[ovs-dev] [PATCH] [PATCH upstream] net-ovs: Remove vport_ops init() and exit().
Pravin B Shelar
pshelar at nicira.com
Thu Nov 17 00:16:07 UTC 2011
Upstream OVS vports types (internal and netdev) does not make use of
vport_ops init() and exit() interface. So It makes sense to remove it
from upstream OVS.
Signed-off-by: Pravin B Shelar <pshelar at nicira.com>
---
net/openvswitch/vport.c | 58 +++++------------------------------------------
net/openvswitch/vport.h | 6 -----
2 files changed, 6 insertions(+), 58 deletions(-)
diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c
index a3bf980..c9488e0 100644
--- a/net/openvswitch/vport.c
+++ b/net/openvswitch/vport.c
@@ -34,14 +34,11 @@
/* List of statically compiled vport implementations. Don't forget to also
* add yours to the list at the bottom of vport.h. */
-static const struct vport_ops *base_vport_ops_list[] = {
+static const struct vport_ops *vport_ops_list[] = {
&netdev_vport_ops,
&internal_vport_ops,
};
-static const struct vport_ops **vport_ops_list;
-static int n_vport_types;
-
/* Protected by RCU read lock for reading, RTNL lock for writing. */
static struct hlist_head *dev_table;
#define VPORT_HASH_BUCKETS 1024
@@ -49,68 +46,25 @@ static struct hlist_head *dev_table;
/**
* vport_init - initialize vport subsystem
*
- * Called at module load time to initialize the vport subsystem and any
- * compiled in vport types.
+ * Called at module load time to initialize the vport subsystem.
*/
int vport_init(void)
{
- int err;
- int i;
-
dev_table = kzalloc(VPORT_HASH_BUCKETS * sizeof(struct hlist_head),
GFP_KERNEL);
- if (!dev_table) {
- err = -ENOMEM;
- goto error;
- }
-
- vport_ops_list = kmalloc(ARRAY_SIZE(base_vport_ops_list) *
- sizeof(struct vport_ops *), GFP_KERNEL);
- if (!vport_ops_list) {
- err = -ENOMEM;
- goto error_dev_table;
- }
-
- for (i = 0; i < ARRAY_SIZE(base_vport_ops_list); i++) {
- const struct vport_ops *new_ops = base_vport_ops_list[i];
-
- if (new_ops->init)
- err = new_ops->init();
- else
- err = 0;
-
- if (!err)
- vport_ops_list[n_vport_types++] = new_ops;
- else {
- vport_exit();
- goto error;
- }
- }
+ if (!dev_table)
+ return -ENOMEM;
return 0;
-
-error_dev_table:
- kfree(dev_table);
-error:
- return err;
}
/**
* vport_exit - shutdown vport subsystem
*
- * Called at module exit time to shutdown the vport subsystem and any
- * initialized vport types.
+ * Called at module exit time to shutdown the vport subsystem.
*/
void vport_exit(void)
{
- int i;
-
- for (i = 0; i < n_vport_types; i++) {
- if (vport_ops_list[i]->exit)
- vport_ops_list[i]->exit();
- }
-
- kfree(vport_ops_list);
kfree(dev_table);
}
@@ -213,7 +167,7 @@ struct vport *vport_add(const struct vport_parms *parms)
ASSERT_RTNL();
- for (i = 0; i < n_vport_types; i++) {
+ for (i = 0; i < ARRAY_SIZE(vport_ops_list); i++) {
if (vport_ops_list[i]->type == parms->type) {
vport = vport_ops_list[i]->create(parms);
if (IS_ERR(vport)) {
diff --git a/net/openvswitch/vport.h b/net/openvswitch/vport.h
index 8b64fd9..f5ef1f8 100644
--- a/net/openvswitch/vport.h
+++ b/net/openvswitch/vport.h
@@ -119,8 +119,6 @@ struct vport_parms {
* struct vport_ops - definition of a type of virtual port
*
* @type: %OVS_VPORT_TYPE_* value for this type of virtual port.
- * @init: Called at module initialization.
- * @exit: Called at module unload.
* @create: Create a new vport configured as specified. On success returns
* a new vport allocated with vport_alloc(), otherwise an ERR_PTR() value.
* @destroy: Destroys a vport. Must call vport_free() on the vport but not
@@ -139,10 +137,6 @@ struct vport_parms {
struct vport_ops {
enum ovs_vport_type type;
- /* Called at module init and exit respectively. */
- int (*init)(void);
- void (*exit)(void);
-
/* Called with RTNL lock. */
struct vport *(*create)(const struct vport_parms *);
void (*destroy)(struct vport *);
--
1.7.1
More information about the dev
mailing list