DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] ethdev: keep port_id unchanged if obtaining by name failed
       [not found] <CGME20170518121955eucas1p211ce46317d0d74c99db0b94c1662fb59@eucas1p2.samsung.com>
@ 2017-05-18 12:19 ` Ilya Maximets
  2017-06-09 16:34   ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Ilya Maximets @ 2017-05-18 12:19 UTC (permalink / raw)
  To: dev, Thomas Monjalon; +Cc: Heetae Ahn, Ravi Kerur, Ilya Maximets

Currently, 'rte_eth_dev_get_port_by_name' changes transmitted
'port_id' unconditionally. This is undocumented and misleading
behaviour as user may expect unchanged value in case of error.

Otherwise, there is no sense having both return value and
a pointer in the function.

Fixes: 9c5b8d8b9feb ("ethdev: clean port id retrieval when attaching")

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
---
 lib/librte_ether/rte_ethdev.c | 1 -
 lib/librte_ether/rte_ethdev.h | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 83898a8..64aefdd 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -339,7 +339,6 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id)
 	if (!nb_ports)
 		return -ENODEV;
 
-	*port_id = RTE_MAX_ETHPORTS;
 	RTE_ETH_FOREACH_DEV(i) {
 		if (!strncmp(name,
 			rte_eth_dev_data[i].name, strlen(name))) {
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 0f38b45..9a19974 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -4587,7 +4587,7 @@ rte_eth_dev_l2_tunnel_offload_set(uint8_t port_id,
 * @param port_id
 *   pointer to port identifier of the device
 * @return
-*   - (0) if successful.
+*   - (0) if successful and port_id is filled.
 *   - (-ENODEV or -EINVAL) on failure.
 */
 int
-- 
2.7.4

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH] ethdev: keep port_id unchanged if obtaining by name failed
  2017-05-18 12:19 ` [dpdk-dev] [PATCH] ethdev: keep port_id unchanged if obtaining by name failed Ilya Maximets
@ 2017-06-09 16:34   ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2017-06-09 16:34 UTC (permalink / raw)
  To: Ilya Maximets; +Cc: dev, Heetae Ahn, Ravi Kerur

18/05/2017 14:19, Ilya Maximets:
> Currently, 'rte_eth_dev_get_port_by_name' changes transmitted
> 'port_id' unconditionally. This is undocumented and misleading
> behaviour as user may expect unchanged value in case of error.
> 
> Otherwise, there is no sense having both return value and
> a pointer in the function.
> 
> Fixes: 9c5b8d8b9feb ("ethdev: clean port id retrieval when attaching")
> 
> Signed-off-by: Ilya Maximets <i.maximets@samsung.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-06-09 16:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20170518121955eucas1p211ce46317d0d74c99db0b94c1662fb59@eucas1p2.samsung.com>
2017-05-18 12:19 ` [dpdk-dev] [PATCH] ethdev: keep port_id unchanged if obtaining by name failed Ilya Maximets
2017-06-09 16:34   ` Thomas Monjalon

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).