[dpdk-dev,2/2] ethdev: Export rte_eth_dev_create_unique_device_name() to public API

Message ID 1454423239-16382-2-git-send-email-krytarowski@caviumnetworks.com (mailing list archive)
State Rejected, archived
Delegated to: Thomas Monjalon
Headers

Commit Message

Kamil Rytarowski Feb. 2, 2016, 2:27 p.m. UTC
  From: Kamil Rytarowski <Kamil.Rytarowski@caviumnetworks.com>

Once pci_drv.devinit is overloaded, it's a function used in the original
rte_eth_dev_init(), still reusable in altered versions.

Signed-off-by: Kamil Rytarowski <Kamil.Rytarowski@caviumnetworks.com>
---
 lib/librte_ether/rte_ethdev.c |  2 +-
 lib/librte_ether/rte_ethdev.h | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)
  

Comments

Panu Matilainen Feb. 11, 2016, 4:56 p.m. UTC | #1
On 02/02/2016 04:27 PM, krytarowski@caviumnetworks.com wrote:
> From: Kamil Rytarowski <Kamil.Rytarowski@caviumnetworks.com>
>
> Once pci_drv.devinit is overloaded, it's a function used in the original
> rte_eth_dev_init(), still reusable in altered versions.
>
> Signed-off-by: Kamil Rytarowski <Kamil.Rytarowski@caviumnetworks.com>
> ---
>   lib/librte_ether/rte_ethdev.c |  2 +-
>   lib/librte_ether/rte_ethdev.h | 18 ++++++++++++++++++
>   2 files changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
> index ac4aeab..7f5e741 100644
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -214,7 +214,7 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
>   	return eth_dev;
>   }
>
> -static int
> +int
>   rte_eth_dev_create_unique_device_name(char *name, size_t size,
>   		struct rte_pci_device *pci_dev)
>   {
> diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
> index 8710dd7..b19db9d 100644
> --- a/lib/librte_ether/rte_ethdev.h
> +++ b/lib/librte_ether/rte_ethdev.h
> @@ -3880,6 +3880,24 @@ rte_eth_dma_zone_reserve(const struct rte_eth_dev *eth_dev, const char *name,
>   			 uint16_t queue_id, size_t size,
>   			 unsigned align, int socket_id);
>
> +/**
> + * Create unique device name
> + *
> + * @param name
> + *   The port identifier of the Ethernet device.
> + * @param size
> + *   Maximum string length of the generated name
> + * @param pci_dev
> + *   PCI device pointer
> + *
> + * @return
> + *   - 0: Success.
> + *   - <0: Error during generatin
> + *   - -EINVAL: Invalid input parameters.
> + */
> +int rte_eth_dev_create_unique_device_name(char *name, size_t size,
> +					  struct rte_pci_device *pci_dev);
> +
>   #ifdef __cplusplus
>   }
>   #endif
>

To really export it, you'll need to add it to rte_ether_version.map as well.

	- Panu -
  
David Marchand Feb. 11, 2016, 5:15 p.m. UTC | #2
On Thu, Feb 11, 2016 at 5:56 PM, Panu Matilainen <pmatilai@redhat.com> wrote:
> On 02/02/2016 04:27 PM, krytarowski@caviumnetworks.com wrote:
>>
>> From: Kamil Rytarowski <Kamil.Rytarowski@caviumnetworks.com>
>> +int rte_eth_dev_create_unique_device_name(char *name, size_t size,
>> +                                         struct rte_pci_device *pci_dev);
> To really export it, you'll need to add it to rte_ether_version.map as well.

I already submitted something equivalent, and anyway, this belongs to
eal, not ethdev.
http://dpdk.org/ml/archives/dev/2016-January/032394.html
  

Patch

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index ac4aeab..7f5e741 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -214,7 +214,7 @@  rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
 	return eth_dev;
 }
 
-static int
+int
 rte_eth_dev_create_unique_device_name(char *name, size_t size,
 		struct rte_pci_device *pci_dev)
 {
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 8710dd7..b19db9d 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -3880,6 +3880,24 @@  rte_eth_dma_zone_reserve(const struct rte_eth_dev *eth_dev, const char *name,
 			 uint16_t queue_id, size_t size,
 			 unsigned align, int socket_id);
 
+/**
+ * Create unique device name
+ *
+ * @param name
+ *   The port identifier of the Ethernet device.
+ * @param size
+ *   Maximum string length of the generated name
+ * @param pci_dev
+ *   PCI device pointer
+ *
+ * @return
+ *   - 0: Success.
+ *   - <0: Error during generatin
+ *   - -EINVAL: Invalid input parameters.
+ */
+int rte_eth_dev_create_unique_device_name(char *name, size_t size,
+					  struct rte_pci_device *pci_dev);
+
 #ifdef __cplusplus
 }
 #endif