* [dpdk-dev] [PATCH] ethdev: revert use device name from device structure
@ 2017-09-22 11:30 Ferruh Yigit
2017-09-22 14:57 ` Adrien Mazarguil
0 siblings, 1 reply; 4+ messages in thread
From: Ferruh Yigit @ 2017-09-22 11:30 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev, Adrien Mazarguil, Ferruh Yigit
This reverts commit a1e7c17555e8f77d520ba5f06ed26c00e77a2bd1.
Original commit assumes there is 1:1 mapping between physical device and
ethdev port, so that device name can be used per port instead of ethdev
name field.
But one physical device may have multiple ethdev ports and each port
needs its own unique name.
One issue reported here:
http://dpdk.org/ml/archives/users/2017-September/002484.html
So reverting back the commit to continue using ethdev name field per
port.
Reported-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
lib/librte_ether/rte_ethdev.c | 25 ++++++++++---------------
1 file changed, 10 insertions(+), 15 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 6016fd9be..c944b9fb1 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -177,11 +177,9 @@ rte_eth_dev_allocated(const char *name)
unsigned i;
for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
- if (rte_eth_devices[i].state == RTE_ETH_DEV_ATTACHED &&
- rte_eth_devices[i].device) {
- if (!strcmp(rte_eth_devices[i].device->name, name))
- return &rte_eth_devices[i];
- }
+ if ((rte_eth_devices[i].state == RTE_ETH_DEV_ATTACHED) &&
+ strcmp(rte_eth_devices[i].data->name, name) == 0)
+ return &rte_eth_devices[i];
}
return NULL;
}
@@ -318,7 +316,7 @@ rte_eth_dev_count(void)
int
rte_eth_dev_get_name_by_port(uint8_t port_id, char *name)
{
- const char *tmp;
+ char *tmp;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
@@ -329,7 +327,7 @@ rte_eth_dev_get_name_by_port(uint8_t port_id, char *name)
/* shouldn't check 'rte_eth_devices[i].data',
* because it might be overwritten by VDEV PMD */
- tmp = rte_eth_devices[port_id].device->name;
+ tmp = rte_eth_dev_data[port_id].name;
strcpy(name, tmp);
return 0;
}
@@ -337,7 +335,6 @@ rte_eth_dev_get_name_by_port(uint8_t port_id, char *name)
int
rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id)
{
- int ret;
int i;
if (name == NULL) {
@@ -346,13 +343,11 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id)
}
RTE_ETH_FOREACH_DEV(i) {
- if (!rte_eth_devices[i].device)
- continue;
+ if (!strncmp(name,
+ rte_eth_dev_data[i].name, strlen(name))) {
- ret = strncmp(name, rte_eth_devices[i].device->name,
- strlen(name));
- if (ret == 0) {
*port_id = i;
+
return 0;
}
}
@@ -435,8 +430,8 @@ rte_eth_dev_detach(uint8_t port_id, char *name)
if (rte_eth_dev_is_detachable(port_id))
goto err;
- snprintf(name, RTE_DEV_NAME_MAX_LEN, "%s",
- rte_eth_devices[port_id].device->name);
+ snprintf(name, sizeof(rte_eth_devices[port_id].data->name),
+ "%s", rte_eth_devices[port_id].data->name);
ret = rte_eal_dev_detach(rte_eth_devices[port_id].device);
if (ret < 0)
--
2.13.5
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] ethdev: revert use device name from device structure
2017-09-22 11:30 [dpdk-dev] [PATCH] ethdev: revert use device name from device structure Ferruh Yigit
@ 2017-09-22 14:57 ` Adrien Mazarguil
2017-10-11 21:56 ` Thomas Monjalon
0 siblings, 1 reply; 4+ messages in thread
From: Adrien Mazarguil @ 2017-09-22 14:57 UTC (permalink / raw)
To: Ferruh Yigit; +Cc: Thomas Monjalon, dev
On Fri, Sep 22, 2017 at 12:30:07PM +0100, Ferruh Yigit wrote:
> This reverts commit a1e7c17555e8f77d520ba5f06ed26c00e77a2bd1.
>
> Original commit assumes there is 1:1 mapping between physical device and
> ethdev port, so that device name can be used per port instead of ethdev
> name field.
>
> But one physical device may have multiple ethdev ports and each port
> needs its own unique name.
>
> One issue reported here:
> http://dpdk.org/ml/archives/users/2017-September/002484.html
>
> So reverting back the commit to continue using ethdev name field per
> port.
>
> Reported-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
--
Adrien Mazarguil
6WIND
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] ethdev: revert use device name from device structure
2017-09-22 14:57 ` Adrien Mazarguil
@ 2017-10-11 21:56 ` Thomas Monjalon
2017-10-11 22:44 ` Ferruh Yigit
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Monjalon @ 2017-10-11 21:56 UTC (permalink / raw)
To: Ferruh Yigit, ciara.loftus
Cc: dev, Adrien Mazarguil, ktraynor, gaetan.rivet, jblunck
22/09/2017 16:57, Adrien Mazarguil:
> On Fri, Sep 22, 2017 at 12:30:07PM +0100, Ferruh Yigit wrote:
> > This reverts commit a1e7c17555e8f77d520ba5f06ed26c00e77a2bd1.
> >
> > Original commit assumes there is 1:1 mapping between physical device and
> > ethdev port, so that device name can be used per port instead of ethdev
> > name field.
> >
> > But one physical device may have multiple ethdev ports and each port
> > needs its own unique name.
> >
> > One issue reported here:
> > http://dpdk.org/ml/archives/users/2017-September/002484.html
> >
> > So reverting back the commit to continue using ethdev name field per
> > port.
> >
> > Reported-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
> > Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
>
> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
I agree we must keep separate the device name and the ethdev port name.
About the OVS issue (Cc'ing people), it would be valuable to work
in DPDK to establish a reliable syntax to describe a device
or a port. This is what we call devargs ; it is still a work in progress.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] ethdev: revert use device name from device structure
2017-10-11 21:56 ` Thomas Monjalon
@ 2017-10-11 22:44 ` Ferruh Yigit
0 siblings, 0 replies; 4+ messages in thread
From: Ferruh Yigit @ 2017-10-11 22:44 UTC (permalink / raw)
To: Thomas Monjalon, ciara.loftus
Cc: dev, Adrien Mazarguil, ktraynor, gaetan.rivet, jblunck
On 10/11/2017 10:56 PM, Thomas Monjalon wrote:
> 22/09/2017 16:57, Adrien Mazarguil:
>> On Fri, Sep 22, 2017 at 12:30:07PM +0100, Ferruh Yigit wrote:
>>> This reverts commit a1e7c17555e8f77d520ba5f06ed26c00e77a2bd1.
>>>
>>> Original commit assumes there is 1:1 mapping between physical device and
>>> ethdev port, so that device name can be used per port instead of ethdev
>>> name field.
>>>
>>> But one physical device may have multiple ethdev ports and each port
>>> needs its own unique name.
>>>
>>> One issue reported here:
>>> http://dpdk.org/ml/archives/users/2017-September/002484.html
>>>
>>> So reverting back the commit to continue using ethdev name field per
>>> port.
>>>
>>> Reported-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
>>> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
>>
>> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
>
> Acked-by: Thomas Monjalon <thomas@monjalon.net>
Applied to dpdk-next-net/master, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-10-11 22:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-22 11:30 [dpdk-dev] [PATCH] ethdev: revert use device name from device structure Ferruh Yigit
2017-09-22 14:57 ` Adrien Mazarguil
2017-10-11 21:56 ` Thomas Monjalon
2017-10-11 22:44 ` Ferruh Yigit
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).