Ferruh, Since in the older patch we had introduced rte_eth_dev_get_by_name patch and had been merged to dpdk-next-net, the current patch failed for the build when I submitted the patch. Is there a way to enforce it to dpdk-next-net ? On Thu, Feb 3, 2022 at 1:54 PM Kumara Parameshwaran < kumaraparamesh92@gmail.com> wrote: > From: Kumara Parameshwaran > > Make changes in PMDs to use the new function where > rte_eth_dev_get_port_by_name is used to get port_id > to access rte_eth_devices > > Signed-off-by: Kumara Parameshwaran > --- > v1 > * Replace rte_eth_get_get_port_by_name in PMDs with rte_eth_dev_get_by_name > where port_id is used to retrieve rte_eth_dev data structure > > drivers/net/bonding/rte_eth_bond_api.c | 10 +++++----- > drivers/net/ipn3ke/ipn3ke_ethdev.c | 9 +++------ > drivers/net/memif/rte_eth_memif.c | 7 ++----- > drivers/net/softnic/rte_eth_softnic_thread.c | 8 +++----- > drivers/net/tap/rte_eth_tap.c | 7 ++----- > 5 files changed, 15 insertions(+), 26 deletions(-) > > diff --git a/drivers/net/bonding/rte_eth_bond_api.c > b/drivers/net/bonding/rte_eth_bond_api.c > index 8840d9e17b..b78867b125 100644 > --- a/drivers/net/bonding/rte_eth_bond_api.c > +++ b/drivers/net/bonding/rte_eth_bond_api.c > @@ -151,8 +151,8 @@ int > rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id) > { > struct bond_dev_private *internals; > + struct rte_eth_dev *bond_dev; > char devargs[52]; > - uint16_t port_id; > int ret; > > if (name == NULL) { > @@ -169,8 +169,8 @@ rte_eth_bond_create(const char *name, uint8_t mode, > uint8_t socket_id) > if (ret) > return ret; > > - ret = rte_eth_dev_get_port_by_name(name, &port_id); > - RTE_ASSERT(!ret); > + bond_dev = rte_eth_dev_get_by_name(name); > + RTE_ASSERT(bond_dev); > > /* > * To make bond_ethdev_configure() happy we need to free the > @@ -178,11 +178,11 @@ rte_eth_bond_create(const char *name, uint8_t mode, > uint8_t socket_id) > * > * Also see comment in bond_ethdev_configure(). > */ > - internals = rte_eth_devices[port_id].data->dev_private; > + internals = bond_dev->data->dev_private; > rte_kvargs_free(internals->kvlist); > internals->kvlist = NULL; > > - return port_id; > + return bond_dev->data->port_id; > } > > int > diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.c > b/drivers/net/ipn3ke/ipn3ke_ethdev.c > index 014e438dd5..550a8b0466 100644 > --- a/drivers/net/ipn3ke/ipn3ke_ethdev.c > +++ b/drivers/net/ipn3ke/ipn3ke_ethdev.c > @@ -469,7 +469,6 @@ static int ipn3ke_vswitch_probe(struct rte_afu_device > *afu_dev) > struct ipn3ke_hw *hw; > struct rte_eth_dev *i40e_eth; > struct ifpga_rawdev *ifpga_dev; > - uint16_t port_id; > int i, j, retval; > char *fvl_bdf; > > @@ -519,14 +518,12 @@ static int ipn3ke_vswitch_probe(struct > rte_afu_device *afu_dev) > > for (; j < 8; j++) { > fvl_bdf = ifpga_dev->fvl_bdf[j]; > - retval = rte_eth_dev_get_port_by_name(fvl_bdf, > - &port_id); > - if (retval) { > + i40e_eth = rte_eth_dev_get_by_name(fvl_bdf); > + if (!i40e_eth) { > continue; > } else { > - i40e_eth = &rte_eth_devices[port_id]; > rpst.i40e_pf_eth = i40e_eth; > - rpst.i40e_pf_eth_port_id = port_id; > + rpst.i40e_pf_eth_port_id = > i40e_eth->data->port_id; > > j++; > break; > diff --git a/drivers/net/memif/rte_eth_memif.c > b/drivers/net/memif/rte_eth_memif.c > index d3459c5007..5700c6a2bf 100644 > --- a/drivers/net/memif/rte_eth_memif.c > +++ b/drivers/net/memif/rte_eth_memif.c > @@ -88,17 +88,14 @@ memif_mp_send_region(const struct rte_mp_msg *msg, > const void *peer) > const struct mp_region_msg *msg_param = (const struct > mp_region_msg *)msg->param; > struct rte_mp_msg reply; > struct mp_region_msg *reply_param = (struct mp_region_msg > *)reply.param; > - uint16_t port_id; > - int ret; > > /* Get requested port */ > - ret = rte_eth_dev_get_port_by_name(msg_param->port_name, &port_id); > - if (ret) { > + dev = rte_eth_dev_get_by_name(msg_param->port_name); > + if (!dev) { > MIF_LOG(ERR, "Failed to get port id for %s", > msg_param->port_name); > return -1; > } > - dev = &rte_eth_devices[port_id]; > proc_private = dev->process_private; > > memset(&reply, 0, sizeof(reply)); > diff --git a/drivers/net/softnic/rte_eth_softnic_thread.c > b/drivers/net/softnic/rte_eth_softnic_thread.c > index a8c26a5b23..4a9f2fa6a4 100644 > --- a/drivers/net/softnic/rte_eth_softnic_thread.c > +++ b/drivers/net/softnic/rte_eth_softnic_thread.c > @@ -129,14 +129,12 @@ thread_sc_service_up(struct pmd_internals *softnic, > uint32_t thread_id) > struct softnic_thread *t = &softnic->thread[thread_id]; > struct rte_eth_dev *dev; > int status; > - uint16_t port_id; > > /* service params */ > - status = rte_eth_dev_get_port_by_name(softnic->params.name, > &port_id); > - if (status) > - return status; > + dev = rte_eth_dev_get_by_name(softnic->params.name); > + if (!dev) > + return -EINVAL; > > - dev = &rte_eth_devices[port_id]; > snprintf(service_params.name, sizeof(service_params.name), > "%s_%u", > softnic->params.name, > thread_id); > diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c > index 111037de65..bc3d56a311 100644 > --- a/drivers/net/tap/rte_eth_tap.c > +++ b/drivers/net/tap/rte_eth_tap.c > @@ -2428,19 +2428,16 @@ tap_mp_sync_queues(const struct rte_mp_msg > *request, const void *peer) > (const struct ipc_queues *)request->param; > struct ipc_queues *reply_param = > (struct ipc_queues *)reply.param; > - uint16_t port_id; > int queue; > - int ret; > > /* Get requested port */ > TAP_LOG(DEBUG, "Received IPC request for %s", > request_param->port_name); > - ret = rte_eth_dev_get_port_by_name(request_param->port_name, > &port_id); > - if (ret) { > + dev = rte_eth_dev_get_by_name(request_param->port_name); > + if (!dev) { > TAP_LOG(ERR, "Failed to get port id for %s", > request_param->port_name); > return -1; > } > - dev = &rte_eth_devices[port_id]; > process_private = dev->process_private; > > /* Fill file descriptors for all queues */ > -- > 2.17.1 > >