diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2010-08-31 14:25:32 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-09-01 13:57:55 -0400 |
commit | 86cac58b71227cc34a3d0e78f19585c0eff49ea3 (patch) | |
tree | e3329c4599474c12f17b0de5b2e8e4ff92233853 | |
parent | aed5029ead26fe47527d9e9f2052cf56b72543f0 (diff) |
skge: add GRO support
- napi_gro_flush() is exported from net/core/dev.c, to avoid
an irq_save/irq_restore in the packet receive path.
- use napi_gro_receive() instead of netif_receive_skb()
- use napi_gro_flush() before calling __napi_complete()
- turn on NETIF_F_GRO by default
- Tested on a Marvell 88E8001 Gigabit NIC
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/skge.c | 5 | ||||
-rw-r--r-- | include/linux/netdevice.h | 1 | ||||
-rw-r--r-- | net/core/dev.c | 3 |
3 files changed, 6 insertions, 3 deletions
diff --git a/drivers/net/skge.c b/drivers/net/skge.c index 40e5c46e7571..a8a63581d63d 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c | |||
@@ -3178,8 +3178,7 @@ static int skge_poll(struct napi_struct *napi, int to_do) | |||
3178 | 3178 | ||
3179 | skb = skge_rx_get(dev, e, control, rd->status, rd->csum2); | 3179 | skb = skge_rx_get(dev, e, control, rd->status, rd->csum2); |
3180 | if (likely(skb)) { | 3180 | if (likely(skb)) { |
3181 | netif_receive_skb(skb); | 3181 | napi_gro_receive(napi, skb); |
3182 | |||
3183 | ++work_done; | 3182 | ++work_done; |
3184 | } | 3183 | } |
3185 | } | 3184 | } |
@@ -3192,6 +3191,7 @@ static int skge_poll(struct napi_struct *napi, int to_do) | |||
3192 | if (work_done < to_do) { | 3191 | if (work_done < to_do) { |
3193 | unsigned long flags; | 3192 | unsigned long flags; |
3194 | 3193 | ||
3194 | napi_gro_flush(napi); | ||
3195 | spin_lock_irqsave(&hw->hw_lock, flags); | 3195 | spin_lock_irqsave(&hw->hw_lock, flags); |
3196 | __napi_complete(napi); | 3196 | __napi_complete(napi); |
3197 | hw->intr_mask |= napimask[skge->port]; | 3197 | hw->intr_mask |= napimask[skge->port]; |
@@ -3849,6 +3849,7 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port, | |||
3849 | dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG; | 3849 | dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG; |
3850 | skge->rx_csum = 1; | 3850 | skge->rx_csum = 1; |
3851 | } | 3851 | } |
3852 | dev->features |= NETIF_F_GRO; | ||
3852 | 3853 | ||
3853 | /* read the mac address */ | 3854 | /* read the mac address */ |
3854 | memcpy_fromio(dev->dev_addr, hw->regs + B2_MAC_1 + port*8, ETH_ALEN); | 3855 | memcpy_fromio(dev->dev_addr, hw->regs + B2_MAC_1 + port*8, ETH_ALEN); |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index c82220a9f3d5..af05186d5b36 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -1702,6 +1702,7 @@ extern gro_result_t dev_gro_receive(struct napi_struct *napi, | |||
1702 | extern gro_result_t napi_skb_finish(gro_result_t ret, struct sk_buff *skb); | 1702 | extern gro_result_t napi_skb_finish(gro_result_t ret, struct sk_buff *skb); |
1703 | extern gro_result_t napi_gro_receive(struct napi_struct *napi, | 1703 | extern gro_result_t napi_gro_receive(struct napi_struct *napi, |
1704 | struct sk_buff *skb); | 1704 | struct sk_buff *skb); |
1705 | extern void napi_gro_flush(struct napi_struct *napi); | ||
1705 | extern void napi_reuse_skb(struct napi_struct *napi, | 1706 | extern void napi_reuse_skb(struct napi_struct *napi, |
1706 | struct sk_buff *skb); | 1707 | struct sk_buff *skb); |
1707 | extern struct sk_buff * napi_get_frags(struct napi_struct *napi); | 1708 | extern struct sk_buff * napi_get_frags(struct napi_struct *napi); |
diff --git a/net/core/dev.c b/net/core/dev.c index 63bd20a75929..d8c43e73f0b7 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -3063,7 +3063,7 @@ out: | |||
3063 | return netif_receive_skb(skb); | 3063 | return netif_receive_skb(skb); |
3064 | } | 3064 | } |
3065 | 3065 | ||
3066 | static void napi_gro_flush(struct napi_struct *napi) | 3066 | inline void napi_gro_flush(struct napi_struct *napi) |
3067 | { | 3067 | { |
3068 | struct sk_buff *skb, *next; | 3068 | struct sk_buff *skb, *next; |
3069 | 3069 | ||
@@ -3076,6 +3076,7 @@ static void napi_gro_flush(struct napi_struct *napi) | |||
3076 | napi->gro_count = 0; | 3076 | napi->gro_count = 0; |
3077 | napi->gro_list = NULL; | 3077 | napi->gro_list = NULL; |
3078 | } | 3078 | } |
3079 | EXPORT_SYMBOL(napi_gro_flush); | ||
3079 | 3080 | ||
3080 | enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff *skb) | 3081 | enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff *skb) |
3081 | { | 3082 | { |