netdev
[Top] [All Lists]

RE: conflicting alignment requirements

To: "Andi Kleen" <ak@xxxxxx>
Subject: RE: conflicting alignment requirements
From: "Jacob Avraham" <jacoba@xxxxxxxxx>
Date: Wed, 25 Jul 2001 18:40:27 +0200
Cc: "Network Development List" <netdev@xxxxxxxxxxx>
Importance: Normal
In-reply-to: <20010725151707.44709@colin.muc.de>
Sender: owner-netdev@xxxxxxxxxxx

> On Wed, Jul 25, 2001 at 12:57:37AM +0200, Jacob Avraham wrote:
> > I noticed that some ethernet drivers, like the tulip,
> > require that the receive buffers be 4 byte align
> > (I believe due to h/w constrains).
> > On the  other hand, some upper layer code, like tc
> > (for non x86/68k), checks if the IP header is 4 byte align,
> > and if not, doesn't handle the packet.
> > So it looks like tc and tulip can not be used on other architectures.
> >
> > Has this been discussed before and if yes what was the outcome?
> > In the short term, would that be OK to remove this restriction
> > from tc?
>
> If some network stack code checks the alignment and reject unaligned
> packets it is a bug. Could you tell exactly which code does that?
>
> -Andi
>
>
This is taken from net/sched/cls_u32.c:

static int u32_classify(struct sk_buff *skb, struct tcf_proto *tp, struct
tcf_result *res)
{
        struct {
                struct tc_u_knode *knode;
                u8                *ptr;
        } stack[TC_U32_MAXDEPTH];

        struct tc_u_hnode *ht = (struct tc_u_hnode*)tp->root;
        u8 *ptr = skb->nh.raw;
        struct tc_u_knode *n;
        int sdepth = 0;
        int off2 = 0;
        int sel = 0;
        int i;

#if !defined(__i386__) && !defined(__mc68000__)
        if ((unsigned long)ptr & 3)
                return -1;
#endif


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