netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lennert Buytenhek <buytenh@wantstofly.org>
To: Mike Frysinger <vapier.adi@gmail.com>
Cc: Karl Beldan <karl.beldan@gmail.com>,
	netdev@vger.kernel.org, uclinux-dist-devel@blackfin.uclinux.org
Subject: Re: [Uclinux-dist-devel] [PATCH 1/2] net: dsa: introduce STPID switch tagging handling code
Date: Tue, 10 Aug 2010 16:05:52 +0200	[thread overview]
Message-ID: <20100810140552.GV8876@mail.wantstofly.org> (raw)
In-Reply-To: <AANLkTinNiE1BE=HuwVG2Tom922XJXxQDB-JMsPYimPTk@mail.gmail.com>

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?

  reply	other threads:[~2010-08-10 14:05 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-21 13:37 [PATCH 1/2] net: dsa: introduce STPID switch tagging handling code Mike Frysinger
2010-07-21 13:37 ` [PATCH 2/2] net: dsa: introduce MICREL KSZ8893MQL/BL ethernet switch chip support Mike Frysinger
2010-07-21 15:16   ` Lennert Buytenhek
2010-07-21 15:33     ` Eric Dumazet
2010-07-21 15:36       ` Lennert Buytenhek
2010-07-21 16:40       ` Joe Perches
2010-07-21 16:05     ` [Uclinux-dist-devel] " Mike Frysinger
2010-07-21 20:31       ` Karl Beldan
2010-07-21 21:00         ` Mike Frysinger
2010-07-22 19:27           ` Karl Beldan
     [not found]     ` <20100721151608.GM21121-SHk0+jKqY/D5VnbZ9m/NDkB+6BGkLq7r@public.gmane.org>
2010-07-21 17:23       ` David Miller
2010-07-21 16:29   ` [PATCH 2/2 v2] " Mike Frysinger
2010-07-21 20:45     ` Karl Beldan
2010-07-21 15:02 ` [PATCH 1/2] net: dsa: introduce STPID switch tagging handling code Lennert Buytenhek
2010-07-21 15:29   ` [Uclinux-dist-devel] " Mike Frysinger
2010-07-21 15:35     ` Lennert Buytenhek
2010-07-21 16:08       ` Mike Frysinger
2010-07-29 17:50         ` Mike Frysinger
2010-08-10 14:05           ` Lennert Buytenhek [this message]
2010-08-10 17:04             ` Mike Frysinger
2010-08-12 22:38               ` Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100810140552.GV8876@mail.wantstofly.org \
    --to=buytenh@wantstofly.org \
    --cc=karl.beldan@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=uclinux-dist-devel@blackfin.uclinux.org \
    --cc=vapier.adi@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).