RE: [PATCH] net/ice: allow setting CIR

2023-07-11 Thread Zhang, Qi Z



> -Original Message-
> From: Wu, Wenjun1 
> Sent: Tuesday, July 11, 2023 1:25 PM
> To: markus.th...@tu-ilmenau.de; dev@dpdk.org
> Cc: Yang, Qiming ; Zhang, Qi Z
> ; Michael Rossberg 
> Subject: RE: [PATCH] net/ice: allow setting CIR
> 
> > -Original Message-
> > From: markus.th...@tu-ilmenau.de 
> > Sent: Thursday, July 6, 2023 7:45 PM
> > To: dev@dpdk.org
> > Cc: Yang, Qiming ; Zhang, Qi Z
> > ; Michael Rossberg  > ilmenau.de>
> > Subject: [PATCH] net/ice: allow setting CIR
> >
> > From: Michael Rossberg 
> >
> > ice only allowed to set peak information rate (PIR), while the
> > hardware also supports setting committed information rate (CIR). In
> > many use cases both values are needed, therefore add support for CIR.
> >
> > Signed-off-by: Michael Rossberg 
> > --
> > 2.41.0
> 
> Acked-by: Wenjun Wu 

Applied to dpdk-next-net-intel.

Thanks
Qi


[PATCH] devtools: fix bad substitution

2023-07-11 Thread Raslan Darawsheh
When running check-git-log, it showed a Bad substitution.

It is fixed by using tr to escape the open parenthesis.

Fixes: 6fd14c1b58e6 ("devtools: fix mailmap check for parentheses")
Cc: tho...@monjalon.net

Suggested-by: Thomas Monjalon 
Signed-off-by: Raslan Darawsheh 
---
 devtools/check-git-log.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/devtools/check-git-log.sh b/devtools/check-git-log.sh
