diff options
Diffstat (limited to 'drivers/net')
78 files changed, 512 insertions, 274 deletions
diff --git a/drivers/net/caif/caif_serial.c b/drivers/net/caif/caif_serial.c index a0f954f36c09..44e6c7b1b222 100644 --- a/drivers/net/caif/caif_serial.c +++ b/drivers/net/caif/caif_serial.c | |||
| @@ -257,10 +257,7 @@ static int handle_tx(struct ser_device *ser) | |||
| 257 | if (skb->len == 0) { | 257 | if (skb->len == 0) { |
| 258 | struct sk_buff *tmp = skb_dequeue(&ser->head); | 258 | struct sk_buff *tmp = skb_dequeue(&ser->head); |
| 259 | WARN_ON(tmp != skb); | 259 | WARN_ON(tmp != skb); |
| 260 | if (in_interrupt()) | 260 | dev_consume_skb_any(skb); |
| 261 | dev_kfree_skb_irq(skb); | ||
| 262 | else | ||
| 263 | kfree_skb(skb); | ||
| 264 | } | 261 | } |
| 265 | } | 262 | } |
| 266 | /* Send flow off if queue is empty */ | 263 | /* Send flow off if queue is empty */ |
diff --git a/drivers/net/dsa/b53/b53_srab.c b/drivers/net/dsa/b53/b53_srab.c index 90f514252987..d9c56a779c08 100644 --- a/drivers/net/dsa/b53/b53_srab.c +++ b/drivers/net/dsa/b53/b53_srab.c | |||
| @@ -511,9 +511,6 @@ static void b53_srab_prepare_irq(struct platform_device *pdev) | |||
| 511 | /* Clear all pending interrupts */ | 511 | /* Clear all pending interrupts */ |
| 512 | writel(0xffffffff, priv->regs + B53_SRAB_INTR); | 512 | writel(0xffffffff, priv->regs + B53_SRAB_INTR); |
| 513 | 513 | ||
| 514 | if (dev->pdata && dev->pdata->chip_id != BCM58XX_DEVICE_ID) | ||
| 515 | return; | ||
| 516 | |||
| 517 | for (i = 0; i < B53_N_PORTS; i++) { | 514 | for (i = 0; i < B53_N_PORTS; i++) { |
| 518 | port = &priv->port_intrs[i]; | 515 | port = &priv->port_intrs[i]; |
| 519 | 516 | ||
diff --git a/drivers/net/dsa/mv88e6xxx/global1_atu.c b/drivers/net/dsa/mv88e6xxx/global1_atu.c index 5200e4bdce93..ea243840ee0f 100644 --- a/drivers/net/dsa/mv88e6xxx/global1_atu.c +++ b/drivers/net/dsa/mv88e6xxx/global1_atu.c | |||
| @@ -314,6 +314,7 @@ static irqreturn_t mv88e6xxx_g1_atu_prob_irq_thread_fn(int irq, void *dev_id) | |||
| 314 | { | 314 | { |
| 315 | struct mv88e6xxx_chip *chip = dev_id; | 315 | struct mv88e6xxx_chip *chip = dev_id; |
| 316 | struct mv88e6xxx_atu_entry entry; | 316 | struct mv88e6xxx_atu_entry entry; |
| 317 | int spid; | ||
| 317 | int err; | 318 | int err; |
| 318 | u16 val; | 319 | u16 val; |
| 319 | 320 | ||
| @@ -336,6 +337,8 @@ static irqreturn_t mv88e6xxx_g1_atu_prob_irq_thread_fn(int irq, void *dev_id) | |||
| 336 | if (err) | 337 | if (err) |
| 337 | goto out; | 338 | goto out; |
| 338 | 339 | ||
| 340 | spid = entry.state; | ||
| 341 | |||
| 339 | if (val & MV88E6XXX_G1_ATU_OP_AGE_OUT_VIOLATION) { | 342 | if (val & MV88E6XXX_G1_ATU_OP_AGE_OUT_VIOLATION) { |
| 340 | dev_err_ratelimited(chip->dev, | 343 | dev_err_ratelimited(chip->dev, |
| 341 | "ATU age out violation for %pM\n", | 344 | "ATU age out violation for %pM\n", |
| @@ -344,23 +347,23 @@ static irqreturn_t mv88e6xxx_g1_atu_prob_irq_thread_fn(int irq, void *dev_id) | |||
| 344 | 347 | ||
| 345 | if (val & MV88E6XXX_G1_ATU_OP_MEMBER_VIOLATION) { | 348 | if (val & MV88E6XXX_G1_ATU_OP_MEMBER_VIOLATION) { |
| 346 | dev_err_ratelimited(chip->dev, | 349 | dev_err_ratelimited(chip->dev, |
| 347 | "ATU member violation for %pM portvec %x\n", | 350 | "ATU member violation for %pM portvec %x spid %d\n", |
| 348 | entry.mac, entry.portvec); | 351 | entry.mac, entry.portvec, spid); |
| 349 | chip->ports[entry.portvec].atu_member_violation++; | 352 | chip->ports[spid].atu_member_violation++; |
| 350 | } | 353 | } |
| 351 | 354 | ||
| 352 | if (val & MV88E6XXX_G1_ATU_OP_MISS_VIOLATION) { | 355 | if (val & MV88E6XXX_G1_ATU_OP_MISS_VIOLATION) { |
| 353 | dev_err_ratelimited(chip->dev, | 356 | dev_err_ratelimited(chip->dev, |
| 354 | "ATU miss violation for %pM portvec %x\n", | 357 | "ATU miss violation for %pM portvec %x spid %d\n", |
| 355 | entry.mac, entry.portvec); | 358 | entry.mac, entry.portvec, spid); |
| 356 | chip->ports[entry.portvec].atu_miss_violation++; | 359 | chip->ports[spid].atu_miss_violation++; |
| 357 | } | 360 | } |
| 358 | 361 | ||
| 359 | if (val & MV88E6XXX_G1_ATU_OP_FULL_VIOLATION) { | 362 | if (val & MV88E6XXX_G1_ATU_OP_FULL_VIOLATION) { |
| 360 | dev_err_ratelimited(chip->dev, | 363 | dev_err_ratelimited(chip->dev, |
| 361 | "ATU full violation for %pM portvec %x\n", | 364 | "ATU full violation for %pM portvec %x spid %d\n", |
| 362 | entry.mac, entry.portvec); | 365 | entry.mac, entry.portvec, spid); |
| 363 | chip->ports[entry.portvec].atu_full_violation++; | 366 | chip->ports[spid].atu_full_violation++; |
| 364 | } | 367 | } |
| 365 | mutex_unlock(&chip->reg_lock); | 368 | mutex_unlock(&chip->reg_lock); |
| 366 | 369 | ||
diff --git a/drivers/net/dsa/mv88e6xxx/serdes.c b/drivers/net/dsa/mv88e6xxx/serdes.c index 2caa8c8b4b55..1bfc5ff8d81d 100644 --- a/drivers/net/dsa/mv88e6xxx/serdes.c +++ b/drivers/net/dsa/mv88e6xxx/serdes.c | |||
| @@ -664,7 +664,7 @@ int mv88e6390_serdes_irq_setup(struct mv88e6xxx_chip *chip, int port) | |||
| 664 | if (port < 9) | 664 | if (port < 9) |
| 665 | return 0; | 665 | return 0; |
| 666 | 666 | ||
| 667 | return mv88e6390_serdes_irq_setup(chip, port); | 667 | return mv88e6390x_serdes_irq_setup(chip, port); |
| 668 | } | 668 | } |
| 669 | 669 | ||
| 670 | void mv88e6390x_serdes_irq_free(struct mv88e6xxx_chip *chip, int port) | 670 | void mv88e6390x_serdes_irq_free(struct mv88e6xxx_chip *chip, int port) |
diff --git a/drivers/net/ethernet/alteon/acenic.c b/drivers/net/ethernet/alteon/acenic.c index 4f11f98347ed..1827ef1f6d55 100644 --- a/drivers/net/ethernet/alteon/acenic.c +++ b/drivers/net/ethernet/alteon/acenic.c | |||
| @@ -2059,7 +2059,7 @@ static inline void ace_tx_int(struct net_device *dev, | |||
| 2059 | if (skb) { | 2059 | if (skb) { |
| 2060 | dev->stats.tx_packets++; | 2060 | dev->stats.tx_packets++; |
| 2061 | dev->stats.tx_bytes += skb->len; | 2061 | dev->stats.tx_bytes += skb->len; |
| 2062 | dev_kfree_skb_irq(skb); | 2062 | dev_consume_skb_irq(skb); |
| 2063 | info->skb = NULL; | 2063 | info->skb = NULL; |
| 2064 | } | 2064 | } |
| 2065 | 2065 | ||
diff --git a/drivers/net/ethernet/altera/altera_msgdma.c b/drivers/net/ethernet/altera/altera_msgdma.c index 0fb986ba3290..0ae723f75341 100644 --- a/drivers/net/ethernet/altera/altera_msgdma.c +++ b/drivers/net/ethernet/altera/altera_msgdma.c | |||
| @@ -145,7 +145,8 @@ u32 msgdma_tx_completions(struct altera_tse_private *priv) | |||
| 145 | & 0xffff; | 145 | & 0xffff; |
| 146 | 146 | ||
| 147 | if (inuse) { /* Tx FIFO is not empty */ | 147 | if (inuse) { /* Tx FIFO is not empty */ |
| 148 | ready = priv->tx_prod - priv->tx_cons - inuse - 1; | 148 | ready = max_t(int, |
| 149 | priv->tx_prod - priv->tx_cons - inuse - 1, 0); | ||
| 149 | } else { | 150 | } else { |
| 150 | /* Check for buffered last packet */ | 151 | /* Check for buffered last packet */ |
| 151 | status = csrrd32(priv->tx_dma_csr, msgdma_csroffs(status)); | 152 | status = csrrd32(priv->tx_dma_csr, msgdma_csroffs(status)); |
diff --git a/drivers/net/ethernet/amd/amd8111e.c b/drivers/net/ethernet/amd/amd8111e.c index a90080f12e67..e548c0ae2e00 100644 --- a/drivers/net/ethernet/amd/amd8111e.c +++ b/drivers/net/ethernet/amd/amd8111e.c | |||
| @@ -666,7 +666,7 @@ static int amd8111e_tx(struct net_device *dev) | |||
| 666 | pci_unmap_single(lp->pci_dev, lp->tx_dma_addr[tx_index], | 666 | pci_unmap_single(lp->pci_dev, lp->tx_dma_addr[tx_index], |
| 667 | lp->tx_skbuff[tx_index]->len, | 667 | lp->tx_skbuff[tx_index]->len, |
| 668 | PCI_DMA_TODEVICE); | 668 | PCI_DMA_TODEVICE); |
| 669 | dev_kfree_skb_irq (lp->tx_skbuff[tx_index]); | 669 | dev_consume_skb_irq(lp->tx_skbuff[tx_index]); |
| 670 | lp->tx_skbuff[tx_index] = NULL; | 670 | lp->tx_skbuff[tx_index] = NULL; |
| 671 | lp->tx_dma_addr[tx_index] = 0; | 671 | lp->tx_dma_addr[tx_index] = 0; |
| 672 | } | 672 | } |
diff --git a/drivers/net/ethernet/apple/bmac.c b/drivers/net/ethernet/apple/bmac.c index 6a8e2567f2bd..4d3855ceb500 100644 --- a/drivers/net/ethernet/apple/bmac.c +++ b/drivers/net/ethernet/apple/bmac.c | |||
| @@ -777,7 +777,7 @@ static irqreturn_t bmac_txdma_intr(int irq, void *dev_id) | |||
| 777 | 777 | ||
| 778 | if (bp->tx_bufs[bp->tx_empty]) { | 778 | if (bp->tx_bufs[bp->tx_empty]) { |
| 779 | ++dev->stats.tx_packets; | 779 | ++dev->stats.tx_packets; |
| 780 | dev_kfree_skb_irq(bp->tx_bufs[bp->tx_empty]); | 780 | dev_consume_skb_irq(bp->tx_bufs[bp->tx_empty]); |
| 781 | } | 781 | } |
| 782 | bp->tx_bufs[bp->tx_empty] = NULL; | 782 | bp->tx_bufs[bp->tx_empty] = NULL; |
| 783 | bp->tx_fullup = 0; | 783 | bp->tx_fullup = 0; |
diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c index f44808959ff3..97ab0dd25552 100644 --- a/drivers/net/ethernet/broadcom/b44.c +++ b/drivers/net/ethernet/broadcom/b44.c | |||
| @@ -638,7 +638,7 @@ static void b44_tx(struct b44 *bp) | |||
| 638 | bytes_compl += skb->len; | 638 | bytes_compl += skb->len; |
| 639 | pkts_compl++; | 639 | pkts_compl++; |
| 640 | 640 | ||
| 641 | dev_kfree_skb_irq(skb); | 641 | dev_consume_skb_irq(skb); |
| 642 | } | 642 | } |
| 643 | 643 | ||
| 644 | netdev_completed_queue(bp->dev, pkts_compl, bytes_compl); | 644 | netdev_completed_queue(bp->dev, pkts_compl, bytes_compl); |
| @@ -1012,7 +1012,7 @@ static netdev_tx_t b44_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 1012 | } | 1012 | } |
| 1013 | 1013 | ||
| 1014 | skb_copy_from_linear_data(skb, skb_put(bounce_skb, len), len); | 1014 | skb_copy_from_linear_data(skb, skb_put(bounce_skb, len), len); |
| 1015 | dev_kfree_skb_any(skb); | 1015 | dev_consume_skb_any(skb); |
| 1016 | skb = bounce_skb; | 1016 | skb = bounce_skb; |
| 1017 | } | 1017 | } |
| 1018 | 1018 | ||
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c index f9521d0274b7..28c9b0bdf2f6 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c | |||
| @@ -520,7 +520,6 @@ static void bcm_sysport_get_wol(struct net_device *dev, | |||
| 520 | struct ethtool_wolinfo *wol) | 520 | struct ethtool_wolinfo *wol) |
| 521 | { | 521 | { |
| 522 | struct bcm_sysport_priv *priv = netdev_priv(dev); | 522 | struct bcm_sysport_priv *priv = netdev_priv(dev); |
| 523 | u32 reg; | ||
| 524 | 523 | ||
| 525 | wol->supported = WAKE_MAGIC | WAKE_MAGICSECURE | WAKE_FILTER; | 524 | wol->supported = WAKE_MAGIC | WAKE_MAGICSECURE | WAKE_FILTER; |
| 526 | wol->wolopts = priv->wolopts; | 525 | wol->wolopts = priv->wolopts; |
| @@ -528,11 +527,7 @@ static void bcm_sysport_get_wol(struct net_device *dev, | |||
| 528 | if (!(priv->wolopts & WAKE_MAGICSECURE)) | 527 | if (!(priv->wolopts & WAKE_MAGICSECURE)) |
| 529 | return; | 528 | return; |
| 530 | 529 | ||
| 531 | /* Return the programmed SecureOn password */ | 530 | memcpy(wol->sopass, priv->sopass, sizeof(priv->sopass)); |
| 532 | reg = umac_readl(priv, UMAC_PSW_MS); | ||
| 533 | put_unaligned_be16(reg, &wol->sopass[0]); | ||
| 534 | reg = umac_readl(priv, UMAC_PSW_LS); | ||
| 535 | put_unaligned_be32(reg, &wol->sopass[2]); | ||
| 536 | } | 531 | } |
| 537 | 532 | ||
| 538 | static int bcm_sysport_set_wol(struct net_device *dev, | 533 | static int bcm_sysport_set_wol(struct net_device *dev, |
| @@ -548,13 +543,8 @@ static int bcm_sysport_set_wol(struct net_device *dev, | |||
| 548 | if (wol->wolopts & ~supported) | 543 | if (wol->wolopts & ~supported) |
| 549 | return -EINVAL; | 544 | return -EINVAL; |
| 550 | 545 | ||
| 551 | /* Program the SecureOn password */ | 546 | if (wol->wolopts & WAKE_MAGICSECURE) |
| 552 | if (wol->wolopts & WAKE_MAGICSECURE) { | 547 | memcpy(priv->sopass, wol->sopass, sizeof(priv->sopass)); |
| 553 | umac_writel(priv, get_unaligned_be16(&wol->sopass[0]), | ||
| 554 | UMAC_PSW_MS); | ||
| 555 | umac_writel(priv, get_unaligned_be32(&wol->sopass[2]), | ||
| 556 | UMAC_PSW_LS); | ||
| 557 | } | ||
| 558 | 548 | ||
| 559 | /* Flag the device and relevant IRQ as wakeup capable */ | 549 | /* Flag the device and relevant IRQ as wakeup capable */ |
| 560 | if (wol->wolopts) { | 550 | if (wol->wolopts) { |
| @@ -2649,13 +2639,18 @@ static int bcm_sysport_suspend_to_wol(struct bcm_sysport_priv *priv) | |||
| 2649 | unsigned int index, i = 0; | 2639 | unsigned int index, i = 0; |
| 2650 | u32 reg; | 2640 | u32 reg; |
| 2651 | 2641 | ||
| 2652 | /* Password has already been programmed */ | ||
| 2653 | reg = umac_readl(priv, UMAC_MPD_CTRL); | 2642 | reg = umac_readl(priv, UMAC_MPD_CTRL); |
| 2654 | if (priv->wolopts & (WAKE_MAGIC | WAKE_MAGICSECURE)) | 2643 | if (priv->wolopts & (WAKE_MAGIC | WAKE_MAGICSECURE)) |
| 2655 | reg |= MPD_EN; | 2644 | reg |= MPD_EN; |
| 2656 | reg &= ~PSW_EN; | 2645 | reg &= ~PSW_EN; |
| 2657 | if (priv->wolopts & WAKE_MAGICSECURE) | 2646 | if (priv->wolopts & WAKE_MAGICSECURE) { |
| 2647 | /* Program the SecureOn password */ | ||
| 2648 | umac_writel(priv, get_unaligned_be16(&priv->sopass[0]), | ||
| 2649 | UMAC_PSW_MS); | ||
| 2650 | umac_writel(priv, get_unaligned_be32(&priv->sopass[2]), | ||
| 2651 | UMAC_PSW_LS); | ||
| 2658 | reg |= PSW_EN; | 2652 | reg |= PSW_EN; |
| 2653 | } | ||
| 2659 | umac_writel(priv, reg, UMAC_MPD_CTRL); | 2654 | umac_writel(priv, reg, UMAC_MPD_CTRL); |
| 2660 | 2655 | ||
| 2661 | if (priv->wolopts & WAKE_FILTER) { | 2656 | if (priv->wolopts & WAKE_FILTER) { |
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.h b/drivers/net/ethernet/broadcom/bcmsysport.h index 0887e6356649..0b192fea9c5d 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.h +++ b/drivers/net/ethernet/broadcom/bcmsysport.h | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #define __BCM_SYSPORT_H | 12 | #define __BCM_SYSPORT_H |
| 13 | 13 | ||
| 14 | #include <linux/bitmap.h> | 14 | #include <linux/bitmap.h> |
| 15 | #include <linux/ethtool.h> | ||
| 15 | #include <linux/if_vlan.h> | 16 | #include <linux/if_vlan.h> |
| 16 | #include <linux/net_dim.h> | 17 | #include <linux/net_dim.h> |
| 17 | 18 | ||
| @@ -778,6 +779,7 @@ struct bcm_sysport_priv { | |||
| 778 | unsigned int crc_fwd:1; | 779 | unsigned int crc_fwd:1; |
| 779 | u16 rev; | 780 | u16 rev; |
| 780 | u32 wolopts; | 781 | u32 wolopts; |
| 782 | u8 sopass[SOPASS_MAX]; | ||
| 781 | unsigned int wol_irq_disabled:1; | 783 | unsigned int wol_irq_disabled:1; |
| 782 | 784 | ||
| 783 | /* MIB related fields */ | 785 | /* MIB related fields */ |
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 6a512871176b..8bc7e495b027 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c | |||
| @@ -4973,12 +4973,18 @@ static int bnxt_hwrm_ring_alloc(struct bnxt *bp) | |||
| 4973 | struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring; | 4973 | struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring; |
| 4974 | struct bnxt_ring_struct *ring = &cpr->cp_ring_struct; | 4974 | struct bnxt_ring_struct *ring = &cpr->cp_ring_struct; |
| 4975 | u32 map_idx = ring->map_idx; | 4975 | u32 map_idx = ring->map_idx; |
| 4976 | unsigned int vector; | ||
| 4976 | 4977 | ||
| 4978 | vector = bp->irq_tbl[map_idx].vector; | ||
| 4979 | disable_irq_nosync(vector); | ||
| 4977 | rc = hwrm_ring_alloc_send_msg(bp, ring, type, map_idx); | 4980 | rc = hwrm_ring_alloc_send_msg(bp, ring, type, map_idx); |
| 4978 | if (rc) | 4981 | if (rc) { |
| 4982 | enable_irq(vector); | ||
| 4979 | goto err_out; | 4983 | goto err_out; |
| 4984 | } | ||
| 4980 | bnxt_set_db(bp, &cpr->cp_db, type, map_idx, ring->fw_ring_id); | 4985 | bnxt_set_db(bp, &cpr->cp_db, type, map_idx, ring->fw_ring_id); |
| 4981 | bnxt_db_nq(bp, &cpr->cp_db, cpr->cp_raw_cons); | 4986 | bnxt_db_nq(bp, &cpr->cp_db, cpr->cp_raw_cons); |
| 4987 | enable_irq(vector); | ||
| 4982 | bp->grp_info[i].cp_fw_ring_id = ring->fw_ring_id; | 4988 | bp->grp_info[i].cp_fw_ring_id = ring->fw_ring_id; |
| 4983 | 4989 | ||
| 4984 | if (!i) { | 4990 | if (!i) { |
diff --git a/drivers/net/ethernet/broadcom/sb1250-mac.c b/drivers/net/ethernet/broadcom/sb1250-mac.c index 5db9f4158e62..134ae2862efa 100644 --- a/drivers/net/ethernet/broadcom/sb1250-mac.c +++ b/drivers/net/ethernet/broadcom/sb1250-mac.c | |||
| @@ -1288,7 +1288,7 @@ static void sbdma_tx_process(struct sbmac_softc *sc, struct sbmacdma *d, | |||
| 1288 | * for transmits, we just free buffers. | 1288 | * for transmits, we just free buffers. |
| 1289 | */ | 1289 | */ |
| 1290 | 1290 | ||
| 1291 | dev_kfree_skb_irq(sb); | 1291 | dev_consume_skb_irq(sb); |
| 1292 | 1292 | ||
| 1293 | /* | 1293 | /* |
| 1294 | * .. and advance to the next buffer. | 1294 | * .. and advance to the next buffer. |
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h index 3d45f4c92cf6..9bbaad9f3d63 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h | |||
| @@ -643,6 +643,7 @@ | |||
| 643 | #define MACB_CAPS_JUMBO 0x00000020 | 643 | #define MACB_CAPS_JUMBO 0x00000020 |
| 644 | #define MACB_CAPS_GEM_HAS_PTP 0x00000040 | 644 | #define MACB_CAPS_GEM_HAS_PTP 0x00000040 |
| 645 | #define MACB_CAPS_BD_RD_PREFETCH 0x00000080 | 645 | #define MACB_CAPS_BD_RD_PREFETCH 0x00000080 |
| 646 | #define MACB_CAPS_NEEDS_RSTONUBR 0x00000100 | ||
| 646 | #define MACB_CAPS_FIFO_MODE 0x10000000 | 647 | #define MACB_CAPS_FIFO_MODE 0x10000000 |
| 647 | #define MACB_CAPS_GIGABIT_MODE_AVAILABLE 0x20000000 | 648 | #define MACB_CAPS_GIGABIT_MODE_AVAILABLE 0x20000000 |
| 648 | #define MACB_CAPS_SG_DISABLED 0x40000000 | 649 | #define MACB_CAPS_SG_DISABLED 0x40000000 |
| @@ -1214,6 +1215,8 @@ struct macb { | |||
| 1214 | 1215 | ||
| 1215 | int rx_bd_rd_prefetch; | 1216 | int rx_bd_rd_prefetch; |
| 1216 | int tx_bd_rd_prefetch; | 1217 | int tx_bd_rd_prefetch; |
| 1218 | |||
| 1219 | u32 rx_intr_mask; | ||
| 1217 | }; | 1220 | }; |
| 1218 | 1221 | ||
| 1219 | #ifdef CONFIG_MACB_USE_HWSTAMP | 1222 | #ifdef CONFIG_MACB_USE_HWSTAMP |
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index 66cc7927061a..2b2882615e8b 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c | |||
| @@ -56,8 +56,7 @@ | |||
| 56 | /* level of occupied TX descriptors under which we wake up TX process */ | 56 | /* level of occupied TX descriptors under which we wake up TX process */ |
| 57 | #define MACB_TX_WAKEUP_THRESH(bp) (3 * (bp)->tx_ring_size / 4) | 57 | #define MACB_TX_WAKEUP_THRESH(bp) (3 * (bp)->tx_ring_size / 4) |
| 58 | 58 | ||
| 59 | #define MACB_RX_INT_FLAGS (MACB_BIT(RCOMP) | MACB_BIT(RXUBR) \ | 59 | #define MACB_RX_INT_FLAGS (MACB_BIT(RCOMP) | MACB_BIT(ISR_ROVR)) |
| 60 | | MACB_BIT(ISR_ROVR)) | ||
| 61 | #define MACB_TX_ERR_FLAGS (MACB_BIT(ISR_TUND) \ | 60 | #define MACB_TX_ERR_FLAGS (MACB_BIT(ISR_TUND) \ |
| 62 | | MACB_BIT(ISR_RLE) \ | 61 | | MACB_BIT(ISR_RLE) \ |
| 63 | | MACB_BIT(TXERR)) | 62 | | MACB_BIT(TXERR)) |
| @@ -1270,7 +1269,7 @@ static int macb_poll(struct napi_struct *napi, int budget) | |||
| 1270 | queue_writel(queue, ISR, MACB_BIT(RCOMP)); | 1269 | queue_writel(queue, ISR, MACB_BIT(RCOMP)); |
| 1271 | napi_reschedule(napi); | 1270 | napi_reschedule(napi); |
| 1272 | } else { | 1271 | } else { |
| 1273 | queue_writel(queue, IER, MACB_RX_INT_FLAGS); | 1272 | queue_writel(queue, IER, bp->rx_intr_mask); |
| 1274 | } | 1273 | } |
| 1275 | } | 1274 | } |
| 1276 | 1275 | ||
| @@ -1288,7 +1287,7 @@ static void macb_hresp_error_task(unsigned long data) | |||
| 1288 | u32 ctrl; | 1287 | u32 ctrl; |
| 1289 | 1288 | ||
| 1290 | for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) { | 1289 | for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) { |
| 1291 | queue_writel(queue, IDR, MACB_RX_INT_FLAGS | | 1290 | queue_writel(queue, IDR, bp->rx_intr_mask | |
| 1292 | MACB_TX_INT_FLAGS | | 1291 | MACB_TX_INT_FLAGS | |
| 1293 | MACB_BIT(HRESP)); | 1292 | MACB_BIT(HRESP)); |
| 1294 | } | 1293 | } |
| @@ -1318,7 +1317,7 @@ static void macb_hresp_error_task(unsigned long data) | |||
| 1318 | 1317 | ||
| 1319 | /* Enable interrupts */ | 1318 | /* Enable interrupts */ |
| 1320 | queue_writel(queue, IER, | 1319 | queue_writel(queue, IER, |
| 1321 | MACB_RX_INT_FLAGS | | 1320 | bp->rx_intr_mask | |
| 1322 | MACB_TX_INT_FLAGS | | 1321 | MACB_TX_INT_FLAGS | |
| 1323 | MACB_BIT(HRESP)); | 1322 | MACB_BIT(HRESP)); |
| 1324 | } | 1323 | } |
| @@ -1372,14 +1371,14 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id) | |||
| 1372 | (unsigned int)(queue - bp->queues), | 1371 | (unsigned int)(queue - bp->queues), |
| 1373 | (unsigned long)status); | 1372 | (unsigned long)status); |
| 1374 | 1373 | ||
| 1375 | if (status & MACB_RX_INT_FLAGS) { | 1374 | if (status & bp->rx_intr_mask) { |
| 1376 | /* There's no point taking any more interrupts | 1375 | /* There's no point taking any more interrupts |
| 1377 | * until we have processed the buffers. The | 1376 | * until we have processed the buffers. The |
| 1378 | * scheduling call may fail if the poll routine | 1377 | * scheduling call may fail if the poll routine |
| 1379 | * is already scheduled, so disable interrupts | 1378 | * is already scheduled, so disable interrupts |
| 1380 | * now. | 1379 | * now. |
| 1381 | */ | 1380 | */ |
| 1382 | queue_writel(queue, IDR, MACB_RX_INT_FLAGS); | 1381 | queue_writel(queue, IDR, bp->rx_intr_mask); |
| 1383 | if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE) | 1382 | if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE) |
| 1384 | queue_writel(queue, ISR, MACB_BIT(RCOMP)); | 1383 | queue_writel(queue, ISR, MACB_BIT(RCOMP)); |
| 1385 | 1384 | ||
| @@ -1412,8 +1411,9 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id) | |||
| 1412 | /* There is a hardware issue under heavy load where DMA can | 1411 | /* There is a hardware issue under heavy load where DMA can |
| 1413 | * stop, this causes endless "used buffer descriptor read" | 1412 | * stop, this causes endless "used buffer descriptor read" |
| 1414 | * interrupts but it can be cleared by re-enabling RX. See | 1413 | * interrupts but it can be cleared by re-enabling RX. See |
| 1415 | * the at91 manual, section 41.3.1 or the Zynq manual | 1414 | * the at91rm9200 manual, section 41.3.1 or the Zynq manual |
| 1416 | * section 16.7.4 for details. | 1415 | * section 16.7.4 for details. RXUBR is only enabled for |
| 1416 | * these two versions. | ||
| 1417 | */ | 1417 | */ |
| 1418 | if (status & MACB_BIT(RXUBR)) { | 1418 | if (status & MACB_BIT(RXUBR)) { |
| 1419 | ctrl = macb_readl(bp, NCR); | 1419 | ctrl = macb_readl(bp, NCR); |
| @@ -2259,7 +2259,7 @@ static void macb_init_hw(struct macb *bp) | |||
| 2259 | 2259 | ||
| 2260 | /* Enable interrupts */ | 2260 | /* Enable interrupts */ |
| 2261 | queue_writel(queue, IER, | 2261 | queue_writel(queue, IER, |
| 2262 | MACB_RX_INT_FLAGS | | 2262 | bp->rx_intr_mask | |
| 2263 | MACB_TX_INT_FLAGS | | 2263 | MACB_TX_INT_FLAGS | |
| 2264 | MACB_BIT(HRESP)); | 2264 | MACB_BIT(HRESP)); |
| 2265 | } | 2265 | } |
| @@ -3907,6 +3907,7 @@ static const struct macb_config sama5d4_config = { | |||
| 3907 | }; | 3907 | }; |
| 3908 | 3908 | ||
| 3909 | static const struct macb_config emac_config = { | 3909 | static const struct macb_config emac_config = { |
| 3910 | .caps = MACB_CAPS_NEEDS_RSTONUBR, | ||
| 3910 | .clk_init = at91ether_clk_init, | 3911 | .clk_init = at91ether_clk_init, |
| 3911 | .init = at91ether_init, | 3912 | .init = at91ether_init, |
| 3912 | }; | 3913 | }; |
| @@ -3928,7 +3929,8 @@ static const struct macb_config zynqmp_config = { | |||
| 3928 | }; | 3929 | }; |
| 3929 | 3930 | ||
| 3930 | static const struct macb_config zynq_config = { | 3931 | static const struct macb_config zynq_config = { |
| 3931 | .caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_NO_GIGABIT_HALF, | 3932 | .caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_NO_GIGABIT_HALF | |
| 3933 | MACB_CAPS_NEEDS_RSTONUBR, | ||
| 3932 | .dma_burst_length = 16, | 3934 | .dma_burst_length = 16, |
| 3933 | .clk_init = macb_clk_init, | 3935 | .clk_init = macb_clk_init, |
| 3934 | .init = macb_init, | 3936 | .init = macb_init, |
| @@ -4083,6 +4085,10 @@ static int macb_probe(struct platform_device *pdev) | |||
| 4083 | macb_dma_desc_get_size(bp); | 4085 | macb_dma_desc_get_size(bp); |
| 4084 | } | 4086 | } |
| 4085 | 4087 | ||
| 4088 | bp->rx_intr_mask = MACB_RX_INT_FLAGS; | ||
| 4089 | if (bp->caps & MACB_CAPS_NEEDS_RSTONUBR) | ||
| 4090 | bp->rx_intr_mask |= MACB_BIT(RXUBR); | ||
| 4091 | |||
| 4086 | mac = of_get_mac_address(np); | 4092 | mac = of_get_mac_address(np); |
| 4087 | if (mac) { | 4093 | if (mac) { |
| 4088 | ether_addr_copy(bp->dev->dev_addr, mac); | 4094 | ether_addr_copy(bp->dev->dev_addr, mac); |
diff --git a/drivers/net/ethernet/cavium/Kconfig b/drivers/net/ethernet/cavium/Kconfig index 5f03199a3acf..05f4a3b21e29 100644 --- a/drivers/net/ethernet/cavium/Kconfig +++ b/drivers/net/ethernet/cavium/Kconfig | |||
| @@ -54,7 +54,6 @@ config CAVIUM_PTP | |||
| 54 | tristate "Cavium PTP coprocessor as PTP clock" | 54 | tristate "Cavium PTP coprocessor as PTP clock" |
| 55 | depends on 64BIT && PCI | 55 | depends on 64BIT && PCI |
| 56 | imply PTP_1588_CLOCK | 56 | imply PTP_1588_CLOCK |
| 57 | default y | ||
| 58 | ---help--- | 57 | ---help--- |
| 59 | This driver adds support for the Precision Time Protocol Clocks and | 58 | This driver adds support for the Precision Time Protocol Clocks and |
| 60 | Timestamping coprocessor (PTP) found on Cavium processors. | 59 | Timestamping coprocessor (PTP) found on Cavium processors. |
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c index 60641e202534..9a7f70db20c7 100644 --- a/drivers/net/ethernet/cisco/enic/enic_main.c +++ b/drivers/net/ethernet/cisco/enic/enic_main.c | |||
| @@ -1434,7 +1434,8 @@ static void enic_rq_indicate_buf(struct vnic_rq *rq, | |||
| 1434 | * csum is correct or is zero. | 1434 | * csum is correct or is zero. |
| 1435 | */ | 1435 | */ |
| 1436 | if ((netdev->features & NETIF_F_RXCSUM) && !csum_not_calc && | 1436 | if ((netdev->features & NETIF_F_RXCSUM) && !csum_not_calc && |
| 1437 | tcp_udp_csum_ok && ipv4_csum_ok && outer_csum_ok) { | 1437 | tcp_udp_csum_ok && outer_csum_ok && |
| 1438 | (ipv4_csum_ok || ipv6)) { | ||
| 1438 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 1439 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
| 1439 | skb->csum_level = encap; | 1440 | skb->csum_level = encap; |
| 1440 | } | 1441 | } |
diff --git a/drivers/net/ethernet/dec/tulip/de2104x.c b/drivers/net/ethernet/dec/tulip/de2104x.c index 13430f75496c..f1a2da15dd0a 100644 --- a/drivers/net/ethernet/dec/tulip/de2104x.c +++ b/drivers/net/ethernet/dec/tulip/de2104x.c | |||
| @@ -585,7 +585,7 @@ static void de_tx (struct de_private *de) | |||
| 585 | netif_dbg(de, tx_done, de->dev, | 585 | netif_dbg(de, tx_done, de->dev, |
| 586 | "tx done, slot %d\n", tx_tail); | 586 | "tx done, slot %d\n", tx_tail); |
| 587 | } | 587 | } |
| 588 | dev_kfree_skb_irq(skb); | 588 | dev_consume_skb_irq(skb); |
| 589 | } | 589 | } |
| 590 | 590 | ||
| 591 | next: | 591 | next: |
diff --git a/drivers/net/ethernet/freescale/fec_mpc52xx.c b/drivers/net/ethernet/freescale/fec_mpc52xx.c index b90bab72efdb..c1968b3ecec8 100644 --- a/drivers/net/ethernet/freescale/fec_mpc52xx.c +++ b/drivers/net/ethernet/freescale/fec_mpc52xx.c | |||
| @@ -369,7 +369,7 @@ static irqreturn_t mpc52xx_fec_tx_interrupt(int irq, void *dev_id) | |||
| 369 | dma_unmap_single(dev->dev.parent, bd->skb_pa, skb->len, | 369 | dma_unmap_single(dev->dev.parent, bd->skb_pa, skb->len, |
| 370 | DMA_TO_DEVICE); | 370 | DMA_TO_DEVICE); |
| 371 | 371 | ||
| 372 | dev_kfree_skb_irq(skb); | 372 | dev_consume_skb_irq(skb); |
| 373 | } | 373 | } |
| 374 | spin_unlock(&priv->lock); | 374 | spin_unlock(&priv->lock); |
| 375 | 375 | ||
diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index c3d539e209ed..eb3e65e8868f 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c | |||
| @@ -1879,6 +1879,8 @@ static void ucc_geth_free_tx(struct ucc_geth_private *ugeth) | |||
| 1879 | u16 i, j; | 1879 | u16 i, j; |
| 1880 | u8 __iomem *bd; | 1880 | u8 __iomem *bd; |
| 1881 | 1881 | ||
| 1882 | netdev_reset_queue(ugeth->ndev); | ||
| 1883 | |||
| 1882 | ug_info = ugeth->ug_info; | 1884 | ug_info = ugeth->ug_info; |
| 1883 | uf_info = &ug_info->uf_info; | 1885 | uf_info = &ug_info->uf_info; |
| 1884 | 1886 | ||
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c index 5b33238c6680..60e7d7ae3787 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c | |||
| @@ -2418,6 +2418,8 @@ static int hns_nic_dev_probe(struct platform_device *pdev) | |||
| 2418 | out_notify_fail: | 2418 | out_notify_fail: |
| 2419 | (void)cancel_work_sync(&priv->service_task); | 2419 | (void)cancel_work_sync(&priv->service_task); |
| 2420 | out_read_prop_fail: | 2420 | out_read_prop_fail: |
| 2421 | /* safe for ACPI FW */ | ||
| 2422 | of_node_put(to_of_node(priv->fwnode)); | ||
| 2421 | free_netdev(ndev); | 2423 | free_netdev(ndev); |
| 2422 | return ret; | 2424 | return ret; |
| 2423 | } | 2425 | } |
| @@ -2447,6 +2449,9 @@ static int hns_nic_dev_remove(struct platform_device *pdev) | |||
| 2447 | set_bit(NIC_STATE_REMOVING, &priv->state); | 2449 | set_bit(NIC_STATE_REMOVING, &priv->state); |
| 2448 | (void)cancel_work_sync(&priv->service_task); | 2450 | (void)cancel_work_sync(&priv->service_task); |
| 2449 | 2451 | ||
| 2452 | /* safe for ACPI FW */ | ||
| 2453 | of_node_put(to_of_node(priv->fwnode)); | ||
| 2454 | |||
| 2450 | free_netdev(ndev); | 2455 | free_netdev(ndev); |
| 2451 | return 0; | 2456 | return 0; |
| 2452 | } | 2457 | } |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c index 8e9b95871d30..ce15d2350db9 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c | |||
| @@ -1157,16 +1157,18 @@ static int hns_get_regs_len(struct net_device *net_dev) | |||
| 1157 | */ | 1157 | */ |
| 1158 | static int hns_nic_nway_reset(struct net_device *netdev) | 1158 | static int hns_nic_nway_reset(struct net_device *netdev) |
| 1159 | { | 1159 | { |
| 1160 | int ret = 0; | ||
| 1161 | struct phy_device *phy = netdev->phydev; | 1160 | struct phy_device *phy = netdev->phydev; |
| 1162 | 1161 | ||
| 1163 | if (netif_running(netdev)) { | 1162 | if (!netif_running(netdev)) |
| 1164 | /* if autoneg is disabled, don't restart auto-negotiation */ | 1163 | return 0; |
| 1165 | if (phy && phy->autoneg == AUTONEG_ENABLE) | ||
| 1166 | ret = genphy_restart_aneg(phy); | ||
| 1167 | } | ||
| 1168 | 1164 | ||
| 1169 | return ret; | 1165 | if (!phy) |
| 1166 | return -EOPNOTSUPP; | ||
| 1167 | |||
| 1168 | if (phy->autoneg != AUTONEG_ENABLE) | ||
| 1169 | return -EINVAL; | ||
| 1170 | |||
| 1171 | return genphy_restart_aneg(phy); | ||
| 1170 | } | 1172 | } |
| 1171 | 1173 | ||
| 1172 | static u32 | 1174 | static u32 |
diff --git a/drivers/net/ethernet/hisilicon/hns_mdio.c b/drivers/net/ethernet/hisilicon/hns_mdio.c index 017e08452d8c..baf5cc251f32 100644 --- a/drivers/net/ethernet/hisilicon/hns_mdio.c +++ b/drivers/net/ethernet/hisilicon/hns_mdio.c | |||
| @@ -321,7 +321,7 @@ static int hns_mdio_read(struct mii_bus *bus, int phy_id, int regnum) | |||
| 321 | } | 321 | } |
| 322 | 322 | ||
| 323 | hns_mdio_cmd_write(mdio_dev, is_c45, | 323 | hns_mdio_cmd_write(mdio_dev, is_c45, |
| 324 | MDIO_C45_WRITE_ADDR, phy_id, devad); | 324 | MDIO_C45_READ, phy_id, devad); |
| 325 | } | 325 | } |
| 326 | 326 | ||
| 327 | /* Step 5: waitting for MDIO_COMMAND_REG 's mdio_start==0,*/ | 327 | /* Step 5: waitting for MDIO_COMMAND_REG 's mdio_start==0,*/ |
diff --git a/drivers/net/ethernet/i825xx/82596.c b/drivers/net/ethernet/i825xx/82596.c index d719668a6684..92929750f832 100644 --- a/drivers/net/ethernet/i825xx/82596.c +++ b/drivers/net/ethernet/i825xx/82596.c | |||
| @@ -1310,7 +1310,7 @@ static irqreturn_t i596_interrupt(int irq, void *dev_id) | |||
| 1310 | dev->stats.tx_aborted_errors++; | 1310 | dev->stats.tx_aborted_errors++; |
| 1311 | } | 1311 | } |
| 1312 | 1312 | ||
| 1313 | dev_kfree_skb_irq(skb); | 1313 | dev_consume_skb_irq(skb); |
| 1314 | 1314 | ||
| 1315 | tx_cmd->cmd.command = 0; /* Mark free */ | 1315 | tx_cmd->cmd.command = 0; /* Mark free */ |
| 1316 | break; | 1316 | break; |
diff --git a/drivers/net/ethernet/marvell/skge.c b/drivers/net/ethernet/marvell/skge.c index 04fd1f135011..654ac534b10e 100644 --- a/drivers/net/ethernet/marvell/skge.c +++ b/drivers/net/ethernet/marvell/skge.c | |||
| @@ -152,8 +152,10 @@ static void skge_get_regs(struct net_device *dev, struct ethtool_regs *regs, | |||
| 152 | memset(p, 0, regs->len); | 152 | memset(p, 0, regs->len); |
| 153 | memcpy_fromio(p, io, B3_RAM_ADDR); | 153 | memcpy_fromio(p, io, B3_RAM_ADDR); |
| 154 | 154 | ||
| 155 | memcpy_fromio(p + B3_RI_WTO_R1, io + B3_RI_WTO_R1, | 155 | if (regs->len > B3_RI_WTO_R1) { |
| 156 | regs->len - B3_RI_WTO_R1); | 156 | memcpy_fromio(p + B3_RI_WTO_R1, io + B3_RI_WTO_R1, |
| 157 | regs->len - B3_RI_WTO_R1); | ||
| 158 | } | ||
| 157 | } | 159 | } |
| 158 | 160 | ||
| 159 | /* Wake on Lan only supported on Yukon chips with rev 1 or above */ | 161 | /* Wake on Lan only supported on Yukon chips with rev 1 or above */ |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c index 046948ead152..f3c7ab6faea5 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c | |||
| @@ -256,6 +256,7 @@ int mlx5e_tc_tun_create_header_ipv4(struct mlx5e_priv *priv, | |||
| 256 | e->m_neigh.family = n->ops->family; | 256 | e->m_neigh.family = n->ops->family; |
| 257 | memcpy(&e->m_neigh.dst_ip, n->primary_key, n->tbl->key_len); | 257 | memcpy(&e->m_neigh.dst_ip, n->primary_key, n->tbl->key_len); |
| 258 | e->out_dev = out_dev; | 258 | e->out_dev = out_dev; |
| 259 | e->route_dev = route_dev; | ||
| 259 | 260 | ||
| 260 | /* It's important to add the neigh to the hash table before checking | 261 | /* It's important to add the neigh to the hash table before checking |
| 261 | * the neigh validity state. So if we'll get a notification, in case the | 262 | * the neigh validity state. So if we'll get a notification, in case the |
| @@ -369,6 +370,7 @@ int mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv, | |||
| 369 | e->m_neigh.family = n->ops->family; | 370 | e->m_neigh.family = n->ops->family; |
| 370 | memcpy(&e->m_neigh.dst_ip, n->primary_key, n->tbl->key_len); | 371 | memcpy(&e->m_neigh.dst_ip, n->primary_key, n->tbl->key_len); |
| 371 | e->out_dev = out_dev; | 372 | e->out_dev = out_dev; |
| 373 | e->route_dev = route_dev; | ||
| 372 | 374 | ||
| 373 | /* It's importent to add the neigh to the hash table before checking | 375 | /* It's importent to add the neigh to the hash table before checking |
| 374 | * the neigh validity state. So if we'll get a notification, in case the | 376 | * the neigh validity state. So if we'll get a notification, in case the |
| @@ -612,16 +614,18 @@ int mlx5e_tc_tun_parse(struct net_device *filter_dev, | |||
| 612 | struct mlx5_flow_spec *spec, | 614 | struct mlx5_flow_spec *spec, |
| 613 | struct tc_cls_flower_offload *f, | 615 | struct tc_cls_flower_offload *f, |
| 614 | void *headers_c, | 616 | void *headers_c, |
| 615 | void *headers_v) | 617 | void *headers_v, u8 *match_level) |
| 616 | { | 618 | { |
| 617 | int tunnel_type; | 619 | int tunnel_type; |
| 618 | int err = 0; | 620 | int err = 0; |
| 619 | 621 | ||
| 620 | tunnel_type = mlx5e_tc_tun_get_type(filter_dev); | 622 | tunnel_type = mlx5e_tc_tun_get_type(filter_dev); |
| 621 | if (tunnel_type == MLX5E_TC_TUNNEL_TYPE_VXLAN) { | 623 | if (tunnel_type == MLX5E_TC_TUNNEL_TYPE_VXLAN) { |
| 624 | *match_level = MLX5_MATCH_L4; | ||
| 622 | err = mlx5e_tc_tun_parse_vxlan(priv, spec, f, | 625 | err = mlx5e_tc_tun_parse_vxlan(priv, spec, f, |
| 623 | headers_c, headers_v); | 626 | headers_c, headers_v); |
| 624 | } else if (tunnel_type == MLX5E_TC_TUNNEL_TYPE_GRETAP) { | 627 | } else if (tunnel_type == MLX5E_TC_TUNNEL_TYPE_GRETAP) { |
| 628 | *match_level = MLX5_MATCH_L3; | ||
| 625 | err = mlx5e_tc_tun_parse_gretap(priv, spec, f, | 629 | err = mlx5e_tc_tun_parse_gretap(priv, spec, f, |
| 626 | headers_c, headers_v); | 630 | headers_c, headers_v); |
| 627 | } else { | 631 | } else { |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.h b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.h index 706ce7bf15e7..b63f15de899d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.h | |||
| @@ -39,6 +39,6 @@ int mlx5e_tc_tun_parse(struct net_device *filter_dev, | |||
| 39 | struct mlx5_flow_spec *spec, | 39 | struct mlx5_flow_spec *spec, |
| 40 | struct tc_cls_flower_offload *f, | 40 | struct tc_cls_flower_offload *f, |
| 41 | void *headers_c, | 41 | void *headers_c, |
| 42 | void *headers_v); | 42 | void *headers_v, u8 *match_level); |
| 43 | 43 | ||
| 44 | #endif //__MLX5_EN_TC_TUNNEL_H__ | 44 | #endif //__MLX5_EN_TC_TUNNEL_H__ |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 8cfd2ec7c0a2..01819e5c9975 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c | |||
| @@ -950,7 +950,7 @@ static int mlx5e_open_rq(struct mlx5e_channel *c, | |||
| 950 | if (params->rx_dim_enabled) | 950 | if (params->rx_dim_enabled) |
| 951 | __set_bit(MLX5E_RQ_STATE_AM, &c->rq.state); | 951 | __set_bit(MLX5E_RQ_STATE_AM, &c->rq.state); |
| 952 | 952 | ||
| 953 | if (params->pflags & MLX5E_PFLAG_RX_NO_CSUM_COMPLETE) | 953 | if (MLX5E_GET_PFLAG(params, MLX5E_PFLAG_RX_NO_CSUM_COMPLETE)) |
| 954 | __set_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &c->rq.state); | 954 | __set_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &c->rq.state); |
| 955 | 955 | ||
| 956 | return 0; | 956 | return 0; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c index 04736212a21c..ef9e472daffb 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | |||
| @@ -596,6 +596,10 @@ static void mlx5e_rep_update_flows(struct mlx5e_priv *priv, | |||
| 596 | if (neigh_connected && !(e->flags & MLX5_ENCAP_ENTRY_VALID)) { | 596 | if (neigh_connected && !(e->flags & MLX5_ENCAP_ENTRY_VALID)) { |
| 597 | ether_addr_copy(e->h_dest, ha); | 597 | ether_addr_copy(e->h_dest, ha); |
| 598 | ether_addr_copy(eth->h_dest, ha); | 598 | ether_addr_copy(eth->h_dest, ha); |
| 599 | /* Update the encap source mac, in case that we delete | ||
| 600 | * the flows when encap source mac changed. | ||
| 601 | */ | ||
| 602 | ether_addr_copy(eth->h_source, e->route_dev->dev_addr); | ||
| 599 | 603 | ||
| 600 | mlx5e_tc_encap_flows_add(priv, e); | 604 | mlx5e_tc_encap_flows_add(priv, e); |
| 601 | } | 605 | } |
| @@ -1126,9 +1130,17 @@ static int mlx5e_rep_get_phys_port_name(struct net_device *dev, | |||
| 1126 | struct mlx5e_priv *priv = netdev_priv(dev); | 1130 | struct mlx5e_priv *priv = netdev_priv(dev); |
| 1127 | struct mlx5e_rep_priv *rpriv = priv->ppriv; | 1131 | struct mlx5e_rep_priv *rpriv = priv->ppriv; |
| 1128 | struct mlx5_eswitch_rep *rep = rpriv->rep; | 1132 | struct mlx5_eswitch_rep *rep = rpriv->rep; |
| 1129 | int ret; | 1133 | int ret, pf_num; |
| 1134 | |||
| 1135 | ret = mlx5_lag_get_pf_num(priv->mdev, &pf_num); | ||
| 1136 | if (ret) | ||
| 1137 | return ret; | ||
| 1138 | |||
| 1139 | if (rep->vport == FDB_UPLINK_VPORT) | ||
| 1140 | ret = snprintf(buf, len, "p%d", pf_num); | ||
| 1141 | else | ||
| 1142 | ret = snprintf(buf, len, "pf%dvf%d", pf_num, rep->vport - 1); | ||
| 1130 | 1143 | ||
| 1131 | ret = snprintf(buf, len, "%d", rep->vport - 1); | ||
| 1132 | if (ret >= len) | 1144 | if (ret >= len) |
| 1133 | return -EOPNOTSUPP; | 1145 | return -EOPNOTSUPP; |
| 1134 | 1146 | ||
| @@ -1285,6 +1297,18 @@ static int mlx5e_uplink_rep_set_mac(struct net_device *netdev, void *addr) | |||
| 1285 | return 0; | 1297 | return 0; |
| 1286 | } | 1298 | } |
| 1287 | 1299 | ||
| 1300 | static int mlx5e_uplink_rep_set_vf_vlan(struct net_device *dev, int vf, u16 vlan, u8 qos, | ||
| 1301 | __be16 vlan_proto) | ||
| 1302 | { | ||
| 1303 | netdev_warn_once(dev, "legacy vf vlan setting isn't supported in switchdev mode\n"); | ||
| 1304 | |||
| 1305 | if (vlan != 0) | ||
| 1306 | return -EOPNOTSUPP; | ||
| 1307 | |||
| 1308 | /* allow setting 0-vid for compatibility with libvirt */ | ||
| 1309 | return 0; | ||
| 1310 | } | ||
| 1311 | |||
| 1288 | static const struct switchdev_ops mlx5e_rep_switchdev_ops = { | 1312 | static const struct switchdev_ops mlx5e_rep_switchdev_ops = { |
| 1289 | .switchdev_port_attr_get = mlx5e_attr_get, | 1313 | .switchdev_port_attr_get = mlx5e_attr_get, |
| 1290 | }; | 1314 | }; |
| @@ -1319,6 +1343,7 @@ static const struct net_device_ops mlx5e_netdev_ops_uplink_rep = { | |||
| 1319 | .ndo_set_vf_rate = mlx5e_set_vf_rate, | 1343 | .ndo_set_vf_rate = mlx5e_set_vf_rate, |
| 1320 | .ndo_get_vf_config = mlx5e_get_vf_config, | 1344 | .ndo_get_vf_config = mlx5e_get_vf_config, |
| 1321 | .ndo_get_vf_stats = mlx5e_get_vf_stats, | 1345 | .ndo_get_vf_stats = mlx5e_get_vf_stats, |
| 1346 | .ndo_set_vf_vlan = mlx5e_uplink_rep_set_vf_vlan, | ||
| 1322 | }; | 1347 | }; |
| 1323 | 1348 | ||
| 1324 | bool mlx5e_eswitch_rep(struct net_device *netdev) | 1349 | bool mlx5e_eswitch_rep(struct net_device *netdev) |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.h b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.h index edd722824697..36eafc877e6b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.h | |||
| @@ -148,6 +148,7 @@ struct mlx5e_encap_entry { | |||
| 148 | unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ | 148 | unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ |
| 149 | 149 | ||
| 150 | struct net_device *out_dev; | 150 | struct net_device *out_dev; |
| 151 | struct net_device *route_dev; | ||
| 151 | int tunnel_type; | 152 | int tunnel_type; |
| 152 | int tunnel_hlen; | 153 | int tunnel_hlen; |
| 153 | int reformat_type; | 154 | int reformat_type; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c index cae6c6d48984..b5c1b039375a 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | |||
| @@ -128,6 +128,7 @@ struct mlx5e_tc_flow_parse_attr { | |||
| 128 | struct net_device *filter_dev; | 128 | struct net_device *filter_dev; |
| 129 | struct mlx5_flow_spec spec; | 129 | struct mlx5_flow_spec spec; |
| 130 | int num_mod_hdr_actions; | 130 | int num_mod_hdr_actions; |
| 131 | int max_mod_hdr_actions; | ||
| 131 | void *mod_hdr_actions; | 132 | void *mod_hdr_actions; |
| 132 | int mirred_ifindex[MLX5_MAX_FLOW_FWD_VPORTS]; | 133 | int mirred_ifindex[MLX5_MAX_FLOW_FWD_VPORTS]; |
| 133 | }; | 134 | }; |
| @@ -1302,7 +1303,7 @@ static void mlx5e_tc_del_flow(struct mlx5e_priv *priv, | |||
| 1302 | static int parse_tunnel_attr(struct mlx5e_priv *priv, | 1303 | static int parse_tunnel_attr(struct mlx5e_priv *priv, |
| 1303 | struct mlx5_flow_spec *spec, | 1304 | struct mlx5_flow_spec *spec, |
| 1304 | struct tc_cls_flower_offload *f, | 1305 | struct tc_cls_flower_offload *f, |
| 1305 | struct net_device *filter_dev) | 1306 | struct net_device *filter_dev, u8 *match_level) |
| 1306 | { | 1307 | { |
| 1307 | struct netlink_ext_ack *extack = f->common.extack; | 1308 | struct netlink_ext_ack *extack = f->common.extack; |
| 1308 | void *headers_c = MLX5_ADDR_OF(fte_match_param, spec->match_criteria, | 1309 | void *headers_c = MLX5_ADDR_OF(fte_match_param, spec->match_criteria, |
| @@ -1317,7 +1318,7 @@ static int parse_tunnel_attr(struct mlx5e_priv *priv, | |||
| 1317 | int err = 0; | 1318 | int err = 0; |
| 1318 | 1319 | ||
| 1319 | err = mlx5e_tc_tun_parse(filter_dev, priv, spec, f, | 1320 | err = mlx5e_tc_tun_parse(filter_dev, priv, spec, f, |
| 1320 | headers_c, headers_v); | 1321 | headers_c, headers_v, match_level); |
| 1321 | if (err) { | 1322 | if (err) { |
| 1322 | NL_SET_ERR_MSG_MOD(extack, | 1323 | NL_SET_ERR_MSG_MOD(extack, |
| 1323 | "failed to parse tunnel attributes"); | 1324 | "failed to parse tunnel attributes"); |
| @@ -1426,7 +1427,7 @@ static int __parse_cls_flower(struct mlx5e_priv *priv, | |||
| 1426 | struct mlx5_flow_spec *spec, | 1427 | struct mlx5_flow_spec *spec, |
| 1427 | struct tc_cls_flower_offload *f, | 1428 | struct tc_cls_flower_offload *f, |
| 1428 | struct net_device *filter_dev, | 1429 | struct net_device *filter_dev, |
| 1429 | u8 *match_level) | 1430 | u8 *match_level, u8 *tunnel_match_level) |
| 1430 | { | 1431 | { |
| 1431 | struct netlink_ext_ack *extack = f->common.extack; | 1432 | struct netlink_ext_ack *extack = f->common.extack; |
| 1432 | void *headers_c = MLX5_ADDR_OF(fte_match_param, spec->match_criteria, | 1433 | void *headers_c = MLX5_ADDR_OF(fte_match_param, spec->match_criteria, |
| @@ -1477,7 +1478,7 @@ static int __parse_cls_flower(struct mlx5e_priv *priv, | |||
| 1477 | switch (key->addr_type) { | 1478 | switch (key->addr_type) { |
| 1478 | case FLOW_DISSECTOR_KEY_IPV4_ADDRS: | 1479 | case FLOW_DISSECTOR_KEY_IPV4_ADDRS: |
| 1479 | case FLOW_DISSECTOR_KEY_IPV6_ADDRS: | 1480 | case FLOW_DISSECTOR_KEY_IPV6_ADDRS: |
| 1480 | if (parse_tunnel_attr(priv, spec, f, filter_dev)) | 1481 | if (parse_tunnel_attr(priv, spec, f, filter_dev, tunnel_match_level)) |
| 1481 | return -EOPNOTSUPP; | 1482 | return -EOPNOTSUPP; |
| 1482 | break; | 1483 | break; |
| 1483 | default: | 1484 | default: |
| @@ -1826,11 +1827,11 @@ static int parse_cls_flower(struct mlx5e_priv *priv, | |||
| 1826 | struct mlx5_core_dev *dev = priv->mdev; | 1827 | struct mlx5_core_dev *dev = priv->mdev; |
| 1827 | struct mlx5_eswitch *esw = dev->priv.eswitch; | 1828 | struct mlx5_eswitch *esw = dev->priv.eswitch; |
| 1828 | struct mlx5e_rep_priv *rpriv = priv->ppriv; | 1829 | struct mlx5e_rep_priv *rpriv = priv->ppriv; |
| 1830 | u8 match_level, tunnel_match_level = MLX5_MATCH_NONE; | ||
| 1829 | struct mlx5_eswitch_rep *rep; | 1831 | struct mlx5_eswitch_rep *rep; |
| 1830 | u8 match_level; | ||
| 1831 | int err; | 1832 | int err; |
| 1832 | 1833 | ||
| 1833 | err = __parse_cls_flower(priv, spec, f, filter_dev, &match_level); | 1834 | err = __parse_cls_flower(priv, spec, f, filter_dev, &match_level, &tunnel_match_level); |
| 1834 | 1835 | ||
| 1835 | if (!err && (flow->flags & MLX5E_TC_FLOW_ESWITCH)) { | 1836 | if (!err && (flow->flags & MLX5E_TC_FLOW_ESWITCH)) { |
| 1836 | rep = rpriv->rep; | 1837 | rep = rpriv->rep; |
| @@ -1846,10 +1847,12 @@ static int parse_cls_flower(struct mlx5e_priv *priv, | |||
| 1846 | } | 1847 | } |
| 1847 | } | 1848 | } |
| 1848 | 1849 | ||
| 1849 | if (flow->flags & MLX5E_TC_FLOW_ESWITCH) | 1850 | if (flow->flags & MLX5E_TC_FLOW_ESWITCH) { |
| 1850 | flow->esw_attr->match_level = match_level; | 1851 | flow->esw_attr->match_level = match_level; |
| 1851 | else | 1852 | flow->esw_attr->tunnel_match_level = tunnel_match_level; |
| 1853 | } else { | ||
| 1852 | flow->nic_attr->match_level = match_level; | 1854 | flow->nic_attr->match_level = match_level; |
| 1855 | } | ||
| 1853 | 1856 | ||
| 1854 | return err; | 1857 | return err; |
| 1855 | } | 1858 | } |
| @@ -1934,9 +1937,9 @@ static struct mlx5_fields fields[] = { | |||
| 1934 | OFFLOAD(UDP_DPORT, 2, udp.dest, 0), | 1937 | OFFLOAD(UDP_DPORT, 2, udp.dest, 0), |
| 1935 | }; | 1938 | }; |
| 1936 | 1939 | ||
| 1937 | /* On input attr->num_mod_hdr_actions tells how many HW actions can be parsed at | 1940 | /* On input attr->max_mod_hdr_actions tells how many HW actions can be parsed at |
| 1938 | * max from the SW pedit action. On success, it says how many HW actions were | 1941 | * max from the SW pedit action. On success, attr->num_mod_hdr_actions |
| 1939 | * actually parsed. | 1942 | * says how many HW actions were actually parsed. |
| 1940 | */ | 1943 | */ |
| 1941 | static int offload_pedit_fields(struct pedit_headers *masks, | 1944 | static int offload_pedit_fields(struct pedit_headers *masks, |
| 1942 | struct pedit_headers *vals, | 1945 | struct pedit_headers *vals, |
| @@ -1960,9 +1963,11 @@ static int offload_pedit_fields(struct pedit_headers *masks, | |||
| 1960 | add_vals = &vals[TCA_PEDIT_KEY_EX_CMD_ADD]; | 1963 | add_vals = &vals[TCA_PEDIT_KEY_EX_CMD_ADD]; |
| 1961 | 1964 | ||
| 1962 | action_size = MLX5_UN_SZ_BYTES(set_action_in_add_action_in_auto); | 1965 | action_size = MLX5_UN_SZ_BYTES(set_action_in_add_action_in_auto); |
| 1963 | action = parse_attr->mod_hdr_actions; | 1966 | action = parse_attr->mod_hdr_actions + |
| 1964 | max_actions = parse_attr->num_mod_hdr_actions; | 1967 | parse_attr->num_mod_hdr_actions * action_size; |
| 1965 | nactions = 0; | 1968 | |
| 1969 | max_actions = parse_attr->max_mod_hdr_actions; | ||
| 1970 | nactions = parse_attr->num_mod_hdr_actions; | ||
| 1966 | 1971 | ||
| 1967 | for (i = 0; i < ARRAY_SIZE(fields); i++) { | 1972 | for (i = 0; i < ARRAY_SIZE(fields); i++) { |
| 1968 | f = &fields[i]; | 1973 | f = &fields[i]; |
| @@ -2073,7 +2078,7 @@ static int alloc_mod_hdr_actions(struct mlx5e_priv *priv, | |||
| 2073 | if (!parse_attr->mod_hdr_actions) | 2078 | if (!parse_attr->mod_hdr_actions) |
| 2074 | return -ENOMEM; | 2079 | return -ENOMEM; |
| 2075 | 2080 | ||
| 2076 | parse_attr->num_mod_hdr_actions = max_actions; | 2081 | parse_attr->max_mod_hdr_actions = max_actions; |
| 2077 | return 0; | 2082 | return 0; |
| 2078 | } | 2083 | } |
| 2079 | 2084 | ||
| @@ -2119,9 +2124,11 @@ static int parse_tc_pedit_action(struct mlx5e_priv *priv, | |||
| 2119 | goto out_err; | 2124 | goto out_err; |
| 2120 | } | 2125 | } |
| 2121 | 2126 | ||
| 2122 | err = alloc_mod_hdr_actions(priv, a, namespace, parse_attr); | 2127 | if (!parse_attr->mod_hdr_actions) { |
| 2123 | if (err) | 2128 | err = alloc_mod_hdr_actions(priv, a, namespace, parse_attr); |
| 2124 | goto out_err; | 2129 | if (err) |
| 2130 | goto out_err; | ||
| 2131 | } | ||
| 2125 | 2132 | ||
| 2126 | err = offload_pedit_fields(masks, vals, parse_attr, extack); | 2133 | err = offload_pedit_fields(masks, vals, parse_attr, extack); |
| 2127 | if (err < 0) | 2134 | if (err < 0) |
| @@ -2179,6 +2186,7 @@ static bool csum_offload_supported(struct mlx5e_priv *priv, | |||
| 2179 | 2186 | ||
| 2180 | static bool modify_header_match_supported(struct mlx5_flow_spec *spec, | 2187 | static bool modify_header_match_supported(struct mlx5_flow_spec *spec, |
| 2181 | struct tcf_exts *exts, | 2188 | struct tcf_exts *exts, |
| 2189 | u32 actions, | ||
| 2182 | struct netlink_ext_ack *extack) | 2190 | struct netlink_ext_ack *extack) |
| 2183 | { | 2191 | { |
| 2184 | const struct tc_action *a; | 2192 | const struct tc_action *a; |
| @@ -2188,7 +2196,11 @@ static bool modify_header_match_supported(struct mlx5_flow_spec *spec, | |||
| 2188 | u16 ethertype; | 2196 | u16 ethertype; |
| 2189 | int nkeys, i; | 2197 | int nkeys, i; |
| 2190 | 2198 | ||
| 2191 | headers_v = MLX5_ADDR_OF(fte_match_param, spec->match_value, outer_headers); | 2199 | if (actions & MLX5_FLOW_CONTEXT_ACTION_DECAP) |
| 2200 | headers_v = MLX5_ADDR_OF(fte_match_param, spec->match_value, inner_headers); | ||
| 2201 | else | ||
| 2202 | headers_v = MLX5_ADDR_OF(fte_match_param, spec->match_value, outer_headers); | ||
| 2203 | |||
| 2192 | ethertype = MLX5_GET(fte_match_set_lyr_2_4, headers_v, ethertype); | 2204 | ethertype = MLX5_GET(fte_match_set_lyr_2_4, headers_v, ethertype); |
| 2193 | 2205 | ||
| 2194 | /* for non-IP we only re-write MACs, so we're okay */ | 2206 | /* for non-IP we only re-write MACs, so we're okay */ |
| @@ -2245,7 +2257,7 @@ static bool actions_match_supported(struct mlx5e_priv *priv, | |||
| 2245 | 2257 | ||
| 2246 | if (actions & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR) | 2258 | if (actions & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR) |
| 2247 | return modify_header_match_supported(&parse_attr->spec, exts, | 2259 | return modify_header_match_supported(&parse_attr->spec, exts, |
| 2248 | extack); | 2260 | actions, extack); |
| 2249 | 2261 | ||
| 2250 | return true; | 2262 | return true; |
| 2251 | } | 2263 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c index 598ad7e4d5c9..0e55cd1f2e98 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | |||
| @@ -387,8 +387,14 @@ netdev_tx_t mlx5e_sq_xmit(struct mlx5e_txqsq *sq, struct sk_buff *skb, | |||
| 387 | num_wqebbs = DIV_ROUND_UP(ds_cnt, MLX5_SEND_WQEBB_NUM_DS); | 387 | num_wqebbs = DIV_ROUND_UP(ds_cnt, MLX5_SEND_WQEBB_NUM_DS); |
| 388 | contig_wqebbs_room = mlx5_wq_cyc_get_contig_wqebbs(wq, pi); | 388 | contig_wqebbs_room = mlx5_wq_cyc_get_contig_wqebbs(wq, pi); |
| 389 | if (unlikely(contig_wqebbs_room < num_wqebbs)) { | 389 | if (unlikely(contig_wqebbs_room < num_wqebbs)) { |
| 390 | #ifdef CONFIG_MLX5_EN_IPSEC | ||
| 391 | struct mlx5_wqe_eth_seg cur_eth = wqe->eth; | ||
| 392 | #endif | ||
| 390 | mlx5e_fill_sq_frag_edge(sq, wq, pi, contig_wqebbs_room); | 393 | mlx5e_fill_sq_frag_edge(sq, wq, pi, contig_wqebbs_room); |
| 391 | mlx5e_sq_fetch_wqe(sq, &wqe, &pi); | 394 | mlx5e_sq_fetch_wqe(sq, &wqe, &pi); |
| 395 | #ifdef CONFIG_MLX5_EN_IPSEC | ||
| 396 | wqe->eth = cur_eth; | ||
| 397 | #endif | ||
| 392 | } | 398 | } |
| 393 | 399 | ||
| 394 | /* fill wqe */ | 400 | /* fill wqe */ |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c index a44ea7b85614..5b492b67f4e1 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | |||
| @@ -1134,13 +1134,6 @@ static int esw_vport_ingress_config(struct mlx5_eswitch *esw, | |||
| 1134 | int err = 0; | 1134 | int err = 0; |
| 1135 | u8 *smac_v; | 1135 | u8 *smac_v; |
| 1136 | 1136 | ||
| 1137 | if (vport->info.spoofchk && !is_valid_ether_addr(vport->info.mac)) { | ||
| 1138 | mlx5_core_warn(esw->dev, | ||
| 1139 | "vport[%d] configure ingress rules failed, illegal mac with spoofchk\n", | ||
| 1140 | vport->vport); | ||
| 1141 | return -EPERM; | ||
| 1142 | } | ||
| 1143 | |||
| 1144 | esw_vport_cleanup_ingress_rules(esw, vport); | 1137 | esw_vport_cleanup_ingress_rules(esw, vport); |
| 1145 | 1138 | ||
| 1146 | if (!vport->info.vlan && !vport->info.qos && !vport->info.spoofchk) { | 1139 | if (!vport->info.vlan && !vport->info.qos && !vport->info.spoofchk) { |
| @@ -1728,7 +1721,7 @@ int mlx5_eswitch_init(struct mlx5_core_dev *dev) | |||
| 1728 | int vport_num; | 1721 | int vport_num; |
| 1729 | int err; | 1722 | int err; |
| 1730 | 1723 | ||
| 1731 | if (!MLX5_ESWITCH_MANAGER(dev)) | 1724 | if (!MLX5_VPORT_MANAGER(dev)) |
| 1732 | return 0; | 1725 | return 0; |
| 1733 | 1726 | ||
| 1734 | esw_info(dev, | 1727 | esw_info(dev, |
| @@ -1797,7 +1790,7 @@ abort: | |||
| 1797 | 1790 | ||
| 1798 | void mlx5_eswitch_cleanup(struct mlx5_eswitch *esw) | 1791 | void mlx5_eswitch_cleanup(struct mlx5_eswitch *esw) |
| 1799 | { | 1792 | { |
| 1800 | if (!esw || !MLX5_ESWITCH_MANAGER(esw->dev)) | 1793 | if (!esw || !MLX5_VPORT_MANAGER(esw->dev)) |
| 1801 | return; | 1794 | return; |
| 1802 | 1795 | ||
| 1803 | esw_info(esw->dev, "cleanup\n"); | 1796 | esw_info(esw->dev, "cleanup\n"); |
| @@ -1827,13 +1820,10 @@ int mlx5_eswitch_set_vport_mac(struct mlx5_eswitch *esw, | |||
| 1827 | mutex_lock(&esw->state_lock); | 1820 | mutex_lock(&esw->state_lock); |
| 1828 | evport = &esw->vports[vport]; | 1821 | evport = &esw->vports[vport]; |
| 1829 | 1822 | ||
| 1830 | if (evport->info.spoofchk && !is_valid_ether_addr(mac)) { | 1823 | if (evport->info.spoofchk && !is_valid_ether_addr(mac)) |
| 1831 | mlx5_core_warn(esw->dev, | 1824 | mlx5_core_warn(esw->dev, |
| 1832 | "MAC invalidation is not allowed when spoofchk is on, vport(%d)\n", | 1825 | "Set invalid MAC while spoofchk is on, vport(%d)\n", |
| 1833 | vport); | 1826 | vport); |
| 1834 | err = -EPERM; | ||
| 1835 | goto unlock; | ||
| 1836 | } | ||
| 1837 | 1827 | ||
| 1838 | err = mlx5_modify_nic_vport_mac_address(esw->dev, vport, mac); | 1828 | err = mlx5_modify_nic_vport_mac_address(esw->dev, vport, mac); |
| 1839 | if (err) { | 1829 | if (err) { |
| @@ -1979,6 +1969,10 @@ int mlx5_eswitch_set_vport_spoofchk(struct mlx5_eswitch *esw, | |||
| 1979 | evport = &esw->vports[vport]; | 1969 | evport = &esw->vports[vport]; |
| 1980 | pschk = evport->info.spoofchk; | 1970 | pschk = evport->info.spoofchk; |
| 1981 | evport->info.spoofchk = spoofchk; | 1971 | evport->info.spoofchk = spoofchk; |
| 1972 | if (pschk && !is_valid_ether_addr(evport->info.mac)) | ||
| 1973 | mlx5_core_warn(esw->dev, | ||
| 1974 | "Spoofchk in set while MAC is invalid, vport(%d)\n", | ||
| 1975 | evport->vport); | ||
| 1982 | if (evport->enabled && esw->mode == SRIOV_LEGACY) | 1976 | if (evport->enabled && esw->mode == SRIOV_LEGACY) |
| 1983 | err = esw_vport_ingress_config(esw, evport); | 1977 | err = esw_vport_ingress_config(esw, evport); |
| 1984 | if (err) | 1978 | if (err) |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h index 9c89eea9b2c3..748ff178a1d6 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h | |||
| @@ -312,6 +312,7 @@ struct mlx5_esw_flow_attr { | |||
| 312 | } dests[MLX5_MAX_FLOW_FWD_VPORTS]; | 312 | } dests[MLX5_MAX_FLOW_FWD_VPORTS]; |
| 313 | u32 mod_hdr_id; | 313 | u32 mod_hdr_id; |
| 314 | u8 match_level; | 314 | u8 match_level; |
| 315 | u8 tunnel_match_level; | ||
| 315 | struct mlx5_fc *counter; | 316 | struct mlx5_fc *counter; |
| 316 | u32 chain; | 317 | u32 chain; |
| 317 | u16 prio; | 318 | u16 prio; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c index 53065b6ae593..d4e6fe5b9300 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | |||
| @@ -160,14 +160,15 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw, | |||
| 160 | MLX5_SET_TO_ONES(fte_match_set_misc, misc, | 160 | MLX5_SET_TO_ONES(fte_match_set_misc, misc, |
| 161 | source_eswitch_owner_vhca_id); | 161 | source_eswitch_owner_vhca_id); |
| 162 | 162 | ||
| 163 | if (attr->match_level == MLX5_MATCH_NONE) | 163 | spec->match_criteria_enable = MLX5_MATCH_MISC_PARAMETERS; |
| 164 | spec->match_criteria_enable = MLX5_MATCH_MISC_PARAMETERS; | 164 | if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_DECAP) { |
| 165 | else | 165 | if (attr->tunnel_match_level != MLX5_MATCH_NONE) |
| 166 | spec->match_criteria_enable = MLX5_MATCH_OUTER_HEADERS | | 166 | spec->match_criteria_enable |= MLX5_MATCH_OUTER_HEADERS; |
| 167 | MLX5_MATCH_MISC_PARAMETERS; | 167 | if (attr->match_level != MLX5_MATCH_NONE) |
| 168 | 168 | spec->match_criteria_enable |= MLX5_MATCH_INNER_HEADERS; | |
| 169 | if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_DECAP) | 169 | } else if (attr->match_level != MLX5_MATCH_NONE) { |
| 170 | spec->match_criteria_enable |= MLX5_MATCH_INNER_HEADERS; | 170 | spec->match_criteria_enable |= MLX5_MATCH_OUTER_HEADERS; |
| 171 | } | ||
| 171 | 172 | ||
| 172 | if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR) | 173 | if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR) |
| 173 | flow_act.modify_id = attr->mod_hdr_id; | 174 | flow_act.modify_id = attr->mod_hdr_id; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag.c b/drivers/net/ethernet/mellanox/mlx5/core/lag.c index 3a6baed722d8..2d223385dc81 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lag.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lag.c | |||
| @@ -616,6 +616,27 @@ void mlx5_lag_add(struct mlx5_core_dev *dev, struct net_device *netdev) | |||
| 616 | } | 616 | } |
| 617 | } | 617 | } |
| 618 | 618 | ||
| 619 | int mlx5_lag_get_pf_num(struct mlx5_core_dev *dev, int *pf_num) | ||
| 620 | { | ||
| 621 | struct mlx5_lag *ldev; | ||
| 622 | int n; | ||
| 623 | |||
| 624 | ldev = mlx5_lag_dev_get(dev); | ||
| 625 | if (!ldev) { | ||
| 626 | mlx5_core_warn(dev, "no lag device, can't get pf num\n"); | ||
| 627 | return -EINVAL; | ||
| 628 | } | ||
| 629 | |||
| 630 | for (n = 0; n < MLX5_MAX_PORTS; n++) | ||
| 631 | if (ldev->pf[n].dev == dev) { | ||
| 632 | *pf_num = n; | ||
| 633 | return 0; | ||
| 634 | } | ||
| 635 | |||
| 636 | mlx5_core_warn(dev, "wasn't able to locate pf in the lag device\n"); | ||
| 637 | return -EINVAL; | ||
| 638 | } | ||
| 639 | |||
| 619 | /* Must be called with intf_mutex held */ | 640 | /* Must be called with intf_mutex held */ |
| 620 | void mlx5_lag_remove(struct mlx5_core_dev *dev) | 641 | void mlx5_lag_remove(struct mlx5_core_dev *dev) |
| 621 | { | 642 | { |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h index c68dcea5985b..5300b0b6d836 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h | |||
| @@ -187,6 +187,8 @@ static inline int mlx5_lag_is_lacp_owner(struct mlx5_core_dev *dev) | |||
| 187 | MLX5_CAP_GEN(dev, lag_master); | 187 | MLX5_CAP_GEN(dev, lag_master); |
| 188 | } | 188 | } |
| 189 | 189 | ||
| 190 | int mlx5_lag_get_pf_num(struct mlx5_core_dev *dev, int *pf_num); | ||
| 191 | |||
| 190 | void mlx5_reload_interface(struct mlx5_core_dev *mdev, int protocol); | 192 | void mlx5_reload_interface(struct mlx5_core_dev *mdev, int protocol); |
| 191 | void mlx5_lag_update(struct mlx5_core_dev *dev); | 193 | void mlx5_lag_update(struct mlx5_core_dev *dev); |
| 192 | 194 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/qp.c b/drivers/net/ethernet/mellanox/mlx5/core/qp.c index 388f205a497f..370ca94b6775 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/qp.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/qp.c | |||
| @@ -44,14 +44,15 @@ static struct mlx5_core_rsc_common * | |||
| 44 | mlx5_get_rsc(struct mlx5_qp_table *table, u32 rsn) | 44 | mlx5_get_rsc(struct mlx5_qp_table *table, u32 rsn) |
| 45 | { | 45 | { |
| 46 | struct mlx5_core_rsc_common *common; | 46 | struct mlx5_core_rsc_common *common; |
| 47 | unsigned long flags; | ||
| 47 | 48 | ||
| 48 | spin_lock(&table->lock); | 49 | spin_lock_irqsave(&table->lock, flags); |
| 49 | 50 | ||
| 50 | common = radix_tree_lookup(&table->tree, rsn); | 51 | common = radix_tree_lookup(&table->tree, rsn); |
| 51 | if (common) | 52 | if (common) |
| 52 | atomic_inc(&common->refcount); | 53 | atomic_inc(&common->refcount); |
| 53 | 54 | ||
| 54 | spin_unlock(&table->lock); | 55 | spin_unlock_irqrestore(&table->lock, flags); |
| 55 | 56 | ||
| 56 | return common; | 57 | return common; |
| 57 | } | 58 | } |
diff --git a/drivers/net/ethernet/qlogic/qed/qed.h b/drivers/net/ethernet/qlogic/qed/qed.h index 24a90163775e..2d8a77cc156b 100644 --- a/drivers/net/ethernet/qlogic/qed/qed.h +++ b/drivers/net/ethernet/qlogic/qed/qed.h | |||
| @@ -53,7 +53,7 @@ | |||
| 53 | extern const struct qed_common_ops qed_common_ops_pass; | 53 | extern const struct qed_common_ops qed_common_ops_pass; |
| 54 | 54 | ||
| 55 | #define QED_MAJOR_VERSION 8 | 55 | #define QED_MAJOR_VERSION 8 |
| 56 | #define QED_MINOR_VERSION 33 | 56 | #define QED_MINOR_VERSION 37 |
| 57 | #define QED_REVISION_VERSION 0 | 57 | #define QED_REVISION_VERSION 0 |
| 58 | #define QED_ENGINEERING_VERSION 20 | 58 | #define QED_ENGINEERING_VERSION 20 |
| 59 | 59 | ||
diff --git a/drivers/net/ethernet/qlogic/qed/qed_dev.c b/drivers/net/ethernet/qlogic/qed/qed_dev.c index 8f6551421945..2ecaaaa4469a 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_dev.c +++ b/drivers/net/ethernet/qlogic/qed/qed_dev.c | |||
| @@ -795,19 +795,19 @@ static void qed_init_qm_pq(struct qed_hwfn *p_hwfn, | |||
| 795 | 795 | ||
| 796 | /* get pq index according to PQ_FLAGS */ | 796 | /* get pq index according to PQ_FLAGS */ |
| 797 | static u16 *qed_init_qm_get_idx_from_flags(struct qed_hwfn *p_hwfn, | 797 | static u16 *qed_init_qm_get_idx_from_flags(struct qed_hwfn *p_hwfn, |
| 798 | u32 pq_flags) | 798 | unsigned long pq_flags) |
| 799 | { | 799 | { |
| 800 | struct qed_qm_info *qm_info = &p_hwfn->qm_info; | 800 | struct qed_qm_info *qm_info = &p_hwfn->qm_info; |
| 801 | 801 | ||
| 802 | /* Can't have multiple flags set here */ | 802 | /* Can't have multiple flags set here */ |
| 803 | if (bitmap_weight((unsigned long *)&pq_flags, | 803 | if (bitmap_weight(&pq_flags, |
| 804 | sizeof(pq_flags) * BITS_PER_BYTE) > 1) { | 804 | sizeof(pq_flags) * BITS_PER_BYTE) > 1) { |
| 805 | DP_ERR(p_hwfn, "requested multiple pq flags 0x%x\n", pq_flags); | 805 | DP_ERR(p_hwfn, "requested multiple pq flags 0x%lx\n", pq_flags); |
| 806 | goto err; | 806 | goto err; |
| 807 | } | 807 | } |
| 808 | 808 | ||
| 809 | if (!(qed_get_pq_flags(p_hwfn) & pq_flags)) { | 809 | if (!(qed_get_pq_flags(p_hwfn) & pq_flags)) { |
| 810 | DP_ERR(p_hwfn, "pq flag 0x%x is not set\n", pq_flags); | 810 | DP_ERR(p_hwfn, "pq flag 0x%lx is not set\n", pq_flags); |
| 811 | goto err; | 811 | goto err; |
| 812 | } | 812 | } |
| 813 | 813 | ||
diff --git a/drivers/net/ethernet/qlogic/qed/qed_l2.c b/drivers/net/ethernet/qlogic/qed/qed_l2.c index 67c02ea93906..58be1c4c6668 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_l2.c +++ b/drivers/net/ethernet/qlogic/qed/qed_l2.c | |||
| @@ -609,6 +609,10 @@ qed_sp_update_accept_mode(struct qed_hwfn *p_hwfn, | |||
| 609 | (!!(accept_filter & QED_ACCEPT_MCAST_MATCHED) && | 609 | (!!(accept_filter & QED_ACCEPT_MCAST_MATCHED) && |
| 610 | !!(accept_filter & QED_ACCEPT_MCAST_UNMATCHED))); | 610 | !!(accept_filter & QED_ACCEPT_MCAST_UNMATCHED))); |
| 611 | 611 | ||
| 612 | SET_FIELD(state, ETH_VPORT_TX_MODE_UCAST_ACCEPT_ALL, | ||
| 613 | (!!(accept_filter & QED_ACCEPT_UCAST_MATCHED) && | ||
| 614 | !!(accept_filter & QED_ACCEPT_UCAST_UNMATCHED))); | ||
| 615 | |||
| 612 | SET_FIELD(state, ETH_VPORT_TX_MODE_BCAST_ACCEPT_ALL, | 616 | SET_FIELD(state, ETH_VPORT_TX_MODE_BCAST_ACCEPT_ALL, |
| 613 | !!(accept_filter & QED_ACCEPT_BCAST)); | 617 | !!(accept_filter & QED_ACCEPT_BCAST)); |
| 614 | 618 | ||
| @@ -744,6 +748,11 @@ int qed_sp_vport_update(struct qed_hwfn *p_hwfn, | |||
| 744 | return rc; | 748 | return rc; |
| 745 | } | 749 | } |
| 746 | 750 | ||
| 751 | if (p_params->update_ctl_frame_check) { | ||
| 752 | p_cmn->ctl_frame_mac_check_en = p_params->mac_chk_en; | ||
| 753 | p_cmn->ctl_frame_ethtype_check_en = p_params->ethtype_chk_en; | ||
| 754 | } | ||
| 755 | |||
| 747 | /* Update mcast bins for VFs, PF doesn't use this functionality */ | 756 | /* Update mcast bins for VFs, PF doesn't use this functionality */ |
| 748 | qed_sp_update_mcast_bin(p_hwfn, p_ramrod, p_params); | 757 | qed_sp_update_mcast_bin(p_hwfn, p_ramrod, p_params); |
| 749 | 758 | ||
| @@ -2207,7 +2216,7 @@ static int qed_fill_eth_dev_info(struct qed_dev *cdev, | |||
| 2207 | u16 num_queues = 0; | 2216 | u16 num_queues = 0; |
| 2208 | 2217 | ||
| 2209 | /* Since the feature controls only queue-zones, | 2218 | /* Since the feature controls only queue-zones, |
| 2210 | * make sure we have the contexts [rx, tx, xdp] to | 2219 | * make sure we have the contexts [rx, xdp, tcs] to |
| 2211 | * match. | 2220 | * match. |
| 2212 | */ | 2221 | */ |
| 2213 | for_each_hwfn(cdev, i) { | 2222 | for_each_hwfn(cdev, i) { |
| @@ -2217,7 +2226,8 @@ static int qed_fill_eth_dev_info(struct qed_dev *cdev, | |||
| 2217 | u16 cids; | 2226 | u16 cids; |
| 2218 | 2227 | ||
| 2219 | cids = hwfn->pf_params.eth_pf_params.num_cons; | 2228 | cids = hwfn->pf_params.eth_pf_params.num_cons; |
| 2220 | num_queues += min_t(u16, l2_queues, cids / 3); | 2229 | cids /= (2 + info->num_tc); |
| 2230 | num_queues += min_t(u16, l2_queues, cids); | ||
| 2221 | } | 2231 | } |
| 2222 | 2232 | ||
| 2223 | /* queues might theoretically be >256, but interrupts' | 2233 | /* queues might theoretically be >256, but interrupts' |
| @@ -2688,7 +2698,8 @@ static int qed_configure_filter_rx_mode(struct qed_dev *cdev, | |||
| 2688 | if (type == QED_FILTER_RX_MODE_TYPE_PROMISC) { | 2698 | if (type == QED_FILTER_RX_MODE_TYPE_PROMISC) { |
| 2689 | accept_flags.rx_accept_filter |= QED_ACCEPT_UCAST_UNMATCHED | | 2699 | accept_flags.rx_accept_filter |= QED_ACCEPT_UCAST_UNMATCHED | |
| 2690 | QED_ACCEPT_MCAST_UNMATCHED; | 2700 | QED_ACCEPT_MCAST_UNMATCHED; |
| 2691 | accept_flags.tx_accept_filter |= QED_ACCEPT_MCAST_UNMATCHED; | 2701 | accept_flags.tx_accept_filter |= QED_ACCEPT_UCAST_UNMATCHED | |
| 2702 | QED_ACCEPT_MCAST_UNMATCHED; | ||
| 2692 | } else if (type == QED_FILTER_RX_MODE_TYPE_MULTI_PROMISC) { | 2703 | } else if (type == QED_FILTER_RX_MODE_TYPE_MULTI_PROMISC) { |
| 2693 | accept_flags.rx_accept_filter |= QED_ACCEPT_MCAST_UNMATCHED; | 2704 | accept_flags.rx_accept_filter |= QED_ACCEPT_MCAST_UNMATCHED; |
| 2694 | accept_flags.tx_accept_filter |= QED_ACCEPT_MCAST_UNMATCHED; | 2705 | accept_flags.tx_accept_filter |= QED_ACCEPT_MCAST_UNMATCHED; |
| @@ -2860,7 +2871,8 @@ static int qed_get_coalesce(struct qed_dev *cdev, u16 *coal, void *handle) | |||
| 2860 | p_hwfn = p_cid->p_owner; | 2871 | p_hwfn = p_cid->p_owner; |
| 2861 | rc = qed_get_queue_coalesce(p_hwfn, coal, handle); | 2872 | rc = qed_get_queue_coalesce(p_hwfn, coal, handle); |
| 2862 | if (rc) | 2873 | if (rc) |
| 2863 | DP_NOTICE(p_hwfn, "Unable to read queue coalescing\n"); | 2874 | DP_VERBOSE(cdev, QED_MSG_DEBUG, |
| 2875 | "Unable to read queue coalescing\n"); | ||
| 2864 | 2876 | ||
| 2865 | return rc; | 2877 | return rc; |
| 2866 | } | 2878 | } |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_l2.h b/drivers/net/ethernet/qlogic/qed/qed_l2.h index 8d80f1095d17..7127d5aaac42 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_l2.h +++ b/drivers/net/ethernet/qlogic/qed/qed_l2.h | |||
| @@ -219,6 +219,9 @@ struct qed_sp_vport_update_params { | |||
| 219 | struct qed_rss_params *rss_params; | 219 | struct qed_rss_params *rss_params; |
| 220 | struct qed_filter_accept_flags accept_flags; | 220 | struct qed_filter_accept_flags accept_flags; |
| 221 | struct qed_sge_tpa_params *sge_tpa_params; | 221 | struct qed_sge_tpa_params *sge_tpa_params; |
| 222 | u8 update_ctl_frame_check; | ||
| 223 | u8 mac_chk_en; | ||
| 224 | u8 ethtype_chk_en; | ||
| 222 | }; | 225 | }; |
| 223 | 226 | ||
| 224 | int qed_sp_vport_update(struct qed_hwfn *p_hwfn, | 227 | int qed_sp_vport_update(struct qed_hwfn *p_hwfn, |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_ll2.c b/drivers/net/ethernet/qlogic/qed/qed_ll2.c index d9237c65a838..b5f419b71287 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_ll2.c +++ b/drivers/net/ethernet/qlogic/qed/qed_ll2.c | |||
| @@ -2451,19 +2451,24 @@ static int qed_ll2_start_xmit(struct qed_dev *cdev, struct sk_buff *skb, | |||
| 2451 | { | 2451 | { |
| 2452 | struct qed_ll2_tx_pkt_info pkt; | 2452 | struct qed_ll2_tx_pkt_info pkt; |
| 2453 | const skb_frag_t *frag; | 2453 | const skb_frag_t *frag; |
| 2454 | u8 flags = 0, nr_frags; | ||
| 2454 | int rc = -EINVAL, i; | 2455 | int rc = -EINVAL, i; |
| 2455 | dma_addr_t mapping; | 2456 | dma_addr_t mapping; |
| 2456 | u16 vlan = 0; | 2457 | u16 vlan = 0; |
| 2457 | u8 flags = 0; | ||
| 2458 | 2458 | ||
| 2459 | if (unlikely(skb->ip_summed != CHECKSUM_NONE)) { | 2459 | if (unlikely(skb->ip_summed != CHECKSUM_NONE)) { |
| 2460 | DP_INFO(cdev, "Cannot transmit a checksummed packet\n"); | 2460 | DP_INFO(cdev, "Cannot transmit a checksummed packet\n"); |
| 2461 | return -EINVAL; | 2461 | return -EINVAL; |
| 2462 | } | 2462 | } |
| 2463 | 2463 | ||
| 2464 | if (1 + skb_shinfo(skb)->nr_frags > CORE_LL2_TX_MAX_BDS_PER_PACKET) { | 2464 | /* Cache number of fragments from SKB since SKB may be freed by |
| 2465 | * the completion routine after calling qed_ll2_prepare_tx_packet() | ||
| 2466 | */ | ||
| 2467 | nr_frags = skb_shinfo(skb)->nr_frags; | ||
| 2468 | |||
| 2469 | if (1 + nr_frags > CORE_LL2_TX_MAX_BDS_PER_PACKET) { | ||
| 2465 | DP_ERR(cdev, "Cannot transmit a packet with %d fragments\n", | 2470 | DP_ERR(cdev, "Cannot transmit a packet with %d fragments\n", |
| 2466 | 1 + skb_shinfo(skb)->nr_frags); | 2471 | 1 + nr_frags); |
| 2467 | return -EINVAL; | 2472 | return -EINVAL; |
| 2468 | } | 2473 | } |
| 2469 | 2474 | ||
| @@ -2485,7 +2490,7 @@ static int qed_ll2_start_xmit(struct qed_dev *cdev, struct sk_buff *skb, | |||
| 2485 | } | 2490 | } |
| 2486 | 2491 | ||
| 2487 | memset(&pkt, 0, sizeof(pkt)); | 2492 | memset(&pkt, 0, sizeof(pkt)); |
| 2488 | pkt.num_of_bds = 1 + skb_shinfo(skb)->nr_frags; | 2493 | pkt.num_of_bds = 1 + nr_frags; |
| 2489 | pkt.vlan = vlan; | 2494 | pkt.vlan = vlan; |
| 2490 | pkt.bd_flags = flags; | 2495 | pkt.bd_flags = flags; |
| 2491 | pkt.tx_dest = QED_LL2_TX_DEST_NW; | 2496 | pkt.tx_dest = QED_LL2_TX_DEST_NW; |
| @@ -2496,12 +2501,17 @@ static int qed_ll2_start_xmit(struct qed_dev *cdev, struct sk_buff *skb, | |||
| 2496 | test_bit(QED_LL2_XMIT_FLAGS_FIP_DISCOVERY, &xmit_flags)) | 2501 | test_bit(QED_LL2_XMIT_FLAGS_FIP_DISCOVERY, &xmit_flags)) |
| 2497 | pkt.remove_stag = true; | 2502 | pkt.remove_stag = true; |
| 2498 | 2503 | ||
| 2504 | /* qed_ll2_prepare_tx_packet() may actually send the packet if | ||
| 2505 | * there are no fragments in the skb and subsequently the completion | ||
| 2506 | * routine may run and free the SKB, so no dereferencing the SKB | ||
| 2507 | * beyond this point unless skb has any fragments. | ||
| 2508 | */ | ||
| 2499 | rc = qed_ll2_prepare_tx_packet(&cdev->hwfns[0], cdev->ll2->handle, | 2509 | rc = qed_ll2_prepare_tx_packet(&cdev->hwfns[0], cdev->ll2->handle, |
| 2500 | &pkt, 1); | 2510 | &pkt, 1); |
| 2501 | if (rc) | 2511 | if (rc) |
| 2502 | goto err; | 2512 | goto err; |
| 2503 | 2513 | ||
| 2504 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | 2514 | for (i = 0; i < nr_frags; i++) { |
| 2505 | frag = &skb_shinfo(skb)->frags[i]; | 2515 | frag = &skb_shinfo(skb)->frags[i]; |
| 2506 | 2516 | ||
| 2507 | mapping = skb_frag_dma_map(&cdev->pdev->dev, frag, 0, | 2517 | mapping = skb_frag_dma_map(&cdev->pdev->dev, frag, 0, |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_sp.h b/drivers/net/ethernet/qlogic/qed/qed_sp.h index 4179c9013fc6..96ab77ae6af5 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_sp.h +++ b/drivers/net/ethernet/qlogic/qed/qed_sp.h | |||
| @@ -382,6 +382,7 @@ void qed_consq_setup(struct qed_hwfn *p_hwfn); | |||
| 382 | * @param p_hwfn | 382 | * @param p_hwfn |
| 383 | */ | 383 | */ |
| 384 | void qed_consq_free(struct qed_hwfn *p_hwfn); | 384 | void qed_consq_free(struct qed_hwfn *p_hwfn); |
| 385 | int qed_spq_pend_post(struct qed_hwfn *p_hwfn); | ||
| 385 | 386 | ||
| 386 | /** | 387 | /** |
| 387 | * @file | 388 | * @file |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_sp_commands.c b/drivers/net/ethernet/qlogic/qed/qed_sp_commands.c index 888274fa208b..5a495fda9e9d 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_sp_commands.c +++ b/drivers/net/ethernet/qlogic/qed/qed_sp_commands.c | |||
| @@ -604,6 +604,9 @@ int qed_sp_pf_update_stag(struct qed_hwfn *p_hwfn) | |||
| 604 | 604 | ||
| 605 | p_ent->ramrod.pf_update.update_mf_vlan_flag = true; | 605 | p_ent->ramrod.pf_update.update_mf_vlan_flag = true; |
| 606 | p_ent->ramrod.pf_update.mf_vlan = cpu_to_le16(p_hwfn->hw_info.ovlan); | 606 | p_ent->ramrod.pf_update.mf_vlan = cpu_to_le16(p_hwfn->hw_info.ovlan); |
| 607 | if (test_bit(QED_MF_UFP_SPECIFIC, &p_hwfn->cdev->mf_bits)) | ||
| 608 | p_ent->ramrod.pf_update.mf_vlan |= | ||
| 609 | cpu_to_le16(((u16)p_hwfn->ufp_info.tc << 13)); | ||
| 607 | 610 | ||
| 608 | return qed_spq_post(p_hwfn, p_ent, NULL); | 611 | return qed_spq_post(p_hwfn, p_ent, NULL); |
| 609 | } | 612 | } |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_spq.c b/drivers/net/ethernet/qlogic/qed/qed_spq.c index eb88bbc6b193..ba64ff9bedbd 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_spq.c +++ b/drivers/net/ethernet/qlogic/qed/qed_spq.c | |||
| @@ -397,6 +397,11 @@ int qed_eq_completion(struct qed_hwfn *p_hwfn, void *cookie) | |||
| 397 | 397 | ||
| 398 | qed_eq_prod_update(p_hwfn, qed_chain_get_prod_idx(p_chain)); | 398 | qed_eq_prod_update(p_hwfn, qed_chain_get_prod_idx(p_chain)); |
| 399 | 399 | ||
| 400 | /* Attempt to post pending requests */ | ||
| 401 | spin_lock_bh(&p_hwfn->p_spq->lock); | ||
| 402 | rc = qed_spq_pend_post(p_hwfn); | ||
| 403 | spin_unlock_bh(&p_hwfn->p_spq->lock); | ||
| 404 | |||
| 400 | return rc; | 405 | return rc; |
| 401 | } | 406 | } |
| 402 | 407 | ||
| @@ -767,7 +772,7 @@ static int qed_spq_post_list(struct qed_hwfn *p_hwfn, | |||
| 767 | return 0; | 772 | return 0; |
| 768 | } | 773 | } |
| 769 | 774 | ||
| 770 | static int qed_spq_pend_post(struct qed_hwfn *p_hwfn) | 775 | int qed_spq_pend_post(struct qed_hwfn *p_hwfn) |
| 771 | { | 776 | { |
| 772 | struct qed_spq *p_spq = p_hwfn->p_spq; | 777 | struct qed_spq *p_spq = p_hwfn->p_spq; |
| 773 | struct qed_spq_entry *p_ent = NULL; | 778 | struct qed_spq_entry *p_ent = NULL; |
| @@ -905,7 +910,6 @@ int qed_spq_completion(struct qed_hwfn *p_hwfn, | |||
| 905 | struct qed_spq_entry *p_ent = NULL; | 910 | struct qed_spq_entry *p_ent = NULL; |
| 906 | struct qed_spq_entry *tmp; | 911 | struct qed_spq_entry *tmp; |
| 907 | struct qed_spq_entry *found = NULL; | 912 | struct qed_spq_entry *found = NULL; |
| 908 | int rc; | ||
| 909 | 913 | ||
| 910 | if (!p_hwfn) | 914 | if (!p_hwfn) |
| 911 | return -EINVAL; | 915 | return -EINVAL; |
| @@ -963,12 +967,7 @@ int qed_spq_completion(struct qed_hwfn *p_hwfn, | |||
| 963 | */ | 967 | */ |
| 964 | qed_spq_return_entry(p_hwfn, found); | 968 | qed_spq_return_entry(p_hwfn, found); |
| 965 | 969 | ||
| 966 | /* Attempt to post pending requests */ | 970 | return 0; |
| 967 | spin_lock_bh(&p_spq->lock); | ||
| 968 | rc = qed_spq_pend_post(p_hwfn); | ||
| 969 | spin_unlock_bh(&p_spq->lock); | ||
| 970 | |||
| 971 | return rc; | ||
| 972 | } | 971 | } |
| 973 | 972 | ||
| 974 | int qed_consq_alloc(struct qed_hwfn *p_hwfn) | 973 | int qed_consq_alloc(struct qed_hwfn *p_hwfn) |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_sriov.c b/drivers/net/ethernet/qlogic/qed/qed_sriov.c index ca6290fa0f30..71a7af134dd8 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_sriov.c +++ b/drivers/net/ethernet/qlogic/qed/qed_sriov.c | |||
| @@ -1969,7 +1969,9 @@ static void qed_iov_vf_mbx_start_vport(struct qed_hwfn *p_hwfn, | |||
| 1969 | params.vport_id = vf->vport_id; | 1969 | params.vport_id = vf->vport_id; |
| 1970 | params.max_buffers_per_cqe = start->max_buffers_per_cqe; | 1970 | params.max_buffers_per_cqe = start->max_buffers_per_cqe; |
| 1971 | params.mtu = vf->mtu; | 1971 | params.mtu = vf->mtu; |
| 1972 | params.check_mac = true; | 1972 | |
| 1973 | /* Non trusted VFs should enable control frame filtering */ | ||
| 1974 | params.check_mac = !vf->p_vf_info.is_trusted_configured; | ||
| 1973 | 1975 | ||
| 1974 | rc = qed_sp_eth_vport_start(p_hwfn, ¶ms); | 1976 | rc = qed_sp_eth_vport_start(p_hwfn, ¶ms); |
| 1975 | if (rc) { | 1977 | if (rc) { |
| @@ -5130,6 +5132,9 @@ static void qed_iov_handle_trust_change(struct qed_hwfn *hwfn) | |||
| 5130 | params.opaque_fid = vf->opaque_fid; | 5132 | params.opaque_fid = vf->opaque_fid; |
| 5131 | params.vport_id = vf->vport_id; | 5133 | params.vport_id = vf->vport_id; |
| 5132 | 5134 | ||
| 5135 | params.update_ctl_frame_check = 1; | ||
| 5136 | params.mac_chk_en = !vf_info->is_trusted_configured; | ||
| 5137 | |||
| 5133 | if (vf_info->rx_accept_mode & mask) { | 5138 | if (vf_info->rx_accept_mode & mask) { |
| 5134 | flags->update_rx_mode_config = 1; | 5139 | flags->update_rx_mode_config = 1; |
| 5135 | flags->rx_accept_filter = vf_info->rx_accept_mode; | 5140 | flags->rx_accept_filter = vf_info->rx_accept_mode; |
| @@ -5147,7 +5152,8 @@ static void qed_iov_handle_trust_change(struct qed_hwfn *hwfn) | |||
| 5147 | } | 5152 | } |
| 5148 | 5153 | ||
| 5149 | if (flags->update_rx_mode_config || | 5154 | if (flags->update_rx_mode_config || |
| 5150 | flags->update_tx_mode_config) | 5155 | flags->update_tx_mode_config || |
| 5156 | params.update_ctl_frame_check) | ||
| 5151 | qed_sp_vport_update(hwfn, ¶ms, | 5157 | qed_sp_vport_update(hwfn, ¶ms, |
| 5152 | QED_SPQ_MODE_EBLOCK, NULL); | 5158 | QED_SPQ_MODE_EBLOCK, NULL); |
| 5153 | } | 5159 | } |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_vf.c b/drivers/net/ethernet/qlogic/qed/qed_vf.c index b6cccf44bf40..5dda547772c1 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_vf.c +++ b/drivers/net/ethernet/qlogic/qed/qed_vf.c | |||
| @@ -261,6 +261,7 @@ static int qed_vf_pf_acquire(struct qed_hwfn *p_hwfn) | |||
| 261 | struct pfvf_acquire_resp_tlv *resp = &p_iov->pf2vf_reply->acquire_resp; | 261 | struct pfvf_acquire_resp_tlv *resp = &p_iov->pf2vf_reply->acquire_resp; |
| 262 | struct pf_vf_pfdev_info *pfdev_info = &resp->pfdev_info; | 262 | struct pf_vf_pfdev_info *pfdev_info = &resp->pfdev_info; |
| 263 | struct vf_pf_resc_request *p_resc; | 263 | struct vf_pf_resc_request *p_resc; |
| 264 | u8 retry_cnt = VF_ACQUIRE_THRESH; | ||
| 264 | bool resources_acquired = false; | 265 | bool resources_acquired = false; |
| 265 | struct vfpf_acquire_tlv *req; | 266 | struct vfpf_acquire_tlv *req; |
| 266 | int rc = 0, attempts = 0; | 267 | int rc = 0, attempts = 0; |
| @@ -314,6 +315,15 @@ static int qed_vf_pf_acquire(struct qed_hwfn *p_hwfn) | |||
| 314 | 315 | ||
| 315 | /* send acquire request */ | 316 | /* send acquire request */ |
| 316 | rc = qed_send_msg2pf(p_hwfn, &resp->hdr.status, sizeof(*resp)); | 317 | rc = qed_send_msg2pf(p_hwfn, &resp->hdr.status, sizeof(*resp)); |
| 318 | |||
| 319 | /* Re-try acquire in case of vf-pf hw channel timeout */ | ||
| 320 | if (retry_cnt && rc == -EBUSY) { | ||
| 321 | DP_VERBOSE(p_hwfn, QED_MSG_IOV, | ||
| 322 | "VF retrying to acquire due to VPC timeout\n"); | ||
| 323 | retry_cnt--; | ||
| 324 | continue; | ||
| 325 | } | ||
| 326 | |||
| 317 | if (rc) | 327 | if (rc) |
| 318 | goto exit; | 328 | goto exit; |
| 319 | 329 | ||
diff --git a/drivers/net/ethernet/qlogic/qede/qede.h b/drivers/net/ethernet/qlogic/qede/qede.h index 613249d1e967..730997b13747 100644 --- a/drivers/net/ethernet/qlogic/qede/qede.h +++ b/drivers/net/ethernet/qlogic/qede/qede.h | |||
| @@ -56,7 +56,7 @@ | |||
| 56 | #include <net/tc_act/tc_gact.h> | 56 | #include <net/tc_act/tc_gact.h> |
| 57 | 57 | ||
| 58 | #define QEDE_MAJOR_VERSION 8 | 58 | #define QEDE_MAJOR_VERSION 8 |
| 59 | #define QEDE_MINOR_VERSION 33 | 59 | #define QEDE_MINOR_VERSION 37 |
| 60 | #define QEDE_REVISION_VERSION 0 | 60 | #define QEDE_REVISION_VERSION 0 |
| 61 | #define QEDE_ENGINEERING_VERSION 20 | 61 | #define QEDE_ENGINEERING_VERSION 20 |
| 62 | #define DRV_MODULE_VERSION __stringify(QEDE_MAJOR_VERSION) "." \ | 62 | #define DRV_MODULE_VERSION __stringify(QEDE_MAJOR_VERSION) "." \ |
| @@ -494,6 +494,9 @@ struct qede_reload_args { | |||
| 494 | 494 | ||
| 495 | /* Datapath functions definition */ | 495 | /* Datapath functions definition */ |
| 496 | netdev_tx_t qede_start_xmit(struct sk_buff *skb, struct net_device *ndev); | 496 | netdev_tx_t qede_start_xmit(struct sk_buff *skb, struct net_device *ndev); |
| 497 | u16 qede_select_queue(struct net_device *dev, struct sk_buff *skb, | ||
| 498 | struct net_device *sb_dev, | ||
| 499 | select_queue_fallback_t fallback); | ||
| 497 | netdev_features_t qede_features_check(struct sk_buff *skb, | 500 | netdev_features_t qede_features_check(struct sk_buff *skb, |
| 498 | struct net_device *dev, | 501 | struct net_device *dev, |
| 499 | netdev_features_t features); | 502 | netdev_features_t features); |
diff --git a/drivers/net/ethernet/qlogic/qede/qede_fp.c b/drivers/net/ethernet/qlogic/qede/qede_fp.c index bdf816fe5a16..31b046e24565 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_fp.c +++ b/drivers/net/ethernet/qlogic/qede/qede_fp.c | |||
| @@ -1695,6 +1695,19 @@ netdev_tx_t qede_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
| 1695 | return NETDEV_TX_OK; | 1695 | return NETDEV_TX_OK; |
| 1696 | } | 1696 | } |
| 1697 | 1697 | ||
| 1698 | u16 qede_select_queue(struct net_device *dev, struct sk_buff *skb, | ||
| 1699 | struct net_device *sb_dev, | ||
| 1700 | select_queue_fallback_t fallback) | ||
| 1701 | { | ||
| 1702 | struct qede_dev *edev = netdev_priv(dev); | ||
| 1703 | int total_txq; | ||
| 1704 | |||
| 1705 | total_txq = QEDE_TSS_COUNT(edev) * edev->dev_info.num_tc; | ||
| 1706 | |||
| 1707 | return QEDE_TSS_COUNT(edev) ? | ||
| 1708 | fallback(dev, skb, NULL) % total_txq : 0; | ||
| 1709 | } | ||
| 1710 | |||
| 1698 | /* 8B udp header + 8B base tunnel header + 32B option length */ | 1711 | /* 8B udp header + 8B base tunnel header + 32B option length */ |
| 1699 | #define QEDE_MAX_TUN_HDR_LEN 48 | 1712 | #define QEDE_MAX_TUN_HDR_LEN 48 |
| 1700 | 1713 | ||
diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c index 5a74fcbdbc2b..9790f26d17c4 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_main.c +++ b/drivers/net/ethernet/qlogic/qede/qede_main.c | |||
| @@ -631,6 +631,7 @@ static const struct net_device_ops qede_netdev_ops = { | |||
| 631 | .ndo_open = qede_open, | 631 | .ndo_open = qede_open, |
| 632 | .ndo_stop = qede_close, | 632 | .ndo_stop = qede_close, |
| 633 | .ndo_start_xmit = qede_start_xmit, | 633 | .ndo_start_xmit = qede_start_xmit, |
| 634 | .ndo_select_queue = qede_select_queue, | ||
| 634 | .ndo_set_rx_mode = qede_set_rx_mode, | 635 | .ndo_set_rx_mode = qede_set_rx_mode, |
| 635 | .ndo_set_mac_address = qede_set_mac_addr, | 636 | .ndo_set_mac_address = qede_set_mac_addr, |
| 636 | .ndo_validate_addr = eth_validate_addr, | 637 | .ndo_validate_addr = eth_validate_addr, |
| @@ -666,6 +667,7 @@ static const struct net_device_ops qede_netdev_vf_ops = { | |||
| 666 | .ndo_open = qede_open, | 667 | .ndo_open = qede_open, |
| 667 | .ndo_stop = qede_close, | 668 | .ndo_stop = qede_close, |
| 668 | .ndo_start_xmit = qede_start_xmit, | 669 | .ndo_start_xmit = qede_start_xmit, |
| 670 | .ndo_select_queue = qede_select_queue, | ||
| 669 | .ndo_set_rx_mode = qede_set_rx_mode, | 671 | .ndo_set_rx_mode = qede_set_rx_mode, |
| 670 | .ndo_set_mac_address = qede_set_mac_addr, | 672 | .ndo_set_mac_address = qede_set_mac_addr, |
| 671 | .ndo_validate_addr = eth_validate_addr, | 673 | .ndo_validate_addr = eth_validate_addr, |
| @@ -684,6 +686,7 @@ static const struct net_device_ops qede_netdev_vf_xdp_ops = { | |||
| 684 | .ndo_open = qede_open, | 686 | .ndo_open = qede_open, |
| 685 | .ndo_stop = qede_close, | 687 | .ndo_stop = qede_close, |
| 686 | .ndo_start_xmit = qede_start_xmit, | 688 | .ndo_start_xmit = qede_start_xmit, |
| 689 | .ndo_select_queue = qede_select_queue, | ||
| 687 | .ndo_set_rx_mode = qede_set_rx_mode, | 690 | .ndo_set_rx_mode = qede_set_rx_mode, |
| 688 | .ndo_set_mac_address = qede_set_mac_addr, | 691 | .ndo_set_mac_address = qede_set_mac_addr, |
| 689 | .ndo_validate_addr = eth_validate_addr, | 692 | .ndo_validate_addr = eth_validate_addr, |
diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c index 44f6e4873aad..4f910c4f67b0 100644 --- a/drivers/net/ethernet/realtek/8139cp.c +++ b/drivers/net/ethernet/realtek/8139cp.c | |||
| @@ -691,7 +691,7 @@ static void cp_tx (struct cp_private *cp) | |||
| 691 | } | 691 | } |
| 692 | bytes_compl += skb->len; | 692 | bytes_compl += skb->len; |
| 693 | pkts_compl++; | 693 | pkts_compl++; |
| 694 | dev_kfree_skb_irq(skb); | 694 | dev_consume_skb_irq(skb); |
| 695 | } | 695 | } |
| 696 | 696 | ||
| 697 | cp->tx_skb[tx_tail] = NULL; | 697 | cp->tx_skb[tx_tail] = NULL; |
diff --git a/drivers/net/ethernet/smsc/epic100.c b/drivers/net/ethernet/smsc/epic100.c index 15c62c160953..be47d864f8b9 100644 --- a/drivers/net/ethernet/smsc/epic100.c +++ b/drivers/net/ethernet/smsc/epic100.c | |||
| @@ -1037,7 +1037,7 @@ static void epic_tx(struct net_device *dev, struct epic_private *ep) | |||
| 1037 | skb = ep->tx_skbuff[entry]; | 1037 | skb = ep->tx_skbuff[entry]; |
| 1038 | pci_unmap_single(ep->pci_dev, ep->tx_ring[entry].bufaddr, | 1038 | pci_unmap_single(ep->pci_dev, ep->tx_ring[entry].bufaddr, |
| 1039 | skb->len, PCI_DMA_TODEVICE); | 1039 | skb->len, PCI_DMA_TODEVICE); |
| 1040 | dev_kfree_skb_irq(skb); | 1040 | dev_consume_skb_irq(skb); |
| 1041 | ep->tx_skbuff[entry] = NULL; | 1041 | ep->tx_skbuff[entry] = NULL; |
| 1042 | } | 1042 | } |
| 1043 | 1043 | ||
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c index 7b923362ee55..3b174eae77c1 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | |||
| @@ -1342,8 +1342,10 @@ static int rk_gmac_powerup(struct rk_priv_data *bsp_priv) | |||
| 1342 | } | 1342 | } |
| 1343 | 1343 | ||
| 1344 | ret = phy_power_on(bsp_priv, true); | 1344 | ret = phy_power_on(bsp_priv, true); |
| 1345 | if (ret) | 1345 | if (ret) { |
| 1346 | gmac_clk_enable(bsp_priv, false); | ||
| 1346 | return ret; | 1347 | return ret; |
| 1348 | } | ||
| 1347 | 1349 | ||
| 1348 | pm_runtime_enable(dev); | 1350 | pm_runtime_enable(dev); |
| 1349 | pm_runtime_get_sync(dev); | 1351 | pm_runtime_get_sync(dev); |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c index d1f61c25d82b..5d85742a2be0 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | |||
| @@ -721,8 +721,11 @@ static u32 stmmac_usec2riwt(u32 usec, struct stmmac_priv *priv) | |||
| 721 | { | 721 | { |
| 722 | unsigned long clk = clk_get_rate(priv->plat->stmmac_clk); | 722 | unsigned long clk = clk_get_rate(priv->plat->stmmac_clk); |
| 723 | 723 | ||
| 724 | if (!clk) | 724 | if (!clk) { |
| 725 | return 0; | 725 | clk = priv->plat->clk_ref_rate; |
| 726 | if (!clk) | ||
| 727 | return 0; | ||
| 728 | } | ||
| 726 | 729 | ||
| 727 | return (usec * (clk / 1000000)) / 256; | 730 | return (usec * (clk / 1000000)) / 256; |
| 728 | } | 731 | } |
| @@ -731,8 +734,11 @@ static u32 stmmac_riwt2usec(u32 riwt, struct stmmac_priv *priv) | |||
| 731 | { | 734 | { |
| 732 | unsigned long clk = clk_get_rate(priv->plat->stmmac_clk); | 735 | unsigned long clk = clk_get_rate(priv->plat->stmmac_clk); |
| 733 | 736 | ||
| 734 | if (!clk) | 737 | if (!clk) { |
| 735 | return 0; | 738 | clk = priv->plat->clk_ref_rate; |
| 739 | if (!clk) | ||
| 740 | return 0; | ||
| 741 | } | ||
| 736 | 742 | ||
| 737 | return (riwt * 256) / (clk / 1000000); | 743 | return (riwt * 256) / (clk / 1000000); |
| 738 | } | 744 | } |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 5afba69981cf..685d20472358 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
| @@ -3023,10 +3023,22 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 3023 | 3023 | ||
| 3024 | tx_q = &priv->tx_queue[queue]; | 3024 | tx_q = &priv->tx_queue[queue]; |
| 3025 | 3025 | ||
| 3026 | if (priv->tx_path_in_lpi_mode) | ||
| 3027 | stmmac_disable_eee_mode(priv); | ||
| 3028 | |||
| 3026 | /* Manage oversized TCP frames for GMAC4 device */ | 3029 | /* Manage oversized TCP frames for GMAC4 device */ |
| 3027 | if (skb_is_gso(skb) && priv->tso) { | 3030 | if (skb_is_gso(skb) && priv->tso) { |
| 3028 | if (skb_shinfo(skb)->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)) | 3031 | if (skb_shinfo(skb)->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)) { |
| 3032 | /* | ||
| 3033 | * There is no way to determine the number of TSO | ||
| 3034 | * capable Queues. Let's use always the Queue 0 | ||
| 3035 | * because if TSO is supported then at least this | ||
| 3036 | * one will be capable. | ||
| 3037 | */ | ||
| 3038 | skb_set_queue_mapping(skb, 0); | ||
| 3039 | |||
| 3029 | return stmmac_tso_xmit(skb, dev); | 3040 | return stmmac_tso_xmit(skb, dev); |
| 3041 | } | ||
| 3030 | } | 3042 | } |
| 3031 | 3043 | ||
| 3032 | if (unlikely(stmmac_tx_avail(priv, queue) < nfrags + 1)) { | 3044 | if (unlikely(stmmac_tx_avail(priv, queue) < nfrags + 1)) { |
| @@ -3041,9 +3053,6 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 3041 | return NETDEV_TX_BUSY; | 3053 | return NETDEV_TX_BUSY; |
| 3042 | } | 3054 | } |
| 3043 | 3055 | ||
| 3044 | if (priv->tx_path_in_lpi_mode) | ||
| 3045 | stmmac_disable_eee_mode(priv); | ||
| 3046 | |||
| 3047 | entry = tx_q->cur_tx; | 3056 | entry = tx_q->cur_tx; |
| 3048 | first_entry = entry; | 3057 | first_entry = entry; |
| 3049 | WARN_ON(tx_q->tx_skbuff[first_entry]); | 3058 | WARN_ON(tx_q->tx_skbuff[first_entry]); |
diff --git a/drivers/net/ethernet/sun/cassini.c b/drivers/net/ethernet/sun/cassini.c index 7ec4eb74fe21..6fc05c106afc 100644 --- a/drivers/net/ethernet/sun/cassini.c +++ b/drivers/net/ethernet/sun/cassini.c | |||
| @@ -1898,7 +1898,7 @@ static inline void cas_tx_ringN(struct cas *cp, int ring, int limit) | |||
| 1898 | cp->net_stats[ring].tx_packets++; | 1898 | cp->net_stats[ring].tx_packets++; |
| 1899 | cp->net_stats[ring].tx_bytes += skb->len; | 1899 | cp->net_stats[ring].tx_bytes += skb->len; |
| 1900 | spin_unlock(&cp->stat_lock[ring]); | 1900 | spin_unlock(&cp->stat_lock[ring]); |
| 1901 | dev_kfree_skb_irq(skb); | 1901 | dev_consume_skb_irq(skb); |
| 1902 | } | 1902 | } |
| 1903 | cp->tx_old[ring] = entry; | 1903 | cp->tx_old[ring] = entry; |
| 1904 | 1904 | ||
diff --git a/drivers/net/ethernet/sun/sunbmac.c b/drivers/net/ethernet/sun/sunbmac.c index 720b7ac77f3b..e9b757b03b56 100644 --- a/drivers/net/ethernet/sun/sunbmac.c +++ b/drivers/net/ethernet/sun/sunbmac.c | |||
| @@ -781,7 +781,7 @@ static void bigmac_tx(struct bigmac *bp) | |||
| 781 | 781 | ||
| 782 | DTX(("skb(%p) ", skb)); | 782 | DTX(("skb(%p) ", skb)); |
| 783 | bp->tx_skbs[elem] = NULL; | 783 | bp->tx_skbs[elem] = NULL; |
| 784 | dev_kfree_skb_irq(skb); | 784 | dev_consume_skb_irq(skb); |
| 785 | 785 | ||
| 786 | elem = NEXT_TX(elem); | 786 | elem = NEXT_TX(elem); |
| 787 | } | 787 | } |
diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c index ff641cf30a4e..d007dfeba5c3 100644 --- a/drivers/net/ethernet/sun/sunhme.c +++ b/drivers/net/ethernet/sun/sunhme.c | |||
| @@ -1962,7 +1962,7 @@ static void happy_meal_tx(struct happy_meal *hp) | |||
| 1962 | this = &txbase[elem]; | 1962 | this = &txbase[elem]; |
| 1963 | } | 1963 | } |
| 1964 | 1964 | ||
| 1965 | dev_kfree_skb_irq(skb); | 1965 | dev_consume_skb_irq(skb); |
| 1966 | dev->stats.tx_packets++; | 1966 | dev->stats.tx_packets++; |
| 1967 | } | 1967 | } |
| 1968 | hp->tx_old = elem; | 1968 | hp->tx_old = elem; |
diff --git a/drivers/net/ethernet/tehuti/tehuti.c b/drivers/net/ethernet/tehuti/tehuti.c index dc966ddb6d81..b24c11187017 100644 --- a/drivers/net/ethernet/tehuti/tehuti.c +++ b/drivers/net/ethernet/tehuti/tehuti.c | |||
| @@ -1739,7 +1739,7 @@ static void bdx_tx_cleanup(struct bdx_priv *priv) | |||
| 1739 | tx_level -= db->rptr->len; /* '-' koz len is negative */ | 1739 | tx_level -= db->rptr->len; /* '-' koz len is negative */ |
| 1740 | 1740 | ||
| 1741 | /* now should come skb pointer - free it */ | 1741 | /* now should come skb pointer - free it */ |
| 1742 | dev_kfree_skb_irq(db->rptr->addr.skb); | 1742 | dev_consume_skb_irq(db->rptr->addr.skb); |
| 1743 | bdx_tx_db_inc_rptr(db); | 1743 | bdx_tx_db_inc_rptr(db); |
| 1744 | } | 1744 | } |
| 1745 | 1745 | ||
diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c index 810dfc7de1f9..e2d47b24a869 100644 --- a/drivers/net/ethernet/ti/cpmac.c +++ b/drivers/net/ethernet/ti/cpmac.c | |||
| @@ -608,7 +608,7 @@ static void cpmac_end_xmit(struct net_device *dev, int queue) | |||
| 608 | netdev_dbg(dev, "sent 0x%p, len=%d\n", | 608 | netdev_dbg(dev, "sent 0x%p, len=%d\n", |
| 609 | desc->skb, desc->skb->len); | 609 | desc->skb, desc->skb->len); |
| 610 | 610 | ||
| 611 | dev_kfree_skb_irq(desc->skb); | 611 | dev_consume_skb_irq(desc->skb); |
| 612 | desc->skb = NULL; | 612 | desc->skb = NULL; |
| 613 | if (__netif_subqueue_stopped(dev, queue)) | 613 | if (__netif_subqueue_stopped(dev, queue)) |
| 614 | netif_wake_subqueue(dev, queue); | 614 | netif_wake_subqueue(dev, queue); |
diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index 82412691ee66..27f6cf140845 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c | |||
| @@ -1740,7 +1740,7 @@ static void velocity_free_tx_buf(struct velocity_info *vptr, | |||
| 1740 | dma_unmap_single(vptr->dev, tdinfo->skb_dma[i], | 1740 | dma_unmap_single(vptr->dev, tdinfo->skb_dma[i], |
| 1741 | le16_to_cpu(pktlen), DMA_TO_DEVICE); | 1741 | le16_to_cpu(pktlen), DMA_TO_DEVICE); |
| 1742 | } | 1742 | } |
| 1743 | dev_kfree_skb_irq(skb); | 1743 | dev_consume_skb_irq(skb); |
| 1744 | tdinfo->skb = NULL; | 1744 | tdinfo->skb = NULL; |
| 1745 | } | 1745 | } |
| 1746 | 1746 | ||
diff --git a/drivers/net/fddi/defxx.c b/drivers/net/fddi/defxx.c index 38ac8ef41f5f..56b7791911bf 100644 --- a/drivers/net/fddi/defxx.c +++ b/drivers/net/fddi/defxx.c | |||
| @@ -3512,7 +3512,7 @@ static int dfx_xmt_done(DFX_board_t *bp) | |||
| 3512 | bp->descr_block_virt->xmt_data[comp].long_1, | 3512 | bp->descr_block_virt->xmt_data[comp].long_1, |
| 3513 | p_xmt_drv_descr->p_skb->len, | 3513 | p_xmt_drv_descr->p_skb->len, |
| 3514 | DMA_TO_DEVICE); | 3514 | DMA_TO_DEVICE); |
| 3515 | dev_kfree_skb_irq(p_xmt_drv_descr->p_skb); | 3515 | dev_consume_skb_irq(p_xmt_drv_descr->p_skb); |
| 3516 | 3516 | ||
| 3517 | /* | 3517 | /* |
| 3518 | * Move to start of next packet by updating completion index | 3518 | * Move to start of next packet by updating completion index |
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c index 58bbba8582b0..3377ac66a347 100644 --- a/drivers/net/geneve.c +++ b/drivers/net/geneve.c | |||
| @@ -1512,9 +1512,13 @@ static void geneve_link_config(struct net_device *dev, | |||
| 1512 | } | 1512 | } |
| 1513 | #if IS_ENABLED(CONFIG_IPV6) | 1513 | #if IS_ENABLED(CONFIG_IPV6) |
| 1514 | case AF_INET6: { | 1514 | case AF_INET6: { |
| 1515 | struct rt6_info *rt = rt6_lookup(geneve->net, | 1515 | struct rt6_info *rt; |
| 1516 | &info->key.u.ipv6.dst, NULL, 0, | 1516 | |
| 1517 | NULL, 0); | 1517 | if (!__in6_dev_get(dev)) |
| 1518 | break; | ||
| 1519 | |||
| 1520 | rt = rt6_lookup(geneve->net, &info->key.u.ipv6.dst, NULL, 0, | ||
| 1521 | NULL, 0); | ||
| 1518 | 1522 | ||
| 1519 | if (rt && rt->dst.dev) | 1523 | if (rt && rt->dst.dev) |
| 1520 | ldev_mtu = rt->dst.dev->mtu - GENEVE_IPV6_HLEN; | 1524 | ldev_mtu = rt->dst.dev->mtu - GENEVE_IPV6_HLEN; |
diff --git a/drivers/net/ieee802154/mcr20a.c b/drivers/net/ieee802154/mcr20a.c index 44de81e5f140..c589f5ae75bb 100644 --- a/drivers/net/ieee802154/mcr20a.c +++ b/drivers/net/ieee802154/mcr20a.c | |||
| @@ -905,9 +905,9 @@ mcr20a_irq_clean_complete(void *context) | |||
| 905 | } | 905 | } |
| 906 | break; | 906 | break; |
| 907 | case (DAR_IRQSTS1_RXIRQ | DAR_IRQSTS1_SEQIRQ): | 907 | case (DAR_IRQSTS1_RXIRQ | DAR_IRQSTS1_SEQIRQ): |
| 908 | /* rx is starting */ | 908 | /* rx is starting */ |
| 909 | dev_dbg(printdev(lp), "RX is starting\n"); | 909 | dev_dbg(printdev(lp), "RX is starting\n"); |
| 910 | mcr20a_handle_rx(lp); | 910 | mcr20a_handle_rx(lp); |
| 911 | break; | 911 | break; |
| 912 | case (DAR_IRQSTS1_RXIRQ | DAR_IRQSTS1_TXIRQ | DAR_IRQSTS1_SEQIRQ): | 912 | case (DAR_IRQSTS1_RXIRQ | DAR_IRQSTS1_TXIRQ | DAR_IRQSTS1_SEQIRQ): |
| 913 | if (lp->is_tx) { | 913 | if (lp->is_tx) { |
diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c index 19bdde60680c..7cdac77d0c68 100644 --- a/drivers/net/ipvlan/ipvlan_main.c +++ b/drivers/net/ipvlan/ipvlan_main.c | |||
| @@ -100,12 +100,12 @@ static int ipvlan_set_port_mode(struct ipvl_port *port, u16 nval, | |||
| 100 | err = ipvlan_register_nf_hook(read_pnet(&port->pnet)); | 100 | err = ipvlan_register_nf_hook(read_pnet(&port->pnet)); |
| 101 | if (!err) { | 101 | if (!err) { |
| 102 | mdev->l3mdev_ops = &ipvl_l3mdev_ops; | 102 | mdev->l3mdev_ops = &ipvl_l3mdev_ops; |
| 103 | mdev->priv_flags |= IFF_L3MDEV_MASTER; | 103 | mdev->priv_flags |= IFF_L3MDEV_RX_HANDLER; |
| 104 | } else | 104 | } else |
| 105 | goto fail; | 105 | goto fail; |
| 106 | } else if (port->mode == IPVLAN_MODE_L3S) { | 106 | } else if (port->mode == IPVLAN_MODE_L3S) { |
| 107 | /* Old mode was L3S */ | 107 | /* Old mode was L3S */ |
| 108 | mdev->priv_flags &= ~IFF_L3MDEV_MASTER; | 108 | mdev->priv_flags &= ~IFF_L3MDEV_RX_HANDLER; |
| 109 | ipvlan_unregister_nf_hook(read_pnet(&port->pnet)); | 109 | ipvlan_unregister_nf_hook(read_pnet(&port->pnet)); |
| 110 | mdev->l3mdev_ops = NULL; | 110 | mdev->l3mdev_ops = NULL; |
| 111 | } | 111 | } |
| @@ -167,7 +167,7 @@ static void ipvlan_port_destroy(struct net_device *dev) | |||
| 167 | struct sk_buff *skb; | 167 | struct sk_buff *skb; |
| 168 | 168 | ||
| 169 | if (port->mode == IPVLAN_MODE_L3S) { | 169 | if (port->mode == IPVLAN_MODE_L3S) { |
| 170 | dev->priv_flags &= ~IFF_L3MDEV_MASTER; | 170 | dev->priv_flags &= ~IFF_L3MDEV_RX_HANDLER; |
| 171 | ipvlan_unregister_nf_hook(dev_net(dev)); | 171 | ipvlan_unregister_nf_hook(dev_net(dev)); |
| 172 | dev->l3mdev_ops = NULL; | 172 | dev->l3mdev_ops = NULL; |
| 173 | } | 173 | } |
diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c index 18b41bc345ab..6e8807212aa3 100644 --- a/drivers/net/phy/dp83640.c +++ b/drivers/net/phy/dp83640.c | |||
| @@ -898,14 +898,14 @@ static void decode_txts(struct dp83640_private *dp83640, | |||
| 898 | struct phy_txts *phy_txts) | 898 | struct phy_txts *phy_txts) |
| 899 | { | 899 | { |
| 900 | struct skb_shared_hwtstamps shhwtstamps; | 900 | struct skb_shared_hwtstamps shhwtstamps; |
| 901 | struct dp83640_skb_info *skb_info; | ||
| 901 | struct sk_buff *skb; | 902 | struct sk_buff *skb; |
| 902 | u64 ns; | ||
| 903 | u8 overflow; | 903 | u8 overflow; |
| 904 | u64 ns; | ||
| 904 | 905 | ||
| 905 | /* We must already have the skb that triggered this. */ | 906 | /* We must already have the skb that triggered this. */ |
| 906 | 907 | again: | |
| 907 | skb = skb_dequeue(&dp83640->tx_queue); | 908 | skb = skb_dequeue(&dp83640->tx_queue); |
| 908 | |||
| 909 | if (!skb) { | 909 | if (!skb) { |
| 910 | pr_debug("have timestamp but tx_queue empty\n"); | 910 | pr_debug("have timestamp but tx_queue empty\n"); |
| 911 | return; | 911 | return; |
| @@ -920,6 +920,11 @@ static void decode_txts(struct dp83640_private *dp83640, | |||
| 920 | } | 920 | } |
| 921 | return; | 921 | return; |
| 922 | } | 922 | } |
| 923 | skb_info = (struct dp83640_skb_info *)skb->cb; | ||
| 924 | if (time_after(jiffies, skb_info->tmo)) { | ||
| 925 | kfree_skb(skb); | ||
| 926 | goto again; | ||
| 927 | } | ||
| 923 | 928 | ||
| 924 | ns = phy2txts(phy_txts); | 929 | ns = phy2txts(phy_txts); |
| 925 | memset(&shhwtstamps, 0, sizeof(shhwtstamps)); | 930 | memset(&shhwtstamps, 0, sizeof(shhwtstamps)); |
| @@ -1472,6 +1477,7 @@ static bool dp83640_rxtstamp(struct phy_device *phydev, | |||
| 1472 | static void dp83640_txtstamp(struct phy_device *phydev, | 1477 | static void dp83640_txtstamp(struct phy_device *phydev, |
| 1473 | struct sk_buff *skb, int type) | 1478 | struct sk_buff *skb, int type) |
| 1474 | { | 1479 | { |
| 1480 | struct dp83640_skb_info *skb_info = (struct dp83640_skb_info *)skb->cb; | ||
| 1475 | struct dp83640_private *dp83640 = phydev->priv; | 1481 | struct dp83640_private *dp83640 = phydev->priv; |
| 1476 | 1482 | ||
| 1477 | switch (dp83640->hwts_tx_en) { | 1483 | switch (dp83640->hwts_tx_en) { |
| @@ -1484,6 +1490,7 @@ static void dp83640_txtstamp(struct phy_device *phydev, | |||
| 1484 | /* fall through */ | 1490 | /* fall through */ |
| 1485 | case HWTSTAMP_TX_ON: | 1491 | case HWTSTAMP_TX_ON: |
| 1486 | skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; | 1492 | skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; |
| 1493 | skb_info->tmo = jiffies + SKB_TIMESTAMP_TIMEOUT; | ||
| 1487 | skb_queue_tail(&dp83640->tx_queue, skb); | 1494 | skb_queue_tail(&dp83640->tx_queue, skb); |
| 1488 | break; | 1495 | break; |
| 1489 | 1496 | ||
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index 2e12f982534f..abb7876a8776 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c | |||
| @@ -847,7 +847,6 @@ static int m88e1510_config_init(struct phy_device *phydev) | |||
| 847 | 847 | ||
| 848 | /* SGMII-to-Copper mode initialization */ | 848 | /* SGMII-to-Copper mode initialization */ |
| 849 | if (phydev->interface == PHY_INTERFACE_MODE_SGMII) { | 849 | if (phydev->interface == PHY_INTERFACE_MODE_SGMII) { |
| 850 | |||
| 851 | /* Select page 18 */ | 850 | /* Select page 18 */ |
| 852 | err = marvell_set_page(phydev, 18); | 851 | err = marvell_set_page(phydev, 18); |
| 853 | if (err < 0) | 852 | if (err < 0) |
| @@ -870,21 +869,6 @@ static int m88e1510_config_init(struct phy_device *phydev) | |||
| 870 | err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); | 869 | err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); |
| 871 | if (err < 0) | 870 | if (err < 0) |
| 872 | return err; | 871 | return err; |
| 873 | |||
| 874 | /* There appears to be a bug in the 88e1512 when used in | ||
| 875 | * SGMII to copper mode, where the AN advertisement register | ||
| 876 | * clears the pause bits each time a negotiation occurs. | ||
| 877 | * This means we can never be truely sure what was advertised, | ||
| 878 | * so disable Pause support. | ||
| 879 | */ | ||
| 880 | linkmode_clear_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, | ||
| 881 | phydev->supported); | ||
| 882 | linkmode_clear_bit(ETHTOOL_LINK_MODE_Pause_BIT, | ||
| 883 | phydev->supported); | ||
| 884 | linkmode_clear_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, | ||
| 885 | phydev->advertising); | ||
| 886 | linkmode_clear_bit(ETHTOOL_LINK_MODE_Pause_BIT, | ||
| 887 | phydev->advertising); | ||
| 888 | } | 872 | } |
| 889 | 873 | ||
| 890 | return m88e1318_config_init(phydev); | 874 | return m88e1318_config_init(phydev); |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 18656c4094b3..fed298c0cb39 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
| @@ -866,8 +866,6 @@ static int tun_attach(struct tun_struct *tun, struct file *file, | |||
| 866 | if (rtnl_dereference(tun->xdp_prog)) | 866 | if (rtnl_dereference(tun->xdp_prog)) |
| 867 | sock_set_flag(&tfile->sk, SOCK_XDP); | 867 | sock_set_flag(&tfile->sk, SOCK_XDP); |
| 868 | 868 | ||
| 869 | tun_set_real_num_queues(tun); | ||
| 870 | |||
| 871 | /* device is allowed to go away first, so no need to hold extra | 869 | /* device is allowed to go away first, so no need to hold extra |
| 872 | * refcnt. | 870 | * refcnt. |
| 873 | */ | 871 | */ |
| @@ -879,6 +877,7 @@ static int tun_attach(struct tun_struct *tun, struct file *file, | |||
| 879 | rcu_assign_pointer(tfile->tun, tun); | 877 | rcu_assign_pointer(tfile->tun, tun); |
| 880 | rcu_assign_pointer(tun->tfiles[tun->numqueues], tfile); | 878 | rcu_assign_pointer(tun->tfiles[tun->numqueues], tfile); |
| 881 | tun->numqueues++; | 879 | tun->numqueues++; |
| 880 | tun_set_real_num_queues(tun); | ||
| 882 | out: | 881 | out: |
| 883 | return err; | 882 | return err; |
| 884 | } | 883 | } |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 8fadd8eaf601..4cfceb789eea 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
| @@ -57,6 +57,8 @@ module_param(napi_tx, bool, 0644); | |||
| 57 | #define VIRTIO_XDP_TX BIT(0) | 57 | #define VIRTIO_XDP_TX BIT(0) |
| 58 | #define VIRTIO_XDP_REDIR BIT(1) | 58 | #define VIRTIO_XDP_REDIR BIT(1) |
| 59 | 59 | ||
| 60 | #define VIRTIO_XDP_FLAG BIT(0) | ||
| 61 | |||
| 60 | /* RX packet size EWMA. The average packet size is used to determine the packet | 62 | /* RX packet size EWMA. The average packet size is used to determine the packet |
| 61 | * buffer size when refilling RX rings. As the entire RX ring may be refilled | 63 | * buffer size when refilling RX rings. As the entire RX ring may be refilled |
| 62 | * at once, the weight is chosen so that the EWMA will be insensitive to short- | 64 | * at once, the weight is chosen so that the EWMA will be insensitive to short- |
| @@ -252,6 +254,21 @@ struct padded_vnet_hdr { | |||
| 252 | char padding[4]; | 254 | char padding[4]; |
| 253 | }; | 255 | }; |
| 254 | 256 | ||
| 257 | static bool is_xdp_frame(void *ptr) | ||
| 258 | { | ||
| 259 | return (unsigned long)ptr & VIRTIO_XDP_FLAG; | ||
| 260 | } | ||
| 261 | |||
| 262 | static void *xdp_to_ptr(struct xdp_frame *ptr) | ||
| 263 | { | ||
| 264 | return (void *)((unsigned long)ptr | VIRTIO_XDP_FLAG); | ||
| 265 | } | ||
| 266 | |||
| 267 | static struct xdp_frame *ptr_to_xdp(void *ptr) | ||
| 268 | { | ||
| 269 | return (struct xdp_frame *)((unsigned long)ptr & ~VIRTIO_XDP_FLAG); | ||
| 270 | } | ||
| 271 | |||
| 255 | /* Converting between virtqueue no. and kernel tx/rx queue no. | 272 | /* Converting between virtqueue no. and kernel tx/rx queue no. |
| 256 | * 0:rx0 1:tx0 2:rx1 3:tx1 ... 2N:rxN 2N+1:txN 2N+2:cvq | 273 | * 0:rx0 1:tx0 2:rx1 3:tx1 ... 2N:rxN 2N+1:txN 2N+2:cvq |
| 257 | */ | 274 | */ |
| @@ -462,7 +479,8 @@ static int __virtnet_xdp_xmit_one(struct virtnet_info *vi, | |||
| 462 | 479 | ||
| 463 | sg_init_one(sq->sg, xdpf->data, xdpf->len); | 480 | sg_init_one(sq->sg, xdpf->data, xdpf->len); |
| 464 | 481 | ||
| 465 | err = virtqueue_add_outbuf(sq->vq, sq->sg, 1, xdpf, GFP_ATOMIC); | 482 | err = virtqueue_add_outbuf(sq->vq, sq->sg, 1, xdp_to_ptr(xdpf), |
| 483 | GFP_ATOMIC); | ||
| 466 | if (unlikely(err)) | 484 | if (unlikely(err)) |
| 467 | return -ENOSPC; /* Caller handle free/refcnt */ | 485 | return -ENOSPC; /* Caller handle free/refcnt */ |
| 468 | 486 | ||
| @@ -482,36 +500,47 @@ static int virtnet_xdp_xmit(struct net_device *dev, | |||
| 482 | { | 500 | { |
| 483 | struct virtnet_info *vi = netdev_priv(dev); | 501 | struct virtnet_info *vi = netdev_priv(dev); |
| 484 | struct receive_queue *rq = vi->rq; | 502 | struct receive_queue *rq = vi->rq; |
| 485 | struct xdp_frame *xdpf_sent; | ||
| 486 | struct bpf_prog *xdp_prog; | 503 | struct bpf_prog *xdp_prog; |
| 487 | struct send_queue *sq; | 504 | struct send_queue *sq; |
| 488 | unsigned int len; | 505 | unsigned int len; |
| 506 | int packets = 0; | ||
| 507 | int bytes = 0; | ||
| 489 | int drops = 0; | 508 | int drops = 0; |
| 490 | int kicks = 0; | 509 | int kicks = 0; |
| 491 | int ret, err; | 510 | int ret, err; |
| 511 | void *ptr; | ||
| 492 | int i; | 512 | int i; |
| 493 | 513 | ||
| 494 | sq = virtnet_xdp_sq(vi); | ||
| 495 | |||
| 496 | if (unlikely(flags & ~XDP_XMIT_FLAGS_MASK)) { | ||
| 497 | ret = -EINVAL; | ||
| 498 | drops = n; | ||
| 499 | goto out; | ||
| 500 | } | ||
| 501 | |||
| 502 | /* Only allow ndo_xdp_xmit if XDP is loaded on dev, as this | 514 | /* Only allow ndo_xdp_xmit if XDP is loaded on dev, as this |
| 503 | * indicate XDP resources have been successfully allocated. | 515 | * indicate XDP resources have been successfully allocated. |
| 504 | */ | 516 | */ |
| 505 | xdp_prog = rcu_dereference(rq->xdp_prog); | 517 | xdp_prog = rcu_dereference(rq->xdp_prog); |
| 506 | if (!xdp_prog) { | 518 | if (!xdp_prog) |
| 507 | ret = -ENXIO; | 519 | return -ENXIO; |
| 520 | |||
| 521 | sq = virtnet_xdp_sq(vi); | ||
| 522 | |||
| 523 | if (unlikely(flags & ~XDP_XMIT_FLAGS_MASK)) { | ||
| 524 | ret = -EINVAL; | ||
| 508 | drops = n; | 525 | drops = n; |
| 509 | goto out; | 526 | goto out; |
| 510 | } | 527 | } |
| 511 | 528 | ||
| 512 | /* Free up any pending old buffers before queueing new ones. */ | 529 | /* Free up any pending old buffers before queueing new ones. */ |
| 513 | while ((xdpf_sent = virtqueue_get_buf(sq->vq, &len)) != NULL) | 530 | while ((ptr = virtqueue_get_buf(sq->vq, &len)) != NULL) { |
| 514 | xdp_return_frame(xdpf_sent); | 531 | if (likely(is_xdp_frame(ptr))) { |
| 532 | struct xdp_frame *frame = ptr_to_xdp(ptr); | ||
| 533 | |||
| 534 | bytes += frame->len; | ||
| 535 | xdp_return_frame(frame); | ||
| 536 | } else { | ||
| 537 | struct sk_buff *skb = ptr; | ||
| 538 | |||
| 539 | bytes += skb->len; | ||
| 540 | napi_consume_skb(skb, false); | ||
| 541 | } | ||
| 542 | packets++; | ||
| 543 | } | ||
| 515 | 544 | ||
| 516 | for (i = 0; i < n; i++) { | 545 | for (i = 0; i < n; i++) { |
| 517 | struct xdp_frame *xdpf = frames[i]; | 546 | struct xdp_frame *xdpf = frames[i]; |
| @@ -530,6 +559,8 @@ static int virtnet_xdp_xmit(struct net_device *dev, | |||
| 530 | } | 559 | } |
| 531 | out: | 560 | out: |
| 532 | u64_stats_update_begin(&sq->stats.syncp); | 561 | u64_stats_update_begin(&sq->stats.syncp); |
| 562 | sq->stats.bytes += bytes; | ||
| 563 | sq->stats.packets += packets; | ||
| 533 | sq->stats.xdp_tx += n; | 564 | sq->stats.xdp_tx += n; |
| 534 | sq->stats.xdp_tx_drops += drops; | 565 | sq->stats.xdp_tx_drops += drops; |
| 535 | sq->stats.kicks += kicks; | 566 | sq->stats.kicks += kicks; |
| @@ -1332,18 +1363,26 @@ static int virtnet_receive(struct receive_queue *rq, int budget, | |||
| 1332 | 1363 | ||
| 1333 | static void free_old_xmit_skbs(struct send_queue *sq, bool in_napi) | 1364 | static void free_old_xmit_skbs(struct send_queue *sq, bool in_napi) |
| 1334 | { | 1365 | { |
| 1335 | struct sk_buff *skb; | ||
| 1336 | unsigned int len; | 1366 | unsigned int len; |
| 1337 | unsigned int packets = 0; | 1367 | unsigned int packets = 0; |
| 1338 | unsigned int bytes = 0; | 1368 | unsigned int bytes = 0; |
| 1369 | void *ptr; | ||
| 1339 | 1370 | ||
| 1340 | while ((skb = virtqueue_get_buf(sq->vq, &len)) != NULL) { | 1371 | while ((ptr = virtqueue_get_buf(sq->vq, &len)) != NULL) { |
| 1341 | pr_debug("Sent skb %p\n", skb); | 1372 | if (likely(!is_xdp_frame(ptr))) { |
| 1373 | struct sk_buff *skb = ptr; | ||
| 1342 | 1374 | ||
| 1343 | bytes += skb->len; | 1375 | pr_debug("Sent skb %p\n", skb); |
| 1344 | packets++; | 1376 | |
| 1377 | bytes += skb->len; | ||
| 1378 | napi_consume_skb(skb, in_napi); | ||
| 1379 | } else { | ||
| 1380 | struct xdp_frame *frame = ptr_to_xdp(ptr); | ||
| 1345 | 1381 | ||
| 1346 | napi_consume_skb(skb, in_napi); | 1382 | bytes += frame->len; |
| 1383 | xdp_return_frame(frame); | ||
| 1384 | } | ||
| 1385 | packets++; | ||
| 1347 | } | 1386 | } |
| 1348 | 1387 | ||
| 1349 | /* Avoid overhead when no packets have been processed | 1388 | /* Avoid overhead when no packets have been processed |
| @@ -1358,6 +1397,16 @@ static void free_old_xmit_skbs(struct send_queue *sq, bool in_napi) | |||
| 1358 | u64_stats_update_end(&sq->stats.syncp); | 1397 | u64_stats_update_end(&sq->stats.syncp); |
| 1359 | } | 1398 | } |
| 1360 | 1399 | ||
| 1400 | static bool is_xdp_raw_buffer_queue(struct virtnet_info *vi, int q) | ||
| 1401 | { | ||
| 1402 | if (q < (vi->curr_queue_pairs - vi->xdp_queue_pairs)) | ||
| 1403 | return false; | ||
| 1404 | else if (q < vi->curr_queue_pairs) | ||
| 1405 | return true; | ||
| 1406 | else | ||
| 1407 | return false; | ||
| 1408 | } | ||
| 1409 | |||
| 1361 | static void virtnet_poll_cleantx(struct receive_queue *rq) | 1410 | static void virtnet_poll_cleantx(struct receive_queue *rq) |
| 1362 | { | 1411 | { |
| 1363 | struct virtnet_info *vi = rq->vq->vdev->priv; | 1412 | struct virtnet_info *vi = rq->vq->vdev->priv; |
| @@ -1365,7 +1414,7 @@ static void virtnet_poll_cleantx(struct receive_queue *rq) | |||
| 1365 | struct send_queue *sq = &vi->sq[index]; | 1414 | struct send_queue *sq = &vi->sq[index]; |
| 1366 | struct netdev_queue *txq = netdev_get_tx_queue(vi->dev, index); | 1415 | struct netdev_queue *txq = netdev_get_tx_queue(vi->dev, index); |
| 1367 | 1416 | ||
| 1368 | if (!sq->napi.weight) | 1417 | if (!sq->napi.weight || is_xdp_raw_buffer_queue(vi, index)) |
| 1369 | return; | 1418 | return; |
| 1370 | 1419 | ||
| 1371 | if (__netif_tx_trylock(txq)) { | 1420 | if (__netif_tx_trylock(txq)) { |
| @@ -1442,8 +1491,16 @@ static int virtnet_poll_tx(struct napi_struct *napi, int budget) | |||
| 1442 | { | 1491 | { |
| 1443 | struct send_queue *sq = container_of(napi, struct send_queue, napi); | 1492 | struct send_queue *sq = container_of(napi, struct send_queue, napi); |
| 1444 | struct virtnet_info *vi = sq->vq->vdev->priv; | 1493 | struct virtnet_info *vi = sq->vq->vdev->priv; |
| 1445 | struct netdev_queue *txq = netdev_get_tx_queue(vi->dev, vq2txq(sq->vq)); | 1494 | unsigned int index = vq2txq(sq->vq); |
| 1495 | struct netdev_queue *txq; | ||
| 1446 | 1496 | ||
| 1497 | if (unlikely(is_xdp_raw_buffer_queue(vi, index))) { | ||
| 1498 | /* We don't need to enable cb for XDP */ | ||
| 1499 | napi_complete_done(napi, 0); | ||
| 1500 | return 0; | ||
| 1501 | } | ||
| 1502 | |||
| 1503 | txq = netdev_get_tx_queue(vi->dev, index); | ||
| 1447 | __netif_tx_lock(txq, raw_smp_processor_id()); | 1504 | __netif_tx_lock(txq, raw_smp_processor_id()); |
| 1448 | free_old_xmit_skbs(sq, true); | 1505 | free_old_xmit_skbs(sq, true); |
| 1449 | __netif_tx_unlock(txq); | 1506 | __netif_tx_unlock(txq); |
| @@ -2395,6 +2452,10 @@ static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog, | |||
| 2395 | return -ENOMEM; | 2452 | return -ENOMEM; |
| 2396 | } | 2453 | } |
| 2397 | 2454 | ||
| 2455 | old_prog = rtnl_dereference(vi->rq[0].xdp_prog); | ||
| 2456 | if (!prog && !old_prog) | ||
| 2457 | return 0; | ||
| 2458 | |||
| 2398 | if (prog) { | 2459 | if (prog) { |
| 2399 | prog = bpf_prog_add(prog, vi->max_queue_pairs - 1); | 2460 | prog = bpf_prog_add(prog, vi->max_queue_pairs - 1); |
| 2400 | if (IS_ERR(prog)) | 2461 | if (IS_ERR(prog)) |
| @@ -2402,36 +2463,62 @@ static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog, | |||
| 2402 | } | 2463 | } |
| 2403 | 2464 | ||
| 2404 | /* Make sure NAPI is not using any XDP TX queues for RX. */ | 2465 | /* Make sure NAPI is not using any XDP TX queues for RX. */ |
| 2405 | if (netif_running(dev)) | 2466 | if (netif_running(dev)) { |
| 2406 | for (i = 0; i < vi->max_queue_pairs; i++) | 2467 | for (i = 0; i < vi->max_queue_pairs; i++) { |
| 2407 | napi_disable(&vi->rq[i].napi); | 2468 | napi_disable(&vi->rq[i].napi); |
| 2469 | virtnet_napi_tx_disable(&vi->sq[i].napi); | ||
| 2470 | } | ||
| 2471 | } | ||
| 2472 | |||
| 2473 | if (!prog) { | ||
| 2474 | for (i = 0; i < vi->max_queue_pairs; i++) { | ||
| 2475 | rcu_assign_pointer(vi->rq[i].xdp_prog, prog); | ||
| 2476 | if (i == 0) | ||
| 2477 | virtnet_restore_guest_offloads(vi); | ||
| 2478 | } | ||
| 2479 | synchronize_net(); | ||
| 2480 | } | ||
| 2408 | 2481 | ||
| 2409 | netif_set_real_num_rx_queues(dev, curr_qp + xdp_qp); | ||
| 2410 | err = _virtnet_set_queues(vi, curr_qp + xdp_qp); | 2482 | err = _virtnet_set_queues(vi, curr_qp + xdp_qp); |
| 2411 | if (err) | 2483 | if (err) |
| 2412 | goto err; | 2484 | goto err; |
| 2485 | netif_set_real_num_rx_queues(dev, curr_qp + xdp_qp); | ||
| 2413 | vi->xdp_queue_pairs = xdp_qp; | 2486 | vi->xdp_queue_pairs = xdp_qp; |
| 2414 | 2487 | ||
| 2415 | for (i = 0; i < vi->max_queue_pairs; i++) { | 2488 | if (prog) { |
| 2416 | old_prog = rtnl_dereference(vi->rq[i].xdp_prog); | 2489 | for (i = 0; i < vi->max_queue_pairs; i++) { |
| 2417 | rcu_assign_pointer(vi->rq[i].xdp_prog, prog); | 2490 | rcu_assign_pointer(vi->rq[i].xdp_prog, prog); |
| 2418 | if (i == 0) { | 2491 | if (i == 0 && !old_prog) |
| 2419 | if (!old_prog) | ||
| 2420 | virtnet_clear_guest_offloads(vi); | 2492 | virtnet_clear_guest_offloads(vi); |
| 2421 | if (!prog) | ||
| 2422 | virtnet_restore_guest_offloads(vi); | ||
| 2423 | } | 2493 | } |
| 2494 | } | ||
| 2495 | |||
| 2496 | for (i = 0; i < vi->max_queue_pairs; i++) { | ||
| 2424 | if (old_prog) | 2497 | if (old_prog) |
| 2425 | bpf_prog_put(old_prog); | 2498 | bpf_prog_put(old_prog); |
| 2426 | if (netif_running(dev)) | 2499 | if (netif_running(dev)) { |
| 2427 | virtnet_napi_enable(vi->rq[i].vq, &vi->rq[i].napi); | 2500 | virtnet_napi_enable(vi->rq[i].vq, &vi->rq[i].napi); |
| 2501 | virtnet_napi_tx_enable(vi, vi->sq[i].vq, | ||
| 2502 | &vi->sq[i].napi); | ||
| 2503 | } | ||
| 2428 | } | 2504 | } |
| 2429 | 2505 | ||
| 2430 | return 0; | 2506 | return 0; |
| 2431 | 2507 | ||
| 2432 | err: | 2508 | err: |
| 2433 | for (i = 0; i < vi->max_queue_pairs; i++) | 2509 | if (!prog) { |
| 2434 | virtnet_napi_enable(vi->rq[i].vq, &vi->rq[i].napi); | 2510 | virtnet_clear_guest_offloads(vi); |
| 2511 | for (i = 0; i < vi->max_queue_pairs; i++) | ||
| 2512 | rcu_assign_pointer(vi->rq[i].xdp_prog, old_prog); | ||
| 2513 | } | ||
| 2514 | |||
| 2515 | if (netif_running(dev)) { | ||
| 2516 | for (i = 0; i < vi->max_queue_pairs; i++) { | ||
| 2517 | virtnet_napi_enable(vi->rq[i].vq, &vi->rq[i].napi); | ||
| 2518 | virtnet_napi_tx_enable(vi, vi->sq[i].vq, | ||
| 2519 | &vi->sq[i].napi); | ||
| 2520 | } | ||
| 2521 | } | ||
| 2435 | if (prog) | 2522 | if (prog) |
| 2436 | bpf_prog_sub(prog, vi->max_queue_pairs - 1); | 2523 | bpf_prog_sub(prog, vi->max_queue_pairs - 1); |
| 2437 | return err; | 2524 | return err; |
| @@ -2613,16 +2700,6 @@ static void free_receive_page_frags(struct virtnet_info *vi) | |||
| 2613 | put_page(vi->rq[i].alloc_frag.page); | 2700 | put_page(vi->rq[i].alloc_frag.page); |
| 2614 | } | 2701 | } |
| 2615 | 2702 | ||
| 2616 | static bool is_xdp_raw_buffer_queue(struct virtnet_info *vi, int q) | ||
| 2617 | { | ||
| 2618 | if (q < (vi->curr_queue_pairs - vi->xdp_queue_pairs)) | ||
| 2619 | return false; | ||
| 2620 | else if (q < vi->curr_queue_pairs) | ||
| 2621 | return true; | ||
| 2622 | else | ||
| 2623 | return false; | ||
| 2624 | } | ||
| 2625 | |||
| 2626 | static void free_unused_bufs(struct virtnet_info *vi) | 2703 | static void free_unused_bufs(struct virtnet_info *vi) |
| 2627 | { | 2704 | { |
| 2628 | void *buf; | 2705 | void *buf; |
| @@ -2631,10 +2708,10 @@ static void free_unused_bufs(struct virtnet_info *vi) | |||
| 2631 | for (i = 0; i < vi->max_queue_pairs; i++) { | 2708 | for (i = 0; i < vi->max_queue_pairs; i++) { |
| 2632 | struct virtqueue *vq = vi->sq[i].vq; | 2709 | struct virtqueue *vq = vi->sq[i].vq; |
| 2633 | while ((buf = virtqueue_detach_unused_buf(vq)) != NULL) { | 2710 | while ((buf = virtqueue_detach_unused_buf(vq)) != NULL) { |
| 2634 | if (!is_xdp_raw_buffer_queue(vi, i)) | 2711 | if (!is_xdp_frame(buf)) |
| 2635 | dev_kfree_skb(buf); | 2712 | dev_kfree_skb(buf); |
| 2636 | else | 2713 | else |
| 2637 | put_page(virt_to_head_page(buf)); | 2714 | xdp_return_frame(ptr_to_xdp(buf)); |
| 2638 | } | 2715 | } |
| 2639 | } | 2716 | } |
| 2640 | 2717 | ||
diff --git a/drivers/net/wan/dscc4.c b/drivers/net/wan/dscc4.c index c0b0f525c87c..27decf8ae840 100644 --- a/drivers/net/wan/dscc4.c +++ b/drivers/net/wan/dscc4.c | |||
| @@ -1575,7 +1575,7 @@ try: | |||
| 1575 | dev->stats.tx_packets++; | 1575 | dev->stats.tx_packets++; |
| 1576 | dev->stats.tx_bytes += skb->len; | 1576 | dev->stats.tx_bytes += skb->len; |
| 1577 | } | 1577 | } |
| 1578 | dev_kfree_skb_irq(skb); | 1578 | dev_consume_skb_irq(skb); |
| 1579 | dpriv->tx_skbuff[cur] = NULL; | 1579 | dpriv->tx_skbuff[cur] = NULL; |
| 1580 | ++dpriv->tx_dirty; | 1580 | ++dpriv->tx_dirty; |
| 1581 | } else { | 1581 | } else { |
diff --git a/drivers/net/wan/fsl_ucc_hdlc.c b/drivers/net/wan/fsl_ucc_hdlc.c index 66d889d54e58..a08f04c3f644 100644 --- a/drivers/net/wan/fsl_ucc_hdlc.c +++ b/drivers/net/wan/fsl_ucc_hdlc.c | |||
| @@ -482,7 +482,7 @@ static int hdlc_tx_done(struct ucc_hdlc_private *priv) | |||
| 482 | memset(priv->tx_buffer + | 482 | memset(priv->tx_buffer + |
| 483 | (be32_to_cpu(bd->buf) - priv->dma_tx_addr), | 483 | (be32_to_cpu(bd->buf) - priv->dma_tx_addr), |
| 484 | 0, skb->len); | 484 | 0, skb->len); |
| 485 | dev_kfree_skb_irq(skb); | 485 | dev_consume_skb_irq(skb); |
| 486 | 486 | ||
| 487 | priv->tx_skbuff[priv->skb_dirtytx] = NULL; | 487 | priv->tx_skbuff[priv->skb_dirtytx] = NULL; |
| 488 | priv->skb_dirtytx = | 488 | priv->skb_dirtytx = |
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index 399b501f3c3c..e8891f5fc83a 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c | |||
| @@ -548,7 +548,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { | |||
| 548 | { | 548 | { |
| 549 | .id = WCN3990_HW_1_0_DEV_VERSION, | 549 | .id = WCN3990_HW_1_0_DEV_VERSION, |
| 550 | .dev_id = 0, | 550 | .dev_id = 0, |
| 551 | .bus = ATH10K_BUS_PCI, | 551 | .bus = ATH10K_BUS_SNOC, |
| 552 | .name = "wcn3990 hw1.0", | 552 | .name = "wcn3990 hw1.0", |
| 553 | .continuous_frag_desc = true, | 553 | .continuous_frag_desc = true, |
| 554 | .tx_chain_mask = 0x7, | 554 | .tx_chain_mask = 0x7, |
diff --git a/drivers/net/wireless/intel/iwlwifi/Kconfig b/drivers/net/wireless/intel/iwlwifi/Kconfig index 491ca3c8b43c..83d5bceea08f 100644 --- a/drivers/net/wireless/intel/iwlwifi/Kconfig +++ b/drivers/net/wireless/intel/iwlwifi/Kconfig | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | config IWLWIFI | 1 | config IWLWIFI |
| 2 | tristate "Intel Wireless WiFi Next Gen AGN - Wireless-N/Advanced-N/Ultimate-N (iwlwifi) " | 2 | tristate "Intel Wireless WiFi Next Gen AGN - Wireless-N/Advanced-N/Ultimate-N (iwlwifi) " |
| 3 | depends on PCI && HAS_IOMEM | 3 | depends on PCI && HAS_IOMEM && CFG80211 |
| 4 | select FW_LOADER | 4 | select FW_LOADER |
| 5 | ---help--- | 5 | ---help--- |
| 6 | Select to build the driver supporting the: | 6 | Select to build the driver supporting the: |
| @@ -47,6 +47,7 @@ if IWLWIFI | |||
| 47 | config IWLWIFI_LEDS | 47 | config IWLWIFI_LEDS |
| 48 | bool | 48 | bool |
| 49 | depends on LEDS_CLASS=y || LEDS_CLASS=IWLWIFI | 49 | depends on LEDS_CLASS=y || LEDS_CLASS=IWLWIFI |
| 50 | depends on IWLMVM || IWLDVM | ||
| 50 | select LEDS_TRIGGERS | 51 | select LEDS_TRIGGERS |
| 51 | select MAC80211_LEDS | 52 | select MAC80211_LEDS |
| 52 | default y | 53 | default y |
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c b/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c index 497e762978cc..b2cabce1d74d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c | |||
| @@ -212,24 +212,24 @@ void mt76x0_get_tx_power_per_rate(struct mt76x02_dev *dev) | |||
| 212 | mt76x02_add_rate_power_offset(t, delta); | 212 | mt76x02_add_rate_power_offset(t, delta); |
| 213 | } | 213 | } |
| 214 | 214 | ||
| 215 | void mt76x0_get_power_info(struct mt76x02_dev *dev, u8 *info) | 215 | void mt76x0_get_power_info(struct mt76x02_dev *dev, s8 *tp) |
| 216 | { | 216 | { |
| 217 | struct mt76x0_chan_map { | 217 | struct mt76x0_chan_map { |
| 218 | u8 chan; | 218 | u8 chan; |
| 219 | u8 offset; | 219 | u8 offset; |
| 220 | } chan_map[] = { | 220 | } chan_map[] = { |
| 221 | { 2, 0 }, { 4, 1 }, { 6, 2 }, { 8, 3 }, | 221 | { 2, 0 }, { 4, 2 }, { 6, 4 }, { 8, 6 }, |
| 222 | { 10, 4 }, { 12, 5 }, { 14, 6 }, { 38, 0 }, | 222 | { 10, 8 }, { 12, 10 }, { 14, 12 }, { 38, 0 }, |
| 223 | { 44, 1 }, { 48, 2 }, { 54, 3 }, { 60, 4 }, | 223 | { 44, 2 }, { 48, 4 }, { 54, 6 }, { 60, 8 }, |
| 224 | { 64, 5 }, { 102, 6 }, { 108, 7 }, { 112, 8 }, | 224 | { 64, 10 }, { 102, 12 }, { 108, 14 }, { 112, 16 }, |
| 225 | { 118, 9 }, { 124, 10 }, { 128, 11 }, { 134, 12 }, | 225 | { 118, 18 }, { 124, 20 }, { 128, 22 }, { 134, 24 }, |
| 226 | { 140, 13 }, { 151, 14 }, { 157, 15 }, { 161, 16 }, | 226 | { 140, 26 }, { 151, 28 }, { 157, 30 }, { 161, 32 }, |
| 227 | { 167, 17 }, { 171, 18 }, { 173, 19 }, | 227 | { 167, 34 }, { 171, 36 }, { 175, 38 }, |
| 228 | }; | 228 | }; |
| 229 | struct ieee80211_channel *chan = dev->mt76.chandef.chan; | 229 | struct ieee80211_channel *chan = dev->mt76.chandef.chan; |
| 230 | u8 offset, addr; | 230 | u8 offset, addr; |
| 231 | int i, idx = 0; | ||
| 231 | u16 data; | 232 | u16 data; |
| 232 | int i; | ||
| 233 | 233 | ||
| 234 | if (mt76x0_tssi_enabled(dev)) { | 234 | if (mt76x0_tssi_enabled(dev)) { |
| 235 | s8 target_power; | 235 | s8 target_power; |
| @@ -239,14 +239,14 @@ void mt76x0_get_power_info(struct mt76x02_dev *dev, u8 *info) | |||
| 239 | else | 239 | else |
| 240 | data = mt76x02_eeprom_get(dev, MT_EE_2G_TARGET_POWER); | 240 | data = mt76x02_eeprom_get(dev, MT_EE_2G_TARGET_POWER); |
| 241 | target_power = (data & 0xff) - dev->mt76.rate_power.ofdm[7]; | 241 | target_power = (data & 0xff) - dev->mt76.rate_power.ofdm[7]; |
| 242 | info[0] = target_power + mt76x0_get_delta(dev); | 242 | *tp = target_power + mt76x0_get_delta(dev); |
| 243 | info[1] = 0; | ||
| 244 | 243 | ||
| 245 | return; | 244 | return; |
| 246 | } | 245 | } |
| 247 | 246 | ||
| 248 | for (i = 0; i < ARRAY_SIZE(chan_map); i++) { | 247 | for (i = 0; i < ARRAY_SIZE(chan_map); i++) { |
| 249 | if (chan_map[i].chan <= chan->hw_value) { | 248 | if (chan->hw_value <= chan_map[i].chan) { |
| 249 | idx = (chan->hw_value == chan_map[i].chan); | ||
| 250 | offset = chan_map[i].offset; | 250 | offset = chan_map[i].offset; |
| 251 | break; | 251 | break; |
| 252 | } | 252 | } |
| @@ -258,13 +258,16 @@ void mt76x0_get_power_info(struct mt76x02_dev *dev, u8 *info) | |||
| 258 | addr = MT_EE_TX_POWER_DELTA_BW80 + offset; | 258 | addr = MT_EE_TX_POWER_DELTA_BW80 + offset; |
| 259 | } else { | 259 | } else { |
| 260 | switch (chan->hw_value) { | 260 | switch (chan->hw_value) { |
| 261 | case 42: | ||
| 262 | offset = 2; | ||
| 263 | break; | ||
| 261 | case 58: | 264 | case 58: |
| 262 | offset = 8; | 265 | offset = 8; |
| 263 | break; | 266 | break; |
| 264 | case 106: | 267 | case 106: |
| 265 | offset = 14; | 268 | offset = 14; |
| 266 | break; | 269 | break; |
| 267 | case 112: | 270 | case 122: |
| 268 | offset = 20; | 271 | offset = 20; |
| 269 | break; | 272 | break; |
| 270 | case 155: | 273 | case 155: |
| @@ -277,14 +280,9 @@ void mt76x0_get_power_info(struct mt76x02_dev *dev, u8 *info) | |||
| 277 | } | 280 | } |
| 278 | 281 | ||
| 279 | data = mt76x02_eeprom_get(dev, addr); | 282 | data = mt76x02_eeprom_get(dev, addr); |
| 280 | 283 | *tp = data >> (8 * idx); | |
| 281 | info[0] = data; | 284 | if (*tp < 0 || *tp > 0x3f) |
| 282 | if (!info[0] || info[0] > 0x3f) | 285 | *tp = 5; |
| 283 | info[0] = 5; | ||
| 284 | |||
| 285 | info[1] = data >> 8; | ||
| 286 | if (!info[1] || info[1] > 0x3f) | ||
| 287 | info[1] = 5; | ||
| 288 | } | 286 | } |
| 289 | 287 | ||
| 290 | static int mt76x0_check_eeprom(struct mt76x02_dev *dev) | 288 | static int mt76x0_check_eeprom(struct mt76x02_dev *dev) |
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.h b/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.h index ee9ade9f3c8b..42b259f90b6d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.h +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.h | |||
| @@ -26,7 +26,7 @@ struct mt76x02_dev; | |||
| 26 | int mt76x0_eeprom_init(struct mt76x02_dev *dev); | 26 | int mt76x0_eeprom_init(struct mt76x02_dev *dev); |
| 27 | void mt76x0_read_rx_gain(struct mt76x02_dev *dev); | 27 | void mt76x0_read_rx_gain(struct mt76x02_dev *dev); |
| 28 | void mt76x0_get_tx_power_per_rate(struct mt76x02_dev *dev); | 28 | void mt76x0_get_tx_power_per_rate(struct mt76x02_dev *dev); |
| 29 | void mt76x0_get_power_info(struct mt76x02_dev *dev, u8 *info); | 29 | void mt76x0_get_power_info(struct mt76x02_dev *dev, s8 *tp); |
| 30 | 30 | ||
| 31 | static inline s8 s6_to_s8(u32 val) | 31 | static inline s8 s6_to_s8(u32 val) |
| 32 | { | 32 | { |
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c index 1eb1a802ed20..b6166703ad76 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c | |||
| @@ -845,17 +845,17 @@ static void mt76x0_phy_tssi_calibrate(struct mt76x02_dev *dev) | |||
| 845 | void mt76x0_phy_set_txpower(struct mt76x02_dev *dev) | 845 | void mt76x0_phy_set_txpower(struct mt76x02_dev *dev) |
| 846 | { | 846 | { |
| 847 | struct mt76_rate_power *t = &dev->mt76.rate_power; | 847 | struct mt76_rate_power *t = &dev->mt76.rate_power; |
| 848 | u8 info[2]; | 848 | s8 info; |
| 849 | 849 | ||
| 850 | mt76x0_get_tx_power_per_rate(dev); | 850 | mt76x0_get_tx_power_per_rate(dev); |
| 851 | mt76x0_get_power_info(dev, info); | 851 | mt76x0_get_power_info(dev, &info); |
| 852 | 852 | ||
| 853 | mt76x02_add_rate_power_offset(t, info[0]); | 853 | mt76x02_add_rate_power_offset(t, info); |
| 854 | mt76x02_limit_rate_power(t, dev->mt76.txpower_conf); | 854 | mt76x02_limit_rate_power(t, dev->mt76.txpower_conf); |
| 855 | dev->mt76.txpower_cur = mt76x02_get_max_rate_power(t); | 855 | dev->mt76.txpower_cur = mt76x02_get_max_rate_power(t); |
| 856 | mt76x02_add_rate_power_offset(t, -info[0]); | 856 | mt76x02_add_rate_power_offset(t, -info); |
| 857 | 857 | ||
| 858 | mt76x02_phy_set_txpower(dev, info[0], info[1]); | 858 | mt76x02_phy_set_txpower(dev, info, info); |
| 859 | } | 859 | } |
| 860 | 860 | ||
| 861 | void mt76x0_phy_calibrate(struct mt76x02_dev *dev, bool power_on) | 861 | void mt76x0_phy_calibrate(struct mt76x02_dev *dev, bool power_on) |
diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c index bd10165d7eec..4d4b07701149 100644 --- a/drivers/net/wireless/ti/wlcore/sdio.c +++ b/drivers/net/wireless/ti/wlcore/sdio.c | |||
| @@ -164,6 +164,12 @@ static int wl12xx_sdio_power_on(struct wl12xx_sdio_glue *glue) | |||
| 164 | } | 164 | } |
| 165 | 165 | ||
| 166 | sdio_claim_host(func); | 166 | sdio_claim_host(func); |
| 167 | /* | ||
| 168 | * To guarantee that the SDIO card is power cycled, as required to make | ||
| 169 | * the FW programming to succeed, let's do a brute force HW reset. | ||
| 170 | */ | ||
| 171 | mmc_hw_reset(card->host); | ||
| 172 | |||
| 167 | sdio_enable_func(func); | 173 | sdio_enable_func(func); |
| 168 | sdio_release_host(func); | 174 | sdio_release_host(func); |
| 169 | 175 | ||
| @@ -174,20 +180,13 @@ static int wl12xx_sdio_power_off(struct wl12xx_sdio_glue *glue) | |||
| 174 | { | 180 | { |
| 175 | struct sdio_func *func = dev_to_sdio_func(glue->dev); | 181 | struct sdio_func *func = dev_to_sdio_func(glue->dev); |
| 176 | struct mmc_card *card = func->card; | 182 | struct mmc_card *card = func->card; |
| 177 | int error; | ||
| 178 | 183 | ||
| 179 | sdio_claim_host(func); | 184 | sdio_claim_host(func); |
| 180 | sdio_disable_func(func); | 185 | sdio_disable_func(func); |
| 181 | sdio_release_host(func); | 186 | sdio_release_host(func); |
| 182 | 187 | ||
| 183 | /* Let runtime PM know the card is powered off */ | 188 | /* Let runtime PM know the card is powered off */ |
| 184 | error = pm_runtime_put(&card->dev); | 189 | pm_runtime_put(&card->dev); |
| 185 | if (error < 0 && error != -EBUSY) { | ||
| 186 | dev_err(&card->dev, "%s failed: %i\n", __func__, error); | ||
| 187 | |||
| 188 | return error; | ||
| 189 | } | ||
| 190 | |||
| 191 | return 0; | 190 | return 0; |
| 192 | } | 191 | } |
| 193 | 192 | ||
