[dpdk-dev] [PATCH] pdump: revert PCI device name conversion

2016-10-26 Thread Thomas Monjalon
> > Earlier ethdev library created the device names in the "bus:device.func"
> > format hence pdump library implemented its own conversion method for
> > changing the user passed device name format "domain:bus:device.func" to
> > "bus:device.func"
> > for finding the port id using device name using ethdev library calls. Now 
> > after
> > ethdev and eal rework http://dpdk.org/dev/patchwork/patch/15855/,
> > the device names are created in the format "domain:bus:device.func", so
> > pdump library conversion is not needed any more, hence removed the
> > corresponding code.
> > 
> > Signed-off-by: Reshma Pattan 
> 
> Acked-by: Fan Zhang  

Applied, thanks


[dpdk-dev] [PATCH] pdump: revert PCI device name conversion

2016-10-26 Thread Zhang, Roy Fan
> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Reshma Pattan
> Sent: Tuesday, October 25, 2016 5:32 PM
> To: dev at dpdk.org
> Cc: Pattan, Reshma 
> Subject: [dpdk-dev] [PATCH] pdump: revert PCI device name conversion
> 
> Earlier ethdev library created the device names in the "bus:device.func"
> format hence pdump library implemented its own conversion method for
> changing the user passed device name format "domain:bus:device.func" to
> "bus:device.func"
> for finding the port id using device name using ethdev library calls. Now 
> after
> ethdev and eal rework http://dpdk.org/dev/patchwork/patch/15855/,
> the device names are created in the format "domain:bus:device.func", so
> pdump library conversion is not needed any more, hence removed the
> corresponding code.
> 
> Signed-off-by: Reshma Pattan 
> ---
>  lib/librte_pdump/rte_pdump.c | 37 ++---
>  1 file changed, 2 insertions(+), 35 deletions(-)
> 
> diff --git a/lib/librte_pdump/rte_pdump.c b/lib/librte_pdump/rte_pdump.c
> index ea5ccd9..504a1ce 100644
> --- a/lib/librte_pdump/rte_pdump.c
> +++ b/lib/librte_pdump/rte_pdump.c
> @@ -226,29 +226,6 @@ pdump_tx(uint8_t port __rte_unused, uint16_t qidx
> __rte_unused,  }
> 
>  static int
> -pdump_get_dombdf(char *device_id, char *domBDF, size_t len) -{
> - int ret;
> - struct rte_pci_addr dev_addr = {0};
> -
> - /* identify if device_id is pci address or name */
> - ret = eal_parse_pci_DomBDF(device_id, _addr);
> - if (ret < 0)
> - return -1;
> -
> - if (dev_addr.domain)
> - ret = snprintf(domBDF, len, "%u:%u:%u.%u",
> dev_addr.domain,
> - dev_addr.bus, dev_addr.devid,
> - dev_addr.function);
> - else
> - ret = snprintf(domBDF, len, "%u:%u.%u", dev_addr.bus,
> - dev_addr.devid,
> - dev_addr.function);
> -
> - return ret;
> -}
> -
> -static int
>  pdump_regitser_rx_callbacks(uint16_t end_q, uint8_t port, uint16_t queue,
>   struct rte_ring *ring, struct rte_mempool
> *mp,
>   uint16_t operation)
> @@ -885,7 +862,6 @@ rte_pdump_enable_by_deviceid(char *device_id,
> uint16_t queue,
>   void *filter)
>  {
>   int ret = 0;
> - char domBDF[DEVICE_ID_SIZE];
> 
>   ret = pdump_validate_ring_mp(ring, mp);
>   if (ret < 0)
> @@ -894,11 +870,7 @@ rte_pdump_enable_by_deviceid(char *device_id,
> uint16_t queue,
>   if (ret < 0)
>   return ret;
> 
> - if (pdump_get_dombdf(device_id, domBDF, sizeof(domBDF)) > 0)
> - ret = pdump_prepare_client_request(domBDF, queue, flags,
> - ENABLE, ring, mp, filter);
> - else
> - ret = pdump_prepare_client_request(device_id, queue,
> flags,
> + ret = pdump_prepare_client_request(device_id, queue, flags,
>   ENABLE, ring, mp, filter);
> 
>   return ret;
> @@ -928,17 +900,12 @@ rte_pdump_disable_by_deviceid(char *device_id,
> uint16_t queue,
>   uint32_t flags)
>  {
>   int ret = 0;
> - char domBDF[DEVICE_ID_SIZE];
> 
>   ret = pdump_validate_flags(flags);
>   if (ret < 0)
>   return ret;
> 
> - if (pdump_get_dombdf(device_id, domBDF, sizeof(domBDF)) > 0)
> - ret = pdump_prepare_client_request(domBDF, queue, flags,
> - DISABLE, NULL, NULL, NULL);
> - else
> - ret = pdump_prepare_client_request(device_id, queue,
> flags,
> + ret = pdump_prepare_client_request(device_id, queue, flags,
>   DISABLE, NULL, NULL, NULL);
> 
>   return ret;
> --
> 2.7.4

Acked-by: Fan Zhang  


[dpdk-dev] [PATCH] pdump: revert PCI device name conversion

2016-10-25 Thread Reshma Pattan
Earlier ethdev library created the device names in the
"bus:device.func" format hence pdump library implemented
its own conversion method for changing the user passed
device name format "domain:bus:device.func" to "bus:device.func"
for finding the port id using device name using ethdev library
calls. Now after ethdev and eal rework
http://dpdk.org/dev/patchwork/patch/15855/,
the device names are created in the format "domain:bus:device.func",
so pdump library conversion is not needed any more, hence removed
the corresponding code.

Signed-off-by: Reshma Pattan 
---
 lib/librte_pdump/rte_pdump.c | 37 ++---
 1 file changed, 2 insertions(+), 35 deletions(-)

diff --git a/lib/librte_pdump/rte_pdump.c b/lib/librte_pdump/rte_pdump.c
index ea5ccd9..504a1ce 100644
--- a/lib/librte_pdump/rte_pdump.c
+++ b/lib/librte_pdump/rte_pdump.c
@@ -226,29 +226,6 @@ pdump_tx(uint8_t port __rte_unused, uint16_t qidx 
__rte_unused,
 }

 static int
-pdump_get_dombdf(char *device_id, char *domBDF, size_t len)
-{
-   int ret;
-   struct rte_pci_addr dev_addr = {0};
-
-   /* identify if device_id is pci address or name */
-   ret = eal_parse_pci_DomBDF(device_id, _addr);
-   if (ret < 0)
-   return -1;
-
-   if (dev_addr.domain)
-   ret = snprintf(domBDF, len, "%u:%u:%u.%u", dev_addr.domain,
-   dev_addr.bus, dev_addr.devid,
-   dev_addr.function);
-   else
-   ret = snprintf(domBDF, len, "%u:%u.%u", dev_addr.bus,
-   dev_addr.devid,
-   dev_addr.function);
-
-   return ret;
-}
-
-static int
 pdump_regitser_rx_callbacks(uint16_t end_q, uint8_t port, uint16_t queue,
struct rte_ring *ring, struct rte_mempool *mp,
uint16_t operation)
@@ -885,7 +862,6 @@ rte_pdump_enable_by_deviceid(char *device_id, uint16_t 
queue,
void *filter)
 {
int ret = 0;
-   char domBDF[DEVICE_ID_SIZE];

ret = pdump_validate_ring_mp(ring, mp);
if (ret < 0)
@@ -894,11 +870,7 @@ rte_pdump_enable_by_deviceid(char *device_id, uint16_t 
queue,
if (ret < 0)
return ret;

-   if (pdump_get_dombdf(device_id, domBDF, sizeof(domBDF)) > 0)
-   ret = pdump_prepare_client_request(domBDF, queue, flags,
-   ENABLE, ring, mp, filter);
-   else
-   ret = pdump_prepare_client_request(device_id, queue, flags,
+   ret = pdump_prepare_client_request(device_id, queue, flags,
ENABLE, ring, mp, filter);

return ret;
@@ -928,17 +900,12 @@ rte_pdump_disable_by_deviceid(char *device_id, uint16_t 
queue,
uint32_t flags)
 {
int ret = 0;
-   char domBDF[DEVICE_ID_SIZE];

ret = pdump_validate_flags(flags);
if (ret < 0)
return ret;

-   if (pdump_get_dombdf(device_id, domBDF, sizeof(domBDF)) > 0)
-   ret = pdump_prepare_client_request(domBDF, queue, flags,
-   DISABLE, NULL, NULL, NULL);
-   else
-   ret = pdump_prepare_client_request(device_id, queue, flags,
+   ret = pdump_prepare_client_request(device_id, queue, flags,
DISABLE, NULL, NULL, NULL);

return ret;
-- 
2.7.4