index 89544a2cc5..5c869b7683 100755
--- a/devtools/check-git-log.sh
+++ b/devtools/check-git-log.sh
@@ -264,7 +264,7 @@ names=$(git log --format='From: %an <%ae>%n%b' --reverse 
$range |
sed -rn 's,.*: (.*<.*@.*>),\1,p' |
sort -u)
 bad=$(for contributor in $names ; do
-   contributor=${contributor//(/\\(}
+   contributor=$(echo $contributor | tr '(' '\\(')
! grep -qE "^$contributor($| <)" $selfdir/../.mailmap || continue
name=${contributor%% <*}
if grep -q "^$name <" $selfdir/../.mailmap ; then
-- 
2.25.1



Re: [PATCH v1 1/2] dts: add smoke tests

2023-07-11 Thread Juraj Linkeš
Some more comments below. I agree where I didn't reply.

On Sat, Jul 8, 2023 at 1:07 AM Jeremy Spewock  wrote:
>
>
>
> On Thu, Jul 6, 2023 at 10:54 AM Juraj Linkeš  
> wrote:
>>
>> There are mypy errors related to paramiko:
>> framework/remote_session/remote/interactive_remote_session.py:8: error: 
>> Library stubs not installed for "paramiko" (or incompatible with Python 3.10)
>> framework/remote_session/remote/interactive_remote_session.py:9: error: 
>> Library stubs not installed for "paramiko.ssh_exception" (or incompatible 
>> with Python 3.10)
>>
>> We do this for pexpect:
>> import pexpect  # type: ignore
>> from pexpect import pxssh  # type: ignore
>>
>> We should do the same for paramiko.
>
>
> Good to know, I'll be sure to change that to make sure it passes.
>
>>
>>
>> There are also some changes which may require coordination. I'm not sure how 
>> we'd do that, the best may be to align that off-list.
>>
>> More inline.
>>
>> On Thu, Jun 15, 2023 at 10:13 PM  wrote:
>> >
>> > From: Jeremy Spewock 
>> >
>> > Adds a new test suite as well as configuration changes needed for running
>> > smoke tests that verify general environment aspects of the system
>> > under test. If any of these tests fail, the DTS execution terminates
>> > as part of a "fail-fast" model.
>> >
>> > Signed-off-by: Jeremy Spewock 
>> > ---
>> >  dts/conf.yaml |  13 ++
>> >  dts/framework/config/__init__.py  | 114 +--
>> >  dts/framework/config/conf_yaml_schema.json| 135 +-
>> >  dts/framework/dts.py  | 101 ++---
>> >  dts/framework/exception.py|  12 ++
>> >  dts/framework/remote_session/__init__.py  |  10 +-
>> >  dts/framework/remote_session/os_session.py|  34 -
>> >  dts/framework/remote_session/posix_session.py |  30 
>> >  .../remote_session/remote/__init__.py |  12 ++
>> >  .../remote/interactive_remote_session.py  | 113 +++
>> >  .../remote/interactive_shell.py   |  98 +
>> >  .../remote_session/remote/testpmd_shell.py|  58 
>> >  dts/framework/test_result.py  |  38 -
>> >  dts/framework/test_suite.py   |  31 +++-
>> >  dts/framework/testbed_model/node.py   |   2 +
>> >  dts/framework/testbed_model/sut_node.py   | 110 +-
>> >  dts/tests/TestSuite_smoke_tests.py| 101 +
>> >  17 files changed, 962 insertions(+), 50 deletions(-)
>> >  create mode 100644 
>> > dts/framework/remote_session/remote/interactive_remote_session.py
>> >  create mode 100644 
>> > dts/framework/remote_session/remote/interactive_shell.py
>> >  create mode 100644 dts/framework/remote_session/remote/testpmd_shell.py
>> >  create mode 100644 dts/tests/TestSuite_smoke_tests.py
>> >
>> > diff --git a/dts/conf.yaml b/dts/conf.yaml
>> > index a9bd8a3e..03fd57e1 100644
>> > --- a/dts/conf.yaml
>> > +++ b/dts/conf.yaml
>> > @@ -10,6 +10,8 @@ executions:
>> >  compiler_wrapper: ccache
>> >  perf: false
>> >  func: true
>> > +vdevs: #names of virtual devices to be used for testing
>>
>> Vdevs are optional, let's mention that in the comment as with the hugepages 
>> config.
>
>
> That's a good point, I'll be sure to include that for clarity.
>
>>
>>
>> >
>> > +  - "crypto_openssl"
>>
>> How (or where) is this configured in the original DTS? The vdevs are only 
>> going to be used on SUTs, so it may make sense to put them to node config. 
>> On the other hand, each execution using the SUT may use different vdevs, so 
>> this is probably the best place. Maybe we could move it under 
>> system_under_test in execution? That would make more sense I think - it 
>> would be an addition to the existing SUT configuration (as in here's where 
>> we augment SUT config specific to the execution).
>>
>
>
> I added it under execution under that same line of thinking that you 
> mentioned: different executions might call for use of different vdevs. I 
> think that is a good point however that these are only going to be used on 
> the SUT so it makes sense to add it under that section.
>
> I think this would potentially be good for other things we mentioned as well 
> like how to handle ports on the SUT node and if those should be listed under 
> SUT or execution. I think if we turn this system_under_test key into an 
> object that we can add things to the SUT based on the execution. Then, in the 
> future, we could create a devices object that could be used for CPU devices, 
> NICs, or things of that nature and add them to the SUT based on the execution.

It seems we have an agreement. Let's put vdevs under system_under_test
and we'll put other execution specific SUT config there as we add new
features.

>
>> >
>> >  test_suites:
>> >- hello_world
>> >  system_under_test: "SUT 1"
>> > @@ -20,6 +22,17 @@ nodes:
>> >  arch: x86_64
>> >  os: linux
>> > 

RE: [EXT] [PATCH v2] ipsec: fix NAT-T header length calculation

2023-07-11 Thread Akhil Goyal
> UDP header and L2 header (if any) length is included in sa->hdr_len.
> Take care of that in L3 header and pakcet length calculation.
> 
> Fixes: 01eef5907fc3 ("ipsec: support NAT-T")
> Cc: sta...@dpdk.org
> 
> Signed-off-by: Xiao Liang 
> Acked-by: Konstantin Ananyev 
> Acked-by: Radu Nicolau 

You should supersede the previous versions in patchworks while sending the next 
version.

Applied to dpdk-next-crypto
Thanks


RE: [EXT] [PATCH] test/cryptodev: remove unnecessary null check before free

2023-07-11 Thread Akhil Goyal
> Found by devtools/cocci/nullfree.cocci
> 
> Fixes: 2d970c663314 ("cryptodev: add asymmetric SM2 algorithm")
> Cc: gmuthukri...@marvell.com
> Signed-off-by: Stephen Hemminger 
> ---
Applied to dpdk-next-crypto
Thanks.


RE: [EXT] Re: [PATCH v2] doc: announce addition of new security IPsec SA option

2023-07-11 Thread Akhil Goyal
> Subject: [EXT] Re: [PATCH v2] doc: announce addition of new security IPsec SA
> option
> 
> On Tue, Jul 4, 2023 at 10:45 AM Nithin Dabilpuram
>  wrote:
> >
> > Announce addition of new security IPsec SA option to enable
> > out of place processing in Ingress Inline inbound SA's.
> >
> > Signed-off-by: Nithin Dabilpuram 
> > Acked-by: Akhil Goyal 
> 
> Acked-by: Jerin Jacob 

Acked-by: Kai Ji 
Copied Kai's ack from v1 of this patch.

Applied to dpdk-next-crypto
Thanks.



Re: [PATCH v2] mailmap: fix sorting

2023-07-11 Thread Ferruh Yigit
On 7/6/2023 3:42 AM, Stephen Hemminger wrote:
> On Wed,  5 Jul 2023 19:32:48 -0700
> Stephen Hemminger  wrote:
> 
>> The mailmap file is supposed to be in sorted order,
>> but several entries are in the wrong place.
>>
>> Signed-off-by: Stephen Hemminger 
>> ---
>> v2 - use en_us.UTF-8 sort order
>>
>>  .mailmap | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/.mailmap b/.mailmap
>> index d200f363394d..bfd3528cf734 100644
>> --- a/.mailmap
>> +++ b/.mailmap
>> @@ -115,8 +115,8 @@ Anoob Joseph  
>> 
>>  Antara Ganesh Kolar 
>>  Anthony Fee 
>>  Antonio Fischetti 
>> -Anup Prabhu 
>>  Anupam Kapoor 
>> +Anup Prabhu 
>>  Apeksha Gupta 
>>  Archana Muniganti  
>> 
>>  Archit Pandey 
> 
> Never mind, something is off if Anup shows up after Anupam
>

This sorting logic already in the file:
 Yanjie Xu 
 Yan Xia 

and I don't know how to take following (may sort be ignoring the
white-space between name and surname?):
 Yi Li 
 Yi Liu 
 Yilong Lv 
 Yi Lu 


But to be able to sort whole file with 'sort' and no need to manually
fix above quirks, I am OK with the change, hence:

Acked-by: Ferruh Yigit 


回复: [PATCH v3] vhost: add notify reply ops to fix message deadlock

2023-07-11 Thread Rma Ma
> Since backend and frontend message are synchronous in the same thread,
> there will be a probability of message deadlock.
> Consider each driver to determine whether to wait for response.
>
> Fixes: d90cf7d111ac ("vhost: support host notifier")
> Cc: maxime.coque...@redhat.com
> Signed-off-by: Rma Ma 
> ---
> v2 - fix format error in commit message
> v3 - add --in-reply-to
> ---

Hi Maxime,

This patch helps to fix vhost-user message deadlock, could you help review it?

Thanks.


Best wishes,

Rma


发件人: Rma Ma
发送时间: 2023年7月4日 10:52
收件人: dpdk-dev 
抄送: Maxime Coquelin ; Chenbo Xia 
; Rma Ma 
主题: [PATCH v3] vhost: add notify reply ops to fix message deadlock

Since backend and frontend message are synchronous in the same thread,
there will be a probability of message deadlock.
Consider each driver to determine whether to wait for response.

Fixes: d90cf7d111ac ("vhost: support host notifier")
Cc: maxime.coque...@redhat.com
Signed-off-by: Rma Ma 
---
v2 - fix format error in commit message
v3 - add --in-reply-to
---
 lib/vhost/vdpa_driver.h |  3 +++
 lib/vhost/vhost_user.c  | 23 ++-
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/lib/vhost/vdpa_driver.h b/lib/vhost/vdpa_driver.h
index 8db4ab9f4d..3d2ea3c90e 100644
--- a/lib/vhost/vdpa_driver.h
+++ b/lib/vhost/vdpa_driver.h
@@ -81,6 +81,9 @@ struct rte_vdpa_dev_ops {

 /** get device type: net device, blk device... */
 int (*get_dev_type)(struct rte_vdpa_device *dev, uint32_t *type);
+
+   /** Get the notify reply flag */
+   int (*get_notify_reply_flag)(int vid, bool *need_reply);
 };

 /**
diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
index 901a80bbaa..aa61992939 100644
--- a/lib/vhost/vhost_user.c
+++ b/lib/vhost/vhost_user.c
@@ -3365,13 +3365,14 @@ rte_vhost_backend_config_change(int vid, bool 
need_reply)
 static int vhost_user_backend_set_vring_host_notifier(struct virtio_net *dev,
 int index, int fd,
 uint64_t offset,
-   uint64_t size)
+   uint64_t size,
+   bool need_reply)
 {
 int ret;
 struct vhu_msg_context ctx = {
 .msg = {
 .request.backend = 
VHOST_USER_BACKEND_VRING_HOST_NOTIFIER_MSG,
-   .flags = VHOST_USER_VERSION | VHOST_USER_NEED_REPLY,
+   .flags = VHOST_USER_VERSION,
 .size = sizeof(ctx.msg.payload.area),
 .payload.area = {
 .u64 = index & VHOST_USER_VRING_IDX_MASK,
@@ -3388,7 +3389,13 @@ static int 
vhost_user_backend_set_vring_host_notifier(struct virtio_net *dev,
 ctx.fd_num = 1;
 }

-   ret = send_vhost_backend_message_process_reply(dev, &ctx);
+   if (!need_reply)
+   ret = send_vhost_backend_message(dev, &ctx);
+   else {
+   ctx.msg.flags |= VHOST_USER_NEED_REPLY;
+   ret = send_vhost_backend_message_process_reply(dev, &ctx);
+   }
+
 if (ret < 0)
 VHOST_LOG_CONFIG(dev->ifname, ERR, "failed to set host 
notifier (%d)\n", ret);

@@ -3402,6 +3409,7 @@ int rte_vhost_host_notifier_ctrl(int vid, uint16_t qid, 
bool enable)
 int vfio_device_fd, ret = 0;
 uint64_t offset, size;
 unsigned int i, q_start, q_last;
+   bool need_reply;

 dev = get_device(vid);
 if (!dev)
@@ -3440,6 +3448,11 @@ int rte_vhost_host_notifier_ctrl(int vid, uint16_t qid, 
bool enable)
 if (vfio_device_fd < 0)
 return -ENOTSUP;

+   if (vdpa_dev->ops->get_notify_reply_flag == NULL)
+   need_reply = true;
+   else
+   vdpa_dev->ops->get_notify_reply_flag(vid, &need_reply);
+
 if (enable) {
 for (i = q_start; i <= q_last; i++) {
 if (vdpa_dev->ops->get_notify_area(vid, i, &offset,
@@ -3449,7 +3462,7 @@ int rte_vhost_host_notifier_ctrl(int vid, uint16_t qid, 
bool enable)
 }

 if (vhost_user_backend_set_vring_host_notifier(dev, i,
-   vfio_device_fd, offset, size) < 0) {
+   vfio_device_fd, offset, size, 
need_reply) < 0) {
 ret = -EFAULT;
 goto disable;
 }
@@ -3458,7 +3471,7 @@ int rte_vhost_host_notifier_ctrl(int vid, uint16_t qid, 
bool enable)
 disable:
 for (i = q_start; i <= q_last; i++) {
 vhost_user_backend_set_vring_host_notifier(dev, i, -1,
-   0, 0);
+   0, 0, need_reply);

RE: [PATCH] net/pcap: support MTU set

2023-07-11 Thread Ido Goshen
af_packet is hard coded limited to 1518 bytes so it cannot be used for jumbo

Indifferent, why is it better that pcap would NOT support api that all other 
pmds do (especially if it doesn't change legacy behavior when it's not used)?

> -Original Message-
> From: Ferruh Yigit 
> Sent: Monday, 10 July 2023 20:47
> To: Stephen Hemminger ; Ido Goshen
> 
> Cc: Ferruh Yigit ; dev@dpdk.org
> Subject: Re: [PATCH] net/pcap: support MTU set
> 
> On 7/10/2023 5:45 PM, Stephen Hemminger wrote:
> > On Thu, 17 Mar 2022 19:43:47 +0200
> > ido g  wrote:
> >
> >> Support rte_eth_dev_set_mtu by pcap vdevs Enforce mtu on rx/tx For
> >> more details see https://bugs.dpdk.org/show_bug.cgi?id=961
> >>
> >> Signed-off-by: ido g 
> >
> > Feeling less convinced that this is needed.
> > The motivation appears to be to test with an underlying Linux device.
> > If so, then why not use af_packet or tap devices which already should
> handle MTU?
> >
> 
> I am feeling similar for case that requires underlying physical device.
> 
> If there is a need/use case for .pcap file, as far as I can see v4 version of 
> this
> set is handling .pcap file case.


Re: [PATCH v2 1/2] dts: add smoke tests

2023-07-11 Thread Juraj Linkeš
Just a few more comments.

On Mon, Jul 10, 2023 at 6:23 PM  wrote:
>
> From: Jeremy Spewock 
>
> Adds a new test suite for running smoke tests that verify general
> configuration aspects of the system under test. If any of these tests
> fail, the DTS execution terminates as part of a "fail-fast" model.
>
> Signed-off-by: Jeremy Spewock 
> ---
>  dts/conf.yaml |  17 +-
>  dts/framework/config/__init__.py  | 116 +--
>  dts/framework/config/conf_yaml_schema.json| 142 +-
>  dts/framework/dts.py  |  88 ++---
>  dts/framework/exception.py|  12 ++
>  dts/framework/remote_session/__init__.py  |  10 +-
>  dts/framework/remote_session/os_session.py|  24 ++-
>  dts/framework/remote_session/posix_session.py |  29 ++-
>  .../remote_session/remote/__init__.py |  10 +
>  .../remote/interactive_remote_session.py  | 118 
>  .../remote/interactive_shell.py   |  99 ++
>  .../remote_session/remote/testpmd_shell.py|  67 +++
>  dts/framework/test_result.py  |  37 +++-
>  dts/framework/test_suite.py   |  21 +-
>  dts/framework/testbed_model/node.py   |   2 +
>  dts/framework/testbed_model/sut_node.py   | 180 +-
>  dts/tests/TestSuite_smoke_tests.py| 118 
>  17 files changed, 994 insertions(+), 96 deletions(-)
>  create mode 100644 
> dts/framework/remote_session/remote/interactive_remote_session.py
>  create mode 100644 dts/framework/remote_session/remote/interactive_shell.py
>  create mode 100644 dts/framework/remote_session/remote/testpmd_shell.py
>  create mode 100644 dts/tests/TestSuite_smoke_tests.py
>
> diff --git a/dts/conf.yaml b/dts/conf.yaml
> index a9bd8a3e..2717de13 100644
> --- a/dts/conf.yaml
> +++ b/dts/conf.yaml
> @@ -10,9 +10,13 @@ executions:
>  compiler_wrapper: ccache
>  perf: false
>  func: true
> +skip_smoke_tests: false #optional flag that allow you to ski smoke tests

Typo: ski
Also put a space after #

>  test_suites:
>- hello_world
> -system_under_test: "SUT 1"
> +system_under_test:
> +  node_name: "SUT 1"
> +  vdevs: #optional: if removed vdevs won't be used in the execution

Missing space after #
The sentence after hugepages has a comma in it, let's unify those.

> +- "crypto_openssl"
>  nodes:
>- name: "SUT 1"
>  hostname: sut1.change.me.localhost
> @@ -20,6 +24,17 @@ nodes:
>  arch: x86_64
>  os: linux
>  lcores: ""
> +ports:

I'm comparing my version with this patch and I've just noticed this -
let's put the ports at the end (after hugepages). This way we'll have
the configuration sorted into sections of sorts:
Cores/cpu config
Memory config
Port/devices config

> +  - pci: ":00:08.0"
> +os_driver_for_dpdk: vfio-pci #OS driver that DPDK will use

Missing space after #

> +os_driver: i40e
> +peer_node: "TG 1"
> +peer_pci: ":00:08.0"
> +  - pci: ":00:08.1"
> +os_driver_for_dpdk: vfio-pci
> +os_driver: i40e
> +peer_node: "TG 1"
> +peer_pci: ":00:08.1"
>  use_first_core: false
>  memory_channels: 4
>  hugepages:  # optional; if removed, will use system hugepage 
> configuration
> diff --git a/dts/framework/config/__init__.py 
> b/dts/framework/config/__init__.py
> index ebb0823f..75ac1cbe 100644
> --- a/dts/framework/config/__init__.py
> +++ b/dts/framework/config/__init__.py
> @@ -12,6 +12,7 @@
>  import pathlib
>  from dataclasses import dataclass
>  from enum import Enum, auto, unique
> +from pathlib import PurePath
>  from typing import Any, TypedDict
>
>  import warlock  # type: ignore
> @@ -72,6 +73,20 @@ class HugepageConfiguration:
>  force_first_numa: bool
>
>
> +@dataclass(slots=True, frozen=True)
> +class PortConfig:
> +node: str
> +pci: str
> +os_driver_for_dpdk: str
> +os_driver: str
> +peer_node: str
> +peer_pci: str
> +
> +@staticmethod
> +def from_dict(node: str, d: dict) -> "PortConfig":
> +return PortConfig(node=node, **d)
> +
> +
>  @dataclass(slots=True, frozen=True)
>  class NodeConfiguration:
>  name: str
> @@ -84,6 +99,7 @@ class NodeConfiguration:
>  use_first_core: bool
>  memory_channels: int
>  hugepages: HugepageConfiguration | None
> +ports: list[PortConfig]
>
>  @staticmethod
>  def from_dict(d: dict) -> "NodeConfiguration":
> @@ -92,18 +108,43 @@ def from_dict(d: dict) -> "NodeConfiguration":
>  if "force_first_numa" not in hugepage_config:
>  hugepage_config["force_first_numa"] = False
>  hugepage_config = HugepageConfiguration(**hugepage_config)
> +common_config = {
> +"name": d["name"],
> +"hostname": d["hostname"],
> +"user": d["user"],
> +"password": d.get("password"),
>

[PATCH] kni: fix build with Linux 6.5

2023-07-11 Thread Ferruh Yigit
The get_user_pages_remote() API has been modified in Linux kernel v6.5
[1], "struct vm_area_struct **vmas" parameter removed from the API.

To fix KNI build with Linux kernel v6.5, version check added around the
get_user_pages_remote() API.

[1]
ca5e863233e8 ("mm/gup: remove vmas parameter from get_user_pages_remote()")

Cc: sta...@dpdk.org

Signed-off-by: Ferruh Yigit 
---
 kernel/linux/kni/compat.h  | 4 
 kernel/linux/kni/kni_dev.h | 4 
 2 files changed, 8 insertions(+)

diff --git a/kernel/linux/kni/compat.h b/kernel/linux/kni/compat.h
index 7aa6cd9fca75..8beb67046577 100644
--- a/kernel/linux/kni/compat.h
+++ b/kernel/linux/kni/compat.h
@@ -151,3 +151,7 @@
 RHEL_RELEASE_VERSION(9, 1) <= RHEL_RELEASE_CODE))
 #define HAVE_NETIF_RX_NI
 #endif
+
+#if KERNEL_VERSION(6, 5, 0) > LINUX_VERSION_CODE
+#define HAVE_VMA_IN_GUP
+#endif
diff --git a/kernel/linux/kni/kni_dev.h b/kernel/linux/kni/kni_dev.h
index 21bfb6890e30..975379825b2d 100644
--- a/kernel/linux/kni/kni_dev.h
+++ b/kernel/linux/kni/kni_dev.h
@@ -107,7 +107,11 @@ static inline phys_addr_t iova_to_phys(struct task_struct 
*tsk,
 #ifdef HAVE_TSK_IN_GUP
ret = get_user_pages_remote(tsk, tsk->mm, iova, 1, 0, &page, NULL, 
NULL);
 #else
+  #ifdef HAVE_VMA_IN_GUP
ret = get_user_pages_remote(tsk->mm, iova, 1, 0, &page, NULL, NULL);
+  #else
+   ret = get_user_pages_remote(tsk->mm, iova, 1, 0, &page, NULL);
+  #endif
 #endif
if (ret < 0)
return 0;
-- 
2.34.1



Re: [Patch v2] net/mana: fix counter overflow for posted WQE

2023-07-11 Thread Ferruh Yigit
On 7/11/2023 12:51 AM, lon...@linuxonhyperv.com wrote:
> From: Long Li 
> 
> This counter should set to uint16_t, the same type as pkt_received.
> Otherwise, it may overflow when pkt_received goes over 256.
> 
> Thanks Xinhao Kong  for debugging this.
> 
> Fixes: 517ed6e2d590 ("net/mana: add basic driver with build environment")
> Cc: sta...@dpdk.org
>
> Signed-off-by: Long Li 
>

Applied to dpdk-next-net/main, thanks.


Re: [Patch v2] net/mana: use the correct WQE count for ringing RQ doorbell

2023-07-11 Thread Ferruh Yigit
On 7/11/2023 12:51 AM, lon...@linuxonhyperv.com wrote:
> From: Long Li 
> 
> The hardware specification specifies that WQE_COUNT should set to 0 for
> the Receive Queue. Although currently the hardware doesn't enforce the
> check, in the future releases it may check on this value.
> 
> Signed-off-by: Long Li 
>

Is Fixes tag intentionally omitted since change is because of HW / Spec
change, instead of code being wrong when implemented?



[PATCH 0/5] net/hns3: some performance optimizations

2023-07-11 Thread Dongdong Liu
This patchset is to do some performance optimizations for hns3.

Huisong Li (5):
  net/hns3: fix incorrect index to look up table in NEON Rx
  net/hns3: fix the order of NEON Rx code
  net/hns3: optimize free mbuf code for SVE Tx
  net/hns3: optimize the rearm mbuf function for SVE Rx
  net/hns3: optimize SVE Rx performance

 drivers/net/hns3/hns3_rxtx_vec.c  |  51 --
 drivers/net/hns3/hns3_rxtx_vec.h  |  51 ++
 drivers/net/hns3/hns3_rxtx_vec_neon.h |  82 -
 drivers/net/hns3/hns3_rxtx_vec_sve.c  | 230 --
 4 files changed, 114 insertions(+), 300 deletions(-)

--
2.22.0



[PATCH 1/5] net/hns3: fix incorrect index to look up table in NEON Rx

2023-07-11 Thread Dongdong Liu
From: Huisong Li 

In hns3_recv_burst_vec(), the index to get packet length and data
size are reversed. Fortunately, this doesn't affect functionality
because the NEON Rx only supports single BD in which the packet
length is equal to the date size. Now this patch fixes it to get
back to the truth.

Fixes: a3d4f4d291d7 ("net/hns3: support NEON Rx")
Cc: sta...@dpdk.org

Signed-off-by: Huisong Li 
Signed-off-by: Dongdong Liu 
---
 drivers/net/hns3/hns3_rxtx_vec_neon.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/hns3/hns3_rxtx_vec_neon.h 
b/drivers/net/hns3/hns3_rxtx_vec_neon.h
index 6c49c70fc7..564d831a48 100644
--- a/drivers/net/hns3/hns3_rxtx_vec_neon.h
+++ b/drivers/net/hns3/hns3_rxtx_vec_neon.h
@@ -142,8 +142,8 @@ hns3_recv_burst_vec(struct hns3_rx_queue *__restrict rxq,
/* mask to shuffle from desc to mbuf's rx_descriptor_fields1 */
uint8x16_t shuf_desc_fields_msk = {
0xff, 0xff, 0xff, 0xff,  /* packet type init zero */
-   22, 23, 0xff, 0xff,  /* rx.pkt_len to rte_mbuf.pkt_len */
-   20, 21,  /* size to rte_mbuf.data_len */
+   20, 21, 0xff, 0xff,  /* rx.pkt_len to rte_mbuf.pkt_len */
+   22, 23,  /* size to rte_mbuf.data_len */
0xff, 0xff,  /* rte_mbuf.vlan_tci init zero */
8, 9, 10, 11,/* rx.rss_hash to rte_mbuf.hash.rss */
};
-- 
2.22.0



[PATCH 3/5] net/hns3: optimize free mbuf code for SVE Tx

2023-07-11 Thread Dongdong Liu
From: Huisong Li 

Currently, hns3 SVE Tx checks the valid bits of all descriptors
in a batch and then determines whether to release the corresponding
mbufs. Actually, once the valid bit of any descriptor in a batch
isn't cleared, driver does not need to scan the rest of descriptors.

If we optimize SVE codes algorithm about this function, the performance
of a single queue for 64B packet is improved by ~2% on txonly forwarding
mode. And if use C code to scan all descriptors, the performance is
improved by ~8%.

So this patch selects C code to optimize this code to improve the SVE
Tx performance.

Signed-off-by: Huisong Li 
Signed-off-by: Dongdong Liu 
---
 drivers/net/hns3/hns3_rxtx_vec_sve.c | 42 +---
 1 file changed, 1 insertion(+), 41 deletions(-)

diff --git a/drivers/net/hns3/hns3_rxtx_vec_sve.c 
b/drivers/net/hns3/hns3_rxtx_vec_sve.c
index 8bfc3de049..5011544e07 100644
--- a/drivers/net/hns3/hns3_rxtx_vec_sve.c
+++ b/drivers/net/hns3/hns3_rxtx_vec_sve.c
@@ -337,46 +337,6 @@ hns3_recv_pkts_vec_sve(void *__restrict rx_queue,
return nb_rx;
 }
 
-static inline void
-hns3_tx_free_buffers_sve(struct hns3_tx_queue *txq)
-{
-#define HNS3_SVE_CHECK_DESCS_PER_LOOP  8
-#define TX_VLD_U8_ZIP_INDEXsvindex_u8(0, 4)
-   svbool_t pg32 = svwhilelt_b32(0, HNS3_SVE_CHECK_DESCS_PER_LOOP);
-   svuint32_t vld, vld2;
-   svuint8_t vld_u8;
-   uint64_t vld_all;
-   struct hns3_desc *tx_desc;
-   int i;
-
-   /*
-* All mbufs can be released only when the VLD bits of all
-* descriptors in a batch are cleared.
-*/
-   /* do logical OR operation for all desc's valid field */
-   vld = svdup_n_u32(0);
-   tx_desc = &txq->tx_ring[txq->next_to_clean];
-   for (i = 0; i < txq->tx_rs_thresh; i += HNS3_SVE_CHECK_DESCS_PER_LOOP,
-   tx_desc += HNS3_SVE_CHECK_DESCS_PER_LOOP) {
-   vld2 = svld1_gather_u32offset_u32(pg32, (uint32_t *)tx_desc,
-   svindex_u32(BD_FIELD_VALID_OFFSET, BD_SIZE));
-   vld = svorr_u32_z(pg32, vld, vld2);
-   }
-   /* shift left and then right to get all valid bit */
-   vld = svlsl_n_u32_z(pg32, vld,
-   HNS3_UINT32_BIT - 1 - HNS3_TXD_VLD_B);
-   vld = svreinterpret_u32_s32(svasr_n_s32_z(pg32,
-   svreinterpret_s32_u32(vld), HNS3_UINT32_BIT - 1));
-   /* use tbl to compress 32bit-lane to 8bit-lane */
-   vld_u8 = svtbl_u8(svreinterpret_u8_u32(vld), TX_VLD_U8_ZIP_INDEX);
-   /* dump compressed 64bit to variable */
-   svst1_u64(PG64_64BIT, &vld_all, svreinterpret_u64_u8(vld_u8));
-   if (vld_all > 0)
-   return;
-
-   hns3_tx_bulk_free_buffers(txq);
-}
-
 static inline void
 hns3_tx_fill_hw_ring_sve(struct hns3_tx_queue *txq,
 struct rte_mbuf **pkts,
@@ -462,7 +422,7 @@ hns3_xmit_fixed_burst_vec_sve(void *__restrict tx_queue,
uint16_t nb_tx = 0;
 
if (txq->tx_bd_ready < txq->tx_free_thresh)
-   hns3_tx_free_buffers_sve(txq);
+   hns3_tx_free_buffers(txq);
 
nb_pkts = RTE_MIN(txq->tx_bd_ready, nb_pkts);
if (unlikely(nb_pkts == 0)) {
-- 
2.22.0



[PATCH 4/5] net/hns3: optimize the rearm mbuf function for SVE Rx

2023-07-11 Thread Dongdong Liu
From: Huisong Li 

Use hns3_rxq_rearm_mbuf() to replace the hns3_rxq_rearm_mbuf_sve()
to optimize the performance of SVE Rx.

On the rxonly forwarding mode, the performance of a single queue
for 64B packet is improved by ~15%.

Signed-off-by: Huisong Li 
Signed-off-by: Dongdong Liu 
---
 drivers/net/hns3/hns3_rxtx_vec.c | 51 ---
 drivers/net/hns3/hns3_rxtx_vec.h | 51 +++
 drivers/net/hns3/hns3_rxtx_vec_sve.c | 52 ++--
 3 files changed, 53 insertions(+), 101 deletions(-)

diff --git a/drivers/net/hns3/hns3_rxtx_vec.c b/drivers/net/hns3/hns3_rxtx_vec.c
index cd9264d91b..9708ec614e 100644
--- a/drivers/net/hns3/hns3_rxtx_vec.c
+++ b/drivers/net/hns3/hns3_rxtx_vec.c
@@ -55,57 +55,6 @@ hns3_xmit_pkts_vec(void *tx_queue, struct rte_mbuf 
**tx_pkts, uint16_t nb_pkts)
return nb_tx;
 }
 
-static inline void
-hns3_rxq_rearm_mbuf(struct hns3_rx_queue *rxq)
-{
-#define REARM_LOOP_STEP_NUM4
-   struct hns3_entry *rxep = &rxq->sw_ring[rxq->rx_rearm_start];
-   struct hns3_desc *rxdp = rxq->rx_ring + rxq->rx_rearm_start;
-   uint64_t dma_addr;
-   int i;
-
-   if (unlikely(rte_mempool_get_bulk(rxq->mb_pool, (void *)rxep,
- HNS3_DEFAULT_RXQ_REARM_THRESH) < 0)) {
-   rte_eth_devices[rxq->port_id].data->rx_mbuf_alloc_failed++;
-   return;
-   }
-
-   for (i = 0; i < HNS3_DEFAULT_RXQ_REARM_THRESH; i += REARM_LOOP_STEP_NUM,
-   rxep += REARM_LOOP_STEP_NUM, rxdp += REARM_LOOP_STEP_NUM) {
-   if (likely(i <
-   HNS3_DEFAULT_RXQ_REARM_THRESH - REARM_LOOP_STEP_NUM)) {
-   rte_prefetch_non_temporal(rxep[4].mbuf);
-   rte_prefetch_non_temporal(rxep[5].mbuf);
-   rte_prefetch_non_temporal(rxep[6].mbuf);
-   rte_prefetch_non_temporal(rxep[7].mbuf);
-   }
-
-   dma_addr = rte_mbuf_data_iova_default(rxep[0].mbuf);
-   rxdp[0].addr = rte_cpu_to_le_64(dma_addr);
-   rxdp[0].rx.bd_base_info = 0;
-
-   dma_addr = rte_mbuf_data_iova_default(rxep[1].mbuf);
-   rxdp[1].addr = rte_cpu_to_le_64(dma_addr);
-   rxdp[1].rx.bd_base_info = 0;
-
-   dma_addr = rte_mbuf_data_iova_default(rxep[2].mbuf);
-   rxdp[2].addr = rte_cpu_to_le_64(dma_addr);
-   rxdp[2].rx.bd_base_info = 0;
-
-   dma_addr = rte_mbuf_data_iova_default(rxep[3].mbuf);
-   rxdp[3].addr = rte_cpu_to_le_64(dma_addr);
-   rxdp[3].rx.bd_base_info = 0;
-   }
-
-   rxq->rx_rearm_start += HNS3_DEFAULT_RXQ_REARM_THRESH;
-   if (rxq->rx_rearm_start >= rxq->nb_rx_desc)
-   rxq->rx_rearm_start = 0;
-
-   rxq->rx_rearm_nb -= HNS3_DEFAULT_RXQ_REARM_THRESH;
-
-   hns3_write_reg_opt(rxq->io_head_reg, HNS3_DEFAULT_RXQ_REARM_THRESH);
-}
-
 uint16_t
 hns3_recv_pkts_vec(void *__restrict rx_queue,
   struct rte_mbuf **__restrict rx_pkts,
diff --git a/drivers/net/hns3/hns3_rxtx_vec.h b/drivers/net/hns3/hns3_rxtx_vec.h
index 2c8a91921e..a9a6774294 100644
--- a/drivers/net/hns3/hns3_rxtx_vec.h
+++ b/drivers/net/hns3/hns3_rxtx_vec.h
@@ -94,4 +94,55 @@ hns3_rx_reassemble_pkts(struct rte_mbuf **rx_pkts,
 
return count;
 }
+
+static inline void
+hns3_rxq_rearm_mbuf(struct hns3_rx_queue *rxq)
+{
+#define REARM_LOOP_STEP_NUM4
+   struct hns3_entry *rxep = &rxq->sw_ring[rxq->rx_rearm_start];
+   struct hns3_desc *rxdp = rxq->rx_ring + rxq->rx_rearm_start;
+   uint64_t dma_addr;
+   int i;
+
+   if (unlikely(rte_mempool_get_bulk(rxq->mb_pool, (void *)rxep,
+ HNS3_DEFAULT_RXQ_REARM_THRESH) < 0)) {
+   rte_eth_devices[rxq->port_id].data->rx_mbuf_alloc_failed++;
+   return;
+   }
+
+   for (i = 0; i < HNS3_DEFAULT_RXQ_REARM_THRESH; i += REARM_LOOP_STEP_NUM,
+   rxep += REARM_LOOP_STEP_NUM, rxdp += REARM_LOOP_STEP_NUM) {
+   if (likely(i <
+   HNS3_DEFAULT_RXQ_REARM_THRESH - REARM_LOOP_STEP_NUM)) {
+   rte_prefetch_non_temporal(rxep[4].mbuf);
+   rte_prefetch_non_temporal(rxep[5].mbuf);
+   rte_prefetch_non_temporal(rxep[6].mbuf);
+   rte_prefetch_non_temporal(rxep[7].mbuf);
+   }
+
+   dma_addr = rte_mbuf_data_iova_default(rxep[0].mbuf);
+   rxdp[0].addr = rte_cpu_to_le_64(dma_addr);
+   rxdp[0].rx.bd_base_info = 0;
+
+   dma_addr = rte_mbuf_data_iova_default(rxep[1].mbuf);
+   rxdp[1].addr = rte_cpu_to_le_64(dma_addr);
+   rxdp[1].rx.bd_base_info = 0;
+
+   dma_addr = rte_mbuf_data_iova_default(rxep[2].mbuf);
+   rxdp[2].addr = rte_cpu_to_le_64(dma_addr);
+   rxdp[2].rx.

[PATCH 2/5] net/hns3: fix the order of NEON Rx code

2023-07-11 Thread Dongdong Liu
From: Huisong Li 

This patch reorders the order of the NEON Rx for better maintenance
and easier understanding.

Fixes: a3d4f4d291d7 ("net/hns3: support NEON Rx")
Cc: sta...@dpdk.org

Signed-off-by: Huisong Li 
Signed-off-by: Dongdong Liu 
---
 drivers/net/hns3/hns3_rxtx_vec_neon.h | 78 +++
 1 file changed, 31 insertions(+), 47 deletions(-)

diff --git a/drivers/net/hns3/hns3_rxtx_vec_neon.h 
b/drivers/net/hns3/hns3_rxtx_vec_neon.h
index 564d831a48..0dc6b9f0a2 100644
--- a/drivers/net/hns3/hns3_rxtx_vec_neon.h
+++ b/drivers/net/hns3/hns3_rxtx_vec_neon.h
@@ -180,19 +180,12 @@ hns3_recv_burst_vec(struct hns3_rx_queue *__restrict rxq,
bd_vld = vset_lane_u16(rxdp[2].rx.bdtype_vld_udp0, bd_vld, 2);
bd_vld = vset_lane_u16(rxdp[3].rx.bdtype_vld_udp0, bd_vld, 3);
 
-   /* load 2 mbuf pointer */
-   mbp1 = vld1q_u64((uint64_t *)&sw_ring[pos]);
-
bd_vld = vshl_n_u16(bd_vld,
HNS3_UINT16_BIT - 1 - HNS3_RXD_VLD_B);
bd_vld = vreinterpret_u16_s16(
vshr_n_s16(vreinterpret_s16_u16(bd_vld),
   HNS3_UINT16_BIT - 1));
stat = ~vget_lane_u64(vreinterpret_u64_u16(bd_vld), 0);
-
-   /* load 2 mbuf pointer again */
-   mbp2 = vld1q_u64((uint64_t *)&sw_ring[pos + 2]);
-
if (likely(stat == 0))
bd_valid_num = HNS3_DEFAULT_DESCS_PER_LOOP;
else
@@ -200,20 +193,20 @@ hns3_recv_burst_vec(struct hns3_rx_queue *__restrict rxq,
if (bd_valid_num == 0)
break;
 
-   /* use offset to control below data load oper ordering */
-   offset = rxq->offset_table[bd_valid_num];
+   /* load 4 mbuf pointer */
+   mbp1 = vld1q_u64((uint64_t *)&sw_ring[pos]);
+   mbp2 = vld1q_u64((uint64_t *)&sw_ring[pos + 2]);
 
-   /* store 2 mbuf pointer into rx_pkts */
+   /* store 4 mbuf pointer into rx_pkts */
vst1q_u64((uint64_t *)&rx_pkts[pos], mbp1);
+   vst1q_u64((uint64_t *)&rx_pkts[pos + 2], mbp2);
 
-   /* read first two descs */
+   /* use offset to control below data load oper ordering */
+   offset = rxq->offset_table[bd_valid_num];
+
+   /* read 4 descs */
descs[0] = vld2q_u64((uint64_t *)(rxdp + offset));
descs[1] = vld2q_u64((uint64_t *)(rxdp + offset + 1));
-
-   /* store 2 mbuf pointer into rx_pkts again */
-   vst1q_u64((uint64_t *)&rx_pkts[pos + 2], mbp2);
-
-   /* read remains two descs */
descs[2] = vld2q_u64((uint64_t *)(rxdp + offset + 2));
descs[3] = vld2q_u64((uint64_t *)(rxdp + offset + 3));
 
@@ -221,56 +214,47 @@ hns3_recv_burst_vec(struct hns3_rx_queue *__restrict rxq,
pkt_mbuf1.val[1] = vreinterpretq_u8_u64(descs[0].val[1]);
pkt_mbuf2.val[0] = vreinterpretq_u8_u64(descs[1].val[0]);
pkt_mbuf2.val[1] = vreinterpretq_u8_u64(descs[1].val[1]);
+   pkt_mbuf3.val[0] = vreinterpretq_u8_u64(descs[2].val[0]);
+   pkt_mbuf3.val[1] = vreinterpretq_u8_u64(descs[2].val[1]);
+   pkt_mbuf4.val[0] = vreinterpretq_u8_u64(descs[3].val[0]);
+   pkt_mbuf4.val[1] = vreinterpretq_u8_u64(descs[3].val[1]);
 
-   /* pkt 1,2 convert format from desc to pktmbuf */
+   /* 4 packets convert format from desc to pktmbuf */
pkt_mb1 = vqtbl2q_u8(pkt_mbuf1, shuf_desc_fields_msk);
pkt_mb2 = vqtbl2q_u8(pkt_mbuf2, shuf_desc_fields_msk);
+   pkt_mb3 = vqtbl2q_u8(pkt_mbuf3, shuf_desc_fields_msk);
+   pkt_mb4 = vqtbl2q_u8(pkt_mbuf4, shuf_desc_fields_msk);
 
-   /* store the first 8 bytes of pkt 1,2 mbuf's rearm_data */
-   *(uint64_t *)&sw_ring[pos + 0].mbuf->rearm_data =
-   rxq->mbuf_initializer;
-   *(uint64_t *)&sw_ring[pos + 1].mbuf->rearm_data =
-   rxq->mbuf_initializer;
-
-   /* pkt 1,2 remove crc */
+   /* 4 packets remove crc */
tmp = vsubq_u16(vreinterpretq_u16_u8(pkt_mb1), crc_adjust);
pkt_mb1 = vreinterpretq_u8_u16(tmp);
tmp = vsubq_u16(vreinterpretq_u16_u8(pkt_mb2), crc_adjust);
pkt_mb2 = vreinterpretq_u8_u16(tmp);
+   tmp = vsubq_u16(vreinterpretq_u16_u8(pkt_mb3), crc_adjust);
+   pkt_mb3 = vreinterpretq_u8_u16(tmp);
+   tmp = vsubq_u16(vreinterpretq_u16_u8(pkt_mb4), crc_adjust);
+   pkt_mb4 = vreinterpretq_u8_u16(tmp);
 
-   pkt_mbuf3.val[0] = vreinterpretq_u8_u64(descs[2].val[0]);
-   pkt_mbuf3.val[1] = vreinterpretq_u8_u64(descs[2].val[1]);
-

[PATCH 5/5] net/hns3: optimize SVE Rx performance

2023-07-11 Thread Dongdong Liu
From: Huisong Li 

This patch optimizes SVE Rx performance by the following ways:
1> optimize the calculation of valid BD number.
2> remove a temporary variable (key_fields)
3> use C language to parse some descriptor fields, instead of
   SVE instruction.
4> small step prefetch descriptor.

On the rxonly forwarding mode, the performance of a single queue
or 64B packet is improved by ~40%.

Signed-off-by: Huisong Li 
Signed-off-by: Dongdong Liu 
---
 drivers/net/hns3/hns3_rxtx_vec_sve.c | 138 ++-
 1 file changed, 28 insertions(+), 110 deletions(-)

diff --git a/drivers/net/hns3/hns3_rxtx_vec_sve.c 
b/drivers/net/hns3/hns3_rxtx_vec_sve.c
index 54aef7db8d..0e9abfebec 100644
--- a/drivers/net/hns3/hns3_rxtx_vec_sve.c
+++ b/drivers/net/hns3/hns3_rxtx_vec_sve.c
@@ -20,40 +20,36 @@
 
 #define BD_SIZE32
 #define BD_FIELD_ADDR_OFFSET   0
-#define BD_FIELD_L234_OFFSET   8
-#define BD_FIELD_XLEN_OFFSET   12
-#define BD_FIELD_RSS_OFFSET16
-#define BD_FIELD_OL_OFFSET 24
 #define BD_FIELD_VALID_OFFSET  28
 
-typedef struct {
-   uint32_t l234_info[HNS3_SVE_DEFAULT_DESCS_PER_LOOP];
-   uint32_t ol_info[HNS3_SVE_DEFAULT_DESCS_PER_LOOP];
-   uint32_t bd_base_info[HNS3_SVE_DEFAULT_DESCS_PER_LOOP];
-} HNS3_SVE_KEY_FIELD_S;
-
 static inline uint32_t
 hns3_desc_parse_field_sve(struct hns3_rx_queue *rxq,
  struct rte_mbuf **rx_pkts,
- HNS3_SVE_KEY_FIELD_S *key,
+ struct hns3_desc *rxdp,
  uint32_t   bd_vld_num)
 {
+   uint32_t l234_info, ol_info, bd_base_info;
uint32_t retcode = 0;
int ret, i;
 
for (i = 0; i < (int)bd_vld_num; i++) {
/* init rte_mbuf.rearm_data last 64-bit */
rx_pkts[i]->ol_flags = RTE_MBUF_F_RX_RSS_HASH;
-
-   ret = hns3_handle_bdinfo(rxq, rx_pkts[i], key->bd_base_info[i],
-key->l234_info[i]);
+   rx_pkts[i]->hash.rss = rxdp[i].rx.rss_hash;
+   rx_pkts[i]->pkt_len = rte_le_to_cpu_16(rxdp[i].rx.pkt_len) -
+   rxq->crc_len;
+   rx_pkts[i]->data_len = rx_pkts[i]->pkt_len;
+
+   l234_info = rxdp[i].rx.l234_info;
+   ol_info = rxdp[i].rx.ol_info;
+   bd_base_info = rxdp[i].rx.bd_base_info;
+   ret = hns3_handle_bdinfo(rxq, rx_pkts[i], bd_base_info, 
l234_info);
if (unlikely(ret)) {
retcode |= 1u << i;
continue;
}
 
-   rx_pkts[i]->packet_type = hns3_rx_calc_ptype(rxq,
-   key->l234_info[i], key->ol_info[i]);
+   rx_pkts[i]->packet_type = hns3_rx_calc_ptype(rxq, l234_info, 
ol_info);
 
/* Increment bytes counter */
rxq->basic_stats.bytes += rx_pkts[i]->pkt_len;
@@ -77,46 +73,16 @@ hns3_recv_burst_vec_sve(struct hns3_rx_queue *__restrict 
rxq,
uint16_t nb_pkts,
uint64_t *bd_err_mask)
 {
-#define XLEN_ADJUST_LEN32
-#define RSS_ADJUST_LEN 16
-#define GEN_VLD_U8_ZIP_INDEX   svindex_s8(28, -4)
uint16_t rx_id = rxq->next_to_use;
struct hns3_entry *sw_ring = &rxq->sw_ring[rx_id];
struct hns3_desc *rxdp = &rxq->rx_ring[rx_id];
-   struct hns3_desc *rxdp2;
-   HNS3_SVE_KEY_FIELD_S key_field;
+   struct hns3_desc *rxdp2, *next_rxdp;
uint64_t bd_valid_num;
uint32_t parse_retcode;
uint16_t nb_rx = 0;
int pos, offset;
 
-   uint16_t xlen_adjust[XLEN_ADJUST_LEN] = {
-   0,  0x, 1,  0x,/* 1st mbuf: pkt_len and dat_len */
-   2,  0x, 3,  0x,/* 2st mbuf: pkt_len and dat_len */
-   4,  0x, 5,  0x,/* 3st mbuf: pkt_len and dat_len */
-   6,  0x, 7,  0x,/* 4st mbuf: pkt_len and dat_len */
-   8,  0x, 9,  0x,/* 5st mbuf: pkt_len and dat_len */
-   10, 0x, 11, 0x,/* 6st mbuf: pkt_len and dat_len */
-   12, 0x, 13, 0x,/* 7st mbuf: pkt_len and dat_len */
-   14, 0x, 15, 0x,/* 8st mbuf: pkt_len and dat_len */
-   };
-
-   uint32_t rss_adjust[RSS_ADJUST_LEN] = {
-   0, 0x,/* 1st mbuf: rss */
-   1, 0x,/* 2st mbuf: rss */
-   2, 0x,/* 3st mbuf: rss */
-   3, 0x,/* 4st mbuf: rss */
-   4, 0x,/* 5st mbuf: rss */
-   5, 0x,/* 6st mbuf: rss */
-   6, 0x,/* 7st mbuf: rss */
-   7, 0x,/* 8st mbuf: rss */
-   };
-
svbool_t pg32 = svwhilelt_b32(0, HNS3_SVE_DEFAULT_DESCS_PER_LOOP);
-   svuint16_t xlen_tbl1 = svld1_u16(PG16_256BIT, xlen_adjust);
-   

Re: [PATCH 0/5] net/hns3: some performance optimizations

2023-07-11 Thread Ferruh Yigit
On 7/11/2023 11:24 AM, Dongdong Liu wrote:
> This patchset is to do some performance optimizations for hns3.
> 
> Huisong Li (5):
>   net/hns3: fix incorrect index to look up table in NEON Rx
>   net/hns3: fix the order of NEON Rx code
>   net/hns3: optimize free mbuf code for SVE Tx
>   net/hns3: optimize the rearm mbuf function for SVE Rx
>   net/hns3: optimize SVE Rx performance
>

Hi Dongdong, Huisong,

Release is around a week away, OK to get critical fixes, but I can see
there are some optimizations as well.

Is this set for current release or next release?



Re: [Patch v2] net/mana: use the correct WQE count for ringing RQ doorbell

2023-07-11 Thread Ferruh Yigit
On 7/11/2023 12:51 AM, lon...@linuxonhyperv.com wrote:
> From: Long Li 
> 
> The hardware specification specifies that WQE_COUNT should set to 0 for
> the Receive Queue. Although currently the hardware doesn't enforce the
> check, in the future releases it may check on this value.
> 
> Signed-off-by: Long Li 
>

Applied to dpdk-next-net/main, thanks.


Re: [PATCH 0/5] net/hns3: some performance optimizations

2023-07-11 Thread Dongdong Liu

Hi, Ferruh
On 2023/7/11 18:48, Ferruh Yigit wrote:

On 7/11/2023 11:24 AM, Dongdong Liu wrote:

This patchset is to do some performance optimizations for hns3.

Huisong Li (5):
  net/hns3: fix incorrect index to look up table in NEON Rx
  net/hns3: fix the order of NEON Rx code
  net/hns3: optimize free mbuf code for SVE Tx
  net/hns3: optimize the rearm mbuf function for SVE Rx
  net/hns3: optimize SVE Rx performance



Hi Dongdong, Huisong,

Release is around a week away, OK to get critical fixes, but I can see
there are some optimizations as well.

Is this set for current release or next release?


If possible, we want this patchset can be applied for current release.

Thanks,
Dongdong


.



Re: [PATCH 0/5] net/hns3: some performance optimizations

2023-07-11 Thread Ferruh Yigit
On 7/11/2023 12:27 PM, Dongdong Liu wrote:
> Hi, Ferruh
> On 2023/7/11 18:48, Ferruh Yigit wrote:
>> On 7/11/2023 11:24 AM, Dongdong Liu wrote:
>>> This patchset is to do some performance optimizations for hns3.
>>>
>>> Huisong Li (5):
>>>   net/hns3: fix incorrect index to look up table in NEON Rx
>>>   net/hns3: fix the order of NEON Rx code
>>>   net/hns3: optimize free mbuf code for SVE Tx
>>>   net/hns3: optimize the rearm mbuf function for SVE Rx
>>>   net/hns3: optimize SVE Rx performance
>>>
>>
>> Hi Dongdong, Huisong,
>>
>> Release is around a week away, OK to get critical fixes, but I can see
>> there are some optimizations as well.
>>
>> Is this set for current release or next release?
> 
> If possible, we want this patchset can be applied for current release.
> 
> 

I can see there is a good performance increase, this makes harder to
defer but I am feeling this level of change is risky and you won't have
time to test and fix any issue.

Let me get first patch, as it is a fix. I can merge remaining patches
early in next release cycle.
@Thomas, what do you think?



Re: [PATCH 1/5] net/hns3: fix incorrect index to look up table in NEON Rx

2023-07-11 Thread Ferruh Yigit
On 7/11/2023 11:24 AM, Dongdong Liu wrote:
> From: Huisong Li 
> 
> In hns3_recv_burst_vec(), the index to get packet length and data
> size are reversed. Fortunately, this doesn't affect functionality
> because the NEON Rx only supports single BD in which the packet
> length is equal to the date size. Now this patch fixes it to get
> back to the truth.
> 
> Fixes: a3d4f4d291d7 ("net/hns3: support NEON Rx")
> Cc: sta...@dpdk.org
> 
> Signed-off-by: Huisong Li 
> Signed-off-by: Dongdong Liu 
>

(Just for this patch, not series)
Applied to dpdk-next-net/main, thanks.



Re: 回复: [PATCH v3] vhost: add notify reply ops to fix message deadlock

2023-07-11 Thread Maxime Coquelin

Hi,

On 7/11/23 11:25, Rma Ma wrote:

 > Since backend and frontend message are synchronous in the same thread,
 > there will be a probability of message deadlock.
 > Consider each driver to determine whether to wait for response.
 >
 > Fixes: d90cf7d111ac ("vhost: support host notifier")
 > Cc: maxime.coque...@redhat.com
 > Signed-off-by: Rma Ma 
 > ---
 > v2 - fix format error in commit message
 > v3 - add --in-reply-to
 > ---

Hi Maxime,

This patch helps to fix vhost-user message deadlock, could you help 
review it?


The patch introduces a new device op, but it is used nowhere in vDPA
drivers.

What vDPA driver is it going to be used with?

Regards,
Maxime


Thanks.

Best wishes,

Rma


*发件人:* Rma Ma
*发送时间:* 2023年7月4日 10:52
*收件人:* dpdk-dev 
*抄送:* Maxime Coquelin ; Chenbo Xia 
; Rma Ma 

*主题:* [PATCH v3] vhost: add notify reply ops to fix message deadlock
Since backend and frontend message are synchronous in the same thread,
there will be a probability of message deadlock.
Consider each driver to determine whether to wait for response.

Fixes: d90cf7d111ac ("vhost: support host notifier")
Cc: maxime.coque...@redhat.com
Signed-off-by: Rma Ma 
---
v2 - fix format error in commit message
v3 - add --in-reply-to
---
  lib/vhost/vdpa_driver.h |  3 +++
  lib/vhost/vhost_user.c  | 23 ++-
  2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/lib/vhost/vdpa_driver.h b/lib/vhost/vdpa_driver.h
index 8db4ab9f4d..3d2ea3c90e 100644
--- a/lib/vhost/vdpa_driver.h
+++ b/lib/vhost/vdpa_driver.h
@@ -81,6 +81,9 @@ struct rte_vdpa_dev_ops {

  /** get device type: net device, blk device... */
  int (*get_dev_type)(struct rte_vdpa_device *dev, uint32_t *type);
+
+   /** Get the notify reply flag */
+   int (*get_notify_reply_flag)(int vid, bool *need_reply);
  };

  /**
diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
index 901a80bbaa..aa61992939 100644
--- a/lib/vhost/vhost_user.c
+++ b/lib/vhost/vhost_user.c
@@ -3365,13 +3365,14 @@ rte_vhost_backend_config_change(int vid, bool 
need_reply)
  static int vhost_user_backend_set_vring_host_notifier(struct 
virtio_net *dev,

  int index, int fd,
  uint64_t offset,
-   uint64_t size)
+   uint64_t size,
+   bool need_reply)
  {
  int ret;
  struct vhu_msg_context ctx = {
  .msg = {
  .request.backend = 
VHOST_USER_BACKEND_VRING_HOST_NOTIFIER_MSG,

-   .flags = VHOST_USER_VERSION | VHOST_USER_NEED_REPLY,
+   .flags = VHOST_USER_VERSION,
  .size = sizeof(ctx.msg.payload.area),
  .payload.area = {
  .u64 = index & VHOST_USER_VRING_IDX_MASK,
@@ -3388,7 +3389,13 @@ static int 
vhost_user_backend_set_vring_host_notifier(struct virtio_net *dev,

  ctx.fd_num = 1;
  }

-   ret = send_vhost_backend_message_process_reply(dev, &ctx);
+   if (!need_reply)
+   ret = send_vhost_backend_message(dev, &ctx);
+   else {
+   ctx.msg.flags |= VHOST_USER_NEED_REPLY;
+   ret = send_vhost_backend_message_process_reply(dev, &ctx);
+   }
+
  if (ret < 0)
  VHOST_LOG_CONFIG(dev->ifname, ERR, "failed to set host 
notifier (%d)\n", ret);


@@ -3402,6 +3409,7 @@ int rte_vhost_host_notifier_ctrl(int vid, uint16_t 
qid, bool enable)

  int vfio_device_fd, ret = 0;
  uint64_t offset, size;
  unsigned int i, q_start, q_last;
+   bool need_reply;

  dev = get_device(vid);
  if (!dev)
@@ -3440,6 +3448,11 @@ int rte_vhost_host_notifier_ctrl(int vid, 
uint16_t qid, bool enable)

  if (vfio_device_fd < 0)
  return -ENOTSUP;

+   if (vdpa_dev->ops->get_notify_reply_flag == NULL)
+   need_reply = true;
+   else
+   vdpa_dev->ops->get_notify_reply_flag(vid, &need_reply);
+
  if (enable) {
  for (i = q_start; i <= q_last; i++) {
  if (vdpa_dev->ops->get_notify_area(vid, i, 
&offset,
@@ -3449,7 +3462,7 @@ int rte_vhost_host_notifier_ctrl(int vid, uint16_t 
qid, bool enable)

  }

  if 
(vhost_user_backend_set_vring_host_notifier(dev, i,

-   vfio_device_fd, offset, size) < 0) {
+   vfio_device_fd, offset, size, 
need_reply) < 0) {

  ret = -EFAULT;
  goto disable;
  }
@@ -3458,7 +3471,7 @@ int rte_vhost_host_notifier

Re: [PATCH] lib/ethdev: sanity check on callback before resource allocation

2023-07-11 Thread Ferruh Yigit
On 7/11/2023 2:48 AM, fengchengwen wrote:

> On 2023/7/11 9:18, Kaiyu Zhang wrote:
>> sanity check is performed after a rte_eth_dev object is allocated.
>> The object is not freed if the check fails, though in the current
>> reality this never happens, but it's better programming paradigm
>> to move the quick check up front to the start of
>> rte_eth_dev_pci_generic_probe.
>>
>> Signed-off-by: Kaiyu Zhang 
>> 
> 
> Reviewed-by: Chengwen Feng 
> 
Fixes: dcd5c8112bc3 ("ethdev: add PCI driver helpers")
Cc: sta...@dpdk.org

Reviewed-by: Ferruh Yigit 

Applied to dpdk-next-net/main, thanks.


Re: [PATCH v3] bus/cdx: provide driver flag for optional resource mapping

2023-07-11 Thread Gupta, Nipun
Please use 'in-reply-to' of the first submission when sending any 
subsequent patches.


On 7/11/2023 11:21 AM, Abhijit Gangurde wrote:

Provide driver flag which gives an option to map the cdx
device resource before probing the device driver.
Also, make rte_cdx_map_device() API as public to map
device resource separately.

Signed-off-by: Abhijit Gangurde 


Acked-by: Nipun Gupta 


[PATCH v6 1/2] net/mlx5: add Tx datapath trace analyzing script

2023-07-11 Thread Viacheslav Ovsiienko
The Python script is intended to analyze mlx5 PMD
datapath traces and report:
  - tx_burst routine timings
  - how packets are pushed to WQEs
  - how packet sending is completed with timings

Signed-off-by: Viacheslav Ovsiienko 
---
 drivers/net/mlx5/tools/mlx5_trace.py | 307 +++
 1 file changed, 307 insertions(+)
 create mode 100755 drivers/net/mlx5/tools/mlx5_trace.py

diff --git a/drivers/net/mlx5/tools/mlx5_trace.py 
b/drivers/net/mlx5/tools/mlx5_trace.py
new file mode 100755
index 00..8c1fd0a350
--- /dev/null
+++ b/drivers/net/mlx5/tools/mlx5_trace.py
@@ -0,0 +1,307 @@
+#!/usr/bin/env python3
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright (c) 2023 NVIDIA Corporation & Affiliates
+
+"""
+Analyzing the mlx5 PMD datapath tracings
+"""
+import sys
+import argparse
+import bt2
+
+PFX_TX = "pmd.net.mlx5.tx."
+PFX_TX_LEN = len(PFX_TX)
+
+
+class MlxQueue:
+"""Queue container object"""
+
+def __init__(self):
+self.done_burst = []  # completed bursts
+self.wait_burst = []  # waiting for completion
+self.pq_id = 0
+
+def log(self):
+"""Log all queue bursts"""
+for txb in self.done_burst:
+txb.log()
+
+
+class MlxMbuf:
+"""Packet mbufs container object"""
+
+def __init__(self):
+self.wqe = 0 # wqe id
+self.ptr = None  # first packet mbuf pointer
+self.len = 0 # packet data length
+self.nseg = 0# number of segments
+
+def log(self):
+"""Log mbuf"""
+out_txt = "%X: %u" % (self.ptr, self.len)
+if self.nseg != 1:
+out_txt += " (%d segs)" % self.nseg
+print(out_txt)
+
+
+class MlxWqe:
+"""WQE container object"""
+
+def __init__(self):
+self.mbuf = []# list of mbufs in WQE
+self.wait_ts = 0  # preceding wait/push timestamp
+self.comp_ts = 0  # send/recv completion timestamp
+self.opcode = 0
+
+def log(self):
+"""Log WQE"""
+wqe_id = (self.opcode >> 8) & 0x
+wqe_op = self.opcode & 0xFF
+out_txt = "  %04X: " % wqe_id
+if wqe_op == 0xF:
+out_txt += "WAIT"
+elif wqe_op == 0x29:
+out_txt += "EMPW"
+elif wqe_op == 0xE:
+out_txt += "TSO "
+elif wqe_op == 0xA:
+out_txt += "SEND"
+else:
+out_txt += "0x%02X" % wqe_op
+if self.comp_ts != 0:
+out_txt += " (%d, %d)" % (self.wait_ts, self.comp_ts - 
self.wait_ts)
+else:
+out_txt += " (%d)" % self.wait_ts
+print(out_txt)
+for mbuf in self.mbuf:
+mbuf.log()
+
+def comp(self, wqe_id, wqe_ts):
+"""Return 0 if WQE in not completedLog WQE"""
+if self.comp_ts != 0:
+return 1
+cur_id = (self.opcode >> 8) & 0x
+if cur_id > wqe_id:
+cur_id -= wqe_id
+if cur_id <= 0x8000:
+return 0
+else:
+cur_id = wqe_id - cur_id
+if cur_id >= 0x8000:
+return 0
+self.comp_ts = wqe_ts
+return 1
+
+
+class MlxBurst:
+"""Packet burst container object"""
+
+def __init__(self):
+self.wqes = []# issued burst WQEs
+self.done = 0 # number of sent/recv packets
+self.req = 0  # requested number of packets
+self.call_ts = 0  # burst routine invocation
+self.done_ts = 0  # burst routine done
+self.queue = None
+
+def log(self):
+"""Log burst"""
+port = self.queue.pq_id >> 16
+queue = self.queue.pq_id & 0x
+if self.req == 0:
+print(
+"%u: tx(p=%u, q=%u, %u/%u pkts (incomplete)"
+% (self.call_ts, port, queue, self.done, self.req)
+)
+else:
+print(
+"%u: tx(p=%u, q=%u, %u/%u pkts in %u"
+% (
+self.call_ts,
+port,
+queue,
+self.done,
+self.req,
+self.done_ts - self.call_ts,
+)
+)
+for wqe in self.wqes:
+wqe.log()
+
+def comp(self, wqe_id, wqe_ts):
+"""Return 0 if not all of WQEs in burst completed"""
+wlen = len(self.wqes)
+if wlen == 0:
+return 0
+for wqe in self.wqes:
+if wqe.comp(wqe_id, wqe_ts) == 0:
+return 0
+return 1
+
+
+class MlxTrace:
+"""Trace representing object"""
+
+def __init__(self):
+self.tx_blst = {}  # current Tx bursts per CPU
+self.tx_qlst = {}  # active Tx queues per port/queue
+self.tx_wlst = {}  # wait timestamp list per CPU
+
+def run(self, msg_it):
+"""Run over gathered tracing data and build database"""
+for msg in msg_it:
+if not isinstance(msg, bt2._EventMessageConst):
+

[PATCH v6 0/2] net/mlx5: introduce Tx datapath tracing

2023-07-11 Thread Viacheslav Ovsiienko
The mlx5 provides the send scheduling on specific moment of time,
and for the related kind of applications it would be extremely useful
to have extra debug information - when and how packets were scheduled
and when the actual sending was completed by the NIC hardware (it helps
application to track the internal delay issues).

Because the DPDK tx datapath API does not suppose getting any feedback
from the driver and the feature looks like to be mlx5 specific, it seems
to be reasonable to engage exisiting DPDK datapath tracing capability.

The work cycle is supposed to be:
  - compile appplication with enabled tracing
  - run application with EAL parameters configuring the tracing in mlx5
Tx datapath
  - store the dump file with gathered tracing information
  - run analyzing scrypt (in Python) to combine related events (packet
firing and completion) and see the data in human-readable view

Below is the detailed instruction "how to" with mlx5 NIC to gather
all the debug data including the full timings information.


1. Build DPDK application with enabled datapath tracing

The meson option should be specified:
   --enable_trace_fp=true

The c_args shoudl be specified:
   -DALLOW_EXPERIMENTAL_API

The DPDK configuration examples:

  meson configure --buildtype=debug -Denable_trace_fp=true
-Dc_args='-DRTE_LIBRTE_MLX5_DEBUG -DRTE_ENABLE_ASSERT 
-DALLOW_EXPERIMENTAL_API' build

  meson configure --buildtype=debug -Denable_trace_fp=true
-Dc_args='-DRTE_ENABLE_ASSERT -DALLOW_EXPERIMENTAL_API' build

  meson configure --buildtype=release -Denable_trace_fp=true
-Dc_args='-DRTE_ENABLE_ASSERT -DALLOW_EXPERIMENTAL_API' build

  meson configure --buildtype=release -Denable_trace_fp=true
-Dc_args='-DALLOW_EXPERIMENTAL_API' build


2. Configuring the NIC

If the sending completion timings are important the NIC should be configured
to provide realtime timestamps, the REAL_TIME_CLOCK_ENABLE NV settings parameter
should be configured to TRUE, for example with command (and with following
FW/driver reset):

  sudo mlxconfig -d /dev/mst/mt4125_pciconf0 s REAL_TIME_CLOCK_ENABLE=1


3. Run DPDK application to gather the traces

EAL parameters controlling trace capability in runtime

  --trace=pmd.net.mlx5.tx - the regular expression enabling the tracepoints
with matching names at least "pmd.net.mlx5.tx"
must be enabled to gather all events needed
to analyze mlx5 Tx datapath and its timings.
By default all tracepoints are disabled.

  --trace-dir=/var/log - trace storing directory

  --trace-bufsz=B|K|M - optional, trace data buffer size
   per thread. The default is 1MB.

  --trace-mode=overwrite|discard  - optional, selects trace data buffer mode.


4. Installing or Building Babeltrace2 Package

The gathered trace data can be analyzed with a developed Python script.
To parse the trace, the data script uses the Babeltrace2 library.
The package should be either installed or built from source code as
shown below:

  git clone https://github.com/efficios/babeltrace.git
  cd babeltrace
  ./bootstrap
  ./configure -help
  ./configure --disable-api-doc --disable-man-pages
  --disable-python-bindings-doc --enbale-python-plugins
  --enable-python-binding

5. Running the Analyzing Script

The analyzing script is located in the folder: ./drivers/net/mlx5/tools
It requires Python3.6, Babeltrace2 packages and it takes the only parameter
of trace data file. For example:

   ./mlx5_trace.py /var/log/rte-2023-01-23-AM-11-52-39


6. Interpreting the Script Output Data

All the timings are given in nanoseconds.
The list of Tx (and coming Rx) bursts per port/queue is presented in the output.
Each list element contains the list of built WQEs with specific opcodes, and
each WQE contains the list of the encompassed packets to send.

Signed-off-by: Viacheslav Ovsiienko 

--
v2: - comment addressed: "dump_trace" command is replaced with "save_trace"
- Windows build failure addressed, Windows does not support tracing

v3: - tracepoint routines are moved to the net folder, no need to export
- documentation added
- testpmd patches moved out from series to the dedicated patches

v4: - Python comments addressed
- codestyle issues fixed

v5: - traces are moved to the dedicated files, otherwise registration
  header caused wrong code generation for 3rd party files/objects
  and resulted in performance drop

v6: - documentation reworded

Viacheslav Ovsiienko (2):
  net/mlx5: add Tx datapath trace analyzing script
  doc: add mlx5 datapath tracing feature description

 doc/guides/nics/mlx5.rst |  74 +++
 drivers/net/mlx5/tools/mlx5_trace.py | 307 +++
 2 files changed, 381 insertions(+)
 create mode 100755 drivers/net/mlx5/tools/mlx5_trace.py

-- 
2.18.1



[PATCH v6 2/2] doc: add mlx5 datapath tracing feature description

2023-07-11 Thread Viacheslav Ovsiienko
The mlx5 provides the send scheduling on specific moment of time,
and for the related kind of applications it would be extremely useful
to have extra debug information - when and how packets were scheduled
and when the actual sending was completed by the NIC hardware (it helps
application to track the internal delay issues).

The patch adds the documentation for feature usage.

Signed-off-by: Viacheslav Ovsiienko 
---
 doc/guides/nics/mlx5.rst | 74 
 1 file changed, 74 insertions(+)

diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index 505873ecfd..a407920555 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -1923,6 +1923,80 @@ The procedure below is an example of using a ConnectX-5 
adapter card (pf0) with
 
$ echo ":82:00.2" >> /sys/bus/pci/drivers/mlx5_core/bind
 
+How to trace Tx datapath
+
+
+The mlx5 PMD provides Tx datapath tracing capability with extra debug 
information:
+when and how packets were scheduled
+and when the actual sending was completed by the NIC hardware.
+
+Steps to enable Tx datapath tracing:
+
+#. Build DPDK application with enabled datapath tracing
+
+   The Meson option ``--enable_trace_fp=true`` and
+   the C flag ``ALLOW_EXPERIMENTAL_API`` should be specified.
+
+   .. code-block:: console
+
+  meson configure --buildtype=debug -Denable_trace_fp=true
+ -Dc_args='-DRTE_LIBRTE_MLX5_DEBUG -DRTE_ENABLE_ASSERT 
-DALLOW_EXPERIMENTAL_API' build
+
+#. Configure the NIC
+
+   If the sending completion timings are important,
+   the NIC should be configured to provide realtime timestamps.
+   The non-volatile settings parameter  ``REAL_TIME_CLOCK_ENABLE`` should be 
configured as one.
+   The ``mlxconfig`` utility is part of the MFT package.
+
+   .. code-block:: console
+
+  mlxconfig -d /dev/mst/mt4125_pciconf0 s REAL_TIME_CLOCK_ENABLE=1
+
+#. Run application with EAL parameter enabling the tracing in mlx5 Tx datapath
+
+   By default all tracepoints are disabled.
+   To analyze Tx datapath and its timings: ``--trace=pmd.net.mlx5.tx``.
+
+#. Commit the tracing data to the storage (with ``rte_trace_save()`` API call).
+
+#. Install or build the ``babeltrace2`` package
+
+   The Python script analyzing gathered trace data uses the ``babeltrace2`` 
library.
+   The package should be either installed or built from source as shown below.
+
+   .. code-block:: console
+
+  git clone https://github.com/efficios/babeltrace.git
+  cd babeltrace
+  ./bootstrap
+  ./configure -help
+  ./configure --disable-api-doc --disable-man-pages
+  --disable-python-bindings-doc --enable-python-plugins
+  --enable-python-binding
+
+#. Run analyzing script
+
+   ``mlx5_trace.py`` is used to combine related events (packet firing and 
completion)
+   and to show the results in human-readable view.
+
+   The analyzing script is located in the DPDK source tree: 
``drivers/net/mlx5/tools``.
+
+   It requires Python 3.6, ``babeltrace2`` package.
+
+   The parameter of the script is the trace data folder.
+
+   .. code-block:: console
+
+  mlx5_trace.py /var/log/rte-2023-01-23-AM-11-52-39
+
+#. Interpreting the script output data
+
+   All the timings are given in nanoseconds.
+   The list of Tx bursts per port/queue is presented in the output.
+   Each list element contains the list of built WQEs with specific opcodes.
+   Each WQE contains the list of the encompassed packets to send.
+
 Host shaper
 ---
 
-- 
2.18.1



[PATCH 1/3] net/mlx5: fix validation for conntrack indirect action

2023-07-11 Thread Alexander Kozyrev
From: Bing Zhao 

After rte_flow_shared_action_* API was replaced with
rte_flow_action_handle_* API, one input parameter of the update
interface was also changed. A generic pointer was used instead of the
"const struct rte_flow_action *" pointer.

In the entrance of mlx5 PMD callback for update, the validation is
called for all indirect actions. But for conntrack type, the pointer
is no longer with rte_flow_action pointer type and it will cause an
incorrect casting and error.

The content for updating should only be validated when needed. It
should skip the validation in the entrance. Right now, the content
was already added before updating the hardware by WQE. So the type
of the indirect action should be checked before calling the action
validate function.

When creating a new conntrack object, the validation is still needed
since all the content will be used to update the hardware context.

Fixes: 40327aab1491 ("ethdev: introduce indirect flow action")

Signed-off-by: Bing Zhao 
---
 drivers/net/mlx5/mlx5_flow.c | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 4b567f61dd..9bd92f28fd 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -10753,9 +10753,18 @@ mlx5_action_handle_update(struct rte_eth_dev *dev,
const struct mlx5_flow_driver_ops *fops =
flow_get_drv_ops(flow_get_drv_type(dev, &attr));
int ret;
+   uint32_t act_idx = (uint32_t)(uintptr_t)handle;
+   uint32_t type = act_idx >> MLX5_INDIRECT_ACTION_TYPE_OFFSET;
 
-   ret = flow_drv_action_validate(dev, NULL,
-   (const struct rte_flow_action *)update, fops, error);
+   switch (type) {
+   case MLX5_INDIRECT_ACTION_TYPE_CT:
+   ret = 0;
+   break;
+   default:
+   ret = flow_drv_action_validate(dev, NULL,
+   (const struct rte_flow_action *)update,
+   fops, error);
+   }
if (ret)
return ret;
return flow_drv_action_update(dev, handle, update, fops,
-- 
2.18.2



[PATCH 2/3] net/mlx5: fix handle validation for meter mark

2023-07-11 Thread Alexander Kozyrev
Skip the METER_MARK validation for the indirect action update.
The old synchronous indirect action update was left out
during the METER_MARK implementation in favor of the async way.
Allow the sync method of doing this with relaxed validation.

Fixes: 48fbb0e93d06 ("net/mlx5: support flow meter mark indirect action with 
HWS")

Signed-off-by: Alexander Kozyrev 
---
 drivers/net/mlx5/mlx5_flow.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 9bd92f28fd..e91eb636d0 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -10758,6 +10758,7 @@ mlx5_action_handle_update(struct rte_eth_dev *dev,
 
switch (type) {
case MLX5_INDIRECT_ACTION_TYPE_CT:
+   case MLX5_INDIRECT_ACTION_TYPE_METER_MARK:
ret = 0;
break;
default:
-- 
2.18.2



[PATCH 3/3] app/testpmd: fix meter mark handle update

2023-07-11 Thread Alexander Kozyrev
The indirect action handle update for the METER_MERK action
was implemented only for the async RTE Flow API.
Allow updating the METER_MARK parameters via the old sync method.

Fixes: 9c4a0c1859a3 ("ethdev: add meter color mark flow action")

Signed-off-by: Alexander Kozyrev 
---
 app/test-pmd/config.c | 18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index c4784b7f2c..58ac1576b7 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1943,6 +1943,7 @@ port_action_handle_update(portid_t port_id, uint32_t id,
struct rte_flow_error error;
struct rte_flow_action_handle *action_handle;
struct port_indirect_action *pia;
+   struct rte_flow_update_meter_mark mtr_update;
const void *update;
 
action_handle = port_action_handle_get_by_id(port_id, id);
@@ -1956,6 +1957,17 @@ port_action_handle_update(portid_t port_id, uint32_t id,
case RTE_FLOW_ACTION_TYPE_CONNTRACK:
update = action->conf;
break;
+   case RTE_FLOW_ACTION_TYPE_METER_MARK:
+   rte_memcpy(&mtr_update.meter_mark, action->conf,
+   sizeof(struct rte_flow_action_meter_mark));
+   if (mtr_update.meter_mark.profile)
+   mtr_update.profile_valid = 1;
+   if (mtr_update.meter_mark.policy)
+   mtr_update.policy_valid = 1;
+   mtr_update.color_mode_valid = 1;
+   mtr_update.state_valid = 1;
+   update = &mtr_update;
+   break;
default:
update = action;
break;
@@ -3162,8 +3174,10 @@ port_queue_action_handle_update(portid_t port_id,
case RTE_FLOW_ACTION_TYPE_METER_MARK:
rte_memcpy(&mtr_update.meter_mark, action->conf,
sizeof(struct rte_flow_action_meter_mark));
-   mtr_update.profile_valid = 1;
-   mtr_update.policy_valid = 1;
+   if (mtr_update.meter_mark.profile)
+   mtr_update.profile_valid = 1;
+   if (mtr_update.meter_mark.policy)
+   mtr_update.policy_valid = 1;
mtr_update.color_mode_valid = 1;
mtr_update.init_color_valid = 1;
mtr_update.state_valid = 1;
-- 
2.18.2



Re: [PATCH] usertools: enhance logic to display NUMA

2023-07-11 Thread Stephen Hemminger
On Sat, 26 Mar 2022 00:32:07 -0700
Vipin Varghese  wrote:

> +
> +  output = " Socket " + str(socket).ljust(3, ' ') + " Numa " + 
> str(numa).zfill(1) + " "
> +  #output = " Socket " + str(socket).zfill(1) + " Numa " + 
> str(numa).zfill(1) + " "
> +  print(output)
> +  print(format("-" * len(output)))
> +
> +  for index,coreSibling in enumerate(numa_map[keys]):
> +  print ("Core " + str(index).ljust(3, ' ') + "" + str(coreSibling))
> +  #print ("Core " + str(index).zfill(3) + "" + str(coreSibling))
> +print("")
> +
> -- 

Git complains because you added new blank line at end of file.

One wording suggestion would be to use the term "Node" instead of "Numa" in the 
table.
And fix heading alignment. The new headings don't look right.

For the case with only single socket, single node, some of the headings could be
dropped as well.

I.e:

Socket 0   Node 0 
---
Core 0  [0, 4]
Core 1  [1, 5]
Core 2  [2, 6]
Core 3  [3, 7]


[PATCH v2] eal: provide per lcore macros for MSVC

2023-07-11 Thread Tyler Retzlaff
Provide per lcore macros that use __declspec(thread) and uses C23
typeof.

Signed-off-by: Tyler Retzlaff 
---
 lib/eal/include/rte_per_lcore.h | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/eal/include/rte_per_lcore.h b/lib/eal/include/rte_per_lcore.h
index eaedf0c..2b846f9 100644
--- a/lib/eal/include/rte_per_lcore.h
+++ b/lib/eal/include/rte_per_lcore.h
@@ -24,19 +24,27 @@
 
 #include 
 
+#ifdef RTE_TOOLCHAIN_MSVC
 /**
  * Macro to define a per lcore variable "var" of type "type", don't
  * use keywords like "static" or "volatile" in type, just prefix the
  * whole macro.
  */
 #define RTE_DEFINE_PER_LCORE(type, name)   \
-   __thread __typeof__(type) per_lcore_##name
+   __declspec(thread) typeof(type) per_lcore_##name
 
 /**
  * Macro to declare an extern per lcore variable "var" of type "type"
  */
 #define RTE_DECLARE_PER_LCORE(type, name)  \
+   extern __declspec(thread) typeof(type) per_lcore_##name
+#else
+#define RTE_DEFINE_PER_LCORE(type, name)   \
+   __thread __typeof__(type) per_lcore_##name
+
+#define RTE_DECLARE_PER_LCORE(type, name)  \
extern __thread __typeof__(type) per_lcore_##name
+#endif
 
 /**
  * Read/write the per-lcore variable value
-- 
1.8.3.1



[PATCH v2] provide Windows/MSVC lcore macros

2023-07-11 Thread Tyler Retzlaff
Provide MSVC compatible macros RTE_DEFINE_PER_LCORE and
RTE_DECLARE_PER_LCORE that expand appropriately for Windows/MSVC

NOTICE:

It is intentional that devtools/checkpatches.pl generates an error
about parenthesis to allow comparison with clang/gcc versions of
these macros which also do not have the parenthesis.

```
ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in 
parenthesis
#31: FILE: lib/eal/include/rte_per_lcore.h:42:
+#define RTE_DEFINE_PER_LCORE(type, name)   \
+   __declspec(thread) typeof(type) per_lcore_##name

ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in 
parenthesis
#34: FILE: lib/eal/include/rte_per_lcore.h:45:
+#define RTE_DECLARE_PER_LCORE(type, name)  \
+   extern __declspec(thread) typeof(type) per_lcore_##name
```

v2:
* invert macro test for msvc #ifndef -> #ifdef

Tyler Retzlaff (1):
  eal: provide per lcore macros for MSVC

 lib/eal/include/rte_per_lcore.h | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

-- 
1.8.3.1



Re: [PATCH] usertools: enhance logic to display NUMA

2023-07-11 Thread Thomas Monjalon
11/07/2023 17:42, Stephen Hemminger:
> On Sat, 26 Mar 2022 00:32:07 -0700
> Vipin Varghese  wrote:
> 
> > +
> > +  output = " Socket " + str(socket).ljust(3, ' ') + " Numa " + 
> > str(numa).zfill(1) + " "
> > +  #output = " Socket " + str(socket).zfill(1) + " Numa " + 
> > str(numa).zfill(1) + " "
> > +  print(output)
> > +  print(format("-" * len(output)))
> > +
> > +  for index,coreSibling in enumerate(numa_map[keys]):
> > +  print ("Core " + str(index).ljust(3, ' ') + "" + 
> > str(coreSibling))
> > +  #print ("Core " + str(index).zfill(3) + "" + str(coreSibling))
> > +print("")
> > +
> 
> Git complains because you added new blank line at end of file.
> 
> One wording suggestion would be to use the term "Node" instead of "Numa" in 
> the table.
> And fix heading alignment. The new headings don't look right.
> 
> For the case with only single socket, single node, some of the headings could 
> be
> dropped as well.

I don't understand why we continue working on this script.
I thought we agreed it should be removed in favor of lstopo.




[PATCH v9 01/14] eal: use rdtsc intrinsic

2023-07-11 Thread Tyler Retzlaff
Inline assembly is not supported for MSVC x64. Convert code to use
__rdtsc intrinsic.

Signed-off-by: Tyler Retzlaff 
Acked-by: Konstantin Ananyev 
Acked-by: Morten Brørup 
---
 lib/eal/x86/include/rte_cycles.h | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/lib/eal/x86/include/rte_cycles.h b/lib/eal/x86/include/rte_cycles.h
index a461a4d..ca0fb10 100644
--- a/lib/eal/x86/include/rte_cycles.h
+++ b/lib/eal/x86/include/rte_cycles.h
@@ -6,6 +6,12 @@
 #ifndef _RTE_CYCLES_X86_64_H_
 #define _RTE_CYCLES_X86_64_H_
 
+#ifdef RTE_TOOLCHAIN_MSVC
+#include 
+#else
+#include 
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -23,6 +29,7 @@
 static inline uint64_t
 rte_rdtsc(void)
 {
+#ifdef RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT
union {
uint64_t tsc_64;
RTE_STD_C11
@@ -32,7 +39,6 @@
};
} tsc;
 
-#ifdef RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT
if (unlikely(rte_cycles_vmware_tsc_map)) {
/* ecx = 0x1 corresponds to the physical TSC for VMware */
asm volatile("rdpmc" :
@@ -42,11 +48,7 @@
return tsc.tsc_64;
}
 #endif
-
-   asm volatile("rdtsc" :
-"=a" (tsc.lo_32),
-"=d" (tsc.hi_32));
-   return tsc.tsc_64;
+   return __rdtsc();
 }
 
 static inline uint64_t
-- 
1.8.3.1



[PATCH v9 00/14] msvc integration changes

2023-07-11 Thread Tyler Retzlaff
In accordance with draft plan
http://mails.dpdk.org/archives/web/2023-February/002023.html
introduces conditionally compiled code to enable building with MSVC that
_does not_ require C99/C11 meaning it can be integrated now.

This series covers minimal changes for item #2 in draft plan for EAL
dependencies kvargs, telemetry and consumed EAL public headers.

Note if any patch in the series requires in-depth discussion I'll
detach it from this series for separate submission & more focused
discussion so it doesn't block the entire series.

Note other "common" intrinsics were investigated for viability but
were not adopted either because they were not available on older
versions of gcc or because they generate different code for msvc
vs gcc.

v9:
  * invert macro conditional evaluation and use to be
#ifdef RTE_TOOLCHAIN_MSVC instead of #ifndef RTE_TOOLCHAIN_MSVC
wherever it doesn't make evaluation more complex than
it already is

v8:
  * use waitpkg intrinsics if __WAITPKG__ is defined by the
compiler

v7:
  * remove patch typedef of rte_cpuflags_t as an int. for now we
will just allow warning to be emitted to avoid adding conditional
compilation

v6:
  * convert / expand likely/unlikely macros to _Bool type
  * expand __extension__ empty it's cleaner to do this for now
instead of modifying the whole tree
  * provide msvc container_of not based on gcc expression
statement extension
  * add patch that stops defining typeof (C23 keyword) when
building with msvc

v5:
  * remove accidental line removal in barrier patch
  * update prefetch patch to use intrinsics for all toolchains
  * remove x86 specific changes for byte swap patch since
msvc intrinsics are processor agnostic always use
intrinsics from generic include
  * expand __rte_packed empty for msvc packing will be addressed
in a separate series

v4:
  * update rdtsc patch to use gcc intrinsics
  * update rtm patch to use gcc intrinsics
  * drop patch disable json print formatting, we will utilize
series removing VLAs from Bruce
  * added patch using prefetch intrinsics for msvc
  * added patch using byte swap intrinsics for msvc
  * added patch hiding typdefs for msvc using gcc vector
extension
  * added patch defining MSVC as little endian always

v3:
  * v3 does not group together conditional blocks when experimented
with it didn't reduce conditionals enough to make it worth
while. once msvc tests are at a running point i suggest
a narrow targeted discussion about code organization without
blocking this series
  * v3 does not attempt to refactor to use intrinsics for non-msvc
compilers. again this should be done as a separate follow-up
series later if desired
  * fix expansion of likely and unlikely macros
  * remove unnecessary define for rte_smp_{r,w}mb it is sufficient
for these to be compiler barriers on x86
  * add a new patch to use __cpuid and __cpuidex intrinsics when
building with msvc
  * add a new patch to use _umonitor, _umwait and _tpause intrinsics
when building with msvc

v2:
  * use _mm_{l,s,m}fence intrinsics for rte_smp_{r,w,}mb macros
are intended to be memory barriers not compiler barriers on
x86_64


Tyler Retzlaff (14):
  eal: use rdtsc intrinsic
  eal: use rtm and xtest intrinsics
  eal: use barrier intrinsics
  eal: use cpuid and cpuidex intrinsics
  eal: use umonitor umwait and tpause intrinsics
  eal: use prefetch intrinsics
  eal: use byte swap intrinsics
  eal: hide GCC extension based alignment markers
  eal: hide typedefs based on GCC vector extensions
  eal: expand most macros to empty when using MSVC
  eal: exclude exposure of rte atomic APIs for MSVC builds
  telemetry: avoid expanding versioned symbol macros on MSVC
  eal: always define MSVC as little endian
  eal: do not define typeof macro when building with MSVC

 config/x86/meson.build  |  6 
 lib/eal/include/generic/rte_atomic.h| 11 ++
 lib/eal/include/generic/rte_byteorder.h | 13 +++
 lib/eal/include/generic/rte_vect.h  |  4 +++
 lib/eal/include/rte_branch_prediction.h |  8 +
 lib/eal/include/rte_common.h| 60 +
 lib/eal/include/rte_compat.h| 20 +++
 lib/eal/x86/include/rte_atomic.h|  8 +
 lib/eal/x86/include/rte_byteorder.h |  4 +++
 lib/eal/x86/include/rte_cycles.h| 14 
 lib/eal/x86/include/rte_prefetch.h  | 25 +++---
 lib/eal/x86/include/rte_rtm.h   | 18 +++---
 lib/eal/x86/rte_cpuflags.c  |  6 +++-
 lib/eal/x86/rte_cpuid.h |  7 
 lib/eal/x86/rte_cycles.c| 36 
 lib/eal/x86/rte_hypervisor.c|  4 +++
 lib/eal/x86/rte_power_intrinsics.c  | 12 +++
 lib/telemetry/telemetry_data.c  | 16 +
 18 files changed, 248 insertions(+), 24 deletions(-)

-- 
1.8.3.1



[PATCH v9 02/14] eal: use rtm and xtest intrinsics

2023-07-11 Thread Tyler Retzlaff
Inline assembly is not supported for MSVC x64. Convert code to use
_xend, _xabort and _xtest intrinsics.

Signed-off-by: Tyler Retzlaff 
Acked-by: Bruce Richardson 
Acked-by: Konstantin Ananyev 
Acked-by: Morten Brørup 
---
 config/x86/meson.build|  6 ++
 lib/eal/x86/include/rte_rtm.h | 18 +-
 2 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/config/x86/meson.build b/config/x86/meson.build
index 54345c4..4c0b06c 100644
--- a/config/x86/meson.build
+++ b/config/x86/meson.build
@@ -30,6 +30,12 @@ if cc.get_define('__SSE4_2__', args: machine_args) == ''
 machine_args += '-msse4'
 endif
 
+# enable restricted transactional memory intrinsics
+# https://gcc.gnu.org/onlinedocs/gcc/x86-transactional-memory-intrinsics.html
+if cc.get_id() != 'msvc'
+machine_args += '-mrtm'
+endif
+
 base_flags = ['SSE', 'SSE2', 'SSE3','SSSE3', 'SSE4_1', 'SSE4_2']
 foreach f:base_flags
 compile_time_cpuflags += ['RTE_CPUFLAG_' + f]
diff --git a/lib/eal/x86/include/rte_rtm.h b/lib/eal/x86/include/rte_rtm.h
index 36bf498..b84e58e 100644
--- a/lib/eal/x86/include/rte_rtm.h
+++ b/lib/eal/x86/include/rte_rtm.h
@@ -5,6 +5,7 @@
 #ifndef _RTE_RTM_H_
 #define _RTE_RTM_H_ 1
 
+#include 
 
 /* Official RTM intrinsics interface matching gcc/icc, but works
on older gcc compatible compilers and binutils. */
@@ -28,31 +29,22 @@
 static __rte_always_inline
 unsigned int rte_xbegin(void)
 {
-   unsigned int ret = RTE_XBEGIN_STARTED;
-
-   asm volatile(".byte 0xc7,0xf8 ; .long 0" : "+a" (ret) :: "memory");
-   return ret;
+   return _xbegin();
 }
 
 static __rte_always_inline
 void rte_xend(void)
 {
-asm volatile(".byte 0x0f,0x01,0xd5" ::: "memory");
+   _xend();
 }
 
 /* not an inline function to workaround a clang bug with -O0 */
-#define rte_xabort(status) do { \
-   asm volatile(".byte 0xc6,0xf8,%P0" :: "i" (status) : "memory"); \
-} while (0)
+#define rte_xabort(status) _xabort(status)
 
 static __rte_always_inline
 int rte_xtest(void)
 {
-   unsigned char out;
-
-   asm volatile(".byte 0x0f,0x01,0xd6 ; setnz %0" :
-   "=r" (out) :: "memory");
-   return out;
+   return _xtest();
 }
 
 #ifdef __cplusplus
-- 
1.8.3.1



[PATCH v9 03/14] eal: use barrier intrinsics

2023-07-11 Thread Tyler Retzlaff
Inline assembly is not supported for MSVC x64 instead expand
rte_compiler_barrier as _ReadWriteBarrier and for rte_smp_mb
_m_mfence intrinsics.

Signed-off-by: Tyler Retzlaff 
Acked-by: Bruce Richardson 
Acked-by: Konstantin Ananyev 
Acked-by: Morten Brørup 
---
 lib/eal/include/generic/rte_atomic.h | 4 
 lib/eal/x86/include/rte_atomic.h | 4 
 2 files changed, 8 insertions(+)

diff --git a/lib/eal/include/generic/rte_atomic.h 
b/lib/eal/include/generic/rte_atomic.h
index 58df843..6a6c394 100644
--- a/lib/eal/include/generic/rte_atomic.h
+++ b/lib/eal/include/generic/rte_atomic.h
@@ -116,9 +116,13 @@
  * Guarantees that operation reordering does not occur at compile time
  * for operations directly before and after the barrier.
  */
+#ifdef RTE_TOOLCHAIN_MSVC
+#define rte_compiler_barrier() _ReadWriteBarrier()
+#else
 #definerte_compiler_barrier() do { \
asm volatile ("" : : : "memory");   \
 } while(0)
+#endif
 
 /**
  * Synchronization fence between threads based on the specified memory order.
diff --git a/lib/eal/x86/include/rte_atomic.h b/lib/eal/x86/include/rte_atomic.h
index f2ee1a9..7aba1c3 100644
--- a/lib/eal/x86/include/rte_atomic.h
+++ b/lib/eal/x86/include/rte_atomic.h
@@ -66,11 +66,15 @@
 static __rte_always_inline void
 rte_smp_mb(void)
 {
+#ifdef RTE_TOOLCHAIN_MSVC
+   _mm_mfence();
+#else
 #ifdef RTE_ARCH_I686
asm volatile("lock addl $0, -128(%%esp); " ::: "memory");
 #else
asm volatile("lock addl $0, -128(%%rsp); " ::: "memory");
 #endif
+#endif
 }
 
 #define rte_io_mb() rte_mb()
-- 
1.8.3.1



[PATCH v9 04/14] eal: use cpuid and cpuidex intrinsics

2023-07-11 Thread Tyler Retzlaff
Inline assembly is not supported for MSVC x64 instead use __cpuid
and __cpuidex intrinsics.

Signed-off-by: Tyler Retzlaff 
Acked-by: Morten Brørup 
---
 lib/eal/x86/rte_cpuflags.c   |  6 +-
 lib/eal/x86/rte_cpuid.h  |  7 +++
 lib/eal/x86/rte_cycles.c | 36 
 lib/eal/x86/rte_hypervisor.c |  4 
 4 files changed, 52 insertions(+), 1 deletion(-)

diff --git a/lib/eal/x86/rte_cpuflags.c b/lib/eal/x86/rte_cpuflags.c
index d6b5182..8a30f79 100644
--- a/lib/eal/x86/rte_cpuflags.c
+++ b/lib/eal/x86/rte_cpuflags.c
@@ -165,9 +165,13 @@ struct feature_entry {
if (maxleaf < feat->leaf)
return 0;
 
-__cpuid_count(feat->leaf, feat->subleaf,
+#ifdef RTE_TOOLCHAIN_MSVC
+   __cpuidex(regs, feat->leaf, feat->subleaf);
+#else
+   __cpuid_count(feat->leaf, feat->subleaf,
 regs[RTE_REG_EAX], regs[RTE_REG_EBX],
 regs[RTE_REG_ECX], regs[RTE_REG_EDX]);
+#endif
 
/* check if the feature is enabled */
return (regs[feat->reg] >> feat->bit) & 1;
diff --git a/lib/eal/x86/rte_cpuid.h b/lib/eal/x86/rte_cpuid.h
index b773ad9..c6abaad 100644
--- a/lib/eal/x86/rte_cpuid.h
+++ b/lib/eal/x86/rte_cpuid.h
@@ -5,7 +5,9 @@
 #ifndef RTE_CPUID_H
 #define RTE_CPUID_H
 
+#ifndef RTE_TOOLCHAIN_MSVC
 #include 
+#endif
 
 enum cpu_register_t {
RTE_REG_EAX = 0,
@@ -16,4 +18,9 @@ enum cpu_register_t {
 
 typedef uint32_t cpuid_registers_t[4];
 
+#ifdef RTE_TOOLCHAIN_MSVC
+int
+__get_cpuid_max(unsigned int e, unsigned int *s);
+#endif
+
 #endif /* RTE_CPUID_H */
diff --git a/lib/eal/x86/rte_cycles.c b/lib/eal/x86/rte_cycles.c
index 0e695ca..69ed59b 100644
--- a/lib/eal/x86/rte_cycles.c
+++ b/lib/eal/x86/rte_cycles.c
@@ -4,7 +4,11 @@
 
 #include 
 #include 
+#ifdef RTE_TOOLCHAIN_MSVC
+#define bit_AVX (1 << 28)
+#else
 #include 
+#endif
 
 
 #include "eal_private.h"
@@ -82,9 +86,25 @@
return 0;
 }
 
+#ifdef RTE_TOOLCHAIN_MSVC
+int
+__get_cpuid_max(unsigned int e, unsigned int *s)
+{
+   uint32_t cpuinfo[4];
+
+   __cpuid(cpuinfo, e);
+   if (s)
+   *s = cpuinfo[1];
+   return cpuinfo[0];
+}
+#endif
+
 uint64_t
 get_tsc_freq_arch(void)
 {
+#ifdef RTE_TOOLCHAIN_MSVC
+   int cpuinfo[4];
+#endif
uint64_t tsc_hz = 0;
uint32_t a, b, c, d, maxleaf;
uint8_t mult, model;
@@ -97,14 +117,30 @@
maxleaf = __get_cpuid_max(0, NULL);
 
if (maxleaf >= 0x15) {
+#ifdef RTE_TOOLCHAIN_MSVC
+   __cpuid(cpuinfo, 0x15);
+   a = cpuinfo[0];
+   b = cpuinfo[1];
+   c = cpuinfo[2];
+   d = cpuinfo[3];
+#else
__cpuid(0x15, a, b, c, d);
+#endif
 
/* EBX : TSC/Crystal ratio, ECX : Crystal Hz */
if (b && c)
return c * (b / a);
}
 
+#ifdef RTE_TOOLCHAIN_MSVC
+   __cpuid(cpuinfo, 0x1);
+   a = cpuinfo[0];
+   b = cpuinfo[1];
+   c = cpuinfo[2];
+   d = cpuinfo[3];
+#else
__cpuid(0x1, a, b, c, d);
+#endif
model = rte_cpu_get_model(a);
 
if (check_model_wsm_nhm(model))
diff --git a/lib/eal/x86/rte_hypervisor.c b/lib/eal/x86/rte_hypervisor.c
index c38cfc0..04fe767 100644
--- a/lib/eal/x86/rte_hypervisor.c
+++ b/lib/eal/x86/rte_hypervisor.c
@@ -23,9 +23,13 @@ enum rte_hypervisor
if (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_HYPERVISOR))
return RTE_HYPERVISOR_NONE;
 
+#ifdef RTE_TOOLCHAIN_MSVC
+   __cpuid(regs, HYPERVISOR_INFO_LEAF);
+#else
__cpuid(HYPERVISOR_INFO_LEAF,
regs[RTE_REG_EAX], regs[RTE_REG_EBX],
regs[RTE_REG_ECX], regs[RTE_REG_EDX]);
+#endif
for (reg = 1; reg < 4; reg++)
memcpy(name + (reg - 1) * 4, ®s[reg], 4);
name[12] = '\0';
-- 
1.8.3.1



[PATCH v9 06/14] eal: use prefetch intrinsics

2023-07-11 Thread Tyler Retzlaff
Inline assembly is not supported for MSVC x64 instead use _mm_prefetch
and _mm_cldemote intrinsics.

Signed-off-by: Tyler Retzlaff 
Acked-by: Bruce Richardson 
Acked-by: Morten Brørup 
Acked-by: Konstantin Ananyev 
---
 lib/eal/x86/include/rte_prefetch.h | 25 +
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/lib/eal/x86/include/rte_prefetch.h 
b/lib/eal/x86/include/rte_prefetch.h
index 7fd01c4..7a6988e 100644
--- a/lib/eal/x86/include/rte_prefetch.h
+++ b/lib/eal/x86/include/rte_prefetch.h
@@ -9,30 +9,38 @@
 extern "C" {
 #endif
 
+#include 
+
 #include 
 #include 
 #include "generic/rte_prefetch.h"
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wcast-qual"
+
 static inline void rte_prefetch0(const volatile void *p)
 {
-   asm volatile ("prefetcht0 %[p]" : : [p] "m" (*(const volatile char 
*)p));
+   _mm_prefetch((const void *)p, _MM_HINT_T0);
 }
 
 static inline void rte_prefetch1(const volatile void *p)
 {
-   asm volatile ("prefetcht1 %[p]" : : [p] "m" (*(const volatile char 
*)p));
+   _mm_prefetch((const void *)p, _MM_HINT_T1);
 }
 
 static inline void rte_prefetch2(const volatile void *p)
 {
-   asm volatile ("prefetcht2 %[p]" : : [p] "m" (*(const volatile char 
*)p));
+   _mm_prefetch((const void *)p, _MM_HINT_T2);
 }
 
 static inline void rte_prefetch_non_temporal(const volatile void *p)
 {
-   asm volatile ("prefetchnta %[p]" : : [p] "m" (*(const volatile char 
*)p));
+   _mm_prefetch((const void *)p, _MM_HINT_NTA);
 }
 
+#pragma GCC diagnostic pop
+
+#ifdef RTE_TOOLCHAIN_MSVC
 /*
  * We use raw byte codes for now as only the newest compiler
  * versions support this instruction natively.
@@ -41,8 +49,17 @@ static inline void rte_prefetch_non_temporal(const volatile 
void *p)
 static inline void
 rte_cldemote(const volatile void *p)
 {
+   _mm_cldemote(p);
+}
+#else
+__rte_experimental
+static inline void
+rte_cldemote(const volatile void *p)
+{
asm volatile(".byte 0x0f, 0x1c, 0x06" :: "S" (p));
 }
+#endif
+
 
 #ifdef __cplusplus
 }
-- 
1.8.3.1



[PATCH v9 08/14] eal: hide GCC extension based alignment markers

2023-07-11 Thread Tyler Retzlaff
When compiling with MSVC don't expose typedefs used as alignment
markers.

Signed-off-by: Tyler Retzlaff 
Acked-by: Morten Brørup 
---
 lib/eal/include/rte_common.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h
index 15765b4..2f464e3 100644
--- a/lib/eal/include/rte_common.h
+++ b/lib/eal/include/rte_common.h
@@ -460,6 +460,8 @@ static void __attribute__((destructor(RTE_PRIO(prio)), 
used)) func(void)
 
 /*** Structure alignment markers /
 
+#ifndef RTE_TOOLCHAIN_MSVC
+
 /** Generic marker for any place in a structure. */
 __extension__ typedef void*RTE_MARKER[0];
 /** Marker for 1B alignment in a structure. */
@@ -471,6 +473,8 @@ static void __attribute__((destructor(RTE_PRIO(prio)), 
used)) func(void)
 /** Marker for 8B alignment in a structure. */
 __extension__ typedef uint64_t RTE_MARKER64[0];
 
+#endif
+
 /**
  * Combines 32b inputs most significant set bits into the least
  * significant bits to construct a value with the same MSBs as x
-- 
1.8.3.1



[PATCH v9 12/14] telemetry: avoid expanding versioned symbol macros on MSVC

2023-07-11 Thread Tyler Retzlaff
Windows does not support versioned symbols. Fortunately Windows also
doesn't have an exported stable ABI.

Export rte_tel_data_add_array_int -> rte_tel_data_add_array_int_24
and rte_tel_data_add_dict_int -> rte_tel_data_add_dict_int_v24
functions.

Windows does have a way to achieve similar versioning for symbols but it
is not a simple #define so it will be done as a work package later.

Signed-off-by: Tyler Retzlaff 
Acked-by: Bruce Richardson 
Acked-by: Morten Brørup 
---
 lib/telemetry/telemetry_data.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/lib/telemetry/telemetry_data.c b/lib/telemetry/telemetry_data.c
index 0c7187b..523287b 100644
--- a/lib/telemetry/telemetry_data.c
+++ b/lib/telemetry/telemetry_data.c
@@ -83,8 +83,16 @@
 /* mark the v23 function as the older version, and v24 as the default version 
*/
 VERSION_SYMBOL(rte_tel_data_add_array_int, _v23, 23);
 BIND_DEFAULT_SYMBOL(rte_tel_data_add_array_int, _v24, 24);
+#ifdef RTE_TOOLCHAIN_MSVC
+int
+rte_tel_data_add_array_int(struct rte_tel_data *d, int64_t x)
+{
+   return rte_tel_data_add_array_int_v24(d, x);
+}
+#else
 MAP_STATIC_SYMBOL(int rte_tel_data_add_array_int(struct rte_tel_data *d,
int64_t x), rte_tel_data_add_array_int_v24);
+#endif
 
 int
 rte_tel_data_add_array_uint(struct rte_tel_data *d, uint64_t x)
@@ -218,8 +226,16 @@
 /* mark the v23 function as the older version, and v24 as the default version 
*/
 VERSION_SYMBOL(rte_tel_data_add_dict_int, _v23, 23);
 BIND_DEFAULT_SYMBOL(rte_tel_data_add_dict_int, _v24, 24);
+#ifdef RTE_TOOLCHAIN_MSVC
+int
+rte_tel_data_add_dict_int(struct rte_tel_data *d, const char *name, int64_t 
val)
+{
+   return rte_tel_data_add_dict_int_v24(d, name, val);
+}
+#else
 MAP_STATIC_SYMBOL(int rte_tel_data_add_dict_int(struct rte_tel_data *d,
const char *name, int64_t val), rte_tel_data_add_dict_int_v24);
+#endif
 
 int
 rte_tel_data_add_dict_uint(struct rte_tel_data *d,
-- 
1.8.3.1



[PATCH v9 11/14] eal: exclude exposure of rte atomic APIs for MSVC builds

2023-07-11 Thread Tyler Retzlaff
It's discouraged to use rte_atomics APIs instead standard APIs should be
used from C11. Since MSVC is a new toolchain/platform combination block
visibility of the rte_atomic APIs from day 1.

Signed-off-by: Tyler Retzlaff 
Acked-by: Morten Brørup 
---
 lib/eal/include/generic/rte_atomic.h | 7 +++
 lib/eal/x86/include/rte_atomic.h | 4 
 2 files changed, 11 insertions(+)

diff --git a/lib/eal/include/generic/rte_atomic.h 
b/lib/eal/include/generic/rte_atomic.h
index 6a6c394..0112208 100644
--- a/lib/eal/include/generic/rte_atomic.h
+++ b/lib/eal/include/generic/rte_atomic.h
@@ -131,6 +131,8 @@
 
 /*- 16 bit atomic operations 
-*/
 
+#ifndef RTE_TOOLCHAIN_MSVC
+
 /**
  * Atomic compare and set.
  *
@@ -1038,8 +1040,11 @@ static inline void rte_atomic64_clear(rte_atomic64_t *v)
 }
 #endif
 
+#endif
+
 /* 128 bit atomic operations 
-*/
 
+
 /**
  * 128-bit integer structure.
  */
@@ -1049,8 +1054,10 @@ static inline void rte_atomic64_clear(rte_atomic64_t *v)
union {
uint64_t val[2];
 #ifdef RTE_ARCH_64
+#ifndef RTE_TOOLCHAIN_MSVC
__extension__ __int128 int128;
 #endif
+#endif
};
 } __rte_aligned(16) rte_int128_t;
 
diff --git a/lib/eal/x86/include/rte_atomic.h b/lib/eal/x86/include/rte_atomic.h
index 7aba1c3..9ba61f8 100644
--- a/lib/eal/x86/include/rte_atomic.h
+++ b/lib/eal/x86/include/rte_atomic.h
@@ -83,6 +83,8 @@
 
 #define rte_io_rmb() rte_compiler_barrier()
 
+#ifndef RTE_TOOLCHAIN_MSVC
+
 /**
  * Synchronization fence between threads based on the specified memory order.
  *
@@ -279,6 +281,8 @@ static inline int rte_atomic32_dec_and_test(rte_atomic32_t 
*v)
 #include "rte_atomic_64.h"
 #endif
 
+#endif
+
 #ifdef __cplusplus
 }
 #endif
-- 
1.8.3.1



[PATCH v9 09/14] eal: hide typedefs based on GCC vector extensions

2023-07-11 Thread Tyler Retzlaff
When compiling with MSVC don't expose typedefs based on GCC vector
extensions.

Signed-off-by: Tyler Retzlaff 
Acked-by: Morten Brørup 
---
 lib/eal/include/generic/rte_vect.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/lib/eal/include/generic/rte_vect.h 
b/lib/eal/include/generic/rte_vect.h
index 3fec2bf..777510c 100644
--- a/lib/eal/include/generic/rte_vect.h
+++ b/lib/eal/include/generic/rte_vect.h
@@ -17,6 +17,8 @@
 
 #include 
 
+#ifndef RTE_TOOLCHAIN_MSVC
+
 /* Unsigned vector types */
 
 /**
@@ -186,6 +188,8 @@
  */
 typedef int64_t rte_v256s64_t __attribute__((vector_size(32), aligned(32)));
 
+#endif
+
 /**
  * The max SIMD bitwidth value to limit vector path selection.
  */
-- 
1.8.3.1



[PATCH v9 05/14] eal: use umonitor umwait and tpause intrinsics

2023-07-11 Thread Tyler Retzlaff
Inline assembly is not supported for MSVC x64 instead use _umonitor,
_umwait and _tpause intrinsics.

Signed-off-by: Tyler Retzlaff 
Acked-by: Morten Brørup 
Acked-by: Konstantin Ananyev 
---
 lib/eal/x86/rte_power_intrinsics.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/lib/eal/x86/rte_power_intrinsics.c 
b/lib/eal/x86/rte_power_intrinsics.c
index f749da9..4066d13 100644
--- a/lib/eal/x86/rte_power_intrinsics.c
+++ b/lib/eal/x86/rte_power_intrinsics.c
@@ -109,9 +109,13 @@
 */
 
/* set address for UMONITOR */
+#if defined(RTE_TOOLCHAIN_MSVC) || defined(__WAITPKG__)
+   _umonitor(pmc->addr);
+#else
asm volatile(".byte 0xf3, 0x0f, 0xae, 0xf7;"
:
: "D"(pmc->addr));
+#endif
 
/* now that we've put this address into monitor, we can unlock */
rte_spinlock_unlock(&s->lock);
@@ -123,10 +127,14 @@
goto end;
 
/* execute UMWAIT */
+#if defined(RTE_TOOLCHAIN_MSVC) || defined(__WAITPKG__)
+   _umwait(tsc_l, tsc_h);
+#else
asm volatile(".byte 0xf2, 0x0f, 0xae, 0xf7;"
: /* ignore rflags */
: "D"(0), /* enter C0.2 */
  "a"(tsc_l), "d"(tsc_h));
+#endif
 
 end:
/* erase sleep address */
@@ -153,10 +161,14 @@
return -ENOTSUP;
 
/* execute TPAUSE */
+#if defined(RTE_TOOLCHAIN_MSVC) || defined(__WAITPKG__)
+   _tpause(tsc_l, tsc_h);
+#else
asm volatile(".byte 0x66, 0x0f, 0xae, 0xf7;"
: /* ignore rflags */
: "D"(0), /* enter C0.2 */
"a"(tsc_l), "d"(tsc_h));
+#endif
 
return 0;
 }
-- 
1.8.3.1



[PATCH v9 10/14] eal: expand most macros to empty when using MSVC

2023-07-11 Thread Tyler Retzlaff
For now expand a lot of common rte macros empty. The catch here is we
need to test that most of the macros do what they should but at the same
time they are blocking work needed to bootstrap of the unit tests.

Later we will return and provide (where possible) expansions that work
correctly for msvc and where not possible provide some alternate macros
to achieve the same outcome.

Signed-off-by: Tyler Retzlaff 
Acked-by: Morten Brørup 
---
 lib/eal/include/rte_branch_prediction.h |  8 +
 lib/eal/include/rte_common.h| 54 +
 lib/eal/include/rte_compat.h| 20 
 3 files changed, 82 insertions(+)

diff --git a/lib/eal/include/rte_branch_prediction.h 
b/lib/eal/include/rte_branch_prediction.h
index 414cd92..c0356ca 100644
--- a/lib/eal/include/rte_branch_prediction.h
+++ b/lib/eal/include/rte_branch_prediction.h
@@ -24,7 +24,11 @@
  *  do_stuff();
  */
 #ifndef likely
+#ifdef RTE_TOOLCHAIN_MSVC
+#define likely(x)  (!!(x))
+#else
 #define likely(x)  __builtin_expect(!!(x), 1)
+#endif
 #endif /* likely */
 
 /**
@@ -37,7 +41,11 @@
  *  do_stuff();
  */
 #ifndef unlikely
+#ifdef RTE_TOOLCHAIN_MSVC
+#define unlikely(x)(!!(x))
+#else
 #define unlikely(x)__builtin_expect(!!(x), 0)
+#endif
 #endif /* unlikely */
 
 #ifdef __cplusplus
diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h
index 2f464e3..b087532 100644
--- a/lib/eal/include/rte_common.h
+++ b/lib/eal/include/rte_common.h
@@ -41,6 +41,10 @@
 #define RTE_STD_C11
 #endif
 
+#ifdef RTE_TOOLCHAIN_MSVC
+#define __extension__
+#endif
+
 /*
  * RTE_TOOLCHAIN_GCC is defined if the target is built with GCC,
  * while a host application (like pmdinfogen) may have another compiler.
@@ -65,7 +69,11 @@
 /**
  * Force alignment
  */
+#ifdef RTE_TOOLCHAIN_MSVC
+#define __rte_aligned(a)
+#else
 #define __rte_aligned(a) __attribute__((__aligned__(a)))
+#endif
 
 #ifdef RTE_ARCH_STRICT_ALIGN
 typedef uint64_t unaligned_uint64_t __rte_aligned(1);
@@ -80,16 +88,29 @@
 /**
  * Force a structure to be packed
  */
+#ifdef RTE_TOOLCHAIN_MSVC
+#define __rte_packed
+#else
 #define __rte_packed __attribute__((__packed__))
+#endif
 
 /**
  * Macro to mark a type that is not subject to type-based aliasing rules
  */
+#ifdef RTE_TOOLCHAIN_MSVC
+#define __rte_may_alias
+#else
 #define __rte_may_alias __attribute__((__may_alias__))
+#endif
 
 /*** Macro to mark functions and fields scheduled for removal */
+#ifdef RTE_TOOLCHAIN_MSVC
+#define __rte_deprecated
+#define __rte_deprecated_msg(msg)
+#else
 #define __rte_deprecated   __attribute__((__deprecated__))
 #define __rte_deprecated_msg(msg)  __attribute__((__deprecated__(msg)))
+#endif
 
 /**
  *  Macro to mark macros and defines scheduled for removal
@@ -110,14 +131,22 @@
 /**
  * Force symbol to be generated even if it appears to be unused.
  */
+#ifdef RTE_TOOLCHAIN_MSVC
+#define __rte_used
+#else
 #define __rte_used __attribute__((used))
+#endif
 
 /*** Macros to eliminate unused variable warnings /
 
 /**
  * short definition to mark a function parameter unused
  */
+#ifdef RTE_TOOLCHAIN_MSVC
+#define __rte_unused
+#else
 #define __rte_unused __attribute__((__unused__))
+#endif
 
 /**
  * Mark pointer as restricted with regard to pointer aliasing.
@@ -141,6 +170,9 @@
  * even if the underlying stdio implementation is ANSI-compliant,
  * so this must be overridden.
  */
+#ifdef RTE_TOOLCHAIN_MSVC
+#define __rte_format_printf(format_index, first_arg)
+#else
 #if RTE_CC_IS_GNU
 #define __rte_format_printf(format_index, first_arg) \
__attribute__((format(gnu_printf, format_index, first_arg)))
@@ -148,6 +180,7 @@
 #define __rte_format_printf(format_index, first_arg) \
__attribute__((format(printf, format_index, first_arg)))
 #endif
+#endif
 
 /**
  * Tells compiler that the function returns a value that points to
@@ -222,7 +255,11 @@ static void __attribute__((destructor(RTE_PRIO(prio)), 
used)) func(void)
 /**
  * Hint never returning function
  */
+#ifdef RTE_TOOLCHAIN_MSVC
+#define __rte_noreturn
+#else
 #define __rte_noreturn __attribute__((noreturn))
+#endif
 
 /**
  * Issue a warning in case the function's return value is ignored.
@@ -247,12 +284,20 @@ static void __attribute__((destructor(RTE_PRIO(prio)), 
used)) func(void)
  *  }
  * @endcode
  */
+#ifdef RTE_TOOLCHAIN_MSVC
+#define __rte_warn_unused_result
+#else
 #define __rte_warn_unused_result __attribute__((warn_unused_result))
+#endif
 
 /**
  * Force a function to be inlined
  */
+#ifdef RTE_TOOLCHAIN_MSVC
+#define __rte_always_inline
+#else
 #define __rte_always_inline inline __attribute__((always_inline))
+#endif
 
 /**
  * Force a function to be noinlined
@@ -437,7 +482,11 @@ static void __attribute__((destructor(RTE_PRIO(prio)), 
used)) func(void)
 #define RTE_CACHE_LINE_MIN_SIZE 64
 
 /** Force alignment to cache line. */
+#ifdef RTE_TOOLCHAIN_MSVC
+#define __rte_cache_aligned
+#else
 #define __rte_cache_al

[PATCH v9 13/14] eal: always define MSVC as little endian

2023-07-11 Thread Tyler Retzlaff
The MSVC compiler does not target big endian platforms so define
little endian always.

Signed-off-by: Tyler Retzlaff 
Acked-by: Morten Brørup 
---
 lib/eal/include/generic/rte_byteorder.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/eal/include/generic/rte_byteorder.h 
b/lib/eal/include/generic/rte_byteorder.h
index 1e32a1b..375f118 100644
--- a/lib/eal/include/generic/rte_byteorder.h
+++ b/lib/eal/include/generic/rte_byteorder.h
@@ -45,6 +45,8 @@
 #define RTE_BYTE_ORDER RTE_BIG_ENDIAN
 #elif defined __LITTLE_ENDIAN__
 #define RTE_BYTE_ORDER RTE_LITTLE_ENDIAN
+#elif defined RTE_TOOLCHAIN_MSVC
+#define RTE_BYTE_ORDER RTE_LITTLE_ENDIAN
 #endif
 #if !defined(RTE_BYTE_ORDER)
 #error Unknown endianness.
-- 
1.8.3.1



[PATCH v9 14/14] eal: do not define typeof macro when building with MSVC

2023-07-11 Thread Tyler Retzlaff
When building with MSVC do not assume typeof is a macro and don't
define a typeof macro that conflicts with C23 typeof keyword.

Signed-off-by: Tyler Retzlaff 
Acked-by: Morten Brørup 
---
 lib/eal/include/rte_common.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h
index b087532..cf7d8d8 100644
--- a/lib/eal/include/rte_common.h
+++ b/lib/eal/include/rte_common.h
@@ -24,9 +24,11 @@
 /* OS specific include */
 #include 
 
+#ifndef RTE_TOOLCHAIN_MSVC
 #ifndef typeof
 #define typeof __typeof__
 #endif
+#endif
 
 #ifndef __cplusplus
 #ifndef asm
-- 
1.8.3.1



[PATCH v9 07/14] eal: use byte swap intrinsics

2023-07-11 Thread Tyler Retzlaff
Inline assembly is not supported for MSVC x64 instead expand
use _byteswap_u{ushort,ulong,uint64} intrinsics instead.

Signed-off-by: Tyler Retzlaff 
Acked-by: Morten Brørup 
---
 lib/eal/include/generic/rte_byteorder.h | 11 +++
 lib/eal/x86/include/rte_byteorder.h |  4 
 2 files changed, 15 insertions(+)

diff --git a/lib/eal/include/generic/rte_byteorder.h 
b/lib/eal/include/generic/rte_byteorder.h
index a67e1d7..1e32a1b 100644
--- a/lib/eal/include/generic/rte_byteorder.h
+++ b/lib/eal/include/generic/rte_byteorder.h
@@ -234,6 +234,7 @@
 #endif /* __DOXYGEN__ */
 
 #ifdef RTE_FORCE_INTRINSICS
+#ifndef RTE_TOOLCHAIN_MSVC
 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
 #define rte_bswap16(x) __builtin_bswap16(x)
 #endif
@@ -241,6 +242,16 @@
 #define rte_bswap32(x) __builtin_bswap32(x)
 
 #define rte_bswap64(x) __builtin_bswap64(x)
+#else
+/*
+ * note: we may want to #pragma intrsinsic(_byteswap_u{short,long,uint64})
+ */
+#define rte_bswap16(x) _byteswap_ushort(x)
+
+#define rte_bswap32(x) _byteswap_ulong(x)
+
+#define rte_bswap64(x) _byteswap_uint64(x)
+#endif
 
 #endif
 
diff --git a/lib/eal/x86/include/rte_byteorder.h 
b/lib/eal/x86/include/rte_byteorder.h
index a2dfecc..3d6e58e 100644
--- a/lib/eal/x86/include/rte_byteorder.h
+++ b/lib/eal/x86/include/rte_byteorder.h
@@ -18,6 +18,7 @@
 #define RTE_BYTE_ORDER RTE_LITTLE_ENDIAN
 #endif
 
+#ifndef RTE_TOOLCHAIN_MSVC
 /*
  * An architecture-optimized byte swap for a 16-bit value.
  *
@@ -69,6 +70,7 @@ static inline uint32_t rte_arch_bswap32(uint32_t _x)
   rte_arch_bswap16(x)))
 #endif
 #endif
+#endif
 
 #define rte_cpu_to_le_16(x) (x)
 #define rte_cpu_to_le_32(x) (x)
@@ -86,11 +88,13 @@ static inline uint32_t rte_arch_bswap32(uint32_t _x)
 #define rte_be_to_cpu_32(x) rte_bswap32(x)
 #define rte_be_to_cpu_64(x) rte_bswap64(x)
 
+#ifndef RTE_TOOLCHAIN_MSVC
 #ifdef RTE_ARCH_I686
 #include "rte_byteorder_32.h"
 #else
 #include "rte_byteorder_64.h"
 #endif
+#endif
 
 #ifdef __cplusplus
 }
-- 
1.8.3.1



[PATCH v6 1/2] ip_frag: optimize key compare and hash generation

2023-07-11 Thread pbhagavatula
From: Pavan Nikhilesh 

Use optimized rte_hash_k32_cmp_eq routine for key comparison for
x86 and ARM64.
Use CRC instructions for hash generation on ARM64.

Signed-off-by: Pavan Nikhilesh 
Reviewed-by: Ruifeng Wang 
Acked-by: Konstantin Ananyev 
---
On Neoverse-N2, performance improved by 10% when measured with
examples/ip_reassembly.

 v6 Changes:
 - Fix compilation with mingw
 v5 Changes:
 - Fix spellcheck.
 v4 Changes:
 - Fix compilation failures (sys/queue)
 - Update test case to use proper macros.
 v3 Changes:
 - Drop NEON patch.
 v2 Changes:
 - Fix compilation failure with non ARM64/x86 targets

 lib/hash/rte_cmp_arm64.h   | 16 
 lib/hash/rte_cmp_x86.h | 16 
 lib/ip_frag/ip_frag_common.h   | 14 ++
 lib/ip_frag/ip_frag_internal.c |  4 ++--
 4 files changed, 32 insertions(+), 18 deletions(-)

diff --git a/lib/hash/rte_cmp_arm64.h b/lib/hash/rte_cmp_arm64.h
index e9e26f9abd..a3e85635eb 100644
--- a/lib/hash/rte_cmp_arm64.h
+++ b/lib/hash/rte_cmp_arm64.h
@@ -3,7 +3,7 @@
  */

 /* Functions to compare multiple of 16 byte keys (up to 128 bytes) */
-static int
+static inline int
 rte_hash_k16_cmp_eq(const void *key1, const void *key2,
size_t key_len __rte_unused)
 {
@@ -24,7 +24,7 @@ rte_hash_k16_cmp_eq(const void *key1, const void *key2,
return !(x0 == 0 && x1 == 0);
 }

-static int
+static inline int
 rte_hash_k32_cmp_eq(const void *key1, const void *key2, size_t key_len)
 {
return rte_hash_k16_cmp_eq(key1, key2, key_len) ||
@@ -32,7 +32,7 @@ rte_hash_k32_cmp_eq(const void *key1, const void *key2, 
size_t key_len)
(const char *) key2 + 16, key_len);
 }

-static int
+static inline int
 rte_hash_k48_cmp_eq(const void *key1, const void *key2, size_t key_len)
 {
return rte_hash_k16_cmp_eq(key1, key2, key_len) ||
@@ -42,7 +42,7 @@ rte_hash_k48_cmp_eq(const void *key1, const void *key2, 
size_t key_len)
(const char *) key2 + 32, key_len);
 }

-static int
+static inline int
 rte_hash_k64_cmp_eq(const void *key1, const void *key2, size_t key_len)
 {
return rte_hash_k32_cmp_eq(key1, key2, key_len) ||
@@ -50,7 +50,7 @@ rte_hash_k64_cmp_eq(const void *key1, const void *key2, 
size_t key_len)
(const char *) key2 + 32, key_len);
 }

-static int
+static inline int
 rte_hash_k80_cmp_eq(const void *key1, const void *key2, size_t key_len)
 {
return rte_hash_k64_cmp_eq(key1, key2, key_len) ||
@@ -58,7 +58,7 @@ rte_hash_k80_cmp_eq(const void *key1, const void *key2, 
size_t key_len)
(const char *) key2 + 64, key_len);
 }

-static int
+static inline int
 rte_hash_k96_cmp_eq(const void *key1, const void *key2, size_t key_len)
 {
return rte_hash_k64_cmp_eq(key1, key2, key_len) ||
@@ -66,7 +66,7 @@ rte_hash_k96_cmp_eq(const void *key1, const void *key2, 
size_t key_len)
(const char *) key2 + 64, key_len);
 }

-static int
+static inline int
 rte_hash_k112_cmp_eq(const void *key1, const void *key2, size_t key_len)
 {
return rte_hash_k64_cmp_eq(key1, key2, key_len) ||
@@ -76,7 +76,7 @@ rte_hash_k112_cmp_eq(const void *key1, const void *key2, 
size_t key_len)
(const char *) key2 + 96, key_len);
 }

-static int
+static inline int
 rte_hash_k128_cmp_eq(const void *key1, const void *key2, size_t key_len)
 {
return rte_hash_k64_cmp_eq(key1, key2, key_len) ||
diff --git a/lib/hash/rte_cmp_x86.h b/lib/hash/rte_cmp_x86.h
index 13a5836351..ddfbef462f 100644
--- a/lib/hash/rte_cmp_x86.h
+++ b/lib/hash/rte_cmp_x86.h
@@ -5,7 +5,7 @@
 #include 

 /* Functions to compare multiple of 16 byte keys (up to 128 bytes) */
-static int
+static inline int
 rte_hash_k16_cmp_eq(const void *key1, const void *key2, size_t key_len 
__rte_unused)
 {
const __m128i k1 = _mm_loadu_si128((const __m128i *) key1);
@@ -15,7 +15,7 @@ rte_hash_k16_cmp_eq(const void *key1, const void *key2, 
size_t key_len __rte_unu
return !_mm_test_all_zeros(x, x);
 }

-static int
+static inline int
 rte_hash_k32_cmp_eq(const void *key1, const void *key2, size_t key_len)
 {
return rte_hash_k16_cmp_eq(key1, key2, key_len) ||
@@ -23,7 +23,7 @@ rte_hash_k32_cmp_eq(const void *key1, const void *key2, 
size_t key_len)
(const char *) key2 + 16, key_len);
 }

-static int
+static inline int
 rte_hash_k48_cmp_eq(const void *key1, const void *key2, size_t key_len)
 {
return rte_hash_k16_cmp_eq(key1, key2, key_len) ||
@@ -33,7 +33,7 @@ rte_hash_k48_cmp_eq(const void *key1, const void *key2, 
size_t key_len)
(const char *) key2 + 32, key_len);
 }

-static int
+static inline int
 rte_hash_k64_cmp_eq(const void *key1, const void *key2, size_t key_len)
 {
return rte_hash_k32_cmp_eq(key1, key2, key_len) ||
@@ -41,7 +41,7 @@ rte_hash_k64_cmp_eq(const void *key1, const void *

[PATCH v6 2/2] test: add reassembly perf test

2023-07-11 Thread pbhagavatula
From: Pavan Nikhilesh 

Add reassembly perf autotest for both ipv4 and ipv6 reassembly.
Each test is performed with variable number of fragments per flow,
either ordered or unordered fragments and interleaved flows.

Signed-off-by: Pavan Nikhilesh 
Reviewed-by: Amit Prakash Shukla 
Tested-by: Amit Prakash Shukla 
Acked-by: Konstantin Ananyev 
---
 app/test/meson.build|2 +
 app/test/test_reassembly_perf.c | 1003 +++
 2 files changed, 1005 insertions(+)
 create mode 100644 app/test/test_reassembly_perf.c

diff --git a/app/test/meson.build b/app/test/meson.build
index 3e0a2360a3..b89cf0368f 100644
--- a/app/test/meson.build
+++ b/app/test/meson.build
@@ -106,6 +106,7 @@ test_sources = files(
 'test_rawdev.c',
 'test_rcu_qsbr.c',
 'test_rcu_qsbr_perf.c',
+'test_reassembly_perf.c',
 'test_reciprocal_division.c',
 'test_reciprocal_division_perf.c',
 'test_red.c',
@@ -296,6 +297,7 @@ perf_test_names = [
 'trace_perf_autotest',
 'ipsec_perf_autotest',
 'thash_perf_autotest',
+'reassembly_perf_autotest',
 ]
 
 driver_test_names = [
diff --git a/app/test/test_reassembly_perf.c b/app/test/test_reassembly_perf.c
new file mode 100644
index 00..c11b65291f
--- /dev/null
+++ b/app/test/test_reassembly_perf.c
@@ -0,0 +1,1003 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Marvell.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "test.h"
+
+#define MAX_FLOWS  (1024 * 32)
+#define MAX_BKTS   MAX_FLOWS
+#define MAX_ENTRIES_PER_BKT 16
+#define MAX_FRAGMENTS  RTE_LIBRTE_IP_FRAG_MAX_FRAG
+#define MIN_FRAGMENTS  2
+#define MAX_PKTS   (MAX_FLOWS * MAX_FRAGMENTS)
+
+#define MAX_PKT_LEN 2048
+#define MAX_TTL_MS  (5 * MS_PER_S)
+
+/* use RFC863 Discard Protocol */
+#define UDP_SRC_PORT 9
+#define UDP_DST_PORT 9
+
+/* use RFC5735 / RFC2544 reserved network test addresses */
+#define IP_SRC_ADDR(x) ((198U << 24) | (18 << 16) | (0 << 8) | (x))
+#define IP_DST_ADDR(x) ((198U << 24) | (18 << 16) | (1 << 15) | (x))
+
+/* 2001:0200::/48 is IANA reserved range for IPv6 benchmarking (RFC5180) */
+static uint8_t ip6_addr[16] = {32, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0};
+#define IP6_VERSION 6
+
+#define IP_DEFTTL 64 /* from RFC 1340. */
+
+static struct rte_ip_frag_tbl *frag_tbl;
+static struct rte_mempool *pkt_pool;
+static struct rte_mbuf *mbufs[MAX_FLOWS][MAX_FRAGMENTS];
+static uint8_t frag_per_flow[MAX_FLOWS];
+static uint32_t flow_cnt;
+
+#define FILL_MODE_LINEAR  0
+#define FILL_MODE_RANDOM  1
+#define FILL_MODE_INTERLEAVED 2
+
+static int
+reassembly_test_setup(void)
+{
+   uint64_t max_ttl_cyc = (MAX_TTL_MS * rte_get_timer_hz()) / 1E3;
+
+   frag_tbl = rte_ip_frag_table_create(MAX_BKTS, MAX_ENTRIES_PER_BKT,
+   MAX_BKTS * MAX_ENTRIES_PER_BKT, 
max_ttl_cyc,
+   rte_socket_id());
+   if (frag_tbl == NULL)
+   return TEST_FAILED;
+
+   rte_mbuf_set_user_mempool_ops("ring_mp_mc");
+   pkt_pool = rte_pktmbuf_pool_create(
+   "reassembly_perf_pool", MAX_FLOWS * MAX_FRAGMENTS, 0, 0,
+   RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
+   if (pkt_pool == NULL) {
+   printf("[%s] Failed to create pkt pool\n", __func__);
+   rte_ip_frag_table_destroy(frag_tbl);
+   return TEST_FAILED;
+   }
+
+   return TEST_SUCCESS;
+}
+
+static void
+reassembly_test_teardown(void)
+{
+   if (frag_tbl != NULL)
+   rte_ip_frag_table_destroy(frag_tbl);
+
+   if (pkt_pool != NULL)
+   rte_mempool_free(pkt_pool);
+}
+
+static void
+randomize_array_positions(void **array, uint8_t sz)
+{
+   void *tmp;
+   int i, j;
+
+   if (sz == 2) {
+   tmp = array[0];
+   array[0] = array[1];
+   array[1] = tmp;
+   } else {
+   for (i = sz - 1; i > 0; i--) {
+   j = rte_rand_max(i + 1);
+   tmp = array[i];
+   array[i] = array[j];
+   array[j] = tmp;
+   }
+   }
+}
+
+static void
+reassembly_print_banner(const char *proto_str)
+{
+   printf("+=="
+  "+\n");
+   printf("| %-32s| %-3s : %-58d|\n", proto_str, "Flow Count", MAX_FLOWS);
+   printf("+++=+=+"
+  "+===+\n");
+   printf("%-17s%-17s%-14s%-14s%-25s%-20s\n", "| Fragment Order",
+  "| Fragments/Flow", "| Outstanding", "| Cycles/Flow",
+  "| Cycles/Fragment insert", "| Cycles/Reassembly |");
+  

[PATCH] crypto/openssl: fix segfault due to uninitialized var

2023-07-11 Thread Gowrishankar Muthukrishnan
In some openSSL 3 libraries, uninitialized output variable
cause segfault. It is always nice to initialize it.

Fixes: 3b7d638fb11f ("crypto/openssl: support asymmetric SM2")
Bugzilla ID: 1250

Signed-off-by: Gowrishankar Muthukrishnan 
---
 drivers/crypto/openssl/rte_openssl_pmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c 
b/drivers/crypto/openssl/rte_openssl_pmd.c
index 4569c5e62f..5e8624cebe 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -2734,7 +2734,7 @@ process_openssl_sm2_op_evp(struct rte_crypto_op *cop,
case RTE_CRYPTO_ASYM_OP_ENCRYPT:
{
OSSL_PARAM *eparams = sess->u.sm2.params;
-   size_t output_len;
+   size_t output_len = 0;
 
kctx = EVP_PKEY_CTX_new_id(EVP_PKEY_SM2, NULL);
if (kctx == NULL || EVP_PKEY_fromdata_init(kctx) <= 0 ||
-- 
2.25.1



[PATCH] crypto/openssl: check for SM2 support in openssl 3.x lib

2023-07-11 Thread Gowrishankar Muthukrishnan
In some version of openSSL 3 lib (for an instance, in linux
distribution), if SM2 is not supported, driver should return
error.

Fixes: 3b7d638fb11f ("crypto/openssl: support asymmetric SM2")
Bugzilla ID: 1250

Signed-off-by: Gowrishankar Muthukrishnan 
---
 drivers/crypto/openssl/rte_openssl_pmd_ops.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/crypto/openssl/rte_openssl_pmd_ops.c 
b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
index 9497da41ef..85a4fa3e55 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd_ops.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
@@ -1285,6 +1285,7 @@ static int openssl_set_asym_session_parameters(
case RTE_CRYPTO_ASYM_XFORM_SM2:
{
 #if (OPENSSL_VERSION_NUMBER >= 0x3000L)
+#ifndef OPENSSL_NO_SM2
OSSL_PARAM_BLD *param_bld = NULL;
OSSL_PARAM *params = NULL;
int ret = -1;
@@ -1324,6 +1325,10 @@ static int openssl_set_asym_session_parameters(
OSSL_PARAM_free(asym_session->u.sm2.params);
 
return -1;
+#else
+   OPENSSL_LOG(WARNING, "SM2 unsupported in current OpenSSL 
Version");
+   return -ENOTSUP;
+#endif
 #else
OPENSSL_LOG(WARNING, "SM2 unsupported for OpenSSL Version < 
3.0");
return -ENOTSUP;
-- 
2.25.1



[PATCH] net/netvsc: remove unused function hn_vf_reset()

2023-07-11 Thread longli
From: Long Li 

hn_vf_reset() is defined but not used. Remove it.

Signed-off-by: Long Li 
---
 drivers/net/netvsc/hn_var.h | 1 -
 drivers/net/netvsc/hn_vf.c  | 5 -
 2 files changed, 6 deletions(-)

diff --git a/drivers/net/netvsc/hn_var.h b/drivers/net/netvsc/hn_var.h
index 98a3b83033..e1f8e69a28 100644
--- a/drivers/net/netvsc/hn_var.h
+++ b/drivers/net/netvsc/hn_var.h
@@ -248,7 +248,6 @@ int hn_vf_configure_locked(struct rte_eth_dev *dev,
   const struct rte_eth_conf *dev_conf);
 const uint32_t *hn_vf_supported_ptypes(struct rte_eth_dev *dev);
 inthn_vf_start(struct rte_eth_dev *dev);
-void   hn_vf_reset(struct rte_eth_dev *dev);
 inthn_vf_close(struct rte_eth_dev *dev);
 inthn_vf_stop(struct rte_eth_dev *dev);
 
diff --git a/drivers/net/netvsc/hn_vf.c b/drivers/net/netvsc/hn_vf.c
index 40981706d5..782395d805 100644
--- a/drivers/net/netvsc/hn_vf.c
+++ b/drivers/net/netvsc/hn_vf.c
@@ -534,11 +534,6 @@ int hn_vf_stop(struct rte_eth_dev *dev)
return ret; \
}
 
-void hn_vf_reset(struct rte_eth_dev *dev)
-{
-   VF_ETHDEV_FUNC(dev, rte_eth_dev_reset);
-}
-
 int hn_vf_close(struct rte_eth_dev *dev)
 {
int ret = 0;
-- 
2.17.1



[PATCH v3 0/2] Add DTS smoke tests

2023-07-11 Thread jspewock
From: Jeremy Spewock 

This version of the series addresses comments and improvements listed on
the previous non-RFC patch.

RFCs for this patch:
* v3: https://mails.dpdk.org/archives/dev/2023-June/269859.html
* v2: https://mails.dpdk.org/archives/dev/2023-May/267915.html
* v1: https://mails.dpdk.org/archives/dev/2023-April/266580.html

Previous patch:
* v1: https://mails.dpdk.org/archives/dev/2023-June/271309.html
* v2: https://mails.dpdk.org/archives/dev/2023-July/272833.html

Jeremy Spewock (2):
  dts: add smoke tests
  dts: add paramiko to dependencies

 dts/conf.yaml |  17 +-
 dts/framework/config/__init__.py  | 105 +--
 dts/framework/config/conf_yaml_schema.json| 142 +-
 dts/framework/dts.py  |  87 ++---
 dts/framework/exception.py|  12 ++
 dts/framework/remote_session/__init__.py  |  11 +-
 dts/framework/remote_session/os_session.py|  53 +-
 dts/framework/remote_session/posix_session.py |  29 ++-
 .../remote_session/remote/__init__.py |  10 +
 .../remote/interactive_remote_session.py  |  82 
 .../remote/interactive_shell.py   | 107 +++
 .../remote_session/remote/testpmd_shell.py|  75 
 dts/framework/test_result.py  |  37 +++-
 dts/framework/test_suite.py   |  10 +-
 dts/framework/testbed_model/node.py   |   2 +
 dts/framework/testbed_model/sut_node.py   | 176 +-
 dts/framework/utils.py|   2 +
 dts/poetry.lock   | 160 
 dts/pyproject.toml|   1 +
 dts/tests/TestSuite_smoke_tests.py| 113 +++
 20 files changed, 1097 insertions(+), 134 deletions(-)
 create mode 100644 
dts/framework/remote_session/remote/interactive_remote_session.py
 create mode 100644 dts/framework/remote_session/remote/interactive_shell.py
 create mode 100644 dts/framework/remote_session/remote/testpmd_shell.py
 create mode 100644 dts/tests/TestSuite_smoke_tests.py

-- 
2.41.0



[PATCH v3 1/2] dts: add smoke tests

2023-07-11 Thread jspewock
From: Jeremy Spewock 

Adds a new test suite for running smoke tests that verify general
configuration aspects of the system under test. If any of these tests
fail, the DTS execution terminates as part of a "fail-fast" model.

Signed-off-by: Jeremy Spewock 
---
 dts/conf.yaml |  17 +-
 dts/framework/config/__init__.py  | 105 +--
 dts/framework/config/conf_yaml_schema.json| 142 +-
 dts/framework/dts.py  |  87 ++---
 dts/framework/exception.py|  12 ++
 dts/framework/remote_session/__init__.py  |  11 +-
 dts/framework/remote_session/os_session.py|  53 +-
 dts/framework/remote_session/posix_session.py |  29 ++-
 .../remote_session/remote/__init__.py |  10 +
 .../remote/interactive_remote_session.py  |  82 
 .../remote/interactive_shell.py   | 107 +++
 .../remote_session/remote/testpmd_shell.py|  75 
 dts/framework/test_result.py  |  37 +++-
 dts/framework/test_suite.py   |  10 +-
 dts/framework/testbed_model/node.py   |   2 +
 dts/framework/testbed_model/sut_node.py   | 176 +-
 dts/framework/utils.py|   2 +
 dts/tests/TestSuite_smoke_tests.py| 113 +++
 18 files changed, 973 insertions(+), 97 deletions(-)
 create mode 100644 
dts/framework/remote_session/remote/interactive_remote_session.py
 create mode 100644 dts/framework/remote_session/remote/interactive_shell.py
 create mode 100644 dts/framework/remote_session/remote/testpmd_shell.py
 create mode 100644 dts/tests/TestSuite_smoke_tests.py

diff --git a/dts/conf.yaml b/dts/conf.yaml
index a9bd8a3e..c0be7848 100644
--- a/dts/conf.yaml
+++ b/dts/conf.yaml
@@ -10,9 +10,13 @@ executions:
 compiler_wrapper: ccache
 perf: false
 func: true
+skip_smoke_tests: false # optional flag that allow you to skip smoke tests
 test_suites:
   - hello_world
-system_under_test: "SUT 1"
+system_under_test:
+  node_name: "SUT 1"
+  vdevs: # optional; if removed, vdevs won't be used in the execution
+- "crypto_openssl"
 nodes:
   - name: "SUT 1"
 hostname: sut1.change.me.localhost
@@ -25,3 +29,14 @@ nodes:
 hugepages:  # optional; if removed, will use system hugepage configuration
 amount: 256
 force_first_numa: false
+ports:
+  - pci: ":00:08.0"
+os_driver_for_dpdk: vfio-pci # OS driver that DPDK will use
+os_driver: i40e
+peer_node: "TG 1"
+peer_pci: ":00:08.0"
+  - pci: ":00:08.1"
+os_driver_for_dpdk: vfio-pci
+os_driver: i40e
+peer_node: "TG 1"
+peer_pci: ":00:08.1"
diff --git a/dts/framework/config/__init__.py b/dts/framework/config/__init__.py
index ebb0823f..9e144748 100644
--- a/dts/framework/config/__init__.py
+++ b/dts/framework/config/__init__.py
@@ -12,6 +12,7 @@
 import pathlib
 from dataclasses import dataclass
 from enum import Enum, auto, unique
+from pathlib import PurePath
 from typing import Any, TypedDict
 
 import warlock  # type: ignore
@@ -72,6 +73,20 @@ class HugepageConfiguration:
 force_first_numa: bool
 
 
+@dataclass(slots=True, frozen=True)
+class PortConfig:
+node: str
+pci: str
+os_driver_for_dpdk: str
+os_driver: str
+peer_node: str
+peer_pci: str
+
+@staticmethod
+def from_dict(node: str, d: dict) -> "PortConfig":
+return PortConfig(node=node, **d)
+
+
 @dataclass(slots=True, frozen=True)
 class NodeConfiguration:
 name: str
@@ -84,6 +99,7 @@ class NodeConfiguration:
 use_first_core: bool
 memory_channels: int
 hugepages: HugepageConfiguration | None
+ports: list[PortConfig]
 
 @staticmethod
 def from_dict(d: dict) -> "NodeConfiguration":
@@ -92,19 +108,36 @@ def from_dict(d: dict) -> "NodeConfiguration":
 if "force_first_numa" not in hugepage_config:
 hugepage_config["force_first_numa"] = False
 hugepage_config = HugepageConfiguration(**hugepage_config)
+common_config = {
+"name": d["name"],
+"hostname": d["hostname"],
+"user": d["user"],
+"password": d.get("password"),
+"arch": Architecture(d["arch"]),
+"os": OS(d["os"]),
+"lcores": d.get("lcores", "1"),
+"use_first_core": d.get("use_first_core", False),
+"memory_channels": d.get("memory_channels", 1),
+"hugepages": hugepage_config,
+"ports": [PortConfig.from_dict(d["name"], port) for port in 
d["ports"]],
+}
+
+return NodeConfiguration(**common_config)
 
-return NodeConfiguration(
-name=d["name"],
-hostname=d["hostname"],
-user=d["user"],
-password=d.get("password"),
-arch=Architecture(d["arch"]),
-os=OS(d["os"]

[PATCH v3 2/2] dts: add paramiko to dependencies

2023-07-11 Thread jspewock
From: Jeremy Spewock 

added paramiko to the dependency files

Signed-off-by: Jeremy Spewock 
---
 dts/poetry.lock| 160 ++---
 dts/pyproject.toml |   1 +
 2 files changed, 124 insertions(+), 37 deletions(-)

diff --git a/dts/poetry.lock b/dts/poetry.lock
index 0b2a007d..dfd9a240 100644
--- a/dts/poetry.lock
+++ b/dts/poetry.lock
@@ -1,20 +1,33 @@
 [[package]]
 name = "attrs"
-version = "22.1.0"
+version = "23.1.0"
 description = "Classes Without Boilerplate"
 category = "main"
 optional = false
-python-versions = ">=3.5"
+python-versions = ">=3.7"
 
 [package.extras]
-dev = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest 
(>=4.3.0)", "mypy (>=0.900,!=0.940)", "pytest-mypy-plugins", "zope.interface", 
"furo", "sphinx", "sphinx-notfound-page", "pre-commit", "cloudpickle"]
-docs = ["furo", "sphinx", "zope.interface", "sphinx-notfound-page"]
-tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest 
(>=4.3.0)", "mypy (>=0.900,!=0.940)", "pytest-mypy-plugins", "zope.interface", 
"cloudpickle"]
-tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest 
(>=4.3.0)", "mypy (>=0.900,!=0.940)", "pytest-mypy-plugins", "cloudpickle"]
+cov = ["attrs", "coverage[toml] (>=5.3)"]
+dev = ["attrs", "pre-commit"]
+docs = ["furo", "myst-parser", "sphinx", "sphinx-notfound-page", 
"sphinxcontrib-towncrier", "towncrier", "zope-interface"]
+tests = ["attrs", "zope-interface"]
+tests-no-zope = ["cloudpickle", "hypothesis", "mypy (>=1.1.1)", "pympler", 
"pytest-mypy-plugins", "pytest-xdist", "pytest (>=4.3.0)"]
+
+[[package]]
+name = "bcrypt"
+version = "4.0.1"
+description = "Modern password hashing for your software and your servers"
+category = "main"
+optional = false
+python-versions = ">=3.6"
+
+[package.extras]
+tests = ["pytest (>=3.2.1,!=3.3.0)"]
+typecheck = ["mypy"]
 
 [[package]]
 name = "black"
-version = "22.10.0"
+version = "22.12.0"
 description = "The uncompromising code formatter."
 category = "dev"
 optional = false
@@ -33,6 +46,17 @@ d = ["aiohttp (>=3.7.4)"]
 jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"]
 uvloop = ["uvloop (>=0.15.2)"]
 
+[[package]]
+name = "cffi"
+version = "1.15.1"
+description = "Foreign Function Interface for Python calling C code."
+category = "main"
+optional = false
+python-versions = "*"
+
+[package.dependencies]
+pycparser = "*"
+
 [[package]]
 name = "click"
 version = "8.1.3"
@@ -52,18 +76,39 @@ category = "dev"
 optional = false
 python-versions = 
"!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
 
+[[package]]
+name = "cryptography"
+version = "41.0.1"
+description = "cryptography is a package which provides cryptographic recipes 
and primitives to Python developers."
+category = "main"
+optional = false
+python-versions = ">=3.7"
+
+[package.dependencies]
+cffi = ">=1.12"
+
+[package.extras]
+docs = ["sphinx (>=5.3.0)", "sphinx-rtd-theme (>=1.1.1)"]
+docstest = ["pyenchant (>=1.6.11)", "twine (>=1.12.0)", 
"sphinxcontrib-spelling (>=4.0.1)"]
+nox = ["nox"]
+pep8test = ["black", "ruff", "mypy", "check-sdist"]
+sdist = ["build"]
+ssh = ["bcrypt (>=3.1.5)"]
+test = ["pytest (>=6.2.0)", "pytest-benchmark", "pytest-cov", "pytest-xdist", 
"pretend"]
+test-randomorder = ["pytest-randomly"]
+
 [[package]]
 name = "isort"
-version = "5.10.1"
+version = "5.12.0"
 description = "A Python utility / library to sort Python imports."
 category = "dev"
 optional = false
-python-versions = ">=3.6.1,<4.0"
+python-versions = ">=3.8.0"
 
 [package.extras]
-pipfile_deprecated_finder = ["pipreqs", "requirementslib"]
-requirements_deprecated_finder = ["pipreqs", "pip-api"]
-colors = ["colorama (>=0.4.3,<0.5.0)"]
+colors = ["colorama (>=0.4.3)"]
+requirements-deprecated-finder = ["pip-api", "pipreqs"]
+pipfile-deprecated-finder = ["pip-shims (>=0.5.2)", "pipreqs", 
"requirementslib"]
 plugins = ["setuptools"]
 
 [[package]]
@@ -87,7 +132,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
 
 [[package]]
 name = "jsonschema"
-version = "4.17.0"
+version = "4.17.3"
 description = "An implementation of JSON Schema validation for Python"
 category = "main"
 optional = false
@@ -129,15 +174,33 @@ reports = ["lxml"]
 
 [[package]]
 name = "mypy-extensions"
-version = "0.4.3"
-description = "Experimental type system extensions for programs checked with 
the mypy typechecker."
+version = "1.0.0"
+description = "Type system extensions for programs checked with the mypy type 
checker."
 category = "dev"
 optional = false
-python-versions = "*"
+python-versions = ">=3.5"
+
+[[package]]
+name = "paramiko"
+version = "3.2.0"
+description = "SSH2 protocol library"
+category = "main"
+optional = false
+python-versions = ">=3.6"
+
+[package.dependencies]
+bcrypt = ">=3.2"
+cryptography = ">=3.3"
+pynacl = ">=1.5"
+
+[package.extras]
+all = ["pyasn1 (>=0.1.7)", "invoke (>=2.0)", "gssapi (>=1.4.1)", "pywin32 
(>=2.1.8)"]
+gssapi = ["pyasn1 (>=0.1.7)", "gssapi (>=1.4.1)", "pywin32 (>=2.1.8)"

Re: [PATCH v4] doc: add iavf live migration guide

2023-07-11 Thread Thomas Monjalon
Hello,

I don't pull this patch in -rc3 because I feel some improvements should be done.


> On 7/7/2023 2:08 PM, Lingyu Liu wrote:
> > +echo 2 > /sys/bus/pci/devices/:ca:00.1/sriov_numvfs
> > +echo "8086 1889" > /sys/bus/pci/drivers/ice-vfio-pci/new_id
> > +echo :ca:11.0 > /sys/bus/pci/devices/:ca:11.0/driver/unbind
> > +echo :ca:11.0 > /sys/bus/pci/drivers/ice-vfio-pci/bind
> > +echo :ca:11.1 > /sys/bus/pci/devices/:ca:11.1/driver/unbind
> > +echo :ca:11.1 > /sys/bus/pci/drivers/ice-vfio-pci/bind

Why not using dpdk-devbind.py?

> > +
> > +.. note::
> > +
> > +The command above creates two vfs for device :ca:00.1:

vfs should be VFs

> > +
> > +.. code-block:: console
> > +
> > +:ca:11.0 'Ethernet Adaptive Virtual Function 1889' if= 
> > drv=ice-vfio-pci unused=iavf
> > +:ca:11.1 'Ethernet Adaptive Virtual Function 1889' if= 
> > drv=ice-vfio-pci unused=iavf
> > +
> > +#.  Now, start the migration source Virtual Machine by running the 
> > following command:
> > +
> > +.. code-block:: console
> > +
> > +qemu/build/x86_64-softmmu/qemu-system-x86_64 -enable-kvm -cpu host 
> > -m 4G -smp 1 -device 
> > vfio-pci,host=:ca:11.0,x-enable-migration=true,x-pre-copy-dirty-page-tracking=off
> >  -drive file=ubuntu-2004.qcow2 -nic user,hostfwd=tcp::-:22 -monitor 
> > stdio

No need the full qemu command with your local details here.


> > --- a/doc/guides/rel_notes/release_23_07.rst
> > +++ b/doc/guides/rel_notes/release_23_07.rst
> > @@ -200,6 +200,9 @@ New Features
> >   
> > Enhanced the GRO library to support TCP packets over IPv6 network.
> >   
> > +* **Updated Intel iavf driver.**
> > +
> > +  Added the document for iavf driver live migration based on KVM vfio 
> > migration.

Not sure about the importance of this note.




Re: [PATCH 3/3] app/testpmd: fix meter mark handle update

2023-07-11 Thread Stephen Hemminger
On Tue, 11 Jul 2023 18:20:44 +0300
Alexander Kozyrev  wrote:

> + case RTE_FLOW_ACTION_TYPE_METER_MARK:
> + rte_memcpy(&mtr_update.meter_mark, action->conf,
> + sizeof(struct rte_flow_action_meter_mark));

Why use rte_memcpy? memcpy of fixed size is faster.
Also, more static checkers know what memcpy is.


Re: [PATCH] net/netvsc: remove unused function hn_vf_reset()

2023-07-11 Thread Stephen Hemminger
On Tue, 11 Jul 2023 12:12:30 -0700
lon...@linuxonhyperv.com wrote:

> From: Long Li 
> 
> hn_vf_reset() is defined but not used. Remove it.
> 
> Signed-off-by: Long Li 

Acked-by: Stephen Hemminger 


回复: 回复: [PATCH v3] vhost: add notify reply ops to fix message deadlock

2023-07-11 Thread Rma Ma
>  >  > Since backend and frontend message are synchronous in the same thread,
>  >  > there will be a probability of message deadlock.
>  >  > Consider each driver to determine whether to wait for response.
>  >  >
>  >  > Fixes: d90cf7d111ac ("vhost: support host notifier")
>  >  > Cc: maxime.coque...@redhat.com
>  >  > Signed-off-by: Rma Ma 
>  >  > ---
>  >  > v2 - fix format error in commit message
>  >  > v3 - add --in-reply-to
>  >  > ---
>  >
>  > Hi Maxime,
>  >
>  > This patch helps to fix vhost-user message deadlock, could you help
>  > review it?
>
>  The patch introduces a new device op, but it is used nowhere in vDPA
>  drivers.
>
>  What vDPA driver is it going to be used with?
>
>  Regards,
>  Maxime


Hi,

Our company's jmnd vdpa driver, which requires the rte_vhost_host_notifier_ctrl 
interface,
replicates the problem with the following scenario:

QEMU start vhost-user with modern net and blk, backend use dpdk-vdpa process,
after live migration, dest QEMU deadlock with dpdk-vdpa.

- QEMU sends VHOST_USER_SET_VRING_KICK to dpdk-vdpa net
- QEMU does not need to wait for a response to this message
- QEMU then sends VHOST_USER_SET_MEM_TABLE to dpdk-vdpa blk
- QEMU needs to wait reply in this message
- when dpdk-vdpa recv VHOST_USER_SET_VRING_KICK,
- it will send VHOST_USER_BACKEND_VRING_HOST_NOTIFIER_MSG to QEMU
- dpdk-vdpa needs to wait for a response to this message
- QEMU will deadlock with dpdk-vdpa

I tried to add a patch to the qemu community that uses a new thread to loop 
backend channel,
But there will be some multi-threaded synchronization issues

I think this is a public issue, and other backend messages take this into 
account,
so I think this message also needs a flag to fix it.

and jmnd vdpa driver will subsequently be open-sourced to the community.




Best wishes,

Rma


发件人: Maxime Coquelin 
发送时间: 2023年7月11日 21:25
收件人: Rma Ma ; dpdk-dev 
抄送: Chenbo Xia 
主题: Re: 回复: [PATCH v3] vhost: add notify reply ops to fix message deadlock

Hi,

On 7/11/23 11:25, Rma Ma wrote:
>  > Since backend and frontend message are synchronous in the same thread,
>  > there will be a probability of message deadlock.
>  > Consider each driver to determine whether to wait for response.
>  >
>  > Fixes: d90cf7d111ac ("vhost: support host notifier")
>  > Cc: maxime.coque...@redhat.com
>  > Signed-off-by: Rma Ma 
>  > ---
>  > v2 - fix format error in commit message
>  > v3 - add --in-reply-to
>  > ---
>
> Hi Maxime,
>
> This patch helps to fix vhost-user message deadlock, could you help
> review it?

The patch introduces a new device op, but it is used nowhere in vDPA
drivers.

What vDPA driver is it going to be used with?

Regards,
Maxime

> Thanks.
>
> Best wishes,
>
> Rma
>
> 
> *发件人:* Rma Ma
> *发送时间:* 2023年7月4日 10:52
> *收件人:* dpdk-dev 
> *抄送:* Maxime Coquelin ; Chenbo Xia
> ; Rma Ma 
> *主题:* [PATCH v3] vhost: add notify reply ops to fix message deadlock
> Since backend and frontend message are synchronous in the same thread,
> there will be a probability of message deadlock.
> Consider each driver to determine whether to wait for response.
>
> Fixes: d90cf7d111ac ("vhost: support host notifier")
> Cc: maxime.coque...@redhat.com
> Signed-off-by: Rma Ma 
> ---
> v2 - fix format error in commit message
> v3 - add --in-reply-to
> ---
>   lib/vhost/vdpa_driver.h |  3 +++
>   lib/vhost/vhost_user.c  | 23 ++-
>   2 files changed, 21 insertions(+), 5 deletions(-)
>
> diff --git a/lib/vhost/vdpa_driver.h b/lib/vhost/vdpa_driver.h
> index 8db4ab9f4d..3d2ea3c90e 100644
> --- a/lib/vhost/vdpa_driver.h
> +++ b/lib/vhost/vdpa_driver.h
> @@ -81,6 +81,9 @@ struct rte_vdpa_dev_ops {
>
>   /** get device type: net device, blk device... */
>   int (*get_dev_type)(struct rte_vdpa_device *dev, uint32_t *type);
> +
> +   /** Get the notify reply flag */
> +   int (*get_notify_reply_flag)(int vid, bool *need_reply);
>   };
>
>   /**
> diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
> index 901a80bbaa..aa61992939 100644
> --- a/lib/vhost/vhost_user.c
> +++ b/lib/vhost/vhost_user.c
> @@ -3365,13 +3365,14 @@ rte_vhost_backend_config_change(int vid, bool
> need_reply)
>   static int vhost_user_backend_set_vring_host_notifier(struct
> virtio_net *dev,
>   int index, int fd,
>   uint64_t offset,
> -   uint64_t size)
> +   uint64_t size,
> +   bool need_reply)
>   {
>   int ret;
>   struct vhu_msg_context ctx = {
>   .msg = {
>   .request.backend =
> VHOST_USER_BACKEND_VRING_HOST_NOTIFIER_MSG,
> -   .flags = VHOST_USER_VERSION | VHOST_USER_NEED_REPL

RE: [PATCH v1] app/procinfo: revise display eventdev xstats

2023-07-11 Thread Yuan, DukaiX
> -Original Message-
> From: Abdullah Sevincer 
> Sent: 2023年7月9日 0:24
> To: dev@dpdk.org
> Cc: Pattan, Reshma ;
> step...@networkplumber.org; Sevincer, Abdullah
> ; sta...@dpdk.org
> Subject: [PATCH v1] app/procinfo: revise display eventdev xstats
> 
> process_eventdev_xstats() function was iterating over eventdev_var[]
> structure even if there is no eventdev present.
> Revised the code to check to iterate and only look for the number of
> eventdevs present in the system. Also, shortened function name to
> eventdev_xstats().
> 
> Coverity issue: 395458
> Fixes: 674bb3906931 ("app/procinfo: display eventdev xstats")
> Cc: sta...@dpdk.org
> 
> Signed-off-by: Abdullah Sevincer 
> ---
Tested-by: Dukai Yuan


Reminder - DPDK Tech Board Meeting Tomorrow, Wed. Jul. 12, 2023 - 8am Pacific/11am Eastern/1500h UTC

2023-07-11 Thread Nathan Southern
Good evening DPDK Community,

Our next meeting will be held tomorrow, Wed., Jul. 12, 2023, at 8am
Pacific/11am Eastern.

Here is a read only link to the agenda:

https://annuel.framapad.org/p/r.0c3cc4d1e011214183872a98f6b5c7db

And you can log in at the jit.si link:

https://meet.jit.si/dpdk

See you soon

Thanks,

Nathan

Nathan C. Southern, Project Coordinator

Data Plane Development Kit

The Linux Foundation

248.835.4812 (mobile)

nsouth...@linuxfoundation.org


[Bug 1253] [dpdk-23.07] vf_offload/test_tso_tunnel: IPv6/UDP/GTPU packet of iavf cannot be forwarded in 32bit

2023-07-11 Thread bugzilla
https://bugs.dpdk.org/show_bug.cgi?id=1253

linglix.c...@intel.com changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|UNCONFIRMED |RESOLVED

--- Comment #3 from linglix.c...@intel.com ---
Verified on dpdk-23.07.0-rc2(490501e6cb) main branch PASSED.

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

[PATCH] net/iavf: fix the order of closing Rx queue

2023-07-11 Thread Zhichao Zeng
The current implementation stops queue before disabling the Rx interrupt,
and when there are still unprocessed packets remaining in the queue,
this may cause the Rx ring to timeout, leading to IOMMU fault.

This patch disables the Rx interrupt before stopping the queue, ensuring
that no packets received when disabling the queues.

Fixes: 02d212ca3125 ("net/iavf: rename remaining avf strings")
Cc: sta...@dpdk.org
Signed-off-by: Bartosz Staszewski 
Signed-off-by: Zhichao Zeng 
---
 drivers/net/iavf/iavf_ethdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index ac7154d720..f2fc5a5621 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -1087,8 +1087,6 @@ iavf_dev_stop(struct rte_eth_dev *dev)
if (adapter->stopped == 1)
return 0;
 
-   iavf_stop_queues(dev);
-
/* Disable the interrupt for Rx */
rte_intr_efd_disable(intr_handle);
/* Rx interrupt vector mapping free */
@@ -1101,6 +1099,8 @@ iavf_dev_stop(struct rte_eth_dev *dev)
iavf_add_del_mc_addr_list(adapter, vf->mc_addrs, vf->mc_addrs_num,
  false);
 
+   iavf_stop_queues(dev);
+
adapter->stopped = 1;
dev->data->dev_started = 0;
 
-- 
2.34.1



RE: [PATCH] crypto/openssl: fix segfault due to uninitialized var

2023-07-11 Thread Anoob Joseph
> 
> In some openSSL 3 libraries, uninitialized output variable cause segfault. It 
> is
> always nice to initialize it.
> 
> Fixes: 3b7d638fb11f ("crypto/openssl: support asymmetric SM2") Bugzilla ID:
> 1250
> 
> Signed-off-by: Gowrishankar Muthukrishnan 

Acked-by: Anoob Joseph 


RE: [PATCH] crypto/openssl: check for SM2 support in openssl 3.x lib

2023-07-11 Thread Anoob Joseph
> 
> In some version of openSSL 3 lib (for an instance, in linux distribution), if 
> SM2
> is not supported, driver should return error.
> 
> Fixes: 3b7d638fb11f ("crypto/openssl: support asymmetric SM2") Bugzilla ID:
> 1250
> 
> Signed-off-by: Gowrishankar Muthukrishnan 

Acked-by: Anoob Joseph 


Re: [PATCH v1 1/2] dts: add smoke tests

2023-07-11 Thread Juraj Linkeš
I think we're basically there, just one more point that needs to be
addressed - the send_command_no_output method.

>> >> > diff --git a/dts/framework/config/conf_yaml_schema.json 
>> >> > b/dts/framework/config/conf_yaml_schema.json
>> >> > index ca2d4a1e..3f7c301a 100644
>> >> > --- a/dts/framework/config/conf_yaml_schema.json
>> >> > +++ b/dts/framework/config/conf_yaml_schema.json
>> >> > @@ -6,6 +6,76 @@
>> >> >"type": "string",
>> >> >"description": "A unique identifier for a node"
>> >> >  },
>> >> > +"NIC": {
>> >> > +  "type": "string",
>> >> > +  "enum": [
>> >> > +"ALL",
>> >> > +"ConnectX3_MT4103",
>> >> > +"ConnectX4_LX_MT4117",
>> >> > +"ConnectX4_MT4115",
>> >> > +"ConnectX5_MT4119",
>> >> > +"ConnectX5_MT4121",
>> >> > +"I40E_10G-10G_BASE_T_BC",
>> >> > +"I40E_10G-10G_BASE_T_X722",
>> >> > +"I40E_10G-SFP_X722",
>> >> > +"I40E_10G-SFP_XL710",
>> >> > +"I40E_10G-X722_A0",
>> >> > +"I40E_1G-1G_BASE_T_X722",
>> >> > +"I40E_25G-25G_SFP28",
>> >> > +"I40E_40G-QSFP_A",
>> >> > +"I40E_40G-QSFP_B",
>> >> > +"IAVF-ADAPTIVE_VF",
>> >> > +"IAVF-VF",
>> >> > +"IAVF_10G-X722_VF",
>> >> > +"ICE_100G-E810C_QSFP",
>> >> > +"ICE_25G-E810C_SFP",
>> >> > +"ICE_25G-E810_XXV_SFP",
>> >> > +"IGB-I350_VF",
>> >> > +"IGB_1G-82540EM",
>> >> > +"IGB_1G-82545EM_COPPER",
>> >> > +"IGB_1G-82571EB_COPPER",
>> >> > +"IGB_1G-82574L",
>> >> > +"IGB_1G-82576",
>> >> > +"IGB_1G-82576_QUAD_COPPER",
>> >> > +"IGB_1G-82576_QUAD_COPPER_ET2",
>> >> > +"IGB_1G-82580_COPPER",
>> >> > +"IGB_1G-I210_COPPER",
>> >> > +"IGB_1G-I350_COPPER",
>> >> > +"IGB_1G-I354_SGMII",
>> >> > +"IGB_1G-PCH_LPTLP_I218_LM",
>> >> > +"IGB_1G-PCH_LPTLP_I218_V",
>> >> > +"IGB_1G-PCH_LPT_I217_LM",
>> >> > +"IGB_1G-PCH_LPT_I217_V",
>> >> > +"IGB_2.5G-I354_BACKPLANE_2_5GBPS",
>> >> > +"IGC-I225_LM",
>> >> > +"IGC-I226_LM",
>> >> > +"IXGBE_10G-82599_SFP",
>> >> > +"IXGBE_10G-82599_SFP_SF_QP",
>> >> > +"IXGBE_10G-82599_T3_LOM",
>> >> > +"IXGBE_10G-82599_VF",
>> >> > +"IXGBE_10G-X540T",
>> >> > +"IXGBE_10G-X540_VF",
>> >> > +"IXGBE_10G-X550EM_A_SFP",
>> >> > +"IXGBE_10G-X550EM_X_10G_T",
>> >> > +"IXGBE_10G-X550EM_X_SFP",
>> >> > +"IXGBE_10G-X550EM_X_VF",
>> >> > +"IXGBE_10G-X550T",
>> >> > +"IXGBE_10G-X550_VF",
>> >> > +"brcm_57414",
>> >> > +"brcm_P2100G",
>> >> > +"cavium_0011",
>> >> > +"cavium_a034",
>> >> > +"cavium_a063",
>> >> > +"cavium_a064",
>> >> > +"fastlinq_ql41000",
>> >> > +"fastlinq_ql41000_vf",
>> >> > +"fastlinq_ql45000",
>> >> > +"fastlinq_ql45000_vf",
>> >> > +"hi1822",
>> >> > +"virtio"
>> >> > +  ]
>> >> > +},
>> >> > +
>> >>
>> >> All these NICs may be overkill, do we want to trim them?
>> >>
>> >
>> >
>> > I think in general that the more we have the better to make it more 
>> > universally usable. If a NIC isn't supported by DTS anymore we could pull 
>> > it out but I don't see a problem with maintaining a list that has all 
>> > supported NICs even if it does end up being long.
>> >
>>
>> The broader question is what does it mean that a NIC is supported in
>> DTS? That's a question we should address in the CI/DTS call and in the
>> meantime, we could just leave the list as is.
>>
>
> I think this would be a very good thing to bring up and agree that there 
> should be more discussion on it. It probably is better to leave the list 
> longer in the meantime like you were saying as well.
>

I'm keeping notes on everything we need to talk about - we'll do that
after release.


>> >
>> >>
>> >> >
>> >> >  """
>> >> >  The package provides modules for managing remote connections to a 
>> >> > remote host (node),
>> >> > @@ -17,7 +18,14 @@
>> >> >
>> >> >  from .linux_session import LinuxSession
>> >> >  from .os_session import OSSession
>> >> > -from .remote import CommandResult, RemoteSession, SSHSession
>> >> > +from .remote import (
>> >> > +CommandResult,
>> >> > +InteractiveRemoteSession,
>> >> > +InteractiveShell,
>> >> > +RemoteSession,
>> >> > +SSHSession,
>> >> > +TestPmdShell,
>> >> > +)
>> >> >
>> >> >
>> >> >  def create_session(
>> >> > diff --git a/dts/framework/remote_session/os_session.py 
>> >> > b/dts/framework/remote_session/os_session.py
>> >> > index 4c48ae25..f5f53923 100644
>> >> > --- a/dts/framework/remote_session/os_session.py
>> >> > +++ b/dts/framework/remote_session/os_session.py
>> >> > @@ -12,7 +12,13 @@
>> >> >  from framework.testbed_model import LogicalCore
>> >> >  from framework.utils import EnvVarsDict, MesonArgs
>> >> >
>> >> > -from .remot