Commit a6539819 authored by Duanqiang Wen's avatar Duanqiang Wen
Browse files

net: wangxun: fix tx csum by soft except tcp udp sctp

wangxun inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IBCASR


CVE: NA

-------------------------------

when l4 protocol is not tcp, udp, or sctp,
compute csum by software.otherwise, it will
cause tx hang.

Fixes: a5961b4b ("openeuler: net: ngbe: add ngbe module support")
Fixes: a493f74a ("net: txgbe: Add support for Netswift 10G NIC")
Signed-off-by: default avatarDuanqiang Wen <duanqiangwen@net-swift.com>
parent d42c1711
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -5432,6 +5432,7 @@ static void ngbe_tx_csum(struct ngbe_ring *tx_ring,
	u32 type_tucmd;

	if (skb->ip_summed != CHECKSUM_PARTIAL) {
csum_failed:
		if (!(first->tx_flags & NGBE_TX_FLAGS_HW_VLAN) &&
		    !(first->tx_flags & NGBE_TX_FLAGS_CC))
			return;
@@ -5534,7 +5535,8 @@ static void ngbe_tx_csum(struct ngbe_ring *tx_ring,
					NGBE_TXD_L4LEN_SHIFT;
			break;
		default:
			break;
			skb_checksum_help(skb);
			goto csum_failed;
		}

		/* update TX checksum flag */
+3 −4
Original line number Diff line number Diff line
@@ -6350,12 +6350,11 @@ static void txgbe_tx_csum(struct txgbe_ring *tx_ring,
	u32 vlan_macip_lens = 0;
	u32 mss_l4len_idx = 0;
	u32 tunhdr_eiplen_tunlen = 0;

	u8 tun_prot = 0;

	u32 type_tucmd;

	if (skb->ip_summed != CHECKSUM_PARTIAL) {
csum_failed:
		if (!(first->tx_flags & TXGBE_TX_FLAGS_HW_VLAN) &&
		    !(first->tx_flags & TXGBE_TX_FLAGS_CC))
			return;
@@ -6447,7 +6446,6 @@ static void txgbe_tx_csum(struct txgbe_ring *tx_ring,

		switch (l4_prot) {
		case IPPROTO_TCP:

		mss_l4len_idx = (transport_hdr.tcphdr->doff * 4) <<
				TXGBE_TXD_L4LEN_SHIFT;
			break;
@@ -6460,7 +6458,8 @@ static void txgbe_tx_csum(struct txgbe_ring *tx_ring,
					TXGBE_TXD_L4LEN_SHIFT;
			break;
		default:
			break;
			skb_checksum_help(skb);
			goto csum_failed;
		}

		/* update TX checksum flag */