summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2014-03-12 17:49:28 +0000
committerRussell King <rmk+kernel@arm.linux.org.uk>2014-10-17 14:35:50 +0100
commit137d6c7a9eed27262541e8719292c76e3242e9d8 (patch)
treeb71bb6148ebadcf147642cdef85b90583f1334e5
parente8d8ba2f37b2f4fdf10e690e7e07ee9ff164e857 (diff)
net:fec: simplify packet data copying and vlan tag removal
Implement this as two distinct code paths: this allows non-tagged traffic to be copied in one go, whereas tagged traffic needs to be copied in two separate chunks. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--drivers/net/ethernet/freescale/fec_main.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index ab10480718a8..d26c29c914ff 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1080,6 +1080,9 @@ fec_enet_rx(struct net_device *ndev, int budget)
if (fep->quirks & FEC_QUIRK_SWAP_FRAME)
swap_buffer(data, pkt_len);
+ skb_reserve(skb, NET_IP_ALIGN);
+ skb_put(skb, pkt_len); /* Make room */
+
/* If this is a VLAN packet remove the VLAN Tag */
if (cbd_esc & BD_ENET_RX_VLAN) {
/* Push and remove the vlan tag */
@@ -1089,21 +1092,18 @@ fec_enet_rx(struct net_device *ndev, int budget)
__vlan_hwaccel_put_tag(skb,
htons(ETH_P_8021Q),
ntohs(vlan->h_vlan_TCI));
- }
-
- {
- int payload_offset = (2 * ETH_ALEN);
- skb_reserve(skb, NET_IP_ALIGN);
- 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));
- if (cbd_esc & BD_ENET_RX_VLAN)
- payload_offset = (2 * ETH_ALEN) + VLAN_HLEN;
- skb_copy_to_linear_data_offset(skb, (2 * ETH_ALEN),
- data + payload_offset,
- pkt_len - (2 * ETH_ALEN));
+ skb_copy_to_linear_data(skb, data, 2 * ETH_ALEN);
+ skb_copy_to_linear_data_offset(skb, 2 * ETH_ALEN,
+ data + 2 * ETH_ALEN +
+ VLAN_HLEN,
+ pkt_len - 2 * ETH_ALEN);
+ } else {
+ skb_copy_to_linear_data(skb, data, pkt_len);
+ }
+ {
skb->protocol = eth_type_trans(skb, ndev);
/* Get receive timestamp from the skb */