net: emac: remove IBM_EMAC_RX_SKB_HEADROOM
Subsystems (2)
PATCH v2 1/1 net: emac: remove IBM_EMAC_RX_SKB_HEADROOM
The EMAC driver had a custom IBM_EMAC_RX_SKB_HEADROOM Kconfig option that reserved additional skb headroom for RX. This patch removes the option and migrates the code to use napi_alloc_skb() and netdev_alloc_skb_ip_align() in its place.
Signed-off-by Christian Lamparter <[email protected]>
--- drivers/net/ethernet/ibm/emac/Kconfig | 12 ----- drivers/net/ethernet/ibm/emac/core.c | 64 ++++++++++++++++++--------- drivers/net/ethernet/ibm/emac/core.h | 10 ++--- 3 files changed, 47 insertions(+), 39 deletions(-)
drivers/net/ethernet/ibm/emac/Kconfig +0 -12
@@ -28,18 +28,6 @@ config IBM_EMAC_RX_COPY_THRESHOLD depends on IBM_EMAC default "256" -config IBM_EMAC_RX_SKB_HEADROOM - int "Additional RX skb headroom (bytes)" - depends on IBM_EMAC - default "0" - help - Additional receive skb headroom. Note, that driver - will always reserve at least 2 bytes to make IP header - aligned, so usually there is no need to add any additional - headroom. - - If unsure, set to 0. - config IBM_EMAC_DEBUG bool "Debugging" depends on IBM_EMAC
drivers/net/ethernet/ibm/emac/core.c +44 -20
132 lines not on this page · raw message
drivers/net/ethernet/ibm/emac/core.h +3 -7
@@ -68,22 +68,18 @@ static inline int emac_rx_size(int mtu)return mal_rx_size (ETH_DATA_LEN +EMAC_MTU_OVERHEAD ); } -#define EMAC_DMA_ALIGN (x) ALIGN((x), dma_get_cache_alignment()) - -#define EMAC_RX_SKB_HEADROOM \ - EMAC_DMA_ALIGN(CONFIG_IBM_EMAC_RX_SKB_HEADROOM) -/* Size of RX skb for the given MTU */ static inline int emac_rx_skb_size (int mtu) {int size =max (mtu +EMAC_MTU_OVERHEAD ,emac_rx_size (mtu)); -return EMAC_DMA_ALIGN (size +2 ) +EMAC_RX_SKB_HEADROOM ; + +return SKB_DATA_ALIGN (size +NET_IP_ALIGN ) +NET_SKB_PAD ; }/* RX DMA sync size */ static inline int emac_rx_sync_size (int mtu) { -return EMAC_DMA_ALIGN (emac_rx_size (mtu) +2 ); +return SKB_DATA_ALIGN (emac_rx_size (mtu) +NET_IP_ALIGN ); }/* Driver statistcs is split into two parts to make it more cache friendly:
Signature · 1 line
2.20.1
David Miller
maintainerFrom: Christian Lamparter <[email protected]>
Date: Mon, 4 Feb 2019 22:58:29 +0100
Quoted 15 lines
drivers/net/ethernet/ibm/emac/core.c +11
-0@@ -1195,6 +1195,27 @@ static inline int emac_alloc_rx_skb(struct emac_instance *dev, int slot,return 0 ; } +static inline int +emac_alloc_rx_skb (struct emac_instance *dev,int slot) +{ +struct sk_buff *skb; + + skb =__netdev_alloc_skb_ip_align (dev->ndev, dev->rx_skb_size, +GFP_KERNEL ); + +return __emac_prepare_rx_skb (skb, dev, slot); +} +
drivers/net/ethernet/ibm/emac/core.c static inline int emac_alloc_rx_skb(struct emac_instance *dev, int slot, · line 1218
Quoted 10 lines
drivers/net/ethernet/ibm/emac/core.c +10
-0+static inline int +emac_alloc_rx_skb_napi (struct emac_instance *dev,int slot) +{ +struct sk_buff *skb; + + skb =napi_alloc_skb (&dev->mal->napi, dev->rx_skb_size); + +return __emac_prepare_rx_skb (skb, dev, slot); +} +
Do not use the inline keyword in foo.c files, let the compiler decide.
Thank you.