[dpdk-dev] [PATCH] ethdev: add size and align to compose dma zone name strings

2019-04-27 Thread wangyunjian
From: Yunjian Wang 

The current dma zone name consists of the port_id, queue_id and
ring_name. If a port_id is reused, a new nic maybe use same dma
zone name. At this time, the zone size of the new driver is
differnt. When the zone is reused, it may cause illegal access
to memory.

Signed-off-by: Yunjian Wang 
---
 lib/librte_ethdev/rte_ethdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index d7cfa3d..3242737 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -3630,9 +3630,9 @@ int rte_eth_set_queue_rate_limit(uint16_t port_id, 
uint16_t queue_idx,
const struct rte_memzone *mz;
int rc;
 
-   rc = snprintf(z_name, sizeof(z_name), "eth_p%d_q%d_%s",
+   rc = snprintf(z_name, sizeof(z_name), "p%dq%d%s0x%zx_%d",
  dev->data->port_id, queue_id, ring_name);
-   if (rc >= RTE_MEMZONE_NAMESIZE) {
+   if (rc >= RTE_MEMZONE_NAMESIZE || rx < 0) {
RTE_ETHDEV_LOG(ERR, "ring name too long\n");
rte_errno = ENAMETOOLONG;
return NULL;
-- 
1.8.3.1




[dpdk-dev] [PATCH] ethdev: add size and align to compose dma zone name strings

2019-04-27 Thread wangyunjian
From: Yunjian Wang 

The current dma zone name consists of the port_id, queue_id and
ring_name. If a port_id is reused, a new nic maybe use same dma
zone name. At this time, the zone size of the new driver is
differnt. When the zone is reused, it may cause illegal access
to memory.

Signed-off-by: Yunjian Wang 
---
 lib/librte_ethdev/rte_ethdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index d7cfa3d..0703cda 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -3630,9 +3630,9 @@ int rte_eth_set_queue_rate_limit(uint16_t port_id, 
uint16_t queue_idx,
const struct rte_memzone *mz;
int rc;
 
-   rc = snprintf(z_name, sizeof(z_name), "eth_p%d_q%d_%s",
- dev->data->port_id, queue_id, ring_name);
-   if (rc >= RTE_MEMZONE_NAMESIZE) {
+   rc = snprintf(z_name, sizeof(z_name), "p%dq%d%s0x%zx_%d",
+ dev->data->port_id, queue_id, ring_name, size, align);
+   if (rc >= RTE_MEMZONE_NAMESIZE || rc < 0) {
RTE_ETHDEV_LOG(ERR, "ring name too long\n");
rte_errno = ENAMETOOLONG;
return NULL;
-- 
1.8.3.1




Re: [dpdk-dev] [PATCH v2 1/2] doc: fix spelling errors reported by aspell

2019-04-27 Thread Rami Rosen
Hi John,

Thanks for this patch set, it really makes DPDK documentation more refined.

> -(for example the collectd plugin) should be run to begin querying the
API.
> +(for example the CollectD plugin) should be run to begin querying the
API.


I am not sure about this change to "CollectD". Actually from what I know,
in official
collectd/service assurance documenration, it always appear as "collectd
plugin" or "Collectd plugin" (this is the usual semantics for unix/linux
daemons).

For example,

https://blog.dbrgn.ch/2017/3/10/write-a-collectd-python-plugin/
https://wiki.opnfv.org/display/fastpath/Collectd+how+to+implement+a+simple+plugin
https://collectd.org/documentation/manpages/collectd.conf.5.shtml

If it  agreed that change to CollectD should be reverted, not sure that a
new V3 should be sent, this is a huge patch; if reverting can be done via
merge, it will be better.

Other than that,
Acked-by: Rami Rosen 

>
>


[dpdk-dev] [PATCH v2] app/pdump: add exit_with_primary option support.

2019-04-27 Thread Suanming . Mou
When primary app exits, the residual running pdump will stop
the primary app to restart. Add an exit_with_primary option
to make pdump exit with primary.

Suggested-by: Varghese, Vipin 
Suggested-by: Burakov, Anatoly 
Signed-off-by: Suanming.Mou 
---
 app/pdump/main.c | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/app/pdump/main.c b/app/pdump/main.c
index 3d20854..3909f15 100644
--- a/app/pdump/main.c
+++ b/app/pdump/main.c
@@ -26,11 +26,14 @@
 #include 
 #include 
 #include 
+#include 
 
 #define CMD_LINE_OPT_PDUMP "pdump"
 #define CMD_LINE_OPT_PDUMP_NUM 256
 #define CMD_LINE_OPT_MULTI "multi"
 #define CMD_LINE_OPT_MULTI_NUM 257
+#define CMD_LINE_OPT_EXIT_WP "exit_with_primary"
+#define CMD_LINE_OPT_EXIT_WP_NUM 258
 #define PDUMP_PORT_ARG "port"
 #define PDUMP_PCI_ARG "device_id"
 #define PDUMP_QUEUE_ARG "queue"
@@ -65,6 +68,7 @@
 #define SIZE 256
 #define BURST_SIZE 32
 #define NUM_VDEVS 2
+#define MONITOR_INTERVEL (500 * 1000)
 
 /* true if x is a power of 2 */
 #define POWEROF2(x) x)-1) & (x)) == 0)
@@ -143,12 +147,14 @@ struct parse_val {
 static struct rte_eth_conf port_conf_default;
 static volatile uint8_t quit_signal;
 static uint8_t multiple_core_capture;
+static uint8_t exit_with_primary;
 
 /**< display usage */
 static void
 pdump_usage(const char *prgname)
 {
printf("usage: %s [EAL options]"
+   " --["CMD_LINE_OPT_EXIT_WP"]"
" --["CMD_LINE_OPT_MULTI"]\n"
" --"CMD_LINE_OPT_PDUMP" "
"'(port= | device_id=),"
@@ -383,6 +389,7 @@ struct parse_val {
static struct option long_option[] = {
{CMD_LINE_OPT_PDUMP, 1, 0, CMD_LINE_OPT_PDUMP_NUM},
{CMD_LINE_OPT_MULTI, 0, 0, CMD_LINE_OPT_MULTI_NUM},
+   {CMD_LINE_OPT_EXIT_WP, 0, 0, CMD_LINE_OPT_EXIT_WP_NUM},
{NULL, 0, 0, 0}
};
 
@@ -403,6 +410,9 @@ struct parse_val {
case CMD_LINE_OPT_MULTI_NUM:
multiple_core_capture = 1;
break;
+   case CMD_LINE_OPT_EXIT_WP_NUM:
+   exit_with_primary = 1;
+   break;
default:
pdump_usage(prgname);
return -1;
@@ -864,12 +874,28 @@ struct parse_val {
return 0;
 }
 
+static void monitor_primary(void *arg __rte_unused)
+{
+   if (quit_signal)
+   return;
+
+   if (rte_eal_primary_proc_alive(NULL))
+   rte_eal_alarm_set(MONITOR_INTERVEL, monitor_primary, NULL);
+   else
+   quit_signal = 1;
+
+   return;
+}
+
 static inline void
 dump_packets(void)
 {
int i;
uint32_t lcore_id = 0;
 
+   if (exit_with_primary)
+   rte_eal_alarm_set(MONITOR_INTERVEL, monitor_primary, NULL);
+
if (!multiple_core_capture) {
printf(" core (%u), capture for (%d) tuples\n",
rte_lcore_id(), num_tuples);
-- 
1.8.3.4



[dpdk-dev] [PATCH v3] app/pdump: add exit_with_primary option support.

2019-04-27 Thread Suanming . Mou
When primary app exits, the residual running pdump will stop
the primary app to restart. Add an exit_with_primary option
to make pdump exit with primary.

Suggested-by: Varghese, Vipin 
Suggested-by: Burakov, Anatoly 
Signed-off-by: Suanming.Mou 
---
 app/pdump/main.c | 24 
 1 file changed, 24 insertions(+)

diff --git a/app/pdump/main.c b/app/pdump/main.c
index 3d20854..b69ef4e 100644
--- a/app/pdump/main.c
+++ b/app/pdump/main.c
@@ -26,11 +26,14 @@
 #include 
 #include 
 #include 
+#include 
 
 #define CMD_LINE_OPT_PDUMP "pdump"
 #define CMD_LINE_OPT_PDUMP_NUM 256
 #define CMD_LINE_OPT_MULTI "multi"
 #define CMD_LINE_OPT_MULTI_NUM 257
+#define CMD_LINE_OPT_EXIT_WP "exit_with_primary"
+#define CMD_LINE_OPT_EXIT_WP_NUM 258
 #define PDUMP_PORT_ARG "port"
 #define PDUMP_PCI_ARG "device_id"
 #define PDUMP_QUEUE_ARG "queue"
@@ -65,6 +68,7 @@
 #define SIZE 256
 #define BURST_SIZE 32
 #define NUM_VDEVS 2
+#define MONITOR_INTERVEL (500 * 1000)
 
 /* true if x is a power of 2 */
 #define POWEROF2(x) x)-1) & (x)) == 0)
@@ -143,12 +147,14 @@ struct parse_val {
 static struct rte_eth_conf port_conf_default;
 static volatile uint8_t quit_signal;
 static uint8_t multiple_core_capture;
+static uint8_t exit_with_primary;
 
 /**< display usage */
 static void
 pdump_usage(const char *prgname)
 {
printf("usage: %s [EAL options]"
+   " --["CMD_LINE_OPT_EXIT_WP"]"
" --["CMD_LINE_OPT_MULTI"]\n"
" --"CMD_LINE_OPT_PDUMP" "
"'(port= | device_id=),"
@@ -383,6 +389,7 @@ struct parse_val {
static struct option long_option[] = {
{CMD_LINE_OPT_PDUMP, 1, 0, CMD_LINE_OPT_PDUMP_NUM},
{CMD_LINE_OPT_MULTI, 0, 0, CMD_LINE_OPT_MULTI_NUM},
+   {CMD_LINE_OPT_EXIT_WP, 0, 0, CMD_LINE_OPT_EXIT_WP_NUM},
{NULL, 0, 0, 0}
};
 
@@ -403,6 +410,9 @@ struct parse_val {
case CMD_LINE_OPT_MULTI_NUM:
multiple_core_capture = 1;
break;
+   case CMD_LINE_OPT_EXIT_WP_NUM:
+   exit_with_primary = 1;
+   break;
default:
pdump_usage(prgname);
return -1;
@@ -864,12 +874,26 @@ struct parse_val {
return 0;
 }
 
+static void monitor_primary(void *arg __rte_unused)
+{
+   if (quit_signal)
+   return;
+
+   if (rte_eal_primary_proc_alive(NULL))
+   rte_eal_alarm_set(MONITOR_INTERVEL, monitor_primary, NULL);
+   else
+   quit_signal = 1;
+}
+
 static inline void
 dump_packets(void)
 {
int i;
uint32_t lcore_id = 0;
 
+   if (exit_with_primary)
+   rte_eal_alarm_set(MONITOR_INTERVEL, monitor_primary, NULL);
+
if (!multiple_core_capture) {
printf(" core (%u), capture for (%d) tuples\n",
rte_lcore_id(), num_tuples);
-- 
1.8.3.4



Re: [dpdk-dev] [PATCH v8 1/4] rcu: add RCU library supporting QSBR mechanism

2019-04-27 Thread Ruifeng Wang (Arm Technology China)


> -Original Message-
> From: dev  On Behalf Of Honnappa Nagarahalli
> Sent: Friday, April 26, 2019 12:40
> To: konstantin.anan...@intel.com; step...@networkplumber.org;
> paul...@linux.ibm.com; marko.kovace...@intel.com; dev@dpdk.org
> Cc: Honnappa Nagarahalli ; Gavin Hu (Arm
> Technology China) ; Dharmik Thakkar
> ; Malvika Gupta 
> Subject: [dpdk-dev] [PATCH v8 1/4] rcu: add RCU library supporting QSBR
> mechanism
> 
> Add RCU library supporting quiescent state based memory reclamation
> method.
> This library helps identify the quiescent state of the reader threads so that
> the writers can free the memory associated with the lock less data structures.
> 
> Signed-off-by: Honnappa Nagarahalli 
> Reviewed-by: Steve Capper 
> Reviewed-by: Gavin Hu 
> Reviewed-by: Ola Liljedahl 
> Acked-by: Konstantin Ananyev 
> Acked-by: Paul E. McKenney 
> ---

Compiled DPDK as both static library and shared library.
Ran UT on ARMv8 LS2088a DPAA2 platform, 3 to 8 cores were used, tests passed.

Tested-by: Ruifeng Wang 



[dpdk-dev] [PATCH] net/i40e: remove useless check for queue number

2019-04-27 Thread Wei Zhao
There is no need to do such a check of queue number, so remove it.

Fixes: ac8d22de2394 ("ethdev: flatten RSS configuration in flow API")

Signed-off-by: Wei Zhao 
---
 drivers/net/i40e/i40e_ethdev.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index dca61f0..5059bad 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -12699,9 +12699,6 @@ i40e_config_rss_filter(struct i40e_pf *pf,
return -EINVAL;
}
 
-   if (rss_info->conf.queue_num)
-   return -EINVAL;
-
/* If both VMDQ and RSS enabled, not all of PF queues are configured.
 * It's necessary to calculate the actual PF queues that are configured.
 */
-- 
2.7.5



Re: [dpdk-dev] [PATCH] net/ixgbe: 10GBASE-T SFP+ copper support

2019-04-27 Thread Ido Goshen


> -Original Message-
> From: Ananyev, Konstantin 
> Sent: Friday, April 26, 2019 3:13 PM
> To: Ido Goshen ; Lu, Wenzhuo
> 
> Cc: dev@dpdk.org
> Subject: RE: [PATCH] net/ixgbe: 10GBASE-T SFP+ copper support
> 
> 
> 
> > > > From: Ido Goshen 
> > > >
> > > > 10BASE-T SFP+ copper transceivers become cheaper and popular So
> > > > far those were blocked by ixgbe as “unsupported”.
> > > > e.g.
> > > > eth_ixgbe_dev_init(): Unsupported SFP+ Module
> > > > eth_ixgbe_dev_init(): Hardware Initialization Failure: -19
> > > > EAL: Requested device :0a:00.0 cannot be used
> > > >
> > > > This patch expands the usage of allow_unsupported_sfp to be more
> > > > general and makes ixgbe more tolerant to unknown SFPs
> > >
> > >
> > > I don't think it is a good idea to change the base code to blindly
> > > allow unknown SFPs.
> > > Again in eth_ixgbe_dev_init() we do set
> > > hw->allow_unsupported_sfp = 1;
> > > so the function below will return success anyway,
> >
> > what's the reason to not allow unknown SFPs?
> > as is they are explicitly blocked and not working anyway, why not give
> them a chance?
> 
> From my perspective the question should be opposite: why to allow it?
> ixgbe base code is developed and maintained by Intel ND team for several
> platforms.
> It should be some good reason to change it inside DPDK project only.
> As I said,  in eth_ixgbe_dev_init() we already set hw->allow_unsupported_sfp
> = 1, so unknown spf should be allowed by DPDK ixgbe PMD.
> So what exact problem you are trying to solve here?
> Konstantin

The problem is that 10GBASE-T copper transceivers are not working just because 
they are unknown
http://www.eoptolink.com/products/copper-10g-sfp

The hw->allow_unsupported_sfp is used too late in
https://git.dpdk.org/next/dpdk-next-net-intel/tree/drivers/net/ixgbe/base/ixgbe_phy.c#n1530
And if we've already got out earlier in
https://git.dpdk.org/next/dpdk-next-net-intel/tree/drivers/net/ixgbe/base/ixgbe_phy.c#n1507
The device cannot be used
The patch tries to make the hw->allow_unsupported_sfp more general and in case 
it is set (always in dpdk)
change any return status of IXGBE_ERR_SFP_NOT_SUPPORTED to IXGBE_SUCCESS with 
ixgbe_phy_unknown

Other suggestions how to make 10GBASE-T copper work?

> 
> >
> > More inputs
> > 1. i40e already does support it (I didn't go deep into it but it just
> > seems less strict on hw_init) 2. even with ixgbe it can work, because
> unsupported is only checked by ixgbe_init_hw
> >  so if the SFP is inserted after the app has started it does work
> >  kind of inconsistent
> >
> > >
> > > >
> > > > Signed-off-by: Ido Goshen 
> > > > ---
> > > >  drivers/net/ixgbe/base/ixgbe_phy.c  | 22 +++---
> > > > drivers/net/ixgbe/base/ixgbe_x550.c |  3 +++
> > > >  2 files changed, 14 insertions(+), 11 deletions(-)
> > > >
> > > > diff --git a/drivers/net/ixgbe/base/ixgbe_phy.c
> > > > b/drivers/net/ixgbe/base/ixgbe_phy.c
> > > > index dd118f9..ff96afc 100644
> > > > --- a/drivers/net/ixgbe/base/ixgbe_phy.c
> > > > +++ b/drivers/net/ixgbe/base/ixgbe_phy.c
> > > > @@ -1527,18 +1527,9 @@ s32
> > > > ixgbe_identify_sfp_module_generic(struct
> > > ixgbe_hw *hw)
> > > > if (hw->phy.type == ixgbe_phy_sfp_intel) {
> > > > status = IXGBE_SUCCESS;
> > > > } else {
> > > > -   if (hw->allow_unsupported_sfp == true) {
> > > > -   EWARN(hw,
> > > > -   "WARNING: Intel (R)
> > > Network Connections are quality tested using Intel (R) Ethernet
> > > > Optics. "
> > > > -   "Using untested modules 
> > > > is
> > > not supported and may cause unstable operation or damage
> > > > to the module or the adapter. "
> > > > -   "Intel Corporation is 
> > > > not
> > > responsible for any harm caused by using untested modules.\n");
> > > > -   status = IXGBE_SUCCESS;
> > > > -   } else {
> > > > -   DEBUGOUT("SFP+ module not
> > > supported\n");
> > > > -   hw->phy.type =
> > > > +   hw->phy.type =
> > > > 
> > > > ixgbe_phy_sfp_unsupported;
> > > > -   status =
> > > IXGBE_ERR_SFP_NOT_SUPPORTED;
> > > > -   }
> > > > +   status = IXGBE_ERR_SFP_NOT_SUPPORTED;
> > > > }
> > > > } else {
> > > > status = IXGBE_SUCCESS;
> > > > @@ -1546,6 +1537,15 @@ s32
> > > > ixgbe_identify_sfp_module_generic(struct
> > > ixgbe_hw *hw)
> > > > }
> > > >
> > > >  out:
> > > > +   if (status == IXGBE_ERR_SFP_

Re: [dpdk-dev] CALL to eth PMD maintainers: complete closing of port

2019-04-27 Thread Matan Azrad


Hi Thomas

vdev_netvsc has no close API - should I change something there?

> From: Thomas Monjalon 
> Hi all,
> 
> Since DPDK 18.11, the behaviour of the close operation is changed if
> RTE_ETH_DEV_CLOSE_REMOVE is enabled in the driver:
> port is released (i.e. totally freed and data erased) on close.
> This new behaviour is enabled per driver for a migration period.
> 
> Looking at the code, you can see these comments:
> /* old behaviour: only free queue arrays */ RTE_ETHDEV_LOG(DEBUG, "Port
> closing is using an old behaviour.\n"
>   "The driver %s should migrate to the new behaviour.\n",
> /* new behaviour: send event + reset state + free all data */
> 
> You can find an advice in the commit:
>   https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2
> Fgit.dpdk.org%2Fdpdk%2Fcommit%2F%3Fid%3D23ea57a2a&data=02%7
> C01%7Cmatan%40mellanox.com%7C3fea370ec31f4d22be8708d6c3ecf74b%7
> Ca652971c7d2e4d9ba6a4d149256f461b%7C0%7C0%7C636911819926371170&a
> mp;sdata=%2BHLHG6VK2gNLejSHRKLYtS4Qelqg%2FOD%2FUQbZwOIT9%2BA
> %3D&reserved=0
> "
> When enabling RTE_ETH_DEV_CLOSE_REMOVE,
> the PMD must free all its private resources for the port, in its dev_close
> function.
> It is advised to call the dev_close function in the remove function in order 
> to
> support removing a device without closing its ports.
> "
> 
> It would be great to complete this migration for the next LTS version, which
> will be 19.11.
> It means the work should be ideally finished during the summer.
> 
> The migration to the new behaviour is done in 4 drivers:
> git grep -l RTE_ETH_DEV_CLOSE_REMOVE drivers | cut -d/ -f3
>   ena
>   enic
>   mlx5
>   vmxnet3
> 
> Following drivers should be migrated:
> ( find drivers/net -mindepth 1 -maxdepth 1 -type d | cut -d/ -f3 ; git grep -l
> RTE_ETH_DEV_CLOSE_REMOVE drivers | cut -d/ -f3 ) | sort | uniq -u
>   af_packet
>   af_xdp
>   ark
>   atlantic
>   avp
>   axgbe
>   bnx2x
>   bnxt
>   bonding
>   cxgbe
>   dpaa
>   dpaa2
>   e1000
>   enetc
>   failsafe
>   fm10k
>   i40e
>   iavf
>   ice
>   ifc
>   ixgbe
>   kni
>   liquidio
>   mlx4
>   mvneta
>   mvpp2
>   netvsc
>   nfb
>   nfp
>   null
>   octeontx
>   pcap
>   qede
>   ring
>   sfc
>   softnic
>   szedata2
>   tap
>   thunderx
>   vdev_netvsc
>   vhost
>   virtio
> 
> Please let's progress smoothly on this topic, thanks.
> 
> The concerned maintainers (Cc) can be found with the following command:
> devtools/get-maintainer.sh $(( find drivers/net -mindepth 1 -maxdepth 1 -
> type d | cut -d/ -f-3 ; git grep -l RTE_ETH_DEV_CLOSE_REMOVE drivers ) |
> sort | uniq -u)
>