[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100810140552.GV8876@mail.wantstofly.org>
Date: Tue, 10 Aug 2010 16:05:52 +0200
From: Lennert Buytenhek <buytenh@...tstofly.org>
To: Mike Frysinger <vapier.adi@...il.com>
Cc: Karl Beldan <karl.beldan@...il.com>, netdev@...r.kernel.org,
uclinux-dist-devel@...ckfin.uclinux.org
Subject: Re: [Uclinux-dist-devel] [PATCH 1/2] net: dsa: introduce STPID switch tagging handling code
On Thu, Jul 29, 2010 at 01:50:45PM -0400, Mike Frysinger wrote:
> >>> >> + source_port = dsa_header[1] & 0x03;
> >>> >> + if (source_port >= DSA_MAX_PORTS || ds->ports[source_port] == NULL)
> >>> >> + goto out_drop;
> >>> >> +
> >>> >> + if (((dsa_header[0] & ETH_P_8021QH) == ETH_P_8021QH) &&
> >>> >
> >>> > This is bogus -- what it does is:
> >>> >
> >>> > if ((dsa_header[0] & 0x81) == 0x81)
> >>> >
> >>> > It doesn't look like you need to mask here at all.
> >>>
> >>> where does it say dsa_header[0] will always have 0x81 set ?
> >>
> >> Eh?
> >>
> >> This code is checking whether the packet has a STPID tag on it or not.
> >> A STPID tag exists if the first 12 nibbles are 0x810.
> >>
> >> You are checking whether the first 8 nibbles of this are equal to 0x81
> >> by doing:
> >>
> >> if ((byte & 0x81) == 0x81)
> >>
> >> What if the first byte is 0x93? Or 0xc5?
> >
> > that was my point. should it be masking or doing a raw compare ?
>
> and the answer is ... ? so i can send an updated patch ;)
>From what I understand, you should just be checking for equality with
0x81 in the first byte, as that is what indicates presence of the STPID
tag.
Is the hardware you're doing this on available somewhere for me to
try things out on?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists