diff options
author | David S. Miller <davem@davemloft.net> | 2019-01-11 18:35:06 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-01-11 18:35:06 -0500 |
commit | 5fea7f1091d725bd0601c931f237fed210d37dad (patch) | |
tree | b075afe3743760f4b27da8f4a3b3dce9938def07 | |
parent | e8b108b050e84b6d7497d2cd29fe7623d0a33ed6 (diff) | |
parent | fa0be0a43f101888ac677dba31b590963eafeaa1 (diff) |
Merge branch 'stmmac-fixes'
Jose Abreu says:
====================
net: stmmac: Misc Fixes
Some small fixes for stmmac targeting -net. Detailed info in commit log.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c | 6 | ||||
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 51 | ||||
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 10 | ||||
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 2 |
4 files changed, 41 insertions, 28 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c index 6c5092e7771c..c5e25580a43f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c | |||
@@ -263,6 +263,7 @@ static int dwxgmac2_dma_interrupt(void __iomem *ioaddr, | |||
263 | struct stmmac_extra_stats *x, u32 chan) | 263 | struct stmmac_extra_stats *x, u32 chan) |
264 | { | 264 | { |
265 | u32 intr_status = readl(ioaddr + XGMAC_DMA_CH_STATUS(chan)); | 265 | u32 intr_status = readl(ioaddr + XGMAC_DMA_CH_STATUS(chan)); |
266 | u32 intr_en = readl(ioaddr + XGMAC_DMA_CH_INT_EN(chan)); | ||
266 | int ret = 0; | 267 | int ret = 0; |
267 | 268 | ||
268 | /* ABNORMAL interrupts */ | 269 | /* ABNORMAL interrupts */ |
@@ -282,8 +283,7 @@ static int dwxgmac2_dma_interrupt(void __iomem *ioaddr, | |||
282 | x->normal_irq_n++; | 283 | x->normal_irq_n++; |
283 | 284 | ||
284 | if (likely(intr_status & XGMAC_RI)) { | 285 | if (likely(intr_status & XGMAC_RI)) { |
285 | u32 value = readl(ioaddr + XGMAC_DMA_CH_INT_EN(chan)); | 286 | if (likely(intr_en & XGMAC_RIE)) { |
286 | if (likely(value & XGMAC_RIE)) { | ||
287 | x->rx_normal_irq_n++; | 287 | x->rx_normal_irq_n++; |
288 | ret |= handle_rx; | 288 | ret |= handle_rx; |
289 | } | 289 | } |
@@ -295,7 +295,7 @@ static int dwxgmac2_dma_interrupt(void __iomem *ioaddr, | |||
295 | } | 295 | } |
296 | 296 | ||
297 | /* Clear interrupts */ | 297 | /* Clear interrupts */ |
298 | writel(~0x0, ioaddr + XGMAC_DMA_CH_STATUS(chan)); | 298 | writel(intr_en & intr_status, ioaddr + XGMAC_DMA_CH_STATUS(chan)); |
299 | 299 | ||
300 | return ret; | 300 | return ret; |
301 | } | 301 | } |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 0e0a0789c2ed..3f23e14891df 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
@@ -3525,27 +3525,28 @@ static int stmmac_napi_poll(struct napi_struct *napi, int budget) | |||
3525 | struct stmmac_channel *ch = | 3525 | struct stmmac_channel *ch = |
3526 | container_of(napi, struct stmmac_channel, napi); | 3526 | container_of(napi, struct stmmac_channel, napi); |
3527 | struct stmmac_priv *priv = ch->priv_data; | 3527 | struct stmmac_priv *priv = ch->priv_data; |
3528 | int work_done = 0, work_rem = budget; | 3528 | int work_done, rx_done = 0, tx_done = 0; |
3529 | u32 chan = ch->index; | 3529 | u32 chan = ch->index; |
3530 | 3530 | ||
3531 | priv->xstats.napi_poll++; | 3531 | priv->xstats.napi_poll++; |
3532 | 3532 | ||
3533 | if (ch->has_tx) { | 3533 | if (ch->has_tx) |
3534 | int done = stmmac_tx_clean(priv, work_rem, chan); | 3534 | tx_done = stmmac_tx_clean(priv, budget, chan); |
3535 | if (ch->has_rx) | ||
3536 | rx_done = stmmac_rx(priv, budget, chan); | ||
3535 | 3537 | ||
3536 | work_done += done; | 3538 | work_done = max(rx_done, tx_done); |
3537 | work_rem -= done; | 3539 | work_done = min(work_done, budget); |
3538 | } | ||
3539 | |||
3540 | if (ch->has_rx) { | ||
3541 | int done = stmmac_rx(priv, work_rem, chan); | ||
3542 | 3540 | ||
3543 | work_done += done; | 3541 | if (work_done < budget && napi_complete_done(napi, work_done)) { |
3544 | work_rem -= done; | 3542 | int stat; |
3545 | } | ||
3546 | 3543 | ||
3547 | if (work_done < budget && napi_complete_done(napi, work_done)) | ||
3548 | stmmac_enable_dma_irq(priv, priv->ioaddr, chan); | 3544 | stmmac_enable_dma_irq(priv, priv->ioaddr, chan); |
3545 | stat = stmmac_dma_interrupt_status(priv, priv->ioaddr, | ||
3546 | &priv->xstats, chan); | ||
3547 | if (stat && napi_reschedule(napi)) | ||
3548 | stmmac_disable_dma_irq(priv, priv->ioaddr, chan); | ||
3549 | } | ||
3549 | 3550 | ||
3550 | return work_done; | 3551 | return work_done; |
3551 | } | 3552 | } |
@@ -4168,6 +4169,18 @@ static int stmmac_hw_init(struct stmmac_priv *priv) | |||
4168 | return ret; | 4169 | return ret; |
4169 | } | 4170 | } |
4170 | 4171 | ||
4172 | /* Rx Watchdog is available in the COREs newer than the 3.40. | ||
4173 | * In some case, for example on bugged HW this feature | ||
4174 | * has to be disable and this can be done by passing the | ||
4175 | * riwt_off field from the platform. | ||
4176 | */ | ||
4177 | if (((priv->synopsys_id >= DWMAC_CORE_3_50) || | ||
4178 | (priv->plat->has_xgmac)) && (!priv->plat->riwt_off)) { | ||
4179 | priv->use_riwt = 1; | ||
4180 | dev_info(priv->device, | ||
4181 | "Enable RX Mitigation via HW Watchdog Timer\n"); | ||
4182 | } | ||
4183 | |||
4171 | return 0; | 4184 | return 0; |
4172 | } | 4185 | } |
4173 | 4186 | ||
@@ -4300,18 +4313,6 @@ int stmmac_dvr_probe(struct device *device, | |||
4300 | if (flow_ctrl) | 4313 | if (flow_ctrl) |
4301 | priv->flow_ctrl = FLOW_AUTO; /* RX/TX pause on */ | 4314 | priv->flow_ctrl = FLOW_AUTO; /* RX/TX pause on */ |
4302 | 4315 | ||
4303 | /* Rx Watchdog is available in the COREs newer than the 3.40. | ||
4304 | * In some case, for example on bugged HW this feature | ||
4305 | * has to be disable and this can be done by passing the | ||
4306 | * riwt_off field from the platform. | ||
4307 | */ | ||
4308 | if (((priv->synopsys_id >= DWMAC_CORE_3_50) || | ||
4309 | (priv->plat->has_xgmac)) && (!priv->plat->riwt_off)) { | ||
4310 | priv->use_riwt = 1; | ||
4311 | dev_info(priv->device, | ||
4312 | "Enable RX Mitigation via HW Watchdog Timer\n"); | ||
4313 | } | ||
4314 | |||
4315 | /* Setup channels NAPI */ | 4316 | /* Setup channels NAPI */ |
4316 | maxq = max(priv->plat->rx_queues_to_use, priv->plat->tx_queues_to_use); | 4317 | maxq = max(priv->plat->rx_queues_to_use, priv->plat->tx_queues_to_use); |
4317 | 4318 | ||
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c index c54a50dbd5ac..d819e8eaba12 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | |||
@@ -299,7 +299,17 @@ static int stmmac_pci_probe(struct pci_dev *pdev, | |||
299 | */ | 299 | */ |
300 | static void stmmac_pci_remove(struct pci_dev *pdev) | 300 | static void stmmac_pci_remove(struct pci_dev *pdev) |
301 | { | 301 | { |
302 | int i; | ||
303 | |||
302 | stmmac_dvr_remove(&pdev->dev); | 304 | stmmac_dvr_remove(&pdev->dev); |
305 | |||
306 | for (i = 0; i <= PCI_STD_RESOURCE_END; i++) { | ||
307 | if (pci_resource_len(pdev, i) == 0) | ||
308 | continue; | ||
309 | pcim_iounmap_regions(pdev, BIT(i)); | ||
310 | break; | ||
311 | } | ||
312 | |||
303 | pci_disable_device(pdev); | 313 | pci_disable_device(pdev); |
304 | } | 314 | } |
305 | 315 | ||
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c index 531294f4978b..58ea18af9813 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | |||
@@ -301,6 +301,8 @@ static int tc_setup_cbs(struct stmmac_priv *priv, | |||
301 | /* Queue 0 is not AVB capable */ | 301 | /* Queue 0 is not AVB capable */ |
302 | if (queue <= 0 || queue >= tx_queues_count) | 302 | if (queue <= 0 || queue >= tx_queues_count) |
303 | return -EINVAL; | 303 | return -EINVAL; |
304 | if (!priv->dma_cap.av) | ||
305 | return -EOPNOTSUPP; | ||
304 | if (priv->speed != SPEED_100 && priv->speed != SPEED_1000) | 306 | if (priv->speed != SPEED_100 && priv->speed != SPEED_1000) |
305 | return -EOPNOTSUPP; | 307 | return -EOPNOTSUPP; |
306 | 308 | ||