forked from amzn/amzn-drivers
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid false L4 csum validation failures on older DPDK versions (amzn#154
) * net/ena: avoid false l4 csum validation failures The driver should ignore Rx csum validation errors for fragments and also when the relevant offload is not supported by the ENA device. Signed-off-by: Igor Chauskin <[email protected]> Co-authored-by: Igor Chauskin <[email protected]>
- Loading branch information
Showing
4 changed files
with
300 additions
and
0 deletions.
There are no files selected for viewing
75 changes: 75 additions & 0 deletions
75
userspace/dpdk/18.02/0023-net-ena-avoid-false-l4-csum-validation-failures.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
From 21fd17c74c6e2db1552bd362de32bd388586fb4d Mon Sep 17 00:00:00 2001 | ||
From: Igor Chauskin <[email protected]> | ||
Date: Tue, 5 Jan 2021 11:08:08 +0200 | ||
Subject: [PATCH] net/ena: avoid false l4 csum validation failures | ||
|
||
The driver should ignore Rx csum validation errors | ||
for fragments and also when the relevant effload | ||
is not supported by the ENA device. | ||
|
||
Signed-off-by: Igor Chauskin <[email protected]> | ||
--- | ||
drivers/net/ena/ena_ethdev.c | 25 ++++++++++++++++++++----- | ||
1 file changed, 20 insertions(+), 5 deletions(-) | ||
|
||
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c | ||
index 34b2a8d78..ca61850e0 100644 | ||
--- a/drivers/net/ena/ena_ethdev.c | ||
+++ b/drivers/net/ena/ena_ethdev.c | ||
@@ -272,7 +272,8 @@ static inline int ena_cpu_to_node(int cpu) | ||
} | ||
|
||
static inline void ena_rx_mbuf_prepare(struct rte_mbuf *mbuf, | ||
- struct ena_com_rx_ctx *ena_rx_ctx) | ||
+ struct ena_com_rx_ctx *ena_rx_ctx, | ||
+ uint64_t rx_offloads) | ||
{ | ||
uint64_t ol_flags = 0; | ||
uint32_t packet_type = 0; | ||
@@ -287,10 +288,23 @@ static inline void ena_rx_mbuf_prepare(struct rte_mbuf *mbuf, | ||
else if (ena_rx_ctx->l3_proto == ENA_ETH_IO_L3_PROTO_IPV6) | ||
packet_type |= RTE_PTYPE_L3_IPV6; | ||
|
||
- if (unlikely(ena_rx_ctx->l4_csum_err)) | ||
- ol_flags |= PKT_RX_L4_CKSUM_BAD; | ||
+ /* Csum error flags are valid only when the device has indicated | ||
+ * that the corresponding Rx csum offload is supported. | ||
+ * Also, the driver currently handles L4 Rx offload only for IPv4 | ||
+ */ | ||
+ if (!ena_rx_ctx->frag) { | ||
+ if (unlikely(ena_rx_ctx->l4_csum_err)) | ||
+ if (packet_type & RTE_PTYPE_L3_IPV4) | ||
+ if (((rx_offloads & DEV_RX_OFFLOAD_TCP_CKSUM) && | ||
+ (packet_type & RTE_PTYPE_L4_TCP)) || | ||
+ ((rx_offloads & DEV_RX_OFFLOAD_UDP_CKSUM) && | ||
+ (packet_type & RTE_PTYPE_L4_UDP))) | ||
+ ol_flags |= PKT_RX_L4_CKSUM_BAD; | ||
+ } | ||
+ | ||
if (unlikely(ena_rx_ctx->l3_csum_err)) | ||
- ol_flags |= PKT_RX_IP_CKSUM_BAD; | ||
+ if(rx_offloads & DEV_RX_OFFLOAD_IPV4_CKSUM) | ||
+ ol_flags |= PKT_RX_IP_CKSUM_BAD; | ||
|
||
mbuf->ol_flags = ol_flags; | ||
mbuf->packet_type = packet_type; | ||
@@ -1600,6 +1614,7 @@ static uint16_t eth_ena_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, | ||
|
||
struct ena_com_rx_ctx ena_rx_ctx; | ||
int rc = 0; | ||
+ uint64_t dev_rx_offloads = rx_ring->adapter->rx_supported_offloads; | ||
|
||
/* Check adapter state */ | ||
if (unlikely(rx_ring->adapter->state != ENA_ADAPTER_STATE_RUNNING)) { | ||
@@ -1653,7 +1668,7 @@ static uint16_t eth_ena_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, | ||
} | ||
|
||
/* fill mbuf attributes if any */ | ||
- ena_rx_mbuf_prepare(mbuf_head, &ena_rx_ctx); | ||
+ ena_rx_mbuf_prepare(mbuf_head, &ena_rx_ctx, dev_rx_offloads); | ||
mbuf_head->hash.rss = (uint32_t)rx_ring->id; | ||
|
||
/* pass to DPDK application head mbuf */ | ||
-- | ||
2.29.2 | ||
|
75 changes: 75 additions & 0 deletions
75
userspace/dpdk/18.05/0023-net-ena-avoid-false-l4-csum-validation-failures.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
From ab698c484cc9da22d11e725e449d8eea86db109c Mon Sep 17 00:00:00 2001 | ||
From: Igor Chauskin <[email protected]> | ||
Date: Tue, 5 Jan 2021 11:02:25 +0200 | ||
Subject: [PATCH] net/ena: avoid false l4 csum validation failures | ||
|
||
The driver should ignore Rx csum validation errors | ||
for fragments and also when the relevant effload | ||
is not supported by the ENA device. | ||
|
||
Signed-off-by: Igor Chauskin <[email protected]> | ||
--- | ||
drivers/net/ena/ena_ethdev.c | 25 ++++++++++++++++++++----- | ||
1 file changed, 20 insertions(+), 5 deletions(-) | ||
|
||
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c | ||
index c255dc6db..d4173a7c2 100644 | ||
--- a/drivers/net/ena/ena_ethdev.c | ||
+++ b/drivers/net/ena/ena_ethdev.c | ||
@@ -290,7 +290,8 @@ static inline int ena_cpu_to_node(int cpu) | ||
} | ||
|
||
static inline void ena_rx_mbuf_prepare(struct rte_mbuf *mbuf, | ||
- struct ena_com_rx_ctx *ena_rx_ctx) | ||
+ struct ena_com_rx_ctx *ena_rx_ctx, | ||
+ uint64_t rx_offloads) | ||
{ | ||
uint64_t ol_flags = 0; | ||
uint32_t packet_type = 0; | ||
@@ -305,10 +306,23 @@ static inline void ena_rx_mbuf_prepare(struct rte_mbuf *mbuf, | ||
else if (ena_rx_ctx->l3_proto == ENA_ETH_IO_L3_PROTO_IPV6) | ||
packet_type |= RTE_PTYPE_L3_IPV6; | ||
|
||
- if (unlikely(ena_rx_ctx->l4_csum_err)) | ||
- ol_flags |= PKT_RX_L4_CKSUM_BAD; | ||
+ /* Csum error flags are valid only when the device has indicated | ||
+ * that the corresponding Rx csum offload is supported. | ||
+ * Also, the driver currently handles L4 Rx offload only for IPv4 | ||
+ */ | ||
+ if (!ena_rx_ctx->frag) { | ||
+ if (unlikely(ena_rx_ctx->l4_csum_err)) | ||
+ if (packet_type & RTE_PTYPE_L3_IPV4) | ||
+ if (((rx_offloads & DEV_RX_OFFLOAD_TCP_CKSUM) && | ||
+ (packet_type & RTE_PTYPE_L4_TCP)) || | ||
+ ((rx_offloads & DEV_RX_OFFLOAD_UDP_CKSUM) && | ||
+ (packet_type & RTE_PTYPE_L4_UDP))) | ||
+ ol_flags |= PKT_RX_L4_CKSUM_BAD; | ||
+ } | ||
+ | ||
if (unlikely(ena_rx_ctx->l3_csum_err)) | ||
- ol_flags |= PKT_RX_IP_CKSUM_BAD; | ||
+ if(rx_offloads & DEV_RX_OFFLOAD_IPV4_CKSUM) | ||
+ ol_flags |= PKT_RX_IP_CKSUM_BAD; | ||
|
||
mbuf->ol_flags = ol_flags; | ||
mbuf->packet_type = packet_type; | ||
@@ -1862,6 +1876,7 @@ static uint16_t eth_ena_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, | ||
|
||
struct ena_com_rx_ctx ena_rx_ctx; | ||
int rc = 0; | ||
+ uint64_t dev_rx_offloads = rx_ring->adapter->rx_supported_offloads; | ||
|
||
/* Check adapter state */ | ||
if (unlikely(rx_ring->adapter->state != ENA_ADAPTER_STATE_RUNNING)) { | ||
@@ -1923,7 +1938,7 @@ static uint16_t eth_ena_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, | ||
} | ||
|
||
/* fill mbuf attributes if any */ | ||
- ena_rx_mbuf_prepare(mbuf_head, &ena_rx_ctx); | ||
+ ena_rx_mbuf_prepare(mbuf_head, &ena_rx_ctx, dev_rx_offloads); | ||
mbuf_head->hash.rss = (uint32_t)rx_ring->id; | ||
|
||
/* pass to DPDK application head mbuf */ | ||
-- | ||
2.29.2 | ||
|
75 changes: 75 additions & 0 deletions
75
userspace/dpdk/18.08/0028-net-ena-avoid-false-l4-csum-validation-failures.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
From ab698c484cc9da22d11e725e449d8eea86db109c Mon Sep 17 00:00:00 2001 | ||
From: Igor Chauskin <[email protected]> | ||
Date: Tue, 5 Jan 2021 11:02:25 +0200 | ||
Subject: [PATCH] net/ena: avoid false l4 csum validation failures | ||
|
||
The driver should ignore Rx csum validation errors | ||
for fragments and also when the relevant effload | ||
is not supported by the ENA device. | ||
|
||
Signed-off-by: Igor Chauskin <[email protected]> | ||
--- | ||
drivers/net/ena/ena_ethdev.c | 25 ++++++++++++++++++++----- | ||
1 file changed, 20 insertions(+), 5 deletions(-) | ||
|
||
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c | ||
index c255dc6db..d4173a7c2 100644 | ||
--- a/drivers/net/ena/ena_ethdev.c | ||
+++ b/drivers/net/ena/ena_ethdev.c | ||
@@ -290,7 +290,8 @@ static inline int ena_cpu_to_node(int cpu) | ||
} | ||
|
||
static inline void ena_rx_mbuf_prepare(struct rte_mbuf *mbuf, | ||
- struct ena_com_rx_ctx *ena_rx_ctx) | ||
+ struct ena_com_rx_ctx *ena_rx_ctx, | ||
+ uint64_t rx_offloads) | ||
{ | ||
uint64_t ol_flags = 0; | ||
uint32_t packet_type = 0; | ||
@@ -305,10 +306,23 @@ static inline void ena_rx_mbuf_prepare(struct rte_mbuf *mbuf, | ||
else if (ena_rx_ctx->l3_proto == ENA_ETH_IO_L3_PROTO_IPV6) | ||
packet_type |= RTE_PTYPE_L3_IPV6; | ||
|
||
- if (unlikely(ena_rx_ctx->l4_csum_err)) | ||
- ol_flags |= PKT_RX_L4_CKSUM_BAD; | ||
+ /* Csum error flags are valid only when the device has indicated | ||
+ * that the corresponding Rx csum offload is supported. | ||
+ * Also, the driver currently handles L4 Rx offload only for IPv4 | ||
+ */ | ||
+ if (!ena_rx_ctx->frag) { | ||
+ if (unlikely(ena_rx_ctx->l4_csum_err)) | ||
+ if (packet_type & RTE_PTYPE_L3_IPV4) | ||
+ if (((rx_offloads & DEV_RX_OFFLOAD_TCP_CKSUM) && | ||
+ (packet_type & RTE_PTYPE_L4_TCP)) || | ||
+ ((rx_offloads & DEV_RX_OFFLOAD_UDP_CKSUM) && | ||
+ (packet_type & RTE_PTYPE_L4_UDP))) | ||
+ ol_flags |= PKT_RX_L4_CKSUM_BAD; | ||
+ } | ||
+ | ||
if (unlikely(ena_rx_ctx->l3_csum_err)) | ||
- ol_flags |= PKT_RX_IP_CKSUM_BAD; | ||
+ if(rx_offloads & DEV_RX_OFFLOAD_IPV4_CKSUM) | ||
+ ol_flags |= PKT_RX_IP_CKSUM_BAD; | ||
|
||
mbuf->ol_flags = ol_flags; | ||
mbuf->packet_type = packet_type; | ||
@@ -1862,6 +1876,7 @@ static uint16_t eth_ena_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, | ||
|
||
struct ena_com_rx_ctx ena_rx_ctx; | ||
int rc = 0; | ||
+ uint64_t dev_rx_offloads = rx_ring->adapter->rx_supported_offloads; | ||
|
||
/* Check adapter state */ | ||
if (unlikely(rx_ring->adapter->state != ENA_ADAPTER_STATE_RUNNING)) { | ||
@@ -1923,7 +1938,7 @@ static uint16_t eth_ena_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, | ||
} | ||
|
||
/* fill mbuf attributes if any */ | ||
- ena_rx_mbuf_prepare(mbuf_head, &ena_rx_ctx); | ||
+ ena_rx_mbuf_prepare(mbuf_head, &ena_rx_ctx, dev_rx_offloads); | ||
mbuf_head->hash.rss = (uint32_t)rx_ring->id; | ||
|
||
/* pass to DPDK application head mbuf */ | ||
-- | ||
2.29.2 | ||
|
75 changes: 75 additions & 0 deletions
75
userspace/dpdk/18.11/0025-net-ena-avoid-false-l4-csum-validation-failures.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
From 970b37ba0308a4482479234c94b730dd68eeae46 Mon Sep 17 00:00:00 2001 | ||
From: Igor Chauskin <[email protected]> | ||
Date: Tue, 22 Dec 2020 11:48:36 +0200 | ||
Subject: [PATCH] net/ena: avoid false l4 csum validation failures | ||
|
||
The driver should ignore Rx csum validation errors | ||
for fragments and also when the relevant effload | ||
is not supported by the ENA device. | ||
|
||
Signed-off-by: Igor Chauskin <[email protected]> | ||
--- | ||
drivers/net/ena/ena_ethdev.c | 25 ++++++++++++++++++++----- | ||
1 file changed, 20 insertions(+), 5 deletions(-) | ||
|
||
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c | ||
index a07bd2b49..2aa1841b1 100644 | ||
--- a/drivers/net/ena/ena_ethdev.c | ||
+++ b/drivers/net/ena/ena_ethdev.c | ||
@@ -292,7 +292,8 @@ static inline int ena_cpu_to_node(int cpu) | ||
} | ||
|
||
static inline void ena_rx_mbuf_prepare(struct rte_mbuf *mbuf, | ||
- struct ena_com_rx_ctx *ena_rx_ctx) | ||
+ struct ena_com_rx_ctx *ena_rx_ctx, | ||
+ uint64_t rx_offloads) | ||
{ | ||
uint64_t ol_flags = 0; | ||
uint32_t packet_type = 0; | ||
@@ -307,10 +308,23 @@ static inline void ena_rx_mbuf_prepare(struct rte_mbuf *mbuf, | ||
else if (ena_rx_ctx->l3_proto == ENA_ETH_IO_L3_PROTO_IPV6) | ||
packet_type |= RTE_PTYPE_L3_IPV6; | ||
|
||
- if (unlikely(ena_rx_ctx->l4_csum_err)) | ||
- ol_flags |= PKT_RX_L4_CKSUM_BAD; | ||
+ /* Csum error flags are valid only when the device has indicated | ||
+ * that the corresponding Rx csum offload is supported. | ||
+ * Also, the driver currently handles L4 Rx offload only for IPv4 | ||
+ */ | ||
+ if (!ena_rx_ctx->frag) { | ||
+ if (unlikely(ena_rx_ctx->l4_csum_err)) | ||
+ if (packet_type & RTE_PTYPE_L3_IPV4) | ||
+ if (((rx_offloads & DEV_RX_OFFLOAD_TCP_CKSUM) && | ||
+ (packet_type & RTE_PTYPE_L4_TCP)) || | ||
+ ((rx_offloads & DEV_RX_OFFLOAD_UDP_CKSUM) && | ||
+ (packet_type & RTE_PTYPE_L4_UDP))) | ||
+ ol_flags |= PKT_RX_L4_CKSUM_BAD; | ||
+ } | ||
+ | ||
if (unlikely(ena_rx_ctx->l3_csum_err)) | ||
- ol_flags |= PKT_RX_IP_CKSUM_BAD; | ||
+ if(rx_offloads & DEV_RX_OFFLOAD_IPV4_CKSUM) | ||
+ ol_flags |= PKT_RX_IP_CKSUM_BAD; | ||
|
||
mbuf->ol_flags = ol_flags; | ||
mbuf->packet_type = packet_type; | ||
@@ -1883,6 +1897,7 @@ static uint16_t eth_ena_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, | ||
|
||
struct ena_com_rx_ctx ena_rx_ctx; | ||
int rc = 0; | ||
+ uint64_t dev_rx_offloads = rx_ring->adapter->rx_supported_offloads; | ||
|
||
/* Check adapter state */ | ||
if (unlikely(rx_ring->adapter->state != ENA_ADAPTER_STATE_RUNNING)) { | ||
@@ -1944,7 +1959,7 @@ static uint16_t eth_ena_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, | ||
} | ||
|
||
/* fill mbuf attributes if any */ | ||
- ena_rx_mbuf_prepare(mbuf_head, &ena_rx_ctx); | ||
+ ena_rx_mbuf_prepare(mbuf_head, &ena_rx_ctx, dev_rx_offloads); | ||
mbuf_head->hash.rss = ena_rx_ctx.hash; | ||
|
||
/* pass to DPDK application head mbuf */ | ||
-- | ||
2.29.2 | ||
|