diff options
Diffstat (limited to 'pfinet/linux-src')
-rw-r--r-- | pfinet/linux-src/include/linux/skbuff.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/pfinet/linux-src/include/linux/skbuff.h b/pfinet/linux-src/include/linux/skbuff.h index 00f9ab2a..46eb995e 100644 --- a/pfinet/linux-src/include/linux/skbuff.h +++ b/pfinet/linux-src/include/linux/skbuff.h @@ -498,6 +498,30 @@ static __inline__ int skb_tailroom(struct sk_buff *skb) return skb->end-skb->tail; } +/* + * CPUs often take a performance hit when accessing unaligned memory + * locations. The actual performance hit varies, it can be small if the + * hardware handles it or large if we have to take an exception and fix it + * in software. + * + * Since an ethernet header is 14 bytes network drivers often end up with + * the IP header at an unaligned offset. The IP header can be aligned by + * shifting the start of the packet by 2 bytes. Drivers should do this + * with: + * + * skb_reserve(skb, NET_IP_ALIGN); + * + * The downside to this alignment of the IP header is that the DMA is now + * unaligned. On some architectures the cost of an unaligned DMA is high + * and this cost outweighs the gains made by aligning the IP header. + * + * Since this trade off varies between architectures, we allow NET_IP_ALIGN + * to be overridden. + */ +#ifndef NET_IP_ALIGN +#define NET_IP_ALIGN 2 +#endif + static __inline__ void skb_reserve(struct sk_buff *skb, unsigned int len) { skb->data+=len; |