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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 6 Dec 2018 14:03:45 +0100
From:   Pavel Machek <pavel@....cz>
To:     andrew@...n.ch, vivien.didelot@...oirfairelinux.com,
        netdev@...r.kernel.org, f.fainelli@...il.com
Cc:     buytenh@...vell.com, buytenh@...tstofly.org, nico@...vell.com
Subject: mv88e6060: Turn e6060 driver into e6065 driver

    
This is NOT ready for merge, as you lose support for 6060. Probably
not what you want.
    
Signed-off-by: Pavel Machek <pavel@....cz> (not ready)

diff --git a/drivers/net/dsa/mv88e6060.c b/drivers/net/dsa/mv88e6060.c
index 9e3901f18518..9c9b4792bbad 100644
--- a/drivers/net/dsa/mv88e6060.c
+++ b/drivers/net/dsa/mv88e6060.c
@@ -61,6 +61,7 @@ static const char *mv88e6060_get_name(struct mii_bus *bus, int sw_addr)
 	int ret;
 
 	ret = mdiobus_read(bus, sw_addr + REG_PORT(0), PORT_SWITCH_ID);
+	printk("e6060: get name: %lx\n", (long) ret);
 	if (ret >= 0) {
 		if (ret == PORT_SWITCH_ID_6060)
 			return "Marvell 88E6060 (A0)";
@@ -69,6 +70,8 @@ static const char *mv88e6060_get_name(struct mii_bus *bus, int sw_addr)
 			return "Marvell 88E6060 (B0)";
 		if ((ret & PORT_SWITCH_ID_6060_MASK) == PORT_SWITCH_ID_6060)
 			return "Marvell 88E6060";
+		if ((ret & PORT_SWITCH_ID_6060_MASK) == 0x0650)
+			return "Marvell 88E6065";
 	}
 
 	return NULL;
@@ -79,7 +82,7 @@ static enum dsa_tag_protocol mv88e6060_get_tag_protocol(struct dsa_switch *ds,
 {
   //return DSA_TAG_PROTO_QCA;
   //return DSA_TAG_PROTO_TRAILER;
-	return DSA_TAG_PROTO_TRAILER;
+	return DSA_TAG_PROTO_DADDR;
 }
 
 static struct mv88e6060_priv *
@@ -128,6 +131,7 @@ static int mv88e6060_switch_reset(struct dsa_switch *ds)
 			  ret & ~PORT_CONTROL_STATE_MASK);
 	}
 
+
 	/* Wait for transmit queues to drain. */
 	usleep_range(2000, 4000);
 
@@ -174,6 +178,11 @@ static int mv88e6060_setup_global(struct dsa_switch *ds)
 	return 0;
 }
 
+static int mv88e6060_setup_port_hacks(struct dsa_switch *ds, int p)
+{
+}
+
+
 static int mv88e6060_setup_port(struct dsa_switch *ds, int p)
 {
 	int addr = REG_PORT(p);
@@ -184,12 +193,17 @@ static int mv88e6060_setup_port(struct dsa_switch *ds, int p)
 	 * port, enable Ingress and Egress Trailer tagging mode.
 	 */
 	REG_WRITE(addr, PORT_CONTROL,
-		  dsa_is_cpu_port(ds, p) ?
-			PORT_CONTROL_TRAILER |
-			PORT_CONTROL_INGRESS_MODE |
-			PORT_CONTROL_STATE_FORWARDING :
-			PORT_CONTROL_STATE_FORWARDING);
-
+		  PORT_CONTROL_INITIAL_PRI_6065 |
+		  PORT_CONTROL_FLOOD_ALL_6065 |
+		  PORT_CONTROL_STATE_FORWARDING |
+		  (dsa_is_cpu_port(ds, p) ?
+		   PORT_CONTROL_HEADER |
+		   PORT_CONTROL_TRAILER_6065
+		   : 0));
+
+	if (dsa_is_cpu_port(ds, p))
+		mv88e6060_setup_port_hacks(ds, p);
+	
 	/* Port based VLAN map: give each port its own address
 	 * database, allow the CPU port to talk to each of the 'real'
 	 * ports, and allow each of the 'real' ports to only talk to
diff --git a/drivers/net/dsa/mv88e6060.h b/drivers/net/dsa/mv88e6060.h
index 10249bd16292..13f7e8a2107a 100644
--- a/drivers/net/dsa/mv88e6060.h
+++ b/drivers/net/dsa/mv88e6060.h
@@ -32,27 +32,30 @@
 #define PORT_SWITCH_ID_6060_MASK	0xfff0
 #define PORT_SWITCH_ID_6060_R1	0x0601
 #define PORT_SWITCH_ID_6060_R2	0x0602
-#define PORT_CONTROL		0x04
+#define PORT_CONTROL		0x04 /* Matches */
 #define PORT_CONTROL_FORCE_FLOW_CTRL	BIT(15)
-#define PORT_CONTROL_TRAILER	BIT(14)
-#define PORT_CONTROL_HEADER	BIT(11)
-#define PORT_CONTROL_INGRESS_MODE	BIT(8)
+#define PORT_CONTROL_TRAILER_6060	BIT(14)
+#define PORT_CONTROL_TRAILER_6065	(BIT(12) /* |  BIT(13) */)
+#define PORT_CONTROL_HEADER	BIT(11) /* Controls ingress/egress on 6065, 2 byte headers? */
+#define PORT_CONTROL_INGRESS_MODE_6060	BIT(8)
 #define PORT_CONTROL_VLAN_TUNNEL	BIT(7)
-#define PORT_CONTROL_STATE_MASK	0x03
+#define PORT_CONTROL_INITIAL_PRI_6065   BIT(4)
+#define PORT_CONTROL_FLOOD_ALL_6065     (BIT(2) | BIT(3))
+#define PORT_CONTROL_STATE_MASK	0x03 /* Matches */
 #define PORT_CONTROL_STATE_DISABLED	0x00
 #define PORT_CONTROL_STATE_BLOCKING	0x01
 #define PORT_CONTROL_STATE_LEARNING	0x02
 #define PORT_CONTROL_STATE_FORWARDING	0x03
-#define PORT_VLAN_MAP		0x06
+#define PORT_VLAN_MAP		0x06 /* Matches */
 #define PORT_VLAN_MAP_DBNUM_SHIFT	12
 #define PORT_VLAN_MAP_TABLE_MASK	0x1f
-#define PORT_ASSOC_VECTOR	0x0b
+#define PORT_ASSOC_VECTOR	0x0b /* Matches */
 #define PORT_ASSOC_VECTOR_MONITOR	BIT(15)
 #define PORT_ASSOC_VECTOR_PAV_MASK	0x1f
-#define PORT_RX_CNTR		0x10
-#define PORT_TX_CNTR		0x11
+#define PORT_RX_CNTR		0x10 /* Matches */
+#define PORT_TX_CNTR		0x11 /* Matches */
 
-#define REG_GLOBAL		0x0f
+#define REG_GLOBAL		0x0f 
 #define GLOBAL_STATUS		0x00
 #define GLOBAL_STATUS_SW_MODE_MASK	(0x3 << 12)
 #define GLOBAL_STATUS_SW_MODE_0	(0x0 << 12)

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