Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3904dcc4 authored by Somnath Kotur's avatar Somnath Kotur Committed by David S. Miller
Browse files

be2net: Trim padded packets for Lancer



For padded packets, Lancer computes incorrect checksum. The workaround is
to trim such packets. This workaround is mainly for IPv4 packets.

Signed-off-by: default avatarKalesh AP <kalesh.purayil@emulex.com>
Signed-off-by: default avatarSomnath Kotur <somnath.kotur@emulex.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 48265667
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -860,10 +860,12 @@ static struct sk_buff *be_xmit_workarounds(struct be_adapter *adapter,


	/* For padded packets, BE HW modifies tot_len field in IP header
	/* For padded packets, BE HW modifies tot_len field in IP header
	 * incorrecly when VLAN tag is inserted by HW.
	 * incorrecly when VLAN tag is inserted by HW.
	 * For padded packets, Lancer computes incorrect checksum.
	 */
	 */
	eth_hdr_len = ntohs(skb->protocol) == ETH_P_8021Q ?
	eth_hdr_len = ntohs(skb->protocol) == ETH_P_8021Q ?
						VLAN_ETH_HLEN : ETH_HLEN;
						VLAN_ETH_HLEN : ETH_HLEN;
	if (skb->len <= 60 && vlan_tx_tag_present(skb) &&
	if (skb->len <= 60 &&
	    (lancer_chip(adapter) || vlan_tx_tag_present(skb)) &&
	    is_ipv4_pkt(skb)) {
	    is_ipv4_pkt(skb)) {
		ip = (struct iphdr *)ip_hdr(skb);
		ip = (struct iphdr *)ip_hdr(skb);
		pskb_trim(skb, eth_hdr_len + ntohs(ip->tot_len));
		pskb_trim(skb, eth_hdr_len + ntohs(ip->tot_len));