aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/ti
diff options
context:
space:
mode:
authorMugunthan V N <mugunthanvnm@ti.com>2015-01-13 07:05:49 -0500
committerDavid S. Miller <davem@davemloft.net>2015-01-13 16:54:23 -0500
commit25906052d953d3fbdb7e19480b9de5e6bb949f3f (patch)
tree6ec171a214475a4d6b6711d739dd89fd8c9a4677 /drivers/net/ethernet/ti
parentfd48e639dfd3e86dd85bdeb40512a44b74b02e6f (diff)
drivers: net: cpsw: fix multicast flush in dual emac mode
Since ALE table is a common resource for both the interfaces in Dual EMAC mode and while bringing up the second interface in cpsw_ndo_set_rx_mode() all the multicast entries added by the first interface is flushed out and only second interface multicast addresses are added. Fixing this by flushing multicast addresses based on dual EMAC port vlans which will not affect the other emac port multicast addresses. Fixes: d9ba8f9 (driver: net: ethernet: cpsw: dual emac interface implementation) Cc: <stable@vger.kernel.org> # v3.9+ Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/ti')
-rw-r--r--drivers/net/ethernet/ti/cpsw.c11
-rw-r--r--drivers/net/ethernet/ti/cpsw_ale.c10
-rw-r--r--drivers/net/ethernet/ti/cpsw_ale.h2
3 files changed, 19 insertions, 4 deletions
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index e61ee8351272..64d1cef4cda1 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -610,7 +610,7 @@ static void cpsw_set_promiscious(struct net_device *ndev, bool enable)
610 610
611 /* Clear all mcast from ALE */ 611 /* Clear all mcast from ALE */
612 cpsw_ale_flush_multicast(ale, ALE_ALL_PORTS << 612 cpsw_ale_flush_multicast(ale, ALE_ALL_PORTS <<
613 priv->host_port); 613 priv->host_port, -1);
614 614
615 /* Flood All Unicast Packets to Host port */ 615 /* Flood All Unicast Packets to Host port */
616 cpsw_ale_control_set(ale, 0, ALE_P0_UNI_FLOOD, 1); 616 cpsw_ale_control_set(ale, 0, ALE_P0_UNI_FLOOD, 1);
@@ -634,6 +634,12 @@ static void cpsw_set_promiscious(struct net_device *ndev, bool enable)
634static void cpsw_ndo_set_rx_mode(struct net_device *ndev) 634static void cpsw_ndo_set_rx_mode(struct net_device *ndev)
635{ 635{
636 struct cpsw_priv *priv = netdev_priv(ndev); 636 struct cpsw_priv *priv = netdev_priv(ndev);
637 int vid;
638
639 if (priv->data.dual_emac)
640 vid = priv->slaves[priv->emac_port].port_vlan;
641 else
642 vid = priv->data.default_vlan;
637 643
638 if (ndev->flags & IFF_PROMISC) { 644 if (ndev->flags & IFF_PROMISC) {
639 /* Enable promiscuous mode */ 645 /* Enable promiscuous mode */
@@ -649,7 +655,8 @@ static void cpsw_ndo_set_rx_mode(struct net_device *ndev)
649 cpsw_ale_set_allmulti(priv->ale, priv->ndev->flags & IFF_ALLMULTI); 655 cpsw_ale_set_allmulti(priv->ale, priv->ndev->flags & IFF_ALLMULTI);
650 656
651 /* Clear all mcast from ALE */ 657 /* Clear all mcast from ALE */
652 cpsw_ale_flush_multicast(priv->ale, ALE_ALL_PORTS << priv->host_port); 658 cpsw_ale_flush_multicast(priv->ale, ALE_ALL_PORTS << priv->host_port,
659 vid);
653 660
654 if (!netdev_mc_empty(ndev)) { 661 if (!netdev_mc_empty(ndev)) {
655 struct netdev_hw_addr *ha; 662 struct netdev_hw_addr *ha;
diff --git a/drivers/net/ethernet/ti/cpsw_ale.c b/drivers/net/ethernet/ti/cpsw_ale.c
index 097ebe7077ac..5246b3a18ff8 100644
--- a/drivers/net/ethernet/ti/cpsw_ale.c
+++ b/drivers/net/ethernet/ti/cpsw_ale.c
@@ -234,7 +234,7 @@ static void cpsw_ale_flush_mcast(struct cpsw_ale *ale, u32 *ale_entry,
234 cpsw_ale_set_entry_type(ale_entry, ALE_TYPE_FREE); 234 cpsw_ale_set_entry_type(ale_entry, ALE_TYPE_FREE);
235} 235}
236 236
237int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask) 237int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask, int vid)
238{ 238{
239 u32 ale_entry[ALE_ENTRY_WORDS]; 239 u32 ale_entry[ALE_ENTRY_WORDS];
240 int ret, idx; 240 int ret, idx;
@@ -245,6 +245,14 @@ int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask)
245 if (ret != ALE_TYPE_ADDR && ret != ALE_TYPE_VLAN_ADDR) 245 if (ret != ALE_TYPE_ADDR && ret != ALE_TYPE_VLAN_ADDR)
246 continue; 246 continue;
247 247
248 /* if vid passed is -1 then remove all multicast entry from
249 * the table irrespective of vlan id, if a valid vlan id is
250 * passed then remove only multicast added to that vlan id.
251 * if vlan id doesn't match then move on to next entry.
252 */
253 if (vid != -1 && cpsw_ale_get_vlan_id(ale_entry) != vid)
254 continue;
255
248 if (cpsw_ale_get_mcast(ale_entry)) { 256 if (cpsw_ale_get_mcast(ale_entry)) {
249 u8 addr[6]; 257 u8 addr[6];
250 258
diff --git a/drivers/net/ethernet/ti/cpsw_ale.h b/drivers/net/ethernet/ti/cpsw_ale.h
index c0d4127aa549..af1e7ecd87c6 100644
--- a/drivers/net/ethernet/ti/cpsw_ale.h
+++ b/drivers/net/ethernet/ti/cpsw_ale.h
@@ -92,7 +92,7 @@ void cpsw_ale_stop(struct cpsw_ale *ale);
92 92
93int cpsw_ale_set_ageout(struct cpsw_ale *ale, int ageout); 93int cpsw_ale_set_ageout(struct cpsw_ale *ale, int ageout);
94int cpsw_ale_flush(struct cpsw_ale *ale, int port_mask); 94int cpsw_ale_flush(struct cpsw_ale *ale, int port_mask);
95int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask); 95int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask, int vid);
96int cpsw_ale_add_ucast(struct cpsw_ale *ale, u8 *addr, int port, 96int cpsw_ale_add_ucast(struct cpsw_ale *ale, u8 *addr, int port,
97 int flags, u16 vid); 97 int flags, u16 vid);
98int cpsw_ale_del_ucast(struct cpsw_ale *ale, u8 *addr, int port, 98int cpsw_ale_del_ucast(struct cpsw_ale *ale, u8 *addr, int port,