[ovs-dev] [PATCH v4 1/3] netdev-dpdk: Fix double attaching of virtual devices.

Ben Pfaff blp at ovn.org
Wed May 31 23:19:16 UTC 2017


Thanks Ilya and Billy, I applied this to master.

On Fri, May 26, 2017 at 12:53:04PM +0000, O Mahony, Billy wrote:
> Tested-by: Billy O'Mahony <billy.o.mahony at intel.com>
> Acked-by: Billy O'Mahony <billy.o.mahony at intel.com>
> 
> 
> > -----Original Message-----
> > From: ovs-dev-bounces at openvswitch.org [mailto:ovs-dev-
> > bounces at openvswitch.org] On Behalf Of Ilya Maximets
> > Sent: Friday, May 19, 2017 2:38 PM
> > To: dev at openvswitch.org; Daniele Di Proietto <diproiettod at ovn.org>;
> > Darrell Ball <dball at vmware.com>
> > Cc: Ilya Maximets <i.maximets at samsung.com>; Heetae Ahn
> > <heetae82.ahn at samsung.com>
> > Subject: [ovs-dev] [PATCH v4 1/3] netdev-dpdk: Fix double attaching of
> > virtual devices.
> > 
> > 'devargs' for virtual devices contains not only name but also a list of
> > arguments like this:
> > 
> > 	'net_pcap0,rx_pcap=file_rx.pcap,tx_pcap=file_tx.pcap'
> > 	or
> > 	'eth_af_packet0,iface=eth0'
> > 
> > We must cut off the arguments from this string before calling
> > 'rte_eth_dev_get_port_by_name()' to avoid double attaching of the same
> > device.
> > 
> > CC: Ciara Loftus <ciara.loftus at intel.com>
> > Fixes: 69876ed78611 ("netdev-dpdk: Add support for virtual DPDK PMDs
> > (vdevs)")
> > Signed-off-by: Ilya Maximets <i.maximets at samsung.com>
> > ---
> >  lib/netdev-dpdk.c | 7 +++++--
> >  1 file changed, 5 insertions(+), 2 deletions(-)
> > 
> > diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 9941f88..1586e41
> > 100644
> > --- a/lib/netdev-dpdk.c
> > +++ b/lib/netdev-dpdk.c
> > @@ -1115,10 +1115,12 @@ netdev_dpdk_lookup_by_port_id(int port_id)
> > static int  netdev_dpdk_process_devargs(const char *devargs, char **errp)
> > {
> > +    /* Get the name up to the first comma. */
> > +    char *name = xmemdup0(devargs, strcspn(devargs, ","));
> >      uint8_t new_port_id = UINT8_MAX;
> > 
> >      if (!rte_eth_dev_count()
> > -            || rte_eth_dev_get_port_by_name(devargs, &new_port_id)
> > +            || rte_eth_dev_get_port_by_name(name, &new_port_id)
> >              || !rte_eth_dev_is_valid_port(new_port_id)) {
> >          /* Device not found in DPDK, attempt to attach it */
> >          if (!rte_eth_dev_attach(devargs, &new_port_id)) { @@ -1128,10
> > +1130,11 @@ netdev_dpdk_process_devargs(const char *devargs, char
> > **errp)
> >              /* Attach unsuccessful */
> >              VLOG_WARN_BUF(errp, "Error attaching device '%s' to DPDK",
> >                            devargs);
> > -            return -1;
> > +            new_port_id = UINT8_MAX;
> >          }
> >      }
> > 
> > +    free(name);
> >      return new_port_id;
> >  }
> > 
> > --
> > 2.7.4
> > 
> > _______________________________________________
> > dev mailing list
> > dev at openvswitch.org
> > https://mail.openvswitch.org/mailman/listinfo/ovs-dev
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev


More information about the dev mailing list