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

Pull networking fixes from Jakub Kicinski:
"Networking fixes for 5.10-rc6, including fixes from the WiFi driver,
and CAN subtrees.

Current release - regressions:

- gro_cells: reduce number of synchronize_net() calls

- ch_ktls: release a lock before jumping to an error path

Current release - always broken:

- tcp: Allow full IP tos/IPv6 tclass to be reflected in L3 header

Previous release - regressions:

- net/tls: fix missing received data after fast remote close

- vsock/virtio: discard packets only when socket is really closed

- sock: set sk_err to ee_errno on dequeue from errq

- cxgb4: fix the panic caused by non smac rewrite

Previous release - always broken:

- tcp: fix corner cases around setting ECN with BPF selection of
congestion control

- tcp: fix race condition when creating child sockets from syncookies
on loopback interface

- usbnet: ipheth: fix connectivity with iOS 14

- tun: honor IOCB_NOWAIT flag

- net/packet: fix packet receive on L3 devices without visible hard
header

- devlink: Make sure devlink instance and port are in same net
namespace

- net: openvswitch: fix TTL decrement action netlink message format

- bonding: wait for sysfs kobject destruction before freeing struct
slave

- net: stmmac: fix upstream patch applied to the wrong context

- bnxt_en: fix return value and unwind in probe error paths

Misc:

- devlink: add extra layer of categorization to the reload stats uAPI
before it's released"

* tag 'net-5.10-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (68 commits)
sock: set sk_err to ee_errno on dequeue from errq
mptcp: fix NULL ptr dereference on bad MPJ
net: openvswitch: fix TTL decrement action netlink message format
can: af_can: can_rx_unregister(): remove WARN() statement from list operation sanity check
can: m_can: m_can_dev_setup(): add support for bosch mcan version 3.3.0
can: m_can: fix nominal bitiming tseg2 min for version >= 3.1
can: m_can: m_can_open(): remove IRQF_TRIGGER_FALLING from request_threaded_irq()'s flags
can: mcp251xfd: mcp251xfd_probe(): bail out if no IRQ was given
can: gs_usb: fix endianess problem with candleLight firmware
ch_ktls: lock is not freed
net/tls: Protect from calling tls_dev_del for TLS RX twice
devlink: Make sure devlink instance and port are in same net namespace
devlink: Hold rtnl lock while reading netdev attributes
ptp: clockmatrix: bug fix for idtcm_strverscmp
enetc: Let the hardware auto-advance the taprio base-time of 0
gro_cells: reduce number of synchronize_net() calls
net: stmmac: fix incorrect merge of patch upstream
ipv6: addrlabel: fix possible memory leak in ip6addrlbl_net_init
Documentation: netdev-FAQ: suggest how to post co-dependent series
ibmvnic: enhance resetting status check during module exit
...

+872 -515
+26
Documentation/networking/netdev-FAQ.rst
··· 254 254 minimum, your changes should survive an ``allyesconfig`` and an 255 255 ``allmodconfig`` build without new warnings or failures. 256 256 257 + Q: How do I post corresponding changes to user space components? 258 + ---------------------------------------------------------------- 259 + A: User space code exercising kernel features should be posted 260 + alongside kernel patches. This gives reviewers a chance to see 261 + how any new interface is used and how well it works. 262 + 263 + When user space tools reside in the kernel repo itself all changes 264 + should generally come as one series. If series becomes too large 265 + or the user space project is not reviewed on netdev include a link 266 + to a public repo where user space patches can be seen. 267 + 268 + In case user space tooling lives in a separate repository but is 269 + reviewed on netdev (e.g. patches to `iproute2` tools) kernel and 270 + user space patches should form separate series (threads) when posted 271 + to the mailing list, e.g.:: 272 + 273 + [PATCH net-next 0/3] net: some feature cover letter 274 + └─ [PATCH net-next 1/3] net: some feature prep 275 + └─ [PATCH net-next 2/3] net: some feature do it 276 + └─ [PATCH net-next 3/3] selftest: net: some feature 277 + 278 + [PATCH iproute2-next] ip: add support for some feature 279 + 280 + Posting as one thread is discouraged because it confuses patchwork 281 + (as of patchwork 2.2.2). 282 + 257 283 Q: Any other tips to help ensure my net/net-next patch gets OK'd? 258 284 ----------------------------------------------------------------- 259 285 A: Attention to detail. Re-read your own work as if you were the
+9 -7
MAINTAINERS
··· 3528 3528 M: Arend van Spriel <arend.vanspriel@broadcom.com> 3529 3529 M: Franky Lin <franky.lin@broadcom.com> 3530 3530 M: Hante Meuleman <hante.meuleman@broadcom.com> 3531 - M: Chi-Hsien Lin <chi-hsien.lin@cypress.com> 3532 - M: Wright Feng <wright.feng@cypress.com> 3531 + M: Chi-hsien Lin <chi-hsien.lin@infineon.com> 3532 + M: Wright Feng <wright.feng@infineon.com> 3533 + M: Chung-hsien Hsu <chung-hsien.hsu@infineon.com> 3533 3534 L: linux-wireless@vger.kernel.org 3534 3535 L: brcm80211-dev-list.pdl@broadcom.com 3535 - L: brcm80211-dev-list@cypress.com 3536 + L: SHA-cyfmac-dev-list@infineon.com 3536 3537 S: Supported 3537 3538 F: drivers/net/wireless/broadcom/brcm80211/ 3538 3539 ··· 13163 13162 M: Ilias Apalodimas <ilias.apalodimas@linaro.org> 13164 13163 L: netdev@vger.kernel.org 13165 13164 S: Supported 13165 + F: Documentation/networking/page_pool.rst 13166 13166 F: include/net/page_pool.h 13167 + F: include/trace/events/page_pool.h 13167 13168 F: net/core/page_pool.c 13168 13169 13169 13170 PANASONIC LAPTOP ACPI EXTRAS DRIVER ··· 14807 14804 F: drivers/net/wireless/realtek/rtlwifi/ 14808 14805 14809 14806 REALTEK WIRELESS DRIVER (rtw88) 14810 - M: Yan-Hsuan Chuang <yhchuang@realtek.com> 14807 + M: Yan-Hsuan Chuang <tony0620emma@gmail.com> 14811 14808 L: linux-wireless@vger.kernel.org 14812 14809 S: Maintained 14813 14810 F: drivers/net/wireless/realtek/rtw88/ ··· 15780 15777 F: include/linux/slimbus.h 15781 15778 15782 15779 SFC NETWORK DRIVER 15783 - M: Solarflare linux maintainers <linux-net-drivers@solarflare.com> 15784 - M: Edward Cree <ecree@solarflare.com> 15785 - M: Martin Habets <mhabets@solarflare.com> 15780 + M: Edward Cree <ecree.xilinx@gmail.com> 15781 + M: Martin Habets <habetsm.xilinx@gmail.com> 15786 15782 L: netdev@vger.kernel.org 15787 15783 S: Supported 15788 15784 F: drivers/net/ethernet/sfc/
+52 -27
drivers/net/bonding/bond_main.c
··· 1460 1460 slave->dev->flags &= ~IFF_SLAVE; 1461 1461 } 1462 1462 1463 - static struct slave *bond_alloc_slave(struct bonding *bond) 1463 + static void slave_kobj_release(struct kobject *kobj) 1464 1464 { 1465 - struct slave *slave = NULL; 1466 - 1467 - slave = kzalloc(sizeof(*slave), GFP_KERNEL); 1468 - if (!slave) 1469 - return NULL; 1470 - 1471 - if (BOND_MODE(bond) == BOND_MODE_8023AD) { 1472 - SLAVE_AD_INFO(slave) = kzalloc(sizeof(struct ad_slave_info), 1473 - GFP_KERNEL); 1474 - if (!SLAVE_AD_INFO(slave)) { 1475 - kfree(slave); 1476 - return NULL; 1477 - } 1478 - } 1479 - INIT_DELAYED_WORK(&slave->notify_work, bond_netdev_notify_work); 1480 - 1481 - return slave; 1482 - } 1483 - 1484 - static void bond_free_slave(struct slave *slave) 1485 - { 1465 + struct slave *slave = to_slave(kobj); 1486 1466 struct bonding *bond = bond_get_bond_by_slave(slave); 1487 1467 1488 1468 cancel_delayed_work_sync(&slave->notify_work); ··· 1470 1490 kfree(SLAVE_AD_INFO(slave)); 1471 1491 1472 1492 kfree(slave); 1493 + } 1494 + 1495 + static struct kobj_type slave_ktype = { 1496 + .release = slave_kobj_release, 1497 + #ifdef CONFIG_SYSFS 1498 + .sysfs_ops = &slave_sysfs_ops, 1499 + #endif 1500 + }; 1501 + 1502 + static int bond_kobj_init(struct slave *slave) 1503 + { 1504 + int err; 1505 + 1506 + err = kobject_init_and_add(&slave->kobj, &slave_ktype, 1507 + &(slave->dev->dev.kobj), "bonding_slave"); 1508 + if (err) 1509 + kobject_put(&slave->kobj); 1510 + 1511 + return err; 1512 + } 1513 + 1514 + static struct slave *bond_alloc_slave(struct bonding *bond, 1515 + struct net_device *slave_dev) 1516 + { 1517 + struct slave *slave = NULL; 1518 + 1519 + slave = kzalloc(sizeof(*slave), GFP_KERNEL); 1520 + if (!slave) 1521 + return NULL; 1522 + 1523 + slave->bond = bond; 1524 + slave->dev = slave_dev; 1525 + 1526 + if (bond_kobj_init(slave)) 1527 + return NULL; 1528 + 1529 + if (BOND_MODE(bond) == BOND_MODE_8023AD) { 1530 + SLAVE_AD_INFO(slave) = kzalloc(sizeof(struct ad_slave_info), 1531 + GFP_KERNEL); 1532 + if (!SLAVE_AD_INFO(slave)) { 1533 + kobject_put(&slave->kobj); 1534 + return NULL; 1535 + } 1536 + } 1537 + INIT_DELAYED_WORK(&slave->notify_work, bond_netdev_notify_work); 1538 + 1539 + return slave; 1473 1540 } 1474 1541 1475 1542 static void bond_fill_ifbond(struct bonding *bond, struct ifbond *info) ··· 1705 1678 goto err_undo_flags; 1706 1679 } 1707 1680 1708 - new_slave = bond_alloc_slave(bond); 1681 + new_slave = bond_alloc_slave(bond, slave_dev); 1709 1682 if (!new_slave) { 1710 1683 res = -ENOMEM; 1711 1684 goto err_undo_flags; 1712 1685 } 1713 1686 1714 - new_slave->bond = bond; 1715 - new_slave->dev = slave_dev; 1716 1687 /* Set the new_slave's queue_id to be zero. Queue ID mapping 1717 1688 * is set via sysfs or module option if desired. 1718 1689 */ ··· 2032 2007 dev_set_mtu(slave_dev, new_slave->original_mtu); 2033 2008 2034 2009 err_free: 2035 - bond_free_slave(new_slave); 2010 + kobject_put(&new_slave->kobj); 2036 2011 2037 2012 err_undo_flags: 2038 2013 /* Enslave of first slave has failed and we need to fix master's mac */ ··· 2212 2187 if (!netif_is_bond_master(slave_dev)) 2213 2188 slave_dev->priv_flags &= ~IFF_BONDING; 2214 2189 2215 - bond_free_slave(slave); 2190 + kobject_put(&slave->kobj); 2216 2191 2217 2192 return 0; 2218 2193 }
+1 -17
drivers/net/bonding/bond_sysfs_slave.c
··· 121 121 }; 122 122 123 123 #define to_slave_attr(_at) container_of(_at, struct slave_attribute, attr) 124 - #define to_slave(obj) container_of(obj, struct slave, kobj) 125 124 126 125 static ssize_t slave_show(struct kobject *kobj, 127 126 struct attribute *attr, char *buf) ··· 131 132 return slave_attr->show(slave, buf); 132 133 } 133 134 134 - static const struct sysfs_ops slave_sysfs_ops = { 135 + const struct sysfs_ops slave_sysfs_ops = { 135 136 .show = slave_show, 136 - }; 137 - 138 - static struct kobj_type slave_ktype = { 139 - #ifdef CONFIG_SYSFS 140 - .sysfs_ops = &slave_sysfs_ops, 141 - #endif 142 137 }; 143 138 144 139 int bond_sysfs_slave_add(struct slave *slave) 145 140 { 146 141 const struct slave_attribute **a; 147 142 int err; 148 - 149 - err = kobject_init_and_add(&slave->kobj, &slave_ktype, 150 - &(slave->dev->dev.kobj), "bonding_slave"); 151 - if (err) { 152 - kobject_put(&slave->kobj); 153 - return err; 154 - } 155 143 156 144 for (a = slave_attrs; *a; ++a) { 157 145 err = sysfs_create_file(&slave->kobj, &((*a)->attr)); ··· 157 171 158 172 for (a = slave_attrs; *a; ++a) 159 173 sysfs_remove_file(&slave->kobj, &((*a)->attr)); 160 - 161 - kobject_put(&slave->kobj); 162 174 }
+4 -2
drivers/net/can/m_can/m_can.c
··· 1033 1033 .name = KBUILD_MODNAME, 1034 1034 .tseg1_min = 2, /* Time segment 1 = prop_seg + phase_seg1 */ 1035 1035 .tseg1_max = 256, 1036 - .tseg2_min = 1, /* Time segment 2 = phase_seg2 */ 1036 + .tseg2_min = 2, /* Time segment 2 = phase_seg2 */ 1037 1037 .tseg2_max = 128, 1038 1038 .sjw_max = 128, 1039 1039 .brp_min = 1, ··· 1385 1385 &m_can_data_bittiming_const_31X; 1386 1386 break; 1387 1387 case 32: 1388 + case 33: 1389 + /* Support both MCAN version v3.2.x and v3.3.0 */ 1388 1390 m_can_dev->can.bittiming_const = m_can_dev->bit_timing ? 1389 1391 m_can_dev->bit_timing : &m_can_bittiming_const_31X; 1390 1392 ··· 1655 1653 INIT_WORK(&cdev->tx_work, m_can_tx_work_queue); 1656 1654 1657 1655 err = request_threaded_irq(dev->irq, NULL, m_can_isr, 1658 - IRQF_ONESHOT | IRQF_TRIGGER_FALLING, 1656 + IRQF_ONESHOT, 1659 1657 dev->name, dev); 1660 1658 } else { 1661 1659 err = request_irq(dev->irq, m_can_isr, IRQF_SHARED, dev->name,
+4
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
··· 2738 2738 u32 freq; 2739 2739 int err; 2740 2740 2741 + if (!spi->irq) 2742 + return dev_err_probe(&spi->dev, -ENXIO, 2743 + "No IRQ specified (maybe node \"interrupts-extended\" in DT missing)!\n"); 2744 + 2741 2745 rx_int = devm_gpiod_get_optional(&spi->dev, "microchip,rx-int", 2742 2746 GPIOD_IN); 2743 2747 if (PTR_ERR(rx_int) == -EPROBE_DEFER)
+71 -62
drivers/net/can/usb/gs_usb.c
··· 63 63 }; 64 64 65 65 /* data types passed between host and device */ 66 - struct gs_host_config { 67 - u32 byte_order; 68 - } __packed; 69 - /* All data exchanged between host and device is exchanged in host byte order, 70 - * thanks to the struct gs_host_config byte_order member, which is sent first 71 - * to indicate the desired byte order. 66 + 67 + /* The firmware on the original USB2CAN by Geschwister Schneider 68 + * Technologie Entwicklungs- und Vertriebs UG exchanges all data 69 + * between the host and the device in host byte order. This is done 70 + * with the struct gs_host_config::byte_order member, which is sent 71 + * first to indicate the desired byte order. 72 + * 73 + * The widely used open source firmware candleLight doesn't support 74 + * this feature and exchanges the data in little endian byte order. 72 75 */ 76 + struct gs_host_config { 77 + __le32 byte_order; 78 + } __packed; 73 79 74 80 struct gs_device_config { 75 81 u8 reserved1; 76 82 u8 reserved2; 77 83 u8 reserved3; 78 84 u8 icount; 79 - u32 sw_version; 80 - u32 hw_version; 85 + __le32 sw_version; 86 + __le32 hw_version; 81 87 } __packed; 82 88 83 89 #define GS_CAN_MODE_NORMAL 0 ··· 93 87 #define GS_CAN_MODE_ONE_SHOT BIT(3) 94 88 95 89 struct gs_device_mode { 96 - u32 mode; 97 - u32 flags; 90 + __le32 mode; 91 + __le32 flags; 98 92 } __packed; 99 93 100 94 struct gs_device_state { 101 - u32 state; 102 - u32 rxerr; 103 - u32 txerr; 95 + __le32 state; 96 + __le32 rxerr; 97 + __le32 txerr; 104 98 } __packed; 105 99 106 100 struct gs_device_bittiming { 107 - u32 prop_seg; 108 - u32 phase_seg1; 109 - u32 phase_seg2; 110 - u32 sjw; 111 - u32 brp; 101 + __le32 prop_seg; 102 + __le32 phase_seg1; 103 + __le32 phase_seg2; 104 + __le32 sjw; 105 + __le32 brp; 112 106 } __packed; 113 107 114 108 struct gs_identify_mode { 115 - u32 mode; 109 + __le32 mode; 116 110 } __packed; 117 111 118 112 #define GS_CAN_FEATURE_LISTEN_ONLY BIT(0) ··· 123 117 #define GS_CAN_FEATURE_IDENTIFY BIT(5) 124 118 125 119 struct gs_device_bt_const { 126 - u32 feature; 127 - u32 fclk_can; 128 - u32 tseg1_min; 129 - u32 tseg1_max; 130 - u32 tseg2_min; 131 - u32 tseg2_max; 132 - u32 sjw_max; 133 - u32 brp_min; 134 - u32 brp_max; 135 - u32 brp_inc; 120 + __le32 feature; 121 + __le32 fclk_can; 122 + __le32 tseg1_min; 123 + __le32 tseg1_max; 124 + __le32 tseg2_min; 125 + __le32 tseg2_max; 126 + __le32 sjw_max; 127 + __le32 brp_min; 128 + __le32 brp_max; 129 + __le32 brp_inc; 136 130 } __packed; 137 131 138 132 #define GS_CAN_FLAG_OVERFLOW 1 139 133 140 134 struct gs_host_frame { 141 135 u32 echo_id; 142 - u32 can_id; 136 + __le32 can_id; 143 137 144 138 u8 can_dlc; 145 139 u8 channel; ··· 335 329 if (!skb) 336 330 return; 337 331 338 - cf->can_id = hf->can_id; 332 + cf->can_id = le32_to_cpu(hf->can_id); 339 333 340 334 cf->can_dlc = get_can_dlc(hf->can_dlc); 341 335 memcpy(cf->data, hf->data, 8); 342 336 343 337 /* ERROR frames tell us information about the controller */ 344 - if (hf->can_id & CAN_ERR_FLAG) 338 + if (le32_to_cpu(hf->can_id) & CAN_ERR_FLAG) 345 339 gs_update_state(dev, cf); 346 340 347 341 netdev->stats.rx_packets++; ··· 424 418 if (!dbt) 425 419 return -ENOMEM; 426 420 427 - dbt->prop_seg = bt->prop_seg; 428 - dbt->phase_seg1 = bt->phase_seg1; 429 - dbt->phase_seg2 = bt->phase_seg2; 430 - dbt->sjw = bt->sjw; 431 - dbt->brp = bt->brp; 421 + dbt->prop_seg = cpu_to_le32(bt->prop_seg); 422 + dbt->phase_seg1 = cpu_to_le32(bt->phase_seg1); 423 + dbt->phase_seg2 = cpu_to_le32(bt->phase_seg2); 424 + dbt->sjw = cpu_to_le32(bt->sjw); 425 + dbt->brp = cpu_to_le32(bt->brp); 432 426 433 427 /* request bit timings */ 434 428 rc = usb_control_msg(interface_to_usbdev(intf), ··· 509 503 510 504 cf = (struct can_frame *)skb->data; 511 505 512 - hf->can_id = cf->can_id; 506 + hf->can_id = cpu_to_le32(cf->can_id); 513 507 hf->can_dlc = cf->can_dlc; 514 508 memcpy(hf->data, cf->data, cf->can_dlc); 515 509 ··· 579 573 int rc, i; 580 574 struct gs_device_mode *dm; 581 575 u32 ctrlmode; 576 + u32 flags = 0; 582 577 583 578 rc = open_candev(netdev); 584 579 if (rc) ··· 647 640 648 641 /* flags */ 649 642 ctrlmode = dev->can.ctrlmode; 650 - dm->flags = 0; 651 643 652 644 if (ctrlmode & CAN_CTRLMODE_LOOPBACK) 653 - dm->flags |= GS_CAN_MODE_LOOP_BACK; 645 + flags |= GS_CAN_MODE_LOOP_BACK; 654 646 else if (ctrlmode & CAN_CTRLMODE_LISTENONLY) 655 - dm->flags |= GS_CAN_MODE_LISTEN_ONLY; 647 + flags |= GS_CAN_MODE_LISTEN_ONLY; 656 648 657 649 /* Controller is not allowed to retry TX 658 650 * this mode is unavailable on atmels uc3c hardware 659 651 */ 660 652 if (ctrlmode & CAN_CTRLMODE_ONE_SHOT) 661 - dm->flags |= GS_CAN_MODE_ONE_SHOT; 653 + flags |= GS_CAN_MODE_ONE_SHOT; 662 654 663 655 if (ctrlmode & CAN_CTRLMODE_3_SAMPLES) 664 - dm->flags |= GS_CAN_MODE_TRIPLE_SAMPLE; 656 + flags |= GS_CAN_MODE_TRIPLE_SAMPLE; 665 657 666 658 /* finally start device */ 667 - dm->mode = GS_CAN_MODE_START; 659 + dm->mode = cpu_to_le32(GS_CAN_MODE_START); 660 + dm->flags = cpu_to_le32(flags); 668 661 rc = usb_control_msg(interface_to_usbdev(dev->iface), 669 662 usb_sndctrlpipe(interface_to_usbdev(dev->iface), 0), 670 663 GS_USB_BREQ_MODE, ··· 744 737 return -ENOMEM; 745 738 746 739 if (do_identify) 747 - imode->mode = GS_CAN_IDENTIFY_ON; 740 + imode->mode = cpu_to_le32(GS_CAN_IDENTIFY_ON); 748 741 else 749 - imode->mode = GS_CAN_IDENTIFY_OFF; 742 + imode->mode = cpu_to_le32(GS_CAN_IDENTIFY_OFF); 750 743 751 744 rc = usb_control_msg(interface_to_usbdev(dev->iface), 752 745 usb_sndctrlpipe(interface_to_usbdev(dev->iface), ··· 797 790 struct net_device *netdev; 798 791 int rc; 799 792 struct gs_device_bt_const *bt_const; 793 + u32 feature; 800 794 801 795 bt_const = kmalloc(sizeof(*bt_const), GFP_KERNEL); 802 796 if (!bt_const) ··· 838 830 839 831 /* dev setup */ 840 832 strcpy(dev->bt_const.name, "gs_usb"); 841 - dev->bt_const.tseg1_min = bt_const->tseg1_min; 842 - dev->bt_const.tseg1_max = bt_const->tseg1_max; 843 - dev->bt_const.tseg2_min = bt_const->tseg2_min; 844 - dev->bt_const.tseg2_max = bt_const->tseg2_max; 845 - dev->bt_const.sjw_max = bt_const->sjw_max; 846 - dev->bt_const.brp_min = bt_const->brp_min; 847 - dev->bt_const.brp_max = bt_const->brp_max; 848 - dev->bt_const.brp_inc = bt_const->brp_inc; 833 + dev->bt_const.tseg1_min = le32_to_cpu(bt_const->tseg1_min); 834 + dev->bt_const.tseg1_max = le32_to_cpu(bt_const->tseg1_max); 835 + dev->bt_const.tseg2_min = le32_to_cpu(bt_const->tseg2_min); 836 + dev->bt_const.tseg2_max = le32_to_cpu(bt_const->tseg2_max); 837 + dev->bt_const.sjw_max = le32_to_cpu(bt_const->sjw_max); 838 + dev->bt_const.brp_min = le32_to_cpu(bt_const->brp_min); 839 + dev->bt_const.brp_max = le32_to_cpu(bt_const->brp_max); 840 + dev->bt_const.brp_inc = le32_to_cpu(bt_const->brp_inc); 849 841 850 842 dev->udev = interface_to_usbdev(intf); 851 843 dev->iface = intf; ··· 862 854 863 855 /* can setup */ 864 856 dev->can.state = CAN_STATE_STOPPED; 865 - dev->can.clock.freq = bt_const->fclk_can; 857 + dev->can.clock.freq = le32_to_cpu(bt_const->fclk_can); 866 858 dev->can.bittiming_const = &dev->bt_const; 867 859 dev->can.do_set_bittiming = gs_usb_set_bittiming; 868 860 869 861 dev->can.ctrlmode_supported = 0; 870 862 871 - if (bt_const->feature & GS_CAN_FEATURE_LISTEN_ONLY) 863 + feature = le32_to_cpu(bt_const->feature); 864 + if (feature & GS_CAN_FEATURE_LISTEN_ONLY) 872 865 dev->can.ctrlmode_supported |= CAN_CTRLMODE_LISTENONLY; 873 866 874 - if (bt_const->feature & GS_CAN_FEATURE_LOOP_BACK) 867 + if (feature & GS_CAN_FEATURE_LOOP_BACK) 875 868 dev->can.ctrlmode_supported |= CAN_CTRLMODE_LOOPBACK; 876 869 877 - if (bt_const->feature & GS_CAN_FEATURE_TRIPLE_SAMPLE) 870 + if (feature & GS_CAN_FEATURE_TRIPLE_SAMPLE) 878 871 dev->can.ctrlmode_supported |= CAN_CTRLMODE_3_SAMPLES; 879 872 880 - if (bt_const->feature & GS_CAN_FEATURE_ONE_SHOT) 873 + if (feature & GS_CAN_FEATURE_ONE_SHOT) 881 874 dev->can.ctrlmode_supported |= CAN_CTRLMODE_ONE_SHOT; 882 875 883 876 SET_NETDEV_DEV(netdev, &intf->dev); 884 877 885 - if (dconf->sw_version > 1) 886 - if (bt_const->feature & GS_CAN_FEATURE_IDENTIFY) 878 + if (le32_to_cpu(dconf->sw_version) > 1) 879 + if (feature & GS_CAN_FEATURE_IDENTIFY) 887 880 netdev->ethtool_ops = &gs_usb_ethtool_ops; 888 881 889 882 kfree(bt_const); ··· 919 910 if (!hconf) 920 911 return -ENOMEM; 921 912 922 - hconf->byte_order = 0x0000beef; 913 + hconf->byte_order = cpu_to_le32(0x0000beef); 923 914 924 915 /* send host config */ 925 916 rc = usb_control_msg(interface_to_usbdev(intf),
+3
drivers/net/ethernet/amazon/ena/ena_eth_com.c
··· 516 516 { 517 517 struct ena_com_rx_buf_info *ena_buf = &ena_rx_ctx->ena_bufs[0]; 518 518 struct ena_eth_io_rx_cdesc_base *cdesc = NULL; 519 + u16 q_depth = io_cq->q_depth; 519 520 u16 cdesc_idx = 0; 520 521 u16 nb_hw_desc; 521 522 u16 i = 0; ··· 544 543 do { 545 544 ena_buf[i].len = cdesc->length; 546 545 ena_buf[i].req_id = cdesc->req_id; 546 + if (unlikely(ena_buf[i].req_id >= q_depth)) 547 + return -EIO; 547 548 548 549 if (++i >= nb_hw_desc) 549 550 break;
+30 -50
drivers/net/ethernet/amazon/ena/ena_netdev.c
··· 789 789 adapter->num_io_queues); 790 790 } 791 791 792 - static int validate_rx_req_id(struct ena_ring *rx_ring, u16 req_id) 793 - { 794 - if (likely(req_id < rx_ring->ring_size)) 795 - return 0; 796 - 797 - netif_err(rx_ring->adapter, rx_err, rx_ring->netdev, 798 - "Invalid rx req_id: %hu\n", req_id); 799 - 800 - u64_stats_update_begin(&rx_ring->syncp); 801 - rx_ring->rx_stats.bad_req_id++; 802 - u64_stats_update_end(&rx_ring->syncp); 803 - 804 - /* Trigger device reset */ 805 - rx_ring->adapter->reset_reason = ENA_REGS_RESET_INV_RX_REQ_ID; 806 - set_bit(ENA_FLAG_TRIGGER_RESET, &rx_ring->adapter->flags); 807 - return -EFAULT; 808 - } 809 - 810 792 /* ena_setup_rx_resources - allocate I/O Rx resources (Descriptors) 811 793 * @adapter: network interface device structure 812 794 * @qid: queue index ··· 908 926 static int ena_alloc_rx_page(struct ena_ring *rx_ring, 909 927 struct ena_rx_buffer *rx_info, gfp_t gfp) 910 928 { 929 + int headroom = rx_ring->rx_headroom; 911 930 struct ena_com_buf *ena_buf; 912 931 struct page *page; 913 932 dma_addr_t dma; 933 + 934 + /* restore page offset value in case it has been changed by device */ 935 + rx_info->page_offset = headroom; 914 936 915 937 /* if previous allocated page is not used */ 916 938 if (unlikely(rx_info->page)) ··· 945 959 "Allocate page %p, rx_info %p\n", page, rx_info); 946 960 947 961 rx_info->page = page; 948 - rx_info->page_offset = 0; 949 962 ena_buf = &rx_info->ena_buf; 950 - ena_buf->paddr = dma + rx_ring->rx_headroom; 951 - ena_buf->len = ENA_PAGE_SIZE - rx_ring->rx_headroom; 963 + ena_buf->paddr = dma + headroom; 964 + ena_buf->len = ENA_PAGE_SIZE - headroom; 952 965 953 966 return 0; 954 967 } ··· 1341 1356 struct ena_rx_buffer *rx_info; 1342 1357 u16 len, req_id, buf = 0; 1343 1358 void *va; 1344 - int rc; 1345 1359 1346 1360 len = ena_bufs[buf].len; 1347 1361 req_id = ena_bufs[buf].req_id; 1348 - 1349 - rc = validate_rx_req_id(rx_ring, req_id); 1350 - if (unlikely(rc < 0)) 1351 - return NULL; 1352 1362 1353 1363 rx_info = &rx_ring->rx_buffer_info[req_id]; 1354 1364 ··· 1359 1379 1360 1380 /* save virt address of first buffer */ 1361 1381 va = page_address(rx_info->page) + rx_info->page_offset; 1362 - prefetch(va + NET_IP_ALIGN); 1382 + 1383 + prefetch(va); 1363 1384 1364 1385 if (len <= rx_ring->rx_copybreak) { 1365 1386 skb = ena_alloc_skb(rx_ring, false); ··· 1401 1420 1402 1421 skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, rx_info->page, 1403 1422 rx_info->page_offset, len, ENA_PAGE_SIZE); 1404 - /* The offset is non zero only for the first buffer */ 1405 - rx_info->page_offset = 0; 1406 1423 1407 1424 netif_dbg(rx_ring->adapter, rx_status, rx_ring->netdev, 1408 1425 "RX skb updated. len %d. data_len %d\n", ··· 1418 1439 buf++; 1419 1440 len = ena_bufs[buf].len; 1420 1441 req_id = ena_bufs[buf].req_id; 1421 - 1422 - rc = validate_rx_req_id(rx_ring, req_id); 1423 - if (unlikely(rc < 0)) 1424 - return NULL; 1425 1442 1426 1443 rx_info = &rx_ring->rx_buffer_info[req_id]; 1427 1444 } while (1); ··· 1519 1544 int ret; 1520 1545 1521 1546 rx_info = &rx_ring->rx_buffer_info[rx_ring->ena_bufs[0].req_id]; 1522 - xdp->data = page_address(rx_info->page) + 1523 - rx_info->page_offset + rx_ring->rx_headroom; 1547 + xdp->data = page_address(rx_info->page) + rx_info->page_offset; 1524 1548 xdp_set_data_meta_invalid(xdp); 1525 1549 xdp->data_hard_start = page_address(rx_info->page); 1526 1550 xdp->data_end = xdp->data + rx_ring->ena_bufs[0].len; ··· 1586 1612 if (unlikely(ena_rx_ctx.descs == 0)) 1587 1613 break; 1588 1614 1615 + /* First descriptor might have an offset set by the device */ 1589 1616 rx_info = &rx_ring->rx_buffer_info[rx_ring->ena_bufs[0].req_id]; 1590 - rx_info->page_offset = ena_rx_ctx.pkt_offset; 1617 + rx_info->page_offset += ena_rx_ctx.pkt_offset; 1591 1618 1592 1619 netif_dbg(rx_ring->adapter, rx_status, rx_ring->netdev, 1593 1620 "rx_poll: q %d got packet from ena. descs #: %d l3 proto %d l4 proto %d hash: %x\n", ··· 1672 1697 error: 1673 1698 adapter = netdev_priv(rx_ring->netdev); 1674 1699 1675 - u64_stats_update_begin(&rx_ring->syncp); 1676 - rx_ring->rx_stats.bad_desc_num++; 1677 - u64_stats_update_end(&rx_ring->syncp); 1700 + if (rc == -ENOSPC) { 1701 + u64_stats_update_begin(&rx_ring->syncp); 1702 + rx_ring->rx_stats.bad_desc_num++; 1703 + u64_stats_update_end(&rx_ring->syncp); 1704 + adapter->reset_reason = ENA_REGS_RESET_TOO_MANY_RX_DESCS; 1705 + } else { 1706 + u64_stats_update_begin(&rx_ring->syncp); 1707 + rx_ring->rx_stats.bad_req_id++; 1708 + u64_stats_update_end(&rx_ring->syncp); 1709 + adapter->reset_reason = ENA_REGS_RESET_INV_RX_REQ_ID; 1710 + } 1678 1711 1679 - /* Too many desc from the device. Trigger reset */ 1680 - adapter->reset_reason = ENA_REGS_RESET_TOO_MANY_RX_DESCS; 1681 1712 set_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags); 1682 1713 1683 1714 return 0; ··· 3369 3388 goto err_mmio_read_less; 3370 3389 } 3371 3390 3372 - rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(dma_width)); 3391 + rc = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(dma_width)); 3373 3392 if (rc) { 3374 - dev_err(dev, "pci_set_dma_mask failed 0x%x\n", rc); 3375 - goto err_mmio_read_less; 3376 - } 3377 - 3378 - rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(dma_width)); 3379 - if (rc) { 3380 - dev_err(dev, "err_pci_set_consistent_dma_mask failed 0x%x\n", 3381 - rc); 3393 + dev_err(dev, "dma_set_mask_and_coherent failed %d\n", rc); 3382 3394 goto err_mmio_read_less; 3383 3395 } 3384 3396 ··· 4139 4165 if (rc) { 4140 4166 dev_err(&pdev->dev, "pci_enable_device_mem() failed!\n"); 4141 4167 return rc; 4168 + } 4169 + 4170 + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(ENA_MAX_PHYS_ADDR_SIZE_BITS)); 4171 + if (rc) { 4172 + dev_err(&pdev->dev, "dma_set_mask_and_coherent failed %d\n", rc); 4173 + goto err_disable_device; 4142 4174 } 4143 4175 4144 4176 pci_set_master(pdev);
+50 -72
drivers/net/ethernet/aquantia/atlantic/aq_ring.c
··· 413 413 buff->rxdata.pg_off, 414 414 buff->len, DMA_FROM_DEVICE); 415 415 416 - /* for single fragment packets use build_skb() */ 417 - if (buff->is_eop && 418 - buff->len <= AQ_CFG_RX_FRAME_MAX - AQ_SKB_ALIGN) { 419 - skb = build_skb(aq_buf_vaddr(&buff->rxdata), 416 + skb = napi_alloc_skb(napi, AQ_CFG_RX_HDR_SIZE); 417 + if (unlikely(!skb)) { 418 + u64_stats_update_begin(&self->stats.rx.syncp); 419 + self->stats.rx.skb_alloc_fails++; 420 + u64_stats_update_end(&self->stats.rx.syncp); 421 + err = -ENOMEM; 422 + goto err_exit; 423 + } 424 + if (is_ptp_ring) 425 + buff->len -= 426 + aq_ptp_extract_ts(self->aq_nic, skb, 427 + aq_buf_vaddr(&buff->rxdata), 428 + buff->len); 429 + 430 + hdr_len = buff->len; 431 + if (hdr_len > AQ_CFG_RX_HDR_SIZE) 432 + hdr_len = eth_get_headlen(skb->dev, 433 + aq_buf_vaddr(&buff->rxdata), 434 + AQ_CFG_RX_HDR_SIZE); 435 + 436 + memcpy(__skb_put(skb, hdr_len), aq_buf_vaddr(&buff->rxdata), 437 + ALIGN(hdr_len, sizeof(long))); 438 + 439 + if (buff->len - hdr_len > 0) { 440 + skb_add_rx_frag(skb, 0, buff->rxdata.page, 441 + buff->rxdata.pg_off + hdr_len, 442 + buff->len - hdr_len, 420 443 AQ_CFG_RX_FRAME_MAX); 421 - if (unlikely(!skb)) { 422 - u64_stats_update_begin(&self->stats.rx.syncp); 423 - self->stats.rx.skb_alloc_fails++; 424 - u64_stats_update_end(&self->stats.rx.syncp); 425 - err = -ENOMEM; 426 - goto err_exit; 427 - } 428 - if (is_ptp_ring) 429 - buff->len -= 430 - aq_ptp_extract_ts(self->aq_nic, skb, 431 - aq_buf_vaddr(&buff->rxdata), 432 - buff->len); 433 - skb_put(skb, buff->len); 434 444 page_ref_inc(buff->rxdata.page); 435 - } else { 436 - skb = napi_alloc_skb(napi, AQ_CFG_RX_HDR_SIZE); 437 - if (unlikely(!skb)) { 438 - u64_stats_update_begin(&self->stats.rx.syncp); 439 - self->stats.rx.skb_alloc_fails++; 440 - u64_stats_update_end(&self->stats.rx.syncp); 441 - err = -ENOMEM; 442 - goto err_exit; 443 - } 444 - if (is_ptp_ring) 445 - buff->len -= 446 - aq_ptp_extract_ts(self->aq_nic, skb, 447 - aq_buf_vaddr(&buff->rxdata), 448 - buff->len); 445 + } 449 446 450 - hdr_len = buff->len; 451 - if (hdr_len > AQ_CFG_RX_HDR_SIZE) 452 - hdr_len = eth_get_headlen(skb->dev, 453 - aq_buf_vaddr(&buff->rxdata), 454 - AQ_CFG_RX_HDR_SIZE); 447 + if (!buff->is_eop) { 448 + buff_ = buff; 449 + i = 1U; 450 + do { 451 + next_ = buff_->next; 452 + buff_ = &self->buff_ring[next_]; 455 453 456 - memcpy(__skb_put(skb, hdr_len), aq_buf_vaddr(&buff->rxdata), 457 - ALIGN(hdr_len, sizeof(long))); 458 - 459 - if (buff->len - hdr_len > 0) { 460 - skb_add_rx_frag(skb, 0, buff->rxdata.page, 461 - buff->rxdata.pg_off + hdr_len, 462 - buff->len - hdr_len, 454 + dma_sync_single_range_for_cpu(aq_nic_get_dev(self->aq_nic), 455 + buff_->rxdata.daddr, 456 + buff_->rxdata.pg_off, 457 + buff_->len, 458 + DMA_FROM_DEVICE); 459 + skb_add_rx_frag(skb, i++, 460 + buff_->rxdata.page, 461 + buff_->rxdata.pg_off, 462 + buff_->len, 463 463 AQ_CFG_RX_FRAME_MAX); 464 - page_ref_inc(buff->rxdata.page); 465 - } 464 + page_ref_inc(buff_->rxdata.page); 465 + buff_->is_cleaned = 1; 466 466 467 - if (!buff->is_eop) { 468 - buff_ = buff; 469 - i = 1U; 470 - do { 471 - next_ = buff_->next, 472 - buff_ = &self->buff_ring[next_]; 467 + buff->is_ip_cso &= buff_->is_ip_cso; 468 + buff->is_udp_cso &= buff_->is_udp_cso; 469 + buff->is_tcp_cso &= buff_->is_tcp_cso; 470 + buff->is_cso_err |= buff_->is_cso_err; 473 471 474 - dma_sync_single_range_for_cpu( 475 - aq_nic_get_dev(self->aq_nic), 476 - buff_->rxdata.daddr, 477 - buff_->rxdata.pg_off, 478 - buff_->len, 479 - DMA_FROM_DEVICE); 480 - skb_add_rx_frag(skb, i++, 481 - buff_->rxdata.page, 482 - buff_->rxdata.pg_off, 483 - buff_->len, 484 - AQ_CFG_RX_FRAME_MAX); 485 - page_ref_inc(buff_->rxdata.page); 486 - buff_->is_cleaned = 1; 487 - 488 - buff->is_ip_cso &= buff_->is_ip_cso; 489 - buff->is_udp_cso &= buff_->is_udp_cso; 490 - buff->is_tcp_cso &= buff_->is_tcp_cso; 491 - buff->is_cso_err |= buff_->is_cso_err; 492 - 493 - } while (!buff_->is_eop); 494 - } 472 + } while (!buff_->is_eop); 495 473 } 496 474 497 475 if (buff->is_vlan)
+3 -1
drivers/net/ethernet/broadcom/bnxt/bnxt.c
··· 11590 11590 if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) != 0 && 11591 11591 dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)) != 0) { 11592 11592 dev_err(&pdev->dev, "System does not support DMA, aborting\n"); 11593 - goto init_err_disable; 11593 + rc = -EIO; 11594 + goto init_err_release; 11594 11595 } 11595 11596 11596 11597 pci_set_master(pdev); ··· 12675 12674 create_singlethread_workqueue("bnxt_pf_wq"); 12676 12675 if (!bnxt_pf_wq) { 12677 12676 dev_err(&pdev->dev, "Unable to create workqueue.\n"); 12677 + rc = -ENOMEM; 12678 12678 goto init_err_pci_clean; 12679 12679 } 12680 12680 }
+1 -1
drivers/net/ethernet/chelsio/Kconfig
··· 68 68 69 69 config CHELSIO_T4 70 70 tristate "Chelsio Communications T4/T5/T6 Ethernet support" 71 - depends on PCI && (IPV6 || IPV6=n) 71 + depends on PCI && (IPV6 || IPV6=n) && (TLS || TLS=n) 72 72 select FW_LOADER 73 73 select MDIO 74 74 select ZLIB_DEFLATE
+2 -1
drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c
··· 880 880 FW_FILTER_WR_OVLAN_VLD_V(f->fs.val.ovlan_vld) | 881 881 FW_FILTER_WR_IVLAN_VLDM_V(f->fs.mask.ivlan_vld) | 882 882 FW_FILTER_WR_OVLAN_VLDM_V(f->fs.mask.ovlan_vld)); 883 - fwr->smac_sel = f->smt->idx; 883 + if (f->fs.newsmac) 884 + fwr->smac_sel = f->smt->idx; 884 885 fwr->rx_chan_rx_rpl_iq = 885 886 htons(FW_FILTER_WR_RX_CHAN_V(0) | 886 887 FW_FILTER_WR_RX_RPL_IQ_V(adapter->sge.fw_evtq.abs_id));
+3 -1
drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c
··· 544 544 /* need to wait for hw response, can't free tx_info yet. */ 545 545 if (tx_info->open_state == CH_KTLS_OPEN_PENDING) 546 546 tx_info->pending_close = true; 547 - /* free the lock after the cleanup */ 547 + else 548 + spin_unlock_bh(&tx_info->lock); 549 + /* if in pending close, free the lock after the cleanup */ 548 550 goto put_module; 549 551 } 550 552 spin_unlock_bh(&tx_info->lock);
+2
drivers/net/ethernet/freescale/dpaa2/Kconfig
··· 4 4 depends on FSL_MC_BUS && FSL_MC_DPIO 5 5 select PHYLINK 6 6 select PCS_LYNX 7 + select FSL_XGMAC_MDIO 8 + select NET_DEVLINK 7 9 help 8 10 This is the DPAA2 Ethernet driver supporting Freescale SoCs 9 11 with DPAA2 (DataPath Acceleration Architecture v2).
+2 -12
drivers/net/ethernet/freescale/enetc/enetc_qos.c
··· 92 92 gcl_config->atc = 0xff; 93 93 gcl_config->acl_len = cpu_to_le16(gcl_len); 94 94 95 - if (!admin_conf->base_time) { 96 - gcl_data->btl = 97 - cpu_to_le32(enetc_rd(&priv->si->hw, ENETC_SICTR0)); 98 - gcl_data->bth = 99 - cpu_to_le32(enetc_rd(&priv->si->hw, ENETC_SICTR1)); 100 - } else { 101 - gcl_data->btl = 102 - cpu_to_le32(lower_32_bits(admin_conf->base_time)); 103 - gcl_data->bth = 104 - cpu_to_le32(upper_32_bits(admin_conf->base_time)); 105 - } 106 - 95 + gcl_data->btl = cpu_to_le32(lower_32_bits(admin_conf->base_time)); 96 + gcl_data->bth = cpu_to_le32(upper_32_bits(admin_conf->base_time)); 107 97 gcl_data->ct = cpu_to_le32(admin_conf->cycle_time); 108 98 gcl_data->cte = cpu_to_le32(admin_conf->cycle_time_extension); 109 99
+20 -3
drivers/net/ethernet/ibm/ibmvnic.c
··· 2074 2074 for (i = 0; i < adapter->req_rx_queues; i++) 2075 2075 napi_schedule(&adapter->napi[i]); 2076 2076 2077 - if (adapter->reset_reason != VNIC_RESET_FAILOVER) 2077 + if (adapter->reset_reason == VNIC_RESET_FAILOVER || 2078 + adapter->reset_reason == VNIC_RESET_MOBILITY) { 2078 2079 call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, netdev); 2080 + call_netdevice_notifiers(NETDEV_RESEND_IGMP, netdev); 2081 + } 2079 2082 2080 2083 rc = 0; 2081 2084 ··· 2148 2145 if (rc) 2149 2146 return IBMVNIC_OPEN_FAILED; 2150 2147 2148 + call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, netdev); 2149 + call_netdevice_notifiers(NETDEV_RESEND_IGMP, netdev); 2150 + 2151 2151 return 0; 2152 2152 } 2153 2153 ··· 2215 2209 2216 2210 if (!saved_state) { 2217 2211 reset_state = adapter->state; 2218 - adapter->state = VNIC_RESETTING; 2219 2212 saved_state = true; 2220 2213 } 2221 2214 spin_unlock_irqrestore(&adapter->state_lock, flags); ··· 2354 2349 static void ibmvnic_tx_timeout(struct net_device *dev, unsigned int txqueue) 2355 2350 { 2356 2351 struct ibmvnic_adapter *adapter = netdev_priv(dev); 2352 + 2353 + if (test_bit(0, &adapter->resetting)) { 2354 + netdev_err(adapter->netdev, 2355 + "Adapter is resetting, skip timeout reset\n"); 2356 + return; 2357 + } 2357 2358 2358 2359 ibmvnic_reset(adapter, VNIC_RESET_TIMEOUT); 2359 2360 } ··· 2878 2867 static int reset_sub_crq_queues(struct ibmvnic_adapter *adapter) 2879 2868 { 2880 2869 int i, rc; 2870 + 2871 + if (!adapter->tx_scrq || !adapter->rx_scrq) 2872 + return -EINVAL; 2881 2873 2882 2874 for (i = 0; i < adapter->req_tx_queues; i++) { 2883 2875 netdev_dbg(adapter->netdev, "Re-setting tx_scrq[%d]\n", i); ··· 4972 4958 } while (rc == H_BUSY || H_IS_LONG_BUSY(rc)); 4973 4959 4974 4960 /* Clean out the queue */ 4961 + if (!crq->msgs) 4962 + return -EINVAL; 4963 + 4975 4964 memset(crq->msgs, 0, PAGE_SIZE); 4976 4965 crq->cur = 0; 4977 4966 crq->active = false; ··· 5279 5262 unsigned long flags; 5280 5263 5281 5264 spin_lock_irqsave(&adapter->state_lock, flags); 5282 - if (adapter->state == VNIC_RESETTING) { 5265 + if (test_bit(0, &adapter->resetting)) { 5283 5266 spin_unlock_irqrestore(&adapter->state_lock, flags); 5284 5267 return -EBUSY; 5285 5268 }
+1 -2
drivers/net/ethernet/ibm/ibmvnic.h
··· 942 942 VNIC_CLOSING, 943 943 VNIC_CLOSED, 944 944 VNIC_REMOVING, 945 - VNIC_REMOVED, 946 - VNIC_RESETTING}; 945 + VNIC_REMOVED}; 947 946 948 947 enum ibmvnic_reset_reason {VNIC_RESET_FAILOVER = 1, 949 948 VNIC_RESET_MOBILITY,
+1
drivers/net/ethernet/intel/i40e/i40e.h
··· 140 140 __I40E_CLIENT_RESET, 141 141 __I40E_VIRTCHNL_OP_PENDING, 142 142 __I40E_RECOVERY_MODE, 143 + __I40E_VF_RESETS_DISABLED, /* disable resets during i40e_remove */ 143 144 /* This must be last as it determines the size of the BITMAP */ 144 145 __I40E_STATE_SIZE__, 145 146 };
+15 -7
drivers/net/ethernet/intel/i40e/i40e_main.c
··· 4010 4010 } 4011 4011 4012 4012 if (icr0 & I40E_PFINT_ICR0_VFLR_MASK) { 4013 - ena_mask &= ~I40E_PFINT_ICR0_ENA_VFLR_MASK; 4014 - set_bit(__I40E_VFLR_EVENT_PENDING, pf->state); 4013 + /* disable any further VFLR event notifications */ 4014 + if (test_bit(__I40E_VF_RESETS_DISABLED, pf->state)) { 4015 + u32 reg = rd32(hw, I40E_PFINT_ICR0_ENA); 4016 + 4017 + reg &= ~I40E_PFINT_ICR0_VFLR_MASK; 4018 + wr32(hw, I40E_PFINT_ICR0_ENA, reg); 4019 + } else { 4020 + ena_mask &= ~I40E_PFINT_ICR0_ENA_VFLR_MASK; 4021 + set_bit(__I40E_VFLR_EVENT_PENDING, pf->state); 4022 + } 4015 4023 } 4016 4024 4017 4025 if (icr0 & I40E_PFINT_ICR0_GRST_MASK) { ··· 15319 15311 while (test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state)) 15320 15312 usleep_range(1000, 2000); 15321 15313 15314 + if (pf->flags & I40E_FLAG_SRIOV_ENABLED) { 15315 + set_bit(__I40E_VF_RESETS_DISABLED, pf->state); 15316 + i40e_free_vfs(pf); 15317 + pf->flags &= ~I40E_FLAG_SRIOV_ENABLED; 15318 + } 15322 15319 /* no more scheduling of any task */ 15323 15320 set_bit(__I40E_SUSPENDED, pf->state); 15324 15321 set_bit(__I40E_DOWN, pf->state); ··· 15349 15336 * has been stopped. 15350 15337 */ 15351 15338 i40e_notify_client_of_netdev_close(pf->vsi[pf->lan_vsi], false); 15352 - 15353 - if (pf->flags & I40E_FLAG_SRIOV_ENABLED) { 15354 - i40e_free_vfs(pf); 15355 - pf->flags &= ~I40E_FLAG_SRIOV_ENABLED; 15356 - } 15357 15339 15358 15340 i40e_fdir_teardown(pf); 15359 15341
+15 -11
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
··· 1403 1403 * @vf: pointer to the VF structure 1404 1404 * @flr: VFLR was issued or not 1405 1405 * 1406 - * Returns true if the VF is reset, false otherwise. 1406 + * Returns true if the VF is in reset, resets successfully, or resets 1407 + * are disabled and false otherwise. 1407 1408 **/ 1408 1409 bool i40e_reset_vf(struct i40e_vf *vf, bool flr) 1409 1410 { ··· 1414 1413 u32 reg; 1415 1414 int i; 1416 1415 1416 + if (test_bit(__I40E_VF_RESETS_DISABLED, pf->state)) 1417 + return true; 1418 + 1417 1419 /* If the VFs have been disabled, this means something else is 1418 1420 * resetting the VF, so we shouldn't continue. 1419 1421 */ 1420 1422 if (test_and_set_bit(__I40E_VF_DISABLE, pf->state)) 1421 - return false; 1423 + return true; 1422 1424 1423 1425 i40e_trigger_vf_reset(vf, flr); 1424 1426 ··· 1585 1581 1586 1582 i40e_notify_client_of_vf_enable(pf, 0); 1587 1583 1584 + /* Disable IOV before freeing resources. This lets any VF drivers 1585 + * running in the host get themselves cleaned up before we yank 1586 + * the carpet out from underneath their feet. 1587 + */ 1588 + if (!pci_vfs_assigned(pf->pdev)) 1589 + pci_disable_sriov(pf->pdev); 1590 + else 1591 + dev_warn(&pf->pdev->dev, "VFs are assigned - not disabling SR-IOV\n"); 1592 + 1588 1593 /* Amortize wait time by stopping all VFs at the same time */ 1589 1594 for (i = 0; i < pf->num_alloc_vfs; i++) { 1590 1595 if (test_bit(I40E_VF_STATE_INIT, &pf->vf[i].vf_states)) ··· 1608 1595 1609 1596 i40e_vsi_wait_queues_disabled(pf->vsi[pf->vf[i].lan_vsi_idx]); 1610 1597 } 1611 - 1612 - /* Disable IOV before freeing resources. This lets any VF drivers 1613 - * running in the host get themselves cleaned up before we yank 1614 - * the carpet out from underneath their feet. 1615 - */ 1616 - if (!pci_vfs_assigned(pf->pdev)) 1617 - pci_disable_sriov(pf->pdev); 1618 - else 1619 - dev_warn(&pf->pdev->dev, "VFs are assigned - not disabling SR-IOV\n"); 1620 1598 1621 1599 /* free up VF resources */ 1622 1600 tmp = pf->num_alloc_vfs;
+1 -1
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
··· 1171 1171 .pcs_get_adv_lp = dwmac4_get_adv_lp, 1172 1172 .debug = dwmac4_debug, 1173 1173 .set_filter = dwmac4_set_filter, 1174 - .flex_pps_config = dwmac5_flex_pps_config, 1175 1174 .set_mac_loopback = dwmac4_set_mac_loopback, 1176 1175 .update_vlan_hash = dwmac4_update_vlan_hash, 1177 1176 .sarc_configure = dwmac4_sarc_configure, ··· 1212 1213 .pcs_get_adv_lp = dwmac4_get_adv_lp, 1213 1214 .debug = dwmac4_debug, 1214 1215 .set_filter = dwmac4_set_filter, 1216 + .flex_pps_config = dwmac5_flex_pps_config, 1215 1217 .set_mac_loopback = dwmac4_set_mac_loopback, 1216 1218 .update_vlan_hash = dwmac4_update_vlan_hash, 1217 1219 .sarc_configure = dwmac4_sarc_configure,
+11 -3
drivers/net/tun.c
··· 1961 1961 struct tun_file *tfile = file->private_data; 1962 1962 struct tun_struct *tun = tun_get(tfile); 1963 1963 ssize_t result; 1964 + int noblock = 0; 1964 1965 1965 1966 if (!tun) 1966 1967 return -EBADFD; 1967 1968 1968 - result = tun_get_user(tun, tfile, NULL, from, 1969 - file->f_flags & O_NONBLOCK, false); 1969 + if ((file->f_flags & O_NONBLOCK) || (iocb->ki_flags & IOCB_NOWAIT)) 1970 + noblock = 1; 1971 + 1972 + result = tun_get_user(tun, tfile, NULL, from, noblock, false); 1970 1973 1971 1974 tun_put(tun); 1972 1975 return result; ··· 2188 2185 struct tun_file *tfile = file->private_data; 2189 2186 struct tun_struct *tun = tun_get(tfile); 2190 2187 ssize_t len = iov_iter_count(to), ret; 2188 + int noblock = 0; 2191 2189 2192 2190 if (!tun) 2193 2191 return -EBADFD; 2194 - ret = tun_do_read(tun, tfile, to, file->f_flags & O_NONBLOCK, NULL); 2192 + 2193 + if ((file->f_flags & O_NONBLOCK) || (iocb->ki_flags & IOCB_NOWAIT)) 2194 + noblock = 1; 2195 + 2196 + ret = tun_do_read(tun, tfile, to, noblock, NULL); 2195 2197 ret = min_t(ssize_t, ret, len); 2196 2198 if (ret > 0) 2197 2199 iocb->ki_pos = ret;
+1 -1
drivers/net/usb/ipheth.c
··· 59 59 #define IPHETH_USBINTF_SUBCLASS 253 60 60 #define IPHETH_USBINTF_PROTO 1 61 61 62 - #define IPHETH_BUF_SIZE 1516 62 + #define IPHETH_BUF_SIZE 1514 63 63 #define IPHETH_IP_ALIGN 2 /* padding at front of URB */ 64 64 #define IPHETH_TX_TIMEOUT (5 * HZ) 65 65
+5 -5
drivers/net/wireless/intel/iwlwifi/fw/api/sta.h
··· 5 5 * 6 6 * GPL LICENSE SUMMARY 7 7 * 8 - * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 9 8 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH 10 9 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 11 - * Copyright(c) 2018 - 2019 Intel Corporation 10 + * Copyright(c) 2012-2014, 2018 - 2020 Intel Corporation 12 11 * 13 12 * This program is free software; you can redistribute it and/or modify 14 13 * it under the terms of version 2 of the GNU General Public License as ··· 27 28 * 28 29 * BSD LICENSE 29 30 * 30 - * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 31 31 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH 32 32 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 33 - * Copyright(c) 2018 - 2019 Intel Corporation 33 + * Copyright(c) 2012-2014, 2018 - 2020 Intel Corporation 34 34 * All rights reserved. 35 35 * 36 36 * Redistribution and use in source and binary forms, with or without ··· 126 128 STA_FLG_MAX_AGG_SIZE_256K = (5 << STA_FLG_MAX_AGG_SIZE_SHIFT), 127 129 STA_FLG_MAX_AGG_SIZE_512K = (6 << STA_FLG_MAX_AGG_SIZE_SHIFT), 128 130 STA_FLG_MAX_AGG_SIZE_1024K = (7 << STA_FLG_MAX_AGG_SIZE_SHIFT), 129 - STA_FLG_MAX_AGG_SIZE_MSK = (7 << STA_FLG_MAX_AGG_SIZE_SHIFT), 131 + STA_FLG_MAX_AGG_SIZE_2M = (8 << STA_FLG_MAX_AGG_SIZE_SHIFT), 132 + STA_FLG_MAX_AGG_SIZE_4M = (9 << STA_FLG_MAX_AGG_SIZE_SHIFT), 133 + STA_FLG_MAX_AGG_SIZE_MSK = (0xf << STA_FLG_MAX_AGG_SIZE_SHIFT), 130 134 131 135 STA_FLG_AGG_MPDU_DENS_SHIFT = 23, 132 136 STA_FLG_AGG_MPDU_DENS_2US = (4 << STA_FLG_AGG_MPDU_DENS_SHIFT),
+5 -3
drivers/net/wireless/intel/iwlwifi/fw/api/time-event.h
··· 8 8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 9 9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 10 10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 11 - * Copyright(c) 2018 - 2019 Intel Corporation 11 + * Copyright(c) 2018 - 2020 Intel Corporation 12 12 * 13 13 * This program is free software; you can redistribute it and/or modify 14 14 * it under the terms of version 2 of the GNU General Public License as ··· 31 31 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 32 32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 33 33 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 34 - * Copyright(c) 2018 - 2019 Intel Corporation 34 + * Copyright(c) 2018 - 2020 Intel Corporation 35 35 * All rights reserved. 36 36 * 37 37 * Redistribution and use in source and binary forms, with or without ··· 421 421 * able to run the GO Negotiation. Will not be fragmented and not 422 422 * repetitive. Valid only on the P2P Device MAC. Only the duration will 423 423 * be taken into account. 424 + * @SESSION_PROTECT_CONF_MAX_ID: not used 424 425 */ 425 426 enum iwl_mvm_session_prot_conf_id { 426 427 SESSION_PROTECT_CONF_ASSOC, 427 428 SESSION_PROTECT_CONF_GO_CLIENT_ASSOC, 428 429 SESSION_PROTECT_CONF_P2P_DEVICE_DISCOV, 429 430 SESSION_PROTECT_CONF_P2P_GO_NEGOTIATION, 431 + SESSION_PROTECT_CONF_MAX_ID, 430 432 }; /* SESSION_PROTECTION_CONF_ID_E_VER_1 */ 431 433 432 434 /** ··· 461 459 * @mac_id: the mac id for which the session protection started / ended 462 460 * @status: 1 means success, 0 means failure 463 461 * @start: 1 means the session protection started, 0 means it ended 464 - * @conf_id: the configuration id of the session that started / eneded 462 + * @conf_id: see &enum iwl_mvm_session_prot_conf_id 465 463 * 466 464 * Note that any session protection will always get two notifications: start 467 465 * and end even the firmware could not schedule it.
+10
drivers/net/wireless/intel/iwlwifi/iwl-csr.h
··· 147 147 #define CSR_MAC_SHADOW_REG_CTL2 (CSR_BASE + 0x0AC) 148 148 #define CSR_MAC_SHADOW_REG_CTL2_RX_WAKE 0xFFFF 149 149 150 + /* LTR control (since IWL_DEVICE_FAMILY_22000) */ 151 + #define CSR_LTR_LONG_VAL_AD (CSR_BASE + 0x0D4) 152 + #define CSR_LTR_LONG_VAL_AD_NO_SNOOP_REQ 0x80000000 153 + #define CSR_LTR_LONG_VAL_AD_NO_SNOOP_SCALE 0x1c000000 154 + #define CSR_LTR_LONG_VAL_AD_NO_SNOOP_VAL 0x03ff0000 155 + #define CSR_LTR_LONG_VAL_AD_SNOOP_REQ 0x00008000 156 + #define CSR_LTR_LONG_VAL_AD_SNOOP_SCALE 0x00001c00 157 + #define CSR_LTR_LONG_VAL_AD_SNOOP_VAL 0x000003ff 158 + #define CSR_LTR_LONG_VAL_AD_SCALE_USEC 2 159 + 150 160 /* GIO Chicken Bits (PCI Express bus link power management) */ 151 161 #define CSR_GIO_CHICKEN_BITS (CSR_BASE+0x100) 152 162
+4 -1
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
··· 3080 3080 3081 3081 /* this would be a mac80211 bug ... but don't crash */ 3082 3082 if (WARN_ON_ONCE(!mvmvif->phy_ctxt)) 3083 - return -EINVAL; 3083 + return test_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED, &mvm->status) ? 0 : -EINVAL; 3084 3084 3085 3085 /* 3086 3086 * If we are in a STA removal flow and in DQA mode: ··· 3126 3126 ret = -EINVAL; 3127 3127 goto out_unlock; 3128 3128 } 3129 + 3130 + if (vif->type == NL80211_IFTYPE_STATION) 3131 + vif->bss_conf.he_support = sta->he_cap.has_he; 3129 3132 3130 3133 if (sta->tdls && 3131 3134 (vif->p2p ||
+18
drivers/net/wireless/intel/iwlwifi/mvm/sta.c
··· 196 196 mpdu_dens = sta->ht_cap.ampdu_density; 197 197 } 198 198 199 + 199 200 if (sta->vht_cap.vht_supported) { 200 201 agg_size = sta->vht_cap.cap & 201 202 IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK; ··· 205 204 } else if (sta->ht_cap.ht_supported) { 206 205 agg_size = sta->ht_cap.ampdu_factor; 207 206 } 207 + 208 + /* D6.0 10.12.2 A-MPDU length limit rules 209 + * A STA indicates the maximum length of the A-MPDU preEOF padding 210 + * that it can receive in an HE PPDU in the Maximum A-MPDU Length 211 + * Exponent field in its HT Capabilities, VHT Capabilities, 212 + * and HE 6 GHz Band Capabilities elements (if present) and the 213 + * Maximum AMPDU Length Exponent Extension field in its HE 214 + * Capabilities element 215 + */ 216 + if (sta->he_cap.has_he) 217 + agg_size += u8_get_bits(sta->he_cap.he_cap_elem.mac_cap_info[3], 218 + IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_MASK); 219 + 220 + /* Limit to max A-MPDU supported by FW */ 221 + if (agg_size > (STA_FLG_MAX_AGG_SIZE_4M >> STA_FLG_MAX_AGG_SIZE_SHIFT)) 222 + agg_size = (STA_FLG_MAX_AGG_SIZE_4M >> 223 + STA_FLG_MAX_AGG_SIZE_SHIFT); 208 224 209 225 add_sta_cmd.station_flags |= 210 226 cpu_to_le32(agg_size << STA_FLG_MAX_AGG_SIZE_SHIFT);
+69 -34
drivers/net/wireless/intel/iwlwifi/mvm/time-event.c
··· 641 641 } 642 642 } 643 643 644 + static void iwl_mvm_cancel_session_protection(struct iwl_mvm *mvm, 645 + struct iwl_mvm_vif *mvmvif) 646 + { 647 + struct iwl_mvm_session_prot_cmd cmd = { 648 + .id_and_color = 649 + cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, 650 + mvmvif->color)), 651 + .action = cpu_to_le32(FW_CTXT_ACTION_REMOVE), 652 + .conf_id = cpu_to_le32(mvmvif->time_event_data.id), 653 + }; 654 + int ret; 655 + 656 + ret = iwl_mvm_send_cmd_pdu(mvm, iwl_cmd_id(SESSION_PROTECTION_CMD, 657 + MAC_CONF_GROUP, 0), 658 + 0, sizeof(cmd), &cmd); 659 + if (ret) 660 + IWL_ERR(mvm, 661 + "Couldn't send the SESSION_PROTECTION_CMD: %d\n", ret); 662 + } 663 + 644 664 static bool __iwl_mvm_remove_time_event(struct iwl_mvm *mvm, 645 665 struct iwl_mvm_time_event_data *te_data, 646 666 u32 *uid) 647 667 { 648 668 u32 id; 669 + struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(te_data->vif); 649 670 650 671 /* 651 672 * It is possible that by the time we got to this point the time ··· 684 663 iwl_mvm_te_clear_data(mvm, te_data); 685 664 spin_unlock_bh(&mvm->time_event_lock); 686 665 687 - /* 688 - * It is possible that by the time we try to remove it, the time event 689 - * has already ended and removed. In such a case there is no need to 690 - * send a removal command. 666 + /* When session protection is supported, the te_data->id field 667 + * is reused to save session protection's configuration. 691 668 */ 692 - if (id == TE_MAX) { 693 - IWL_DEBUG_TE(mvm, "TE 0x%x has already ended\n", *uid); 669 + if (fw_has_capa(&mvm->fw->ucode_capa, 670 + IWL_UCODE_TLV_CAPA_SESSION_PROT_CMD)) { 671 + if (mvmvif && id < SESSION_PROTECT_CONF_MAX_ID) { 672 + /* Session protection is still ongoing. Cancel it */ 673 + iwl_mvm_cancel_session_protection(mvm, mvmvif); 674 + if (te_data->vif->type == NL80211_IFTYPE_P2P_DEVICE) { 675 + set_bit(IWL_MVM_STATUS_NEED_FLUSH_P2P, &mvm->status); 676 + iwl_mvm_roc_finished(mvm); 677 + } 678 + } 694 679 return false; 680 + } else { 681 + /* It is possible that by the time we try to remove it, the 682 + * time event has already ended and removed. In such a case 683 + * there is no need to send a removal command. 684 + */ 685 + if (id == TE_MAX) { 686 + IWL_DEBUG_TE(mvm, "TE 0x%x has already ended\n", *uid); 687 + return false; 688 + } 695 689 } 696 690 697 691 return true; ··· 807 771 struct iwl_rx_packet *pkt = rxb_addr(rxb); 808 772 struct iwl_mvm_session_prot_notif *notif = (void *)pkt->data; 809 773 struct ieee80211_vif *vif; 774 + struct iwl_mvm_vif *mvmvif; 810 775 811 776 rcu_read_lock(); 812 777 vif = iwl_mvm_rcu_dereference_vif_id(mvm, le32_to_cpu(notif->mac_id), ··· 816 779 if (!vif) 817 780 goto out_unlock; 818 781 782 + mvmvif = iwl_mvm_vif_from_mac80211(vif); 783 + 819 784 /* The vif is not a P2P_DEVICE, maintain its time_event_data */ 820 785 if (vif->type != NL80211_IFTYPE_P2P_DEVICE) { 821 - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 822 786 struct iwl_mvm_time_event_data *te_data = 823 787 &mvmvif->time_event_data; 824 788 ··· 854 816 855 817 if (!le32_to_cpu(notif->status) || !le32_to_cpu(notif->start)) { 856 818 /* End TE, notify mac80211 */ 819 + mvmvif->time_event_data.id = SESSION_PROTECT_CONF_MAX_ID; 857 820 ieee80211_remain_on_channel_expired(mvm->hw); 858 821 set_bit(IWL_MVM_STATUS_NEED_FLUSH_P2P, &mvm->status); 859 822 iwl_mvm_roc_finished(mvm); 860 823 } else if (le32_to_cpu(notif->start)) { 824 + if (WARN_ON(mvmvif->time_event_data.id != 825 + le32_to_cpu(notif->conf_id))) 826 + goto out_unlock; 861 827 set_bit(IWL_MVM_STATUS_ROC_RUNNING, &mvm->status); 862 828 ieee80211_ready_on_channel(mvm->hw); /* Start TE */ 863 829 } ··· 887 845 888 846 lockdep_assert_held(&mvm->mutex); 889 847 848 + /* The time_event_data.id field is reused to save session 849 + * protection's configuration. 850 + */ 890 851 switch (type) { 891 852 case IEEE80211_ROC_TYPE_NORMAL: 892 - cmd.conf_id = 893 - cpu_to_le32(SESSION_PROTECT_CONF_P2P_DEVICE_DISCOV); 853 + mvmvif->time_event_data.id = 854 + SESSION_PROTECT_CONF_P2P_DEVICE_DISCOV; 894 855 break; 895 856 case IEEE80211_ROC_TYPE_MGMT_TX: 896 - cmd.conf_id = 897 - cpu_to_le32(SESSION_PROTECT_CONF_P2P_GO_NEGOTIATION); 857 + mvmvif->time_event_data.id = 858 + SESSION_PROTECT_CONF_P2P_GO_NEGOTIATION; 898 859 break; 899 860 default: 900 861 WARN_ONCE(1, "Got an invalid ROC type\n"); 901 862 return -EINVAL; 902 863 } 903 864 865 + cmd.conf_id = cpu_to_le32(mvmvif->time_event_data.id); 904 866 return iwl_mvm_send_cmd_pdu(mvm, iwl_cmd_id(SESSION_PROTECTION_CMD, 905 867 MAC_CONF_GROUP, 0), 906 868 0, sizeof(cmd), &cmd); ··· 1006 960 __iwl_mvm_remove_time_event(mvm, te_data, &uid); 1007 961 } 1008 962 1009 - static void iwl_mvm_cancel_session_protection(struct iwl_mvm *mvm, 1010 - struct iwl_mvm_vif *mvmvif) 1011 - { 1012 - struct iwl_mvm_session_prot_cmd cmd = { 1013 - .id_and_color = 1014 - cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, 1015 - mvmvif->color)), 1016 - .action = cpu_to_le32(FW_CTXT_ACTION_REMOVE), 1017 - }; 1018 - int ret; 1019 - 1020 - ret = iwl_mvm_send_cmd_pdu(mvm, iwl_cmd_id(SESSION_PROTECTION_CMD, 1021 - MAC_CONF_GROUP, 0), 1022 - 0, sizeof(cmd), &cmd); 1023 - if (ret) 1024 - IWL_ERR(mvm, 1025 - "Couldn't send the SESSION_PROTECTION_CMD: %d\n", ret); 1026 - } 1027 - 1028 963 void iwl_mvm_stop_roc(struct iwl_mvm *mvm, struct ieee80211_vif *vif) 1029 964 { 1030 965 struct iwl_mvm_vif *mvmvif; ··· 1015 988 IWL_UCODE_TLV_CAPA_SESSION_PROT_CMD)) { 1016 989 mvmvif = iwl_mvm_vif_from_mac80211(vif); 1017 990 1018 - iwl_mvm_cancel_session_protection(mvm, mvmvif); 1019 - 1020 - if (vif->type == NL80211_IFTYPE_P2P_DEVICE) 991 + if (vif->type == NL80211_IFTYPE_P2P_DEVICE) { 992 + iwl_mvm_cancel_session_protection(mvm, mvmvif); 1021 993 set_bit(IWL_MVM_STATUS_NEED_FLUSH_P2P, &mvm->status); 994 + } else { 995 + iwl_mvm_remove_aux_roc_te(mvm, mvmvif, 996 + &mvmvif->time_event_data); 997 + } 1022 998 1023 999 iwl_mvm_roc_finished(mvm); 1024 1000 ··· 1156 1126 cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, 1157 1127 mvmvif->color)), 1158 1128 .action = cpu_to_le32(FW_CTXT_ACTION_ADD), 1159 - .conf_id = cpu_to_le32(SESSION_PROTECT_CONF_ASSOC), 1160 1129 .duration_tu = cpu_to_le32(MSEC_TO_TU(duration)), 1161 1130 }; 1131 + 1132 + /* The time_event_data.id field is reused to save session 1133 + * protection's configuration. 1134 + */ 1135 + mvmvif->time_event_data.id = SESSION_PROTECT_CONF_ASSOC; 1136 + cmd.conf_id = cpu_to_le32(mvmvif->time_event_data.id); 1162 1137 1163 1138 lockdep_assert_held(&mvm->mutex); 1164 1139
+20
drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c
··· 252 252 253 253 iwl_set_bit(trans, CSR_CTXT_INFO_BOOT_CTRL, 254 254 CSR_AUTO_FUNC_BOOT_ENA); 255 + 256 + if (trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_AX210) { 257 + /* 258 + * The firmware initializes this again later (to a smaller 259 + * value), but for the boot process initialize the LTR to 260 + * ~250 usec. 261 + */ 262 + u32 val = CSR_LTR_LONG_VAL_AD_NO_SNOOP_REQ | 263 + u32_encode_bits(CSR_LTR_LONG_VAL_AD_SCALE_USEC, 264 + CSR_LTR_LONG_VAL_AD_NO_SNOOP_SCALE) | 265 + u32_encode_bits(250, 266 + CSR_LTR_LONG_VAL_AD_NO_SNOOP_VAL) | 267 + CSR_LTR_LONG_VAL_AD_SNOOP_REQ | 268 + u32_encode_bits(CSR_LTR_LONG_VAL_AD_SCALE_USEC, 269 + CSR_LTR_LONG_VAL_AD_SNOOP_SCALE) | 270 + u32_encode_bits(250, CSR_LTR_LONG_VAL_AD_SNOOP_VAL); 271 + 272 + iwl_write32(trans, CSR_LTR_LONG_VAL_AD, val); 273 + } 274 + 255 275 if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210) 256 276 iwl_write_umac_prph(trans, UREG_CPU_INIT_RUN, 1); 257 277 else
+27 -9
drivers/net/wireless/intel/iwlwifi/pcie/trans.c
··· 2156 2156 void *buf, int dwords) 2157 2157 { 2158 2158 unsigned long flags; 2159 - int offs, ret = 0; 2159 + int offs = 0; 2160 2160 u32 *vals = buf; 2161 2161 2162 - if (iwl_trans_grab_nic_access(trans, &flags)) { 2163 - iwl_write32(trans, HBUS_TARG_MEM_RADDR, addr); 2164 - for (offs = 0; offs < dwords; offs++) 2165 - vals[offs] = iwl_read32(trans, HBUS_TARG_MEM_RDAT); 2166 - iwl_trans_release_nic_access(trans, &flags); 2167 - } else { 2168 - ret = -EBUSY; 2162 + while (offs < dwords) { 2163 + /* limit the time we spin here under lock to 1/2s */ 2164 + ktime_t timeout = ktime_add_us(ktime_get(), 500 * USEC_PER_MSEC); 2165 + 2166 + if (iwl_trans_grab_nic_access(trans, &flags)) { 2167 + iwl_write32(trans, HBUS_TARG_MEM_RADDR, 2168 + addr + 4 * offs); 2169 + 2170 + while (offs < dwords) { 2171 + vals[offs] = iwl_read32(trans, 2172 + HBUS_TARG_MEM_RDAT); 2173 + offs++; 2174 + 2175 + /* calling ktime_get is expensive so 2176 + * do it once in 128 reads 2177 + */ 2178 + if (offs % 128 == 0 && ktime_after(ktime_get(), 2179 + timeout)) 2180 + break; 2181 + } 2182 + iwl_trans_release_nic_access(trans, &flags); 2183 + } else { 2184 + return -EBUSY; 2185 + } 2169 2186 } 2170 - return ret; 2187 + 2188 + return 0; 2171 2189 } 2172 2190 2173 2191 static int iwl_trans_pcie_write_mem(struct iwl_trans *trans, u32 addr,
+1 -1
drivers/net/wireless/realtek/rtw88/fw.c
··· 1482 1482 int rtw_fw_dump_fifo(struct rtw_dev *rtwdev, u8 fifo_sel, u32 addr, u32 size, 1483 1483 u32 *buffer) 1484 1484 { 1485 - if (!rtwdev->chip->fw_fifo_addr) { 1485 + if (!rtwdev->chip->fw_fifo_addr[0]) { 1486 1486 rtw_dbg(rtwdev, RTW_DBG_FW, "chip not support dump fw fifo\n"); 1487 1487 return -ENOTSUPP; 1488 1488 }
+2 -2
drivers/nfc/s3fwrn5/i2c.c
··· 26 26 struct i2c_client *i2c_dev; 27 27 struct nci_dev *ndev; 28 28 29 - unsigned int gpio_en; 30 - unsigned int gpio_fw_wake; 29 + int gpio_en; 30 + int gpio_fw_wake; 31 31 32 32 struct mutex mutex; 33 33
+16 -33
drivers/ptp/ptp_clockmatrix.c
··· 103 103 return 0; 104 104 } 105 105 106 - static int idtcm_strverscmp(const char *ver1, const char *ver2) 106 + static int idtcm_strverscmp(const char *version1, const char *version2) 107 107 { 108 - u8 num1; 109 - u8 num2; 110 - int result = 0; 108 + u8 ver1[3], ver2[3]; 109 + int i; 111 110 112 - /* loop through each level of the version string */ 113 - while (result == 0) { 114 - /* extract leading version numbers */ 115 - if (kstrtou8(ver1, 10, &num1) < 0) 111 + if (sscanf(version1, "%hhu.%hhu.%hhu", 112 + &ver1[0], &ver1[1], &ver1[2]) != 3) 113 + return -1; 114 + if (sscanf(version2, "%hhu.%hhu.%hhu", 115 + &ver2[0], &ver2[1], &ver2[2]) != 3) 116 + return -1; 117 + 118 + for (i = 0; i < 3; i++) { 119 + if (ver1[i] > ver2[i]) 120 + return 1; 121 + if (ver1[i] < ver2[i]) 116 122 return -1; 117 - 118 - if (kstrtou8(ver2, 10, &num2) < 0) 119 - return -1; 120 - 121 - /* if numbers differ, then set the result */ 122 - if (num1 < num2) 123 - result = -1; 124 - else if (num1 > num2) 125 - result = 1; 126 - else { 127 - /* if numbers are the same, go to next level */ 128 - ver1 = strchr(ver1, '.'); 129 - ver2 = strchr(ver2, '.'); 130 - if (!ver1 && !ver2) 131 - break; 132 - else if (!ver1) 133 - result = -1; 134 - else if (!ver2) 135 - result = 1; 136 - else { 137 - ver1++; 138 - ver2++; 139 - } 140 - } 141 123 } 142 - return result; 124 + 125 + return 0; 143 126 } 144 127 145 128 static int idtcm_xfer_read(struct idtcm *idtcm,
+6 -3
drivers/s390/net/qeth_core.h
··· 417 417 QETH_QDIO_BUF_EMPTY, 418 418 /* Filled by driver; owned by hardware in order to be sent. */ 419 419 QETH_QDIO_BUF_PRIMED, 420 - /* Identified to be pending in TPQ. */ 420 + /* Discovered by the TX completion code: */ 421 421 QETH_QDIO_BUF_PENDING, 422 - /* Found in completion queue. */ 423 - QETH_QDIO_BUF_IN_CQ, 422 + /* Finished by the TX completion code: */ 423 + QETH_QDIO_BUF_NEED_QAOB, 424 + /* Received QAOB notification on CQ: */ 425 + QETH_QDIO_BUF_QAOB_OK, 426 + QETH_QDIO_BUF_QAOB_ERROR, 424 427 /* Handled via transfer pending / completion queue. */ 425 428 QETH_QDIO_BUF_HANDLED_DELAYED, 426 429 };
+54 -28
drivers/s390/net/qeth_core_main.c
··· 33 33 34 34 #include <net/iucv/af_iucv.h> 35 35 #include <net/dsfield.h> 36 + #include <net/sock.h> 36 37 37 38 #include <asm/ebcdic.h> 38 39 #include <asm/chpid.h> ··· 500 499 501 500 } 502 501 } 503 - if (forced_cleanup && (atomic_read(&(q->bufs[bidx]->state)) == 504 - QETH_QDIO_BUF_HANDLED_DELAYED)) { 505 - /* for recovery situations */ 506 - qeth_init_qdio_out_buf(q, bidx); 507 - QETH_CARD_TEXT(q->card, 2, "clprecov"); 508 - } 509 502 } 510 503 511 504 static void qeth_qdio_handle_aob(struct qeth_card *card, 512 505 unsigned long phys_aob_addr) 513 506 { 507 + enum qeth_qdio_out_buffer_state new_state = QETH_QDIO_BUF_QAOB_OK; 514 508 struct qaob *aob; 515 509 struct qeth_qdio_out_buffer *buffer; 516 510 enum iucv_tx_notify notification; ··· 516 520 QETH_CARD_TEXT_(card, 5, "%lx", phys_aob_addr); 517 521 buffer = (struct qeth_qdio_out_buffer *) aob->user1; 518 522 QETH_CARD_TEXT_(card, 5, "%lx", aob->user1); 519 - 520 - if (atomic_cmpxchg(&buffer->state, QETH_QDIO_BUF_PRIMED, 521 - QETH_QDIO_BUF_IN_CQ) == QETH_QDIO_BUF_PRIMED) { 522 - notification = TX_NOTIFY_OK; 523 - } else { 524 - WARN_ON_ONCE(atomic_read(&buffer->state) != 525 - QETH_QDIO_BUF_PENDING); 526 - atomic_set(&buffer->state, QETH_QDIO_BUF_IN_CQ); 527 - notification = TX_NOTIFY_DELAYED_OK; 528 - } 529 - 530 - if (aob->aorc != 0) { 531 - QETH_CARD_TEXT_(card, 2, "aorc%02X", aob->aorc); 532 - notification = qeth_compute_cq_notification(aob->aorc, 1); 533 - } 534 - qeth_notify_skbs(buffer->q, buffer, notification); 535 523 536 524 /* Free dangling allocations. The attached skbs are handled by 537 525 * qeth_cleanup_handled_pending(). ··· 528 548 if (data && buffer->is_header[i]) 529 549 kmem_cache_free(qeth_core_header_cache, data); 530 550 } 531 - atomic_set(&buffer->state, QETH_QDIO_BUF_HANDLED_DELAYED); 551 + 552 + if (aob->aorc) { 553 + QETH_CARD_TEXT_(card, 2, "aorc%02X", aob->aorc); 554 + new_state = QETH_QDIO_BUF_QAOB_ERROR; 555 + } 556 + 557 + switch (atomic_xchg(&buffer->state, new_state)) { 558 + case QETH_QDIO_BUF_PRIMED: 559 + /* Faster than TX completion code. */ 560 + notification = qeth_compute_cq_notification(aob->aorc, 0); 561 + qeth_notify_skbs(buffer->q, buffer, notification); 562 + atomic_set(&buffer->state, QETH_QDIO_BUF_HANDLED_DELAYED); 563 + break; 564 + case QETH_QDIO_BUF_PENDING: 565 + /* TX completion code is active and will handle the async 566 + * completion for us. 567 + */ 568 + break; 569 + case QETH_QDIO_BUF_NEED_QAOB: 570 + /* TX completion code is already finished. */ 571 + notification = qeth_compute_cq_notification(aob->aorc, 1); 572 + qeth_notify_skbs(buffer->q, buffer, notification); 573 + atomic_set(&buffer->state, QETH_QDIO_BUF_HANDLED_DELAYED); 574 + break; 575 + default: 576 + WARN_ON_ONCE(1); 577 + } 532 578 533 579 qdio_release_aob(aob); 534 580 } ··· 1411 1405 skb_queue_walk(&buf->skb_list, skb) { 1412 1406 QETH_CARD_TEXT_(q->card, 5, "skbn%d", notification); 1413 1407 QETH_CARD_TEXT_(q->card, 5, "%lx", (long) skb); 1414 - if (skb->protocol == htons(ETH_P_AF_IUCV) && skb->sk) 1408 + if (skb->sk && skb->sk->sk_family == PF_IUCV) 1415 1409 iucv_sk(skb->sk)->sk_txnotify(skb, notification); 1416 1410 } 1417 1411 } ··· 1421 1415 { 1422 1416 struct qeth_qdio_out_q *queue = buf->q; 1423 1417 struct sk_buff *skb; 1424 - 1425 - /* release may never happen from within CQ tasklet scope */ 1426 - WARN_ON_ONCE(atomic_read(&buf->state) == QETH_QDIO_BUF_IN_CQ); 1427 1418 1428 1419 if (atomic_read(&buf->state) == QETH_QDIO_BUF_PENDING) 1429 1420 qeth_notify_skbs(queue, buf, TX_NOTIFY_GENERALERROR); ··· 5872 5869 5873 5870 if (atomic_cmpxchg(&buffer->state, QETH_QDIO_BUF_PRIMED, 5874 5871 QETH_QDIO_BUF_PENDING) == 5875 - QETH_QDIO_BUF_PRIMED) 5872 + QETH_QDIO_BUF_PRIMED) { 5876 5873 qeth_notify_skbs(queue, buffer, TX_NOTIFY_PENDING); 5874 + 5875 + /* Handle race with qeth_qdio_handle_aob(): */ 5876 + switch (atomic_xchg(&buffer->state, 5877 + QETH_QDIO_BUF_NEED_QAOB)) { 5878 + case QETH_QDIO_BUF_PENDING: 5879 + /* No concurrent QAOB notification. */ 5880 + break; 5881 + case QETH_QDIO_BUF_QAOB_OK: 5882 + qeth_notify_skbs(queue, buffer, 5883 + TX_NOTIFY_DELAYED_OK); 5884 + atomic_set(&buffer->state, 5885 + QETH_QDIO_BUF_HANDLED_DELAYED); 5886 + break; 5887 + case QETH_QDIO_BUF_QAOB_ERROR: 5888 + qeth_notify_skbs(queue, buffer, 5889 + TX_NOTIFY_DELAYED_GENERALERROR); 5890 + atomic_set(&buffer->state, 5891 + QETH_QDIO_BUF_HANDLED_DELAYED); 5892 + break; 5893 + default: 5894 + WARN_ON_ONCE(1); 5895 + } 5896 + } 5877 5897 5878 5898 QETH_CARD_TEXT_(card, 5, "pel%u", bidx); 5879 5899
+2 -16
drivers/s390/net/qeth_l2_main.c
··· 985 985 * change notification' and thus can support the learning_sync bridgeport 986 986 * attribute 987 987 * @card: qeth_card structure pointer 988 - * 989 - * This is a destructive test and must be called before dev2br or 990 - * bridgeport address notification is enabled! 991 988 */ 992 989 static void qeth_l2_detect_dev2br_support(struct qeth_card *card) 993 990 { 994 991 struct qeth_priv *priv = netdev_priv(card->dev); 995 992 bool dev2br_supported; 996 - int rc; 997 993 998 994 QETH_CARD_TEXT(card, 2, "d2brsup"); 999 995 if (!IS_IQD(card)) 1000 996 return; 1001 997 1002 998 /* dev2br requires valid cssid,iid,chid */ 1003 - if (!card->info.ids_valid) { 1004 - dev2br_supported = false; 1005 - } else if (css_general_characteristics.enarf) { 1006 - dev2br_supported = true; 1007 - } else { 1008 - /* Old machines don't have the feature bit: 1009 - * Probe by testing whether a disable succeeds 1010 - */ 1011 - rc = qeth_l2_pnso(card, PNSO_OC_NET_ADDR_INFO, 0, NULL, NULL); 1012 - dev2br_supported = !rc; 1013 - } 999 + dev2br_supported = card->info.ids_valid && 1000 + css_general_characteristics.enarf; 1014 1001 QETH_CARD_TEXT_(card, 2, "D2Bsup%02x", dev2br_supported); 1015 1002 1016 1003 if (dev2br_supported) ··· 2220 2233 struct net_device *dev = card->dev; 2221 2234 int rc = 0; 2222 2235 2223 - /* query before bridgeport_notification may be enabled */ 2224 2236 qeth_l2_detect_dev2br_support(card); 2225 2237 2226 2238 mutex_lock(&card->sbp_lock);
+5
include/linux/netdevice.h
··· 3137 3137 return false; 3138 3138 } 3139 3139 3140 + static inline bool dev_has_header(const struct net_device *dev) 3141 + { 3142 + return dev->header_ops && dev->header_ops->create; 3143 + } 3144 + 3140 3145 typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, 3141 3146 int len, int size); 3142 3147 int register_gifconf(unsigned int family, gifconf_func_t *gifconf);
+8
include/net/bonding.h
··· 185 185 struct rtnl_link_stats64 slave_stats; 186 186 }; 187 187 188 + static inline struct slave *to_slave(struct kobject *kobj) 189 + { 190 + return container_of(kobj, struct slave, kobj); 191 + } 192 + 188 193 struct bond_up_slave { 189 194 unsigned int count; 190 195 struct rcu_head rcu; ··· 754 749 755 750 /* exported from bond_netlink.c */ 756 751 extern struct rtnl_link_ops bond_link_ops; 752 + 753 + /* exported from bond_sysfs_slave.c */ 754 + extern const struct sysfs_ops slave_sysfs_ops; 757 755 758 756 static inline netdev_tx_t bond_tx_drop(struct net_device *dev, struct sk_buff *skb) 759 757 {
+3 -2
include/net/inet_hashtables.h
··· 247 247 unsigned long high_limit); 248 248 int inet_hashinfo2_init_mod(struct inet_hashinfo *h); 249 249 250 - bool inet_ehash_insert(struct sock *sk, struct sock *osk); 251 - bool inet_ehash_nolisten(struct sock *sk, struct sock *osk); 250 + bool inet_ehash_insert(struct sock *sk, struct sock *osk, bool *found_dup_sk); 251 + bool inet_ehash_nolisten(struct sock *sk, struct sock *osk, 252 + bool *found_dup_sk); 252 253 int __inet_hash(struct sock *sk, struct sock *osk); 253 254 int inet_hash(struct sock *sk); 254 255 void inet_unhash(struct sock *sk);
+6
include/net/tls.h
··· 199 199 * to be atomic. 200 200 */ 201 201 TLS_TX_SYNC_SCHED = 1, 202 + /* tls_dev_del was called for the RX side, device state was released, 203 + * but tls_ctx->netdev might still be kept, because TX-side driver 204 + * resources might not be released yet. Used to prevent the second 205 + * tls_dev_del call in tls_device_down if it happens simultaneously. 206 + */ 207 + TLS_RX_DEV_CLOSED = 2, 202 208 }; 203 209 204 210 struct cipher_context {
+2
include/uapi/linux/devlink.h
··· 526 526 DEVLINK_ATTR_RELOAD_STATS_LIMIT, /* u8 */ 527 527 DEVLINK_ATTR_RELOAD_STATS_VALUE, /* u32 */ 528 528 DEVLINK_ATTR_REMOTE_RELOAD_STATS, /* nested */ 529 + DEVLINK_ATTR_RELOAD_ACTION_INFO, /* nested */ 530 + DEVLINK_ATTR_RELOAD_ACTION_STATS, /* nested */ 529 531 530 532 /* add new attributes above here, update the policy in devlink.c */ 531 533
+2
include/uapi/linux/openvswitch.h
··· 1058 1058 __OVS_DEC_TTL_ATTR_MAX 1059 1059 }; 1060 1060 1061 + #define OVS_DEC_TTL_ATTR_MAX (__OVS_DEC_TTL_ATTR_MAX - 1) 1062 + 1061 1063 #endif /* _LINUX_OPENVSWITCH_H */
+1
net/batman-adv/log.c
··· 180 180 .read = batadv_log_read, 181 181 .poll = batadv_log_poll, 182 182 .llseek = no_llseek, 183 + .owner = THIS_MODULE, 183 184 }; 184 185 185 186 /**
+5 -2
net/can/af_can.c
··· 541 541 542 542 /* Check for bugs in CAN protocol implementations using af_can.c: 543 543 * 'rcv' will be NULL if no matching list item was found for removal. 544 + * As this case may potentially happen when closing a socket while 545 + * the notifier for removing the CAN netdev is running we just print 546 + * a warning here. 544 547 */ 545 548 if (!rcv) { 546 - WARN(1, "BUG: receive list entry not found for dev %s, id %03X, mask %03X\n", 547 - DNAME(dev), can_id, mask); 549 + pr_warn("can: receive list entry not found for dev %s, id %03X, mask %03X\n", 550 + DNAME(dev), can_id, mask); 548 551 goto out; 549 552 } 550 553
+39 -17
net/core/devlink.c
··· 517 517 return test_bit(limit, &devlink->ops->reload_limits); 518 518 } 519 519 520 - static int devlink_reload_stat_put(struct sk_buff *msg, enum devlink_reload_action action, 520 + static int devlink_reload_stat_put(struct sk_buff *msg, 521 521 enum devlink_reload_limit limit, u32 value) 522 522 { 523 523 struct nlattr *reload_stats_entry; ··· 526 526 if (!reload_stats_entry) 527 527 return -EMSGSIZE; 528 528 529 - if (nla_put_u8(msg, DEVLINK_ATTR_RELOAD_ACTION, action) || 530 - nla_put_u8(msg, DEVLINK_ATTR_RELOAD_STATS_LIMIT, limit) || 529 + if (nla_put_u8(msg, DEVLINK_ATTR_RELOAD_STATS_LIMIT, limit) || 531 530 nla_put_u32(msg, DEVLINK_ATTR_RELOAD_STATS_VALUE, value)) 532 531 goto nla_put_failure; 533 532 nla_nest_end(msg, reload_stats_entry); ··· 539 540 540 541 static int devlink_reload_stats_put(struct sk_buff *msg, struct devlink *devlink, bool is_remote) 541 542 { 542 - struct nlattr *reload_stats_attr; 543 + struct nlattr *reload_stats_attr, *act_info, *act_stats; 543 544 int i, j, stat_idx; 544 545 u32 value; 545 546 ··· 551 552 if (!reload_stats_attr) 552 553 return -EMSGSIZE; 553 554 554 - for (j = 0; j <= DEVLINK_RELOAD_LIMIT_MAX; j++) { 555 - /* Remote stats are shown even if not locally supported. Stats 556 - * of actions with unspecified limit are shown though drivers 557 - * don't need to register unspecified limit. 558 - */ 559 - if (!is_remote && j != DEVLINK_RELOAD_LIMIT_UNSPEC && 560 - !devlink_reload_limit_is_supported(devlink, j)) 555 + for (i = 0; i <= DEVLINK_RELOAD_ACTION_MAX; i++) { 556 + if ((!is_remote && 557 + !devlink_reload_action_is_supported(devlink, i)) || 558 + i == DEVLINK_RELOAD_ACTION_UNSPEC) 561 559 continue; 562 - for (i = 0; i <= DEVLINK_RELOAD_ACTION_MAX; i++) { 563 - if ((!is_remote && !devlink_reload_action_is_supported(devlink, i)) || 564 - i == DEVLINK_RELOAD_ACTION_UNSPEC || 560 + act_info = nla_nest_start(msg, DEVLINK_ATTR_RELOAD_ACTION_INFO); 561 + if (!act_info) 562 + goto nla_put_failure; 563 + 564 + if (nla_put_u8(msg, DEVLINK_ATTR_RELOAD_ACTION, i)) 565 + goto action_info_nest_cancel; 566 + act_stats = nla_nest_start(msg, DEVLINK_ATTR_RELOAD_ACTION_STATS); 567 + if (!act_stats) 568 + goto action_info_nest_cancel; 569 + 570 + for (j = 0; j <= DEVLINK_RELOAD_LIMIT_MAX; j++) { 571 + /* Remote stats are shown even if not locally supported. 572 + * Stats of actions with unspecified limit are shown 573 + * though drivers don't need to register unspecified 574 + * limit. 575 + */ 576 + if ((!is_remote && j != DEVLINK_RELOAD_LIMIT_UNSPEC && 577 + !devlink_reload_limit_is_supported(devlink, j)) || 565 578 devlink_reload_combination_is_invalid(i, j)) 566 579 continue; 567 580 ··· 582 571 value = devlink->stats.reload_stats[stat_idx]; 583 572 else 584 573 value = devlink->stats.remote_reload_stats[stat_idx]; 585 - if (devlink_reload_stat_put(msg, i, j, value)) 586 - goto nla_put_failure; 574 + if (devlink_reload_stat_put(msg, j, value)) 575 + goto action_stats_nest_cancel; 587 576 } 577 + nla_nest_end(msg, act_stats); 578 + nla_nest_end(msg, act_info); 588 579 } 589 580 nla_nest_end(msg, reload_stats_attr); 590 581 return 0; 591 582 583 + action_stats_nest_cancel: 584 + nla_nest_cancel(msg, act_stats); 585 + action_info_nest_cancel: 586 + nla_nest_cancel(msg, act_info); 592 587 nla_put_failure: 593 588 nla_nest_cancel(msg, reload_stats_attr); 594 589 return -EMSGSIZE; ··· 772 755 if (nla_put_u32(msg, DEVLINK_ATTR_PORT_INDEX, devlink_port->index)) 773 756 goto nla_put_failure; 774 757 758 + /* Hold rtnl lock while accessing port's netdev attributes. */ 759 + rtnl_lock(); 775 760 spin_lock_bh(&devlink_port->type_lock); 776 761 if (nla_put_u16(msg, DEVLINK_ATTR_PORT_TYPE, devlink_port->type)) 777 762 goto nla_put_failure_type_locked; ··· 782 763 devlink_port->desired_type)) 783 764 goto nla_put_failure_type_locked; 784 765 if (devlink_port->type == DEVLINK_PORT_TYPE_ETH) { 766 + struct net *net = devlink_net(devlink_port->devlink); 785 767 struct net_device *netdev = devlink_port->type_dev; 786 768 787 - if (netdev && 769 + if (netdev && net_eq(net, dev_net(netdev)) && 788 770 (nla_put_u32(msg, DEVLINK_ATTR_PORT_NETDEV_IFINDEX, 789 771 netdev->ifindex) || 790 772 nla_put_string(msg, DEVLINK_ATTR_PORT_NETDEV_NAME, ··· 801 781 goto nla_put_failure_type_locked; 802 782 } 803 783 spin_unlock_bh(&devlink_port->type_lock); 784 + rtnl_unlock(); 804 785 if (devlink_nl_port_attrs_put(msg, devlink_port)) 805 786 goto nla_put_failure; 806 787 if (devlink_nl_port_function_attrs_put(msg, devlink_port, extack)) ··· 812 791 813 792 nla_put_failure_type_locked: 814 793 spin_unlock_bh(&devlink_port->type_lock); 794 + rtnl_unlock(); 815 795 nla_put_failure: 816 796 genlmsg_cancel(msg, hdr); 817 797 return -EMSGSIZE;
+6 -1
net/core/gro_cells.c
··· 99 99 struct gro_cell *cell = per_cpu_ptr(gcells->cells, i); 100 100 101 101 napi_disable(&cell->napi); 102 - netif_napi_del(&cell->napi); 102 + __netif_napi_del(&cell->napi); 103 103 __skb_queue_purge(&cell->napi_skbs); 104 104 } 105 + /* This barrier is needed because netpoll could access dev->napi_list 106 + * under rcu protection. 107 + */ 108 + synchronize_net(); 109 + 105 110 free_percpu(gcells->cells); 106 111 gcells->cells = NULL; 107 112 }
+1 -1
net/core/skbuff.c
··· 4549 4549 if (skb && (skb_next = skb_peek(q))) { 4550 4550 icmp_next = is_icmp_err_skb(skb_next); 4551 4551 if (icmp_next) 4552 - sk->sk_err = SKB_EXT_ERR(skb_next)->ee.ee_origin; 4552 + sk->sk_err = SKB_EXT_ERR(skb_next)->ee.ee_errno; 4553 4553 } 4554 4554 spin_unlock_irqrestore(&q->lock, flags); 4555 4555
+1 -1
net/dccp/ipv4.c
··· 427 427 428 428 if (__inet_inherit_port(sk, newsk) < 0) 429 429 goto put_and_exit; 430 - *own_req = inet_ehash_nolisten(newsk, req_to_sk(req_unhash)); 430 + *own_req = inet_ehash_nolisten(newsk, req_to_sk(req_unhash), NULL); 431 431 if (*own_req) 432 432 ireq->ireq_opt = NULL; 433 433 else
+1 -1
net/dccp/ipv6.c
··· 533 533 dccp_done(newsk); 534 534 goto out; 535 535 } 536 - *own_req = inet_ehash_nolisten(newsk, req_to_sk(req_unhash)); 536 + *own_req = inet_ehash_nolisten(newsk, req_to_sk(req_unhash), NULL); 537 537 /* Clone pktoptions received with SYN, if we own the req */ 538 538 if (*own_req && ireq->pktopts) { 539 539 newnp->pktoptions = skb_clone(ireq->pktopts, GFP_ATOMIC);
+1 -1
net/ipv4/inet_connection_sock.c
··· 787 787 timer_setup(&req->rsk_timer, reqsk_timer_handler, TIMER_PINNED); 788 788 mod_timer(&req->rsk_timer, jiffies + timeout); 789 789 790 - inet_ehash_insert(req_to_sk(req), NULL); 790 + inet_ehash_insert(req_to_sk(req), NULL, NULL); 791 791 /* before letting lookups find us, make sure all req fields 792 792 * are committed to memory and refcnt initialized. 793 793 */
+60 -8
net/ipv4/inet_hashtables.c
··· 20 20 #include <net/addrconf.h> 21 21 #include <net/inet_connection_sock.h> 22 22 #include <net/inet_hashtables.h> 23 + #if IS_ENABLED(CONFIG_IPV6) 24 + #include <net/inet6_hashtables.h> 25 + #endif 23 26 #include <net/secure_seq.h> 24 27 #include <net/ip.h> 25 28 #include <net/tcp.h> ··· 511 508 inet->inet_dport); 512 509 } 513 510 514 - /* insert a socket into ehash, and eventually remove another one 515 - * (The another one can be a SYN_RECV or TIMEWAIT 511 + /* Searches for an exsiting socket in the ehash bucket list. 512 + * Returns true if found, false otherwise. 516 513 */ 517 - bool inet_ehash_insert(struct sock *sk, struct sock *osk) 514 + static bool inet_ehash_lookup_by_sk(struct sock *sk, 515 + struct hlist_nulls_head *list) 516 + { 517 + const __portpair ports = INET_COMBINED_PORTS(sk->sk_dport, sk->sk_num); 518 + const int sdif = sk->sk_bound_dev_if; 519 + const int dif = sk->sk_bound_dev_if; 520 + const struct hlist_nulls_node *node; 521 + struct net *net = sock_net(sk); 522 + struct sock *esk; 523 + 524 + INET_ADDR_COOKIE(acookie, sk->sk_daddr, sk->sk_rcv_saddr); 525 + 526 + sk_nulls_for_each_rcu(esk, node, list) { 527 + if (esk->sk_hash != sk->sk_hash) 528 + continue; 529 + if (sk->sk_family == AF_INET) { 530 + if (unlikely(INET_MATCH(esk, net, acookie, 531 + sk->sk_daddr, 532 + sk->sk_rcv_saddr, 533 + ports, dif, sdif))) { 534 + return true; 535 + } 536 + } 537 + #if IS_ENABLED(CONFIG_IPV6) 538 + else if (sk->sk_family == AF_INET6) { 539 + if (unlikely(INET6_MATCH(esk, net, 540 + &sk->sk_v6_daddr, 541 + &sk->sk_v6_rcv_saddr, 542 + ports, dif, sdif))) { 543 + return true; 544 + } 545 + } 546 + #endif 547 + } 548 + return false; 549 + } 550 + 551 + /* Insert a socket into ehash, and eventually remove another one 552 + * (The another one can be a SYN_RECV or TIMEWAIT) 553 + * If an existing socket already exists, socket sk is not inserted, 554 + * and sets found_dup_sk parameter to true. 555 + */ 556 + bool inet_ehash_insert(struct sock *sk, struct sock *osk, bool *found_dup_sk) 518 557 { 519 558 struct inet_hashinfo *hashinfo = sk->sk_prot->h.hashinfo; 520 559 struct hlist_nulls_head *list; ··· 575 530 if (osk) { 576 531 WARN_ON_ONCE(sk->sk_hash != osk->sk_hash); 577 532 ret = sk_nulls_del_node_init_rcu(osk); 533 + } else if (found_dup_sk) { 534 + *found_dup_sk = inet_ehash_lookup_by_sk(sk, list); 535 + if (*found_dup_sk) 536 + ret = false; 578 537 } 538 + 579 539 if (ret) 580 540 __sk_nulls_add_node_rcu(sk, list); 541 + 581 542 spin_unlock(lock); 543 + 582 544 return ret; 583 545 } 584 546 585 - bool inet_ehash_nolisten(struct sock *sk, struct sock *osk) 547 + bool inet_ehash_nolisten(struct sock *sk, struct sock *osk, bool *found_dup_sk) 586 548 { 587 - bool ok = inet_ehash_insert(sk, osk); 549 + bool ok = inet_ehash_insert(sk, osk, found_dup_sk); 588 550 589 551 if (ok) { 590 552 sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1); ··· 635 583 int err = 0; 636 584 637 585 if (sk->sk_state != TCP_LISTEN) { 638 - inet_ehash_nolisten(sk, osk); 586 + inet_ehash_nolisten(sk, osk, NULL); 639 587 return 0; 640 588 } 641 589 WARN_ON(!sk_unhashed(sk)); ··· 731 679 tb = inet_csk(sk)->icsk_bind_hash; 732 680 spin_lock_bh(&head->lock); 733 681 if (sk_head(&tb->owners) == sk && !sk->sk_bind_node.next) { 734 - inet_ehash_nolisten(sk, NULL); 682 + inet_ehash_nolisten(sk, NULL, NULL); 735 683 spin_unlock_bh(&head->lock); 736 684 return 0; 737 685 } ··· 810 758 inet_bind_hash(sk, tb, port); 811 759 if (sk_unhashed(sk)) { 812 760 inet_sk(sk)->inet_sport = htons(port); 813 - inet_ehash_nolisten(sk, (struct sock *)tw); 761 + inet_ehash_nolisten(sk, (struct sock *)tw, NULL); 814 762 } 815 763 if (tw) 816 764 inet_twsk_bind_unhash(tw, hinfo);
+5
net/ipv4/tcp_cong.c
··· 198 198 icsk->icsk_ca_setsockopt = 1; 199 199 memset(icsk->icsk_ca_priv, 0, sizeof(icsk->icsk_ca_priv)); 200 200 201 + if (ca->flags & TCP_CONG_NEEDS_ECN) 202 + INET_ECN_xmit(sk); 203 + else 204 + INET_ECN_dontxmit(sk); 205 + 201 206 if (!((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN))) 202 207 tcp_init_congestion_control(sk); 203 208 }
+22 -6
net/ipv4/tcp_ipv4.c
··· 980 980 981 981 skb = tcp_make_synack(sk, dst, req, foc, synack_type, syn_skb); 982 982 983 - tos = sock_net(sk)->ipv4.sysctl_tcp_reflect_tos ? 984 - tcp_rsk(req)->syn_tos : inet_sk(sk)->tos; 985 - 986 983 if (skb) { 987 984 __tcp_v4_send_check(skb, ireq->ir_loc_addr, ireq->ir_rmt_addr); 985 + 986 + tos = sock_net(sk)->ipv4.sysctl_tcp_reflect_tos ? 987 + tcp_rsk(req)->syn_tos & ~INET_ECN_MASK : 988 + inet_sk(sk)->tos; 989 + 990 + if (!INET_ECN_is_capable(tos) && 991 + tcp_bpf_ca_needs_ecn((struct sock *)req)) 992 + tos |= INET_ECN_ECT_0; 988 993 989 994 rcu_read_lock(); 990 995 err = ip_build_and_send_pkt(skb, sk, ireq->ir_loc_addr, 991 996 ireq->ir_rmt_addr, 992 997 rcu_dereference(ireq->ireq_opt), 993 - tos & ~INET_ECN_MASK); 998 + tos); 994 999 rcu_read_unlock(); 995 1000 err = net_xmit_eval(err); 996 1001 } ··· 1503 1498 bool *own_req) 1504 1499 { 1505 1500 struct inet_request_sock *ireq; 1501 + bool found_dup_sk = false; 1506 1502 struct inet_sock *newinet; 1507 1503 struct tcp_sock *newtp; 1508 1504 struct sock *newsk; ··· 1581 1575 1582 1576 if (__inet_inherit_port(sk, newsk) < 0) 1583 1577 goto put_and_exit; 1584 - *own_req = inet_ehash_nolisten(newsk, req_to_sk(req_unhash)); 1578 + *own_req = inet_ehash_nolisten(newsk, req_to_sk(req_unhash), 1579 + &found_dup_sk); 1585 1580 if (likely(*own_req)) { 1586 1581 tcp_move_syn(newtp, req); 1587 1582 ireq->ireq_opt = NULL; 1588 1583 } else { 1589 - newinet->inet_opt = NULL; 1584 + if (!req_unhash && found_dup_sk) { 1585 + /* This code path should only be executed in the 1586 + * syncookie case only 1587 + */ 1588 + bh_unlock_sock(newsk); 1589 + sock_put(newsk); 1590 + newsk = NULL; 1591 + } else { 1592 + newinet->inet_opt = NULL; 1593 + } 1590 1594 } 1591 1595 return newsk; 1592 1596
+17 -9
net/ipv6/addrlabel.c
··· 306 306 /* add default label */ 307 307 static int __net_init ip6addrlbl_net_init(struct net *net) 308 308 { 309 - int err = 0; 309 + struct ip6addrlbl_entry *p = NULL; 310 + struct hlist_node *n; 311 + int err; 310 312 int i; 311 313 312 314 ADDRLABEL(KERN_DEBUG "%s\n", __func__); ··· 317 315 INIT_HLIST_HEAD(&net->ipv6.ip6addrlbl_table.head); 318 316 319 317 for (i = 0; i < ARRAY_SIZE(ip6addrlbl_init_table); i++) { 320 - int ret = ip6addrlbl_add(net, 321 - ip6addrlbl_init_table[i].prefix, 322 - ip6addrlbl_init_table[i].prefixlen, 323 - 0, 324 - ip6addrlbl_init_table[i].label, 0); 325 - /* XXX: should we free all rules when we catch an error? */ 326 - if (ret && (!err || err != -ENOMEM)) 327 - err = ret; 318 + err = ip6addrlbl_add(net, 319 + ip6addrlbl_init_table[i].prefix, 320 + ip6addrlbl_init_table[i].prefixlen, 321 + 0, 322 + ip6addrlbl_init_table[i].label, 0); 323 + if (err) 324 + goto err_ip6addrlbl_add; 325 + } 326 + return 0; 327 + 328 + err_ip6addrlbl_add: 329 + hlist_for_each_entry_safe(p, n, &net->ipv6.ip6addrlbl_table.head, list) { 330 + hlist_del_rcu(&p->list); 331 + kfree_rcu(p, rcu); 328 332 } 329 333 return err; 330 334 }
+21 -5
net/ipv6/tcp_ipv6.c
··· 527 527 if (np->repflow && ireq->pktopts) 528 528 fl6->flowlabel = ip6_flowlabel(ipv6_hdr(ireq->pktopts)); 529 529 530 + tclass = sock_net(sk)->ipv4.sysctl_tcp_reflect_tos ? 531 + tcp_rsk(req)->syn_tos & ~INET_ECN_MASK : 532 + np->tclass; 533 + 534 + if (!INET_ECN_is_capable(tclass) && 535 + tcp_bpf_ca_needs_ecn((struct sock *)req)) 536 + tclass |= INET_ECN_ECT_0; 537 + 530 538 rcu_read_lock(); 531 539 opt = ireq->ipv6_opt; 532 - tclass = sock_net(sk)->ipv4.sysctl_tcp_reflect_tos ? 533 - tcp_rsk(req)->syn_tos : np->tclass; 534 540 if (!opt) 535 541 opt = rcu_dereference(np->opt); 536 542 err = ip6_xmit(sk, skb, fl6, sk->sk_mark, opt, 537 - tclass & ~INET_ECN_MASK, 538 - sk->sk_priority); 543 + tclass, sk->sk_priority); 539 544 rcu_read_unlock(); 540 545 err = net_xmit_eval(err); 541 546 } ··· 1198 1193 const struct ipv6_pinfo *np = tcp_inet6_sk(sk); 1199 1194 struct ipv6_txoptions *opt; 1200 1195 struct inet_sock *newinet; 1196 + bool found_dup_sk = false; 1201 1197 struct tcp_sock *newtp; 1202 1198 struct sock *newsk; 1203 1199 #ifdef CONFIG_TCP_MD5SIG ··· 1374 1368 tcp_done(newsk); 1375 1369 goto out; 1376 1370 } 1377 - *own_req = inet_ehash_nolisten(newsk, req_to_sk(req_unhash)); 1371 + *own_req = inet_ehash_nolisten(newsk, req_to_sk(req_unhash), 1372 + &found_dup_sk); 1378 1373 if (*own_req) { 1379 1374 tcp_move_syn(newtp, req); 1380 1375 ··· 1389 1382 tcp_v6_restore_cb(newnp->pktoptions); 1390 1383 skb_set_owner_r(newnp->pktoptions, newsk); 1391 1384 } 1385 + } 1386 + } else { 1387 + if (!req_unhash && found_dup_sk) { 1388 + /* This code path should only be executed in the 1389 + * syncookie case only 1390 + */ 1391 + bh_unlock_sock(newsk); 1392 + sock_put(newsk); 1393 + newsk = NULL; 1392 1394 } 1393 1395 } 1394 1396
+2 -2
net/iucv/af_iucv.c
··· 1645 1645 } 1646 1646 1647 1647 /* Create the new socket */ 1648 - nsk = iucv_sock_alloc(NULL, sk->sk_type, GFP_ATOMIC, 0); 1648 + nsk = iucv_sock_alloc(NULL, sk->sk_protocol, GFP_ATOMIC, 0); 1649 1649 if (!nsk) { 1650 1650 err = pr_iucv->path_sever(path, user_data); 1651 1651 iucv_path_free(path); ··· 1851 1851 goto out; 1852 1852 } 1853 1853 1854 - nsk = iucv_sock_alloc(NULL, sk->sk_type, GFP_ATOMIC, 0); 1854 + nsk = iucv_sock_alloc(NULL, sk->sk_protocol, GFP_ATOMIC, 0); 1855 1855 bh_lock_sock(sk); 1856 1856 if ((sk->sk_state != IUCV_LISTEN) || 1857 1857 sk_acceptq_is_full(sk) ||
+2 -3
net/mptcp/subflow.c
··· 543 543 fallback = true; 544 544 } else if (subflow_req->mp_join) { 545 545 mptcp_get_options(skb, &mp_opt); 546 - if (!mp_opt.mp_join || 547 - !mptcp_can_accept_new_subflow(subflow_req->msk) || 548 - !subflow_hmac_valid(req, &mp_opt)) { 546 + if (!mp_opt.mp_join || !subflow_hmac_valid(req, &mp_opt) || 547 + !mptcp_can_accept_new_subflow(subflow_req->msk)) { 549 548 SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKMAC); 550 549 fallback = true; 551 550 }
+3 -4
net/openvswitch/actions.c
··· 958 958 { 959 959 /* The first action is always 'OVS_DEC_TTL_ATTR_ARG'. */ 960 960 struct nlattr *dec_ttl_arg = nla_data(attr); 961 - int rem = nla_len(attr); 962 961 963 962 if (nla_len(dec_ttl_arg)) { 964 - struct nlattr *actions = nla_next(dec_ttl_arg, &rem); 963 + struct nlattr *actions = nla_data(dec_ttl_arg); 965 964 966 965 if (actions) 967 - return clone_execute(dp, skb, key, 0, actions, rem, 968 - last, false); 966 + return clone_execute(dp, skb, key, 0, nla_data(actions), 967 + nla_len(actions), last, false); 969 968 } 970 969 consume_skb(skb); 971 970 return 0;
+55 -19
net/openvswitch/flow_netlink.c
··· 2503 2503 __be16 eth_type, __be16 vlan_tci, 2504 2504 u32 mpls_label_count, bool log) 2505 2505 { 2506 - int start, err; 2507 - u32 nested = true; 2506 + const struct nlattr *attrs[OVS_DEC_TTL_ATTR_MAX + 1]; 2507 + int start, action_start, err, rem; 2508 + const struct nlattr *a, *actions; 2508 2509 2509 - if (!nla_len(attr)) 2510 - return ovs_nla_add_action(sfa, OVS_ACTION_ATTR_DEC_TTL, 2511 - NULL, 0, log); 2510 + memset(attrs, 0, sizeof(attrs)); 2511 + nla_for_each_nested(a, attr, rem) { 2512 + int type = nla_type(a); 2513 + 2514 + /* Ignore unknown attributes to be future proof. */ 2515 + if (type > OVS_DEC_TTL_ATTR_MAX) 2516 + continue; 2517 + 2518 + if (!type || attrs[type]) 2519 + return -EINVAL; 2520 + 2521 + attrs[type] = a; 2522 + } 2523 + 2524 + actions = attrs[OVS_DEC_TTL_ATTR_ACTION]; 2525 + if (rem || !actions || (nla_len(actions) && nla_len(actions) < NLA_HDRLEN)) 2526 + return -EINVAL; 2512 2527 2513 2528 start = add_nested_action_start(sfa, OVS_ACTION_ATTR_DEC_TTL, log); 2514 2529 if (start < 0) 2515 2530 return start; 2516 2531 2517 - err = ovs_nla_add_action(sfa, OVS_DEC_TTL_ATTR_ACTION, &nested, 2518 - sizeof(nested), log); 2532 + action_start = add_nested_action_start(sfa, OVS_DEC_TTL_ATTR_ACTION, log); 2533 + if (action_start < 0) 2534 + return start; 2519 2535 2520 - if (err) 2521 - return err; 2522 - 2523 - err = __ovs_nla_copy_actions(net, attr, key, sfa, eth_type, 2536 + err = __ovs_nla_copy_actions(net, actions, key, sfa, eth_type, 2524 2537 vlan_tci, mpls_label_count, log); 2525 2538 if (err) 2526 2539 return err; 2527 2540 2541 + add_nested_action_end(*sfa, action_start); 2528 2542 add_nested_action_end(*sfa, start); 2529 2543 return 0; 2530 2544 } ··· 3501 3487 static int dec_ttl_action_to_attr(const struct nlattr *attr, 3502 3488 struct sk_buff *skb) 3503 3489 { 3504 - int err = 0, rem = nla_len(attr); 3505 - struct nlattr *start; 3490 + struct nlattr *start, *action_start; 3491 + const struct nlattr *a; 3492 + int err = 0, rem; 3506 3493 3507 3494 start = nla_nest_start_noflag(skb, OVS_ACTION_ATTR_DEC_TTL); 3508 - 3509 3495 if (!start) 3510 3496 return -EMSGSIZE; 3511 3497 3512 - err = ovs_nla_put_actions(nla_data(attr), rem, skb); 3513 - if (err) 3514 - nla_nest_cancel(skb, start); 3515 - else 3516 - nla_nest_end(skb, start); 3498 + nla_for_each_attr(a, nla_data(attr), nla_len(attr), rem) { 3499 + switch (nla_type(a)) { 3500 + case OVS_DEC_TTL_ATTR_ACTION: 3517 3501 3502 + action_start = nla_nest_start_noflag(skb, OVS_DEC_TTL_ATTR_ACTION); 3503 + if (!action_start) { 3504 + err = -EMSGSIZE; 3505 + goto out; 3506 + } 3507 + 3508 + err = ovs_nla_put_actions(nla_data(a), nla_len(a), skb); 3509 + if (err) 3510 + goto out; 3511 + 3512 + nla_nest_end(skb, action_start); 3513 + break; 3514 + 3515 + default: 3516 + /* Ignore all other option to be future compatible */ 3517 + break; 3518 + } 3519 + } 3520 + 3521 + nla_nest_end(skb, start); 3522 + return 0; 3523 + 3524 + out: 3525 + nla_nest_cancel(skb, start); 3518 3526 return err; 3519 3527 } 3520 3528
+9 -9
net/packet/af_packet.c
··· 93 93 94 94 /* 95 95 Assumptions: 96 - - If the device has no dev->header_ops, there is no LL header visible 97 - above the device. In this case, its hard_header_len should be 0. 96 + - If the device has no dev->header_ops->create, there is no LL header 97 + visible above the device. In this case, its hard_header_len should be 0. 98 98 The device may prepend its own header internally. In this case, its 99 99 needed_headroom should be set to the space needed for it to add its 100 100 internal header. ··· 108 108 On receive: 109 109 ----------- 110 110 111 - Incoming, dev->header_ops != NULL 111 + Incoming, dev_has_header(dev) == true 112 112 mac_header -> ll header 113 113 data -> data 114 114 115 - Outgoing, dev->header_ops != NULL 115 + Outgoing, dev_has_header(dev) == true 116 116 mac_header -> ll header 117 117 data -> ll header 118 118 119 - Incoming, dev->header_ops == NULL 119 + Incoming, dev_has_header(dev) == false 120 120 mac_header -> data 121 121 However drivers often make it point to the ll header. 122 122 This is incorrect because the ll header should be invisible to us. 123 123 data -> data 124 124 125 - Outgoing, dev->header_ops == NULL 125 + Outgoing, dev_has_header(dev) == false 126 126 mac_header -> data. ll header is invisible to us. 127 127 data -> data 128 128 129 129 Resume 130 - If dev->header_ops == NULL we are unable to restore the ll header, 130 + If dev_has_header(dev) == false we are unable to restore the ll header, 131 131 because it is invisible to us. 132 132 133 133 ··· 2069 2069 2070 2070 skb->dev = dev; 2071 2071 2072 - if (dev->header_ops) { 2072 + if (dev_has_header(dev)) { 2073 2073 /* The device has an explicit notion of ll header, 2074 2074 * exported to higher levels. 2075 2075 * ··· 2198 2198 if (!net_eq(dev_net(dev), sock_net(sk))) 2199 2199 goto drop; 2200 2200 2201 - if (dev->header_ops) { 2201 + if (dev_has_header(dev)) { 2202 2202 if (sk->sk_type != SOCK_DGRAM) 2203 2203 skb_push(skb, skb->data - skb_mac_header(skb)); 2204 2204 else if (skb->pkt_type == PACKET_OUTGOING) {
+13 -4
net/rose/rose_loopback.c
··· 96 96 } 97 97 98 98 if (frametype == ROSE_CALL_REQUEST) { 99 - if ((dev = rose_dev_get(dest)) != NULL) { 100 - if (rose_rx_call_request(skb, dev, rose_loopback_neigh, lci_o) == 0) 101 - kfree_skb(skb); 102 - } else { 99 + if (!rose_loopback_neigh->dev) { 100 + kfree_skb(skb); 101 + continue; 102 + } 103 + 104 + dev = rose_dev_get(dest); 105 + if (!dev) { 106 + kfree_skb(skb); 107 + continue; 108 + } 109 + 110 + if (rose_rx_call_request(skb, dev, rose_loopback_neigh, lci_o) == 0) { 111 + dev_put(dev); 103 112 kfree_skb(skb); 104 113 } 105 114 } else {
+4 -1
net/tls/tls_device.c
··· 1262 1262 if (tls_ctx->tx_conf != TLS_HW) { 1263 1263 dev_put(netdev); 1264 1264 tls_ctx->netdev = NULL; 1265 + } else { 1266 + set_bit(TLS_RX_DEV_CLOSED, &tls_ctx->flags); 1265 1267 } 1266 1268 out: 1267 1269 up_read(&device_offload_lock); ··· 1293 1291 if (ctx->tx_conf == TLS_HW) 1294 1292 netdev->tlsdev_ops->tls_dev_del(netdev, ctx, 1295 1293 TLS_OFFLOAD_CTX_DIR_TX); 1296 - if (ctx->rx_conf == TLS_HW) 1294 + if (ctx->rx_conf == TLS_HW && 1295 + !test_bit(TLS_RX_DEV_CLOSED, &ctx->flags)) 1297 1296 netdev->tlsdev_ops->tls_dev_del(netdev, ctx, 1298 1297 TLS_OFFLOAD_CTX_DIR_RX); 1299 1298 WRITE_ONCE(ctx->netdev, NULL);
+6
net/tls/tls_sw.c
··· 1295 1295 return NULL; 1296 1296 } 1297 1297 1298 + if (!skb_queue_empty(&sk->sk_receive_queue)) { 1299 + __strp_unpause(&ctx->strp); 1300 + if (ctx->recv_pkt) 1301 + return ctx->recv_pkt; 1302 + } 1303 + 1298 1304 if (sk->sk_shutdown & RCV_SHUTDOWN) 1299 1305 return NULL; 1300 1306
+5 -3
net/vmw_vsock/virtio_transport_common.c
··· 841 841 virtio_transport_free_pkt(pkt); 842 842 } 843 843 844 - if (remove_sock) 844 + if (remove_sock) { 845 + sock_set_flag(sk, SOCK_DONE); 845 846 vsock_remove_sock(vsk); 847 + } 846 848 } 847 849 EXPORT_SYMBOL_GPL(virtio_transport_release); 848 850 ··· 1134 1132 1135 1133 lock_sock(sk); 1136 1134 1137 - /* Check if sk has been released before lock_sock */ 1138 - if (sk->sk_shutdown == SHUTDOWN_MASK) { 1135 + /* Check if sk has been closed before lock_sock */ 1136 + if (sock_flag(sk, SOCK_DONE)) { 1139 1137 (void)virtio_transport_reset_no_sock(t, pkt); 1140 1138 release_sock(sk); 1141 1139 sock_put(sk);