* [dpdk-dev] [PATCH v2 1/5] net/fm10k: fix Rx checksum flags
2016-09-06 1:27 [dpdk-dev] [PATCH v2 0/5] implement new Rx checksum flag Xiao Wang
@ 2016-09-06 1:27 ` Xiao Wang
2016-09-06 1:27 ` [dpdk-dev] [PATCH v2 2/5] net/fm10k: implement new Rx checksum flag Xiao Wang
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Xiao Wang @ 2016-09-06 1:27 UTC (permalink / raw)
To: dev; +Cc: jing.d.chen, olivier.matz, Xiao Wang
A previous patch removed some necessary lines about Rx checksum offload
by mistake, this patch adds them back.
Fixes: 6046898f5097 ("net/mbuf: remove unused Rx error flags")
Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
drivers/net/fm10k/fm10k_rxtx.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/net/fm10k/fm10k_rxtx.c b/drivers/net/fm10k/fm10k_rxtx.c
index 5b2d04b..bf5888b 100644
--- a/drivers/net/fm10k/fm10k_rxtx.c
+++ b/drivers/net/fm10k/fm10k_rxtx.c
@@ -96,6 +96,16 @@ rx_desc_to_ol_flags(struct rte_mbuf *m, const union fm10k_rx_desc *d)
if (d->w.pkt_info & FM10K_RXD_RSSTYPE_MASK)
m->ol_flags |= PKT_RX_RSS_HASH;
+
+ if (unlikely((d->d.staterr &
+ (FM10K_RXD_STATUS_IPCS | FM10K_RXD_STATUS_IPE)) ==
+ (FM10K_RXD_STATUS_IPCS | FM10K_RXD_STATUS_IPE)))
+ m->ol_flags |= PKT_RX_IP_CKSUM_BAD;
+
+ if (unlikely((d->d.staterr &
+ (FM10K_RXD_STATUS_L4CS | FM10K_RXD_STATUS_L4E)) ==
+ (FM10K_RXD_STATUS_L4CS | FM10K_RXD_STATUS_L4E)))
+ m->ol_flags |= PKT_RX_L4_CKSUM_BAD;
}
uint16_t
--
1.9.3
^ permalink raw reply [flat|nested] 8+ messages in thread
* [dpdk-dev] [PATCH v2 2/5] net/fm10k: implement new Rx checksum flag
2016-09-06 1:27 [dpdk-dev] [PATCH v2 0/5] implement new Rx checksum flag Xiao Wang
2016-09-06 1:27 ` [dpdk-dev] [PATCH v2 1/5] net/fm10k: fix Rx checksum flags Xiao Wang
@ 2016-09-06 1:27 ` Xiao Wang
2016-09-06 1:27 ` [dpdk-dev] [PATCH v2 3/5] net/e1000: " Xiao Wang
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Xiao Wang @ 2016-09-06 1:27 UTC (permalink / raw)
To: dev; +Cc: jing.d.chen, olivier.matz, Xiao Wang
Add CKSUM_GOOD flag to distinguish a good checksum from an unknown one.
Since vector Rx supports checksum offload, this patch removes the
hw_ip_checksum check in fm10k_rx_vec_condition_check().
Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
drivers/net/fm10k/fm10k_rxtx.c | 4 ++++
drivers/net/fm10k/fm10k_rxtx_vec.c | 24 +++++++++++++++++-------
2 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/drivers/net/fm10k/fm10k_rxtx.c b/drivers/net/fm10k/fm10k_rxtx.c
index bf5888b..32cc7ff 100644
--- a/drivers/net/fm10k/fm10k_rxtx.c
+++ b/drivers/net/fm10k/fm10k_rxtx.c
@@ -101,11 +101,15 @@ rx_desc_to_ol_flags(struct rte_mbuf *m, const union fm10k_rx_desc *d)
(FM10K_RXD_STATUS_IPCS | FM10K_RXD_STATUS_IPE)) ==
(FM10K_RXD_STATUS_IPCS | FM10K_RXD_STATUS_IPE)))
m->ol_flags |= PKT_RX_IP_CKSUM_BAD;
+ else
+ m->ol_flags |= PKT_RX_IP_CKSUM_GOOD;
if (unlikely((d->d.staterr &
(FM10K_RXD_STATUS_L4CS | FM10K_RXD_STATUS_L4E)) ==
(FM10K_RXD_STATUS_L4CS | FM10K_RXD_STATUS_L4E)))
m->ol_flags |= PKT_RX_L4_CKSUM_BAD;
+ else
+ m->ol_flags |= PKT_RX_L4_CKSUM_GOOD;
}
uint16_t
diff --git a/drivers/net/fm10k/fm10k_rxtx_vec.c b/drivers/net/fm10k/fm10k_rxtx_vec.c
index 9ea747e..5513f86 100644
--- a/drivers/net/fm10k/fm10k_rxtx_vec.c
+++ b/drivers/net/fm10k/fm10k_rxtx_vec.c
@@ -67,6 +67,8 @@ fm10k_reset_tx_queue(struct fm10k_tx_queue *txq);
#define RXEFLAG_SHIFT (13)
/* IPE/L4E flag shift */
#define L3L4EFLAG_SHIFT (14)
+/* shift PKT_RX_L4_CKSUM_GOOD into one byte by 1 bit */
+#define CKSUM_SHIFT (1)
static inline void
fm10k_desc_to_olflags_v(__m128i descs[4], struct rte_mbuf **rx_pkts)
@@ -92,11 +94,18 @@ fm10k_desc_to_olflags_v(__m128i descs[4], struct rte_mbuf **rx_pkts)
0x0000, 0x0000, 0x0000, 0x0000,
0x0001, 0x0001, 0x0001, 0x0001);
+ /* mask the lower byte of ol_flags */
+ const __m128i ol_flags_msk = _mm_set_epi16(
+ 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x00FF, 0x00FF, 0x00FF, 0x00FF);
+
const __m128i l3l4cksum_flag = _mm_set_epi8(0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
- PKT_RX_IP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD,
- PKT_RX_IP_CKSUM_BAD, PKT_RX_L4_CKSUM_BAD, 0);
+ (PKT_RX_IP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD) >> CKSUM_SHIFT,
+ (PKT_RX_IP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD) >> CKSUM_SHIFT,
+ (PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD) >> CKSUM_SHIFT,
+ (PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_GOOD) >> CKSUM_SHIFT);
const __m128i rxe_flag = _mm_set_epi8(0, 0, 0, 0,
0, 0, 0, 0,
@@ -139,6 +148,10 @@ fm10k_desc_to_olflags_v(__m128i descs[4], struct rte_mbuf **rx_pkts)
/* Process L4/L3 checksum error flags */
cksumflag = _mm_srli_epi16(cksumflag, L3L4EFLAG_SHIFT);
cksumflag = _mm_shuffle_epi8(l3l4cksum_flag, cksumflag);
+
+ /* clean the higher byte and shift back the flag bits */
+ cksumflag = _mm_and_si128(cksumflag, ol_flags_msk);
+ cksumflag = _mm_slli_epi16(cksumflag, CKSUM_SHIFT);
vtag1 = _mm_or_si128(cksumflag, vtag1);
vol.dword = _mm_cvtsi128_si64(vtag1);
@@ -234,11 +247,8 @@ fm10k_rx_vec_condition_check(struct rte_eth_dev *dev)
if (fconf->mode != RTE_FDIR_MODE_NONE)
return -1;
- /* - no csum error report support
- * - no header split support
- */
- if (rxmode->hw_ip_checksum == 1 ||
- rxmode->header_split == 1)
+ /* no header split support */
+ if (rxmode->header_split == 1)
return -1;
return 0;
--
1.9.3
^ permalink raw reply [flat|nested] 8+ messages in thread
* [dpdk-dev] [PATCH v2 3/5] net/e1000: implement new Rx checksum flag
2016-09-06 1:27 [dpdk-dev] [PATCH v2 0/5] implement new Rx checksum flag Xiao Wang
2016-09-06 1:27 ` [dpdk-dev] [PATCH v2 1/5] net/fm10k: fix Rx checksum flags Xiao Wang
2016-09-06 1:27 ` [dpdk-dev] [PATCH v2 2/5] net/fm10k: implement new Rx checksum flag Xiao Wang
@ 2016-09-06 1:27 ` Xiao Wang
2016-09-06 1:27 ` [dpdk-dev] [PATCH v2 4/5] net/ixgbe: " Xiao Wang
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Xiao Wang @ 2016-09-06 1:27 UTC (permalink / raw)
To: dev; +Cc: jing.d.chen, olivier.matz, Xiao Wang
Add CKSUM_GOOD flag to distinguish a good checksum from an unknown one.
Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
drivers/net/e1000/igb_rxtx.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c
index 9d80a0b..bc33aed 100644
--- a/drivers/net/e1000/igb_rxtx.c
+++ b/drivers/net/e1000/igb_rxtx.c
@@ -748,7 +748,9 @@ rx_desc_error_to_pkt_flags(uint32_t rx_status)
*/
static uint64_t error_to_pkt_flags_map[4] = {
- 0, PKT_RX_L4_CKSUM_BAD, PKT_RX_IP_CKSUM_BAD,
+ PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_GOOD,
+ PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD,
+ PKT_RX_IP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD,
PKT_RX_IP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD
};
return error_to_pkt_flags_map[(rx_status >>
--
1.9.3
^ permalink raw reply [flat|nested] 8+ messages in thread
* [dpdk-dev] [PATCH v2 4/5] net/ixgbe: implement new Rx checksum flag
2016-09-06 1:27 [dpdk-dev] [PATCH v2 0/5] implement new Rx checksum flag Xiao Wang
` (2 preceding siblings ...)
2016-09-06 1:27 ` [dpdk-dev] [PATCH v2 3/5] net/e1000: " Xiao Wang
@ 2016-09-06 1:27 ` Xiao Wang
2016-09-06 1:27 ` [dpdk-dev] [PATCH v2 5/5] net/i40e: " Xiao Wang
2016-09-14 5:41 ` [dpdk-dev] [PATCH v2 0/5] " Chen, Jing D
5 siblings, 0 replies; 8+ messages in thread
From: Xiao Wang @ 2016-09-06 1:27 UTC (permalink / raw)
To: dev; +Cc: jing.d.chen, olivier.matz, Xiao Wang
Add CKSUM_GOOD flag to distinguish a good checksum from an unknown one.
Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
drivers/net/ixgbe/ixgbe_rxtx.c | 4 +++-
drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 30 ++++++++++++++++++++++++------
2 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index 8a306b0..d2dc82a 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -1345,7 +1345,9 @@ rx_desc_error_to_pkt_flags(uint32_t rx_status)
* Bit 30: L4I, L4I integrity error
*/
static uint64_t error_to_pkt_flags_map[4] = {
- 0, PKT_RX_L4_CKSUM_BAD, PKT_RX_IP_CKSUM_BAD,
+ PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_GOOD,
+ PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD,
+ PKT_RX_IP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD,
PKT_RX_IP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD
};
pkt_flags = error_to_pkt_flags_map[(rx_status >>
diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
index dc5657e..7929593 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
@@ -156,6 +156,11 @@ desc_to_olflags_v(__m128i descs[4], uint8_t vlan_flags,
0x0000, 0x0000, 0x0000, 0x0000,
0x000F, 0x000F, 0x000F, 0x000F);
+ /* mask the lower byte of ol_flags */
+ const __m128i ol_flags_msk = _mm_set_epi16(
+ 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x00FF, 0x00FF, 0x00FF, 0x00FF);
+
/* map rss type to rss hash flag */
const __m128i rss_flags = _mm_set_epi8(PKT_RX_FDIR, 0, 0, 0,
0, 0, 0, PKT_RX_RSS_HASH,
@@ -171,17 +176,25 @@ desc_to_olflags_v(__m128i descs[4], uint8_t vlan_flags,
IXGBE_RXD_STAT_VP, IXGBE_RXD_STAT_VP,
IXGBE_RXD_STAT_VP, IXGBE_RXD_STAT_VP);
/* map vlan present (0x8), IPE (0x2), L4E (0x1) to ol_flags */
- const __m128i vlan_csum_map = _mm_set_epi8(
+ const __m128i vlan_csum_map_lo = _mm_set_epi8(
0, 0, 0, 0,
vlan_flags | PKT_RX_IP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD,
vlan_flags | PKT_RX_IP_CKSUM_BAD,
- vlan_flags | PKT_RX_L4_CKSUM_BAD,
- vlan_flags,
+ vlan_flags | PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD,
+ vlan_flags | PKT_RX_IP_CKSUM_GOOD,
0, 0, 0, 0,
PKT_RX_IP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD,
PKT_RX_IP_CKSUM_BAD,
- PKT_RX_L4_CKSUM_BAD,
- 0);
+ PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD,
+ PKT_RX_IP_CKSUM_GOOD);
+
+ const __m128i vlan_csum_map_hi = _mm_set_epi8(
+ 0, 0, 0, 0,
+ 0, PKT_RX_L4_CKSUM_GOOD >> sizeof(uint8_t), 0,
+ PKT_RX_L4_CKSUM_GOOD >> sizeof(uint8_t),
+ 0, 0, 0, 0,
+ 0, PKT_RX_L4_CKSUM_GOOD >> sizeof(uint8_t), 0,
+ PKT_RX_L4_CKSUM_GOOD >> sizeof(uint8_t));
ptype0 = _mm_unpacklo_epi16(descs[0], descs[1]);
ptype1 = _mm_unpacklo_epi16(descs[2], descs[3]);
@@ -207,7 +220,12 @@ desc_to_olflags_v(__m128i descs[4], uint8_t vlan_flags,
vtag1 = _mm_or_si128(csum, vtag1);
/* convert VP, IPE, L4E to ol_flags */
- vtag1 = _mm_shuffle_epi8(vlan_csum_map, vtag1);
+ vtag0 = _mm_shuffle_epi8(vlan_csum_map_hi, vtag1);
+ vtag0 = _mm_slli_epi16(vtag0, sizeof(uint8_t));
+
+ vtag1 = _mm_shuffle_epi8(vlan_csum_map_lo, vtag1);
+ vtag1 = _mm_and_si128(vtag1, ol_flags_msk);
+ vtag1 = _mm_or_si128(vtag0, vtag1);
vtag1 = _mm_or_si128(ptype0, vtag1);
vol.dword = _mm_cvtsi128_si64(vtag1);
--
1.9.3
^ permalink raw reply [flat|nested] 8+ messages in thread
* [dpdk-dev] [PATCH v2 5/5] net/i40e: implement new Rx checksum flag
2016-09-06 1:27 [dpdk-dev] [PATCH v2 0/5] implement new Rx checksum flag Xiao Wang
` (3 preceding siblings ...)
2016-09-06 1:27 ` [dpdk-dev] [PATCH v2 4/5] net/ixgbe: " Xiao Wang
@ 2016-09-06 1:27 ` Xiao Wang
2016-09-14 5:41 ` [dpdk-dev] [PATCH v2 0/5] " Chen, Jing D
5 siblings, 0 replies; 8+ messages in thread
From: Xiao Wang @ 2016-09-06 1:27 UTC (permalink / raw)
To: dev; +Cc: jing.d.chen, olivier.matz, Xiao Wang
Add CKSUM_GOOD flag to distinguish a good checksum from an unknown one.
Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
drivers/net/i40e/i40e_rxtx.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 554d167..b49d9dc 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -142,8 +142,14 @@ i40e_rxd_error_to_pkt_flags(uint64_t qword)
return flags;
if (unlikely(error_bits & (1 << I40E_RX_DESC_ERROR_IPE_SHIFT)))
flags |= PKT_RX_IP_CKSUM_BAD;
+ else
+ flags |= PKT_RX_IP_CKSUM_GOOD;
+
if (unlikely(error_bits & (1 << I40E_RX_DESC_ERROR_L4E_SHIFT)))
flags |= PKT_RX_L4_CKSUM_BAD;
+ else
+ flags |= PKT_RX_L4_CKSUM_GOOD;
+
if (unlikely(error_bits & (1 << I40E_RX_DESC_ERROR_EIPE_SHIFT)))
flags |= PKT_RX_EIP_CKSUM_BAD;
--
1.9.3
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [dpdk-dev] [PATCH v2 0/5] implement new Rx checksum flag
2016-09-06 1:27 [dpdk-dev] [PATCH v2 0/5] implement new Rx checksum flag Xiao Wang
` (4 preceding siblings ...)
2016-09-06 1:27 ` [dpdk-dev] [PATCH v2 5/5] net/i40e: " Xiao Wang
@ 2016-09-14 5:41 ` Chen, Jing D
2016-10-13 23:37 ` Thomas Monjalon
5 siblings, 1 reply; 8+ messages in thread
From: Chen, Jing D @ 2016-09-14 5:41 UTC (permalink / raw)
To: Wang, Xiao W, dev; +Cc: olivier.matz
Hi,
> -----Original Message-----
> From: Wang, Xiao W
> Sent: Tuesday, September 06, 2016 9:27 AM
> To: dev@dpdk.org
> Cc: Chen, Jing D <jing.d.chen@intel.com>; olivier.matz@6wind.com; Wang, Xiao W
> <xiao.w.wang@intel.com>
> Subject: [PATCH v2 0/5] implement new Rx checksum flag
>
> v2:
> * Removed hw_ip_checksum check in fm10k_rx_vec_condition_check().
>
> * Defined CKSUM_SHIFT for SSE bits shift.
>
> * Changed commit title from "add back Rx checksum offload" to
> "fix Rx checksum flags".
>
> * Added new cksum flag support for ixgbe vector Rx, based on patch
> (http://dpdk.org/dev/patchwork/patch/14630/) which came earlier.
>
> v1:
> Following http://dpdk.org/dev/patchwork/patch/14941/, this patch set
> implements newly defined Rx checksum flag for igb, ixgbe, i40e and fm10k.
>
> Currently, ixgbe and fm10k support Rx checksum offload in both scalar
> and vector datapath, while the other two don't, this patch set keeps
> this situation.
>
> Note: This patch set has dependency on the following patches:
>
> "mbuf: add new Rx checksum mbuf flags"
> (http://dpdk.org/dev/patchwork/patch/14941/)
>
> "ixgbe: support checksum flags in sse vector Rx function"
> (http://dpdk.org/dev/patchwork/patch/14630/)
>
> Xiao Wang (5):
> net/fm10k: fix Rx checksum flags
> net/fm10k: implement new Rx checksum flag
> net/e1000: implement new Rx checksum flag
> net/ixgbe: implement new Rx checksum flag
> net/i40e: implement new Rx checksum flag
>
> drivers/net/e1000/igb_rxtx.c | 4 +++-
> drivers/net/fm10k/fm10k_rxtx.c | 14 ++++++++++++++
> drivers/net/fm10k/fm10k_rxtx_vec.c | 24 +++++++++++++++++-------
> drivers/net/i40e/i40e_rxtx.c | 6 ++++++
> drivers/net/ixgbe/ixgbe_rxtx.c | 4 +++-
> drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 30 ++++++++++++++++++++++++------
> 6 files changed, 67 insertions(+), 15 deletions(-)
Acked-by : Jing Chen <jing.d.chen@intel.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [dpdk-dev] [PATCH v2 0/5] implement new Rx checksum flag
2016-09-14 5:41 ` [dpdk-dev] [PATCH v2 0/5] " Chen, Jing D
@ 2016-10-13 23:37 ` Thomas Monjalon
0 siblings, 0 replies; 8+ messages in thread
From: Thomas Monjalon @ 2016-10-13 23:37 UTC (permalink / raw)
To: Wang, Xiao W; +Cc: dev, Chen, Jing D, olivier.matz
> > Xiao Wang (5):
> > net/fm10k: fix Rx checksum flags
> > net/fm10k: implement new Rx checksum flag
> > net/e1000: implement new Rx checksum flag
> > net/ixgbe: implement new Rx checksum flag
> > net/i40e: implement new Rx checksum flag
>
> Acked-by : Jing Chen <jing.d.chen@intel.com>
Applied directly in mainline on Ferruh's advice
^ permalink raw reply [flat|nested] 8+ messages in thread