* [PATCH 1/2] net: allow multiple dev per napi with GRO
@ 2009-04-01 21:20 Stephen Hemminger
2009-04-01 21:39 ` [PATCH 2/2] sky2: add GRO support Stephen Hemminger
2009-04-02 8:08 ` [PATCH 1/2] net: allow multiple dev per napi with GRO David Miller
0 siblings, 2 replies; 5+ messages in thread
From: Stephen Hemminger @ 2009-04-01 21:20 UTC (permalink / raw)
To: Herbert Xu, David Miller; +Cc: netdev
GRO assumes that there is a one-to-one relationship between NAPI
structure and network device. Some devices like sky2 share multiple
devices on a single interrupt so only have one NAPI handler. Rather than
split GRO from NAPI, just have GRO assume if device changes that
it is a different flow.
Signed-off-by: Stephen Hemminger <shemminger@vyatta•com>
--- a/net/core/dev.c 2009-04-01 12:02:12.381316147 -0700
+++ b/net/core/dev.c 2009-04-01 12:07:29.718192280 -0700
@@ -2472,8 +2472,9 @@ static int __napi_gro_receive(struct nap
return GRO_NORMAL;
for (p = napi->gro_list; p; p = p->next) {
- NAPI_GRO_CB(p)->same_flow = !compare_ether_header(
- skb_mac_header(p), skb_gro_mac_header(skb));
+ NAPI_GRO_CB(p)->same_flow = (p->dev == skb->dev)
+ && !compare_ether_header(skb_mac_header(p),
+ skb_gro_mac_header(skb));
NAPI_GRO_CB(p)->flush = 0;
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] sky2: add GRO support
2009-04-01 21:20 [PATCH 1/2] net: allow multiple dev per napi with GRO Stephen Hemminger
@ 2009-04-01 21:39 ` Stephen Hemminger
2009-04-02 8:08 ` David Miller
2009-04-02 8:08 ` [PATCH 1/2] net: allow multiple dev per napi with GRO David Miller
1 sibling, 1 reply; 5+ messages in thread
From: Stephen Hemminger @ 2009-04-01 21:39 UTC (permalink / raw)
To: Herbert Xu, David Miller; +Cc: netdev
Add support for generic receive offload. Also cleanup counters so
that only updated once per interrupt.
Signed-off-by: Stephen Hemminger <shemminger@vyatta•com>
----
Note: this is experimental at this point (so please hold for 2.6.31)
--- a/drivers/net/sky2.c 2009-04-01 11:51:55.822315655 -0700
+++ b/drivers/net/sky2.c 2009-04-01 13:13:40.275066435 -0700
@@ -2344,11 +2344,46 @@ static inline void sky2_tx_done(struct n
}
}
+static inline void sky2_skb_rx(const struct sky2_port *sky2,
+ u32 status, struct sk_buff *skb)
+{
+#ifdef SKY2_VLAN_TAG_USED
+ u16 vlan_tag = be16_to_cpu(sky2->rx_tag);
+ if (sky2->vlgrp && (status & GMR_FS_VLAN)) {
+ if (skb->ip_summed == CHECKSUM_NONE)
+ vlan_hwaccel_receive_skb(skb, sky2->vlgrp, vlan_tag);
+ else
+ vlan_gro_receive(&sky2->hw->napi, sky2->vlgrp,
+ vlan_tag, skb);
+ return;
+ }
+#endif
+ if (skb->ip_summed == CHECKSUM_NONE)
+ netif_receive_skb(skb);
+ else
+ napi_gro_receive(&sky2->hw->napi, skb);
+}
+
+static void sky2_rx_done(struct sky2_hw *hw, unsigned port,
+ unsigned packets, unsigned bytes)
+{
+ struct net_device *dev = hw->dev[port];
+
+ if (dev) {
+ dev->stats.rx_packets += packets;
+ dev->stats.rx_bytes += bytes;
+ dev->last_rx = jiffies;
+ sky2_rx_update(netdev_priv(dev), rxqaddr[port]);
+ }
+}
+
+
/* Process status response ring */
static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx)
{
int work_done = 0;
- unsigned rx[2] = { 0, 0 };
+ unsigned int total_bytes[2] = { 0 };
+ unsigned int total_packets[2] = { 0 };
rmb();
do {
@@ -2375,7 +2410,8 @@ static int sky2_status_intr(struct sky2_
le->opcode = 0;
switch (opcode & ~HW_OWNER) {
case OP_RXSTAT:
- ++rx[port];
+ total_packets[port]++;
+ total_bytes[port] += length;
skb = sky2_receive(dev, length, status);
if (unlikely(!skb)) {
dev->stats.rx_dropped++;
@@ -2393,18 +2429,8 @@ static int sky2_status_intr(struct sky2_
}
skb->protocol = eth_type_trans(skb, dev);
- dev->stats.rx_packets++;
- dev->stats.rx_bytes += skb->len;
- dev->last_rx = jiffies;
-#ifdef SKY2_VLAN_TAG_USED
- if (sky2->vlgrp && (status & GMR_FS_VLAN)) {
- vlan_hwaccel_receive_skb(skb,
- sky2->vlgrp,
- be16_to_cpu(sky2->rx_tag));
- } else
-#endif
- netif_receive_skb(skb);
+ sky2_skb_rx(sky2, status, skb);
/* Stop after net poll weight */
if (++work_done >= to_do)
@@ -2474,11 +2500,9 @@ static int sky2_status_intr(struct sky2_
sky2_write32(hw, STAT_CTRL, SC_STAT_CLR_IRQ);
exit_loop:
- if (rx[0])
- sky2_rx_update(netdev_priv(hw->dev[0]), Q_R1);
- if (rx[1])
- sky2_rx_update(netdev_priv(hw->dev[1]), Q_R2);
+ sky2_rx_done(hw, 0, total_packets[0], total_bytes[0]);
+ sky2_rx_done(hw, 1, total_packets[1], total_bytes[1]);
return work_done;
}
@@ -4245,6 +4269,7 @@ static __devinit struct net_device *sky2
sky2->port = port;
dev->features |= NETIF_F_TSO | NETIF_F_IP_CSUM | NETIF_F_SG;
+ dev->features |= NETIF_F_GRO;
if (highmem)
dev->features |= NETIF_F_HIGHDMA;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] net: allow multiple dev per napi with GRO
2009-04-01 21:20 [PATCH 1/2] net: allow multiple dev per napi with GRO Stephen Hemminger
2009-04-01 21:39 ` [PATCH 2/2] sky2: add GRO support Stephen Hemminger
@ 2009-04-02 8:08 ` David Miller
2009-04-02 8:28 ` Herbert Xu
1 sibling, 1 reply; 5+ messages in thread
From: David Miller @ 2009-04-02 8:08 UTC (permalink / raw)
To: shemminger; +Cc: herbert, netdev
From: Stephen Hemminger <shemminger@vyatta•com>
Date: Wed, 1 Apr 2009 14:20:20 -0700
> GRO assumes that there is a one-to-one relationship between NAPI
> structure and network device. Some devices like sky2 share multiple
> devices on a single interrupt so only have one NAPI handler. Rather than
> split GRO from NAPI, just have GRO assume if device changes that
> it is a different flow.
>
> Signed-off-by: Stephen Hemminger <shemminger@vyatta•com>
Looks good, applied.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] sky2: add GRO support
2009-04-01 21:39 ` [PATCH 2/2] sky2: add GRO support Stephen Hemminger
@ 2009-04-02 8:08 ` David Miller
0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2009-04-02 8:08 UTC (permalink / raw)
To: shemminger; +Cc: herbert, netdev
From: Stephen Hemminger <shemminger@vyatta•com>
Date: Wed, 1 Apr 2009 14:39:46 -0700
> Add support for generic receive offload. Also cleanup counters so
> that only updated once per interrupt.
>
> Signed-off-by: Stephen Hemminger <shemminger@vyatta•com>
> ----
> Note: this is experimental at this point (so please hold for 2.6.31)
Ok, please just resubmit this when -rc1 is released.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] net: allow multiple dev per napi with GRO
2009-04-02 8:08 ` [PATCH 1/2] net: allow multiple dev per napi with GRO David Miller
@ 2009-04-02 8:28 ` Herbert Xu
0 siblings, 0 replies; 5+ messages in thread
From: Herbert Xu @ 2009-04-02 8:28 UTC (permalink / raw)
To: David Miller; +Cc: shemminger, netdev
On Thu, Apr 02, 2009 at 01:08:01AM -0700, David Miller wrote:
> From: Stephen Hemminger <shemminger@vyatta•com>
> Date: Wed, 1 Apr 2009 14:20:20 -0700
>
> > GRO assumes that there is a one-to-one relationship between NAPI
> > structure and network device. Some devices like sky2 share multiple
> > devices on a single interrupt so only have one NAPI handler. Rather than
> > split GRO from NAPI, just have GRO assume if device changes that
> > it is a different flow.
> >
> > Signed-off-by: Stephen Hemminger <shemminger@vyatta•com>
>
> Looks good, applied.
Yep, looks good to me too. It's only the non-skb interface that
can't handle a shared napi as it uses napi->dev to construct the
skb.
I'm currently experimenting with a new interface to replace the
existing non-skb interface. The idea is to get the driver to do
what we currently do in napi_fraginfo_skb through helpers. This
should remove the usage of napi->dev. It should also remove the
unnecessary double-copying of the frags array.
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor•apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-04-02 8:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-01 21:20 [PATCH 1/2] net: allow multiple dev per napi with GRO Stephen Hemminger
2009-04-01 21:39 ` [PATCH 2/2] sky2: add GRO support Stephen Hemminger
2009-04-02 8:08 ` David Miller
2009-04-02 8:08 ` [PATCH 1/2] net: allow multiple dev per napi with GRO David Miller
2009-04-02 8:28 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox