From: Eric Dumazet <eric.dumazet@gmail.com>
To: Chris Metcalf <cmetcalf@tilera.com>
Cc: Stephen Hemminger <shemminger@vyatta.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] marvell sky2 driver: fix so it works without unaligned accesses
Date: Tue, 03 Apr 2012 18:18:36 +0200 [thread overview]
Message-ID: <1333469916.18626.284.camel@edumazet-glaptop> (raw)
In-Reply-To: <201204031527.q33FR04i031747@farm-0027.internal.tilera.com>
On Tue, 2012-04-03 at 11:13 -0400, Chris Metcalf 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>
> ---
> drivers/net/ethernet/marvell/sky2.c | 10 +++++++---
> 1 files changed, 7 insertions(+), 3 deletions(-)
>
> 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 (expensive ?) copy should be done only if (sky2->hw->flags &
SKY2_HW_RAM_BUFFER)
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
index b806d9b..3da3cdc 100644
--- a/drivers/net/ethernet/marvell/sky2.c
+++ b/drivers/net/ethernet/marvell/sky2.c
@@ -2599,7 +2599,11 @@ static struct sk_buff *sky2_receive(struct net_device *dev,
goto error;
okay:
- if (length < copybreak)
+ if ((length < copybreak)
+#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
+ || (sky2->hw->flags & SKY2_HW_RAM_BUFFER)
+#endif
+ )
skb = receive_copy(sky2, re, length);
else
skb = receive_new(sky2, re, length);
next prev parent reply other threads:[~2012-04-03 16:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-03 15:13 [PATCH] marvell sky2 driver: fix so it works without unaligned accesses Chris Metcalf
2012-04-03 16:17 ` Stephen Hemminger
2012-04-03 16:18 ` Eric Dumazet [this message]
2012-04-03 21:46 ` David Miller
2012-04-04 14:13 ` [PATCH v2] " Chris Metcalf
2012-04-04 16:04 ` Stephen Hemminger
2012-04-04 18:42 ` Stephen Hemminger
2012-04-04 21:52 ` Chris Metcalf
2012-04-04 22:10 ` [PATCH v3] sky2: copy received packets on inefficient unaligned architecture Stephen Hemminger
2012-04-04 22:14 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1333469916.18626.284.camel@edumazet-glaptop \
--to=eric.dumazet@gmail.com \
--cc=cmetcalf@tilera.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=shemminger@vyatta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox