Message ID | 201204031527.q33FR04i031747@farm-0027.internal.tilera.com |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
On Tue, 3 Apr 2012 11:13:56 -0400 Chris Metcalf <cmetcalf@tilera.com> wrote: > The driver uses a receive_new() routine that ends up requiring unaligned > accesses in IP header processing. If the architecture doesn't support > efficient unaligned accesses, just copy all ingress packets to the bounce > buffers instead. > > This allows the driver to be used on the Tilera TILEmpower-Gx, since > the tile architecture doesn't currently handle kernel unaligned accesses, > just userspace. > > Signed-off-by: Chris Metcalf <cmetcalf@tilera.com> There are many other encapsulation cases where IP header won't be aligned. Why not just set copybreak module option to a very large value? -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Chris Metcalf <cmetcalf@tilera.com> Date: Tue, 3 Apr 2012 11:13:56 -0400 > The driver uses a receive_new() routine that ends up requiring unaligned > accesses in IP header processing. If the architecture doesn't support > efficient unaligned accesses, just copy all ingress packets to the bounce > buffers instead. > > This allows the driver to be used on the Tilera TILEmpower-Gx, since > the tile architecture doesn't currently handle kernel unaligned accesses, > just userspace. > > Signed-off-by: Chris Metcalf <cmetcalf@tilera.com> As Stephen Hemminger alluded to, adjust the copybreak as needed. If you look at how other device drivers use this CONFIG variable, you'll get a better idea of what to do here if you want to adjust the default copybreak. Also keep in mind the issue brought up by Eric Dumazet in that not all kinds of sky2 chips would need this copybreak adjustment, only ones that have the SKY2_HW_RAM_BUFFER bit cleared. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c index 879b0a4..7a15482 100644 --- a/drivers/net/ethernet/marvell/sky2.c +++ b/drivers/net/ethernet/marvell/sky2.c @@ -2490,6 +2490,7 @@ static struct sk_buff *receive_copy(struct sky2_port *sky2, return skb; } +#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS /* Adjust length of skb with fragments to match received data */ static void skb_put_frags(struct sk_buff *skb, unsigned int hdr_space, unsigned int length) @@ -2555,6 +2556,7 @@ nomap: nobuf: return NULL; } +#endif /* CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS */ /* * Receive one packet. @@ -2598,10 +2600,12 @@ static struct sk_buff *sky2_receive(struct net_device *dev, goto error; okay: - if (length < copybreak) - skb = receive_copy(sky2, re, length); - else +#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS + if (length >= copybreak) skb = receive_new(sky2, re, length); + else +#endif + skb = receive_copy(sky2, re, length); dev->stats.rx_dropped += (skb == NULL);
The driver uses a receive_new() routine that ends up requiring unaligned accesses in IP header processing. If the architecture doesn't support efficient unaligned accesses, just copy all ingress packets to the bounce buffers instead. This allows the driver to be used on the Tilera TILEmpower-Gx, since the tile architecture doesn't currently handle kernel unaligned accesses, just userspace. Signed-off-by: Chris Metcalf <cmetcalf@tilera.com> --- drivers/net/ethernet/marvell/sky2.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-)