Thread (49 messages) 49 messages, 6 authors, 2017-10-20

Re: [PATCH v2 1/2] app/testpmd: add traffic management forwarding mode

From: De Lara Guarch, Pablo <hidden>
Date: 2017-09-18 13:54:21

quoted hunk ↗ jump to hunk
-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jasvinder Singh
Sent: Thursday, September 14, 2017 12:53 PM
To: dev@dpdk.org
Cc: Dumitrescu, Cristian <redacted>; Wu, Jingjing
[off-list ref]
Subject: [dpdk-dev] [PATCH v2 1/2] app/testpmd: add traffic management
forwarding mode

This commit extends the testpmd application with new forwarding engine
that demonstrates the use of ethdev traffic management APIs and softnic
PMD for QoS traffic management.

In this mode, 5-level hierarchical tree of the QoS scheduler is built with the
help of ethdev TM APIs such as shaper profile add/delete, shared shaper
add/update, node add/delete, hierarchy commit, etc.
The hierarchical tree has following nodes; root node(x1, level 0), subport
node(x1, level 1), pipe node(x4096, level 2), tc node(x16348, level 3), queue
node(x65536, level 4).

During runtime, each received packet is first classified by mapping the
packet fields information to 5-tuples (HQoS subport, pipe, traffic class,
queue within traffic class, and color) and storing it in the packet mbuf sched
field. After classification, each packet is sent to softnic port which prioritizes
the transmission of the received packets, and accordingly sends them on to
the output interface.

To enable traffic management mode, following testpmd command is used;

$ ./testpmd -c c -n 4 --vdev
	'net_softnic0,hard_name=0000:06:00.1,soft_tm=on' -- -i
	--forward-mode=tm

This patchset has dependency on following patch series;
http://www.dpdk.org/dev/patchwork/patch/27517/
http://www.dpdk.org/dev/patchwork/patch/27518/
http://www.dpdk.org/dev/patchwork/patch/27519/
http://www.dpdk.org/dev/patchwork/patch/27520/

Signed-off-by: Jasvinder Singh <redacted>
---
v2 change:
- change file name softnictm.c to tm.c
- change forward mode name to "tm"
- code clean up

 app/test-pmd/Makefile  |   5 +
 app/test-pmd/testpmd.c |  11 +
 app/test-pmd/testpmd.h |  34 ++
 app/test-pmd/tm.c      | 863
+++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 913 insertions(+)
 create mode 100644 app/test-pmd/tm.c
diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile index
c36be19..925787f 100644
--- a/app/test-pmd/Makefile
+++ b/app/test-pmd/Makefile
@@ -57,6 +57,7 @@ SRCS-y += rxonly.c
 SRCS-y += txonly.c
 SRCS-y += csumonly.c
 SRCS-y += icmpecho.c
+SRCS-y += tm.c
 SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c

 ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
@@ -81,6 +82,10 @@ ifeq ($(CONFIG_RTE_LIBRTE_PMD_XENVIRT),y)
 LDLIBS += -lrte_pmd_xenvirt
 endif

+ifeq ($(CONFIG_RTE_LIBRTE_PMD_SOFTNIC),y)
+LDLIBS += -lrte_pmd_softnic
+endif
+
 endif

 CFLAGS_cmdline.o := -D_GNU_SOURCE
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index
7d40139..996e982 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -167,6 +167,8 @@ struct fwd_engine * fwd_engines[] = {
 	&tx_only_engine,
 	&csum_fwd_engine,
 	&icmp_echo_engine,
+	&softnic_tm_engine,
+	&softnic_tm_bypass_engine,
 #ifdef RTE_LIBRTE_IEEE1588
 	&ieee1588_fwd_engine,
 #endif
If SCHED library is not set, I think these two modes should be disabled.
You can introduce the TM_MODE flag in testpmd.h, so you can use it everywhere.
quoted hunk ↗ jump to hunk
@@ -2044,6 +2046,15 @@ init_port_config(void)
 		    (rte_eth_devices[pid].data->dev_flags &
 		     RTE_ETH_DEV_INTR_RMV))
 			port->dev_conf.intr_conf.rmv = 1;
+
+		/* Detect softnic port */
+		if (!strcmp(port->dev_info.driver_name, "net_softnic")) {
+			memset(&port->softport, 0, sizeof(struct
softnic_port));
+				port->softport.enable = 1;
+
+			if (!strcmp(cur_fwd_eng->fwd_mode_name, "tm"))
+				port->softport.tm_flag = 1;
+		}
 	}
 }
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index
c9d7739..c8fa180 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -163,6 +163,37 @@ struct port_flow {
...
quoted hunk ↗ jump to hunk
 struct rte_port {
@@ -195,6 +226,7 @@ struct rte_port {
 	uint32_t                mc_addr_nb; /**< nb. of addr. in mc_addr_pool
*/
 	uint8_t                 slave_flag; /**< bonding slave port */
 	struct port_flow        *flow_list; /**< Associated flows. */
+	struct softnic_port     softport;  /**< softnic port params > */
Remove last ">".
 };

 /**
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help