]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/net/ethernet/ti/cpsw.c
net: ethernet: ti: cpsw: fix vlan configuration while down/up
[linux.git] / drivers / net / ethernet / ti / cpsw.c
index 0b18634d336c7999f80c69a2438118b2875534e8..9434fd5a5477234889020e3fefe072f343a1a133 100644 (file)
@@ -565,6 +565,9 @@ static const struct cpsw_stats cpsw_gstrings_ch_stats[] = {
                                (func)(slave++, ##arg);                 \
        } while (0)
 
+static int cpsw_ndo_vlan_rx_add_vid(struct net_device *ndev,
+                                   __be16 proto, u16 vid);
+
 static inline int cpsw_get_slave_port(u32 slave_num)
 {
        return slave_num + 1;
@@ -1951,9 +1954,23 @@ static void cpsw_mqprio_resume(struct cpsw_slave *slave, struct cpsw_priv *priv)
        slave_write(slave, tx_prio_map, tx_prio_rg);
 }
 
+static int cpsw_restore_vlans(struct net_device *vdev, int vid, void *arg)
+{
+       struct cpsw_priv *priv = arg;
+
+       if (!vdev)
+               return 0;
+
+       cpsw_ndo_vlan_rx_add_vid(priv->ndev, 0, vid);
+       return 0;
+}
+
 /* restore resources after port reset */
 static void cpsw_restore(struct cpsw_priv *priv)
 {
+       /* restore vlan configurations */
+       vlan_for_each(priv->ndev, cpsw_restore_vlans, priv);
+
        /* restore MQPRIO offload */
        for_each_slave(priv, cpsw_mqprio_resume, priv);