netdev
[Top] [All Lists]

Re: Allow IP header alignment to be overriden

To: Scott Feldman <sfeldma@xxxxxxxxx>
Subject: Re: Allow IP header alignment to be overriden
From: Anton Blanchard <anton@xxxxxxxxx>
Date: Sat, 12 Jun 2004 00:23:37 +1000
Cc: "David S. Miller" <davem@xxxxxxxxxx>, netdev@xxxxxxxxxxx
In-reply-to: <1086939562.3657.10.camel@sfeldma-mobl2.dsl-verizon.net>
References: <20040611012727.GA27672@krispykreme> <20040610223549.5e9ad025.davem@redhat.com> <1086939562.3657.10.camel@sfeldma-mobl2.dsl-verizon.net>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mutt/1.5.6+20040523i
 
Hi,

> Would replacing "2" with a macro that's defined on a per-arch basis
> work?

Nice idea. This would avoid us adding useless padding in that case, as
we currently do:

reserve_len = 2;
skb = dev_alloc_skb(adapter->rx_buffer_len + reserve_len);
skb_reserve(skb, reserve_len);

which would be nice if we are using a power of 2 buffer size. Would
creating:

/* 
 * Network drivers want to align IP headers. Since we have 14 bytes of
 * ethernet header, adding 2 bytes will align the IP header.  However
 * this will mean we do unaligned DMA so there is a trade off.
 *
 * We allow this to be overridden per arch as the unaligned DMA cost may
 * outweigh the unaligned CPU cost.
 */
#ifndef NET_IP_ALIGN
#define NET_IP_ALIGN 2
#endif

Instead of skb_align make more sense? It does have the advantage of
removing another magic number.

Anton

<Prev in Thread] Current Thread [Next in Thread>