All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Kalpesh Rathod <kalpeshrathod@gmail.com>,
	linux-net@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [query] skb alignment in tx path of driver
Date: Thu, 23 Jul 2009 10:23:29 -0700	[thread overview]
Message-ID: <20090723102329.54906366@nehalam> (raw)
In-Reply-To: <4A689B01.3010007@gmail.com>

On Thu, 23 Jul 2009 19:16:49 +0200
Eric Dumazet <eric.dumazet@gmail.com> wrote:

> Kalpesh Rathod a écrit :
> > Hi,
> > 
> > I am writing n/w device driver for sdio wifi card. I am testing it on
> > embedded platform.
> > DMA controller on the platform is able to xfer data to sdio only if
> > source data buf address is 4 byte aligned.
> > 
> > The firmware on the card understands 802.3 frames with snap headers.
> > So, I convert it to the required format in my driver.
> > 4 byte additional header is also attached to this frame and sent over sdio.
> > This all conversion effectively adds 12 byes to the frame received in
> > hard_xmit method.
> > 
> > Problem is, frame received in hard_xmit method is 2 byte aligned.
> > (skb->data is 2 byte aligned). As a result,
> > after addition of 12 bytes header, skb->data remains 2 byte aligned
> > instead of 4 byte aligned. And DMA controller refuses
> > to transfer it.
> > 
> > So, how can I request IP stack so that frame received in hard_xmit is
> > on 4 byte aligned boundry?
> 
> You cannot.
> 
> Search for skb_copy_and_csum_dev() use in drivers.
> 
> drivers/net/via-rhine.c is a good example of a driver dealing with same
> alignment requirement.
> 
>         if ((rp->quirks & rqRhineI) &&
>             (((unsigned long)skb->data & 3) || skb_shinfo(skb)->nr_frags != 0 || skb->ip_summed == CHECKSUM_PARTIAL)) {
There are wrappers for two of those tests
	      (!IS_ALIGNED(skb->data, 4) || skb_has_frags(skb) || skb->ip_summed == CHECKSUM_PARTIAL)

      reply	other threads:[~2009-07-23 17:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-23 16:55 [query] skb alignment in tx path of driver Kalpesh Rathod
2009-07-23 17:16 ` Eric Dumazet
2009-07-23 17:23   ` Stephen Hemminger [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=20090723102329.54906366@nehalam \
    --to=shemminger@vyatta.com \
    --cc=eric.dumazet@gmail.com \
    --cc=kalpeshrathod@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-net@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.