Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1178696

Re: [PATCH v3 1/3] net: dsa: mv88e6xxx: add debugfs interface for VTU

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Guenter Roeck <linux@roeck-us.net>
Newsgroups linux.kernel
Subject Re: [PATCH v3 1/3] net: dsa: mv88e6xxx: add debugfs interface for VTU
Date Tue, 07 Jul 2015 18:20:01 +0200
Message-ID <pJDLb-7RF-3@gated-at.bofh.it> (permalink)
References <pJ4aJ-2gZ-3@gated-at.bofh.it> <pJ4aJ-2gZ-1@gated-at.bofh.it> <pJqEh-87D-1@gated-at.bofh.it> <pJDrP-7uN-9@gated-at.bofh.it>
X-Original-To Vivien Didelot <vivien.didelot@savoirfairelinux.com>, Andrew Lunn <andrew@lunn.ch>
Dkim-Signature v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=roeck-us.net; s=default; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:References:Subject:CC:To:MIME-Version:From:Date:Message-ID; bh=5GdKQ61k7GuAtWYaDx1q71vnCPK+FJj++jenzLlykTs=; b=QR1XGgzsLov9/Hf10xBj9U0G+UQG5WlWK/A0mygOA2PvkH0uGuaW5B9ScuxoXLRI2SQDKSmfJ9iYZbJF5KvuzKKid4vuGfGBmUXNYVwkUHMzUnZQ7o45ZADbtLQLei7A7S6eote87pjBfrw+U7yCj5NcxUWYoZ8G/affFotH/0w=;
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0
MIME-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Authenticated_Sender linux@roeck-us.net
X-Outgoing-Spam-Status No, score=-1.0
X-Antiabuse This header was added to track abuse, please include it with any abuse report
X-Antiabuse Primary Hostname - bh-25.webhostbox.net
X-Antiabuse Original Domain - vger.kernel.org
X-Antiabuse Originator/Caller UID/GID - [47 12] / [47 12]
X-Antiabuse Sender Address Domain - roeck-us.net
X-Get-Message-Sender-Via bh-25.webhostbox.net: authenticated_id: linux@roeck-us.net
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 125
Organization linux.* mail to news gateway
X-Original-Cc netdev <netdev@vger.kernel.org>, David <davem@davemloft.net>, Scott Feldman <sfeldma@gmail.com>, Jiri Pirko <jiri@resnulli.us>, Florian Fainelli <f.fainelli@gmail.com>, linux-kernel <linux-kernel@vger.kernel.org>, kernel <kernel@savoirfairelinux.com>
X-Original-Date Tue, 07 Jul 2015 09:11:30 -0700
X-Original-Message-ID <559BFA32.8010004@roeck-us.net>
X-Original-References <1436148893-14379-1-git-send-email-vivien.didelot@savoirfairelinux.com> <1436148893-14379-2-git-send-email-vivien.didelot@savoirfairelinux.com> <20150707020818.GB5540@lunn.ch> <1165322565.210276.1436284349938.JavaMail.zimbra@savoirfairelinux.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref aioe.org linux.kernel:1178696

Show key headers only | View raw


On 07/07/2015 08:52 AM, Vivien Didelot wrote:
> Hi Andrew,
>
> On Jul 6, 2015, at 10:08 PM, Andrew Lunn andrew@lunn.ch wrote:
>
>>> +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;
>>
>> Hi Vivien
>>
>> It looks like you still have up to 7 ports, rather than use
>> ps->num_ports. I have a ten port switch i would like to use VLANs with
>> :-)
>>
>>> +
>>> +		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;
>>> +		} else {
>>> +			entry->fid = 0;
>>> +			entry->sid = 0;
>>> +		}
>>> +	}
>>> +
>>> +	return 0;
>>> +}
>>> +
>>> +static int _mv88e6xxx_vtu_loadpurge(struct dsa_switch *ds,
>>> +				    struct mv88e6xxx_vtu_entry *entry)
>>> +{
>>> +	u16 data = 0;
>>> +	int ret, i;
>>> +
>>> +	ret = _mv88e6xxx_vtu_wait(ds);
>>> +	if (ret < 0)
>>> +		return ret;
>>> +
>>> +	if (entry->valid) {
>>> +		/* Set Data Register, ports 0-3, offsets 0, 4, 8, 12 */
>>> +		for (data = i = 0; i < 4; ++i)
>>> +			data |= entry->tags[i] << (i * 4);
>>> +		ret = _mv88e6xxx_reg_write(ds, REG_GLOBAL, GLOBAL_VTU_DATA_0_3,
>>> +					   data);
>>> +		if (ret < 0)
>>> +			return ret;
>>> +
>>> +		/* Set Data Register, ports 4-6, offsets 0, 4, 8 */
>>> +		for (data = 0, i = 4; i < 7; ++i)
>>> +			data |= entry->tags[i] << ((i - 4) * 4);
>>> +		ret = _mv88e6xxx_reg_write(ds, REG_GLOBAL, GLOBAL_VTU_DATA_4_7,
>>> +					   data);
>>
>> Same again here.
>>
>>       Andrew
>
> Indeed, I intentionally kept it as is, since the 88E6352 datasheet is not
> really clear about this. I see that the register 0x09 (called
> GLOBAL_VTU_DATA_8_11 in mv88e6xxx.h) only contains VID priority related bits in
> 15:12, in my case. As bits 11:0 are reserved, I suspect that the offsets of
> Member TagP7, Member TagP8 and Member TagP9 are respectively 0, 4 and 8 for
> you. Can you confirm? If so, I'll make that generic with these values.
>

For 6152 and 6185: Port 7 is in bit 12:15 of GLOBAL_VTU_DATA_4_7, port 8 and 9
are in register 9, bit 0:3 and 4:7.

Guenter

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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 0/3] net: dsa: mv88e6xxx: add support for VLAN Table Unit Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2015-07-06 04:20 +0200
  [PATCH v3 2/3] net: dsa: add support for switchdev VLAN objects Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2015-07-06 04:20 +0200
  [PATCH v3 1/3] net: dsa: mv88e6xxx: add debugfs interface for VTU Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2015-07-06 04:20 +0200
    Re: [PATCH v3 1/3] net: dsa: mv88e6xxx: add debugfs interface for  VTU Guenter Roeck <linux@roeck-us.net> - 2015-07-07 18:20 +0200
    Re: [PATCH v3 1/3] net: dsa: mv88e6xxx: add debugfs interface for  VTU Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2015-07-07 18:20 +0200
    Re: [PATCH v3 1/3] net: dsa: mv88e6xxx: add debugfs interface for VTU Andrew Lunn <andrew@lunn.ch> - 2015-07-07 18:20 +0200
  [PATCH v3 3/3] net: dsa: mv88e6xxx: add switchdev VLAN operations Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2015-07-06 04:20 +0200
  Re: [PATCH v3 0/3] net: dsa: mv88e6xxx: add support for VLAN Table  Unit Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2015-07-07 18:20 +0200
    Re: [PATCH v3 0/3] net: dsa: mv88e6xxx: add support for VLAN Table  Unit Andrew Lunn <andrew@lunn.ch> - 2015-07-07 18:30 +0200

csiph-web