diff mbox series

[ovs-dev] netdev-dpdk: Fix to set attached flag if valid DPDK port was found

Message ID 20200407065556.13176-1-somnath.kotur@broadcom.com
State Rejected
Delegated to: Ilya Maximets
Headers show
Series [ovs-dev] netdev-dpdk: Fix to set attached flag if valid DPDK port was found | expand

Commit Message

Li,Rongqing via dev April 7, 2020, 6:55 a.m. UTC
The 'attached' flag for a netdev_dpdk device is set only when it is
attached via rte_dev_probe(). However, when the DPDK port probe was
successfully done as part of vswitchd bring up (if the device was bound to
igb_uio/vfio-pci prior to bring up), then this flag is not set.
When netdev_dpdk_process_devargs() finds this already probed device as part
of 'ovs-vsctl add port' cmd and returns it with a port_id, the
'attached' flag for the 'dev' is not set which can lead to improper cleanup
while destroying the device later on in netdev_dpdk_destruct.

Fixes: 40e940e4391f ("netdev-dpdk: support port representors")

Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 lib/netdev-dpdk.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Ilya Maximets April 7, 2020, 8:50 a.m. UTC | #1
On 4/7/20 8:55 AM, Somnath Kotur via dev wrote:
> The 'attached' flag for a netdev_dpdk device is set only when it is
> attached via rte_dev_probe(). However, when the DPDK port probe was
> successfully done as part of vswitchd bring up (if the device was bound to
> igb_uio/vfio-pci prior to bring up), then this flag is not set.
> When netdev_dpdk_process_devargs() finds this already probed device as part
> of 'ovs-vsctl add port' cmd and returns it with a port_id, the
> 'attached' flag for the 'dev' is not set which can lead to improper cleanup
> while destroying the device later on in netdev_dpdk_destruct.

It's not a bug.  It's intentional that we're setting 'attached' flag only
for devices that OVS really attached by itself.  We're not responsible for
devices that were probed on the initialization stage.

See the following thread with a similar patch for details:
    https://patchwork.ozlabs.org/patch/1191742/

We might want to improve some comments around this flag, though.

Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 6187129..f47d514 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -1842,7 +1842,11 @@  netdev_dpdk_process_devargs(struct netdev_dpdk *dev,
                     new_port_id = DPDK_ETH_PORT_ID_INVALID;
                 }
             }
-        }
+    } else if (!dev->attached) {  /* Device found in DPDK, check if
+                                   * attached and set if not
+                                   */
+               dev->attached = true;
+       }
     }
 
     if (new_port_id == DPDK_ETH_PORT_ID_INVALID) {