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

Commit b0d1562c authored by Ben Greear's avatar Ben Greear Committed by Jeff Kirsher
Browse files

e1000: Support RX-FCS flag.



This allows the NIC to pass the Ethernet Frame Checksum
(FCS) up the stack.  Useful when sniffing packets.

Signed-off-by: default avatarBen Greear <greearb@candelatech.com>
Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 11a78dcf
Loading
Loading
Loading
Loading
+11 −10
Original line number Original line Diff line number Diff line
@@ -1071,6 +1071,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,


	netdev->features |= netdev->hw_features;
	netdev->features |= netdev->hw_features;
	netdev->hw_features |= NETIF_F_RXCSUM;
	netdev->hw_features |= NETIF_F_RXCSUM;
	netdev->hw_features |= NETIF_F_RXFCS;


	if (pci_using_dac) {
	if (pci_using_dac) {
		netdev->features |= NETIF_F_HIGHDMA;
		netdev->features |= NETIF_F_HIGHDMA;
@@ -4137,10 +4138,9 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter,
		                  ((u32)(rx_desc->errors) << 24),
		                  ((u32)(rx_desc->errors) << 24),
		                  le16_to_cpu(rx_desc->csum), skb);
		                  le16_to_cpu(rx_desc->csum), skb);


		total_rx_bytes += (skb->len - 4); /* don't count FCS */
		if (likely(!(netdev->features & NETIF_F_RXFCS)))
			pskb_trim(skb, skb->len - 4);
			pskb_trim(skb, skb->len - 4);

		/* probably a little skewed due to removing CRC */
		total_rx_bytes += skb->len;
		total_rx_packets++;
		total_rx_packets++;


		/* eth type trans needs skb->data to point to something */
		/* eth type trans needs skb->data to point to something */
@@ -4294,14 +4294,15 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
			}
			}
		}
		}


		total_rx_bytes += (length - 4); /* don't count FCS */
		total_rx_packets++;

		if (likely(!(netdev->features & NETIF_F_RXFCS)))
			/* adjust length to remove Ethernet CRC, this must be
			/* adjust length to remove Ethernet CRC, this must be
		 * done after the TBI_ACCEPT workaround above */
			 * done after the TBI_ACCEPT workaround above
			 */
			length -= 4;
			length -= 4;


		/* probably a little skewed due to removing CRC */
		total_rx_bytes += length;
		total_rx_packets++;

		e1000_check_copybreak(netdev, buffer_info, length, &skb);
		e1000_check_copybreak(netdev, buffer_info, length, &skb);


		skb_put(skb, length);
		skb_put(skb, length);