Commit db30f5ef authored by Atsushi Nemoto's avatar Atsushi Nemoto Committed by David S. Miller

tc35815: Improve BLEx / FDAEx handling

Clear Int_BLEx / Int_FDAEx after (not before) processing Rx interrupt.
This will reduce number of unnecessary interrupts.
Also print rx error messages only if netif_msg_rx_err() enabled.
Signed-off-by: default avatarAtsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 297713de
...@@ -1541,8 +1541,6 @@ static int tc35815_do_interrupt(struct net_device *dev, u32 status) ...@@ -1541,8 +1541,6 @@ static int tc35815_do_interrupt(struct net_device *dev, u32 status)
#endif #endif
{ {
struct tc35815_local *lp = netdev_priv(dev); struct tc35815_local *lp = netdev_priv(dev);
struct tc35815_regs __iomem *tr =
(struct tc35815_regs __iomem *)dev->base_addr;
int ret = -1; int ret = -1;
/* Fatal errors... */ /* Fatal errors... */
...@@ -1552,27 +1550,26 @@ static int tc35815_do_interrupt(struct net_device *dev, u32 status) ...@@ -1552,27 +1550,26 @@ static int tc35815_do_interrupt(struct net_device *dev, u32 status)
} }
/* recoverable errors */ /* recoverable errors */
if (status & Int_IntFDAEx) { if (status & Int_IntFDAEx) {
/* disable FDAEx int. (until we make rooms...) */ if (netif_msg_rx_err(lp))
tc_writel(tc_readl(&tr->Int_En) & ~Int_FDAExEn, &tr->Int_En); dev_warn(&dev->dev,
printk(KERN_WARNING "Free Descriptor Area Exhausted (%#x).\n",
"%s: Free Descriptor Area Exhausted (%#x).\n", status);
dev->name, status);
dev->stats.rx_dropped++; dev->stats.rx_dropped++;
ret = 0; ret = 0;
} }
if (status & Int_IntBLEx) { if (status & Int_IntBLEx) {
/* disable BLEx int. (until we make rooms...) */ if (netif_msg_rx_err(lp))
tc_writel(tc_readl(&tr->Int_En) & ~Int_BLExEn, &tr->Int_En); dev_warn(&dev->dev,
printk(KERN_WARNING "Buffer List Exhausted (%#x).\n",
"%s: Buffer List Exhausted (%#x).\n", status);
dev->name, status);
dev->stats.rx_dropped++; dev->stats.rx_dropped++;
ret = 0; ret = 0;
} }
if (status & Int_IntExBD) { if (status & Int_IntExBD) {
printk(KERN_WARNING if (netif_msg_rx_err(lp))
"%s: Excessive Buffer Descriptiors (%#x).\n", dev_warn(&dev->dev,
dev->name, status); "Excessive Buffer Descriptiors (%#x).\n",
status);
dev->stats.rx_length_errors++; dev->stats.rx_length_errors++;
ret = 0; ret = 0;
} }
...@@ -1631,8 +1628,12 @@ static irqreturn_t tc35815_interrupt(int irq, void *dev_id) ...@@ -1631,8 +1628,12 @@ static irqreturn_t tc35815_interrupt(int irq, void *dev_id)
spin_lock(&lp->lock); spin_lock(&lp->lock);
status = tc_readl(&tr->Int_Src); status = tc_readl(&tr->Int_Src);
tc_writel(status, &tr->Int_Src); /* write to clear */ /* BLEx, FDAEx will be cleared later */
tc_writel(status & ~(Int_BLEx | Int_FDAEx),
&tr->Int_Src); /* write to clear */
handled = tc35815_do_interrupt(dev, status); handled = tc35815_do_interrupt(dev, status);
if (status & (Int_BLEx | Int_FDAEx))
tc_writel(status & (Int_BLEx | Int_FDAEx), &tr->Int_Src);
(void)tc_readl(&tr->Int_Src); /* flush */ (void)tc_readl(&tr->Int_Src); /* flush */
spin_unlock(&lp->lock); spin_unlock(&lp->lock);
return IRQ_RETVAL(handled >= 0); return IRQ_RETVAL(handled >= 0);
...@@ -1660,8 +1661,6 @@ tc35815_rx(struct net_device *dev) ...@@ -1660,8 +1661,6 @@ tc35815_rx(struct net_device *dev)
struct tc35815_local *lp = netdev_priv(dev); struct tc35815_local *lp = netdev_priv(dev);
unsigned int fdctl; unsigned int fdctl;
int i; int i;
int buf_free_count = 0;
int fd_free_count = 0;
#ifdef TC35815_NAPI #ifdef TC35815_NAPI
int received = 0; int received = 0;
#endif #endif
...@@ -1770,8 +1769,9 @@ tc35815_rx(struct net_device *dev) ...@@ -1770,8 +1769,9 @@ tc35815_rx(struct net_device *dev)
dev->stats.rx_bytes += pkt_len; dev->stats.rx_bytes += pkt_len;
} else { } else {
dev->stats.rx_errors++; dev->stats.rx_errors++;
printk(KERN_DEBUG "%s: Rx error (status %x)\n", if (netif_msg_rx_err(lp))
dev->name, status & Rx_Stat_Mask); dev_info(&dev->dev, "Rx error (status %x)\n",
status & Rx_Stat_Mask);
/* WORKAROUND: LongErr and CRCErr means Overflow. */ /* WORKAROUND: LongErr and CRCErr means Overflow. */
if ((status & Rx_LongErr) && (status & Rx_CRCErr)) { if ((status & Rx_LongErr) && (status & Rx_CRCErr)) {
status &= ~(Rx_LongErr|Rx_CRCErr); status &= ~(Rx_LongErr|Rx_CRCErr);
...@@ -1849,7 +1849,6 @@ tc35815_rx(struct net_device *dev) ...@@ -1849,7 +1849,6 @@ tc35815_rx(struct net_device *dev)
#else #else
lp->fbl_count++; lp->fbl_count++;
#endif #endif
buf_free_count++;
} }
} }
...@@ -1871,7 +1870,6 @@ tc35815_rx(struct net_device *dev) ...@@ -1871,7 +1870,6 @@ tc35815_rx(struct net_device *dev)
#endif #endif
lp->rfd_cur->fd.FDCtl = cpu_to_le32(FD_CownsFD); lp->rfd_cur->fd.FDCtl = cpu_to_le32(FD_CownsFD);
lp->rfd_cur++; lp->rfd_cur++;
fd_free_count++;
} }
if (lp->rfd_cur > lp->rfd_limit) if (lp->rfd_cur > lp->rfd_limit)
lp->rfd_cur = lp->rfd_base; lp->rfd_cur = lp->rfd_base;
...@@ -1882,17 +1880,6 @@ tc35815_rx(struct net_device *dev) ...@@ -1882,17 +1880,6 @@ tc35815_rx(struct net_device *dev)
#endif #endif
} }
/* re-enable BL/FDA Exhaust interrupts. */
if (fd_free_count) {
struct tc35815_regs __iomem *tr =
(struct tc35815_regs __iomem *)dev->base_addr;
u32 en, en_old = tc_readl(&tr->Int_En);
en = en_old | Int_FDAExEn;
if (buf_free_count)
en |= Int_BLExEn;
if (en != en_old)
tc_writel(en, &tr->Int_En);
}
#ifdef TC35815_NAPI #ifdef TC35815_NAPI
return received; return received;
#endif #endif
...@@ -1911,9 +1898,14 @@ static int tc35815_poll(struct napi_struct *napi, int budget) ...@@ -1911,9 +1898,14 @@ static int tc35815_poll(struct napi_struct *napi, int budget)
spin_lock(&lp->lock); spin_lock(&lp->lock);
status = tc_readl(&tr->Int_Src); status = tc_readl(&tr->Int_Src);
do { do {
tc_writel(status, &tr->Int_Src); /* write to clear */ /* BLEx, FDAEx will be cleared later */
tc_writel(status & ~(Int_BLEx | Int_FDAEx),
&tr->Int_Src); /* write to clear */
handled = tc35815_do_interrupt(dev, status, budget - received); handled = tc35815_do_interrupt(dev, status, budget - received);
if (status & (Int_BLEx | Int_FDAEx))
tc_writel(status & (Int_BLEx | Int_FDAEx),
&tr->Int_Src);
if (handled >= 0) { if (handled >= 0) {
received += handled; received += handled;
if (received >= budget) if (received >= budget)
......
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