Commit 75c48859 authored by Yong Zhang's avatar Yong Zhang Committed by David S. Miller

gianfar: keep vlan related state when restart

If vlan has been enabled. ifdown followed by ifup will lost hardware
related state.

Also remove duplicated operation in gfar_vlan_rx_register().
Signed-off-by: default avatarYong Zhang <yong.zhang0@gmail.com>
Acked-by: default avatarDai Haruki <dai.haruki@freescale.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 148675a7
...@@ -936,6 +936,7 @@ int startup_gfar(struct net_device *dev) ...@@ -936,6 +936,7 @@ int startup_gfar(struct net_device *dev)
struct gfar __iomem *regs = priv->regs; struct gfar __iomem *regs = priv->regs;
int err = 0; int err = 0;
u32 rctrl = 0; u32 rctrl = 0;
u32 tctrl = 0;
u32 attrs = 0; u32 attrs = 0;
gfar_write(&regs->imask, IMASK_INIT_CLEAR); gfar_write(&regs->imask, IMASK_INIT_CLEAR);
...@@ -1111,11 +1112,19 @@ int startup_gfar(struct net_device *dev) ...@@ -1111,11 +1112,19 @@ int startup_gfar(struct net_device *dev)
rctrl |= RCTRL_PADDING(priv->padding); rctrl |= RCTRL_PADDING(priv->padding);
} }
/* keep vlan related bits if it's enabled */
if (priv->vlgrp) {
rctrl |= RCTRL_VLEX | RCTRL_PRSDEP_INIT;
tctrl |= TCTRL_VLINS;
}
/* Init rctrl based on our settings */ /* Init rctrl based on our settings */
gfar_write(&priv->regs->rctrl, rctrl); gfar_write(&priv->regs->rctrl, rctrl);
if (dev->features & NETIF_F_IP_CSUM) if (dev->features & NETIF_F_IP_CSUM)
gfar_write(&priv->regs->tctrl, TCTRL_INIT_CSUM); tctrl |= TCTRL_INIT_CSUM;
gfar_write(&priv->regs->tctrl, tctrl);
/* Set the extraction length and index */ /* Set the extraction length and index */
attrs = ATTRELI_EL(priv->rx_stash_size) | attrs = ATTRELI_EL(priv->rx_stash_size) |
...@@ -1450,7 +1459,6 @@ static void gfar_vlan_rx_register(struct net_device *dev, ...@@ -1450,7 +1459,6 @@ static void gfar_vlan_rx_register(struct net_device *dev,
/* Enable VLAN tag extraction */ /* Enable VLAN tag extraction */
tempval = gfar_read(&priv->regs->rctrl); tempval = gfar_read(&priv->regs->rctrl);
tempval |= RCTRL_VLEX;
tempval |= (RCTRL_VLEX | RCTRL_PRSDEP_INIT); tempval |= (RCTRL_VLEX | RCTRL_PRSDEP_INIT);
gfar_write(&priv->regs->rctrl, tempval); gfar_write(&priv->regs->rctrl, tempval);
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment