Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Mar 2016 03:16:56 +0000 (UTC)
From:      Luiz Otavio O Souza <loos@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r297132 - head/sys/arm/ti/cpsw
Message-ID:  <201603210316.u2L3GuXO091542@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: loos
Date: Mon Mar 21 03:16:56 2016
New Revision: 297132
URL: https://svnweb.freebsd.org/changeset/base/297132

Log:
  Enable multicast addresses on vlan ports.  Fixes the reception of broadcast
  packets on vlan aware mode.
  
  Sponsored by:	Rubicon Communications (Netgate)

Modified:
  head/sys/arm/ti/cpsw/if_cpsw.c
  head/sys/arm/ti/cpsw/if_cpswreg.h

Modified: head/sys/arm/ti/cpsw/if_cpsw.c
==============================================================================
--- head/sys/arm/ti/cpsw/if_cpsw.c	Mon Mar 21 02:38:21 2016	(r297131)
+++ head/sys/arm/ti/cpsw/if_cpsw.c	Mon Mar 21 03:16:56 2016	(r297132)
@@ -140,7 +140,8 @@ static void cpsw_ale_read_entry(struct c
 static void cpsw_ale_write_entry(struct cpsw_softc *, uint16_t, uint32_t *);
 static int cpsw_ale_mc_entry_set(struct cpsw_softc *, uint8_t, int, uint8_t *);
 static void cpsw_ale_dump_table(struct cpsw_softc *);
-static int cpsw_ale_update_vlan_table(struct cpsw_softc *, int, int, int);
+static int cpsw_ale_update_vlan_table(struct cpsw_softc *, int, int, int, int,
+	int);
 static int cpswp_ale_update_addresses(struct cpswp_softc *, int);
 
 /* Statistics and sysctls. */
@@ -1148,8 +1149,9 @@ cpswp_init_locked(void *arg)
 		cpsw_write_4(sc->swsc, CPSW_PORT_P_VLAN(sc->unit + 1),
 		    sc->vlan & 0xfff);
 		cpsw_ale_update_vlan_table(sc->swsc, sc->vlan,
-		    (1 << (sc->unit + 1)) | (1 << 0),
-		    (1 << (sc->unit + 1)) | (1 << 0));
+		    (1 << (sc->unit + 1)) | (1 << 0), /* Member list */
+		    (1 << (sc->unit + 1)) | (1 << 0), /* Untagged egress */
+		    (1 << (sc->unit + 1)) | (1 << 0), 0); /* mcast reg flood */
 	}
 
 	mii_mediachg(sc->mii);
@@ -2368,7 +2370,8 @@ cpswp_ale_update_addresses(struct cpswp_
 }
 
 static int
-cpsw_ale_update_vlan_table(struct cpsw_softc *sc, int vlan, int ports, int untag)
+cpsw_ale_update_vlan_table(struct cpsw_softc *sc, int vlan, int ports,
+	int untag, int mcregflood, int mcunregflood)
 {
 	int free_index, i, matching_index;
 	uint32_t ale_entry[3];
@@ -2394,7 +2397,8 @@ cpsw_ale_update_vlan_table(struct cpsw_s
 		i = free_index;
 	}
 
-	ale_entry[0] = (untag & 7) << 24 | (ports & 7);
+	ale_entry[0] = (untag & 7) << 24 | (mcregflood & 7) << 16 |
+	    (mcunregflood & 7) << 8 | (ports & 7);
 	ale_entry[1] = ALE_TYPE_VLAN << 28 | vlan << 16;
 	ale_entry[2] = 0;
 	cpsw_ale_write_entry(sc, i, ale_entry);

Modified: head/sys/arm/ti/cpsw/if_cpswreg.h
==============================================================================
--- head/sys/arm/ti/cpsw/if_cpswreg.h	Mon Mar 21 02:38:21 2016	(r297131)
+++ head/sys/arm/ti/cpsw/if_cpswreg.h	Mon Mar 21 03:16:56 2016	(r297132)
@@ -98,8 +98,8 @@
 #define	 ALE_TYPE_VLAN			2
 #define	 ALE_TYPE_VLAN_ADDR		3
 #define	 ALE_VLAN(_a)			((_a[1] >> 16) & 0xfff)
-#define	 ALE_VLAN_REGFLOOD(_a)		((_a[0] >> 8) & 7)
-#define	 ALE_VLAN_UNREGFLOOD(_a)	((_a[0] >> 16) & 7)
+#define	 ALE_VLAN_UNREGFLOOD(_a)	((_a[0] >> 8) & 7)
+#define	 ALE_VLAN_REGFLOOD(_a)		((_a[0] >> 16) & 7)
 #define	 ALE_VLAN_UNTAG(_a)		((_a[0] >> 24) & 7)
 #define	 ALE_VLAN_MEMBERS(_a)		(_a[0] & 7)
 #define	CPSW_ALE_PORTCTL(p)		(CPSW_ALE_OFFSET + 0x40 + ((p) * 0x04))



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201603210316.u2L3GuXO091542>