lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Thu, 23 Jul 2009 10:23:29 -0700
From:	Stephen Hemminger <shemminger@...tta.com>
To:	Eric Dumazet <eric.dumazet@...il.com>
Cc:	Kalpesh Rathod <kalpeshrathod@...il.com>,
	linux-net@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [query] skb alignment in tx path of driver

On Thu, 23 Jul 2009 19:16:49 +0200
Eric Dumazet <eric.dumazet@...il.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)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