Since removal of tunnel vport types, there aren't any vports that
support options.  Let's remove the options-related infrastructure.

Can be reinstated if we ever need a new vport type or if we need extra
options for the existing ones.  The uAPI attribute remains.

Clarification comment is added to highlight that none of the supported
vports support options at the moment.

Note: It is technically possible that someone has an out-of-tree module
named vport-type-N that implements a different vport type and they have
options for this vport type.  However, our message size calculations do
not account for whatever options such a port would have and so it is
dangerous to load such a module without modifying the code in the main
datapath.c, unless the options are smaller than the ones we had for
vxlan.  A more robust solution would be to have a different version of
the entire openvswitch module instead, so the use case of a separate
vport-type-N loaded with the upstream openvswitch module is unlikely.
At this time we're not aware of anyone doing that.  Alternative to
immediate removal would be printing out a deprecation warning whenever
the options setting is attempted.

Signed-off-by: Ilya Maximets <[email protected]>
---
 net/openvswitch/datapath.c | 20 +-------------
 net/openvswitch/vport.c    | 54 --------------------------------------
 net/openvswitch/vport.h    | 14 ----------
 3 files changed, 1 insertion(+), 87 deletions(-)

diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index d86c53fedc1e1..a9c0cc2c702a4 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -1852,7 +1852,6 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct 
genl_info *info)
        /* Set up our datapath device. */
        parms.name = nla_data(a[OVS_DP_ATTR_NAME]);
        parms.type = OVS_VPORT_TYPE_INTERNAL;
-       parms.options = NULL;
        parms.dp = dp;
        parms.port_no = OVSP_LOCAL;
        parms.upcall_portids = a[OVS_DP_ATTR_UPCALL_PID];
@@ -2168,10 +2167,6 @@ static int ovs_vport_cmd_fill_info(struct vport *vport, 
struct sk_buff *skb,
        if (ovs_vport_get_upcall_portids(vport, skb))
                goto nla_put_failure;
 
-       err = ovs_vport_get_options(vport, skb);
-       if (err == -EMSGSIZE)
-               goto error;
-
        genlmsg_end(skb, ovs_header);
        return 0;
 
@@ -2179,7 +2174,6 @@ static int ovs_vport_cmd_fill_info(struct vport *vport, 
struct sk_buff *skb,
        rcu_read_unlock();
 nla_put_failure:
        err = -EMSGSIZE;
-error:
        genlmsg_cancel(skb, ovs_header);
        return err;
 }
@@ -2206,10 +2200,6 @@ static size_t ovs_vport_cmd_msg_size(void)
        /* OVS_VPORT_ATTR_UPCALL_PID */
        msgsize += nla_total_size(nr_cpu_ids * sizeof(u32));
 
-       /* There are no vports supporting OVS_VPORT_ATTR_OPTIONS, so it is
-        * not included in the message size calculation.
-        */
-
        return msgsize;
 }
 
@@ -2361,7 +2351,6 @@ static int ovs_vport_cmd_new(struct sk_buff *skb, struct 
genl_info *info)
        }
 
        parms.name = nla_data(a[OVS_VPORT_ATTR_NAME]);
-       parms.options = a[OVS_VPORT_ATTR_OPTIONS];
        parms.dp = dp;
        parms.port_no = port_no;
        parms.upcall_portids = a[OVS_VPORT_ATTR_UPCALL_PID];
@@ -2422,13 +2411,6 @@ static int ovs_vport_cmd_set(struct sk_buff *skb, struct 
genl_info *info)
                goto exit_unlock_free;
        }
 
-       if (a[OVS_VPORT_ATTR_OPTIONS]) {
-               err = ovs_vport_set_options(vport, a[OVS_VPORT_ATTR_OPTIONS]);
-               if (err)
-                       goto exit_unlock_free;
-       }
-
-
        if (a[OVS_VPORT_ATTR_UPCALL_PID]) {
                struct nlattr *ids = a[OVS_VPORT_ATTR_UPCALL_PID];
 
@@ -2602,7 +2584,7 @@ static const struct nla_policy 
vport_policy[OVS_VPORT_ATTR_MAX + 1] = {
        [OVS_VPORT_ATTR_PORT_NO] = { .type = NLA_U32 },
        [OVS_VPORT_ATTR_TYPE] = { .type = NLA_U32 },
        [OVS_VPORT_ATTR_UPCALL_PID] = { .type = NLA_UNSPEC },
-       [OVS_VPORT_ATTR_OPTIONS] = { .type = NLA_NESTED },
+       [OVS_VPORT_ATTR_OPTIONS] = { .type = NLA_NESTED }, /* Unused. */
        [OVS_VPORT_ATTR_IFINDEX] = NLA_POLICY_MIN(NLA_S32, 0),
        [OVS_VPORT_ATTR_NETNSID] = { .type = NLA_S32 },
        [OVS_VPORT_ATTR_UPCALL_STATS] = { .type = NLA_NESTED },
diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c
index 56b2e2d1a749f..7a9caacfd6ac2 100644
--- a/net/openvswitch/vport.c
+++ b/net/openvswitch/vport.c
@@ -239,22 +239,6 @@ struct vport *ovs_vport_add(const struct vport_parms 
*parms)
                return ERR_PTR(-EAGAIN);
 }
 
-/**
- *     ovs_vport_set_options - modify existing vport device (for kernel 
callers)
- *
- * @vport: vport to modify.
- * @options: New configuration.
- *
- * Modifies an existing device with the specified configuration (which is
- * dependent on device type).  ovs_mutex must be held.
- */
-int ovs_vport_set_options(struct vport *vport, struct nlattr *options)
-{
-       if (!vport->ops->set_options)
-               return -EOPNOTSUPP;
-       return vport->ops->set_options(vport, options);
-}
-
 /**
  *     ovs_vport_del - delete existing vport device
  *
@@ -348,44 +332,6 @@ int ovs_vport_get_upcall_stats(struct vport *vport, struct 
sk_buff *skb)
        return 0;
 }
 
-/**
- *     ovs_vport_get_options - retrieve device options
- *
- * @vport: vport from which to retrieve the options.
- * @skb: sk_buff where options should be appended.
- *
- * Retrieves the configuration of the given device, appending an
- * %OVS_VPORT_ATTR_OPTIONS attribute that in turn contains nested
- * vport-specific attributes to @skb.
- *
- * Returns 0 if successful, -EMSGSIZE if @skb has insufficient room, or another
- * negative error code if a real error occurred.  If an error occurs, @skb is
- * left unmodified.
- *
- * Must be called with ovs_mutex or rcu_read_lock.
- */
-int ovs_vport_get_options(const struct vport *vport, struct sk_buff *skb)
-{
-       struct nlattr *nla;
-       int err;
-
-       if (!vport->ops->get_options)
-               return 0;
-
-       nla = nla_nest_start_noflag(skb, OVS_VPORT_ATTR_OPTIONS);
-       if (!nla)
-               return -EMSGSIZE;
-
-       err = vport->ops->get_options(vport, skb);
-       if (err) {
-               nla_nest_cancel(skb, nla);
-               return err;
-       }
-
-       nla_nest_end(skb, nla);
-       return 0;
-}
-
 /**
  *     ovs_vport_set_upcall_portids - set upcall portids of @vport.
  *
diff --git a/net/openvswitch/vport.h b/net/openvswitch/vport.h
index 9f67b9dd49f98..636788b59907c 100644
--- a/net/openvswitch/vport.h
+++ b/net/openvswitch/vport.h
@@ -34,9 +34,6 @@ void ovs_vport_get_stats(struct vport *, struct 
ovs_vport_stats *);
 
 int ovs_vport_get_upcall_stats(struct vport *vport, struct sk_buff *skb);
 
-int ovs_vport_set_options(struct vport *, struct nlattr *options);
-int ovs_vport_get_options(const struct vport *, struct sk_buff *);
-
 int ovs_vport_set_upcall_portids(struct vport *, const struct nlattr *pids);
 int ovs_vport_get_upcall_portids(const struct vport *, struct sk_buff *);
 u32 ovs_vport_find_upcall_portid(const struct vport *, struct sk_buff *);
@@ -92,8 +89,6 @@ struct vport {
  *
  * @name: New vport's name.
  * @type: New vport's type.
- * @options: %OVS_VPORT_ATTR_OPTIONS attribute from Netlink message, %NULL if
- * none was supplied.
  * @desired_ifindex: New vport's ifindex.
  * @dp: New vport's datapath.
  * @port_no: New vport's port number.
@@ -104,7 +99,6 @@ struct vport_parms {
        const char *name;
        enum ovs_vport_type type;
        int desired_ifindex;
-       struct nlattr *options;
 
        /* For ovs_vport_alloc(). */
        struct datapath *dp;
@@ -120,11 +114,6 @@ struct vport_parms {
  * a new vport allocated with ovs_vport_alloc(), otherwise an ERR_PTR() value.
  * @destroy: Destroys a vport.  Must call vport_free() on the vport but not
  * before an RCU grace period has elapsed.
- * @set_options: Modify the configuration of an existing vport.  May be %NULL
- * if modification is not supported.
- * @get_options: Appends vport-specific attributes for the configuration of an
- * existing vport to a &struct sk_buff.  May be %NULL for a vport that does not
- * have any configuration.
  * @send: Send a packet on the device.
  * zero for dropped packets or negative for error.
  * @owner: Module that implements this vport type.
@@ -137,9 +126,6 @@ struct vport_ops {
        struct vport *(*create)(const struct vport_parms *);
        void (*destroy)(struct vport *);
 
-       int (*set_options)(struct vport *, struct nlattr *);
-       int (*get_options)(const struct vport *, struct sk_buff *);
-
        int (*send)(struct sk_buff *skb);
        struct module *owner;
        struct list_head list;
-- 
2.53.0


Reply via email to