Merge branch 'calxedaxgmac'
Rob Herring says: ==================== This is a couple of fixes related to xgmac_set_rx_mode. The changes are necessary for "bridge fdb add" to work correctly. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
52f77ba925
1 changed files with 14 additions and 9 deletions
|
@ -106,7 +106,6 @@
|
||||||
#define XGMAC_DMA_HW_FEATURE 0x00000f58 /* Enabled Hardware Features */
|
#define XGMAC_DMA_HW_FEATURE 0x00000f58 /* Enabled Hardware Features */
|
||||||
|
|
||||||
#define XGMAC_ADDR_AE 0x80000000
|
#define XGMAC_ADDR_AE 0x80000000
|
||||||
#define XGMAC_MAX_FILTER_ADDR 31
|
|
||||||
|
|
||||||
/* PMT Control and Status */
|
/* PMT Control and Status */
|
||||||
#define XGMAC_PMT_POINTER_RESET 0x80000000
|
#define XGMAC_PMT_POINTER_RESET 0x80000000
|
||||||
|
@ -384,6 +383,7 @@ struct xgmac_priv {
|
||||||
struct device *device;
|
struct device *device;
|
||||||
struct napi_struct napi;
|
struct napi_struct napi;
|
||||||
|
|
||||||
|
int max_macs;
|
||||||
struct xgmac_extra_stats xstats;
|
struct xgmac_extra_stats xstats;
|
||||||
|
|
||||||
spinlock_t stats_lock;
|
spinlock_t stats_lock;
|
||||||
|
@ -1291,14 +1291,12 @@ static void xgmac_set_rx_mode(struct net_device *dev)
|
||||||
netdev_dbg(priv->dev, "# mcasts %d, # unicast %d\n",
|
netdev_dbg(priv->dev, "# mcasts %d, # unicast %d\n",
|
||||||
netdev_mc_count(dev), netdev_uc_count(dev));
|
netdev_mc_count(dev), netdev_uc_count(dev));
|
||||||
|
|
||||||
if (dev->flags & IFF_PROMISC) {
|
if (dev->flags & IFF_PROMISC)
|
||||||
writel(XGMAC_FRAME_FILTER_PR, ioaddr + XGMAC_FRAME_FILTER);
|
value |= XGMAC_FRAME_FILTER_PR;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(hash_filter, 0, sizeof(hash_filter));
|
memset(hash_filter, 0, sizeof(hash_filter));
|
||||||
|
|
||||||
if (netdev_uc_count(dev) > XGMAC_MAX_FILTER_ADDR) {
|
if (netdev_uc_count(dev) > priv->max_macs) {
|
||||||
use_hash = true;
|
use_hash = true;
|
||||||
value |= XGMAC_FRAME_FILTER_HUC | XGMAC_FRAME_FILTER_HPF;
|
value |= XGMAC_FRAME_FILTER_HUC | XGMAC_FRAME_FILTER_HPF;
|
||||||
}
|
}
|
||||||
|
@ -1321,7 +1319,7 @@ static void xgmac_set_rx_mode(struct net_device *dev)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((netdev_mc_count(dev) + reg - 1) > XGMAC_MAX_FILTER_ADDR) {
|
if ((netdev_mc_count(dev) + reg - 1) > priv->max_macs) {
|
||||||
use_hash = true;
|
use_hash = true;
|
||||||
value |= XGMAC_FRAME_FILTER_HMC | XGMAC_FRAME_FILTER_HPF;
|
value |= XGMAC_FRAME_FILTER_HMC | XGMAC_FRAME_FILTER_HPF;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1342,8 +1340,8 @@ static void xgmac_set_rx_mode(struct net_device *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
for (i = reg; i < XGMAC_MAX_FILTER_ADDR; i++)
|
for (i = reg; i <= priv->max_macs; i++)
|
||||||
xgmac_set_mac_addr(ioaddr, NULL, reg);
|
xgmac_set_mac_addr(ioaddr, NULL, i);
|
||||||
for (i = 0; i < XGMAC_NUM_HASH; i++)
|
for (i = 0; i < XGMAC_NUM_HASH; i++)
|
||||||
writel(hash_filter[i], ioaddr + XGMAC_HASH(i));
|
writel(hash_filter[i], ioaddr + XGMAC_HASH(i));
|
||||||
|
|
||||||
|
@ -1761,6 +1759,13 @@ static int xgmac_probe(struct platform_device *pdev)
|
||||||
uid = readl(priv->base + XGMAC_VERSION);
|
uid = readl(priv->base + XGMAC_VERSION);
|
||||||
netdev_info(ndev, "h/w version is 0x%x\n", uid);
|
netdev_info(ndev, "h/w version is 0x%x\n", uid);
|
||||||
|
|
||||||
|
/* Figure out how many valid mac address filter registers we have */
|
||||||
|
writel(1, priv->base + XGMAC_ADDR_HIGH(31));
|
||||||
|
if (readl(priv->base + XGMAC_ADDR_HIGH(31)) == 1)
|
||||||
|
priv->max_macs = 31;
|
||||||
|
else
|
||||||
|
priv->max_macs = 7;
|
||||||
|
|
||||||
writel(0, priv->base + XGMAC_DMA_INTR_ENA);
|
writel(0, priv->base + XGMAC_DMA_INTR_ENA);
|
||||||
ndev->irq = platform_get_irq(pdev, 0);
|
ndev->irq = platform_get_irq(pdev, 0);
|
||||||
if (ndev->irq == -ENXIO) {
|
if (ndev->irq == -ENXIO) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue