osi dma: fix mgbe rx checksum flags

Issue description:
- IPV4 CSUM SW flag is always set without checking HW flags.

Fix description:
- Set IPV4 CSUM SW flag only if packet type is > 0 in rdes3.
- Check for IPHE and CSUM errors from rdes3.ellt only if
  rdes3.es bit is set.

Bug 4611476

Change-Id: Iaaf56b4cc122fd51e29f12f759ac7e3a3905a067
Signed-off-by: Hareesh Kesireddy <hkesireddy@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/kernel/nvethernetrm/+/3119885
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
(cherry picked from commit 39e36ad2cad9c7e4254c2f6eef91a7f074b207df)
Reviewed-on: https://git-master.nvidia.com/r/c/kernel/nvethernetrm/+/3137117
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Hareesh Kesireddy
2024-04-19 22:01:09 +05:30
committed by mobile promotions
parent face9ac97b
commit aa57af8328

View File

@@ -153,34 +153,39 @@ static void mgbe_get_rx_csum(const struct osi_rx_desc *const rx_desc,
nveu32_t ellt = rx_desc->rdes3 & RDES3_ELLT; nveu32_t ellt = rx_desc->rdes3 & RDES3_ELLT;
nveu32_t pkt_type; nveu32_t pkt_type;
/* Always include either checksum none/unnecessary if ((rx_desc->rdes3 & RDES3_ES_MGBE) != 0U) {
* depending on status fields in desc. if (ellt == RDES3_ELLT_CSUM_ERR) {
* Hence no need to explicitly add OSI_PKT_CX_CSUM flag. rx_pkt_cx->rxcsum |= OSI_CHECKSUM_TCP_UDP_BAD;
*/ } else if (ellt == RDES3_ELLT_IPHE) {
if ((ellt != RDES3_ELLT_IPHE) && (ellt != RDES3_ELLT_CSUM_ERR)) { rx_pkt_cx->rxcsum |= OSI_CHECKSUM_IPv4_BAD;
rx_pkt_cx->rxcsum |= OSI_CHECKSUM_UNNECESSARY; } else {
} /* Do nothing */
}
rx_pkt_cx->rxcsum |= OSI_CHECKSUM_IPv4;
if (ellt == RDES3_ELLT_IPHE) {
rx_pkt_cx->rxcsum |= OSI_CHECKSUM_IPv4_BAD;
}
pkt_type = rx_desc->rdes3 & MGBE_RDES3_PT_MASK;
if (pkt_type == MGBE_RDES3_PT_IPV4_TCP) {
rx_pkt_cx->rxcsum |= OSI_CHECKSUM_TCPv4;
} else if (pkt_type == MGBE_RDES3_PT_IPV4_UDP) {
rx_pkt_cx->rxcsum |= OSI_CHECKSUM_UDPv4;
} else if (pkt_type == MGBE_RDES3_PT_IPV6_TCP) {
rx_pkt_cx->rxcsum |= OSI_CHECKSUM_TCPv6;
} else if (pkt_type == MGBE_RDES3_PT_IPV6_UDP) {
rx_pkt_cx->rxcsum |= OSI_CHECKSUM_UDPv6;
} else { } else {
/* Do nothing */ pkt_type = rx_desc->rdes3 & MGBE_RDES3_PT_MASK;
} if (pkt_type != 0U) {
/* ES is zero and PT is non-zero means
if (ellt == RDES3_ELLT_CSUM_ERR) { * HW validated CSUM, hence set UNNECESSARY flag for
rx_pkt_cx->rxcsum |= OSI_CHECKSUM_TCP_UDP_BAD; * Linux OSD.
* Remaining flags are for QNX OSD.
*/
rx_pkt_cx->rxcsum |= OSI_CHECKSUM_UNNECESSARY;
if (pkt_type == MGBE_RDES3_PT_IPV4_TCP) {
rx_pkt_cx->rxcsum |= OSI_CHECKSUM_TCPv4;
rx_pkt_cx->rxcsum |= OSI_CHECKSUM_IPv4;
} else if (pkt_type == MGBE_RDES3_PT_IPV4_UDP) {
rx_pkt_cx->rxcsum |= OSI_CHECKSUM_UDPv4;
rx_pkt_cx->rxcsum |= OSI_CHECKSUM_IPv4;
} else if (pkt_type == MGBE_RDES3_PT_IPV6_TCP) {
rx_pkt_cx->rxcsum |= OSI_CHECKSUM_TCPv6;
rx_pkt_cx->rxcsum |= OSI_CHECKSUM_IPv4;
} else if (pkt_type == MGBE_RDES3_PT_IPV6_UDP) {
rx_pkt_cx->rxcsum |= OSI_CHECKSUM_UDPv6;
rx_pkt_cx->rxcsum |= OSI_CHECKSUM_IPv4;
} else {
rx_pkt_cx->rxcsum |= OSI_CHECKSUM_IPv4;
}
}
} }
} }