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

Pull networking fixes from Paolo Abeni:
"Including fixes from CAN

Current release - regressions:

- udp: do not use skb_release_head_state() before
skb_attempt_defer_free()

- gro_cells: use nested-BH locking for gro_cell

- dpll: zl3073x: increase maximum size of flash utility

Previous releases - regressions:

- core: fix lockdep splat on device unregister

- tcp: fix tcp_tso_should_defer() vs large RTT

- tls:
- don't rely on tx_work during send()
- wait for pending async decryptions if tls_strp_msg_hold fails

- can: j1939: add missing calls in NETDEV_UNREGISTER notification
handler

- eth: lan78xx: fix lost EEPROM write timeout in
lan78xx_write_raw_eeprom

Previous releases - always broken:

- ip6_tunnel: prevent perpetual tunnel growth

- dpll: zl3073x: handle missing or corrupted flash configuration

- can: m_can: fix pm_runtime and CAN state handling

- eth:
- ixgbe: fix too early devlink_free() in ixgbe_remove()
- ixgbevf: fix mailbox API compatibility
- gve: Check valid ts bit on RX descriptor before hw timestamping
- idpf: cleanup remaining SKBs in PTP flows
- r8169: fix packet truncation after S4 resume on RTL8168H/RTL8111H"

* tag 'net-6.18-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (50 commits)
udp: do not use skb_release_head_state() before skb_attempt_defer_free()
net: usb: lan78xx: fix use of improperly initialized dev->chipid in lan78xx_reset
netdevsim: set the carrier when the device goes up
selftests: tls: add test for short splice due to full skmsg
selftests: net: tls: add tests for cmsg vs MSG_MORE
tls: don't rely on tx_work during send()
tls: wait for pending async decryptions if tls_strp_msg_hold fails
tls: always set record_type in tls_process_cmsg
tls: wait for async encrypt in case of error during latter iterations of sendmsg
tls: trim encrypted message to match the plaintext on short splice
tg3: prevent use of uninitialized remote_adv and local_adv variables
MAINTAINERS: new entry for IPv6 IOAM
gve: Check valid ts bit on RX descriptor before hw timestamping
net: core: fix lockdep splat on device unregister
MAINTAINERS: add myself as maintainer for b53
selftests: net: check jq command is supported
net: airoha: Take into account out-of-order tx completions in airoha_dev_xmit()
tcp: fix tcp_tso_should_defer() vs large RTT
r8152: add error handling in rtl8152_driver_init
usbnet: Fix using smp_processor_id() in preemptible code warnings
...

