diff mbox series

[ovs-dev,V2,07/14] netdev-offload: Allow offloading to netdev without ifindex.

Message ID 20210210152702.4898-8-elibr@nvidia.com
State New
Headers show
Series Netdev vxlan-decap offload | expand

Commit Message

Eli Britstein Feb. 10, 2021, 3:26 p.m. UTC
From: Ilya Maximets <i.maximets@ovn.org>

Virtual interfaces like vports or dpdk vhost-user ports have no
proper ifindex, while still supporting some offloads.

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

Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: Eli Britstein <elibr@nvidia.com>
Reviewed-by: Gaetan Rivet <gaetanr@nvidia.com>
---
 lib/netdev-offload.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

Comments

0-day Robot Feb. 10, 2021, 9:20 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@nvidia.com>
Lines checked: 68, 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
diff mbox series

Patch

diff --git a/lib/netdev-offload.c b/lib/netdev-offload.c
index e5d24651f..9234423e3 100644
--- a/lib/netdev-offload.c
+++ b/lib/netdev-offload.c
@@ -561,10 +561,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);
@@ -574,13 +570,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);
@@ -616,7 +617,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;
     }