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 tag 'net-6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

Pull networking fixes from Jakub Kicinski:
"Including fixes from bluetooth, bpf and wireguard.

Current release - regressions:

- nvme-tcp: fix comma-related oops after sendpage changes

Current release - new code bugs:

- ptp: make max_phase_adjustment sysfs device attribute invisible
when not supported

Previous releases - regressions:

- sctp: fix potential deadlock on &net->sctp.addr_wq_lock

- mptcp:
- ensure subflow is unhashed before cleaning the backlog
- do not rely on implicit state check in mptcp_listen()

Previous releases - always broken:

- net: fix net_dev_start_xmit trace event vs skb_transport_offset()

- Bluetooth:
- fix use-bdaddr-property quirk
- L2CAP: fix multiple UaFs
- ISO: use hci_sync for setting CIG parameters
- hci_event: fix Set CIG Parameters error status handling
- hci_event: fix parsing of CIS Established Event
- MGMT: fix marking SCAN_RSP as not connectable

- wireguard: queuing: use saner cpu selection wrapping

- sched: act_ipt: various bug fixes for iptables <> TC interactions

- sched: act_pedit: add size check for TCA_PEDIT_PARMS_EX

- dsa: fixes for receiving PTP packets with 8021q and sja1105 tagging

- eth: sfc: fix null-deref in devlink port without MAE access

- eth: ibmvnic: do not reset dql stats on NON_FATAL err

Misc:

- xsk: honor SO_BINDTODEVICE on bind"

* tag 'net-6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (70 commits)
nfp: clean mc addresses in application firmware when closing port
selftests: mptcp: pm_nl_ctl: fix 32-bit support
selftests: mptcp: depend on SYN_COOKIES
selftests: mptcp: userspace_pm: report errors with 'remove' tests
selftests: mptcp: userspace_pm: use correct server port
selftests: mptcp: sockopt: return error if wrong mark
selftests: mptcp: sockopt: use 'iptables-legacy' if available
selftests: mptcp: connect: fail if nft supposed to work
mptcp: do not rely on implicit state check in mptcp_listen()
mptcp: ensure subflow is unhashed before cleaning the backlog
s390/qeth: Fix vipa deletion
octeontx-af: fix hardware timestamp configuration
net: dsa: sja1105: always enable the send_meta options
net: dsa: tag_sja1105: fix MAC DA patching from meta frames
net: Replace strlcpy with strscpy
pptp: Fix fib lookup calls.
mlxsw: spectrum_router: Fix an IS_ERR() vs NULL check
net/sched: act_pedit: Add size check for TCA_PEDIT_PARMS_EX
xsk: Honor SO_BINDTODEVICE on bind
ptp: Make max_phase_adjustment sysfs device attribute invisible when not supported
...

