Enable multicast addresses on vlan ports. Fixes the reception of broadcast

packets on vlan aware mode.

Sponsored by:	Rubicon Communications (Netgate)
This commit is contained in:
Luiz Otavio O Souza 2016-03-21 03:16:56 +00:00
parent 672145ff55
commit 51f8a15cad
2 changed files with 11 additions and 7 deletions

View File

@ -140,7 +140,8 @@ static void cpsw_ale_read_entry(struct cpsw_softc *, uint16_t, uint32_t *);
static void cpsw_ale_write_entry(struct cpsw_softc *, uint16_t, uint32_t *); 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 int cpsw_ale_mc_entry_set(struct cpsw_softc *, uint8_t, int, uint8_t *);
static void cpsw_ale_dump_table(struct cpsw_softc *); 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); static int cpswp_ale_update_addresses(struct cpswp_softc *, int);
/* Statistics and sysctls. */ /* Statistics and sysctls. */
@ -1148,8 +1149,9 @@ cpswp_init_locked(void *arg)
cpsw_write_4(sc->swsc, CPSW_PORT_P_VLAN(sc->unit + 1), cpsw_write_4(sc->swsc, CPSW_PORT_P_VLAN(sc->unit + 1),
sc->vlan & 0xfff); sc->vlan & 0xfff);
cpsw_ale_update_vlan_table(sc->swsc, sc->vlan, cpsw_ale_update_vlan_table(sc->swsc, sc->vlan,
(1 << (sc->unit + 1)) | (1 << 0), (1 << (sc->unit + 1)) | (1 << 0), /* Member list */
(1 << (sc->unit + 1)) | (1 << 0)); (1 << (sc->unit + 1)) | (1 << 0), /* Untagged egress */
(1 << (sc->unit + 1)) | (1 << 0), 0); /* mcast reg flood */
} }
mii_mediachg(sc->mii); mii_mediachg(sc->mii);
@ -2368,7 +2370,8 @@ cpswp_ale_update_addresses(struct cpswp_softc *sc, int purge)
} }
static int 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; int free_index, i, matching_index;
uint32_t ale_entry[3]; uint32_t ale_entry[3];
@ -2394,7 +2397,8 @@ cpsw_ale_update_vlan_table(struct cpsw_softc *sc, int vlan, int ports, int untag
i = free_index; 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[1] = ALE_TYPE_VLAN << 28 | vlan << 16;
ale_entry[2] = 0; ale_entry[2] = 0;
cpsw_ale_write_entry(sc, i, ale_entry); cpsw_ale_write_entry(sc, i, ale_entry);

View File

@ -98,8 +98,8 @@
#define ALE_TYPE_VLAN 2 #define ALE_TYPE_VLAN 2
#define ALE_TYPE_VLAN_ADDR 3 #define ALE_TYPE_VLAN_ADDR 3
#define ALE_VLAN(_a) ((_a[1] >> 16) & 0xfff) #define ALE_VLAN(_a) ((_a[1] >> 16) & 0xfff)
#define ALE_VLAN_REGFLOOD(_a) ((_a[0] >> 8) & 7) #define ALE_VLAN_UNREGFLOOD(_a) ((_a[0] >> 8) & 7)
#define ALE_VLAN_UNREGFLOOD(_a) ((_a[0] >> 16) & 7) #define ALE_VLAN_REGFLOOD(_a) ((_a[0] >> 16) & 7)
#define ALE_VLAN_UNTAG(_a) ((_a[0] >> 24) & 7) #define ALE_VLAN_UNTAG(_a) ((_a[0] >> 24) & 7)
#define ALE_VLAN_MEMBERS(_a) (_a[0] & 7) #define ALE_VLAN_MEMBERS(_a) (_a[0] & 7)
#define CPSW_ALE_PORTCTL(p) (CPSW_ALE_OFFSET + 0x40 + ((p) * 0x04)) #define CPSW_ALE_PORTCTL(p) (CPSW_ALE_OFFSET + 0x40 + ((p) * 0x04))