lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150626152344.GI9469@lunn.ch>
Date:	Fri, 26 Jun 2015 17:23:44 +0200
From:	Andrew Lunn <andrew@...n.ch>
To:	Vivien Didelot <vivien.didelot@...oirfairelinux.com>
Cc:	netdev <netdev@...r.kernel.org>, David <davem@...emloft.net>,
	Florian Fainelli <f.fainelli@...il.com>,
	Guenter Roeck <linux@...ck-us.net>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	kernel <kernel@...oirfairelinux.com>
Subject: Re: [PATCH 1/3] net: dsa: mv88e6xxx: add debugfs interface for VTU

> >> +static int _mv88e6xxx_vtu_getnext(struct dsa_switch *ds, u16 vid,
> >> +                  struct mv88e6xxx_vtu_entry *entry)
> >> +{
> >> +    int ret, i;
> >> +
> >> +    ret = _mv88e6xxx_vtu_wait(ds);
> >> +    if (ret < 0)
> >> +        return ret;
> >> +
> >> +    ret = _mv88e6xxx_reg_write(ds, REG_GLOBAL, GLOBAL_VTU_VID,
> >> +                   vid & GLOBAL_VTU_VID_MASK);
> >> +    if (ret < 0)
> >> +        return ret;
> >> +
> >> +    ret = _mv88e6xxx_vtu_cmd(ds, GLOBAL_VTU_OP_VTU_GET_NEXT);
> >> +    if (ret < 0)
> >> +        return ret;
> >> +
> >> +    ret = _mv88e6xxx_reg_read(ds, REG_GLOBAL, GLOBAL_VTU_VID);
> >> +    if (ret < 0)
> >> +        return ret;
> >> +
> >> +    entry->vid = ret & GLOBAL_VTU_VID_MASK;
> >> +    entry->valid = !!(ret & GLOBAL_VTU_VID_VALID);
> >> +
> >> +    if (entry->valid) {
> >> +        /* Ports 0-3, offsets 0, 4, 8, 12 */
> >> +        ret = _mv88e6xxx_reg_read(ds, REG_GLOBAL, GLOBAL_VTU_DATA_0_3);
> >> +        if (ret < 0)
> >> +            return ret;
> >> +
> >> +        for (i = 0; i < 4; ++i)
> >> +            entry->tags[i] = (ret >> (i * 4)) & 3;
> >> +
> >> +        /* Ports 4-6, offsets 0, 4, 8 */
> >> +        ret = _mv88e6xxx_reg_read(ds, REG_GLOBAL, GLOBAL_VTU_DATA_4_7);
> >> +        if (ret < 0)
> >> +            return ret;
> >> +
> >> +        for (i = 4; i < 7; ++i)
> >> +            entry->tags[i] = (ret >> ((i - 4) * 4)) & 3;
> >> +
> >> +        ret = _mv88e6xxx_reg_read(ds, REG_GLOBAL, GLOBAL_VTU_FID);
> >> +        if (ret < 0)
> >> +            return ret;
> >> +
> >> +        entry->fid = ret & GLOBAL_VTU_FID_MASK;
> >> +
> >> +        ret = _mv88e6xxx_reg_read(ds, REG_GLOBAL, GLOBAL_VTU_SID);
> >> +        if (ret < 0)
> >> +            return ret;
> >> +
> >> +        entry->sid = ret & GLOBAL_VTU_SID_MASK;
> > 
> > As you point out in the header file, not all switches have FID and
> > VID. A quick look at DSDT suggests for both FID and SID:
> > 
> > DEV_88E6097_FAMILY | DEV_88E6165_FAMILY | DEV_88E6351_FAMILY |
> > DEV_88E6352_FAMILY
> > 
> > Please limit access to these registers to just these families.
> 
> OK. Thanks for pointing this out. I think you meant SID instead of VID.

Yes, my error.

> Would something like the following be correct then?
> 
> #define GLOBAL_VTU_FID          0x02    /* 6097 6165 6351 6352 */
> #define GLOBAL_VTU_SID          0x03    /* 6097 6165 6351 6352 */

Yes. I've not annotated all #defines, but here there is a clear
overlap with the MAC address for some chips, so the comment is
justified.
 
>     if (mv88e6xxx_6097_family(ds) || mv88e6xxx_6165_family(ds) ||
>         mv88e6xxx_6351_family(ds) || mv88e6xxx_6352_family(ds)) {
>         ret = _mv88e6xxx_reg_read(ds, REG_GLOBAL, GLOBAL_VTU_FID);
>         if (ret < 0)
>             return ret;
> 
>         entry->fid = ret & GLOBAL_VTU_FID_MASK;
> 
>         ret = _mv88e6xxx_reg_read(ds, REG_GLOBAL, GLOBAL_VTU_SID);
>         if (ret < 0)
>             return ret;
> 
>         entry->sid = ret & GLOBAL_VTU_SID_MASK;
>     }

Maybe add an else to set sid and fid to 0?

Thanks
	Andrew
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