+817 -182
+1
.mailmap
··· 227 227 Dmitry Safonov <0x7f454c46@gmail.com> <d.safonov@partner.samsung.com> 228 228 Dmitry Safonov <0x7f454c46@gmail.com> <dsafonov@virtuozzo.com> 229 229 Domen Puncer <domen@coderock.org> 230 + Dong Aisheng <aisheng.dong@nxp.com> <b29396@freescale.com> 230 231 Douglas Gilbert <dougg@torque.net> 231 232 Drew Fustini <fustini@kernel.org> <drew@pdp7.com> 232 233 <duje@dujemihanovic.xyz> <duje.mihanovic@skole.hr>
+67 -4
Documentation/networking/can.rst
··· 1398 1398 Additionally CAN FD capable CAN controllers support up to 64 bytes of 1399 1399 payload. The representation of this length in can_frame.len and 1400 1400 canfd_frame.len for userspace applications and inside the Linux network 1401 - layer is a plain value from 0 .. 64 instead of the CAN 'data length code'. 1402 - The data length code was a 1:1 mapping to the payload length in the Classical 1403 - CAN frames anyway. The payload length to the bus-relevant DLC mapping is 1404 - only performed inside the CAN drivers, preferably with the helper 1401 + layer is a plain value from 0 .. 64 instead of the Classical CAN length 1402 + which ranges from 0 to 8. The payload length to the bus-relevant DLC mapping 1403 + is only performed inside the CAN drivers, preferably with the helper 1405 1404 functions can_fd_dlc2len() and can_fd_len2dlc(). 1406 1405 1407 1406 The CAN netdevice driver capabilities can be distinguished by the network ··· 1462 1463 Example when 'fd-non-iso on' is added on this switchable CAN FD adapter:: 1463 1464 1464 1465 can <FD,FD-NON-ISO> state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0 1466 + 1467 + 1468 + Transmitter Delay Compensation 1469 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1470 + 1471 + At high bit rates, the propagation delay from the TX pin to the RX pin of 1472 + the transceiver might become greater than the actual bit time causing 1473 + measurement errors: the RX pin would still be measuring the previous bit. 1474 + 1475 + The Transmitter Delay Compensation (thereafter, TDC) resolves this problem 1476 + by introducing a Secondary Sample Point (SSP) equal to the distance, in 1477 + minimum time quantum, from the start of the bit time on the TX pin to the 1478 + actual measurement on the RX pin. The SSP is calculated as the sum of two 1479 + configurable values: the TDC Value (TDCV) and the TDC offset (TDCO). 1480 + 1481 + TDC, if supported by the device, can be configured together with CAN-FD 1482 + using the ip tool's "tdc-mode" argument as follow: 1483 + 1484 + **omitted** 1485 + When no "tdc-mode" option is provided, the kernel will automatically 1486 + decide whether TDC should be turned on, in which case it will 1487 + calculate a default TDCO and use the TDCV as measured by the 1488 + device. This is the recommended method to use TDC. 1489 + 1490 + **"tdc-mode off"** 1491 + TDC is explicitly disabled. 1492 + 1493 + **"tdc-mode auto"** 1494 + The user must provide the "tdco" argument. The TDCV will be 1495 + automatically calculated by the device. This option is only 1496 + available if the device supports the TDC-AUTO CAN controller mode. 1497 + 1498 + **"tdc-mode manual"** 1499 + The user must provide both the "tdco" and "tdcv" arguments. This 1500 + option is only available if the device supports the TDC-MANUAL CAN 1501 + controller mode. 1502 + 1503 + Note that some devices may offer an additional parameter: "tdcf" (TDC Filter 1504 + window). If supported by your device, this can be added as an optional 1505 + argument to either "tdc-mode auto" or "tdc-mode manual". 1506 + 1507 + Example configuring a 500 kbit/s arbitration bitrate, a 5 Mbit/s data 1508 + bitrate, a TDCO of 15 minimum time quantum and a TDCV automatically measured 1509 + by the device:: 1510 + 1511 + $ ip link set can0 up type can bitrate 500000 \ 1512 + fd on dbitrate 4000000 \ 1513 + tdc-mode auto tdco 15 1514 + $ ip -details link show can0 1515 + 5: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 72 qdisc pfifo_fast state UP \ 1516 + mode DEFAULT group default qlen 10 1517 + link/can promiscuity 0 allmulti 0 minmtu 72 maxmtu 72 1518 + can <FD,TDC-AUTO> state ERROR-ACTIVE restart-ms 0 1519 + bitrate 500000 sample-point 0.875 1520 + tq 12 prop-seg 69 phase-seg1 70 phase-seg2 20 sjw 10 brp 1 1521 + ES582.1/ES584.1: tseg1 2..256 tseg2 2..128 sjw 1..128 brp 1..512 \ 1522 + brp_inc 1 1523 + dbitrate 4000000 dsample-point 0.750 1524 + dtq 12 dprop-seg 7 dphase-seg1 7 dphase-seg2 5 dsjw 2 dbrp 1 1525 + tdco 15 tdcf 0 1526 + ES582.1/ES584.1: dtseg1 2..32 dtseg2 1..16 dsjw 1..8 dbrp 1..32 \ 1527 + dbrp_inc 1 1528 + tdco 0..127 tdcf 0..127 1529 + clock 80000000 1465 1530 1466 1531 1467 1532 Supported CAN Hardware
+3
Documentation/networking/seg6-sysctl.rst
··· 25 25 26 26 Default is 0. 27 27 28 + /proc/sys/net/ipv6/seg6_* variables: 29 + ==================================== 30 + 28 31 seg6_flowlabel - INTEGER 29 32 Controls the behaviour of computing the flowlabel of outer 30 33 IPv6 header in case of SR T.encaps
+11
MAINTAINERS
··· 4804 4804 4805 4805 BROADCOM B53/SF2 ETHERNET SWITCH DRIVER 4806 4806 M: Florian Fainelli <florian.fainelli@broadcom.com> 4807 + M: Jonas Gorski <jonas.gorski@gmail.com> 4807 4808 L: netdev@vger.kernel.org 4808 4809 L: openwrt-devel@lists.openwrt.org (subscribers-only) 4809 4810 S: Supported ··· 18013 18012 X: net/rfkill/ 18014 18013 X: net/wireless/ 18015 18014 X: tools/testing/selftests/net/can/ 18015 + 18016 + NETWORKING [IOAM] 18017 + M: Justin Iurman <justin.iurman@uliege.be> 18018 + S: Maintained 18019 + F: Documentation/networking/ioam6* 18020 + F: include/linux/ioam6* 18021 + F: include/net/ioam6* 18022 + F: include/uapi/linux/ioam6* 18023 + F: net/ipv6/ioam6* 18024 + F: tools/testing/selftests/net/ioam6* 18016 18025 18017 18026 NETWORKING [IPSEC] 18018 18027 M: Steffen Klassert <steffen.klassert@secunet.com>
+21
drivers/dpll/zl3073x/core.c
··· 1038 1038 int zl3073x_dev_start(struct zl3073x_dev *zldev, bool full) 1039 1039 { 1040 1040 struct zl3073x_dpll *zldpll; 1041 + u8 info; 1041 1042 int rc; 1043 + 1044 + rc = zl3073x_read_u8(zldev, ZL_REG_INFO, &info); 1045 + if (rc) { 1046 + dev_err(zldev->dev, "Failed to read device status info\n"); 1047 + return rc; 1048 + } 1049 + 1050 + if (!FIELD_GET(ZL_INFO_READY, info)) { 1051 + /* The ready bit indicates that the firmware was successfully 1052 + * configured and is ready for normal operation. If it is 1053 + * cleared then the configuration stored in flash is wrong 1054 + * or missing. In this situation the driver will expose 1055 + * only devlink interface to give an opportunity to flash 1056 + * the correct config. 1057 + */ 1058 + dev_info(zldev->dev, 1059 + "FW not fully ready - missing or corrupted config\n"); 1060 + 1061 + return 0; 1062 + } 1042 1063 1043 1064 if (full) { 1044 1065 /* Fetch device state */
+1 -1
drivers/dpll/zl3073x/fw.c
··· 37 37 static const struct zl3073x_fw_component_info component_info[] = { 38 38 [ZL_FW_COMPONENT_UTIL] = { 39 39 .name = "utility", 40 - .max_size = 0x2300, 40 + .max_size = 0x4000, 41 41 .load_addr = 0x20000000, 42 42 .flash_type = ZL3073X_FLASH_TYPE_NONE, 43 43 },
+3
drivers/dpll/zl3073x/regs.h
··· 67 67 * Register Page 0, General 68 68 **************************/ 69 69 70 + #define ZL_REG_INFO ZL_REG(0, 0x00, 1) 71 + #define ZL_INFO_READY BIT(7) 72 + 70 73 #define ZL_REG_ID ZL_REG(0, 0x01, 2) 71 74 #define ZL_REG_REVISION ZL_REG(0, 0x03, 2) 72 75 #define ZL_REG_FW_VER ZL_REG(0, 0x05, 2)
+39 -29
drivers/net/can/m_can/m_can.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 // CAN bus driver for Bosch M_CAN controller 3 3 // Copyright (C) 2014 Freescale Semiconductor, Inc. 4 - // Dong Aisheng <b29396@freescale.com> 4 + // Dong Aisheng <aisheng.dong@nxp.com> 5 5 // Copyright (C) 2018-19 Texas Instruments Incorporated - http://www.ti.com/ 6 6 7 7 /* Bosch M_CAN user manual can be obtained from: ··· 812 812 u32 timestamp = 0; 813 813 814 814 switch (new_state) { 815 + case CAN_STATE_ERROR_ACTIVE: 816 + cdev->can.state = CAN_STATE_ERROR_ACTIVE; 817 + break; 815 818 case CAN_STATE_ERROR_WARNING: 816 819 /* error warning state */ 817 820 cdev->can.can_stats.error_warning++; ··· 844 841 __m_can_get_berr_counter(dev, &bec); 845 842 846 843 switch (new_state) { 844 + case CAN_STATE_ERROR_ACTIVE: 845 + cf->can_id |= CAN_ERR_CRTL | CAN_ERR_CNT; 846 + cf->data[1] = CAN_ERR_CRTL_ACTIVE; 847 + cf->data[6] = bec.txerr; 848 + cf->data[7] = bec.rxerr; 849 + break; 847 850 case CAN_STATE_ERROR_WARNING: 848 851 /* error warning state */ 849 852 cf->can_id |= CAN_ERR_CRTL | CAN_ERR_CNT; ··· 886 877 return 1; 887 878 } 888 879 889 - static int m_can_handle_state_errors(struct net_device *dev, u32 psr) 880 + static enum can_state 881 + m_can_state_get_by_psr(struct m_can_classdev *cdev) 882 + { 883 + u32 reg_psr; 884 + 885 + reg_psr = m_can_read(cdev, M_CAN_PSR); 886 + 887 + if (reg_psr & PSR_BO) 888 + return CAN_STATE_BUS_OFF; 889 + if (reg_psr & PSR_EP) 890 + return CAN_STATE_ERROR_PASSIVE; 891 + if (reg_psr & PSR_EW) 892 + return CAN_STATE_ERROR_WARNING; 893 + 894 + return CAN_STATE_ERROR_ACTIVE; 895 + } 896 + 897 + static int m_can_handle_state_errors(struct net_device *dev) 890 898 { 891 899 struct m_can_classdev *cdev = netdev_priv(dev); 892 - int work_done = 0; 900 + enum can_state new_state; 893 901 894 - if (psr & PSR_EW && cdev->can.state != CAN_STATE_ERROR_WARNING) { 895 - netdev_dbg(dev, "entered error warning state\n"); 896 - work_done += m_can_handle_state_change(dev, 897 - CAN_STATE_ERROR_WARNING); 898 - } 902 + new_state = m_can_state_get_by_psr(cdev); 903 + if (new_state == cdev->can.state) 904 + return 0; 899 905 900 - if (psr & PSR_EP && cdev->can.state != CAN_STATE_ERROR_PASSIVE) { 901 - netdev_dbg(dev, "entered error passive state\n"); 902 - work_done += m_can_handle_state_change(dev, 903 - CAN_STATE_ERROR_PASSIVE); 904 - } 905 - 906 - if (psr & PSR_BO && cdev->can.state != CAN_STATE_BUS_OFF) { 907 - netdev_dbg(dev, "entered error bus off state\n"); 908 - work_done += m_can_handle_state_change(dev, 909 - CAN_STATE_BUS_OFF); 910 - } 911 - 912 - return work_done; 906 + return m_can_handle_state_change(dev, new_state); 913 907 } 914 908 915 909 static void m_can_handle_other_err(struct net_device *dev, u32 irqstatus) ··· 1043 1031 } 1044 1032 1045 1033 if (irqstatus & IR_ERR_STATE) 1046 - work_done += m_can_handle_state_errors(dev, 1047 - m_can_read(cdev, M_CAN_PSR)); 1034 + work_done += m_can_handle_state_errors(dev); 1048 1035 1049 1036 if (irqstatus & IR_ERR_BUS_30X) 1050 1037 work_done += m_can_handle_bus_errors(dev, irqstatus, ··· 1617 1606 netdev_queue_set_dql_min_limit(netdev_get_tx_queue(cdev->net, 0), 1618 1607 cdev->tx_max_coalesced_frames); 1619 1608 1620 - cdev->can.state = CAN_STATE_ERROR_ACTIVE; 1609 + cdev->can.state = m_can_state_get_by_psr(cdev); 1621 1610 1622 1611 m_can_enable_all_interrupts(cdev); 1623 1612 ··· 2503 2492 } 2504 2493 2505 2494 m_can_clk_stop(cdev); 2495 + cdev->can.state = CAN_STATE_SLEEPING; 2506 2496 } 2507 2497 2508 2498 pinctrl_pm_select_sleep_state(dev); 2509 - 2510 - cdev->can.state = CAN_STATE_SLEEPING; 2511 2499 2512 2500 return ret; 2513 2501 } ··· 2519 2509 int ret = 0; 2520 2510 2521 2511 pinctrl_pm_select_default_state(dev); 2522 - 2523 - cdev->can.state = CAN_STATE_ERROR_ACTIVE; 2524 2512 2525 2513 if (netif_running(ndev)) { 2526 2514 ret = m_can_clk_start(cdev); ··· 2537 2529 if (cdev->ops->init) 2538 2530 ret = cdev->ops->init(cdev); 2539 2531 2532 + cdev->can.state = m_can_state_get_by_psr(cdev); 2533 + 2540 2534 m_can_write(cdev, M_CAN_IE, cdev->active_interrupts); 2541 2535 } else { 2542 2536 ret = m_can_start(ndev); ··· 2556 2546 } 2557 2547 EXPORT_SYMBOL_GPL(m_can_class_resume); 2558 2548 2559 - MODULE_AUTHOR("Dong Aisheng <b29396@freescale.com>"); 2549 + MODULE_AUTHOR("Dong Aisheng <aisheng.dong@nxp.com>"); 2560 2550 MODULE_AUTHOR("Dan Murphy <dmurphy@ti.com>"); 2561 2551 MODULE_LICENSE("GPL v2"); 2562 2552 MODULE_DESCRIPTION("CAN bus driver for Bosch M_CAN controller");
+3 -3
drivers/net/can/m_can/m_can_platform.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 // IOMapped CAN bus driver for Bosch M_CAN controller 3 3 // Copyright (C) 2014 Freescale Semiconductor, Inc. 4 - // Dong Aisheng <b29396@freescale.com> 4 + // Dong Aisheng <aisheng.dong@nxp.com> 5 5 // 6 6 // Copyright (C) 2018-19 Texas Instruments Incorporated - http://www.ti.com/ 7 7 ··· 180 180 struct m_can_classdev *mcan_class = &priv->cdev; 181 181 182 182 m_can_class_unregister(mcan_class); 183 - 183 + pm_runtime_disable(mcan_class->dev); 184 184 m_can_class_free_dev(mcan_class->net); 185 185 } 186 186 ··· 236 236 237 237 module_platform_driver(m_can_plat_driver); 238 238 239 - MODULE_AUTHOR("Dong Aisheng <b29396@freescale.com>"); 239 + MODULE_AUTHOR("Dong Aisheng <aisheng.dong@nxp.com>"); 240 240 MODULE_AUTHOR("Dan Murphy <dmurphy@ti.com>"); 241 241 MODULE_LICENSE("GPL v2"); 242 242 MODULE_DESCRIPTION("M_CAN driver for IO Mapped Bosch controllers");
+11 -12
drivers/net/can/usb/gs_usb.c
··· 289 289 #define GS_MAX_RX_URBS 30 290 290 #define GS_NAPI_WEIGHT 32 291 291 292 - /* Maximum number of interfaces the driver supports per device. 293 - * Current hardware only supports 3 interfaces. The future may vary. 294 - */ 295 - #define GS_MAX_INTF 3 296 - 297 292 struct gs_tx_context { 298 293 struct gs_can *dev; 299 294 unsigned int echo_id; ··· 319 324 320 325 /* usb interface struct */ 321 326 struct gs_usb { 322 - struct gs_can *canch[GS_MAX_INTF]; 323 327 struct usb_anchor rx_submitted; 324 328 struct usb_device *udev; 325 329 ··· 330 336 331 337 unsigned int hf_size_rx; 332 338 u8 active_channels; 339 + u8 channel_cnt; 333 340 334 341 unsigned int pipe_in; 335 342 unsigned int pipe_out; 343 + struct gs_can *canch[] __counted_by(channel_cnt); 336 344 }; 337 345 338 346 /* 'allocate' a tx context. ··· 595 599 } 596 600 597 601 /* device reports out of range channel id */ 598 - if (hf->channel >= GS_MAX_INTF) 602 + if (hf->channel >= parent->channel_cnt) 599 603 goto device_detach; 600 604 601 605 dev = parent->canch[hf->channel]; ··· 695 699 /* USB failure take down all interfaces */ 696 700 if (rc == -ENODEV) { 697 701 device_detach: 698 - for (rc = 0; rc < GS_MAX_INTF; rc++) { 702 + for (rc = 0; rc < parent->channel_cnt; rc++) { 699 703 if (parent->canch[rc]) 700 704 netif_device_detach(parent->canch[rc]->netdev); 701 705 } ··· 1245 1249 1246 1250 netdev->flags |= IFF_ECHO; /* we support full roundtrip echo */ 1247 1251 netdev->dev_id = channel; 1252 + netdev->dev_port = channel; 1248 1253 1249 1254 /* dev setup */ 1250 1255 strcpy(dev->bt_const.name, KBUILD_MODNAME); ··· 1457 1460 icount = dconf.icount + 1; 1458 1461 dev_info(&intf->dev, "Configuring for %u interfaces\n", icount); 1459 1462 1460 - if (icount > GS_MAX_INTF) { 1463 + if (icount > type_max(parent->channel_cnt)) { 1461 1464 dev_err(&intf->dev, 1462 1465 "Driver cannot handle more that %u CAN interfaces\n", 1463 - GS_MAX_INTF); 1466 + type_max(parent->channel_cnt)); 1464 1467 return -EINVAL; 1465 1468 } 1466 1469 1467 - parent = kzalloc(sizeof(*parent), GFP_KERNEL); 1470 + parent = kzalloc(struct_size(parent, canch, icount), GFP_KERNEL); 1468 1471 if (!parent) 1469 1472 return -ENOMEM; 1473 + 1474 + parent->channel_cnt = icount; 1470 1475 1471 1476 init_usb_anchor(&parent->rx_submitted); 1472 1477 ··· 1530 1531 return; 1531 1532 } 1532 1533 1533 - for (i = 0; i < GS_MAX_INTF; i++) 1534 + for (i = 0; i < parent->channel_cnt; i++) 1534 1535 if (parent->canch[i]) 1535 1536 gs_destroy_candev(parent->canch[i]); 1536 1537
+15 -1
drivers/net/ethernet/airoha/airoha_eth.c
··· 1873 1873 #endif 1874 1874 } 1875 1875 1876 + static bool airoha_dev_tx_queue_busy(struct airoha_queue *q, u32 nr_frags) 1877 + { 1878 + u32 tail = q->tail <= q->head ? q->tail + q->ndesc : q->tail; 1879 + u32 index = q->head + nr_frags; 1880 + 1881 + /* completion napi can free out-of-order tx descriptors if hw QoS is 1882 + * enabled and packets with different priorities are queued to the same 1883 + * DMA ring. Take into account possible out-of-order reports checking 1884 + * if the tx queue is full using circular buffer head/tail pointers 1885 + * instead of the number of queued packets. 1886 + */ 1887 + return index >= tail; 1888 + } 1889 + 1876 1890 static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb, 1877 1891 struct net_device *dev) 1878 1892 { ··· 1940 1926 txq = netdev_get_tx_queue(dev, qid); 1941 1927 nr_frags = 1 + skb_shinfo(skb)->nr_frags; 1942 1928 1943 - if (q->queued + nr_frags > q->ndesc) { 1929 + if (airoha_dev_tx_queue_busy(q, nr_frags)) { 1944 1930 /* not enough space in the queue */ 1945 1931 netif_tx_stop_queue(txq); 1946 1932 spin_unlock_bh(&q->lock);
-1
drivers/net/ethernet/amd/xgbe/xgbe-drv.c
··· 1080 1080 1081 1081 static int xgbe_phy_reset(struct xgbe_prv_data *pdata) 1082 1082 { 1083 - pdata->phy_link = -1; 1084 1083 pdata->phy_speed = SPEED_UNKNOWN; 1085 1084 1086 1085 return pdata->phy_if.phy_reset(pdata);
+1
drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
··· 1555 1555 pdata->phy.duplex = DUPLEX_FULL; 1556 1556 } 1557 1557 1558 + pdata->phy_link = 0; 1558 1559 pdata->phy.link = 0; 1559 1560 1560 1561 pdata->phy.pause_autoneg = pdata->pause_autoneg;
+1 -4
drivers/net/ethernet/broadcom/tg3.c
··· 5803 5803 u32 current_speed = SPEED_UNKNOWN; 5804 5804 u8 current_duplex = DUPLEX_UNKNOWN; 5805 5805 bool current_link_up = false; 5806 - u32 local_adv, remote_adv, sgsr; 5806 + u32 local_adv = 0, remote_adv = 0, sgsr; 5807 5807 5808 5808 if ((tg3_asic_rev(tp) == ASIC_REV_5719 || 5809 5809 tg3_asic_rev(tp) == ASIC_REV_5720) && ··· 5943 5943 current_duplex = DUPLEX_FULL; 5944 5944 else 5945 5945 current_duplex = DUPLEX_HALF; 5946 - 5947 - local_adv = 0; 5948 - remote_adv = 0; 5949 5946 5950 5947 if (bmcr & BMCR_ANENABLE) { 5951 5948 u32 common;
+16 -7
drivers/net/ethernet/dlink/dl2k.c
··· 508 508 for (i = 0; i < RX_RING_SIZE; i++) { 509 509 /* Allocated fixed size of skbuff */ 510 510 struct sk_buff *skb; 511 + dma_addr_t addr; 511 512 512 513 skb = netdev_alloc_skb_ip_align(dev, np->rx_buf_sz); 513 514 np->rx_skbuff[i] = skb; 514 - if (!skb) { 515 - free_list(dev); 516 - return -ENOMEM; 517 - } 515 + if (!skb) 516 + goto err_free_list; 517 + 518 + addr = dma_map_single(&np->pdev->dev, skb->data, 519 + np->rx_buf_sz, DMA_FROM_DEVICE); 520 + if (dma_mapping_error(&np->pdev->dev, addr)) 521 + goto err_kfree_skb; 518 522 519 523 np->rx_ring[i].next_desc = cpu_to_le64(np->rx_ring_dma + 520 524 ((i + 1) % RX_RING_SIZE) * 521 525 sizeof(struct netdev_desc)); 522 526 /* Rubicon now supports 40 bits of addressing space. */ 523 - np->rx_ring[i].fraginfo = 524 - cpu_to_le64(dma_map_single(&np->pdev->dev, skb->data, 525 - np->rx_buf_sz, DMA_FROM_DEVICE)); 527 + np->rx_ring[i].fraginfo = cpu_to_le64(addr); 526 528 np->rx_ring[i].fraginfo |= cpu_to_le64((u64)np->rx_buf_sz << 48); 527 529 } 528 530 529 531 return 0; 532 + 533 + err_kfree_skb: 534 + dev_kfree_skb(np->rx_skbuff[i]); 535 + np->rx_skbuff[i] = NULL; 536 + err_free_list: 537 + free_list(dev); 538 + return -ENOMEM; 530 539 } 531 540 532 541 static void rio_hw_init(struct net_device *dev)
+2
drivers/net/ethernet/google/gve/gve.h
··· 100 100 */ 101 101 #define GVE_DQO_QPL_ONDEMAND_ALLOC_THRESHOLD 96 102 102 103 + #define GVE_DQO_RX_HWTSTAMP_VALID 0x1 104 + 103 105 /* Each slot in the desc ring has a 1:1 mapping to a slot in the data ring */ 104 106 struct gve_rx_desc_queue { 105 107 struct gve_rx_desc *desc_ring; /* the descriptor ring */
+2 -1
drivers/net/ethernet/google/gve/gve_desc_dqo.h
··· 236 236 237 237 u8 status_error1; 238 238 239 - __le16 reserved5; 239 + u8 reserved5; 240 + u8 ts_sub_nsecs_low; 240 241 __le16 buf_id; /* Buffer ID which was sent on the buffer queue. */ 241 242 242 243 union {
+11 -5
drivers/net/ethernet/google/gve/gve_rx_dqo.c
··· 456 456 * Note that this means if the time delta between packet reception and the last 457 457 * clock read is greater than ~2 seconds, this will provide invalid results. 458 458 */ 459 - static void gve_rx_skb_hwtstamp(struct gve_rx_ring *rx, u32 hwts) 459 + static void gve_rx_skb_hwtstamp(struct gve_rx_ring *rx, 460 + const struct gve_rx_compl_desc_dqo *desc) 460 461 { 461 462 u64 last_read = READ_ONCE(rx->gve->last_sync_nic_counter); 462 463 struct sk_buff *skb = rx->ctx.skb_head; 463 - u32 low = (u32)last_read; 464 - s32 diff = hwts - low; 464 + u32 ts, low; 465 + s32 diff; 465 466 466 - skb_hwtstamps(skb)->hwtstamp = ns_to_ktime(last_read + diff); 467 + if (desc->ts_sub_nsecs_low & GVE_DQO_RX_HWTSTAMP_VALID) { 468 + ts = le32_to_cpu(desc->ts); 469 + low = (u32)last_read; 470 + diff = ts - low; 471 + skb_hwtstamps(skb)->hwtstamp = ns_to_ktime(last_read + diff); 472 + } 467 473 } 468 474 469 475 static void gve_rx_free_skb(struct napi_struct *napi, struct gve_rx_ring *rx) ··· 950 944 gve_rx_skb_csum(rx->ctx.skb_head, desc, ptype); 951 945 952 946 if (rx->gve->ts_config.rx_filter == HWTSTAMP_FILTER_ALL) 953 - gve_rx_skb_hwtstamp(rx, le32_to_cpu(desc->ts)); 947 + gve_rx_skb_hwtstamp(rx, desc); 954 948 955 949 /* RSC packets must set gso_size otherwise the TCP stack will complain 956 950 * that packets are larger than MTU.
+3
drivers/net/ethernet/intel/idpf/idpf_ptp.c
··· 863 863 u64_stats_inc(&vport->tstamp_stats.flushed); 864 864 865 865 list_del(&ptp_tx_tstamp->list_member); 866 + if (ptp_tx_tstamp->skb) 867 + consume_skb(ptp_tx_tstamp->skb); 868 + 866 869 kfree(ptp_tx_tstamp); 867 870 } 868 871 u64_stats_update_end(&vport->tstamp_stats.stats_sync);
+1
drivers/net/ethernet/intel/idpf/idpf_virtchnl_ptp.c
··· 517 517 shhwtstamps.hwtstamp = ns_to_ktime(tstamp); 518 518 skb_tstamp_tx(ptp_tx_tstamp->skb, &shhwtstamps); 519 519 consume_skb(ptp_tx_tstamp->skb); 520 + ptp_tx_tstamp->skb = NULL; 520 521 521 522 list_add(&ptp_tx_tstamp->list_member, 522 523 &tx_tstamp_caps->latches_free);
+2 -1
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
··· 12101 12101 12102 12102 devl_port_unregister(&adapter->devlink_port); 12103 12103 devl_unlock(adapter->devlink); 12104 - devlink_free(adapter->devlink); 12105 12104 12106 12105 ixgbe_stop_ipsec_offload(adapter); 12107 12106 ixgbe_clear_interrupt_scheme(adapter); ··· 12136 12137 12137 12138 if (disable_dev) 12138 12139 pci_disable_device(pdev); 12140 + 12141 + devlink_free(adapter->devlink); 12139 12142 } 12140 12143 12141 12144 /**
+15
drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h
··· 50 50 ixgbe_mbox_api_12, /* API version 1.2, linux/freebsd VF driver */ 51 51 ixgbe_mbox_api_13, /* API version 1.3, linux/freebsd VF driver */ 52 52 ixgbe_mbox_api_14, /* API version 1.4, linux/freebsd VF driver */ 53 + ixgbe_mbox_api_15, /* API version 1.5, linux/freebsd VF driver */ 54 + ixgbe_mbox_api_16, /* API version 1.6, linux/freebsd VF driver */ 55 + ixgbe_mbox_api_17, /* API version 1.7, linux/freebsd VF driver */ 53 56 /* This value should always be last */ 54 57 ixgbe_mbox_api_unknown, /* indicates that API version is not known */ 55 58 }; ··· 89 86 90 87 #define IXGBE_VF_GET_LINK_STATE 0x10 /* get vf link state */ 91 88 89 + /* mailbox API, version 1.6 VF requests */ 90 + #define IXGBE_VF_GET_PF_LINK_STATE 0x11 /* request PF to send link info */ 91 + 92 + /* mailbox API, version 1.7 VF requests */ 93 + #define IXGBE_VF_FEATURES_NEGOTIATE 0x12 /* get features supported by PF */ 94 + 92 95 /* length of permanent address message returned from PF */ 93 96 #define IXGBE_VF_PERMADDR_MSG_LEN 4 94 97 /* word in permanent address message with the current multicast type */ ··· 104 95 105 96 #define IXGBE_VF_MBX_INIT_TIMEOUT 2000 /* number of retries on mailbox */ 106 97 #define IXGBE_VF_MBX_INIT_DELAY 500 /* microseconds between retries */ 98 + 99 + /* features negotiated between PF/VF */ 100 + #define IXGBEVF_PF_SUP_IPSEC BIT(0) 101 + #define IXGBEVF_PF_SUP_ESX_MBX BIT(1) 102 + 103 + #define IXGBE_SUPPORTED_FEATURES IXGBEVF_PF_SUP_IPSEC 107 104 108 105 struct ixgbe_hw; 109 106
+79
drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
··· 510 510 case ixgbe_mbox_api_12: 511 511 case ixgbe_mbox_api_13: 512 512 case ixgbe_mbox_api_14: 513 + case ixgbe_mbox_api_16: 514 + case ixgbe_mbox_api_17: 513 515 /* Version 1.1 supports jumbo frames on VFs if PF has 514 516 * jumbo frames enabled which means legacy VFs are 515 517 * disabled ··· 1048 1046 case ixgbe_mbox_api_12: 1049 1047 case ixgbe_mbox_api_13: 1050 1048 case ixgbe_mbox_api_14: 1049 + case ixgbe_mbox_api_16: 1050 + case ixgbe_mbox_api_17: 1051 1051 adapter->vfinfo[vf].vf_api = api; 1052 1052 return 0; 1053 1053 default: ··· 1076 1072 case ixgbe_mbox_api_12: 1077 1073 case ixgbe_mbox_api_13: 1078 1074 case ixgbe_mbox_api_14: 1075 + case ixgbe_mbox_api_16: 1076 + case ixgbe_mbox_api_17: 1079 1077 break; 1080 1078 default: 1081 1079 return -1; ··· 1118 1112 1119 1113 /* verify the PF is supporting the correct API */ 1120 1114 switch (adapter->vfinfo[vf].vf_api) { 1115 + case ixgbe_mbox_api_17: 1116 + case ixgbe_mbox_api_16: 1121 1117 case ixgbe_mbox_api_14: 1122 1118 case ixgbe_mbox_api_13: 1123 1119 case ixgbe_mbox_api_12: ··· 1153 1145 1154 1146 /* verify the PF is supporting the correct API */ 1155 1147 switch (adapter->vfinfo[vf].vf_api) { 1148 + case ixgbe_mbox_api_17: 1149 + case ixgbe_mbox_api_16: 1156 1150 case ixgbe_mbox_api_14: 1157 1151 case ixgbe_mbox_api_13: 1158 1152 case ixgbe_mbox_api_12: ··· 1184 1174 fallthrough; 1185 1175 case ixgbe_mbox_api_13: 1186 1176 case ixgbe_mbox_api_14: 1177 + case ixgbe_mbox_api_16: 1178 + case ixgbe_mbox_api_17: 1187 1179 break; 1188 1180 default: 1189 1181 return -EOPNOTSUPP; ··· 1256 1244 case ixgbe_mbox_api_12: 1257 1245 case ixgbe_mbox_api_13: 1258 1246 case ixgbe_mbox_api_14: 1247 + case ixgbe_mbox_api_16: 1248 + case ixgbe_mbox_api_17: 1259 1249 break; 1260 1250 default: 1261 1251 return -EOPNOTSUPP; 1262 1252 } 1263 1253 1264 1254 *link_state = adapter->vfinfo[vf].link_enable; 1255 + 1256 + return 0; 1257 + } 1258 + 1259 + /** 1260 + * ixgbe_send_vf_link_status - send link status data to VF 1261 + * @adapter: pointer to adapter struct 1262 + * @msgbuf: pointer to message buffers 1263 + * @vf: VF identifier 1264 + * 1265 + * Reply for IXGBE_VF_GET_PF_LINK_STATE mbox command sending link status data. 1266 + * 1267 + * Return: 0 on success or -EOPNOTSUPP when operation is not supported. 1268 + */ 1269 + static int ixgbe_send_vf_link_status(struct ixgbe_adapter *adapter, 1270 + u32 *msgbuf, u32 vf) 1271 + { 1272 + struct ixgbe_hw *hw = &adapter->hw; 1273 + 1274 + switch (adapter->vfinfo[vf].vf_api) { 1275 + case ixgbe_mbox_api_16: 1276 + case ixgbe_mbox_api_17: 1277 + if (hw->mac.type != ixgbe_mac_e610) 1278 + return -EOPNOTSUPP; 1279 + break; 1280 + default: 1281 + return -EOPNOTSUPP; 1282 + } 1283 + /* Simply provide stored values as watchdog & link status events take 1284 + * care of its freshness. 1285 + */ 1286 + msgbuf[1] = adapter->link_speed; 1287 + msgbuf[2] = adapter->link_up; 1288 + 1289 + return 0; 1290 + } 1291 + 1292 + /** 1293 + * ixgbe_negotiate_vf_features - negotiate supported features with VF driver 1294 + * @adapter: pointer to adapter struct 1295 + * @msgbuf: pointer to message buffers 1296 + * @vf: VF identifier 1297 + * 1298 + * Return: 0 on success or -EOPNOTSUPP when operation is not supported. 1299 + */ 1300 + static int ixgbe_negotiate_vf_features(struct ixgbe_adapter *adapter, 1301 + u32 *msgbuf, u32 vf) 1302 + { 1303 + u32 features = msgbuf[1]; 1304 + 1305 + switch (adapter->vfinfo[vf].vf_api) { 1306 + case ixgbe_mbox_api_17: 1307 + break; 1308 + default: 1309 + return -EOPNOTSUPP; 1310 + } 1311 + 1312 + features &= IXGBE_SUPPORTED_FEATURES; 1313 + msgbuf[1] = features; 1265 1314 1266 1315 return 0; 1267 1316 } ··· 1400 1327 break; 1401 1328 case IXGBE_VF_IPSEC_DEL: 1402 1329 retval = ixgbe_ipsec_vf_del_sa(adapter, msgbuf, vf); 1330 + break; 1331 + case IXGBE_VF_GET_PF_LINK_STATE: 1332 + retval = ixgbe_send_vf_link_status(adapter, msgbuf, vf); 1333 + break; 1334 + case IXGBE_VF_FEATURES_NEGOTIATE: 1335 + retval = ixgbe_negotiate_vf_features(adapter, msgbuf, vf); 1403 1336 break; 1404 1337 default: 1405 1338 e_err(drv, "Unhandled Msg %8.8x\n", msgbuf[0]);
+1
drivers/net/ethernet/intel/ixgbevf/defines.h
··· 28 28 29 29 /* Link speed */ 30 30 typedef u32 ixgbe_link_speed; 31 + #define IXGBE_LINK_SPEED_UNKNOWN 0 31 32 #define IXGBE_LINK_SPEED_1GB_FULL 0x0020 32 33 #define IXGBE_LINK_SPEED_10GB_FULL 0x0080 33 34 #define IXGBE_LINK_SPEED_100_FULL 0x0008
+10
drivers/net/ethernet/intel/ixgbevf/ipsec.c
··· 273 273 adapter = netdev_priv(dev); 274 274 ipsec = adapter->ipsec; 275 275 276 + if (!(adapter->pf_features & IXGBEVF_PF_SUP_IPSEC)) 277 + return -EOPNOTSUPP; 278 + 276 279 if (xs->id.proto != IPPROTO_ESP && xs->id.proto != IPPROTO_AH) { 277 280 NL_SET_ERR_MSG_MOD(extack, "Unsupported protocol for IPsec offload"); 278 281 return -EINVAL; ··· 407 404 408 405 adapter = netdev_priv(dev); 409 406 ipsec = adapter->ipsec; 407 + 408 + if (!(adapter->pf_features & IXGBEVF_PF_SUP_IPSEC)) 409 + return; 410 410 411 411 if (xs->xso.dir == XFRM_DEV_OFFLOAD_IN) { 412 412 sa_idx = xs->xso.offload_handle - IXGBE_IPSEC_BASE_RX_INDEX; ··· 618 612 size_t size; 619 613 620 614 switch (adapter->hw.api_version) { 615 + case ixgbe_mbox_api_17: 616 + if (!(adapter->pf_features & IXGBEVF_PF_SUP_IPSEC)) 617 + return; 618 + break; 621 619 case ixgbe_mbox_api_14: 622 620 break; 623 621 default:
+7
drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
··· 363 363 struct ixgbe_hw hw; 364 364 u16 msg_enable; 365 365 366 + u32 pf_features; 367 + #define IXGBEVF_PF_SUP_IPSEC BIT(0) 368 + #define IXGBEVF_PF_SUP_ESX_MBX BIT(1) 369 + 370 + #define IXGBEVF_SUPPORTED_FEATURES (IXGBEVF_PF_SUP_IPSEC | \ 371 + IXGBEVF_PF_SUP_ESX_MBX) 372 + 366 373 struct ixgbevf_hw_stats stats; 367 374 368 375 unsigned long state;
+33 -1
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
··· 2271 2271 adapter->stats.base_vfmprc = adapter->stats.last_vfmprc; 2272 2272 } 2273 2273 2274 + /** 2275 + * ixgbevf_set_features - Set features supported by PF 2276 + * @adapter: pointer to the adapter struct 2277 + * 2278 + * Negotiate with PF supported features and then set pf_features accordingly. 2279 + */ 2280 + static void ixgbevf_set_features(struct ixgbevf_adapter *adapter) 2281 + { 2282 + u32 *pf_features = &adapter->pf_features; 2283 + struct ixgbe_hw *hw = &adapter->hw; 2284 + int err; 2285 + 2286 + err = hw->mac.ops.negotiate_features(hw, pf_features); 2287 + if (err && err != -EOPNOTSUPP) 2288 + netdev_dbg(adapter->netdev, 2289 + "PF feature negotiation failed.\n"); 2290 + 2291 + /* Address also pre API 1.7 cases */ 2292 + if (hw->api_version == ixgbe_mbox_api_14) 2293 + *pf_features |= IXGBEVF_PF_SUP_IPSEC; 2294 + else if (hw->api_version == ixgbe_mbox_api_15) 2295 + *pf_features |= IXGBEVF_PF_SUP_ESX_MBX; 2296 + } 2297 + 2274 2298 static void ixgbevf_negotiate_api(struct ixgbevf_adapter *adapter) 2275 2299 { 2276 2300 struct ixgbe_hw *hw = &adapter->hw; 2277 2301 static const int api[] = { 2302 + ixgbe_mbox_api_17, 2303 + ixgbe_mbox_api_16, 2278 2304 ixgbe_mbox_api_15, 2279 2305 ixgbe_mbox_api_14, 2280 2306 ixgbe_mbox_api_13, ··· 2320 2294 idx++; 2321 2295 } 2322 2296 2323 - if (hw->api_version >= ixgbe_mbox_api_15) { 2297 + ixgbevf_set_features(adapter); 2298 + 2299 + if (adapter->pf_features & IXGBEVF_PF_SUP_ESX_MBX) { 2324 2300 hw->mbx.ops.init_params(hw); 2325 2301 memcpy(&hw->mbx.ops, &ixgbevf_mbx_ops, 2326 2302 sizeof(struct ixgbe_mbx_operations)); ··· 2679 2651 case ixgbe_mbox_api_13: 2680 2652 case ixgbe_mbox_api_14: 2681 2653 case ixgbe_mbox_api_15: 2654 + case ixgbe_mbox_api_16: 2655 + case ixgbe_mbox_api_17: 2682 2656 if (adapter->xdp_prog && 2683 2657 hw->mac.max_tx_queues == rss) 2684 2658 rss = rss > 3 ? 2 : 1; ··· 4675 4645 case ixgbe_mbox_api_13: 4676 4646 case ixgbe_mbox_api_14: 4677 4647 case ixgbe_mbox_api_15: 4648 + case ixgbe_mbox_api_16: 4649 + case ixgbe_mbox_api_17: 4678 4650 netdev->max_mtu = IXGBE_MAX_JUMBO_FRAME_SIZE - 4679 4651 (ETH_HLEN + ETH_FCS_LEN); 4680 4652 break;
+8
drivers/net/ethernet/intel/ixgbevf/mbx.h
··· 66 66 ixgbe_mbox_api_13, /* API version 1.3, linux/freebsd VF driver */ 67 67 ixgbe_mbox_api_14, /* API version 1.4, linux/freebsd VF driver */ 68 68 ixgbe_mbox_api_15, /* API version 1.5, linux/freebsd VF driver */ 69 + ixgbe_mbox_api_16, /* API version 1.6, linux/freebsd VF driver */ 70 + ixgbe_mbox_api_17, /* API version 1.7, linux/freebsd VF driver */ 69 71 /* This value should always be last */ 70 72 ixgbe_mbox_api_unknown, /* indicates that API version is not known */ 71 73 }; ··· 103 101 #define IXGBE_VF_IPSEC_DEL 0x0e 104 102 105 103 #define IXGBE_VF_GET_LINK_STATE 0x10 /* get vf link state */ 104 + 105 + /* mailbox API, version 1.6 VF requests */ 106 + #define IXGBE_VF_GET_PF_LINK_STATE 0x11 /* request PF to send link info */ 107 + 108 + /* mailbox API, version 1.7 VF requests */ 109 + #define IXGBE_VF_FEATURES_NEGOTIATE 0x12 /* get features supported by PF*/ 106 110 107 111 /* length of permanent address message returned from PF */ 108 112 #define IXGBE_VF_PERMADDR_MSG_LEN 4
+150 -32
drivers/net/ethernet/intel/ixgbevf/vf.c
··· 313 313 * is not supported for this device type. 314 314 */ 315 315 switch (hw->api_version) { 316 + case ixgbe_mbox_api_17: 317 + case ixgbe_mbox_api_16: 316 318 case ixgbe_mbox_api_15: 317 319 case ixgbe_mbox_api_14: 318 320 case ixgbe_mbox_api_13: ··· 384 382 * or if the operation is not supported for this device type. 385 383 */ 386 384 switch (hw->api_version) { 385 + case ixgbe_mbox_api_17: 386 + case ixgbe_mbox_api_16: 387 387 case ixgbe_mbox_api_15: 388 388 case ixgbe_mbox_api_14: 389 389 case ixgbe_mbox_api_13: ··· 556 552 case ixgbe_mbox_api_13: 557 553 case ixgbe_mbox_api_14: 558 554 case ixgbe_mbox_api_15: 555 + case ixgbe_mbox_api_16: 556 + case ixgbe_mbox_api_17: 559 557 break; 560 558 default: 561 559 return -EOPNOTSUPP; ··· 631 625 } 632 626 633 627 /** 628 + * ixgbevf_get_pf_link_state - Get PF's link status 629 + * @hw: pointer to the HW structure 630 + * @speed: link speed 631 + * @link_up: indicate if link is up/down 632 + * 633 + * Ask PF to provide link_up state and speed of the link. 634 + * 635 + * Return: IXGBE_ERR_MBX in the case of mailbox error, 636 + * -EOPNOTSUPP if the op is not supported or 0 on success. 637 + */ 638 + static int ixgbevf_get_pf_link_state(struct ixgbe_hw *hw, ixgbe_link_speed *speed, 639 + bool *link_up) 640 + { 641 + u32 msgbuf[3] = {}; 642 + int err; 643 + 644 + switch (hw->api_version) { 645 + case ixgbe_mbox_api_16: 646 + case ixgbe_mbox_api_17: 647 + break; 648 + default: 649 + return -EOPNOTSUPP; 650 + } 651 + 652 + msgbuf[0] = IXGBE_VF_GET_PF_LINK_STATE; 653 + 654 + err = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, 655 + ARRAY_SIZE(msgbuf)); 656 + if (err || (msgbuf[0] & IXGBE_VT_MSGTYPE_FAILURE)) { 657 + err = IXGBE_ERR_MBX; 658 + *speed = IXGBE_LINK_SPEED_UNKNOWN; 659 + /* No need to set @link_up to false as it will be done by 660 + * ixgbe_check_mac_link_vf(). 661 + */ 662 + } else { 663 + *speed = msgbuf[1]; 664 + *link_up = msgbuf[2]; 665 + } 666 + 667 + return err; 668 + } 669 + 670 + /** 671 + * ixgbevf_negotiate_features_vf - negotiate supported features with PF driver 672 + * @hw: pointer to the HW structure 673 + * @pf_features: bitmask of features supported by PF 674 + * 675 + * Return: IXGBE_ERR_MBX in the case of mailbox error, 676 + * -EOPNOTSUPP if the op is not supported or 0 on success. 677 + */ 678 + static int ixgbevf_negotiate_features_vf(struct ixgbe_hw *hw, u32 *pf_features) 679 + { 680 + u32 msgbuf[2] = {}; 681 + int err; 682 + 683 + switch (hw->api_version) { 684 + case ixgbe_mbox_api_17: 685 + break; 686 + default: 687 + return -EOPNOTSUPP; 688 + } 689 + 690 + msgbuf[0] = IXGBE_VF_FEATURES_NEGOTIATE; 691 + msgbuf[1] = IXGBEVF_SUPPORTED_FEATURES; 692 + 693 + err = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, 694 + ARRAY_SIZE(msgbuf)); 695 + 696 + if (err || (msgbuf[0] & IXGBE_VT_MSGTYPE_FAILURE)) { 697 + err = IXGBE_ERR_MBX; 698 + *pf_features = 0x0; 699 + } else { 700 + *pf_features = msgbuf[1]; 701 + } 702 + 703 + return err; 704 + } 705 + 706 + /** 634 707 * ixgbevf_set_vfta_vf - Set/Unset VLAN filter table address 635 708 * @hw: pointer to the HW structure 636 709 * @vlan: 12 bit VLAN ID ··· 741 656 742 657 mbx_err: 743 658 return err; 659 + } 660 + 661 + /** 662 + * ixgbe_read_vflinks - Read VFLINKS register 663 + * @hw: pointer to the HW structure 664 + * @speed: link speed 665 + * @link_up: indicate if link is up/down 666 + * 667 + * Get linkup status and link speed from the VFLINKS register. 668 + */ 669 + static void ixgbe_read_vflinks(struct ixgbe_hw *hw, ixgbe_link_speed *speed, 670 + bool *link_up) 671 + { 672 + u32 vflinks = IXGBE_READ_REG(hw, IXGBE_VFLINKS); 673 + 674 + /* if link status is down no point in checking to see if PF is up */ 675 + if (!(vflinks & IXGBE_LINKS_UP)) { 676 + *link_up = false; 677 + return; 678 + } 679 + 680 + /* for SFP+ modules and DA cables on 82599 it can take up to 500usecs 681 + * before the link status is correct 682 + */ 683 + if (hw->mac.type == ixgbe_mac_82599_vf) { 684 + for (int i = 0; i < 5; i++) { 685 + udelay(100); 686 + vflinks = IXGBE_READ_REG(hw, IXGBE_VFLINKS); 687 + 688 + if (!(vflinks & IXGBE_LINKS_UP)) { 689 + *link_up = false; 690 + return; 691 + } 692 + } 693 + } 694 + 695 + /* We reached this point so there's link */ 696 + *link_up = true; 697 + 698 + switch (vflinks & IXGBE_LINKS_SPEED_82599) { 699 + case IXGBE_LINKS_SPEED_10G_82599: 700 + *speed = IXGBE_LINK_SPEED_10GB_FULL; 701 + break; 702 + case IXGBE_LINKS_SPEED_1G_82599: 703 + *speed = IXGBE_LINK_SPEED_1GB_FULL; 704 + break; 705 + case IXGBE_LINKS_SPEED_100_82599: 706 + *speed = IXGBE_LINK_SPEED_100_FULL; 707 + break; 708 + default: 709 + *speed = IXGBE_LINK_SPEED_UNKNOWN; 710 + } 744 711 } 745 712 746 713 /** ··· 839 702 bool *link_up, 840 703 bool autoneg_wait_to_complete) 841 704 { 705 + struct ixgbevf_adapter *adapter = hw->back; 842 706 struct ixgbe_mbx_info *mbx = &hw->mbx; 843 707 struct ixgbe_mac_info *mac = &hw->mac; 844 708 s32 ret_val = 0; 845 - u32 links_reg; 846 709 u32 in_msg = 0; 847 710 848 711 /* If we were hit with a reset drop the link */ ··· 852 715 if (!mac->get_link_status) 853 716 goto out; 854 717 855 - /* if link status is down no point in checking to see if pf is up */ 856 - links_reg = IXGBE_READ_REG(hw, IXGBE_VFLINKS); 857 - if (!(links_reg & IXGBE_LINKS_UP)) 858 - goto out; 859 - 860 - /* for SFP+ modules and DA cables on 82599 it can take up to 500usecs 861 - * before the link status is correct 862 - */ 863 - if (mac->type == ixgbe_mac_82599_vf) { 864 - int i; 865 - 866 - for (i = 0; i < 5; i++) { 867 - udelay(100); 868 - links_reg = IXGBE_READ_REG(hw, IXGBE_VFLINKS); 869 - 870 - if (!(links_reg & IXGBE_LINKS_UP)) 871 - goto out; 872 - } 873 - } 874 - 875 - switch (links_reg & IXGBE_LINKS_SPEED_82599) { 876 - case IXGBE_LINKS_SPEED_10G_82599: 877 - *speed = IXGBE_LINK_SPEED_10GB_FULL; 878 - break; 879 - case IXGBE_LINKS_SPEED_1G_82599: 880 - *speed = IXGBE_LINK_SPEED_1GB_FULL; 881 - break; 882 - case IXGBE_LINKS_SPEED_100_82599: 883 - *speed = IXGBE_LINK_SPEED_100_FULL; 884 - break; 718 + if (hw->mac.type == ixgbe_mac_e610_vf) { 719 + ret_val = ixgbevf_get_pf_link_state(hw, speed, link_up); 720 + if (ret_val) 721 + goto out; 722 + } else { 723 + ixgbe_read_vflinks(hw, speed, link_up); 724 + if (*link_up == false) 725 + goto out; 885 726 } 886 727 887 728 /* if the read failed it could just be a mailbox collision, best wait 888 729 * until we are called again and don't report an error 889 730 */ 890 731 if (mbx->ops.read(hw, &in_msg, 1)) { 891 - if (hw->api_version >= ixgbe_mbox_api_15) 732 + if (adapter->pf_features & IXGBEVF_PF_SUP_ESX_MBX) 892 733 mac->get_link_status = false; 893 734 goto out; 894 735 } ··· 1066 951 case ixgbe_mbox_api_13: 1067 952 case ixgbe_mbox_api_14: 1068 953 case ixgbe_mbox_api_15: 954 + case ixgbe_mbox_api_16: 955 + case ixgbe_mbox_api_17: 1069 956 break; 1070 957 default: 1071 958 return 0; ··· 1122 1005 .setup_link = ixgbevf_setup_mac_link_vf, 1123 1006 .check_link = ixgbevf_check_mac_link_vf, 1124 1007 .negotiate_api_version = ixgbevf_negotiate_api_version_vf, 1008 + .negotiate_features = ixgbevf_negotiate_features_vf, 1125 1009 .set_rar = ixgbevf_set_rar_vf, 1126 1010 .update_mc_addr_list = ixgbevf_update_mc_addr_list_vf, 1127 1011 .update_xcast_mode = ixgbevf_update_xcast_mode,
+1
drivers/net/ethernet/intel/ixgbevf/vf.h
··· 26 26 s32 (*stop_adapter)(struct ixgbe_hw *); 27 27 s32 (*get_bus_info)(struct ixgbe_hw *); 28 28 s32 (*negotiate_api_version)(struct ixgbe_hw *hw, int api); 29 + int (*negotiate_features)(struct ixgbe_hw *hw, u32 *pf_features); 29 30 30 31 /* Link */ 31 32 s32 (*setup_link)(struct ixgbe_hw *, ixgbe_link_speed, bool, bool);
+1
drivers/net/ethernet/marvell/octeontx2/af/cgx.c
··· 1981 1981 !is_cgx_mapped_to_nix(pdev->subsystem_device, cgx->cgx_id)) { 1982 1982 dev_notice(dev, "CGX %d not mapped to NIX, skipping probe\n", 1983 1983 cgx->cgx_id); 1984 + err = -ENODEV; 1984 1985 goto err_release_regions; 1985 1986 } 1986 1987
+6 -2
drivers/net/ethernet/mediatek/mtk_wed.c
··· 677 677 void *buf; 678 678 int s; 679 679 680 - page = __dev_alloc_page(GFP_KERNEL); 680 + page = __dev_alloc_page(GFP_KERNEL | GFP_DMA32); 681 681 if (!page) 682 682 return -ENOMEM; 683 683 ··· 800 800 struct page *page; 801 801 int s; 802 802 803 - page = __dev_alloc_page(GFP_KERNEL); 803 + page = __dev_alloc_page(GFP_KERNEL | GFP_DMA32); 804 804 if (!page) 805 805 return -ENOMEM; 806 806 ··· 2425 2425 dev->wdma_idx = hw->index; 2426 2426 dev->version = hw->version; 2427 2427 dev->hw->pcie_base = mtk_wed_get_pcie_base(dev); 2428 + 2429 + ret = dma_set_mask_and_coherent(hw->dev, DMA_BIT_MASK(32)); 2430 + if (ret) 2431 + goto out; 2428 2432 2429 2433 if (hw->eth->dma_dev == hw->eth->dev && 2430 2434 of_dma_is_coherent(hw->eth->dev->of_node))
+3 -2
drivers/net/ethernet/realtek/r8169_main.c
··· 4994 4994 if (!device_may_wakeup(tp_to_dev(tp))) 4995 4995 clk_prepare_enable(tp->clk); 4996 4996 4997 - /* Reportedly at least Asus X453MA truncates packets otherwise */ 4998 - if (tp->mac_version == RTL_GIGA_MAC_VER_37) 4997 + /* Some chip versions may truncate packets without this initialization */ 4998 + if (tp->mac_version == RTL_GIGA_MAC_VER_37 || 4999 + tp->mac_version == RTL_GIGA_MAC_VER_46) 4999 5000 rtl_init_rxcfg(tp); 5000 5001 5001 5002 return rtl8169_runtime_resume(device);
+7
drivers/net/netdevsim/netdev.c
··· 545 545 static int nsim_open(struct net_device *dev) 546 546 { 547 547 struct netdevsim *ns = netdev_priv(dev); 548 + struct netdevsim *peer; 548 549 int err; 549 550 550 551 netdev_assert_locked(dev); ··· 555 554 return err; 556 555 557 556 nsim_enable_napi(ns); 557 + 558 + peer = rtnl_dereference(ns->peer); 559 + if (peer && netif_running(peer->netdev)) { 560 + netif_carrier_on(dev); 561 + netif_carrier_on(peer->netdev); 562 + } 558 563 559 564 return 0; 560 565 }
+19 -1
drivers/net/phy/broadcom.c
··· 405 405 static int bcm54811_config_init(struct phy_device *phydev) 406 406 { 407 407 struct bcm54xx_phy_priv *priv = phydev->priv; 408 - int err, reg, exp_sync_ethernet; 408 + int err, reg, exp_sync_ethernet, aux_rgmii_en; 409 409 410 410 /* Enable CLK125 MUX on LED4 if ref clock is enabled. */ 411 411 if (!(phydev->dev_flags & PHY_BRCM_RX_REFCLK_UNUSED)) { ··· 431 431 err = bcm_phy_modify_exp(phydev, BCM_EXP_SYNC_ETHERNET, 432 432 BCM_EXP_SYNC_ETHERNET_MII_LITE, 433 433 exp_sync_ethernet); 434 + if (err < 0) 435 + return err; 436 + 437 + /* Enable RGMII if configured */ 438 + if (phy_interface_is_rgmii(phydev)) 439 + aux_rgmii_en = MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_EN | 440 + MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN; 441 + else 442 + aux_rgmii_en = 0; 443 + 444 + /* Also writing Reserved bits 6:5 because the documentation requires 445 + * them to be written to 0b11 446 + */ 447 + err = bcm54xx_auxctl_write(phydev, 448 + MII_BCM54XX_AUXCTL_SHDWSEL_MISC, 449 + MII_BCM54XX_AUXCTL_MISC_WREN | 450 + aux_rgmii_en | 451 + MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RSVD); 434 452 if (err < 0) 435 453 return err; 436 454
+11 -12
drivers/net/phy/realtek/realtek_main.c
··· 633 633 str_enabled_disabled(val_rxdly)); 634 634 } 635 635 636 + if (!priv->has_phycr2) 637 + return 0; 638 + 636 639 /* Disable PHY-mode EEE so LPI is passed to the MAC */ 637 640 ret = phy_modify_paged(phydev, RTL8211F_PHYCR_PAGE, RTL8211F_PHYCR2, 638 641 RTL8211F_PHYCR2_PHY_EEE_ENABLE, 0); 639 642 if (ret) 640 643 return ret; 641 644 642 - if (priv->has_phycr2) { 643 - ret = phy_modify_paged(phydev, RTL8211F_PHYCR_PAGE, 644 - RTL8211F_PHYCR2, RTL8211F_CLKOUT_EN, 645 - priv->phycr2); 646 - if (ret < 0) { 647 - dev_err(dev, "clkout configuration failed: %pe\n", 648 - ERR_PTR(ret)); 649 - return ret; 650 - } 651 - 652 - return genphy_soft_reset(phydev); 645 + ret = phy_modify_paged(phydev, RTL8211F_PHYCR_PAGE, 646 + RTL8211F_PHYCR2, RTL8211F_CLKOUT_EN, 647 + priv->phycr2); 648 + if (ret < 0) { 649 + dev_err(dev, "clkout configuration failed: %pe\n", 650 + ERR_PTR(ret)); 651 + return ret; 653 652 } 654 653 655 - return 0; 654 + return genphy_soft_reset(phydev); 656 655 } 657 656 658 657 static int rtl821x_suspend(struct phy_device *phydev)
+11 -8
drivers/net/usb/lan78xx.c
··· 1175 1175 } 1176 1176 1177 1177 write_raw_eeprom_done: 1178 - if (dev->chipid == ID_REV_CHIP_ID_7800_) 1179 - return lan78xx_write_reg(dev, HW_CFG, saved); 1180 - 1181 - return 0; 1178 + if (dev->chipid == ID_REV_CHIP_ID_7800_) { 1179 + int rc = lan78xx_write_reg(dev, HW_CFG, saved); 1180 + /* If USB fails, there is nothing to do */ 1181 + if (rc < 0) 1182 + return rc; 1183 + } 1184 + return ret; 1182 1185 } 1183 1186 1184 1187 static int lan78xx_read_raw_otp(struct lan78xx_net *dev, u32 offset, ··· 3250 3247 } 3251 3248 } while (buf & HW_CFG_LRST_); 3252 3249 3253 - ret = lan78xx_init_mac_address(dev); 3254 - if (ret < 0) 3255 - return ret; 3256 - 3257 3250 /* save DEVID for later usage */ 3258 3251 ret = lan78xx_read_reg(dev, ID_REV, &buf); 3259 3252 if (ret < 0) ··· 3257 3258 3258 3259 dev->chipid = (buf & ID_REV_CHIP_ID_MASK_) >> 16; 3259 3260 dev->chiprev = buf & ID_REV_CHIP_REV_MASK_; 3261 + 3262 + ret = lan78xx_init_mac_address(dev); 3263 + if (ret < 0) 3264 + return ret; 3260 3265 3261 3266 /* Respond to the IN token with a NAK */ 3262 3267 ret = lan78xx_read_reg(dev, USB_CFG0, &buf);
+6 -1
drivers/net/usb/r8152.c
··· 10122 10122 ret = usb_register_device_driver(&rtl8152_cfgselector_driver, THIS_MODULE); 10123 10123 if (ret) 10124 10124 return ret; 10125 - return usb_register(&rtl8152_driver); 10125 + 10126 + ret = usb_register(&rtl8152_driver); 10127 + if (ret) 10128 + usb_deregister_device_driver(&rtl8152_cfgselector_driver); 10129 + 10130 + return ret; 10126 10131 } 10127 10132 10128 10133 static void __exit rtl8152_driver_exit(void)
+2
drivers/net/usb/usbnet.c
··· 702 702 struct sk_buff *skb; 703 703 int num = 0; 704 704 705 + local_bh_disable(); 705 706 clear_bit(EVENT_RX_PAUSED, &dev->flags); 706 707 707 708 while ((skb = skb_dequeue(&dev->rxq_pause)) != NULL) { ··· 711 710 } 712 711 713 712 queue_work(system_bh_wq, &dev->bh_work); 713 + local_bh_enable(); 714 714 715 715 netif_dbg(dev, rx_status, dev->net, 716 716 "paused rx queue disabled, %d skbs requeued\n", num);
+1
include/linux/brcmphy.h
··· 137 137 138 138 #define MII_BCM54XX_AUXCTL_SHDWSEL_MISC 0x07 139 139 #define MII_BCM54XX_AUXCTL_SHDWSEL_MISC_WIRESPEED_EN 0x0010 140 + #define MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RSVD 0x0060 140 141 #define MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_EN 0x0080 141 142 #define MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN 0x0100 142 143 #define MII_BCM54XX_AUXCTL_MISC_FORCE_AMDIX 0x0200
+15
include/net/ip_tunnels.h
··· 611 611 int skb_tunnel_check_pmtu(struct sk_buff *skb, struct dst_entry *encap_dst, 612 612 int headroom, bool reply); 613 613 614 + static inline void ip_tunnel_adj_headroom(struct net_device *dev, 615 + unsigned int headroom) 616 + { 617 + /* we must cap headroom to some upperlimit, else pskb_expand_head 618 + * will overflow header offsets in skb_headers_offset_update(). 619 + */ 620 + const unsigned int max_allowed = 512; 621 + 622 + if (headroom > max_allowed) 623 + headroom = max_allowed; 624 + 625 + if (headroom > READ_ONCE(dev->needed_headroom)) 626 + WRITE_ONCE(dev->needed_headroom, headroom); 627 + } 628 + 614 629 int iptunnel_handle_offloads(struct sk_buff *skb, int gso_type_mask); 615 630 616 631 static inline int iptunnel_pull_offloads(struct sk_buff *skb)
+2
net/can/j1939/main.c
··· 378 378 j1939_ecu_unmap_all(priv); 379 379 break; 380 380 case NETDEV_UNREGISTER: 381 + j1939_cancel_active_session(priv, NULL); 382 + j1939_sk_netdev_event_netdown(priv); 381 383 j1939_sk_netdev_event_unregister(priv); 382 384 break; 383 385 }
+35 -5
net/core/dev.c
··· 12176 12176 } 12177 12177 } 12178 12178 12179 + /* devices must be UP and netdev_lock()'d */ 12180 + static void netif_close_many_and_unlock(struct list_head *close_head) 12181 + { 12182 + struct net_device *dev, *tmp; 12183 + 12184 + netif_close_many(close_head, false); 12185 + 12186 + /* ... now unlock them */ 12187 + list_for_each_entry_safe(dev, tmp, close_head, close_list) { 12188 + netdev_unlock(dev); 12189 + list_del_init(&dev->close_list); 12190 + } 12191 + } 12192 + 12193 + static void netif_close_many_and_unlock_cond(struct list_head *close_head) 12194 + { 12195 + #ifdef CONFIG_LOCKDEP 12196 + /* We can only track up to MAX_LOCK_DEPTH locks per task. 12197 + * 12198 + * Reserve half the available slots for additional locks possibly 12199 + * taken by notifiers and (soft)irqs. 12200 + */ 12201 + unsigned int limit = MAX_LOCK_DEPTH / 2; 12202 + 12203 + if (lockdep_depth(current) > limit) 12204 + netif_close_many_and_unlock(close_head); 12205 + #endif 12206 + } 12207 + 12179 12208 void unregister_netdevice_many_notify(struct list_head *head, 12180 12209 u32 portid, const struct nlmsghdr *nlh) 12181 12210 { ··· 12237 12208 12238 12209 /* If device is running, close it first. Start with ops locked... */ 12239 12210 list_for_each_entry(dev, head, unreg_list) { 12211 + if (!(dev->flags & IFF_UP)) 12212 + continue; 12240 12213 if (netdev_need_ops_lock(dev)) { 12241 12214 list_add_tail(&dev->close_list, &close_head); 12242 12215 netdev_lock(dev); 12243 12216 } 12217 + netif_close_many_and_unlock_cond(&close_head); 12244 12218 } 12245 - netif_close_many(&close_head, true); 12246 - /* ... now unlock them and go over the rest. */ 12219 + netif_close_many_and_unlock(&close_head); 12220 + /* ... now go over the rest. */ 12247 12221 list_for_each_entry(dev, head, unreg_list) { 12248 - if (netdev_need_ops_lock(dev)) 12249 - netdev_unlock(dev); 12250 - else 12222 + if (!netdev_need_ops_lock(dev)) 12251 12223 list_add_tail(&dev->close_list, &close_head); 12252 12224 } 12253 12225 netif_close_many(&close_head, true);
+10
net/core/gro_cells.c
··· 8 8 struct gro_cell { 9 9 struct sk_buff_head napi_skbs; 10 10 struct napi_struct napi; 11 + local_lock_t bh_lock; 11 12 }; 12 13 13 14 int gro_cells_receive(struct gro_cells *gcells, struct sk_buff *skb) 14 15 { 15 16 struct net_device *dev = skb->dev; 17 + bool have_bh_lock = false; 16 18 struct gro_cell *cell; 17 19 int res; 18 20 ··· 27 25 goto unlock; 28 26 } 29 27 28 + local_lock_nested_bh(&gcells->cells->bh_lock); 29 + have_bh_lock = true; 30 30 cell = this_cpu_ptr(gcells->cells); 31 31 32 32 if (skb_queue_len(&cell->napi_skbs) > READ_ONCE(net_hotdata.max_backlog)) { ··· 42 38 __skb_queue_tail(&cell->napi_skbs, skb); 43 39 if (skb_queue_len(&cell->napi_skbs) == 1) 44 40 napi_schedule(&cell->napi); 41 + 42 + if (have_bh_lock) 43 + local_unlock_nested_bh(&gcells->cells->bh_lock); 45 44 46 45 res = NET_RX_SUCCESS; 47 46 ··· 61 54 struct sk_buff *skb; 62 55 int work_done = 0; 63 56 57 + __local_lock_nested_bh(&cell->bh_lock); 64 58 while (work_done < budget) { 65 59 skb = __skb_dequeue(&cell->napi_skbs); 66 60 if (!skb) ··· 72 64 73 65 if (work_done < budget) 74 66 napi_complete_done(napi, work_done); 67 + __local_unlock_nested_bh(&cell->bh_lock); 75 68 return work_done; 76 69 } 77 70 ··· 88 79 struct gro_cell *cell = per_cpu_ptr(gcells->cells, i); 89 80 90 81 __skb_queue_head_init(&cell->napi_skbs); 82 + local_lock_init(&cell->bh_lock); 91 83 92 84 set_bit(NAPI_STATE_NO_BUSY_POLL, &cell->napi.state); 93 85
+1
net/core/skbuff.c
··· 7200 7200 7201 7201 DEBUG_NET_WARN_ON_ONCE(skb_dst(skb)); 7202 7202 DEBUG_NET_WARN_ON_ONCE(skb->destructor); 7203 + DEBUG_NET_WARN_ON_ONCE(skb_nfct(skb)); 7203 7204 7204 7205 sdn = per_cpu_ptr(net_hotdata.skb_defer_nodes, cpu) + numa_node_id(); 7205 7206
-14
net/ipv4/ip_tunnel.c
··· 568 568 return 0; 569 569 } 570 570 571 - static void ip_tunnel_adj_headroom(struct net_device *dev, unsigned int headroom) 572 - { 573 - /* we must cap headroom to some upperlimit, else pskb_expand_head 574 - * will overflow header offsets in skb_headers_offset_update(). 575 - */ 576 - static const unsigned int max_allowed = 512; 577 - 578 - if (headroom > max_allowed) 579 - headroom = max_allowed; 580 - 581 - if (headroom > READ_ONCE(dev->needed_headroom)) 582 - WRITE_ONCE(dev->needed_headroom, headroom); 583 - } 584 - 585 571 void ip_md_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, 586 572 u8 proto, int tunnel_hlen) 587 573 {
+15 -4
net/ipv4/tcp_output.c
··· 2369 2369 u32 max_segs) 2370 2370 { 2371 2371 const struct inet_connection_sock *icsk = inet_csk(sk); 2372 - u32 send_win, cong_win, limit, in_flight; 2372 + u32 send_win, cong_win, limit, in_flight, threshold; 2373 + u64 srtt_in_ns, expected_ack, how_far_is_the_ack; 2373 2374 struct tcp_sock *tp = tcp_sk(sk); 2374 2375 struct sk_buff *head; 2375 2376 int win_divisor; ··· 2432 2431 head = tcp_rtx_queue_head(sk); 2433 2432 if (!head) 2434 2433 goto send_now; 2435 - delta = tp->tcp_clock_cache - head->tstamp; 2436 - /* If next ACK is likely to come too late (half srtt), do not defer */ 2437 - if ((s64)(delta - (u64)NSEC_PER_USEC * (tp->srtt_us >> 4)) < 0) 2434 + 2435 + srtt_in_ns = (u64)(NSEC_PER_USEC >> 3) * tp->srtt_us; 2436 + /* When is the ACK expected ? */ 2437 + expected_ack = head->tstamp + srtt_in_ns; 2438 + /* How far from now is the ACK expected ? */ 2439 + how_far_is_the_ack = expected_ack - tp->tcp_clock_cache; 2440 + 2441 + /* If next ACK is likely to come too late, 2442 + * ie in more than min(1ms, half srtt), do not defer. 2443 + */ 2444 + threshold = min(srtt_in_ns >> 1, NSEC_PER_MSEC); 2445 + 2446 + if ((s64)(how_far_is_the_ack - threshold) > 0) 2438 2447 goto send_now; 2439 2448 2440 2449 /* Ok, it looks like it is advisable to defer.
-2
net/ipv4/udp.c
··· 1851 1851 sk_peek_offset_bwd(sk, len); 1852 1852 1853 1853 if (!skb_shared(skb)) { 1854 - if (unlikely(udp_skb_has_head_state(skb))) 1855 - skb_release_head_state(skb); 1856 1854 skb_attempt_defer_free(skb); 1857 1855 return; 1858 1856 }
+1 -2
net/ipv6/ip6_tunnel.c
··· 1257 1257 */ 1258 1258 max_headroom = LL_RESERVED_SPACE(tdev) + sizeof(struct ipv6hdr) 1259 1259 + dst->header_len + t->hlen; 1260 - if (max_headroom > READ_ONCE(dev->needed_headroom)) 1261 - WRITE_ONCE(dev->needed_headroom, max_headroom); 1260 + ip_tunnel_adj_headroom(dev, max_headroom); 1262 1261 1263 1262 err = ip6_tnl_encap(skb, t, &proto, fl6); 1264 1263 if (err)
+2 -5
net/tls/tls_main.c
··· 255 255 if (msg->msg_flags & MSG_MORE) 256 256 return -EINVAL; 257 257 258 - rc = tls_handle_open_record(sk, msg->msg_flags); 259 - if (rc) 260 - return rc; 261 - 262 258 *record_type = *(unsigned char *)CMSG_DATA(cmsg); 263 - rc = 0; 259 + 260 + rc = tls_handle_open_record(sk, msg->msg_flags); 264 261 break; 265 262 default: 266 263 return -EINVAL;
+25 -6
net/tls/tls_sw.c
··· 1054 1054 if (ret == -EINPROGRESS) 1055 1055 num_async++; 1056 1056 else if (ret != -EAGAIN) 1057 - goto send_end; 1057 + goto end; 1058 1058 } 1059 1059 } 1060 1060 ··· 1112 1112 goto send_end; 1113 1113 tls_ctx->pending_open_record_frags = true; 1114 1114 1115 - if (sk_msg_full(msg_pl)) 1115 + if (sk_msg_full(msg_pl)) { 1116 1116 full_record = true; 1117 + sk_msg_trim(sk, msg_en, 1118 + msg_pl->sg.size + prot->overhead_size); 1119 + } 1117 1120 1118 1121 if (full_record || eor) 1119 1122 goto copied; ··· 1152 1149 } else if (ret != -EAGAIN) 1153 1150 goto send_end; 1154 1151 } 1152 + 1153 + /* Transmit if any encryptions have completed */ 1154 + if (test_and_clear_bit(BIT_TX_SCHEDULED, &ctx->tx_bitmask)) { 1155 + cancel_delayed_work(&ctx->tx_work.work); 1156 + tls_tx_records(sk, msg->msg_flags); 1157 + } 1158 + 1155 1159 continue; 1156 1160 rollback_iter: 1157 1161 copied -= try_to_copy; ··· 1214 1204 goto send_end; 1215 1205 } 1216 1206 } 1207 + 1208 + /* Transmit if any encryptions have completed */ 1209 + if (test_and_clear_bit(BIT_TX_SCHEDULED, &ctx->tx_bitmask)) { 1210 + cancel_delayed_work(&ctx->tx_work.work); 1211 + tls_tx_records(sk, msg->msg_flags); 1212 + } 1217 1213 } 1218 1214 1219 1215 continue; ··· 1239 1223 goto alloc_encrypted; 1240 1224 } 1241 1225 1226 + send_end: 1242 1227 if (!num_async) { 1243 - goto send_end; 1228 + goto end; 1244 1229 } else if (num_zc || eor) { 1245 1230 int err; 1246 1231 ··· 1259 1242 tls_tx_records(sk, msg->msg_flags); 1260 1243 } 1261 1244 1262 - send_end: 1245 + end: 1263 1246 ret = sk_stream_error(sk, msg->msg_flags, ret); 1264 1247 return copied > 0 ? copied : ret; 1265 1248 } ··· 1654 1637 1655 1638 if (unlikely(darg->async)) { 1656 1639 err = tls_strp_msg_hold(&ctx->strp, &ctx->async_hold); 1657 - if (err) 1658 - __skb_queue_tail(&ctx->async_hold, darg->skb); 1640 + if (err) { 1641 + err = tls_decrypt_async_wait(ctx); 1642 + darg->async = false; 1643 + } 1659 1644 return err; 1660 1645 } 1661 1646
+29 -11
tools/testing/selftests/drivers/net/hw/lib/py/__init__.py
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 3 + """ 4 + Driver test environment (hardware-only tests). 5 + NetDrvEnv and NetDrvEpEnv are the main environment classes. 6 + Former is for local host only tests, latter creates / connects 7 + to a remote endpoint. See NIPA wiki for more information about 8 + running and writing driver tests. 9 + """ 10 + 3 11 import sys 4 12 from pathlib import Path 5 13 ··· 16 8 try: 17 9 sys.path.append(KSFT_DIR.as_posix()) 18 10 19 - from net.lib.py import * 20 - from drivers.net.lib.py import * 21 - 22 11 # Import one by one to avoid pylint false positives 12 + from net.lib.py import NetNS, NetNSEnter, NetdevSimDev 23 13 from net.lib.py import EthtoolFamily, NetdevFamily, NetshaperFamily, \ 24 14 NlError, RtnlFamily, DevlinkFamily, PSPFamily 25 15 from net.lib.py import CmdExitFailure 26 - from net.lib.py import bkg, cmd, defer, ethtool, fd_read_timeout, ip, \ 27 - rand_port, tool, wait_port_listen 28 - from net.lib.py import fd_read_timeout 16 + from net.lib.py import bkg, cmd, bpftool, bpftrace, defer, ethtool, \ 17 + fd_read_timeout, ip, rand_port, wait_port_listen, wait_file 29 18 from net.lib.py import KsftSkipEx, KsftFailEx, KsftXfailEx 30 19 from net.lib.py import ksft_disruptive, ksft_exit, ksft_pr, ksft_run, \ 31 20 ksft_setup 32 21 from net.lib.py import ksft_eq, ksft_ge, ksft_in, ksft_is, ksft_lt, \ 33 22 ksft_ne, ksft_not_in, ksft_raises, ksft_true, ksft_gt, ksft_not_none 34 - from net.lib.py import NetNSEnter 35 - from drivers.net.lib.py import GenerateTraffic 23 + from drivers.net.lib.py import GenerateTraffic, Remote 36 24 from drivers.net.lib.py import NetDrvEnv, NetDrvEpEnv 25 + 26 + __all__ = ["NetNS", "NetNSEnter", "NetdevSimDev", 27 + "EthtoolFamily", "NetdevFamily", "NetshaperFamily", 28 + "NlError", "RtnlFamily", "DevlinkFamily", "PSPFamily", 29 + "CmdExitFailure", 30 + "bkg", "cmd", "bpftool", "bpftrace", "defer", "ethtool", 31 + "fd_read_timeout", "ip", "rand_port", 32 + "wait_port_listen", "wait_file", 33 + "KsftSkipEx", "KsftFailEx", "KsftXfailEx", 34 + "ksft_disruptive", "ksft_exit", "ksft_pr", "ksft_run", 35 + "ksft_setup", 36 + "ksft_eq", "ksft_ge", "ksft_in", "ksft_is", "ksft_lt", 37 + "ksft_ne", "ksft_not_in", "ksft_raises", "ksft_true", "ksft_gt", 38 + "ksft_not_none", "ksft_not_none", 39 + "NetDrvEnv", "NetDrvEpEnv", "GenerateTraffic", "Remote"] 37 40 except ModuleNotFoundError as e: 38 - ksft_pr("Failed importing `net` library from kernel sources") 39 - ksft_pr(str(e)) 40 - ktap_result(True, comment="SKIP") 41 + print("Failed importing `net` library from kernel sources") 42 + print(str(e)) 41 43 sys.exit(4)
+2 -2
tools/testing/selftests/drivers/net/lib/py/__init__.py
··· 22 22 NlError, RtnlFamily, DevlinkFamily, PSPFamily 23 23 from net.lib.py import CmdExitFailure 24 24 from net.lib.py import bkg, cmd, bpftool, bpftrace, defer, ethtool, \ 25 - fd_read_timeout, ip, rand_port, tool, wait_port_listen, wait_file 25 + fd_read_timeout, ip, rand_port, wait_port_listen, wait_file 26 26 from net.lib.py import KsftSkipEx, KsftFailEx, KsftXfailEx 27 27 from net.lib.py import ksft_disruptive, ksft_exit, ksft_pr, ksft_run, \ 28 28 ksft_setup ··· 34 34 "NlError", "RtnlFamily", "DevlinkFamily", "PSPFamily", 35 35 "CmdExitFailure", 36 36 "bkg", "cmd", "bpftool", "bpftrace", "defer", "ethtool", 37 - "fd_read_timeout", "ip", "rand_port", "tool", 37 + "fd_read_timeout", "ip", "rand_port", 38 38 "wait_port_listen", "wait_file", 39 39 "KsftSkipEx", "KsftFailEx", "KsftXfailEx", 40 40 "ksft_disruptive", "ksft_exit", "ksft_pr", "ksft_run",
+26 -3
tools/testing/selftests/net/lib/py/__init__.py
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 3 + """ 4 + Python selftest helpers for netdev. 5 + """ 6 + 3 7 from .consts import KSRC 4 - from .ksft import * 8 + from .ksft import KsftFailEx, KsftSkipEx, KsftXfailEx, ksft_pr, ksft_eq, \ 9 + ksft_ne, ksft_true, ksft_not_none, ksft_in, ksft_not_in, ksft_is, \ 10 + ksft_ge, ksft_gt, ksft_lt, ksft_raises, ksft_busy_wait, \ 11 + ktap_result, ksft_disruptive, ksft_setup, ksft_run, ksft_exit 5 12 from .netns import NetNS, NetNSEnter 6 - from .nsim import * 7 - from .utils import * 13 + from .nsim import NetdevSim, NetdevSimDev 14 + from .utils import CmdExitFailure, fd_read_timeout, cmd, bkg, defer, \ 15 + bpftool, ip, ethtool, bpftrace, rand_port, wait_port_listen, wait_file 8 16 from .ynl import NlError, YnlFamily, EthtoolFamily, NetdevFamily, RtnlFamily, RtnlAddrFamily 9 17 from .ynl import NetshaperFamily, DevlinkFamily, PSPFamily 18 + 19 + __all__ = ["KSRC", 20 + "KsftFailEx", "KsftSkipEx", "KsftXfailEx", "ksft_pr", "ksft_eq", 21 + "ksft_ne", "ksft_true", "ksft_not_none", "ksft_in", "ksft_not_in", 22 + "ksft_is", "ksft_ge", "ksft_gt", "ksft_lt", "ksft_raises", 23 + "ksft_busy_wait", "ktap_result", "ksft_disruptive", "ksft_setup", 24 + "ksft_run", "ksft_exit", 25 + "NetNS", "NetNSEnter", 26 + "CmdExitFailure", "fd_read_timeout", "cmd", "bkg", "defer", 27 + "bpftool", "ip", "ethtool", "bpftrace", "rand_port", 28 + "wait_port_listen", "wait_file", 29 + "NetdevSim", "NetdevSimDev", 30 + "NetshaperFamily", "DevlinkFamily", "PSPFamily", "NlError", 31 + "YnlFamily", "EthtoolFamily", "NetdevFamily", "RtnlFamily", 32 + "RtnlAddrFamily"]
+2
tools/testing/selftests/net/rtnetlink.sh
··· 1466 1466 EOF 1467 1467 } 1468 1468 1469 + require_command jq 1470 + 1469 1471 #check for needed privileges 1470 1472 if [ "$(id -u)" -ne 0 ];then 1471 1473 end_test "SKIP: Need root privileges"
+65
tools/testing/selftests/net/tls.c
··· 564 564 EXPECT_EQ(memcmp(buf, test_str, send_len), 0); 565 565 } 566 566 567 + TEST_F(tls, cmsg_msg_more) 568 + { 569 + char *test_str = "test_read"; 570 + char record_type = 100; 571 + int send_len = 10; 572 + 573 + /* we don't allow MSG_MORE with non-DATA records */ 574 + EXPECT_EQ(tls_send_cmsg(self->fd, record_type, test_str, send_len, 575 + MSG_MORE), -1); 576 + EXPECT_EQ(errno, EINVAL); 577 + } 578 + 579 + TEST_F(tls, msg_more_then_cmsg) 580 + { 581 + char *test_str = "test_read"; 582 + char record_type = 100; 583 + int send_len = 10; 584 + char buf[10 * 2]; 585 + int ret; 586 + 587 + EXPECT_EQ(send(self->fd, test_str, send_len, MSG_MORE), send_len); 588 + EXPECT_EQ(recv(self->cfd, buf, send_len, MSG_DONTWAIT), -1); 589 + 590 + ret = tls_send_cmsg(self->fd, record_type, test_str, send_len, 0); 591 + EXPECT_EQ(ret, send_len); 592 + 593 + /* initial DATA record didn't get merged with the non-DATA record */ 594 + EXPECT_EQ(recv(self->cfd, buf, send_len * 2, 0), send_len); 595 + 596 + EXPECT_EQ(tls_recv_cmsg(_metadata, self->cfd, record_type, 597 + buf, sizeof(buf), MSG_WAITALL), 598 + send_len); 599 + } 600 + 567 601 TEST_F(tls, msg_more_unsent) 568 602 { 569 603 char const *test_str = "test_read"; ··· 945 911 EXPECT_EQ(read(p[0], mem_recv, send_len), send_len); 946 912 EXPECT_EQ(memcmp(mem_send, mem_recv, send_len), 0); 947 913 } 914 + 915 + #define MAX_FRAGS 48 916 + TEST_F(tls, splice_short) 917 + { 918 + struct iovec sendchar_iov; 919 + char read_buf[0x10000]; 920 + char sendbuf[0x100]; 921 + char sendchar = 'S'; 922 + int pipefds[2]; 923 + int i; 924 + 925 + sendchar_iov.iov_base = &sendchar; 926 + sendchar_iov.iov_len = 1; 927 + 928 + memset(sendbuf, 's', sizeof(sendbuf)); 929 + 930 + ASSERT_GE(pipe2(pipefds, O_NONBLOCK), 0); 931 + ASSERT_GE(fcntl(pipefds[0], F_SETPIPE_SZ, (MAX_FRAGS + 1) * 0x1000), 0); 932 + 933 + for (i = 0; i < MAX_FRAGS; i++) 934 + ASSERT_GE(vmsplice(pipefds[1], &sendchar_iov, 1, 0), 0); 935 + 936 + ASSERT_EQ(write(pipefds[1], sendbuf, sizeof(sendbuf)), sizeof(sendbuf)); 937 + 938 + EXPECT_EQ(splice(pipefds[0], NULL, self->fd, NULL, MAX_FRAGS + 0x1000, 0), 939 + MAX_FRAGS + sizeof(sendbuf)); 940 + EXPECT_EQ(recv(self->cfd, read_buf, sizeof(read_buf), 0), MAX_FRAGS + sizeof(sendbuf)); 941 + EXPECT_EQ(recv(self->cfd, read_buf, sizeof(read_buf), MSG_DONTWAIT), -1); 942 + EXPECT_EQ(errno, EAGAIN); 943 + } 944 + #undef MAX_FRAGS 948 945 949 946 TEST_F(tls, recvmsg_single) 950 947 {
+2
tools/testing/selftests/net/vlan_bridge_binding.sh
··· 249 249 do_test_binding_off : "on->off when upper down" 250 250 } 251 251 252 + require_command jq 253 + 252 254 trap defer_scopes_cleanup EXIT 253 255 setup_prepare 254 256 tests_run