Commit fb7ee60a 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/IBCARJ


CVE: NA

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

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

Fixes: e9f0b33c ("net: txgbe: Add support for Netswift 10G NIC")
Fixes: 206f9c11 ("net: ngbe: Add Netswift Giga NIC driver")
Signed-off-by: default avatarDuanqiang Wen <duanqiangwen@net-swift.com>
parent 5189a49e
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -5438,6 +5438,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;
@@ -5540,7 +5541,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
@@ -6230,12 +6230,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;
@@ -6327,7 +6326,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;
@@ -6340,7 +6338,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 */