Re: [ovs-dev] [PATCH] netdev-dpdk: Remove uneeded call to rte_eth_dev_count().
On 11/27/2017 04:19 PM, Loftus, Ciara wrote: >> >> The call to rte_eth_dev_count() was added as workaround >> for rte_eth_dev_get_port_by_name() not handling cases >> when there was no DPDK ports. In recent versions of DPDK, >> rte_eth_dev_get_port_by_name() does handle this >> case, so the rte_eth_dev_count() call can be removed. >> >> CC: Ciara Loftus>> Signed-off-by: Kevin Traynor >> --- >> lib/netdev-dpdk.c | 6 ++ >> 1 file changed, 2 insertions(+), 4 deletions(-) >> >> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c >> index faff842..0436ff0 100644 >> --- a/lib/netdev-dpdk.c >> +++ b/lib/netdev-dpdk.c >> @@ -1192,6 +1192,5 @@ netdev_dpdk_process_devargs(struct >> netdev_dpdk *dev, >> dpdk_port_t new_port_id = DPDK_ETH_PORT_ID_INVALID; >> >> -if (!rte_eth_dev_count() >> -|| rte_eth_dev_get_port_by_name(name, _port_id) >> +if (rte_eth_dev_get_port_by_name(name, _port_id) >> || !rte_eth_dev_is_valid_port(new_port_id)) { >> /* Device not found in DPDK, attempt to attach it */ >> @@ -2526,6 +2525,5 @@ netdev_dpdk_detach(struct unixctl_conn *conn, >> int argc OVS_UNUSED, >> ovs_mutex_lock(_mutex); >> >> -if (!rte_eth_dev_count() || rte_eth_dev_get_port_by_name(argv[1], >> - _id)) { >> +if (rte_eth_dev_get_port_by_name(argv[1], _id)) { > > LGTM. DPDK commit f9ae888b1e19 removes the need for the call to count(). > > Acked-by: Ciara Loftus > Thanks - I updated the commit message with that info and the ack in v2. Kevin. > Thanks, > Ciara > >> response = xasprintf("Device '%s' not found in DPDK", argv[1]); >> goto error; >> -- >> 1.8.3.1 > ___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Re: [ovs-dev] [PATCH] netdev-dpdk: Remove uneeded call to rte_eth_dev_count().
> > The call to rte_eth_dev_count() was added as workaround > for rte_eth_dev_get_port_by_name() not handling cases > when there was no DPDK ports. In recent versions of DPDK, > rte_eth_dev_get_port_by_name() does handle this > case, so the rte_eth_dev_count() call can be removed. > > CC: Ciara Loftus> Signed-off-by: Kevin Traynor > --- > lib/netdev-dpdk.c | 6 ++ > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c > index faff842..0436ff0 100644 > --- a/lib/netdev-dpdk.c > +++ b/lib/netdev-dpdk.c > @@ -1192,6 +1192,5 @@ netdev_dpdk_process_devargs(struct > netdev_dpdk *dev, > dpdk_port_t new_port_id = DPDK_ETH_PORT_ID_INVALID; > > -if (!rte_eth_dev_count() > -|| rte_eth_dev_get_port_by_name(name, _port_id) > +if (rte_eth_dev_get_port_by_name(name, _port_id) > || !rte_eth_dev_is_valid_port(new_port_id)) { > /* Device not found in DPDK, attempt to attach it */ > @@ -2526,6 +2525,5 @@ netdev_dpdk_detach(struct unixctl_conn *conn, > int argc OVS_UNUSED, > ovs_mutex_lock(_mutex); > > -if (!rte_eth_dev_count() || rte_eth_dev_get_port_by_name(argv[1], > - _id)) { > +if (rte_eth_dev_get_port_by_name(argv[1], _id)) { LGTM. DPDK commit f9ae888b1e19 removes the need for the call to count(). Acked-by: Ciara Loftus Thanks, Ciara > response = xasprintf("Device '%s' not found in DPDK", argv[1]); > goto error; > -- > 1.8.3.1 ___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev
[ovs-dev] [PATCH] netdev-dpdk: Remove uneeded call to rte_eth_dev_count().
The call to rte_eth_dev_count() was added as workaround for rte_eth_dev_get_port_by_name() not handling cases when there was no DPDK ports. In recent versions of DPDK, rte_eth_dev_get_port_by_name() does handle this case, so the rte_eth_dev_count() call can be removed. CC: Ciara LoftusSigned-off-by: Kevin Traynor --- lib/netdev-dpdk.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index faff842..0436ff0 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -1192,6 +1192,5 @@ netdev_dpdk_process_devargs(struct netdev_dpdk *dev, dpdk_port_t new_port_id = DPDK_ETH_PORT_ID_INVALID; -if (!rte_eth_dev_count() -|| rte_eth_dev_get_port_by_name(name, _port_id) +if (rte_eth_dev_get_port_by_name(name, _port_id) || !rte_eth_dev_is_valid_port(new_port_id)) { /* Device not found in DPDK, attempt to attach it */ @@ -2526,6 +2525,5 @@ netdev_dpdk_detach(struct unixctl_conn *conn, int argc OVS_UNUSED, ovs_mutex_lock(_mutex); -if (!rte_eth_dev_count() || rte_eth_dev_get_port_by_name(argv[1], - _id)) { +if (rte_eth_dev_get_port_by_name(argv[1], _id)) { response = xasprintf("Device '%s' not found in DPDK", argv[1]); goto error; -- 1.8.3.1 ___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev