RE: [dpdk-dev] [PATCH 1/1] net/mlx5: fix memory leak when releasing a drop action

2022-07-31 Thread Matan Azrad
Hi Yunjian

From: Yunjian Wang
> When the memory for hrxq->action is allocated in mlx5_devx_hrxq_new().

Memory -> resources .. are

> But it was not being freed when the drop action was released in
> mlx5_devx_drop_action_destroy(). These cause a memory leak.
> 
> Fixes: bc5bee028ebc ("net/mlx5: create drop queue using DevX")
> Cc: sta...@dpdk.org
> 
> Signed-off-by: Yunjian Wang 
> ---
>  drivers/net/mlx5/mlx5_devx.c | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/net/mlx5/mlx5_devx.c b/drivers/net/mlx5/mlx5_devx.c
> index 6886ae1f22..171ce5c08a 100644
> --- a/drivers/net/mlx5/mlx5_devx.c
> +++ b/drivers/net/mlx5/mlx5_devx.c
> @@ -1097,6 +1097,12 @@ mlx5_devx_drop_action_destroy(struct
> rte_eth_dev *dev)
> mlx5_devx_ind_table_destroy(hrxq->ind_table);
> if (priv->drop_queue.rxq->devx_rq.rq != NULL)
> mlx5_rxq_devx_obj_drop_release(dev);
> +#ifdef HAVE_IBV_FLOW_DV_SUPPORT
> +   if (hrxq->action != NULL) {
> +   mlx5_glue->destroy_flow_action(hrxq->action);
> +   hrxq->action = NULL;
> +   }
> +#endif

Good catch for the leak.
I think the issue is in mlx5_devx_tir_destroy and not related only to the drop 
queue management.
So the fix should be for the mlx5_devx_tir_destroy. What do you think?



>  }
> 
>  /**
> --
> 2.27.0



Re: Question about pattern types for rte_flow RSS rule

2022-07-31 Thread Andrew Rybchenko

Hi, Huisong!

On 7/29/22 05:30, lihuisong (C) wrote:

Hi Ori, and all,

For RSS flow rule, pattern item types and RSS types in action
are an inclusive relationship, and RSS types contain pattern item
types. 


I disagree with the statement. We can redirect various packets,
but apply RSS on subset only. Everything else goes to the first
queue (first entry in the redirection table in fact).


Is it necessary to set pattern item types when specify RSS
types to create a rule? 


No, it is not strictly required. It depends on what you want.


How should the user set and how should the
driver do?


Pattern and action are not strictly related in the case of RSS.
Pattern defines on which packets the rule is applied.
Action defines what the rule does. If hash function is not
applicable to a packet, e.g. ARP packet and ipv4-tcp hash function,
the hash is 0 and goes via redirection table entry 0.

Andrew.



Looking forward to your reply.

Regards,
Huisong

在 2022/7/13 9:34, lihuisong (C) 写道:

Hi all,

Can someone open my confusion?
I'm looking forward to your reply.

Thanks,
Huisong.

在 2022/7/7 11:50, lihuisong (C) 写道:

Hi all,

From following testpmd command:
'flow create 0 ingress pattern eth / ipv4 / tcp / end actions rss 
types ipv4-tcp l3-src-only end queues end / end'

and
"flow create 0 ingress pattern end actions rss types ipv4-tcp 
l3-src-only end queues end / end"


I have some confusions about rte_flow RSS rule:
1> Do pattern item types need to set when configure rte_flow RSS rule?
2> Does the driver need to check and process the pattern? (After all, 
the RSS types in actions alreadly contain all RSS offload types.)


Have someone explains it?

Regards,
Huisong

.

.




[PATCH 0/2] vhost fixes for OVS SIGSEGV in PMD

2022-07-31 Thread Claudio Fontana
Hi, the real meat is in patch 1/2,

which fixes a segmentation fault in the OVS PMD thread when
resynchronizing with QEMU after the guest application has been killed
with SIGKILL.

This fixes an issue where the guest DPDK application is able
to crash the OVS process on the host.

Patch 2/2 is just an improvement in the current error handling.

For your review and comments,

Claudio

Claudio Fontana (2):
  vhost: fix error handling in virtio_dev_tx_split
  vhost: improve error handling in desc_to_mbuf

 lib/vhost/virtio_net.c | 16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

-- 
2.26.2



[PATCH 1/2] vhost: fix error handling in virtio_dev_tx_split

2022-07-31 Thread Claudio Fontana
in virtio_dev_split we add a check for invalid nr_vec,
mainly for nr_vec == 0 (but add a check for BUF_VECTOR_MAX too),
and bail out before calling desc_to_mbuf, otherwise in desc_to_mbuf
we end up trying to memcpy from a source address buf_vec[0] that
is an uninitialized stack variable.

This should fix errors that have been reported in multiple occasions
from telcos to the DPDK, OVS and QEMU projects, as this affects in
particular the openvswitch/DPDK, QEMU vhost-user setup.

The back trace looks roughly like this, depending on the specific
rte_memcpy selected, etc, in any case the "src" parameter is garbage
(in this example containing 0 + dev->host_hlen(12 = 0xc)).

Thread 153 "pmd-c88/id:150" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f64e5e6b700 (LWP 141373)]
rte_mov128blocks (n=2048, src=0xc ,
  dst=0x150da4480) at ../lib/eal/x86/include/rte_memcpy.h:384
(gdb) bt
0  rte_mov128blocks (n=2048, src=0xc, dst=0x150da4480)
1  rte_memcpy_generic (n=2048, src=0xc, dst=0x150da4480)
2  rte_memcpy (n=2048, src=0xc, dst=)
3  sync_fill_seg
4  desc_to_mbuf
5  virtio_dev_tx_split
6  virtio_dev_tx_split_legacy
7  0x7f676fea0fef in rte_vhost_dequeue_burst
8  0x7f6772005a62 in netdev_dpdk_vhost_rxq_recv
9  0x7f6771f38116 in netdev_rxq_recv
10 0x7f6771f03d96 in dp_netdev_process_rxq_port
11 0x7f6771f04239 in pmd_thread_main
12 0x7f6771f92aff in ovsthread_wrapper
13 0x7f6771c1b6ea in start_thread
14 0x7f6771933a8f in clone

Tested-by: Claudio Fontana 
Signed-off-by: Claudio Fontana 
---
 lib/vhost/virtio_net.c | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c
index 35fa4670fd..0b8db2046e 100644
--- a/lib/vhost/virtio_net.c
+++ b/lib/vhost/virtio_net.c
@@ -2917,9 +2917,16 @@ virtio_dev_tx_split(struct virtio_net *dev, struct 
vhost_virtqueue *vq,
vq->last_avail_idx + i,
&nr_vec, buf_vec,
&head_idx, &buf_len,
-   VHOST_ACCESS_RO) < 0))
+   VHOST_ACCESS_RO) < 0)) {
+   dropped += 1;
+   i++;
break;
-
+   }
+   if (unlikely(nr_vec < 1 || nr_vec >= BUF_VECTOR_MAX)) {
+   dropped += 1;
+   i++;
+   break;
+   }
update_shadow_used_ring_split(vq, head_idx, 0);
 
err = virtio_dev_pktmbuf_prep(dev, pkts[i], buf_len);
-- 
2.26.2



[PATCH 2/2] vhost: improve error handling in desc_to_mbuf

2022-07-31 Thread Claudio Fontana
check when increasing vec_idx that it is still valid
in the (buf_len < dev->vhost_hlen) case too.

Signed-off-by: Claudio Fontana 
---
 lib/vhost/virtio_net.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c
index 0b8db2046e..6d34feaf73 100644
--- a/lib/vhost/virtio_net.c
+++ b/lib/vhost/virtio_net.c
@@ -2701,12 +2701,15 @@ desc_to_mbuf(struct virtio_net *dev, struct 
vhost_virtqueue *vq,
if (unlikely(buf_len < dev->vhost_hlen)) {
buf_offset = dev->vhost_hlen - buf_len;
vec_idx++;
+   if (unlikely(vec_idx >= nr_vec))
+   goto error;
buf_addr = buf_vec[vec_idx].buf_addr;
buf_iova = buf_vec[vec_idx].buf_iova;
buf_len = buf_vec[vec_idx].buf_len;
buf_avail  = buf_len - buf_offset;
} else if (buf_len == dev->vhost_hlen) {
-   if (unlikely(++vec_idx >= nr_vec))
+   vec_idx++;
+   if (unlikely(vec_idx >= nr_vec))
goto error;
buf_addr = buf_vec[vec_idx].buf_addr;
buf_iova = buf_vec[vec_idx].buf_iova;
-- 
2.26.2



Re: [PATCH v4 0/6] add thread lifetime and attributes API

2022-07-31 Thread Dmitry Kozlyuk
2022-06-27 09:56 (UTC-0700), Tyler Retzlaff:
> add rte thread lifetime and attributes api. with these api additions
> there is now sufficient platform abstracted thread api to remove the
> use of pthread in the unit tests.

For series,
Acked-by: Dmitry Kozlyuk 

Sorry it took so long to review.


RE: [RFC,1/2] member: implement NitroSketch mode

2022-07-31 Thread Wang, Yipeng1
> -Original Message-
> From: Rong, Leyi 
> Sent: Wednesday, June 1, 2022 1:22 AM
> To: Wang, Yipeng1 ; zaoxing...@gmail.com; Gobriel,
> Sameh 
> Cc: dev@dpdk.org; Rong, Leyi 
> Subject: [RFC,1/2] member: implement NitroSketch mode
> 
> Sketching algorithm provide high-fidelity approximate measurements and
> appears as a promising alternative to traditional approches such as
> packet sampling.
> 
> NitroSketch [1] is a software sketching framework that optimizes
> performance, provides accuracy guarantees, and supports a variety of
> sketches.
> 
> This commit adds a new data structure called sketch into
> membership library. This new data structure is an efficient
> way to profile the traffic for heavy hitters. Also use min-heap
> structure to maintain the top-k flow keys.
> 
> [1] Zaoxing Liu, Ran Ben-Basat, Gil Einziger, Yaron Kassner, Vladimir
> Braverman, Roy Friedman, Vyas Sekar, "NitroSketch: Robust and General
> Sketch-based Monitoring in Software Switches", in ACM SIGCOMM 2019.
> 
> Signed-off-by: Alan Liu 
> Signed-off-by: Yipeng Wang 
> Signed-off-by: Leyi Rong 
> ---
>  lib/member/meson.build|  35 +-
>  lib/member/rte_member.c   |  75 
>  lib/member/rte_member.h   | 141 ++-
>  lib/member/rte_member_heap.h  | 449 
>  lib/member/rte_member_sketch.c| 584 ++
>  lib/member/rte_member_sketch.h|  96 +
>  lib/member/rte_member_sketch_avx512.c |  69 +++
>  lib/member/rte_member_sketch_avx512.h |  36 ++
>  lib/member/rte_xxh64_avx512.h | 117 ++
>  9 files changed, 1598 insertions(+), 4 deletions(-)
>  create mode 100644 lib/member/rte_member_heap.h
>  create mode 100644 lib/member/rte_member_sketch.c
>  create mode 100644 lib/member/rte_member_sketch.h
>  create mode 100644 lib/member/rte_member_sketch_avx512.c
>  create mode 100644 lib/member/rte_member_sketch_avx512.h
>  create mode 100644 lib/member/rte_xxh64_avx512.h
> 
> diff --git a/lib/member/meson.build b/lib/member/meson.build
> index e06fddc240..426c9891c2 100644
> --- a/lib/member/meson.build
> +++ b/lib/member/meson.build
> @@ -7,6 +7,39 @@ if is_windows
>  subdir_done()
>  endif
> 
> -sources = files('rte_member.c', 'rte_member_ht.c', 'rte_member_vbf.c')
> +sources = files('rte_member.c', 'rte_member_ht.c', 'rte_member_vbf.c',
> 'rte_member_sketch.c')
>  headers = files('rte_member.h')
>  deps += ['hash']
> +
> +# compile AVX512 version if:
> +# we are building 64-bit binary AND binutils can generate proper code
> +if dpdk_conf.has('RTE_ARCH_X86_64') and binutils_ok
> +# compile AVX512 version if either:
> +# a. we have AVX512 supported in minimum instruction set
> +#baseline
> +# b. it's not minimum instruction set, but supported by
> +#compiler
> +#
> +# in former case, just add avx512 C file to files list
> +# in latter case, compile c file to static lib, using correct
> +# compiler flags, and then have the .o file from static lib
> +# linked into main lib.
> +sketch_avx512_cpu_support = (
> +cc.get_define('__AVX512F__', args: machine_args) != ''
> +)
> +
> +if sketch_avx512_cpu_support == true
> + cflags += ['-DCC_AVX512_SUPPORT']
> + if cc.has_argument('-mavx512f')
> + cflags += ['-mavx', '-mavx2', '-mavx512f', '-mavx512ifma', '-
> march=icelake-server']
> + endif
> + sources += files('rte_member_sketch_avx512.c')
> +elif cc.has_argument('-mavx512f')
> + cflags += '-DCC_AVX512_SUPPORT'
> + sketch_avx512_tmp = static_library('sketch_avx512_tmp',
> + 'rte_member_sketch_avx512.c',
> + dependencies: static_rte_eal,
> + c_args: cflags + ['-mavx512f'])
> + objs +=
> sketch_avx512_tmp.extract_objects('rte_member_sketch_avx512.c')
> +endif
> +endif
> diff --git a/lib/member/rte_member.c b/lib/member/rte_member.c
> index 7e1632e6b5..8f859f7fbd 100644
> --- a/lib/member/rte_member.c
> +++ b/lib/member/rte_member.c
> @@ -9,10 +9,12 @@
>  #include 
>  #include 
>  #include 
> +#include 
> 
>  #include "rte_member.h"
>  #include "rte_member_ht.h"
>  #include "rte_member_vbf.h"
> +#include "rte_member_sketch.h"
> 
>  TAILQ_HEAD(rte_member_list, rte_tailq_entry);
>  static struct rte_tailq_elem rte_member_tailq = {
> @@ -72,6 +74,9 @@ rte_member_free(struct rte_member_setsum *setsum)
>   case RTE_MEMBER_TYPE_VBF:
>   rte_member_free_vbf(setsum);
>   break;
> + case RTE_MEMBER_TYPE_SKETCH:
> + rte_member_free_sketch(setsum);
> + break;
>   default:
>   break;
>   }
> @@ -86,6 +91,8 @@ rte_member_create(const struct rte_member_parameters
> *params)
>   struct rte_member_list *member_list;
>   struct rte_member_setsum *setsum;
>   int ret;
> + char ring_name[RTE_RING_NAMESIZE];
> + struct rte_ring *sketch_key_ring = NULL;
> 
>   if (params == NULL) {
>   rte_errno = EINV

[Bug 1061] [dpdk v21.11.2-rc1] examples/performance-thread meson build error with gcc12.1 on fedora36

2022-07-31 Thread bugzilla
https://bugs.dpdk.org/show_bug.cgi?id=1061

Bug ID: 1061
   Summary: [dpdk v21.11.2-rc1] examples/performance-thread meson
build error with gcc12.1 on fedora36
   Product: DPDK
   Version: 21.11
  Hardware: All
OS: All
Status: UNCONFIRMED
  Severity: major
  Priority: Normal
 Component: core
  Assignee: dev@dpdk.org
  Reporter: daxuex@intel.com
  Target Milestone: ---

[DPDK Version]
dpdk stable v21.11.2-rc1

[OS version]
OS: Fedora Linux 36 (Server Edition)/Linux 5.17.7-300.fc36.x86_64
gcc: version 12.1.1 20220507

[Bad commit]
This is a problem on a new os.

[Test setup]
CC=gcc meson --werror -Denable_kmods=True -Dlibdir=lib -Dexamples=all
--default-library=static gcc-linux-app  
ninja -C gcc-linux-app

[Error log]
examples/performance-thread meson build error with gcc12.1 on fedora36
FAILED:
examples/dpdk-pthread_shim.p/performance-thread_pthread_shim_pthread_shim.c.o
gcc -Iexamples/dpdk-pthread_shim.p -Iexamples -I../examples
-Iexamples/performance-thread/pthread_shim
-I../examples/performance-thread/pthread_shim
-I../examples/performance-thread/common
-I../examples/performance-thread/common/arch/x86 -I. -I.. -Iconfig -I../config
-Ilib/eal/include -I../lib/eal/include -Ilib/eal/linux/include
-I../lib/eal/linux/include -Ilib/eal/x86/include -I../lib/eal/x86/include
-Ilib/eal/common -I../lib/eal/common -Ilib/eal -I../lib/eal -Ilib/kvargs
-I../lib/kvargs -Ilib/metrics -I../lib/metrics -Ilib/telemetry
-I../lib/telemetry -Ilib/mempool -I../lib/mempool -Ilib/ring -I../lib/ring
-Ilib/net -I../lib/net -Ilib/mbuf -I../lib/mbuf -Ilib/ethdev -I../lib/ethdev
-Ilib/meter -I../lib/meter -Ilib/cmdline -I../lib/cmdline -Ilib/timer
-I../lib/timer -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall
-Winvalid-pch -Werror -O3 -include rte_config.h -Wextra -Wcast-qual
-Wdeprecated -Wformat -Wformat-nonliteral -Wformat-security
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs
-Wold-style-definition -Wpointer-arith -Wsign-compare -Wstrict-prototypes
-Wundef -Wwrite-strings -Wno-address-of-packed-member -Wno-packed-not-aligned
-Wno-missing-field-initializers -Wno-zero-length-bounds -D_GNU_SOURCE
-march=native -Wno-format-truncation -DALLOW_EXPERIMENTAL_API -MD -MQ
examples/dpdk-pthread_shim.p/performance-thread_pthread_shim_pthread_shim.c.o
-MF
examples/dpdk-pthread_shim.p/performance-thread_pthread_shim_pthread_shim.c.o.d
-o
examples/dpdk-pthread_shim.p/performance-thread_pthread_shim_pthread_shim.c.o
-c ../examples/performance-thread/pthread_shim/pthread_shim.c
../examples/performance-thread/pthread_shim/pthread_shim.c: In function
‘pthread_setspecific’:
../examples/performance-thread/pthread_shim/pthread_shim.c:592:27: error:
‘data’ may be used uninitialized [-Werror=maybe-uninitialized]
  592 | int rv =  lthread_setspecific((unsigned int)key, data);
  |   ^~~~
../examples/performance-thread/pthread_shim/pthread_shim.c:589:56: note:
accessing argument 2 of a function declared with attribute ‘access (none, 2)’
  589 | int pthread_setspecific(pthread_key_t key, const void *data)
  |^~~~
cc1: all warnings being treated as errors [3006/3142] Compiling C object
examples/dpdk-l3fwd-thread.p/performance-thread_common_lthread_tls.c.o
[3007/3142] Compiling C object
examples/dpdk-simple_mp.p/multi_process_simple_mp_main.c.o
[3008/3142] Compiling C object
examples/dpdk-mp_client.p/multi_process_client_server_mp_mp_client_client.c.o
[3009/3142] Compiling C object
examples/dpdk-link_status_interrupt.p/link_status_interrupt_main.c.o
[3010/3142] Compiling C object
examples/dpdk-mp_server.p/multi_process_client_server_mp_mp_server_init.c.o
[3011/3142] Compiling C object
examples/dpdk-mp_server.p/multi_process_client_server_mp_mp_server_args.c.o
[3012/3142] Compiling C object
examples/dpdk-simple_mp.p/multi_process_simple_mp_mp_commands.c.o
[3013/3142] Compiling C object
drivers/libtmp_rte_event_octeontx2.a.p/event_octeontx2_otx2_worker.c.o
[3014/3142] Compiling C object
drivers/libtmp_rte_event_octeontx2.a.p/event_octeontx2_otx2_worker_dual.c.o
ninja: build stopped

-- 
You are receiving this mail because:
You are the assignee for the bug.

RE: DPDK source code browser

2022-07-31 Thread Honnappa Nagarahalli
Good to add to Techboard agenda


> -Original Message-
> From: Morten Brørup 
> Sent: Friday, July 29, 2022 11:57 AM
> To: dev@dpdk.org
> Cc: Michael Opdenacker 
> Subject: DPDK source code browser
> 
> Good news, everyone.
> 
> Bootlin's Elixir source code browser now includes the stable releases:
> https://elixir.bootlin.com/dpdk/latest/source
> 
> I propose to take down the code.dpdk.org source code browser server
> completely, and permanently link to Bootlin's server instead (also on the
> DPDK web site). The DPDK server has been out of service for a while now, and
> we don't need to waste resources on maintaining services already provided
> elsewhere.
> 
> 
> Med venlig hilsen / Kind regards,
> -Morten Brørup
> 



[PATCH] app/testpmd: add command line argument 'rx-metadata'

2022-07-31 Thread Hanumanth Pothula
Performance drop is observed by sending per packet rx
metadata (offloads).

Hence, introducing command line argument, 'rx-metadata' to
control passing rx metadata to PMD. By default it’s disabled.

Signed-off-by: Hanumanth Pothula 
---
 app/test-pmd/parameters.c | 4 
 app/test-pmd/testpmd.c| 6 +-
 app/test-pmd/testpmd.h| 2 ++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index e3c9757f3f..daf1218977 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -213,6 +213,7 @@ usage(char* progname)
printf("  --hairpin-mode=0xXX: bitmask set the hairpin port mode.\n"
   "0x10 - explicit Tx rule, 0x02 - hairpin ports paired\n"
   "0x01 - hairpin ports loop, 0x00 - hairpin port self\n");
+   printf(" --rx-metadata: send rx  metadata to driver \n");
 }
 
 #ifdef RTE_LIB_CMDLINE
@@ -710,6 +711,7 @@ launch_args_parse(int argc, char** argv)
{ "record-burst-stats", 0, 0, 0 },
{ PARAM_NUM_PROCS,  1, 0, 0 },
{ PARAM_PROC_ID,1, 0, 0 },
+   { "rx-metadata",0, 0, 0 },
{ 0, 0, 0, 0 },
};
 
@@ -1510,6 +1512,8 @@ launch_args_parse(int argc, char** argv)
num_procs = atoi(optarg);
if (!strcmp(lgopts[opt_idx].name, PARAM_PROC_ID))
proc_id = atoi(optarg);
+   if (!strcmp(lgopts[opt_idx].name, "rx-metadata"))
+   rx_metadata_negotiate = 1;
break;
case 'h':
usage(argv[0]);
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index addcbcac85..ebbde5dfc9 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -411,6 +411,9 @@ uint8_t clear_ptypes = true;
 /* Hairpin ports configuration mode. */
 uint16_t hairpin_mode;
 
+/* send rx metadata */
+uint8_t rx_metadata_negotiate;
+
 /* Pretty printing of ethdev events */
 static const char * const eth_event_desc[] = {
[RTE_ETH_EVENT_UNKNOWN] = "unknown",
@@ -1628,7 +1631,8 @@ init_config_port_offloads(portid_t pid, uint32_t 
socket_id)
int ret;
int i;
 
-   eth_rx_metadata_negotiate_mp(pid);
+   if (rx_metadata_negotiate)
+   eth_rx_metadata_negotiate_mp(pid);
 
port->dev_conf.txmode = tx_mode;
port->dev_conf.rxmode = rx_mode;
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index fb2f5195d3..8a9168c51e 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -621,6 +621,8 @@ extern struct rte_ether_addr 
peer_eth_addrs[RTE_MAX_ETHPORTS];
 extern uint32_t burst_tx_delay_time; /**< Burst tx delay time(us) for 
mac-retry. */
 extern uint32_t burst_tx_retry_num;  /**< Burst tx retry number for mac-retry. 
*/
 
+extern uint8_t rx_metadata_negotiate;
+
 #ifdef RTE_LIB_GRO
 #define GRO_DEFAULT_ITEM_NUM_PER_FLOW 32
 #define GRO_DEFAULT_FLOW_NUM (RTE_GRO_MAX_BURST_ITEM_NUM / \
-- 
2.25.1



RE: [PATCH v6] net/ice: add retry mechanism for DCF after failure

2022-07-31 Thread Zhou, YidingX



> -Original Message-
> From: Zhang, Qi Z 
> Sent: Thursday, July 7, 2022 2:56 PM
> To: Zhang, Peng1X ; Yang, Qiming
> ; dev@dpdk.org
> Subject: RE: [PATCH v6] net/ice: add retry mechanism for DCF after failure
> 
> 
> 
> > -Original Message-
> > From: Zhang, Peng1X 
> > Sent: Wednesday, July 6, 2022 10:17 PM
> > To: Yang, Qiming ; Zhang, Qi Z
> > ; dev@dpdk.org
> > Subject: [PATCH v6] net/ice: add retry mechanism for DCF after failure
> >
> > From: Peng Zhang 
> >
> > The origin design is if error happen during the step 3 of given
> > situation, it will return error directly without retry. While in
> > current patch, it will retry at every interval time during certain
> > time if receive designed error code 'VIRTCHNL_STATUS_ERR_RETRY'
> > from kernel. If retry succeed, rule can be continuously created.
> >
> > The given situation as following steps show:
> > step 1. Kernel PF and DPDK DCF are ready at the beginning.
> > step 2. A VF reset happen, kernel send an event to DCF and set STATE to
> pause.
> > step 3. Before DCF receive the event, it is possible a rule creation
> > is ongoing and virtual channel command from DCF to kernel PF is executing.
> > step 4. Then result of command is failure, it will lead to error code
> > return to DCF. Error code will be set as EINVAL, not EAGAIN.
> >
> > Fixes: daa714d55c72 ("net/ice: handle AdminQ command by DCF")
> > Cc: sta...@dpdk.org
> >
> > Signed-off-by: Peng Zhang 
> > ---
> >  v6 changes:
> >  - Add retry mechanism for DCF if receive designed error code from kernel.
> >  v5 changes:
> >  - Add retry mechanism for DCF if the result of sending virtual channel
> >command is failure.
> >  v4 changes:
> >  - Add retry mechanism if the result of sending adminQ queue command is
> >failure.
> >  v3 Changes:
> >  - Add the situation description, expected error code and incorrect
> >error code in commit log.
> >  v2 Changes:
> >  - Modify DCF state checking mechanism.
> >
> >  drivers/common/iavf/virtchnl.h |  1 +
> >  drivers/net/ice/ice_dcf.c  | 32 
> >  2 files changed, 21 insertions(+), 12 deletions(-)
> >
> > diff --git a/drivers/common/iavf/virtchnl.h
> > b/drivers/common/iavf/virtchnl.h index f123daec8e..e15e3a4439 100644
> > --- a/drivers/common/iavf/virtchnl.h
> > +++ b/drivers/common/iavf/virtchnl.h
> > @@ -49,6 +49,7 @@ enum virtchnl_status_code {
> > VIRTCHNL_STATUS_ERR_CQP_COMPL_ERROR = -39,
> > VIRTCHNL_STATUS_ERR_INVALID_VF_ID   = -40,
> > VIRTCHNL_STATUS_ERR_ADMIN_QUEUE_ERROR   = -53,
> > +   VIRTCHNL_STATUS_ERR_RETRY   = -63,
> 
> Where this error code be used?

This error code is not used in DPDK.  It's unnecessary to add it in vritchnl.h.
DPDK use IAVF_ERR_NOT_READY which has the same value -63.


[dpdk-dev] [PATCH 1/3] common/cnxk: fix printing disabled MKEX registers

2022-07-31 Thread psatheesh
From: Satheesh Paul 

This patch skips printing disabled MKEX registers when
dumping hardware flow MCAM entry data.

Fixes: 9869c39918 ("common/cnxk: support flow entry dump")
Cc: sta...@dpdk.org

Signed-off-by: Satheesh Paul 
Reviewed-by: Kiran Kumar K 
---
 drivers/common/cnxk/roc_npc_mcam_dump.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/common/cnxk/roc_npc_mcam_dump.c 
b/drivers/common/cnxk/roc_npc_mcam_dump.c
index 2aaf3ccd0b..16997bd38a 100644
--- a/drivers/common/cnxk/roc_npc_mcam_dump.c
+++ b/drivers/common/cnxk/roc_npc_mcam_dump.c
@@ -310,8 +310,10 @@ npc_flow_print_item(FILE *file, struct npc *npc, struct 
npc_xtract_info *xinfo,
for (i = 0; i < NPC_MAX_LFL; i++) {
lflags_info = npc->prx_fxcfg[intf][ld][i].xtract;
 
-   npc_flow_print_xtractinfo(file, lflags_info, flow, lid,
- lt);
+   if (!lflags_info->enable)
+   continue;
+
+   npc_flow_print_xtractinfo(file, lflags_info, flow, lid, 
lt);
}
}
 }
@@ -620,7 +622,7 @@ roc_npc_flow_mcam_dump(FILE *file, struct roc_npc *roc_npc,
mcam_read_req->entry = flow->mcam_id;
rc = mbox_process_msg(npc->mbox, (void *)&mcam_read_rsp);
if (rc) {
-   plt_err("Failed to fetch MCAM entry");
+   plt_err("Failed to fetch MCAM entry:%d", flow->mcam_id);
return;
}
 
-- 
2.35.3



[dpdk-dev] [PATCH 2/3] common/cnxk: print counters along with flow dump

2022-07-31 Thread psatheesh
From: Satheesh Paul 

When dumping hardware flow data, print any counter
configured on the flow as well.

Signed-off-by: Satheesh Paul 
Reviewed-by: Kiran Kumar K 
---
 drivers/common/cnxk/roc_npc_mcam_dump.c | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/common/cnxk/roc_npc_mcam_dump.c 
b/drivers/common/cnxk/roc_npc_mcam_dump.c
index 16997bd38a..fe57811a84 100644
--- a/drivers/common/cnxk/roc_npc_mcam_dump.c
+++ b/drivers/common/cnxk/roc_npc_mcam_dump.c
@@ -590,12 +590,19 @@ roc_npc_flow_mcam_dump(FILE *file, struct roc_npc 
*roc_npc,
struct npc *npc = roc_npc_to_npc_priv(roc_npc);
struct npc_mcam_read_entry_req *mcam_read_req;
struct npc_mcam_read_entry_rsp *mcam_read_rsp;
+   uint64_t count = 0;
bool is_rx = 0;
int i, rc = 0;
 
fprintf(file, "MCAM Index:%d\n", flow->mcam_id);
-   fprintf(file, "Interface :%s (%d)\n", intf_str[flow->nix_intf],
-   flow->nix_intf);
+   if (flow->ctr_id != NPC_COUNTER_NONE && flow->use_ctr) {
+   rc = roc_npc_mcam_read_counter(roc_npc, flow->ctr_id, &count);
+   if (rc)
+   return;
+   fprintf(file, "Hit count: %" PRIu64 "\n", count);
+   }
+
+   fprintf(file, "Interface :%s (%d)\n", intf_str[flow->nix_intf], 
flow->nix_intf);
fprintf(file, "Priority  :%d\n", flow->priority);
 
if (flow->nix_intf == NIX_INTF_RX)
-- 
2.35.3



[dpdk-dev] [PATCH 3/3] common/cnxk: update MKEX capability flags

2022-07-31 Thread psatheesh
From: Satheesh Paul 

Update MKEX capability flags to enable parsing
VLAN PCP, DSCP and GTPv1 TEID.

Signed-off-by: Satheesh Paul 
Reviewed-by: Kiran Kumar K 
---
 drivers/common/cnxk/roc_npc_mcam.c | 86 --
 drivers/common/cnxk/roc_npc_priv.h | 12 +++--
 2 files changed, 44 insertions(+), 54 deletions(-)

diff --git a/drivers/common/cnxk/roc_npc_mcam.c 
b/drivers/common/cnxk/roc_npc_mcam.c
index 245eeb0107..a71f0c8b8a 100644
--- a/drivers/common/cnxk/roc_npc_mcam.c
+++ b/drivers/common/cnxk/roc_npc_mcam.c
@@ -232,80 +232,64 @@ npc_get_kex_capability(struct npc *npc)
memset(&kex_cap, 0, sizeof(kex_cap));
 
/* Ethtype: Offset 12B, len 2B */
-   kex_cap.bit.ethtype_0 = npc_is_kex_enabled(
-   npc, NPC_LID_LA, NPC_LT_LA_ETHER, 12 * 8, 2 * 8);
+   kex_cap.bit.ethtype_0 = npc_is_kex_enabled(npc, NPC_LID_LA, 
NPC_LT_LA_ETHER, 12 * 8, 2 * 8);
/* QINQ VLAN Ethtype: offset 8B, len 2B */
-   kex_cap.bit.ethtype_x = npc_is_kex_enabled(
-   npc, NPC_LID_LB, NPC_LT_LB_STAG_QINQ, 8 * 8, 2 * 8);
+   kex_cap.bit.ethtype_x =
+   npc_is_kex_enabled(npc, NPC_LID_LB, NPC_LT_LB_STAG_QINQ, 8 * 8, 
2 * 8);
/* VLAN ID0 : Outer VLAN: Offset 2B, len 2B */
-   kex_cap.bit.vlan_id_0 = npc_is_kex_enabled(
-   npc, NPC_LID_LB, NPC_LT_LB_CTAG, 2 * 8, 2 * 8);
-   /* VLAN ID0 : Inner VLAN: offset 6B, len 2B */
-   kex_cap.bit.vlan_id_x = npc_is_kex_enabled(
-   npc, NPC_LID_LB, NPC_LT_LB_STAG_QINQ, 6 * 8, 2 * 8);
+   kex_cap.bit.vlan_id_0 = npc_is_kex_enabled(npc, NPC_LID_LB, 
NPC_LT_LB_CTAG, 2 * 8, 2 * 8);
+   /* VLAN PCP0 : Outer VLAN: Offset 2B, len 1B */
+   kex_cap.bit.vlan_pcp_0 = npc_is_kex_enabled(npc, NPC_LID_LB, 
NPC_LT_LB_CTAG, 2 * 8, 2 * 1);
+   /* VLAN IDX : Inner VLAN: offset 6B, len 2B */
+   kex_cap.bit.vlan_id_x =
+   npc_is_kex_enabled(npc, NPC_LID_LB, NPC_LT_LB_STAG_QINQ, 6 * 8, 
2 * 8);
/* DMCA: offset 0B, len 6B */
-   kex_cap.bit.dmac = npc_is_kex_enabled(npc, NPC_LID_LA, NPC_LT_LA_ETHER,
- 0 * 8, 6 * 8);
+   kex_cap.bit.dmac = npc_is_kex_enabled(npc, NPC_LID_LA, NPC_LT_LA_ETHER, 
0 * 8, 6 * 8);
/* IP proto: offset 9B, len 1B */
-   kex_cap.bit.ip_proto =
-   npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP, 9 * 8, 1 * 8);
+   kex_cap.bit.ip_proto = npc_is_kex_enabled(npc, NPC_LID_LC, 
NPC_LT_LC_IP, 9 * 8, 1 * 8);
+   /* IPv4 dscp: offset 1B, len 1B, IPv6 dscp: offset 0B, len 2B */
+   kex_cap.bit.ip_dscp = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP, 
1 * 8, 1 * 8) &
+ npc_is_kex_enabled(npc, NPC_LID_LC, 
NPC_LT_LC_IP6, 0, 2 * 8);
/* UDP dport: offset 2B, len 2B */
-   kex_cap.bit.udp_dport = npc_is_kex_enabled(npc, NPC_LID_LD,
-  NPC_LT_LD_UDP, 2 * 8, 2 * 8);
+   kex_cap.bit.udp_dport = npc_is_kex_enabled(npc, NPC_LID_LD, 
NPC_LT_LD_UDP, 2 * 8, 2 * 8);
/* UDP sport: offset 0B, len 2B */
-   kex_cap.bit.udp_sport = npc_is_kex_enabled(npc, NPC_LID_LD,
-  NPC_LT_LD_UDP, 0 * 8, 2 * 8);
+   kex_cap.bit.udp_sport = npc_is_kex_enabled(npc, NPC_LID_LD, 
NPC_LT_LD_UDP, 0 * 8, 2 * 8);
/* TCP dport: offset 2B, len 2B */
-   kex_cap.bit.tcp_dport = npc_is_kex_enabled(npc, NPC_LID_LD,
-  NPC_LT_LD_TCP, 2 * 8, 2 * 8);
+   kex_cap.bit.tcp_dport = npc_is_kex_enabled(npc, NPC_LID_LD, 
NPC_LT_LD_TCP, 2 * 8, 2 * 8);
/* TCP sport: offset 0B, len 2B */
-   kex_cap.bit.tcp_sport = npc_is_kex_enabled(npc, NPC_LID_LD,
-  NPC_LT_LD_TCP, 0 * 8, 2 * 8);
+   kex_cap.bit.tcp_sport = npc_is_kex_enabled(npc, NPC_LID_LD, 
NPC_LT_LD_TCP, 0 * 8, 2 * 8);
/* IP SIP: offset 12B, len 4B */
-   kex_cap.bit.sip_addr = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP,
- 12 * 8, 4 * 8);
+   kex_cap.bit.sip_addr = npc_is_kex_enabled(npc, NPC_LID_LC, 
NPC_LT_LC_IP, 12 * 8, 4 * 8);
/* IP DIP: offset 14B, len 4B */
-   kex_cap.bit.dip_addr = npc_is_kex_enabled(npc, NPC_LID_LC, NPC_LT_LC_IP,
- 14 * 8, 4 * 8);
+   kex_cap.bit.dip_addr = npc_is_kex_enabled(npc, NPC_LID_LC, 
NPC_LT_LC_IP, 14 * 8, 4 * 8);
/* IP6 SIP: offset 8B, len 16B */
-   kex_cap.bit.sip6_addr = npc_is_kex_enabled(npc, NPC_LID_LC, 
NPC_LT_LC_IP6,
-   8 * 8, 16 * 8);
+   kex_cap.bit.sip6_addr = npc_is_kex_enabled(npc, NPC_LID_LC, 
NPC_LT_LC_IP6, 8 * 8, 16 * 8);
/* IP6 DIP: offset 24B, len 16B */
-   kex_cap.bit.dip6_addr = npc_is_kex_enabled(
-   npc, NPC_LID_LC, NPC_LT_LC_IP6, 24 * 8, 16 * 8);
+   kex_cap.bit.dip6_addr = npc_is_kex_enabl

RE: [PATCH 1/2] eventdev/eth_tx: add spinlock for adapter start/stop

2022-07-31 Thread Jayatheerthan, Jay
> -Original Message-
> From: Naga Harish K, S V 
> Sent: Tuesday, July 26, 2022 9:52 AM
> To: Jayatheerthan, Jay ; jer...@marvell.com
> Cc: dev@dpdk.org; sta...@dpdk.org
> Subject: [PATCH 1/2] eventdev/eth_tx: add spinlock for adapter start/stop
> 
> add spinlock protection for tx adapter stop and start APIs
> add null check for tx adapter service pointer in adapter start/stop apis.
> 
> Fixes: a3bbf2e09756 ("eventdev: add eth Tx adapter implementation")
> Cc: sta...@dpdk.org
> 
> Signed-off-by: Naga Harish K S V 
> ---
>  lib/eventdev/rte_event_eth_tx_adapter.c | 7 +--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c 
> b/lib/eventdev/rte_event_eth_tx_adapter.c
> index a237e8edba..3251dad61f 100644
> --- a/lib/eventdev/rte_event_eth_tx_adapter.c
> +++ b/lib/eventdev/rte_event_eth_tx_adapter.c
> @@ -44,7 +44,7 @@
>  #define RTE_EVENT_ETH_TX_ADAPTER_ID_VALID_OR_ERR_RET(id, retval) \
>  do { \
>   if (!txa_valid_id(id)) { \
> - RTE_EDEV_LOG_ERR("Invalid eth Rx adapter id = %d", id); \
> + RTE_EDEV_LOG_ERR("Invalid eth Tx adapter id = %d", id); \
>   return retval; \
>   } \
>  } while (0)
> @@ -468,10 +468,13 @@ txa_service_ctrl(uint8_t id, int start)
>   struct txa_service_data *txa;
> 
>   txa = txa_service_id_to_data(id);
> - if (txa->service_id == TXA_INVALID_SERVICE_ID)
> + if (txa == NULL || txa->service_id == TXA_INVALID_SERVICE_ID)
>   return 0;
> 
> + rte_spinlock_lock(&txa->tx_lock);
>   ret = rte_service_runstate_set(txa->service_id, start);
> + rte_spinlock_unlock(&txa->tx_lock);
> +
>   if (ret == 0 && !start) {
>   while (rte_service_may_be_active(txa->service_id))
>   rte_pause();
> --
> 2.23.0

There are three different changes in this patch. But since they are quite 
small, it should be ok.

Acked-by: Jay Jayatheerthan 



RE: [PATCH 2/2] eventdev/eth_tx: fix adapter stop

2022-07-31 Thread Jayatheerthan, Jay
> -Original Message-
> From: Naga Harish K, S V 
> Sent: Tuesday, July 26, 2022 9:52 AM
> To: Jayatheerthan, Jay ; jer...@marvell.com
> Cc: dev@dpdk.org; sta...@dpdk.org
> Subject: [PATCH 2/2] eventdev/eth_tx: fix adapter stop
> 
> adapter_stop function is stopping the adapter service using
> rte_service_runstate_set() api and waiting until
> rte_service_may_be_active() api returns stopped state in an
> infinite loop.
> 
> This results in hang issues if application calls
> rte_service_lcore_stop() before adapter stop.
> 
> remove the state check after setting the service state which
> avoids running into hang issues. This also makes tx adapter stop
> inline with remaining adapters.
> 
> Fixes: a3bbf2e09756 ("eventdev: add eth Tx adapter implementation")
> Cc: sta...@dpdk.org
> 
> Signed-off-by: Naga Harish K S V 
> ---
>  lib/eventdev/rte_event_eth_tx_adapter.c | 4 
>  1 file changed, 4 deletions(-)
> 
> diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c 
> b/lib/eventdev/rte_event_eth_tx_adapter.c
> index 3251dad61f..41509ba750 100644
> --- a/lib/eventdev/rte_event_eth_tx_adapter.c
> +++ b/lib/eventdev/rte_event_eth_tx_adapter.c
> @@ -475,10 +475,6 @@ txa_service_ctrl(uint8_t id, int start)
>   ret = rte_service_runstate_set(txa->service_id, start);
>   rte_spinlock_unlock(&txa->tx_lock);
> 
> - if (ret == 0 && !start) {
> - while (rte_service_may_be_active(txa->service_id))
> - rte_pause();
> - }
>   return ret;
>  }
> 
> --
> 2.23.0

Acked-by: Jay Jayatheerthan