Re: [PATCH] app/testpmd:add vxlan txonly

2023-02-18 Thread wushaohua


在 2023/2/18 4:43, Ferruh Yigit 写道:

On 1/3/2023 2:30 AM,wushao...@chinatelecom.cn  wrote:

From: Shaohua Wu

Add the vxlan packet sending module to actively send
vxlan packets using a common network adapter.
The default vni is 1000.
example:
  ./dpdk-testpmd -l 32-47 -n 16 --file-prefix pg0 -- -i
--rxq=16 --txq=16 --rxd=1024 --txd=1024
--txpkts=64 --burst=64  --mbuf-size=4096
--nb-cores=15  --underlay_tx_only
--underlay-eth-peer=0,f0:00:00:00:00:66
--eth-peer=0,08:c0:eb:3e:87:af
--utx-ip=11.0.0.1,11.0.0.2
--tx-ip=30.0.0.1,30.0.0.2
--forward-mode=tuntxonly
--txonly-multi-flow

Signed-off-by: Shaohua Wu

Hi Shaohua,

This is a good feature but I am not sure if this is in the scope of
testpmd application.

Testpmd has basic packet generation capabilities, and it is useful for
quick/dirty testing, but for more advanced packet generation perhaps
other tools like pktgen [1] can be used, what do you think?

What is the justification to have this feature in testpmd, and what is
your usecase?


[1]
https://git.dpdk.org/apps/pktgen-dpdk/


Hi Ferruh,

Thank you for your review.From what I know now pktgen doesn't seem to support 
the construction of vxlan packets.

In a real test scenario, testpmd only sends bare packets and cannot cover test scenarios, such as ovs 
decap performance.


Currently, testpmd of this patch is used, and the packet sending performance is 22+Mpps 
with a 25G network adapter.



This is necessary for testing DPU devices or virtualization scenarios.



Best regards.Shaohua


[PATCH] mempool:Add monitor print for memory pool

2022-12-31 Thread wushaohua
From: wushaohua 

rte_mempool_dump adds prints for monitoring available and
used memory blocks

Signed-off-by: wushaohua 
---
 lib/mempool/rte_mempool.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c
index f33f455790..f6790bcc78 100644
--- a/lib/mempool/rte_mempool.c
+++ b/lib/mempool/rte_mempool.c
@@ -1268,7 +1268,10 @@ rte_mempool_dump(FILE *f, struct rte_mempool *mp)
if ((cache_count + common_count) > mp->size)
common_count = mp->size - cache_count;
fprintf(f, "  common_pool_count=%u\n", common_count);
-
+   fprintf(f, "  common_pool_avail_count=%u\n",
+   rte_mempool_avail_count(mp));
+   fprintf(f, "  common_pool_used=%u",
+   rte_mempool_in_use_count(mp));
/* sum and dump statistics */
 #ifdef RTE_LIBRTE_MEMPOOL_STATS
rte_mempool_ops_get_info(mp, &info);
-- 
2.30.2



[PATCH v2] mempool:Add monitor dump for memory pool

2022-12-31 Thread wushaohua
From: wushaohua 

rte_mempool_dump add dump for monitoring available and
used memory blocks

Signed-off-by: wushaohua 
---
 lib/mempool/rte_mempool.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c
index f33f455790..09d512a604 100644
--- a/lib/mempool/rte_mempool.c
+++ b/lib/mempool/rte_mempool.c
@@ -1265,9 +1265,14 @@ rte_mempool_dump(FILE *f, struct rte_mempool *mp)
 
cache_count = rte_mempool_dump_cache(f, mp);
common_count = rte_mempool_ops_get_count(mp);
+
if ((cache_count + common_count) > mp->size)
common_count = mp->size - cache_count;
fprintf(f, "  common_pool_count=%u\n", common_count);
+   fprintf(f, "  common_pool_avail_count=%u\n",
+   rte_mempool_avail_count(mp));
+   fprintf(f, "  common_pool_used_count=%u\n",
+   rte_mempool_in_use_count(mp));
 
/* sum and dump statistics */
 #ifdef RTE_LIBRTE_MEMPOOL_STATS
-- 
2.30.2



[PATCH 1/2] mempool:Add monitor dump for memory pool

2022-12-31 Thread wushaohua
From: wushaohua 

rte_mempool_dump add dump for monitoring available and
used memory blocks

Signed-off-by: wushaohua 
---
 lib/mempool/rte_mempool.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c
index f33f455790..09d512a604 100644
--- a/lib/mempool/rte_mempool.c
+++ b/lib/mempool/rte_mempool.c
@@ -1265,9 +1265,14 @@ rte_mempool_dump(FILE *f, struct rte_mempool *mp)
 
cache_count = rte_mempool_dump_cache(f, mp);
common_count = rte_mempool_ops_get_count(mp);
+
if ((cache_count + common_count) > mp->size)
common_count = mp->size - cache_count;
fprintf(f, "  common_pool_count=%u\n", common_count);
+   fprintf(f, "  common_pool_avail_count=%u\n",
+   rte_mempool_avail_count(mp));
+   fprintf(f, "  common_pool_used_count=%u\n",
+   rte_mempool_in_use_count(mp));
 
