[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTinNiE1BE=HuwVG2Tom922XJXxQDB-JMsPYimPTk@mail.gmail.com>
Date: Thu, 29 Jul 2010 13:50:45 -0400
From: Mike Frysinger <vapier.adi@...il.com>
To: Lennert Buytenhek <buytenh@...tstofly.org>
Cc: Karl Beldan <karl.beldan@...il.com>, netdev@...r.kernel.org,
uclinux-dist-devel@...ckfin.uclinux.org,
"David S. Miller" <davem@...emloft.net>
Subject: Re: [Uclinux-dist-devel] [PATCH 1/2] net: dsa: introduce STPID switch
tagging handling code
On Wed, Jul 21, 2010 at 12:08, Mike Frysinger wrote:
> On Wed, Jul 21, 2010 at 11:35, Lennert Buytenhek wrote:
>> On Wed, Jul 21, 2010 at 11:29:30AM -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 ;)
-mike
--
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