Skip to contentSkip to conversation

ethdev: add rx offload to drop error packets

PATCH Superseded Nipun Gupta 10 participants 46 messages Aug 31, 2020 – Apr 20, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ethdev: add rx offload to drop error packets

This change adds a RX offload capability where hardware can drop the packets in case there is an error in the packet such as L3 checksum error or L4 checksum.

---
 lib/librte_ethdev/rte_ethdev.h | 1 +
 1 file changed, 1 insertion(+)
lib/librte_ethdev/rte_ethdev.h +1 -0
index a49242bcd..bb9df2fb9 100644
@@ -1120,6 +1120,7 @@ struct rte_eth_conf {
 #define DEV_RX_OFFLOAD_SCTP_CKSUM	0x00020000
 #define DEV_RX_OFFLOAD_OUTER_UDP_CKSUM  0x00040000
 #define DEV_RX_OFFLOAD_RSS_HASH		0x00080000
+#define DEV_RX_OFFLOAD_ERR_PKT_DROP	0x00100000
 
 #define DEV_RX_OFFLOAD_CHECKSUM (DEV_RX_OFFLOAD_IPV4_CKSUM | \
 				 DEV_RX_OFFLOAD_UDP_CKSUM | \
Signature · 1 line
2.17.1
#1 lore raw
Quoted 16 lines · Nipun Gupta

This change adds a RX offload capability where hardware can drop the packets in case there is an error in the packet such as L3 checksum error or L4 checksum.

---
 lib/librte_ethdev/rte_ethdev.h | 1 +
 1 file changed, 1 insertion(+)
lib/librte_ethdev/rte_ethdev.h +0 -0
index a49242bcd..bb9df2fb9 100644

lib/librte_ethdev/rte_ethdev.h struct rte_eth_conf { · line 1126

Quoted 7 lines
lib/librte_ethdev/rte_ethdev.h +1 -0
@@ -1120,6 +1120,7 @@ struct rte_eth_conf {
 #define DEV_RX_OFFLOAD_SCTP_CKSUM	0x00020000
 #define DEV_RX_OFFLOAD_OUTER_UDP_CKSUM  0x00040000
 #define DEV_RX_OFFLOAD_RSS_HASH		0x00080000
+#define DEV_RX_OFFLOAD_ERR_PKT_DROP	0x00100000
 
 #define DEV_RX_OFFLOAD_CHECKSUM (DEV_RX_OFFLOAD_IPV4_CKSUM | \
 				 DEV_RX_OFFLOAD_UDP_CKSUM | \

Hi Nipun,

You adding a new offload type for network devices, it should have some more description and relevant PMD/testpmd updates too.

But before that, is dropping faulty packets an offload or a config option for the NIC? Or is this common for all NICs to have in ethdev?

#2 lore raw

Hi Ferruh,

Quoted 36 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Monday, August 31, 2020 6:29 PM
To: Nipun Gupta <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; Hemant Agrawal <[email protected]>; Rohit Raj <[email protected]>
Subject: Re: [PATCH] ethdev: add rx offload to drop error packets

Quoted 16 lines · Nipun Gupta

This change adds a RX offload capability where hardware can drop the packets in case there is an error in the packet such as L3 checksum error or L4 checksum.

---
 lib/librte_ethdev/rte_ethdev.h | 1 +
 1 file changed, 1 insertion(+)
lib/librte_ethdev/rte_ethdev.h +0 -0
index a49242bcd..bb9df2fb9 100644

lib/librte_ethdev/rte_ethdev.h struct rte_eth_conf { · line 1126

Quoted 7 lines
lib/librte_ethdev/rte_ethdev.h +1 -0
@@ -1120,6 +1120,7 @@ struct rte_eth_conf {
 #define DEV_RX_OFFLOAD_SCTP_CKSUM	0x00020000
 #define DEV_RX_OFFLOAD_OUTER_UDP_CKSUM  0x00040000
 #define DEV_RX_OFFLOAD_RSS_HASH		0x00080000
+#define DEV_RX_OFFLOAD_ERR_PKT_DROP	0x00100000
 
 #define DEV_RX_OFFLOAD_CHECKSUM (DEV_RX_OFFLOAD_IPV4_CKSUM | \
 				 DEV_RX_OFFLOAD_UDP_CKSUM | \

Hi Nipun,

Quoted 2 lines

You adding a new offload type for network devices, it should have some more description and relevant PMD/testpmd updates too.

I should have added an RFC tag in the patch. I sent this for comment for error packet drop offload support. I will send patches after proper implementation.

Quoted 3 lines

But before that, is dropping faulty packets an offload or a config option for the NIC? Or is this common for all NICs to have in ethdev?

We would like to have it as an offload capability, and on the basis of this capability user can configure the Ethernet device to drop the error packets on the device itself without providing them to the core.
Sorry I did not get your comment "Or is this common for all NICs to have in ethdev?"

Thanks,
Nipun

#3 lore raw
In reply to Nipun Gupta
Quoted 15 lines · On Mon, 31 Aug 2020 13:23:33 +0530 Nipun Gupta <[email protected]> wrote:

This change adds a RX offload capability where hardware can drop the packets in case there is an error in the packet such as L3 checksum error or L4 checksum.

---
 lib/librte_ethdev/rte_ethdev.h | 1 +
 1 file changed, 1 insertion(+)
lib/librte_ethdev/rte_ethdev.h +0 -0
index a49242bcd..bb9df2fb9 100644

lib/librte_ethdev/rte_ethdev.h struct rte_eth_conf { · line 1126

Quoted 7 lines
lib/librte_ethdev/rte_ethdev.h +1 -0
@@ -1120,6 +1120,7 @@ struct rte_eth_conf {
 #define DEV_RX_OFFLOAD_SCTP_CKSUM	0x00020000
 #define DEV_RX_OFFLOAD_OUTER_UDP_CKSUM  0x00040000
 #define DEV_RX_OFFLOAD_RSS_HASH		0x00080000
+#define DEV_RX_OFFLOAD_ERR_PKT_DROP	0x00100000
 
 #define DEV_RX_OFFLOAD_CHECKSUM (DEV_RX_OFFLOAD_IPV4_CKSUM | \
 				 DEV_RX_OFFLOAD_UDP_CKSUM | \

Could/should this be an rte_flow action as well?

#4 lore raw

31/08/2020 19:00, Stephen Hemminger:

Quoted 11 lines
Quoted 8 lines · On Mon, 31 Aug 2020 13:23:33 +0530 Nipun Gupta <[email protected]> wrote:

This change adds a RX offload capability where hardware can drop the packets in case there is an error in the packet such as L3 checksum error or L4 checksum.

---
+#define DEV_RX_OFFLOAD_ERR_PKT_DROP 0x00100000

Please add RTE_ prefix, even if older macros don't have it. We could (in a separate effort) alias old ones with RTE_ prefixed names.

Quoted 1 line

Could/should this be an rte_flow action as well?

I feel rte_flow API is not appropriate here.
Ori, any opinion?

#5 lore raw
Quoted 20 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Tuesday, September 1, 2020 1:39 PM
To: Nipun Gupta <[email protected]>; Stephen Hemminger <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Hemant Agrawal <[email protected]>; Rohit Raj <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH] ethdev: add rx offload to drop error packets

31/08/2020 19:00, Stephen Hemminger:

Quoted 7 lines
Quoted 4 lines · On Mon, 31 Aug 2020 13:23:33 +0530 Nipun Gupta <[email protected]> wrote:

This change adds a RX offload capability where hardware can drop the packets in case there is an error in the packet such as L3 checksum error or L4 checksum.

Quoted 7 lines
Quoted 4 lines
Quoted 4 lines

---
+#define DEV_RX_OFFLOAD_ERR_PKT_DROP 0x00100000

Please add RTE_ prefix, even if older macros don't have it. We could (in a separate effort) alias old ones with RTE_ prefixed names.

Agree, will update and send the change along with testpmd and dpaa2 driver change.

Quoted 6 lines
Quoted 2 lines

Could/should this be an rte_flow action as well?

I feel rte_flow API is not appropriate here.
Ori, any opinion?

#6 lore raw
In reply to Thomas Monjalon

Hi

Quoted 16 lines

-----Original Message-----
Subject: Re: [dpdk-dev] [PATCH] ethdev: add rx offload to drop error packets

31/08/2020 19:00, Stephen Hemminger:

Quoted 11 lines
Quoted 8 lines · On Mon, 31 Aug 2020 13:23:33 +0530 Nipun Gupta <[email protected]> wrote:

This change adds a RX offload capability where hardware can drop the packets in case there is an error in the packet such as L3 checksum error or L4 checksum.

---
+#define DEV_RX_OFFLOAD_ERR_PKT_DROP 0x00100000

Quoted 8 lines

Please add RTE_ prefix, even if older macros don't have it. We could (in a separate effort) alias old ones with RTE_ prefixed names.

Quoted 1 line

Could/should this be an rte_flow action as well?

I feel rte_flow API is not appropriate here.
Ori, any opinion?

I also don't think this is relevant action in case of rte_flow, If we want to support such a thing in rte_flow we should add item that matches on error and then use the drop action.

Best,
Ori

#7 lore raw

PATCH v2 1/3 ethdev: add rx offload to drop error packets

In reply to Nipun Gupta

From: Nipun Gupta <[email protected]>

This change adds a RX offload capability, which once enabled, hardware will drop the packets in case there of any error in the packet such as L3 checksum error or L4 checksum.

---
These patches are based over series:
https://patchwork.dpdk.org/patch/78630/

Changes in v2:
- Add support in DPAA1 driver (patch 2/3)
- Add support and config parameter in testpmd (patch 3/3)

 lib/librte_ethdev/rte_ethdev.h | 1 +
 1 file changed, 1 insertion(+)
lib/librte_ethdev/rte_ethdev.h +1 -0
index 645a18664..314d06c74 100644
@@ -1260,6 +1260,7 @@ struct rte_eth_conf {
 #define DEV_RX_OFFLOAD_SCTP_CKSUM	0x00020000
 #define DEV_RX_OFFLOAD_OUTER_UDP_CKSUM  0x00040000
 #define DEV_RX_OFFLOAD_RSS_HASH		0x00080000
+#define DEV_RX_OFFLOAD_ERR_PKT_DROP	0x00100000
 
 #define DEV_RX_OFFLOAD_CHECKSUM (DEV_RX_OFFLOAD_IPV4_CKSUM | \
 				 DEV_RX_OFFLOAD_UDP_CKSUM | \
Signature · 1 line
2.17.1
#8 lore raw

PATCH v2 2/3 net/dpaa: support RX offload for error packet drop

From: Nipun Gupta <[email protected]>

This patch supports RX offload capability DEV_RX_OFFLOAD_ERR_PKT_DROP, to drop error packets in the hardware

---
 drivers/bus/dpaa/base/fman/fman_hw.c |  7 ++++++-
 drivers/net/dpaa/dpaa_ethdev.c       | 18 ++++++++++++++----
 2 files changed, 20 insertions(+), 5 deletions(-)
drivers/bus/dpaa/base/fman/fman_hw.c +6 -1
index 4ab49f785..40e4e0000 100644
@@ -597,7 +597,12 @@ void
 fman_if_discard_rx_errors(struct fman_if *fm_if)
 {
 	struct __fman_if *__if = container_of(fm_if, struct __fman_if, __if);
-	unsigned int *fmbm_rfsdm, *fmbm_rfsem;
+	unsigned int *fmbm_rcfg, *fmbm_rfsdm, *fmbm_rfsem;
+	unsigned int val;
+
+	fmbm_rcfg = &((struct rx_bmi_regs *)__if->bmi_map)->fmbm_rcfg;
+	val = in_be32(fmbm_rcfg);
+	out_be32(fmbm_rcfg, val & ~BMI_PORT_CFG_FDOVR);
 
 	fmbm_rfsem = &((struct rx_bmi_regs *)__if->bmi_map)->fmbm_rfsem;
 	out_be32(fmbm_rfsem, 0);
drivers/net/dpaa/dpaa_ethdev.c +14 -4
index 1f94fc9b9..39f673db5 100644
@@ -52,7 +52,8 @@
 /* Supported Rx offloads */
 static uint64_t dev_rx_offloads_sup =
 		DEV_RX_OFFLOAD_JUMBO_FRAME |
-		DEV_RX_OFFLOAD_SCATTER;
+		DEV_RX_OFFLOAD_SCATTER |
+		DEV_RX_OFFLOAD_ERR_PKT_DROP;
 
 /* Rx offloads which cannot be disabled */
 static uint64_t dev_rx_offloads_nodis =
@@ -262,6 +263,18 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
 		dev->data->scattered_rx = 1;
 	}
 
+	if (!(rx_offloads & DEV_RX_OFFLOAD_ERR_PKT_DROP)) {
+		struct dpaa_if *dpaa_intf = dev->data->dev_private;
+		struct qman_fq *rxq = &dpaa_intf->rx_queues[0];
+
+		DPAA_PMD_DEBUG("error packets will not be droppped on hw");
+		fman_if_receive_rx_errors(fif, FM_FD_RX_STATUS_ERR_MASK);
+		fman_if_set_err_fqid(fif, rxq->fqid);
+	} else {
+		DPAA_PMD_DEBUG("error packets will be droppped on hw");
+		fman_if_discard_rx_errors(fif);
+	}
+
 	if (!(default_q || fmc_q)) {
 		if (dpaa_fm_config(dev,
 			eth_conf->rx_adv_conf.rss_conf.rss_hf)) {
@@ -2031,9 +2044,6 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 		fman_intf->mac_addr.addr_bytes[5]);
 
 	if (!fman_intf->is_shared_mac) {
-		/* Configure error packet handling */
-		fman_if_receive_rx_errors(fman_intf,
-			FM_FD_RX_STATUS_ERR_MASK);
 		/* Disable RX mode */
 		fman_if_disable_rx(fman_intf);
 		/* Disable promiscuous mode */
Signature · 1 line
2.17.1
#9 lore raw

PATCH v2 3/3 testpmd: support hardware offload to drop error packets

In reply to [email protected]

From: Nipun Gupta <[email protected]>

With DEV_RX_OFFLOAD_ERR_PKT_DROP now defined as an offload capability, testpmd showcases this with a new added configuration option 'enable-hw-drop-err'.

---
 app/test-pmd/parameters.c | 5 +++++
 1 file changed, 5 insertions(+)
app/test-pmd/parameters.c +5 -0
index 1ead59579..ada870e2d 100644
@@ -142,6 +142,7 @@ usage(char* progname)
 	printf("  --enable-hw-vlan-strip: enable hardware vlan strip.\n");
 	printf("  --enable-hw-vlan-extend: enable hardware vlan extend.\n");
 	printf("  --enable-hw-qinq-strip: enable hardware qinq strip.\n");
+	printf("  --enable-hw-drop-err: enable hardware packet drop for error packets.\n");
 	printf("  --enable-drop-en: enable per queue packet drop.\n");
 	printf("  --disable-rss: disable rss.\n");
 	printf("  --port-topology=<paired|chained|loop>: set port topology (paired "
@@ -631,6 +632,7 @@ launch_args_parse(int argc, char** argv)
 		{ "enable-hw-vlan-strip",       0, 0, 0 },
 		{ "enable-hw-vlan-extend",      0, 0, 0 },
 		{ "enable-hw-qinq-strip",       0, 0, 0 },
+		{ "enable-hw-drop-err",         0, 0, 0 },
 		{ "enable-drop-en",            0, 0, 0 },
 		{ "disable-rss",                0, 0, 0 },
 		{ "port-topology",              1, 0, 0 },
@@ -1037,6 +1039,9 @@ launch_args_parse(int argc, char** argv)
 					"enable-hw-qinq-strip"))
 				rx_offloads |= DEV_RX_OFFLOAD_QINQ_STRIP;
 
+			if (!strcmp(lgopts[opt_idx].name, "enable-hw-drop-err"))
+				rx_offloads |= DEV_RX_OFFLOAD_ERR_PKT_DROP;
+
 			if (!strcmp(lgopts[opt_idx].name, "enable-drop-en"))
 				rx_drop_en = 1;
 
Signature · 1 line
2.17.1
#10 lore raw

Re: [dpdk-dev] [PATCH 3/3 v2] testpmd: support hardware offload to drop error packets

Quoted 57 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of [email protected]
Sent: Monday, October 5, 2020 10:15 AM
To: [email protected]
Cc: NBU-Contact-Thomas Monjalon <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Nipun Gupta <[email protected]>
Subject: [dpdk-dev] [PATCH 3/3 v2] testpmd: support hardware offload to drop error packets

From: Nipun Gupta <[email protected]>

With DEV_RX_OFFLOAD_ERR_PKT_DROP now defined as an offload capability, testpmd showcases this with a new added configuration option 'enable-hw-drop-err'.

---
app/test-pmd/parameters.c | 5 +++++

1 file changed, 5 insertions(+)
app/test-pmd/parameters.c index renamed from app/test-pmd/parameters.c +0 -0

1ead59579..ada870e2d 100644

app/test-pmd/parameters.c +2 -0
@@ -142,6 +142,7 @@ usage(char* progname)
 	printf("  --enable-hw-vlan-strip: enable hardware vlan strip.\n");
 	printf("  --enable-hw-vlan-extend: enable hardware vlan extend.\n");
 	printf("  --enable-hw-qinq-strip: enable hardware qinq strip.\n");
+	printf("  --enable-hw-drop-err: enable hardware packet drop for error
+packets.\n");
 	printf("  --enable-drop-en: enable per queue packet drop.\n");
 	printf("  --disable-rss: disable rss.\n");
	printf("  --port-topology=<paired|chained|loop>: set port topology

(paired "

app/test-pmd/parameters.c +4 -0
@@ -631,6 +632,7 @@ launch_args_parse(int argc, char** argv)
 		{ "enable-hw-vlan-strip",       0, 0, 0 },
 		{ "enable-hw-vlan-extend",      0, 0, 0 },
 		{ "enable-hw-qinq-strip",       0, 0, 0 },
+		{ "enable-hw-drop-err",         0, 0, 0 },
 		{ "enable-drop-en",            0, 0, 0 },
 		{ "disable-rss",                0, 0, 0 },
 		{ "port-topology",              1, 0, 0 },
@@ -1037,6 +1039,9 @@ launch_args_parse(int argc, char** argv)
 					"enable-hw-qinq-strip"))
 				rx_offloads |=
 DEV_RX_OFFLOAD_QINQ_STRIP;
 
+			if (!strcmp(lgopts[opt_idx].name, "enable-hw-drop-
 err"))
+				rx_offloads |=
 DEV_RX_OFFLOAD_ERR_PKT_DROP;
+
			if (!strcmp(lgopts[opt_idx].name, "enable-drop-en"))
				rx_drop_en = 1;
Quoted 2 lines

--
2.17.1

I think it would be good also to update testpmd run_app.rst with this new option.

#11 lore raw

Re: [dpdk-dev] [PATCH 3/3 v2] testpmd: support hardware offload to drop error packets

Quoted 70 lines

-----Original Message-----
From: Asaf Penso <[email protected]>
Sent: Thursday, October 8, 2020 8:36 PM
To: Nipun Gupta <[email protected]>; [email protected]
Cc: NBU-Contact-Thomas Monjalon <[email protected]>; [email protected]; [email protected]; Hemant Agrawal <[email protected]>; Sachin Saxena <[email protected]>; Rohit Raj <[email protected]>
Subject: RE: [dpdk-dev] [PATCH 3/3 v2] testpmd: support hardware offload to drop error packets

Quoted 57 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of [email protected]
Sent: Monday, October 5, 2020 10:15 AM
To: [email protected]
Cc: NBU-Contact-Thomas Monjalon <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Nipun Gupta <[email protected]>
Subject: [dpdk-dev] [PATCH 3/3 v2] testpmd: support hardware offload to drop error packets

From: Nipun Gupta <[email protected]>

With DEV_RX_OFFLOAD_ERR_PKT_DROP now defined as an offload capability, testpmd showcases this with a new added configuration option 'enable-hw-drop-err'.

---
app/test-pmd/parameters.c | 5 +++++

1 file changed, 5 insertions(+)
app/test-pmd/parameters.c index renamed from app/test-pmd/parameters.c +0 -0

1ead59579..ada870e2d 100644

app/test-pmd/parameters.c +2 -0
@@ -142,6 +142,7 @@ usage(char* progname)
 	printf("  --enable-hw-vlan-strip: enable hardware vlan strip.\n");
 	printf("  --enable-hw-vlan-extend: enable hardware vlan extend.\n");
 	printf("  --enable-hw-qinq-strip: enable hardware qinq strip.\n");
+	printf("  --enable-hw-drop-err: enable hardware packet drop for error
+packets.\n");
 	printf("  --enable-drop-en: enable per queue packet drop.\n");
 	printf("  --disable-rss: disable rss.\n");
	printf("  --port-topology=<paired|chained|loop>: set port topology

(paired "

app/test-pmd/parameters.c +4 -0
@@ -631,6 +632,7 @@ launch_args_parse(int argc, char** argv)
 		{ "enable-hw-vlan-strip",       0, 0, 0 },
 		{ "enable-hw-vlan-extend",      0, 0, 0 },
 		{ "enable-hw-qinq-strip",       0, 0, 0 },
+		{ "enable-hw-drop-err",         0, 0, 0 },
 		{ "enable-drop-en",            0, 0, 0 },
 		{ "disable-rss",                0, 0, 0 },
 		{ "port-topology",              1, 0, 0 },
@@ -1037,6 +1039,9 @@ launch_args_parse(int argc, char** argv)
 					"enable-hw-qinq-strip"))
 				rx_offloads |=
 DEV_RX_OFFLOAD_QINQ_STRIP;
 
+			if (!strcmp(lgopts[opt_idx].name, "enable-hw-drop-
 err"))
+				rx_offloads |=
 DEV_RX_OFFLOAD_ERR_PKT_DROP;
+
			if (!strcmp(lgopts[opt_idx].name, "enable-drop-en"))
				rx_drop_en = 1;
Quoted 4 lines
Quoted 2 lines

--
2.17.1

I think it would be good also to update testpmd run_app.rst with this new option.

Sure. Will update in next spin.

Thanks,
Nipun

#12 lore raw
In reply to [email protected]
Quoted 12 lines · On Mon, 5 Oct 2020 12:45:04 +0530 [email protected] wrote:

From: Nipun Gupta <[email protected]>

This change adds a RX offload capability, which once enabled, hardware will drop the packets in case there of any error in the packet such as L3 checksum error or L4 checksum.

---
These patches are based over series:
https://patchwork.dpdk.org/patch/78630/

Quoted 6 lines

Changes in v2:
- Add support in DPAA1 driver (patch 2/3)
- Add support and config parameter in testpmd (patch 3/3)

 lib/librte_ethdev/rte_ethdev.h | 1 +
 1 file changed, 1 insertion(+)

Maybe this should be an rte_flow match/action which would then make it more flexible?

There is not much of a performance gain for this in real life and if only one driver supports it then I am not convinced this is needed.

#13 lore raw
Quoted 9 lines · Stephen Hemminger
Quoted 5 lines · On Mon, 5 Oct 2020 12:45:04 +0530 [email protected] wrote:

From: Nipun Gupta <[email protected]>

This change adds a RX offload capability, which once enabled, hardware will drop the packets in case there of any error in the packet such as L3 checksum error or L4 checksum.

IMO, Providing additional support up to the level to choose the errors to drops give more control to the application. Meaning,
L1 errors such as FCS error
L2 errors ..
L3 errors such checksum
i.e ethdev spec need to have error level supported by PMD and the application can set the layers interested to drop.

Quoted 11 lines
Quoted 11 lines

---
These patches are based over series:
https://patchwork.dpdk.org/patch/78630/

Changes in v2:
- Add support in DPAA1 driver (patch 2/3)
- Add support and config parameter in testpmd (patch 3/3)

Quoted 5 lines
Quoted 2 lines
 lib/librte_ethdev/rte_ethdev.h | 1 +
 1 file changed, 1 insertion(+)

Maybe this should be an rte_flow match/action which would then make it more flexible?

I think, it is not based on any Patten matching. So IMO, it should be best if it is part of RX offload.

Quoted 3 lines

There is not much of a performance gain for this in real life and if only one driver supports it then I am not convinced this is needed.

Marvell HW has this feature.

#14 lore raw
Quoted 26 lines

-----Original Message-----
From: Jerin Jacob <[email protected]>
Sent: Monday, October 5, 2020 9:40 PM
To: Stephen Hemminger <[email protected]>
Cc: Nipun Gupta <[email protected]>; dpdk-dev <[email protected]>; Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Andrew Rybchenko <[email protected]>; Hemant Agrawal <[email protected]>; Sachin Saxena <[email protected]>; Rohit Raj <[email protected]>
Subject: Re: [dpdk-dev] [PATCH 1/3 v2] ethdev: add rx offload to drop error packets

Quoted 9 lines · Stephen Hemminger
Quoted 5 lines · On Mon, 5 Oct 2020 12:45:04 +0530 [email protected] wrote:

From: Nipun Gupta <[email protected]>

This change adds a RX offload capability, which once enabled, hardware will drop the packets in case there of any error in the packet such as L3 checksum error or L4 checksum.

Quoted 7 lines

IMO, Providing additional support up to the level to choose the errors to drops give more control to the application. Meaning,
L1 errors such as FCS error
L2 errors ..
L3 errors such checksum
i.e ethdev spec need to have error level supported by PMD and the application can set the layers interested to drop.

Agree, but 'DEV_RX_OFFLOAD_ERR_PKT_DROP' shall also be there to drop all the error packets? Maybe we can rename it to DEV_RX_OFFLOAD_ALL_ERR_PKT_DROP.

Currently we have not planned to add separate knobs for separate error in the driver, maybe we can define them separately, or we need have them in this series itself?

Quoted 31 lines
Quoted 7 lines
Quoted 7 lines

---
These patches are based over series:

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchwo
rk.dpdk.org%2Fpatch%2F78630%2F&amp;data=02%7C01%7Cnipun.gupta%40nx p.com%7C90b516fd465c48945e7008d869492b3e%7C686ea1d3bc2b4c6fa92cd9 9c5c301635%7C0%7C0%7C637375110263097933&amp;sdata=RBQswMBsfpM6 nyKur%2FaHvOMvNK7RU%2BRyhHt%2FXBsP1OM%3D&amp;reserved=0

Quoted 10 lines
Quoted 7 lines

Changes in v2:
- Add support in DPAA1 driver (patch 2/3)
- Add support and config parameter in testpmd (patch 3/3)

 lib/librte_ethdev/rte_ethdev.h | 1 +
 1 file changed, 1 insertion(+)

Maybe this should be an rte_flow match/action which would then make it more flexible?

I think, it is not based on any Patten matching. So IMO, it should be best if it is part of RX offload.

Quoted 3 lines

There is not much of a performance gain for this in real life and if only one driver supports it then I am not convinced this is needed.

Marvell HW has this feature.

#15 lore raw
Quoted 35 lines · Nipun Gupta
Quoted 27 lines

-----Original Message-----
From: Jerin Jacob <[email protected]>
Sent: Monday, October 5, 2020 9:40 PM
To: Stephen Hemminger <[email protected]>
Cc: Nipun Gupta <[email protected]>; dpdk-dev <[email protected]>; Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Andrew Rybchenko <[email protected]>; Hemant Agrawal <[email protected]>; Sachin Saxena <[email protected]>; Rohit Raj <[email protected]>
Subject: Re: [dpdk-dev] [PATCH 1/3 v2] ethdev: add rx offload to drop error packets

Quoted 9 lines · Stephen Hemminger
Quoted 5 lines · On Mon, 5 Oct 2020 12:45:04 +0530 [email protected] wrote:

From: Nipun Gupta <[email protected]>

This change adds a RX offload capability, which once enabled, hardware will drop the packets in case there of any error in the packet such as L3 checksum error or L4 checksum.

Quoted 7 lines

IMO, Providing additional support up to the level to choose the errors to drops give more control to the application. Meaning,
L1 errors such as FCS error
L2 errors ..
L3 errors such checksum
i.e ethdev spec need to have error level supported by PMD and the application can set the layers interested to drop.

Quoted 2 lines

Agree, but 'DEV_RX_OFFLOAD_ERR_PKT_DROP' shall also be there to drop all the error packets? Maybe we can rename it to DEV_RX_OFFLOAD_ALL_ERR_PKT_DROP.

IMHO, we introduce such shortcut for a single flag for all err drop then we can not change the scheme
without an API/ABI break.

Quoted 4 lines

Currently we have not planned to add separate knobs for separate error in the driver, maybe we can define them separately, or we need have them in this series itself?

I think, ethdev API can have the capability on what are levels it supported, in your
driver case, you can express the same.

Quoted 32 lines
Quoted 32 lines
Quoted 8 lines
Quoted 8 lines

---
These patches are based over series:

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchwo
rk.dpdk.org%2Fpatch%2F78630%2F&amp;data=02%7C01%7Cnipun.gupta%40nx p.com%7C90b516fd465c48945e7008d869492b3e%7C686ea1d3bc2b4c6fa92cd9 9c5c301635%7C0%7C0%7C637375110263097933&amp;sdata=RBQswMBsfpM6 nyKur%2FaHvOMvNK7RU%2BRyhHt%2FXBsP1OM%3D&amp;reserved=0

Quoted 10 lines
Quoted 7 lines

Changes in v2:
- Add support in DPAA1 driver (patch 2/3)
- Add support and config parameter in testpmd (patch 3/3)

 lib/librte_ethdev/rte_ethdev.h | 1 +
 1 file changed, 1 insertion(+)

Maybe this should be an rte_flow match/action which would then make it more flexible?

I think, it is not based on any Patten matching. So IMO, it should be best if it is part of RX offload.

Quoted 3 lines

There is not much of a performance gain for this in real life and if only one driver supports it then I am not convinced this is needed.

Marvell HW has this feature.

#16 lore raw
Quoted 52 lines

-----Original Message-----
From: Jerin Jacob <[email protected]>
Sent: Tuesday, October 6, 2020 5:31 PM
To: Nipun Gupta <[email protected]>
Cc: Stephen Hemminger <[email protected]>; dpdk-dev <[email protected]>; Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Andrew Rybchenko <[email protected]>; Hemant Agrawal <[email protected]>; Sachin Saxena <[email protected]>; Rohit Raj <[email protected]>
Subject: Re: [dpdk-dev] [PATCH 1/3 v2] ethdev: add rx offload to drop error packets

Quoted 8 lines · Nipun Gupta
Quoted 8 lines

-----Original Message-----
From: Jerin Jacob <[email protected]>
Sent: Monday, October 5, 2020 9:40 PM
To: Stephen Hemminger <[email protected]>
Cc: Nipun Gupta <[email protected]>; dpdk-dev <[email protected]>;

Thomas

Quoted 3 lines
Quoted 3 lines

Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Andrew Rybchenko <[email protected]>; Hemant Agrawal <[email protected]>; Sachin Saxena <[email protected]>;

Rohit

Quoted 24 lines
Quoted 23 lines

Raj <[email protected]>
Subject: Re: [dpdk-dev] [PATCH 1/3 v2] ethdev: add rx offload to drop error packets

Quoted 9 lines · Stephen Hemminger
Quoted 5 lines · On Mon, 5 Oct 2020 12:45:04 +0530 [email protected] wrote:

From: Nipun Gupta <[email protected]>

This change adds a RX offload capability, which once enabled, hardware will drop the packets in case there of any error in the packet such as L3 checksum error or L4 checksum.

IMO, Providing additional support up to the level to choose the errors to drops give more control to the application. Meaning,
L1 errors such as FCS error
L2 errors ..
L3 errors such checksum
i.e ethdev spec need to have error level supported by PMD and the application can set the layers interested to drop.

Quoted 8 lines
Quoted 1 line

Agree, but 'DEV_RX_OFFLOAD_ERR_PKT_DROP' shall also be there to drop all

the

Quoted 1 line

error packets? Maybe we can rename it to

DEV_RX_OFFLOAD_ALL_ERR_PKT_DROP.

IMHO, we introduce such shortcut for a single flag for all err drop then we can not change the scheme
without an API/ABI break.

Are the following offloads fine:
DEV_RX_OFFLOAD_L1_FCS_ERR_PKT_DROP
DEV_RX_OFFLOAD_L3_CSUM_ERR_PKT_DROP
DEV_RX_OFFLOAD_L4_CSUM_ERR_PKT_DROP
DEV_RX_OFFLOAD_ALL_ERR_PKT_DROP

Please let me know in case I need to add any other too. Ill send a v3.

Thanks,
Nipun

Quoted 47 lines
Quoted 5 lines

Currently we have not planned to add separate knobs for separate error in the driver, maybe we can define them separately, or we need have them in this series itself?

I think, ethdev API can have the capability on what are levels it supported, in your
driver case, you can express the same.

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines

---
These patches are based over series:

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchwo

Quoted 1 line
Quoted 1 line

rk.dpdk.org%2Fpatch%2F78630%2F&amp;data=02%7C01%7Cnipun.gupta%40nx

Quoted 1 line
Quoted 1 line

p.com%7C90b516fd465c48945e7008d869492b3e%7C686ea1d3bc2b4c6fa92cd9

Quoted 1 line
Quoted 1 line

9c5c301635%7C0%7C0%7C637375110263097933&amp;sdata=RBQswMBsfpM6

Quoted 20 lines
Quoted 20 lines

nyKur%2FaHvOMvNK7RU%2BRyhHt%2FXBsP1OM%3D&amp;reserved=0

Quoted 10 lines
Quoted 7 lines

Changes in v2:
- Add support in DPAA1 driver (patch 2/3)
- Add support and config parameter in testpmd (patch 3/3)

 lib/librte_ethdev/rte_ethdev.h | 1 +
 1 file changed, 1 insertion(+)

Maybe this should be an rte_flow match/action which would then make it more flexible?

I think, it is not based on any Patten matching. So IMO, it should be best if it is part of RX offload.

Quoted 3 lines

There is not much of a performance gain for this in real life and if only one driver supports it then I am not convinced this is needed.

Marvell HW has this feature.

#17 lore raw
Quoted 62 lines · Nipun Gupta
Quoted 53 lines

-----Original Message-----
From: Jerin Jacob <[email protected]>
Sent: Tuesday, October 6, 2020 5:31 PM
To: Nipun Gupta <[email protected]>
Cc: Stephen Hemminger <[email protected]>; dpdk-dev <[email protected]>; Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Andrew Rybchenko <[email protected]>; Hemant Agrawal <[email protected]>; Sachin Saxena <[email protected]>; Rohit Raj <[email protected]>
Subject: Re: [dpdk-dev] [PATCH 1/3 v2] ethdev: add rx offload to drop error packets

Quoted 8 lines · Nipun Gupta
Quoted 8 lines

-----Original Message-----
From: Jerin Jacob <[email protected]>
Sent: Monday, October 5, 2020 9:40 PM
To: Stephen Hemminger <[email protected]>
Cc: Nipun Gupta <[email protected]>; dpdk-dev <[email protected]>;

Thomas

Quoted 3 lines
Quoted 3 lines

Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Andrew Rybchenko <[email protected]>; Hemant Agrawal <[email protected]>; Sachin Saxena <[email protected]>;

Rohit

Quoted 24 lines
Quoted 23 lines

Raj <[email protected]>
Subject: Re: [dpdk-dev] [PATCH 1/3 v2] ethdev: add rx offload to drop error packets

Quoted 9 lines · Stephen Hemminger
Quoted 5 lines · On Mon, 5 Oct 2020 12:45:04 +0530 [email protected] wrote:

From: Nipun Gupta <[email protected]>

This change adds a RX offload capability, which once enabled, hardware will drop the packets in case there of any error in the packet such as L3 checksum error or L4 checksum.

IMO, Providing additional support up to the level to choose the errors to drops give more control to the application. Meaning,
L1 errors such as FCS error
L2 errors ..
L3 errors such checksum
i.e ethdev spec need to have error level supported by PMD and the application can set the layers interested to drop.

Quoted 8 lines
Quoted 1 line

Agree, but 'DEV_RX_OFFLOAD_ERR_PKT_DROP' shall also be there to drop all

the

Quoted 1 line

error packets? Maybe we can rename it to

DEV_RX_OFFLOAD_ALL_ERR_PKT_DROP.

IMHO, we introduce such shortcut for a single flag for all err drop then we can not change the scheme
without an API/ABI break.

Quoted 7 lines

Are the following offloads fine:
DEV_RX_OFFLOAD_L1_FCS_ERR_PKT_DROP
DEV_RX_OFFLOAD_L3_CSUM_ERR_PKT_DROP
DEV_RX_OFFLOAD_L4_CSUM_ERR_PKT_DROP
DEV_RX_OFFLOAD_ALL_ERR_PKT_DROP

Please let me know in case I need to add any other too.

I think, single offload flags and some config/capability structure to define the additional
layer selection would be good, instead of adding a lot of new offload flags.

Quoted 52 lines

Ill send a v3.

Thanks,
Nipun

Quoted 47 lines
Quoted 5 lines

Currently we have not planned to add separate knobs for separate error in the driver, maybe we can define them separately, or we need have them in this series itself?

I think, ethdev API can have the capability on what are levels it supported, in your
driver case, you can express the same.

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines

---
These patches are based over series:

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchwo

Quoted 1 line
Quoted 1 line

rk.dpdk.org%2Fpatch%2F78630%2F&amp;data=02%7C01%7Cnipun.gupta%40nx

Quoted 1 line
Quoted 1 line

p.com%7C90b516fd465c48945e7008d869492b3e%7C686ea1d3bc2b4c6fa92cd9

Quoted 1 line
Quoted 1 line

9c5c301635%7C0%7C0%7C637375110263097933&amp;sdata=RBQswMBsfpM6

Quoted 20 lines
Quoted 20 lines

nyKur%2FaHvOMvNK7RU%2BRyhHt%2FXBsP1OM%3D&amp;reserved=0

Quoted 10 lines
Quoted 7 lines

Changes in v2:
- Add support in DPAA1 driver (patch 2/3)
- Add support and config parameter in testpmd (patch 3/3)

 lib/librte_ethdev/rte_ethdev.h | 1 +
 1 file changed, 1 insertion(+)

Maybe this should be an rte_flow match/action which would then make it more flexible?

I think, it is not based on any Patten matching. So IMO, it should be best if it is part of RX offload.

Quoted 3 lines

There is not much of a performance gain for this in real life and if only one driver supports it then I am not convinced this is needed.

Marvell HW has this feature.

#18 lore raw
Quoted 87 lines

-----Original Message-----
From: Jerin Jacob <[email protected]>
Sent: Tuesday, October 6, 2020 6:44 PM
To: Nipun Gupta <[email protected]>
Cc: Stephen Hemminger <[email protected]>; dpdk-dev <[email protected]>; Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Andrew Rybchenko <[email protected]>; Hemant Agrawal <[email protected]>; Sachin Saxena <[email protected]>; Rohit Raj <[email protected]>
Subject: Re: [dpdk-dev] [PATCH 1/3 v2] ethdev: add rx offload to drop error packets

Quoted 10 lines · Nipun Gupta
Quoted 10 lines

-----Original Message-----
From: Jerin Jacob <[email protected]>
Sent: Tuesday, October 6, 2020 5:31 PM
To: Nipun Gupta <[email protected]>
Cc: Stephen Hemminger <[email protected]>; dpdk-dev <[email protected]>; Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Andrew Rybchenko

<[email protected]>;

Quoted 9 lines
Quoted 9 lines

Hemant Agrawal <[email protected]>; Sachin Saxena <[email protected]>; Rohit Raj <[email protected]>
Subject: Re: [dpdk-dev] [PATCH 1/3 v2] ethdev: add rx offload to drop error packets

Quoted 3 lines · Nipun Gupta
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines

-----Original Message-----
From: Jerin Jacob <[email protected]>
Sent: Monday, October 5, 2020 9:40 PM
To: Stephen Hemminger <[email protected]>
Cc: Nipun Gupta <[email protected]>; dpdk-dev <[email protected]>;

Thomas

Quoted 1 line
Quoted 1 line

Monjalon <[email protected]>; Ferruh Yigit

<[email protected]>;

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines

Andrew Rybchenko <[email protected]>; Hemant Agrawal <[email protected]>; Sachin Saxena <[email protected]>;

Rohit

Quoted 2 lines
Quoted 2 lines

Raj <[email protected]>
Subject: Re: [dpdk-dev] [PATCH 1/3 v2] ethdev: add rx offload to drop

error

Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 21 lines

packets

Quoted 9 lines · Stephen Hemminger
Quoted 5 lines · On Mon, 5 Oct 2020 12:45:04 +0530 [email protected] wrote:

From: Nipun Gupta <[email protected]>

This change adds a RX offload capability, which once enabled, hardware will drop the packets in case there of any error in the packet such as L3 checksum error or L4 checksum.

IMO, Providing additional support up to the level to choose the errors to drops give more control to the application. Meaning,
L1 errors such as FCS error
L2 errors ..
L3 errors such checksum
i.e ethdev spec need to have error level supported by PMD and the application can set the layers interested to drop.

Quoted 1 line
Quoted 1 line
Quoted 1 line

Agree, but 'DEV_RX_OFFLOAD_ERR_PKT_DROP' shall also be there to drop

all

Quoted 14 lines
Quoted 7 lines

the

Quoted 1 line

error packets? Maybe we can rename it to

DEV_RX_OFFLOAD_ALL_ERR_PKT_DROP.

IMHO, we introduce such shortcut for a single flag for all err drop then we can not change the scheme
without an API/ABI break.

Are the following offloads fine:
DEV_RX_OFFLOAD_L1_FCS_ERR_PKT_DROP
DEV_RX_OFFLOAD_L3_CSUM_ERR_PKT_DROP
DEV_RX_OFFLOAD_L4_CSUM_ERR_PKT_DROP
DEV_RX_OFFLOAD_ALL_ERR_PKT_DROP

Quoted 5 lines
Quoted 1 line

Please let me know in case I need to add any other too.

I think, single offload flags and some config/capability structure to define the additional
layer selection would be good, instead of adding a lot of new offload flags.

+/**
+ * A structure used to enable/disable error packet drop on Rx.
+ */
+struct rte_rx_err_pkt_drop_conf {
+ /** enable/disable all RX error packet drop.
+ * 0 (default) - disable, 1 enable
+ */
+ uint32_t all:1;
+};
+
/**
* A structure used to configure an Ethernet port.
* Depending upon the RX multi-queue mode, extra advanced
@@ -1236,6 +1246,8 @@ struct rte_eth_conf {
uint32_t dcb_capability_en;
struct rte_fdir_conf fdir_conf; /**< FDIR configuration. DEPRECATED */ struct rte_intr_conf intr_conf; /**< Interrupt mode configuration. */
+ struct rte_rx_err_pkt_drop_conf err_pkt_drop_conf;
+ /**< RX error packet drop configuration. */

Is this the kind of changes you are talking about?

Also, more changes will be there in 'struct rte_eth_dev_info' structure, defining additional separate capability something like 'uint64_t rx_err_drop_offload_capa'.

Regards,
Nipun

Quoted 60 lines
Quoted 28 lines

Ill send a v3.

Thanks,
Nipun

Quoted 21 lines
Quoted 5 lines

Currently we have not planned to add separate knobs for separate error in the driver, maybe we can define them separately, or we need have them in this series itself?

I think, ethdev API can have the capability on what are levels it supported, in your
driver case, you can express the same.

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines

---
These patches are based over series:

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchwo

Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line

rk.dpdk.org%2Fpatch%2F78630%2F&amp;data=02%7C01%7Cnipun.gupta%40nx

Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line

p.com%7C90b516fd465c48945e7008d869492b3e%7C686ea1d3bc2b4c6fa92cd9

Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line

9c5c301635%7C0%7C0%7C637375110263097933&amp;sdata=RBQswMBsfpM6

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

nyKur%2FaHvOMvNK7RU%2BRyhHt%2FXBsP1OM%3D&amp;reserved=0

Quoted 9 lines
Quoted 7 lines

Changes in v2:
- Add support in DPAA1 driver (patch 2/3)
- Add support and config parameter in testpmd (patch 3/3)

 lib/librte_ethdev/rte_ethdev.h | 1 +
 1 file changed, 1 insertion(+)

Maybe this should be an rte_flow match/action which would then make

it

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

more flexible?

I think, it is not based on any Patten matching. So IMO, it should be best

if it

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

is part of RX offload.

Quoted 3 lines

There is not much of a performance gain for this in real life and if only one driver supports it then I am not convinced this is needed.

Marvell HW has this feature.

#19 lore raw
Quoted 115 lines · Nipun Gupta
Quoted 93 lines

-----Original Message-----
From: Jerin Jacob <[email protected]>
Sent: Tuesday, October 6, 2020 6:44 PM
To: Nipun Gupta <[email protected]>
Cc: Stephen Hemminger <[email protected]>; dpdk-dev <[email protected]>; Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Andrew Rybchenko <[email protected]>; Hemant Agrawal <[email protected]>; Sachin Saxena <[email protected]>; Rohit Raj <[email protected]>
Subject: Re: [dpdk-dev] [PATCH 1/3 v2] ethdev: add rx offload to drop error packets

Quoted 10 lines · Nipun Gupta
Quoted 10 lines

-----Original Message-----
From: Jerin Jacob <[email protected]>
Sent: Tuesday, October 6, 2020 5:31 PM
To: Nipun Gupta <[email protected]>
Cc: Stephen Hemminger <[email protected]>; dpdk-dev <[email protected]>; Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Andrew Rybchenko

<[email protected]>;

Quoted 9 lines
Quoted 9 lines

Hemant Agrawal <[email protected]>; Sachin Saxena <[email protected]>; Rohit Raj <[email protected]>
Subject: Re: [dpdk-dev] [PATCH 1/3 v2] ethdev: add rx offload to drop error packets

Quoted 3 lines · Nipun Gupta
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines

-----Original Message-----
From: Jerin Jacob <[email protected]>
Sent: Monday, October 5, 2020 9:40 PM
To: Stephen Hemminger <[email protected]>
Cc: Nipun Gupta <[email protected]>; dpdk-dev <[email protected]>;

Thomas

Quoted 1 line
Quoted 1 line

Monjalon <[email protected]>; Ferruh Yigit

<[email protected]>;

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines

Andrew Rybchenko <[email protected]>; Hemant Agrawal <[email protected]>; Sachin Saxena <[email protected]>;

Rohit

Quoted 2 lines
Quoted 2 lines

Raj <[email protected]>
Subject: Re: [dpdk-dev] [PATCH 1/3 v2] ethdev: add rx offload to drop

error

Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 21 lines

packets

Quoted 9 lines · Stephen Hemminger
Quoted 5 lines · On Mon, 5 Oct 2020 12:45:04 +0530 [email protected] wrote:

From: Nipun Gupta <[email protected]>

This change adds a RX offload capability, which once enabled, hardware will drop the packets in case there of any error in the packet such as L3 checksum error or L4 checksum.

IMO, Providing additional support up to the level to choose the errors to drops give more control to the application. Meaning,
L1 errors such as FCS error
L2 errors ..
L3 errors such checksum
i.e ethdev spec need to have error level supported by PMD and the application can set the layers interested to drop.

Quoted 1 line
Quoted 1 line
Quoted 1 line

Agree, but 'DEV_RX_OFFLOAD_ERR_PKT_DROP' shall also be there to drop

all

Quoted 8 lines
Quoted 7 lines

the

Quoted 1 line

error packets? Maybe we can rename it to

DEV_RX_OFFLOAD_ALL_ERR_PKT_DROP.

IMHO, we introduce such shortcut for a single flag for all err drop then we can not change the scheme
without an API/ABI break.

Quoted 7 lines

Are the following offloads fine:
DEV_RX_OFFLOAD_L1_FCS_ERR_PKT_DROP
DEV_RX_OFFLOAD_L3_CSUM_ERR_PKT_DROP
DEV_RX_OFFLOAD_L4_CSUM_ERR_PKT_DROP
DEV_RX_OFFLOAD_ALL_ERR_PKT_DROP

Please let me know in case I need to add any other too.

I think, single offload flags and some config/capability structure to define the additional
layer selection would be good, instead of adding a lot of new offload flags.

(quoted diff) +12 -0
+/**
+ * A structure used to enable/disable error packet drop on Rx.
+ */
+struct rte_rx_err_pkt_drop_conf {
+       /** enable/disable all RX error packet drop.
+        * 0 (default) - disable, 1 enable
+        */
+       uint32_t all:1;
+};
+
 /**
  * A structure used to configure an Ethernet port.
  * Depending upon the RX multi-queue mode, extra advanced
@@ -1236,6 +1246,8 @@ struct rte_eth_conf {
        uint32_t dcb_capability_en;
        struct rte_fdir_conf fdir_conf; /**< FDIR configuration. DEPRECATED */
        struct rte_intr_conf intr_conf; /**< Interrupt mode configuration. */
+       struct rte_rx_err_pkt_drop_conf err_pkt_drop_conf;
+       /**< RX error packet drop configuration. */
 
Quoted 1 line

Is this the kind of changes you are talking about?

Yes.

Quoted 67 lines

Also, more changes will be there in 'struct rte_eth_dev_info' structure, defining additional separate capability something like 'uint64_t rx_err_drop_offload_capa'.

Regards,
Nipun

Quoted 60 lines
Quoted 28 lines

Ill send a v3.

Thanks,
Nipun

Quoted 21 lines
Quoted 5 lines

Currently we have not planned to add separate knobs for separate error in the driver, maybe we can define them separately, or we need have them in this series itself?

I think, ethdev API can have the capability on what are levels it supported, in your
driver case, you can express the same.

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines

---
These patches are based over series:

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchwo

Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line

rk.dpdk.org%2Fpatch%2F78630%2F&amp;data=02%7C01%7Cnipun.gupta%40nx

Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line

p.com%7C90b516fd465c48945e7008d869492b3e%7C686ea1d3bc2b4c6fa92cd9

Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line

9c5c301635%7C0%7C0%7C637375110263097933&amp;sdata=RBQswMBsfpM6

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

nyKur%2FaHvOMvNK7RU%2BRyhHt%2FXBsP1OM%3D&amp;reserved=0

Quoted 9 lines
Quoted 7 lines

Changes in v2:
- Add support in DPAA1 driver (patch 2/3)
- Add support and config parameter in testpmd (patch 3/3)

 lib/librte_ethdev/rte_ethdev.h | 1 +
 1 file changed, 1 insertion(+)

Maybe this should be an rte_flow match/action which would then make

it

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

more flexible?

I think, it is not based on any Patten matching. So IMO, it should be best

if it

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

is part of RX offload.

Quoted 3 lines

There is not much of a performance gain for this in real life and if only one driver supports it then I am not convinced this is needed.

Marvell HW has this feature.

Reviewed-by
#20 lore raw
Quoted 214 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Jerin Jacob
Sent: Thursday, October 8, 2020 11:56 AM
To: Nipun Gupta <[email protected]>
Cc: Stephen Hemminger <[email protected]>; dpdk-dev <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Andrew Rybchenko <[email protected]>; Hemant Agrawal <[email protected]>; Sachin Saxena <[email protected]>; Rohit Raj <[email protected]>
Subject: Re: [dpdk-dev] [PATCH 1/3 v2] ethdev: add rx offload to drop error packets

Quoted 9 lines · Nipun Gupta
Quoted 9 lines

-----Original Message-----
From: Jerin Jacob <[email protected]>
Sent: Tuesday, October 6, 2020 6:44 PM
To: Nipun Gupta <[email protected]>
Cc: Stephen Hemminger <[email protected]>; dpdk-dev <[email protected]>; Thomas Monjalon <[email protected]>; Ferruh

Yigit

Quoted 8 lines
Quoted 8 lines

<[email protected]>; Andrew Rybchenko <[email protected]>; Hemant Agrawal <[email protected]>; Sachin Saxena <[email protected]>; Rohit Raj <[email protected]>
Subject: Re: [dpdk-dev] [PATCH 1/3 v2] ethdev: add rx offload to drop error packets

On Tue, Oct 6, 2020 at 6:40 PM Nipun Gupta <[email protected]>

Quoted 9 lines · wrote:
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

-----Original Message-----
From: Jerin Jacob <[email protected]>
Sent: Tuesday, October 6, 2020 5:31 PM
To: Nipun Gupta <[email protected]>
Cc: Stephen Hemminger <[email protected]>; dpdk-dev <[email protected]>; Thomas Monjalon <[email protected]>;

Ferruh

Quoted 8 lines
Quoted 8 lines
Quoted 1 line
Quoted 1 line

Yigit <[email protected]>; Andrew Rybchenko

<[email protected]>;

Quoted 6 lines
Quoted 6 lines

Hemant Agrawal <[email protected]>; Sachin Saxena <[email protected]>; Rohit Raj <[email protected]>
Subject: Re: [dpdk-dev] [PATCH 1/3 v2] ethdev: add rx offload to drop error packets

On Tue, Oct 6, 2020 at 4:07 PM Nipun Gupta <[email protected]>

Quoted 9 lines · wrote:
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

-----Original Message-----
From: Jerin Jacob <[email protected]>
Sent: Monday, October 5, 2020 9:40 PM
To: Stephen Hemminger <[email protected]>
Cc: Nipun Gupta <[email protected]>; dpdk-dev <[email protected]>;

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines

Thomas

Quoted 1 line
Quoted 1 line

Monjalon <[email protected]>; Ferruh Yigit

<[email protected]>;

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Andrew Rybchenko <[email protected]>; Hemant

Agrawal

Quoted 12 lines
Quoted 12 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

<[email protected]>; Sachin Saxena
<[email protected]>;

Rohit

Quoted 3 lines
Quoted 3 lines

Raj <[email protected]>
Subject: Re: [dpdk-dev] [PATCH 1/3 v2] ethdev: add rx offload to drop

error

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

packets

Quoted 1 line · Stephen Hemminger
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines · On Mon, 5 Oct 2020 12:45:04 +0530 [email protected] wrote:

From: Nipun Gupta <[email protected]>

This change adds a RX offload capability, which once enabled, hardware will drop the packets in case there of any error in the packet such as L3 checksum error or L4

checksum.

Quoted 54 lines
Quoted 31 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines

IMO, Providing additional support up to the level to choose the errors to drops give more control to the application. Meaning,
L1 errors such as FCS error
L2 errors ..
L3 errors such checksum
i.e ethdev spec need to have error level supported by PMD and the application can set the layers interested to drop.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Agree, but 'DEV_RX_OFFLOAD_ERR_PKT_DROP' shall also be there to drop

all

Quoted 7 lines
Quoted 6 lines

the

Quoted 1 line

error packets? Maybe we can rename it to

DEV_RX_OFFLOAD_ALL_ERR_PKT_DROP.

IMHO, we introduce such shortcut for a single flag for all err drop then we can not change the scheme without an API/ABI break.

Quoted 7 lines

Are the following offloads fine:
DEV_RX_OFFLOAD_L1_FCS_ERR_PKT_DROP
DEV_RX_OFFLOAD_L3_CSUM_ERR_PKT_DROP
DEV_RX_OFFLOAD_L4_CSUM_ERR_PKT_DROP
DEV_RX_OFFLOAD_ALL_ERR_PKT_DROP

Please let me know in case I need to add any other too.

I think, single offload flags and some config/capability structure to define the additional layer selection would be good, instead of adding a lot of new offload flags.

(quoted diff) +11 -0
+/**
+ * A structure used to enable/disable error packet drop on Rx.
+ */
+struct rte_rx_err_pkt_drop_conf {
+       /** enable/disable all RX error packet drop.
+        * 0 (default) - disable, 1 enable
+        */
+       uint32_t all:1;
+};
+
 /**
  * A structure used to configure an Ethernet port.
  * Depending upon the RX multi-queue mode, extra advanced @@ -1236,6
+1246,8 @@ struct rte_eth_conf {
        uint32_t dcb_capability_en;
        struct rte_fdir_conf fdir_conf; /**< FDIR configuration. DEPRECATED */
        struct rte_intr_conf intr_conf; /**< Interrupt mode

configuration. */

(quoted diff) +2 -0
+       struct rte_rx_err_pkt_drop_conf err_pkt_drop_conf;
+       /**< RX error packet drop configuration. */
Quoted 1 line

Is this the kind of changes you are talking about?

Yes.

Quoted 3 lines

Also, more changes will be there in 'struct rte_eth_dev_info' structure, defining additional separate capability something like 'uint64_t

rx_err_drop_offload_capa'.

Quoted 36 lines

Regards,
Nipun

Quoted 32 lines
Quoted 27 lines

Ill send a v3.

Thanks,
Nipun

Quoted 20 lines
Quoted 5 lines

Currently we have not planned to add separate knobs for separate error in the driver, maybe we can define them separately, or we need have them in this series itself?

I think, ethdev API can have the capability on what are levels it supported, in your driver case, you can express the same.

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines

---
These patches are based over series:

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpa
tchwo

Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line

rk.dpdk.org%2Fpatch%2F78630%2F&amp;data=02%7C01%7Cnipun.gupta%40 nx

Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line

p.com%7C90b516fd465c48945e7008d869492b3e%7C686ea1d3bc2b4c6fa92cd9

Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line

9c5c301635%7C0%7C0%7C637375110263097933&amp;sdata=RBQswMBsfpM6

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

nyKur%2FaHvOMvNK7RU%2BRyhHt%2FXBsP1OM%3D&amp;reserved=0

Quoted 16 lines
Quoted 16 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 8 lines

Changes in v2:
- Add support in DPAA1 driver (patch 2/3)
- Add support and config parameter in testpmd (patch
3/3)

 lib/librte_ethdev/rte_ethdev.h | 1 +
 1 file changed, 1 insertion(+)

Maybe this should be an rte_flow match/action which would then make

it

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line

more flexible?

I think, it is not based on any Patten matching. So IMO, it should be best

Quoted 9 lines
Quoted 6 lines
Quoted 6 lines

if it

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

is part of RX offload.

Quoted 3 lines

There is not much of a performance gain for this in real life and if only one driver supports it then I am not convinced this

is needed.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Marvell HW has this feature.

#21 lore raw

PATCH v3 1/3 ethdev: add rx offload to drop error packets

In reply to Nipun Gupta

From: Nipun Gupta <[email protected]>

This change adds a RX offload capability and configuration to enable hardware to drop the packets in case of any error in the packets such as L3 checksum error or L4 checksum.

---

v3:
- Add additional rx_err_drop_offload_capa, which is specific capability flag for RX packets error drop offload. Currently only 'all' error packet drops are enabled, but can be extended to provide capability to drop any specific errors like L1 FCS, L3 Checksum etc.
- Added separate config structure to enable the drop configuration.
- Updated doc with the new updated option in testbbdev (patch 3/3)

v2:
- Add support in DPAA1 driver (patch 2/3)
- Add support and config parameter in testpmd (patch 3/3)

 lib/librte_ethdev/rte_ethdev.c |  1 +
 lib/librte_ethdev/rte_ethdev.h | 22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+)
lib/librte_ethdev/rte_ethdev.c +1 -0
index 48d1333b1..be25e947e 100644
@@ -128,6 +128,7 @@ static const struct {
 	RTE_RX_OFFLOAD_BIT2STR(SCTP_CKSUM),
 	RTE_RX_OFFLOAD_BIT2STR(OUTER_UDP_CKSUM),
 	RTE_RX_OFFLOAD_BIT2STR(RSS_HASH),
+	RTE_RX_OFFLOAD_BIT2STR(ERR_PKT_DROP),
 };
 
 #undef RTE_RX_OFFLOAD_BIT2STR
lib/librte_ethdev/rte_ethdev.h +22 -0
index d2bf74f12..cb968d38a 100644
@@ -1194,6 +1194,16 @@ struct rte_intr_conf {
 	uint32_t rmv:1;
 };
 
+/**
+ * A structure used to enable/disable error packet drop on RX.
+ */
+struct rte_rx_err_pkt_drop_conf {
+	/** enable/disable all RX error packet drop.
+	 * 0 (default) - disable, 1 enable
+	 */
+	uint32_t all:1;
+};
+
 /**
  * A structure used to configure an Ethernet port.
  * Depending upon the RX multi-queue mode, extra advanced
@@ -1236,6 +1246,8 @@ struct rte_eth_conf {
 	uint32_t dcb_capability_en;
 	struct rte_fdir_conf fdir_conf; /**< FDIR configuration. DEPRECATED */
 	struct rte_intr_conf intr_conf; /**< Interrupt mode configuration. */
+	struct rte_rx_err_pkt_drop_conf err_pkt_drop_conf;
+	/**< RX error packet drop configuration. */
 };
 
 /**
@@ -1260,6 +1272,7 @@ struct rte_eth_conf {
 #define DEV_RX_OFFLOAD_SCTP_CKSUM	0x00020000
 #define DEV_RX_OFFLOAD_OUTER_UDP_CKSUM  0x00040000
 #define DEV_RX_OFFLOAD_RSS_HASH		0x00080000
+#define DEV_RX_OFFLOAD_ERR_PKT_DROP	0x00100000
 
 #define DEV_RX_OFFLOAD_CHECKSUM (DEV_RX_OFFLOAD_IPV4_CKSUM | \
 				 DEV_RX_OFFLOAD_UDP_CKSUM | \
@@ -1274,6 +1287,13 @@ struct rte_eth_conf {
  * mentioned in rte_rx_offload_names in rte_ethdev.c file.
  */
 
+/**
+ * RX Error Drop offload config/capabilities of a device. These
+ * are valid only when RX capability DEV_RX_OFFLOAD_ERR_PKT_DROP
+ * is supported by the device.
+ */
+#define DEV_RX_ERR_PKT_DROP_OFFLOAD_ALL		0x00000001
+
 /**
  * TX offload capabilities of a device.
  */
@@ -1411,6 +1431,8 @@ struct rte_eth_dev_info {
 	/**< Device per-queue RX offload capabilities. */
 	uint64_t tx_queue_offload_capa;
 	/**< Device per-queue TX offload capabilities. */
+	uint64_t rx_err_drop_offload_capa;
+	/**< RX error packet drop offload capabilities. */
 	uint16_t reta_size;
 	/**< Device redirection table size, the total number of entries. */
 	uint8_t hash_key_size; /**< Hash key size in bytes */
Signature · 1 line
2.17.1
#22 lore raw

PATCH v3 2/3 net/dpaa: support RX offload for error packet drop

From: Nipun Gupta <[email protected]>

This patch supports RX offload configuration to drop error packets in the hardware

---
 drivers/bus/dpaa/base/fman/fman_hw.c |  7 ++++++-
 drivers/net/dpaa/dpaa_ethdev.c       | 23 +++++++++++++++++++----
 2 files changed, 25 insertions(+), 5 deletions(-)
drivers/bus/dpaa/base/fman/fman_hw.c +6 -1
index 4ab49f785..40e4e0000 100644
@@ -597,7 +597,12 @@ void
 fman_if_discard_rx_errors(struct fman_if *fm_if)
 {
 	struct __fman_if *__if = container_of(fm_if, struct __fman_if, __if);
-	unsigned int *fmbm_rfsdm, *fmbm_rfsem;
+	unsigned int *fmbm_rcfg, *fmbm_rfsdm, *fmbm_rfsem;
+	unsigned int val;
+
+	fmbm_rcfg = &((struct rx_bmi_regs *)__if->bmi_map)->fmbm_rcfg;
+	val = in_be32(fmbm_rcfg);
+	out_be32(fmbm_rcfg, val & ~BMI_PORT_CFG_FDOVR);
 
 	fmbm_rfsem = &((struct rx_bmi_regs *)__if->bmi_map)->fmbm_rfsem;
 	out_be32(fmbm_rfsem, 0);
drivers/net/dpaa/dpaa_ethdev.c +19 -4
index af47c196a..bed84a584 100644
@@ -52,7 +52,8 @@
 /* Supported Rx offloads */
 static uint64_t dev_rx_offloads_sup =
 		DEV_RX_OFFLOAD_JUMBO_FRAME |
-		DEV_RX_OFFLOAD_SCATTER;
+		DEV_RX_OFFLOAD_SCATTER |
+		DEV_RX_OFFLOAD_ERR_PKT_DROP;
 
 /* Rx offloads which cannot be disabled */
 static uint64_t dev_rx_offloads_nodis =
@@ -62,6 +63,10 @@ static uint64_t dev_rx_offloads_nodis =
 		DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM |
 		DEV_RX_OFFLOAD_RSS_HASH;
 
+/* Supported Rx Error packet drop offload */
+static uint64_t dev_rx_err_drop_offloads_sup =
+		DEV_RX_ERR_PKT_DROP_OFFLOAD_ALL;
+
 /* Supported Tx offloads */
 static uint64_t dev_tx_offloads_sup =
 		DEV_TX_OFFLOAD_MT_LOCKFREE |
@@ -262,6 +267,18 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
 		dev->data->scattered_rx = 1;
 	}
 
+	if (eth_conf->err_pkt_drop_conf.all) {
+		DPAA_PMD_DEBUG("error packets will be dropped on hw");
+		fman_if_discard_rx_errors(fif);
+	} else {
+		struct dpaa_if *dpaa_intf = dev->data->dev_private;
+		struct qman_fq *rxq = &dpaa_intf->rx_queues[0];
+
+		DPAA_PMD_DEBUG("error packets will not be dropped on hw");
+		fman_if_receive_rx_errors(fif, FM_FD_RX_STATUS_ERR_MASK);
+		fman_if_set_err_fqid(fif, rxq->fqid);
+	}
+
 	if (!(default_q || fmc_q)) {
 		if (dpaa_fm_config(dev,
 			eth_conf->rx_adv_conf.rss_conf.rss_hf)) {
@@ -591,6 +608,7 @@ static int dpaa_eth_dev_info(struct rte_eth_dev *dev,
 					dev_rx_offloads_nodis;
 	dev_info->tx_offload_capa = dev_tx_offloads_sup |
 					dev_tx_offloads_nodis;
+	dev_info->rx_err_drop_offload_capa = dev_rx_err_drop_offloads_sup;
 	dev_info->default_rxportconf.burst_size = DPAA_DEF_RX_BURST_SIZE;
 	dev_info->default_txportconf.burst_size = DPAA_DEF_TX_BURST_SIZE;
 	dev_info->default_rxportconf.nb_queues = 1;
@@ -2085,9 +2103,6 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 		fman_intf->mac_addr.addr_bytes[5]);
 
 	if (!fman_intf->is_shared_mac) {
-		/* Configure error packet handling */
-		fman_if_receive_rx_errors(fman_intf,
-			FM_FD_RX_STATUS_ERR_MASK);
 		/* Disable RX mode */
 		fman_if_disable_rx(fman_intf);
 		/* Disable promiscuous mode */
Signature · 1 line
2.17.1
#23 lore raw

PATCH v3 3/3 app/testpmd: support hardware offload to drop error packets

In reply to [email protected]

From: Nipun Gupta <[email protected]>

With DEV_RX_OFFLOAD_ERR_PKT_DROP now defined as an offload capability, and separate DEV_RX_ERR_PKT_DROP_OFFLOAD_ALL capability to drop all error packets in hardware, testpmd showcases this with a new added configuration option 'enable-hw-drop-err-all'.

---
 app/test-pmd/parameters.c             | 7 +++++++
 app/test-pmd/testpmd.c                | 8 ++++++++
 app/test-pmd/testpmd.h                | 1 +
 doc/guides/testpmd_app_ug/run_app.rst | 4 ++++
 4 files changed, 20 insertions(+)
app/test-pmd/parameters.c +7 -0
index 1ead59579..508612426 100644
@@ -142,6 +142,7 @@ usage(char* progname)
 	printf("  --enable-hw-vlan-strip: enable hardware vlan strip.\n");
 	printf("  --enable-hw-vlan-extend: enable hardware vlan extend.\n");
 	printf("  --enable-hw-qinq-strip: enable hardware qinq strip.\n");
+	printf("  --enable-hw-drop-err-all: enable hardware packet drop for all error packets.\n");
 	printf("  --enable-drop-en: enable per queue packet drop.\n");
 	printf("  --disable-rss: disable rss.\n");
 	printf("  --port-topology=<paired|chained|loop>: set port topology (paired "
@@ -631,6 +632,7 @@ launch_args_parse(int argc, char** argv)
 		{ "enable-hw-vlan-strip",       0, 0, 0 },
 		{ "enable-hw-vlan-extend",      0, 0, 0 },
 		{ "enable-hw-qinq-strip",       0, 0, 0 },
+		{ "enable-hw-drop-err-all",     0, 0, 0 },
 		{ "enable-drop-en",            0, 0, 0 },
 		{ "disable-rss",                0, 0, 0 },
 		{ "port-topology",              1, 0, 0 },
@@ -1283,6 +1285,11 @@ launch_args_parse(int argc, char** argv)
 				rmv_interrupt = 0;
 			if (!strcmp(lgopts[opt_idx].name, "flow-isolate-all"))
 				flow_isolate_all = 1;
+			if (!strcmp(lgopts[opt_idx].name,
+					"enable-hw-drop-err-all")) {
+				rx_err_pkt_drop_all = 1;
+			}
+
 			if (!strcmp(lgopts[opt_idx].name, "tx-offloads")) {
 				char *end = NULL;
 				n = strtoull(optarg, &end, 16);
app/test-pmd/testpmd.c +8 -0
index ccba71c07..c9e7397e6 100644
@@ -359,6 +359,11 @@ uint8_t lsc_interrupt = 1; /* enabled by default */
  */
 uint8_t rmv_interrupt = 1; /* enabled by default */
 
+/*
+ * Drop all RX error packets on HW itself.
+ */
+uint8_t rx_err_pkt_drop_all = 0; /* disabled by default */
+
 uint8_t hot_plug = 0; /**< hotplug disabled by default. */
 
 /* After attach, port setup is called on event or by iterator */
@@ -3359,6 +3364,9 @@ init_port_config(void)
 		    (rte_eth_devices[pid].data->dev_flags &
 		     RTE_ETH_DEV_INTR_RMV))
 			port->dev_conf.intr_conf.rmv = 1;
+
+		if (rx_err_pkt_drop_all)
+			port->dev_conf.err_pkt_drop_conf.all = 1;
 	}
 }
 
app/test-pmd/testpmd.h +1 -0
index c7e7e41a9..eab154ed4 100644
@@ -314,6 +314,7 @@ extern uint8_t no_device_start; /**<set by "--disable-device-start" parameter */
 extern volatile int test_done; /* stop packet forwarding when set to 1. */
 extern uint8_t lsc_interrupt; /**< disabled by "--no-lsc-interrupt" parameter */
 extern uint8_t rmv_interrupt; /**< disabled by "--no-rmv-interrupt" parameter */
+extern uint8_t rx_err_pkt_drop_all; /**< enabled by "--enable-hw-drop-err-all" parameter */
 extern uint32_t event_print_mask;
 /**< set by "--print-event xxxx" and "--mask-event xxxx parameters */
 extern bool setup_on_probe_event; /**< disabled by port setup-on iterator */
doc/guides/testpmd_app_ug/run_app.rst +4 -0
index e2539f693..20f2f8083 100644
@@ -213,6 +213,10 @@ The command line options are:
 
     Enable hardware QINQ strip.
 
+*  ``--enable-hw-drop-err-all``
+
+    Enable hardware packet drop for any error packets
+
 *   ``--enable-drop-en``
 
     Enable per-queue packet drop for packets with no descriptors.
Signature · 1 line
2.17.1
Reviewed-by on v3 3/3
#24 lore raw

Re: [dpdk-dev] [PATCH 3/3 v3] app/testpmd: support hardware offload to drop error packets

Regards,
Asaf Penso

Quoted 12 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Friday, October 9, 2020 4:14 PM
To: [email protected]
Cc: NBU-Contact-Thomas Monjalon <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Asaf Penso <[email protected]>; Nipun Gupta <[email protected]>
Subject: [PATCH 3/3 v3] app/testpmd: support hardware offload to drop error packets

Quoted 8 lines

From: Nipun Gupta <[email protected]>

With DEV_RX_OFFLOAD_ERR_PKT_DROP now defined as an offload capability, and separate DEV_RX_ERR_PKT_DROP_OFFLOAD_ALL capability to drop all error packets in hardware, testpmd showcases this with a new added configuration option 'enable-hw-drop-err-all'.

Quoted 99 lines

---

app/test-pmd/parameters.c             | 7 +++++++
app/test-pmd/testpmd.c                | 8 ++++++++
app/test-pmd/testpmd.h                | 1 +
doc/guides/testpmd_app_ug/run_app.rst | 4 ++++
4 files changed, 20 insertions(+)
app/test-pmd/parameters.c index renamed from app/test-pmd/parameters.c +0 -0

1ead59579..508612426 100644

app/test-pmd/parameters.c +2 -0
@@ -142,6 +142,7 @@ usage(char* progname)
 	printf("  --enable-hw-vlan-strip: enable hardware vlan strip.\n");
 	printf("  --enable-hw-vlan-extend: enable hardware vlan extend.\n");
 	printf("  --enable-hw-qinq-strip: enable hardware qinq strip.\n");
+	printf("  --enable-hw-drop-err-all: enable hardware packet drop for
+all error packets.\n");
 	printf("  --enable-drop-en: enable per queue packet drop.\n");
 	printf("  --disable-rss: disable rss.\n");
	printf("  --port-topology=<paired|chained|loop>: set port topology

(paired "

app/test-pmd/parameters.c +6 -0
@@ -631,6 +632,7 @@ launch_args_parse(int argc, char** argv)
 		{ "enable-hw-vlan-strip",       0, 0, 0 },
 		{ "enable-hw-vlan-extend",      0, 0, 0 },
 		{ "enable-hw-qinq-strip",       0, 0, 0 },
+		{ "enable-hw-drop-err-all",     0, 0, 0 },
 		{ "enable-drop-en",            0, 0, 0 },
 		{ "disable-rss",                0, 0, 0 },
 		{ "port-topology",              1, 0, 0 },
@@ -1283,6 +1285,11 @@ launch_args_parse(int argc, char** argv)
 				rmv_interrupt = 0;
 			if (!strcmp(lgopts[opt_idx].name, "flow-isolate-all"))
 				flow_isolate_all = 1;
+			if (!strcmp(lgopts[opt_idx].name,
+					"enable-hw-drop-err-all")) {
+				rx_err_pkt_drop_all = 1;
+			}
+
 			if (!strcmp(lgopts[opt_idx].name, "tx-offloads")) {
 				char *end = NULL;
 				n = strtoull(optarg, &end, 16);
app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0 -0

ccba71c07..c9e7397e6 100644

app/test-pmd/testpmd.c +0 -0
@@ -359,6 +359,11 @@ uint8_t lsc_interrupt = 1; /* enabled by default */
 */

uint8_t rmv_interrupt = 1; /* enabled by default */

app/test-pmd/testpmd.c +5 -0
+/*
+ * Drop all RX error packets on HW itself.
+ */
+uint8_t rx_err_pkt_drop_all = 0; /* disabled by default */
+

uint8_t hot_plug = 0; /**< hotplug disabled by default. */

/* After attach, port setup is called on event or by iterator */ @@ -3359,6 +3364,9 @@ init_port_config(void)

		    (rte_eth_devices[pid].data->dev_flags &
		     RTE_ETH_DEV_INTR_RMV))
			port->dev_conf.intr_conf.rmv = 1;
app/test-pmd/testpmd.c +3 -0
+
+		if (rx_err_pkt_drop_all)
+			port->dev_conf.err_pkt_drop_conf.all = 1;
	}
}
app/test-pmd/testpmd.h index renamed from app/test-pmd/testpmd.h +0 -0

c7e7e41a9..eab154ed4 100644

app/test-pmd/testpmd.h +0 -0
@@ -314,6 +314,7 @@ extern uint8_t no_device_start; /**<set by "--disable-

device-start" parameter */ extern volatile int test_done; /* stop packet forwarding when set to 1. */ extern uint8_t lsc_interrupt; /**< disabled by "- -no-lsc-interrupt" parameter */ extern uint8_t rmv_interrupt; /**< disabled by "--no-rmv-interrupt" parameter */
+extern uint8_t rx_err_pkt_drop_all; /**< enabled by +"--enable-hw-drop-err-all" parameter */
extern uint32_t event_print_mask;
/**< set by "--print-event xxxx" and "--mask-event xxxx parameters */ extern bool setup_on_probe_event; /**< disabled by port setup-on iterator */ diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst
index e2539f693..20f2f8083 100644

doc/guides/testpmd_app_ug/run_app.rst +4 -1
@@ -213,6 +213,10 @@ The command line options are:
 
    Enable hardware QINQ strip.
 
+*  ``--enable-hw-drop-err-all``
+
+    Enable hardware packet drop for any error packets
+
 *   ``--enable-drop-en``
 
    Enable per-queue packet drop for packets with no descriptors.
--

2.17.1

Reviewed-by Ferruh Yigit on v3 1/3
#25 lore raw
In reply to [email protected]
Quoted 21 lines · On Fri, Oct 9, 2020 at 6:43 PM <[email protected]> wrote:

From: Nipun Gupta <[email protected]>

This change adds a RX offload capability and configuration to enable hardware to drop the packets in case of any error in the packets such as L3 checksum error or L4 checksum.

---

v3:
- Add additional rx_err_drop_offload_capa, which is specific capability flag for RX packets error drop offload. Currently only 'all' error packet drops are enabled, but can be extended to provide capability to drop any specific errors like L1 FCS, L3 Checksum etc.
- Added separate config structure to enable the drop configuration.
- Updated doc with the new updated option in testbbdev (patch 3/3)

Quoted 7 lines

v2:
- Add support in DPAA1 driver (patch 2/3)
- Add support and config parameter in testpmd (patch 3/3)

 lib/librte_ethdev/rte_ethdev.c |  1 +
 lib/librte_ethdev/rte_ethdev.h | 22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+)

The patch looks good to me.

1) Missed to update port_offload_cap_display() for new oflload in /app/test-pmd/config.c
2) Please update doc/guides/nics/features.rst for this new offload

See [1] as a reference.
[1]
commit 28f6a3b88d23a348eeffd2bac79b2e0819d3b4e9

Author: Jerin Jacob <[email protected]>
Date:   Tue Oct 2 16:21:41 2018 +0530

ethdev: support SCTP Rx checksum offload

Added SCTP Rx checksum offload support

Quoted 77 lines
lib/librte_ethdev/rte_ethdev.c +1 -0
index 48d1333b1..be25e947e 100644
@@ -128,6 +128,7 @@ static const struct {
        RTE_RX_OFFLOAD_BIT2STR(SCTP_CKSUM),
        RTE_RX_OFFLOAD_BIT2STR(OUTER_UDP_CKSUM),
        RTE_RX_OFFLOAD_BIT2STR(RSS_HASH),
+       RTE_RX_OFFLOAD_BIT2STR(ERR_PKT_DROP),
 };
 
 #undef RTE_RX_OFFLOAD_BIT2STR
lib/librte_ethdev/rte_ethdev.h +22 -1
index d2bf74f12..cb968d38a 100644
@@ -1194,6 +1194,16 @@ struct rte_intr_conf {
        uint32_t rmv:1;
 };
 
+/**
+ * A structure used to enable/disable error packet drop on RX.
+ */
+struct rte_rx_err_pkt_drop_conf {
+       /** enable/disable all RX error packet drop.
+        * 0 (default) - disable, 1 enable
+        */
+       uint32_t all:1;
+};
+
 /**
  * A structure used to configure an Ethernet port.
  * Depending upon the RX multi-queue mode, extra advanced
@@ -1236,6 +1246,8 @@ struct rte_eth_conf {
        uint32_t dcb_capability_en;
        struct rte_fdir_conf fdir_conf; /**< FDIR configuration. DEPRECATED */
        struct rte_intr_conf intr_conf; /**< Interrupt mode configuration. */
+       struct rte_rx_err_pkt_drop_conf err_pkt_drop_conf;
+       /**< RX error packet drop configuration. */
 };
 
 /**
@@ -1260,6 +1272,7 @@ struct rte_eth_conf {
 #define DEV_RX_OFFLOAD_SCTP_CKSUM      0x00020000
 #define DEV_RX_OFFLOAD_OUTER_UDP_CKSUM  0x00040000
 #define DEV_RX_OFFLOAD_RSS_HASH                0x00080000
+#define DEV_RX_OFFLOAD_ERR_PKT_DROP    0x00100000
 
 #define DEV_RX_OFFLOAD_CHECKSUM (DEV_RX_OFFLOAD_IPV4_CKSUM | \
                                 DEV_RX_OFFLOAD_UDP_CKSUM | \
@@ -1274,6 +1287,13 @@ struct rte_eth_conf {
  * mentioned in rte_rx_offload_names in rte_ethdev.c file.
  */
 
+/**
+ * RX Error Drop offload config/capabilities of a device. These
+ * are valid only when RX capability DEV_RX_OFFLOAD_ERR_PKT_DROP
+ * is supported by the device.
+ */
+#define DEV_RX_ERR_PKT_DROP_OFFLOAD_ALL                0x00000001
+
 /**
  * TX offload capabilities of a device.
  */
@@ -1411,6 +1431,8 @@ struct rte_eth_dev_info {
        /**< Device per-queue RX offload capabilities. */
        uint64_t tx_queue_offload_capa;
        /**< Device per-queue TX offload capabilities. */
+       uint64_t rx_err_drop_offload_capa;
+       /**< RX error packet drop offload capabilities. */
        uint16_t reta_size;
        /**< Device redirection table size, the total number of entries. */
        uint8_t hash_key_size; /**< Hash key size in bytes */
--

2.17.1

#26 lore raw
In reply to [email protected]

Hi,

The configuration of this feature is not clear to me. Please see the comments below.

09/10/2020 15:13, [email protected]:

Quoted 10 lines

From: Nipun Gupta <[email protected]>

This change adds a RX offload capability and configuration to enable hardware to drop the packets in case of any error in the packets such as L3 checksum error or L4 checksum.

---

[...]

Quoted 2 lines

+/**
+ * A structure used to enable/disable error packet drop on RX.

RX -> Rx
same for other occurences below

Quoted 2 lines

+ */
+struct rte_rx_err_pkt_drop_conf {

The name should start with rte_eth_

lib/librte_ethdev/rte_ethdev.h struct rte_intr_conf { · line 1205

Quoted 5 lines
lib/librte_ethdev/rte_ethdev.h +5 -0
+	/** enable/disable all RX error packet drop.
+	 * 0 (default) - disable, 1 enable
+	 */
+	uint32_t all:1;
+};

I don't understand the meaning of this struct. Is it just one bit to drop packets having an error? How do you determine what is an error?

[...]

lib/librte_ethdev/rte_ethdev.h struct rte_eth_conf { · line 1250

Quoted 6 lines
lib/librte_ethdev/rte_ethdev.h +2 -0
@@ -1236,6 +1246,8 @@ struct rte_eth_conf {
 	uint32_t dcb_capability_en;
 	struct rte_fdir_conf fdir_conf; /**< FDIR configuration. DEPRECATED */
 	struct rte_intr_conf intr_conf; /**< Interrupt mode configuration. */
+	struct rte_rx_err_pkt_drop_conf err_pkt_drop_conf;
+	/**< RX error packet drop configuration. */

Why a per-port configuration is needed in addition of the per-queue offload?

[...]

lib/librte_ethdev/rte_ethdev.h struct rte_eth_conf { · line 1275

Quoted 5 lines
lib/librte_ethdev/rte_ethdev.h +1 -0
@@ -1260,6 +1272,7 @@ struct rte_eth_conf {
 #define DEV_RX_OFFLOAD_SCTP_CKSUM	0x00020000
 #define DEV_RX_OFFLOAD_OUTER_UDP_CKSUM  0x00040000
 #define DEV_RX_OFFLOAD_RSS_HASH		0x00080000
+#define DEV_RX_OFFLOAD_ERR_PKT_DROP	0x00100000

New offload names should starte with RTE_ prefix.

lib/librte_ethdev/rte_ethdev.h struct rte_eth_conf { · line 1295

Quoted 6 lines
lib/librte_ethdev/rte_ethdev.h +6 -0
+/**
+ * RX Error Drop offload config/capabilities of a device. These
+ * are valid only when RX capability DEV_RX_OFFLOAD_ERR_PKT_DROP
+ * is supported by the device.
+ */
+#define DEV_RX_ERR_PKT_DROP_OFFLOAD_ALL		0x00000001

I don't understand the meaning.

lib/librte_ethdev/rte_ethdev.h struct rte_eth_dev_info { · line 1435

Quoted 6 lines
lib/librte_ethdev/rte_ethdev.h +2 -0
@@ -1411,6 +1431,8 @@ struct rte_eth_dev_info {
 	/**< Device per-queue RX offload capabilities. */
 	uint64_t tx_queue_offload_capa;
 	/**< Device per-queue TX offload capabilities. */
+	uint64_t rx_err_drop_offload_capa;
+	/**< RX error packet drop offload capabilities. */

Why adding a new field here instead of reporting in rx_offload_capa?

#27 lore raw
Quoted 29 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Monday, October 12, 2020 3:12 AM
To: Nipun Gupta <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Hemant Agrawal <[email protected]>; Sachin Saxena <[email protected]>; Rohit Raj <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH 1/3 v3] ethdev: add rx offload to drop error packets

Hi,

The configuration of this feature is not clear to me. Please see the comments below.

09/10/2020 15:13, [email protected]:

Quoted 10 lines

From: Nipun Gupta <[email protected]>

This change adds a RX offload capability and configuration to enable hardware to drop the packets in case of any error in the packets such as L3 checksum error or L4 checksum.

---

Quoted 6 lines

[...]

Quoted 2 lines

+/**
+ * A structure used to enable/disable error packet drop on RX.

RX -> Rx
same for other occurences below

Okay.

Quoted 6 lines
Quoted 3 lines

+ */
+struct rte_rx_err_pkt_drop_conf {

The name should start with rte_eth_

Quoted 9 lines

lib/librte_ethdev/rte_ethdev.h struct rte_intr_conf { · line 1205

Quoted 5 lines
lib/librte_ethdev/rte_ethdev.h +5 -0
+	/** enable/disable all RX error packet drop.
+	 * 0 (default) - disable, 1 enable
+	 */
+	uint32_t all:1;
+};

I don't understand the meaning of this struct. Is it just one bit to drop packets having an error? How do you determine what is an error?

The error packets which are dropped on the hardware can be from various reasons, like L1 FCS, L3 CSUM, L4 CSUM or HW can be configured to drop ALL (or any) of the error packets received on the interface.

Currently DPAA drivers support drop of ALL the error packets, but does not support configuration of packet drops on basis of separate error types like dropping only L2 CSUM, L3 CSUM. So this patch is supporting only drop of 'ALL' the errors packets received on HW.

Marvell supports drop on separate error types, thus Jerin suggested to have this structure so that it opens the room for adding separate configuration to drop packets on basis of separate error types.

Jerin,
maybe you can add more on this.

Quoted 11 lines

[...]

lib/librte_ethdev/rte_ethdev.h struct rte_eth_conf { · line 1250

Quoted 6 lines
lib/librte_ethdev/rte_ethdev.h +2 -0
@@ -1236,6 +1246,8 @@ struct rte_eth_conf {
 	uint32_t dcb_capability_en;
 	struct rte_fdir_conf fdir_conf; /**< FDIR configuration. DEPRECATED */
 	struct rte_intr_conf intr_conf; /**< Interrupt mode configuration. */
+	struct rte_rx_err_pkt_drop_conf err_pkt_drop_conf;
+	/**< RX error packet drop configuration. */

Why a per-port configuration is needed in addition of the per-queue offload?

Quoted 8 lines

[...]

lib/librte_ethdev/rte_ethdev.h struct rte_eth_conf { · line 1275

Quoted 5 lines
lib/librte_ethdev/rte_ethdev.h +1 -0
@@ -1260,6 +1272,7 @@ struct rte_eth_conf {
 #define DEV_RX_OFFLOAD_SCTP_CKSUM	0x00020000
 #define DEV_RX_OFFLOAD_OUTER_UDP_CKSUM  0x00040000
 #define DEV_RX_OFFLOAD_RSS_HASH		0x00080000
+#define DEV_RX_OFFLOAD_ERR_PKT_DROP	0x00100000

New offload names should starte with RTE_ prefix.

Okay

Quoted 10 lines

lib/librte_ethdev/rte_ethdev.h struct rte_eth_conf { · line 1295

Quoted 8 lines
lib/librte_ethdev/rte_ethdev.h +6 -0
+/**
+ * RX Error Drop offload config/capabilities of a device. These
+ * are valid only when RX capability DEV_RX_OFFLOAD_ERR_PKT_DROP
+ * is supported by the device.
+ */
+#define DEV_RX_ERR_PKT_DROP_OFFLOAD_ALL		0x00000001

I don't understand the meaning.

For DPAA drivers there is only one offload required, but once separate offloads are added to drop packets on basis of separate errors, then it can bloat up the offload capabilities. So we added new flags ' rte_rx_err_pkt_drop_conf ' instead of adding this onto 'rx_offload_capa'.

There is only one flag ' DEV_RX_OFFLOAD_ERR_PKT_DROP' added in 'rx_offload_capa' and if this flag is enabled, one or more of the flag in ' DEV_RX_ERR_PKT_DROP_OFFLOAD...' can be enabled (currently only DEV_RX_ERR_PKT_DROP_OFFLOAD_ALL) being supported Others like:
- DEV_RX_ERR_PKT_DROP_OFFLOAD_L1_FCS
- DEV_RX_ERR_PKT_DROP_OFFLOAD_L3_CSUM
- DEV_RX_ERR_PKT_DROP_OFFLOAD_L4_CSUM etc.
Can be added once any reference driver is supporting this.

P.S. I can add these flags in this patch but without any ref driver support.

Quoted 9 lines

lib/librte_ethdev/rte_ethdev.h struct rte_eth_dev_info { · line 1435

Quoted 7 lines
lib/librte_ethdev/rte_ethdev.h +2 -0
@@ -1411,6 +1431,8 @@ struct rte_eth_dev_info {
 	/**< Device per-queue RX offload capabilities. */
 	uint64_t tx_queue_offload_capa;
 	/**< Device per-queue TX offload capabilities. */
+	uint64_t rx_err_drop_offload_capa;
+	/**< RX error packet drop offload capabilities. */

Why adding a new field here instead of reporting in rx_offload_capa?

This was part of v2 where flag was added in rx_offload_capa.

Both ways (v2 and v3 versions) seems to have pros and cons:
- Adding only in the rx_offload_capa' seems simpler to implement and use
- But it shall lead to increase in the offload capability types when packet drop configuration is added on individual error types.

Regards,
Nipun

Quoted 2 lines
#28 lore raw

Hi Thomas and Jerin,

There seems two views:
1. Use of existing rx_offload_capa, to have additional error packet drop offload capabilities. This is showcased in v2, and also suggested by Thomas.
2. Adding additional offload capability flag types and configuration structure for error packet drop configuration as suggested by Jerin, which is part of v3.

Please let me know which one shall I continue with for the next spin.

Thanks,
Nipun

Quoted 155 lines

-----Original Message-----
From: Nipun Gupta
Sent: Monday, October 12, 2020 11:11 AM
To: Thomas Monjalon <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Hemant Agrawal <[email protected]>; Sachin Saxena <[email protected]>; Rohit Raj <[email protected]>; [email protected]; [email protected]
Subject: RE: [dpdk-dev] [PATCH 1/3 v3] ethdev: add rx offload to drop error packets

Quoted 27 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Monday, October 12, 2020 3:12 AM
To: Nipun Gupta <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Hemant Agrawal <[email protected]>; Sachin Saxena <[email protected]>; Rohit Raj <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH 1/3 v3] ethdev: add rx offload to drop error packets

Hi,

The configuration of this feature is not clear to me. Please see the comments below.

09/10/2020 15:13, [email protected]:

Quoted 10 lines

From: Nipun Gupta <[email protected]>

This change adds a RX offload capability and configuration to enable hardware to drop the packets in case of any error in the packets such as L3 checksum error or L4 checksum.

---

Quoted 6 lines

[...]

Quoted 2 lines

+/**
+ * A structure used to enable/disable error packet drop on RX.

RX -> Rx
same for other occurences below

Okay.

Quoted 6 lines
Quoted 3 lines

+ */
+struct rte_rx_err_pkt_drop_conf {

The name should start with rte_eth_

Quoted 9 lines

lib/librte_ethdev/rte_ethdev.h struct rte_intr_conf { · line 1205

Quoted 5 lines
lib/librte_ethdev/rte_ethdev.h +5 -0
+	/** enable/disable all RX error packet drop.
+	 * 0 (default) - disable, 1 enable
+	 */
+	uint32_t all:1;
+};

I don't understand the meaning of this struct. Is it just one bit to drop packets having an error? How do you determine what is an error?

The error packets which are dropped on the hardware can be from various reasons, like L1 FCS, L3 CSUM, L4 CSUM or HW can be configured to drop ALL (or any) of the error packets received on the interface.

Currently DPAA drivers support drop of ALL the error packets, but does not support configuration of packet drops on basis of separate error types like dropping only L2 CSUM, L3 CSUM. So this patch is supporting only drop of 'ALL' the errors packets received on HW.

Marvell supports drop on separate error types, thus Jerin suggested to have this structure so that it opens the room for adding separate configuration to drop packets on basis of separate error types.

Jerin,
maybe you can add more on this.

Quoted 11 lines

[...]

lib/librte_ethdev/rte_ethdev.h struct rte_eth_conf { · line 1250

Quoted 6 lines
lib/librte_ethdev/rte_ethdev.h +2 -0
@@ -1236,6 +1246,8 @@ struct rte_eth_conf {
 	uint32_t dcb_capability_en;
 	struct rte_fdir_conf fdir_conf; /**< FDIR configuration. DEPRECATED */
 	struct rte_intr_conf intr_conf; /**< Interrupt mode configuration. */
+	struct rte_rx_err_pkt_drop_conf err_pkt_drop_conf;
+	/**< RX error packet drop configuration. */

Why a per-port configuration is needed in addition of the per-queue offload?

Quoted 8 lines

[...]

lib/librte_ethdev/rte_ethdev.h struct rte_eth_conf { · line 1275

Quoted 5 lines
lib/librte_ethdev/rte_ethdev.h +1 -0
@@ -1260,6 +1272,7 @@ struct rte_eth_conf {
 #define DEV_RX_OFFLOAD_SCTP_CKSUM	0x00020000
 #define DEV_RX_OFFLOAD_OUTER_UDP_CKSUM  0x00040000
 #define DEV_RX_OFFLOAD_RSS_HASH		0x00080000
+#define DEV_RX_OFFLOAD_ERR_PKT_DROP	0x00100000

New offload names should starte with RTE_ prefix.

Okay

Quoted 10 lines

lib/librte_ethdev/rte_ethdev.h struct rte_eth_conf { · line 1295

Quoted 8 lines
lib/librte_ethdev/rte_ethdev.h +6 -0
+/**
+ * RX Error Drop offload config/capabilities of a device. These
+ * are valid only when RX capability DEV_RX_OFFLOAD_ERR_PKT_DROP
+ * is supported by the device.
+ */
+#define DEV_RX_ERR_PKT_DROP_OFFLOAD_ALL		0x00000001

I don't understand the meaning.

For DPAA drivers there is only one offload required, but once separate offloads are added to drop packets on basis of separate errors, then it can bloat up the offload capabilities. So we added new flags ' rte_rx_err_pkt_drop_conf ' instead of adding this onto 'rx_offload_capa'.

There is only one flag ' DEV_RX_OFFLOAD_ERR_PKT_DROP' added in 'rx_offload_capa'
and if this flag is enabled, one or more of the flag in ' DEV_RX_ERR_PKT_DROP_OFFLOAD...'
can be enabled (currently only DEV_RX_ERR_PKT_DROP_OFFLOAD_ALL) being supported
Others like:
- DEV_RX_ERR_PKT_DROP_OFFLOAD_L1_FCS
- DEV_RX_ERR_PKT_DROP_OFFLOAD_L3_CSUM
- DEV_RX_ERR_PKT_DROP_OFFLOAD_L4_CSUM etc.
Can be added once any reference driver is supporting this.

P.S. I can add these flags in this patch but without any ref driver support.

Quoted 9 lines

lib/librte_ethdev/rte_ethdev.h struct rte_eth_dev_info { · line 1435

Quoted 7 lines
lib/librte_ethdev/rte_ethdev.h +2 -0
@@ -1411,6 +1431,8 @@ struct rte_eth_dev_info {
 	/**< Device per-queue RX offload capabilities. */
 	uint64_t tx_queue_offload_capa;
 	/**< Device per-queue TX offload capabilities. */
+	uint64_t rx_err_drop_offload_capa;
+	/**< RX error packet drop offload capabilities. */

Why adding a new field here instead of reporting in rx_offload_capa?

This was part of v2 where flag was added in rx_offload_capa.

Both ways (v2 and v3 versions) seems to have pros and cons:
- Adding only in the rx_offload_capa' seems simpler to implement and use
- But it shall lead to increase in the offload capability types when packet drop configuration is added on individual error types.

Regards,
Nipun

Quoted 2 lines
#29 lore raw
In reply to [email protected]
Quoted 46 lines · On 10/9/20 4:13 PM, [email protected] wrote:

From: Nipun Gupta <[email protected]>

This change adds a RX offload capability and configuration to enable hardware to drop the packets in case of any error in the packets such as L3 checksum error or L4 checksum.

---

v3:
- Add additional rx_err_drop_offload_capa, which is specific capability flag for RX packets error drop offload. Currently only 'all' error packet drops are enabled, but can be extended to provide capability to drop any specific errors like L1 FCS, L3 Checksum etc.
- Added separate config structure to enable the drop configuration.
- Updated doc with the new updated option in testbbdev (patch 3/3)

v2:
- Add support in DPAA1 driver (patch 2/3)
- Add support and config parameter in testpmd (patch 3/3)

 lib/librte_ethdev/rte_ethdev.c |  1 +
 lib/librte_ethdev/rte_ethdev.h | 22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+)
lib/librte_ethdev/rte_ethdev.c +1 -0
index 48d1333b1..be25e947e 100644
@@ -128,6 +128,7 @@ static const struct {
 	RTE_RX_OFFLOAD_BIT2STR(SCTP_CKSUM),
 	RTE_RX_OFFLOAD_BIT2STR(OUTER_UDP_CKSUM),
 	RTE_RX_OFFLOAD_BIT2STR(RSS_HASH),
+	RTE_RX_OFFLOAD_BIT2STR(ERR_PKT_DROP),
 };
 
 #undef RTE_RX_OFFLOAD_BIT2STR
lib/librte_ethdev/rte_ethdev.h +0 -0
index d2bf74f12..cb968d38a 100644
@@ -1194,6 +1194,16 @@ struct rte_intr_conf {
 	uint32_t rmv:1;

lib/librte_ethdev/rte_ethdev.h struct rte_intr_conf { · line 1204

Quoted 10 lines
lib/librte_ethdev/rte_ethdev.h +8 -0
 };
 
+/**
+ * A structure used to enable/disable error packet drop on RX.
+ */
+struct rte_rx_err_pkt_drop_conf {
+	/** enable/disable all RX error packet drop.
+	 * 0 (default) - disable, 1 enable
+	 */
+	uint32_t all:1;

"all" is bad. It should be granular and in the same terms as mask in dev_info capability.

lib/librte_ethdev/rte_ethdev.h struct rte_eth_conf { · line 1250

Quoted 11 lines
lib/librte_ethdev/rte_ethdev.h +4 -0
+};
+
 /**
  * A structure used to configure an Ethernet port.
  * Depending upon the RX multi-queue mode, extra advanced
@@ -1236,6 +1246,8 @@ struct rte_eth_conf {
 	uint32_t dcb_capability_en;
 	struct rte_fdir_conf fdir_conf; /**< FDIR configuration. DEPRECATED */
 	struct rte_intr_conf intr_conf; /**< Interrupt mode configuration. */
+	struct rte_rx_err_pkt_drop_conf err_pkt_drop_conf;
+	/**< RX error packet drop configuration. */

Why not per queue?

Quoted 12 lines
lib/librte_ethdev/rte_ethdev.h +1 -0
 };
 
 /**
@@ -1260,6 +1272,7 @@ struct rte_eth_conf {
 #define DEV_RX_OFFLOAD_SCTP_CKSUM	0x00020000
 #define DEV_RX_OFFLOAD_OUTER_UDP_CKSUM  0x00040000
 #define DEV_RX_OFFLOAD_RSS_HASH		0x00080000
+#define DEV_RX_OFFLOAD_ERR_PKT_DROP	0x00100000
 
 #define DEV_RX_OFFLOAD_CHECKSUM (DEV_RX_OFFLOAD_IPV4_CKSUM | \
 				 DEV_RX_OFFLOAD_UDP_CKSUM | \

lib/librte_ethdev/rte_ethdev.h struct rte_eth_conf { · line 1296

Quoted 10 lines
lib/librte_ethdev/rte_ethdev.h +7 -0
@@ -1274,6 +1287,13 @@ struct rte_eth_conf {
  * mentioned in rte_rx_offload_names in rte_ethdev.c file.
  */
 
+/**
+ * RX Error Drop offload config/capabilities of a device. These
+ * are valid only when RX capability DEV_RX_OFFLOAD_ERR_PKT_DROP
+ * is supported by the device.
+ */
+#define DEV_RX_ERR_PKT_DROP_OFFLOAD_ALL		0x00000001
+

I strictly dislike "all". It will always be bad defined. It must be granular.

Quoted 13 lines
lib/librte_ethdev/rte_ethdev.h +2 -0
 /**
  * TX offload capabilities of a device.
  */
@@ -1411,6 +1431,8 @@ struct rte_eth_dev_info {
 	/**< Device per-queue RX offload capabilities. */
 	uint64_t tx_queue_offload_capa;
 	/**< Device per-queue TX offload capabilities. */
+	uint64_t rx_err_drop_offload_capa;
+	/**< RX error packet drop offload capabilities. */
 	uint16_t reta_size;
 	/**< Device redirection table size, the total number of entries. */
 	uint8_t hash_key_size; /**< Hash key size in bytes */
#30 lore raw
Quoted 62 lines

-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Monday, October 12, 2020 1:32 PM
To: Nipun Gupta <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Hemant Agrawal <[email protected]>; Sachin Saxena <[email protected]>; Rohit Raj <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH 1/3 v3] ethdev: add rx offload to drop error packets

Quoted 48 lines · On 10/9/20 4:13 PM, [email protected] wrote:

From: Nipun Gupta <[email protected]>

This change adds a RX offload capability and configuration to enable hardware to drop the packets in case of any error in the packets such as L3 checksum error or L4 checksum.

---

v3:
- Add additional rx_err_drop_offload_capa, which is specific capability flag for RX packets error drop offload. Currently only 'all' error packet drops are enabled, but can be extended to provide capability to drop any specific errors like L1 FCS, L3 Checksum etc.
- Added separate config structure to enable the drop configuration.
- Updated doc with the new updated option in testbbdev (patch 3/3)

v2:
- Add support in DPAA1 driver (patch 2/3)
- Add support and config parameter in testpmd (patch 3/3)

 lib/librte_ethdev/rte_ethdev.c |  1 +
 lib/librte_ethdev/rte_ethdev.h | 22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+)
lib/librte_ethdev/rte_ethdev.c +1 -0
index 48d1333b1..be25e947e 100644
@@ -128,6 +128,7 @@ static const struct {
 	RTE_RX_OFFLOAD_BIT2STR(SCTP_CKSUM),
 	RTE_RX_OFFLOAD_BIT2STR(OUTER_UDP_CKSUM),
 	RTE_RX_OFFLOAD_BIT2STR(RSS_HASH),
+	RTE_RX_OFFLOAD_BIT2STR(ERR_PKT_DROP),
 };
 
 #undef RTE_RX_OFFLOAD_BIT2STR
lib/librte_ethdev/rte_ethdev.h +0 -0
index d2bf74f12..cb968d38a 100644
@@ -1194,6 +1194,16 @@ struct rte_intr_conf {
 	uint32_t rmv:1;
 };
 
Quoted 11 lines

lib/librte_ethdev/rte_ethdev.h struct rte_intr_conf { · line 1204

Quoted 8 lines
lib/librte_ethdev/rte_ethdev.h +8 -0
+/**
+ * A structure used to enable/disable error packet drop on RX.
+ */
+struct rte_rx_err_pkt_drop_conf {
+	/** enable/disable all RX error packet drop.
+	 * 0 (default) - disable, 1 enable
+	 */
+	uint32_t all:1;

"all" is bad. It should be granular and in the same terms as mask in dev_info capability.

Consider that application do not want to receive any error packets as it will drop all the error packets after increasing the error counter maintainer in the application. If same functionality can be done by the hardware where hardware maintains the error statistics, then why not have the same?
When hardware does parsing of packet headers and found error during that parsing, this is to say to HW - hey drop any such error packets which you found during parsing and just increase specific error counter (if present).

I agree, granular shall also be added, but as our driver does not support them, so I did not add those bits here.

Quoted 14 lines

lib/librte_ethdev/rte_ethdev.h struct rte_eth_conf { · line 1250

Quoted 12 lines
lib/librte_ethdev/rte_ethdev.h +4 -0
+};
+
 /**
  * A structure used to configure an Ethernet port.
  * Depending upon the RX multi-queue mode, extra advanced
@@ -1236,6 +1246,8 @@ struct rte_eth_conf {
 	uint32_t dcb_capability_en;
 	struct rte_fdir_conf fdir_conf; /**< FDIR configuration. DEPRECATED */
 	struct rte_intr_conf intr_conf; /**< Interrupt mode configuration. */
+	struct rte_rx_err_pkt_drop_conf err_pkt_drop_conf;
+	/**< RX error packet drop configuration. */

Why not per queue?

We do not support per queue configuration for error packet drop, but only on ethernet basis.

Quoted 40 lines
Quoted 13 lines
lib/librte_ethdev/rte_ethdev.h +1 -0
 };
 
 /**
@@ -1260,6 +1272,7 @@ struct rte_eth_conf {
 #define DEV_RX_OFFLOAD_SCTP_CKSUM	0x00020000
 #define DEV_RX_OFFLOAD_OUTER_UDP_CKSUM  0x00040000
 #define DEV_RX_OFFLOAD_RSS_HASH		0x00080000
+#define DEV_RX_OFFLOAD_ERR_PKT_DROP	0x00100000
 
 #define DEV_RX_OFFLOAD_CHECKSUM (DEV_RX_OFFLOAD_IPV4_CKSUM | \
 				 DEV_RX_OFFLOAD_UDP_CKSUM | \

lib/librte_ethdev/rte_ethdev.h struct rte_eth_conf { · line 1296

Quoted 10 lines
lib/librte_ethdev/rte_ethdev.h +7 -0
@@ -1274,6 +1287,13 @@ struct rte_eth_conf {
  * mentioned in rte_rx_offload_names in rte_ethdev.c file.
  */
 
+/**
+ * RX Error Drop offload config/capabilities of a device. These
+ * are valid only when RX capability DEV_RX_OFFLOAD_ERR_PKT_DROP
+ * is supported by the device.
+ */
+#define DEV_RX_ERR_PKT_DROP_OFFLOAD_ALL		0x00000001
+

I strictly dislike "all". It will always be bad defined. It must be granular.

Quoted 13 lines
lib/librte_ethdev/rte_ethdev.h +2 -0
 /**
  * TX offload capabilities of a device.
  */
@@ -1411,6 +1431,8 @@ struct rte_eth_dev_info {
 	/**< Device per-queue RX offload capabilities. */
 	uint64_t tx_queue_offload_capa;
 	/**< Device per-queue TX offload capabilities. */
+	uint64_t rx_err_drop_offload_capa;
+	/**< RX error packet drop offload capabilities. */
 	uint16_t reta_size;
 	/**< Device redirection table size, the total number of entries. */
 	uint8_t hash_key_size; /**< Hash key size in bytes */
#31 lore raw
Quoted 82 lines · Nipun Gupta
Quoted 62 lines

-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Monday, October 12, 2020 1:32 PM
To: Nipun Gupta <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Hemant Agrawal <[email protected]>; Sachin Saxena <[email protected]>; Rohit Raj <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH 1/3 v3] ethdev: add rx offload to drop error packets

Quoted 48 lines · On 10/9/20 4:13 PM, [email protected] wrote:

From: Nipun Gupta <[email protected]>

This change adds a RX offload capability and configuration to enable hardware to drop the packets in case of any error in the packets such as L3 checksum error or L4 checksum.

---

v3:
- Add additional rx_err_drop_offload_capa, which is specific capability flag for RX packets error drop offload. Currently only 'all' error packet drops are enabled, but can be extended to provide capability to drop any specific errors like L1 FCS, L3 Checksum etc.
- Added separate config structure to enable the drop configuration.
- Updated doc with the new updated option in testbbdev (patch 3/3)

v2:
- Add support in DPAA1 driver (patch 2/3)
- Add support and config parameter in testpmd (patch 3/3)

 lib/librte_ethdev/rte_ethdev.c |  1 +
 lib/librte_ethdev/rte_ethdev.h | 22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+)
lib/librte_ethdev/rte_ethdev.c +1 -0
index 48d1333b1..be25e947e 100644
@@ -128,6 +128,7 @@ static const struct {
 	RTE_RX_OFFLOAD_BIT2STR(SCTP_CKSUM),
 	RTE_RX_OFFLOAD_BIT2STR(OUTER_UDP_CKSUM),
 	RTE_RX_OFFLOAD_BIT2STR(RSS_HASH),
+	RTE_RX_OFFLOAD_BIT2STR(ERR_PKT_DROP),
 };
 
 #undef RTE_RX_OFFLOAD_BIT2STR
lib/librte_ethdev/rte_ethdev.h +0 -0
index d2bf74f12..cb968d38a 100644
@@ -1194,6 +1194,16 @@ struct rte_intr_conf {
 	uint32_t rmv:1;
 };
 
Quoted 11 lines

lib/librte_ethdev/rte_ethdev.h struct rte_intr_conf { · line 1204

Quoted 8 lines
lib/librte_ethdev/rte_ethdev.h +8 -0
+/**
+ * A structure used to enable/disable error packet drop on RX.
+ */
+struct rte_rx_err_pkt_drop_conf {
+	/** enable/disable all RX error packet drop.
+	 * 0 (default) - disable, 1 enable
+	 */
+	uint32_t all:1;

"all" is bad. It should be granular and in the same terms as mask in dev_info capability.

Consider that application do not want to receive any error packets as it will drop all the error packets after increasing the error counter maintainer in the application. If same functionality can be done by the hardware where hardware maintains the error statistics, then why not have the same?
When hardware does parsing of packet headers and found error during that parsing, this is to say to HW - hey drop any such error packets which you found during parsing and just increase specific error counter (if present).

Quoted 2 lines

I agree, granular shall also be added, but as our driver does not support them, so I did not add those bits here.

There is always precise definition behind "all". You can report it in dev_info, an application can get it and use as is (all reported capability bits) in configuration.

Quoted 60 lines
Quoted 15 lines

lib/librte_ethdev/rte_ethdev.h struct rte_eth_conf { · line 1250

Quoted 13 lines
lib/librte_ethdev/rte_ethdev.h +4 -0
+};
+
 /**
  * A structure used to configure an Ethernet port.
  * Depending upon the RX multi-queue mode, extra advanced
@@ -1236,6 +1246,8 @@ struct rte_eth_conf {
 	uint32_t dcb_capability_en;
 	struct rte_fdir_conf fdir_conf; /**< FDIR configuration. DEPRECATED */
 	struct rte_intr_conf intr_conf; /**< Interrupt mode configuration. */
+	struct rte_rx_err_pkt_drop_conf err_pkt_drop_conf;
+	/**< RX error packet drop configuration. */

Why not per queue?

We do not support per queue configuration for error packet drop, but only on ethernet basis.

Quoted 40 lines
Quoted 13 lines
lib/librte_ethdev/rte_ethdev.h +1 -0
 };
 
 /**
@@ -1260,6 +1272,7 @@ struct rte_eth_conf {
 #define DEV_RX_OFFLOAD_SCTP_CKSUM	0x00020000
 #define DEV_RX_OFFLOAD_OUTER_UDP_CKSUM  0x00040000
 #define DEV_RX_OFFLOAD_RSS_HASH		0x00080000
+#define DEV_RX_OFFLOAD_ERR_PKT_DROP	0x00100000
 
 #define DEV_RX_OFFLOAD_CHECKSUM (DEV_RX_OFFLOAD_IPV4_CKSUM | \
 				 DEV_RX_OFFLOAD_UDP_CKSUM | \

lib/librte_ethdev/rte_ethdev.h struct rte_eth_conf { · line 1296

Quoted 10 lines
lib/librte_ethdev/rte_ethdev.h +7 -0
@@ -1274,6 +1287,13 @@ struct rte_eth_conf {
  * mentioned in rte_rx_offload_names in rte_ethdev.c file.
  */
 
+/**
+ * RX Error Drop offload config/capabilities of a device. These
+ * are valid only when RX capability DEV_RX_OFFLOAD_ERR_PKT_DROP
+ * is supported by the device.
+ */
+#define DEV_RX_ERR_PKT_DROP_OFFLOAD_ALL		0x00000001
+

I strictly dislike "all". It will always be bad defined. It must be granular.

Quoted 13 lines
lib/librte_ethdev/rte_ethdev.h +2 -0
 /**
  * TX offload capabilities of a device.
  */
@@ -1411,6 +1431,8 @@ struct rte_eth_dev_info {
 	/**< Device per-queue RX offload capabilities. */
 	uint64_t tx_queue_offload_capa;
 	/**< Device per-queue TX offload capabilities. */
+	uint64_t rx_err_drop_offload_capa;
+	/**< RX error packet drop offload capabilities. */
 	uint16_t reta_size;
 	/**< Device redirection table size, the total number of entries. */
 	uint8_t hash_key_size; /**< Hash key size in bytes */
#32 lore raw
Quoted 102 lines

-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Monday, October 12, 2020 5:53 PM
To: Nipun Gupta <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Hemant Agrawal <[email protected]>; Sachin Saxena <[email protected]>; Rohit Raj <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH 1/3 v3] ethdev: add rx offload to drop error packets

Quoted 7 lines · Nipun Gupta
Quoted 7 lines

-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Monday, October 12, 2020 1:32 PM
To: Nipun Gupta <[email protected]>; [email protected]
Cc: [email protected]; [email protected];

[email protected];

Quoted 67 lines
Quoted 55 lines

Hemant Agrawal <[email protected]>; Sachin Saxena <[email protected]>; Rohit Raj <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH 1/3 v3] ethdev: add rx offload to drop error packets

Quoted 48 lines · On 10/9/20 4:13 PM, [email protected] wrote:

From: Nipun Gupta <[email protected]>

This change adds a RX offload capability and configuration to enable hardware to drop the packets in case of any error in the packets such as L3 checksum error or L4 checksum.

---

v3:
- Add additional rx_err_drop_offload_capa, which is specific capability flag for RX packets error drop offload. Currently only 'all' error packet drops are enabled, but can be extended to provide capability to drop any specific errors like L1 FCS, L3 Checksum etc.
- Added separate config structure to enable the drop configuration.
- Updated doc with the new updated option in testbbdev (patch 3/3)

v2:
- Add support in DPAA1 driver (patch 2/3)
- Add support and config parameter in testpmd (patch 3/3)

 lib/librte_ethdev/rte_ethdev.c |  1 +
 lib/librte_ethdev/rte_ethdev.h | 22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+)
lib/librte_ethdev/rte_ethdev.c +1 -0
index 48d1333b1..be25e947e 100644
@@ -128,6 +128,7 @@ static const struct {
 	RTE_RX_OFFLOAD_BIT2STR(SCTP_CKSUM),
 	RTE_RX_OFFLOAD_BIT2STR(OUTER_UDP_CKSUM),
 	RTE_RX_OFFLOAD_BIT2STR(RSS_HASH),
+	RTE_RX_OFFLOAD_BIT2STR(ERR_PKT_DROP),
 };
 
 #undef RTE_RX_OFFLOAD_BIT2STR
lib/librte_ethdev/rte_ethdev.h +0 -0
index d2bf74f12..cb968d38a 100644
@@ -1194,6 +1194,16 @@ struct rte_intr_conf {
 	uint32_t rmv:1;
 };
 
Quoted 11 lines

lib/librte_ethdev/rte_ethdev.h struct rte_intr_conf { · line 1204

Quoted 8 lines
lib/librte_ethdev/rte_ethdev.h +8 -0
+/**
+ * A structure used to enable/disable error packet drop on RX.
+ */
+struct rte_rx_err_pkt_drop_conf {
+	/** enable/disable all RX error packet drop.
+	 * 0 (default) - disable, 1 enable
+	 */
+	uint32_t all:1;

"all" is bad. It should be granular and in the same terms as mask in dev_info capability.

Quoted 1 line

Consider that application do not want to receive any error packets as it will

drop all

Quoted 1 line

the error packets after increasing the error counter maintainer in the

application.

Quoted 1 line

If same functionality can be done by the hardware where hardware maintains

the error

Quoted 2 lines

statistics, then why not have the same?
When hardware does parsing of packet headers and found error during that

parsing,

Quoted 1 line

this is to say to HW - hey drop any such error packets which you found during

parsing

Quoted 2 lines

and just increase specific error counter (if present).

Quoted 7 lines
Quoted 1 line

I agree, granular shall also be added, but as our driver does not support them,

so I did

Quoted 1 line

not add those bits here.

There is always precise definition behind "all". You can report it in dev_info, an application can get it and use as is (all reported capability bits) in configuration.

Maybe Ill define individual error also (like l3_csum, l4_csum etc), and then 'all' will make more sense. It will indicate that all the bits are on irrespective of individual bits and can also be used in case if offload of individual error packet drops type is not supported, but dropping all of them can be supported.

Quoted 62 lines
Quoted 23 lines
Quoted 16 lines
Quoted 9 lines
lib/librte_ethdev/rte_ethdev.h +2 -0
+};
+
 /**
  * A structure used to configure an Ethernet port.
  * Depending upon the RX multi-queue mode, extra advanced

lib/librte_ethdev/rte_ethdev.h struct rte_eth_conf { · line 1250

Quoted 5 lines
lib/librte_ethdev/rte_ethdev.h +2 -0
@@ -1236,6 +1246,8 @@ struct rte_eth_conf {
 	uint32_t dcb_capability_en;
 	struct rte_fdir_conf fdir_conf; /**< FDIR configuration. DEPRECATED */
 	struct rte_intr_conf intr_conf; /**< Interrupt mode configuration. */
+	struct rte_rx_err_pkt_drop_conf err_pkt_drop_conf;
+	/**< RX error packet drop configuration. */

Why not per queue?

We do not support per queue configuration for error packet drop, but only on ethernet basis.

Quoted 3 lines
Quoted 3 lines
lib/librte_ethdev/rte_ethdev.h +0 -0
 };
 
Quoted 8 lines
Quoted 8 lines

lib/librte_ethdev/rte_ethdev.h struct rte_eth_conf { · line 1277

Quoted 8 lines
lib/librte_ethdev/rte_ethdev.h +1 -0
 /**
@@ -1260,6 +1272,7 @@ struct rte_eth_conf {
 #define DEV_RX_OFFLOAD_SCTP_CKSUM	0x00020000
 #define DEV_RX_OFFLOAD_OUTER_UDP_CKSUM  0x00040000
 #define DEV_RX_OFFLOAD_RSS_HASH		0x00080000
+#define DEV_RX_OFFLOAD_ERR_PKT_DROP	0x00100000
 
 #define DEV_RX_OFFLOAD_CHECKSUM (DEV_RX_OFFLOAD_IPV4_CKSUM |

\

Quoted 30 lines
Quoted 29 lines

lib/librte_ethdev/rte_ethdev.h struct rte_eth_conf { · line 1296

Quoted 12 lines
lib/librte_ethdev/rte_ethdev.h +7 -0
 				 DEV_RX_OFFLOAD_UDP_CKSUM | \
@@ -1274,6 +1287,13 @@ struct rte_eth_conf {
  * mentioned in rte_rx_offload_names in rte_ethdev.c file.
  */
 
+/**
+ * RX Error Drop offload config/capabilities of a device. These
+ * are valid only when RX capability DEV_RX_OFFLOAD_ERR_PKT_DROP
+ * is supported by the device.
+ */
+#define DEV_RX_ERR_PKT_DROP_OFFLOAD_ALL		0x00000001
+

I strictly dislike "all". It will always be bad defined. It must be granular.

Quoted 13 lines
lib/librte_ethdev/rte_ethdev.h +2 -0
 /**
  * TX offload capabilities of a device.
  */
@@ -1411,6 +1431,8 @@ struct rte_eth_dev_info {
 	/**< Device per-queue RX offload capabilities. */
 	uint64_t tx_queue_offload_capa;
 	/**< Device per-queue TX offload capabilities. */
+	uint64_t rx_err_drop_offload_capa;
+	/**< RX error packet drop offload capabilities. */
 	uint16_t reta_size;
 	/**< Device redirection table size, the total number of entries. */
 	uint8_t hash_key_size; /**< Hash key size in bytes */
#33 lore raw
In reply to Andrew Rybchenko
Quoted 15 lines · Andrew Rybchenko
Quoted 14 lines · Nipun Gupta
Quoted 14 lines

-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Monday, October 12, 2020 1:32 PM
To: Nipun Gupta <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Hemant Agrawal <[email protected]>; Sachin Saxena <[email protected]>; Rohit Raj <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH 1/3 v3] ethdev: add rx offload to drop error packets

Quoted 2 lines · On 10/9/20 4:13 PM, [email protected] wrote:

From: Nipun Gupta <[email protected]>

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

This change adds a RX offload capability and configuration to enable hardware to drop the packets in case of any error in the packets such as L3 checksum error or L4 checksum.

Thinking a bit more about it I agree with Thomas idea that it should be flow API based solution in fact. Drop is just a one of possible actions to be done with packets with bad checksum on one or another layer. Such packets could be redirected to a slow path (dedicated queue or port ID (PF, VF)).
It is just a missing feature in various layer pattern match to say if we want to proceed with packets with only good or only bad chehcksum (or we don't care as we do right now). Exact match for checksums is hardly useful except UDP with zero checksum case.

#34 lore raw
Quoted 38 lines

-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Tuesday, October 13, 2020 12:52 PM
To: Nipun Gupta <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; Hemant Agrawal <[email protected]>; Sachin Saxena <[email protected]>; Rohit Raj <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH 1/3 v3] ethdev: add rx offload to drop error packets

Quoted 6 lines · Andrew Rybchenko
Quoted 5 lines · Nipun Gupta
Quoted 5 lines

-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Monday, October 12, 2020 1:32 PM
To: Nipun Gupta <[email protected]>; [email protected]
Cc: [email protected]; [email protected];

[email protected];

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

Hemant Agrawal <[email protected]>; Sachin Saxena <[email protected]>; Rohit Raj <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH 1/3 v3] ethdev: add rx offload to drop error packets

Quoted 2 lines · On 10/9/20 4:13 PM, [email protected] wrote:

From: Nipun Gupta <[email protected]>

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

This change adds a RX offload capability and configuration to enable hardware to drop the packets in case of any error in the packets such as L3 checksum error or L4 checksum.

Quoted 11 lines

Thinking a bit more about it I agree with Thomas idea that it should be flow API based solution in fact. Drop is just a one of possible actions to be done with packets with bad checksum on one or another layer. Such packets could be redirected to a slow path (dedicated queue or port ID (PF, VF)).
It is just a missing feature in various layer pattern match to say if we want to proceed with packets with only good or only bad chehcksum (or we don't care as we do right now). Exact match for checksums is hardly useful except UDP with zero checksum case.

I would think of it applicable to both, i.e. it could fit in config option as well as in flow (e.g. RSS we also have as part of both config and flow). Having this in flow would increase usage like redirecting as you mentioned, and having in the config will increase utility when simple config like RSS is used without flow API's.

#35 lore raw
Quoted 50 lines · Nipun Gupta
Quoted 38 lines

-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Tuesday, October 13, 2020 12:52 PM
To: Nipun Gupta <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; Hemant Agrawal <[email protected]>; Sachin Saxena <[email protected]>; Rohit Raj <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH 1/3 v3] ethdev: add rx offload to drop error packets

Quoted 6 lines · Andrew Rybchenko
Quoted 5 lines · Nipun Gupta
Quoted 5 lines

-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Monday, October 12, 2020 1:32 PM
To: Nipun Gupta <[email protected]>; [email protected]
Cc: [email protected]; [email protected];

[email protected];

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

Hemant Agrawal <[email protected]>; Sachin Saxena <[email protected]>; Rohit Raj <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH 1/3 v3] ethdev: add rx offload to drop error packets

Quoted 2 lines · On 10/9/20 4:13 PM, [email protected] wrote:

From: Nipun Gupta <[email protected]>

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

This change adds a RX offload capability and configuration to enable hardware to drop the packets in case of any error in the packets such as L3 checksum error or L4 checksum.

Quoted 11 lines

Thinking a bit more about it I agree with Thomas idea that it should be flow API based solution in fact. Drop is just a one of possible actions to be done with packets with bad checksum on one or another layer. Such packets could be redirected to a slow path (dedicated queue or port ID (PF, VF)).
It is just a missing feature in various layer pattern match to say if we want to proceed with packets with only good or only bad chehcksum (or we don't care as we do right now). Exact match for checksums is hardly useful except UDP with zero checksum case.

Quoted 5 lines

I would think of it applicable to both, i.e. it could fit in config option as well as in flow (e.g. RSS we also have as part of both config and flow). Having this in flow would increase usage like redirecting as you mentioned, and having in the config will increase utility when simple config like RSS is used without flow API's.

I dislike the idea to have it on both layers.
It adds conflicts by design. It should be no duplication. That's why mirroring API is deprecated and will be removed since we have the functionality via flow API now.

#36 lore raw
Quoted 73 lines

-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Tuesday, October 13, 2020 1:21 PM
To: Nipun Gupta <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; Hemant Agrawal <[email protected]>; Sachin Saxena <[email protected]>; Rohit Raj <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH 1/3 v3] ethdev: add rx offload to drop error packets

Quoted 8 lines · Nipun Gupta
Quoted 8 lines

-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Tuesday, October 13, 2020 12:52 PM
To: Nipun Gupta <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; Hemant Agrawal <[email protected]>; Sachin Saxena <[email protected]>;

Rohit

Quoted 12 lines
Quoted 12 lines

Raj <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH 1/3 v3] ethdev: add rx offload to drop error packets

Quoted 6 lines · Andrew Rybchenko
Quoted 5 lines · Nipun Gupta
Quoted 5 lines

-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Monday, October 12, 2020 1:32 PM
To: Nipun Gupta <[email protected]>; [email protected]
Cc: [email protected]; [email protected];

Quoted 4 lines
Quoted 4 lines

[email protected];

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Hemant Agrawal <[email protected]>; Sachin Saxena <[email protected]>; Rohit Raj <[email protected]>; [email protected]; [email protected];

[email protected]

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Subject: Re: [dpdk-dev] [PATCH 1/3 v3] ethdev: add rx offload to drop

error

Quoted 25 lines
Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

packets

Quoted 2 lines · On 10/9/20 4:13 PM, [email protected] wrote:

From: Nipun Gupta <[email protected]>

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

This change adds a RX offload capability and configuration to enable hardware to drop the packets in case of any error in the packets such as L3 checksum error or L4 checksum.

Quoted 11 lines

Thinking a bit more about it I agree with Thomas idea that it should be flow API based solution in fact. Drop is just a one of possible actions to be done with packets with bad checksum on one or another layer. Such packets could be redirected to a slow path (dedicated queue or port ID (PF, VF)).
It is just a missing feature in various layer pattern match to say if we want to proceed with packets with only good or only bad chehcksum (or we don't care as we do right now). Exact match for checksums is hardly useful except UDP with zero checksum case.

Quoted 5 lines

I would think of it applicable to both, i.e. it could fit in config option as well as in flow (e.g. RSS we also have as part of both config and flow). Having this in flow would increase usage like redirecting as you mentioned, and having in the config will increase utility when simple config like RSS is used without flow API's.

Quoted 4 lines

I dislike the idea to have it on both layers.
It adds conflicts by design. It should be no duplication. That's why mirroring API is deprecated and will be removed since we have the functionality via flow API now.

I would like to agree, but looking at some general configuration which we have part of both config and flow like RSS packet distribution. It seems it is part of config too apart from flow and most sample applications using the same because of simplicity of use?
Seems stripping of VLAN is in similar lines: RTE_FLOW_ACTION_TYPE_OF_POP_VLAN and DEV_RX_OFFLOAD_VLAN_STRIP?

#37 lore raw

PATCH v4 1/3 ethdev: add Rx offload to drop error packets

In reply to Nipun Gupta

From: Nipun Gupta <[email protected]>

This change adds a Rx offload capability and configuration to enable hardware to drop the packets in case of any error in the packets such as L3 checksum error or L4 checksum.

---

v4:
- renamed 'rte_rx_err_pkt_drop_conf' to 'rte_eth_rx_err_pkt_drop_conf'
- updated function 'port_offload_cap_display' to display newly added offloads
- added placeholder for L1 FCS, L3 Checksum, L4 Checksum error packet drops
- updated doc/guides/nics/features.rst
- updated new added 'DEV_RX_OFFLOAD_*' to 'RTE_DEV_RX_OFFLOAD*'
- updated RX to Rx

v3:
- Add additional rx_err_drop_offload_capa, which is specific capability flag for RX packets error drop offload. Currently only 'all' error packet drops are enabled, but can be extended to provide capability to drop any specific errors like L1 FCS, L3 Checksum etc.
- Added separate config structure to enable the drop configuration.
- Updated doc with the new updated option in testbbdev (patch 3/3)

v2:
- Add support in DPAA1 driver (patch 2/3)
- Add support and config parameter in testpmd (patch 3/3)

 lib/librte_ethdev/rte_ethdev.c |  1 +
 lib/librte_ethdev/rte_ethdev.h | 39 +++++++++++++++++++++++++++++++++-
 2 files changed, 39 insertions(+), 1 deletion(-)
lib/librte_ethdev/rte_ethdev.c +1 -0
index 48d1333b1..be25e947e 100644
@@ -128,6 +128,7 @@ static const struct {
 	RTE_RX_OFFLOAD_BIT2STR(SCTP_CKSUM),
 	RTE_RX_OFFLOAD_BIT2STR(OUTER_UDP_CKSUM),
 	RTE_RX_OFFLOAD_BIT2STR(RSS_HASH),
+	RTE_RX_OFFLOAD_BIT2STR(ERR_PKT_DROP),
 };
 
 #undef RTE_RX_OFFLOAD_BIT2STR
lib/librte_ethdev/rte_ethdev.h +38 -1
index d2bf74f12..0db4b4021 100644
@@ -1194,6 +1194,28 @@ struct rte_intr_conf {
 	uint32_t rmv:1;
 };
 
+/**
+ * A structure used to enable/disable error packet drop on Rx.
+ */
+struct rte_eth_rx_err_pkt_drop_conf {
+	/** enable/disable L1 FSC error packet drop on Rx.
+	 * 0 (default) - disable, 1 enable
+	 */
+	uint32_t l1_fcs:1;
+	/** enable/disable L3 Checksum error packet drop on Rx.
+	 * 0 (default) - disable, 1 enable
+	 */
+	uint32_t l3_csum:1;
+	/** enable/disable L4 Checksum error packet drop on Rx.
+	 * 0 (default) - disable, 1 enable
+	 */
+	uint32_t l4_csum:1;
+	/** enable/disable all Rx error packet drop.
+	 * 0 (default) - disable, 1 enable
+	 */
+	uint32_t all:1;
+};
+
 /**
  * A structure used to configure an Ethernet port.
  * Depending upon the RX multi-queue mode, extra advanced
@@ -1236,10 +1258,12 @@ struct rte_eth_conf {
 	uint32_t dcb_capability_en;
 	struct rte_fdir_conf fdir_conf; /**< FDIR configuration. DEPRECATED */
 	struct rte_intr_conf intr_conf; /**< Interrupt mode configuration. */
+	struct rte_eth_rx_err_pkt_drop_conf err_pkt_drop_conf;
+	/**< Rx error packet drop configuration. */
 };
 
 /**
- * RX offload capabilities of a device.
+ * Rx offload capabilities of a device.
  */
 #define DEV_RX_OFFLOAD_VLAN_STRIP  0x00000001
 #define DEV_RX_OFFLOAD_IPV4_CKSUM  0x00000002
@@ -1260,6 +1284,7 @@ struct rte_eth_conf {
 #define DEV_RX_OFFLOAD_SCTP_CKSUM	0x00020000
 #define DEV_RX_OFFLOAD_OUTER_UDP_CKSUM  0x00040000
 #define DEV_RX_OFFLOAD_RSS_HASH		0x00080000
+#define DEV_RX_OFFLOAD_ERR_PKT_DROP	0x00100000
 
 #define DEV_RX_OFFLOAD_CHECKSUM (DEV_RX_OFFLOAD_IPV4_CKSUM | \
 				 DEV_RX_OFFLOAD_UDP_CKSUM | \
@@ -1274,6 +1299,16 @@ struct rte_eth_conf {
  * mentioned in rte_rx_offload_names in rte_ethdev.c file.
  */
 
+/**
+ * Rx Error Drop offload config/capabilities of a device. These
+ * are valid only when Rx capability RTE_DEV_RX_OFFLOAD_ERR_PKT_DROP
+ * is supported by the device.
+ */
+#define RTE_DEV_RX_ERR_PKT_DROP_OFFLOAD_L1_FCS		0x00000001
+#define RTE_DEV_RX_ERR_PKT_DROP_OFFLOAD_L3_CSUM		0x00000002
+#define RTE_DEV_RX_ERR_PKT_DROP_OFFLOAD_L4_CSUM		0x00000004
+#define RTE_DEV_RX_ERR_PKT_DROP_OFFLOAD_ALL		0x80000000
+
 /**
  * TX offload capabilities of a device.
  */
@@ -1411,6 +1446,8 @@ struct rte_eth_dev_info {
 	/**< Device per-queue RX offload capabilities. */
 	uint64_t tx_queue_offload_capa;
 	/**< Device per-queue TX offload capabilities. */
+	uint64_t rx_err_drop_offload_capa;
+	/**< RX error packet drop offload capabilities. */
 	uint16_t reta_size;
 	/**< Device redirection table size, the total number of entries. */
 	uint8_t hash_key_size; /**< Hash key size in bytes */
Signature · 1 line
2.17.1
#38 lore raw

PATCH v4 2/3 net/dpaa: support Rx offload for error packet drop

From: Nipun Gupta <[email protected]>

This patch supports Rx offload configuration to drop error packets in the hardware

---
 drivers/bus/dpaa/base/fman/fman_hw.c |  7 ++++++-
 drivers/net/dpaa/dpaa_ethdev.c       | 23 +++++++++++++++++++----
 2 files changed, 25 insertions(+), 5 deletions(-)
drivers/bus/dpaa/base/fman/fman_hw.c +6 -1
index 4ab49f785..40e4e0000 100644
@@ -597,7 +597,12 @@ void
 fman_if_discard_rx_errors(struct fman_if *fm_if)
 {
 	struct __fman_if *__if = container_of(fm_if, struct __fman_if, __if);
-	unsigned int *fmbm_rfsdm, *fmbm_rfsem;
+	unsigned int *fmbm_rcfg, *fmbm_rfsdm, *fmbm_rfsem;
+	unsigned int val;
+
+	fmbm_rcfg = &((struct rx_bmi_regs *)__if->bmi_map)->fmbm_rcfg;
+	val = in_be32(fmbm_rcfg);
+	out_be32(fmbm_rcfg, val & ~BMI_PORT_CFG_FDOVR);
 
 	fmbm_rfsem = &((struct rx_bmi_regs *)__if->bmi_map)->fmbm_rfsem;
 	out_be32(fmbm_rfsem, 0);
drivers/net/dpaa/dpaa_ethdev.c +19 -4
index af47c196a..b9cfc4fb3 100644
@@ -52,7 +52,8 @@
 /* Supported Rx offloads */
 static uint64_t dev_rx_offloads_sup =
 		DEV_RX_OFFLOAD_JUMBO_FRAME |
-		DEV_RX_OFFLOAD_SCATTER;
+		DEV_RX_OFFLOAD_SCATTER |
+		DEV_RX_OFFLOAD_ERR_PKT_DROP;
 
 /* Rx offloads which cannot be disabled */
 static uint64_t dev_rx_offloads_nodis =
@@ -62,6 +63,10 @@ static uint64_t dev_rx_offloads_nodis =
 		DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM |
 		DEV_RX_OFFLOAD_RSS_HASH;
 
+/* Supported Rx Error packet drop offload */
+static uint64_t dev_rx_err_drop_offloads_sup =
+		RTE_DEV_RX_ERR_PKT_DROP_OFFLOAD_ALL;
+
 /* Supported Tx offloads */
 static uint64_t dev_tx_offloads_sup =
 		DEV_TX_OFFLOAD_MT_LOCKFREE |
@@ -262,6 +267,18 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
 		dev->data->scattered_rx = 1;
 	}
 
+	if (eth_conf->err_pkt_drop_conf.all) {
+		DPAA_PMD_DEBUG("error packets will be dropped on hw");
+		fman_if_discard_rx_errors(fif);
+	} else {
+		struct dpaa_if *dpaa_intf = dev->data->dev_private;
+		struct qman_fq *rxq = &dpaa_intf->rx_queues[0];
+
+		DPAA_PMD_DEBUG("error packets will not be dropped on hw");
+		fman_if_receive_rx_errors(fif, FM_FD_RX_STATUS_ERR_MASK);
+		fman_if_set_err_fqid(fif, rxq->fqid);
+	}
+
 	if (!(default_q || fmc_q)) {
 		if (dpaa_fm_config(dev,
 			eth_conf->rx_adv_conf.rss_conf.rss_hf)) {
@@ -591,6 +608,7 @@ static int dpaa_eth_dev_info(struct rte_eth_dev *dev,
 					dev_rx_offloads_nodis;
 	dev_info->tx_offload_capa = dev_tx_offloads_sup |
 					dev_tx_offloads_nodis;
+	dev_info->rx_err_drop_offload_capa = dev_rx_err_drop_offloads_sup;
 	dev_info->default_rxportconf.burst_size = DPAA_DEF_RX_BURST_SIZE;
 	dev_info->default_txportconf.burst_size = DPAA_DEF_TX_BURST_SIZE;
 	dev_info->default_rxportconf.nb_queues = 1;
@@ -2085,9 +2103,6 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 		fman_intf->mac_addr.addr_bytes[5]);
 
 	if (!fman_intf->is_shared_mac) {
-		/* Configure error packet handling */
-		fman_if_receive_rx_errors(fman_intf,
-			FM_FD_RX_STATUS_ERR_MASK);
 		/* Disable RX mode */
 		fman_if_disable_rx(fman_intf);
 		/* Disable promiscuous mode */
Signature · 1 line
2.17.1
#39 lore raw

PATCH v4 3/3 app/testpmd: support hardware offload to drop error packets

In reply to [email protected]

From: Nipun Gupta <[email protected]>

With DEV_RX_OFFLOAD_ERR_PKT_DROP now defined as an offload capability, and separate RTE_DEV_RX_ERR_PKT_DROP_OFFLOAD_ALL capability to drop all error packets in hardware, testpmd showcases this with a new added configuration option 'enable-hw-drop-err-all'.

---
 app/test-pmd/config.c                 | 35 +++++++++++++++++++++
 app/test-pmd/parameters.c             |  7 +++++
 app/test-pmd/testpmd.c                |  8 +++++
 app/test-pmd/testpmd.h                |  1 +
 doc/guides/nics/features.rst          | 44 +++++++++++++++++++++++++++
 doc/guides/testpmd_app_ug/run_app.rst |  4 +++
 6 files changed, 99 insertions(+)
app/test-pmd/config.c +35 -0
index e73dc66c8..14ef4e468 100644
@@ -1027,6 +1027,41 @@ port_offload_cap_display(portid_t port_id)
 			printf("off\n");
 	}
 
+	if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_ERR_PKT_DROP) {
+		if (dev_info.rx_err_drop_offload_capa &
+			RTE_DEV_RX_ERR_PKT_DROP_OFFLOAD_L1_FCS) {
+			printf("RX L1 FCS Error pkt drop:      ");
+			if (ports[port_id].dev_conf.err_pkt_drop_conf.l1_fcs)
+				printf("on\n");
+			else
+				printf("off\n");
+		}
+		if (dev_info.rx_err_drop_offload_capa &
+			RTE_DEV_RX_ERR_PKT_DROP_OFFLOAD_L3_CSUM) {
+			printf("RX L3 Csum Error pkt drop:     ");
+			if (ports[port_id].dev_conf.err_pkt_drop_conf.l3_csum)
+				printf("on\n");
+			else
+				printf("off\n");
+		}
+		if (dev_info.rx_err_drop_offload_capa &
+			RTE_DEV_RX_ERR_PKT_DROP_OFFLOAD_L4_CSUM) {
+			printf("RX L4 Csum Error pkt drop:     ");
+			if (ports[port_id].dev_conf.err_pkt_drop_conf.l4_csum)
+				printf("on\n");
+			else
+				printf("off\n");
+		}
+		if (dev_info.rx_err_drop_offload_capa &
+			RTE_DEV_RX_ERR_PKT_DROP_OFFLOAD_ALL) {
+			printf("RX all Error pkt drop:         ");
+			if (ports[port_id].dev_conf.err_pkt_drop_conf.all)
+				printf("on\n");
+			else
+				printf("off\n");
+		}
+	}
+
 	if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) {
 		printf("VLAN insert:                   ");
 		if (ports[port_id].dev_conf.txmode.offloads &
app/test-pmd/parameters.c +7 -0
index 1ead59579..508612426 100644
@@ -142,6 +142,7 @@ usage(char* progname)
 	printf("  --enable-hw-vlan-strip: enable hardware vlan strip.\n");
 	printf("  --enable-hw-vlan-extend: enable hardware vlan extend.\n");
 	printf("  --enable-hw-qinq-strip: enable hardware qinq strip.\n");
+	printf("  --enable-hw-drop-err-all: enable hardware packet drop for all error packets.\n");
 	printf("  --enable-drop-en: enable per queue packet drop.\n");
 	printf("  --disable-rss: disable rss.\n");
 	printf("  --port-topology=<paired|chained|loop>: set port topology (paired "
@@ -631,6 +632,7 @@ launch_args_parse(int argc, char** argv)
 		{ "enable-hw-vlan-strip",       0, 0, 0 },
 		{ "enable-hw-vlan-extend",      0, 0, 0 },
 		{ "enable-hw-qinq-strip",       0, 0, 0 },
+		{ "enable-hw-drop-err-all",     0, 0, 0 },
 		{ "enable-drop-en",            0, 0, 0 },
 		{ "disable-rss",                0, 0, 0 },
 		{ "port-topology",              1, 0, 0 },
@@ -1283,6 +1285,11 @@ launch_args_parse(int argc, char** argv)
 				rmv_interrupt = 0;
 			if (!strcmp(lgopts[opt_idx].name, "flow-isolate-all"))
 				flow_isolate_all = 1;
+			if (!strcmp(lgopts[opt_idx].name,
+					"enable-hw-drop-err-all")) {
+				rx_err_pkt_drop_all = 1;
+			}
+
 			if (!strcmp(lgopts[opt_idx].name, "tx-offloads")) {
 				char *end = NULL;
 				n = strtoull(optarg, &end, 16);
app/test-pmd/testpmd.c +8 -0
index ccba71c07..c9e7397e6 100644
@@ -359,6 +359,11 @@ uint8_t lsc_interrupt = 1; /* enabled by default */
  */
 uint8_t rmv_interrupt = 1; /* enabled by default */
 
+/*
+ * Drop all RX error packets on HW itself.
+ */
+uint8_t rx_err_pkt_drop_all = 0; /* disabled by default */
+
 uint8_t hot_plug = 0; /**< hotplug disabled by default. */
 
 /* After attach, port setup is called on event or by iterator */
@@ -3359,6 +3364,9 @@ init_port_config(void)
 		    (rte_eth_devices[pid].data->dev_flags &
 		     RTE_ETH_DEV_INTR_RMV))
 			port->dev_conf.intr_conf.rmv = 1;
+
+		if (rx_err_pkt_drop_all)
+			port->dev_conf.err_pkt_drop_conf.all = 1;
 	}
 }
 
app/test-pmd/testpmd.h +1 -0
index c7e7e41a9..eab154ed4 100644
@@ -314,6 +314,7 @@ extern uint8_t no_device_start; /**<set by "--disable-device-start" parameter */
 extern volatile int test_done; /* stop packet forwarding when set to 1. */
 extern uint8_t lsc_interrupt; /**< disabled by "--no-lsc-interrupt" parameter */
 extern uint8_t rmv_interrupt; /**< disabled by "--no-rmv-interrupt" parameter */
+extern uint8_t rx_err_pkt_drop_all; /**< enabled by "--enable-hw-drop-err-all" parameter */
 extern uint32_t event_print_mask;
 /**< set by "--print-event xxxx" and "--mask-event xxxx parameters */
 extern bool setup_on_probe_event; /**< disabled by port setup-on iterator */
doc/guides/nics/features.rst +44 -0

50 lines not on this page · raw message

doc/guides/testpmd_app_ug/run_app.rst +4 -0
index e2539f693..20f2f8083 100644
@@ -213,6 +213,10 @@ The command line options are:
 
     Enable hardware QINQ strip.
 
+*  ``--enable-hw-drop-err-all``
+
+    Enable hardware packet drop for any error packets
+
 *   ``--enable-drop-en``
 
     Enable per-queue packet drop for packets with no descriptors.
Signature · 1 line
2.17.1
Reviewed-by on v4 3/3
#40 lore raw

Re: [dpdk-dev] [PATCH 3/3 v4] app/testpmd: support hardware offload to drop error packets

Hi Nipun,

Some nits. Looks good otherwise.

Quoted 87 lines · On Oct 15, 2020, at 8:23 AM, [email protected] <[email protected]> wrote:

From: Nipun Gupta <[email protected]>

With DEV_RX_OFFLOAD_ERR_PKT_DROP now defined as an offload capability, and separate RTE_DEV_RX_ERR_PKT_DROP_OFFLOAD_ALL capability to drop all error packets in hardware, testpmd showcases this with a new added configuration option 'enable-hw-drop-err-all'.

---

app/test-pmd/config.c                 | 35 +++++++++++++++++++++
app/test-pmd/parameters.c             |  7 +++++
app/test-pmd/testpmd.c                |  8 +++++
app/test-pmd/testpmd.h                |  1 +
doc/guides/nics/features.rst          | 44 +++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/run_app.rst |  4 +++
6 files changed, 99 insertions(+)
app/test-pmd/config.c +35 -0
index e73dc66c8..14ef4e468 100644
@@ -1027,6 +1027,41 @@ port_offload_cap_display(portid_t port_id)
 			printf("off\n");
 	}
 
+	if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_ERR_PKT_DROP) {
+		if (dev_info.rx_err_drop_offload_capa &
+			RTE_DEV_RX_ERR_PKT_DROP_OFFLOAD_L1_FCS) {
+			printf("RX L1 FCS Error pkt drop:      ");
+			if (ports[port_id].dev_conf.err_pkt_drop_conf.l1_fcs)
+				printf("on\n");
+			else
+				printf("off\n");
+		}
+		if (dev_info.rx_err_drop_offload_capa &
+			RTE_DEV_RX_ERR_PKT_DROP_OFFLOAD_L3_CSUM) {
+			printf("RX L3 Csum Error pkt drop:     ");
+			if (ports[port_id].dev_conf.err_pkt_drop_conf.l3_csum)
+				printf("on\n");
+			else
+				printf("off\n");
+		}
+		if (dev_info.rx_err_drop_offload_capa &
+			RTE_DEV_RX_ERR_PKT_DROP_OFFLOAD_L4_CSUM) {
+			printf("RX L4 Csum Error pkt drop:     ");
+			if (ports[port_id].dev_conf.err_pkt_drop_conf.l4_csum)
+				printf("on\n");
+			else
+				printf("off\n");
+		}
+		if (dev_info.rx_err_drop_offload_capa &
+			RTE_DEV_RX_ERR_PKT_DROP_OFFLOAD_ALL) {
+			printf("RX all Error pkt drop:         ");
+			if (ports[port_id].dev_conf.err_pkt_drop_conf.all)
+				printf("on\n");
+			else
+				printf("off\n");
+		}
+	}
+
 	if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) {
 		printf("VLAN insert:                   ");
 		if (ports[port_id].dev_conf.txmode.offloads &
app/test-pmd/parameters.c +2 -0
index 1ead59579..508612426 100644
@@ -142,6 +142,7 @@ usage(char* progname)
 	printf("  --enable-hw-vlan-strip: enable hardware vlan strip.\n");
 	printf("  --enable-hw-vlan-extend: enable hardware vlan extend.\n");
 	printf("  --enable-hw-qinq-strip: enable hardware qinq strip.\n");
+	printf("  --enable-hw-drop-err-all: enable hardware packet drop for all error packets.\n");
 	printf("  --enable-drop-en: enable per queue packet drop.\n");
 	printf("  --disable-rss: disable rss.\n");
 	printf("  --port-topology=<paired|chained|loop>: set port topology (paired "
@@ -631,6 +632,7 @@ launch_args_parse(int argc, char** argv)
 		{ "enable-hw-vlan-strip",       0, 0, 0 },
 		{ "enable-hw-vlan-extend",      0, 0, 0 },
 		{ "enable-hw-qinq-strip",       0, 0, 0 },
+		{ "enable-hw-drop-err-all",     0, 0, 0 },
 		{ "enable-drop-en",            0, 0, 0 },
 		{ "disable-rss",                0, 0, 0 },
 		{ "port-topology",              1, 0, 0 },

app/test-pmd/parameters.c launch_args_parse(int argc, char** argv) · line 1291

Quoted 7 lines
app/test-pmd/parameters.c +4 -0
@@ -1283,6 +1285,11 @@ launch_args_parse(int argc, char** argv)
 				rmv_interrupt = 0;
 			if (!strcmp(lgopts[opt_idx].name, "flow-isolate-all"))
 				flow_isolate_all = 1;
+			if (!strcmp(lgopts[opt_idx].name,
+					"enable-hw-drop-err-all")) {
+				rx_err_pkt_drop_all = 1;
+			}

{ } can be removed.

Quoted 12 lines
app/test-pmd/parameters.c +1 -0
+
 			if (!strcmp(lgopts[opt_idx].name, "tx-offloads")) {
 				char *end = NULL;
 				n = strtoull(optarg, &end, 16);
app/test-pmd/testpmd.c +0 -0
index ccba71c07..c9e7397e6 100644
@@ -359,6 +359,11 @@ uint8_t lsc_interrupt = 1; /* enabled by default */
 */

uint8_t rmv_interrupt = 1; /* enabled by default */

app/test-pmd/testpmd.c uint8_t lsc_interrupt = 1; /* enabled by default */ · line 365

Quoted 4 lines
app/test-pmd/testpmd.c +4 -0
+/*
+ * Drop all RX error packets on HW itself.
+ */
+uint8_t rx_err_pkt_drop_all = 0; /* disabled by default */

= 0 can be removed.

Quoted 63 lines

+
uint8_t hot_plug = 0; /**< hotplug disabled by default. */

/* After attach, port setup is called on event or by iterator */

app/test-pmd/testpmd.c +3 -0
@@ -3359,6 +3364,9 @@ init_port_config(void)
 		    (rte_eth_devices[pid].data->dev_flags &
 		     RTE_ETH_DEV_INTR_RMV))
 			port->dev_conf.intr_conf.rmv = 1;
+
+		if (rx_err_pkt_drop_all)
+			port->dev_conf.err_pkt_drop_conf.all = 1;
 	}
 }
 
app/test-pmd/testpmd.h +0 -0
index c7e7e41a9..eab154ed4 100644
@@ -314,6 +314,7 @@ extern uint8_t no_device_start; /**<set by "--disable-device-start" parameter */

extern volatile int test_done; /* stop packet forwarding when set to 1. */ extern uint8_t lsc_interrupt; /**< disabled by "--no-lsc-interrupt" parameter */ extern uint8_t rmv_interrupt; /**< disabled by "--no-rmv-interrupt" parameter */ +extern uint8_t rx_err_pkt_drop_all; /**< enabled by "--enable-hw-drop-err-all" parameter */ extern uint32_t event_print_mask;
/**< set by "--print-event xxxx" and "--mask-event xxxx parameters */
extern bool setup_on_probe_event; /**< disabled by port setup-on iterator */

doc/guides/nics/features.rst +29 -0
index dd8c9555b..cb7fdfd8b 100644
@@ -606,6 +606,50 @@ Supports inner packet L4 checksum.
  ``tx_offload_capa,tx_queue_offload_capa:DEV_TX_OFFLOAD_OUTER_UDP_CKSUM``.
 
 
+.. _nic_features_l1_fcs_rx_error_packet_drop:
+
+L1 FCS Error Packet drop on Rx
+------------------------------
+
+Supports dropping of packets having L1 FCS error on Rx.
+
+* **[uses]     user config**: ``dev_conf.err_pkt_drop_conf.l1_fcs``.
+* **[provides] rte_eth_dev_info**: ``rx_err_drop_offload_capa:RTE_DEV_RX_ERR_PKT_DROP_OFFLOAD_L1_FCS``.
+
+
+.. _nic_features_l3_csum_rx_error_packet_drop:
+
+L3 checksum Error Packet drop on Rx
+-----------------------------------
+
+Supports dropping of packets having L3 Checksum error on Rx.
+
+* **[uses]     user config**: ``dev_conf.err_pkt_drop_conf.l3_csum``.
+* **[provides] rte_eth_dev_info**: ``rx_err_drop_offload_capa:RTE_DEV_RX_ERR_PKT_DROP_OFFLOAD_L3_CSUM``.
+
+
+.. _nic_features_l4_csum_rx_error_packet_drop:
+
+L4 Checksum Error Packet drop on Rx
+-----------------------------------
+
+Supports dropping of packets having L1 FCS error on Rx.
+

doc/guides/nics/features.rst Supports inner packet L4 checksum. · line 647

Quoted 10 lines
doc/guides/nics/features.rst +10 -0
+* **[uses]     user config**: ``dev_conf.err_pkt_drop_conf.l4_csum``.
+* **[provides] rte_eth_dev_info**: ``rx_err_drop_offload_capa:RTE_DEV_RX_ERR_PKT_DROP_OFFLOAD_L4_CSUM``.
+
+
+.. _nic_features_all_rx_error_packet_drop:
+
+All/any Error Packet drop on Rx
+-------------------------------
+
+Supports dropping of packets having any of the errors like L1 FSC, L3/L4 Checksum on Rx.

s/FSC/FCS

Quoted 23 lines
doc/guides/nics/features.rst +5 -0
+
+* **[uses]     user config**: ``dev_conf.err_pkt_drop_conf.all``.
+* **[provides] rte_eth_dev_info**: ``rx_err_drop_offload_capa:RTE_DEV_RX_ERR_PKT_DROP_OFFLOAD_ALL``.
+
+

.. _nic_features_packet_type_parsing:

Packet type parsing

doc/guides/testpmd_app_ug/run_app.rst +4 -0
index e2539f693..20f2f8083 100644
@@ -213,6 +213,10 @@ The command line options are:
 
    Enable hardware QINQ strip.
 
+*  ``--enable-hw-drop-err-all``
+
+    Enable hardware packet drop for any error packets
+
 *   ``--enable-drop-en``
 
    Enable per-queue packet drop for packets with no descriptors.
Quoted 3 lines

—
2.17.1

#41 lore raw

Re: [dpdk-dev] [PATCH 3/3 v4] app/testpmd: support hardware offload to drop error packets

Quoted 110 lines

-----Original Message-----
From: Dharmik Thakkar <[email protected]>
Sent: Thursday, October 29, 2020 10:52 PM
To: Nipun Gupta <[email protected]>
Cc: dev <[email protected]>; [email protected]; Ferruh Yigit <[email protected]>; [email protected]; Hemant Agrawal <[email protected]>; Sachin Saxena <[email protected]>; Rohit Raj <[email protected]>; Jerin Jacob <[email protected]>; Stephen Hemminger <[email protected]>; [email protected]; nd <[email protected]>
Subject: Re: [dpdk-dev] [PATCH 3/3 v4] app/testpmd: support hardware offload to drop error packets

Hi Nipun,

Some nits. Looks good otherwise.

Quoted 1 line

On Oct 15, 2020, at 8:23 AM, [email protected] <[email protected]>

Quoted 70 lines · wrote:

From: Nipun Gupta <[email protected]>

With DEV_RX_OFFLOAD_ERR_PKT_DROP now defined as an offload capability, and separate RTE_DEV_RX_ERR_PKT_DROP_OFFLOAD_ALL capability to drop all error packets in hardware, testpmd showcases this with a new added configuration option 'enable-hw-drop-err-all'.

---

app/test-pmd/config.c                 | 35 +++++++++++++++++++++
app/test-pmd/parameters.c             |  7 +++++
app/test-pmd/testpmd.c                |  8 +++++
app/test-pmd/testpmd.h                |  1 +
doc/guides/nics/features.rst          | 44 +++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/run_app.rst |  4 +++
6 files changed, 99 insertions(+)
app/test-pmd/config.c +35 -0
index e73dc66c8..14ef4e468 100644
@@ -1027,6 +1027,41 @@ port_offload_cap_display(portid_t port_id)
 			printf("off\n");
 	}
 
+	if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_ERR_PKT_DROP) {
+		if (dev_info.rx_err_drop_offload_capa &
+			RTE_DEV_RX_ERR_PKT_DROP_OFFLOAD_L1_FCS) {
+			printf("RX L1 FCS Error pkt drop:      ");
+			if (ports[port_id].dev_conf.err_pkt_drop_conf.l1_fcs)
+				printf("on\n");
+			else
+				printf("off\n");
+		}
+		if (dev_info.rx_err_drop_offload_capa &
+			RTE_DEV_RX_ERR_PKT_DROP_OFFLOAD_L3_CSUM) {
+			printf("RX L3 Csum Error pkt drop:     ");
+			if (ports[port_id].dev_conf.err_pkt_drop_conf.l3_csum)
+				printf("on\n");
+			else
+				printf("off\n");
+		}
+		if (dev_info.rx_err_drop_offload_capa &
+			RTE_DEV_RX_ERR_PKT_DROP_OFFLOAD_L4_CSUM) {
+			printf("RX L4 Csum Error pkt drop:     ");
+			if (ports[port_id].dev_conf.err_pkt_drop_conf.l4_csum)
+				printf("on\n");
+			else
+				printf("off\n");
+		}
+		if (dev_info.rx_err_drop_offload_capa &
+			RTE_DEV_RX_ERR_PKT_DROP_OFFLOAD_ALL) {
+			printf("RX all Error pkt drop:         ");
+			if (ports[port_id].dev_conf.err_pkt_drop_conf.all)
+				printf("on\n");
+			else
+				printf("off\n");
+		}
+	}
+
 	if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) {
 		printf("VLAN insert:                   ");
 		if (ports[port_id].dev_conf.txmode.offloads &
app/test-pmd/parameters.c +0 -0
index 1ead59579..508612426 100644

app/test-pmd/parameters.c usage(char* progname) · line 145

Quoted 4 lines
app/test-pmd/parameters.c +1 -0
@@ -142,6 +142,7 @@ usage(char* progname)
 	printf("  --enable-hw-vlan-strip: enable hardware vlan strip.\n");
 	printf("  --enable-hw-vlan-extend: enable hardware vlan extend.\n");
 	printf("  --enable-hw-qinq-strip: enable hardware qinq strip.\n");
+	printf("  --enable-hw-drop-err-all: enable hardware packet drop for all

error packets.\n");

app/test-pmd/parameters.c usage(char* progname)

Quoted 3 lines
app/test-pmd/parameters.c +0 -0
 	printf("  --enable-drop-en: enable per queue packet drop.\n");
 	printf("  --disable-rss: disable rss.\n");
 	printf("  --port-topology=<paired|chained|loop>: set port topology

(paired "

Quoted 10 lines
app/test-pmd/parameters.c +1 -0
@@ -631,6 +632,7 @@ launch_args_parse(int argc, char** argv)
 		{ "enable-hw-vlan-strip",       0, 0, 0 },
 		{ "enable-hw-vlan-extend",      0, 0, 0 },
 		{ "enable-hw-qinq-strip",       0, 0, 0 },
+		{ "enable-hw-drop-err-all",     0, 0, 0 },
 		{ "enable-drop-en",            0, 0, 0 },
 		{ "disable-rss",                0, 0, 0 },
 		{ "port-topology",              1, 0, 0 },
@@ -1283,6 +1285,11 @@ launch_args_parse(int argc, char** argv)
 				rmv_interrupt = 0;
Quoted 8 lines

app/test-pmd/parameters.c launch_args_parse(int argc, char** argv) · line 1291

Quoted 6 lines
app/test-pmd/parameters.c +4 -0
 			if (!strcmp(lgopts[opt_idx].name, "flow-isolate-all"))
 				flow_isolate_all = 1;
+			if (!strcmp(lgopts[opt_idx].name,
+					"enable-hw-drop-err-all")) {
+				rx_err_pkt_drop_all = 1;
+			}

{ } can be removed.

Agree.

Quoted 13 lines
Quoted 13 lines
app/test-pmd/parameters.c +1 -0
+
 			if (!strcmp(lgopts[opt_idx].name, "tx-offloads")) {
 				char *end = NULL;
 				n = strtoull(optarg, &end, 16);
app/test-pmd/testpmd.c +0 -0
index ccba71c07..c9e7397e6 100644
@@ -359,6 +359,11 @@ uint8_t lsc_interrupt = 1; /* enabled by default */
 */

uint8_t rmv_interrupt = 1; /* enabled by default */

Quoted 6 lines

app/test-pmd/testpmd.c uint8_t lsc_interrupt = 1; /* enabled by default */ · line 365

Quoted 4 lines
app/test-pmd/testpmd.c +4 -0
+/*
+ * Drop all RX error packets on HW itself.
+ */
+uint8_t rx_err_pkt_drop_all = 0; /* disabled by default */

= 0 can be removed.

This is on all the other default disabled parameters too probably to show that they are disabled by default. So I would prefer to keep it like this.

Quoted 86 lines

app/test-pmd/testpmd.h extern uint8_t no_device_start; /**<set by "--disable-

Quoted 20 lines

+
uint8_t hot_plug = 0; /**< hotplug disabled by default. */

/* After attach, port setup is called on event or by iterator */

app/test-pmd/testpmd.c +3 -0
@@ -3359,6 +3364,9 @@ init_port_config(void)
 		    (rte_eth_devices[pid].data->dev_flags &
 		     RTE_ETH_DEV_INTR_RMV))
 			port->dev_conf.intr_conf.rmv = 1;
+
+		if (rx_err_pkt_drop_all)
+			port->dev_conf.err_pkt_drop_conf.all = 1;
 	}
 }
 
app/test-pmd/testpmd.h +0 -0
index c7e7e41a9..eab154ed4 100644
@@ -314,6 +314,7 @@ extern uint8_t no_device_start; /**<set by "--disable-

device-start" parameter */

Quoted 3 lines

extern volatile int test_done; /* stop packet forwarding when set to 1. */ extern uint8_t lsc_interrupt; /**< disabled by "--no-lsc-interrupt" parameter */ extern uint8_t rmv_interrupt; /**< disabled by "--no-rmv-interrupt" parameter

*/

Quoted 1 line

+extern uint8_t rx_err_pkt_drop_all; /**< enabled by "--enable-hw-drop-err-

all" parameter */

doc/guides/nics/features.rst Supports inner packet L4 checksum. · line 606

Quoted 9 lines

extern uint32_t event_print_mask;
/**< set by "--print-event xxxx" and "--mask-event xxxx parameters */ extern bool setup_on_probe_event; /**< disabled by port setup-on iterator */

doc/guides/nics/features.rst +0 -0
index dd8c9555b..cb7fdfd8b 100644
@@ -606,6 +606,50 @@ Supports inner packet L4 checksum.
 

``tx_offload_capa,tx_queue_offload_capa:DEV_TX_OFFLOAD_OUTER_UDP_CK SUM``.

doc/guides/nics/features.rst Supports inner packet L4 checksum.

Quoted 11 lines
doc/guides/nics/features.rst +9 -0
+.. _nic_features_l1_fcs_rx_error_packet_drop:
+
+L1 FCS Error Packet drop on Rx
+------------------------------
+
+Supports dropping of packets having L1 FCS error on Rx.
+
+* **[uses]     user config**: ``dev_conf.err_pkt_drop_conf.l1_fcs``.
+* **[provides] rte_eth_dev_info**:

``rx_err_drop_offload_capa:RTE_DEV_RX_ERR_PKT_DROP_OFFLOAD_L1_FCS``.

doc/guides/nics/features.rst Supports inner packet L4 checksum.

Quoted 11 lines
doc/guides/nics/features.rst +11 -0
+
+
+.. _nic_features_l3_csum_rx_error_packet_drop:
+
+L3 checksum Error Packet drop on Rx
+-----------------------------------
+
+Supports dropping of packets having L3 Checksum error on Rx.
+
+* **[uses]     user config**: ``dev_conf.err_pkt_drop_conf.l3_csum``.
+* **[provides] rte_eth_dev_info**:

``rx_err_drop_offload_capa:RTE_DEV_RX_ERR_PKT_DROP_OFFLOAD_L3_CSUM ``.

doc/guides/nics/features.rst Supports inner packet L4 checksum.

Quoted 11 lines
doc/guides/nics/features.rst +11 -0
+
+
+.. _nic_features_l4_csum_rx_error_packet_drop:
+
+L4 Checksum Error Packet drop on Rx
+-----------------------------------
+
+Supports dropping of packets having L1 FCS error on Rx.
+
+* **[uses]     user config**: ``dev_conf.err_pkt_drop_conf.l4_csum``.
+* **[provides] rte_eth_dev_info**:

``rx_err_drop_offload_capa:RTE_DEV_RX_ERR_PKT_DROP_OFFLOAD_L4_CSUM ``.

doc/guides/nics/features.rst Supports inner packet L4 checksum.

Quoted 8 lines
doc/guides/nics/features.rst +8 -0
+
+
+.. _nic_features_all_rx_error_packet_drop:
+
+All/any Error Packet drop on Rx
+-------------------------------
+
+Supports dropping of packets having any of the errors like L1 FSC, L3/L4

Checksum on Rx.

Quoted 1 line

s/FSC/FCS

Will update in the next spin.

Thanks,
Nipun

Quoted 32 lines

doc/guides/nics/features.rst Supports inner packet L4 checksum.

Quoted 4 lines
doc/guides/nics/features.rst +3 -0
+
+* **[uses]     user config**: ``dev_conf.err_pkt_drop_conf.all``.
+* **[provides] rte_eth_dev_info**:

``rx_err_drop_offload_capa:RTE_DEV_RX_ERR_PKT_DROP_OFFLOAD_ALL``.

Review

Quoted 6 lines
doc/guides/nics/features.rst +2 -0
+
+

.. _nic_features_packet_type_parsing:

Packet type parsing

(quoted diff) +0 -0

b/doc/guides/testpmd_app_ug/run_app.rst

Quoted 14 lines

index e2539f693..20f2f8083 100644

doc/guides/testpmd_app_ug/run_app.rst +4 -0
@@ -213,6 +213,10 @@ The command line options are:
 
    Enable hardware QINQ strip.
 
+*  ``--enable-hw-drop-err-all``
+
+    Enable hardware packet drop for any error packets
+
 *   ``--enable-drop-en``
 
    Enable per-queue packet drop for packets with no descriptors.
Quoted 3 lines

—
2.17.1

#42 lore raw

Re: [dpdk-dev] [PATCH 1/3 v4] ethdev: add Rx offload to drop error packets

In reply to [email protected]
Quoted 57 lines · On Thu, Oct 15, 2020 at 6:24 AM <[email protected]> wrote:

From: Nipun Gupta <[email protected]>

This change adds a Rx offload capability and configuration to enable hardware to drop the packets in case of any error in the packets such as L3 checksum error or L4 checksum.

---

v4:
- renamed 'rte_rx_err_pkt_drop_conf' to 'rte_eth_rx_err_pkt_drop_conf'
- updated function 'port_offload_cap_display' to display newly added offloads
- added placeholder for L1 FCS, L3 Checksum, L4 Checksum error packet drops
- updated doc/guides/nics/features.rst
- updated new added 'DEV_RX_OFFLOAD_*' to 'RTE_DEV_RX_OFFLOAD*'
- updated RX to Rx

v3:
- Add additional rx_err_drop_offload_capa, which is specific capability flag for RX packets error drop offload. Currently only 'all' error packet drops are enabled, but can be extended to provide capability to drop any specific errors like L1 FCS, L3 Checksum etc.
- Added separate config structure to enable the drop configuration.
- Updated doc with the new updated option in testbbdev (patch 3/3)

v2:
- Add support in DPAA1 driver (patch 2/3)
- Add support and config parameter in testpmd (patch 3/3)

 lib/librte_ethdev/rte_ethdev.c |  1 +
 lib/librte_ethdev/rte_ethdev.h | 39 +++++++++++++++++++++++++++++++++-
 2 files changed, 39 insertions(+), 1 deletion(-)
lib/librte_ethdev/rte_ethdev.c +1 -0
index 48d1333b1..be25e947e 100644
@@ -128,6 +128,7 @@ static const struct {
        RTE_RX_OFFLOAD_BIT2STR(SCTP_CKSUM),
        RTE_RX_OFFLOAD_BIT2STR(OUTER_UDP_CKSUM),
        RTE_RX_OFFLOAD_BIT2STR(RSS_HASH),
+       RTE_RX_OFFLOAD_BIT2STR(ERR_PKT_DROP),
 };
 
 #undef RTE_RX_OFFLOAD_BIT2STR
lib/librte_ethdev/rte_ethdev.h +0 -0
index d2bf74f12..0db4b4021 100644

lib/librte_ethdev/rte_ethdev.h struct rte_intr_conf { · line 1201

Quoted 8 lines
lib/librte_ethdev/rte_ethdev.h +5 -0
@@ -1194,6 +1194,28 @@ struct rte_intr_conf {
        uint32_t rmv:1;
 };
 
+/**
+ * A structure used to enable/disable error packet drop on Rx.
+ */
+struct rte_eth_rx_err_pkt_drop_conf {
+       /** enable/disable L1 FSC error packet drop on Rx.

s/FSC/FCS
Its L2 FCS. FCS is a part of Ethernet frame.

lib/librte_ethdev/rte_ethdev.h struct rte_intr_conf { · line 1204

Quoted 3 lines
lib/librte_ethdev/rte_ethdev.h +3 -0
+        * 0 (default) - disable, 1 enable
+        */
+       uint32_t l1_fcs:1;

l2_fcs;

Quoted 40 lines
lib/librte_ethdev/rte_ethdev.h +18 -1
+       /** enable/disable L3 Checksum error packet drop on Rx.
+        * 0 (default) - disable, 1 enable
+        */
+       uint32_t l3_csum:1;
+       /** enable/disable L4 Checksum error packet drop on Rx.
+        * 0 (default) - disable, 1 enable
+        */
+       uint32_t l4_csum:1;
+       /** enable/disable all Rx error packet drop.
+        * 0 (default) - disable, 1 enable
+        */
+       uint32_t all:1;
+};
+
 /**
  * A structure used to configure an Ethernet port.
  * Depending upon the RX multi-queue mode, extra advanced
@@ -1236,10 +1258,12 @@ struct rte_eth_conf {
        uint32_t dcb_capability_en;
        struct rte_fdir_conf fdir_conf; /**< FDIR configuration. DEPRECATED */
        struct rte_intr_conf intr_conf; /**< Interrupt mode configuration. */
+       struct rte_eth_rx_err_pkt_drop_conf err_pkt_drop_conf;
+       /**< Rx error packet drop configuration. */
 };
 
 /**
- * RX offload capabilities of a device.
+ * Rx offload capabilities of a device.
  */
 #define DEV_RX_OFFLOAD_VLAN_STRIP  0x00000001
 #define DEV_RX_OFFLOAD_IPV4_CKSUM  0x00000002
@@ -1260,6 +1284,7 @@ struct rte_eth_conf {
 #define DEV_RX_OFFLOAD_SCTP_CKSUM      0x00020000
 #define DEV_RX_OFFLOAD_OUTER_UDP_CKSUM  0x00040000
 #define DEV_RX_OFFLOAD_RSS_HASH                0x00080000
+#define DEV_RX_OFFLOAD_ERR_PKT_DROP    0x00100000
 
 #define DEV_RX_OFFLOAD_CHECKSUM (DEV_RX_OFFLOAD_IPV4_CKSUM | \
                                 DEV_RX_OFFLOAD_UDP_CKSUM | \

lib/librte_ethdev/rte_ethdev.h struct rte_eth_conf { · line 1307

Quoted 9 lines
lib/librte_ethdev/rte_ethdev.h +6 -0
@@ -1274,6 +1299,16 @@ struct rte_eth_conf {
  * mentioned in rte_rx_offload_names in rte_ethdev.c file.
  */
 
+/**
+ * Rx Error Drop offload config/capabilities of a device. These
+ * are valid only when Rx capability RTE_DEV_RX_OFFLOAD_ERR_PKT_DROP
+ * is supported by the device.
+ */
+#define RTE_DEV_RX_ERR_PKT_DROP_OFFLOAD_L1_FCS         0x00000001

RTE_DEV_RX_ERR_PKT_DROP_OFFLOAD_L2_FCS

Quoted 19 lines
lib/librte_ethdev/rte_ethdev.h +6 -1
+#define RTE_DEV_RX_ERR_PKT_DROP_OFFLOAD_L3_CSUM                0x00000002
+#define RTE_DEV_RX_ERR_PKT_DROP_OFFLOAD_L4_CSUM                0x00000004
+#define RTE_DEV_RX_ERR_PKT_DROP_OFFLOAD_ALL            0x80000000
+
 /**
  * TX offload capabilities of a device.
  */
@@ -1411,6 +1446,8 @@ struct rte_eth_dev_info {
        /**< Device per-queue RX offload capabilities. */
        uint64_t tx_queue_offload_capa;
        /**< Device per-queue TX offload capabilities. */
+       uint64_t rx_err_drop_offload_capa;
+       /**< RX error packet drop offload capabilities. */
        uint16_t reta_size;
        /**< Device redirection table size, the total number of entries. */
        uint8_t hash_key_size; /**< Hash key size in bytes */
--

2.17.1

#43 lore raw

Re: [dpdk-dev] [PATCH 1/3 v4] ethdev: add Rx offload to drop error packets

In reply to [email protected]

lib/librte_ethdev/rte_ethdev.c

Quoted 40 lines · On 10/15/2020 2:23 PM, [email protected] wrote:

From: Nipun Gupta <[email protected]>

This change adds a Rx offload capability and configuration to enable hardware to drop the packets in case of any error in the packets such as L3 checksum error or L4 checksum.

---

v4:
- renamed 'rte_rx_err_pkt_drop_conf' to

    'rte_eth_rx_err_pkt_drop_conf'

- updated function 'port_offload_cap_display' to display newly added offloads
- added placeholder for L1 FCS, L3 Checksum, L4 Checksum error packet drops
- updated doc/guides/nics/features.rst
- updated new added 'DEV_RX_OFFLOAD_*' to 'RTE_DEV_RX_OFFLOAD*'
- updated RX to Rx

v3:
- Add additional rx_err_drop_offload_capa, which is specific capability flag for RX packets error drop offload. Currently only 'all' error packet drops are enabled, but can be extended to provide capability to drop any specific errors like L1 FCS, L3 Checksum etc.
- Added separate config structure to enable the drop configuration.
- Updated doc with the new updated option in testbbdev (patch 3/3)

v2:
- Add support in DPAA1 driver (patch 2/3)
- Add support and config parameter in testpmd (patch 3/3)

  lib/librte_ethdev/rte_ethdev.c |  1 +
  lib/librte_ethdev/rte_ethdev.h | 39 +++++++++++++++++++++++++++++++++-
  2 files changed, 39 insertions(+), 1 deletion(-)
lib/librte_ethdev/rte_ethdev.c +0 -0

This feature touches many main parts,
- new config item for 'rte_eth_dev_configure()'
- a new offload flag
- new capability reporting for 'rte_eth_dev_info_get()'

The feature doesn't look very mainstream to touch all these main parts and add complexity to them, which will affect almost all users.

And has some inconsistencies, like configuration is done via config struct, but capability is returned as bit-wise. Or I think config option taken into account only if offload is requested has a chance to confuse people in both app and driver end.

What do you think having two specific APIs to get_capabilities and set drop config?
The responsibility of those APIs will be clear and narrowed down, which makes it harder to make it wrong.

Also it is an ABI break as it is and needs to wait 21.11, and even after that it has a potential to cause more ABI breaks, like trying to add a new error type to drop will need to wait 22.11 ..., but if we can have them as separate APIs we can have them as experimental without waiting next LTS.

#44 lore raw

Re: [dpdk-dev] [PATCH 1/3 v4] ethdev: add Rx offload to drop error packets

18/02/2021 21:32, Ferruh Yigit:

Quoted 20 lines · On 10/15/2020 2:23 PM, [email protected] wrote:
Quoted 10 lines

From: Nipun Gupta <[email protected]>

This change adds a Rx offload capability and configuration to enable hardware to drop the packets in case of any error in the packets such as L3 checksum error or L4 checksum.

---

This feature touches many main parts,
- new config item for 'rte_eth_dev_configure()'
- a new offload flag
- new capability reporting for 'rte_eth_dev_info_get()'

The feature doesn't look very mainstream to touch all these main parts and add complexity to them, which will affect almost all users.

Quoted 8 lines

And has some inconsistencies, like configuration is done via config struct, but capability is returned as bit-wise.
Or I think config option taken into account only if offload is requested has a chance to confuse people in both app and driver end.

What do you think having two specific APIs to get_capabilities and set drop config? The responsibility of those APIs will be clear and narrowed down, which makes it harder to make it wrong.

I agree. In general, it is better adding new functions instead of adding everything in rte_eth_dev_configure().

#45 lore raw

Re: [dpdk-dev] [PATCH 1/3 v4] ethdev: add Rx offload to drop error packets

Quoted 26 lines · Thomas Monjalon

18/02/2021 21:32, Ferruh Yigit:

Quoted 25 lines · On 10/15/2020 2:23 PM, [email protected] wrote:
Quoted 10 lines

From: Nipun Gupta <[email protected]>

This change adds a Rx offload capability and configuration to enable hardware to drop the packets in case of any error in the packets such as L3 checksum error or L4 checksum.

---

This feature touches many main parts,
- new config item for 'rte_eth_dev_configure()'
- a new offload flag
- new capability reporting for 'rte_eth_dev_info_get()'

The feature doesn't look very mainstream to touch all these main parts and add complexity to them, which will affect almost all users.

And has some inconsistencies, like configuration is done via config struct, but capability is returned as bit-wise.
Or I think config option taken into account only if offload is requested has a chance to confuse people in both app and driver end.

Quoted 7 lines
Quoted 3 lines

What do you think having two specific APIs to get_capabilities and set drop config? The responsibility of those APIs will be clear and narrowed down, which makes it harder to make it wrong.

I agree. In general, it is better adding new functions instead of adding everything in rte_eth_dev_configure().

The set is stale, rejecting it, please send a new version if required.