Re: [Uclinux-dist-devel] [PATCH 1/2] net: dsa: introduce STPID switch tagging handling code
From: Lennert Buytenhek <hidden>
Date: 2010-08-10 14:05:53
From: Lennert Buytenhek <hidden>
Date: 2010-08-10 14:05:53
On Thu, Jul 29, 2010 at 01:50:45PM -0400, Mike Frysinger wrote:
quoted
quoted
quoted
quoted
quoted
+ 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?