* [dpdk-dev] [PATCH] net/i40e: fix x86 vPMD Rx checksum flag
@ 2017-01-24 18:49 Qi Zhang
2017-01-24 19:06 ` [dpdk-dev] [PATCH v2] " Qi Zhang
2017-01-25 1:58 ` [dpdk-dev] [PATCH] " Zhang, Qi Z
0 siblings, 2 replies; 4+ messages in thread
From: Qi Zhang @ 2017-01-24 18:49 UTC (permalink / raw)
To: jingjing.wu, helin.zhang; +Cc: dev, Qi Zhang
When no error reported in Rx descriptor, we should set
CKSUM_GOOD flag before return.
Fixes: 9966a00a0688 ("net/i40e: enable bad checksum flags in vector Rx")
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
drivers/net/i40e/i40e_rxtx_vec_sse.c | 38 ++++++++++++++++++++++++++++--------
1 file changed, 30 insertions(+), 8 deletions(-)
diff --git a/drivers/net/i40e/i40e_rxtx_vec_sse.c b/drivers/net/i40e/i40e_rxtx_vec_sse.c
index 7c84a41..2c4061c 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_sse.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_sse.c
@@ -148,6 +148,20 @@ desc_to_olflags_v(__m128i descs[4], struct rte_mbuf **rx_pkts)
const __m128i rss_vlan_msk = _mm_set_epi32(
0x1c03804, 0x1c03804, 0x1c03804, 0x1c03804);
+ const __m128i cksum_mask = _mm_set_epi32(
+ PKT_RX_IP_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD |
+ PKT_RX_L4_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD |
+ PKT_RX_EIP_CKSUM_BAD,
+ PKT_RX_IP_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD |
+ PKT_RX_L4_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD |
+ PKT_RX_EIP_CKSUM_BAD,
+ PKT_RX_IP_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD |
+ PKT_RX_L4_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD |
+ PKT_RX_EIP_CKSUM_BAD,
+ PKT_RX_IP_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD |
+ PKT_RX_L4_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD |
+ PKT_RX_EIP_CKSUM_BAD);
+
/* map rss and vlan type to rss hash and vlan flag */
const __m128i vlan_flags = _mm_set_epi8(0, 0, 0, 0,
0, 0, 0, 0,
@@ -160,14 +174,17 @@ desc_to_olflags_v(__m128i descs[4], struct rte_mbuf **rx_pkts)
0, 0, PKT_RX_FDIR, 0);
const __m128i l3_l4e_flags = _mm_set_epi8(0, 0, 0, 0, 0, 0, 0, 0,
- PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD,
- PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD,
- PKT_RX_EIP_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD,
- PKT_RX_EIP_CKSUM_BAD,
- PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD,
- PKT_RX_L4_CKSUM_BAD,
- PKT_RX_IP_CKSUM_BAD,
- 0);
+ /* shift right 1 bit to make sure it not exceed 255 */
+ (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
+ PKT_RX_IP_CKSUM_BAD) >> 1,
+ (PKT_RX_IP_CKSUM_GOOD | PKT_RX_EIP_CKSUM_BAD |
+ PKT_RX_L4_CKSUM_BAD) >> 1,
+ (PKT_RX_EIP_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
+ (PKT_RX_IP_CKSUM_GOOD | PKT_RX_EIP_CKSUM_BAD) >> 1,
+ (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
+ (PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD) >> 1,
+ PKT_RX_IP_CKSUM_BAD >> 1,
+ (PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_GOOD) >> 1);
vlan0 = _mm_unpackhi_epi32(descs[0], descs[1]);
vlan1 = _mm_unpackhi_epi32(descs[2], descs[3]);
@@ -181,6 +198,10 @@ desc_to_olflags_v(__m128i descs[4], struct rte_mbuf **rx_pkts)
l3_l4e = _mm_srli_epi32(vlan1, 22);
l3_l4e = _mm_shuffle_epi8(l3_l4e_flags, l3_l4e);
+ /* then we shift left 1 bit */
+ l3_l4e = _mm_slli_epi32(l3_l4e, 1);
+ /* we need to mask out the reduntant bits */
+ l3_l4e = _mm_and_si128(l3_l4e, cksum_mask);
vlan0 = _mm_or_si128(vlan0, rss);
vlan0 = _mm_or_si128(vlan0, l3_l4e);
@@ -189,6 +210,7 @@ desc_to_olflags_v(__m128i descs[4], struct rte_mbuf **rx_pkts)
rx_pkts[1]->ol_flags = _mm_extract_epi16(vlan0, 2);
rx_pkts[2]->ol_flags = _mm_extract_epi16(vlan0, 4);
rx_pkts[3]->ol_flags = _mm_extract_epi16(vlan0, 6);
+ printf("ol_flags = %lx\n", rx_pkts[0]->ol_flags);
}
#else
#define desc_to_olflags_v(desc, rx_pkts) do {} while (0)
--
2.7.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* [dpdk-dev] [PATCH v2] net/i40e: fix x86 vPMD Rx checksum flag
2017-01-24 18:49 [dpdk-dev] [PATCH] net/i40e: fix x86 vPMD Rx checksum flag Qi Zhang
@ 2017-01-24 19:06 ` Qi Zhang
2017-01-25 14:00 ` Ferruh Yigit
2017-01-25 1:58 ` [dpdk-dev] [PATCH] " Zhang, Qi Z
1 sibling, 1 reply; 4+ messages in thread
From: Qi Zhang @ 2017-01-24 19:06 UTC (permalink / raw)
To: jingjing.wu, helin.zhang; +Cc: dev, Qi Zhang
When no error reported in Rx descriptor, we should set
CKSUM_GOOD flag before return.
Fixes: 9966a00a0688 ("net/i40e: enable bad checksum flags in vector Rx")
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
v2:
- remove debug code
drivers/net/i40e/i40e_rxtx_vec_sse.c | 37 ++++++++++++++++++++++++++++--------
1 file changed, 29 insertions(+), 8 deletions(-)
diff --git a/drivers/net/i40e/i40e_rxtx_vec_sse.c b/drivers/net/i40e/i40e_rxtx_vec_sse.c
index 7c84a41..b95cc8e 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_sse.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_sse.c
@@ -148,6 +148,20 @@ desc_to_olflags_v(__m128i descs[4], struct rte_mbuf **rx_pkts)
const __m128i rss_vlan_msk = _mm_set_epi32(
0x1c03804, 0x1c03804, 0x1c03804, 0x1c03804);
+ const __m128i cksum_mask = _mm_set_epi32(
+ PKT_RX_IP_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD |
+ PKT_RX_L4_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD |
+ PKT_RX_EIP_CKSUM_BAD,
+ PKT_RX_IP_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD |
+ PKT_RX_L4_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD |
+ PKT_RX_EIP_CKSUM_BAD,
+ PKT_RX_IP_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD |
+ PKT_RX_L4_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD |
+ PKT_RX_EIP_CKSUM_BAD,
+ PKT_RX_IP_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD |
+ PKT_RX_L4_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD |
+ PKT_RX_EIP_CKSUM_BAD);
+
/* map rss and vlan type to rss hash and vlan flag */
const __m128i vlan_flags = _mm_set_epi8(0, 0, 0, 0,
0, 0, 0, 0,
@@ -160,14 +174,17 @@ desc_to_olflags_v(__m128i descs[4], struct rte_mbuf **rx_pkts)
0, 0, PKT_RX_FDIR, 0);
const __m128i l3_l4e_flags = _mm_set_epi8(0, 0, 0, 0, 0, 0, 0, 0,
- PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD,
- PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD,
- PKT_RX_EIP_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD,
- PKT_RX_EIP_CKSUM_BAD,
- PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD,
- PKT_RX_L4_CKSUM_BAD,
- PKT_RX_IP_CKSUM_BAD,
- 0);
+ /* shift right 1 bit to make sure it not exceed 255 */
+ (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
+ PKT_RX_IP_CKSUM_BAD) >> 1,
+ (PKT_RX_IP_CKSUM_GOOD | PKT_RX_EIP_CKSUM_BAD |
+ PKT_RX_L4_CKSUM_BAD) >> 1,
+ (PKT_RX_EIP_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
+ (PKT_RX_IP_CKSUM_GOOD | PKT_RX_EIP_CKSUM_BAD) >> 1,
+ (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
+ (PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD) >> 1,
+ PKT_RX_IP_CKSUM_BAD >> 1,
+ (PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_GOOD) >> 1);
vlan0 = _mm_unpackhi_epi32(descs[0], descs[1]);
vlan1 = _mm_unpackhi_epi32(descs[2], descs[3]);
@@ -181,6 +198,10 @@ desc_to_olflags_v(__m128i descs[4], struct rte_mbuf **rx_pkts)
l3_l4e = _mm_srli_epi32(vlan1, 22);
l3_l4e = _mm_shuffle_epi8(l3_l4e_flags, l3_l4e);
+ /* then we shift left 1 bit */
+ l3_l4e = _mm_slli_epi32(l3_l4e, 1);
+ /* we need to mask out the reduntant bits */
+ l3_l4e = _mm_and_si128(l3_l4e, cksum_mask);
vlan0 = _mm_or_si128(vlan0, rss);
vlan0 = _mm_or_si128(vlan0, l3_l4e);
--
2.7.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] net/i40e: fix x86 vPMD Rx checksum flag
2017-01-24 18:49 [dpdk-dev] [PATCH] net/i40e: fix x86 vPMD Rx checksum flag Qi Zhang
2017-01-24 19:06 ` [dpdk-dev] [PATCH v2] " Qi Zhang
@ 2017-01-25 1:58 ` Zhang, Qi Z
1 sibling, 0 replies; 4+ messages in thread
From: Zhang, Qi Z @ 2017-01-25 1:58 UTC (permalink / raw)
To: Wu, Jingjing, Zhang, Helin; +Cc: dev
Please ignore this, I forgot to remove the debug line.
> -----Original Message-----
> From: Zhang, Qi Z
> Sent: Wednesday, January 25, 2017 2:49 AM
> To: Wu, Jingjing <jingjing.wu@intel.com>; Zhang, Helin
> <helin.zhang@intel.com>
> Cc: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>
> Subject: [PATCH] net/i40e: fix x86 vPMD Rx checksum flag
>
> When no error reported in Rx descriptor, we should set CKSUM_GOOD flag
> before return.
>
> Fixes: 9966a00a0688 ("net/i40e: enable bad checksum flags in vector Rx")ple
>
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> ---
> drivers/net/i40e/i40e_rxtx_vec_sse.c | 38
> ++++++++++++++++++++++++++++--------
> 1 file changed, 30 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/i40e/i40e_rxtx_vec_sse.c
> b/drivers/net/i40e/i40e_rxtx_vec_sse.c
> index 7c84a41..2c4061c 100644
> --- a/drivers/net/i40e/i40e_rxtx_vec_sse.c
> +++ b/drivers/net/i40e/i40e_rxtx_vec_sse.c
> @@ -148,6 +148,20 @@ desc_to_olflags_v(__m128i descs[4], struct rte_mbuf
> **rx_pkts)
> const __m128i rss_vlan_msk = _mm_set_epi32(
> 0x1c03804, 0x1c03804, 0x1c03804, 0x1c03804);
>
> + const __m128i cksum_mask = _mm_set_epi32(
> + PKT_RX_IP_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD |
> + PKT_RX_L4_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD |
> + PKT_RX_EIP_CKSUM_BAD,
> + PKT_RX_IP_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD |
> + PKT_RX_L4_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD |
> + PKT_RX_EIP_CKSUM_BAD,
> + PKT_RX_IP_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD |
> + PKT_RX_L4_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD |
> + PKT_RX_EIP_CKSUM_BAD,
> + PKT_RX_IP_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD |
> + PKT_RX_L4_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD |
> + PKT_RX_EIP_CKSUM_BAD);
> +
> /* map rss and vlan type to rss hash and vlan flag */
> const __m128i vlan_flags = _mm_set_epi8(0, 0, 0, 0,
> 0, 0, 0, 0,
> @@ -160,14 +174,17 @@ desc_to_olflags_v(__m128i descs[4], struct
> rte_mbuf **rx_pkts)
> 0, 0, PKT_RX_FDIR, 0);
>
> const __m128i l3_l4e_flags = _mm_set_epi8(0, 0, 0, 0, 0, 0, 0, 0,
> - PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
> PKT_RX_IP_CKSUM_BAD,
> - PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD,
> - PKT_RX_EIP_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD,
> - PKT_RX_EIP_CKSUM_BAD,
> - PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD,
> - PKT_RX_L4_CKSUM_BAD,
> - PKT_RX_IP_CKSUM_BAD,
> - 0);
> + /* shift right 1 bit to make sure it not exceed 255 */
> + (PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD |
> + PKT_RX_IP_CKSUM_BAD) >> 1,
> + (PKT_RX_IP_CKSUM_GOOD | PKT_RX_EIP_CKSUM_BAD |
> + PKT_RX_L4_CKSUM_BAD) >> 1,
> + (PKT_RX_EIP_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
> + (PKT_RX_IP_CKSUM_GOOD | PKT_RX_EIP_CKSUM_BAD) >> 1,
> + (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD) >> 1,
> + (PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD) >> 1,
> + PKT_RX_IP_CKSUM_BAD >> 1,
> + (PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_GOOD) >> 1);
>
> vlan0 = _mm_unpackhi_epi32(descs[0], descs[1]);
> vlan1 = _mm_unpackhi_epi32(descs[2], descs[3]); @@ -181,6 +198,10
> @@ desc_to_olflags_v(__m128i descs[4], struct rte_mbuf **rx_pkts)
>
> l3_l4e = _mm_srli_epi32(vlan1, 22);
> l3_l4e = _mm_shuffle_epi8(l3_l4e_flags, l3_l4e);
> + /* then we shift left 1 bit */
> + l3_l4e = _mm_slli_epi32(l3_l4e, 1);
> + /* we need to mask out the reduntant bits */
> + l3_l4e = _mm_and_si128(l3_l4e, cksum_mask);
>
> vlan0 = _mm_or_si128(vlan0, rss);
> vlan0 = _mm_or_si128(vlan0, l3_l4e);
> @@ -189,6 +210,7 @@ desc_to_olflags_v(__m128i descs[4], struct rte_mbuf
> **rx_pkts)
> rx_pkts[1]->ol_flags = _mm_extract_epi16(vlan0, 2);
> rx_pkts[2]->ol_flags = _mm_extract_epi16(vlan0, 4);
> rx_pkts[3]->ol_flags = _mm_extract_epi16(vlan0, 6);
> + printf("ol_flags = %lx\n", rx_pkts[0]->ol_flags);
> }
> #else
> #define desc_to_olflags_v(desc, rx_pkts) do {} while (0)
> --
> 2.7.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/i40e: fix x86 vPMD Rx checksum flag
2017-01-24 19:06 ` [dpdk-dev] [PATCH v2] " Qi Zhang
@ 2017-01-25 14:00 ` Ferruh Yigit
0 siblings, 0 replies; 4+ messages in thread
From: Ferruh Yigit @ 2017-01-25 14:00 UTC (permalink / raw)
To: Qi Zhang, jingjing.wu, helin.zhang; +Cc: dev, dpdk stable
On 1/24/2017 7:06 PM, Qi Zhang wrote:
> When no error reported in Rx descriptor, we should set
> CKSUM_GOOD flag before return.
>
> Fixes: 9966a00a0688 ("net/i40e: enable bad checksum flags in vector Rx")
>
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Cc: stable@dpdk.org
Applied to dpdk-next-net/master, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-01-25 14:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-24 18:49 [dpdk-dev] [PATCH] net/i40e: fix x86 vPMD Rx checksum flag Qi Zhang
2017-01-24 19:06 ` [dpdk-dev] [PATCH v2] " Qi Zhang
2017-01-25 14:00 ` Ferruh Yigit
2017-01-25 1:58 ` [dpdk-dev] [PATCH] " Zhang, Qi Z
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).