/* sum and dump statistics */
 #ifdef RTE_LIBRTE_MEMPOOL_STATS
-- 
2.30.2



[PATCH 2/2] update .mailmap

2022-12-31 Thread wushaohua
From: wushaohua 

Signed-off-by: wushaohua 
---
 .mailmap | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.mailmap b/.mailmap
index 75884b6fe2..fbcd6384eb 100644
--- a/.mailmap
+++ b/.mailmap
@@ -1498,6 +1498,7 @@ Yerden Zhumabekov  

 Yicai Lu 
 Yiding Zhou 
 Yi Li 
+wushaohua 
 Yi Liu 
 Yilong Lv 
 Yi Lu 
-- 
2.30.2



[PATCH] mempool:Add monitor dump for memory pool

2022-12-31 Thread wushaohua
From: Shaohua Wu 

rte_mempool_dump add dump for monitoring available and
used memory blocks

Signed-off-by: Shaohua Wu 
---
 lib/mempool/rte_mempool.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c
index f33f455790..09d512a604 100644
--- a/lib/mempool/rte_mempool.c
+++ b/lib/mempool/rte_mempool.c
@@ -1265,9 +1265,14 @@ rte_mempool_dump(FILE *f, struct rte_mempool *mp)
 
cache_count = rte_mempool_dump_cache(f, mp);
common_count = rte_mempool_ops_get_count(mp);
+
if ((cache_count + common_count) > mp->size)
common_count = mp->size - cache_count;
fprintf(f, "  common_pool_count=%u\n", common_count);
+   fprintf(f, "  common_pool_avail_count=%u\n",
+   rte_mempool_avail_count(mp));
+   fprintf(f, "  common_pool_used_count=%u\n",
+   rte_mempool_in_use_count(mp));
 
/* sum and dump statistics */
 #ifdef RTE_LIBRTE_MEMPOOL_STATS
-- 
2.30.2



[PATCH] .mailmap:update

2022-12-31 Thread wushaohua
From: Shaohua Wu 

update .mailmap

Signed-off-by: Shaohua Wu 
---
 .mailmap | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.mailmap b/.mailmap
index 75884b6fe2..5eb74a4479 100644
--- a/.mailmap
+++ b/.mailmap
@@ -1498,6 +1498,7 @@ Yerden Zhumabekov  

 Yicai Lu 
 Yiding Zhou 
 Yi Li 
+Shaohua Wu 
 Yi Liu 
 Yilong Lv 
 Yi Lu 
-- 
2.30.2



[PATCH] .mailmap:update

2023-01-01 Thread wushaohua
From: Shaohua Wu 

update .mailmap

Signed-off-by: Shaohua Wu 
---
 .mailmap | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.mailmap b/.mailmap
index 5eb74a4479..c9f4bdc162 100644
--- a/.mailmap
+++ b/.mailmap
@@ -1195,6 +1195,7 @@ Shai Brandes 
 Shally Verma  
 Shannon Nelson 
 Shannon Zhao 
+Shaohua Wu 
 Shaopeng He 
 Sharmila Podury 
 Sharon Haroni 
@@ -1498,7 +1499,6 @@ Yerden Zhumabekov  

 Yicai Lu 
 Yiding Zhou 
 Yi Li 
-Shaohua Wu 
 Yi Liu 
 Yilong Lv 
 Yi Lu 
-- 
2.30.2



[PATCH v2] .mailmap:update

2023-01-01 Thread wushaohua
From: Shaohua Wu 

update .mailmap

Signed-off-by: Shaohua Wu 
---
 .mailmap | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.mailmap b/.mailmap
index 5eb74a4479..c9f4bdc162 100644
--- a/.mailmap
+++ b/.mailmap
@@ -1195,6 +1195,7 @@ Shai Brandes 
 Shally Verma  
 Shannon Nelson 
 Shannon Zhao 
+Shaohua Wu 
 Shaopeng He 
 Sharmila Podury 
 Sharon Haroni 
@@ -1498,7 +1499,6 @@ Yerden Zhumabekov  

 Yicai Lu 
 Yiding Zhou 
 Yi Li 
-Shaohua Wu 
 Yi Liu 
 Yilong Lv 
 Yi Lu 
-- 
2.30.2



[PATCH] app/testpmd:add vxlan txonly

2023-01-02 Thread wushaohua
From: Shaohua Wu 

Add the vxlan packet sending module to actively send
vxlan packets using a common network adapter.
The default vni is 1000.
example:
 ./dpdk-testpmd -l 32-47 -n 16 --file-prefix pg0 -- -i
--rxq=16 --txq=16 --rxd=1024 --txd=1024
--txpkts=64 --burst=64  --mbuf-size=4096
--nb-cores=15  --underlay_tx_only
--underlay-eth-peer=0,f0:00:00:00:00:66
--eth-peer=0,08:c0:eb:3e:87:af
--utx-ip=11.0.0.1,11.0.0.2
--tx-ip=30.0.0.1,30.0.0.2
--forward-mode=tuntxonly
--txonly-multi-flow

