All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafał Miłecki" <zajec5@gmail.com>
To: Hauke Mehrtens <hauke@hauke-m.de>
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH] bgmac: fix unaligned accesses to network headers
Date: Mon, 18 Feb 2013 17:14:25 +0100	[thread overview]
Message-ID: <CACna6ry0DWdnsLv0MLERkg8evYpgzAFvYEJes3Jn71iCPkJVjw@mail.gmail.com> (raw)
In-Reply-To: <1361025154-11612-1-git-send-email-hauke@hauke-m.de>

2013/2/16 Hauke Mehrtens <hauke@hauke-m.de>:
> Without this patch I get many unaligned access warnings per packet,
> this patches fixes them all. This should improve performance ony some
> systems like mips.
>
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
>  drivers/net/ethernet/broadcom/bgmac.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c
> index d341090..f9b1bc8 100644
> --- a/drivers/net/ethernet/broadcom/bgmac.c
> +++ b/drivers/net/ethernet/broadcom/bgmac.c
> @@ -301,8 +301,9 @@ static int bgmac_dma_rx_read(struct bgmac *bgmac, struct bgmac_dma_ring *ring,
>                         bgmac_err(bgmac, "Found poisoned packet at slot %d, DMA issue!\n",
>                                   ring->start);
>                 } else {
> -                       new_skb = netdev_alloc_skb(bgmac->net_dev, len);
> +                       new_skb = netdev_alloc_skb(bgmac->net_dev, len + 2);
>                         if (new_skb) {
> +                               skb_reserve(new_skb, 2);

I never understood that code in b44, glad you hit that warnings! ;)

The version with netdev_alloc_skb_ip_align looks much better (no more
magic numbers), b44 should be converted too.

Thanks for your patch!

-- 
Rafał

      parent reply	other threads:[~2013-02-18 16:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-16 14:32 [PATCH] bgmac: fix unaligned accesses to network headers Hauke Mehrtens
2013-02-16 18:36 ` Stephen Hemminger
2013-02-16 19:01   ` Hauke Mehrtens
2013-02-18 16:14 ` Rafał Miłecki [this message]

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=CACna6ry0DWdnsLv0MLERkg8evYpgzAFvYEJes3Jn71iCPkJVjw@mail.gmail.com \
    --to=zajec5@gmail.com \
    --cc=davem@davemloft.net \
    --cc=hauke@hauke-m.de \
    --cc=netdev@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.