Since removal of legacy tunnel vport types only the built-in ones remain. So, there is no need for the extra infrastructure for dynamic module loading. Can be reinstated in the future if we need a new vport type.
Note: It is technically possible that someone has an out-of-tree module named vport-type-N that implements a different vport type. At this time we're not aware of anyone doing that. People running out-of-tree modules normally just have an out-of-tree openvswitch module as a whole. And there are actually no supported out-of-tree implementations of the openvswitch module known to the community. Alternative to immediate removal would be printing out a deprecation warning whenever a vport module is loaded, but I'm not sure if we need it at this time. Signed-off-by: Ilya Maximets <[email protected]> --- net/openvswitch/vport.c | 22 ++-------------------- net/openvswitch/vport.h | 9 +-------- 2 files changed, 3 insertions(+), 28 deletions(-) diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c index 7a9caacfd6ac2..ef2fff4353c0a 100644 --- a/net/openvswitch/vport.c +++ b/net/openvswitch/vport.c @@ -57,7 +57,7 @@ static struct hlist_head *hash_bucket(const struct net *net, const char *name) return &dev_table[hash & (VPORT_HASH_BUCKETS - 1)]; } -int __ovs_vport_ops_register(struct vport_ops *ops) +int ovs_vport_ops_register(struct vport_ops *ops) { int err = -EEXIST; struct vport_ops *o; @@ -73,7 +73,6 @@ int __ovs_vport_ops_register(struct vport_ops *ops) ovs_unlock(); return err; } -EXPORT_SYMBOL_GPL(__ovs_vport_ops_register); void ovs_vport_ops_unregister(struct vport_ops *ops) { @@ -81,7 +80,6 @@ void ovs_vport_ops_unregister(struct vport_ops *ops) list_del(&ops->list); ovs_unlock(); } -EXPORT_SYMBOL_GPL(ovs_vport_ops_unregister); /** * ovs_vport_locate - find a port that has already been created @@ -210,12 +208,8 @@ struct vport *ovs_vport_add(const struct vport_parms *parms) if (ops) { struct hlist_head *bucket; - if (!try_module_get(ops->owner)) - return ERR_PTR(-EAFNOSUPPORT); - vport = ops->create(parms); if (IS_ERR(vport)) { - module_put(ops->owner); return vport; } @@ -225,18 +219,7 @@ struct vport *ovs_vport_add(const struct vport_parms *parms) return vport; } - /* Unlock to attempt module load and return -EAGAIN if load - * was successful as we need to restart the port addition - * workflow. - */ - ovs_unlock(); - request_module("vport-type-%d", parms->type); - ovs_lock(); - - if (!ovs_vport_lookup(parms)) - return ERR_PTR(-EAFNOSUPPORT); - else - return ERR_PTR(-EAGAIN); + return ERR_PTR(-EAFNOSUPPORT); } /** @@ -250,7 +233,6 @@ struct vport *ovs_vport_add(const struct vport_parms *parms) void ovs_vport_del(struct vport *vport) { hlist_del_rcu(&vport->hash_node); - module_put(vport->ops->owner); vport->ops->destroy(vport); } diff --git a/net/openvswitch/vport.h b/net/openvswitch/vport.h index 636788b59907c..930f1ccc85581 100644 --- a/net/openvswitch/vport.h +++ b/net/openvswitch/vport.h @@ -116,7 +116,6 @@ struct vport_parms { * before an RCU grace period has elapsed. * @send: Send a packet on the device. * zero for dropped packets or negative for error. - * @owner: Module that implements this vport type. * @list: List entry in the global list of vport types. */ struct vport_ops { @@ -127,7 +126,6 @@ struct vport_ops { void (*destroy)(struct vport *); int (*send)(struct sk_buff *skb); - struct module *owner; struct list_head list; }; @@ -191,12 +189,7 @@ static inline const char *ovs_vport_name(struct vport *vport) return vport->dev->name; } -int __ovs_vport_ops_register(struct vport_ops *ops); -#define ovs_vport_ops_register(ops) \ - ({ \ - (ops)->owner = THIS_MODULE; \ - __ovs_vport_ops_register(ops); \ - }) +int ovs_vport_ops_register(struct vport_ops *ops); void ovs_vport_ops_unregister(struct vport_ops *ops); void ovs_vport_send(struct vport *vport, struct sk_buff *skb, u8 mac_proto); -- 2.53.0

