Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

Pull networking fixes from David Miller:
"Yeah I should have sent a pull request last week, so there is a lot
more here than usual:

1) Fix memory leak in ebtables compat code, from Wenwen Wang.

2) Several kTLS bug fixes from Jakub Kicinski (circular close on
disconnect etc.)

3) Force slave speed check on link state recovery in bonding 802.3ad
mode, from Thomas Falcon.

4) Clear RX descriptor bits before assigning buffers to them in
stmmac, from Jose Abreu.

5) Several missing of_node_put() calls, mostly wrt. for_each_*() OF
loops, from Nishka Dasgupta.

6) Double kfree_skb() in peak_usb can driver, from Stephane Grosjean.

7) Need to hold sock across skb->destructor invocation, from Cong
Wang.

8) IP header length needs to be validated in ipip tunnel xmit, from
Haishuang Yan.

9) Use after free in ip6 tunnel driver, also from Haishuang Yan.

10) Do not use MSI interrupts on r8169 chips before RTL8168d, from
Heiner Kallweit.

11) Upon bridge device init failure, we need to delete the local fdb.
From Nikolay Aleksandrov.

12) Handle erros from of_get_mac_address() properly in stmmac, from
Martin Blumenstingl.

13) Handle concurrent rename vs. dump in netfilter ipset, from Jozsef
Kadlecsik.

14) Setting NETIF_F_LLTX on mac80211 causes complete breakage with
some devices, so revert. From Johannes Berg.

15) Fix deadlock in rxrpc, from David Howells.

16) Fix Kconfig deps of enetc driver, we must have PHYLIB. From Yue
Haibing.

17) Fix mvpp2 crash on module removal, from Matteo Croce.

18) Fix race in genphy_update_link, from Heiner Kallweit.

19) bpf_xdp_adjust_head() stopped working with generic XDP when we
fixes generic XDP to support stacked devices properly, fix from
Jesper Dangaard Brouer.

20) Unbalanced RCU locking in rt6_update_exception_stamp_rt(), from
David Ahern.

21) Several memory leaks in new sja1105 driver, from Vladimir Oltean"

* git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (214 commits)
net: dsa: sja1105: Fix memory leak on meta state machine error path
net: dsa: sja1105: Fix memory leak on meta state machine normal path
net: dsa: sja1105: Really fix panic on unregistering PTP clock
net: dsa: sja1105: Use the LOCKEDS bit for SJA1105 E/T as well
net: dsa: sja1105: Fix broken learning with vlan_filtering disabled
net: dsa: qca8k: Add of_node_put() in qca8k_setup_mdio_bus()
net: sched: sample: allow accessing psample_group with rtnl
net: sched: police: allow accessing police->params with rtnl
net: hisilicon: Fix dma_map_single failed on arm64
net: hisilicon: fix hip04-xmit never return TX_BUSY
net: hisilicon: make hip04_tx_reclaim non-reentrant
tc-testing: updated vlan action tests with batch create/delete
net sched: update vlan action for batched events operations
net: stmmac: tc: Do not return a fragment entry
net: stmmac: Fix issues when number of Queues >= 4
net: stmmac: xgmac: Fix XGMAC selftests
be2net: disable bh with spin_lock in be_process_mcc
net: cxgb3_main: Fix a resource leak in a error path in 'init_one()'
net: ethernet: sun4i-emac: Support phy-handle property for finding PHYs
net: bridge: move default pvid init/deinit to NETDEV_REGISTER/UNREGISTER
...

+2403 -1275
+17 -6
Documentation/networking/tls-offload.rst
··· 424 424 Following minimum set of TLS-related statistics should be reported 425 425 by the driver: 426 426 427 - * ``rx_tls_decrypted`` - number of successfully decrypted TLS segments 428 - * ``tx_tls_encrypted`` - number of in-order TLS segments passed to device 429 - for encryption 427 + * ``rx_tls_decrypted_packets`` - number of successfully decrypted RX packets 428 + which were part of a TLS stream. 429 + * ``rx_tls_decrypted_bytes`` - number of TLS payload bytes in RX packets 430 + which were successfully decrypted. 431 + * ``tx_tls_encrypted_packets`` - number of TX packets passed to the device 432 + for encryption of their TLS payload. 433 + * ``tx_tls_encrypted_bytes`` - number of TLS payload bytes in TX packets 434 + passed to the device for encryption. 435 + * ``tx_tls_ctx`` - number of TLS TX HW offload contexts added to device for 436 + encryption. 430 437 * ``tx_tls_ooo`` - number of TX packets which were part of a TLS stream 431 - but did not arrive in the expected order 432 - * ``tx_tls_drop_no_sync_data`` - number of TX packets dropped because 433 - they arrived out of order and associated record could not be found 438 + but did not arrive in the expected order. 439 + * ``tx_tls_drop_no_sync_data`` - number of TX packets which were part of 440 + a TLS stream dropped, because they arrived out of order and associated 441 + record could not be found. 442 + * ``tx_tls_drop_bypass_req`` - number of TX packets which were part of a TLS 443 + stream dropped, because they contain both data that has been encrypted by 444 + software and data that expects hardware crypto offload. 434 445 435 446 Notable corner cases, exceptions and additional requirements 436 447 ============================================================
+2 -8
MAINTAINERS
··· 6827 6827 F: fs/gfs2/ 6828 6828 F: include/uapi/linux/gfs2_ondisk.h 6829 6829 6830 - GIGASET ISDN DRIVERS 6831 - M: Paul Bolle <pebolle@tiscali.nl> 6832 - L: gigaset307x-common@lists.sourceforge.net 6833 - W: http://gigaset307x.sourceforge.net/ 6834 - S: Odd Fixes 6835 - F: drivers/staging/isdn/gigaset/ 6836 - 6837 6830 GNSS SUBSYSTEM 6838 6831 M: Johan Hovold <johan@kernel.org> 6839 6832 T: git git://git.kernel.org/pub/scm/linux/kernel/git/johan/gnss.git ··· 11142 11149 S: Maintained 11143 11150 W: https://fedorahosted.org/dropwatch/ 11144 11151 F: net/core/drop_monitor.c 11152 + F: include/uapi/linux/net_dropmon.h 11145 11153 11146 11154 NETWORKING DRIVERS 11147 11155 M: "David S. Miller" <davem@davemloft.net> ··· 11281 11287 M: Dave Watson <davejwatson@fb.com> 11282 11288 M: John Fastabend <john.fastabend@gmail.com> 11283 11289 M: Daniel Borkmann <daniel@iogearbox.net> 11290 + M: Jakub Kicinski <jakub.kicinski@netronome.com> 11284 11291 L: netdev@vger.kernel.org 11285 11292 S: Maintained 11286 11293 F: net/tls/* ··· 17560 17565 M: Jesper Dangaard Brouer <hawk@kernel.org> 17561 17566 M: John Fastabend <john.fastabend@gmail.com> 17562 17567 L: netdev@vger.kernel.org 17563 - L: xdp-newbies@vger.kernel.org 17564 17568 L: bpf@vger.kernel.org 17565 17569 S: Supported 17566 17570 F: net/core/xdp.c
+6 -2
drivers/atm/iphase.c
··· 63 63 #include <asm/byteorder.h> 64 64 #include <linux/vmalloc.h> 65 65 #include <linux/jiffies.h> 66 + #include <linux/nospec.h> 66 67 #include "iphase.h" 67 68 #include "suni.h" 68 69 #define swap_byte_order(x) (((x & 0xff) << 8) | ((x & 0xff00) >> 8)) ··· 2761 2760 } 2762 2761 if (copy_from_user(&ia_cmds, arg, sizeof ia_cmds)) return -EFAULT; 2763 2762 board = ia_cmds.status; 2764 - if ((board < 0) || (board > iadev_count)) 2765 - board = 0; 2763 + 2764 + if ((board < 0) || (board > iadev_count)) 2765 + board = 0; 2766 + board = array_index_nospec(board, iadev_count + 1); 2767 + 2766 2768 iadev = ia_dev[board]; 2767 2769 switch (ia_cmds.cmd) { 2768 2770 case MEMDUMP:
+12 -1
drivers/isdn/hardware/mISDN/hfcsusb.c
··· 1394 1394 printk(KERN_DEBUG 1395 1395 "%s: %s: alloc urb for fifo %i failed", 1396 1396 hw->name, __func__, fifo->fifonum); 1397 + continue; 1397 1398 } 1398 1399 fifo->iso[i].owner_fifo = (struct usb_fifo *) fifo; 1399 1400 fifo->iso[i].indx = i; ··· 1693 1692 static int 1694 1693 setup_hfcsusb(struct hfcsusb *hw) 1695 1694 { 1695 + void *dmabuf = kmalloc(sizeof(u_char), GFP_KERNEL); 1696 1696 u_char b; 1697 + int ret; 1697 1698 1698 1699 if (debug & DBG_HFC_CALL_TRACE) 1699 1700 printk(KERN_DEBUG "%s: %s\n", hw->name, __func__); 1700 1701 1702 + if (!dmabuf) 1703 + return -ENOMEM; 1704 + 1705 + ret = read_reg_atomic(hw, HFCUSB_CHIP_ID, dmabuf); 1706 + 1707 + memcpy(&b, dmabuf, sizeof(u_char)); 1708 + kfree(dmabuf); 1709 + 1701 1710 /* check the chip id */ 1702 - if (read_reg_atomic(hw, HFCUSB_CHIP_ID, &b) != 1) { 1711 + if (ret != 1) { 1703 1712 printk(KERN_DEBUG "%s: %s: cannot read chip id\n", 1704 1713 hw->name, __func__); 1705 1714 return 1;
+3
drivers/net/arcnet/arc-rimi.c
··· 363 363 switch (ints[0]) { 364 364 default: /* ERROR */ 365 365 pr_err("Too many arguments\n"); 366 + /* Fall through */ 366 367 case 3: /* Node ID */ 367 368 node = ints[3]; 369 + /* Fall through */ 368 370 case 2: /* IRQ */ 369 371 irq = ints[2]; 372 + /* Fall through */ 370 373 case 1: /* IO address */ 371 374 io = ints[1]; 372 375 }
+6
drivers/net/arcnet/com20020-isa.c
··· 197 197 switch (ints[0]) { 198 198 default: /* ERROR */ 199 199 pr_info("Too many arguments\n"); 200 + /* Fall through */ 200 201 case 6: /* Timeout */ 201 202 timeout = ints[6]; 203 + /* Fall through */ 202 204 case 5: /* CKP value */ 203 205 clockp = ints[5]; 206 + /* Fall through */ 204 207 case 4: /* Backplane flag */ 205 208 backplane = ints[4]; 209 + /* Fall through */ 206 210 case 3: /* Node ID */ 207 211 node = ints[3]; 212 + /* Fall through */ 208 213 case 2: /* IRQ */ 209 214 irq = ints[2]; 215 + /* Fall through */ 210 216 case 1: /* IO address */ 211 217 io = ints[1]; 212 218 }
+2
drivers/net/arcnet/com90io.c
··· 363 363 switch (ints[0]) { 364 364 default: /* ERROR */ 365 365 pr_err("Too many arguments\n"); 366 + /* Fall through */ 366 367 case 2: /* IRQ */ 367 368 irq = ints[2]; 369 + /* Fall through */ 368 370 case 1: /* IO address */ 369 371 io = ints[1]; 370 372 }
+3
drivers/net/arcnet/com90xx.c
··· 693 693 switch (ints[0]) { 694 694 default: /* ERROR */ 695 695 pr_err("Too many arguments\n"); 696 + /* Fall through */ 696 697 case 3: /* Mem address */ 697 698 shmem = ints[3]; 699 + /* Fall through */ 698 700 case 2: /* IRQ */ 699 701 irq = ints[2]; 702 + /* Fall through */ 700 703 case 1: /* IO address */ 701 704 io = ints[1]; 702 705 }
+9
drivers/net/bonding/bond_main.c
··· 2196 2196 bond_for_each_slave(bond, slave, iter) { 2197 2197 switch (slave->new_link) { 2198 2198 case BOND_LINK_NOCHANGE: 2199 + /* For 802.3ad mode, check current slave speed and 2200 + * duplex again in case its port was disabled after 2201 + * invalid speed/duplex reporting but recovered before 2202 + * link monitoring could make a decision on the actual 2203 + * link status 2204 + */ 2205 + if (BOND_MODE(bond) == BOND_MODE_8023AD && 2206 + slave->link == BOND_LINK_UP) 2207 + bond_3ad_adapter_speed_duplex_changed(slave); 2199 2208 continue; 2200 2209 2201 2210 case BOND_LINK_UP:
+2
drivers/net/can/dev.c
··· 1249 1249 return -EINVAL; 1250 1250 1251 1251 dev->rtnl_link_ops = &can_link_ops; 1252 + netif_carrier_off(dev); 1253 + 1252 1254 return register_netdev(dev); 1253 1255 } 1254 1256 EXPORT_SYMBOL_GPL(register_candev);
+32 -7
drivers/net/can/flexcan.c
··· 400 400 priv->write(reg_mcr, &regs->mcr); 401 401 } 402 402 403 - static inline void flexcan_enter_stop_mode(struct flexcan_priv *priv) 403 + static inline int flexcan_enter_stop_mode(struct flexcan_priv *priv) 404 404 { 405 405 struct flexcan_regs __iomem *regs = priv->regs; 406 + unsigned int ackval; 406 407 u32 reg_mcr; 407 408 408 409 reg_mcr = priv->read(&regs->mcr); ··· 413 412 /* enable stop request */ 414 413 regmap_update_bits(priv->stm.gpr, priv->stm.req_gpr, 415 414 1 << priv->stm.req_bit, 1 << priv->stm.req_bit); 415 + 416 + /* get stop acknowledgment */ 417 + if (regmap_read_poll_timeout(priv->stm.gpr, priv->stm.ack_gpr, 418 + ackval, ackval & (1 << priv->stm.ack_bit), 419 + 0, FLEXCAN_TIMEOUT_US)) 420 + return -ETIMEDOUT; 421 + 422 + return 0; 416 423 } 417 424 418 - static inline void flexcan_exit_stop_mode(struct flexcan_priv *priv) 425 + static inline int flexcan_exit_stop_mode(struct flexcan_priv *priv) 419 426 { 420 427 struct flexcan_regs __iomem *regs = priv->regs; 428 + unsigned int ackval; 421 429 u32 reg_mcr; 422 430 423 431 /* remove stop request */ 424 432 regmap_update_bits(priv->stm.gpr, priv->stm.req_gpr, 425 433 1 << priv->stm.req_bit, 0); 426 434 435 + /* get stop acknowledgment */ 436 + if (regmap_read_poll_timeout(priv->stm.gpr, priv->stm.ack_gpr, 437 + ackval, !(ackval & (1 << priv->stm.ack_bit)), 438 + 0, FLEXCAN_TIMEOUT_US)) 439 + return -ETIMEDOUT; 440 + 427 441 reg_mcr = priv->read(&regs->mcr); 428 442 reg_mcr &= ~FLEXCAN_MCR_SLF_WAK; 429 443 priv->write(reg_mcr, &regs->mcr); 444 + 445 + return 0; 430 446 } 431 447 432 448 static inline void flexcan_error_irq_enable(const struct flexcan_priv *priv) ··· 1455 1437 1456 1438 priv = netdev_priv(dev); 1457 1439 priv->stm.gpr = syscon_node_to_regmap(gpr_np); 1458 - of_node_put(gpr_np); 1459 1440 if (IS_ERR(priv->stm.gpr)) { 1460 1441 dev_dbg(&pdev->dev, "could not find gpr regmap\n"); 1461 - return PTR_ERR(priv->stm.gpr); 1442 + ret = PTR_ERR(priv->stm.gpr); 1443 + goto out_put_node; 1462 1444 } 1463 1445 1464 1446 priv->stm.req_gpr = out_val[1]; ··· 1473 1455 1474 1456 device_set_wakeup_capable(&pdev->dev, true); 1475 1457 1476 - return 0; 1458 + out_put_node: 1459 + of_node_put(gpr_np); 1460 + return ret; 1477 1461 } 1478 1462 1479 1463 static const struct of_device_id flexcan_of_match[] = { ··· 1632 1612 */ 1633 1613 if (device_may_wakeup(device)) { 1634 1614 enable_irq_wake(dev->irq); 1635 - flexcan_enter_stop_mode(priv); 1615 + err = flexcan_enter_stop_mode(priv); 1616 + if (err) 1617 + return err; 1636 1618 } else { 1637 1619 err = flexcan_chip_disable(priv); 1638 1620 if (err) ··· 1684 1662 { 1685 1663 struct net_device *dev = dev_get_drvdata(device); 1686 1664 struct flexcan_priv *priv = netdev_priv(dev); 1665 + int err; 1687 1666 1688 1667 if (netif_running(dev) && device_may_wakeup(device)) { 1689 1668 flexcan_enable_wakeup_irq(priv, false); 1690 - flexcan_exit_stop_mode(priv); 1669 + err = flexcan_exit_stop_mode(priv); 1670 + if (err) 1671 + return err; 1691 1672 } 1692 1673 1693 1674 return 0;
+5 -4
drivers/net/can/rcar/rcar_canfd.c
··· 1508 1508 1509 1509 /* All packets processed */ 1510 1510 if (num_pkts < quota) { 1511 - napi_complete_done(napi, num_pkts); 1512 - /* Enable Rx FIFO interrupts */ 1513 - rcar_canfd_set_bit(priv->base, RCANFD_RFCC(ridx), 1514 - RCANFD_RFCC_RFIE); 1511 + if (napi_complete_done(napi, num_pkts)) { 1512 + /* Enable Rx FIFO interrupts */ 1513 + rcar_canfd_set_bit(priv->base, RCANFD_RFCC(ridx), 1514 + RCANFD_RFCC_RFIE); 1515 + } 1515 1516 } 1516 1517 return num_pkts; 1517 1518 }
+1 -1
drivers/net/can/sja1000/peak_pcmcia.c
··· 479 479 if (!netdev) 480 480 continue; 481 481 482 - strncpy(name, netdev->name, IFNAMSIZ); 482 + strlcpy(name, netdev->name, IFNAMSIZ); 483 483 484 484 unregister_sja1000dev(netdev); 485 485
+22 -27
drivers/net/can/spi/mcp251x.c
··· 664 664 return regulator_disable(reg); 665 665 } 666 666 667 - static void mcp251x_open_clean(struct net_device *net) 668 - { 669 - struct mcp251x_priv *priv = netdev_priv(net); 670 - struct spi_device *spi = priv->spi; 671 - 672 - free_irq(spi->irq, priv); 673 - mcp251x_hw_sleep(spi); 674 - mcp251x_power_enable(priv->transceiver, 0); 675 - close_candev(net); 676 - } 677 - 678 667 static int mcp251x_stop(struct net_device *net) 679 668 { 680 669 struct mcp251x_priv *priv = netdev_priv(net); ··· 930 941 flags | IRQF_ONESHOT, DEVICE_NAME, priv); 931 942 if (ret) { 932 943 dev_err(&spi->dev, "failed to acquire irq %d\n", spi->irq); 933 - mcp251x_power_enable(priv->transceiver, 0); 934 - close_candev(net); 935 - goto open_unlock; 944 + goto out_close; 936 945 } 937 946 938 947 priv->wq = alloc_workqueue("mcp251x_wq", WQ_FREEZABLE | WQ_MEM_RECLAIM, 939 948 0); 949 + if (!priv->wq) { 950 + ret = -ENOMEM; 951 + goto out_clean; 952 + } 940 953 INIT_WORK(&priv->tx_work, mcp251x_tx_work_handler); 941 954 INIT_WORK(&priv->restart_work, mcp251x_restart_work_handler); 942 955 943 956 ret = mcp251x_hw_reset(spi); 944 - if (ret) { 945 - mcp251x_open_clean(net); 946 - goto open_unlock; 947 - } 957 + if (ret) 958 + goto out_free_wq; 948 959 ret = mcp251x_setup(net, spi); 949 - if (ret) { 950 - mcp251x_open_clean(net); 951 - goto open_unlock; 952 - } 960 + if (ret) 961 + goto out_free_wq; 953 962 ret = mcp251x_set_normal_mode(spi); 954 - if (ret) { 955 - mcp251x_open_clean(net); 956 - goto open_unlock; 957 - } 963 + if (ret) 964 + goto out_free_wq; 958 965 959 966 can_led_event(net, CAN_LED_EVENT_OPEN); 960 967 961 968 netif_wake_queue(net); 969 + mutex_unlock(&priv->mcp_lock); 962 970 963 - open_unlock: 971 + return 0; 972 + 973 + out_free_wq: 974 + destroy_workqueue(priv->wq); 975 + out_clean: 976 + free_irq(spi->irq, priv); 977 + mcp251x_hw_sleep(spi); 978 + out_close: 979 + mcp251x_power_enable(priv->transceiver, 0); 980 + close_candev(net); 964 981 mutex_unlock(&priv->mcp_lock); 965 982 return ret; 966 983 }
+5 -5
drivers/net/can/usb/peak_usb/pcan_usb_core.c
··· 568 568 dev->state &= ~PCAN_USB_STATE_STARTED; 569 569 netif_stop_queue(netdev); 570 570 571 + close_candev(netdev); 572 + 573 + dev->can.state = CAN_STATE_STOPPED; 574 + 571 575 /* unlink all pending urbs and free used memory */ 572 576 peak_usb_unlink_all_urbs(dev); 573 577 574 578 if (dev->adapter->dev_stop) 575 579 dev->adapter->dev_stop(dev); 576 - 577 - close_candev(netdev); 578 - 579 - dev->can.state = CAN_STATE_STOPPED; 580 580 581 581 /* can set bus off now */ 582 582 if (dev->adapter->dev_set_bus) { ··· 855 855 856 856 dev_prev_siblings = dev->prev_siblings; 857 857 dev->state &= ~PCAN_USB_STATE_CONNECTED; 858 - strncpy(name, netdev->name, IFNAMSIZ); 858 + strlcpy(name, netdev->name, IFNAMSIZ); 859 859 860 860 unregister_netdev(netdev); 861 861
+1 -1
drivers/net/can/usb/peak_usb/pcan_usb_fd.c
··· 841 841 goto err_out; 842 842 843 843 /* allocate command buffer once for all for the interface */ 844 - pdev->cmd_buffer_addr = kmalloc(PCAN_UFD_CMD_BUFFER_SIZE, 844 + pdev->cmd_buffer_addr = kzalloc(PCAN_UFD_CMD_BUFFER_SIZE, 845 845 GFP_KERNEL); 846 846 if (!pdev->cmd_buffer_addr) 847 847 goto err_out_1;
+1 -1
drivers/net/can/usb/peak_usb/pcan_usb_pro.c
··· 494 494 u8 *buffer; 495 495 int err; 496 496 497 - buffer = kmalloc(PCAN_USBPRO_FCT_DRVLD_REQ_LEN, GFP_KERNEL); 497 + buffer = kzalloc(PCAN_USBPRO_FCT_DRVLD_REQ_LEN, GFP_KERNEL); 498 498 if (!buffer) 499 499 return -ENOMEM; 500 500
+2 -27
drivers/net/dsa/mv88e6xxx/chip.c
··· 27 27 #include <linux/platform_data/mv88e6xxx.h> 28 28 #include <linux/netdevice.h> 29 29 #include <linux/gpio/consumer.h> 30 - #include <linux/phy.h> 31 30 #include <linux/phylink.h> 32 31 #include <net/dsa.h> 33 32 ··· 429 430 return 0; 430 431 431 432 /* Port's MAC control must not be changed unless the link is down */ 432 - err = chip->info->ops->port_set_link(chip, port, 0); 433 + err = chip->info->ops->port_set_link(chip, port, LINK_FORCED_DOWN); 433 434 if (err) 434 435 return err; 435 436 ··· 479 480 struct mv88e6xxx_chip *chip = ds->priv; 480 481 481 482 return port < chip->info->num_internal_phys; 482 - } 483 - 484 - /* We expect the switch to perform auto negotiation if there is a real 485 - * phy. However, in the case of a fixed link phy, we force the port 486 - * settings from the fixed link settings. 487 - */ 488 - static void mv88e6xxx_adjust_link(struct dsa_switch *ds, int port, 489 - struct phy_device *phydev) 490 - { 491 - struct mv88e6xxx_chip *chip = ds->priv; 492 - int err; 493 - 494 - if (!phy_is_pseudo_fixed_link(phydev) && 495 - mv88e6xxx_phy_is_internal(ds, port)) 496 - return; 497 - 498 - mv88e6xxx_reg_lock(chip); 499 - err = mv88e6xxx_port_setup_mac(chip, port, phydev->link, phydev->speed, 500 - phydev->duplex, phydev->pause, 501 - phydev->interface); 502 - mv88e6xxx_reg_unlock(chip); 503 - 504 - if (err && err != -EOPNOTSUPP) 505 - dev_err(ds->dev, "p%d: failed to configure MAC\n", port); 506 483 } 507 484 508 485 static void mv88e6065_phylink_validate(struct mv88e6xxx_chip *chip, int port, ··· 2696 2721 err = mv88e6xxx_mdio_register(chip, child, true); 2697 2722 if (err) { 2698 2723 mv88e6xxx_mdios_unregister(chip); 2724 + of_node_put(child); 2699 2725 return err; 2700 2726 } 2701 2727 } ··· 4614 4638 static const struct dsa_switch_ops mv88e6xxx_switch_ops = { 4615 4639 .get_tag_protocol = mv88e6xxx_get_tag_protocol, 4616 4640 .setup = mv88e6xxx_setup, 4617 - .adjust_link = mv88e6xxx_adjust_link, 4618 4641 .phylink_validate = mv88e6xxx_validate, 4619 4642 .phylink_mac_link_state = mv88e6xxx_link_state, 4620 4643 .phylink_mac_config = mv88e6xxx_mac_config,
+8 -2
drivers/net/dsa/qca8k.c
··· 2 2 /* 3 3 * Copyright (C) 2009 Felix Fietkau <nbd@nbd.name> 4 4 * Copyright (C) 2011-2012 Gabor Juhos <juhosg@openwrt.org> 5 - * Copyright (c) 2015, The Linux Foundation. All rights reserved. 5 + * Copyright (c) 2015, 2019, The Linux Foundation. All rights reserved. 6 6 * Copyright (c) 2016 John Crispin <john@phrozen.org> 7 7 */ 8 8 ··· 583 583 584 584 for_each_available_child_of_node(ports, port) { 585 585 err = of_property_read_u32(port, "reg", &reg); 586 - if (err) 586 + if (err) { 587 + of_node_put(port); 588 + of_node_put(ports); 587 589 return err; 590 + } 588 591 589 592 if (!dsa_is_user_port(priv->ds, reg)) 590 593 continue; ··· 598 595 internal_mdio_mask |= BIT(reg); 599 596 } 600 597 598 + of_node_put(ports); 601 599 if (!external_mdio_mask && !internal_mdio_mask) { 602 600 dev_err(priv->dev, "no PHYs are defined.\n"); 603 601 return -EINVAL; ··· 938 934 939 935 qca8k_port_set_status(priv, port, 1); 940 936 priv->port_sts[port].enabled = 1; 937 + 938 + phy_support_asym_pause(phy); 941 939 942 940 return 0; 943 941 }
+13 -1
drivers/net/dsa/sja1105/sja1105_dynamic_config.c
··· 277 277 SJA1105ET_SIZE_L2_LOOKUP_ENTRY, op); 278 278 } 279 279 280 + static size_t sja1105et_dyn_l2_lookup_entry_packing(void *buf, void *entry_ptr, 281 + enum packing_op op) 282 + { 283 + struct sja1105_l2_lookup_entry *entry = entry_ptr; 284 + u8 *cmd = buf + SJA1105ET_SIZE_L2_LOOKUP_ENTRY; 285 + const int size = SJA1105_SIZE_DYN_CMD; 286 + 287 + sja1105_packing(cmd, &entry->lockeds, 28, 28, size, op); 288 + 289 + return sja1105et_l2_lookup_entry_packing(buf, entry_ptr, op); 290 + } 291 + 280 292 static void 281 293 sja1105et_mgmt_route_cmd_packing(void *buf, struct sja1105_dyn_cmd *cmd, 282 294 enum packing_op op) ··· 489 477 /* SJA1105E/T: First generation */ 490 478 struct sja1105_dynamic_table_ops sja1105et_dyn_ops[BLK_IDX_MAX_DYN] = { 491 479 [BLK_IDX_L2_LOOKUP] = { 492 - .entry_packing = sja1105et_l2_lookup_entry_packing, 480 + .entry_packing = sja1105et_dyn_l2_lookup_entry_packing, 493 481 .cmd_packing = sja1105et_l2_lookup_cmd_packing, 494 482 .access = (OP_READ | OP_WRITE | OP_DEL), 495 483 .max_entry_count = SJA1105_MAX_L2_LOOKUP_COUNT,
+60 -83
drivers/net/dsa/sja1105/sja1105_main.c
··· 218 218 /* This selects between Independent VLAN Learning (IVL) and 219 219 * Shared VLAN Learning (SVL) 220 220 */ 221 - .shared_learn = false, 221 + .shared_learn = true, 222 222 /* Don't discard management traffic based on ENFPORT - 223 223 * we don't perform SMAC port enforcement anyway, so 224 224 * what we are setting here doesn't matter. ··· 625 625 if (of_property_read_u32(child, "reg", &index) < 0) { 626 626 dev_err(dev, "Port number not defined in device tree " 627 627 "(property \"reg\")\n"); 628 + of_node_put(child); 628 629 return -ENODEV; 629 630 } 630 631 ··· 635 634 dev_err(dev, "Failed to read phy-mode or " 636 635 "phy-interface-type property for port %d\n", 637 636 index); 637 + of_node_put(child); 638 638 return -ENODEV; 639 639 } 640 640 ports[index].phy_mode = phy_mode; ··· 645 643 if (!of_phy_is_fixed_link(child)) { 646 644 dev_err(dev, "phy-handle or fixed-link " 647 645 "properties missing!\n"); 646 + of_node_put(child); 648 647 return -ENODEV; 649 648 } 650 649 /* phy-handle is missing, but fixed-link isn't. ··· 1092 1089 l2_lookup.vlanid = vid; 1093 1090 l2_lookup.iotag = SJA1105_S_TAG; 1094 1091 l2_lookup.mask_macaddr = GENMASK_ULL(ETH_ALEN * 8 - 1, 0); 1095 - l2_lookup.mask_vlanid = VLAN_VID_MASK; 1096 - l2_lookup.mask_iotag = BIT(0); 1092 + if (dsa_port_is_vlan_filtering(&ds->ports[port])) { 1093 + l2_lookup.mask_vlanid = VLAN_VID_MASK; 1094 + l2_lookup.mask_iotag = BIT(0); 1095 + } else { 1096 + l2_lookup.mask_vlanid = 0; 1097 + l2_lookup.mask_iotag = 0; 1098 + } 1097 1099 l2_lookup.destports = BIT(port); 1098 1100 1099 1101 rc = sja1105_dynamic_config_read(priv, BLK_IDX_L2_LOOKUP, ··· 1155 1147 l2_lookup.vlanid = vid; 1156 1148 l2_lookup.iotag = SJA1105_S_TAG; 1157 1149 l2_lookup.mask_macaddr = GENMASK_ULL(ETH_ALEN * 8 - 1, 0); 1158 - l2_lookup.mask_vlanid = VLAN_VID_MASK; 1159 - l2_lookup.mask_iotag = BIT(0); 1150 + if (dsa_port_is_vlan_filtering(&ds->ports[port])) { 1151 + l2_lookup.mask_vlanid = VLAN_VID_MASK; 1152 + l2_lookup.mask_iotag = BIT(0); 1153 + } else { 1154 + l2_lookup.mask_vlanid = 0; 1155 + l2_lookup.mask_iotag = 0; 1156 + } 1160 1157 l2_lookup.destports = BIT(port); 1161 1158 1162 1159 rc = sja1105_dynamic_config_read(priv, BLK_IDX_L2_LOOKUP, ··· 1191 1178 const unsigned char *addr, u16 vid) 1192 1179 { 1193 1180 struct sja1105_private *priv = ds->priv; 1194 - u16 rx_vid, tx_vid; 1195 - int rc, i; 1196 1181 1197 - if (dsa_port_is_vlan_filtering(&ds->ports[port])) 1198 - return priv->info->fdb_add_cmd(ds, port, addr, vid); 1199 - 1200 - /* Since we make use of VLANs even when the bridge core doesn't tell us 1201 - * to, translate these FDB entries into the correct dsa_8021q ones. 1202 - * The basic idea (also repeats for removal below) is: 1203 - * - Each of the other front-panel ports needs to be able to forward a 1204 - * pvid-tagged (aka tagged with their rx_vid) frame that matches this 1205 - * DMAC. 1206 - * - The CPU port (aka the tx_vid of this port) needs to be able to 1207 - * send a frame matching this DMAC to the specified port. 1208 - * For a better picture see net/dsa/tag_8021q.c. 1182 + /* dsa_8021q is in effect when the bridge's vlan_filtering isn't, 1183 + * so the switch still does some VLAN processing internally. 1184 + * But Shared VLAN Learning (SVL) is also active, and it will take 1185 + * care of autonomous forwarding between the unique pvid's of each 1186 + * port. Here we just make sure that users can't add duplicate FDB 1187 + * entries when in this mode - the actual VID doesn't matter except 1188 + * for what gets printed in 'bridge fdb show'. In the case of zero, 1189 + * no VID gets printed at all. 1209 1190 */ 1210 - for (i = 0; i < SJA1105_NUM_PORTS; i++) { 1211 - if (i == port) 1212 - continue; 1213 - if (i == dsa_upstream_port(priv->ds, port)) 1214 - continue; 1191 + if (!dsa_port_is_vlan_filtering(&ds->ports[port])) 1192 + vid = 0; 1215 1193 1216 - rx_vid = dsa_8021q_rx_vid(ds, i); 1217 - rc = priv->info->fdb_add_cmd(ds, port, addr, rx_vid); 1218 - if (rc < 0) 1219 - return rc; 1220 - } 1221 - tx_vid = dsa_8021q_tx_vid(ds, port); 1222 - return priv->info->fdb_add_cmd(ds, port, addr, tx_vid); 1194 + return priv->info->fdb_add_cmd(ds, port, addr, vid); 1223 1195 } 1224 1196 1225 1197 static int sja1105_fdb_del(struct dsa_switch *ds, int port, 1226 1198 const unsigned char *addr, u16 vid) 1227 1199 { 1228 1200 struct sja1105_private *priv = ds->priv; 1229 - u16 rx_vid, tx_vid; 1230 - int rc, i; 1231 1201 1232 - if (dsa_port_is_vlan_filtering(&ds->ports[port])) 1233 - return priv->info->fdb_del_cmd(ds, port, addr, vid); 1202 + if (!dsa_port_is_vlan_filtering(&ds->ports[port])) 1203 + vid = 0; 1234 1204 1235 - for (i = 0; i < SJA1105_NUM_PORTS; i++) { 1236 - if (i == port) 1237 - continue; 1238 - if (i == dsa_upstream_port(priv->ds, port)) 1239 - continue; 1240 - 1241 - rx_vid = dsa_8021q_rx_vid(ds, i); 1242 - rc = priv->info->fdb_del_cmd(ds, port, addr, rx_vid); 1243 - if (rc < 0) 1244 - return rc; 1245 - } 1246 - tx_vid = dsa_8021q_tx_vid(ds, port); 1247 - return priv->info->fdb_del_cmd(ds, port, addr, tx_vid); 1205 + return priv->info->fdb_del_cmd(ds, port, addr, vid); 1248 1206 } 1249 1207 1250 1208 static int sja1105_fdb_dump(struct dsa_switch *ds, int port, ··· 1254 1270 continue; 1255 1271 u64_to_ether_addr(l2_lookup.macaddr, macaddr); 1256 1272 1257 - /* On SJA1105 E/T, the switch doesn't implement the LOCKEDS 1258 - * bit, so it doesn't tell us whether a FDB entry is static 1259 - * or not. 1260 - * But, of course, we can find out - we're the ones who added 1261 - * it in the first place. 1262 - */ 1263 - if (priv->info->device_id == SJA1105E_DEVICE_ID || 1264 - priv->info->device_id == SJA1105T_DEVICE_ID) { 1265 - int match; 1266 - 1267 - match = sja1105_find_static_fdb_entry(priv, port, 1268 - &l2_lookup); 1269 - l2_lookup.lockeds = (match >= 0); 1270 - } 1271 - 1272 - /* We need to hide the dsa_8021q VLANs from the user. This 1273 - * basically means hiding the duplicates and only showing 1274 - * the pvid that is supposed to be active in standalone and 1275 - * non-vlan_filtering modes (aka 1). 1276 - * - For statically added FDB entries (bridge fdb add), we 1277 - * can convert the TX VID (coming from the CPU port) into the 1278 - * pvid and ignore the RX VIDs of the other ports. 1279 - * - For dynamically learned FDB entries, a single entry with 1280 - * no duplicates is learned - that which has the real port's 1281 - * pvid, aka RX VID. 1282 - */ 1283 - if (!dsa_port_is_vlan_filtering(&ds->ports[port])) { 1284 - if (l2_lookup.vlanid == tx_vid || 1285 - l2_lookup.vlanid == rx_vid) 1286 - l2_lookup.vlanid = 1; 1287 - else 1288 - continue; 1289 - } 1273 + /* We need to hide the dsa_8021q VLANs from the user. */ 1274 + if (!dsa_port_is_vlan_filtering(&ds->ports[port])) 1275 + l2_lookup.vlanid = 0; 1290 1276 cb(macaddr, l2_lookup.vlanid, l2_lookup.lockeds, data); 1291 1277 } 1292 1278 return 0; ··· 1548 1594 */ 1549 1595 static int sja1105_vlan_filtering(struct dsa_switch *ds, int port, bool enabled) 1550 1596 { 1597 + struct sja1105_l2_lookup_params_entry *l2_lookup_params; 1551 1598 struct sja1105_general_params_entry *general_params; 1552 1599 struct sja1105_private *priv = ds->priv; 1553 1600 struct sja1105_table *table; ··· 1576 1621 */ 1577 1622 general_params->incl_srcpt1 = enabled; 1578 1623 general_params->incl_srcpt0 = enabled; 1624 + 1625 + /* VLAN filtering => independent VLAN learning. 1626 + * No VLAN filtering => shared VLAN learning. 1627 + * 1628 + * In shared VLAN learning mode, untagged traffic still gets 1629 + * pvid-tagged, and the FDB table gets populated with entries 1630 + * containing the "real" (pvid or from VLAN tag) VLAN ID. 1631 + * However the switch performs a masked L2 lookup in the FDB, 1632 + * effectively only looking up a frame's DMAC (and not VID) for the 1633 + * forwarding decision. 1634 + * 1635 + * This is extremely convenient for us, because in modes with 1636 + * vlan_filtering=0, dsa_8021q actually installs unique pvid's into 1637 + * each front panel port. This is good for identification but breaks 1638 + * learning badly - the VID of the learnt FDB entry is unique, aka 1639 + * no frames coming from any other port are going to have it. So 1640 + * for forwarding purposes, this is as though learning was broken 1641 + * (all frames get flooded). 1642 + */ 1643 + table = &priv->static_config.tables[BLK_IDX_L2_LOOKUP_PARAMS]; 1644 + l2_lookup_params = table->entries; 1645 + l2_lookup_params->shared_learn = !enabled; 1579 1646 1580 1647 rc = sja1105_static_config_reload(priv); 1581 1648 if (rc) ··· 1728 1751 1729 1752 cancel_work_sync(&priv->tagger_data.rxtstamp_work); 1730 1753 skb_queue_purge(&priv->tagger_data.skb_rxtstamp_queue); 1754 + sja1105_ptp_clock_unregister(priv); 1755 + sja1105_static_config_free(&priv->static_config); 1731 1756 } 1732 1757 1733 1758 static int sja1105_mgmt_xmit(struct dsa_switch *ds, int port, int slot, ··· 2187 2208 { 2188 2209 struct sja1105_private *priv = spi_get_drvdata(spi); 2189 2210 2190 - sja1105_ptp_clock_unregister(priv); 2191 2211 dsa_unregister_switch(priv->ds); 2192 - sja1105_static_config_free(&priv->static_config); 2193 2212 return 0; 2194 2213 } 2195 2214
+3 -4
drivers/net/dsa/sja1105/sja1105_ptp.c
··· 369 369 .mult = SJA1105_CC_MULT, 370 370 }; 371 371 mutex_init(&priv->ptp_lock); 372 - INIT_DELAYED_WORK(&priv->refresh_work, sja1105_ptp_overflow_check); 373 - 374 - schedule_delayed_work(&priv->refresh_work, SJA1105_REFRESH_INTERVAL); 375 - 376 372 priv->ptp_caps = sja1105_ptp_caps; 377 373 378 374 priv->clock = ptp_clock_register(&priv->ptp_caps, ds->dev); 379 375 if (IS_ERR_OR_NULL(priv->clock)) 380 376 return PTR_ERR(priv->clock); 377 + 378 + INIT_DELAYED_WORK(&priv->refresh_work, sja1105_ptp_overflow_check); 379 + schedule_delayed_work(&priv->refresh_work, SJA1105_REFRESH_INTERVAL); 381 380 382 381 return sja1105_ptp_reset(priv); 383 382 }
+2 -2
drivers/net/ethernet/8390/Kconfig
··· 12 12 13 13 Note that the answer to this question doesn't directly affect the 14 14 kernel: saying N will just cause the configurator to skip all 15 - the questions about Western Digital cards. If you say Y, you will be 16 - asked for your specific card in the following questions. 15 + the questions about National Semiconductor 8390 cards. If you say Y, 16 + you will be asked for your specific card in the following questions. 17 17 18 18 if NET_VENDOR_8390 19 19
+1 -1
drivers/net/ethernet/agere/et131x.c
··· 2362 2362 2363 2363 /* Allocate memory for the TCB's (Transmit Control Block) */ 2364 2364 tx_ring->tcb_ring = kcalloc(NUM_TCB, sizeof(struct tcb), 2365 - GFP_ATOMIC | GFP_DMA); 2365 + GFP_KERNEL | GFP_DMA); 2366 2366 if (!tx_ring->tcb_ring) 2367 2367 return -ENOMEM; 2368 2368
+3 -1
drivers/net/ethernet/allwinner/sun4i-emac.c
··· 860 860 goto out_clk_disable_unprepare; 861 861 } 862 862 863 - db->phy_node = of_parse_phandle(np, "phy", 0); 863 + db->phy_node = of_parse_phandle(np, "phy-handle", 0); 864 + if (!db->phy_node) 865 + db->phy_node = of_parse_phandle(np, "phy", 0); 864 866 if (!db->phy_node) { 865 867 dev_err(&pdev->dev, "no associated PHY\n"); 866 868 ret = -ENODEV;
+1 -1
drivers/net/ethernet/amd/Kconfig
··· 14 14 say Y. 15 15 16 16 Note that the answer to this question does not directly affect 17 - the kernel: saying N will just case the configurator to skip all 17 + the kernel: saying N will just cause the configurator to skip all 18 18 the questions regarding AMD chipsets. If you say Y, you will be asked 19 19 for your specific chipset/driver in the following questions. 20 20
+2 -2
drivers/net/ethernet/apple/Kconfig
··· 11 11 If you have a network (Ethernet) card belonging to this class, say Y. 12 12 13 13 Note that the answer to this question doesn't directly affect the 14 - kernel: saying N will just cause the configurator to skip all 15 - the questions about IBM devices. If you say Y, you will be asked for 14 + kernel: saying N will just cause the configurator to skip all the 15 + questions about Apple devices. If you say Y, you will be asked for 16 16 your specific card in the following questions. 17 17 18 18 if NET_VENDOR_APPLE
+1 -1
drivers/net/ethernet/atheros/ag71xx.c
··· 1141 1141 1142 1142 tx->descs_cpu = dma_alloc_coherent(&ag->pdev->dev, 1143 1143 ring_size * AG71XX_DESC_SIZE, 1144 - &tx->descs_dma, GFP_ATOMIC); 1144 + &tx->descs_dma, GFP_KERNEL); 1145 1145 if (!tx->descs_cpu) { 1146 1146 kfree(tx->buf); 1147 1147 tx->buf = NULL;
+3 -3
drivers/net/ethernet/broadcom/Kconfig
··· 14 14 say Y. 15 15 16 16 Note that the answer to this question does not directly affect 17 - the kernel: saying N will just case the configurator to skip all 18 - the questions regarding AMD chipsets. If you say Y, you will be asked 19 - for your specific chipset/driver in the following questions. 17 + the kernel: saying N will just cause the configurator to skip all 18 + the questions regarding Broadcom chipsets. If you say Y, you will 19 + be asked for your specific chipset/driver in the following questions. 20 20 21 21 if NET_VENDOR_BROADCOM 22 22
+1 -1
drivers/net/ethernet/broadcom/bcmsysport.c
··· 992 992 { 993 993 struct bcm_sysport_priv *priv = 994 994 container_of(napi, struct bcm_sysport_priv, napi); 995 - struct dim_sample dim_sample; 995 + struct dim_sample dim_sample = {}; 996 996 unsigned int work_done = 0; 997 997 998 998 work_done = bcm_sysport_desc_rx(priv, budget);
+1 -2
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
··· 1934 1934 } 1935 1935 1936 1936 /* select a non-FCoE queue */ 1937 - return netdev_pick_tx(dev, skb, NULL) % 1938 - (BNX2X_NUM_ETH_QUEUES(bp) * bp->max_cos); 1937 + return netdev_pick_tx(dev, skb, NULL) % (BNX2X_NUM_ETH_QUEUES(bp)); 1939 1938 } 1940 1939 1941 1940 void bnx2x_set_num_queues(struct bnx2x *bp)
+1 -1
drivers/net/ethernet/broadcom/bnxt/bnxt.c
··· 2136 2136 } 2137 2137 } 2138 2138 if (bp->flags & BNXT_FLAG_DIM) { 2139 - struct dim_sample dim_sample; 2139 + struct dim_sample dim_sample = {}; 2140 2140 2141 2141 dim_update_sample(cpr->event_ctr, 2142 2142 cpr->rx_packets,
+1 -1
drivers/net/ethernet/broadcom/genet/bcmgenet.c
··· 1895 1895 { 1896 1896 struct bcmgenet_rx_ring *ring = container_of(napi, 1897 1897 struct bcmgenet_rx_ring, napi); 1898 - struct dim_sample dim_sample; 1898 + struct dim_sample dim_sample = {}; 1899 1899 unsigned int work_done; 1900 1900 1901 1901 work_done = bcmgenet_desc_rx(ring, budget);
+6 -12
drivers/net/ethernet/cavium/thunder/thunder_bgx.c
··· 1381 1381 u8 *dst) 1382 1382 { 1383 1383 u8 mac[ETH_ALEN]; 1384 - int ret; 1384 + u8 *addr; 1385 1385 1386 - ret = fwnode_property_read_u8_array(acpi_fwnode_handle(adev), 1387 - "mac-address", mac, ETH_ALEN); 1388 - if (ret) 1389 - goto out; 1390 - 1391 - if (!is_valid_ether_addr(mac)) { 1386 + addr = fwnode_get_mac_address(acpi_fwnode_handle(adev), mac, ETH_ALEN); 1387 + if (!addr) { 1392 1388 dev_err(dev, "MAC address invalid: %pM\n", mac); 1393 - ret = -EINVAL; 1394 - goto out; 1389 + return -EINVAL; 1395 1390 } 1396 1391 1397 1392 dev_info(dev, "MAC address set to: %pM\n", mac); 1398 1393 1399 - memcpy(dst, mac, ETH_ALEN); 1400 - out: 1401 - return ret; 1394 + ether_addr_copy(dst, mac); 1395 + return 0; 1402 1396 } 1403 1397 1404 1398 /* Currently only sets the MAC address. */
+4 -1
drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
··· 3269 3269 if (!adapter->regs) { 3270 3270 dev_err(&pdev->dev, "cannot map device registers\n"); 3271 3271 err = -ENOMEM; 3272 - goto out_free_adapter; 3272 + goto out_free_adapter_nofail; 3273 3273 } 3274 3274 3275 3275 adapter->pdev = pdev; ··· 3396 3396 for (i = ai->nports0 + ai->nports1 - 1; i >= 0; --i) 3397 3397 if (adapter->port[i]) 3398 3398 free_netdev(adapter->port[i]); 3399 + 3400 + out_free_adapter_nofail: 3401 + kfree_skb(adapter->nofail_skb); 3399 3402 3400 3403 out_free_adapter: 3401 3404 kfree(adapter);
+2 -4
drivers/net/ethernet/emulex/benet/be_cmds.c
··· 550 550 int num = 0, status = 0; 551 551 struct be_mcc_obj *mcc_obj = &adapter->mcc_obj; 552 552 553 - spin_lock(&adapter->mcc_cq_lock); 553 + spin_lock_bh(&adapter->mcc_cq_lock); 554 554 555 555 while ((compl = be_mcc_compl_get(adapter))) { 556 556 if (compl->flags & CQE_FLAGS_ASYNC_MASK) { ··· 566 566 if (num) 567 567 be_cq_notify(adapter, mcc_obj->cq.id, mcc_obj->rearm_cq, num); 568 568 569 - spin_unlock(&adapter->mcc_cq_lock); 569 + spin_unlock_bh(&adapter->mcc_cq_lock); 570 570 return status; 571 571 } 572 572 ··· 581 581 if (be_check_error(adapter, BE_ERROR_ANY)) 582 582 return -EIO; 583 583 584 - local_bh_disable(); 585 584 status = be_process_mcc(adapter); 586 - local_bh_enable(); 587 585 588 586 if (atomic_read(&mcc_obj->q.used) == 0) 589 587 break;
-2
drivers/net/ethernet/emulex/benet/be_main.c
··· 5630 5630 * mcc completions 5631 5631 */ 5632 5632 if (!netif_running(adapter->netdev)) { 5633 - local_bh_disable(); 5634 5633 be_process_mcc(adapter); 5635 - local_bh_enable(); 5636 5634 goto reschedule; 5637 5635 } 5638 5636
+2
drivers/net/ethernet/freescale/enetc/Kconfig
··· 2 2 config FSL_ENETC 3 3 tristate "ENETC PF driver" 4 4 depends on PCI && PCI_MSI && (ARCH_LAYERSCAPE || COMPILE_TEST) 5 + select PHYLIB 5 6 help 6 7 This driver supports NXP ENETC gigabit ethernet controller PCIe 7 8 physical function (PF) devices, managing ENETC Ports at a privileged ··· 13 12 config FSL_ENETC_VF 14 13 tristate "ENETC VF driver" 15 14 depends on PCI && PCI_MSI && (ARCH_LAYERSCAPE || COMPILE_TEST) 15 + select PHYLIB 16 16 help 17 17 This driver supports NXP ENETC gigabit ethernet controller PCIe 18 18 virtual function (VF) devices enabled by the ENETC PF driver.
-3
drivers/net/ethernet/freescale/fman/fman.c
··· 2439 2439 * buffers when not using jumbo frames. 2440 2440 * Must be large enough to accommodate the network MTU, but small enough 2441 2441 * to avoid wasting skb memory. 2442 - * 2443 - * Could be overridden once, at boot-time, via the 2444 - * fm_set_max_frm() callback. 2445 2442 */ 2446 2443 static int fsl_fm_max_frm = FSL_FM_MAX_FRAME_SIZE; 2447 2444 module_param(fsl_fm_max_frm, int, 0);
+3 -5
drivers/net/ethernet/google/gve/gve.h
··· 31 31 struct gve_rx_desc_queue { 32 32 struct gve_rx_desc *desc_ring; /* the descriptor ring */ 33 33 dma_addr_t bus; /* the bus for the desc_ring */ 34 - u32 cnt; /* free-running total number of completed packets */ 35 - u32 fill_cnt; /* free-running total number of descriptors posted */ 36 - u32 mask; /* masks the cnt to the size of the ring */ 37 34 u8 seqno; /* the next expected seqno for this desc*/ 38 35 }; 39 36 ··· 57 60 dma_addr_t data_bus; /* dma mapping of the slots */ 58 61 struct gve_rx_slot_page_info *page_info; /* page info of the buffers */ 59 62 struct gve_queue_page_list *qpl; /* qpl assigned to this queue */ 60 - u32 mask; /* masks the cnt to the size of the ring */ 61 - u32 cnt; /* free-running total number of completed packets */ 62 63 }; 63 64 64 65 struct gve_priv; ··· 68 73 struct gve_rx_data_queue data; 69 74 u64 rbytes; /* free-running bytes received */ 70 75 u64 rpackets; /* free-running packets received */ 76 + u32 cnt; /* free-running total number of completed packets */ 77 + u32 fill_cnt; /* free-running total number of descs and buffs posted */ 78 + u32 mask; /* masks the cnt and fill_cnt to the size of the ring */ 71 79 u32 q_num; /* queue index */ 72 80 u32 ntfy_id; /* notification block index */ 73 81 struct gve_queue_resources *q_resources; /* head and tail pointer idx */
+2 -2
drivers/net/ethernet/google/gve/gve_ethtool.c
··· 138 138 for (ring = 0; ring < priv->rx_cfg.num_queues; ring++) { 139 139 struct gve_rx_ring *rx = &priv->rx[ring]; 140 140 141 - data[i++] = rx->desc.cnt; 142 - data[i++] = rx->desc.fill_cnt; 141 + data[i++] = rx->cnt; 142 + data[i++] = rx->fill_cnt; 143 143 } 144 144 } else { 145 145 i += priv->rx_cfg.num_queues * NUM_GVE_RX_CNTS;
+15 -19
drivers/net/ethernet/google/gve/gve_rx.c
··· 37 37 rx->data.qpl = NULL; 38 38 kvfree(rx->data.page_info); 39 39 40 - slots = rx->data.mask + 1; 40 + slots = rx->mask + 1; 41 41 bytes = sizeof(*rx->data.data_ring) * slots; 42 42 dma_free_coherent(dev, bytes, rx->data.data_ring, 43 43 rx->data.data_bus); ··· 64 64 /* Allocate one page per Rx queue slot. Each page is split into two 65 65 * packet buffers, when possible we "page flip" between the two. 66 66 */ 67 - slots = rx->data.mask + 1; 67 + slots = rx->mask + 1; 68 68 69 69 rx->data.page_info = kvzalloc(slots * 70 70 sizeof(*rx->data.page_info), GFP_KERNEL); ··· 111 111 rx->q_num = idx; 112 112 113 113 slots = priv->rx_pages_per_qpl; 114 - rx->data.mask = slots - 1; 114 + rx->mask = slots - 1; 115 115 116 116 /* alloc rx data ring */ 117 117 bytes = sizeof(*rx->data.data_ring) * slots; ··· 125 125 err = -ENOMEM; 126 126 goto abort_with_slots; 127 127 } 128 - rx->desc.fill_cnt = filled_pages; 128 + rx->fill_cnt = filled_pages; 129 129 /* Ensure data ring slots (packet buffers) are visible. */ 130 130 dma_wmb(); 131 131 ··· 156 156 err = -ENOMEM; 157 157 goto abort_with_q_resources; 158 158 } 159 - rx->desc.mask = slots - 1; 160 - rx->desc.cnt = 0; 159 + rx->mask = slots - 1; 160 + rx->cnt = 0; 161 161 rx->desc.seqno = 1; 162 162 gve_rx_add_to_block(priv, idx); 163 163 ··· 213 213 { 214 214 u32 db_idx = be32_to_cpu(rx->q_resources->db_index); 215 215 216 - iowrite32be(rx->desc.fill_cnt, &priv->db_bar2[db_idx]); 216 + iowrite32be(rx->fill_cnt, &priv->db_bar2[db_idx]); 217 217 } 218 218 219 219 static enum pkt_hash_types gve_rss_type(__be16 pkt_flags) ··· 273 273 } 274 274 275 275 static bool gve_rx(struct gve_rx_ring *rx, struct gve_rx_desc *rx_desc, 276 - netdev_features_t feat) 276 + netdev_features_t feat, u32 idx) 277 277 { 278 278 struct gve_rx_slot_page_info *page_info; 279 279 struct gve_priv *priv = rx->gve; ··· 282 282 struct sk_buff *skb; 283 283 int pagecount; 284 284 u16 len; 285 - u32 idx; 286 285 287 286 /* drop this packet */ 288 287 if (unlikely(rx_desc->flags_seq & GVE_RXF_ERR)) 289 288 return true; 290 289 291 290 len = be16_to_cpu(rx_desc->len) - GVE_RX_PAD; 292 - idx = rx->data.cnt & rx->data.mask; 293 291 page_info = &rx->data.page_info[idx]; 294 292 295 293 /* gvnic can only receive into registered segments. If the buffer ··· 338 340 if (!skb) 339 341 return true; 340 342 341 - rx->data.cnt++; 342 - 343 343 if (likely(feat & NETIF_F_RXCSUM)) { 344 344 /* NIC passes up the partial sum */ 345 345 if (rx_desc->csum) ··· 366 370 __be16 flags_seq; 367 371 u32 next_idx; 368 372 369 - next_idx = rx->desc.cnt & rx->desc.mask; 373 + next_idx = rx->cnt & rx->mask; 370 374 desc = rx->desc.desc_ring + next_idx; 371 375 372 376 flags_seq = desc->flags_seq; ··· 381 385 { 382 386 struct gve_priv *priv = rx->gve; 383 387 struct gve_rx_desc *desc; 384 - u32 cnt = rx->desc.cnt; 385 - u32 idx = cnt & rx->desc.mask; 388 + u32 cnt = rx->cnt; 389 + u32 idx = cnt & rx->mask; 386 390 u32 work_done = 0; 387 391 u64 bytes = 0; 388 392 ··· 397 401 rx->q_num, GVE_SEQNO(desc->flags_seq), 398 402 rx->desc.seqno); 399 403 bytes += be16_to_cpu(desc->len) - GVE_RX_PAD; 400 - if (!gve_rx(rx, desc, feat)) 404 + if (!gve_rx(rx, desc, feat, idx)) 401 405 gve_schedule_reset(priv); 402 406 cnt++; 403 - idx = cnt & rx->desc.mask; 407 + idx = cnt & rx->mask; 404 408 desc = rx->desc.desc_ring + idx; 405 409 rx->desc.seqno = gve_next_seqno(rx->desc.seqno); 406 410 work_done++; ··· 413 417 rx->rpackets += work_done; 414 418 rx->rbytes += bytes; 415 419 u64_stats_update_end(&rx->statss); 416 - rx->desc.cnt = cnt; 417 - rx->desc.fill_cnt += work_done; 420 + rx->cnt = cnt; 421 + rx->fill_cnt += work_done; 418 422 419 423 /* restock desc ring slots */ 420 424 dma_wmb(); /* Ensure descs are visible before ringing doorbell */
+16 -12
drivers/net/ethernet/hisilicon/hip04_eth.c
··· 220 220 unsigned int reg_inten; 221 221 222 222 struct napi_struct napi; 223 + struct device *dev; 223 224 struct net_device *ndev; 224 225 225 226 struct tx_desc *tx_desc; ··· 249 248 250 249 static inline unsigned int tx_count(unsigned int head, unsigned int tail) 251 250 { 252 - return (head - tail) % (TX_DESC_NUM - 1); 251 + return (head - tail) % TX_DESC_NUM; 253 252 } 254 253 255 254 static void hip04_config_port(struct net_device *ndev, u32 speed, u32 duplex) ··· 466 465 } 467 466 468 467 if (priv->tx_phys[tx_tail]) { 469 - dma_unmap_single(&ndev->dev, priv->tx_phys[tx_tail], 468 + dma_unmap_single(priv->dev, priv->tx_phys[tx_tail], 470 469 priv->tx_skb[tx_tail]->len, 471 470 DMA_TO_DEVICE); 472 471 priv->tx_phys[tx_tail] = 0; ··· 517 516 return NETDEV_TX_BUSY; 518 517 } 519 518 520 - phys = dma_map_single(&ndev->dev, skb->data, skb->len, DMA_TO_DEVICE); 521 - if (dma_mapping_error(&ndev->dev, phys)) { 519 + phys = dma_map_single(priv->dev, skb->data, skb->len, DMA_TO_DEVICE); 520 + if (dma_mapping_error(priv->dev, phys)) { 522 521 dev_kfree_skb(skb); 523 522 return NETDEV_TX_OK; 524 523 } ··· 586 585 u16 len; 587 586 u32 err; 588 587 588 + /* clean up tx descriptors */ 589 + tx_remaining = hip04_tx_reclaim(ndev, false); 590 + 589 591 while (cnt && !last) { 590 592 buf = priv->rx_buf[priv->rx_head]; 591 593 skb = build_skb(buf, priv->rx_buf_size); ··· 597 593 goto refill; 598 594 } 599 595 600 - dma_unmap_single(&ndev->dev, priv->rx_phys[priv->rx_head], 596 + dma_unmap_single(priv->dev, priv->rx_phys[priv->rx_head], 601 597 RX_BUF_SIZE, DMA_FROM_DEVICE); 602 598 priv->rx_phys[priv->rx_head] = 0; 603 599 ··· 626 622 buf = netdev_alloc_frag(priv->rx_buf_size); 627 623 if (!buf) 628 624 goto done; 629 - phys = dma_map_single(&ndev->dev, buf, 625 + phys = dma_map_single(priv->dev, buf, 630 626 RX_BUF_SIZE, DMA_FROM_DEVICE); 631 - if (dma_mapping_error(&ndev->dev, phys)) 627 + if (dma_mapping_error(priv->dev, phys)) 632 628 goto done; 633 629 priv->rx_buf[priv->rx_head] = buf; 634 630 priv->rx_phys[priv->rx_head] = phys; ··· 649 645 } 650 646 napi_complete_done(napi, rx); 651 647 done: 652 - /* clean up tx descriptors and start a new timer if necessary */ 653 - tx_remaining = hip04_tx_reclaim(ndev, false); 648 + /* start a new timer if necessary */ 654 649 if (rx < budget && tx_remaining) 655 650 hip04_start_tx_timer(priv); 656 651 ··· 731 728 for (i = 0; i < RX_DESC_NUM; i++) { 732 729 dma_addr_t phys; 733 730 734 - phys = dma_map_single(&ndev->dev, priv->rx_buf[i], 731 + phys = dma_map_single(priv->dev, priv->rx_buf[i], 735 732 RX_BUF_SIZE, DMA_FROM_DEVICE); 736 - if (dma_mapping_error(&ndev->dev, phys)) 733 + if (dma_mapping_error(priv->dev, phys)) 737 734 return -EIO; 738 735 739 736 priv->rx_phys[i] = phys; ··· 767 764 768 765 for (i = 0; i < RX_DESC_NUM; i++) { 769 766 if (priv->rx_phys[i]) { 770 - dma_unmap_single(&ndev->dev, priv->rx_phys[i], 767 + dma_unmap_single(priv->dev, priv->rx_phys[i], 771 768 RX_BUF_SIZE, DMA_FROM_DEVICE); 772 769 priv->rx_phys[i] = 0; 773 770 } ··· 910 907 return -ENOMEM; 911 908 912 909 priv = netdev_priv(ndev); 910 + priv->dev = d; 913 911 priv->ndev = ndev; 914 912 platform_set_drvdata(pdev, ndev); 915 913 SET_NETDEV_DEV(ndev, &pdev->dev);
+1 -1
drivers/net/ethernet/ibm/ehea/ehea_main.c
··· 3251 3251 switch (action) { 3252 3252 case MEM_CANCEL_OFFLINE: 3253 3253 pr_info("memory offlining canceled"); 3254 - /* Fall through: re-add canceled memory block */ 3254 + /* Fall through - re-add canceled memory block */ 3255 3255 3256 3256 case MEM_ONLINE: 3257 3257 pr_info("memory is going online");
+22 -9
drivers/net/ethernet/marvell/mvmdio.c
··· 319 319 320 320 init_waitqueue_head(&dev->smi_busy_wait); 321 321 322 - for (i = 0; i < ARRAY_SIZE(dev->clk); i++) { 323 - dev->clk[i] = of_clk_get(pdev->dev.of_node, i); 324 - if (PTR_ERR(dev->clk[i]) == -EPROBE_DEFER) { 322 + if (pdev->dev.of_node) { 323 + for (i = 0; i < ARRAY_SIZE(dev->clk); i++) { 324 + dev->clk[i] = of_clk_get(pdev->dev.of_node, i); 325 + if (PTR_ERR(dev->clk[i]) == -EPROBE_DEFER) { 326 + ret = -EPROBE_DEFER; 327 + goto out_clk; 328 + } 329 + if (IS_ERR(dev->clk[i])) 330 + break; 331 + clk_prepare_enable(dev->clk[i]); 332 + } 333 + 334 + if (!IS_ERR(of_clk_get(pdev->dev.of_node, 335 + ARRAY_SIZE(dev->clk)))) 336 + dev_warn(&pdev->dev, 337 + "unsupported number of clocks, limiting to the first " 338 + __stringify(ARRAY_SIZE(dev->clk)) "\n"); 339 + } else { 340 + dev->clk[0] = clk_get(&pdev->dev, NULL); 341 + if (PTR_ERR(dev->clk[0]) == -EPROBE_DEFER) { 325 342 ret = -EPROBE_DEFER; 326 343 goto out_clk; 327 344 } 328 - if (IS_ERR(dev->clk[i])) 329 - break; 330 - clk_prepare_enable(dev->clk[i]); 345 + if (!IS_ERR(dev->clk[0])) 346 + clk_prepare_enable(dev->clk[0]); 331 347 } 332 348 333 - if (!IS_ERR(of_clk_get(pdev->dev.of_node, ARRAY_SIZE(dev->clk)))) 334 - dev_warn(&pdev->dev, "unsupported number of clocks, limiting to the first " 335 - __stringify(ARRAY_SIZE(dev->clk)) "\n"); 336 349 337 350 dev->err_interrupt = platform_get_irq(pdev, 0); 338 351 if (dev->err_interrupt > 0 &&
+40 -47
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
··· 811 811 return 0; 812 812 } 813 813 814 + static void mvpp2_set_hw_csum(struct mvpp2_port *port, 815 + enum mvpp2_bm_pool_log_num new_long_pool) 816 + { 817 + const netdev_features_t csums = NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; 818 + 819 + /* Update L4 checksum when jumbo enable/disable on port. 820 + * Only port 0 supports hardware checksum offload due to 821 + * the Tx FIFO size limitation. 822 + * Also, don't set NETIF_F_HW_CSUM because L3_offset in TX descriptor 823 + * has 7 bits, so the maximum L3 offset is 128. 824 + */ 825 + if (new_long_pool == MVPP2_BM_JUMBO && port->id != 0) { 826 + port->dev->features &= ~csums; 827 + port->dev->hw_features &= ~csums; 828 + } else { 829 + port->dev->features |= csums; 830 + port->dev->hw_features |= csums; 831 + } 832 + } 833 + 814 834 static int mvpp2_bm_update_mtu(struct net_device *dev, int mtu) 815 835 { 816 836 struct mvpp2_port *port = netdev_priv(dev); ··· 863 843 /* Add port to new short & long pool */ 864 844 mvpp2_swf_bm_pool_init(port); 865 845 866 - /* Update L4 checksum when jumbo enable/disable on port */ 867 - if (new_long_pool == MVPP2_BM_JUMBO && port->id != 0) { 868 - dev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM); 869 - dev->hw_features &= ~(NETIF_F_IP_CSUM | 870 - NETIF_F_IPV6_CSUM); 871 - } else { 872 - dev->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; 873 - dev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; 874 - } 846 + mvpp2_set_hw_csum(port, new_long_pool); 875 847 } 876 848 877 849 dev->mtu = mtu; ··· 3712 3700 static int mvpp2_change_mtu(struct net_device *dev, int mtu) 3713 3701 { 3714 3702 struct mvpp2_port *port = netdev_priv(dev); 3703 + bool running = netif_running(dev); 3715 3704 int err; 3716 3705 3717 3706 if (!IS_ALIGNED(MVPP2_RX_PKT_SIZE(mtu), 8)) { ··· 3721 3708 mtu = ALIGN(MVPP2_RX_PKT_SIZE(mtu), 8); 3722 3709 } 3723 3710 3724 - if (!netif_running(dev)) { 3725 - err = mvpp2_bm_update_mtu(dev, mtu); 3726 - if (!err) { 3727 - port->pkt_size = MVPP2_RX_PKT_SIZE(mtu); 3728 - return 0; 3729 - } 3730 - 3731 - /* Reconfigure BM to the original MTU */ 3732 - err = mvpp2_bm_update_mtu(dev, dev->mtu); 3733 - if (err) 3734 - goto log_error; 3735 - } 3736 - 3737 - mvpp2_stop_dev(port); 3711 + if (running) 3712 + mvpp2_stop_dev(port); 3738 3713 3739 3714 err = mvpp2_bm_update_mtu(dev, mtu); 3740 - if (!err) { 3715 + if (err) { 3716 + netdev_err(dev, "failed to change MTU\n"); 3717 + /* Reconfigure BM to the original MTU */ 3718 + mvpp2_bm_update_mtu(dev, dev->mtu); 3719 + } else { 3741 3720 port->pkt_size = MVPP2_RX_PKT_SIZE(mtu); 3742 - goto out_start; 3743 3721 } 3744 3722 3745 - /* Reconfigure BM to the original MTU */ 3746 - err = mvpp2_bm_update_mtu(dev, dev->mtu); 3747 - if (err) 3748 - goto log_error; 3723 + if (running) { 3724 + mvpp2_start_dev(port); 3725 + mvpp2_egress_enable(port); 3726 + mvpp2_ingress_enable(port); 3727 + } 3749 3728 3750 - out_start: 3751 - mvpp2_start_dev(port); 3752 - mvpp2_egress_enable(port); 3753 - mvpp2_ingress_enable(port); 3754 - 3755 - return 0; 3756 - log_error: 3757 - netdev_err(dev, "failed to change MTU\n"); 3758 3729 return err; 3759 3730 } 3760 3731 ··· 4736 4739 else 4737 4740 ctrl0 &= ~MVPP22_XLG_CTRL0_RX_FLOW_CTRL_EN; 4738 4741 4739 - ctrl4 &= ~MVPP22_XLG_CTRL4_MACMODSELECT_GMAC; 4740 - ctrl4 |= MVPP22_XLG_CTRL4_FWD_FC | MVPP22_XLG_CTRL4_FWD_PFC | 4741 - MVPP22_XLG_CTRL4_EN_IDLE_CHECK; 4742 + ctrl4 &= ~(MVPP22_XLG_CTRL4_MACMODSELECT_GMAC | 4743 + MVPP22_XLG_CTRL4_EN_IDLE_CHECK); 4744 + ctrl4 |= MVPP22_XLG_CTRL4_FWD_FC | MVPP22_XLG_CTRL4_FWD_PFC; 4742 4745 4743 4746 if (old_ctrl0 != ctrl0) 4744 4747 writel(ctrl0, port->base + MVPP22_XLG_CTRL0_REG); ··· 5205 5208 dev->features |= NETIF_F_NTUPLE; 5206 5209 } 5207 5210 5208 - if (port->pool_long->id == MVPP2_BM_JUMBO && port->id != 0) { 5209 - dev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM); 5210 - dev->hw_features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM); 5211 - } 5211 + mvpp2_set_hw_csum(port, port->pool_long->id); 5212 5212 5213 5213 dev->vlan_features |= features; 5214 5214 dev->gso_max_segs = MVPP2_MAX_TSO_SEGS; ··· 5753 5759 5754 5760 mvpp2_dbgfs_cleanup(priv); 5755 5761 5756 - flush_workqueue(priv->stats_queue); 5757 - destroy_workqueue(priv->stats_queue); 5758 - 5759 5762 fwnode_for_each_available_child_node(fwnode, port_fwnode) { 5760 5763 if (priv->port_list[i]) { 5761 5764 mutex_destroy(&priv->port_list[i]->gather_stats_lock); ··· 5760 5769 } 5761 5770 i++; 5762 5771 } 5772 + 5773 + destroy_workqueue(priv->stats_queue); 5763 5774 5764 5775 for (i = 0; i < MVPP2_BM_POOLS_NUM; i++) { 5765 5776 struct mvpp2_bm_pool *bm_pool = &priv->bm_pools[i];
+7
drivers/net/ethernet/marvell/sky2.c
··· 4924 4924 DMI_MATCH(DMI_PRODUCT_NAME, "P5W DH Deluxe"), 4925 4925 }, 4926 4926 }, 4927 + { 4928 + .ident = "ASUS P6T", 4929 + .matches = { 4930 + DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), 4931 + DMI_MATCH(DMI_BOARD_NAME, "P6T"), 4932 + }, 4933 + }, 4927 4934 {} 4928 4935 }; 4929 4936
-1
drivers/net/ethernet/mediatek/Kconfig
··· 9 9 10 10 config NET_MEDIATEK_SOC 11 11 tristate "MediaTek SoC Gigabit Ethernet support" 12 - depends on NET_VENDOR_MEDIATEK 13 12 select PHYLIB 14 13 ---help--- 15 14 This driver supports the gigabit ethernet MACs in the
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/dev.c
··· 213 213 struct mlx5_interface *intf; 214 214 215 215 mutex_lock(&mlx5_intf_mutex); 216 - list_for_each_entry(intf, &intf_list, list) 216 + list_for_each_entry_reverse(intf, &intf_list, list) 217 217 mlx5_remove_device(intf, priv); 218 218 list_del(&priv->dev_list); 219 219 mutex_unlock(&mlx5_intf_mutex);
+3 -9
drivers/net/ethernet/mellanox/mlx5/core/en.h
··· 159 159 enum mlx5e_rq_group { 160 160 MLX5E_RQ_GROUP_REGULAR, 161 161 MLX5E_RQ_GROUP_XSK, 162 - MLX5E_NUM_RQ_GROUPS /* Keep last. */ 162 + #define MLX5E_NUM_RQ_GROUPS(g) (1 + MLX5E_RQ_GROUP_##g) 163 163 }; 164 164 165 165 static inline u16 mlx5_min_rx_wqes(int wq_type, u32 wq_size) ··· 180 180 return is_kdump_kernel() ? 181 181 MLX5E_MIN_NUM_CHANNELS : 182 182 min_t(int, mlx5_comp_vectors_count(mdev), MLX5E_MAX_NUM_CHANNELS); 183 - } 184 - 185 - /* Use this function to get max num channels after netdev was created */ 186 - static inline int mlx5e_get_netdev_max_channels(struct net_device *netdev) 187 - { 188 - return min_t(unsigned int, 189 - netdev->num_rx_queues / MLX5E_NUM_RQ_GROUPS, 190 - netdev->num_tx_queues); 191 183 } 192 184 193 185 struct mlx5e_tx_wqe { ··· 822 830 struct net_device *netdev; 823 831 struct mlx5e_stats stats; 824 832 struct mlx5e_channel_stats channel_stats[MLX5E_MAX_NUM_CHANNELS]; 833 + u16 max_nch; 825 834 u8 max_opened_tc; 826 835 struct hwtstamp_config tstamp; 827 836 u16 q_counter; ··· 864 871 mlx5e_fp_handle_rx_cqe handle_rx_cqe_mpwqe; 865 872 } rx_handlers; 866 873 int max_tc; 874 + u8 rq_groups; 867 875 }; 868 876 869 877 void mlx5e_build_ptys2ethtool_map(void);
+3 -2
drivers/net/ethernet/mellanox/mlx5/core/en/params.h
··· 66 66 *group = qid / nch; 67 67 } 68 68 69 - static inline bool mlx5e_qid_validate(struct mlx5e_params *params, u64 qid) 69 + static inline bool mlx5e_qid_validate(const struct mlx5e_profile *profile, 70 + struct mlx5e_params *params, u64 qid) 70 71 { 71 - return qid < params->num_channels * MLX5E_NUM_RQ_GROUPS; 72 + return qid < params->num_channels * profile->rq_groups; 72 73 } 73 74 74 75 /* Parameter calculations */
+18 -9
drivers/net/ethernet/mellanox/mlx5/core/en/port.c
··· 78 78 }; 79 79 80 80 static void mlx5e_port_get_speed_arr(struct mlx5_core_dev *mdev, 81 - const u32 **arr, u32 *size) 81 + const u32 **arr, u32 *size, 82 + bool force_legacy) 82 83 { 83 - bool ext = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet); 84 + bool ext = force_legacy ? false : MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet); 84 85 85 86 *size = ext ? ARRAY_SIZE(mlx5e_ext_link_speed) : 86 87 ARRAY_SIZE(mlx5e_link_speed); ··· 153 152 sizeof(out), MLX5_REG_PTYS, 0, 1); 154 153 } 155 154 156 - u32 mlx5e_port_ptys2speed(struct mlx5_core_dev *mdev, u32 eth_proto_oper) 155 + u32 mlx5e_port_ptys2speed(struct mlx5_core_dev *mdev, u32 eth_proto_oper, 156 + bool force_legacy) 157 157 { 158 158 unsigned long temp = eth_proto_oper; 159 159 const u32 *table; ··· 162 160 u32 max_size; 163 161 int i; 164 162 165 - mlx5e_port_get_speed_arr(mdev, &table, &max_size); 163 + mlx5e_port_get_speed_arr(mdev, &table, &max_size, force_legacy); 166 164 i = find_first_bit(&temp, max_size); 167 165 if (i < max_size) 168 166 speed = table[i]; ··· 172 170 int mlx5e_port_linkspeed(struct mlx5_core_dev *mdev, u32 *speed) 173 171 { 174 172 struct mlx5e_port_eth_proto eproto; 173 + bool force_legacy = false; 175 174 bool ext; 176 175 int err; 177 176 ··· 180 177 err = mlx5_port_query_eth_proto(mdev, 1, ext, &eproto); 181 178 if (err) 182 179 goto out; 183 - 184 - *speed = mlx5e_port_ptys2speed(mdev, eproto.oper); 180 + if (ext && !eproto.admin) { 181 + force_legacy = true; 182 + err = mlx5_port_query_eth_proto(mdev, 1, false, &eproto); 183 + if (err) 184 + goto out; 185 + } 186 + *speed = mlx5e_port_ptys2speed(mdev, eproto.oper, force_legacy); 185 187 if (!(*speed)) 186 188 err = -EINVAL; 187 189 ··· 209 201 if (err) 210 202 return err; 211 203 212 - mlx5e_port_get_speed_arr(mdev, &table, &max_size); 204 + mlx5e_port_get_speed_arr(mdev, &table, &max_size, false); 213 205 for (i = 0; i < max_size; ++i) 214 206 if (eproto.cap & MLX5E_PROT_MASK(i)) 215 207 max_speed = max(max_speed, table[i]); ··· 218 210 return 0; 219 211 } 220 212 221 - u32 mlx5e_port_speed2linkmodes(struct mlx5_core_dev *mdev, u32 speed) 213 + u32 mlx5e_port_speed2linkmodes(struct mlx5_core_dev *mdev, u32 speed, 214 + bool force_legacy) 222 215 { 223 216 u32 link_modes = 0; 224 217 const u32 *table; 225 218 u32 max_size; 226 219 int i; 227 220 228 - mlx5e_port_get_speed_arr(mdev, &table, &max_size); 221 + mlx5e_port_get_speed_arr(mdev, &table, &max_size, force_legacy); 229 222 for (i = 0; i < max_size; ++i) { 230 223 if (table[i] == speed) 231 224 link_modes |= MLX5E_PROT_MASK(i);
+4 -2
drivers/net/ethernet/mellanox/mlx5/core/en/port.h
··· 48 48 u8 *an_disable_cap, u8 *an_disable_admin); 49 49 int mlx5_port_set_eth_ptys(struct mlx5_core_dev *dev, bool an_disable, 50 50 u32 proto_admin, bool ext); 51 - u32 mlx5e_port_ptys2speed(struct mlx5_core_dev *mdev, u32 eth_proto_oper); 51 + u32 mlx5e_port_ptys2speed(struct mlx5_core_dev *mdev, u32 eth_proto_oper, 52 + bool force_legacy); 52 53 int mlx5e_port_linkspeed(struct mlx5_core_dev *mdev, u32 *speed); 53 54 int mlx5e_port_max_linkspeed(struct mlx5_core_dev *mdev, u32 *speed); 54 - u32 mlx5e_port_speed2linkmodes(struct mlx5_core_dev *mdev, u32 speed); 55 + u32 mlx5e_port_speed2linkmodes(struct mlx5_core_dev *mdev, u32 speed, 56 + bool force_legacy); 55 57 56 58 int mlx5e_port_query_pbmc(struct mlx5_core_dev *mdev, void *out); 57 59 int mlx5e_port_set_pbmc(struct mlx5_core_dev *mdev, void *in);
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
··· 412 412 goto out; 413 413 414 414 tls_ctx = tls_get_ctx(skb->sk); 415 - if (unlikely(tls_ctx->netdev != netdev)) 415 + if (unlikely(WARN_ON_ONCE(tls_ctx->netdev != netdev))) 416 416 goto err_out; 417 417 418 418 priv_tx = mlx5e_get_ktls_tx_priv_ctx(tls_ctx);
+49 -24
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
··· 391 391 { 392 392 mutex_lock(&priv->state_lock); 393 393 394 - ch->max_combined = mlx5e_get_netdev_max_channels(priv->netdev); 394 + ch->max_combined = priv->max_nch; 395 395 ch->combined_count = priv->channels.params.num_channels; 396 396 if (priv->xsk.refcnt) { 397 397 /* The upper half are XSK queues. */ ··· 785 785 } 786 786 787 787 static void get_speed_duplex(struct net_device *netdev, 788 - u32 eth_proto_oper, 788 + u32 eth_proto_oper, bool force_legacy, 789 789 struct ethtool_link_ksettings *link_ksettings) 790 790 { 791 791 struct mlx5e_priv *priv = netdev_priv(netdev); ··· 795 795 if (!netif_carrier_ok(netdev)) 796 796 goto out; 797 797 798 - speed = mlx5e_port_ptys2speed(priv->mdev, eth_proto_oper); 798 + speed = mlx5e_port_ptys2speed(priv->mdev, eth_proto_oper, force_legacy); 799 799 if (!speed) { 800 800 speed = SPEED_UNKNOWN; 801 801 goto out; ··· 914 914 /* Fields: eth_proto_admin and ext_eth_proto_admin are 915 915 * mutually exclusive. Hence try reading legacy advertising 916 916 * when extended advertising is zero. 917 - * admin_ext indicates how eth_proto_admin should be 918 - * interpreted 917 + * admin_ext indicates which proto_admin (ext vs. legacy) 918 + * should be read and interpreted 919 919 */ 920 920 admin_ext = ext; 921 921 if (ext && !eth_proto_admin) { ··· 924 924 admin_ext = false; 925 925 } 926 926 927 - eth_proto_oper = MLX5_GET_ETH_PROTO(ptys_reg, out, ext, 927 + eth_proto_oper = MLX5_GET_ETH_PROTO(ptys_reg, out, admin_ext, 928 928 eth_proto_oper); 929 929 eth_proto_lp = MLX5_GET(ptys_reg, out, eth_proto_lp_advertise); 930 930 an_disable_admin = MLX5_GET(ptys_reg, out, an_disable_admin); ··· 939 939 get_supported(mdev, eth_proto_cap, link_ksettings); 940 940 get_advertising(eth_proto_admin, tx_pause, rx_pause, link_ksettings, 941 941 admin_ext); 942 - get_speed_duplex(priv->netdev, eth_proto_oper, link_ksettings); 942 + get_speed_duplex(priv->netdev, eth_proto_oper, !admin_ext, 943 + link_ksettings); 943 944 944 945 eth_proto_oper = eth_proto_oper ? eth_proto_oper : eth_proto_cap; 945 946 ··· 1017 1016 return ptys_modes; 1018 1017 } 1019 1018 1019 + static bool ext_link_mode_requested(const unsigned long *adver) 1020 + { 1021 + #define MLX5E_MIN_PTYS_EXT_LINK_MODE_BIT ETHTOOL_LINK_MODE_50000baseKR_Full_BIT 1022 + int size = __ETHTOOL_LINK_MODE_MASK_NBITS - MLX5E_MIN_PTYS_EXT_LINK_MODE_BIT; 1023 + __ETHTOOL_DECLARE_LINK_MODE_MASK(modes); 1024 + 1025 + bitmap_set(modes, MLX5E_MIN_PTYS_EXT_LINK_MODE_BIT, size); 1026 + return bitmap_intersects(modes, adver, __ETHTOOL_LINK_MODE_MASK_NBITS); 1027 + } 1028 + 1029 + static bool ext_speed_requested(u32 speed) 1030 + { 1031 + #define MLX5E_MAX_PTYS_LEGACY_SPEED 100000 1032 + return !!(speed > MLX5E_MAX_PTYS_LEGACY_SPEED); 1033 + } 1034 + 1035 + static bool ext_requested(u8 autoneg, const unsigned long *adver, u32 speed) 1036 + { 1037 + bool ext_link_mode = ext_link_mode_requested(adver); 1038 + bool ext_speed = ext_speed_requested(speed); 1039 + 1040 + return autoneg == AUTONEG_ENABLE ? ext_link_mode : ext_speed; 1041 + } 1042 + 1020 1043 int mlx5e_ethtool_set_link_ksettings(struct mlx5e_priv *priv, 1021 1044 const struct ethtool_link_ksettings *link_ksettings) 1022 1045 { 1023 1046 struct mlx5_core_dev *mdev = priv->mdev; 1024 1047 struct mlx5e_port_eth_proto eproto; 1048 + const unsigned long *adver; 1025 1049 bool an_changes = false; 1026 1050 u8 an_disable_admin; 1027 1051 bool ext_supported; 1028 - bool ext_requested; 1029 1052 u8 an_disable_cap; 1030 1053 bool an_disable; 1031 1054 u32 link_modes; 1032 1055 u8 an_status; 1056 + u8 autoneg; 1033 1057 u32 speed; 1058 + bool ext; 1034 1059 int err; 1035 1060 1036 1061 u32 (*ethtool2ptys_adver_func)(const unsigned long *adver); 1037 1062 1038 - #define MLX5E_PTYS_EXT ((1ULL << ETHTOOL_LINK_MODE_50000baseKR_Full_BIT) - 1) 1039 - 1040 - ext_requested = !!(link_ksettings->link_modes.advertising[0] > 1041 - MLX5E_PTYS_EXT || 1042 - link_ksettings->link_modes.advertising[1]); 1043 - ext_supported = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet); 1044 - ext_requested &= ext_supported; 1045 - 1063 + adver = link_ksettings->link_modes.advertising; 1064 + autoneg = link_ksettings->base.autoneg; 1046 1065 speed = link_ksettings->base.speed; 1047 - ethtool2ptys_adver_func = ext_requested ? 1048 - mlx5e_ethtool2ptys_ext_adver_link : 1066 + 1067 + ext = ext_requested(autoneg, adver, speed), 1068 + ext_supported = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet); 1069 + if (!ext_supported && ext) 1070 + return -EOPNOTSUPP; 1071 + 1072 + ethtool2ptys_adver_func = ext ? mlx5e_ethtool2ptys_ext_adver_link : 1049 1073 mlx5e_ethtool2ptys_adver_link; 1050 - err = mlx5_port_query_eth_proto(mdev, 1, ext_requested, &eproto); 1074 + err = mlx5_port_query_eth_proto(mdev, 1, ext, &eproto); 1051 1075 if (err) { 1052 1076 netdev_err(priv->netdev, "%s: query port eth proto failed: %d\n", 1053 1077 __func__, err); 1054 1078 goto out; 1055 1079 } 1056 - link_modes = link_ksettings->base.autoneg == AUTONEG_ENABLE ? 1057 - ethtool2ptys_adver_func(link_ksettings->link_modes.advertising) : 1058 - mlx5e_port_speed2linkmodes(mdev, speed); 1080 + link_modes = autoneg == AUTONEG_ENABLE ? ethtool2ptys_adver_func(adver) : 1081 + mlx5e_port_speed2linkmodes(mdev, speed, !ext); 1059 1082 1060 1083 link_modes = link_modes & eproto.cap; 1061 1084 if (!link_modes) { ··· 1092 1067 mlx5_port_query_eth_autoneg(mdev, &an_status, &an_disable_cap, 1093 1068 &an_disable_admin); 1094 1069 1095 - an_disable = link_ksettings->base.autoneg == AUTONEG_DISABLE; 1070 + an_disable = autoneg == AUTONEG_DISABLE; 1096 1071 an_changes = ((!an_disable && an_disable_admin) || 1097 1072 (an_disable && !an_disable_admin)); 1098 1073 1099 1074 if (!an_changes && link_modes == eproto.admin) 1100 1075 goto out; 1101 1076 1102 - mlx5_port_set_eth_ptys(mdev, an_disable, link_modes, ext_requested); 1077 + mlx5_port_set_eth_ptys(mdev, an_disable, link_modes, ext); 1103 1078 mlx5_toggle_port_link(mdev); 1104 1079 1105 1080 out:
+2 -1
drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c
··· 611 611 return -ENOSPC; 612 612 613 613 if (fs->ring_cookie != RX_CLS_FLOW_DISC) 614 - if (!mlx5e_qid_validate(&priv->channels.params, fs->ring_cookie)) 614 + if (!mlx5e_qid_validate(priv->profile, &priv->channels.params, 615 + fs->ring_cookie)) 615 616 return -EINVAL; 616 617 617 618 switch (fs->flow_type & ~(FLOW_EXT | FLOW_MAC_EXT)) {
+18 -23
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
··· 331 331 332 332 static void mlx5e_init_frags_partition(struct mlx5e_rq *rq) 333 333 { 334 - struct mlx5e_wqe_frag_info next_frag, *prev; 334 + struct mlx5e_wqe_frag_info next_frag = {}; 335 + struct mlx5e_wqe_frag_info *prev = NULL; 335 336 int i; 336 337 337 338 next_frag.di = &rq->wqe.di[0]; 338 - next_frag.offset = 0; 339 - prev = NULL; 340 339 341 340 for (i = 0; i < mlx5_wq_cyc_get_size(&rq->wqe.wq); i++) { 342 341 struct mlx5e_rq_frag_info *frag_info = &rq->wqe.info.arr[0]; ··· 1676 1677 struct mlx5e_channel_param *cparam) 1677 1678 { 1678 1679 struct mlx5e_priv *priv = c->priv; 1679 - int err, tc, max_nch = mlx5e_get_netdev_max_channels(priv->netdev); 1680 + int err, tc; 1680 1681 1681 1682 for (tc = 0; tc < params->num_tc; tc++) { 1682 - int txq_ix = c->ix + tc * max_nch; 1683 + int txq_ix = c->ix + tc * priv->max_nch; 1683 1684 1684 1685 err = mlx5e_open_txqsq(c, c->priv->tisn[tc], txq_ix, 1685 1686 params, &cparam->sq, &c->sq[tc], tc); ··· 2437 2438 2438 2439 int mlx5e_create_direct_rqts(struct mlx5e_priv *priv, struct mlx5e_tir *tirs) 2439 2440 { 2440 - const int max_nch = mlx5e_get_netdev_max_channels(priv->netdev); 2441 2441 int err; 2442 2442 int ix; 2443 2443 2444 - for (ix = 0; ix < max_nch; ix++) { 2444 + for (ix = 0; ix < priv->max_nch; ix++) { 2445 2445 err = mlx5e_create_rqt(priv, 1 /*size */, &tirs[ix].rqt); 2446 2446 if (unlikely(err)) 2447 2447 goto err_destroy_rqts; ··· 2458 2460 2459 2461 void mlx5e_destroy_direct_rqts(struct mlx5e_priv *priv, struct mlx5e_tir *tirs) 2460 2462 { 2461 - const int max_nch = mlx5e_get_netdev_max_channels(priv->netdev); 2462 2463 int i; 2463 2464 2464 - for (i = 0; i < max_nch; i++) 2465 + for (i = 0; i < priv->max_nch; i++) 2465 2466 mlx5e_destroy_rqt(priv, &tirs[i].rqt); 2466 2467 } 2467 2468 ··· 2554 2557 mlx5e_redirect_rqt(priv, rqtn, MLX5E_INDIR_RQT_SIZE, rrp); 2555 2558 } 2556 2559 2557 - for (ix = 0; ix < mlx5e_get_netdev_max_channels(priv->netdev); ix++) { 2560 + for (ix = 0; ix < priv->max_nch; ix++) { 2558 2561 struct mlx5e_redirect_rqt_param direct_rrp = { 2559 2562 .is_rss = false, 2560 2563 { ··· 2755 2758 goto free_in; 2756 2759 } 2757 2760 2758 - for (ix = 0; ix < mlx5e_get_netdev_max_channels(priv->netdev); ix++) { 2761 + for (ix = 0; ix < priv->max_nch; ix++) { 2759 2762 err = mlx5_core_modify_tir(mdev, priv->direct_tir[ix].tirn, 2760 2763 in, inlen); 2761 2764 if (err) ··· 2855 2858 2856 2859 static void mlx5e_build_tc2txq_maps(struct mlx5e_priv *priv) 2857 2860 { 2858 - int max_nch = mlx5e_get_netdev_max_channels(priv->netdev); 2859 2861 int i, tc; 2860 2862 2861 - for (i = 0; i < max_nch; i++) 2863 + for (i = 0; i < priv->max_nch; i++) 2862 2864 for (tc = 0; tc < priv->profile->max_tc; tc++) 2863 - priv->channel_tc2txq[i][tc] = i + tc * max_nch; 2865 + priv->channel_tc2txq[i][tc] = i + tc * priv->max_nch; 2864 2866 } 2865 2867 2866 2868 static void mlx5e_build_tx2sq_maps(struct mlx5e_priv *priv) ··· 2880 2884 void mlx5e_activate_priv_channels(struct mlx5e_priv *priv) 2881 2885 { 2882 2886 int num_txqs = priv->channels.num * priv->channels.params.num_tc; 2883 - int num_rxqs = priv->channels.num * MLX5E_NUM_RQ_GROUPS; 2887 + int num_rxqs = priv->channels.num * priv->profile->rq_groups; 2884 2888 struct net_device *netdev = priv->netdev; 2885 2889 2886 2890 mlx5e_netdev_set_tcs(netdev); ··· 3302 3306 3303 3307 int mlx5e_create_direct_tirs(struct mlx5e_priv *priv, struct mlx5e_tir *tirs) 3304 3308 { 3305 - const int max_nch = mlx5e_get_netdev_max_channels(priv->netdev); 3306 3309 struct mlx5e_tir *tir; 3307 3310 void *tirc; 3308 3311 int inlen; ··· 3314 3319 if (!in) 3315 3320 return -ENOMEM; 3316 3321 3317 - for (ix = 0; ix < max_nch; ix++) { 3322 + for (ix = 0; ix < priv->max_nch; ix++) { 3318 3323 memset(in, 0, inlen); 3319 3324 tir = &tirs[ix]; 3320 3325 tirc = MLX5_ADDR_OF(create_tir_in, in, ctx); ··· 3353 3358 3354 3359 void mlx5e_destroy_direct_tirs(struct mlx5e_priv *priv, struct mlx5e_tir *tirs) 3355 3360 { 3356 - const int max_nch = mlx5e_get_netdev_max_channels(priv->netdev); 3357 3361 int i; 3358 3362 3359 - for (i = 0; i < max_nch; i++) 3363 + for (i = 0; i < priv->max_nch; i++) 3360 3364 mlx5e_destroy_tir(priv->mdev, &tirs[i]); 3361 3365 } 3362 3366 ··· 3481 3487 { 3482 3488 int i; 3483 3489 3484 - for (i = 0; i < mlx5e_get_netdev_max_channels(priv->netdev); i++) { 3490 + for (i = 0; i < priv->max_nch; i++) { 3485 3491 struct mlx5e_channel_stats *channel_stats = &priv->channel_stats[i]; 3486 3492 struct mlx5e_rq_stats *xskrq_stats = &channel_stats->xskrq; 3487 3493 struct mlx5e_rq_stats *rq_stats = &channel_stats->rq; ··· 4954 4960 return err; 4955 4961 4956 4962 mlx5e_build_nic_params(mdev, &priv->xsk, rss, &priv->channels.params, 4957 - mlx5e_get_netdev_max_channels(netdev), 4958 - netdev->mtu); 4963 + priv->max_nch, netdev->mtu); 4959 4964 4960 4965 mlx5e_timestamp_init(priv); 4961 4966 ··· 5157 5164 .rx_handlers.handle_rx_cqe = mlx5e_handle_rx_cqe, 5158 5165 .rx_handlers.handle_rx_cqe_mpwqe = mlx5e_handle_rx_cqe_mpwrq, 5159 5166 .max_tc = MLX5E_MAX_NUM_TC, 5167 + .rq_groups = MLX5E_NUM_RQ_GROUPS(XSK), 5160 5168 }; 5161 5169 5162 5170 /* mlx5e generic netdev management API (move to en_common.c) */ ··· 5175 5181 priv->profile = profile; 5176 5182 priv->ppriv = ppriv; 5177 5183 priv->msglevel = MLX5E_MSG_LEVEL; 5184 + priv->max_nch = netdev->num_rx_queues / max_t(u8, profile->rq_groups, 1); 5178 5185 priv->max_opened_tc = 1; 5179 5186 5180 5187 mutex_init(&priv->state_lock); ··· 5213 5218 5214 5219 netdev = alloc_etherdev_mqs(sizeof(struct mlx5e_priv), 5215 5220 nch * profile->max_tc, 5216 - nch * MLX5E_NUM_RQ_GROUPS); 5221 + nch * profile->rq_groups); 5217 5222 if (!netdev) { 5218 5223 mlx5_core_err(mdev, "alloc_etherdev_mqs() failed\n"); 5219 5224 return NULL;
+2
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
··· 1701 1701 .rx_handlers.handle_rx_cqe = mlx5e_handle_rx_cqe_rep, 1702 1702 .rx_handlers.handle_rx_cqe_mpwqe = mlx5e_handle_rx_cqe_mpwrq, 1703 1703 .max_tc = 1, 1704 + .rq_groups = MLX5E_NUM_RQ_GROUPS(REGULAR), 1704 1705 }; 1705 1706 1706 1707 static const struct mlx5e_profile mlx5e_uplink_rep_profile = { ··· 1719 1718 .rx_handlers.handle_rx_cqe = mlx5e_handle_rx_cqe_rep, 1720 1719 .rx_handlers.handle_rx_cqe_mpwqe = mlx5e_handle_rx_cqe_mpwrq, 1721 1720 .max_tc = MLX5E_MAX_NUM_TC, 1721 + .rq_groups = MLX5E_NUM_RQ_GROUPS(REGULAR), 1722 1722 }; 1723 1723 1724 1724 static bool
+4 -4
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
··· 172 172 173 173 memset(s, 0, sizeof(*s)); 174 174 175 - for (i = 0; i < mlx5e_get_netdev_max_channels(priv->netdev); i++) { 175 + for (i = 0; i < priv->max_nch; i++) { 176 176 struct mlx5e_channel_stats *channel_stats = 177 177 &priv->channel_stats[i]; 178 178 struct mlx5e_xdpsq_stats *xdpsq_red_stats = &channel_stats->xdpsq; ··· 1395 1395 1396 1396 static int mlx5e_grp_channels_get_num_stats(struct mlx5e_priv *priv) 1397 1397 { 1398 - int max_nch = mlx5e_get_netdev_max_channels(priv->netdev); 1398 + int max_nch = priv->max_nch; 1399 1399 1400 1400 return (NUM_RQ_STATS * max_nch) + 1401 1401 (NUM_CH_STATS * max_nch) + ··· 1409 1409 static int mlx5e_grp_channels_fill_strings(struct mlx5e_priv *priv, u8 *data, 1410 1410 int idx) 1411 1411 { 1412 - int max_nch = mlx5e_get_netdev_max_channels(priv->netdev); 1413 1412 bool is_xsk = priv->xsk.ever_used; 1413 + int max_nch = priv->max_nch; 1414 1414 int i, j, tc; 1415 1415 1416 1416 for (i = 0; i < max_nch; i++) ··· 1452 1452 static int mlx5e_grp_channels_fill_stats(struct mlx5e_priv *priv, u64 *data, 1453 1453 int idx) 1454 1454 { 1455 - int max_nch = mlx5e_get_netdev_max_channels(priv->netdev); 1456 1455 bool is_xsk = priv->xsk.ever_used; 1456 + int max_nch = priv->max_nch; 1457 1457 int i, j, tc; 1458 1458 1459 1459 for (i = 0; i < max_nch; i++)
+2 -2
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
··· 1230 1230 void mlx5e_tc_update_neigh_used_value(struct mlx5e_neigh_hash_entry *nhe) 1231 1231 { 1232 1232 struct mlx5e_neigh *m_neigh = &nhe->m_neigh; 1233 - u64 bytes, packets, lastuse = 0; 1234 1233 struct mlx5e_tc_flow *flow; 1235 1234 struct mlx5e_encap_entry *e; 1236 1235 struct mlx5_fc *counter; 1237 1236 struct neigh_table *tbl; 1238 1237 bool neigh_used = false; 1239 1238 struct neighbour *n; 1239 + u64 lastuse; 1240 1240 1241 1241 if (m_neigh->family == AF_INET) 1242 1242 tbl = &arp_tbl; ··· 1256 1256 encaps[efi->index]); 1257 1257 if (flow->flags & MLX5E_TC_FLOW_OFFLOADED) { 1258 1258 counter = mlx5e_tc_get_counter(flow); 1259 - mlx5_fc_query_cached(counter, &bytes, &packets, &lastuse); 1259 + lastuse = mlx5_fc_query_lastuse(counter); 1260 1260 if (time_after((unsigned long)lastuse, nhe->reported_lastuse)) { 1261 1261 neigh_used = true; 1262 1262 break;
+2 -2
drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
··· 49 49 static void mlx5e_handle_tx_dim(struct mlx5e_txqsq *sq) 50 50 { 51 51 struct mlx5e_sq_stats *stats = sq->stats; 52 - struct dim_sample dim_sample; 52 + struct dim_sample dim_sample = {}; 53 53 54 54 if (unlikely(!test_bit(MLX5E_SQ_STATE_AM, &sq->state))) 55 55 return; ··· 61 61 static void mlx5e_handle_rx_dim(struct mlx5e_rq *rq) 62 62 { 63 63 struct mlx5e_rq_stats *stats = rq->stats; 64 - struct dim_sample dim_sample; 64 + struct dim_sample dim_sample = {}; 65 65 66 66 if (unlikely(!test_bit(MLX5E_RQ_STATE_AM, &rq->state))) 67 67 return;
+3 -2
drivers/net/ethernet/mellanox/mlx5/core/fs_core.h
··· 68 68 FS_FT_SNIFFER_RX = 0X5, 69 69 FS_FT_SNIFFER_TX = 0X6, 70 70 FS_FT_RDMA_RX = 0X7, 71 - FS_FT_MAX_TYPE = FS_FT_SNIFFER_TX, 71 + FS_FT_MAX_TYPE = FS_FT_RDMA_RX, 72 72 }; 73 73 74 74 enum fs_flow_table_op_mod { ··· 275 275 (type == FS_FT_FDB) ? MLX5_CAP_ESW_FLOWTABLE_FDB(mdev, cap) : \ 276 276 (type == FS_FT_SNIFFER_RX) ? MLX5_CAP_FLOWTABLE_SNIFFER_RX(mdev, cap) : \ 277 277 (type == FS_FT_SNIFFER_TX) ? MLX5_CAP_FLOWTABLE_SNIFFER_TX(mdev, cap) : \ 278 - (BUILD_BUG_ON_ZERO(FS_FT_SNIFFER_TX != FS_FT_MAX_TYPE))\ 278 + (type == FS_FT_RDMA_RX) ? MLX5_CAP_FLOWTABLE_RDMA_RX(mdev, cap) : \ 279 + (BUILD_BUG_ON_ZERO(FS_FT_RDMA_RX != FS_FT_MAX_TYPE))\ 279 280 ) 280 281 281 282 #endif
+5
drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c
··· 369 369 } 370 370 EXPORT_SYMBOL(mlx5_fc_query); 371 371 372 + u64 mlx5_fc_query_lastuse(struct mlx5_fc *counter) 373 + { 374 + return counter->cache.lastuse; 375 + } 376 + 372 377 void mlx5_fc_query_cached(struct mlx5_fc *counter, 373 378 u64 *bytes, u64 *packets, u64 *lastuse) 374 379 {
+3 -4
drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
··· 88 88 netdev->mtu = netdev->max_mtu; 89 89 90 90 mlx5e_build_nic_params(mdev, NULL, &priv->rss_params, &priv->channels.params, 91 - mlx5e_get_netdev_max_channels(netdev), 92 - netdev->mtu); 91 + priv->max_nch, netdev->mtu); 93 92 mlx5i_build_nic_params(mdev, &priv->channels.params); 94 93 95 94 mlx5e_timestamp_init(priv); ··· 117 118 118 119 static void mlx5i_grp_sw_update_stats(struct mlx5e_priv *priv) 119 120 { 120 - int max_nch = mlx5e_get_netdev_max_channels(priv->netdev); 121 121 struct mlx5e_sw_stats s = { 0 }; 122 122 int i, j; 123 123 124 - for (i = 0; i < max_nch; i++) { 124 + for (i = 0; i < priv->max_nch; i++) { 125 125 struct mlx5e_channel_stats *channel_stats; 126 126 struct mlx5e_rq_stats *rq_stats; 127 127 ··· 434 436 .rx_handlers.handle_rx_cqe = mlx5i_handle_rx_cqe, 435 437 .rx_handlers.handle_rx_cqe_mpwqe = NULL, /* Not supported */ 436 438 .max_tc = MLX5I_MAX_NUM_TC, 439 + .rq_groups = MLX5E_NUM_RQ_GROUPS(REGULAR), 437 440 }; 438 441 439 442 /* mlx5i netdev NDos */
+1
drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c
··· 355 355 .rx_handlers.handle_rx_cqe = mlx5i_handle_rx_cqe, 356 356 .rx_handlers.handle_rx_cqe_mpwqe = NULL, /* Not supported */ 357 357 .max_tc = MLX5I_MAX_NUM_TC, 358 + .rq_groups = MLX5E_NUM_RQ_GROUPS(REGULAR), 358 359 }; 359 360 360 361 const struct mlx5e_profile *mlx5i_pkey_get_profile(void)
+1 -1
drivers/net/ethernet/mellanox/mlxsw/spectrum.c
··· 6330 6330 return 0; 6331 6331 6332 6332 err_sp2_pci_driver_register: 6333 - mlxsw_pci_driver_unregister(&mlxsw_sp2_pci_driver); 6333 + mlxsw_pci_driver_unregister(&mlxsw_sp1_pci_driver); 6334 6334 err_sp1_pci_driver_register: 6335 6335 mlxsw_core_driver_unregister(&mlxsw_sp2_driver); 6336 6336 err_sp2_core_driver_register:
+4
drivers/net/ethernet/mellanox/mlxsw/spectrum.h
··· 951 951 int mlxsw_sp_nve_init(struct mlxsw_sp *mlxsw_sp); 952 952 void mlxsw_sp_nve_fini(struct mlxsw_sp *mlxsw_sp); 953 953 954 + /* spectrum_nve_vxlan.c */ 955 + int mlxsw_sp_nve_inc_parsing_depth_get(struct mlxsw_sp *mlxsw_sp); 956 + void mlxsw_sp_nve_inc_parsing_depth_put(struct mlxsw_sp *mlxsw_sp); 957 + 954 958 #endif
+2 -2
drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c
··· 437 437 MLXSW_SP1_SB_PR_CPU_SIZE, true, false), 438 438 }; 439 439 440 - #define MLXSW_SP2_SB_PR_INGRESS_SIZE 38128752 441 - #define MLXSW_SP2_SB_PR_EGRESS_SIZE 38128752 440 + #define MLXSW_SP2_SB_PR_INGRESS_SIZE 35297568 441 + #define MLXSW_SP2_SB_PR_EGRESS_SIZE 35297568 442 442 #define MLXSW_SP2_SB_PR_CPU_SIZE (256 * 1000) 443 443 444 444 /* Order according to mlxsw_sp2_sb_pool_dess */
+1
drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c
··· 775 775 ops->fini(nve); 776 776 mlxsw_sp_kvdl_free(mlxsw_sp, MLXSW_SP_KVDL_ENTRY_TYPE_ADJ, 1, 777 777 nve->tunnel_index); 778 + memset(&nve->config, 0, sizeof(nve->config)); 778 779 } 779 780 nve->num_nve_tunnels--; 780 781 }
+1
drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.h
··· 29 29 unsigned int num_max_mc_entries[MLXSW_SP_L3_PROTO_MAX]; 30 30 u32 tunnel_index; 31 31 u16 ul_rif_index; /* Reserved for Spectrum */ 32 + unsigned int inc_parsing_depth_refs; 32 33 }; 33 34 34 35 struct mlxsw_sp_nve_ops {
+59 -17
drivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c
··· 103 103 config->udp_dport = cfg->dst_port; 104 104 } 105 105 106 - static int mlxsw_sp_nve_parsing_set(struct mlxsw_sp *mlxsw_sp, 107 - unsigned int parsing_depth, 108 - __be16 udp_dport) 106 + static int __mlxsw_sp_nve_parsing_set(struct mlxsw_sp *mlxsw_sp, 107 + unsigned int parsing_depth, 108 + __be16 udp_dport) 109 109 { 110 110 char mprs_pl[MLXSW_REG_MPRS_LEN]; 111 111 112 112 mlxsw_reg_mprs_pack(mprs_pl, parsing_depth, be16_to_cpu(udp_dport)); 113 113 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(mprs), mprs_pl); 114 + } 115 + 116 + static int mlxsw_sp_nve_parsing_set(struct mlxsw_sp *mlxsw_sp, 117 + __be16 udp_dport) 118 + { 119 + int parsing_depth = mlxsw_sp->nve->inc_parsing_depth_refs ? 120 + MLXSW_SP_NVE_VXLAN_PARSING_DEPTH : 121 + MLXSW_SP_NVE_DEFAULT_PARSING_DEPTH; 122 + 123 + return __mlxsw_sp_nve_parsing_set(mlxsw_sp, parsing_depth, udp_dport); 124 + } 125 + 126 + static int 127 + __mlxsw_sp_nve_inc_parsing_depth_get(struct mlxsw_sp *mlxsw_sp, 128 + __be16 udp_dport) 129 + { 130 + int err; 131 + 132 + mlxsw_sp->nve->inc_parsing_depth_refs++; 133 + 134 + err = mlxsw_sp_nve_parsing_set(mlxsw_sp, udp_dport); 135 + if (err) 136 + goto err_nve_parsing_set; 137 + return 0; 138 + 139 + err_nve_parsing_set: 140 + mlxsw_sp->nve->inc_parsing_depth_refs--; 141 + return err; 142 + } 143 + 144 + static void 145 + __mlxsw_sp_nve_inc_parsing_depth_put(struct mlxsw_sp *mlxsw_sp, 146 + __be16 udp_dport) 147 + { 148 + mlxsw_sp->nve->inc_parsing_depth_refs--; 149 + mlxsw_sp_nve_parsing_set(mlxsw_sp, udp_dport); 150 + } 151 + 152 + int mlxsw_sp_nve_inc_parsing_depth_get(struct mlxsw_sp *mlxsw_sp) 153 + { 154 + __be16 udp_dport = mlxsw_sp->nve->config.udp_dport; 155 + 156 + return __mlxsw_sp_nve_inc_parsing_depth_get(mlxsw_sp, udp_dport); 157 + } 158 + 159 + void mlxsw_sp_nve_inc_parsing_depth_put(struct mlxsw_sp *mlxsw_sp) 160 + { 161 + __be16 udp_dport = mlxsw_sp->nve->config.udp_dport; 162 + 163 + __mlxsw_sp_nve_inc_parsing_depth_put(mlxsw_sp, udp_dport); 114 164 } 115 165 116 166 static void ··· 226 176 struct mlxsw_sp *mlxsw_sp = nve->mlxsw_sp; 227 177 int err; 228 178 229 - err = mlxsw_sp_nve_parsing_set(mlxsw_sp, 230 - MLXSW_SP_NVE_VXLAN_PARSING_DEPTH, 231 - config->udp_dport); 179 + err = __mlxsw_sp_nve_inc_parsing_depth_get(mlxsw_sp, config->udp_dport); 232 180 if (err) 233 181 return err; 234 182 ··· 251 203 err_rtdp_set: 252 204 mlxsw_sp1_nve_vxlan_config_clear(mlxsw_sp); 253 205 err_config_set: 254 - mlxsw_sp_nve_parsing_set(mlxsw_sp, MLXSW_SP_NVE_DEFAULT_PARSING_DEPTH, 255 - config->udp_dport); 206 + __mlxsw_sp_nve_inc_parsing_depth_put(mlxsw_sp, 0); 256 207 return err; 257 208 } 258 209 ··· 263 216 mlxsw_sp_router_nve_demote_decap(mlxsw_sp, config->ul_tb_id, 264 217 config->ul_proto, &config->ul_sip); 265 218 mlxsw_sp1_nve_vxlan_config_clear(mlxsw_sp); 266 - mlxsw_sp_nve_parsing_set(mlxsw_sp, MLXSW_SP_NVE_DEFAULT_PARSING_DEPTH, 267 - config->udp_dport); 219 + __mlxsw_sp_nve_inc_parsing_depth_put(mlxsw_sp, 0); 268 220 } 269 221 270 222 static int ··· 366 320 struct mlxsw_sp *mlxsw_sp = nve->mlxsw_sp; 367 321 int err; 368 322 369 - err = mlxsw_sp_nve_parsing_set(mlxsw_sp, 370 - MLXSW_SP_NVE_VXLAN_PARSING_DEPTH, 371 - config->udp_dport); 323 + err = __mlxsw_sp_nve_inc_parsing_depth_get(mlxsw_sp, config->udp_dport); 372 324 if (err) 373 325 return err; 374 326 ··· 392 348 err_rtdp_set: 393 349 mlxsw_sp2_nve_vxlan_config_clear(mlxsw_sp); 394 350 err_config_set: 395 - mlxsw_sp_nve_parsing_set(mlxsw_sp, MLXSW_SP_NVE_DEFAULT_PARSING_DEPTH, 396 - config->udp_dport); 351 + __mlxsw_sp_nve_inc_parsing_depth_put(mlxsw_sp, 0); 397 352 return err; 398 353 } 399 354 ··· 404 361 mlxsw_sp_router_nve_demote_decap(mlxsw_sp, config->ul_tb_id, 405 362 config->ul_proto, &config->ul_sip); 406 363 mlxsw_sp2_nve_vxlan_config_clear(mlxsw_sp); 407 - mlxsw_sp_nve_parsing_set(mlxsw_sp, MLXSW_SP_NVE_DEFAULT_PARSING_DEPTH, 408 - config->udp_dport); 364 + __mlxsw_sp_nve_inc_parsing_depth_put(mlxsw_sp, 0); 409 365 } 410 366 411 367 const struct mlxsw_sp_nve_ops mlxsw_sp2_nve_vxlan_ops = {
+17
drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c
··· 979 979 { 980 980 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; 981 981 struct mlxsw_sp_port *tmp; 982 + u16 orig_ing_types = 0; 983 + u16 orig_egr_types = 0; 984 + int err; 982 985 int i; 983 986 984 987 /* MTPPPC configures timestamping globally, not per port. Find the ··· 989 986 */ 990 987 for (i = 1; i < mlxsw_core_max_ports(mlxsw_sp->core); i++) { 991 988 tmp = mlxsw_sp->ports[i]; 989 + if (tmp) { 990 + orig_ing_types |= tmp->ptp.ing_types; 991 + orig_egr_types |= tmp->ptp.egr_types; 992 + } 992 993 if (tmp && tmp != mlxsw_sp_port) { 993 994 ing_types |= tmp->ptp.ing_types; 994 995 egr_types |= tmp->ptp.egr_types; 995 996 } 996 997 } 998 + 999 + if ((ing_types || egr_types) && !(orig_ing_types || orig_egr_types)) { 1000 + err = mlxsw_sp_nve_inc_parsing_depth_get(mlxsw_sp); 1001 + if (err) { 1002 + netdev_err(mlxsw_sp_port->dev, "Failed to increase parsing depth"); 1003 + return err; 1004 + } 1005 + } 1006 + if (!(ing_types || egr_types) && (orig_ing_types || orig_egr_types)) 1007 + mlxsw_sp_nve_inc_parsing_depth_put(mlxsw_sp); 997 1008 998 1009 return mlxsw_sp1_ptp_mtpppc_set(mlxsw_sp_port->mlxsw_sp, 999 1010 ing_types, egr_types);
+1
drivers/net/ethernet/mscc/ocelot.c
··· 1818 1818 1819 1819 void ocelot_deinit(struct ocelot *ocelot) 1820 1820 { 1821 + cancel_delayed_work(&ocelot->stats_work); 1821 1822 destroy_workqueue(ocelot->stats_queue); 1822 1823 mutex_destroy(&ocelot->stats_lock); 1823 1824 ocelot_ace_deinit();
+2 -2
drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
··· 444 444 data = nfp_pr_et(data, "hw_rx_csum_complete"); 445 445 data = nfp_pr_et(data, "hw_rx_csum_err"); 446 446 data = nfp_pr_et(data, "rx_replace_buf_alloc_fail"); 447 - data = nfp_pr_et(data, "rx_tls_decrypted"); 447 + data = nfp_pr_et(data, "rx_tls_decrypted_packets"); 448 448 data = nfp_pr_et(data, "hw_tx_csum"); 449 449 data = nfp_pr_et(data, "hw_tx_inner_csum"); 450 450 data = nfp_pr_et(data, "tx_gather"); 451 451 data = nfp_pr_et(data, "tx_lso"); 452 - data = nfp_pr_et(data, "tx_tls_encrypted"); 452 + data = nfp_pr_et(data, "tx_tls_encrypted_packets"); 453 453 data = nfp_pr_et(data, "tx_tls_ooo"); 454 454 data = nfp_pr_et(data, "tx_tls_drop_no_sync_data"); 455 455
+1 -1
drivers/net/ethernet/ni/Kconfig
··· 11 11 12 12 Note that the answer to this question doesn't directly affect the 13 13 kernel: saying N will just cause the configurator to skip all 14 - the questions about National Instrument devices. 14 + the questions about National Instruments devices. 15 15 If you say Y, you will be asked for your specific device in the 16 16 following questions. 17 17
+3 -3
drivers/net/ethernet/packetengines/Kconfig
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 # 3 - # Packet engine device configuration 3 + # Packet Engines device configuration 4 4 # 5 5 6 6 config NET_VENDOR_PACKET_ENGINES 7 - bool "Packet Engine devices" 7 + bool "Packet Engines devices" 8 8 default y 9 9 depends on PCI 10 10 ---help--- ··· 12 12 13 13 Note that the answer to this question doesn't directly affect the 14 14 kernel: saying N will just cause the configurator to skip all 15 - the questions about packet engine devices. If you say Y, you will 15 + the questions about Packet Engines devices. If you say Y, you will 16 16 be asked for your specific card in the following questions. 17 17 18 18 if NET_VENDOR_PACKET_ENGINES
+1 -1
drivers/net/ethernet/packetengines/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 # 3 - # Makefile for the Packet Engine network device drivers. 3 + # Makefile for the Packet Engines network device drivers. 4 4 # 5 5 6 6 obj-$(CONFIG_HAMACHI) += hamachi.o
+1 -1
drivers/net/ethernet/qlogic/qed/qed_int.c
··· 1093 1093 snprintf(bit_name, 30, 1094 1094 p_aeu->bit_name, num); 1095 1095 else 1096 - strncpy(bit_name, 1096 + strlcpy(bit_name, 1097 1097 p_aeu->bit_name, 30); 1098 1098 1099 1099 /* We now need to pass bitmask in its
+1 -1
drivers/net/ethernet/qlogic/qed/qed_rdma.c
··· 442 442 /* Vendor specific information */ 443 443 dev->vendor_id = cdev->vendor_id; 444 444 dev->vendor_part_id = cdev->device_id; 445 - dev->hw_ver = 0; 445 + dev->hw_ver = cdev->chip_rev; 446 446 dev->fw_ver = (FW_MAJOR_VERSION << 24) | (FW_MINOR_VERSION << 16) | 447 447 (FW_REVISION_VERSION << 8) | (FW_ENGINEERING_VERSION); 448 448
+9 -4
drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
··· 206 206 ul_header->csum_insert_offset = skb->csum_offset; 207 207 ul_header->csum_enabled = 1; 208 208 if (ip4h->protocol == IPPROTO_UDP) 209 - ul_header->udp_ip4_ind = 1; 209 + ul_header->udp_ind = 1; 210 210 else 211 - ul_header->udp_ip4_ind = 0; 211 + ul_header->udp_ind = 0; 212 212 213 213 /* Changing remaining fields to network order */ 214 214 hdr++; ··· 239 239 struct rmnet_map_ul_csum_header *ul_header, 240 240 struct sk_buff *skb) 241 241 { 242 + struct ipv6hdr *ip6h = (struct ipv6hdr *)ip6hdr; 242 243 __be16 *hdr = (__be16 *)ul_header, offset; 243 244 244 245 offset = htons((__force u16)(skb_transport_header(skb) - ··· 247 246 ul_header->csum_start_offset = offset; 248 247 ul_header->csum_insert_offset = skb->csum_offset; 249 248 ul_header->csum_enabled = 1; 250 - ul_header->udp_ip4_ind = 0; 249 + 250 + if (ip6h->nexthdr == IPPROTO_UDP) 251 + ul_header->udp_ind = 1; 252 + else 253 + ul_header->udp_ind = 0; 251 254 252 255 /* Changing remaining fields to network order */ 253 256 hdr++; ··· 424 419 ul_header->csum_start_offset = 0; 425 420 ul_header->csum_insert_offset = 0; 426 421 ul_header->csum_enabled = 0; 427 - ul_header->udp_ip4_ind = 0; 422 + ul_header->udp_ind = 0; 428 423 429 424 priv->stats.csum_sw++; 430 425 }
+8 -6
drivers/net/ethernet/realtek/r8169_main.c
··· 6136 6136 if (ret) 6137 6137 return ret; 6138 6138 6139 - if (tp->supports_gmii) 6140 - phy_remove_link_mode(phydev, 6141 - ETHTOOL_LINK_MODE_1000baseT_Half_BIT); 6142 - else 6139 + if (!tp->supports_gmii) 6143 6140 phy_set_max_speed(phydev, SPEED_100); 6144 6141 6145 6142 phy_support_asym_pause(phydev); ··· 6586 6589 { 6587 6590 unsigned int flags; 6588 6591 6589 - if (tp->mac_version <= RTL_GIGA_MAC_VER_06) { 6592 + switch (tp->mac_version) { 6593 + case RTL_GIGA_MAC_VER_02 ... RTL_GIGA_MAC_VER_06: 6590 6594 rtl_unlock_config_regs(tp); 6591 6595 RTL_W8(tp, Config2, RTL_R8(tp, Config2) & ~MSIEnable); 6592 6596 rtl_lock_config_regs(tp); 6597 + /* fall through */ 6598 + case RTL_GIGA_MAC_VER_07 ... RTL_GIGA_MAC_VER_24: 6593 6599 flags = PCI_IRQ_LEGACY; 6594 - } else { 6600 + break; 6601 + default: 6595 6602 flags = PCI_IRQ_ALL_TYPES; 6603 + break; 6596 6604 } 6597 6605 6598 6606 return pci_alloc_irq_vectors(tp->pci_dev, 1, 1, flags);
+2
drivers/net/ethernet/rocker/rocker_main.c
··· 2208 2208 2209 2209 if (fen_info->fi->fib_nh_is_v6) { 2210 2210 NL_SET_ERR_MSG_MOD(info->extack, "IPv6 gateway with IPv4 route is not supported"); 2211 + kfree(fib_work); 2211 2212 return notifier_from_errno(-EINVAL); 2212 2213 } 2213 2214 if (fen_info->fi->nh) { 2214 2215 NL_SET_ERR_MSG_MOD(info->extack, "IPv4 route with nexthop objects is not supported"); 2216 + kfree(fib_work); 2215 2217 return notifier_from_errno(-EINVAL); 2216 2218 } 2217 2219 }
+1 -1
drivers/net/ethernet/samsung/Kconfig
··· 11 11 say Y. 12 12 13 13 Note that the answer to this question does not directly affect 14 - the kernel: saying N will just case the configurator to skip all 14 + the kernel: saying N will just cause the configurator to skip all 15 15 the questions about Samsung chipsets. If you say Y, you will be asked 16 16 for your specific chipset/driver in the following questions. 17 17
+1
drivers/net/ethernet/smsc/smc911x.c
··· 712 712 /* Found an external PHY */ 713 713 break; 714 714 } 715 + /* Else, fall through */ 715 716 default: 716 717 /* Internal media only */ 717 718 SMC_GET_PHY_ID1(lp, 1, id1);
+4
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
··· 85 85 u32 value; 86 86 87 87 base_register = (queue < 4) ? GMAC_RXQ_CTRL2 : GMAC_RXQ_CTRL3; 88 + if (queue >= 4) 89 + queue -= 4; 88 90 89 91 value = readl(ioaddr + base_register); 90 92 ··· 104 102 u32 value; 105 103 106 104 base_register = (queue < 4) ? GMAC_TXQ_PRTY_MAP0 : GMAC_TXQ_PRTY_MAP1; 105 + if (queue >= 4) 106 + queue -= 4; 107 107 108 108 value = readl(ioaddr + base_register); 109 109
+5 -2
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h
··· 44 44 #define XGMAC_CORE_INIT_RX 0 45 45 #define XGMAC_PACKET_FILTER 0x00000008 46 46 #define XGMAC_FILTER_RA BIT(31) 47 + #define XGMAC_FILTER_HPF BIT(10) 47 48 #define XGMAC_FILTER_PCF BIT(7) 48 49 #define XGMAC_FILTER_PM BIT(4) 49 50 #define XGMAC_FILTER_HMC BIT(2) 50 51 #define XGMAC_FILTER_PR BIT(0) 51 52 #define XGMAC_HASH_TABLE(x) (0x00000010 + (x) * 4) 53 + #define XGMAC_MAX_HASH_TABLE 8 52 54 #define XGMAC_RXQ_CTRL0 0x000000a0 53 55 #define XGMAC_RXQEN(x) GENMASK((x) * 2 + 1, (x) * 2) 54 56 #define XGMAC_RXQEN_SHIFT(x) ((x) * 2) ··· 101 99 #define XGMAC_MDIO_ADDR 0x00000200 102 100 #define XGMAC_MDIO_DATA 0x00000204 103 101 #define XGMAC_MDIO_C22P 0x00000220 104 - #define XGMAC_ADDR0_HIGH 0x00000300 102 + #define XGMAC_ADDRx_HIGH(x) (0x00000300 + (x) * 0x8) 103 + #define XGMAC_ADDR_MAX 32 105 104 #define XGMAC_AE BIT(31) 106 105 #define XGMAC_DCS GENMASK(19, 16) 107 106 #define XGMAC_DCS_SHIFT 16 108 - #define XGMAC_ADDR0_LOW 0x00000304 107 + #define XGMAC_ADDRx_LOW(x) (0x00000304 + (x) * 0x8) 109 108 #define XGMAC_ARP_ADDR 0x00000c10 110 109 #define XGMAC_TIMESTAMP_STATUS 0x00000d20 111 110 #define XGMAC_TXTSC BIT(15)
+78 -9
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
··· 4 4 * stmmac XGMAC support. 5 5 */ 6 6 7 + #include <linux/bitrev.h> 8 + #include <linux/crc32.h> 7 9 #include "stmmac.h" 8 10 #include "dwxgmac2.h" 9 11 ··· 108 106 u32 value, reg; 109 107 110 108 reg = (queue < 4) ? XGMAC_RXQ_CTRL2 : XGMAC_RXQ_CTRL3; 109 + if (queue >= 4) 110 + queue -= 4; 111 111 112 112 value = readl(ioaddr + reg); 113 113 value &= ~XGMAC_PSRQ(queue); ··· 173 169 u32 value, reg; 174 170 175 171 reg = (queue < 4) ? XGMAC_MTL_RXQ_DMA_MAP0 : XGMAC_MTL_RXQ_DMA_MAP1; 172 + if (queue >= 4) 173 + queue -= 4; 176 174 177 175 value = readl(ioaddr + reg); 178 176 value &= ~XGMAC_QxMDMACH(queue); ··· 284 278 u32 value; 285 279 286 280 value = (addr[5] << 8) | addr[4]; 287 - writel(value | XGMAC_AE, ioaddr + XGMAC_ADDR0_HIGH); 281 + writel(value | XGMAC_AE, ioaddr + XGMAC_ADDRx_HIGH(reg_n)); 288 282 289 283 value = (addr[3] << 24) | (addr[2] << 16) | (addr[1] << 8) | addr[0]; 290 - writel(value, ioaddr + XGMAC_ADDR0_LOW); 284 + writel(value, ioaddr + XGMAC_ADDRx_LOW(reg_n)); 291 285 } 292 286 293 287 static void dwxgmac2_get_umac_addr(struct mac_device_info *hw, ··· 297 291 u32 hi_addr, lo_addr; 298 292 299 293 /* Read the MAC address from the hardware */ 300 - hi_addr = readl(ioaddr + XGMAC_ADDR0_HIGH); 301 - lo_addr = readl(ioaddr + XGMAC_ADDR0_LOW); 294 + hi_addr = readl(ioaddr + XGMAC_ADDRx_HIGH(reg_n)); 295 + lo_addr = readl(ioaddr + XGMAC_ADDRx_LOW(reg_n)); 302 296 303 297 /* Extract the MAC address from the high and low words */ 304 298 addr[0] = lo_addr & 0xff; ··· 309 303 addr[5] = (hi_addr >> 8) & 0xff; 310 304 } 311 305 306 + static void dwxgmac2_set_mchash(void __iomem *ioaddr, u32 *mcfilterbits, 307 + int mcbitslog2) 308 + { 309 + int numhashregs, regs; 310 + 311 + switch (mcbitslog2) { 312 + case 6: 313 + numhashregs = 2; 314 + break; 315 + case 7: 316 + numhashregs = 4; 317 + break; 318 + case 8: 319 + numhashregs = 8; 320 + break; 321 + default: 322 + return; 323 + } 324 + 325 + for (regs = 0; regs < numhashregs; regs++) 326 + writel(mcfilterbits[regs], ioaddr + XGMAC_HASH_TABLE(regs)); 327 + } 328 + 312 329 static void dwxgmac2_set_filter(struct mac_device_info *hw, 313 330 struct net_device *dev) 314 331 { 315 332 void __iomem *ioaddr = (void __iomem *)dev->base_addr; 316 - u32 value = XGMAC_FILTER_RA; 333 + u32 value = readl(ioaddr + XGMAC_PACKET_FILTER); 334 + int mcbitslog2 = hw->mcast_bits_log2; 335 + u32 mc_filter[8]; 336 + int i; 337 + 338 + value &= ~(XGMAC_FILTER_PR | XGMAC_FILTER_HMC | XGMAC_FILTER_PM); 339 + value |= XGMAC_FILTER_HPF; 340 + 341 + memset(mc_filter, 0, sizeof(mc_filter)); 317 342 318 343 if (dev->flags & IFF_PROMISC) { 319 - value |= XGMAC_FILTER_PR | XGMAC_FILTER_PCF; 344 + value |= XGMAC_FILTER_PR; 345 + value |= XGMAC_FILTER_PCF; 320 346 } else if ((dev->flags & IFF_ALLMULTI) || 321 - (netdev_mc_count(dev) > HASH_TABLE_SIZE)) { 347 + (netdev_mc_count(dev) > hw->multicast_filter_bins)) { 322 348 value |= XGMAC_FILTER_PM; 323 - writel(~0x0, ioaddr + XGMAC_HASH_TABLE(0)); 324 - writel(~0x0, ioaddr + XGMAC_HASH_TABLE(1)); 349 + 350 + for (i = 0; i < XGMAC_MAX_HASH_TABLE; i++) 351 + writel(~0x0, ioaddr + XGMAC_HASH_TABLE(i)); 352 + } else if (!netdev_mc_empty(dev)) { 353 + struct netdev_hw_addr *ha; 354 + 355 + value |= XGMAC_FILTER_HMC; 356 + 357 + netdev_for_each_mc_addr(ha, dev) { 358 + int nr = (bitrev32(~crc32_le(~0, ha->addr, 6)) >> 359 + (32 - mcbitslog2)); 360 + mc_filter[nr >> 5] |= (1 << (nr & 0x1F)); 361 + } 362 + } 363 + 364 + dwxgmac2_set_mchash(ioaddr, mc_filter, mcbitslog2); 365 + 366 + /* Handle multiple unicast addresses */ 367 + if (netdev_uc_count(dev) > XGMAC_ADDR_MAX) { 368 + value |= XGMAC_FILTER_PR; 369 + } else { 370 + struct netdev_hw_addr *ha; 371 + int reg = 1; 372 + 373 + netdev_for_each_uc_addr(ha, dev) { 374 + dwxgmac2_set_umac_addr(hw, ha->addr, reg); 375 + reg++; 376 + } 377 + 378 + for ( ; reg < XGMAC_ADDR_MAX; reg++) { 379 + writel(0, ioaddr + XGMAC_ADDRx_HIGH(reg)); 380 + writel(0, ioaddr + XGMAC_ADDRx_LOW(reg)); 381 + } 325 382 } 326 383 327 384 writel(value, ioaddr + XGMAC_PACKET_FILTER);
+26 -24
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
··· 814 814 phylink_set(mac_supported, 10baseT_Full); 815 815 phylink_set(mac_supported, 100baseT_Half); 816 816 phylink_set(mac_supported, 100baseT_Full); 817 + phylink_set(mac_supported, 1000baseT_Half); 818 + phylink_set(mac_supported, 1000baseT_Full); 819 + phylink_set(mac_supported, 1000baseKX_Full); 817 820 818 821 phylink_set(mac_supported, Autoneg); 819 822 phylink_set(mac_supported, Pause); 820 823 phylink_set(mac_supported, Asym_Pause); 821 824 phylink_set_port_modes(mac_supported); 822 - 823 - if (priv->plat->has_gmac || 824 - priv->plat->has_gmac4 || 825 - priv->plat->has_xgmac) { 826 - phylink_set(mac_supported, 1000baseT_Half); 827 - phylink_set(mac_supported, 1000baseT_Full); 828 - phylink_set(mac_supported, 1000baseKX_Full); 829 - } 830 825 831 826 /* Cut down 1G if asked to */ 832 827 if ((max_speed > 0) && (max_speed < 1000)) { ··· 1290 1295 "(%s) dma_rx_phy=0x%08x\n", __func__, 1291 1296 (u32)rx_q->dma_rx_phy); 1292 1297 1298 + stmmac_clear_rx_descriptors(priv, queue); 1299 + 1293 1300 for (i = 0; i < DMA_RX_SIZE; i++) { 1294 1301 struct dma_desc *p; 1295 1302 ··· 1308 1311 1309 1312 rx_q->cur_rx = 0; 1310 1313 rx_q->dirty_rx = (unsigned int)(i - DMA_RX_SIZE); 1311 - 1312 - stmmac_clear_rx_descriptors(priv, queue); 1313 1314 1314 1315 /* Setup the chained descriptor addresses */ 1315 1316 if (priv->mode == STMMAC_CHAIN_MODE) { ··· 1550 1555 goto err_dma; 1551 1556 } 1552 1557 1553 - rx_q->buf_pool = kmalloc_array(DMA_RX_SIZE, 1554 - sizeof(*rx_q->buf_pool), 1555 - GFP_KERNEL); 1558 + rx_q->buf_pool = kcalloc(DMA_RX_SIZE, sizeof(*rx_q->buf_pool), 1559 + GFP_KERNEL); 1556 1560 if (!rx_q->buf_pool) 1557 1561 goto err_dma; 1558 1562 ··· 1602 1608 tx_q->queue_index = queue; 1603 1609 tx_q->priv_data = priv; 1604 1610 1605 - tx_q->tx_skbuff_dma = kmalloc_array(DMA_TX_SIZE, 1606 - sizeof(*tx_q->tx_skbuff_dma), 1607 - GFP_KERNEL); 1611 + tx_q->tx_skbuff_dma = kcalloc(DMA_TX_SIZE, 1612 + sizeof(*tx_q->tx_skbuff_dma), 1613 + GFP_KERNEL); 1608 1614 if (!tx_q->tx_skbuff_dma) 1609 1615 goto err_dma; 1610 1616 1611 - tx_q->tx_skbuff = kmalloc_array(DMA_TX_SIZE, 1612 - sizeof(struct sk_buff *), 1613 - GFP_KERNEL); 1617 + tx_q->tx_skbuff = kcalloc(DMA_TX_SIZE, 1618 + sizeof(struct sk_buff *), 1619 + GFP_KERNEL); 1614 1620 if (!tx_q->tx_skbuff) 1615 1621 goto err_dma; 1616 1622 ··· 3271 3277 static inline void stmmac_rx_refill(struct stmmac_priv *priv, u32 queue) 3272 3278 { 3273 3279 struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue]; 3274 - int dirty = stmmac_rx_dirty(priv, queue); 3280 + int len, dirty = stmmac_rx_dirty(priv, queue); 3275 3281 unsigned int entry = rx_q->dirty_rx; 3282 + 3283 + len = DIV_ROUND_UP(priv->dma_buf_sz, PAGE_SIZE) * PAGE_SIZE; 3276 3284 3277 3285 while (dirty-- > 0) { 3278 3286 struct stmmac_rx_buffer *buf = &rx_q->buf_pool[entry]; ··· 3293 3297 } 3294 3298 3295 3299 buf->addr = page_pool_get_dma_addr(buf->page); 3300 + 3301 + /* Sync whole allocation to device. This will invalidate old 3302 + * data. 3303 + */ 3304 + dma_sync_single_for_device(priv->device, buf->addr, len, 3305 + DMA_FROM_DEVICE); 3306 + 3296 3307 stmmac_set_desc_addr(priv, p, buf->addr); 3297 3308 stmmac_refill_desc3(priv, rx_q, p); 3298 3309 ··· 3434 3431 skb_copy_to_linear_data(skb, page_address(buf->page), 3435 3432 frame_len); 3436 3433 skb_put(skb, frame_len); 3437 - dma_sync_single_for_device(priv->device, buf->addr, 3438 - frame_len, DMA_FROM_DEVICE); 3439 3434 3440 3435 if (netif_msg_pktdata(priv)) { 3441 3436 netdev_dbg(priv->dev, "frame received (%dbytes)", ··· 4320 4319 NAPI_POLL_WEIGHT); 4321 4320 } 4322 4321 if (queue < priv->plat->tx_queues_to_use) { 4323 - netif_napi_add(ndev, &ch->tx_napi, stmmac_napi_poll_tx, 4324 - NAPI_POLL_WEIGHT); 4322 + netif_tx_napi_add(ndev, &ch->tx_napi, 4323 + stmmac_napi_poll_tx, 4324 + NAPI_POLL_WEIGHT); 4325 4325 } 4326 4326 } 4327 4327
+7
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
··· 370 370 return ERR_PTR(-ENOMEM); 371 371 372 372 *mac = of_get_mac_address(np); 373 + if (IS_ERR(*mac)) { 374 + if (PTR_ERR(*mac) == -EPROBE_DEFER) 375 + return ERR_CAST(*mac); 376 + 377 + *mac = NULL; 378 + } 379 + 373 380 plat->interface = of_get_phy_mode(np); 374 381 375 382 /* Some wrapper drivers still rely on phy_node. Let's save it while
+1 -1
drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
··· 37 37 entry = &priv->tc_entries[i]; 38 38 if (!entry->in_use && !first && free) 39 39 first = entry; 40 - if (entry->handle == loc && !free) 40 + if ((entry->handle == loc) && !free && !entry->is_frag) 41 41 dup = entry; 42 42 } 43 43
+1
drivers/net/ethernet/toshiba/spider_net.c
··· 788 788 /* fallthrough, if we release the descriptors 789 789 * brutally (then we don't care about 790 790 * SPIDER_NET_DESCR_CARDOWNED) */ 791 + /* Fall through */ 791 792 792 793 case SPIDER_NET_DESCR_RESPONSE_ERROR: 793 794 case SPIDER_NET_DESCR_PROTECTION_ERROR:
+1 -1
drivers/net/ethernet/xscale/Kconfig
··· 13 13 14 14 Note that the answer to this question does not directly affect the 15 15 kernel: saying N will just cause the configurator to skip all 16 - the questions about XSacle IXP devices. If you say Y, you will be 16 + the questions about XScale IXP devices. If you say Y, you will be 17 17 asked for your specific card in the following questions. 18 18 19 19 if NET_VENDOR_XSCALE
+2 -1
drivers/net/hamradio/baycom_epp.c
··· 500 500 } 501 501 break; 502 502 } 503 + /* fall through */ 503 504 504 - default: /* fall through */ 505 + default: 505 506 if (bc->hdlctx.calibrate <= 0) 506 507 return 0; 507 508 i = min_t(int, cnt, bc->hdlctx.calibrate);
+4 -2
drivers/net/phy/fixed_phy.c
··· 216 216 if (IS_ERR(gpiod)) { 217 217 if (PTR_ERR(gpiod) == -EPROBE_DEFER) 218 218 return gpiod; 219 - pr_err("error getting GPIO for fixed link %pOF, proceed without\n", 220 - fixed_link_node); 219 + 220 + if (PTR_ERR(gpiod) != -ENOENT) 221 + pr_err("error getting GPIO for fixed link %pOF, proceed without\n", 222 + fixed_link_node); 221 223 gpiod = NULL; 222 224 } 223 225
+8 -8
drivers/net/phy/mscc.c
··· 2226 2226 vsc8531->supp_led_modes = VSC85XX_SUPP_LED_MODES; 2227 2227 vsc8531->hw_stats = vsc85xx_hw_stats; 2228 2228 vsc8531->nstats = ARRAY_SIZE(vsc85xx_hw_stats); 2229 - vsc8531->stats = devm_kmalloc_array(&phydev->mdio.dev, vsc8531->nstats, 2230 - sizeof(u64), GFP_KERNEL); 2229 + vsc8531->stats = devm_kcalloc(&phydev->mdio.dev, vsc8531->nstats, 2230 + sizeof(u64), GFP_KERNEL); 2231 2231 if (!vsc8531->stats) 2232 2232 return -ENOMEM; 2233 2233 ··· 2251 2251 vsc8531->supp_led_modes = VSC8584_SUPP_LED_MODES; 2252 2252 vsc8531->hw_stats = vsc8584_hw_stats; 2253 2253 vsc8531->nstats = ARRAY_SIZE(vsc8584_hw_stats); 2254 - vsc8531->stats = devm_kmalloc_array(&phydev->mdio.dev, vsc8531->nstats, 2255 - sizeof(u64), GFP_KERNEL); 2254 + vsc8531->stats = devm_kcalloc(&phydev->mdio.dev, vsc8531->nstats, 2255 + sizeof(u64), GFP_KERNEL); 2256 2256 if (!vsc8531->stats) 2257 2257 return -ENOMEM; 2258 2258 ··· 2281 2281 vsc8531->supp_led_modes = VSC8584_SUPP_LED_MODES; 2282 2282 vsc8531->hw_stats = vsc8584_hw_stats; 2283 2283 vsc8531->nstats = ARRAY_SIZE(vsc8584_hw_stats); 2284 - vsc8531->stats = devm_kmalloc_array(&phydev->mdio.dev, vsc8531->nstats, 2285 - sizeof(u64), GFP_KERNEL); 2284 + vsc8531->stats = devm_kcalloc(&phydev->mdio.dev, vsc8531->nstats, 2285 + sizeof(u64), GFP_KERNEL); 2286 2286 if (!vsc8531->stats) 2287 2287 return -ENOMEM; 2288 2288 ··· 2311 2311 vsc8531->supp_led_modes = VSC85XX_SUPP_LED_MODES; 2312 2312 vsc8531->hw_stats = vsc85xx_hw_stats; 2313 2313 vsc8531->nstats = ARRAY_SIZE(vsc85xx_hw_stats); 2314 - vsc8531->stats = devm_kmalloc_array(&phydev->mdio.dev, vsc8531->nstats, 2315 - sizeof(u64), GFP_KERNEL); 2314 + vsc8531->stats = devm_kcalloc(&phydev->mdio.dev, vsc8531->nstats, 2315 + sizeof(u64), GFP_KERNEL); 2316 2316 if (!vsc8531->stats) 2317 2317 return -ENOMEM; 2318 2318
+6
drivers/net/phy/phy_device.c
··· 1774 1774 phydev->link = status & BMSR_LSTATUS ? 1 : 0; 1775 1775 phydev->autoneg_complete = status & BMSR_ANEGCOMPLETE ? 1 : 0; 1776 1776 1777 + /* Consider the case that autoneg was started and "aneg complete" 1778 + * bit has been reset, but "link up" bit not yet. 1779 + */ 1780 + if (phydev->autoneg == AUTONEG_ENABLE && !phydev->autoneg_complete) 1781 + phydev->link = 0; 1782 + 1777 1783 return 0; 1778 1784 } 1779 1785 EXPORT_SYMBOL(genphy_update_link);
+2 -1
drivers/net/phy/phy_led_triggers.c
··· 48 48 if (!phy->last_triggered) 49 49 led_trigger_event(&phy->led_link_trigger->trigger, 50 50 LED_FULL); 51 + else 52 + led_trigger_event(&phy->last_triggered->trigger, LED_OFF); 51 53 52 - led_trigger_event(&phy->last_triggered->trigger, LED_OFF); 53 54 led_trigger_event(&plt->trigger, LED_FULL); 54 55 phy->last_triggered = plt; 55 56 }
+6 -4
drivers/net/phy/phylink.c
··· 216 216 pl->supported, true); 217 217 linkmode_zero(pl->supported); 218 218 phylink_set(pl->supported, MII); 219 + phylink_set(pl->supported, Pause); 220 + phylink_set(pl->supported, Asym_Pause); 219 221 if (s) { 220 222 __set_bit(s->bit, pl->supported); 221 223 } else { ··· 992 990 } 993 991 if (pl->link_an_mode == MLO_AN_FIXED && pl->get_fixed_state) 994 992 mod_timer(&pl->link_poll, jiffies + HZ); 995 - if (pl->sfp_bus) 996 - sfp_upstream_start(pl->sfp_bus); 997 993 if (pl->phydev) 998 994 phy_start(pl->phydev); 995 + if (pl->sfp_bus) 996 + sfp_upstream_start(pl->sfp_bus); 999 997 } 1000 998 EXPORT_SYMBOL_GPL(phylink_start); 1001 999 ··· 1012 1010 { 1013 1011 ASSERT_RTNL(); 1014 1012 1015 - if (pl->phydev) 1016 - phy_stop(pl->phydev); 1017 1013 if (pl->sfp_bus) 1018 1014 sfp_upstream_stop(pl->sfp_bus); 1015 + if (pl->phydev) 1016 + phy_stop(pl->phydev); 1019 1017 del_timer_sync(&pl->link_poll); 1020 1018 if (pl->link_irq) { 1021 1019 free_irq(pl->link_irq, pl);
+3
drivers/net/ppp/pppoe.c
··· 1115 1115 .recvmsg = pppoe_recvmsg, 1116 1116 .mmap = sock_no_mmap, 1117 1117 .ioctl = pppox_ioctl, 1118 + #ifdef CONFIG_COMPAT 1119 + .compat_ioctl = pppox_compat_ioctl, 1120 + #endif 1118 1121 }; 1119 1122 1120 1123 static const struct pppox_proto pppoe_proto = {
+13
drivers/net/ppp/pppox.c
··· 17 17 #include <linux/string.h> 18 18 #include <linux/module.h> 19 19 #include <linux/kernel.h> 20 + #include <linux/compat.h> 20 21 #include <linux/errno.h> 21 22 #include <linux/netdevice.h> 22 23 #include <linux/net.h> ··· 98 97 } 99 98 100 99 EXPORT_SYMBOL(pppox_ioctl); 100 + 101 + #ifdef CONFIG_COMPAT 102 + int pppox_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) 103 + { 104 + if (cmd == PPPOEIOCSFWD32) 105 + cmd = PPPOEIOCSFWD; 106 + 107 + return pppox_ioctl(sock, cmd, (unsigned long)compat_ptr(arg)); 108 + } 109 + 110 + EXPORT_SYMBOL(pppox_compat_ioctl); 111 + #endif 101 112 102 113 static int pppox_create(struct net *net, struct socket *sock, int protocol, 103 114 int kern)
+3
drivers/net/ppp/pptp.c
··· 623 623 .recvmsg = sock_no_recvmsg, 624 624 .mmap = sock_no_mmap, 625 625 .ioctl = pppox_ioctl, 626 + #ifdef CONFIG_COMPAT 627 + .compat_ioctl = pppox_compat_ioctl, 628 + #endif 626 629 }; 627 630 628 631 static const struct pppox_proto pppox_pptp_proto = {
+6 -3
drivers/net/tun.c
··· 1599 1599 return true; 1600 1600 } 1601 1601 1602 - static struct sk_buff *__tun_build_skb(struct page_frag *alloc_frag, char *buf, 1602 + static struct sk_buff *__tun_build_skb(struct tun_file *tfile, 1603 + struct page_frag *alloc_frag, char *buf, 1603 1604 int buflen, int len, int pad) 1604 1605 { 1605 1606 struct sk_buff *skb = build_skb(buf, buflen); ··· 1610 1609 1611 1610 skb_reserve(skb, pad); 1612 1611 skb_put(skb, len); 1612 + skb_set_owner_w(skb, tfile->socket.sk); 1613 1613 1614 1614 get_page(alloc_frag->page); 1615 1615 alloc_frag->offset += buflen; ··· 1688 1686 */ 1689 1687 if (hdr->gso_type || !xdp_prog) { 1690 1688 *skb_xdp = 1; 1691 - return __tun_build_skb(alloc_frag, buf, buflen, len, pad); 1689 + return __tun_build_skb(tfile, alloc_frag, buf, buflen, len, 1690 + pad); 1692 1691 } 1693 1692 1694 1693 *skb_xdp = 0; ··· 1726 1723 rcu_read_unlock(); 1727 1724 local_bh_enable(); 1728 1725 1729 - return __tun_build_skb(alloc_frag, buf, buflen, len, pad); 1726 + return __tun_build_skb(tfile, alloc_frag, buf, buflen, len, pad); 1730 1727 1731 1728 err_xdp: 1732 1729 put_page(alloc_frag->page);
+1 -1
drivers/net/usb/pegasus.c
··· 282 282 static int read_eprom_word(pegasus_t *pegasus, __u8 index, __u16 *retdata) 283 283 { 284 284 int i; 285 - __u8 tmp; 285 + __u8 tmp = 0; 286 286 __le16 retdatai; 287 287 int ret; 288 288
+1
drivers/net/usb/qmi_wwan.c
··· 1295 1295 {QMI_FIXED_INTF(0x2001, 0x7e3d, 4)}, /* D-Link DWM-222 A2 */ 1296 1296 {QMI_FIXED_INTF(0x2020, 0x2031, 4)}, /* Olicard 600 */ 1297 1297 {QMI_FIXED_INTF(0x2020, 0x2033, 4)}, /* BroadMobi BM806U */ 1298 + {QMI_FIXED_INTF(0x2020, 0x2060, 4)}, /* BroadMobi BM818 */ 1298 1299 {QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)}, /* Sierra Wireless MC7700 */ 1299 1300 {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */ 1300 1301 {QMI_FIXED_INTF(0x1199, 0x68a2, 8)}, /* Sierra Wireless MC7710 in QMI mode */
+6 -6
drivers/net/usb/r8152.c
··· 50 50 #define PLA_TEREDO_WAKE_BASE 0xc0c4 51 51 #define PLA_MAR 0xcd00 52 52 #define PLA_BACKUP 0xd000 53 - #define PAL_BDC_CR 0xd1a0 53 + #define PLA_BDC_CR 0xd1a0 54 54 #define PLA_TEREDO_TIMER 0xd2cc 55 55 #define PLA_REALWOW_TIMER 0xd2e8 56 56 #define PLA_SUSPEND_FLAG 0xd38a ··· 274 274 #define TEREDO_RS_EVENT_MASK 0x00fe 275 275 #define OOB_TEREDO_EN 0x0001 276 276 277 - /* PAL_BDC_CR */ 277 + /* PLA_BDC_CR */ 278 278 #define ALDPS_PROXY_MODE 0x0001 279 279 280 280 /* PLA_EFUSE_CMD */ ··· 3191 3191 3192 3192 rtl_rx_vlan_en(tp, true); 3193 3193 3194 - ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PAL_BDC_CR); 3194 + ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_BDC_CR); 3195 3195 ocp_data |= ALDPS_PROXY_MODE; 3196 - ocp_write_word(tp, MCU_TYPE_PLA, PAL_BDC_CR, ocp_data); 3196 + ocp_write_word(tp, MCU_TYPE_PLA, PLA_BDC_CR, ocp_data); 3197 3197 3198 3198 ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); 3199 3199 ocp_data |= NOW_IS_OOB | DIS_MCU_CLROOB; ··· 3577 3577 3578 3578 rtl_rx_vlan_en(tp, true); 3579 3579 3580 - ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PAL_BDC_CR); 3580 + ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_BDC_CR); 3581 3581 ocp_data |= ALDPS_PROXY_MODE; 3582 - ocp_write_word(tp, MCU_TYPE_PLA, PAL_BDC_CR, ocp_data); 3582 + ocp_write_word(tp, MCU_TYPE_PLA, PLA_BDC_CR, ocp_data); 3583 3583 3584 3584 ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); 3585 3585 ocp_data |= NOW_IS_OOB | DIS_MCU_CLROOB;
+1
drivers/net/wan/sdla.c
··· 413 413 case SDLA_RET_NO_BUFS: 414 414 if (cmd == SDLA_INFORMATION_WRITE) 415 415 break; 416 + /* Else, fall through */ 416 417 417 418 default: 418 419 netdev_dbg(dev, "Cmd 0x%02X generated return code 0x%02X\n",
+2 -1
drivers/net/wireless/intel/iwlwifi/fw/api/rx.h
··· 776 776 u8 indirection_table[IWL_RSS_INDIRECTION_TABLE_SIZE]; 777 777 } __packed; /* RSS_CONFIG_CMD_API_S_VER_1 */ 778 778 779 - #define IWL_MULTI_QUEUE_SYNC_MSG_MAX_SIZE 128 780 779 #define IWL_MULTI_QUEUE_SYNC_SENDER_POS 0 781 780 #define IWL_MULTI_QUEUE_SYNC_SENDER_MSK 0xf 782 781 ··· 811 812 * 812 813 * @IWL_MVM_RXQ_EMPTY: empty sync notification 813 814 * @IWL_MVM_RXQ_NOTIF_DEL_BA: notify RSS queues of delBA 815 + * @IWL_MVM_RXQ_NSSN_SYNC: notify all the RSS queues with the new NSSN 814 816 */ 815 817 enum iwl_mvm_rxq_notif_type { 816 818 IWL_MVM_RXQ_EMPTY, 817 819 IWL_MVM_RXQ_NOTIF_DEL_BA, 820 + IWL_MVM_RXQ_NSSN_SYNC, 818 821 }; 819 822 820 823 /**
+12 -10
drivers/net/wireless/intel/iwlwifi/fw/dbg.c
··· 2438 2438 { 2439 2439 u32 img_name_len = le32_to_cpu(dbg_info->img_name_len); 2440 2440 u32 dbg_cfg_name_len = le32_to_cpu(dbg_info->dbg_cfg_name_len); 2441 - const char err_str[] = 2442 - "WRT: ext=%d. Invalid %s name length %d, expected %d\n"; 2443 2441 2444 2442 if (img_name_len != IWL_FW_INI_MAX_IMG_NAME_LEN) { 2445 - IWL_WARN(fwrt, err_str, ext, "image", img_name_len, 2443 + IWL_WARN(fwrt, 2444 + "WRT: ext=%d. Invalid image name length %d, expected %d\n", 2445 + ext, img_name_len, 2446 2446 IWL_FW_INI_MAX_IMG_NAME_LEN); 2447 2447 return; 2448 2448 } 2449 2449 2450 2450 if (dbg_cfg_name_len != IWL_FW_INI_MAX_DBG_CFG_NAME_LEN) { 2451 - IWL_WARN(fwrt, err_str, ext, "debug cfg", dbg_cfg_name_len, 2451 + IWL_WARN(fwrt, 2452 + "WRT: ext=%d. Invalid debug cfg name length %d, expected %d\n", 2453 + ext, dbg_cfg_name_len, 2452 2454 IWL_FW_INI_MAX_DBG_CFG_NAME_LEN); 2453 2455 return; 2454 2456 } ··· 2777 2775 struct iwl_ucode_tlv *tlv = iter; 2778 2776 void *ini_tlv = (void *)tlv->data; 2779 2777 u32 type = le32_to_cpu(tlv->type); 2780 - const char invalid_ap_str[] = 2781 - "WRT: ext=%d. Invalid apply point %d for %s\n"; 2782 2778 2783 2779 switch (type) { 2784 2780 case IWL_UCODE_TLV_TYPE_DEBUG_INFO: ··· 2786 2786 struct iwl_fw_ini_allocation_data *buf_alloc = ini_tlv; 2787 2787 2788 2788 if (pnt != IWL_FW_INI_APPLY_EARLY) { 2789 - IWL_ERR(fwrt, invalid_ap_str, ext, pnt, 2790 - "buffer allocation"); 2789 + IWL_ERR(fwrt, 2790 + "WRT: ext=%d. Invalid apply point %d for buffer allocation\n", 2791 + ext, pnt); 2791 2792 goto next; 2792 2793 } 2793 2794 ··· 2798 2797 } 2799 2798 case IWL_UCODE_TLV_TYPE_HCMD: 2800 2799 if (pnt < IWL_FW_INI_APPLY_AFTER_ALIVE) { 2801 - IWL_ERR(fwrt, invalid_ap_str, ext, pnt, 2802 - "host command"); 2800 + IWL_ERR(fwrt, 2801 + "WRT: ext=%d. Invalid apply point %d for host command\n", 2802 + ext, pnt); 2803 2803 goto next; 2804 2804 } 2805 2805 iwl_fw_dbg_send_hcmd(fwrt, tlv, ext);
+3 -1
drivers/net/wireless/intel/iwlwifi/iwl-drv.c
··· 1640 1640 init_completion(&drv->request_firmware_complete); 1641 1641 INIT_LIST_HEAD(&drv->list); 1642 1642 1643 + iwl_load_fw_dbg_tlv(drv->trans->dev, drv->trans); 1644 + 1643 1645 #ifdef CONFIG_IWLWIFI_DEBUGFS 1644 1646 /* Create the device debugfs entries. */ 1645 1647 drv->dbgfs_drv = debugfs_create_dir(dev_name(trans->dev), ··· 1662 1660 err_fw: 1663 1661 #ifdef CONFIG_IWLWIFI_DEBUGFS 1664 1662 debugfs_remove_recursive(drv->dbgfs_drv); 1665 - iwl_fw_dbg_free(drv->trans); 1666 1663 #endif 1664 + iwl_fw_dbg_free(drv->trans); 1667 1665 kfree(drv); 1668 1666 err: 1669 1667 return ERR_PTR(ret);
+21 -8
drivers/net/wireless/intel/iwlwifi/mvm/fw.c
··· 755 755 756 756 for (i = 0; i < n_profiles; i++) { 757 757 /* the tables start at element 3 */ 758 - static int pos = 3; 758 + int pos = 3; 759 759 760 760 /* The EWRD profiles officially go from 2 to 4, but we 761 761 * save them in sar_profiles[1-3] (because we don't ··· 880 880 return iwl_mvm_send_cmd_pdu(mvm, REDUCE_TX_POWER_CMD, 0, len, &cmd); 881 881 } 882 882 883 + static bool iwl_mvm_sar_geo_support(struct iwl_mvm *mvm) 884 + { 885 + /* 886 + * The GEO_TX_POWER_LIMIT command is not supported on earlier 887 + * firmware versions. Unfortunately, we don't have a TLV API 888 + * flag to rely on, so rely on the major version which is in 889 + * the first byte of ucode_ver. This was implemented 890 + * initially on version 38 and then backported to 36, 29 and 891 + * 17. 892 + */ 893 + return IWL_UCODE_SERIAL(mvm->fw->ucode_ver) >= 38 || 894 + IWL_UCODE_SERIAL(mvm->fw->ucode_ver) == 36 || 895 + IWL_UCODE_SERIAL(mvm->fw->ucode_ver) == 29 || 896 + IWL_UCODE_SERIAL(mvm->fw->ucode_ver) == 17; 897 + } 898 + 883 899 int iwl_mvm_get_sar_geo_profile(struct iwl_mvm *mvm) 884 900 { 885 901 struct iwl_geo_tx_power_profiles_resp *resp; ··· 925 909 .data = { data }, 926 910 }; 927 911 912 + if (!iwl_mvm_sar_geo_support(mvm)) 913 + return -EOPNOTSUPP; 914 + 928 915 ret = iwl_mvm_send_cmd(mvm, &cmd); 929 916 if (ret) { 930 917 IWL_ERR(mvm, "Failed to get geographic profile info %d\n", ret); ··· 953 934 int ret, i, j; 954 935 u16 cmd_wide_id = WIDE_ID(PHY_OPS_GROUP, GEO_TX_POWER_LIMIT); 955 936 956 - /* 957 - * This command is not supported on earlier firmware versions. 958 - * Unfortunately, we don't have a TLV API flag to rely on, so 959 - * rely on the major version which is in the first byte of 960 - * ucode_ver. 961 - */ 962 - if (IWL_UCODE_SERIAL(mvm->fw->ucode_ver) < 41) 937 + if (!iwl_mvm_sar_geo_support(mvm)) 963 938 return 0; 964 939 965 940 ret = iwl_mvm_sar_get_wgds_table(mvm);
+42 -16
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
··· 207 207 }, 208 208 }; 209 209 210 - static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, 211 - enum set_key_cmd cmd, 212 - struct ieee80211_vif *vif, 213 - struct ieee80211_sta *sta, 214 - struct ieee80211_key_conf *key); 210 + static int __iwl_mvm_mac_set_key(struct ieee80211_hw *hw, 211 + enum set_key_cmd cmd, 212 + struct ieee80211_vif *vif, 213 + struct ieee80211_sta *sta, 214 + struct ieee80211_key_conf *key); 215 215 216 216 void iwl_mvm_ref(struct iwl_mvm *mvm, enum iwl_mvm_ref_type ref_type) 217 217 { ··· 474 474 ieee80211_hw_set(hw, SUPPORTS_VHT_EXT_NSS_BW); 475 475 ieee80211_hw_set(hw, BUFF_MMPDU_TXQ); 476 476 ieee80211_hw_set(hw, STA_MMPDU_TXQ); 477 - ieee80211_hw_set(hw, TX_AMSDU); 477 + /* 478 + * On older devices, enabling TX A-MSDU occasionally leads to 479 + * something getting messed up, the command read from the FIFO 480 + * gets out of sync and isn't a TX command, so that we have an 481 + * assert EDC. 482 + * 483 + * It's not clear where the bug is, but since we didn't used to 484 + * support A-MSDU until moving the mac80211 iTXQs, just leave it 485 + * for older devices. We also don't see this issue on any newer 486 + * devices. 487 + */ 488 + if (mvm->cfg->device_family >= IWL_DEVICE_FAMILY_9000) 489 + ieee80211_hw_set(hw, TX_AMSDU); 478 490 ieee80211_hw_set(hw, TX_FRAG_LIST); 479 491 480 492 if (iwl_mvm_has_tlc_offload(mvm)) { ··· 2738 2726 2739 2727 mvmvif->ap_early_keys[i] = NULL; 2740 2728 2741 - ret = iwl_mvm_mac_set_key(hw, SET_KEY, vif, NULL, key); 2729 + ret = __iwl_mvm_mac_set_key(hw, SET_KEY, vif, NULL, key); 2742 2730 if (ret) 2743 2731 goto out_quota_failed; 2744 2732 } ··· 3506 3494 return ret; 3507 3495 } 3508 3496 3509 - static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, 3510 - enum set_key_cmd cmd, 3511 - struct ieee80211_vif *vif, 3512 - struct ieee80211_sta *sta, 3513 - struct ieee80211_key_conf *key) 3497 + static int __iwl_mvm_mac_set_key(struct ieee80211_hw *hw, 3498 + enum set_key_cmd cmd, 3499 + struct ieee80211_vif *vif, 3500 + struct ieee80211_sta *sta, 3501 + struct ieee80211_key_conf *key) 3514 3502 { 3515 3503 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 3516 3504 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); ··· 3564 3552 else 3565 3553 return -EOPNOTSUPP; 3566 3554 } 3567 - 3568 - mutex_lock(&mvm->mutex); 3569 3555 3570 3556 switch (cmd) { 3571 3557 case SET_KEY: ··· 3710 3700 ret = -EINVAL; 3711 3701 } 3712 3702 3703 + return ret; 3704 + } 3705 + 3706 + static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, 3707 + enum set_key_cmd cmd, 3708 + struct ieee80211_vif *vif, 3709 + struct ieee80211_sta *sta, 3710 + struct ieee80211_key_conf *key) 3711 + { 3712 + struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); 3713 + int ret; 3714 + 3715 + mutex_lock(&mvm->mutex); 3716 + ret = __iwl_mvm_mac_set_key(hw, cmd, vif, sta, key); 3713 3717 mutex_unlock(&mvm->mutex); 3718 + 3714 3719 return ret; 3715 3720 } 3716 3721 ··· 5066 5041 u32 qmask = BIT(mvm->trans->num_rx_queues) - 1; 5067 5042 int ret; 5068 5043 5069 - lockdep_assert_held(&mvm->mutex); 5070 5044 5071 5045 if (!iwl_mvm_has_new_rx_api(mvm)) 5072 5046 return; ··· 5076 5052 atomic_set(&mvm->queue_sync_counter, 5077 5053 mvm->trans->num_rx_queues); 5078 5054 5079 - ret = iwl_mvm_notify_rx_queue(mvm, qmask, (u8 *)notif, size); 5055 + ret = iwl_mvm_notify_rx_queue(mvm, qmask, (u8 *)notif, 5056 + size, !notif->sync); 5080 5057 if (ret) { 5081 5058 IWL_ERR(mvm, "Failed to trigger RX queues sync (%d)\n", ret); 5082 5059 goto out; 5083 5060 } 5084 5061 5085 5062 if (notif->sync) { 5063 + lockdep_assert_held(&mvm->mutex); 5086 5064 ret = wait_event_timeout(mvm->rx_sync_waitq, 5087 5065 atomic_read(&mvm->queue_sync_counter) == 0 || 5088 5066 iwl_mvm_is_radio_killed(mvm),
+4 -4
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
··· 1664 1664 void iwl_mvm_rx_frame_release(struct iwl_mvm *mvm, struct napi_struct *napi, 1665 1665 struct iwl_rx_cmd_buffer *rxb, int queue); 1666 1666 int iwl_mvm_notify_rx_queue(struct iwl_mvm *mvm, u32 rxq_mask, 1667 - const u8 *data, u32 count); 1668 - void iwl_mvm_rx_queue_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, 1669 - int queue); 1667 + const u8 *data, u32 count, bool async); 1668 + void iwl_mvm_rx_queue_notif(struct iwl_mvm *mvm, struct napi_struct *napi, 1669 + struct iwl_rx_cmd_buffer *rxb, int queue); 1670 1670 void iwl_mvm_rx_tx_cmd(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb); 1671 1671 void iwl_mvm_mfu_assert_dump_notif(struct iwl_mvm *mvm, 1672 1672 struct iwl_rx_cmd_buffer *rxb); ··· 1813 1813 #endif /* CONFIG_IWLWIFI_DEBUGFS */ 1814 1814 1815 1815 /* rate scaling */ 1816 - int iwl_mvm_send_lq_cmd(struct iwl_mvm *mvm, struct iwl_lq_cmd *lq, bool sync); 1816 + int iwl_mvm_send_lq_cmd(struct iwl_mvm *mvm, struct iwl_lq_cmd *lq); 1817 1817 void iwl_mvm_update_frame_stats(struct iwl_mvm *mvm, u32 rate, bool agg); 1818 1818 int rs_pretty_print_rate(char *buf, int bufsz, const u32 rate); 1819 1819 void rs_update_last_rssi(struct iwl_mvm *mvm,
+1 -1
drivers/net/wireless/intel/iwlwifi/mvm/nvm.c
··· 620 620 enum iwl_mcc_source src; 621 621 char mcc[3]; 622 622 struct ieee80211_regdomain *regd; 623 - u32 wgds_tbl_idx; 623 + int wgds_tbl_idx; 624 624 625 625 lockdep_assert_held(&mvm->mutex); 626 626
+2 -2
drivers/net/wireless/intel/iwlwifi/mvm/ops.c
··· 1088 1088 iwl_mvm_rx_mpdu_mq(mvm, napi, rxb, 0); 1089 1089 else if (unlikely(cmd == WIDE_ID(DATA_PATH_GROUP, 1090 1090 RX_QUEUES_NOTIFICATION))) 1091 - iwl_mvm_rx_queue_notif(mvm, rxb, 0); 1091 + iwl_mvm_rx_queue_notif(mvm, napi, rxb, 0); 1092 1092 else if (cmd == WIDE_ID(LEGACY_GROUP, FRAME_RELEASE)) 1093 1093 iwl_mvm_rx_frame_release(mvm, napi, rxb, 0); 1094 1094 else if (cmd == WIDE_ID(DATA_PATH_GROUP, RX_NO_DATA_NOTIF)) ··· 1812 1812 iwl_mvm_rx_frame_release(mvm, napi, rxb, queue); 1813 1813 else if (unlikely(cmd == WIDE_ID(DATA_PATH_GROUP, 1814 1814 RX_QUEUES_NOTIFICATION))) 1815 - iwl_mvm_rx_queue_notif(mvm, rxb, queue); 1815 + iwl_mvm_rx_queue_notif(mvm, napi, rxb, queue); 1816 1816 else if (likely(cmd == WIDE_ID(LEGACY_GROUP, REPLY_RX_MPDU_CMD))) 1817 1817 iwl_mvm_rx_mpdu_mq(mvm, napi, rxb, queue); 1818 1818 }
+289 -250
drivers/net/wireless/intel/iwlwifi/mvm/rs.c
··· 1197 1197 return tid; 1198 1198 } 1199 1199 1200 - void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta, 1201 - int tid, struct ieee80211_tx_info *info, bool ndp) 1202 - { 1203 - int legacy_success; 1204 - int retries; 1205 - int i; 1206 - struct iwl_lq_cmd *table; 1207 - u32 lq_hwrate; 1208 - struct rs_rate lq_rate, tx_resp_rate; 1209 - struct iwl_scale_tbl_info *curr_tbl, *other_tbl, *tmp_tbl; 1210 - u32 tlc_info = (uintptr_t)info->status.status_driver_data[0]; 1211 - u8 reduced_txp = tlc_info & RS_DRV_DATA_TXP_MSK; 1212 - u8 lq_color = RS_DRV_DATA_LQ_COLOR_GET(tlc_info); 1213 - u32 tx_resp_hwrate = (uintptr_t)info->status.status_driver_data[1]; 1214 - struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); 1215 - struct iwl_lq_sta *lq_sta = &mvmsta->lq_sta.rs_drv; 1216 - 1217 - /* Treat uninitialized rate scaling data same as non-existing. */ 1218 - if (!lq_sta) { 1219 - IWL_DEBUG_RATE(mvm, "Station rate scaling not created yet.\n"); 1220 - return; 1221 - } else if (!lq_sta->pers.drv) { 1222 - IWL_DEBUG_RATE(mvm, "Rate scaling not initialized yet.\n"); 1223 - return; 1224 - } 1225 - 1226 - /* This packet was aggregated but doesn't carry status info */ 1227 - if ((info->flags & IEEE80211_TX_CTL_AMPDU) && 1228 - !(info->flags & IEEE80211_TX_STAT_AMPDU)) 1229 - return; 1230 - 1231 - if (rs_rate_from_ucode_rate(tx_resp_hwrate, info->band, 1232 - &tx_resp_rate)) { 1233 - WARN_ON_ONCE(1); 1234 - return; 1235 - } 1236 - 1237 - #ifdef CONFIG_MAC80211_DEBUGFS 1238 - /* Disable last tx check if we are debugging with fixed rate but 1239 - * update tx stats */ 1240 - if (lq_sta->pers.dbg_fixed_rate) { 1241 - int index = tx_resp_rate.index; 1242 - enum rs_column column; 1243 - int attempts, success; 1244 - 1245 - column = rs_get_column_from_rate(&tx_resp_rate); 1246 - if (WARN_ONCE(column == RS_COLUMN_INVALID, 1247 - "Can't map rate 0x%x to column", 1248 - tx_resp_hwrate)) 1249 - return; 1250 - 1251 - if (info->flags & IEEE80211_TX_STAT_AMPDU) { 1252 - attempts = info->status.ampdu_len; 1253 - success = info->status.ampdu_ack_len; 1254 - } else { 1255 - attempts = info->status.rates[0].count; 1256 - success = !!(info->flags & IEEE80211_TX_STAT_ACK); 1257 - } 1258 - 1259 - lq_sta->pers.tx_stats[column][index].total += attempts; 1260 - lq_sta->pers.tx_stats[column][index].success += success; 1261 - 1262 - IWL_DEBUG_RATE(mvm, "Fixed rate 0x%x success %d attempts %d\n", 1263 - tx_resp_hwrate, success, attempts); 1264 - return; 1265 - } 1266 - #endif 1267 - 1268 - if (time_after(jiffies, 1269 - (unsigned long)(lq_sta->last_tx + 1270 - (IWL_MVM_RS_IDLE_TIMEOUT * HZ)))) { 1271 - IWL_DEBUG_RATE(mvm, "Tx idle for too long. reinit rs\n"); 1272 - iwl_mvm_rs_rate_init(mvm, sta, info->band, true); 1273 - return; 1274 - } 1275 - lq_sta->last_tx = jiffies; 1276 - 1277 - /* Ignore this Tx frame response if its initial rate doesn't match 1278 - * that of latest Link Quality command. There may be stragglers 1279 - * from a previous Link Quality command, but we're no longer interested 1280 - * in those; they're either from the "active" mode while we're trying 1281 - * to check "search" mode, or a prior "search" mode after we've moved 1282 - * to a new "search" mode (which might become the new "active" mode). 1283 - */ 1284 - table = &lq_sta->lq; 1285 - lq_hwrate = le32_to_cpu(table->rs_table[0]); 1286 - if (rs_rate_from_ucode_rate(lq_hwrate, info->band, &lq_rate)) { 1287 - WARN_ON_ONCE(1); 1288 - return; 1289 - } 1290 - 1291 - /* Here we actually compare this rate to the latest LQ command */ 1292 - if (lq_color != LQ_FLAG_COLOR_GET(table->flags)) { 1293 - IWL_DEBUG_RATE(mvm, 1294 - "tx resp color 0x%x does not match 0x%x\n", 1295 - lq_color, LQ_FLAG_COLOR_GET(table->flags)); 1296 - 1297 - /* 1298 - * Since rates mis-match, the last LQ command may have failed. 1299 - * After IWL_MISSED_RATE_MAX mis-matches, resync the uCode with 1300 - * ... driver. 1301 - */ 1302 - lq_sta->missed_rate_counter++; 1303 - if (lq_sta->missed_rate_counter > IWL_MVM_RS_MISSED_RATE_MAX) { 1304 - lq_sta->missed_rate_counter = 0; 1305 - IWL_DEBUG_RATE(mvm, 1306 - "Too many rates mismatch. Send sync LQ. rs_state %d\n", 1307 - lq_sta->rs_state); 1308 - iwl_mvm_send_lq_cmd(mvm, &lq_sta->lq, false); 1309 - } 1310 - /* Regardless, ignore this status info for outdated rate */ 1311 - return; 1312 - } else 1313 - /* Rate did match, so reset the missed_rate_counter */ 1314 - lq_sta->missed_rate_counter = 0; 1315 - 1316 - if (!lq_sta->search_better_tbl) { 1317 - curr_tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 1318 - other_tbl = &(lq_sta->lq_info[1 - lq_sta->active_tbl]); 1319 - } else { 1320 - curr_tbl = &(lq_sta->lq_info[1 - lq_sta->active_tbl]); 1321 - other_tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 1322 - } 1323 - 1324 - if (WARN_ON_ONCE(!rs_rate_column_match(&lq_rate, &curr_tbl->rate))) { 1325 - IWL_DEBUG_RATE(mvm, 1326 - "Neither active nor search matches tx rate\n"); 1327 - tmp_tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 1328 - rs_dump_rate(mvm, &tmp_tbl->rate, "ACTIVE"); 1329 - tmp_tbl = &(lq_sta->lq_info[1 - lq_sta->active_tbl]); 1330 - rs_dump_rate(mvm, &tmp_tbl->rate, "SEARCH"); 1331 - rs_dump_rate(mvm, &lq_rate, "ACTUAL"); 1332 - 1333 - /* 1334 - * no matching table found, let's by-pass the data collection 1335 - * and continue to perform rate scale to find the rate table 1336 - */ 1337 - rs_stay_in_table(lq_sta, true); 1338 - goto done; 1339 - } 1340 - 1341 - /* 1342 - * Updating the frame history depends on whether packets were 1343 - * aggregated. 1344 - * 1345 - * For aggregation, all packets were transmitted at the same rate, the 1346 - * first index into rate scale table. 1347 - */ 1348 - if (info->flags & IEEE80211_TX_STAT_AMPDU) { 1349 - rs_collect_tpc_data(mvm, lq_sta, curr_tbl, tx_resp_rate.index, 1350 - info->status.ampdu_len, 1351 - info->status.ampdu_ack_len, 1352 - reduced_txp); 1353 - 1354 - /* ampdu_ack_len = 0 marks no BA was received. For TLC, treat 1355 - * it as a single frame loss as we don't want the success ratio 1356 - * to dip too quickly because a BA wasn't received. 1357 - * For TPC, there's no need for this optimisation since we want 1358 - * to recover very quickly from a bad power reduction and, 1359 - * therefore we'd like the success ratio to get an immediate hit 1360 - * when failing to get a BA, so we'd switch back to a lower or 1361 - * zero power reduction. When FW transmits agg with a rate 1362 - * different from the initial rate, it will not use reduced txp 1363 - * and will send BA notification twice (one empty with reduced 1364 - * txp equal to the value from LQ and one with reduced txp 0). 1365 - * We need to update counters for each txp level accordingly. 1366 - */ 1367 - if (info->status.ampdu_ack_len == 0) 1368 - info->status.ampdu_len = 1; 1369 - 1370 - rs_collect_tlc_data(mvm, mvmsta, tid, curr_tbl, tx_resp_rate.index, 1371 - info->status.ampdu_len, 1372 - info->status.ampdu_ack_len); 1373 - 1374 - /* Update success/fail counts if not searching for new mode */ 1375 - if (lq_sta->rs_state == RS_STATE_STAY_IN_COLUMN) { 1376 - lq_sta->total_success += info->status.ampdu_ack_len; 1377 - lq_sta->total_failed += (info->status.ampdu_len - 1378 - info->status.ampdu_ack_len); 1379 - } 1380 - } else { 1381 - /* For legacy, update frame history with for each Tx retry. */ 1382 - retries = info->status.rates[0].count - 1; 1383 - /* HW doesn't send more than 15 retries */ 1384 - retries = min(retries, 15); 1385 - 1386 - /* The last transmission may have been successful */ 1387 - legacy_success = !!(info->flags & IEEE80211_TX_STAT_ACK); 1388 - /* Collect data for each rate used during failed TX attempts */ 1389 - for (i = 0; i <= retries; ++i) { 1390 - lq_hwrate = le32_to_cpu(table->rs_table[i]); 1391 - if (rs_rate_from_ucode_rate(lq_hwrate, info->band, 1392 - &lq_rate)) { 1393 - WARN_ON_ONCE(1); 1394 - return; 1395 - } 1396 - 1397 - /* 1398 - * Only collect stats if retried rate is in the same RS 1399 - * table as active/search. 1400 - */ 1401 - if (rs_rate_column_match(&lq_rate, &curr_tbl->rate)) 1402 - tmp_tbl = curr_tbl; 1403 - else if (rs_rate_column_match(&lq_rate, 1404 - &other_tbl->rate)) 1405 - tmp_tbl = other_tbl; 1406 - else 1407 - continue; 1408 - 1409 - rs_collect_tpc_data(mvm, lq_sta, tmp_tbl, 1410 - tx_resp_rate.index, 1, 1411 - i < retries ? 0 : legacy_success, 1412 - reduced_txp); 1413 - rs_collect_tlc_data(mvm, mvmsta, tid, tmp_tbl, 1414 - tx_resp_rate.index, 1, 1415 - i < retries ? 0 : legacy_success); 1416 - } 1417 - 1418 - /* Update success/fail counts if not searching for new mode */ 1419 - if (lq_sta->rs_state == RS_STATE_STAY_IN_COLUMN) { 1420 - lq_sta->total_success += legacy_success; 1421 - lq_sta->total_failed += retries + (1 - legacy_success); 1422 - } 1423 - } 1424 - /* The last TX rate is cached in lq_sta; it's set in if/else above */ 1425 - lq_sta->last_rate_n_flags = lq_hwrate; 1426 - IWL_DEBUG_RATE(mvm, "reduced txpower: %d\n", reduced_txp); 1427 - done: 1428 - /* See if there's a better rate or modulation mode to try. */ 1429 - if (sta->supp_rates[info->band]) 1430 - rs_rate_scale_perform(mvm, sta, lq_sta, tid, ndp); 1431 - } 1432 - 1433 1200 /* 1434 1201 * mac80211 sends us Tx status 1435 1202 */ ··· 1209 1442 struct iwl_op_mode *op_mode = mvm_r; 1210 1443 struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); 1211 1444 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 1445 + struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); 1212 1446 1213 - if (!iwl_mvm_sta_from_mac80211(sta)->vif) 1447 + if (!mvmsta->vif) 1214 1448 return; 1215 1449 1216 1450 if (!ieee80211_is_data(hdr->frame_control) || ··· 1350 1582 const struct rs_tx_column *column = &rs_tx_columns[tbl->column]; 1351 1583 1352 1584 tbl->expected_tpt = rs_get_expected_tpt_table(lq_sta, column, rate->bw); 1585 + } 1586 + 1587 + /* rs uses two tables, one is active and the second is for searching better 1588 + * configuration. This function, according to the index of the currently 1589 + * active table returns the search table, which is located at the 1590 + * index complementary to 1 according to the active table (active = 1, 1591 + * search = 0 or active = 0, search = 1). 1592 + * Since lq_info is an arary of size 2, make sure index cannot be out of bounds. 1593 + */ 1594 + static inline u8 rs_search_tbl(u8 active_tbl) 1595 + { 1596 + return (active_tbl ^ 1) & 1; 1353 1597 } 1354 1598 1355 1599 static s32 rs_get_best_rate(struct iwl_mvm *mvm, ··· 1574 1794 struct iwl_scale_tbl_info *tbl) 1575 1795 { 1576 1796 rs_fill_lq_cmd(mvm, sta, lq_sta, &tbl->rate); 1577 - iwl_mvm_send_lq_cmd(mvm, &lq_sta->lq, false); 1797 + iwl_mvm_send_lq_cmd(mvm, &lq_sta->lq); 1578 1798 } 1579 1799 1580 1800 static bool rs_tweak_rate_tbl(struct iwl_mvm *mvm, ··· 1711 1931 struct ieee80211_sta *sta, 1712 1932 enum rs_column col_id) 1713 1933 { 1714 - struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 1934 + struct iwl_scale_tbl_info *tbl = &lq_sta->lq_info[lq_sta->active_tbl]; 1715 1935 struct iwl_scale_tbl_info *search_tbl = 1716 - &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); 1936 + &lq_sta->lq_info[rs_search_tbl(lq_sta->active_tbl)]; 1717 1937 struct rs_rate *rate = &search_tbl->rate; 1718 1938 const struct rs_tx_column *column = &rs_tx_columns[col_id]; 1719 1939 const struct rs_tx_column *curr_column = &rs_tx_columns[tbl->column]; ··· 2121 2341 if (!lq_sta->search_better_tbl) 2122 2342 active_tbl = lq_sta->active_tbl; 2123 2343 else 2124 - active_tbl = 1 - lq_sta->active_tbl; 2344 + active_tbl = rs_search_tbl(lq_sta->active_tbl); 2125 2345 2126 2346 tbl = &(lq_sta->lq_info[active_tbl]); 2127 2347 rate = &tbl->rate; ··· 2345 2565 /* If new "search" mode was selected, set up in uCode table */ 2346 2566 if (lq_sta->search_better_tbl) { 2347 2567 /* Access the "search" table, clear its history. */ 2348 - tbl = &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); 2568 + tbl = &lq_sta->lq_info[rs_search_tbl(lq_sta->active_tbl)]; 2349 2569 rs_rate_scale_clear_tbl_windows(mvm, tbl); 2350 2570 2351 2571 /* Use new "search" start rate */ ··· 2676 2896 static void rs_initialize_lq(struct iwl_mvm *mvm, 2677 2897 struct ieee80211_sta *sta, 2678 2898 struct iwl_lq_sta *lq_sta, 2679 - enum nl80211_band band, bool update) 2899 + enum nl80211_band band) 2680 2900 { 2681 2901 struct iwl_scale_tbl_info *tbl; 2682 2902 struct rs_rate *rate; ··· 2688 2908 if (!lq_sta->search_better_tbl) 2689 2909 active_tbl = lq_sta->active_tbl; 2690 2910 else 2691 - active_tbl = 1 - lq_sta->active_tbl; 2911 + active_tbl = rs_search_tbl(lq_sta->active_tbl); 2692 2912 2693 2913 tbl = &(lq_sta->lq_info[active_tbl]); 2694 2914 rate = &tbl->rate; ··· 2706 2926 rs_set_expected_tpt_table(lq_sta, tbl); 2707 2927 rs_fill_lq_cmd(mvm, sta, lq_sta, rate); 2708 2928 /* TODO restore station should remember the lq cmd */ 2709 - iwl_mvm_send_lq_cmd(mvm, &lq_sta->lq, !update); 2929 + iwl_mvm_send_lq_cmd(mvm, &lq_sta->lq); 2710 2930 } 2711 2931 2712 2932 static void rs_drv_get_rate(void *mvm_r, struct ieee80211_sta *sta, ··· 2955 3175 * Called after adding a new station to initialize rate scaling 2956 3176 */ 2957 3177 static void rs_drv_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, 2958 - enum nl80211_band band, bool update) 3178 + enum nl80211_band band) 2959 3179 { 2960 3180 int i, j; 2961 3181 struct ieee80211_hw *hw = mvm->hw; ··· 2965 3185 struct iwl_lq_sta *lq_sta = &mvmsta->lq_sta.rs_drv; 2966 3186 struct ieee80211_supported_band *sband; 2967 3187 unsigned long supp; /* must be unsigned long for for_each_set_bit */ 3188 + 3189 + lockdep_assert_held(&mvmsta->lq_sta.rs_drv.pers.lock); 2968 3190 2969 3191 /* clear all non-persistent lq data */ 2970 3192 memset(lq_sta, 0, offsetof(typeof(*lq_sta), pers)); ··· 3037 3255 #ifdef CONFIG_IWLWIFI_DEBUGFS 3038 3256 iwl_mvm_reset_frame_stats(mvm); 3039 3257 #endif 3040 - rs_initialize_lq(mvm, sta, lq_sta, band, update); 3258 + rs_initialize_lq(mvm, sta, lq_sta, band); 3041 3259 } 3042 3260 3043 3261 static void rs_drv_rate_update(void *mvm_r, ··· 3058 3276 ieee80211_stop_tx_ba_session(sta, tid); 3059 3277 3060 3278 iwl_mvm_rs_rate_init(mvm, sta, sband->band, true); 3279 + } 3280 + 3281 + static void __iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, 3282 + struct ieee80211_sta *sta, 3283 + int tid, struct ieee80211_tx_info *info, 3284 + bool ndp) 3285 + { 3286 + int legacy_success; 3287 + int retries; 3288 + int i; 3289 + struct iwl_lq_cmd *table; 3290 + u32 lq_hwrate; 3291 + struct rs_rate lq_rate, tx_resp_rate; 3292 + struct iwl_scale_tbl_info *curr_tbl, *other_tbl, *tmp_tbl; 3293 + u32 tlc_info = (uintptr_t)info->status.status_driver_data[0]; 3294 + u8 reduced_txp = tlc_info & RS_DRV_DATA_TXP_MSK; 3295 + u8 lq_color = RS_DRV_DATA_LQ_COLOR_GET(tlc_info); 3296 + u32 tx_resp_hwrate = (uintptr_t)info->status.status_driver_data[1]; 3297 + struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); 3298 + struct iwl_lq_sta *lq_sta = &mvmsta->lq_sta.rs_drv; 3299 + 3300 + /* Treat uninitialized rate scaling data same as non-existing. */ 3301 + if (!lq_sta) { 3302 + IWL_DEBUG_RATE(mvm, "Station rate scaling not created yet.\n"); 3303 + return; 3304 + } else if (!lq_sta->pers.drv) { 3305 + IWL_DEBUG_RATE(mvm, "Rate scaling not initialized yet.\n"); 3306 + return; 3307 + } 3308 + 3309 + /* This packet was aggregated but doesn't carry status info */ 3310 + if ((info->flags & IEEE80211_TX_CTL_AMPDU) && 3311 + !(info->flags & IEEE80211_TX_STAT_AMPDU)) 3312 + return; 3313 + 3314 + if (rs_rate_from_ucode_rate(tx_resp_hwrate, info->band, 3315 + &tx_resp_rate)) { 3316 + WARN_ON_ONCE(1); 3317 + return; 3318 + } 3319 + 3320 + #ifdef CONFIG_MAC80211_DEBUGFS 3321 + /* Disable last tx check if we are debugging with fixed rate but 3322 + * update tx stats 3323 + */ 3324 + if (lq_sta->pers.dbg_fixed_rate) { 3325 + int index = tx_resp_rate.index; 3326 + enum rs_column column; 3327 + int attempts, success; 3328 + 3329 + column = rs_get_column_from_rate(&tx_resp_rate); 3330 + if (WARN_ONCE(column == RS_COLUMN_INVALID, 3331 + "Can't map rate 0x%x to column", 3332 + tx_resp_hwrate)) 3333 + return; 3334 + 3335 + if (info->flags & IEEE80211_TX_STAT_AMPDU) { 3336 + attempts = info->status.ampdu_len; 3337 + success = info->status.ampdu_ack_len; 3338 + } else { 3339 + attempts = info->status.rates[0].count; 3340 + success = !!(info->flags & IEEE80211_TX_STAT_ACK); 3341 + } 3342 + 3343 + lq_sta->pers.tx_stats[column][index].total += attempts; 3344 + lq_sta->pers.tx_stats[column][index].success += success; 3345 + 3346 + IWL_DEBUG_RATE(mvm, "Fixed rate 0x%x success %d attempts %d\n", 3347 + tx_resp_hwrate, success, attempts); 3348 + return; 3349 + } 3350 + #endif 3351 + 3352 + if (time_after(jiffies, 3353 + (unsigned long)(lq_sta->last_tx + 3354 + (IWL_MVM_RS_IDLE_TIMEOUT * HZ)))) { 3355 + IWL_DEBUG_RATE(mvm, "Tx idle for too long. reinit rs\n"); 3356 + /* reach here only in case of driver RS, call directly 3357 + * the unlocked version 3358 + */ 3359 + rs_drv_rate_init(mvm, sta, info->band); 3360 + return; 3361 + } 3362 + lq_sta->last_tx = jiffies; 3363 + 3364 + /* Ignore this Tx frame response if its initial rate doesn't match 3365 + * that of latest Link Quality command. There may be stragglers 3366 + * from a previous Link Quality command, but we're no longer interested 3367 + * in those; they're either from the "active" mode while we're trying 3368 + * to check "search" mode, or a prior "search" mode after we've moved 3369 + * to a new "search" mode (which might become the new "active" mode). 3370 + */ 3371 + table = &lq_sta->lq; 3372 + lq_hwrate = le32_to_cpu(table->rs_table[0]); 3373 + if (rs_rate_from_ucode_rate(lq_hwrate, info->band, &lq_rate)) { 3374 + WARN_ON_ONCE(1); 3375 + return; 3376 + } 3377 + 3378 + /* Here we actually compare this rate to the latest LQ command */ 3379 + if (lq_color != LQ_FLAG_COLOR_GET(table->flags)) { 3380 + IWL_DEBUG_RATE(mvm, 3381 + "tx resp color 0x%x does not match 0x%x\n", 3382 + lq_color, LQ_FLAG_COLOR_GET(table->flags)); 3383 + 3384 + /* Since rates mis-match, the last LQ command may have failed. 3385 + * After IWL_MISSED_RATE_MAX mis-matches, resync the uCode with 3386 + * ... driver. 3387 + */ 3388 + lq_sta->missed_rate_counter++; 3389 + if (lq_sta->missed_rate_counter > IWL_MVM_RS_MISSED_RATE_MAX) { 3390 + lq_sta->missed_rate_counter = 0; 3391 + IWL_DEBUG_RATE(mvm, 3392 + "Too many rates mismatch. Send sync LQ. rs_state %d\n", 3393 + lq_sta->rs_state); 3394 + iwl_mvm_send_lq_cmd(mvm, &lq_sta->lq); 3395 + } 3396 + /* Regardless, ignore this status info for outdated rate */ 3397 + return; 3398 + } 3399 + 3400 + /* Rate did match, so reset the missed_rate_counter */ 3401 + lq_sta->missed_rate_counter = 0; 3402 + 3403 + if (!lq_sta->search_better_tbl) { 3404 + curr_tbl = &lq_sta->lq_info[lq_sta->active_tbl]; 3405 + other_tbl = &lq_sta->lq_info[rs_search_tbl(lq_sta->active_tbl)]; 3406 + } else { 3407 + curr_tbl = &lq_sta->lq_info[rs_search_tbl(lq_sta->active_tbl)]; 3408 + other_tbl = &lq_sta->lq_info[lq_sta->active_tbl]; 3409 + } 3410 + 3411 + if (WARN_ON_ONCE(!rs_rate_column_match(&lq_rate, &curr_tbl->rate))) { 3412 + IWL_DEBUG_RATE(mvm, 3413 + "Neither active nor search matches tx rate\n"); 3414 + tmp_tbl = &lq_sta->lq_info[lq_sta->active_tbl]; 3415 + rs_dump_rate(mvm, &tmp_tbl->rate, "ACTIVE"); 3416 + tmp_tbl = &lq_sta->lq_info[rs_search_tbl(lq_sta->active_tbl)]; 3417 + rs_dump_rate(mvm, &tmp_tbl->rate, "SEARCH"); 3418 + rs_dump_rate(mvm, &lq_rate, "ACTUAL"); 3419 + 3420 + /* no matching table found, let's by-pass the data collection 3421 + * and continue to perform rate scale to find the rate table 3422 + */ 3423 + rs_stay_in_table(lq_sta, true); 3424 + goto done; 3425 + } 3426 + 3427 + /* Updating the frame history depends on whether packets were 3428 + * aggregated. 3429 + * 3430 + * For aggregation, all packets were transmitted at the same rate, the 3431 + * first index into rate scale table. 3432 + */ 3433 + if (info->flags & IEEE80211_TX_STAT_AMPDU) { 3434 + rs_collect_tpc_data(mvm, lq_sta, curr_tbl, tx_resp_rate.index, 3435 + info->status.ampdu_len, 3436 + info->status.ampdu_ack_len, 3437 + reduced_txp); 3438 + 3439 + /* ampdu_ack_len = 0 marks no BA was received. For TLC, treat 3440 + * it as a single frame loss as we don't want the success ratio 3441 + * to dip too quickly because a BA wasn't received. 3442 + * For TPC, there's no need for this optimisation since we want 3443 + * to recover very quickly from a bad power reduction and, 3444 + * therefore we'd like the success ratio to get an immediate hit 3445 + * when failing to get a BA, so we'd switch back to a lower or 3446 + * zero power reduction. When FW transmits agg with a rate 3447 + * different from the initial rate, it will not use reduced txp 3448 + * and will send BA notification twice (one empty with reduced 3449 + * txp equal to the value from LQ and one with reduced txp 0). 3450 + * We need to update counters for each txp level accordingly. 3451 + */ 3452 + if (info->status.ampdu_ack_len == 0) 3453 + info->status.ampdu_len = 1; 3454 + 3455 + rs_collect_tlc_data(mvm, mvmsta, tid, curr_tbl, 3456 + tx_resp_rate.index, 3457 + info->status.ampdu_len, 3458 + info->status.ampdu_ack_len); 3459 + 3460 + /* Update success/fail counts if not searching for new mode */ 3461 + if (lq_sta->rs_state == RS_STATE_STAY_IN_COLUMN) { 3462 + lq_sta->total_success += info->status.ampdu_ack_len; 3463 + lq_sta->total_failed += (info->status.ampdu_len - 3464 + info->status.ampdu_ack_len); 3465 + } 3466 + } else { 3467 + /* For legacy, update frame history with for each Tx retry. */ 3468 + retries = info->status.rates[0].count - 1; 3469 + /* HW doesn't send more than 15 retries */ 3470 + retries = min(retries, 15); 3471 + 3472 + /* The last transmission may have been successful */ 3473 + legacy_success = !!(info->flags & IEEE80211_TX_STAT_ACK); 3474 + /* Collect data for each rate used during failed TX attempts */ 3475 + for (i = 0; i <= retries; ++i) { 3476 + lq_hwrate = le32_to_cpu(table->rs_table[i]); 3477 + if (rs_rate_from_ucode_rate(lq_hwrate, info->band, 3478 + &lq_rate)) { 3479 + WARN_ON_ONCE(1); 3480 + return; 3481 + } 3482 + 3483 + /* Only collect stats if retried rate is in the same RS 3484 + * table as active/search. 3485 + */ 3486 + if (rs_rate_column_match(&lq_rate, &curr_tbl->rate)) 3487 + tmp_tbl = curr_tbl; 3488 + else if (rs_rate_column_match(&lq_rate, 3489 + &other_tbl->rate)) 3490 + tmp_tbl = other_tbl; 3491 + else 3492 + continue; 3493 + 3494 + rs_collect_tpc_data(mvm, lq_sta, tmp_tbl, 3495 + tx_resp_rate.index, 1, 3496 + i < retries ? 0 : legacy_success, 3497 + reduced_txp); 3498 + rs_collect_tlc_data(mvm, mvmsta, tid, tmp_tbl, 3499 + tx_resp_rate.index, 1, 3500 + i < retries ? 0 : legacy_success); 3501 + } 3502 + 3503 + /* Update success/fail counts if not searching for new mode */ 3504 + if (lq_sta->rs_state == RS_STATE_STAY_IN_COLUMN) { 3505 + lq_sta->total_success += legacy_success; 3506 + lq_sta->total_failed += retries + (1 - legacy_success); 3507 + } 3508 + } 3509 + /* The last TX rate is cached in lq_sta; it's set in if/else above */ 3510 + lq_sta->last_rate_n_flags = lq_hwrate; 3511 + IWL_DEBUG_RATE(mvm, "reduced txpower: %d\n", reduced_txp); 3512 + done: 3513 + /* See if there's a better rate or modulation mode to try. */ 3514 + if (sta->supp_rates[info->band]) 3515 + rs_rate_scale_perform(mvm, sta, lq_sta, tid, ndp); 3516 + } 3517 + 3518 + void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta, 3519 + int tid, struct ieee80211_tx_info *info, bool ndp) 3520 + { 3521 + struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); 3522 + 3523 + /* If it's locked we are in middle of init flow 3524 + * just wait for next tx status to update the lq_sta data 3525 + */ 3526 + if (!spin_trylock(&mvmsta->lq_sta.rs_drv.pers.lock)) 3527 + return; 3528 + 3529 + __iwl_mvm_rs_tx_status(mvm, sta, tid, info, ndp); 3530 + spin_unlock(&mvmsta->lq_sta.rs_drv.pers.lock); 3061 3531 } 3062 3532 3063 3533 #ifdef CONFIG_MAC80211_DEBUGFS ··· 3603 3569 3604 3570 bfersta_ss_params &= ~LQ_SS_BFER_ALLOWED; 3605 3571 bfersta_lq_cmd->ss_params = cpu_to_le32(bfersta_ss_params); 3606 - iwl_mvm_send_lq_cmd(mvm, bfersta_lq_cmd, false); 3572 + iwl_mvm_send_lq_cmd(mvm, bfersta_lq_cmd); 3607 3573 3608 3574 ss_params |= LQ_SS_BFER_ALLOWED; 3609 3575 IWL_DEBUG_RATE(mvm, ··· 3769 3735 3770 3736 if (lq_sta->pers.dbg_fixed_rate) { 3771 3737 rs_fill_lq_cmd(mvm, NULL, lq_sta, NULL); 3772 - iwl_mvm_send_lq_cmd(lq_sta->pers.drv, &lq_sta->lq, false); 3738 + iwl_mvm_send_lq_cmd(lq_sta->pers.drv, &lq_sta->lq); 3773 3739 } 3774 3740 } 3775 3741 ··· 4166 4132 void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, 4167 4133 enum nl80211_band band, bool update) 4168 4134 { 4169 - if (iwl_mvm_has_tlc_offload(mvm)) 4135 + if (iwl_mvm_has_tlc_offload(mvm)) { 4170 4136 rs_fw_rate_init(mvm, sta, band, update); 4171 - else 4172 - rs_drv_rate_init(mvm, sta, band, update); 4137 + } else { 4138 + struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); 4139 + 4140 + spin_lock(&mvmsta->lq_sta.rs_drv.pers.lock); 4141 + rs_drv_rate_init(mvm, sta, band); 4142 + spin_unlock(&mvmsta->lq_sta.rs_drv.pers.lock); 4143 + } 4173 4144 } 4174 4145 4175 4146 int iwl_mvm_rate_control_register(void) ··· 4204 4165 lq->flags &= ~LQ_FLAG_USE_RTS_MSK; 4205 4166 } 4206 4167 4207 - return iwl_mvm_send_lq_cmd(mvm, lq, false); 4168 + return iwl_mvm_send_lq_cmd(mvm, lq); 4208 4169 } 4209 4170 4210 4171 /**
+2 -1
drivers/net/wireless/intel/iwlwifi/mvm/rs.h
··· 4 4 * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved. 5 5 * Copyright(c) 2015 Intel Mobile Communications GmbH 6 6 * Copyright(c) 2017 Intel Deutschland GmbH 7 - * Copyright(c) 2018 Intel Corporation 7 + * Copyright(c) 2018 - 2019 Intel Corporation 8 8 * 9 9 * Contact Information: 10 10 * Intel Linux Wireless <linuxwifi@intel.com> ··· 390 390 s8 last_rssi; 391 391 struct rs_rate_stats tx_stats[RS_COLUMN_COUNT][IWL_RATE_COUNT]; 392 392 struct iwl_mvm *drv; 393 + spinlock_t lock; /* for races in reinit/update table */ 393 394 } pers; 394 395 }; 395 396
+134 -51
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
··· 463 463 } 464 464 465 465 int iwl_mvm_notify_rx_queue(struct iwl_mvm *mvm, u32 rxq_mask, 466 - const u8 *data, u32 count) 466 + const u8 *data, u32 count, bool async) 467 467 { 468 - struct iwl_rxq_sync_cmd *cmd; 468 + u8 buf[sizeof(struct iwl_rxq_sync_cmd) + 469 + sizeof(struct iwl_mvm_rss_sync_notif)]; 470 + struct iwl_rxq_sync_cmd *cmd = (void *)buf; 469 471 u32 data_size = sizeof(*cmd) + count; 470 472 int ret; 471 473 472 - /* should be DWORD aligned */ 473 - if (WARN_ON(count & 3 || count > IWL_MULTI_QUEUE_SYNC_MSG_MAX_SIZE)) 474 + /* 475 + * size must be a multiple of DWORD 476 + * Ensure we don't overflow buf 477 + */ 478 + if (WARN_ON(count & 3 || 479 + count > sizeof(struct iwl_mvm_rss_sync_notif))) 474 480 return -EINVAL; 475 - 476 - cmd = kzalloc(data_size, GFP_KERNEL); 477 - if (!cmd) 478 - return -ENOMEM; 479 481 480 482 cmd->rxq_mask = cpu_to_le32(rxq_mask); 481 483 cmd->count = cpu_to_le32(count); ··· 487 485 ret = iwl_mvm_send_cmd_pdu(mvm, 488 486 WIDE_ID(DATA_PATH_GROUP, 489 487 TRIGGER_RX_QUEUES_NOTIF_CMD), 490 - 0, data_size, cmd); 488 + async ? CMD_ASYNC : 0, data_size, cmd); 491 489 492 - kfree(cmd); 493 490 return ret; 494 491 } 495 492 ··· 504 503 !ieee80211_sn_less(sn1, sn2 - buffer_size); 505 504 } 506 505 506 + static void iwl_mvm_sync_nssn(struct iwl_mvm *mvm, u8 baid, u16 nssn) 507 + { 508 + struct iwl_mvm_rss_sync_notif notif = { 509 + .metadata.type = IWL_MVM_RXQ_NSSN_SYNC, 510 + .metadata.sync = 0, 511 + .nssn_sync.baid = baid, 512 + .nssn_sync.nssn = nssn, 513 + }; 514 + 515 + iwl_mvm_sync_rx_queues_internal(mvm, (void *)&notif, sizeof(notif)); 516 + } 517 + 507 518 #define RX_REORDER_BUF_TIMEOUT_MQ (HZ / 10) 519 + 520 + enum iwl_mvm_release_flags { 521 + IWL_MVM_RELEASE_SEND_RSS_SYNC = BIT(0), 522 + IWL_MVM_RELEASE_FROM_RSS_SYNC = BIT(1), 523 + }; 508 524 509 525 static void iwl_mvm_release_frames(struct iwl_mvm *mvm, 510 526 struct ieee80211_sta *sta, 511 527 struct napi_struct *napi, 512 528 struct iwl_mvm_baid_data *baid_data, 513 529 struct iwl_mvm_reorder_buffer *reorder_buf, 514 - u16 nssn) 530 + u16 nssn, u32 flags) 515 531 { 516 532 struct iwl_mvm_reorder_buf_entry *entries = 517 533 &baid_data->entries[reorder_buf->queue * ··· 536 518 u16 ssn = reorder_buf->head_sn; 537 519 538 520 lockdep_assert_held(&reorder_buf->lock); 521 + 522 + /* 523 + * We keep the NSSN not too far behind, if we are sync'ing it and it 524 + * is more than 2048 ahead of us, it must be behind us. Discard it. 525 + * This can happen if the queue that hit the 0 / 2048 seqno was lagging 526 + * behind and this queue already processed packets. The next if 527 + * would have caught cases where this queue would have processed less 528 + * than 64 packets, but it may have processed more than 64 packets. 529 + */ 530 + if ((flags & IWL_MVM_RELEASE_FROM_RSS_SYNC) && 531 + ieee80211_sn_less(nssn, ssn)) 532 + goto set_timer; 539 533 540 534 /* ignore nssn smaller than head sn - this can happen due to timeout */ 541 535 if (iwl_mvm_is_sn_less(nssn, ssn, reorder_buf->buf_size)) ··· 559 529 struct sk_buff *skb; 560 530 561 531 ssn = ieee80211_sn_inc(ssn); 532 + if ((flags & IWL_MVM_RELEASE_SEND_RSS_SYNC) && 533 + (ssn == 2048 || ssn == 0)) 534 + iwl_mvm_sync_nssn(mvm, baid_data->baid, ssn); 562 535 563 536 /* 564 537 * Empty the list. Will have more than one frame for A-MSDU. ··· 648 615 sta_id, sn); 649 616 iwl_mvm_event_frame_timeout_callback(buf->mvm, mvmsta->vif, 650 617 sta, baid_data->tid); 651 - iwl_mvm_release_frames(buf->mvm, sta, NULL, baid_data, buf, sn); 618 + iwl_mvm_release_frames(buf->mvm, sta, NULL, baid_data, 619 + buf, sn, IWL_MVM_RELEASE_SEND_RSS_SYNC); 652 620 rcu_read_unlock(); 653 621 } else { 654 622 /* ··· 691 657 spin_lock_bh(&reorder_buf->lock); 692 658 iwl_mvm_release_frames(mvm, sta, NULL, ba_data, reorder_buf, 693 659 ieee80211_sn_add(reorder_buf->head_sn, 694 - reorder_buf->buf_size)); 660 + reorder_buf->buf_size), 661 + 0); 695 662 spin_unlock_bh(&reorder_buf->lock); 696 663 del_timer_sync(&reorder_buf->reorder_timer); 697 664 ··· 700 665 rcu_read_unlock(); 701 666 } 702 667 703 - void iwl_mvm_rx_queue_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, 704 - int queue) 668 + static void iwl_mvm_release_frames_from_notif(struct iwl_mvm *mvm, 669 + struct napi_struct *napi, 670 + u8 baid, u16 nssn, int queue, 671 + u32 flags) 672 + { 673 + struct ieee80211_sta *sta; 674 + struct iwl_mvm_reorder_buffer *reorder_buf; 675 + struct iwl_mvm_baid_data *ba_data; 676 + 677 + IWL_DEBUG_HT(mvm, "Frame release notification for BAID %u, NSSN %d\n", 678 + baid, nssn); 679 + 680 + if (WARN_ON_ONCE(baid == IWL_RX_REORDER_DATA_INVALID_BAID || 681 + baid >= ARRAY_SIZE(mvm->baid_map))) 682 + return; 683 + 684 + rcu_read_lock(); 685 + 686 + ba_data = rcu_dereference(mvm->baid_map[baid]); 687 + if (WARN_ON_ONCE(!ba_data)) 688 + goto out; 689 + 690 + sta = rcu_dereference(mvm->fw_id_to_mac_id[ba_data->sta_id]); 691 + if (WARN_ON_ONCE(IS_ERR_OR_NULL(sta))) 692 + goto out; 693 + 694 + reorder_buf = &ba_data->reorder_buf[queue]; 695 + 696 + spin_lock_bh(&reorder_buf->lock); 697 + iwl_mvm_release_frames(mvm, sta, napi, ba_data, 698 + reorder_buf, nssn, flags); 699 + spin_unlock_bh(&reorder_buf->lock); 700 + 701 + out: 702 + rcu_read_unlock(); 703 + } 704 + 705 + static void iwl_mvm_nssn_sync(struct iwl_mvm *mvm, 706 + struct napi_struct *napi, int queue, 707 + const struct iwl_mvm_nssn_sync_data *data) 708 + { 709 + iwl_mvm_release_frames_from_notif(mvm, napi, data->baid, 710 + data->nssn, queue, 711 + IWL_MVM_RELEASE_FROM_RSS_SYNC); 712 + } 713 + 714 + void iwl_mvm_rx_queue_notif(struct iwl_mvm *mvm, struct napi_struct *napi, 715 + struct iwl_rx_cmd_buffer *rxb, int queue) 705 716 { 706 717 struct iwl_rx_packet *pkt = rxb_addr(rxb); 707 718 struct iwl_rxq_sync_notification *notif; ··· 767 686 break; 768 687 case IWL_MVM_RXQ_NOTIF_DEL_BA: 769 688 iwl_mvm_del_ba(mvm, queue, (void *)internal_notif->data); 689 + break; 690 + case IWL_MVM_RXQ_NSSN_SYNC: 691 + iwl_mvm_nssn_sync(mvm, napi, queue, 692 + (void *)internal_notif->data); 770 693 break; 771 694 default: 772 695 WARN_ONCE(1, "Invalid identifier %d", internal_notif->type); ··· 870 785 } 871 786 872 787 if (ieee80211_is_back_req(hdr->frame_control)) { 873 - iwl_mvm_release_frames(mvm, sta, napi, baid_data, buffer, nssn); 788 + iwl_mvm_release_frames(mvm, sta, napi, baid_data, 789 + buffer, nssn, 0); 874 790 goto drop; 875 791 } 876 792 ··· 880 794 * If the SN is smaller than the NSSN it might need to first go into 881 795 * the reorder buffer, in which case we just release up to it and the 882 796 * rest of the function will take care of storing it and releasing up to 883 - * the nssn 797 + * the nssn. 798 + * This should not happen. This queue has been lagging and it should 799 + * have been updated by a IWL_MVM_RXQ_NSSN_SYNC notification. Be nice 800 + * and update the other queues. 884 801 */ 885 802 if (!iwl_mvm_is_sn_less(nssn, buffer->head_sn + buffer->buf_size, 886 803 buffer->buf_size) || ··· 891 802 u16 min_sn = ieee80211_sn_less(sn, nssn) ? sn : nssn; 892 803 893 804 iwl_mvm_release_frames(mvm, sta, napi, baid_data, buffer, 894 - min_sn); 805 + min_sn, IWL_MVM_RELEASE_SEND_RSS_SYNC); 895 806 } 896 807 897 808 /* drop any oudated packets */ ··· 902 813 if (!buffer->num_stored && ieee80211_sn_less(sn, nssn)) { 903 814 if (iwl_mvm_is_sn_less(buffer->head_sn, nssn, 904 815 buffer->buf_size) && 905 - (!amsdu || last_subframe)) 816 + (!amsdu || last_subframe)) { 817 + /* 818 + * If we crossed the 2048 or 0 SN, notify all the 819 + * queues. This is done in order to avoid having a 820 + * head_sn that lags behind for too long. When that 821 + * happens, we can get to a situation where the head_sn 822 + * is within the interval [nssn - buf_size : nssn] 823 + * which will make us think that the nssn is a packet 824 + * that we already freed because of the reordering 825 + * buffer and we will ignore it. So maintain the 826 + * head_sn somewhat updated across all the queues: 827 + * when it crosses 0 and 2048. 828 + */ 829 + if (sn == 2048 || sn == 0) 830 + iwl_mvm_sync_nssn(mvm, baid, sn); 906 831 buffer->head_sn = nssn; 832 + } 907 833 /* No need to update AMSDU last SN - we are moving the head */ 908 834 spin_unlock_bh(&buffer->lock); 909 835 return false; ··· 933 829 * while technically there is no hole and we can move forward. 934 830 */ 935 831 if (!buffer->num_stored && sn == buffer->head_sn) { 936 - if (!amsdu || last_subframe) 832 + if (!amsdu || last_subframe) { 833 + if (sn == 2048 || sn == 0) 834 + iwl_mvm_sync_nssn(mvm, baid, sn); 937 835 buffer->head_sn = ieee80211_sn_inc(buffer->head_sn); 836 + } 938 837 /* No need to update AMSDU last SN - we are moving the head */ 939 838 spin_unlock_bh(&buffer->lock); 940 839 return false; ··· 982 875 * release notification with up to date NSSN. 983 876 */ 984 877 if (!amsdu || last_subframe) 985 - iwl_mvm_release_frames(mvm, sta, napi, baid_data, buffer, nssn); 878 + iwl_mvm_release_frames(mvm, sta, napi, baid_data, 879 + buffer, nssn, 880 + IWL_MVM_RELEASE_SEND_RSS_SYNC); 986 881 987 882 spin_unlock_bh(&buffer->lock); 988 883 return true; ··· 1949 1840 out: 1950 1841 rcu_read_unlock(); 1951 1842 } 1843 + 1952 1844 void iwl_mvm_rx_frame_release(struct iwl_mvm *mvm, struct napi_struct *napi, 1953 1845 struct iwl_rx_cmd_buffer *rxb, int queue) 1954 1846 { 1955 1847 struct iwl_rx_packet *pkt = rxb_addr(rxb); 1956 1848 struct iwl_frame_release *release = (void *)pkt->data; 1957 - struct ieee80211_sta *sta; 1958 - struct iwl_mvm_reorder_buffer *reorder_buf; 1959 - struct iwl_mvm_baid_data *ba_data; 1960 1849 1961 - int baid = release->baid; 1962 - 1963 - IWL_DEBUG_HT(mvm, "Frame release notification for BAID %u, NSSN %d\n", 1964 - release->baid, le16_to_cpu(release->nssn)); 1965 - 1966 - if (WARN_ON_ONCE(baid == IWL_RX_REORDER_DATA_INVALID_BAID)) 1967 - return; 1968 - 1969 - rcu_read_lock(); 1970 - 1971 - ba_data = rcu_dereference(mvm->baid_map[baid]); 1972 - if (WARN_ON_ONCE(!ba_data)) 1973 - goto out; 1974 - 1975 - sta = rcu_dereference(mvm->fw_id_to_mac_id[ba_data->sta_id]); 1976 - if (WARN_ON_ONCE(IS_ERR_OR_NULL(sta))) 1977 - goto out; 1978 - 1979 - reorder_buf = &ba_data->reorder_buf[queue]; 1980 - 1981 - spin_lock_bh(&reorder_buf->lock); 1982 - iwl_mvm_release_frames(mvm, sta, napi, ba_data, reorder_buf, 1983 - le16_to_cpu(release->nssn)); 1984 - spin_unlock_bh(&reorder_buf->lock); 1985 - 1986 - out: 1987 - rcu_read_unlock(); 1850 + iwl_mvm_release_frames_from_notif(mvm, napi, release->baid, 1851 + le16_to_cpu(release->nssn), 1852 + queue, 0); 1988 1853 }
+4 -2
drivers/net/wireless/intel/iwlwifi/mvm/sta.c
··· 1684 1684 */ 1685 1685 if (iwl_mvm_has_tlc_offload(mvm)) 1686 1686 iwl_mvm_rs_add_sta(mvm, mvm_sta); 1687 + else 1688 + spin_lock_init(&mvm_sta->lq_sta.rs_drv.pers.lock); 1687 1689 1688 1690 iwl_mvm_toggle_tx_ant(mvm, &mvm_sta->tx_ant); 1689 1691 ··· 2423 2421 2424 2422 static void iwl_mvm_sync_rxq_del_ba(struct iwl_mvm *mvm, u8 baid) 2425 2423 { 2426 - struct iwl_mvm_delba_notif notif = { 2424 + struct iwl_mvm_rss_sync_notif notif = { 2427 2425 .metadata.type = IWL_MVM_RXQ_NOTIF_DEL_BA, 2428 2426 .metadata.sync = 1, 2429 2427 .delba.baid = baid, ··· 2974 2972 IWL_DEBUG_HT(mvm, "Tx aggregation enabled on ra = %pM tid = %d\n", 2975 2973 sta->addr, tid); 2976 2974 2977 - return iwl_mvm_send_lq_cmd(mvm, &mvmsta->lq_sta.rs_drv.lq, false); 2975 + return iwl_mvm_send_lq_cmd(mvm, &mvmsta->lq_sta.rs_drv.lq); 2978 2976 } 2979 2977 2980 2978 static void iwl_mvm_unreserve_agg_queue(struct iwl_mvm *mvm,
+10 -2
drivers/net/wireless/intel/iwlwifi/mvm/sta.h
··· 343 343 u32 baid; 344 344 } __packed; 345 345 346 - struct iwl_mvm_delba_notif { 346 + struct iwl_mvm_nssn_sync_data { 347 + u32 baid; 348 + u32 nssn; 349 + } __packed; 350 + 351 + struct iwl_mvm_rss_sync_notif { 347 352 struct iwl_mvm_internal_rxq_notif metadata; 348 - struct iwl_mvm_delba_data delba; 353 + union { 354 + struct iwl_mvm_delba_data delba; 355 + struct iwl_mvm_nssn_sync_data nssn_sync; 356 + }; 349 357 } __packed; 350 358 351 359 /**
+2 -1
drivers/net/wireless/intel/iwlwifi/mvm/tx.c
··· 831 831 unsigned int tcp_payload_len; 832 832 unsigned int mss = skb_shinfo(skb)->gso_size; 833 833 bool ipv4 = (skb->protocol == htons(ETH_P_IP)); 834 + bool qos = ieee80211_is_data_qos(hdr->frame_control); 834 835 u16 ip_base_id = ipv4 ? ntohs(ip_hdr(skb)->id) : 0; 835 836 836 837 skb_shinfo(skb)->gso_size = num_subframes * mss; ··· 865 864 if (tcp_payload_len > mss) { 866 865 skb_shinfo(tmp)->gso_size = mss; 867 866 } else { 868 - if (ieee80211_is_data_qos(hdr->frame_control)) { 867 + if (qos) { 869 868 u8 *qc; 870 869 871 870 if (ipv4)
+2 -2
drivers/net/wireless/intel/iwlwifi/mvm/utils.c
··· 653 653 * this case to clear the state indicating that station creation is in 654 654 * progress. 655 655 */ 656 - int iwl_mvm_send_lq_cmd(struct iwl_mvm *mvm, struct iwl_lq_cmd *lq, bool sync) 656 + int iwl_mvm_send_lq_cmd(struct iwl_mvm *mvm, struct iwl_lq_cmd *lq) 657 657 { 658 658 struct iwl_host_cmd cmd = { 659 659 .id = LQ_CMD, 660 660 .len = { sizeof(struct iwl_lq_cmd), }, 661 - .flags = sync ? 0 : CMD_ASYNC, 661 + .flags = CMD_ASYNC, 662 662 .data = { lq, }, 663 663 }; 664 664
+3
drivers/net/wireless/intel/iwlwifi/pcie/drv.c
··· 604 604 {IWL_PCI_DEVICE(0x2526, 0x40A4, iwl9460_2ac_cfg)}, 605 605 {IWL_PCI_DEVICE(0x2526, 0x4234, iwl9560_2ac_cfg_soc)}, 606 606 {IWL_PCI_DEVICE(0x2526, 0x42A4, iwl9462_2ac_cfg_soc)}, 607 + {IWL_PCI_DEVICE(0x2526, 0x6010, iwl9260_2ac_160_cfg)}, 607 608 {IWL_PCI_DEVICE(0x2526, 0x6014, iwl9260_2ac_160_cfg)}, 608 609 {IWL_PCI_DEVICE(0x2526, 0x8014, iwl9260_2ac_160_cfg)}, 609 610 {IWL_PCI_DEVICE(0x2526, 0x8010, iwl9260_2ac_160_cfg)}, 610 611 {IWL_PCI_DEVICE(0x2526, 0xA014, iwl9260_2ac_160_cfg)}, 612 + {IWL_PCI_DEVICE(0x2526, 0xE010, iwl9260_2ac_160_cfg)}, 613 + {IWL_PCI_DEVICE(0x2526, 0xE014, iwl9260_2ac_160_cfg)}, 611 614 {IWL_PCI_DEVICE(0x271B, 0x0010, iwl9160_2ac_cfg)}, 612 615 {IWL_PCI_DEVICE(0x271B, 0x0014, iwl9160_2ac_cfg)}, 613 616 {IWL_PCI_DEVICE(0x271B, 0x0210, iwl9160_2ac_cfg)},
+2
drivers/net/wireless/intel/iwlwifi/pcie/tx.c
··· 435 435 DMA_TO_DEVICE); 436 436 } 437 437 438 + meta->tbs = 0; 439 + 438 440 if (trans->cfg->use_tfh) { 439 441 struct iwl_tfh_tfd *tfd_fh = (void *)tfd; 440 442
+5 -3
drivers/net/wireless/mac80211_hwsim.c
··· 3617 3617 hdr = genlmsg_put(skb, NETLINK_CB(cb->skb).portid, 3618 3618 cb->nlh->nlmsg_seq, &hwsim_genl_family, 3619 3619 NLM_F_MULTI, HWSIM_CMD_GET_RADIO); 3620 - if (!hdr) 3620 + if (hdr) { 3621 + genl_dump_check_consistent(cb, hdr); 3622 + genlmsg_end(skb, hdr); 3623 + } else { 3621 3624 res = -EMSGSIZE; 3622 - genl_dump_check_consistent(cb, hdr); 3623 - genlmsg_end(skb, hdr); 3625 + } 3624 3626 } 3625 3627 3626 3628 done:
+1
drivers/net/wireless/marvell/mwifiex/main.h
··· 124 124 125 125 #define MWIFIEX_MAX_TOTAL_SCAN_TIME (MWIFIEX_TIMER_10S - MWIFIEX_TIMER_1S) 126 126 127 + #define WPA_GTK_OUI_OFFSET 2 127 128 #define RSN_GTK_OUI_OFFSET 2 128 129 129 130 #define MWIFIEX_OUI_NOT_PRESENT 0
+2 -1
drivers/net/wireless/marvell/mwifiex/scan.c
··· 181 181 u8 ret = MWIFIEX_OUI_NOT_PRESENT; 182 182 183 183 if (has_vendor_hdr(bss_desc->bcn_wpa_ie, WLAN_EID_VENDOR_SPECIFIC)) { 184 - iebody = (struct ie_body *) bss_desc->bcn_wpa_ie->data; 184 + iebody = (struct ie_body *)((u8 *)bss_desc->bcn_wpa_ie->data + 185 + WPA_GTK_OUI_OFFSET); 185 186 oui = &mwifiex_wpa_oui[cipher][0]; 186 187 ret = mwifiex_search_oui_in_ie(iebody, oui); 187 188 if (ret)
+2 -2
drivers/nfc/nfcmrvl/main.c
··· 244 244 /* Reset possible fault of previous session */ 245 245 clear_bit(NFCMRVL_PHY_ERROR, &priv->flags); 246 246 247 - if (priv->config.reset_n_io) { 247 + if (gpio_is_valid(priv->config.reset_n_io)) { 248 248 nfc_info(priv->dev, "reset the chip\n"); 249 249 gpio_set_value(priv->config.reset_n_io, 0); 250 250 usleep_range(5000, 10000); ··· 255 255 256 256 void nfcmrvl_chip_halt(struct nfcmrvl_private *priv) 257 257 { 258 - if (priv->config.reset_n_io) 258 + if (gpio_is_valid(priv->config.reset_n_io)) 259 259 gpio_set_value(priv->config.reset_n_io, 0); 260 260 } 261 261
+2 -2
drivers/nfc/nfcmrvl/uart.c
··· 26 26 static unsigned int hci_muxed; 27 27 static unsigned int flow_control; 28 28 static unsigned int break_control; 29 - static unsigned int reset_n_io; 29 + static int reset_n_io = -EINVAL; 30 30 31 31 /* 32 32 ** NFCMRVL NCI OPS ··· 231 231 module_param(hci_muxed, uint, 0); 232 232 MODULE_PARM_DESC(hci_muxed, "Tell if transport is muxed in HCI one."); 233 233 234 - module_param(reset_n_io, uint, 0); 234 + module_param(reset_n_io, int, 0); 235 235 MODULE_PARM_DESC(reset_n_io, "GPIO that is wired to RESET_N signal.");
+1
drivers/nfc/nfcmrvl/usb.c
··· 305 305 306 306 /* No configuration for USB */ 307 307 memset(&config, 0, sizeof(config)); 308 + config.reset_n_io = -EINVAL; 308 309 309 310 nfc_info(&udev->dev, "intf %p id %p\n", intf, id); 310 311
+2
drivers/nfc/st-nci/se.c
··· 333 333 334 334 transaction = (struct nfc_evt_transaction *)devm_kzalloc(dev, 335 335 skb->len - 2, GFP_KERNEL); 336 + if (!transaction) 337 + return -ENOMEM; 336 338 337 339 transaction->aid_len = skb->data[1]; 338 340 memcpy(transaction->aid, &skb->data[2], transaction->aid_len);
+2
drivers/nfc/st21nfca/se.c
··· 317 317 318 318 transaction = (struct nfc_evt_transaction *)devm_kzalloc(dev, 319 319 skb->len - 2, GFP_KERNEL); 320 + if (!transaction) 321 + return -ENOMEM; 320 322 321 323 transaction->aid_len = skb->data[1]; 322 324 memcpy(transaction->aid, &skb->data[2],
-3
fs/compat_ioctl.c
··· 638 638 COMPATIBLE_IOCTL(PPPIOCATTCHAN) 639 639 COMPATIBLE_IOCTL(PPPIOCGCHAN) 640 640 COMPATIBLE_IOCTL(PPPIOCGL2TPSTATS) 641 - /* PPPOX */ 642 - COMPATIBLE_IOCTL(PPPOEIOCSFWD) 643 - COMPATIBLE_IOCTL(PPPOEIOCDFWD) 644 641 /* Big A */ 645 642 /* sparc only */ 646 643 /* Big Q for sound/OSS */
-56
include/linux/dim.h
··· 272 272 273 273 /* Net DIM */ 274 274 275 - /* 276 - * Net DIM profiles: 277 - * There are different set of profiles for each CQ period mode. 278 - * There are different set of profiles for RX/TX CQs. 279 - * Each profile size must be of NET_DIM_PARAMS_NUM_PROFILES 280 - */ 281 - #define NET_DIM_PARAMS_NUM_PROFILES 5 282 - #define NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE 256 283 - #define NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE 128 284 - #define NET_DIM_DEF_PROFILE_CQE 1 285 - #define NET_DIM_DEF_PROFILE_EQE 1 286 - 287 - #define NET_DIM_RX_EQE_PROFILES { \ 288 - {1, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ 289 - {8, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ 290 - {64, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ 291 - {128, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ 292 - {256, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ 293 - } 294 - 295 - #define NET_DIM_RX_CQE_PROFILES { \ 296 - {2, 256}, \ 297 - {8, 128}, \ 298 - {16, 64}, \ 299 - {32, 64}, \ 300 - {64, 64} \ 301 - } 302 - 303 - #define NET_DIM_TX_EQE_PROFILES { \ 304 - {1, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \ 305 - {8, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \ 306 - {32, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \ 307 - {64, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \ 308 - {128, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE} \ 309 - } 310 - 311 - #define NET_DIM_TX_CQE_PROFILES { \ 312 - {5, 128}, \ 313 - {8, 64}, \ 314 - {16, 32}, \ 315 - {32, 32}, \ 316 - {64, 32} \ 317 - } 318 - 319 - static const struct dim_cq_moder 320 - rx_profile[DIM_CQ_PERIOD_NUM_MODES][NET_DIM_PARAMS_NUM_PROFILES] = { 321 - NET_DIM_RX_EQE_PROFILES, 322 - NET_DIM_RX_CQE_PROFILES, 323 - }; 324 - 325 - static const struct dim_cq_moder 326 - tx_profile[DIM_CQ_PERIOD_NUM_MODES][NET_DIM_PARAMS_NUM_PROFILES] = { 327 - NET_DIM_TX_EQE_PROFILES, 328 - NET_DIM_TX_CQE_PROFILES, 329 - }; 330 - 331 275 /** 332 276 * net_dim_get_rx_moderation - provide a CQ moderation object for the given RX profile 333 277 * @cq_period_mode: CQ period mode
+13
include/linux/filter.h
··· 24 24 25 25 #include <net/sch_generic.h> 26 26 27 + #include <asm/byteorder.h> 27 28 #include <uapi/linux/filter.h> 28 29 #include <uapi/linux/bpf.h> 29 30 ··· 746 745 bpf_ctx_narrow_access_ok(u32 off, u32 size, u32 size_default) 747 746 { 748 747 return size <= size_default && (size & (size - 1)) == 0; 748 + } 749 + 750 + static inline u8 751 + bpf_ctx_narrow_load_shift(u32 off, u32 size, u32 size_default) 752 + { 753 + u8 load_off = off & (size_default - 1); 754 + 755 + #ifdef __LITTLE_ENDIAN 756 + return load_off * 8; 757 + #else 758 + return (size_default - (load_off + size)) * 8; 759 + #endif 749 760 } 750 761 751 762 #define bpf_ctx_wide_access_ok(off, size, type, field) \
+3
include/linux/if_pppox.h
··· 80 80 extern void unregister_pppox_proto(int proto_num); 81 81 extern void pppox_unbind_sock(struct sock *sk);/* delete ppp-channel binding */ 82 82 extern int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); 83 + extern int pppox_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); 84 + 85 + #define PPPOEIOCSFWD32 _IOW(0xB1 ,0, compat_size_t) 83 86 84 87 /* PPPoX socket states */ 85 88 enum {
+2 -2
include/linux/if_rmnet.h
··· 41 41 __be16 csum_start_offset; 42 42 #if defined(__LITTLE_ENDIAN_BITFIELD) 43 43 u16 csum_insert_offset:14; 44 - u16 udp_ip4_ind:1; 44 + u16 udp_ind:1; 45 45 u16 csum_enabled:1; 46 46 #elif defined (__BIG_ENDIAN_BITFIELD) 47 47 u16 csum_enabled:1; 48 - u16 udp_ip4_ind:1; 48 + u16 udp_ind:1; 49 49 u16 csum_insert_offset:14; 50 50 #else 51 51 #error "Please fix <asm/byteorder.h>"
+1
include/linux/mlx5/fs.h
··· 220 220 221 221 struct mlx5_fc *mlx5_fc_create(struct mlx5_core_dev *dev, bool aging); 222 222 void mlx5_fc_destroy(struct mlx5_core_dev *dev, struct mlx5_fc *counter); 223 + u64 mlx5_fc_query_lastuse(struct mlx5_fc *counter); 223 224 void mlx5_fc_query_cached(struct mlx5_fc *counter, 224 225 u64 *bytes, u64 *packets, u64 *lastuse); 225 226 int mlx5_fc_query(struct mlx5_core_dev *dev, struct mlx5_fc *counter,
+4 -2
include/linux/mlx5/mlx5_ifc.h
··· 5975 5975 5976 5976 struct mlx5_ifc_cqc_bits cq_context; 5977 5977 5978 - u8 reserved_at_280[0x40]; 5978 + u8 reserved_at_280[0x60]; 5979 5979 5980 5980 u8 cq_umem_valid[0x1]; 5981 - u8 reserved_at_2c1[0x5bf]; 5981 + u8 reserved_at_2e1[0x1f]; 5982 + 5983 + u8 reserved_at_300[0x580]; 5982 5984 5983 5985 u8 pas[0][0x40]; 5984 5986 };
+7 -1
include/linux/skmsg.h
··· 354 354 sk->sk_write_space = psock->saved_write_space; 355 355 356 356 if (psock->sk_proto) { 357 - sk->sk_prot = psock->sk_proto; 357 + struct inet_connection_sock *icsk = inet_csk(sk); 358 + bool has_ulp = !!icsk->icsk_ulp_data; 359 + 360 + if (has_ulp) 361 + tcp_update_ulp(sk, psock->sk_proto); 362 + else 363 + sk->sk_prot = psock->sk_proto; 358 364 psock->sk_proto = NULL; 359 365 } 360 366 }
+15
include/net/cfg80211.h
··· 7320 7320 struct cfg80211_pmsr_request *req, 7321 7321 gfp_t gfp); 7322 7322 7323 + /** 7324 + * cfg80211_iftype_allowed - check whether the interface can be allowed 7325 + * @wiphy: the wiphy 7326 + * @iftype: interface type 7327 + * @is_4addr: use_4addr flag, must be '0' when check_swif is '1' 7328 + * @check_swif: check iftype against software interfaces 7329 + * 7330 + * Check whether the interface is allowed to operate; additionally, this API 7331 + * can be used to check iftype against the software interfaces when 7332 + * check_swif is '1'. 7333 + */ 7334 + bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype, 7335 + bool is_4addr, u8 check_swif); 7336 + 7337 + 7323 7338 /* Logging, debugging and troubleshooting/diagnostic helpers. */ 7324 7339 7325 7340 /* wiphy_printk helpers, similar to dev_printk */
+2 -2
include/net/tc_act/tc_police.h
··· 54 54 struct tcf_police *police = to_police(act); 55 55 struct tcf_police_params *params; 56 56 57 - params = rcu_dereference_bh(police->params); 57 + params = rcu_dereference_bh_rtnl(police->params); 58 58 return params->rate.rate_bytes_ps; 59 59 } 60 60 ··· 63 63 struct tcf_police *police = to_police(act); 64 64 struct tcf_police_params *params; 65 65 66 - params = rcu_dereference_bh(police->params); 66 + params = rcu_dereference_bh_rtnl(police->params); 67 67 return params->tcfp_burst; 68 68 } 69 69
+1 -1
include/net/tc_act/tc_sample.h
··· 44 44 static inline struct psample_group * 45 45 tcf_sample_psample_group(const struct tc_action *a) 46 46 { 47 - return rcu_dereference(to_sample(a)->psample_group); 47 + return rcu_dereference_rtnl(to_sample(a)->psample_group); 48 48 } 49 49 50 50 #endif /* __NET_TC_SAMPLE_H */
+3
include/net/tcp.h
··· 2108 2108 2109 2109 /* initialize ulp */ 2110 2110 int (*init)(struct sock *sk); 2111 + /* update ulp */ 2112 + void (*update)(struct sock *sk, struct proto *p); 2111 2113 /* cleanup ulp */ 2112 2114 void (*release)(struct sock *sk); 2113 2115 ··· 2121 2119 int tcp_set_ulp(struct sock *sk, const char *name); 2122 2120 void tcp_get_available_ulp(char *buf, size_t len); 2123 2121 void tcp_cleanup_ulp(struct sock *sk); 2122 + void tcp_update_ulp(struct sock *sk, struct proto *p); 2124 2123 2125 2124 #define MODULE_ALIAS_TCP_ULP(name) \ 2126 2125 __MODULE_INFO(alias, alias_userspace, name); \
+9 -4
include/net/tls.h
··· 107 107 enum { 108 108 TLS_BASE, 109 109 TLS_SW, 110 - #ifdef CONFIG_TLS_DEVICE 111 110 TLS_HW, 112 - #endif 113 111 TLS_HW_RECORD, 114 112 TLS_NUM_CONFIG, 115 113 }; ··· 160 162 int async_capable; 161 163 162 164 #define BIT_TX_SCHEDULED 0 165 + #define BIT_TX_CLOSING 1 163 166 unsigned long tx_bitmask; 164 167 }; 165 168 ··· 271 272 unsigned long flags; 272 273 273 274 /* cache cold stuff */ 275 + struct proto *sk_proto; 276 + 274 277 void (*sk_destruct)(struct sock *sk); 275 278 void (*sk_proto_close)(struct sock *sk, long timeout); 276 279 ··· 356 355 unsigned int optlen); 357 356 358 357 int tls_set_sw_offload(struct sock *sk, struct tls_context *ctx, int tx); 358 + void tls_sw_strparser_arm(struct sock *sk, struct tls_context *ctx); 359 + void tls_sw_strparser_done(struct tls_context *tls_ctx); 359 360 int tls_sw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size); 360 361 int tls_sw_sendpage(struct sock *sk, struct page *page, 361 362 int offset, size_t size, int flags); 362 - void tls_sw_close(struct sock *sk, long timeout); 363 - void tls_sw_free_resources_tx(struct sock *sk); 363 + void tls_sw_cancel_work_tx(struct tls_context *tls_ctx); 364 + void tls_sw_release_resources_tx(struct sock *sk); 365 + void tls_sw_free_ctx_tx(struct tls_context *tls_ctx); 364 366 void tls_sw_free_resources_rx(struct sock *sk); 365 367 void tls_sw_release_resources_rx(struct sock *sk); 368 + void tls_sw_free_ctx_rx(struct tls_context *tls_ctx); 366 369 int tls_sw_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, 367 370 int nonblock, int flags, int *addr_len); 368 371 bool tls_sw_stream_read(const struct sock *sk);
+6
include/uapi/linux/netfilter/xt_connlabel.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 + 3 + #ifndef _UAPI_XT_CONNLABEL_H 4 + #define _UAPI_XT_CONNLABEL_H 5 + 2 6 #include <linux/types.h> 3 7 4 8 #define XT_CONNLABEL_MAXBIT 127 ··· 15 11 __u16 bit; 16 12 __u16 options; 17 13 }; 14 + 15 + #endif /* _UAPI_XT_CONNLABEL_H */
+13 -6
include/uapi/linux/socket.h
··· 6 6 * Desired design of maximum size and alignment (see RFC2553) 7 7 */ 8 8 #define _K_SS_MAXSIZE 128 /* Implementation specific max size */ 9 - #define _K_SS_ALIGNSIZE (__alignof__ (struct sockaddr *)) 10 - /* Implementation specific desired alignment */ 11 9 12 10 typedef unsigned short __kernel_sa_family_t; 13 11 12 + /* 13 + * The definition uses anonymous union and struct in order to control the 14 + * default alignment. 15 + */ 14 16 struct __kernel_sockaddr_storage { 15 - __kernel_sa_family_t ss_family; /* address family */ 16 - /* Following field(s) are implementation specific */ 17 - char __data[_K_SS_MAXSIZE - sizeof(unsigned short)]; 17 + union { 18 + struct { 19 + __kernel_sa_family_t ss_family; /* address family */ 20 + /* Following field(s) are implementation specific */ 21 + char __data[_K_SS_MAXSIZE - sizeof(unsigned short)]; 18 22 /* space to achieve desired size, */ 19 23 /* _SS_MAXSIZE value minus size of ss_family */ 20 - } __attribute__ ((aligned(_K_SS_ALIGNSIZE))); /* force desired alignment */ 24 + }; 25 + void *__align; /* implementation specific desired alignment */ 26 + }; 27 + }; 21 28 22 29 #endif /* _UAPI_LINUX_SOCKET_H */
+2 -2
kernel/bpf/verifier.c
··· 8616 8616 } 8617 8617 8618 8618 if (is_narrower_load && size < target_size) { 8619 - u8 shift = (off & (size_default - 1)) * 8; 8620 - 8619 + u8 shift = bpf_ctx_narrow_load_shift(off, size, 8620 + size_default); 8621 8621 if (ctx_field_size <= 4) { 8622 8622 if (shift) 8623 8623 insn_buf[cnt++] = BPF_ALU32_IMM(BPF_RSH,
+2 -2
lib/dim/dim.c
··· 74 74 delta_us); 75 75 curr_stats->cpms = DIV_ROUND_UP(ncomps * USEC_PER_MSEC, delta_us); 76 76 if (curr_stats->epms != 0) 77 - curr_stats->cpe_ratio = 78 - (curr_stats->cpms * 100) / curr_stats->epms; 77 + curr_stats->cpe_ratio = DIV_ROUND_DOWN_ULL( 78 + curr_stats->cpms * 100, curr_stats->epms); 79 79 else 80 80 curr_stats->cpe_ratio = 0; 81 81
+56
lib/dim/net_dim.c
··· 5 5 6 6 #include <linux/dim.h> 7 7 8 + /* 9 + * Net DIM profiles: 10 + * There are different set of profiles for each CQ period mode. 11 + * There are different set of profiles for RX/TX CQs. 12 + * Each profile size must be of NET_DIM_PARAMS_NUM_PROFILES 13 + */ 14 + #define NET_DIM_PARAMS_NUM_PROFILES 5 15 + #define NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE 256 16 + #define NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE 128 17 + #define NET_DIM_DEF_PROFILE_CQE 1 18 + #define NET_DIM_DEF_PROFILE_EQE 1 19 + 20 + #define NET_DIM_RX_EQE_PROFILES { \ 21 + {1, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ 22 + {8, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ 23 + {64, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ 24 + {128, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ 25 + {256, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ 26 + } 27 + 28 + #define NET_DIM_RX_CQE_PROFILES { \ 29 + {2, 256}, \ 30 + {8, 128}, \ 31 + {16, 64}, \ 32 + {32, 64}, \ 33 + {64, 64} \ 34 + } 35 + 36 + #define NET_DIM_TX_EQE_PROFILES { \ 37 + {1, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \ 38 + {8, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \ 39 + {32, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \ 40 + {64, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \ 41 + {128, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE} \ 42 + } 43 + 44 + #define NET_DIM_TX_CQE_PROFILES { \ 45 + {5, 128}, \ 46 + {8, 64}, \ 47 + {16, 32}, \ 48 + {32, 32}, \ 49 + {64, 32} \ 50 + } 51 + 52 + static const struct dim_cq_moder 53 + rx_profile[DIM_CQ_PERIOD_NUM_MODES][NET_DIM_PARAMS_NUM_PROFILES] = { 54 + NET_DIM_RX_EQE_PROFILES, 55 + NET_DIM_RX_CQE_PROFILES, 56 + }; 57 + 58 + static const struct dim_cq_moder 59 + tx_profile[DIM_CQ_PERIOD_NUM_MODES][NET_DIM_PARAMS_NUM_PROFILES] = { 60 + NET_DIM_TX_EQE_PROFILES, 61 + NET_DIM_TX_CQE_PROFILES, 62 + }; 63 + 8 64 struct dim_cq_moder 9 65 net_dim_get_rx_moderation(u8 cq_period_mode, int ix) 10 66 {
+4 -1
net/bridge/br.c
··· 37 37 int err; 38 38 39 39 if (dev->priv_flags & IFF_EBRIDGE) { 40 + err = br_vlan_bridge_event(dev, event, ptr); 41 + if (err) 42 + return notifier_from_errno(err); 43 + 40 44 if (event == NETDEV_REGISTER) { 41 45 /* register of bridge completed, add sysfs entries */ 42 46 br_sysfs_addbr(dev); 43 47 return NOTIFY_DONE; 44 48 } 45 - br_vlan_bridge_event(dev, event, ptr); 46 49 } 47 50 48 51 /* not a port of a bridge */
+3
net/bridge/br_multicast.c
··· 1388 1388 if (!br_port_group_equal(p, port, src)) 1389 1389 continue; 1390 1390 1391 + if (p->flags & MDB_PG_FLAGS_PERMANENT) 1392 + break; 1393 + 1391 1394 rcu_assign_pointer(*pp, p->next); 1392 1395 hlist_del_init(&p->mglist); 1393 1396 del_timer(&p->timer);
+5 -4
net/bridge/br_private.h
··· 894 894 void br_vlan_get_stats(const struct net_bridge_vlan *v, 895 895 struct br_vlan_stats *stats); 896 896 void br_vlan_port_event(struct net_bridge_port *p, unsigned long event); 897 - void br_vlan_bridge_event(struct net_device *dev, unsigned long event, 898 - void *ptr); 897 + int br_vlan_bridge_event(struct net_device *dev, unsigned long event, 898 + void *ptr); 899 899 900 900 static inline struct net_bridge_vlan_group *br_vlan_group( 901 901 const struct net_bridge *br) ··· 1085 1085 { 1086 1086 } 1087 1087 1088 - static inline void br_vlan_bridge_event(struct net_device *dev, 1089 - unsigned long event, void *ptr) 1088 + static inline int br_vlan_bridge_event(struct net_device *dev, 1089 + unsigned long event, void *ptr) 1090 1090 { 1091 + return 0; 1091 1092 } 1092 1093 #endif 1093 1094
+16 -13
net/bridge/br_vlan.c
··· 1053 1053 { 1054 1054 struct net_bridge_vlan_group *vg; 1055 1055 int ret = -ENOMEM; 1056 - bool changed; 1057 1056 1058 1057 vg = kzalloc(sizeof(*vg), GFP_KERNEL); 1059 1058 if (!vg) ··· 1067 1068 br->vlan_proto = htons(ETH_P_8021Q); 1068 1069 br->default_pvid = 1; 1069 1070 rcu_assign_pointer(br->vlgrp, vg); 1070 - ret = br_vlan_add(br, 1, 1071 - BRIDGE_VLAN_INFO_PVID | BRIDGE_VLAN_INFO_UNTAGGED | 1072 - BRIDGE_VLAN_INFO_BRENTRY, &changed, NULL); 1073 - if (ret) 1074 - goto err_vlan_add; 1075 1071 1076 1072 out: 1077 1073 return ret; 1078 1074 1079 - err_vlan_add: 1080 - vlan_tunnel_deinit(vg); 1081 1075 err_tunnel_init: 1082 1076 rhashtable_destroy(&vg->vlan_hash); 1083 1077 err_rhtbl: ··· 1456 1464 } 1457 1465 1458 1466 /* Must be protected by RTNL. */ 1459 - void br_vlan_bridge_event(struct net_device *dev, unsigned long event, 1460 - void *ptr) 1467 + int br_vlan_bridge_event(struct net_device *dev, unsigned long event, void *ptr) 1461 1468 { 1462 1469 struct netdev_notifier_changeupper_info *info; 1463 - struct net_bridge *br; 1470 + struct net_bridge *br = netdev_priv(dev); 1471 + bool changed; 1472 + int ret = 0; 1464 1473 1465 1474 switch (event) { 1475 + case NETDEV_REGISTER: 1476 + ret = br_vlan_add(br, br->default_pvid, 1477 + BRIDGE_VLAN_INFO_PVID | 1478 + BRIDGE_VLAN_INFO_UNTAGGED | 1479 + BRIDGE_VLAN_INFO_BRENTRY, &changed, NULL); 1480 + break; 1481 + case NETDEV_UNREGISTER: 1482 + br_vlan_delete(br, br->default_pvid); 1483 + break; 1466 1484 case NETDEV_CHANGEUPPER: 1467 1485 info = ptr; 1468 1486 br_vlan_upper_change(dev, info->upper_dev, info->linking); ··· 1480 1478 1481 1479 case NETDEV_CHANGE: 1482 1480 case NETDEV_UP: 1483 - br = netdev_priv(dev); 1484 1481 if (!br_opt_get(br, BROPT_VLAN_BRIDGE_BINDING)) 1485 - return; 1482 + break; 1486 1483 br_vlan_link_state_change(dev, br); 1487 1484 break; 1488 1485 } 1486 + 1487 + return ret; 1489 1488 } 1490 1489 1491 1490 /* Must be protected by RTNL. */
+20 -12
net/bridge/netfilter/ebtables.c
··· 1770 1770 return 0; 1771 1771 } 1772 1772 1773 + static int ebt_compat_init_offsets(unsigned int number) 1774 + { 1775 + if (number > INT_MAX) 1776 + return -EINVAL; 1777 + 1778 + /* also count the base chain policies */ 1779 + number += NF_BR_NUMHOOKS; 1780 + 1781 + return xt_compat_init_offsets(NFPROTO_BRIDGE, number); 1782 + } 1773 1783 1774 1784 static int compat_table_info(const struct ebt_table_info *info, 1775 1785 struct compat_ebt_replace *newinfo) 1776 1786 { 1777 1787 unsigned int size = info->entries_size; 1778 1788 const void *entries = info->entries; 1789 + int ret; 1779 1790 1780 1791 newinfo->entries_size = size; 1781 - if (info->nentries) { 1782 - int ret = xt_compat_init_offsets(NFPROTO_BRIDGE, 1783 - info->nentries); 1784 - if (ret) 1785 - return ret; 1786 - } 1792 + ret = ebt_compat_init_offsets(info->nentries); 1793 + if (ret) 1794 + return ret; 1787 1795 1788 1796 return EBT_ENTRY_ITERATE(entries, size, compat_calc_entry, info, 1789 1797 entries, newinfo); ··· 2242 2234 2243 2235 xt_compat_lock(NFPROTO_BRIDGE); 2244 2236 2245 - if (tmp.nentries) { 2246 - ret = xt_compat_init_offsets(NFPROTO_BRIDGE, tmp.nentries); 2247 - if (ret < 0) 2248 - goto out_unlock; 2249 - } 2237 + ret = ebt_compat_init_offsets(tmp.nentries); 2238 + if (ret < 0) 2239 + goto out_unlock; 2250 2240 2251 2241 ret = compat_copy_entries(entries_tmp, tmp.entries_size, &state); 2252 2242 if (ret < 0) ··· 2267 2261 state.buf_kern_len = size64; 2268 2262 2269 2263 ret = compat_copy_entries(entries_tmp, tmp.entries_size, &state); 2270 - if (WARN_ON(ret < 0)) 2264 + if (WARN_ON(ret < 0)) { 2265 + vfree(entries_tmp); 2271 2266 goto out_unlock; 2267 + } 2272 2268 2273 2269 vfree(entries_tmp); 2274 2270 tmp.entries_size = size64;
+2 -8
net/bridge/netfilter/nft_meta_bridge.c
··· 30 30 switch (priv->key) { 31 31 case NFT_META_BRI_IIFNAME: 32 32 br_dev = nft_meta_get_bridge(in); 33 - if (!br_dev) 34 - goto err; 35 33 break; 36 34 case NFT_META_BRI_OIFNAME: 37 35 br_dev = nft_meta_get_bridge(out); 38 - if (!br_dev) 39 - goto err; 40 36 break; 41 37 case NFT_META_BRI_IIFPVID: { 42 38 u16 p_pvid; ··· 57 61 return; 58 62 } 59 63 default: 60 - goto out; 64 + return nft_meta_get_eval(expr, regs, pkt); 61 65 } 62 66 63 - strncpy((char *)dest, br_dev->name, IFNAMSIZ); 67 + strncpy((char *)dest, br_dev ? br_dev->name : "", IFNAMSIZ); 64 68 return; 65 - out: 66 - return nft_meta_get_eval(expr, regs, pkt); 67 69 err: 68 70 regs->verdict.code = NFT_BREAK; 69 71 }
+32 -14
net/can/gw.c
··· 1046 1046 pr_info("can: netlink gateway (rev " CAN_GW_VERSION ") max_hops=%d\n", 1047 1047 max_hops); 1048 1048 1049 - register_pernet_subsys(&cangw_pernet_ops); 1049 + ret = register_pernet_subsys(&cangw_pernet_ops); 1050 + if (ret) 1051 + return ret; 1052 + 1053 + ret = -ENOMEM; 1050 1054 cgw_cache = kmem_cache_create("can_gw", sizeof(struct cgw_job), 1051 1055 0, 0, NULL); 1052 - 1053 1056 if (!cgw_cache) 1054 - return -ENOMEM; 1057 + goto out_cache_create; 1055 1058 1056 1059 /* set notifier */ 1057 1060 notifier.notifier_call = cgw_notifier; 1058 - register_netdevice_notifier(&notifier); 1061 + ret = register_netdevice_notifier(&notifier); 1062 + if (ret) 1063 + goto out_register_notifier; 1059 1064 1060 1065 ret = rtnl_register_module(THIS_MODULE, PF_CAN, RTM_GETROUTE, 1061 1066 NULL, cgw_dump_jobs, 0); 1062 - if (ret) { 1063 - unregister_netdevice_notifier(&notifier); 1064 - kmem_cache_destroy(cgw_cache); 1065 - return -ENOBUFS; 1066 - } 1067 + if (ret) 1068 + goto out_rtnl_register1; 1067 1069 1068 - /* Only the first call to rtnl_register_module can fail */ 1069 - rtnl_register_module(THIS_MODULE, PF_CAN, RTM_NEWROUTE, 1070 - cgw_create_job, NULL, 0); 1071 - rtnl_register_module(THIS_MODULE, PF_CAN, RTM_DELROUTE, 1072 - cgw_remove_job, NULL, 0); 1070 + ret = rtnl_register_module(THIS_MODULE, PF_CAN, RTM_NEWROUTE, 1071 + cgw_create_job, NULL, 0); 1072 + if (ret) 1073 + goto out_rtnl_register2; 1074 + ret = rtnl_register_module(THIS_MODULE, PF_CAN, RTM_DELROUTE, 1075 + cgw_remove_job, NULL, 0); 1076 + if (ret) 1077 + goto out_rtnl_register3; 1073 1078 1074 1079 return 0; 1080 + 1081 + out_rtnl_register3: 1082 + rtnl_unregister(PF_CAN, RTM_NEWROUTE); 1083 + out_rtnl_register2: 1084 + rtnl_unregister(PF_CAN, RTM_GETROUTE); 1085 + out_rtnl_register1: 1086 + unregister_netdevice_notifier(&notifier); 1087 + out_register_notifier: 1088 + kmem_cache_destroy(cgw_cache); 1089 + out_cache_create: 1090 + unregister_pernet_subsys(&cangw_pernet_ops); 1091 + 1092 + return ret; 1075 1093 } 1076 1094 1077 1095 static __exit void cgw_module_exit(void)
+12 -5
net/core/dev.c
··· 4374 4374 4375 4375 act = bpf_prog_run_xdp(xdp_prog, xdp); 4376 4376 4377 + /* check if bpf_xdp_adjust_head was used */ 4377 4378 off = xdp->data - orig_data; 4378 - if (off > 0) 4379 - __skb_pull(skb, off); 4380 - else if (off < 0) 4381 - __skb_push(skb, -off); 4382 - skb->mac_header += off; 4379 + if (off) { 4380 + if (off > 0) 4381 + __skb_pull(skb, off); 4382 + else if (off < 0) 4383 + __skb_push(skb, -off); 4384 + 4385 + skb->mac_header += off; 4386 + skb_reset_network_header(skb); 4387 + } 4383 4388 4384 4389 /* check if bpf_xdp_adjust_tail was used. it can only "shrink" 4385 4390 * pckt. ··· 9706 9701 9707 9702 /* Push remaining network devices to init_net */ 9708 9703 snprintf(fb_name, IFNAMSIZ, "dev%d", dev->ifindex); 9704 + if (__dev_get_by_name(&init_net, fb_name)) 9705 + snprintf(fb_name, IFNAMSIZ, "dev%%d"); 9709 9706 err = dev_change_net_namespace(dev, &init_net, fb_name); 9710 9707 if (err) { 9711 9708 pr_emerg("%s: failed to move %s to init_net: %d\n",
+3 -3
net/core/filter.c
··· 7455 7455 case offsetof(struct __sk_buff, gso_segs): 7456 7456 /* si->dst_reg = skb_shinfo(SKB); */ 7457 7457 #ifdef NET_SKBUFF_DATA_USES_OFFSET 7458 - *insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(struct sk_buff, head), 7459 - si->dst_reg, si->src_reg, 7460 - offsetof(struct sk_buff, head)); 7461 7458 *insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(struct sk_buff, end), 7462 7459 BPF_REG_AX, si->src_reg, 7463 7460 offsetof(struct sk_buff, end)); 7461 + *insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(struct sk_buff, head), 7462 + si->dst_reg, si->src_reg, 7463 + offsetof(struct sk_buff, head)); 7464 7464 *insn++ = BPF_ALU64_REG(BPF_ADD, si->dst_reg, BPF_REG_AX); 7465 7465 #else 7466 7466 *insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(struct sk_buff, end),
+2 -2
net/core/skmsg.c
··· 585 585 586 586 void sk_psock_drop(struct sock *sk, struct sk_psock *psock) 587 587 { 588 - rcu_assign_sk_user_data(sk, NULL); 589 588 sk_psock_cork_free(psock); 590 589 sk_psock_zap_ingress(psock); 591 - sk_psock_restore_proto(sk, psock); 592 590 593 591 write_lock_bh(&sk->sk_callback_lock); 592 + sk_psock_restore_proto(sk, psock); 593 + rcu_assign_sk_user_data(sk, NULL); 594 594 if (psock->progs.skb_parser) 595 595 sk_psock_stop_strp(sk, psock); 596 596 write_unlock_bh(&sk->sk_callback_lock);
+14 -5
net/core/sock_map.c
··· 247 247 raw_spin_unlock_bh(&stab->lock); 248 248 rcu_read_unlock(); 249 249 250 + synchronize_rcu(); 251 + 250 252 bpf_map_area_free(stab->sks); 251 253 kfree(stab); 252 254 } ··· 278 276 struct sock **psk) 279 277 { 280 278 struct sock *sk; 279 + int err = 0; 281 280 282 281 raw_spin_lock_bh(&stab->lock); 283 282 sk = *psk; 284 283 if (!sk_test || sk_test == sk) 285 - *psk = NULL; 284 + sk = xchg(psk, NULL); 285 + 286 + if (likely(sk)) 287 + sock_map_unref(sk, psk); 288 + else 289 + err = -EINVAL; 290 + 286 291 raw_spin_unlock_bh(&stab->lock); 287 - if (unlikely(!sk)) 288 - return -EINVAL; 289 - sock_map_unref(sk, psk); 290 - return 0; 292 + return err; 291 293 } 292 294 293 295 static void sock_map_delete_from_link(struct bpf_map *map, struct sock *sk, ··· 334 328 struct sock *sk, u64 flags) 335 329 { 336 330 struct bpf_stab *stab = container_of(map, struct bpf_stab, map); 331 + struct inet_connection_sock *icsk = inet_csk(sk); 337 332 struct sk_psock_link *link; 338 333 struct sk_psock *psock; 339 334 struct sock *osk; ··· 345 338 return -EINVAL; 346 339 if (unlikely(idx >= map->max_entries)) 347 340 return -E2BIG; 341 + if (unlikely(icsk->icsk_ulp_data)) 342 + return -EINVAL; 348 343 349 344 link = sk_psock_init_link(); 350 345 if (!link)
+2 -10
net/dsa/tag_sja1105.c
··· 165 165 "Expected meta frame, is %12llx " 166 166 "in the DSA master multicast filter?\n", 167 167 SJA1105_META_DMAC); 168 + kfree_skb(sp->data->stampable_skb); 168 169 } 169 170 170 171 /* Hold a reference to avoid dsa_switch_rcv ··· 212 211 * for further processing up the network stack. 213 212 */ 214 213 kfree_skb(skb); 215 - 216 - skb = skb_copy(stampable_skb, GFP_ATOMIC); 217 - if (!skb) { 218 - dev_err_ratelimited(dp->ds->dev, 219 - "Failed to copy stampable skb\n"); 220 - spin_unlock(&sp->data->meta_lock); 221 - return NULL; 222 - } 214 + skb = stampable_skb; 223 215 sja1105_transfer_meta(skb, meta); 224 - /* The cached copy will be freed now */ 225 - skb_unref(stampable_skb); 226 216 227 217 spin_unlock(&sp->data->meta_lock); 228 218 }
+1 -1
net/ipv4/inet_fragment.c
··· 331 331 prev = rhashtable_lookup(&fqdir->rhashtable, key, fqdir->f->rhash_params); 332 332 if (!prev) 333 333 fq = inet_frag_create(fqdir, key, &prev); 334 - if (prev && !IS_ERR(prev)) { 334 + if (!IS_ERR_OR_NULL(prev)) { 335 335 fq = prev; 336 336 if (!refcount_inc_not_zero(&fq->refcnt)) 337 337 fq = NULL;
+3
net/ipv4/ipip.c
··· 275 275 const struct iphdr *tiph = &tunnel->parms.iph; 276 276 u8 ipproto; 277 277 278 + if (!pskb_inet_may_pull(skb)) 279 + goto tx_error; 280 + 278 281 switch (skb->protocol) { 279 282 case htons(ETH_P_IP): 280 283 ipproto = IPPROTO_IPIP;
+13
net/ipv4/tcp_ulp.c
··· 96 96 rcu_read_unlock(); 97 97 } 98 98 99 + void tcp_update_ulp(struct sock *sk, struct proto *proto) 100 + { 101 + struct inet_connection_sock *icsk = inet_csk(sk); 102 + 103 + if (!icsk->icsk_ulp_ops) { 104 + sk->sk_prot = proto; 105 + return; 106 + } 107 + 108 + if (icsk->icsk_ulp_ops->update) 109 + icsk->icsk_ulp_ops->update(sk, proto); 110 + } 111 + 99 112 void tcp_cleanup_ulp(struct sock *sk) 100 113 { 101 114 struct inet_connection_sock *icsk = inet_csk(sk);
+2 -1
net/ipv6/ip6_gre.c
··· 660 660 struct flowi6 *fl6, __u8 *dsfield, 661 661 int *encap_limit) 662 662 { 663 - struct ipv6hdr *ipv6h = ipv6_hdr(skb); 663 + struct ipv6hdr *ipv6h; 664 664 struct ip6_tnl *t = netdev_priv(dev); 665 665 __u16 offset; 666 666 667 667 offset = ip6_tnl_parse_tlv_enc_lim(skb, skb_network_header(skb)); 668 668 /* ip6_tnl_parse_tlv_enc_lim() might have reallocated skb->head */ 669 + ipv6h = ipv6_hdr(skb); 669 670 670 671 if (offset > 0) { 671 672 struct ipv6_tlv_tnl_enc_lim *tel;
+2 -4
net/ipv6/ip6_tunnel.c
··· 1278 1278 } 1279 1279 1280 1280 fl6.flowi6_uid = sock_net_uid(dev_net(dev), NULL); 1281 + dsfield = INET_ECN_encapsulate(dsfield, ipv4_get_dsfield(iph)); 1281 1282 1282 1283 if (iptunnel_handle_offloads(skb, SKB_GSO_IPXIP6)) 1283 1284 return -1; 1284 - 1285 - dsfield = INET_ECN_encapsulate(dsfield, ipv4_get_dsfield(iph)); 1286 1285 1287 1286 skb_set_inner_ipproto(skb, IPPROTO_IPIP); 1288 1287 ··· 1366 1367 } 1367 1368 1368 1369 fl6.flowi6_uid = sock_net_uid(dev_net(dev), NULL); 1370 + dsfield = INET_ECN_encapsulate(dsfield, ipv6_get_dsfield(ipv6h)); 1369 1371 1370 1372 if (iptunnel_handle_offloads(skb, SKB_GSO_IPXIP6)) 1371 1373 return -1; 1372 - 1373 - dsfield = INET_ECN_encapsulate(dsfield, ipv6_get_dsfield(ipv6h)); 1374 1374 1375 1375 skb_set_inner_ipproto(skb, IPPROTO_IPV6); 1376 1376
+1 -1
net/ipv6/route.c
··· 1951 1951 nexthop_for_each_fib6_nh(from->nh, fib6_nh_find_match, &arg); 1952 1952 1953 1953 if (!arg.match) 1954 - return; 1954 + goto unlock; 1955 1955 fib6_nh = arg.match; 1956 1956 } else { 1957 1957 fib6_nh = from->fib6_nh;
+9 -5
net/iucv/af_iucv.c
··· 512 512 sk->sk_state = IUCV_DISCONN; 513 513 sk->sk_state_change(sk); 514 514 } 515 - case IUCV_DISCONN: /* fall through */ 515 + /* fall through */ 516 + 517 + case IUCV_DISCONN: 516 518 sk->sk_state = IUCV_CLOSING; 517 519 sk->sk_state_change(sk); 518 520 ··· 527 525 iucv_sock_in_state(sk, IUCV_CLOSED, 0), 528 526 timeo); 529 527 } 528 + /* fall through */ 530 529 531 - case IUCV_CLOSING: /* fall through */ 530 + case IUCV_CLOSING: 532 531 sk->sk_state = IUCV_CLOSED; 533 532 sk->sk_state_change(sk); 534 533 ··· 538 535 539 536 skb_queue_purge(&iucv->send_skb_q); 540 537 skb_queue_purge(&iucv->backlog_skb_q); 538 + /* fall through */ 541 539 542 - default: /* fall through */ 540 + default: 543 541 iucv_sever_path(sk, 1); 544 542 } 545 543 ··· 2251 2247 kfree_skb(skb); 2252 2248 break; 2253 2249 } 2254 - /* fall through and receive non-zero length data */ 2250 + /* fall through - and receive non-zero length data */ 2255 2251 case (AF_IUCV_FLAG_SHT): 2256 2252 /* shutdown request */ 2257 - /* fall through and receive zero length data */ 2253 + /* fall through - and receive zero length data */ 2258 2254 case 0: 2259 2255 /* plain data frame */ 2260 2256 IUCV_SKB_CB(skb)->class = trans_hdr->iucv_hdr.class;
+3
net/l2tp/l2tp_ppp.c
··· 1681 1681 .recvmsg = pppol2tp_recvmsg, 1682 1682 .mmap = sock_no_mmap, 1683 1683 .ioctl = pppox_ioctl, 1684 + #ifdef CONFIG_COMPAT 1685 + .compat_ioctl = pppox_compat_ioctl, 1686 + #endif 1684 1687 }; 1685 1688 1686 1689 static const struct pppox_proto pppol2tp_proto = {
-1
net/mac80211/iface.c
··· 1222 1222 static void ieee80211_if_setup_no_queue(struct net_device *dev) 1223 1223 { 1224 1224 ieee80211_if_setup(dev); 1225 - dev->features |= NETIF_F_LLTX; 1226 1225 dev->priv_flags |= IFF_NO_QUEUE; 1227 1226 } 1228 1227
+10
net/mac80211/mlme.c
··· 2042 2042 ieee80211_regulatory_limit_wmm_params(sdata, &params[ac], ac); 2043 2043 } 2044 2044 2045 + /* WMM specification requires all 4 ACIs. */ 2046 + for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { 2047 + if (params[ac].cw_min == 0) { 2048 + sdata_info(sdata, 2049 + "AP has invalid WMM params (missing AC %d), using defaults\n", 2050 + ac); 2051 + return false; 2052 + } 2053 + } 2054 + 2045 2055 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { 2046 2056 mlme_dbg(sdata, 2047 2057 "WMM AC=%d acm=%d aifs=%d cWmin=%d cWmax=%d txop=%d uapsd=%d, downgraded=%d\n",
+3 -4
net/mac80211/util.c
··· 3796 3796 } 3797 3797 3798 3798 /* Always allow software iftypes */ 3799 - if (local->hw.wiphy->software_iftypes & BIT(iftype) || 3800 - (iftype == NL80211_IFTYPE_AP_VLAN && 3801 - local->hw.wiphy->flags & WIPHY_FLAG_4ADDR_AP)) { 3799 + if (cfg80211_iftype_allowed(local->hw.wiphy, iftype, 0, 1)) { 3802 3800 if (radar_detect) 3803 3801 return -EINVAL; 3804 3802 return 0; ··· 3831 3833 3832 3834 if (sdata_iter == sdata || 3833 3835 !ieee80211_sdata_running(sdata_iter) || 3834 - local->hw.wiphy->software_iftypes & BIT(wdev_iter->iftype)) 3836 + cfg80211_iftype_allowed(local->hw.wiphy, 3837 + wdev_iter->iftype, 0, 1)) 3835 3838 continue; 3836 3839 3837 3840 params.iftype_num[wdev_iter->iftype]++;
+1 -1
net/netfilter/ipset/ip_set_bitmap_ipmac.c
··· 226 226 227 227 e.id = ip_to_id(map, ip); 228 228 229 - if (opt->flags & IPSET_DIM_ONE_SRC) 229 + if (opt->flags & IPSET_DIM_TWO_SRC) 230 230 ether_addr_copy(e.ether, eth_hdr(skb)->h_source); 231 231 else 232 232 ether_addr_copy(e.ether, eth_hdr(skb)->h_dest);
+1 -1
net/netfilter/ipset/ip_set_core.c
··· 1161 1161 return -ENOENT; 1162 1162 1163 1163 write_lock_bh(&ip_set_ref_lock); 1164 - if (set->ref != 0) { 1164 + if (set->ref != 0 || set->ref_netlink != 0) { 1165 1165 ret = -IPSET_ERR_REFERENCED; 1166 1166 goto out; 1167 1167 }
+1 -5
net/netfilter/ipset/ip_set_hash_ipmac.c
··· 89 89 struct hash_ipmac4_elem e = { .ip = 0, { .foo[0] = 0, .foo[1] = 0 } }; 90 90 struct ip_set_ext ext = IP_SET_INIT_KEXT(skb, opt, set); 91 91 92 - /* MAC can be src only */ 93 - if (!(opt->flags & IPSET_DIM_TWO_SRC)) 94 - return 0; 95 - 96 92 if (skb_mac_header(skb) < skb->head || 97 93 (skb_mac_header(skb) + ETH_HLEN) > skb->data) 98 94 return -EINVAL; 99 95 100 - if (opt->flags & IPSET_DIM_ONE_SRC) 96 + if (opt->flags & IPSET_DIM_TWO_SRC) 101 97 ether_addr_copy(e.ether, eth_hdr(skb)->h_source); 102 98 else 103 99 ether_addr_copy(e.ether, eth_hdr(skb)->h_dest);
+4 -12
net/netfilter/nft_meta.c
··· 60 60 *dest = skb->mark; 61 61 break; 62 62 case NFT_META_IIF: 63 - if (in == NULL) 64 - goto err; 65 - *dest = in->ifindex; 63 + *dest = in ? in->ifindex : 0; 66 64 break; 67 65 case NFT_META_OIF: 68 - if (out == NULL) 69 - goto err; 70 - *dest = out->ifindex; 66 + *dest = out ? out->ifindex : 0; 71 67 break; 72 68 case NFT_META_IIFNAME: 73 - if (in == NULL) 74 - goto err; 75 - strncpy((char *)dest, in->name, IFNAMSIZ); 69 + strncpy((char *)dest, in ? in->name : "", IFNAMSIZ); 76 70 break; 77 71 case NFT_META_OIFNAME: 78 - if (out == NULL) 79 - goto err; 80 - strncpy((char *)dest, out->name, IFNAMSIZ); 72 + strncpy((char *)dest, out ? out->name : "", IFNAMSIZ); 81 73 break; 82 74 case NFT_META_IIFTYPE: 83 75 if (in == NULL)
+1
net/netrom/af_netrom.c
··· 967 967 968 968 window = skb->data[20]; 969 969 970 + sock_hold(make); 970 971 skb->sk = make; 971 972 skb->destructor = sock_efree; 972 973 make->sk_state = TCP_ESTABLISHED;
+8 -7
net/openvswitch/datapath.c
··· 1047 1047 } 1048 1048 1049 1049 /* Factor out action copy to avoid "Wframe-larger-than=1024" warning. */ 1050 - static struct sw_flow_actions *get_flow_actions(struct net *net, 1050 + static noinline_for_stack struct sw_flow_actions *get_flow_actions(struct net *net, 1051 1051 const struct nlattr *a, 1052 1052 const struct sw_flow_key *key, 1053 1053 const struct sw_flow_mask *mask, ··· 1081 1081 * we should not to return match object with dangling reference 1082 1082 * to mask. 1083 1083 * */ 1084 - static int ovs_nla_init_match_and_action(struct net *net, 1085 - struct sw_flow_match *match, 1086 - struct sw_flow_key *key, 1087 - struct nlattr **a, 1088 - struct sw_flow_actions **acts, 1089 - bool log) 1084 + static noinline_for_stack int 1085 + ovs_nla_init_match_and_action(struct net *net, 1086 + struct sw_flow_match *match, 1087 + struct sw_flow_key *key, 1088 + struct nlattr **a, 1089 + struct sw_flow_actions **acts, 1090 + bool log) 1090 1091 { 1091 1092 struct sw_flow_mask mask; 1092 1093 int error = 0;
+4 -1
net/rds/rdma_transport.c
··· 105 105 break; 106 106 107 107 case RDMA_CM_EVENT_ESTABLISHED: 108 - trans->cm_connect_complete(conn, event); 108 + if (conn) 109 + trans->cm_connect_complete(conn, event); 109 110 break; 110 111 111 112 case RDMA_CM_EVENT_REJECTED: ··· 138 137 break; 139 138 140 139 case RDMA_CM_EVENT_DISCONNECTED: 140 + if (!conn) 141 + break; 141 142 rdsdebug("DISCONNECT event - dropping connection " 142 143 "%pI6c->%pI6c\n", &conn->c_laddr, 143 144 &conn->c_faddr);
+1
net/rxrpc/ar-internal.h
··· 1061 1061 struct rxrpc_peer *rxrpc_get_peer(struct rxrpc_peer *); 1062 1062 struct rxrpc_peer *rxrpc_get_peer_maybe(struct rxrpc_peer *); 1063 1063 void rxrpc_put_peer(struct rxrpc_peer *); 1064 + void rxrpc_put_peer_locked(struct rxrpc_peer *); 1064 1065 1065 1066 /* 1066 1067 * proc.c
+1 -1
net/rxrpc/peer_event.c
··· 378 378 spin_lock_bh(&rxnet->peer_hash_lock); 379 379 list_add_tail(&peer->keepalive_link, 380 380 &rxnet->peer_keepalive[slot & mask]); 381 - rxrpc_put_peer(peer); 381 + rxrpc_put_peer_locked(peer); 382 382 } 383 383 384 384 spin_unlock_bh(&rxnet->peer_hash_lock);
+18
net/rxrpc/peer_object.c
··· 437 437 } 438 438 439 439 /* 440 + * Drop a ref on a peer record where the caller already holds the 441 + * peer_hash_lock. 442 + */ 443 + void rxrpc_put_peer_locked(struct rxrpc_peer *peer) 444 + { 445 + const void *here = __builtin_return_address(0); 446 + int n; 447 + 448 + n = atomic_dec_return(&peer->usage); 449 + trace_rxrpc_peer(peer, rxrpc_peer_put, n, here); 450 + if (n == 0) { 451 + hash_del_rcu(&peer->hash_link); 452 + list_del_init(&peer->keepalive_link); 453 + kfree_rcu(peer, rcu); 454 + } 455 + } 456 + 457 + /* 440 458 * Make sure all peer records have been discarded. 441 459 */ 442 460 void rxrpc_destroy_all_peers(struct rxrpc_net *rxnet)
+1
net/rxrpc/sendmsg.c
··· 226 226 rxrpc_set_call_completion(call, 227 227 RXRPC_CALL_LOCAL_ERROR, 228 228 0, ret); 229 + rxrpc_notify_socket(call); 229 230 goto out; 230 231 } 231 232 _debug("need instant resend %d", ret);
+5 -4
net/sched/act_bpf.c
··· 285 285 struct tcf_bpf *prog; 286 286 bool is_bpf, is_ebpf; 287 287 int ret, res = 0; 288 + u32 index; 288 289 289 290 if (!nla) 290 291 return -EINVAL; ··· 299 298 return -EINVAL; 300 299 301 300 parm = nla_data(tb[TCA_ACT_BPF_PARMS]); 302 - 303 - ret = tcf_idr_check_alloc(tn, &parm->index, act, bind); 301 + index = parm->index; 302 + ret = tcf_idr_check_alloc(tn, &index, act, bind); 304 303 if (!ret) { 305 - ret = tcf_idr_create(tn, parm->index, est, act, 304 + ret = tcf_idr_create(tn, index, est, act, 306 305 &act_bpf_ops, bind, true); 307 306 if (ret < 0) { 308 - tcf_idr_cleanup(tn, parm->index); 307 + tcf_idr_cleanup(tn, index); 309 308 return ret; 310 309 } 311 310
+5 -4
net/sched/act_connmark.c
··· 103 103 struct tcf_connmark_info *ci; 104 104 struct tc_connmark *parm; 105 105 int ret = 0, err; 106 + u32 index; 106 107 107 108 if (!nla) 108 109 return -EINVAL; ··· 117 116 return -EINVAL; 118 117 119 118 parm = nla_data(tb[TCA_CONNMARK_PARMS]); 120 - 121 - ret = tcf_idr_check_alloc(tn, &parm->index, a, bind); 119 + index = parm->index; 120 + ret = tcf_idr_check_alloc(tn, &index, a, bind); 122 121 if (!ret) { 123 - ret = tcf_idr_create(tn, parm->index, est, a, 122 + ret = tcf_idr_create(tn, index, est, a, 124 123 &act_connmark_ops, bind, false); 125 124 if (ret) { 126 - tcf_idr_cleanup(tn, parm->index); 125 + tcf_idr_cleanup(tn, index); 127 126 return ret; 128 127 } 129 128
+5 -4
net/sched/act_csum.c
··· 52 52 struct tc_csum *parm; 53 53 struct tcf_csum *p; 54 54 int ret = 0, err; 55 + u32 index; 55 56 56 57 if (nla == NULL) 57 58 return -EINVAL; ··· 65 64 if (tb[TCA_CSUM_PARMS] == NULL) 66 65 return -EINVAL; 67 66 parm = nla_data(tb[TCA_CSUM_PARMS]); 68 - 69 - err = tcf_idr_check_alloc(tn, &parm->index, a, bind); 67 + index = parm->index; 68 + err = tcf_idr_check_alloc(tn, &index, a, bind); 70 69 if (!err) { 71 - ret = tcf_idr_create(tn, parm->index, est, a, 70 + ret = tcf_idr_create(tn, index, est, a, 72 71 &act_csum_ops, bind, true); 73 72 if (ret) { 74 - tcf_idr_cleanup(tn, parm->index); 73 + tcf_idr_cleanup(tn, index); 75 74 return ret; 76 75 } 77 76 ret = ACT_P_CREATED;
+5 -4
net/sched/act_ct.c
··· 666 666 struct tc_ct *parm; 667 667 struct tcf_ct *c; 668 668 int err, res = 0; 669 + u32 index; 669 670 670 671 if (!nla) { 671 672 NL_SET_ERR_MSG_MOD(extack, "Ct requires attributes to be passed"); ··· 682 681 return -EINVAL; 683 682 } 684 683 parm = nla_data(tb[TCA_CT_PARMS]); 685 - 686 - err = tcf_idr_check_alloc(tn, &parm->index, a, bind); 684 + index = parm->index; 685 + err = tcf_idr_check_alloc(tn, &index, a, bind); 687 686 if (err < 0) 688 687 return err; 689 688 690 689 if (!err) { 691 - err = tcf_idr_create(tn, parm->index, est, a, 690 + err = tcf_idr_create(tn, index, est, a, 692 691 &act_ct_ops, bind, true); 693 692 if (err) { 694 - tcf_idr_cleanup(tn, parm->index); 693 + tcf_idr_cleanup(tn, index); 695 694 return err; 696 695 } 697 696 res = ACT_P_CREATED;
+5 -4
net/sched/act_ctinfo.c
··· 157 157 struct netlink_ext_ack *extack) 158 158 { 159 159 struct tc_action_net *tn = net_generic(net, ctinfo_net_id); 160 + u32 dscpmask = 0, dscpstatemask, index; 160 161 struct nlattr *tb[TCA_CTINFO_MAX + 1]; 161 162 struct tcf_ctinfo_params *cp_new; 162 163 struct tcf_chain *goto_ch = NULL; 163 - u32 dscpmask = 0, dscpstatemask; 164 164 struct tc_ctinfo *actparm; 165 165 struct tcf_ctinfo *ci; 166 166 u8 dscpmaskshift; ··· 206 206 } 207 207 208 208 /* done the validation:now to the actual action allocation */ 209 - err = tcf_idr_check_alloc(tn, &actparm->index, a, bind); 209 + index = actparm->index; 210 + err = tcf_idr_check_alloc(tn, &index, a, bind); 210 211 if (!err) { 211 - ret = tcf_idr_create(tn, actparm->index, est, a, 212 + ret = tcf_idr_create(tn, index, est, a, 212 213 &act_ctinfo_ops, bind, false); 213 214 if (ret) { 214 - tcf_idr_cleanup(tn, actparm->index); 215 + tcf_idr_cleanup(tn, index); 215 216 return ret; 216 217 } 217 218 ret = ACT_P_CREATED;
+5 -3
net/sched/act_gact.c
··· 61 61 struct tc_gact *parm; 62 62 struct tcf_gact *gact; 63 63 int ret = 0; 64 + u32 index; 64 65 int err; 65 66 #ifdef CONFIG_GACT_PROB 66 67 struct tc_gact_p *p_parm = NULL; ··· 78 77 if (tb[TCA_GACT_PARMS] == NULL) 79 78 return -EINVAL; 80 79 parm = nla_data(tb[TCA_GACT_PARMS]); 80 + index = parm->index; 81 81 82 82 #ifndef CONFIG_GACT_PROB 83 83 if (tb[TCA_GACT_PROB] != NULL) ··· 96 94 } 97 95 #endif 98 96 99 - err = tcf_idr_check_alloc(tn, &parm->index, a, bind); 97 + err = tcf_idr_check_alloc(tn, &index, a, bind); 100 98 if (!err) { 101 - ret = tcf_idr_create(tn, parm->index, est, a, 99 + ret = tcf_idr_create(tn, index, est, a, 102 100 &act_gact_ops, bind, true); 103 101 if (ret) { 104 - tcf_idr_cleanup(tn, parm->index); 102 + tcf_idr_cleanup(tn, index); 105 103 return ret; 106 104 } 107 105 ret = ACT_P_CREATED;
+10 -3
net/sched/act_ife.c
··· 479 479 u8 *saddr = NULL; 480 480 bool exists = false; 481 481 int ret = 0; 482 + u32 index; 482 483 int err; 484 + 485 + if (!nla) { 486 + NL_SET_ERR_MSG_MOD(extack, "IFE requires attributes to be passed"); 487 + return -EINVAL; 488 + } 483 489 484 490 err = nla_parse_nested_deprecated(tb, TCA_IFE_MAX, nla, ife_policy, 485 491 NULL); ··· 508 502 if (!p) 509 503 return -ENOMEM; 510 504 511 - err = tcf_idr_check_alloc(tn, &parm->index, a, bind); 505 + index = parm->index; 506 + err = tcf_idr_check_alloc(tn, &index, a, bind); 512 507 if (err < 0) { 513 508 kfree(p); 514 509 return err; ··· 521 514 } 522 515 523 516 if (!exists) { 524 - ret = tcf_idr_create(tn, parm->index, est, a, &act_ife_ops, 517 + ret = tcf_idr_create(tn, index, est, a, &act_ife_ops, 525 518 bind, true); 526 519 if (ret) { 527 - tcf_idr_cleanup(tn, parm->index); 520 + tcf_idr_cleanup(tn, index); 528 521 kfree(p); 529 522 return ret; 530 523 }
+7 -6
net/sched/act_mirred.c
··· 104 104 struct net_device *dev; 105 105 bool exists = false; 106 106 int ret, err; 107 + u32 index; 107 108 108 109 if (!nla) { 109 110 NL_SET_ERR_MSG_MOD(extack, "Mirred requires attributes to be passed"); ··· 119 118 return -EINVAL; 120 119 } 121 120 parm = nla_data(tb[TCA_MIRRED_PARMS]); 122 - 123 - err = tcf_idr_check_alloc(tn, &parm->index, a, bind); 121 + index = parm->index; 122 + err = tcf_idr_check_alloc(tn, &index, a, bind); 124 123 if (err < 0) 125 124 return err; 126 125 exists = err; ··· 137 136 if (exists) 138 137 tcf_idr_release(*a, bind); 139 138 else 140 - tcf_idr_cleanup(tn, parm->index); 139 + tcf_idr_cleanup(tn, index); 141 140 NL_SET_ERR_MSG_MOD(extack, "Unknown mirred option"); 142 141 return -EINVAL; 143 142 } 144 143 145 144 if (!exists) { 146 145 if (!parm->ifindex) { 147 - tcf_idr_cleanup(tn, parm->index); 146 + tcf_idr_cleanup(tn, index); 148 147 NL_SET_ERR_MSG_MOD(extack, "Specified device does not exist"); 149 148 return -EINVAL; 150 149 } 151 - ret = tcf_idr_create(tn, parm->index, est, a, 150 + ret = tcf_idr_create(tn, index, est, a, 152 151 &act_mirred_ops, bind, true); 153 152 if (ret) { 154 - tcf_idr_cleanup(tn, parm->index); 153 + tcf_idr_cleanup(tn, index); 155 154 return ret; 156 155 } 157 156 ret = ACT_P_CREATED;
+5 -3
net/sched/act_mpls.c
··· 138 138 struct tcf_mpls *m; 139 139 int ret = 0, err; 140 140 u8 mpls_ttl = 0; 141 + u32 index; 141 142 142 143 if (!nla) { 143 144 NL_SET_ERR_MSG_MOD(extack, "Missing netlink attributes"); ··· 154 153 return -EINVAL; 155 154 } 156 155 parm = nla_data(tb[TCA_MPLS_PARMS]); 156 + index = parm->index; 157 157 158 158 /* Verify parameters against action type. */ 159 159 switch (parm->m_action) { ··· 211 209 return -EINVAL; 212 210 } 213 211 214 - err = tcf_idr_check_alloc(tn, &parm->index, a, bind); 212 + err = tcf_idr_check_alloc(tn, &index, a, bind); 215 213 if (err < 0) 216 214 return err; 217 215 exists = err; ··· 219 217 return 0; 220 218 221 219 if (!exists) { 222 - ret = tcf_idr_create(tn, parm->index, est, a, 220 + ret = tcf_idr_create(tn, index, est, a, 223 221 &act_mpls_ops, bind, true); 224 222 if (ret) { 225 - tcf_idr_cleanup(tn, parm->index); 223 + tcf_idr_cleanup(tn, index); 226 224 return ret; 227 225 } 228 226
+5 -4
net/sched/act_nat.c
··· 44 44 struct tc_nat *parm; 45 45 int ret = 0, err; 46 46 struct tcf_nat *p; 47 + u32 index; 47 48 48 49 if (nla == NULL) 49 50 return -EINVAL; ··· 57 56 if (tb[TCA_NAT_PARMS] == NULL) 58 57 return -EINVAL; 59 58 parm = nla_data(tb[TCA_NAT_PARMS]); 60 - 61 - err = tcf_idr_check_alloc(tn, &parm->index, a, bind); 59 + index = parm->index; 60 + err = tcf_idr_check_alloc(tn, &index, a, bind); 62 61 if (!err) { 63 - ret = tcf_idr_create(tn, parm->index, est, a, 62 + ret = tcf_idr_create(tn, index, est, a, 64 63 &act_nat_ops, bind, false); 65 64 if (ret) { 66 - tcf_idr_cleanup(tn, parm->index); 65 + tcf_idr_cleanup(tn, index); 67 66 return ret; 68 67 } 69 68 ret = ACT_P_CREATED;
+6 -4
net/sched/act_pedit.c
··· 149 149 struct tcf_pedit *p; 150 150 int ret = 0, err; 151 151 int ksize; 152 + u32 index; 152 153 153 154 if (!nla) { 154 155 NL_SET_ERR_MSG_MOD(extack, "Pedit requires attributes to be passed"); ··· 180 179 if (IS_ERR(keys_ex)) 181 180 return PTR_ERR(keys_ex); 182 181 183 - err = tcf_idr_check_alloc(tn, &parm->index, a, bind); 182 + index = parm->index; 183 + err = tcf_idr_check_alloc(tn, &index, a, bind); 184 184 if (!err) { 185 185 if (!parm->nkeys) { 186 - tcf_idr_cleanup(tn, parm->index); 186 + tcf_idr_cleanup(tn, index); 187 187 NL_SET_ERR_MSG_MOD(extack, "Pedit requires keys to be passed"); 188 188 ret = -EINVAL; 189 189 goto out_free; 190 190 } 191 - ret = tcf_idr_create(tn, parm->index, est, a, 191 + ret = tcf_idr_create(tn, index, est, a, 192 192 &act_pedit_ops, bind, false); 193 193 if (ret) { 194 - tcf_idr_cleanup(tn, parm->index); 194 + tcf_idr_cleanup(tn, index); 195 195 goto out_free; 196 196 } 197 197 ret = ACT_P_CREATED;
+5 -3
net/sched/act_police.c
··· 57 57 struct tc_action_net *tn = net_generic(net, police_net_id); 58 58 struct tcf_police_params *new; 59 59 bool exists = false; 60 + u32 index; 60 61 61 62 if (nla == NULL) 62 63 return -EINVAL; ··· 74 73 return -EINVAL; 75 74 76 75 parm = nla_data(tb[TCA_POLICE_TBF]); 77 - err = tcf_idr_check_alloc(tn, &parm->index, a, bind); 76 + index = parm->index; 77 + err = tcf_idr_check_alloc(tn, &index, a, bind); 78 78 if (err < 0) 79 79 return err; 80 80 exists = err; ··· 83 81 return 0; 84 82 85 83 if (!exists) { 86 - ret = tcf_idr_create(tn, parm->index, NULL, a, 84 + ret = tcf_idr_create(tn, index, NULL, a, 87 85 &act_police_ops, bind, true); 88 86 if (ret) { 89 - tcf_idr_cleanup(tn, parm->index); 87 + tcf_idr_cleanup(tn, index); 90 88 return ret; 91 89 } 92 90 ret = ACT_P_CREATED;
+5 -5
net/sched/act_sample.c
··· 41 41 struct tc_action_net *tn = net_generic(net, sample_net_id); 42 42 struct nlattr *tb[TCA_SAMPLE_MAX + 1]; 43 43 struct psample_group *psample_group; 44 + u32 psample_group_num, rate, index; 44 45 struct tcf_chain *goto_ch = NULL; 45 - u32 psample_group_num, rate; 46 46 struct tc_sample *parm; 47 47 struct tcf_sample *s; 48 48 bool exists = false; ··· 59 59 return -EINVAL; 60 60 61 61 parm = nla_data(tb[TCA_SAMPLE_PARMS]); 62 - 63 - err = tcf_idr_check_alloc(tn, &parm->index, a, bind); 62 + index = parm->index; 63 + err = tcf_idr_check_alloc(tn, &index, a, bind); 64 64 if (err < 0) 65 65 return err; 66 66 exists = err; ··· 68 68 return 0; 69 69 70 70 if (!exists) { 71 - ret = tcf_idr_create(tn, parm->index, est, a, 71 + ret = tcf_idr_create(tn, index, est, a, 72 72 &act_sample_ops, bind, true); 73 73 if (ret) { 74 - tcf_idr_cleanup(tn, parm->index); 74 + tcf_idr_cleanup(tn, index); 75 75 return ret; 76 76 } 77 77 ret = ACT_P_CREATED;
+6 -4
net/sched/act_simple.c
··· 95 95 struct tcf_defact *d; 96 96 bool exists = false; 97 97 int ret = 0, err; 98 + u32 index; 98 99 99 100 if (nla == NULL) 100 101 return -EINVAL; ··· 109 108 return -EINVAL; 110 109 111 110 parm = nla_data(tb[TCA_DEF_PARMS]); 112 - err = tcf_idr_check_alloc(tn, &parm->index, a, bind); 111 + index = parm->index; 112 + err = tcf_idr_check_alloc(tn, &index, a, bind); 113 113 if (err < 0) 114 114 return err; 115 115 exists = err; ··· 121 119 if (exists) 122 120 tcf_idr_release(*a, bind); 123 121 else 124 - tcf_idr_cleanup(tn, parm->index); 122 + tcf_idr_cleanup(tn, index); 125 123 return -EINVAL; 126 124 } 127 125 128 126 if (!exists) { 129 - ret = tcf_idr_create(tn, parm->index, est, a, 127 + ret = tcf_idr_create(tn, index, est, a, 130 128 &act_simp_ops, bind, false); 131 129 if (ret) { 132 - tcf_idr_cleanup(tn, parm->index); 130 + tcf_idr_cleanup(tn, index); 133 131 return ret; 134 132 } 135 133
+6 -5
net/sched/act_skbedit.c
··· 99 99 u16 *queue_mapping = NULL, *ptype = NULL; 100 100 bool exists = false; 101 101 int ret = 0, err; 102 + u32 index; 102 103 103 104 if (nla == NULL) 104 105 return -EINVAL; ··· 147 146 } 148 147 149 148 parm = nla_data(tb[TCA_SKBEDIT_PARMS]); 150 - 151 - err = tcf_idr_check_alloc(tn, &parm->index, a, bind); 149 + index = parm->index; 150 + err = tcf_idr_check_alloc(tn, &index, a, bind); 152 151 if (err < 0) 153 152 return err; 154 153 exists = err; ··· 159 158 if (exists) 160 159 tcf_idr_release(*a, bind); 161 160 else 162 - tcf_idr_cleanup(tn, parm->index); 161 + tcf_idr_cleanup(tn, index); 163 162 return -EINVAL; 164 163 } 165 164 166 165 if (!exists) { 167 - ret = tcf_idr_create(tn, parm->index, est, a, 166 + ret = tcf_idr_create(tn, index, est, a, 168 167 &act_skbedit_ops, bind, true); 169 168 if (ret) { 170 - tcf_idr_cleanup(tn, parm->index); 169 + tcf_idr_cleanup(tn, index); 171 170 return ret; 172 171 } 173 172
+6 -5
net/sched/act_skbmod.c
··· 87 87 struct tcf_skbmod_params *p, *p_old; 88 88 struct tcf_chain *goto_ch = NULL; 89 89 struct tc_skbmod *parm; 90 + u32 lflags = 0, index; 90 91 struct tcf_skbmod *d; 91 92 bool exists = false; 92 93 u8 *daddr = NULL; 93 94 u8 *saddr = NULL; 94 95 u16 eth_type = 0; 95 - u32 lflags = 0; 96 96 int ret = 0, err; 97 97 98 98 if (!nla) ··· 122 122 } 123 123 124 124 parm = nla_data(tb[TCA_SKBMOD_PARMS]); 125 + index = parm->index; 125 126 if (parm->flags & SKBMOD_F_SWAPMAC) 126 127 lflags = SKBMOD_F_SWAPMAC; 127 128 128 - err = tcf_idr_check_alloc(tn, &parm->index, a, bind); 129 + err = tcf_idr_check_alloc(tn, &index, a, bind); 129 130 if (err < 0) 130 131 return err; 131 132 exists = err; ··· 137 136 if (exists) 138 137 tcf_idr_release(*a, bind); 139 138 else 140 - tcf_idr_cleanup(tn, parm->index); 139 + tcf_idr_cleanup(tn, index); 141 140 return -EINVAL; 142 141 } 143 142 144 143 if (!exists) { 145 - ret = tcf_idr_create(tn, parm->index, est, a, 144 + ret = tcf_idr_create(tn, index, est, a, 146 145 &act_skbmod_ops, bind, true); 147 146 if (ret) { 148 - tcf_idr_cleanup(tn, parm->index); 147 + tcf_idr_cleanup(tn, index); 149 148 return ret; 150 149 } 151 150
+5 -3
net/sched/act_tunnel_key.c
··· 225 225 __be16 flags = 0; 226 226 u8 tos, ttl; 227 227 int ret = 0; 228 + u32 index; 228 229 int err; 229 230 230 231 if (!nla) { ··· 246 245 } 247 246 248 247 parm = nla_data(tb[TCA_TUNNEL_KEY_PARMS]); 249 - err = tcf_idr_check_alloc(tn, &parm->index, a, bind); 248 + index = parm->index; 249 + err = tcf_idr_check_alloc(tn, &index, a, bind); 250 250 if (err < 0) 251 251 return err; 252 252 exists = err; ··· 347 345 } 348 346 349 347 if (!exists) { 350 - ret = tcf_idr_create(tn, parm->index, est, a, 348 + ret = tcf_idr_create(tn, index, est, a, 351 349 &act_tunnel_key_ops, bind, true); 352 350 if (ret) { 353 351 NL_SET_ERR_MSG(extack, "Cannot create TC IDR"); ··· 405 403 if (exists) 406 404 tcf_idr_release(*a, bind); 407 405 else 408 - tcf_idr_cleanup(tn, parm->index); 406 + tcf_idr_cleanup(tn, index); 409 407 return ret; 410 408 } 411 409
+18 -7
net/sched/act_vlan.c
··· 116 116 u8 push_prio = 0; 117 117 bool exists = false; 118 118 int ret = 0, err; 119 + u32 index; 119 120 120 121 if (!nla) 121 122 return -EINVAL; ··· 129 128 if (!tb[TCA_VLAN_PARMS]) 130 129 return -EINVAL; 131 130 parm = nla_data(tb[TCA_VLAN_PARMS]); 132 - err = tcf_idr_check_alloc(tn, &parm->index, a, bind); 131 + index = parm->index; 132 + err = tcf_idr_check_alloc(tn, &index, a, bind); 133 133 if (err < 0) 134 134 return err; 135 135 exists = err; ··· 146 144 if (exists) 147 145 tcf_idr_release(*a, bind); 148 146 else 149 - tcf_idr_cleanup(tn, parm->index); 147 + tcf_idr_cleanup(tn, index); 150 148 return -EINVAL; 151 149 } 152 150 push_vid = nla_get_u16(tb[TCA_VLAN_PUSH_VLAN_ID]); ··· 154 152 if (exists) 155 153 tcf_idr_release(*a, bind); 156 154 else 157 - tcf_idr_cleanup(tn, parm->index); 155 + tcf_idr_cleanup(tn, index); 158 156 return -ERANGE; 159 157 } 160 158 ··· 168 166 if (exists) 169 167 tcf_idr_release(*a, bind); 170 168 else 171 - tcf_idr_cleanup(tn, parm->index); 169 + tcf_idr_cleanup(tn, index); 172 170 return -EPROTONOSUPPORT; 173 171 } 174 172 } else { ··· 182 180 if (exists) 183 181 tcf_idr_release(*a, bind); 184 182 else 185 - tcf_idr_cleanup(tn, parm->index); 183 + tcf_idr_cleanup(tn, index); 186 184 return -EINVAL; 187 185 } 188 186 action = parm->v_action; 189 187 190 188 if (!exists) { 191 - ret = tcf_idr_create(tn, parm->index, est, a, 189 + ret = tcf_idr_create(tn, index, est, a, 192 190 &act_vlan_ops, bind, true); 193 191 if (ret) { 194 - tcf_idr_cleanup(tn, parm->index); 192 + tcf_idr_cleanup(tn, index); 195 193 return ret; 196 194 } 197 195 ··· 308 306 return tcf_idr_search(tn, a, index); 309 307 } 310 308 309 + static size_t tcf_vlan_get_fill_size(const struct tc_action *act) 310 + { 311 + return nla_total_size(sizeof(struct tc_vlan)) 312 + + nla_total_size(sizeof(u16)) /* TCA_VLAN_PUSH_VLAN_ID */ 313 + + nla_total_size(sizeof(u16)) /* TCA_VLAN_PUSH_VLAN_PROTOCOL */ 314 + + nla_total_size(sizeof(u8)); /* TCA_VLAN_PUSH_VLAN_PRIORITY */ 315 + } 316 + 311 317 static struct tc_action_ops act_vlan_ops = { 312 318 .kind = "vlan", 313 319 .id = TCA_ID_VLAN, ··· 325 315 .init = tcf_vlan_init, 326 316 .cleanup = tcf_vlan_cleanup, 327 317 .walk = tcf_vlan_walker, 318 + .get_fill_size = tcf_vlan_get_fill_size, 328 319 .lookup = tcf_vlan_search, 329 320 .size = sizeof(struct tcf_vlan), 330 321 };
+3 -3
net/sched/sch_codel.c
··· 71 71 struct Qdisc *sch = ctx; 72 72 struct sk_buff *skb = __qdisc_dequeue_head(&sch->q); 73 73 74 - if (skb) 74 + if (skb) { 75 75 sch->qstats.backlog -= qdisc_pkt_len(skb); 76 - 77 - prefetch(&skb->end); /* we'll need skb_shinfo() */ 76 + prefetch(&skb->end); /* we'll need skb_shinfo() */ 77 + } 78 78 return skb; 79 79 } 80 80
+2 -2
net/sctp/socket.c
··· 985 985 return -EINVAL; 986 986 987 987 kaddrs = memdup_user(addrs, addrs_size); 988 - if (unlikely(IS_ERR(kaddrs))) 988 + if (IS_ERR(kaddrs)) 989 989 return PTR_ERR(kaddrs); 990 990 991 991 /* Walk through the addrs buffer and count the number of addresses. */ ··· 1315 1315 return -EINVAL; 1316 1316 1317 1317 kaddrs = memdup_user(addrs, addrs_size); 1318 - if (unlikely(IS_ERR(kaddrs))) 1318 + if (IS_ERR(kaddrs)) 1319 1319 return PTR_ERR(kaddrs); 1320 1320 1321 1321 /* Allow security module to validate connectx addresses. */
+10 -5
net/smc/af_smc.c
··· 263 263 264 264 /* Check if socket is already active */ 265 265 rc = -EINVAL; 266 - if (sk->sk_state != SMC_INIT) 266 + if (sk->sk_state != SMC_INIT || smc->connect_nonblock) 267 267 goto out_rel; 268 268 269 269 smc->clcsock->sk->sk_reuse = sk->sk_reuse; ··· 1390 1390 lock_sock(sk); 1391 1391 1392 1392 rc = -EINVAL; 1393 - if ((sk->sk_state != SMC_INIT) && (sk->sk_state != SMC_LISTEN)) 1393 + if ((sk->sk_state != SMC_INIT && sk->sk_state != SMC_LISTEN) || 1394 + smc->connect_nonblock) 1394 1395 goto out; 1395 1396 1396 1397 rc = 0; ··· 1519 1518 goto out; 1520 1519 1521 1520 if (msg->msg_flags & MSG_FASTOPEN) { 1522 - if (sk->sk_state == SMC_INIT) { 1521 + if (sk->sk_state == SMC_INIT && !smc->connect_nonblock) { 1523 1522 smc_switch_to_fallback(smc); 1524 1523 smc->fallback_rsn = SMC_CLC_DECL_OPTUNSUPP; 1525 1524 } else { ··· 1733 1732 } 1734 1733 break; 1735 1734 case TCP_NODELAY: 1736 - if (sk->sk_state != SMC_INIT && sk->sk_state != SMC_LISTEN) { 1735 + if (sk->sk_state != SMC_INIT && 1736 + sk->sk_state != SMC_LISTEN && 1737 + sk->sk_state != SMC_CLOSED) { 1737 1738 if (val && !smc->use_fallback) 1738 1739 mod_delayed_work(system_wq, &smc->conn.tx_work, 1739 1740 0); 1740 1741 } 1741 1742 break; 1742 1743 case TCP_CORK: 1743 - if (sk->sk_state != SMC_INIT && sk->sk_state != SMC_LISTEN) { 1744 + if (sk->sk_state != SMC_INIT && 1745 + sk->sk_state != SMC_LISTEN && 1746 + sk->sk_state != SMC_CLOSED) { 1744 1747 if (!val && !smc->use_fallback) 1745 1748 mod_delayed_work(system_wq, &smc->conn.tx_work, 1746 1749 0);
+1 -2
net/tipc/socket.c
··· 485 485 tsk_set_unreturnable(tsk, true); 486 486 if (sock->type == SOCK_DGRAM) 487 487 tsk_set_unreliable(tsk, true); 488 - __skb_queue_head_init(&tsk->mc_method.deferredq); 489 488 } 490 - 489 + __skb_queue_head_init(&tsk->mc_method.deferredq); 491 490 trace_tipc_sk_create(sk, NULL, TIPC_DUMP_NONE, " "); 492 491 return 0; 493 492 }
+60 -37
net/tls/tls_main.c
··· 261 261 kfree(ctx); 262 262 } 263 263 264 - static void tls_sk_proto_close(struct sock *sk, long timeout) 264 + static void tls_sk_proto_cleanup(struct sock *sk, 265 + struct tls_context *ctx, long timeo) 265 266 { 266 - struct tls_context *ctx = tls_get_ctx(sk); 267 - long timeo = sock_sndtimeo(sk, 0); 268 - void (*sk_proto_close)(struct sock *sk, long timeout); 269 - bool free_ctx = false; 270 - 271 - lock_sock(sk); 272 - sk_proto_close = ctx->sk_proto_close; 273 - 274 - if (ctx->tx_conf == TLS_HW_RECORD && ctx->rx_conf == TLS_HW_RECORD) 275 - goto skip_tx_cleanup; 276 - 277 - if (ctx->tx_conf == TLS_BASE && ctx->rx_conf == TLS_BASE) { 278 - free_ctx = true; 279 - goto skip_tx_cleanup; 280 - } 281 - 282 267 if (unlikely(sk->sk_write_pending) && 283 268 !wait_on_pending_writer(sk, &timeo)) 284 269 tls_handle_open_record(sk, 0); ··· 272 287 if (ctx->tx_conf == TLS_SW) { 273 288 kfree(ctx->tx.rec_seq); 274 289 kfree(ctx->tx.iv); 275 - tls_sw_free_resources_tx(sk); 290 + tls_sw_release_resources_tx(sk); 276 291 #ifdef CONFIG_TLS_DEVICE 277 292 } else if (ctx->tx_conf == TLS_HW) { 278 293 tls_device_free_resources_tx(sk); ··· 280 295 } 281 296 282 297 if (ctx->rx_conf == TLS_SW) 283 - tls_sw_free_resources_rx(sk); 298 + tls_sw_release_resources_rx(sk); 284 299 285 300 #ifdef CONFIG_TLS_DEVICE 286 301 if (ctx->rx_conf == TLS_HW) 287 302 tls_device_offload_cleanup_rx(sk); 288 - 289 - if (ctx->tx_conf != TLS_HW && ctx->rx_conf != TLS_HW) { 290 - #else 291 - { 292 303 #endif 293 - tls_ctx_free(ctx); 294 - ctx = NULL; 295 - } 304 + } 296 305 297 - skip_tx_cleanup: 306 + static void tls_sk_proto_close(struct sock *sk, long timeout) 307 + { 308 + struct inet_connection_sock *icsk = inet_csk(sk); 309 + struct tls_context *ctx = tls_get_ctx(sk); 310 + long timeo = sock_sndtimeo(sk, 0); 311 + bool free_ctx; 312 + 313 + if (ctx->tx_conf == TLS_SW) 314 + tls_sw_cancel_work_tx(ctx); 315 + 316 + lock_sock(sk); 317 + free_ctx = ctx->tx_conf != TLS_HW && ctx->rx_conf != TLS_HW; 318 + 319 + if (ctx->tx_conf != TLS_BASE || ctx->rx_conf != TLS_BASE) 320 + tls_sk_proto_cleanup(sk, ctx, timeo); 321 + 322 + write_lock_bh(&sk->sk_callback_lock); 323 + if (free_ctx) 324 + icsk->icsk_ulp_data = NULL; 325 + sk->sk_prot = ctx->sk_proto; 326 + write_unlock_bh(&sk->sk_callback_lock); 298 327 release_sock(sk); 299 - sk_proto_close(sk, timeout); 300 - /* free ctx for TLS_HW_RECORD, used by tcp_set_state 301 - * for sk->sk_prot->unhash [tls_hw_unhash] 302 - */ 328 + if (ctx->tx_conf == TLS_SW) 329 + tls_sw_free_ctx_tx(ctx); 330 + if (ctx->rx_conf == TLS_SW || ctx->rx_conf == TLS_HW) 331 + tls_sw_strparser_done(ctx); 332 + if (ctx->rx_conf == TLS_SW) 333 + tls_sw_free_ctx_rx(ctx); 334 + ctx->sk_proto_close(sk, timeout); 335 + 303 336 if (free_ctx) 304 337 tls_ctx_free(ctx); 305 338 } ··· 529 526 { 530 527 #endif 531 528 rc = tls_set_sw_offload(sk, ctx, 1); 529 + if (rc) 530 + goto err_crypto_info; 532 531 conf = TLS_SW; 533 532 } 534 533 } else { ··· 542 537 { 543 538 #endif 544 539 rc = tls_set_sw_offload(sk, ctx, 0); 540 + if (rc) 541 + goto err_crypto_info; 545 542 conf = TLS_SW; 546 543 } 544 + tls_sw_strparser_arm(sk, ctx); 547 545 } 548 - 549 - if (rc) 550 - goto err_crypto_info; 551 546 552 547 if (tx) 553 548 ctx->tx_conf = conf; ··· 612 607 ctx->setsockopt = sk->sk_prot->setsockopt; 613 608 ctx->getsockopt = sk->sk_prot->getsockopt; 614 609 ctx->sk_proto_close = sk->sk_prot->close; 610 + ctx->unhash = sk->sk_prot->unhash; 615 611 return ctx; 616 612 } 617 613 ··· 770 764 prot[TLS_HW_RECORD][TLS_HW_RECORD] = *base; 771 765 prot[TLS_HW_RECORD][TLS_HW_RECORD].hash = tls_hw_hash; 772 766 prot[TLS_HW_RECORD][TLS_HW_RECORD].unhash = tls_hw_unhash; 773 - prot[TLS_HW_RECORD][TLS_HW_RECORD].close = tls_sk_proto_close; 774 767 } 775 768 776 769 static int tls_init(struct sock *sk) ··· 778 773 int rc = 0; 779 774 780 775 if (tls_hw_prot(sk)) 781 - goto out; 776 + return 0; 782 777 783 778 /* The TLS ulp is currently supported only for TCP sockets 784 779 * in ESTABLISHED state. ··· 789 784 if (sk->sk_state != TCP_ESTABLISHED) 790 785 return -ENOTSUPP; 791 786 787 + tls_build_proto(sk); 788 + 792 789 /* allocate tls context */ 790 + write_lock_bh(&sk->sk_callback_lock); 793 791 ctx = create_ctx(sk); 794 792 if (!ctx) { 795 793 rc = -ENOMEM; 796 794 goto out; 797 795 } 798 796 799 - tls_build_proto(sk); 800 797 ctx->tx_conf = TLS_BASE; 801 798 ctx->rx_conf = TLS_BASE; 799 + ctx->sk_proto = sk->sk_prot; 802 800 update_sk_prot(sk, ctx); 803 801 out: 802 + write_unlock_bh(&sk->sk_callback_lock); 804 803 return rc; 804 + } 805 + 806 + static void tls_update(struct sock *sk, struct proto *p) 807 + { 808 + struct tls_context *ctx; 809 + 810 + ctx = tls_get_ctx(sk); 811 + if (likely(ctx)) { 812 + ctx->sk_proto_close = p->close; 813 + ctx->sk_proto = p; 814 + } else { 815 + sk->sk_prot = p; 816 + } 805 817 } 806 818 807 819 void tls_register_device(struct tls_device *device) ··· 841 819 .name = "tls", 842 820 .owner = THIS_MODULE, 843 821 .init = tls_init, 822 + .update = tls_update, 844 823 }; 845 824 846 825 static int __init tls_register(void)
+59 -24
net/tls/tls_sw.c
··· 2054 2054 } 2055 2055 } 2056 2056 2057 - void tls_sw_free_resources_tx(struct sock *sk) 2057 + void tls_sw_cancel_work_tx(struct tls_context *tls_ctx) 2058 + { 2059 + struct tls_sw_context_tx *ctx = tls_sw_ctx_tx(tls_ctx); 2060 + 2061 + set_bit(BIT_TX_CLOSING, &ctx->tx_bitmask); 2062 + set_bit(BIT_TX_SCHEDULED, &ctx->tx_bitmask); 2063 + cancel_delayed_work_sync(&ctx->tx_work.work); 2064 + } 2065 + 2066 + void tls_sw_release_resources_tx(struct sock *sk) 2058 2067 { 2059 2068 struct tls_context *tls_ctx = tls_get_ctx(sk); 2060 2069 struct tls_sw_context_tx *ctx = tls_sw_ctx_tx(tls_ctx); ··· 2074 2065 if (atomic_read(&ctx->encrypt_pending)) 2075 2066 crypto_wait_req(-EINPROGRESS, &ctx->async_wait); 2076 2067 2077 - release_sock(sk); 2078 - cancel_delayed_work_sync(&ctx->tx_work.work); 2079 - lock_sock(sk); 2080 - 2081 - /* Tx whatever records we can transmit and abandon the rest */ 2082 2068 tls_tx_records(sk, -1); 2083 2069 2084 2070 /* Free up un-sent records in tx_list. First, free ··· 2096 2092 2097 2093 crypto_free_aead(ctx->aead_send); 2098 2094 tls_free_open_rec(sk); 2095 + } 2096 + 2097 + void tls_sw_free_ctx_tx(struct tls_context *tls_ctx) 2098 + { 2099 + struct tls_sw_context_tx *ctx = tls_sw_ctx_tx(tls_ctx); 2099 2100 2100 2101 kfree(ctx); 2101 2102 } ··· 2119 2110 skb_queue_purge(&ctx->rx_list); 2120 2111 crypto_free_aead(ctx->aead_recv); 2121 2112 strp_stop(&ctx->strp); 2122 - write_lock_bh(&sk->sk_callback_lock); 2123 - sk->sk_data_ready = ctx->saved_data_ready; 2124 - write_unlock_bh(&sk->sk_callback_lock); 2125 - release_sock(sk); 2126 - strp_done(&ctx->strp); 2127 - lock_sock(sk); 2113 + /* If tls_sw_strparser_arm() was not called (cleanup paths) 2114 + * we still want to strp_stop(), but sk->sk_data_ready was 2115 + * never swapped. 2116 + */ 2117 + if (ctx->saved_data_ready) { 2118 + write_lock_bh(&sk->sk_callback_lock); 2119 + sk->sk_data_ready = ctx->saved_data_ready; 2120 + write_unlock_bh(&sk->sk_callback_lock); 2121 + } 2128 2122 } 2123 + } 2124 + 2125 + void tls_sw_strparser_done(struct tls_context *tls_ctx) 2126 + { 2127 + struct tls_sw_context_rx *ctx = tls_sw_ctx_rx(tls_ctx); 2128 + 2129 + strp_done(&ctx->strp); 2130 + } 2131 + 2132 + void tls_sw_free_ctx_rx(struct tls_context *tls_ctx) 2133 + { 2134 + struct tls_sw_context_rx *ctx = tls_sw_ctx_rx(tls_ctx); 2135 + 2136 + kfree(ctx); 2129 2137 } 2130 2138 2131 2139 void tls_sw_free_resources_rx(struct sock *sk) 2132 2140 { 2133 2141 struct tls_context *tls_ctx = tls_get_ctx(sk); 2134 - struct tls_sw_context_rx *ctx = tls_sw_ctx_rx(tls_ctx); 2135 2142 2136 2143 tls_sw_release_resources_rx(sk); 2137 - 2138 - kfree(ctx); 2144 + tls_sw_free_ctx_rx(tls_ctx); 2139 2145 } 2140 2146 2141 2147 /* The work handler to transmitt the encrypted records in tx_list */ ··· 2161 2137 struct tx_work, work); 2162 2138 struct sock *sk = tx_work->sk; 2163 2139 struct tls_context *tls_ctx = tls_get_ctx(sk); 2164 - struct tls_sw_context_tx *ctx = tls_sw_ctx_tx(tls_ctx); 2140 + struct tls_sw_context_tx *ctx; 2141 + 2142 + if (unlikely(!tls_ctx)) 2143 + return; 2144 + 2145 + ctx = tls_sw_ctx_tx(tls_ctx); 2146 + if (test_bit(BIT_TX_CLOSING, &ctx->tx_bitmask)) 2147 + return; 2165 2148 2166 2149 if (!test_and_clear_bit(BIT_TX_SCHEDULED, &ctx->tx_bitmask)) 2167 2150 return; 2168 - 2169 2151 lock_sock(sk); 2170 2152 tls_tx_records(sk, -1); 2171 2153 release_sock(sk); ··· 2188 2158 &tx_ctx->tx_bitmask)) 2189 2159 schedule_delayed_work(&tx_ctx->tx_work.work, 0); 2190 2160 } 2161 + } 2162 + 2163 + void tls_sw_strparser_arm(struct sock *sk, struct tls_context *tls_ctx) 2164 + { 2165 + struct tls_sw_context_rx *rx_ctx = tls_sw_ctx_rx(tls_ctx); 2166 + 2167 + write_lock_bh(&sk->sk_callback_lock); 2168 + rx_ctx->saved_data_ready = sk->sk_data_ready; 2169 + sk->sk_data_ready = tls_data_ready; 2170 + write_unlock_bh(&sk->sk_callback_lock); 2171 + 2172 + strp_check_rcv(&rx_ctx->strp); 2191 2173 } 2192 2174 2193 2175 int tls_set_sw_offload(struct sock *sk, struct tls_context *ctx, int tx) ··· 2399 2357 cb.parse_msg = tls_read_size; 2400 2358 2401 2359 strp_init(&sw_ctx_rx->strp, sk, &cb); 2402 - 2403 - write_lock_bh(&sk->sk_callback_lock); 2404 - sw_ctx_rx->saved_data_ready = sk->sk_data_ready; 2405 - sk->sk_data_ready = tls_data_ready; 2406 - write_unlock_bh(&sk->sk_callback_lock); 2407 - 2408 - strp_check_rcv(&sw_ctx_rx->strp); 2409 2360 } 2410 2361 2411 2362 goto out;
+8
net/vmw_vsock/hyperv_transport.c
··· 312 312 lock_sock(sk); 313 313 hvs_do_close_lock_held(vsock_sk(sk), true); 314 314 release_sock(sk); 315 + 316 + /* Release the refcnt for the channel that's opened in 317 + * hvs_open_connection(). 318 + */ 319 + sock_put(sk); 315 320 } 316 321 317 322 static void hvs_open_connection(struct vmbus_channel *chan) ··· 412 407 } 413 408 414 409 set_per_channel_state(chan, conn_from_host ? new : sk); 410 + 411 + /* This reference will be dropped by hvs_close_connection(). */ 412 + sock_hold(conn_from_host ? new : sk); 415 413 vmbus_set_chn_rescind_callback(chan, hvs_close_connection); 416 414 417 415 /* Set the pending send size to max packet size to always get
+2 -4
net/wireless/core.c
··· 1410 1410 } 1411 1411 break; 1412 1412 case NETDEV_PRE_UP: 1413 - if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype)) && 1414 - !(wdev->iftype == NL80211_IFTYPE_AP_VLAN && 1415 - rdev->wiphy.flags & WIPHY_FLAG_4ADDR_AP && 1416 - wdev->use_4addr)) 1413 + if (!cfg80211_iftype_allowed(wdev->wiphy, wdev->iftype, 1414 + wdev->use_4addr, 0)) 1417 1415 return notifier_from_errno(-EOPNOTSUPP); 1418 1416 1419 1417 if (rfkill_blocked(rdev->rfkill))
+1 -3
net/wireless/nl80211.c
··· 3484 3484 return err; 3485 3485 } 3486 3486 3487 - if (!(rdev->wiphy.interface_modes & (1 << type)) && 3488 - !(type == NL80211_IFTYPE_AP_VLAN && params.use_4addr && 3489 - rdev->wiphy.flags & WIPHY_FLAG_4ADDR_AP)) 3487 + if (!cfg80211_iftype_allowed(&rdev->wiphy, type, params.use_4addr, 0)) 3490 3488 return -EOPNOTSUPP; 3491 3489 3492 3490 err = nl80211_parse_mon_options(rdev, type, info, &params);
+25 -2
net/wireless/util.c
··· 1697 1697 for (iftype = 0; iftype < NUM_NL80211_IFTYPES; iftype++) { 1698 1698 num_interfaces += params->iftype_num[iftype]; 1699 1699 if (params->iftype_num[iftype] > 0 && 1700 - !(wiphy->software_iftypes & BIT(iftype))) 1700 + !cfg80211_iftype_allowed(wiphy, iftype, 0, 1)) 1701 1701 used_iftypes |= BIT(iftype); 1702 1702 } 1703 1703 ··· 1719 1719 return -ENOMEM; 1720 1720 1721 1721 for (iftype = 0; iftype < NUM_NL80211_IFTYPES; iftype++) { 1722 - if (wiphy->software_iftypes & BIT(iftype)) 1722 + if (cfg80211_iftype_allowed(wiphy, iftype, 0, 1)) 1723 1723 continue; 1724 1724 for (j = 0; j < c->n_limits; j++) { 1725 1725 all_iftypes |= limits[j].types; ··· 2072 2072 return max_vht_nss; 2073 2073 } 2074 2074 EXPORT_SYMBOL(ieee80211_get_vht_max_nss); 2075 + 2076 + bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype, 2077 + bool is_4addr, u8 check_swif) 2078 + 2079 + { 2080 + bool is_vlan = iftype == NL80211_IFTYPE_AP_VLAN; 2081 + 2082 + switch (check_swif) { 2083 + case 0: 2084 + if (is_vlan && is_4addr) 2085 + return wiphy->flags & WIPHY_FLAG_4ADDR_AP; 2086 + return wiphy->interface_modes & BIT(iftype); 2087 + case 1: 2088 + if (!(wiphy->software_iftypes & BIT(iftype)) && is_vlan) 2089 + return wiphy->flags & WIPHY_FLAG_4ADDR_AP; 2090 + return wiphy->software_iftypes & BIT(iftype); 2091 + default: 2092 + break; 2093 + } 2094 + 2095 + return false; 2096 + } 2097 + EXPORT_SYMBOL(cfg80211_iftype_allowed);
+3 -2
tools/lib/bpf/btf.c
··· 1 1 // SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) 2 2 /* Copyright (c) 2018 Facebook */ 3 3 4 + #include <endian.h> 4 5 #include <stdio.h> 5 6 #include <stdlib.h> 6 7 #include <string.h> ··· 420 419 421 420 static bool btf_check_endianness(const GElf_Ehdr *ehdr) 422 421 { 423 - #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ 422 + #if __BYTE_ORDER == __LITTLE_ENDIAN 424 423 return ehdr->e_ident[EI_DATA] == ELFDATA2LSB; 425 - #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ 424 + #elif __BYTE_ORDER == __BIG_ENDIAN 426 425 return ehdr->e_ident[EI_DATA] == ELFDATA2MSB; 427 426 #else 428 427 # error "Unrecognized __BYTE_ORDER__"
+23 -11
tools/lib/bpf/libbpf.c
··· 20 20 #include <inttypes.h> 21 21 #include <string.h> 22 22 #include <unistd.h> 23 + #include <endian.h> 23 24 #include <fcntl.h> 24 25 #include <errno.h> 25 26 #include <asm/unistd.h> ··· 613 612 614 613 static int bpf_object__check_endianness(struct bpf_object *obj) 615 614 { 616 - #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ 615 + #if __BYTE_ORDER == __LITTLE_ENDIAN 617 616 if (obj->efile.ehdr.e_ident[EI_DATA] == ELFDATA2LSB) 618 617 return 0; 619 - #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ 618 + #elif __BYTE_ORDER == __BIG_ENDIAN 620 619 if (obj->efile.ehdr.e_ident[EI_DATA] == ELFDATA2MSB) 621 620 return 0; 622 621 #else ··· 1378 1377 if (!has_datasec && kind == BTF_KIND_VAR) { 1379 1378 /* replace VAR with INT */ 1380 1379 t->info = BTF_INFO_ENC(BTF_KIND_INT, 0, 0); 1381 - t->size = sizeof(int); 1382 - *(int *)(t+1) = BTF_INT_ENC(0, 0, 32); 1380 + /* 1381 + * using size = 1 is the safest choice, 4 will be too 1382 + * big and cause kernel BTF validation failure if 1383 + * original variable took less than 4 bytes 1384 + */ 1385 + t->size = 1; 1386 + *(int *)(t+1) = BTF_INT_ENC(0, 0, 8); 1383 1387 } else if (!has_datasec && kind == BTF_KIND_DATASEC) { 1384 1388 /* replace DATASEC with STRUCT */ 1385 1389 struct btf_var_secinfo *v = (void *)(t + 1); ··· 1506 1500 BTF_ELF_SEC, err); 1507 1501 btf__free(obj->btf); 1508 1502 obj->btf = NULL; 1503 + /* btf_ext can't exist without btf, so free it as well */ 1504 + if (obj->btf_ext) { 1505 + btf_ext__free(obj->btf_ext); 1506 + obj->btf_ext = NULL; 1507 + } 1508 + 1509 1509 if (bpf_object__is_btf_mandatory(obj)) 1510 1510 return err; 1511 1511 } ··· 4519 4507 const struct perf_buffer_opts *opts) 4520 4508 { 4521 4509 struct perf_buffer_params p = {}; 4522 - struct perf_event_attr attr = { 4523 - .config = PERF_COUNT_SW_BPF_OUTPUT, 4524 - .type = PERF_TYPE_SOFTWARE, 4525 - .sample_type = PERF_SAMPLE_RAW, 4526 - .sample_period = 1, 4527 - .wakeup_events = 1, 4528 - }; 4510 + struct perf_event_attr attr = { 0, }; 4511 + 4512 + attr.config = PERF_COUNT_SW_BPF_OUTPUT, 4513 + attr.type = PERF_TYPE_SOFTWARE; 4514 + attr.sample_type = PERF_SAMPLE_RAW; 4515 + attr.sample_period = 1; 4516 + attr.wakeup_events = 1; 4529 4517 4530 4518 p.attr = &attr; 4531 4519 p.sample_cb = opts ? opts->sample_cb : NULL;
+5 -6
tools/lib/bpf/xsk.c
··· 317 317 318 318 static int xsk_get_max_queues(struct xsk_socket *xsk) 319 319 { 320 - struct ethtool_channels channels; 321 - struct ifreq ifr; 320 + struct ethtool_channels channels = { .cmd = ETHTOOL_GCHANNELS }; 321 + struct ifreq ifr = {}; 322 322 int fd, err, ret; 323 323 324 324 fd = socket(AF_INET, SOCK_DGRAM, 0); 325 325 if (fd < 0) 326 326 return -errno; 327 327 328 - channels.cmd = ETHTOOL_GCHANNELS; 329 328 ifr.ifr_data = (void *)&channels; 330 - strncpy(ifr.ifr_name, xsk->ifname, IFNAMSIZ - 1); 329 + memcpy(ifr.ifr_name, xsk->ifname, IFNAMSIZ - 1); 331 330 ifr.ifr_name[IFNAMSIZ - 1] = '\0'; 332 331 err = ioctl(fd, SIOCETHTOOL, &ifr); 333 332 if (err && errno != EOPNOTSUPP) { ··· 334 335 goto out; 335 336 } 336 337 337 - if (channels.max_combined == 0 || errno == EOPNOTSUPP) 338 + if (err || channels.max_combined == 0) 338 339 /* If the device says it has no channels, then all traffic 339 340 * is sent to a single stream, so max queues = 1. 340 341 */ ··· 516 517 err = -errno; 517 518 goto out_socket; 518 519 } 519 - strncpy(xsk->ifname, ifname, IFNAMSIZ - 1); 520 + memcpy(xsk->ifname, ifname, IFNAMSIZ - 1); 520 521 xsk->ifname[IFNAMSIZ - 1] = '\0'; 521 522 522 523 err = xsk_set_xdp_socket_config(&xsk->config, usr_config);
+2 -1
tools/testing/selftests/bpf/Makefile
··· 57 57 test_lirc_mode2.sh \ 58 58 test_skb_cgroup_id.sh \ 59 59 test_flow_dissector.sh \ 60 - test_xdp_vlan.sh \ 60 + test_xdp_vlan_mode_generic.sh \ 61 + test_xdp_vlan_mode_native.sh \ 61 62 test_lwt_ip_encap.sh \ 62 63 test_tcp_check_syncookie.sh \ 63 64 test_tc_tunnel.sh \
+1 -2
tools/testing/selftests/bpf/progs/sendmsg6_prog.c
··· 41 41 } 42 42 43 43 /* Rewrite destination. */ 44 - if ((ctx->user_ip6[0] & 0xFFFF) == bpf_htons(0xFACE) && 45 - ctx->user_ip6[0] >> 16 == bpf_htons(0xB00C)) { 44 + if (ctx->user_ip6[0] == bpf_htonl(0xFACEB00C)) { 46 45 ctx->user_ip6[0] = bpf_htonl(DST_REWRITE_IP6_0); 47 46 ctx->user_ip6[1] = bpf_htonl(DST_REWRITE_IP6_1); 48 47 ctx->user_ip6[2] = bpf_htonl(DST_REWRITE_IP6_2);
+45 -12
tools/testing/selftests/bpf/test_xdp_vlan.sh
··· 1 1 #!/bin/bash 2 + # SPDX-License-Identifier: GPL-2.0 3 + # Author: Jesper Dangaard Brouer <hawk@kernel.org> 2 4 3 - TESTNAME=xdp_vlan 5 + # Allow wrapper scripts to name test 6 + if [ -z "$TESTNAME" ]; then 7 + TESTNAME=xdp_vlan 8 + fi 9 + 10 + # Default XDP mode 11 + XDP_MODE=xdpgeneric 4 12 5 13 usage() { 6 14 echo "Testing XDP + TC eBPF VLAN manipulations: $TESTNAME" ··· 17 9 echo " -v | --verbose : Verbose" 18 10 echo " --flush : Flush before starting (e.g. after --interactive)" 19 11 echo " --interactive : Keep netns setup running after test-run" 12 + echo " --mode=XXX : Choose XDP mode (xdp | xdpgeneric | xdpdrv)" 20 13 echo "" 14 + } 15 + 16 + valid_xdp_mode() 17 + { 18 + local mode=$1 19 + 20 + case "$mode" in 21 + xdpgeneric | xdpdrv | xdp) 22 + return 0 23 + ;; 24 + *) 25 + return 1 26 + esac 21 27 } 22 28 23 29 cleanup() ··· 59 37 60 38 # Using external program "getopt" to get --long-options 61 39 OPTIONS=$(getopt -o hvfi: \ 62 - --long verbose,flush,help,interactive,debug -- "$@") 40 + --long verbose,flush,help,interactive,debug,mode: -- "$@") 63 41 if (( $? != 0 )); then 64 42 usage 65 43 echo "selftests: $TESTNAME [FAILED] Error calling getopt, unknown option?" ··· 80 58 ;; 81 59 -f | --flush ) 82 60 cleanup 61 + shift 62 + ;; 63 + --mode ) 64 + shift 65 + XDP_MODE=$1 83 66 shift 84 67 ;; 85 68 -- ) ··· 108 81 exit 1 109 82 fi 110 83 111 - ip link set dev lo xdp off 2>/dev/null > /dev/null 112 - if [ $? -ne 0 ];then 84 + valid_xdp_mode $XDP_MODE 85 + if [ $? -ne 0 ]; then 86 + echo "selftests: $TESTNAME [FAILED] unknown XDP mode ($XDP_MODE)" 87 + exit 1 88 + fi 89 + 90 + ip link set dev lo xdpgeneric off 2>/dev/null > /dev/null 91 + if [ $? -ne 0 ]; then 113 92 echo "selftests: $TESTNAME [SKIP] need ip xdp support" 114 93 exit 0 115 94 fi ··· 188 155 # At this point, the hosts cannot reach each-other, 189 156 # because ns2 are using VLAN tags on the packets. 190 157 191 - ip netns exec ns2 sh -c 'ping -W 1 -c 1 100.64.41.1 || echo "Okay ping fails"' 158 + ip netns exec ns2 sh -c 'ping -W 1 -c 1 100.64.41.1 || echo "Success: First ping must fail"' 192 159 193 160 194 161 # Now we can use the test_xdp_vlan.c program to pop/push these VLAN tags ··· 199 166 200 167 # First test: Remove VLAN by setting VLAN ID 0, using "xdp_vlan_change" 201 168 export XDP_PROG=xdp_vlan_change 202 - ip netns exec ns1 ip link set $DEVNS1 xdp object $FILE section $XDP_PROG 169 + ip netns exec ns1 ip link set $DEVNS1 $XDP_MODE object $FILE section $XDP_PROG 203 170 204 171 # In ns1: egress use TC to add back VLAN tag 4011 205 172 # (del cmd) ··· 210 177 prio 1 handle 1 bpf da obj $FILE sec tc_vlan_push 211 178 212 179 # Now the namespaces can reach each-other, test with ping: 213 - ip netns exec ns2 ping -W 2 -c 3 $IPADDR1 214 - ip netns exec ns1 ping -W 2 -c 3 $IPADDR2 180 + ip netns exec ns2 ping -i 0.2 -W 2 -c 2 $IPADDR1 181 + ip netns exec ns1 ping -i 0.2 -W 2 -c 2 $IPADDR2 215 182 216 183 # Second test: Replace xdp prog, that fully remove vlan header 217 184 # ··· 220 187 # ETH_P_8021Q indication, and this cause overwriting of our changes. 221 188 # 222 189 export XDP_PROG=xdp_vlan_remove_outer2 223 - ip netns exec ns1 ip link set $DEVNS1 xdp off 224 - ip netns exec ns1 ip link set $DEVNS1 xdp object $FILE section $XDP_PROG 190 + ip netns exec ns1 ip link set $DEVNS1 $XDP_MODE off 191 + ip netns exec ns1 ip link set $DEVNS1 $XDP_MODE object $FILE section $XDP_PROG 225 192 226 193 # Now the namespaces should still be able reach each-other, test with ping: 227 - ip netns exec ns2 ping -W 2 -c 3 $IPADDR1 228 - ip netns exec ns1 ping -W 2 -c 3 $IPADDR2 194 + ip netns exec ns2 ping -i 0.2 -W 2 -c 2 $IPADDR1 195 + ip netns exec ns1 ping -i 0.2 -W 2 -c 2 $IPADDR2
+9
tools/testing/selftests/bpf/test_xdp_vlan_mode_generic.sh
··· 1 + #!/bin/bash 2 + # SPDX-License-Identifier: GPL-2.0 3 + 4 + # Exit on failure 5 + set -e 6 + 7 + # Wrapper script to test generic-XDP 8 + export TESTNAME=xdp_vlan_mode_generic 9 + ./test_xdp_vlan.sh --mode=xdpgeneric
+9
tools/testing/selftests/bpf/test_xdp_vlan_mode_native.sh
··· 1 + #!/bin/bash 2 + # SPDX-License-Identifier: GPL-2.0 3 + 4 + # Exit on failure 5 + set -e 6 + 7 + # Wrapper script to test native-XDP 8 + export TESTNAME=xdp_vlan_mode_native 9 + ./test_xdp_vlan.sh --mode=xdpdrv
+11
tools/testing/selftests/bpf/verifier/ctx_skb.c
··· 975 975 .prog_type = BPF_PROG_TYPE_CGROUP_SKB, 976 976 }, 977 977 { 978 + "read gso_segs from CGROUP_SKB", 979 + .insns = { 980 + BPF_LDX_MEM(BPF_W, BPF_REG_1, BPF_REG_1, 981 + offsetof(struct __sk_buff, gso_segs)), 982 + BPF_MOV64_IMM(BPF_REG_0, 0), 983 + BPF_EXIT_INSN(), 984 + }, 985 + .result = ACCEPT, 986 + .prog_type = BPF_PROG_TYPE_CGROUP_SKB, 987 + }, 988 + { 978 989 "write gso_segs from CGROUP_SKB", 979 990 .insns = { 980 991 BPF_MOV64_IMM(BPF_REG_0, 0),
+2 -2
tools/testing/selftests/net/.gitignore
··· 17 17 tls 18 18 txring_overwrite 19 19 ip_defrag 20 + ipv6_flowlabel 21 + ipv6_flowlabel_mgr 20 22 so_txtime 21 - flowlabel 22 - flowlabel_mgr 23 23 tcp_fastopen_backup_key
+16 -12
tools/testing/selftests/net/forwarding/gre_multipath.sh
··· 93 93 ip route add vrf v$ol1 192.0.2.16/28 \ 94 94 nexthop dev g1a \ 95 95 nexthop dev g1b 96 - 97 - tc qdisc add dev $ul1 clsact 98 - tc filter add dev $ul1 egress pref 111 prot ipv4 \ 99 - flower dst_ip 192.0.2.66 action pass 100 - tc filter add dev $ul1 egress pref 222 prot ipv4 \ 101 - flower dst_ip 192.0.2.82 action pass 102 96 } 103 97 104 98 sw1_destroy() 105 99 { 106 - tc qdisc del dev $ul1 clsact 107 - 108 100 ip route del vrf v$ol1 192.0.2.16/28 109 101 110 102 ip route del vrf v$ol1 192.0.2.82/32 via 192.0.2.146 ··· 131 139 ip route add vrf v$ol2 192.0.2.0/28 \ 132 140 nexthop dev g2a \ 133 141 nexthop dev g2b 142 + 143 + tc qdisc add dev $ul2 clsact 144 + tc filter add dev $ul2 ingress pref 111 prot 802.1Q \ 145 + flower vlan_id 111 action pass 146 + tc filter add dev $ul2 ingress pref 222 prot 802.1Q \ 147 + flower vlan_id 222 action pass 134 148 } 135 149 136 150 sw2_destroy() 137 151 { 152 + tc qdisc del dev $ul2 clsact 153 + 138 154 ip route del vrf v$ol2 192.0.2.0/28 139 155 140 156 ip route del vrf v$ol2 192.0.2.81/32 via 192.0.2.145 ··· 187 187 sw1_create 188 188 sw2_create 189 189 h2_create 190 + 191 + forwarding_enable 190 192 } 191 193 192 194 cleanup() 193 195 { 194 196 pre_cleanup 197 + 198 + forwarding_restore 195 199 196 200 h2_destroy 197 201 sw2_destroy ··· 215 211 nexthop dev g1a weight $weight1 \ 216 212 nexthop dev g1b weight $weight2 217 213 218 - local t0_111=$(tc_rule_stats_get $ul1 111 egress) 219 - local t0_222=$(tc_rule_stats_get $ul1 222 egress) 214 + local t0_111=$(tc_rule_stats_get $ul2 111 ingress) 215 + local t0_222=$(tc_rule_stats_get $ul2 222 ingress) 220 216 221 217 ip vrf exec v$h1 \ 222 218 $MZ $h1 -q -p 64 -A 192.0.2.1 -B 192.0.2.18 \ 223 219 -d 1msec -t udp "sp=1024,dp=0-32768" 224 220 225 - local t1_111=$(tc_rule_stats_get $ul1 111 egress) 226 - local t1_222=$(tc_rule_stats_get $ul1 222 egress) 221 + local t1_111=$(tc_rule_stats_get $ul2 111 ingress) 222 + local t1_222=$(tc_rule_stats_get $ul2 222 ingress) 227 223 228 224 local d111=$((t1_111 - t0_111)) 229 225 local d222=$((t1_222 - t0_222))
+223
tools/testing/selftests/net/tls.c
··· 25 25 #define TLS_PAYLOAD_MAX_LEN 16384 26 26 #define SOL_TLS 282 27 27 28 + #ifndef ENOTSUPP 29 + #define ENOTSUPP 524 30 + #endif 31 + 32 + FIXTURE(tls_basic) 33 + { 34 + int fd, cfd; 35 + bool notls; 36 + }; 37 + 38 + FIXTURE_SETUP(tls_basic) 39 + { 40 + struct sockaddr_in addr; 41 + socklen_t len; 42 + int sfd, ret; 43 + 44 + self->notls = false; 45 + len = sizeof(addr); 46 + 47 + addr.sin_family = AF_INET; 48 + addr.sin_addr.s_addr = htonl(INADDR_ANY); 49 + addr.sin_port = 0; 50 + 51 + self->fd = socket(AF_INET, SOCK_STREAM, 0); 52 + sfd = socket(AF_INET, SOCK_STREAM, 0); 53 + 54 + ret = bind(sfd, &addr, sizeof(addr)); 55 + ASSERT_EQ(ret, 0); 56 + ret = listen(sfd, 10); 57 + ASSERT_EQ(ret, 0); 58 + 59 + ret = getsockname(sfd, &addr, &len); 60 + ASSERT_EQ(ret, 0); 61 + 62 + ret = connect(self->fd, &addr, sizeof(addr)); 63 + ASSERT_EQ(ret, 0); 64 + 65 + self->cfd = accept(sfd, &addr, &len); 66 + ASSERT_GE(self->cfd, 0); 67 + 68 + close(sfd); 69 + 70 + ret = setsockopt(self->fd, IPPROTO_TCP, TCP_ULP, "tls", sizeof("tls")); 71 + if (ret != 0) { 72 + ASSERT_EQ(errno, ENOENT); 73 + self->notls = true; 74 + printf("Failure setting TCP_ULP, testing without tls\n"); 75 + return; 76 + } 77 + 78 + ret = setsockopt(self->cfd, IPPROTO_TCP, TCP_ULP, "tls", sizeof("tls")); 79 + ASSERT_EQ(ret, 0); 80 + } 81 + 82 + FIXTURE_TEARDOWN(tls_basic) 83 + { 84 + close(self->fd); 85 + close(self->cfd); 86 + } 87 + 88 + /* Send some data through with ULP but no keys */ 89 + TEST_F(tls_basic, base_base) 90 + { 91 + char const *test_str = "test_read"; 92 + int send_len = 10; 93 + char buf[10]; 94 + 95 + ASSERT_EQ(strlen(test_str) + 1, send_len); 96 + 97 + EXPECT_EQ(send(self->fd, test_str, send_len, 0), send_len); 98 + EXPECT_NE(recv(self->cfd, buf, send_len, 0), -1); 99 + EXPECT_EQ(memcmp(buf, test_str, send_len), 0); 100 + }; 101 + 28 102 FIXTURE(tls) 29 103 { 30 104 int fd, cfd; ··· 237 163 EXPECT_EQ(recv(self->cfd, buf, send_len * 2, MSG_WAITALL), 238 164 send_len * 2); 239 165 EXPECT_EQ(memcmp(buf, test_str, send_len), 0); 166 + } 167 + 168 + TEST_F(tls, msg_more_unsent) 169 + { 170 + char const *test_str = "test_read"; 171 + int send_len = 10; 172 + char buf[10]; 173 + 174 + EXPECT_EQ(send(self->fd, test_str, send_len, MSG_MORE), send_len); 175 + EXPECT_EQ(recv(self->cfd, buf, send_len, MSG_DONTWAIT), -1); 240 176 } 241 177 242 178 TEST_F(tls, sendmsg_single) ··· 694 610 EXPECT_EQ(memcmp(send_mem, recv_mem + 10, 5), 0); 695 611 } 696 612 613 + TEST_F(tls, bidir) 614 + { 615 + char const *test_str = "test_read"; 616 + int send_len = 10; 617 + char buf[10]; 618 + int ret; 619 + 620 + if (!self->notls) { 621 + struct tls12_crypto_info_aes_gcm_128 tls12; 622 + 623 + memset(&tls12, 0, sizeof(tls12)); 624 + tls12.info.version = TLS_1_3_VERSION; 625 + tls12.info.cipher_type = TLS_CIPHER_AES_GCM_128; 626 + 627 + ret = setsockopt(self->fd, SOL_TLS, TLS_RX, &tls12, 628 + sizeof(tls12)); 629 + ASSERT_EQ(ret, 0); 630 + 631 + ret = setsockopt(self->cfd, SOL_TLS, TLS_TX, &tls12, 632 + sizeof(tls12)); 633 + ASSERT_EQ(ret, 0); 634 + } 635 + 636 + ASSERT_EQ(strlen(test_str) + 1, send_len); 637 + 638 + EXPECT_EQ(send(self->fd, test_str, send_len, 0), send_len); 639 + EXPECT_NE(recv(self->cfd, buf, send_len, 0), -1); 640 + EXPECT_EQ(memcmp(buf, test_str, send_len), 0); 641 + 642 + memset(buf, 0, sizeof(buf)); 643 + 644 + EXPECT_EQ(send(self->cfd, test_str, send_len, 0), send_len); 645 + EXPECT_NE(recv(self->fd, buf, send_len, 0), -1); 646 + EXPECT_EQ(memcmp(buf, test_str, send_len), 0); 647 + }; 648 + 697 649 TEST_F(tls, pollin) 698 650 { 699 651 char const *test_str = "test_poll"; ··· 955 835 record_type = *((unsigned char *)CMSG_DATA(cmsg)); 956 836 EXPECT_EQ(record_type, 100); 957 837 EXPECT_EQ(memcmp(buf, test_str, send_len), 0); 838 + } 839 + 840 + TEST_F(tls, shutdown) 841 + { 842 + char const *test_str = "test_read"; 843 + int send_len = 10; 844 + char buf[10]; 845 + 846 + ASSERT_EQ(strlen(test_str) + 1, send_len); 847 + 848 + EXPECT_EQ(send(self->fd, test_str, send_len, 0), send_len); 849 + EXPECT_NE(recv(self->cfd, buf, send_len, 0), -1); 850 + EXPECT_EQ(memcmp(buf, test_str, send_len), 0); 851 + 852 + shutdown(self->fd, SHUT_RDWR); 853 + shutdown(self->cfd, SHUT_RDWR); 854 + } 855 + 856 + TEST_F(tls, shutdown_unsent) 857 + { 858 + char const *test_str = "test_read"; 859 + int send_len = 10; 860 + 861 + EXPECT_EQ(send(self->fd, test_str, send_len, MSG_MORE), send_len); 862 + 863 + shutdown(self->fd, SHUT_RDWR); 864 + shutdown(self->cfd, SHUT_RDWR); 865 + } 866 + 867 + TEST_F(tls, shutdown_reuse) 868 + { 869 + struct sockaddr_in addr; 870 + int ret; 871 + 872 + shutdown(self->fd, SHUT_RDWR); 873 + shutdown(self->cfd, SHUT_RDWR); 874 + close(self->cfd); 875 + 876 + addr.sin_family = AF_INET; 877 + addr.sin_addr.s_addr = htonl(INADDR_ANY); 878 + addr.sin_port = 0; 879 + 880 + ret = bind(self->fd, &addr, sizeof(addr)); 881 + EXPECT_EQ(ret, 0); 882 + ret = listen(self->fd, 10); 883 + EXPECT_EQ(ret, -1); 884 + EXPECT_EQ(errno, EINVAL); 885 + 886 + ret = connect(self->fd, &addr, sizeof(addr)); 887 + EXPECT_EQ(ret, -1); 888 + EXPECT_EQ(errno, EISCONN); 889 + } 890 + 891 + TEST(non_established) { 892 + struct tls12_crypto_info_aes_gcm_256 tls12; 893 + struct sockaddr_in addr; 894 + int sfd, ret, fd; 895 + socklen_t len; 896 + 897 + len = sizeof(addr); 898 + 899 + memset(&tls12, 0, sizeof(tls12)); 900 + tls12.info.version = TLS_1_2_VERSION; 901 + tls12.info.cipher_type = TLS_CIPHER_AES_GCM_256; 902 + 903 + addr.sin_family = AF_INET; 904 + addr.sin_addr.s_addr = htonl(INADDR_ANY); 905 + addr.sin_port = 0; 906 + 907 + fd = socket(AF_INET, SOCK_STREAM, 0); 908 + sfd = socket(AF_INET, SOCK_STREAM, 0); 909 + 910 + ret = bind(sfd, &addr, sizeof(addr)); 911 + ASSERT_EQ(ret, 0); 912 + ret = listen(sfd, 10); 913 + ASSERT_EQ(ret, 0); 914 + 915 + ret = setsockopt(fd, IPPROTO_TCP, TCP_ULP, "tls", sizeof("tls")); 916 + EXPECT_EQ(ret, -1); 917 + /* TLS ULP not supported */ 918 + if (errno == ENOENT) 919 + return; 920 + EXPECT_EQ(errno, ENOTSUPP); 921 + 922 + ret = setsockopt(sfd, IPPROTO_TCP, TCP_ULP, "tls", sizeof("tls")); 923 + EXPECT_EQ(ret, -1); 924 + EXPECT_EQ(errno, ENOTSUPP); 925 + 926 + ret = getsockname(sfd, &addr, &len); 927 + ASSERT_EQ(ret, 0); 928 + 929 + ret = connect(fd, &addr, sizeof(addr)); 930 + ASSERT_EQ(ret, 0); 931 + 932 + ret = setsockopt(fd, IPPROTO_TCP, TCP_ULP, "tls", sizeof("tls")); 933 + ASSERT_EQ(ret, 0); 934 + 935 + ret = setsockopt(fd, IPPROTO_TCP, TCP_ULP, "tls", sizeof("tls")); 936 + EXPECT_EQ(ret, -1); 937 + EXPECT_EQ(errno, EEXIST); 938 + 939 + close(fd); 940 + close(sfd); 958 941 } 959 942 960 943 TEST(keysizes) {
+94
tools/testing/selftests/tc-testing/tc-tests/actions/vlan.json
··· 713 713 "teardown": [ 714 714 "$TC actions flush action vlan" 715 715 ] 716 + }, 717 + { 718 + "id": "294e", 719 + "name": "Add batch of 32 vlan push actions with cookie", 720 + "category": [ 721 + "actions", 722 + "vlan" 723 + ], 724 + "setup": [ 725 + [ 726 + "$TC actions flush action vlan", 727 + 0, 728 + 1, 729 + 255 730 + ] 731 + ], 732 + "cmdUnderTest": "bash -c \"for i in \\`seq 1 32\\`; do cmd=\\\"action vlan push protocol 802.1q id 4094 priority 7 pipe index \\$i cookie aabbccddeeff112233445566778800a1 \\\"; args=\"\\$args\\$cmd\"; done && $TC actions add \\$args\"", 733 + "expExitCode": "0", 734 + "verifyCmd": "$TC actions list action vlan", 735 + "matchPattern": "^[ \t]+index [0-9]+ ref", 736 + "matchCount": "32", 737 + "teardown": [ 738 + "$TC actions flush action vlan" 739 + ] 740 + }, 741 + { 742 + "id": "56f7", 743 + "name": "Delete batch of 32 vlan push actions", 744 + "category": [ 745 + "actions", 746 + "vlan" 747 + ], 748 + "setup": [ 749 + [ 750 + "$TC actions flush action vlan", 751 + 0, 752 + 1, 753 + 255 754 + ], 755 + "bash -c \"for i in \\`seq 1 32\\`; do cmd=\\\"action vlan push protocol 802.1q id 4094 priority 7 pipe index \\$i \\\"; args=\\\"\\$args\\$cmd\\\"; done && $TC actions add \\$args\"" 756 + ], 757 + "cmdUnderTest": "bash -c \"for i in \\`seq 1 32\\`; do cmd=\\\"action vlan index \\$i \\\"; args=\"\\$args\\$cmd\"; done && $TC actions del \\$args\"", 758 + "expExitCode": "0", 759 + "verifyCmd": "$TC actions list action vlan", 760 + "matchPattern": "^[ \t]+index [0-9]+ ref", 761 + "matchCount": "0", 762 + "teardown": [] 763 + }, 764 + { 765 + "id": "759f", 766 + "name": "Add batch of 32 vlan pop actions with cookie", 767 + "category": [ 768 + "actions", 769 + "vlan" 770 + ], 771 + "setup": [ 772 + [ 773 + "$TC actions flush action vlan", 774 + 0, 775 + 1, 776 + 255 777 + ] 778 + ], 779 + "cmdUnderTest": "bash -c \"for i in \\`seq 1 32\\`; do cmd=\\\"action vlan pop continue index \\$i cookie aabbccddeeff112233445566778800a1 \\\"; args=\"\\$args\\$cmd\"; done && $TC actions add \\$args\"", 780 + "expExitCode": "0", 781 + "verifyCmd": "$TC actions list action vlan", 782 + "matchPattern": "^[ \t]+index [0-9]+ ref", 783 + "matchCount": "32", 784 + "teardown": [ 785 + "$TC actions flush action vlan" 786 + ] 787 + }, 788 + { 789 + "id": "c84a", 790 + "name": "Delete batch of 32 vlan pop actions", 791 + "category": [ 792 + "actions", 793 + "vlan" 794 + ], 795 + "setup": [ 796 + [ 797 + "$TC actions flush action vlan", 798 + 0, 799 + 1, 800 + 255 801 + ], 802 + "bash -c \"for i in \\`seq 1 32\\`; do cmd=\\\"action vlan pop index \\$i \\\"; args=\\\"\\$args\\$cmd\\\"; done && $TC actions add \\$args\"" 803 + ], 804 + "cmdUnderTest": "bash -c \"for i in \\`seq 1 32\\`; do cmd=\\\"action vlan index \\$i \\\"; args=\"\\$args\\$cmd\"; done && $TC actions del \\$args\"", 805 + "expExitCode": "0", 806 + "verifyCmd": "$TC actions list action vlan", 807 + "matchPattern": "^[ \t]+index [0-9]+ ref", 808 + "matchCount": "0", 809 + "teardown": [] 716 810 } 717 811 ]