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:51:42 +0000
committerRussell King <rmk+kernel@arm.linux.org.uk>2014-10-17 14:35:51 +0100
commitcf532149ae68a1eeb31d2a07f0949ac116793b4d (patch)
tree0ba3b93fe7dd7707b3660fb21745f794bd869cee /drivers/net/ethernet/freescale/fec_main.c
parent137d6c7a9eed27262541e8719292c76e3242e9d8 (diff)
net:fec: move final receive to separate function
Move the final receive code sequence to a separate function. Performance tests show that having lots of code integrated into one big function can make the driver performance very dependent on compiler behaviour, and more reliable performance can be obtained by separating this out. 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.c43
1 files changed, 24 insertions, 19 deletions
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index d26c29c914ff..d90fd50f8881 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -964,6 +964,29 @@ fec_enet_tx(struct net_device *ndev)
netif_wake_queue(ndev);
}
+static void
+fec_enet_receive(struct sk_buff *skb, union bufdesc_u *bdp, struct net_device *ndev)
+{
+ struct fec_enet_private *fep = netdev_priv(ndev);
+
+ skb->protocol = eth_type_trans(skb, ndev);
+
+ /* Get receive timestamp from the skb */
+ if (fep->hwts_rx_en && fep->flags & FEC_FLAG_BUFDESC_EX)
+ fec_enet_hwtstamp(fep, bdp->ebd.ts, skb_hwtstamps(skb));
+
+ if (fep->flags & FEC_FLAG_RX_CSUM) {
+ if (!(bdp->ebd.cbd_esc & FLAG_RX_CSUM_ERROR)) {
+ /* don't check it */
+ skb->ip_summed = CHECKSUM_UNNECESSARY;
+ } else {
+ skb_checksum_none_assert(skb);
+ }
+ }
+
+ napi_gro_receive(&fep->napi, skb);
+}
+
/* During a receive, the rx_next points to the current incoming buffer.
* When we update through the ring, if the next incoming buffer has
* not been given to the system, we just set the empty indicator,
@@ -1103,25 +1126,7 @@ fec_enet_rx(struct net_device *ndev, int budget)
skb_copy_to_linear_data(skb, data, pkt_len);
}
- {
- skb->protocol = eth_type_trans(skb, ndev);
-
- /* Get receive timestamp from the skb */
- if (fep->hwts_rx_en && fep->flags & FEC_FLAG_BUFDESC_EX)
- fec_enet_hwtstamp(fep, bdp->ebd.ts,
- skb_hwtstamps(skb));
-
- if (fep->flags & FEC_FLAG_RX_CSUM) {
- if (!(cbd_esc & FLAG_RX_CSUM_ERROR)) {
- /* don't check it */
- skb->ip_summed = CHECKSUM_UNNECESSARY;
- } else {
- skb_checksum_none_assert(skb);
- }
- }
-
- napi_gro_receive(&fep->napi, skb);
- }
+ fec_enet_receive(skb, bdp, ndev);
dma_sync_single_for_device(&fep->pdev->dev, bdp->bd.cbd_bufaddr,
FEC_ENET_RX_FRSIZE, DMA_FROM_DEVICE);