[dpdk-dev] [PATCH v9 4/8] ethdev: make get port by name and get name by port public

2016-06-14 Thread Thomas Monjalon
2016-06-14 10:38, Reshma Pattan:
> Converted rte_eth_dev_get_port_by_name to a public API.
> Converted rte_eth_dev_get_name_by_port to a public API.

No justification?

It was planned to remove these functions.
The unique naming of the device interfaces could be improved
in EAL.


[dpdk-dev] [PATCH v9 4/8] ethdev: make get port by name and get name by port public

2016-06-14 Thread Pattan, Reshma


> -Original Message-
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> Sent: Tuesday, June 14, 2016 9:24 PM
> To: Pattan, Reshma 
> Cc: dev at dpdk.org; david.marchand at 6wind.com
> Subject: Re: [dpdk-dev] [PATCH v9 4/8] ethdev: make get port by name and get
> name by port public
> 
> 2016-06-14 10:38, Reshma Pattan:
> > Converted rte_eth_dev_get_port_by_name to a public API.
> > Converted rte_eth_dev_get_name_by_port to a public API.
> 
> No justification?

I will add the justification to commit message. 

> 
> It was planned to remove these functions.
> The unique naming of the device interfaces could be improved in EAL.

Packet capture framework  provides APIs  to enable or disable  packet capture 
either using   portid, or pci adrres /device name. 
These apis were made public for packet capture framework  library to convert 
pci address and device names to port id  internally,
 and use the port information for registering the RxTx callbacks. These APIs 
are needed, without which library will not work. 

Thanks,
Reshma



[dpdk-dev] [PATCH v9 4/8] ethdev: make get port by name and get name by port public

2016-06-14 Thread Reshma Pattan
Converted rte_eth_dev_get_port_by_name to a public API.
Converted rte_eth_dev_get_name_by_port to a public API.

Signed-off-by: Reshma Pattan 
---
 lib/librte_ether/rte_ethdev.c  |  4 ++--
 lib/librte_ether/rte_ethdev.h  | 29 +
 lib/librte_ether/rte_ether_version.map |  2 ++
 3 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 1f634c9..0b19569 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -406,7 +406,7 @@ rte_eth_dev_get_addr_by_port(uint8_t port_id, struct 
rte_pci_addr *addr)
return 0;
 }

-static int
+int
 rte_eth_dev_get_name_by_port(uint8_t port_id, char *name)
 {
char *tmp;
@@ -425,7 +425,7 @@ rte_eth_dev_get_name_by_port(uint8_t port_id, char *name)
return 0;
 }

-static int
+int
 rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id)
 {
int i;
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 8ad7c01..fab281e 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -4284,6 +4284,35 @@ rte_eth_dev_l2_tunnel_offload_set(uint8_t port_id,
  uint32_t mask,
  uint8_t en);

+/**
+* Get the port id from pci adrress or device name
+* Ex: :2:00.0 or vdev name eth_pcap0
+*
+* @param name
+*  pci address or name of the device
+* @param port_id
+*   pointer to port identifier of the device
+* @return
+*   - (0) if successful.
+*   - (-ENODEV or -EINVAL) on failure.
+*/
+int
+rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id);
+
+/**
+* Get the device name from port id
+*
+* @param port_id
+*   pointer to port identifier of the device
+* @param name
+*  pci address or name of the device
+* @return
+*   - (0) if successful.
+*   - (-EINVAL) on failure.
+*/
+int
+rte_eth_dev_get_name_by_port(uint8_t port_id, char *name);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/librte_ether/rte_ether_version.map 
b/lib/librte_ether/rte_ether_version.map
index d06d648..73e730d 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -137,5 +137,7 @@ DPDK_16.07 {
global:

rte_eth_add_first_rx_callback;
+   rte_eth_dev_get_name_by_port;
+   rte_eth_dev_get_port_by_name;
rte_eth_dev_info_get;
 } DPDK_16.04;
-- 
2.5.0