[ovs-dev,03/25] netdev-offload: Allow offloading to netdev without ifindex.
diff mbox series

Message ID 20200120150830.16262-4-elibr@mellanox.com
State Under Review
Delegated to: Ilya Maximets
Headers show
Series
  • netdev datapath vxlan offload
Related show

Commit Message

Eli Britstein Jan. 20, 2020, 3:08 p.m. UTC
From: Ilya Maximets <i.maximets@ovn.org>

Virtual interfaces like vports or dpdk vhost-user ports has no
proper ifindex, but could support some kind of offloading.

This is a prerequisite for tunneling vport offloading with DPDK
flow API.

Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Acked-by: Eli Britstein <elibr@mellanox.com>
Acked-by: Roni Bar Yanai <roniba@mellanox.com>
Acked-by: Ophir Munk <ophirmu@mellanox.com>
Signed-off-by: Eli Britstein <elibr@mellanox.com>
---
 lib/netdev-offload.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

Comments

0-day Robot Jan. 20, 2020, 4:12 p.m. UTC | #1
Bleep bloop.  Greetings Eli Britstein, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


checkpatch:
WARNING: Unexpected sign-offs from developers who are not authors or co-authors or committers: Eli Britstein <elibr@mellanox.com>
Lines checked: 70, Warnings: 1, Errors: 0


Please check this out.  If you feel there has been an error, please email aconole@redhat.com

Thanks,
0-day Robot

Patch
diff mbox series

diff --git a/lib/netdev-offload.c b/lib/netdev-offload.c
index 82b163e8e..1612fe6b8 100644
--- a/lib/netdev-offload.c
+++ b/lib/netdev-offload.c
@@ -537,10 +537,6 @@  netdev_ports_insert(struct netdev *netdev, const char *dpif_type,
     struct port_to_netdev_data *data;
     int ifindex = netdev_get_ifindex(netdev);
 
-    if (ifindex < 0) {
-        return ENODEV;
-    }
-
     ovs_rwlock_wrlock(&netdev_hmap_rwlock);
     if (netdev_ports_lookup(dpif_port->port_no, dpif_type)) {
         ovs_rwlock_unlock(&netdev_hmap_rwlock);
@@ -550,13 +546,18 @@  netdev_ports_insert(struct netdev *netdev, const char *dpif_type,
     data = xzalloc(sizeof *data);
     data->netdev = netdev_ref(netdev);
     dpif_port_clone(&data->dpif_port, dpif_port);
-    data->ifindex = ifindex;
+
+    if (ifindex >= 0) {
+        data->ifindex = ifindex;
+        hmap_insert(&ifindex_to_port, &data->ifindex_node, ifindex);
+    } else {
+        data->ifindex = -1;
+    }
 
     netdev_set_dpif_type(netdev, dpif_type);
 
     hmap_insert(&port_to_netdev, &data->portno_node,
                 netdev_ports_hash(dpif_port->port_no, dpif_type));
-    hmap_insert(&ifindex_to_port, &data->ifindex_node, ifindex);
     ovs_rwlock_unlock(&netdev_hmap_rwlock);
 
     netdev_init_flow_api(netdev);
@@ -592,7 +593,9 @@  netdev_ports_remove(odp_port_t port_no, const char *dpif_type)
         dpif_port_destroy(&data->dpif_port);
         netdev_close(data->netdev); /* unref and possibly close */
         hmap_remove(&port_to_netdev, &data->portno_node);
-        hmap_remove(&ifindex_to_port, &data->ifindex_node);
+        if (data->ifindex >= 0) {
+            hmap_remove(&ifindex_to_port, &data->ifindex_node);
+        }
         free(data);
         ret = 0;
     }