+639 -329
+1 -1
Documentation/ABI/testing/sysfs-class-net-qmi
··· 62 62 What: /sys/class/net/<iface>/qmi/pass_through 63 63 Date: January 2021 64 64 KernelVersion: 5.12 65 - Contact: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org> 65 + Contact: Subash Abhinov Kasiviswanathan <quic_subashab@quicinc.com> 66 66 Description: 67 67 Boolean. Default: 'N' 68 68
+9
Documentation/networking/af_xdp.rst
··· 433 433 application to use. The final option is the flags field, but it will 434 434 be dealt with in separate sections for each UMEM flag. 435 435 436 + SO_BINDTODEVICE setsockopt 437 + -------------------------- 438 + 439 + This is a generic SOL_SOCKET option that can be used to tie AF_XDP 440 + socket to a particular network interface. It is useful when a socket 441 + is created by a privileged process and passed to a non-privileged one. 442 + Once the option is set, kernel will refuse attempts to bind that socket 443 + to a different interface. Updating the value requires CAP_NET_RAW. 444 + 436 445 XDP_STATISTICS getsockopt 437 446 ------------------------- 438 447
+3 -4
Documentation/networking/device_drivers/cellular/qualcomm/rmnet.rst
··· 190 190 3. Userspace configuration 191 191 ========================== 192 192 193 - rmnet userspace configuration is done through netlink library librmnetctl 194 - and command line utility rmnetcli. Utility is hosted in codeaurora forum git. 195 - The driver uses rtnl_link_ops for communication. 193 + rmnet userspace configuration is done through netlink using iproute2 194 + https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/ 196 195 197 - https://source.codeaurora.org/quic/la/platform/vendor/qcom-opensource/dataservices/tree/rmnetctl 196 + The driver uses rtnl_link_ops for communication.
+5 -2
Documentation/process/maintainer-netdev.rst
··· 149 149 of communicating with the bot, the bot commands should be seen as metadata. 150 150 151 151 The use of the bot is restricted to authors of the patches (the ``From:`` 152 - header on patch submission and command must match!), maintainers themselves 153 - and a handful of senior reviewers. Bot records its activity here: 152 + header on patch submission and command must match!), maintainers of 153 + the modified code according to the MAINTAINERS file (again, ``From:`` 154 + must match the MAINTAINERS entry) and a handful of senior reviewers. 155 + 156 + Bot records its activity here: 154 157 155 158 https://patchwork.hopto.org/pw-bot.html 156 159
+1 -1
drivers/bluetooth/btqca.c
··· 637 637 snprintf(config.fwname, sizeof(config.fwname), 638 638 "qca/%s", firmware_name); 639 639 else if (qca_is_wcn399x(soc_type)) { 640 - if (ver.soc_id == QCA_WCN3991_SOC_ID) { 640 + if (le32_to_cpu(ver.soc_id) == QCA_WCN3991_SOC_ID) { 641 641 snprintf(config.fwname, sizeof(config.fwname), 642 642 "qca/crnv%02xu.bin", rom_ver); 643 643 } else {
+16 -2
drivers/bluetooth/btrtl.c
··· 1367 1367 MODULE_FIRMWARE("rtl_bt/rtl8723cs_vf_config.bin"); 1368 1368 MODULE_FIRMWARE("rtl_bt/rtl8723cs_xx_fw.bin"); 1369 1369 MODULE_FIRMWARE("rtl_bt/rtl8723cs_xx_config.bin"); 1370 + MODULE_FIRMWARE("rtl_bt/rtl8723d_fw.bin"); 1371 + MODULE_FIRMWARE("rtl_bt/rtl8723d_config.bin"); 1370 1372 MODULE_FIRMWARE("rtl_bt/rtl8723ds_fw.bin"); 1371 1373 MODULE_FIRMWARE("rtl_bt/rtl8723ds_config.bin"); 1372 1374 MODULE_FIRMWARE("rtl_bt/rtl8761a_fw.bin"); 1373 1375 MODULE_FIRMWARE("rtl_bt/rtl8761a_config.bin"); 1376 + MODULE_FIRMWARE("rtl_bt/rtl8761b_fw.bin"); 1377 + MODULE_FIRMWARE("rtl_bt/rtl8761b_config.bin"); 1378 + MODULE_FIRMWARE("rtl_bt/rtl8761bu_fw.bin"); 1379 + MODULE_FIRMWARE("rtl_bt/rtl8761bu_config.bin"); 1374 1380 MODULE_FIRMWARE("rtl_bt/rtl8821a_fw.bin"); 1375 1381 MODULE_FIRMWARE("rtl_bt/rtl8821a_config.bin"); 1382 + MODULE_FIRMWARE("rtl_bt/rtl8821c_fw.bin"); 1383 + MODULE_FIRMWARE("rtl_bt/rtl8821c_config.bin"); 1384 + MODULE_FIRMWARE("rtl_bt/rtl8821cs_fw.bin"); 1385 + MODULE_FIRMWARE("rtl_bt/rtl8821cs_config.bin"); 1376 1386 MODULE_FIRMWARE("rtl_bt/rtl8822b_fw.bin"); 1377 1387 MODULE_FIRMWARE("rtl_bt/rtl8822b_config.bin"); 1388 + MODULE_FIRMWARE("rtl_bt/rtl8822cs_fw.bin"); 1389 + MODULE_FIRMWARE("rtl_bt/rtl8822cs_config.bin"); 1390 + MODULE_FIRMWARE("rtl_bt/rtl8822cu_fw.bin"); 1391 + MODULE_FIRMWARE("rtl_bt/rtl8822cu_config.bin"); 1392 + MODULE_FIRMWARE("rtl_bt/rtl8851bu_fw.bin"); 1393 + MODULE_FIRMWARE("rtl_bt/rtl8851bu_config.bin"); 1378 1394 MODULE_FIRMWARE("rtl_bt/rtl8852au_fw.bin"); 1379 1395 MODULE_FIRMWARE("rtl_bt/rtl8852au_config.bin"); 1380 1396 MODULE_FIRMWARE("rtl_bt/rtl8852bs_fw.bin"); ··· 1399 1383 MODULE_FIRMWARE("rtl_bt/rtl8852bu_config.bin"); 1400 1384 MODULE_FIRMWARE("rtl_bt/rtl8852cu_fw.bin"); 1401 1385 MODULE_FIRMWARE("rtl_bt/rtl8852cu_config.bin"); 1402 - MODULE_FIRMWARE("rtl_bt/rtl8851bu_fw.bin"); 1403 - MODULE_FIRMWARE("rtl_bt/rtl8851bu_config.bin");
+5
drivers/bluetooth/btusb.c
··· 613 613 { USB_DEVICE(0x0489, 0xe0d9), .driver_info = BTUSB_MEDIATEK | 614 614 BTUSB_WIDEBAND_SPEECH | 615 615 BTUSB_VALID_LE_STATES }, 616 + { USB_DEVICE(0x0489, 0xe0f5), .driver_info = BTUSB_MEDIATEK | 617 + BTUSB_WIDEBAND_SPEECH | 618 + BTUSB_VALID_LE_STATES }, 616 619 { USB_DEVICE(0x13d3, 0x3568), .driver_info = BTUSB_MEDIATEK | 617 620 BTUSB_WIDEBAND_SPEECH | 618 621 BTUSB_VALID_LE_STATES }, ··· 657 654 { USB_DEVICE(0x2550, 0x8761), .driver_info = BTUSB_REALTEK | 658 655 BTUSB_WIDEBAND_SPEECH }, 659 656 { USB_DEVICE(0x0bda, 0x8771), .driver_info = BTUSB_REALTEK | 657 + BTUSB_WIDEBAND_SPEECH }, 658 + { USB_DEVICE(0x6655, 0x8771), .driver_info = BTUSB_REALTEK | 660 659 BTUSB_WIDEBAND_SPEECH }, 661 660 { USB_DEVICE(0x7392, 0xc611), .driver_info = BTUSB_REALTEK | 662 661 BTUSB_WIDEBAND_SPEECH },
+2 -1
drivers/bluetooth/hci_bcm.c
··· 643 643 * Allow the bootloader to set a valid address through the 644 644 * device tree. 645 645 */ 646 - set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hu->hdev->quirks); 646 + if (test_bit(HCI_QUIRK_INVALID_BDADDR, &hu->hdev->quirks)) 647 + set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hu->hdev->quirks); 647 648 648 649 if (!bcm_request_irq(bcm)) 649 650 err = bcm_setup_sleep(hu);
+12
drivers/net/dsa/ocelot/felix.c
··· 1725 1725 u32 tstamp_hi; 1726 1726 u64 tstamp; 1727 1727 1728 + switch (type & PTP_CLASS_PMASK) { 1729 + case PTP_CLASS_L2: 1730 + if (!(ocelot->ports[port]->trap_proto & OCELOT_PROTO_PTP_L2)) 1731 + return false; 1732 + break; 1733 + case PTP_CLASS_IPV4: 1734 + case PTP_CLASS_IPV6: 1735 + if (!(ocelot->ports[port]->trap_proto & OCELOT_PROTO_PTP_L4)) 1736 + return false; 1737 + break; 1738 + } 1739 + 1728 1740 /* If the "no XTR IRQ" workaround is in use, tell DSA to defer this skb 1729 1741 * for RX timestamping. Then free it, and poll for its copy through 1730 1742 * MMIO in the CPU port module, and inject that into the stack from
+1 -1
drivers/net/dsa/sja1105/sja1105.h
··· 252 252 unsigned long ucast_egress_floods; 253 253 unsigned long bcast_egress_floods; 254 254 unsigned long hwts_tx_en; 255 + unsigned long hwts_rx_en; 255 256 const struct sja1105_info *info; 256 257 size_t max_xfer_len; 257 258 struct spi_device *spidev; ··· 290 289 /* From sja1105_main.c */ 291 290 enum sja1105_reset_reason { 292 291 SJA1105_VLAN_FILTERING = 0, 293 - SJA1105_RX_HWTSTAMPING, 294 292 SJA1105_AGEING_TIME, 295 293 SJA1105_SCHEDULING, 296 294 SJA1105_BEST_EFFORT_POLICING,
+4 -10
drivers/net/dsa/sja1105/sja1105_main.c
··· 866 866 .hostprio = 7, 867 867 .mac_fltres1 = SJA1105_LINKLOCAL_FILTER_A, 868 868 .mac_flt1 = SJA1105_LINKLOCAL_FILTER_A_MASK, 869 - .incl_srcpt1 = false, 870 - .send_meta1 = false, 869 + .incl_srcpt1 = true, 870 + .send_meta1 = true, 871 871 .mac_fltres0 = SJA1105_LINKLOCAL_FILTER_B, 872 872 .mac_flt0 = SJA1105_LINKLOCAL_FILTER_B_MASK, 873 - .incl_srcpt0 = false, 874 - .send_meta0 = false, 873 + .incl_srcpt0 = true, 874 + .send_meta0 = true, 875 875 /* Default to an invalid value */ 876 876 .mirr_port = priv->ds->num_ports, 877 877 /* No TTEthernet */ ··· 2215 2215 2216 2216 static const char * const sja1105_reset_reasons[] = { 2217 2217 [SJA1105_VLAN_FILTERING] = "VLAN filtering", 2218 - [SJA1105_RX_HWTSTAMPING] = "RX timestamping", 2219 2218 [SJA1105_AGEING_TIME] = "Ageing time", 2220 2219 [SJA1105_SCHEDULING] = "Time-aware scheduling", 2221 2220 [SJA1105_BEST_EFFORT_POLICING] = "Best-effort policing", ··· 2404 2405 general_params->tpid = tpid; 2405 2406 /* EtherType used to identify outer tagged (S-tag) VLAN traffic */ 2406 2407 general_params->tpid2 = tpid2; 2407 - /* When VLAN filtering is on, we need to at least be able to 2408 - * decode management traffic through the "backup plan". 2409 - */ 2410 - general_params->incl_srcpt1 = enabled; 2411 - general_params->incl_srcpt0 = enabled; 2412 2408 2413 2409 for (port = 0; port < ds->num_ports; port++) { 2414 2410 if (dsa_is_unused_port(ds, port))
+4 -44
drivers/net/dsa/sja1105/sja1105_ptp.c
··· 58 58 #define ptp_data_to_sja1105(d) \ 59 59 container_of((d), struct sja1105_private, ptp_data) 60 60 61 - /* Must be called only while the RX timestamping state of the tagger 62 - * is turned off 63 - */ 64 - static int sja1105_change_rxtstamping(struct sja1105_private *priv, 65 - bool on) 66 - { 67 - struct sja1105_ptp_data *ptp_data = &priv->ptp_data; 68 - struct sja1105_general_params_entry *general_params; 69 - struct sja1105_table *table; 70 - 71 - table = &priv->static_config.tables[BLK_IDX_GENERAL_PARAMS]; 72 - general_params = table->entries; 73 - general_params->send_meta1 = on; 74 - general_params->send_meta0 = on; 75 - 76 - ptp_cancel_worker_sync(ptp_data->clock); 77 - skb_queue_purge(&ptp_data->skb_txtstamp_queue); 78 - skb_queue_purge(&ptp_data->skb_rxtstamp_queue); 79 - 80 - return sja1105_static_config_reload(priv, SJA1105_RX_HWTSTAMPING); 81 - } 82 - 83 61 int sja1105_hwtstamp_set(struct dsa_switch *ds, int port, struct ifreq *ifr) 84 62 { 85 - struct sja1105_tagger_data *tagger_data = sja1105_tagger_data(ds); 86 63 struct sja1105_private *priv = ds->priv; 87 64 struct hwtstamp_config config; 88 - bool rx_on; 89 - int rc; 90 65 91 66 if (copy_from_user(&config, ifr->ifr_data, sizeof(config))) 92 67 return -EFAULT; ··· 79 104 80 105 switch (config.rx_filter) { 81 106 case HWTSTAMP_FILTER_NONE: 82 - rx_on = false; 107 + priv->hwts_rx_en &= ~BIT(port); 83 108 break; 84 109 default: 85 - rx_on = true; 110 + priv->hwts_rx_en |= BIT(port); 86 111 break; 87 - } 88 - 89 - if (rx_on != tagger_data->rxtstamp_get_state(ds)) { 90 - tagger_data->rxtstamp_set_state(ds, false); 91 - 92 - rc = sja1105_change_rxtstamping(priv, rx_on); 93 - if (rc < 0) { 94 - dev_err(ds->dev, 95 - "Failed to change RX timestamping: %d\n", rc); 96 - return rc; 97 - } 98 - if (rx_on) 99 - tagger_data->rxtstamp_set_state(ds, true); 100 112 } 101 113 102 114 if (copy_to_user(ifr->ifr_data, &config, sizeof(config))) ··· 93 131 94 132 int sja1105_hwtstamp_get(struct dsa_switch *ds, int port, struct ifreq *ifr) 95 133 { 96 - struct sja1105_tagger_data *tagger_data = sja1105_tagger_data(ds); 97 134 struct sja1105_private *priv = ds->priv; 98 135 struct hwtstamp_config config; 99 136 ··· 101 140 config.tx_type = HWTSTAMP_TX_ON; 102 141 else 103 142 config.tx_type = HWTSTAMP_TX_OFF; 104 - if (tagger_data->rxtstamp_get_state(ds)) 143 + if (priv->hwts_rx_en & BIT(port)) 105 144 config.rx_filter = HWTSTAMP_FILTER_PTP_V2_L2_EVENT; 106 145 else 107 146 config.rx_filter = HWTSTAMP_FILTER_NONE; ··· 374 413 375 414 bool sja1105_rxtstamp(struct dsa_switch *ds, int port, struct sk_buff *skb) 376 415 { 377 - struct sja1105_tagger_data *tagger_data = sja1105_tagger_data(ds); 378 416 struct sja1105_private *priv = ds->priv; 379 417 struct sja1105_ptp_data *ptp_data = &priv->ptp_data; 380 418 381 - if (!tagger_data->rxtstamp_get_state(ds)) 419 + if (!(priv->hwts_rx_en & BIT(port))) 382 420 return false; 383 421 384 422 /* We need to read the full PTP clock to reconstruct the Rx
+3 -3
drivers/net/dsa/vitesse-vsc73xx-core.c
··· 1025 1025 struct vsc73xx *vsc = ds->priv; 1026 1026 1027 1027 return vsc73xx_write(vsc, VSC73XX_BLOCK_MAC, port, 1028 - VSC73XX_MAXLEN, new_mtu); 1028 + VSC73XX_MAXLEN, new_mtu + ETH_HLEN + ETH_FCS_LEN); 1029 1029 } 1030 1030 1031 1031 /* According to application not "VSC7398 Jumbo Frames" setting 1032 - * up the MTU to 9.6 KB does not affect the performance on standard 1032 + * up the frame size to 9.6 KB does not affect the performance on standard 1033 1033 * frames. It is clear from the application note that 1034 1034 * "9.6 kilobytes" == 9600 bytes. 1035 1035 */ 1036 1036 static int vsc73xx_get_max_mtu(struct dsa_switch *ds, int port) 1037 1037 { 1038 - return 9600; 1038 + return 9600 - ETH_HLEN - ETH_FCS_LEN; 1039 1039 } 1040 1040 1041 1041 static const struct dsa_switch_ops vsc73xx_ds_ops = {
+1
drivers/net/ethernet/broadcom/tg3.c
··· 225 225 MODULE_DESCRIPTION("Broadcom Tigon3 ethernet driver"); 226 226 MODULE_LICENSE("GPL"); 227 227 MODULE_FIRMWARE(FIRMWARE_TG3); 228 + MODULE_FIRMWARE(FIRMWARE_TG357766); 228 229 MODULE_FIRMWARE(FIRMWARE_TG3TSO); 229 230 MODULE_FIRMWARE(FIRMWARE_TG3TSO5); 230 231
+8 -1
drivers/net/ethernet/ibm/ibmvnic.c
··· 1816 1816 if (prev_state == VNIC_CLOSED) 1817 1817 enable_irq(adapter->tx_scrq[i]->irq); 1818 1818 enable_scrq_irq(adapter, adapter->tx_scrq[i]); 1819 - netdev_tx_reset_queue(netdev_get_tx_queue(netdev, i)); 1819 + /* netdev_tx_reset_queue will reset dql stats. During NON_FATAL 1820 + * resets, don't reset the stats because there could be batched 1821 + * skb's waiting to be sent. If we reset dql stats, we risk 1822 + * num_completed being greater than num_queued. This will cause 1823 + * a BUG_ON in dql_completed(). 1824 + */ 1825 + if (adapter->reset_reason != VNIC_RESET_NON_FATAL) 1826 + netdev_tx_reset_queue(netdev_get_tx_queue(netdev, i)); 1820 1827 } 1821 1828 1822 1829 rc = set_link_state(adapter, IBMVNIC_LOGICAL_LNK_UP);
+30 -3
drivers/net/ethernet/marvell/octeontx2/af/cgx.c
··· 169 169 { 170 170 struct cgx *cgx_dev = cgx_get_pdata(cgx_id); 171 171 172 + /* Software must not access disabled LMAC registers */ 173 + if (!is_lmac_valid(cgx_dev, lmac_id)) 174 + return; 172 175 cgx_write(cgx_dev, lmac_id, offset, val); 173 176 } 174 177 175 178 u64 cgx_lmac_read(int cgx_id, int lmac_id, u64 offset) 176 179 { 177 180 struct cgx *cgx_dev = cgx_get_pdata(cgx_id); 181 + 182 + /* Software must not access disabled LMAC registers */ 183 + if (!is_lmac_valid(cgx_dev, lmac_id)) 184 + return 0; 178 185 179 186 return cgx_read(cgx_dev, lmac_id, offset); 180 187 } ··· 537 530 int cgx_lmac_internal_loopback(void *cgxd, int lmac_id, bool enable) 538 531 { 539 532 struct cgx *cgx = cgxd; 540 - u8 lmac_type; 533 + struct lmac *lmac; 541 534 u64 cfg; 542 535 543 536 if (!is_lmac_valid(cgx, lmac_id)) 544 537 return -ENODEV; 545 538 546 - lmac_type = cgx->mac_ops->get_lmac_type(cgx, lmac_id); 547 - if (lmac_type == LMAC_MODE_SGMII || lmac_type == LMAC_MODE_QSGMII) { 539 + lmac = lmac_pdata(lmac_id, cgx); 540 + if (lmac->lmac_type == LMAC_MODE_SGMII || 541 + lmac->lmac_type == LMAC_MODE_QSGMII) { 548 542 cfg = cgx_read(cgx, lmac_id, CGXX_GMP_PCS_MRX_CTL); 549 543 if (enable) 550 544 cfg |= CGXX_GMP_PCS_MRX_CTL_LBK; ··· 1564 1556 return 0; 1565 1557 } 1566 1558 1559 + int cgx_lmac_reset(void *cgxd, int lmac_id, u8 pf_req_flr) 1560 + { 1561 + struct cgx *cgx = cgxd; 1562 + u64 cfg; 1563 + 1564 + if (!is_lmac_valid(cgx, lmac_id)) 1565 + return -ENODEV; 1566 + 1567 + /* Resetting PFC related CSRs */ 1568 + cfg = 0xff; 1569 + cgx_write(cgxd, lmac_id, CGXX_CMRX_RX_LOGL_XON, cfg); 1570 + 1571 + if (pf_req_flr) 1572 + cgx_lmac_internal_loopback(cgxd, lmac_id, false); 1573 + return 0; 1574 + } 1575 + 1567 1576 static int cgx_configure_interrupt(struct cgx *cgx, struct lmac *lmac, 1568 1577 int cnt, bool req_free) 1569 1578 { ··· 1700 1675 cgx->lmac_idmap[lmac->lmac_id] = lmac; 1701 1676 set_bit(lmac->lmac_id, &cgx->lmac_bmap); 1702 1677 cgx->mac_ops->mac_pause_frm_config(cgx, lmac->lmac_id, true); 1678 + lmac->lmac_type = cgx->mac_ops->get_lmac_type(cgx, lmac->lmac_id); 1703 1679 } 1704 1680 1705 1681 return cgx_lmac_verify_fwi_version(cgx); ··· 1797 1771 .mac_tx_enable = cgx_lmac_tx_enable, 1798 1772 .pfc_config = cgx_lmac_pfc_config, 1799 1773 .mac_get_pfc_frm_cfg = cgx_lmac_get_pfc_frm_cfg, 1774 + .mac_reset = cgx_lmac_reset, 1800 1775 }; 1801 1776 1802 1777 static int cgx_probe(struct pci_dev *pdev, const struct pci_device_id *id)
+2
drivers/net/ethernet/marvell/octeontx2/af/cgx.h
··· 35 35 #define CGXX_CMRX_INT_ENA_W1S 0x058 36 36 #define CGXX_CMRX_RX_ID_MAP 0x060 37 37 #define CGXX_CMRX_RX_STAT0 0x070 38 + #define CGXX_CMRX_RX_LOGL_XON 0x100 38 39 #define CGXX_CMRX_RX_LMACS 0x128 39 40 #define CGXX_CMRX_RX_DMAC_CTL0 (0x1F8 + mac_ops->csr_offset) 40 41 #define CGX_DMAC_CTL0_CAM_ENABLE BIT_ULL(3) ··· 182 181 u8 *rx_pause); 183 182 int verify_lmac_fc_cfg(void *cgxd, int lmac_id, u8 tx_pause, u8 rx_pause, 184 183 int pfvf_idx); 184 + int cgx_lmac_reset(void *cgxd, int lmac_id, u8 pf_req_flr); 185 185 #endif /* CGX_H */
+3
drivers/net/ethernet/marvell/octeontx2/af/lmac_common.h
··· 24 24 * @cgx: parent cgx port 25 25 * @mcast_filters_count: Number of multicast filters installed 26 26 * @lmac_id: lmac port id 27 + * @lmac_type: lmac type like SGMII/XAUI 27 28 * @cmd_pend: flag set before new command is started 28 29 * flag cleared after command response is received 29 30 * @name: lmac port name ··· 44 43 struct cgx *cgx; 45 44 u8 mcast_filters_count; 46 45 u8 lmac_id; 46 + u8 lmac_type; 47 47 bool cmd_pend; 48 48 char *name; 49 49 }; ··· 127 125 128 126 int (*mac_get_pfc_frm_cfg)(void *cgxd, int lmac_id, 129 127 u8 *tx_pause, u8 *rx_pause); 128 + int (*mac_reset)(void *cgxd, int lmac_id, u8 pf_req_flr); 130 129 131 130 /* FEC stats */ 132 131 int (*get_fec_stats)(void *cgxd, int lmac_id,
+28 -4
drivers/net/ethernet/marvell/octeontx2/af/rpm.c
··· 37 37 .mac_tx_enable = rpm_lmac_tx_enable, 38 38 .pfc_config = rpm_lmac_pfc_config, 39 39 .mac_get_pfc_frm_cfg = rpm_lmac_get_pfc_frm_cfg, 40 + .mac_reset = rpm_lmac_reset, 40 41 }; 41 42 42 43 static struct mac_ops rpm2_mac_ops = { ··· 48 47 .int_set_reg = RPM2_CMRX_SW_INT_ENA_W1S, 49 48 .irq_offset = 1, 50 49 .int_ena_bit = BIT_ULL(0), 51 - .lmac_fwi = RPM_LMAC_FWI, 50 + .lmac_fwi = RPM2_LMAC_FWI, 52 51 .non_contiguous_serdes_lane = true, 53 52 .rx_stats_cnt = 43, 54 53 .tx_stats_cnt = 34, ··· 69 68 .mac_tx_enable = rpm_lmac_tx_enable, 70 69 .pfc_config = rpm_lmac_pfc_config, 71 70 .mac_get_pfc_frm_cfg = rpm_lmac_get_pfc_frm_cfg, 71 + .mac_reset = rpm_lmac_reset, 72 72 }; 73 73 74 74 bool is_dev_rpm2(void *rpmd) ··· 539 537 int rpm_lmac_internal_loopback(void *rpmd, int lmac_id, bool enable) 540 538 { 541 539 rpm_t *rpm = rpmd; 542 - u8 lmac_type; 540 + struct lmac *lmac; 543 541 u64 cfg; 544 542 545 543 if (!is_lmac_valid(rpm, lmac_id)) 546 544 return -ENODEV; 547 - lmac_type = rpm->mac_ops->get_lmac_type(rpm, lmac_id); 548 545 549 - if (lmac_type == LMAC_MODE_QSGMII || lmac_type == LMAC_MODE_SGMII) { 546 + lmac = lmac_pdata(lmac_id, rpm); 547 + if (lmac->lmac_type == LMAC_MODE_QSGMII || 548 + lmac->lmac_type == LMAC_MODE_SGMII) { 550 549 dev_err(&rpm->pdev->dev, "loopback not supported for LPC mode\n"); 551 550 return 0; 552 551 } ··· 713 710 val_hi = rpm_read(rpm, 0, RPMX_MTI_STAT_DATA_HI_CDC); 714 711 rsp->fec_uncorr_blks = (val_hi << 32 | val_lo); 715 712 } 713 + 714 + return 0; 715 + } 716 + 717 + int rpm_lmac_reset(void *rpmd, int lmac_id, u8 pf_req_flr) 718 + { 719 + u64 rx_logl_xon, cfg; 720 + rpm_t *rpm = rpmd; 721 + 722 + if (!is_lmac_valid(rpm, lmac_id)) 723 + return -ENODEV; 724 + 725 + /* Resetting PFC related CSRs */ 726 + rx_logl_xon = is_dev_rpm2(rpm) ? RPM2_CMRX_RX_LOGL_XON : 727 + RPMX_CMRX_RX_LOGL_XON; 728 + cfg = 0xff; 729 + 730 + rpm_write(rpm, lmac_id, rx_logl_xon, cfg); 731 + 732 + if (pf_req_flr) 733 + rpm_lmac_internal_loopback(rpm, lmac_id, false); 716 734 717 735 return 0; 718 736 }
+4 -1
drivers/net/ethernet/marvell/octeontx2/af/rpm.h
··· 74 74 #define RPMX_MTI_MAC100X_CL01_PAUSE_QUANTA 0x80A8 75 75 #define RPMX_MTI_MAC100X_CL89_PAUSE_QUANTA 0x8108 76 76 #define RPM_DEFAULT_PAUSE_TIME 0x7FF 77 + #define RPMX_CMRX_RX_LOGL_XON 0x4100 77 78 78 79 #define RPMX_MTI_MAC100X_XIF_MODE 0x8100 79 80 #define RPMX_ONESTEP_ENABLE BIT_ULL(5) ··· 95 94 96 95 /* CN10KB CSR Declaration */ 97 96 #define RPM2_CMRX_SW_INT 0x1b0 98 - #define RPM2_CMRX_SW_INT_ENA_W1S 0x1b8 97 + #define RPM2_CMRX_SW_INT_ENA_W1S 0x1c8 98 + #define RPM2_LMAC_FWI 0x12 99 99 #define RPM2_CMR_CHAN_MSK_OR 0x3120 100 100 #define RPM2_CMR_RX_OVR_BP_EN BIT_ULL(2) 101 101 #define RPM2_CMR_RX_OVR_BP_BP BIT_ULL(1) ··· 133 131 int rpm2_get_nr_lmacs(void *rpmd); 134 132 bool is_dev_rpm2(void *rpmd); 135 133 int rpm_get_fec_stats(void *cgxd, int lmac_id, struct cgx_fec_stats_rsp *rsp); 134 + int rpm_lmac_reset(void *rpmd, int lmac_id, u8 pf_req_flr); 136 135 #endif /* RPM_H */
+1
drivers/net/ethernet/marvell/octeontx2/af/rvu.c
··· 2629 2629 * Since LF is detached use LF number as -1. 2630 2630 */ 2631 2631 rvu_npc_free_mcam_entries(rvu, pcifunc, -1); 2632 + rvu_mac_reset(rvu, pcifunc); 2632 2633 2633 2634 mutex_unlock(&rvu->flr_lock); 2634 2635 }
+12
drivers/net/ethernet/marvell/octeontx2/af/rvu.h
··· 23 23 #define PCI_DEVID_OCTEONTX2_LBK 0xA061 24 24 25 25 /* Subsystem Device ID */ 26 + #define PCI_SUBSYS_DEVID_98XX 0xB100 26 27 #define PCI_SUBSYS_DEVID_96XX 0xB200 27 28 #define PCI_SUBSYS_DEVID_CN10K_A 0xB900 28 29 #define PCI_SUBSYS_DEVID_CNF10K_B 0xBC00 ··· 687 686 return rvu->hw->cpt_chan_base + chan; 688 687 } 689 688 689 + static inline bool is_rvu_supports_nix1(struct rvu *rvu) 690 + { 691 + struct pci_dev *pdev = rvu->pdev; 692 + 693 + if (pdev->subsystem_device == PCI_SUBSYS_DEVID_98XX) 694 + return true; 695 + 696 + return false; 697 + } 698 + 690 699 /* Function Prototypes 691 700 * RVU 692 701 */ ··· 895 884 int rvu_cgx_prio_flow_ctrl_cfg(struct rvu *rvu, u16 pcifunc, u8 tx_pause, u8 rx_pause, 896 885 u16 pfc_en); 897 886 int rvu_cgx_cfg_pause_frm(struct rvu *rvu, u16 pcifunc, u8 tx_pause, u8 rx_pause); 887 + void rvu_mac_reset(struct rvu *rvu, u16 pcifunc); 898 888 u32 rvu_cgx_get_lmac_fifolen(struct rvu *rvu, int cgx, int lmac); 899 889 int npc_get_nixlf_mcam_index(struct npc_mcam *mcam, u16 pcifunc, int nixlf, 900 890 int type);
+20 -2
drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c
··· 114 114 p2x = cgx_lmac_get_p2x(cgx_id, lmac_id); 115 115 /* Firmware sets P2X_SELECT as either NIX0 or NIX1 */ 116 116 pfvf->nix_blkaddr = BLKADDR_NIX0; 117 - if (p2x == CMR_P2X_SEL_NIX1) 117 + if (is_rvu_supports_nix1(rvu) && p2x == CMR_P2X_SEL_NIX1) 118 118 pfvf->nix_blkaddr = BLKADDR_NIX1; 119 119 } 120 120 ··· 763 763 cgxd = rvu_cgx_pdata(cgx_id, rvu); 764 764 765 765 mac_ops = get_mac_ops(cgxd); 766 - mac_ops->mac_enadis_ptp_config(cgxd, lmac_id, true); 766 + mac_ops->mac_enadis_ptp_config(cgxd, lmac_id, enable); 767 767 /* If PTP is enabled then inform NPC that packets to be 768 768 * parsed by this PF will have their data shifted by 8 bytes 769 769 * and if PTP is disabled then no shift is required ··· 1249 1249 1250 1250 mac_ops->mac_get_pfc_frm_cfg(cgxd, lmac_id, &rsp->tx_pause, &rsp->rx_pause); 1251 1251 return err; 1252 + } 1253 + 1254 + void rvu_mac_reset(struct rvu *rvu, u16 pcifunc) 1255 + { 1256 + int pf = rvu_get_pf(pcifunc); 1257 + struct mac_ops *mac_ops; 1258 + struct cgx *cgxd; 1259 + u8 cgx, lmac; 1260 + 1261 + if (!is_pf_cgxmapped(rvu, pf)) 1262 + return; 1263 + 1264 + rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx, &lmac); 1265 + cgxd = rvu_cgx_pdata(cgx, rvu); 1266 + mac_ops = get_mac_ops(cgxd); 1267 + 1268 + if (mac_ops->mac_reset(cgxd, lmac, !is_vf(pcifunc))) 1269 + dev_err(rvu->dev, "Failed to reset MAC\n"); 1252 1270 }
+1
drivers/net/ethernet/mellanox/mlxsw/minimal.c
··· 417 417 err_kmalloc_array: 418 418 for (i--; i >= 0; i--) 419 419 kfree(mlxsw_m->line_cards[i]); 420 + kfree(mlxsw_m->line_cards); 420 421 err_kcalloc: 421 422 kfree(mlxsw_m->ports); 422 423 return err;
+2 -2
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
··· 10794 10794 int err; 10795 10795 10796 10796 router->lb_crif = mlxsw_sp_crif_alloc(NULL); 10797 - if (IS_ERR(router->lb_crif)) 10798 - return PTR_ERR(router->lb_crif); 10797 + if (!router->lb_crif) 10798 + return -ENOMEM; 10799 10799 10800 10800 /* Create a generic loopback RIF associated with the main table 10801 10801 * (default VRF). Any table can be used, but the main table exists
+17 -4
drivers/net/ethernet/microchip/lan743x_main.c
··· 144 144 !(data & HW_CFG_LRST_), 100000, 10000000); 145 145 } 146 146 147 + static int lan743x_csr_wait_for_bit_atomic(struct lan743x_adapter *adapter, 148 + int offset, u32 bit_mask, 149 + int target_value, int udelay_min, 150 + int udelay_max, int count) 151 + { 152 + u32 data; 153 + 154 + return readx_poll_timeout_atomic(LAN743X_CSR_READ_OP, offset, data, 155 + target_value == !!(data & bit_mask), 156 + udelay_max, udelay_min * count); 157 + } 158 + 147 159 static int lan743x_csr_wait_for_bit(struct lan743x_adapter *adapter, 148 160 int offset, u32 bit_mask, 149 161 int target_value, int usleep_min, ··· 748 736 u32 dp_sel; 749 737 int i; 750 738 751 - if (lan743x_csr_wait_for_bit(adapter, DP_SEL, DP_SEL_DPRDY_, 752 - 1, 40, 100, 100)) 739 + if (lan743x_csr_wait_for_bit_atomic(adapter, DP_SEL, DP_SEL_DPRDY_, 740 + 1, 40, 100, 100)) 753 741 return -EIO; 754 742 dp_sel = lan743x_csr_read(adapter, DP_SEL); 755 743 dp_sel &= ~DP_SEL_MASK_; ··· 760 748 lan743x_csr_write(adapter, DP_ADDR, addr + i); 761 749 lan743x_csr_write(adapter, DP_DATA_0, buf[i]); 762 750 lan743x_csr_write(adapter, DP_CMD, DP_CMD_WRITE_); 763 - if (lan743x_csr_wait_for_bit(adapter, DP_SEL, DP_SEL_DPRDY_, 764 - 1, 40, 100, 100)) 751 + if (lan743x_csr_wait_for_bit_atomic(adapter, DP_SEL, 752 + DP_SEL_DPRDY_, 753 + 1, 40, 100, 100)) 765 754 return -EIO; 766 755 } 767 756
-1
drivers/net/ethernet/mscc/ocelot.c
··· 2925 2925 } 2926 2926 } 2927 2927 2928 - mutex_init(&ocelot->ptp_lock); 2929 2928 mutex_init(&ocelot->mact_lock); 2930 2929 mutex_init(&ocelot->fwd_domain_lock); 2931 2930 mutex_init(&ocelot->tas_lock);
+41 -25
drivers/net/ethernet/mscc/ocelot_ptp.c
··· 439 439 static int ocelot_setup_ptp_traps(struct ocelot *ocelot, int port, 440 440 bool l2, bool l4) 441 441 { 442 + struct ocelot_port *ocelot_port = ocelot->ports[port]; 442 443 int err; 444 + 445 + ocelot_port->trap_proto &= ~(OCELOT_PROTO_PTP_L2 | 446 + OCELOT_PROTO_PTP_L4); 443 447 444 448 if (l2) 445 449 err = ocelot_l2_ptp_trap_add(ocelot, port); ··· 468 464 if (err) 469 465 return err; 470 466 467 + if (l2) 468 + ocelot_port->trap_proto |= OCELOT_PROTO_PTP_L2; 469 + if (l4) 470 + ocelot_port->trap_proto |= OCELOT_PROTO_PTP_L4; 471 + 471 472 return 0; 472 473 473 474 err_ipv6: ··· 483 474 return err; 484 475 } 485 476 477 + static int ocelot_traps_to_ptp_rx_filter(unsigned int proto) 478 + { 479 + if ((proto & OCELOT_PROTO_PTP_L2) && (proto & OCELOT_PROTO_PTP_L4)) 480 + return HWTSTAMP_FILTER_PTP_V2_EVENT; 481 + else if (proto & OCELOT_PROTO_PTP_L2) 482 + return HWTSTAMP_FILTER_PTP_V2_L2_EVENT; 483 + else if (proto & OCELOT_PROTO_PTP_L4) 484 + return HWTSTAMP_FILTER_PTP_V2_L4_EVENT; 485 + 486 + return HWTSTAMP_FILTER_NONE; 487 + } 488 + 486 489 int ocelot_hwstamp_get(struct ocelot *ocelot, int port, struct ifreq *ifr) 487 490 { 488 - return copy_to_user(ifr->ifr_data, &ocelot->hwtstamp_config, 489 - sizeof(ocelot->hwtstamp_config)) ? -EFAULT : 0; 491 + struct ocelot_port *ocelot_port = ocelot->ports[port]; 492 + struct hwtstamp_config cfg = {}; 493 + 494 + switch (ocelot_port->ptp_cmd) { 495 + case IFH_REW_OP_TWO_STEP_PTP: 496 + cfg.tx_type = HWTSTAMP_TX_ON; 497 + break; 498 + case IFH_REW_OP_ORIGIN_PTP: 499 + cfg.tx_type = HWTSTAMP_TX_ONESTEP_SYNC; 500 + break; 501 + default: 502 + cfg.tx_type = HWTSTAMP_TX_OFF; 503 + break; 504 + } 505 + 506 + cfg.rx_filter = ocelot_traps_to_ptp_rx_filter(ocelot_port->trap_proto); 507 + 508 + return copy_to_user(ifr->ifr_data, &cfg, sizeof(cfg)) ? -EFAULT : 0; 490 509 } 491 510 EXPORT_SYMBOL(ocelot_hwstamp_get); 492 511 ··· 546 509 return -ERANGE; 547 510 } 548 511 549 - mutex_lock(&ocelot->ptp_lock); 550 - 551 512 switch (cfg.rx_filter) { 552 513 case HWTSTAMP_FILTER_NONE: 553 514 break; ··· 566 531 l4 = true; 567 532 break; 568 533 default: 569 - mutex_unlock(&ocelot->ptp_lock); 570 534 return -ERANGE; 571 535 } 572 536 573 537 err = ocelot_setup_ptp_traps(ocelot, port, l2, l4); 574 - if (err) { 575 - mutex_unlock(&ocelot->ptp_lock); 538 + if (err) 576 539 return err; 577 - } 578 540 579 - if (l2 && l4) 580 - cfg.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT; 581 - else if (l2) 582 - cfg.rx_filter = HWTSTAMP_FILTER_PTP_V2_L2_EVENT; 583 - else if (l4) 584 - cfg.rx_filter = HWTSTAMP_FILTER_PTP_V2_L4_EVENT; 585 - else 586 - cfg.rx_filter = HWTSTAMP_FILTER_NONE; 587 - 588 - /* Commit back the result & save it */ 589 - memcpy(&ocelot->hwtstamp_config, &cfg, sizeof(cfg)); 590 - mutex_unlock(&ocelot->ptp_lock); 541 + cfg.rx_filter = ocelot_traps_to_ptp_rx_filter(ocelot_port->trap_proto); 591 542 592 543 return copy_to_user(ifr->ifr_data, &cfg, sizeof(cfg)) ? -EFAULT : 0; 593 544 } ··· 844 823 ocelot_write(ocelot, 0xffffffff, ANA_TABLES_PTP_ID_HIGH); 845 824 846 825 ocelot_write(ocelot, PTP_CFG_MISC_PTP_EN, PTP_CFG_MISC); 847 - 848 - /* There is no device reconfiguration, PTP Rx stamping is always 849 - * enabled. 850 - */ 851 - ocelot->hwtstamp_config.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT; 852 826 853 827 return 0; 854 828 }
+5
drivers/net/ethernet/netronome/nfp/nfp_net_common.c
··· 53 53 #include "crypto/crypto.h" 54 54 #include "crypto/fw.h" 55 55 56 + static int nfp_net_mc_unsync(struct net_device *netdev, const unsigned char *addr); 57 + 56 58 /** 57 59 * nfp_net_get_fw_version() - Read and parse the FW version 58 60 * @fw_ver: Output fw_version structure to read to ··· 1086 1084 1087 1085 /* Step 2: Tell NFP 1088 1086 */ 1087 + if (nn->cap_w1 & NFP_NET_CFG_CTRL_MCAST_FILTER) 1088 + __dev_mc_unsync(netdev, nfp_net_mc_unsync); 1089 + 1089 1090 nfp_net_clear_config_and_disable(nn); 1090 1091 nfp_port_configure(netdev, false); 1091 1092
+3
drivers/net/ethernet/sfc/efx_devlink.c
··· 626 626 u32 id; 627 627 int rc; 628 628 629 + if (!efx->mae) 630 + return NULL; 631 + 629 632 if (efx_mae_lookup_mport(efx, idx, &id)) { 630 633 /* This should not happen. */ 631 634 if (idx == MAE_MPORT_DESC_VF_IDX_NULL)
+20 -11
drivers/net/ppp/pptp.c
··· 24 24 #include <linux/in.h> 25 25 #include <linux/ip.h> 26 26 #include <linux/rcupdate.h> 27 + #include <linux/security.h> 27 28 #include <linux/spinlock.h> 28 29 29 30 #include <net/sock.h> ··· 129 128 spin_unlock(&chan_lock); 130 129 } 131 130 131 + static struct rtable *pptp_route_output(struct pppox_sock *po, 132 + struct flowi4 *fl4) 133 + { 134 + struct sock *sk = &po->sk; 135 + struct net *net; 136 + 137 + net = sock_net(sk); 138 + flowi4_init_output(fl4, sk->sk_bound_dev_if, sk->sk_mark, 0, 139 + RT_SCOPE_UNIVERSE, IPPROTO_GRE, 0, 140 + po->proto.pptp.dst_addr.sin_addr.s_addr, 141 + po->proto.pptp.src_addr.sin_addr.s_addr, 142 + 0, 0, sock_net_uid(net, sk)); 143 + security_sk_classify_flow(sk, flowi4_to_flowi_common(fl4)); 144 + 145 + return ip_route_output_flow(net, fl4, sk); 146 + } 147 + 132 148 static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb) 133 149 { 134 150 struct sock *sk = (struct sock *) chan->private; ··· 169 151 if (sk_pppox(po)->sk_state & PPPOX_DEAD) 170 152 goto tx_error; 171 153 172 - rt = ip_route_output_ports(net, &fl4, NULL, 173 - opt->dst_addr.sin_addr.s_addr, 174 - opt->src_addr.sin_addr.s_addr, 175 - 0, 0, IPPROTO_GRE, 176 - RT_TOS(0), sk->sk_bound_dev_if); 154 + rt = pptp_route_output(po, &fl4); 177 155 if (IS_ERR(rt)) 178 156 goto tx_error; 179 157 ··· 452 438 po->chan.private = sk; 453 439 po->chan.ops = &pptp_chan_ops; 454 440 455 - rt = ip_route_output_ports(sock_net(sk), &fl4, sk, 456 - opt->dst_addr.sin_addr.s_addr, 457 - opt->src_addr.sin_addr.s_addr, 458 - 0, 0, 459 - IPPROTO_GRE, RT_CONN_FLAGS(sk), 460 - sk->sk_bound_dev_if); 441 + rt = pptp_route_output(po, &fl4); 461 442 if (IS_ERR(rt)) { 462 443 error = -EHOSTUNREACH; 463 444 goto end;
+6
drivers/net/usb/cdc_ether.c
··· 876 876 USB_CDC_PROTO_NONE), 877 877 .driver_info = (unsigned long)&wwan_info, 878 878 }, { 879 + /* U-blox LARA-R6 01B */ 880 + USB_DEVICE_AND_INTERFACE_INFO(UBLOX_VENDOR_ID, 0x1313, USB_CLASS_COMM, 881 + USB_CDC_SUBCLASS_ETHERNET, 882 + USB_CDC_PROTO_NONE), 883 + .driver_info = (unsigned long)&wwan_info, 884 + }, { 879 885 /* U-blox LARA-L6 */ 880 886 USB_DEVICE_AND_INTERFACE_INFO(UBLOX_VENDOR_ID, 0x1343, USB_CLASS_COMM, 881 887 USB_CDC_SUBCLASS_ETHERNET,
+9 -5
drivers/net/wireguard/netlink.c
··· 546 546 u8 *private_key = nla_data(info->attrs[WGDEVICE_A_PRIVATE_KEY]); 547 547 u8 public_key[NOISE_PUBLIC_KEY_LEN]; 548 548 struct wg_peer *peer, *temp; 549 + bool send_staged_packets; 549 550 550 551 if (!crypto_memneq(wg->static_identity.static_private, 551 552 private_key, NOISE_PUBLIC_KEY_LEN)) ··· 565 564 } 566 565 567 566 down_write(&wg->static_identity.lock); 568 - wg_noise_set_static_identity_private_key(&wg->static_identity, 569 - private_key); 570 - list_for_each_entry_safe(peer, temp, &wg->peer_list, 571 - peer_list) { 567 + send_staged_packets = !wg->static_identity.has_identity && netif_running(wg->dev); 568 + wg_noise_set_static_identity_private_key(&wg->static_identity, private_key); 569 + send_staged_packets = send_staged_packets && wg->static_identity.has_identity; 570 + 571 + wg_cookie_checker_precompute_device_keys(&wg->cookie_checker); 572 + list_for_each_entry_safe(peer, temp, &wg->peer_list, peer_list) { 572 573 wg_noise_precompute_static_static(peer); 573 574 wg_noise_expire_current_peer_keypairs(peer); 575 + if (send_staged_packets) 576 + wg_packet_send_staged_packets(peer); 574 577 } 575 - wg_cookie_checker_precompute_device_keys(&wg->cookie_checker); 576 578 up_write(&wg->static_identity.lock); 577 579 } 578 580 skip_set_private_key:
+1
drivers/net/wireguard/queueing.c
··· 28 28 int ret; 29 29 30 30 memset(queue, 0, sizeof(*queue)); 31 + queue->last_cpu = -1; 31 32 ret = ptr_ring_init(&queue->ring, len, GFP_KERNEL); 32 33 if (ret) 33 34 return ret;
+11 -14
drivers/net/wireguard/queueing.h
··· 117 117 return cpu; 118 118 } 119 119 120 - /* This function is racy, in the sense that next is unlocked, so it could return 121 - * the same CPU twice. A race-free version of this would be to instead store an 122 - * atomic sequence number, do an increment-and-return, and then iterate through 123 - * every possible CPU until we get to that index -- choose_cpu. However that's 124 - * a bit slower, and it doesn't seem like this potential race actually 125 - * introduces any performance loss, so we live with it. 120 + /* This function is racy, in the sense that it's called while last_cpu is 121 + * unlocked, so it could return the same CPU twice. Adding locking or using 122 + * atomic sequence numbers is slower though, and the consequences of racing are 123 + * harmless, so live with it. 126 124 */ 127 - static inline int wg_cpumask_next_online(int *next) 125 + static inline int wg_cpumask_next_online(int *last_cpu) 128 126 { 129 - int cpu = *next; 130 - 131 - while (unlikely(!cpumask_test_cpu(cpu, cpu_online_mask))) 132 - cpu = cpumask_next(cpu, cpu_online_mask) % nr_cpumask_bits; 133 - *next = cpumask_next(cpu, cpu_online_mask) % nr_cpumask_bits; 127 + int cpu = cpumask_next(*last_cpu, cpu_online_mask); 128 + if (cpu >= nr_cpu_ids) 129 + cpu = cpumask_first(cpu_online_mask); 130 + *last_cpu = cpu; 134 131 return cpu; 135 132 } 136 133 ··· 156 159 157 160 static inline int wg_queue_enqueue_per_device_and_peer( 158 161 struct crypt_queue *device_queue, struct prev_queue *peer_queue, 159 - struct sk_buff *skb, struct workqueue_struct *wq, int *next_cpu) 162 + struct sk_buff *skb, struct workqueue_struct *wq) 160 163 { 161 164 int cpu; 162 165 ··· 170 173 /* Then we queue it up in the device queue, which consumes the 171 174 * packet as soon as it can. 172 175 */ 173 - cpu = wg_cpumask_next_online(next_cpu); 176 + cpu = wg_cpumask_next_online(&device_queue->last_cpu); 174 177 if (unlikely(ptr_ring_produce_bh(&device_queue->ring, skb))) 175 178 return -EPIPE; 176 179 queue_work_on(cpu, wq, &per_cpu_ptr(device_queue->worker, cpu)->work);
+1 -1
drivers/net/wireguard/receive.c
··· 524 524 goto err; 525 525 526 526 ret = wg_queue_enqueue_per_device_and_peer(&wg->decrypt_queue, &peer->rx_queue, skb, 527 - wg->packet_crypt_wq, &wg->decrypt_queue.last_cpu); 527 + wg->packet_crypt_wq); 528 528 if (unlikely(ret == -EPIPE)) 529 529 wg_queue_enqueue_per_peer_rx(skb, PACKET_STATE_DEAD); 530 530 if (likely(!ret || ret == -EPIPE)) {
+1 -1
drivers/net/wireguard/send.c
··· 318 318 goto err; 319 319 320 320 ret = wg_queue_enqueue_per_device_and_peer(&wg->encrypt_queue, &peer->tx_queue, first, 321 - wg->packet_crypt_wq, &wg->encrypt_queue.last_cpu); 321 + wg->packet_crypt_wq); 322 322 if (unlikely(ret == -EPIPE)) 323 323 wg_queue_enqueue_per_peer_tx(first, PACKET_STATE_DEAD); 324 324 err:
+5 -5
drivers/net/wireguard/timers.c
··· 234 234 235 235 void wg_timers_stop(struct wg_peer *peer) 236 236 { 237 - del_timer_sync(&peer->timer_retransmit_handshake); 238 - del_timer_sync(&peer->timer_send_keepalive); 239 - del_timer_sync(&peer->timer_new_handshake); 240 - del_timer_sync(&peer->timer_zero_key_material); 241 - del_timer_sync(&peer->timer_persistent_keepalive); 237 + timer_delete_sync(&peer->timer_retransmit_handshake); 238 + timer_delete_sync(&peer->timer_send_keepalive); 239 + timer_delete_sync(&peer->timer_new_handshake); 240 + timer_delete_sync(&peer->timer_zero_key_material); 241 + timer_delete_sync(&peer->timer_persistent_keepalive); 242 242 flush_work(&peer->clear_peer_work); 243 243 }
+1 -1
drivers/nvme/host/tcp.c
··· 1014 1014 msg.msg_flags |= MSG_MORE; 1015 1015 1016 1016 if (!sendpage_ok(page)) 1017 - msg.msg_flags &= ~MSG_SPLICE_PAGES, 1017 + msg.msg_flags &= ~MSG_SPLICE_PAGES; 1018 1018 1019 1019 bvec_set_page(&bvec, page, len, offset); 1020 1020 iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, &bvec, 1, len);
+3
drivers/ptp/ptp_sysfs.c
··· 358 358 attr == &dev_attr_max_vclocks.attr) { 359 359 if (ptp->is_virtual_clock) 360 360 mode = 0; 361 + } else if (attr == &dev_attr_max_phase_adjustment.attr) { 362 + if (!info->adjphase || !info->getmaxphase) 363 + mode = 0; 361 364 } 362 365 363 366 return mode;
+1 -1
drivers/s390/net/qeth_l3_sys.c
··· 625 625 static ssize_t qeth_l3_dev_vipa_del4_store(struct device *dev, 626 626 struct device_attribute *attr, const char *buf, size_t count) 627 627 { 628 - return qeth_l3_vipa_store(dev, buf, true, count, QETH_PROT_IPV4); 628 + return qeth_l3_vipa_store(dev, buf, false, count, QETH_PROT_IPV4); 629 629 } 630 630 631 631 static QETH_DEVICE_ATTR(vipa_del4, del4, 0200, NULL,
-4
include/linux/dsa/sja1105.h
··· 48 48 49 49 /* Global tagger data */ 50 50 struct sja1105_tagger_data { 51 - /* Tagger to switch */ 52 51 void (*xmit_work_fn)(struct kthread_work *work); 53 52 void (*meta_tstamp_handler)(struct dsa_switch *ds, int port, u8 ts_id, 54 53 enum sja1110_meta_tstamp dir, u64 tstamp); 55 - /* Switch to tagger */ 56 - bool (*rxtstamp_get_state)(struct dsa_switch *ds); 57 - void (*rxtstamp_set_state)(struct dsa_switch *ds, bool on); 58 54 }; 59 55 60 56 struct sja1105_skb_cb {
+1 -1
include/net/bluetooth/bluetooth.h
··· 185 185 struct bt_iso_bcast_qos { 186 186 __u8 big; 187 187 __u8 bis; 188 - __u8 sync_interval; 188 + __u8 sync_factor; 189 189 __u8 packing; 190 190 __u8 framing; 191 191 struct bt_iso_io_qos in;
+1
include/net/bluetooth/mgmt.h
··· 979 979 #define MGMT_DEV_FOUND_NOT_CONNECTABLE BIT(2) 980 980 #define MGMT_DEV_FOUND_INITIATED_CONN BIT(3) 981 981 #define MGMT_DEV_FOUND_NAME_REQUEST_FAILED BIT(4) 982 + #define MGMT_DEV_FOUND_SCAN_RSP BIT(5) 982 983 983 984 #define MGMT_EV_DEVICE_FOUND 0x0012 984 985 struct mgmt_ev_device_found {
+7 -3
include/soc/mscc/ocelot.h
··· 730 730 ENTRYTYPE_MACv6, 731 731 }; 732 732 733 + enum ocelot_proto { 734 + OCELOT_PROTO_PTP_L2 = BIT(0), 735 + OCELOT_PROTO_PTP_L4 = BIT(1), 736 + }; 737 + 733 738 #define OCELOT_QUIRK_PCS_PERFORMS_RATE_ADAPTATION BIT(0) 734 739 #define OCELOT_QUIRK_QSGMII_PORTS_MUST_BE_UP BIT(1) 735 740 ··· 779 774 780 775 unsigned int ptp_skbs_in_flight; 781 776 struct sk_buff_head tx_skbs; 777 + 778 + unsigned int trap_proto; 782 779 783 780 u16 mrp_ring_id; 784 781 ··· 875 868 u8 mm_supported:1; 876 869 struct ptp_clock *ptp_clock; 877 870 struct ptp_clock_info ptp_info; 878 - struct hwtstamp_config hwtstamp_config; 879 871 unsigned int ptp_skbs_in_flight; 880 872 /* Protects the 2-step TX timestamp ID logic */ 881 873 spinlock_t ts_id_lock; 882 - /* Protects the PTP interface state */ 883 - struct mutex ptp_lock; 884 874 /* Protects the PTP clock */ 885 875 spinlock_t ptp_clock_lock; 886 876 struct ptp_pin_desc ptp_pins[OCELOT_PTP_PINS_NUM];
+1 -1
include/trace/events/fib.h
··· 65 65 } 66 66 67 67 dev = nhc ? nhc->nhc_dev : NULL; 68 - strlcpy(__entry->name, dev ? dev->name : "-", IFNAMSIZ); 68 + strscpy(__entry->name, dev ? dev->name : "-", IFNAMSIZ); 69 69 70 70 if (nhc) { 71 71 if (nhc->nhc_gw_family == AF_INET) {
+1 -1
include/trace/events/fib6.h
··· 63 63 } 64 64 65 65 if (res->nh && res->nh->fib_nh_dev) { 66 - strlcpy(__entry->name, res->nh->fib_nh_dev->name, IFNAMSIZ); 66 + strscpy(__entry->name, res->nh->fib_nh_dev->name, IFNAMSIZ); 67 67 } else { 68 68 strcpy(__entry->name, "-"); 69 69 }
+2 -1
include/trace/events/net.h
··· 51 51 __entry->network_offset = skb_network_offset(skb); 52 52 __entry->transport_offset_valid = 53 53 skb_transport_header_was_set(skb); 54 - __entry->transport_offset = skb_transport_offset(skb); 54 + __entry->transport_offset = skb_transport_header_was_set(skb) ? 55 + skb_transport_offset(skb) : 0; 55 56 __entry->tx_flags = skb_shinfo(skb)->tx_flags; 56 57 __entry->gso_size = skb_shinfo(skb)->gso_size; 57 58 __entry->gso_segs = skb_shinfo(skb)->gso_segs;
+2 -4
kernel/bpf/btf.c
··· 7891 7891 pr_err("missing vmlinux BTF, cannot register kfuncs\n"); 7892 7892 return -ENOENT; 7893 7893 } 7894 - if (kset->owner && IS_ENABLED(CONFIG_DEBUG_INFO_BTF_MODULES)) { 7895 - pr_err("missing module BTF, cannot register kfuncs\n"); 7896 - return -ENOENT; 7897 - } 7894 + if (kset->owner && IS_ENABLED(CONFIG_DEBUG_INFO_BTF_MODULES)) 7895 + pr_warn("missing module BTF, cannot register kfuncs\n"); 7898 7896 return 0; 7899 7897 } 7900 7898 if (IS_ERR(btf))
+39 -10
net/bluetooth/hci_conn.c
··· 775 775 hci_abort_conn(conn, HCI_ERROR_REMOTE_USER_TERM); 776 776 } 777 777 778 + struct iso_cig_params { 779 + struct hci_cp_le_set_cig_params cp; 780 + struct hci_cis_params cis[0x1f]; 781 + }; 782 + 778 783 struct iso_list_data { 779 784 union { 780 785 u8 cig; ··· 791 786 u16 sync_handle; 792 787 }; 793 788 int count; 794 - struct { 795 - struct hci_cp_le_set_cig_params cp; 796 - struct hci_cis_params cis[0x11]; 797 - } pdu; 789 + struct iso_cig_params pdu; 798 790 }; 799 791 800 792 static void bis_list(struct hci_conn *conn, void *data) ··· 1766 1764 return hci_send_cmd(hdev, HCI_OP_LE_CREATE_BIG, sizeof(cp), &cp); 1767 1765 } 1768 1766 1767 + static void set_cig_params_complete(struct hci_dev *hdev, void *data, int err) 1768 + { 1769 + struct iso_cig_params *pdu = data; 1770 + 1771 + bt_dev_dbg(hdev, ""); 1772 + 1773 + if (err) 1774 + bt_dev_err(hdev, "Unable to set CIG parameters: %d", err); 1775 + 1776 + kfree(pdu); 1777 + } 1778 + 1779 + static int set_cig_params_sync(struct hci_dev *hdev, void *data) 1780 + { 1781 + struct iso_cig_params *pdu = data; 1782 + u32 plen; 1783 + 1784 + plen = sizeof(pdu->cp) + pdu->cp.num_cis * sizeof(pdu->cis[0]); 1785 + return __hci_cmd_sync_status(hdev, HCI_OP_LE_SET_CIG_PARAMS, plen, pdu, 1786 + HCI_CMD_TIMEOUT); 1787 + } 1788 + 1769 1789 static bool hci_le_set_cig_params(struct hci_conn *conn, struct bt_iso_qos *qos) 1770 1790 { 1771 1791 struct hci_dev *hdev = conn->hdev; 1772 1792 struct iso_list_data data; 1793 + struct iso_cig_params *pdu; 1773 1794 1774 1795 memset(&data, 0, sizeof(data)); 1775 1796 ··· 1862 1837 if (qos->ucast.cis == BT_ISO_QOS_CIS_UNSET || !data.pdu.cp.num_cis) 1863 1838 return false; 1864 1839 1865 - if (hci_send_cmd(hdev, HCI_OP_LE_SET_CIG_PARAMS, 1866 - sizeof(data.pdu.cp) + 1867 - (data.pdu.cp.num_cis * sizeof(*data.pdu.cis)), 1868 - &data.pdu) < 0) 1840 + pdu = kmemdup(&data.pdu, sizeof(*pdu), GFP_KERNEL); 1841 + if (!pdu) 1869 1842 return false; 1843 + 1844 + if (hci_cmd_sync_queue(hdev, set_cig_params_sync, pdu, 1845 + set_cig_params_complete) < 0) { 1846 + kfree(pdu); 1847 + return false; 1848 + } 1870 1849 1871 1850 return true; 1872 1851 } ··· 2073 2044 flags |= MGMT_ADV_FLAG_SEC_2M; 2074 2045 2075 2046 /* Align intervals */ 2076 - interval = qos->bcast.out.interval / 1250; 2047 + interval = (qos->bcast.out.interval / 1250) * qos->bcast.sync_factor; 2077 2048 2078 2049 if (qos->bcast.bis) 2079 - sync_interval = qos->bcast.sync_interval * 1600; 2050 + sync_interval = interval * 4; 2080 2051 2081 2052 err = hci_start_per_adv_sync(hdev, qos->bcast.bis, conn->le_per_adv_data_len, 2082 2053 conn->le_per_adv_data, flags, interval,
+39 -24
net/bluetooth/hci_event.c
··· 3812 3812 bt_dev_dbg(hdev, "status 0x%2.2x", rp->status); 3813 3813 3814 3814 cp = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_CIG_PARAMS); 3815 - if (!cp || rp->num_handles != cp->num_cis || rp->cig_id != cp->cig_id) { 3815 + if (!rp->status && (!cp || rp->num_handles != cp->num_cis || 3816 + rp->cig_id != cp->cig_id)) { 3816 3817 bt_dev_err(hdev, "unexpected Set CIG Parameters response data"); 3817 3818 status = HCI_ERROR_UNSPECIFIED; 3818 3819 } ··· 6317 6316 return; 6318 6317 } 6319 6318 6320 - /* When receiving non-connectable or scannable undirected 6321 - * advertising reports, this means that the remote device is 6322 - * not connectable and then clearly indicate this in the 6323 - * device found event. 6324 - * 6325 - * When receiving a scan response, then there is no way to 6319 + /* When receiving a scan response, then there is no way to 6326 6320 * know if the remote device is connectable or not. However 6327 6321 * since scan responses are merged with a previously seen 6328 6322 * advertising report, the flags field from that report 6329 6323 * will be used. 6330 6324 * 6331 - * In the really unlikely case that a controller get confused 6332 - * and just sends a scan response event, then it is marked as 6333 - * not connectable as well. 6325 + * In the unlikely case that a controller just sends a scan 6326 + * response event that doesn't match the pending report, then 6327 + * it is marked as a standalone SCAN_RSP. 6334 6328 */ 6335 6329 if (type == LE_ADV_SCAN_RSP) 6336 - flags = MGMT_DEV_FOUND_NOT_CONNECTABLE; 6330 + flags = MGMT_DEV_FOUND_SCAN_RSP; 6337 6331 6338 6332 /* If there's nothing pending either store the data from this 6339 6333 * event or send an immediate device found event if the data ··· 6786 6790 { 6787 6791 struct hci_evt_le_cis_established *ev = data; 6788 6792 struct hci_conn *conn; 6793 + struct bt_iso_qos *qos; 6789 6794 u16 handle = __le16_to_cpu(ev->handle); 6790 6795 6791 6796 bt_dev_dbg(hdev, "status 0x%2.2x", ev->status); ··· 6808 6811 goto unlock; 6809 6812 } 6810 6813 6811 - if (conn->role == HCI_ROLE_SLAVE) { 6812 - __le32 interval; 6814 + qos = &conn->iso_qos; 6813 6815 6814 - memset(&interval, 0, sizeof(interval)); 6816 + /* Convert ISO Interval (1.25 ms slots) to SDU Interval (us) */ 6817 + qos->ucast.in.interval = le16_to_cpu(ev->interval) * 1250; 6818 + qos->ucast.out.interval = qos->ucast.in.interval; 6815 6819 6816 - memcpy(&interval, ev->c_latency, sizeof(ev->c_latency)); 6817 - conn->iso_qos.ucast.in.interval = le32_to_cpu(interval); 6818 - memcpy(&interval, ev->p_latency, sizeof(ev->p_latency)); 6819 - conn->iso_qos.ucast.out.interval = le32_to_cpu(interval); 6820 - conn->iso_qos.ucast.in.latency = le16_to_cpu(ev->interval); 6821 - conn->iso_qos.ucast.out.latency = le16_to_cpu(ev->interval); 6822 - conn->iso_qos.ucast.in.sdu = le16_to_cpu(ev->c_mtu); 6823 - conn->iso_qos.ucast.out.sdu = le16_to_cpu(ev->p_mtu); 6824 - conn->iso_qos.ucast.in.phy = ev->c_phy; 6825 - conn->iso_qos.ucast.out.phy = ev->p_phy; 6820 + switch (conn->role) { 6821 + case HCI_ROLE_SLAVE: 6822 + /* Convert Transport Latency (us) to Latency (msec) */ 6823 + qos->ucast.in.latency = 6824 + DIV_ROUND_CLOSEST(get_unaligned_le24(ev->c_latency), 6825 + 1000); 6826 + qos->ucast.out.latency = 6827 + DIV_ROUND_CLOSEST(get_unaligned_le24(ev->p_latency), 6828 + 1000); 6829 + qos->ucast.in.sdu = le16_to_cpu(ev->c_mtu); 6830 + qos->ucast.out.sdu = le16_to_cpu(ev->p_mtu); 6831 + qos->ucast.in.phy = ev->c_phy; 6832 + qos->ucast.out.phy = ev->p_phy; 6833 + break; 6834 + case HCI_ROLE_MASTER: 6835 + /* Convert Transport Latency (us) to Latency (msec) */ 6836 + qos->ucast.out.latency = 6837 + DIV_ROUND_CLOSEST(get_unaligned_le24(ev->c_latency), 6838 + 1000); 6839 + qos->ucast.in.latency = 6840 + DIV_ROUND_CLOSEST(get_unaligned_le24(ev->p_latency), 6841 + 1000); 6842 + qos->ucast.out.sdu = le16_to_cpu(ev->c_mtu); 6843 + qos->ucast.in.sdu = le16_to_cpu(ev->p_mtu); 6844 + qos->ucast.out.phy = ev->c_phy; 6845 + qos->ucast.in.phy = ev->p_phy; 6846 + break; 6826 6847 } 6827 6848 6828 6849 if (!ev->status) {
+10 -18
net/bluetooth/hci_sync.c
··· 4623 4623 * BD_ADDR invalid before creating the HCI device or in 4624 4624 * its setup callback. 4625 4625 */ 4626 - invalid_bdaddr = test_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks); 4627 - 4626 + invalid_bdaddr = test_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks) || 4627 + test_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks); 4628 4628 if (!ret) { 4629 - if (test_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks)) { 4630 - if (!bacmp(&hdev->public_addr, BDADDR_ANY)) 4631 - hci_dev_get_bd_addr_from_property(hdev); 4629 + if (test_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks) && 4630 + !bacmp(&hdev->public_addr, BDADDR_ANY)) 4631 + hci_dev_get_bd_addr_from_property(hdev); 4632 4632 4633 - if (bacmp(&hdev->public_addr, BDADDR_ANY) && 4634 - hdev->set_bdaddr) { 4635 - ret = hdev->set_bdaddr(hdev, 4636 - &hdev->public_addr); 4637 - 4638 - /* If setting of the BD_ADDR from the device 4639 - * property succeeds, then treat the address 4640 - * as valid even if the invalid BD_ADDR 4641 - * quirk indicates otherwise. 4642 - */ 4643 - if (!ret) 4644 - invalid_bdaddr = false; 4645 - } 4633 + if (invalid_bdaddr && bacmp(&hdev->public_addr, BDADDR_ANY) && 4634 + hdev->set_bdaddr) { 4635 + ret = hdev->set_bdaddr(hdev, &hdev->public_addr); 4636 + if (!ret) 4637 + invalid_bdaddr = false; 4646 4638 } 4647 4639 } 4648 4640
+7 -7
net/bluetooth/hci_sysfs.c
··· 6 6 #include <net/bluetooth/bluetooth.h> 7 7 #include <net/bluetooth/hci_core.h> 8 8 9 - static struct class *bt_class; 9 + static const struct class bt_class = { 10 + .name = "bluetooth", 11 + }; 10 12 11 13 static void bt_link_release(struct device *dev) 12 14 { ··· 38 36 BT_DBG("conn %p", conn); 39 37 40 38 conn->dev.type = &bt_link; 41 - conn->dev.class = bt_class; 39 + conn->dev.class = &bt_class; 42 40 conn->dev.parent = &hdev->dev; 43 41 44 42 device_initialize(&conn->dev); ··· 106 104 struct device *dev = &hdev->dev; 107 105 108 106 dev->type = &bt_host; 109 - dev->class = bt_class; 107 + dev->class = &bt_class; 110 108 111 109 __module_get(THIS_MODULE); 112 110 device_initialize(dev); ··· 114 112 115 113 int __init bt_sysfs_init(void) 116 114 { 117 - bt_class = class_create("bluetooth"); 118 - 119 - return PTR_ERR_OR_ZERO(bt_class); 115 + return class_register(&bt_class); 120 116 } 121 117 122 118 void bt_sysfs_cleanup(void) 123 119 { 124 - class_destroy(bt_class); 120 + class_unregister(&bt_class); 125 121 }
+2 -2
net/bluetooth/iso.c
··· 704 704 .bcast = { 705 705 .big = BT_ISO_QOS_BIG_UNSET, 706 706 .bis = BT_ISO_QOS_BIS_UNSET, 707 - .sync_interval = 0x00, 707 + .sync_factor = 0x01, 708 708 .packing = 0x00, 709 709 .framing = 0x00, 710 710 .in = DEFAULT_IO_QOS, ··· 1213 1213 1214 1214 static bool check_bcast_qos(struct bt_iso_qos *qos) 1215 1215 { 1216 - if (qos->bcast.sync_interval > 0x07) 1216 + if (qos->bcast.sync_factor == 0x00) 1217 1217 return false; 1218 1218 1219 1219 if (qos->bcast.packing > 0x01)
+5
net/bluetooth/l2cap_core.c
··· 6374 6374 if (!chan) 6375 6375 goto done; 6376 6376 6377 + chan = l2cap_chan_hold_unless_zero(chan); 6378 + if (!chan) 6379 + goto done; 6380 + 6377 6381 l2cap_chan_lock(chan); 6378 6382 l2cap_chan_del(chan, ECONNREFUSED); 6379 6383 l2cap_chan_unlock(chan); 6384 + l2cap_chan_put(chan); 6380 6385 6381 6386 done: 6382 6387 mutex_unlock(&conn->chan_lock);
+2
net/bluetooth/l2cap_sock.c
··· 46 46 static void l2cap_sock_init(struct sock *sk, struct sock *parent); 47 47 static struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock, 48 48 int proto, gfp_t prio, int kern); 49 + static void l2cap_sock_cleanup_listen(struct sock *parent); 49 50 50 51 bool l2cap_is_socket(struct socket *sock) 51 52 { ··· 1416 1415 if (!sk) 1417 1416 return 0; 1418 1417 1418 + l2cap_sock_cleanup_listen(sk); 1419 1419 bt_sock_unlink(&l2cap_sk_list, sk); 1420 1420 1421 1421 err = l2cap_sock_shutdown(sock, SHUT_RDWR);
+3 -2
net/bridge/br_if.c
··· 166 166 * This lets us disable promiscuous mode and write 167 167 * this config to hw. 168 168 */ 169 - if (br->auto_cnt == 0 || 170 - (br->auto_cnt == 1 && br_auto_port(p))) 169 + if ((p->dev->priv_flags & IFF_UNICAST_FLT) && 170 + (br->auto_cnt == 0 || 171 + (br->auto_cnt == 1 && br_auto_port(p)))) 171 172 br_port_clear_promisc(p); 172 173 else 173 174 br_port_set_promisc(p);
+35 -57
net/dsa/tag_sja1105.c
··· 58 58 #define SJA1110_TX_TRAILER_LEN 4 59 59 #define SJA1110_MAX_PADDING_LEN 15 60 60 61 - #define SJA1105_HWTS_RX_EN 0 62 - 63 61 struct sja1105_tagger_private { 64 62 struct sja1105_tagger_data data; /* Must be first */ 65 - unsigned long state; 66 63 /* Protects concurrent access to the meta state machine 67 64 * from taggers running on multiple ports on SMP systems 68 65 */ ··· 115 118 * a unified unpacking command for both device series. 116 119 */ 117 120 packing(buf, &meta->tstamp, 31, 0, 4, UNPACK, 0); 118 - packing(buf + 4, &meta->dmac_byte_4, 7, 0, 1, UNPACK, 0); 119 - packing(buf + 5, &meta->dmac_byte_3, 7, 0, 1, UNPACK, 0); 121 + packing(buf + 4, &meta->dmac_byte_3, 7, 0, 1, UNPACK, 0); 122 + packing(buf + 5, &meta->dmac_byte_4, 7, 0, 1, UNPACK, 0); 120 123 packing(buf + 6, &meta->source_port, 7, 0, 1, UNPACK, 0); 121 124 packing(buf + 7, &meta->switch_id, 7, 0, 1, UNPACK, 0); 122 125 } ··· 389 392 390 393 priv = sja1105_tagger_private(ds); 391 394 392 - if (!test_bit(SJA1105_HWTS_RX_EN, &priv->state)) 393 - /* Do normal processing. */ 394 - return skb; 395 - 396 395 spin_lock(&priv->meta_lock); 397 396 /* Was this a link-local frame instead of the meta 398 397 * that we were expecting? ··· 424 431 425 432 priv = sja1105_tagger_private(ds); 426 433 427 - /* Drop the meta frame if we're not in the right state 428 - * to process it. 429 - */ 430 - if (!test_bit(SJA1105_HWTS_RX_EN, &priv->state)) 431 - return NULL; 432 - 433 434 spin_lock(&priv->meta_lock); 434 435 435 436 stampable_skb = priv->stampable_skb; ··· 457 470 } 458 471 459 472 return skb; 460 - } 461 - 462 - static bool sja1105_rxtstamp_get_state(struct dsa_switch *ds) 463 - { 464 - struct sja1105_tagger_private *priv = sja1105_tagger_private(ds); 465 - 466 - return test_bit(SJA1105_HWTS_RX_EN, &priv->state); 467 - } 468 - 469 - static void sja1105_rxtstamp_set_state(struct dsa_switch *ds, bool on) 470 - { 471 - struct sja1105_tagger_private *priv = sja1105_tagger_private(ds); 472 - 473 - if (on) 474 - set_bit(SJA1105_HWTS_RX_EN, &priv->state); 475 - else 476 - clear_bit(SJA1105_HWTS_RX_EN, &priv->state); 477 - 478 - /* Initialize the meta state machine to a known state */ 479 - if (!priv->stampable_skb) 480 - return; 481 - 482 - kfree_skb(priv->stampable_skb); 483 - priv->stampable_skb = NULL; 484 473 } 485 474 486 475 static bool sja1105_skb_has_tag_8021q(const struct sk_buff *skb) ··· 508 545 is_link_local = sja1105_is_link_local(skb); 509 546 is_meta = sja1105_is_meta_frame(skb); 510 547 511 - if (sja1105_skb_has_tag_8021q(skb)) { 512 - /* Normal traffic path. */ 513 - sja1105_vlan_rcv(skb, &source_port, &switch_id, &vbid, &vid); 514 - } else if (is_link_local) { 548 + if (is_link_local) { 515 549 /* Management traffic path. Switch embeds the switch ID and 516 550 * port ID into bytes of the destination MAC, courtesy of 517 551 * the incl_srcpt options. 518 552 */ 519 553 source_port = hdr->h_dest[3]; 520 554 switch_id = hdr->h_dest[4]; 521 - /* Clear the DMAC bytes that were mangled by the switch */ 522 - hdr->h_dest[3] = 0; 523 - hdr->h_dest[4] = 0; 524 555 } else if (is_meta) { 525 556 sja1105_meta_unpack(skb, &meta); 526 557 source_port = meta.source_port; 527 558 switch_id = meta.switch_id; 528 - } else { 559 + } 560 + 561 + /* Normal data plane traffic and link-local frames are tagged with 562 + * a tag_8021q VLAN which we have to strip 563 + */ 564 + if (sja1105_skb_has_tag_8021q(skb)) { 565 + int tmp_source_port = -1, tmp_switch_id = -1; 566 + 567 + sja1105_vlan_rcv(skb, &tmp_source_port, &tmp_switch_id, &vbid, 568 + &vid); 569 + /* Preserve the source information from the INCL_SRCPT option, 570 + * if available. This allows us to not overwrite a valid source 571 + * port and switch ID with zeroes when receiving link-local 572 + * frames from a VLAN-unaware bridged port (non-zero vbid) or a 573 + * VLAN-aware bridged port (non-zero vid). Furthermore, the 574 + * tag_8021q source port information is only of trust when the 575 + * vbid is 0 (precise port). Otherwise, tmp_source_port and 576 + * tmp_switch_id will be zeroes. 577 + */ 578 + if (vbid == 0 && source_port == -1) 579 + source_port = tmp_source_port; 580 + if (vbid == 0 && switch_id == -1) 581 + switch_id = tmp_switch_id; 582 + } else if (source_port == -1 && switch_id == -1) { 583 + /* Packets with no source information have no chance of 584 + * getting accepted, drop them straight away. 585 + */ 529 586 return NULL; 530 587 } 531 588 532 - if (vbid >= 1) 533 - skb->dev = dsa_tag_8021q_find_port_by_vbid(netdev, vbid); 534 - else if (source_port == -1 || switch_id == -1) 535 - skb->dev = dsa_find_designated_bridge_port_by_vid(netdev, vid); 536 - else 589 + if (source_port != -1 && switch_id != -1) 537 590 skb->dev = dsa_master_find_slave(netdev, switch_id, source_port); 591 + else if (vbid >= 1) 592 + skb->dev = dsa_tag_8021q_find_port_by_vbid(netdev, vbid); 593 + else 594 + skb->dev = dsa_find_designated_bridge_port_by_vid(netdev, vid); 538 595 if (!skb->dev) { 539 596 netdev_warn(netdev, "Couldn't decode source port\n"); 540 597 return NULL; ··· 745 762 746 763 static int sja1105_connect(struct dsa_switch *ds) 747 764 { 748 - struct sja1105_tagger_data *tagger_data; 749 765 struct sja1105_tagger_private *priv; 750 766 struct kthread_worker *xmit_worker; 751 767 int err; ··· 764 782 } 765 783 766 784 priv->xmit_worker = xmit_worker; 767 - /* Export functions for switch driver use */ 768 - tagger_data = &priv->data; 769 - tagger_data->rxtstamp_get_state = sja1105_rxtstamp_get_state; 770 - tagger_data->rxtstamp_set_state = sja1105_rxtstamp_set_state; 771 785 ds->tagger_data = priv; 772 786 773 787 return 0;
+9 -3
net/ipv4/tcp_input.c
··· 3590 3590 static bool __tcp_oow_rate_limited(struct net *net, int mib_idx, 3591 3591 u32 *last_oow_ack_time) 3592 3592 { 3593 - if (*last_oow_ack_time) { 3594 - s32 elapsed = (s32)(tcp_jiffies32 - *last_oow_ack_time); 3593 + /* Paired with the WRITE_ONCE() in this function. */ 3594 + u32 val = READ_ONCE(*last_oow_ack_time); 3595 + 3596 + if (val) { 3597 + s32 elapsed = (s32)(tcp_jiffies32 - val); 3595 3598 3596 3599 if (0 <= elapsed && 3597 3600 elapsed < READ_ONCE(net->ipv4.sysctl_tcp_invalid_ratelimit)) { ··· 3603 3600 } 3604 3601 } 3605 3602 3606 - *last_oow_ack_time = tcp_jiffies32; 3603 + /* Paired with the prior READ_ONCE() and with itself, 3604 + * as we might be lockless. 3605 + */ 3606 + WRITE_ONCE(*last_oow_ack_time, tcp_jiffies32); 3607 3607 3608 3608 return false; /* not rate-limited: go ahead, send dupack now! */ 3609 3609 }
+6 -1
net/mptcp/protocol.c
··· 2909 2909 return; 2910 2910 2911 2911 lock_sock_nested(ssk, SINGLE_DEPTH_NESTING); 2912 + tcp_set_state(ssk, TCP_CLOSE); 2912 2913 mptcp_subflow_queue_clean(sk, ssk); 2913 2914 inet_csk_listen_stop(ssk); 2914 2915 mptcp_event_pm_listener(ssk, MPTCP_EVENT_LISTENER_CLOSED); 2915 - tcp_set_state(ssk, TCP_CLOSE); 2916 2916 release_sock(ssk); 2917 2917 } 2918 2918 ··· 3703 3703 pr_debug("msk=%p", msk); 3704 3704 3705 3705 lock_sock(sk); 3706 + 3707 + err = -EINVAL; 3708 + if (sock->state != SS_UNCONNECTED || sock->type != SOCK_STREAM) 3709 + goto unlock; 3710 + 3706 3711 ssock = __mptcp_nmpc_socket(msk); 3707 3712 if (IS_ERR(ssock)) { 3708 3713 err = PTR_ERR(ssock);
+64 -8
net/sched/act_ipt.c
··· 21 21 #include <linux/tc_act/tc_ipt.h> 22 22 #include <net/tc_act/tc_ipt.h> 23 23 #include <net/tc_wrapper.h> 24 + #include <net/ip.h> 24 25 25 26 #include <linux/netfilter_ipv4/ip_tables.h> 26 27 ··· 49 48 par.entryinfo = &e; 50 49 par.target = target; 51 50 par.targinfo = t->data; 52 - par.hook_mask = hook; 51 + par.hook_mask = 1 << hook; 53 52 par.family = NFPROTO_IPV4; 54 53 55 54 ret = xt_check_target(&par, t->u.target_size - sizeof(*t), 0, false); ··· 86 85 87 86 static const struct nla_policy ipt_policy[TCA_IPT_MAX + 1] = { 88 87 [TCA_IPT_TABLE] = { .type = NLA_STRING, .len = IFNAMSIZ }, 89 - [TCA_IPT_HOOK] = { .type = NLA_U32 }, 88 + [TCA_IPT_HOOK] = NLA_POLICY_RANGE(NLA_U32, NF_INET_PRE_ROUTING, 89 + NF_INET_NUMHOOKS), 90 90 [TCA_IPT_INDEX] = { .type = NLA_U32 }, 91 91 [TCA_IPT_TARG] = { .len = sizeof(struct xt_entry_target) }, 92 92 }; ··· 160 158 return -EEXIST; 161 159 } 162 160 } 163 - hook = nla_get_u32(tb[TCA_IPT_HOOK]); 164 161 165 - err = -ENOMEM; 166 - tname = kmalloc(IFNAMSIZ, GFP_KERNEL); 162 + err = -EINVAL; 163 + hook = nla_get_u32(tb[TCA_IPT_HOOK]); 164 + switch (hook) { 165 + case NF_INET_PRE_ROUTING: 166 + break; 167 + case NF_INET_POST_ROUTING: 168 + break; 169 + default: 170 + goto err1; 171 + } 172 + 173 + if (tb[TCA_IPT_TABLE]) { 174 + /* mangle only for now */ 175 + if (nla_strcmp(tb[TCA_IPT_TABLE], "mangle")) 176 + goto err1; 177 + } 178 + 179 + tname = kstrdup("mangle", GFP_KERNEL); 167 180 if (unlikely(!tname)) 168 181 goto err1; 169 - if (tb[TCA_IPT_TABLE] == NULL || 170 - nla_strscpy(tname, tb[TCA_IPT_TABLE], IFNAMSIZ) >= IFNAMSIZ) 171 - strcpy(tname, "mangle"); 172 182 173 183 t = kmemdup(td, td->u.target_size, GFP_KERNEL); 174 184 if (unlikely(!t)) ··· 231 217 a, &act_xt_ops, tp, flags); 232 218 } 233 219 220 + static bool tcf_ipt_act_check(struct sk_buff *skb) 221 + { 222 + const struct iphdr *iph; 223 + unsigned int nhoff, len; 224 + 225 + if (!pskb_may_pull(skb, sizeof(struct iphdr))) 226 + return false; 227 + 228 + nhoff = skb_network_offset(skb); 229 + iph = ip_hdr(skb); 230 + if (iph->ihl < 5 || iph->version != 4) 231 + return false; 232 + 233 + len = skb_ip_totlen(skb); 234 + if (skb->len < nhoff + len || len < (iph->ihl * 4u)) 235 + return false; 236 + 237 + return pskb_may_pull(skb, iph->ihl * 4u); 238 + } 239 + 234 240 TC_INDIRECT_SCOPE int tcf_ipt_act(struct sk_buff *skb, 235 241 const struct tc_action *a, 236 242 struct tcf_result *res) 237 243 { 244 + char saved_cb[sizeof_field(struct sk_buff, cb)]; 238 245 int ret = 0, result = 0; 239 246 struct tcf_ipt *ipt = to_ipt(a); 240 247 struct xt_action_param par; ··· 266 231 .pf = NFPROTO_IPV4, 267 232 }; 268 233 234 + if (skb_protocol(skb, false) != htons(ETH_P_IP)) 235 + return TC_ACT_UNSPEC; 236 + 269 237 if (skb_unclone(skb, GFP_ATOMIC)) 270 238 return TC_ACT_UNSPEC; 239 + 240 + if (!tcf_ipt_act_check(skb)) 241 + return TC_ACT_UNSPEC; 242 + 243 + if (state.hook == NF_INET_POST_ROUTING) { 244 + if (!skb_dst(skb)) 245 + return TC_ACT_UNSPEC; 246 + 247 + state.out = skb->dev; 248 + } 249 + 250 + memcpy(saved_cb, skb->cb, sizeof(saved_cb)); 271 251 272 252 spin_lock(&ipt->tcf_lock); 273 253 ··· 296 246 par.state = &state; 297 247 par.target = ipt->tcfi_t->u.kernel.target; 298 248 par.targinfo = ipt->tcfi_t->data; 249 + 250 + memset(IPCB(skb), 0, sizeof(struct inet_skb_parm)); 251 + 299 252 ret = par.target->target(skb, &par); 300 253 301 254 switch (ret) { ··· 319 266 break; 320 267 } 321 268 spin_unlock(&ipt->tcf_lock); 269 + 270 + memcpy(skb->cb, saved_cb, sizeof(skb->cb)); 271 + 322 272 return result; 323 273 324 274 }
+1
net/sched/act_pedit.c
··· 29 29 30 30 static const struct nla_policy pedit_policy[TCA_PEDIT_MAX + 1] = { 31 31 [TCA_PEDIT_PARMS] = { .len = sizeof(struct tc_pedit) }, 32 + [TCA_PEDIT_PARMS_EX] = { .len = sizeof(struct tc_pedit) }, 32 33 [TCA_PEDIT_KEYS_EX] = { .type = NLA_NESTED }, 33 34 }; 34 35
+2 -2
net/sctp/socket.c
··· 364 364 struct net *net = sock_net(&sp->inet.sk); 365 365 366 366 if (net->sctp.default_auto_asconf) { 367 - spin_lock(&net->sctp.addr_wq_lock); 367 + spin_lock_bh(&net->sctp.addr_wq_lock); 368 368 list_add_tail(&sp->auto_asconf_list, &net->sctp.auto_asconf_splist); 369 - spin_unlock(&net->sctp.addr_wq_lock); 369 + spin_unlock_bh(&net->sctp.addr_wq_lock); 370 370 sp->do_auto_asconf = 1; 371 371 } 372 372 }
+5
net/xdp/xsk.c
··· 886 886 struct sock *sk = sock->sk; 887 887 struct xdp_sock *xs = xdp_sk(sk); 888 888 struct net_device *dev; 889 + int bound_dev_if; 889 890 u32 flags, qid; 890 891 int err = 0; 891 892 ··· 898 897 flags = sxdp->sxdp_flags; 899 898 if (flags & ~(XDP_SHARED_UMEM | XDP_COPY | XDP_ZEROCOPY | 900 899 XDP_USE_NEED_WAKEUP)) 900 + return -EINVAL; 901 + 902 + bound_dev_if = READ_ONCE(sk->sk_bound_dev_if); 903 + if (bound_dev_if && bound_dev_if != sxdp->sxdp_ifindex) 901 904 return -EINVAL; 902 905 903 906 rtnl_lock();
+7 -6
samples/pktgen/functions.sh
··· 108 108 fi 109 109 } 110 110 111 - if [[ -z "$APPEND" ]]; then 112 - if [[ $EUID -eq 0 ]]; then 113 - # Cleanup pktgen setup on exit if thats not "append mode" 114 - trap 'pg_ctrl "reset"' EXIT 115 - fi 116 - fi 111 + function trap_exit() 112 + { 113 + # Cleanup pktgen setup on exit if thats not "append mode" 114 + if [[ -z "$APPEND" ]] && [[ $EUID -eq 0 ]]; then 115 + trap 'pg_ctrl "reset"' EXIT 116 + fi 117 + } 117 118 118 119 ## -- General shell tricks -- 119 120
+4
samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh
··· 33 33 34 34 # Parameter parsing via include 35 35 source ${basedir}/parameters.sh 36 + 37 + # Trap EXIT first 38 + trap_exit 39 + 36 40 # Using invalid DST_MAC will cause the packets to get dropped in 37 41 # ip_rcv() which is part of the test 38 42 if [ -z "$DEST_IP" ]; then
+4
samples/pktgen/pktgen_bench_xmit_mode_queue_xmit.sh
··· 14 14 15 15 # Parameter parsing via include 16 16 source ${basedir}/parameters.sh 17 + 18 + # Trap EXIT first 19 + trap_exit 20 + 17 21 if [ -z "$DEST_IP" ]; then 18 22 [ -z "$IP6" ] && DEST_IP="198.18.0.42" || DEST_IP="FD00::1" 19 23 fi
+4
samples/pktgen/pktgen_sample01_simple.sh
··· 13 13 # - go look in parameters.sh to see which setting are avail 14 14 # - required param is the interface "-i" stored in $DEV 15 15 source ${basedir}/parameters.sh 16 + 17 + # Trap EXIT first 18 + trap_exit 19 + 16 20 # 17 21 # Set some default params, if they didn't get set 18 22 if [ -z "$DEST_IP" ]; then
+3
samples/pktgen/pktgen_sample02_multiqueue.sh
··· 14 14 # Required param: -i dev in $DEV 15 15 source ${basedir}/parameters.sh 16 16 17 + # Trap EXIT first 18 + trap_exit 19 + 17 20 [ -z "$COUNT" ] && COUNT="100000" # Zero means indefinitely 18 21 19 22 # Base Config
+4
samples/pktgen/pktgen_sample03_burst_single_flow.sh
··· 25 25 26 26 # Parameter parsing via include 27 27 source ${basedir}/parameters.sh 28 + 29 + # Trap EXIT first 30 + trap_exit 31 + 28 32 # Set some default params, if they didn't get set 29 33 if [ -z "$DEST_IP" ]; then 30 34 [ -z "$IP6" ] && DEST_IP="198.18.0.42" || DEST_IP="FD00::1"
+4
samples/pktgen/pktgen_sample04_many_flows.sh
··· 12 12 13 13 # Parameter parsing via include 14 14 source ${basedir}/parameters.sh 15 + 16 + # Trap EXIT first 17 + trap_exit 18 + 15 19 # Set some default params, if they didn't get set 16 20 if [ -z "$DEST_IP" ]; then 17 21 [ -z "$IP6" ] && DEST_IP="198.18.0.42" || DEST_IP="FD00::1"
+4
samples/pktgen/pktgen_sample05_flow_per_thread.sh
··· 16 16 17 17 # Parameter parsing via include 18 18 source ${basedir}/parameters.sh 19 + 20 + # Trap EXIT first 21 + trap_exit 22 + 19 23 # Set some default params, if they didn't get set 20 24 if [ -z "$DEST_IP" ]; then 21 25 [ -z "$IP6" ] && DEST_IP="198.18.0.42" || DEST_IP="FD00::1"
+3
samples/pktgen/pktgen_sample06_numa_awared_queue_irq_affinity.sh
··· 14 14 # Required param: -i dev in $DEV 15 15 source ${basedir}/parameters.sh 16 16 17 + # Trap EXIT first 18 + trap_exit 19 + 17 20 # Base Config 18 21 [ -z "$COUNT" ] && COUNT="20000000" # Zero means indefinitely 19 22 [ -z "$CLONE_SKB" ] && CLONE_SKB="0"
+1
tools/testing/selftests/net/config
··· 50 50 CONFIG_AMT=m 51 51 CONFIG_VXLAN=m 52 52 CONFIG_IP_SCTP=m 53 + CONFIG_NETFILTER_XT_MATCH_POLICY=m
+1
tools/testing/selftests/net/mptcp/config
··· 6 6 CONFIG_INET_MPTCP_DIAG=m 7 7 CONFIG_VETH=y 8 8 CONFIG_NET_SCH_NETEM=m 9 + CONFIG_SYN_COOKIES=y 9 10 CONFIG_NETFILTER=y 10 11 CONFIG_NETFILTER_ADVANCED=y 11 12 CONFIG_NETFILTER_NETLINK=m
+3
tools/testing/selftests/net/mptcp/mptcp_connect.sh
··· 718 718 EOF 719 719 if [ $? -ne 0 ]; then 720 720 echo "SKIP: $msg, could not load nft ruleset" 721 + mptcp_lib_fail_if_expected_feature "nft rules" 721 722 return 722 723 fi 723 724 ··· 734 733 if [ $? -ne 0 ]; then 735 734 ip netns exec "$listener_ns" nft flush ruleset 736 735 echo "SKIP: $msg, ip $r6flag rule failed" 736 + mptcp_lib_fail_if_expected_feature "ip rule" 737 737 return 738 738 fi 739 739 ··· 743 741 ip netns exec "$listener_ns" nft flush ruleset 744 742 ip -net "$listener_ns" $r6flag rule del fwmark 1 lookup 100 745 743 echo "SKIP: $msg, ip route add local $local_addr failed" 744 + mptcp_lib_fail_if_expected_feature "ip route" 746 745 return 747 746 fi 748 747
+16 -13
tools/testing/selftests/net/mptcp/mptcp_sockopt.sh
··· 12 12 timeout_poll=30 13 13 timeout_test=$((timeout_poll * 2 + 1)) 14 14 mptcp_connect="" 15 + iptables="iptables" 16 + ip6tables="ip6tables" 15 17 16 18 sec=$(date +%s) 17 19 rndh=$(printf %x $sec)-$(mktemp -u XXXXXX) ··· 27 25 local m=$2 28 26 29 27 local t 30 - for t in iptables ip6tables; do 28 + for t in ${iptables} ${ip6tables}; do 31 29 # just to debug: check we have multiple subflows connection requests 32 30 ip netns exec $ns $t -A OUTPUT -p tcp --syn -m mark --mark $m -j ACCEPT 33 31 ··· 97 95 exit $ksft_skip 98 96 fi 99 97 100 - iptables -V > /dev/null 2>&1 101 - if [ $? -ne 0 ];then 98 + # Use the legacy version if available to support old kernel versions 99 + if iptables-legacy -V &> /dev/null; then 100 + iptables="iptables-legacy" 101 + ip6tables="ip6tables-legacy" 102 + elif ! iptables -V &> /dev/null; then 102 103 echo "SKIP: Could not run all tests without iptables tool" 103 104 exit $ksft_skip 104 - fi 105 - 106 - ip6tables -V > /dev/null 2>&1 107 - if [ $? -ne 0 ];then 105 + elif ! ip6tables -V &> /dev/null; then 108 106 echo "SKIP: Could not run all tests without ip6tables tool" 109 107 exit $ksft_skip 110 108 fi ··· 114 112 local ns=$1 115 113 local af=$2 116 114 117 - local tables=iptables 115 + local tables=${iptables} 118 116 119 117 if [ $af -eq 6 ];then 120 - tables=ip6tables 118 + tables=${ip6tables} 121 119 fi 122 120 123 121 local counters values ··· 128 126 for v in $values; do 129 127 if [ $v -ne 0 ]; then 130 128 echo "FAIL: got $tables $values in ns $ns , not 0 - not all expected packets marked" 1>&2 129 + ret=1 131 130 return 1 132 131 fi 133 132 done ··· 228 225 fi 229 226 230 227 if [ $local_addr = "::" ];then 231 - check_mark $listener_ns 6 232 - check_mark $connector_ns 6 228 + check_mark $listener_ns 6 || retc=1 229 + check_mark $connector_ns 6 || retc=1 233 230 else 234 - check_mark $listener_ns 4 235 - check_mark $connector_ns 4 231 + check_mark $listener_ns 4 || retc=1 232 + check_mark $connector_ns 4 || retc=1 236 233 fi 237 234 238 235 check_transfer $cin $sout "file received by server"
+5 -5
tools/testing/selftests/net/mptcp/pm_nl_ctl.c
··· 425 425 } 426 426 427 427 /* token */ 428 - token = atoi(params[4]); 428 + token = strtoul(params[4], NULL, 10); 429 429 rta = (void *)(data + off); 430 430 rta->rta_type = MPTCP_PM_ATTR_TOKEN; 431 431 rta->rta_len = RTA_LENGTH(4); ··· 551 551 } 552 552 553 553 /* token */ 554 - token = atoi(params[4]); 554 + token = strtoul(params[4], NULL, 10); 555 555 rta = (void *)(data + off); 556 556 rta->rta_type = MPTCP_PM_ATTR_TOKEN; 557 557 rta->rta_len = RTA_LENGTH(4); ··· 598 598 if (++arg >= argc) 599 599 error(1, 0, " missing token value"); 600 600 601 - token = atoi(argv[arg]); 601 + token = strtoul(argv[arg], NULL, 10); 602 602 rta = (void *)(data + off); 603 603 rta->rta_type = MPTCP_PM_ATTR_TOKEN; 604 604 rta->rta_len = RTA_LENGTH(4); ··· 710 710 if (++arg >= argc) 711 711 error(1, 0, " missing token value"); 712 712 713 - token = atoi(argv[arg]); 713 + token = strtoul(argv[arg], NULL, 10); 714 714 } else 715 715 error(1, 0, "unknown keyword %s", argv[arg]); 716 716 } ··· 1347 1347 error(1, 0, " missing token value"); 1348 1348 1349 1349 /* token */ 1350 - token = atoi(argv[arg]); 1350 + token = strtoul(argv[arg], NULL, 10); 1351 1351 } else if (!strcmp(argv[arg], "flags")) { 1352 1352 char *tok, *str; 1353 1353
+3 -1
tools/testing/selftests/net/mptcp/userspace_pm.sh
··· 423 423 stdbuf -o0 -e0 printf "[OK]\n" 424 424 else 425 425 stdbuf -o0 -e0 printf "[FAIL]\n" 426 + exit 1 426 427 fi 427 428 428 429 # RM_ADDR using an invalid addr id should result in no action ··· 438 437 stdbuf -o0 -e0 printf "[OK]\n" 439 438 else 440 439 stdbuf -o0 -e0 printf "[FAIL]\n" 440 + exit 1 441 441 fi 442 442 443 443 # RM_ADDR from the client to server machine ··· 850 848 local count 851 849 852 850 # Send MP_PRIO signal from client to server machine 853 - ip netns exec "$ns2" ./pm_nl_ctl set 10.0.1.2 port "$client4_port" flags backup token "$client4_token" rip 10.0.1.1 rport "$server4_port" 851 + ip netns exec "$ns2" ./pm_nl_ctl set 10.0.1.2 port "$client4_port" flags backup token "$client4_token" rip 10.0.1.1 rport "$app4_port" 854 852 sleep 0.5 855 853 856 854 # Check TX
+26 -4
tools/testing/selftests/wireguard/netns.sh
··· 514 514 n1 ping -W 1 -c 1 192.168.241.2 515 515 [[ $(n2 wg show wg0 endpoints) == "$pub1 10.0.0.3:1" ]] 516 516 517 - ip1 link del veth1 518 - ip1 link del veth3 519 - ip1 link del wg0 520 - ip2 link del wg0 517 + ip1 link del dev veth3 518 + ip1 link del dev wg0 519 + ip2 link del dev wg0 520 + 521 + # Make sure persistent keep alives are sent when an adapter comes up 522 + ip1 link add dev wg0 type wireguard 523 + n1 wg set wg0 private-key <(echo "$key1") peer "$pub2" endpoint 10.0.0.1:1 persistent-keepalive 1 524 + read _ _ tx_bytes < <(n1 wg show wg0 transfer) 525 + [[ $tx_bytes -eq 0 ]] 526 + ip1 link set dev wg0 up 527 + read _ _ tx_bytes < <(n1 wg show wg0 transfer) 528 + [[ $tx_bytes -gt 0 ]] 529 + ip1 link del dev wg0 530 + # This should also happen even if the private key is set later 531 + ip1 link add dev wg0 type wireguard 532 + n1 wg set wg0 peer "$pub2" endpoint 10.0.0.1:1 persistent-keepalive 1 533 + read _ _ tx_bytes < <(n1 wg show wg0 transfer) 534 + [[ $tx_bytes -eq 0 ]] 535 + ip1 link set dev wg0 up 536 + read _ _ tx_bytes < <(n1 wg show wg0 transfer) 537 + [[ $tx_bytes -eq 0 ]] 538 + n1 wg set wg0 private-key <(echo "$key1") 539 + read _ _ tx_bytes < <(n1 wg show wg0 transfer) 540 + [[ $tx_bytes -gt 0 ]] 541 + ip1 link del dev veth1 542 + ip1 link del dev wg0 521 543 522 544 # We test that Netlink/IPC is working properly by doing things that usually cause split responses 523 545 ip0 link add dev wg0 type wireguard