From: Ilya Maximets Date: Thu, 18 May 2017 12:19:40 +0000 (+0300) Subject: ethdev: keep port id unchanged if obtaining by name failed X-Git-Tag: spdx-start~3182 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=a6793d47f328354d0a3a3984060bbfb967e4f91d;p=dpdk.git ethdev: keep port id unchanged if obtaining by name failed 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 --- diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 83898a8f75..64aefdd2c4 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 121058c120..2784ad17e7 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