summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/freescale/fec_main.c
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2014-03-12 17:32:11 +0000
committerRussell King <rmk+kernel@arm.linux.org.uk>2014-10-17 14:35:32 +0100
commita60caabbf5f4ac525ec3807128b87f57dd01278a (patch)
tree11cdc4c0e940644b6b629757ba2f633e05154055 /drivers/net/ethernet/freescale/fec_main.c
parenta1beb33c36178af3b1afda7ab47cbeb58d722b56 (diff)
net: fec: move removal of FCS from packet length to single location
Rather than keep subtracting four off the packet length throughout the receive path, do it at the point we read the packet length from the descriptor. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/net/ethernet/freescale/fec_main.c')
-rw-r--r--drivers/net/ethernet/freescale/fec_main.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 781b2c5a5abe..e8a241754a46 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1277,7 +1277,13 @@ fec_enet_rx(struct net_device *ndev, int budget)
/* Process the incoming frame. */
ndev->stats.rx_packets++;
- pkt_len = bdp->bd.cbd_datlen;
+
+ /*
+ * The packet length includes FCS, but we don't want
+ * to include that when passing upstream as it messes
+ * up bridging applications.
+ */
+ pkt_len = bdp->bd.cbd_datlen - 4;
ndev->stats.rx_bytes += pkt_len;
data = fep->rx_skbuff[index]->data;
@@ -1301,18 +1307,15 @@ fec_enet_rx(struct net_device *ndev, int budget)
}
/* This does 16 byte alignment, exactly what we need.
- * The packet length includes FCS, but we don't want to
- * include that when passing upstream as it messes up
- * bridging applications.
*/
- skb = netdev_alloc_skb(ndev, pkt_len - 4 + NET_IP_ALIGN);
+ skb = netdev_alloc_skb(ndev, pkt_len + NET_IP_ALIGN);
if (unlikely(!skb)) {
ndev->stats.rx_dropped++;
} else {
int payload_offset = (2 * ETH_ALEN);
skb_reserve(skb, NET_IP_ALIGN);
- skb_put(skb, pkt_len - 4); /* Make room */
+ skb_put(skb, pkt_len); /* Make room */
/* Extract the frame data without the VLAN header. */
skb_copy_to_linear_data(skb, data, (2 * ETH_ALEN));
@@ -1320,7 +1323,7 @@ fec_enet_rx(struct net_device *ndev, int budget)
payload_offset = (2 * ETH_ALEN) + VLAN_HLEN;
skb_copy_to_linear_data_offset(skb, (2 * ETH_ALEN),
data + payload_offset,
- pkt_len - 4 - (2 * ETH_ALEN));
+ pkt_len - (2 * ETH_ALEN));
skb->protocol = eth_type_trans(skb, ndev);