datapath: Change vport type from string to integer enumeration.
[sliver-openvswitch.git] / datapath / vport.c
index 9ac216c..2d18f28 100644 (file)
@@ -136,26 +136,6 @@ error:
        return err;
 }
 
-static void vport_del_all(void)
-{
-       int i;
-
-       rtnl_lock();
-       vport_lock();
-
-       for (i = 0; i < VPORT_HASH_BUCKETS; i++) {
-               struct hlist_head *bucket = &dev_table[i];
-               struct vport *vport;
-               struct hlist_node *node, *next;
-
-               hlist_for_each_entry_safe(vport, node, next, bucket, hash_node)
-                       vport_del(vport);
-       }
-
-       vport_unlock();
-       rtnl_unlock();
-}
-
 /**
  *     vport_exit - shutdown vport subsystem
  *
@@ -166,8 +146,6 @@ void vport_exit(void)
 {
        int i;
 
-       vport_del_all();
-
        for (i = 0; i < n_vport_types; i++) {
                if (vport_ops_list[i]->exit)
                        vport_ops_list[i]->exit();
@@ -591,7 +569,7 @@ struct vport *vport_add(const struct vport_parms *parms)
        ASSERT_VPORT();
 
        for (i = 0; i < n_vport_types; i++) {
-               if (!strcmp(vport_ops_list[i]->type, parms->type)) {
+               if (vport_ops_list[i]->type == parms->type) {
                        vport = vport_ops_list[i]->create(parms);
                        if (IS_ERR(vport)) {
                                err = PTR_ERR(vport);
@@ -721,9 +699,7 @@ int vport_set_stats(struct vport *vport, struct rtnl_link_stats64 *stats)
                spin_unlock_bh(&vport->stats_lock);
 
                return 0;
-       } else if (vport->ops->set_stats)
-               return vport->ops->set_stats(vport, stats);
-       else
+       } else
                return -EOPNOTSUPP;
 }
 
@@ -746,9 +722,9 @@ const char *vport_get_name(const struct vport *vport)
  * @vport: vport from which to retrieve the type.
  *
  * Retrieves the type of the given device.  Either RTNL lock or rcu_read_lock
- * must be held for the entire duration that the type is in use.
+ * must be held.
  */
-const char *vport_get_type(const struct vport *vport)
+enum odp_vport_type vport_get_type(const struct vport *vport)
 {
        return vport->ops->type;
 }