Signed-off-by: Shaohua Wu 
---
 app/test-pmd/cmdline.c|  47 
 app/test-pmd/config.c |  15 ++
 app/test-pmd/meson.build  |   1 +
 app/test-pmd/parameters.c |  44 
 app/test-pmd/testpmd.c|  26 +-
 app/test-pmd/testpmd.h|  11 +-
 app/test-pmd/txonly.c |   4 +
 app/test-pmd/vxlan.c  | 534 ++
 app/test-pmd/vxlan.h  |  23 ++
 9 files changed, 700 insertions(+), 5 deletions(-)
 create mode 100644 app/test-pmd/vxlan.c
 create mode 100644 app/test-pmd/vxlan.h

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index b32dc8bfd4..a82214a6b1 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -12621,6 +12621,52 @@ static cmdline_parse_inst_t 
cmd_show_port_flow_transfer_proxy = {
}
 };
 
+struct cmd_underlay_eth_peer_result {
+   cmdline_fixed_string_t set;
+   cmdline_fixed_string_t underlay_eth_peer;
+   portid_t port_id;
+   cmdline_fixed_string_t underlay_peer_addr;
+};
+
+static void cmd_set_underlay_eth_peer_parsed(void *parsed_result,
+   __rte_unused struct cmdline *cl,
+   __rte_unused void *data)
+{
+   struct cmd_underlay_eth_peer_result *res = parsed_result;
+
+   if (test_done == 0) {
+   fprintf(stderr, "Please stop forwarding first\n");
+   return;
+   }
+   if (!strcmp(res->underlay_eth_peer, "underlay-eth-peer")) {
+   set_fwd_underlay_eth_peer(res->port_id, 
res->underlay_peer_addr);
+   fwd_config_setup();
+   }
+}
+
+static cmdline_parse_token_string_t cmd_underlay_eth_peer_set =
+   TOKEN_STRING_INITIALIZER(struct cmd_underlay_eth_peer_result, set, 
"set");
+static cmdline_parse_token_string_t cmd_underlay_eth_peer =
+   TOKEN_STRING_INITIALIZER(struct cmd_underlay_eth_peer_result, 
underlay_eth_peer, "underlay-eth-peer");
+static cmdline_parse_token_num_t cmd_underlay_eth_peer_port_id =
+   TOKEN_NUM_INITIALIZER(struct cmd_underlay_eth_peer_result, port_id,
+   RTE_UINT16);
+static cmdline_parse_token_string_t cmd_underlay_eth_peer_addr =
+   TOKEN_STRING_INITIALIZER(struct cmd_underlay_eth_peer_result, 
underlay_peer_addr, NULL);
+
+static cmdline_parse_inst_t cmd_set_fwd_underlay_eth_peer = {
+   .f = cmd_set_underlay_eth_peer_parsed,
+   .data = NULL,
+   .help_str = "set underlay-eth-peer  ",
+   .tokens = {
+   (void *)&cmd_underlay_eth_peer_set,
+   (void *)&cmd_underlay_eth_peer,
+   (void *)&cmd_underlay_eth_peer_port_id,
+   (void *)&cmd_underlay_eth_peer_addr,
+   NULL,
+   },
+};
+
 /* 

 */
 
 /* list of instructions */
@@ -12851,6 +12897,7 @@ static cmdline_parse_ctx_t builtin_ctx[] = {
(cmdline_parse_inst_t *)&cmd_show_capability,
(cmdline_parse_inst_t *)&cmd_set_flex_is_pattern,
(cmdline_parse_inst_t *)&cmd_set_flex_spec_pattern,
+   (cmdline_parse_inst_t *)&cmd_set_fwd_underlay_eth_peer,
NULL,
 };
 
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index acccb6b035..af878314bf 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -4769,6 +4769,21 @@ set_fwd_eth_peer(portid_t port_id, char *peer_addr)
}
peer_eth_addrs[port_id] = new_peer_addr;
 }
+void
+set_fwd_underlay_eth_peer(portid_t port_id, char *peer_addr)
+{
+   struct rte_ether_addr new_peer_addr;
+   if (!rte_eth_dev_is_valid_port(port_id)) {
+   fprintf(stderr, "Error: Invalid port number %i\n", port_id);
+   return;
+   }
+   if (rte_ether_unformat_addr(peer_addr, &new_peer_addr) < 0) {
+   fprintf(stderr, "Error: Invalid ethernet address: %s\n",
+   peer_addr);
+   return;
+   }
+   peer_underlay_eth_addrs[port_id] = new_peer_addr;
+}
 
 int
 set_fwd_lcores_list(unsigned int *lcorelist, unsigned int nb_lc)
diff --git a/app/test-pmd/meson.build b/app/test-pmd/meson.build
index 8488efc138..5f0de21996 100644
--- a/app/test-pmd/meson.build
+++ b/app/test-pmd/meson.build
@@ -26,6 +26,7 @@ sources = files(
 'testpmd.c',
 'txonly.c',
 'util.c',
+   'vxlan.c'
 )
 
 if dpdk_conf.has('RTE_HAS_JANSS