Skip to content

Commit

Permalink
net/bnxt: fix Rx checksum flags
Browse files Browse the repository at this point in the history
For frames where the hardware is not able to calculate checksum
we are indicating such frames to be bad. And that is incorrect.
Indicate PKT_RX_IP_CKSUM_UNKNOWN or PKT_RX_L4_CKSUM_UNKNOWN
for such frames.

Fixes: 7ec39d8 ("net/bnxt: update status of Rx IP/L4 CKSUM")
Cc: stable@dpdk.org

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
  • Loading branch information
ajitkhaparde authored and Ferruh Yigit committed May 22, 2018
1 parent 7f79907 commit 65ee636
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/net/bnxt/bnxt_rxr.c
Expand Up @@ -464,11 +464,15 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,

if (likely(RX_CMP_IP_CS_OK(rxcmp1)))
mbuf->ol_flags |= PKT_RX_IP_CKSUM_GOOD;
else if (likely(RX_CMP_IP_CS_UNKNOWN(rxcmp1)))
mbuf->ol_flags |= PKT_RX_IP_CKSUM_UNKNOWN;
else
mbuf->ol_flags |= PKT_RX_IP_CKSUM_BAD;

if (likely(RX_CMP_L4_CS_OK(rxcmp1)))
mbuf->ol_flags |= PKT_RX_L4_CKSUM_GOOD;
else if (likely(RX_CMP_L4_CS_UNKNOWN(rxcmp1)))
mbuf->ol_flags |= PKT_RX_L4_CKSUM_UNKNOWN;
else
mbuf->ol_flags |= PKT_RX_L4_CKSUM_BAD;

Expand Down
6 changes: 6 additions & 0 deletions drivers/net/bnxt/bnxt_rxr.h
Expand Up @@ -36,6 +36,9 @@
(((rxcmp1)->flags2 & RX_CMP_L4_CS_BITS) && \
!((rxcmp1)->errors_v2 & RX_CMP_L4_CS_ERR_BITS))

#define RX_CMP_L4_CS_UNKNOWN(rxcmp1) \
!((rxcmp1)->flags2 & RX_CMP_L4_CS_BITS)

#define RX_CMP_IP_CS_ERR_BITS \
rte_cpu_to_le_32(RX_PKT_CMPL_ERRORS_IP_CS_ERROR | \
RX_PKT_CMPL_ERRORS_T_IP_CS_ERROR)
Expand All @@ -48,6 +51,9 @@
(((rxcmp1)->flags2 & RX_CMP_IP_CS_BITS) && \
!((rxcmp1)->errors_v2 & RX_CMP_IP_CS_ERR_BITS))

#define RX_CMP_IP_CS_UNKNOWN(rxcmp1) \
!((rxcmp1)->flags2 & RX_CMP_IP_CS_BITS)

enum pkt_hash_types {
PKT_HASH_TYPE_NONE, /* Undefined type */
PKT_HASH_TYPE_L2, /* Input: src_MAC, dest_MAC */
Expand Down

0 comments on commit 65ee636

Please sign in to comment.