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


Groups > linux.kernel > #1395425 > unrolled thread

[RFC PATCH net-next 14/20] net: dsa: mv88e6xxx: factorize VLAN Ethertype

Started byVivien Didelot <vivien.didelot@savoirfairelinux.com>
First post2016-05-06 00:50 +0200
Last post2016-05-06 17:20 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [RFC PATCH net-next 14/20] net: dsa: mv88e6xxx: factorize VLAN Ethertype Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2016-05-06 00:50 +0200
    Re: [RFC PATCH net-next 14/20] net: dsa: mv88e6xxx: factorize VLAN  Ethertype Andrew Lunn <andrew@lunn.ch> - 2016-05-06 03:00 +0200
      Re: [RFC PATCH net-next 14/20] net: dsa: mv88e6xxx: factorize VLAN Ethertype Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2016-05-06 17:20 +0200

#1395425 — [RFC PATCH net-next 14/20] net: dsa: mv88e6xxx: factorize VLAN Ethertype

FromVivien Didelot <vivien.didelot@savoirfairelinux.com>
Date2016-05-06 00:50 +0200
Subject[RFC PATCH net-next 14/20] net: dsa: mv88e6xxx: factorize VLAN Ethertype
Message-ID<rvAfL-Dg-1@gated-at.bofh.it>
Only the 6131 driver was setting the VLAN Ethertype to 0x8100. Set it to
all models.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
 drivers/net/dsa/mv88e6131.c | 9 ++++-----
 drivers/net/dsa/mv88e6xxx.c | 8 ++++++++
 drivers/net/dsa/mv88e6xxx.h | 7 +++++++
 3 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/drivers/net/dsa/mv88e6131.c b/drivers/net/dsa/mv88e6131.c
index 013668c..4c0b1e9 100644
--- a/drivers/net/dsa/mv88e6131.c
+++ b/drivers/net/dsa/mv88e6131.c
@@ -25,6 +25,7 @@ static const struct mv88e6xxx_info mv88e6131_table[] = {
 		.num_databases = 256,
 		.num_ports = 11,
 		.flags = MV88E6XXX_FLAG_ATU |
+			MV88E6XXX_FLAG_CORE_TAG_TYPE |
 			MV88E6XXX_FLAG_PPU |
 			MV88E6XXX_FLAG_VLANTABLE |
 			MV88E6XXX_FLAG_VTU,
@@ -35,6 +36,7 @@ static const struct mv88e6xxx_info mv88e6131_table[] = {
 		.num_databases = 4096,
 		.num_ports = 10,
 		.flags = MV88E6XXX_FLAG_ATU |
+			MV88E6XXX_FLAG_CORE_TAG_TYPE |
 			MV88E6XXX_FLAG_PPU |
 			MV88E6XXX_FLAG_VLANTABLE |
 			MV88E6XXX_FLAG_VTU,
@@ -45,6 +47,7 @@ static const struct mv88e6xxx_info mv88e6131_table[] = {
 		.num_databases = 256,
 		.num_ports = 8,
 		.flags = MV88E6XXX_FLAG_ATU |
+			MV88E6XXX_FLAG_CORE_TAG_TYPE |
 			MV88E6XXX_FLAG_PPU |
 			MV88E6XXX_FLAG_VLANTABLE |
 			MV88E6XXX_FLAG_VTU,
@@ -55,6 +58,7 @@ static const struct mv88e6xxx_info mv88e6131_table[] = {
 		.num_databases = 256,
 		.num_ports = 10,
 		.flags = MV88E6XXX_FLAG_ATU |
+			MV88E6XXX_FLAG_CORE_TAG_TYPE |
 			MV88E6XXX_FLAG_PPU |
 			MV88E6XXX_FLAG_VLANTABLE |
 			MV88E6XXX_FLAG_VTU,
@@ -77,11 +81,6 @@ static int mv88e6131_setup_global(struct dsa_switch *ds)
 	int ret;
 	u32 reg;
 
-	/* Set the VLAN ethertype to 0x8100. */
-	ret = mv88e6xxx_reg_write(ps, REG_GLOBAL, GLOBAL_CORE_TAG_TYPE, 0x8100);
-	if (ret)
-		return ret;
-
 	/* Disable ARP mirroring, and configure the upstream port as
 	 * the port to which ingress and egress monitor frames are to
 	 * be sent.
diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c
index 1cba078..f7fca3e 100644
--- a/drivers/net/dsa/mv88e6xxx.c
+++ b/drivers/net/dsa/mv88e6xxx.c
@@ -2929,6 +2929,14 @@ static int _mv88e6xxx_setup_global(struct mv88e6xxx_priv_state *ps)
 	if (err)
 		return err;
 
+	/* Set the VLAN ethertype to 0x8100. */
+	if (mv88e6xxx_has(ps, MV88E6XXX_FLAG_CORE_TAG_TYPE)) {
+		err = _mv88e6xxx_reg_write(ps, REG_GLOBAL, GLOBAL_CORE_TAG_TYPE,
+					   0x8100);
+		if (err)
+			return err;
+	}
+
 	/* Set the default address aging time to 5 minutes, and
 	 * enable address learn messages to be sent to all message
 	 * ports.
diff --git a/drivers/net/dsa/mv88e6xxx.h b/drivers/net/dsa/mv88e6xxx.h
index 119271e..c8677dd 100644
--- a/drivers/net/dsa/mv88e6xxx.h
+++ b/drivers/net/dsa/mv88e6xxx.h
@@ -365,6 +365,12 @@ enum mv88e6xxx_cap {
 	 */
 	MV88E6XXX_CAP_EEPROM,
 
+	/* Core Tag Type.
+	 * Used with Double Tagged frames and ports in UseCoreTag mode.
+	 * See GLOBAL_CORE_TAG_TYPE.
+	 */
+	MV88E6XXX_CAP_CORE_TAG_TYPE,
+
 	/* Port State Filtering for 802.1D Spanning Tree.
 	 * See PORT_CONTROL_STATE_* values in the PORT_CONTROL register.
 	 */
@@ -411,6 +417,7 @@ enum mv88e6xxx_cap {
 #define MV88E6XXX_FLAG_ATU		BIT(MV88E6XXX_CAP_ATU)
 #define MV88E6XXX_FLAG_EEE		BIT(MV88E6XXX_CAP_EEE)
 #define MV88E6XXX_FLAG_EEPROM		BIT(MV88E6XXX_CAP_EEPROM)
+#define MV88E6XXX_FLAG_CORE_TAG_TYPE	BIT(MV88E6XXX_CAP_CORE_TAG_TYPE)
 #define MV88E6XXX_FLAG_PORTSTATE	BIT(MV88E6XXX_CAP_PORTSTATE)
 #define MV88E6XXX_FLAG_PPU		BIT(MV88E6XXX_CAP_PPU)
 #define MV88E6XXX_FLAG_PPU_ACTIVE	BIT(MV88E6XXX_CAP_PPU_ACTIVE)
-- 
2.8.2

[toc] | [next] | [standalone]


#1395564 — Re: [RFC PATCH net-next 14/20] net: dsa: mv88e6xxx: factorize VLAN Ethertype

FromAndrew Lunn <andrew@lunn.ch>
Date2016-05-06 03:00 +0200
SubjectRe: [RFC PATCH net-next 14/20] net: dsa: mv88e6xxx: factorize VLAN Ethertype
Message-ID<rvChB-2DB-13@gated-at.bofh.it>
In reply to#1395425
On Thu, May 05, 2016 at 06:40:58PM -0400, Vivien Didelot wrote:
> Only the 6131 driver was setting the VLAN Ethertype to 0x8100. Set it to
> all models.
> 
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
> ---
>  drivers/net/dsa/mv88e6131.c | 9 ++++-----
>  drivers/net/dsa/mv88e6xxx.c | 8 ++++++++
>  drivers/net/dsa/mv88e6xxx.h | 7 +++++++
>  3 files changed, 19 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/dsa/mv88e6131.c b/drivers/net/dsa/mv88e6131.c
> index 013668c..4c0b1e9 100644
> --- a/drivers/net/dsa/mv88e6131.c
> +++ b/drivers/net/dsa/mv88e6131.c
> @@ -25,6 +25,7 @@ static const struct mv88e6xxx_info mv88e6131_table[] = {
>  		.num_databases = 256,
>  		.num_ports = 11,
>  		.flags = MV88E6XXX_FLAG_ATU |
> +			MV88E6XXX_FLAG_CORE_TAG_TYPE |
>  			MV88E6XXX_FLAG_PPU |
>  			MV88E6XXX_FLAG_VLANTABLE |
>  			MV88E6XXX_FLAG_VTU,
> @@ -35,6 +36,7 @@ static const struct mv88e6xxx_info mv88e6131_table[] = {
>  		.num_databases = 4096,
>  		.num_ports = 10,
>  		.flags = MV88E6XXX_FLAG_ATU |
> +			MV88E6XXX_FLAG_CORE_TAG_TYPE |
>  			MV88E6XXX_FLAG_PPU |
>  			MV88E6XXX_FLAG_VLANTABLE |
>  			MV88E6XXX_FLAG_VTU,
> @@ -45,6 +47,7 @@ static const struct mv88e6xxx_info mv88e6131_table[] = {
>  		.num_databases = 256,
>  		.num_ports = 8,
>  		.flags = MV88E6XXX_FLAG_ATU |
> +			MV88E6XXX_FLAG_CORE_TAG_TYPE |
>  			MV88E6XXX_FLAG_PPU |
>  			MV88E6XXX_FLAG_VLANTABLE |
>  			MV88E6XXX_FLAG_VTU,
> @@ -55,6 +58,7 @@ static const struct mv88e6xxx_info mv88e6131_table[] = {
>  		.num_databases = 256,
>  		.num_ports = 10,
>  		.flags = MV88E6XXX_FLAG_ATU |
> +			MV88E6XXX_FLAG_CORE_TAG_TYPE |
>  			MV88E6XXX_FLAG_PPU |
>  			MV88E6XXX_FLAG_VLANTABLE |
>  			MV88E6XXX_FLAG_VTU,

Hi Vivien

Rather than repeating these flags again and again, could you add one
#define containing the flags, and then use that to initialise .flags.

	Andrew

[toc] | [prev] | [next] | [standalone]


#1395933

FromVivien Didelot <vivien.didelot@savoirfairelinux.com>
Date2016-05-06 17:20 +0200
Message-ID<rvPHQ-7CY-29@gated-at.bofh.it>
In reply to#1395564
Hi Andrew,

Andrew Lunn <andrew@lunn.ch> writes:

>> @@ -55,6 +58,7 @@ static const struct mv88e6xxx_info mv88e6131_table[] = {
>>  		.num_databases = 256,
>>  		.num_ports = 10,
>>  		.flags = MV88E6XXX_FLAG_ATU |
>> +			MV88E6XXX_FLAG_CORE_TAG_TYPE |
>>  			MV88E6XXX_FLAG_PPU |
>>  			MV88E6XXX_FLAG_VLANTABLE |
>>  			MV88E6XXX_FLAG_VTU,
>
> Rather than repeating these flags again and again, could you add one
> #define containing the flags, and then use that to initialise .flags.

Hum OK, I wasn't sure, but looking at the final mv88e6xxx_info table, I
can see that models from the same family all have the same set of flags,
even if they don't have the same number of ports or databases.

I'll add one MV88E6XXX_FLAGS_xxxx per family.

Thanks,

        Vivien

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web