[dpdk-dev,v2,2/2] ethdev: export rte_eth_dev_is_detachable function

Message ID 1446550500-24029-3-git-send-email-david.marchand@6wind.com (mailing list archive)
State Rejected, archived
Headers

Commit Message

David Marchand Nov. 3, 2015, 11:35 a.m. UTC
  From: Maxime Leroy <maxime.leroy@6wind.com>

It can be useful for application to know if a port can be detached or not.

Signed-off-by: Maxime Leroy <maxime.leroy@6wind.com>
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
 lib/librte_ether/rte_ethdev.c          |  2 +-
 lib/librte_ether/rte_ethdev.h          | 12 ++++++++++++
 lib/librte_ether/rte_ether_version.map |  1 +
 3 files changed, 14 insertions(+), 1 deletion(-)
  

Comments

Thomas Monjalon Nov. 3, 2015, 1:50 p.m. UTC | #1
2015-11-03 12:35, David Marchand:
> From: Maxime Leroy <maxime.leroy@6wind.com>
> 
> It can be useful for application to know if a port can be detached or not.
> 
> Signed-off-by: Maxime Leroy <maxime.leroy@6wind.com>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> ---
>  lib/librte_ether/rte_ethdev.c          |  2 +-
>  lib/librte_ether/rte_ethdev.h          | 12 ++++++++++++
>  lib/librte_ether/rte_ether_version.map |  1 +
>  3 files changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
> index ec1b632..373d29b 100644
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -503,7 +503,7 @@ rte_eth_dev_get_name_by_port(uint8_t port_id, char *name)
>  	return 0;
>  }
>  
> -static int
> +int
>  rte_eth_dev_is_detachable(uint8_t port_id)
>  {
>  	uint32_t drv_flags;
> diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
> index 7cf4af8..350733b 100644
> --- a/lib/librte_ether/rte_ethdev.h
> +++ b/lib/librte_ether/rte_ethdev.h
> @@ -1640,6 +1640,18 @@ int rte_eth_dev_attach(const char *devargs, uint8_t *port_id);
>   */
>  int rte_eth_dev_detach(uint8_t port_id, char *devname);
>  
> +/**
> + * Check if an Ethernet device specified by port identifer is detachable.
> + *
> + * @param port_id
> + *   The port identifier of the device to check if is detachable
> + *
> + * @return
> + *  1 if device is detachable, else 0
> + */
> +int
> +rte_eth_dev_is_detachable(uint8_t port_id);

After more thoughts, we do not need such function to query a capability.
The Bernard's patch add a bit-field to expose such capabilities.
So this patchset is rejected, sorry.
  
David Marchand Nov. 4, 2015, 7:49 a.m. UTC | #2
On Tue, Nov 3, 2015 at 2:50 PM, Thomas Monjalon <thomas.monjalon@6wind.com>
wrote:

> After more thoughts, we do not need such function to query a capability.
> The Bernard's patch add a bit-field to expose such capabilities.
> So this patchset is rejected, sorry.
>

As discussed offline, as long as those capabilities do the job, I am fine
with it.
Thanks.
  

Patch

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index ec1b632..373d29b 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -503,7 +503,7 @@  rte_eth_dev_get_name_by_port(uint8_t port_id, char *name)
 	return 0;
 }
 
-static int
+int
 rte_eth_dev_is_detachable(uint8_t port_id)
 {
 	uint32_t drv_flags;
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 7cf4af8..350733b 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1640,6 +1640,18 @@  int rte_eth_dev_attach(const char *devargs, uint8_t *port_id);
  */
 int rte_eth_dev_detach(uint8_t port_id, char *devname);
 
+/**
+ * Check if an Ethernet device specified by port identifer is detachable.
+ *
+ * @param port_id
+ *   The port identifier of the device to check if is detachable
+ *
+ * @return
+ *  1 if device is detachable, else 0
+ */
+int
+rte_eth_dev_is_detachable(uint8_t port_id);
+
 struct eth_driver;
 /**
  * @internal
diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
index 7b04e95..40c2a02 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -132,6 +132,7 @@  DPDK_2.2 {
 	global:
 
 	rte_eth_dev_get_dcb_info;
+	rte_eth_dev_is_detachable;
 	rte_eth_rx_queue_info_get;
 	rte_eth_tx_queue_info_get;