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

Configure Feed

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

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

Pull networking fixes from David Miller:
"I was battling a cold after some recent trips, so quite a bit piled up
meanwhile, sorry about that.

Highlights:

1) Fix fd leak in various bpf selftests, from Brian Vazquez.

2) Fix crash in xsk when device doesn't support some methods, from
Magnus Karlsson.

3) Fix various leaks and use-after-free in rxrpc, from David Howells.

4) Fix several SKB leaks due to confusion of who owns an SKB and who
should release it in the llc code. From Eric Biggers.

5) Kill a bunc of KCSAN warnings in TCP, from Eric Dumazet.

6) Jumbo packets don't work after resume on r8169, as the BIOS resets
the chip into non-jumbo mode during suspend. From Heiner Kallweit.

7) Corrupt L2 header during MPLS push, from Davide Caratti.

8) Prevent possible infinite loop in tc_ctl_action, from Eric
Dumazet.

9) Get register bits right in bcmgenet driver, based upon chip
version. From Florian Fainelli.

10) Fix mutex problems in microchip DSA driver, from Marek Vasut.

11) Cure race between route lookup and invalidation in ipv4, from Wei
Wang.

12) Fix performance regression due to false sharing in 'net'
structure, from Eric Dumazet"

* git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (145 commits)
net: reorder 'struct net' fields to avoid false sharing
net: dsa: fix switch tree list
net: ethernet: dwmac-sun8i: show message only when switching to promisc
net: aquantia: add an error handling in aq_nic_set_multicast_list
net: netem: correct the parent's backlog when corrupted packet was dropped
net: netem: fix error path for corrupted GSO frames
macb: propagate errors when getting optional clocks
xen/netback: fix error path of xenvif_connect_data()
net: hns3: fix mis-counting IRQ vector numbers issue
net: usb: lan78xx: Connect PHY before registering MAC
vsock/virtio: discard packets if credit is not respected
vsock/virtio: send a credit update when buffer size is changed
mlxsw: spectrum_trap: Push Ethernet header before reporting trap
net: ensure correct skb->tstamp in various fragmenters
net: bcmgenet: reset 40nm EPHY on energy detect
net: bcmgenet: soft reset 40nm EPHYs before MAC init
net: phy: bcm7xxx: define soft_reset for 40nm EPHY
net: bcmgenet: don't set phydev->link from MAC
net: Update address for MediaTek ethernet driver in MAINTAINERS
ipv4: fix race condition between route lookup and invalidation
...

+1487 -893
+3 -1
Documentation/networking/device_drivers/pensando/ionic.rst
··· 36 36 ======= 37 37 For general Linux networking support, please use the netdev mailing 38 38 list, which is monitored by Pensando personnel:: 39 + 39 40 netdev@vger.kernel.org 40 41 41 42 For more specific support needs, please use the Pensando driver support 42 43 email:: 43 - drivers@pensando.io 44 + 45 + drivers@pensando.io
+18 -18
Documentation/networking/net_dim.txt
··· 92 92 Part III: Registering a Network Device to DIM 93 93 ============================================== 94 94 95 - Net DIM API exposes the main function net_dim(struct net_dim *dim, 96 - struct net_dim_sample end_sample). This function is the entry point to the Net 95 + Net DIM API exposes the main function net_dim(struct dim *dim, 96 + struct dim_sample end_sample). This function is the entry point to the Net 97 97 DIM algorithm and has to be called every time the driver would like to check if 98 98 it should change interrupt moderation parameters. The driver should provide two 99 - data structures: struct net_dim and struct net_dim_sample. Struct net_dim 99 + data structures: struct dim and struct dim_sample. Struct dim 100 100 describes the state of DIM for a specific object (RX queue, TX queue, 101 101 other queues, etc.). This includes the current selected profile, previous data 102 102 samples, the callback function provided by the driver and more. 103 - Struct net_dim_sample describes a data sample, which will be compared to the 104 - data sample stored in struct net_dim in order to decide on the algorithm's next 103 + Struct dim_sample describes a data sample, which will be compared to the 104 + data sample stored in struct dim in order to decide on the algorithm's next 105 105 step. The sample should include bytes, packets and interrupts, measured by 106 106 the driver. 107 107 ··· 110 110 interrupt. Since Net DIM has a built-in moderation and it might decide to skip 111 111 iterations under certain conditions, there is no need to moderate the net_dim() 112 112 calls as well. As mentioned above, the driver needs to provide an object of type 113 - struct net_dim to the net_dim() function call. It is advised for each entity 114 - using Net DIM to hold a struct net_dim as part of its data structure and use it 115 - as the main Net DIM API object. The struct net_dim_sample should hold the latest 113 + struct dim to the net_dim() function call. It is advised for each entity 114 + using Net DIM to hold a struct dim as part of its data structure and use it 115 + as the main Net DIM API object. The struct dim_sample should hold the latest 116 116 bytes, packets and interrupts count. No need to perform any calculations, just 117 117 include the raw data. 118 118 ··· 132 132 133 133 my_driver.c: 134 134 135 - #include <linux/net_dim.h> 135 + #include <linux/dim.h> 136 136 137 137 /* Callback for net DIM to schedule on a decision to change moderation */ 138 138 void my_driver_do_dim_work(struct work_struct *work) 139 139 { 140 - /* Get struct net_dim from struct work_struct */ 141 - struct net_dim *dim = container_of(work, struct net_dim, 142 - work); 140 + /* Get struct dim from struct work_struct */ 141 + struct dim *dim = container_of(work, struct dim, 142 + work); 143 143 /* Do interrupt moderation related stuff */ 144 144 ... 145 145 146 146 /* Signal net DIM work is done and it should move to next iteration */ 147 - dim->state = NET_DIM_START_MEASURE; 147 + dim->state = DIM_START_MEASURE; 148 148 } 149 149 150 150 /* My driver's interrupt handler */ ··· 152 152 { 153 153 ... 154 154 /* A struct to hold current measured data */ 155 - struct net_dim_sample dim_sample; 155 + struct dim_sample dim_sample; 156 156 ... 157 157 /* Initiate data sample struct with current data */ 158 - net_dim_sample(my_entity->events, 159 - my_entity->packets, 160 - my_entity->bytes, 161 - &dim_sample); 158 + dim_update_sample(my_entity->events, 159 + my_entity->packets, 160 + my_entity->bytes, 161 + &dim_sample); 162 162 /* Call net DIM */ 163 163 net_dim(&my_entity->dim, dim_sample); 164 164 ...
+3 -3
MAINTAINERS
··· 9122 9122 F: include/linux/ks0108.h 9123 9123 9124 9124 L3MDEV 9125 - M: David Ahern <dsa@cumulusnetworks.com> 9125 + M: David Ahern <dsahern@kernel.org> 9126 9126 L: netdev@vger.kernel.org 9127 9127 S: Maintained 9128 9128 F: net/l3mdev ··· 10255 10255 M: Felix Fietkau <nbd@openwrt.org> 10256 10256 M: John Crispin <john@phrozen.org> 10257 10257 M: Sean Wang <sean.wang@mediatek.com> 10258 - M: Nelson Chang <nelson.chang@mediatek.com> 10258 + M: Mark Lee <Mark-MC.Lee@mediatek.com> 10259 10259 L: netdev@vger.kernel.org 10260 10260 S: Maintained 10261 10261 F: drivers/net/ethernet/mediatek/ ··· 17433 17433 K: regulator_get_optional 17434 17434 17435 17435 VRF 17436 - M: David Ahern <dsa@cumulusnetworks.com> 17436 + M: David Ahern <dsahern@kernel.org> 17437 17437 M: Shrijeet Mukherjee <shrijeet@gmail.com> 17438 17438 L: netdev@vger.kernel.org 17439 17439 S: Maintained
+12 -1
arch/arm/boot/dts/mt7629-rfb.dts
··· 66 66 pinctrl-1 = <&ephy_leds_pins>; 67 67 status = "okay"; 68 68 69 + gmac0: mac@0 { 70 + compatible = "mediatek,eth-mac"; 71 + reg = <0>; 72 + phy-mode = "2500base-x"; 73 + fixed-link { 74 + speed = <2500>; 75 + full-duplex; 76 + pause; 77 + }; 78 + }; 79 + 69 80 gmac1: mac@1 { 70 81 compatible = "mediatek,eth-mac"; 71 82 reg = <1>; 83 + phy-mode = "gmii"; 72 84 phy-handle = <&phy0>; 73 85 }; 74 86 ··· 90 78 91 79 phy0: ethernet-phy@0 { 92 80 reg = <0>; 93 - phy-mode = "gmii"; 94 81 }; 95 82 }; 96 83 };
-2
arch/arm/boot/dts/mt7629.dtsi
··· 468 468 compatible = "mediatek,mt7629-sgmiisys", "syscon"; 469 469 reg = <0x1b128000 0x3000>; 470 470 #clock-cells = <1>; 471 - mediatek,physpeed = "2500"; 472 471 }; 473 472 474 473 sgmiisys1: syscon@1b130000 { 475 474 compatible = "mediatek,mt7629-sgmiisys", "syscon"; 476 475 reg = <0x1b130000 0x3000>; 477 476 #clock-cells = <1>; 478 - mediatek,physpeed = "2500"; 479 477 }; 480 478 }; 481 479 };
+1 -1
drivers/net/bonding/bond_main.c
··· 4039 4039 * this to-be-skipped slave to send a packet out. 4040 4040 */ 4041 4041 old_arr = rtnl_dereference(bond->slave_arr); 4042 - for (idx = 0; idx < old_arr->count; idx++) { 4042 + for (idx = 0; old_arr != NULL && idx < old_arr->count; idx++) { 4043 4043 if (skipslave == old_arr->arr[idx]) { 4044 4044 old_arr->arr[idx] = 4045 4045 old_arr->arr[old_arr->count-1];
-1
drivers/net/dsa/b53/b53_common.c
··· 1845 1845 loc = B53_EG_MIR_CTL; 1846 1846 1847 1847 b53_read16(dev, B53_MGMT_PAGE, loc, &reg); 1848 - reg &= ~MIRROR_MASK; 1849 1848 reg |= BIT(port); 1850 1849 b53_write16(dev, B53_MGMT_PAGE, loc, reg); 1851 1850
-4
drivers/net/dsa/microchip/ksz8795.c
··· 1224 1224 { 1225 1225 int i; 1226 1226 1227 - mutex_init(&dev->stats_mutex); 1228 - mutex_init(&dev->alu_mutex); 1229 - mutex_init(&dev->vlan_mutex); 1230 - 1231 1227 dev->ds->ops = &ksz8795_switch_ops; 1232 1228 1233 1229 for (i = 0; i < ARRAY_SIZE(ksz8795_switch_chips); i++) {
+4 -3
drivers/net/dsa/microchip/ksz8795_spi.c
··· 25 25 26 26 static int ksz8795_spi_probe(struct spi_device *spi) 27 27 { 28 + struct regmap_config rc; 28 29 struct ksz_device *dev; 29 30 int i, ret; 30 31 ··· 34 33 return -ENOMEM; 35 34 36 35 for (i = 0; i < ARRAY_SIZE(ksz8795_regmap_config); i++) { 37 - dev->regmap[i] = devm_regmap_init_spi(spi, 38 - &ksz8795_regmap_config 39 - [i]); 36 + rc = ksz8795_regmap_config[i]; 37 + rc.lock_arg = &dev->regmap_mutex; 38 + dev->regmap[i] = devm_regmap_init_spi(spi, &rc); 40 39 if (IS_ERR(dev->regmap[i])) { 41 40 ret = PTR_ERR(dev->regmap[i]); 42 41 dev_err(&spi->dev,
+4 -2
drivers/net/dsa/microchip/ksz9477_i2c.c
··· 17 17 static int ksz9477_i2c_probe(struct i2c_client *i2c, 18 18 const struct i2c_device_id *i2c_id) 19 19 { 20 + struct regmap_config rc; 20 21 struct ksz_device *dev; 21 22 int i, ret; 22 23 ··· 26 25 return -ENOMEM; 27 26 28 27 for (i = 0; i < ARRAY_SIZE(ksz9477_regmap_config); i++) { 29 - dev->regmap[i] = devm_regmap_init_i2c(i2c, 30 - &ksz9477_regmap_config[i]); 28 + rc = ksz9477_regmap_config[i]; 29 + rc.lock_arg = &dev->regmap_mutex; 30 + dev->regmap[i] = devm_regmap_init_i2c(i2c, &rc); 31 31 if (IS_ERR(dev->regmap[i])) { 32 32 ret = PTR_ERR(dev->regmap[i]); 33 33 dev_err(&i2c->dev,
+2 -2
drivers/net/dsa/microchip/ksz9477_reg.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 2 - * 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* 3 3 * Microchip KSZ9477 register definitions 4 4 * 5 5 * Copyright (C) 2017-2018 Microchip Technology Inc.
+4 -2
drivers/net/dsa/microchip/ksz9477_spi.c
··· 24 24 25 25 static int ksz9477_spi_probe(struct spi_device *spi) 26 26 { 27 + struct regmap_config rc; 27 28 struct ksz_device *dev; 28 29 int i, ret; 29 30 ··· 33 32 return -ENOMEM; 34 33 35 34 for (i = 0; i < ARRAY_SIZE(ksz9477_regmap_config); i++) { 36 - dev->regmap[i] = devm_regmap_init_spi(spi, 37 - &ksz9477_regmap_config[i]); 35 + rc = ksz9477_regmap_config[i]; 36 + rc.lock_arg = &dev->regmap_mutex; 37 + dev->regmap[i] = devm_regmap_init_spi(spi, &rc); 38 38 if (IS_ERR(dev->regmap[i])) { 39 39 ret = PTR_ERR(dev->regmap[i]); 40 40 dev_err(&spi->dev,
+1 -1
drivers/net/dsa/microchip/ksz_common.c
··· 436 436 } 437 437 438 438 mutex_init(&dev->dev_mutex); 439 - mutex_init(&dev->stats_mutex); 439 + mutex_init(&dev->regmap_mutex); 440 440 mutex_init(&dev->alu_mutex); 441 441 mutex_init(&dev->vlan_mutex); 442 442
+17 -3
drivers/net/dsa/microchip/ksz_common.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 2 - * Microchip switch driver common header 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* Microchip switch driver common header 3 3 * 4 4 * Copyright (C) 2017-2019 Microchip Technology Inc. 5 5 */ ··· 47 47 const char *name; 48 48 49 49 struct mutex dev_mutex; /* device access */ 50 - struct mutex stats_mutex; /* status access */ 50 + struct mutex regmap_mutex; /* regmap access */ 51 51 struct mutex alu_mutex; /* ALU access */ 52 52 struct mutex vlan_mutex; /* vlan access */ 53 53 const struct ksz_dev_ops *dev_ops; ··· 290 290 ksz_write32(dev, dev->dev_ops->get_port_addr(port, offset), data); 291 291 } 292 292 293 + static inline void ksz_regmap_lock(void *__mtx) 294 + { 295 + struct mutex *mtx = __mtx; 296 + mutex_lock(mtx); 297 + } 298 + 299 + static inline void ksz_regmap_unlock(void *__mtx) 300 + { 301 + struct mutex *mtx = __mtx; 302 + mutex_unlock(mtx); 303 + } 304 + 293 305 /* Regmap tables generation */ 294 306 #define KSZ_SPI_OP_RD 3 295 307 #define KSZ_SPI_OP_WR 2 ··· 326 314 .write_flag_mask = \ 327 315 KSZ_SPI_OP_FLAG_MASK(KSZ_SPI_OP_WR, swp, \ 328 316 regbits, regpad), \ 317 + .lock = ksz_regmap_lock, \ 318 + .unlock = ksz_regmap_unlock, \ 329 319 .reg_format_endian = REGMAP_ENDIAN_BIG, \ 330 320 .val_format_endian = REGMAP_ENDIAN_BIG \ 331 321 }
+2 -2
drivers/net/dsa/sja1105/sja1105.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 2 - * Copyright (c) 2018, Sensor-Technik Wiedemann GmbH 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* Copyright (c) 2018, Sensor-Technik Wiedemann GmbH 3 3 * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com> 4 4 */ 5 5 #ifndef _SJA1105_H
+2 -2
drivers/net/dsa/sja1105/sja1105_dynamic_config.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 2 - * Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com> 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com> 3 3 */ 4 4 #ifndef _SJA1105_DYNAMIC_CONFIG_H 5 5 #define _SJA1105_DYNAMIC_CONFIG_H
+2 -2
drivers/net/dsa/sja1105/sja1105_ptp.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 2 - * Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com> 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com> 3 3 */ 4 4 #ifndef _SJA1105_PTP_H 5 5 #define _SJA1105_PTP_H
+2 -2
drivers/net/dsa/sja1105/sja1105_static_config.h
··· 1 - /* SPDX-License-Identifier: BSD-3-Clause 2 - * Copyright (c) 2016-2018, NXP Semiconductors 1 + /* SPDX-License-Identifier: BSD-3-Clause */ 2 + /* Copyright (c) 2016-2018, NXP Semiconductors 3 3 * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com> 4 4 */ 5 5 #ifndef _SJA1105_STATIC_CONFIG_H
+2 -2
drivers/net/dsa/sja1105/sja1105_tas.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 2 - * Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com> 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com> 3 3 */ 4 4 #ifndef _SJA1105_TAS_H 5 5 #define _SJA1105_TAS_H
+1 -3
drivers/net/ethernet/aquantia/atlantic/aq_main.c
··· 194 194 { 195 195 struct aq_nic_s *aq_nic = netdev_priv(ndev); 196 196 197 - aq_nic_set_packet_filter(aq_nic, ndev->flags); 198 - 199 - aq_nic_set_multicast_list(aq_nic, ndev); 197 + (void)aq_nic_set_multicast_list(aq_nic, ndev); 200 198 } 201 199 202 200 static int aq_ndo_vlan_rx_add_vid(struct net_device *ndev, __be16 proto,
+18 -16
drivers/net/ethernet/aquantia/atlantic/aq_nic.c
··· 631 631 632 632 int aq_nic_set_multicast_list(struct aq_nic_s *self, struct net_device *ndev) 633 633 { 634 - unsigned int packet_filter = self->packet_filter; 634 + const struct aq_hw_ops *hw_ops = self->aq_hw_ops; 635 + struct aq_nic_cfg_s *cfg = &self->aq_nic_cfg; 636 + unsigned int packet_filter = ndev->flags; 635 637 struct netdev_hw_addr *ha = NULL; 636 638 unsigned int i = 0U; 639 + int err = 0; 637 640 638 641 self->mc_list.count = 0; 639 642 if (netdev_uc_count(ndev) > AQ_HW_MULTICAST_ADDRESS_MAX) { ··· 644 641 } else { 645 642 netdev_for_each_uc_addr(ha, ndev) { 646 643 ether_addr_copy(self->mc_list.ar[i++], ha->addr); 647 - 648 - if (i >= AQ_HW_MULTICAST_ADDRESS_MAX) 649 - break; 650 644 } 651 645 } 652 646 653 - if (i + netdev_mc_count(ndev) > AQ_HW_MULTICAST_ADDRESS_MAX) { 654 - packet_filter |= IFF_ALLMULTI; 655 - } else { 656 - netdev_for_each_mc_addr(ha, ndev) { 657 - ether_addr_copy(self->mc_list.ar[i++], ha->addr); 658 - 659 - if (i >= AQ_HW_MULTICAST_ADDRESS_MAX) 660 - break; 647 + cfg->is_mc_list_enabled = !!(packet_filter & IFF_MULTICAST); 648 + if (cfg->is_mc_list_enabled) { 649 + if (i + netdev_mc_count(ndev) > AQ_HW_MULTICAST_ADDRESS_MAX) { 650 + packet_filter |= IFF_ALLMULTI; 651 + } else { 652 + netdev_for_each_mc_addr(ha, ndev) { 653 + ether_addr_copy(self->mc_list.ar[i++], 654 + ha->addr); 655 + } 661 656 } 662 657 } 663 658 664 659 if (i > 0 && i <= AQ_HW_MULTICAST_ADDRESS_MAX) { 665 - packet_filter |= IFF_MULTICAST; 666 660 self->mc_list.count = i; 667 - self->aq_hw_ops->hw_multicast_list_set(self->aq_hw, 668 - self->mc_list.ar, 669 - self->mc_list.count); 661 + err = hw_ops->hw_multicast_list_set(self->aq_hw, 662 + self->mc_list.ar, 663 + self->mc_list.count); 664 + if (err < 0) 665 + return err; 670 666 } 671 667 return aq_nic_set_packet_filter(self, packet_filter); 672 668 }
+2 -1
drivers/net/ethernet/aquantia/atlantic/aq_ring.c
··· 313 313 break; 314 314 315 315 buff->is_error |= buff_->is_error; 316 + buff->is_cso_err |= buff_->is_cso_err; 316 317 317 318 } while (!buff_->is_eop); 318 319 ··· 321 320 err = 0; 322 321 goto err_exit; 323 322 } 324 - if (buff->is_error) { 323 + if (buff->is_error || buff->is_cso_err) { 325 324 buff_ = buff; 326 325 do { 327 326 next_ = buff_->next,
+18 -5
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
··· 818 818 cfg->is_vlan_force_promisc); 819 819 820 820 hw_atl_rpfl2multicast_flr_en_set(self, 821 - IS_FILTER_ENABLED(IFF_ALLMULTI), 0); 821 + IS_FILTER_ENABLED(IFF_ALLMULTI) && 822 + IS_FILTER_ENABLED(IFF_MULTICAST), 0); 822 823 823 824 hw_atl_rpfl2_accept_all_mc_packets_set(self, 824 - IS_FILTER_ENABLED(IFF_ALLMULTI)); 825 + IS_FILTER_ENABLED(IFF_ALLMULTI) && 826 + IS_FILTER_ENABLED(IFF_MULTICAST)); 825 827 826 828 hw_atl_rpfl2broadcast_en_set(self, IS_FILTER_ENABLED(IFF_BROADCAST)); 827 829 828 - cfg->is_mc_list_enabled = IS_FILTER_ENABLED(IFF_MULTICAST); 829 830 830 831 for (i = HW_ATL_B0_MAC_MIN; i < HW_ATL_B0_MAC_MAX; ++i) 831 832 hw_atl_rpfl2_uc_flr_en_set(self, ··· 969 968 970 969 static int hw_atl_b0_hw_stop(struct aq_hw_s *self) 971 970 { 971 + int err; 972 + u32 val; 973 + 972 974 hw_atl_b0_hw_irq_disable(self, HW_ATL_B0_INT_MASK); 973 975 974 976 /* Invalidate Descriptor Cache to prevent writing to the cached 975 977 * descriptors and to the data pointer of those descriptors 976 978 */ 977 - hw_atl_rdm_rx_dma_desc_cache_init_set(self, 1); 979 + hw_atl_rdm_rx_dma_desc_cache_init_tgl(self); 978 980 979 - return aq_hw_err_from_flags(self); 981 + err = aq_hw_err_from_flags(self); 982 + 983 + if (err) 984 + goto err_exit; 985 + 986 + readx_poll_timeout_atomic(hw_atl_rdm_rx_dma_desc_cache_init_done_get, 987 + self, val, val == 1, 1000U, 10000U); 988 + 989 + err_exit: 990 + return err; 980 991 } 981 992 982 993 static int hw_atl_b0_hw_ring_tx_stop(struct aq_hw_s *self,
+15 -2
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.c
··· 606 606 HW_ATL_RPB_RX_FC_MODE_SHIFT, rx_flow_ctl_mode); 607 607 } 608 608 609 - void hw_atl_rdm_rx_dma_desc_cache_init_set(struct aq_hw_s *aq_hw, u32 init) 609 + void hw_atl_rdm_rx_dma_desc_cache_init_tgl(struct aq_hw_s *aq_hw) 610 610 { 611 + u32 val; 612 + 613 + val = aq_hw_read_reg_bit(aq_hw, HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_ADR, 614 + HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_MSK, 615 + HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_SHIFT); 616 + 611 617 aq_hw_write_reg_bit(aq_hw, HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_ADR, 612 618 HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_MSK, 613 619 HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_SHIFT, 614 - init); 620 + val ^ 1); 621 + } 622 + 623 + u32 hw_atl_rdm_rx_dma_desc_cache_init_done_get(struct aq_hw_s *aq_hw) 624 + { 625 + return aq_hw_read_reg_bit(aq_hw, RDM_RX_DMA_DESC_CACHE_INIT_DONE_ADR, 626 + RDM_RX_DMA_DESC_CACHE_INIT_DONE_MSK, 627 + RDM_RX_DMA_DESC_CACHE_INIT_DONE_SHIFT); 615 628 } 616 629 617 630 void hw_atl_rpb_rx_pkt_buff_size_per_tc_set(struct aq_hw_s *aq_hw,
+5 -2
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.h
··· 313 313 u32 rx_pkt_buff_size_per_tc, 314 314 u32 buffer); 315 315 316 - /* set rdm rx dma descriptor cache init */ 317 - void hw_atl_rdm_rx_dma_desc_cache_init_set(struct aq_hw_s *aq_hw, u32 init); 316 + /* toggle rdm rx dma descriptor cache init */ 317 + void hw_atl_rdm_rx_dma_desc_cache_init_tgl(struct aq_hw_s *aq_hw); 318 + 319 + /* get rdm rx dma descriptor cache init done */ 320 + u32 hw_atl_rdm_rx_dma_desc_cache_init_done_get(struct aq_hw_s *aq_hw); 318 321 319 322 /* set rx xoff enable (per tc) */ 320 323 void hw_atl_rpb_rx_xoff_en_per_tc_set(struct aq_hw_s *aq_hw, u32 rx_xoff_en_per_tc,
+19
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh_internal.h
··· 318 318 /* default value of bitfield rdm_desc_init_i */ 319 319 #define HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_DEFAULT 0x0 320 320 321 + /* rdm_desc_init_done_i bitfield definitions 322 + * preprocessor definitions for the bitfield rdm_desc_init_done_i. 323 + * port="pif_rdm_desc_init_done_i" 324 + */ 325 + 326 + /* register address for bitfield rdm_desc_init_done_i */ 327 + #define RDM_RX_DMA_DESC_CACHE_INIT_DONE_ADR 0x00005a10 328 + /* bitmask for bitfield rdm_desc_init_done_i */ 329 + #define RDM_RX_DMA_DESC_CACHE_INIT_DONE_MSK 0x00000001U 330 + /* inverted bitmask for bitfield rdm_desc_init_done_i */ 331 + #define RDM_RX_DMA_DESC_CACHE_INIT_DONE_MSKN 0xfffffffe 332 + /* lower bit position of bitfield rdm_desc_init_done_i */ 333 + #define RDM_RX_DMA_DESC_CACHE_INIT_DONE_SHIFT 0U 334 + /* width of bitfield rdm_desc_init_done_i */ 335 + #define RDM_RX_DMA_DESC_CACHE_INIT_DONE_WIDTH 1 336 + /* default value of bitfield rdm_desc_init_done_i */ 337 + #define RDM_RX_DMA_DESC_CACHE_INIT_DONE_DEFAULT 0x0 338 + 339 + 321 340 /* rx int_desc_wrb_en bitfield definitions 322 341 * preprocessor definitions for the bitfield "int_desc_wrb_en". 323 342 * port="pif_rdm_int_desc_wrb_en_i"
+1 -1
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c
··· 337 337 /* Convert PHY temperature from 1/256 degree Celsius 338 338 * to 1/1000 degree Celsius. 339 339 */ 340 - *temp = temp_res * 1000 / 256; 340 + *temp = (temp_res & 0xFFFF) * 1000 / 256; 341 341 342 342 return 0; 343 343 }
+3 -1
drivers/net/ethernet/broadcom/Kconfig
··· 8 8 default y 9 9 depends on (SSB_POSSIBLE && HAS_DMA) || PCI || BCM63XX || \ 10 10 SIBYTE_SB1xxx_SOC 11 - select DIMLIB 12 11 ---help--- 13 12 If you have a network (Ethernet) chipset belonging to this class, 14 13 say Y. ··· 68 69 select FIXED_PHY 69 70 select BCM7XXX_PHY 70 71 select MDIO_BCM_UNIMAC 72 + select DIMLIB 71 73 help 72 74 This driver supports the built-in Ethernet MACs found in the 73 75 Broadcom BCM7xxx Set Top Box family chipset. ··· 188 188 select MII 189 189 select PHYLIB 190 190 select FIXED_PHY 191 + select DIMLIB 191 192 help 192 193 This driver supports the built-in Ethernet MACs found in the 193 194 Broadcom BCM7xxx Set Top Box family chipset using an internal ··· 201 200 select LIBCRC32C 202 201 select NET_DEVLINK 203 202 select PAGE_POOL 203 + select DIMLIB 204 204 ---help--- 205 205 This driver supports Broadcom NetXtreme-C/E 10/25/40/50 gigabit 206 206 Ethernet cards. To compile this driver as a module, choose M here:
+26 -15
drivers/net/ethernet/broadcom/genet/bcmgenet.c
··· 2018 2018 */ 2019 2019 if (priv->internal_phy) { 2020 2020 int0_enable |= UMAC_IRQ_LINK_EVENT; 2021 + if (GENET_IS_V1(priv) || GENET_IS_V2(priv) || GENET_IS_V3(priv)) 2022 + int0_enable |= UMAC_IRQ_PHY_DET_R; 2021 2023 } else if (priv->ext_phy) { 2022 2024 int0_enable |= UMAC_IRQ_LINK_EVENT; 2023 2025 } else if (priv->phy_interface == PHY_INTERFACE_MODE_MOCA) { ··· 2613 2611 priv->irq0_stat = 0; 2614 2612 spin_unlock_irq(&priv->lock); 2615 2613 2614 + if (status & UMAC_IRQ_PHY_DET_R && 2615 + priv->dev->phydev->autoneg != AUTONEG_ENABLE) 2616 + phy_init_hw(priv->dev->phydev); 2617 + 2616 2618 /* Link UP/DOWN event */ 2617 - if (status & UMAC_IRQ_LINK_EVENT) { 2618 - priv->dev->phydev->link = !!(status & UMAC_IRQ_LINK_UP); 2619 + if (status & UMAC_IRQ_LINK_EVENT) 2619 2620 phy_mac_interrupt(priv->dev->phydev); 2620 - } 2621 + 2621 2622 } 2622 2623 2623 2624 /* bcmgenet_isr1: handle Rx and Tx priority queues */ ··· 2715 2710 } 2716 2711 2717 2712 /* all other interested interrupts handled in bottom half */ 2718 - status &= UMAC_IRQ_LINK_EVENT; 2713 + status &= (UMAC_IRQ_LINK_EVENT | UMAC_IRQ_PHY_DET_R); 2719 2714 if (status) { 2720 2715 /* Save irq status for bottom-half processing. */ 2721 2716 spin_lock_irqsave(&priv->lock, flags); ··· 2879 2874 if (priv->internal_phy) 2880 2875 bcmgenet_power_up(priv, GENET_POWER_PASSIVE); 2881 2876 2877 + ret = bcmgenet_mii_connect(dev); 2878 + if (ret) { 2879 + netdev_err(dev, "failed to connect to PHY\n"); 2880 + goto err_clk_disable; 2881 + } 2882 + 2882 2883 /* take MAC out of reset */ 2883 2884 bcmgenet_umac_reset(priv); 2884 2885 ··· 2893 2882 /* Make sure we reflect the value of CRC_CMD_FWD */ 2894 2883 reg = bcmgenet_umac_readl(priv, UMAC_CMD); 2895 2884 priv->crc_fwd_en = !!(reg & CMD_CRC_FWD); 2885 + 2886 + ret = bcmgenet_mii_config(dev, true); 2887 + if (ret) { 2888 + netdev_err(dev, "unsupported PHY\n"); 2889 + goto err_disconnect_phy; 2890 + } 2896 2891 2897 2892 bcmgenet_set_hw_addr(priv, dev->dev_addr); 2898 2893 ··· 2915 2898 ret = bcmgenet_init_dma(priv); 2916 2899 if (ret) { 2917 2900 netdev_err(dev, "failed to initialize DMA\n"); 2918 - goto err_clk_disable; 2901 + goto err_disconnect_phy; 2919 2902 } 2920 2903 2921 2904 /* Always enable ring 16 - descriptor ring */ ··· 2938 2921 goto err_irq0; 2939 2922 } 2940 2923 2941 - ret = bcmgenet_mii_probe(dev); 2942 - if (ret) { 2943 - netdev_err(dev, "failed to connect to PHY\n"); 2944 - goto err_irq1; 2945 - } 2946 - 2947 2924 bcmgenet_netif_start(dev); 2948 2925 2949 2926 netif_tx_start_all_queues(dev); 2950 2927 2951 2928 return 0; 2952 2929 2953 - err_irq1: 2954 - free_irq(priv->irq1, priv); 2955 2930 err_irq0: 2956 2931 free_irq(priv->irq0, priv); 2957 2932 err_fini_dma: 2958 2933 bcmgenet_dma_teardown(priv); 2959 2934 bcmgenet_fini_dma(priv); 2935 + err_disconnect_phy: 2936 + phy_disconnect(dev->phydev); 2960 2937 err_clk_disable: 2961 2938 if (priv->internal_phy) 2962 2939 bcmgenet_power_down(priv, GENET_POWER_PASSIVE); ··· 3631 3620 if (priv->internal_phy) 3632 3621 bcmgenet_power_up(priv, GENET_POWER_PASSIVE); 3633 3622 3623 + phy_init_hw(dev->phydev); 3624 + 3634 3625 bcmgenet_umac_reset(priv); 3635 3626 3636 3627 init_umac(priv); ··· 3640 3627 /* From WOL-enabled suspend, switch to regular clock */ 3641 3628 if (priv->wolopts) 3642 3629 clk_disable_unprepare(priv->clk_wol); 3643 - 3644 - phy_init_hw(dev->phydev); 3645 3630 3646 3631 /* Speed settings must be restored */ 3647 3632 bcmgenet_mii_config(priv->dev, false);
+2 -1
drivers/net/ethernet/broadcom/genet/bcmgenet.h
··· 366 366 #define EXT_PWR_DOWN_PHY_EN (1 << 20) 367 367 368 368 #define EXT_RGMII_OOB_CTRL 0x0C 369 + #define RGMII_MODE_EN_V123 (1 << 0) 369 370 #define RGMII_LINK (1 << 4) 370 371 #define OOB_DISABLE (1 << 5) 371 372 #define RGMII_MODE_EN (1 << 6) ··· 720 719 721 720 /* MDIO routines */ 722 721 int bcmgenet_mii_init(struct net_device *dev); 722 + int bcmgenet_mii_connect(struct net_device *dev); 723 723 int bcmgenet_mii_config(struct net_device *dev, bool init); 724 - int bcmgenet_mii_probe(struct net_device *dev); 725 724 void bcmgenet_mii_exit(struct net_device *dev); 726 725 void bcmgenet_phy_power_set(struct net_device *dev, bool enable); 727 726 void bcmgenet_mii_setup(struct net_device *dev);
+57 -62
drivers/net/ethernet/broadcom/genet/bcmmii.c
··· 173 173 bcmgenet_fixed_phy_link_update); 174 174 } 175 175 176 + int bcmgenet_mii_connect(struct net_device *dev) 177 + { 178 + struct bcmgenet_priv *priv = netdev_priv(dev); 179 + struct device_node *dn = priv->pdev->dev.of_node; 180 + struct phy_device *phydev; 181 + u32 phy_flags = 0; 182 + int ret; 183 + 184 + /* Communicate the integrated PHY revision */ 185 + if (priv->internal_phy) 186 + phy_flags = priv->gphy_rev; 187 + 188 + /* Initialize link state variables that bcmgenet_mii_setup() uses */ 189 + priv->old_link = -1; 190 + priv->old_speed = -1; 191 + priv->old_duplex = -1; 192 + priv->old_pause = -1; 193 + 194 + if (dn) { 195 + phydev = of_phy_connect(dev, priv->phy_dn, bcmgenet_mii_setup, 196 + phy_flags, priv->phy_interface); 197 + if (!phydev) { 198 + pr_err("could not attach to PHY\n"); 199 + return -ENODEV; 200 + } 201 + } else { 202 + phydev = dev->phydev; 203 + phydev->dev_flags = phy_flags; 204 + 205 + ret = phy_connect_direct(dev, phydev, bcmgenet_mii_setup, 206 + priv->phy_interface); 207 + if (ret) { 208 + pr_err("could not attach to PHY\n"); 209 + return -ENODEV; 210 + } 211 + } 212 + 213 + return 0; 214 + } 215 + 176 216 int bcmgenet_mii_config(struct net_device *dev, bool init) 177 217 { 178 218 struct bcmgenet_priv *priv = netdev_priv(dev); ··· 298 258 */ 299 259 if (priv->ext_phy) { 300 260 reg = bcmgenet_ext_readl(priv, EXT_RGMII_OOB_CTRL); 301 - reg |= RGMII_MODE_EN | id_mode_dis; 261 + reg |= id_mode_dis; 262 + if (GENET_IS_V1(priv) || GENET_IS_V2(priv) || GENET_IS_V3(priv)) 263 + reg |= RGMII_MODE_EN_V123; 264 + else 265 + reg |= RGMII_MODE_EN; 302 266 bcmgenet_ext_writel(priv, reg, EXT_RGMII_OOB_CTRL); 303 267 } 304 268 305 - if (init) 269 + if (init) { 270 + linkmode_copy(phydev->advertising, phydev->supported); 271 + 272 + /* The internal PHY has its link interrupts routed to the 273 + * Ethernet MAC ISRs. On GENETv5 there is a hardware issue 274 + * that prevents the signaling of link UP interrupts when 275 + * the link operates at 10Mbps, so fallback to polling for 276 + * those versions of GENET. 277 + */ 278 + if (priv->internal_phy && !GENET_IS_V5(priv)) 279 + phydev->irq = PHY_IGNORE_INTERRUPT; 280 + 306 281 dev_info(kdev, "configuring instance for %s\n", phy_name); 307 - 308 - return 0; 309 - } 310 - 311 - int bcmgenet_mii_probe(struct net_device *dev) 312 - { 313 - struct bcmgenet_priv *priv = netdev_priv(dev); 314 - struct device_node *dn = priv->pdev->dev.of_node; 315 - struct phy_device *phydev; 316 - u32 phy_flags; 317 - int ret; 318 - 319 - /* Communicate the integrated PHY revision */ 320 - phy_flags = priv->gphy_rev; 321 - 322 - /* Initialize link state variables that bcmgenet_mii_setup() uses */ 323 - priv->old_link = -1; 324 - priv->old_speed = -1; 325 - priv->old_duplex = -1; 326 - priv->old_pause = -1; 327 - 328 - if (dn) { 329 - phydev = of_phy_connect(dev, priv->phy_dn, bcmgenet_mii_setup, 330 - phy_flags, priv->phy_interface); 331 - if (!phydev) { 332 - pr_err("could not attach to PHY\n"); 333 - return -ENODEV; 334 - } 335 - } else { 336 - phydev = dev->phydev; 337 - phydev->dev_flags = phy_flags; 338 - 339 - ret = phy_connect_direct(dev, phydev, bcmgenet_mii_setup, 340 - priv->phy_interface); 341 - if (ret) { 342 - pr_err("could not attach to PHY\n"); 343 - return -ENODEV; 344 - } 345 282 } 346 - 347 - /* Configure port multiplexer based on what the probed PHY device since 348 - * reading the 'max-speed' property determines the maximum supported 349 - * PHY speed which is needed for bcmgenet_mii_config() to configure 350 - * things appropriately. 351 - */ 352 - ret = bcmgenet_mii_config(dev, true); 353 - if (ret) { 354 - phy_disconnect(dev->phydev); 355 - return ret; 356 - } 357 - 358 - linkmode_copy(phydev->advertising, phydev->supported); 359 - 360 - /* The internal PHY has its link interrupts routed to the 361 - * Ethernet MAC ISRs. On GENETv5 there is a hardware issue 362 - * that prevents the signaling of link UP interrupts when 363 - * the link operates at 10Mbps, so fallback to polling for 364 - * those versions of GENET. 365 - */ 366 - if (priv->internal_phy && !GENET_IS_V5(priv)) 367 - dev->phydev->irq = PHY_IGNORE_INTERRUPT; 368 283 369 284 return 0; 370 285 }
+6 -6
drivers/net/ethernet/cadence/macb_main.c
··· 3405 3405 return err; 3406 3406 } 3407 3407 3408 - *tx_clk = devm_clk_get(&pdev->dev, "tx_clk"); 3408 + *tx_clk = devm_clk_get_optional(&pdev->dev, "tx_clk"); 3409 3409 if (IS_ERR(*tx_clk)) 3410 - *tx_clk = NULL; 3410 + return PTR_ERR(*tx_clk); 3411 3411 3412 - *rx_clk = devm_clk_get(&pdev->dev, "rx_clk"); 3412 + *rx_clk = devm_clk_get_optional(&pdev->dev, "rx_clk"); 3413 3413 if (IS_ERR(*rx_clk)) 3414 - *rx_clk = NULL; 3414 + return PTR_ERR(*rx_clk); 3415 3415 3416 - *tsu_clk = devm_clk_get(&pdev->dev, "tsu_clk"); 3416 + *tsu_clk = devm_clk_get_optional(&pdev->dev, "tsu_clk"); 3417 3417 if (IS_ERR(*tsu_clk)) 3418 - *tsu_clk = NULL; 3418 + return PTR_ERR(*tsu_clk); 3419 3419 3420 3420 err = clk_prepare_enable(*pclk); 3421 3421 if (err) {
+1 -1
drivers/net/ethernet/cavium/common/cavium_ptp.h
··· 1 - // SPDX-License-Identifier: GPL-2.0 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 2 /* cavium_ptp.h - PTP 1588 clock on Cavium hardware 3 3 * Copyright (c) 2003-2015, 2017 Cavium, Inc. 4 4 */
+49 -1
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
··· 1235 1235 priv->rx_td_enabled = enable; 1236 1236 } 1237 1237 1238 + static void update_tx_fqids(struct dpaa2_eth_priv *priv); 1239 + 1238 1240 static int link_state_update(struct dpaa2_eth_priv *priv) 1239 1241 { 1240 1242 struct dpni_link_state state = {0}; ··· 1263 1261 goto out; 1264 1262 1265 1263 if (state.up) { 1264 + update_tx_fqids(priv); 1266 1265 netif_carrier_on(priv->net_dev); 1267 1266 netif_tx_start_all_queues(priv->net_dev); 1268 1267 } else { ··· 2536 2533 return 0; 2537 2534 } 2538 2535 2536 + static void update_tx_fqids(struct dpaa2_eth_priv *priv) 2537 + { 2538 + struct dpni_queue_id qid = {0}; 2539 + struct dpaa2_eth_fq *fq; 2540 + struct dpni_queue queue; 2541 + int i, j, err; 2542 + 2543 + /* We only use Tx FQIDs for FQID-based enqueue, so check 2544 + * if DPNI version supports it before updating FQIDs 2545 + */ 2546 + if (dpaa2_eth_cmp_dpni_ver(priv, DPNI_ENQUEUE_FQID_VER_MAJOR, 2547 + DPNI_ENQUEUE_FQID_VER_MINOR) < 0) 2548 + return; 2549 + 2550 + for (i = 0; i < priv->num_fqs; i++) { 2551 + fq = &priv->fq[i]; 2552 + if (fq->type != DPAA2_TX_CONF_FQ) 2553 + continue; 2554 + for (j = 0; j < dpaa2_eth_tc_count(priv); j++) { 2555 + err = dpni_get_queue(priv->mc_io, 0, priv->mc_token, 2556 + DPNI_QUEUE_TX, j, fq->flowid, 2557 + &queue, &qid); 2558 + if (err) 2559 + goto out_err; 2560 + 2561 + fq->tx_fqid[j] = qid.fqid; 2562 + if (fq->tx_fqid[j] == 0) 2563 + goto out_err; 2564 + } 2565 + } 2566 + 2567 + priv->enqueue = dpaa2_eth_enqueue_fq; 2568 + 2569 + return; 2570 + 2571 + out_err: 2572 + netdev_info(priv->net_dev, 2573 + "Error reading Tx FQID, fallback to QDID-based enqueue\n"); 2574 + priv->enqueue = dpaa2_eth_enqueue_qd; 2575 + } 2576 + 2539 2577 /* Configure the DPNI object this interface is associated with */ 2540 2578 static int setup_dpni(struct fsl_mc_device *ls_dev) 2541 2579 { ··· 3350 3306 if (status & DPNI_IRQ_EVENT_LINK_CHANGED) 3351 3307 link_state_update(netdev_priv(net_dev)); 3352 3308 3309 + if (status & DPNI_IRQ_EVENT_ENDPOINT_CHANGED) 3310 + set_mac_addr(netdev_priv(net_dev)); 3311 + 3353 3312 return IRQ_HANDLED; 3354 3313 } 3355 3314 ··· 3378 3331 } 3379 3332 3380 3333 err = dpni_set_irq_mask(ls_dev->mc_io, 0, ls_dev->mc_handle, 3381 - DPNI_IRQ_INDEX, DPNI_IRQ_EVENT_LINK_CHANGED); 3334 + DPNI_IRQ_INDEX, DPNI_IRQ_EVENT_LINK_CHANGED | 3335 + DPNI_IRQ_EVENT_ENDPOINT_CHANGED); 3382 3336 if (err < 0) { 3383 3337 dev_err(&ls_dev->dev, "dpni_set_irq_mask(): %d\n", err); 3384 3338 goto free_irq;
+4 -1
drivers/net/ethernet/freescale/dpaa2/dpni.h
··· 133 133 */ 134 134 #define DPNI_IRQ_INDEX 0 135 135 /** 136 - * IRQ event - indicates a change in link state 136 + * IRQ events: 137 + * indicates a change in link state 138 + * indicates a change in endpoint 137 139 */ 138 140 #define DPNI_IRQ_EVENT_LINK_CHANGED 0x00000001 141 + #define DPNI_IRQ_EVENT_ENDPOINT_CHANGED 0x00000002 139 142 140 143 int dpni_set_irq_enable(struct fsl_mc_io *mc_io, 141 144 u32 cmd_flags,
+2
drivers/net/ethernet/hisilicon/hns3/hnae3.h
··· 32 32 33 33 #define HNAE3_MOD_VERSION "1.0" 34 34 35 + #define HNAE3_MIN_VECTOR_NUM 2 /* first one for misc, another for IO */ 36 + 35 37 /* Device IDs */ 36 38 #define HNAE3_DEV_ID_GE 0xA220 37 39 #define HNAE3_DEV_ID_25GE 0xA221
+20 -1
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
··· 906 906 hnae3_get_field(__le16_to_cpu(req->pf_intr_vector_number), 907 907 HCLGE_PF_VEC_NUM_M, HCLGE_PF_VEC_NUM_S); 908 908 909 + /* nic's msix numbers is always equals to the roce's. */ 910 + hdev->num_nic_msi = hdev->num_roce_msi; 911 + 909 912 /* PF should have NIC vectors and Roce vectors, 910 913 * NIC vectors are queued before Roce vectors. 911 914 */ ··· 918 915 hdev->num_msi = 919 916 hnae3_get_field(__le16_to_cpu(req->pf_intr_vector_number), 920 917 HCLGE_PF_VEC_NUM_M, HCLGE_PF_VEC_NUM_S); 918 + 919 + hdev->num_nic_msi = hdev->num_msi; 920 + } 921 + 922 + if (hdev->num_nic_msi < HNAE3_MIN_VECTOR_NUM) { 923 + dev_err(&hdev->pdev->dev, 924 + "Just %u msi resources, not enough for pf(min:2).\n", 925 + hdev->num_nic_msi); 926 + return -EINVAL; 921 927 } 922 928 923 929 return 0; ··· 1518 1506 vport->alloc_tqps = alloced; 1519 1507 kinfo->rss_size = min_t(u16, hdev->rss_size_max, 1520 1508 vport->alloc_tqps / hdev->tm_info.num_tc); 1509 + 1510 + /* ensure one to one mapping between irq and queue at default */ 1511 + kinfo->rss_size = min_t(u16, kinfo->rss_size, 1512 + (hdev->num_nic_msi - 1) / hdev->tm_info.num_tc); 1521 1513 1522 1514 return 0; 1523 1515 } ··· 2301 2285 int vectors; 2302 2286 int i; 2303 2287 2304 - vectors = pci_alloc_irq_vectors(pdev, 1, hdev->num_msi, 2288 + vectors = pci_alloc_irq_vectors(pdev, HNAE3_MIN_VECTOR_NUM, 2289 + hdev->num_msi, 2305 2290 PCI_IRQ_MSI | PCI_IRQ_MSIX); 2306 2291 if (vectors < 0) { 2307 2292 dev_err(&pdev->dev, ··· 2317 2300 2318 2301 hdev->num_msi = vectors; 2319 2302 hdev->num_msi_left = vectors; 2303 + 2320 2304 hdev->base_msi_vector = pdev->irq; 2321 2305 hdev->roce_base_vector = hdev->base_msi_vector + 2322 2306 hdev->roce_base_msix_offset; ··· 3921 3903 int alloc = 0; 3922 3904 int i, j; 3923 3905 3906 + vector_num = min_t(u16, hdev->num_nic_msi - 1, vector_num); 3924 3907 vector_num = min(hdev->num_msi_left, vector_num); 3925 3908 3926 3909 for (j = 0; j < vector_num; j++) {
+1
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
··· 763 763 u32 base_msi_vector; 764 764 u16 *vector_status; 765 765 int *vector_irq; 766 + u16 num_nic_msi; /* Num of nic vectors for this PF */ 766 767 u16 num_roce_msi; /* Num of roce vectors for this PF */ 767 768 int roce_base_vector; 768 769
+9 -2
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
··· 537 537 kinfo->rss_size = kinfo->req_rss_size; 538 538 } else if (kinfo->rss_size > max_rss_size || 539 539 (!kinfo->req_rss_size && kinfo->rss_size < max_rss_size)) { 540 + /* if user not set rss, the rss_size should compare with the 541 + * valid msi numbers to ensure one to one map between tqp and 542 + * irq as default. 543 + */ 544 + if (!kinfo->req_rss_size) 545 + max_rss_size = min_t(u16, max_rss_size, 546 + (hdev->num_nic_msi - 1) / 547 + kinfo->num_tc); 548 + 540 549 /* Set to the maximum specification value (max_rss_size). */ 541 - dev_info(&hdev->pdev->dev, "rss changes from %d to %d\n", 542 - kinfo->rss_size, max_rss_size); 543 550 kinfo->rss_size = max_rss_size; 544 551 } 545 552
+25 -3
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
··· 411 411 kinfo->tqp[i] = &hdev->htqp[i].q; 412 412 } 413 413 414 + /* after init the max rss_size and tqps, adjust the default tqp numbers 415 + * and rss size with the actual vector numbers 416 + */ 417 + kinfo->num_tqps = min_t(u16, hdev->num_nic_msix - 1, kinfo->num_tqps); 418 + kinfo->rss_size = min_t(u16, kinfo->num_tqps / kinfo->num_tc, 419 + kinfo->rss_size); 420 + 414 421 return 0; 415 422 } 416 423 ··· 509 502 int alloc = 0; 510 503 int i, j; 511 504 505 + vector_num = min_t(u16, hdev->num_nic_msix - 1, vector_num); 512 506 vector_num = min(hdev->num_msi_left, vector_num); 513 507 514 508 for (j = 0; j < vector_num; j++) { ··· 2254 2246 int vectors; 2255 2247 int i; 2256 2248 2257 - if (hnae3_get_bit(hdev->ae_dev->flag, HNAE3_DEV_SUPPORT_ROCE_B)) 2249 + if (hnae3_dev_roce_supported(hdev)) 2258 2250 vectors = pci_alloc_irq_vectors(pdev, 2259 2251 hdev->roce_base_msix_offset + 1, 2260 2252 hdev->num_msi, 2261 2253 PCI_IRQ_MSIX); 2262 2254 else 2263 - vectors = pci_alloc_irq_vectors(pdev, 1, hdev->num_msi, 2255 + vectors = pci_alloc_irq_vectors(pdev, HNAE3_MIN_VECTOR_NUM, 2256 + hdev->num_msi, 2264 2257 PCI_IRQ_MSI | PCI_IRQ_MSIX); 2265 2258 2266 2259 if (vectors < 0) { ··· 2277 2268 2278 2269 hdev->num_msi = vectors; 2279 2270 hdev->num_msi_left = vectors; 2271 + 2280 2272 hdev->base_msi_vector = pdev->irq; 2281 2273 hdev->roce_base_vector = pdev->irq + hdev->roce_base_msix_offset; 2282 2274 ··· 2543 2533 2544 2534 req = (struct hclgevf_query_res_cmd *)desc.data; 2545 2535 2546 - if (hnae3_get_bit(hdev->ae_dev->flag, HNAE3_DEV_SUPPORT_ROCE_B)) { 2536 + if (hnae3_dev_roce_supported(hdev)) { 2547 2537 hdev->roce_base_msix_offset = 2548 2538 hnae3_get_field(__le16_to_cpu(req->msixcap_localid_ba_rocee), 2549 2539 HCLGEVF_MSIX_OFT_ROCEE_M, ··· 2551 2541 hdev->num_roce_msix = 2552 2542 hnae3_get_field(__le16_to_cpu(req->vf_intr_vector_number), 2553 2543 HCLGEVF_VEC_NUM_M, HCLGEVF_VEC_NUM_S); 2544 + 2545 + /* nic's msix numbers is always equals to the roce's. */ 2546 + hdev->num_nic_msix = hdev->num_roce_msix; 2554 2547 2555 2548 /* VF should have NIC vectors and Roce vectors, NIC vectors 2556 2549 * are queued before Roce vectors. The offset is fixed to 64. ··· 2564 2551 hdev->num_msi = 2565 2552 hnae3_get_field(__le16_to_cpu(req->vf_intr_vector_number), 2566 2553 HCLGEVF_VEC_NUM_M, HCLGEVF_VEC_NUM_S); 2554 + 2555 + hdev->num_nic_msix = hdev->num_msi; 2556 + } 2557 + 2558 + if (hdev->num_nic_msix < HNAE3_MIN_VECTOR_NUM) { 2559 + dev_err(&hdev->pdev->dev, 2560 + "Just %u msi resources, not enough for vf(min:2).\n", 2561 + hdev->num_nic_msix); 2562 + return -EINVAL; 2567 2563 } 2568 2564 2569 2565 return 0;
+1
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h
··· 270 270 u16 num_msi; 271 271 u16 num_msi_left; 272 272 u16 num_msi_used; 273 + u16 num_nic_msix; /* Num of nic vectors for this VF */ 273 274 u16 num_roce_msix; /* Num of roce vectors for this VF */ 274 275 u16 roce_base_msix_offset; 275 276 int roce_base_vector;
+3 -1
drivers/net/ethernet/i825xx/lasi_82596.c
··· 96 96 97 97 #define OPT_SWAP_PORT 0x0001 /* Need to wordswp on the MPU port */ 98 98 99 + #define LIB82596_DMA_ATTR DMA_ATTR_NON_CONSISTENT 100 + 99 101 #define DMA_WBACK(ndev, addr, len) \ 100 102 do { dma_cache_sync((ndev)->dev.parent, (void *)addr, len, DMA_TO_DEVICE); } while (0) 101 103 ··· 202 200 203 201 unregister_netdev (dev); 204 202 dma_free_attrs(&pdev->dev, sizeof(struct i596_private), lp->dma, 205 - lp->dma_addr, DMA_ATTR_NON_CONSISTENT); 203 + lp->dma_addr, LIB82596_DMA_ATTR); 206 204 free_netdev (dev); 207 205 return 0; 208 206 }
+2 -2
drivers/net/ethernet/i825xx/lib82596.c
··· 1065 1065 1066 1066 dma = dma_alloc_attrs(dev->dev.parent, sizeof(struct i596_dma), 1067 1067 &lp->dma_addr, GFP_KERNEL, 1068 - DMA_ATTR_NON_CONSISTENT); 1068 + LIB82596_DMA_ATTR); 1069 1069 if (!dma) { 1070 1070 printk(KERN_ERR "%s: Couldn't get shared memory\n", __FILE__); 1071 1071 return -ENOMEM; ··· 1087 1087 i = register_netdev(dev); 1088 1088 if (i) { 1089 1089 dma_free_attrs(dev->dev.parent, sizeof(struct i596_dma), 1090 - dma, lp->dma_addr, DMA_ATTR_NON_CONSISTENT); 1090 + dma, lp->dma_addr, LIB82596_DMA_ATTR); 1091 1091 return i; 1092 1092 } 1093 1093
+3 -1
drivers/net/ethernet/i825xx/sni_82596.c
··· 24 24 25 25 static const char sni_82596_string[] = "snirm_82596"; 26 26 27 + #define LIB82596_DMA_ATTR 0 28 + 27 29 #define DMA_WBACK(priv, addr, len) do { } while (0) 28 30 #define DMA_INV(priv, addr, len) do { } while (0) 29 31 #define DMA_WBACK_INV(priv, addr, len) do { } while (0) ··· 154 152 155 153 unregister_netdev(dev); 156 154 dma_free_attrs(dev->dev.parent, sizeof(struct i596_private), lp->dma, 157 - lp->dma_addr, DMA_ATTR_NON_CONSISTENT); 155 + lp->dma_addr, LIB82596_DMA_ATTR); 158 156 iounmap(lp->ca); 159 157 iounmap(lp->mpu_port); 160 158 free_netdev (dev);
+3 -5
drivers/net/ethernet/ibm/ibmvnic.c
··· 2878 2878 2879 2879 if (test_bit(0, &adapter->resetting) && 2880 2880 adapter->reset_reason == VNIC_RESET_MOBILITY) { 2881 - u64 val = (0xff000000) | scrq->hw_irq; 2881 + struct irq_desc *desc = irq_to_desc(scrq->irq); 2882 + struct irq_chip *chip = irq_desc_get_chip(desc); 2882 2883 2883 - rc = plpar_hcall_norets(H_EOI, val); 2884 - if (rc) 2885 - dev_err(dev, "H_EOI FAILED irq 0x%llx. rc=%ld\n", 2886 - val, rc); 2884 + chip->irq_eoi(&desc->irq_data); 2887 2885 } 2888 2886 2889 2887 rc = plpar_hcall_norets(H_VIOCTL, adapter->vdev->unit_address,
+1
drivers/net/ethernet/mediatek/mtk_eth_soc.c
··· 261 261 ge_mode = 0; 262 262 switch (state->interface) { 263 263 case PHY_INTERFACE_MODE_MII: 264 + case PHY_INTERFACE_MODE_GMII: 264 265 ge_mode = 1; 265 266 break; 266 267 case PHY_INTERFACE_MODE_REVMII:
+4 -6
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c
··· 788 788 * it means that all the previous stes are the same, 789 789 * if so, this rule is duplicated. 790 790 */ 791 - if (mlx5dr_ste_is_last_in_rule(nic_matcher, 792 - matched_ste->ste_chain_location)) { 793 - mlx5dr_info(dmn, "Duplicate rule inserted, aborting!!\n"); 794 - return NULL; 795 - } 796 - return matched_ste; 791 + if (!mlx5dr_ste_is_last_in_rule(nic_matcher, ste_location)) 792 + return matched_ste; 793 + 794 + mlx5dr_dbg(dmn, "Duplicate rule inserted\n"); 797 795 } 798 796 799 797 if (!skip_rehash && dr_rule_need_enlarge_hash(cur_htbl, dmn, nic_dmn)) {
+1
drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c
··· 99 99 devlink = priv_to_devlink(mlxsw_sp->core); 100 100 in_devlink_port = mlxsw_core_port_devlink_port_get(mlxsw_sp->core, 101 101 local_port); 102 + skb_push(skb, ETH_HLEN); 102 103 devlink_trap_report(devlink, skb, trap_ctx, in_devlink_port); 103 104 consume_skb(skb); 104 105 }
-3
drivers/net/ethernet/nxp/lpc_eth.c
··· 1356 1356 if (!is_valid_ether_addr(ndev->dev_addr)) 1357 1357 eth_hw_addr_random(ndev); 1358 1358 1359 - /* Reset the ethernet controller */ 1360 - __lpc_eth_reset(pldat); 1361 - 1362 1359 /* then shut everything down to save power */ 1363 1360 __lpc_eth_shutdown(pldat); 1364 1361
+2
drivers/net/ethernet/pensando/ionic/ionic_lif.h
··· 182 182 183 183 #define lif_to_txqcq(lif, i) ((lif)->txqcqs[i].qcq) 184 184 #define lif_to_rxqcq(lif, i) ((lif)->rxqcqs[i].qcq) 185 + #define lif_to_txstats(lif, i) ((lif)->txqcqs[i].stats->tx) 186 + #define lif_to_rxstats(lif, i) ((lif)->rxqcqs[i].stats->rx) 185 187 #define lif_to_txq(lif, i) (&lif_to_txqcq((lif), i)->q) 186 188 #define lif_to_rxq(lif, i) (&lif_to_txqcq((lif), i)->q) 187 189
+19 -10
drivers/net/ethernet/pensando/ionic/ionic_stats.c
··· 117 117 /* rx stats */ 118 118 total += MAX_Q(lif) * IONIC_NUM_RX_STATS; 119 119 120 - if (test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) { 120 + if (test_bit(IONIC_LIF_UP, lif->state) && 121 + test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) { 121 122 /* tx debug stats */ 122 123 total += MAX_Q(lif) * (IONIC_NUM_DBG_CQ_STATS + 123 124 IONIC_NUM_TX_Q_STATS + ··· 150 149 *buf += ETH_GSTRING_LEN; 151 150 } 152 151 153 - if (test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) { 152 + if (test_bit(IONIC_LIF_UP, lif->state) && 153 + test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) { 154 154 for (i = 0; i < IONIC_NUM_TX_Q_STATS; i++) { 155 155 snprintf(*buf, ETH_GSTRING_LEN, 156 156 "txq_%d_%s", ··· 189 187 *buf += ETH_GSTRING_LEN; 190 188 } 191 189 192 - if (test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) { 190 + if (test_bit(IONIC_LIF_UP, lif->state) && 191 + test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) { 193 192 for (i = 0; i < IONIC_NUM_DBG_CQ_STATS; i++) { 194 193 snprintf(*buf, ETH_GSTRING_LEN, 195 194 "rxq_%d_cq_%s", ··· 226 223 { 227 224 struct ionic_lif_sw_stats lif_stats; 228 225 struct ionic_qcq *txqcq, *rxqcq; 226 + struct ionic_tx_stats *txstats; 227 + struct ionic_rx_stats *rxstats; 229 228 int i, q_num; 230 229 231 230 ionic_get_lif_stats(lif, &lif_stats); ··· 238 233 } 239 234 240 235 for (q_num = 0; q_num < MAX_Q(lif); q_num++) { 241 - txqcq = lif_to_txqcq(lif, q_num); 236 + txstats = &lif_to_txstats(lif, q_num); 242 237 243 238 for (i = 0; i < IONIC_NUM_TX_STATS; i++) { 244 - **buf = IONIC_READ_STAT64(&txqcq->stats->tx, 239 + **buf = IONIC_READ_STAT64(txstats, 245 240 &ionic_tx_stats_desc[i]); 246 241 (*buf)++; 247 242 } 248 243 249 - if (test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) { 244 + if (test_bit(IONIC_LIF_UP, lif->state) && 245 + test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) { 246 + txqcq = lif_to_txqcq(lif, q_num); 250 247 for (i = 0; i < IONIC_NUM_TX_Q_STATS; i++) { 251 248 **buf = IONIC_READ_STAT64(&txqcq->q, 252 249 &ionic_txq_stats_desc[i]); ··· 265 258 (*buf)++; 266 259 } 267 260 for (i = 0; i < IONIC_MAX_NUM_SG_CNTR; i++) { 268 - **buf = txqcq->stats->tx.sg_cntr[i]; 261 + **buf = txstats->sg_cntr[i]; 269 262 (*buf)++; 270 263 } 271 264 } 272 265 } 273 266 274 267 for (q_num = 0; q_num < MAX_Q(lif); q_num++) { 275 - rxqcq = lif_to_rxqcq(lif, q_num); 268 + rxstats = &lif_to_rxstats(lif, q_num); 276 269 277 270 for (i = 0; i < IONIC_NUM_RX_STATS; i++) { 278 - **buf = IONIC_READ_STAT64(&rxqcq->stats->rx, 271 + **buf = IONIC_READ_STAT64(rxstats, 279 272 &ionic_rx_stats_desc[i]); 280 273 (*buf)++; 281 274 } 282 275 283 - if (test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) { 276 + if (test_bit(IONIC_LIF_UP, lif->state) && 277 + test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) { 278 + rxqcq = lif_to_rxqcq(lif, q_num); 284 279 for (i = 0; i < IONIC_NUM_DBG_CQ_STATS; i++) { 285 280 **buf = IONIC_READ_STAT64(&rxqcq->cq, 286 281 &ionic_dbg_cq_stats_desc[i]);
+11 -24
drivers/net/ethernet/realtek/r8169_main.c
··· 4146 4146 rtl_lock_config_regs(tp); 4147 4147 } 4148 4148 4149 + static void rtl_jumbo_config(struct rtl8169_private *tp, int mtu) 4150 + { 4151 + if (mtu > ETH_DATA_LEN) 4152 + rtl_hw_jumbo_enable(tp); 4153 + else 4154 + rtl_hw_jumbo_disable(tp); 4155 + } 4156 + 4149 4157 DECLARE_RTL_COND(rtl_chipcmd_cond) 4150 4158 { 4151 4159 return RTL_R8(tp, ChipCmd) & CmdReset; ··· 4450 4442 static void rtl_hw_start_8168bb(struct rtl8169_private *tp) 4451 4443 { 4452 4444 RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Beacon_en); 4453 - 4454 - if (tp->dev->mtu <= ETH_DATA_LEN) { 4455 - rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B | 4456 - PCI_EXP_DEVCTL_NOSNOOP_EN); 4457 - } 4458 4445 } 4459 4446 4460 4447 static void rtl_hw_start_8168bef(struct rtl8169_private *tp) ··· 4464 4461 RTL_W8(tp, Config1, RTL_R8(tp, Config1) | Speed_down); 4465 4462 4466 4463 RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Beacon_en); 4467 - 4468 - if (tp->dev->mtu <= ETH_DATA_LEN) 4469 - rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B); 4470 4464 4471 4465 rtl_disable_clock_request(tp); 4472 4466 } ··· 4490 4490 rtl_set_def_aspm_entry_latency(tp); 4491 4491 4492 4492 RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Beacon_en); 4493 - 4494 - if (tp->dev->mtu <= ETH_DATA_LEN) 4495 - rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B); 4496 4493 } 4497 4494 4498 4495 static void rtl_hw_start_8168cp_3(struct rtl8169_private *tp) ··· 4500 4503 4501 4504 /* Magic. */ 4502 4505 RTL_W8(tp, DBG_REG, 0x20); 4503 - 4504 - if (tp->dev->mtu <= ETH_DATA_LEN) 4505 - rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B); 4506 4506 } 4507 4507 4508 4508 static void rtl_hw_start_8168c_1(struct rtl8169_private *tp) ··· 4605 4611 4606 4612 rtl_ephy_init(tp, e_info_8168e_1); 4607 4613 4608 - if (tp->dev->mtu <= ETH_DATA_LEN) 4609 - rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B); 4610 - 4611 4614 rtl_disable_clock_request(tp); 4612 4615 4613 4616 /* Reset tx FIFO pointer */ ··· 4626 4635 rtl_set_def_aspm_entry_latency(tp); 4627 4636 4628 4637 rtl_ephy_init(tp, e_info_8168e_2); 4629 - 4630 - if (tp->dev->mtu <= ETH_DATA_LEN) 4631 - rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B); 4632 4638 4633 4639 rtl_eri_write(tp, 0xc0, ERIAR_MASK_0011, 0x0000); 4634 4640 rtl_eri_write(tp, 0xb8, ERIAR_MASK_0011, 0x0000); ··· 5473 5485 rtl_set_rx_tx_desc_registers(tp); 5474 5486 rtl_lock_config_regs(tp); 5475 5487 5488 + rtl_jumbo_config(tp, tp->dev->mtu); 5489 + 5476 5490 /* Initially a 10 us delay. Turned it into a PCI commit. - FR */ 5477 5491 RTL_R16(tp, CPlusCmd); 5478 5492 RTL_W8(tp, ChipCmd, CmdTxEnb | CmdRxEnb); ··· 5488 5498 { 5489 5499 struct rtl8169_private *tp = netdev_priv(dev); 5490 5500 5491 - if (new_mtu > ETH_DATA_LEN) 5492 - rtl_hw_jumbo_enable(tp); 5493 - else 5494 - rtl_hw_jumbo_disable(tp); 5501 + rtl_jumbo_config(tp, new_mtu); 5495 5502 5496 5503 dev->mtu = new_mtu; 5497 5504 netdev_update_features(dev);
+2 -1
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
··· 651 651 } 652 652 } 653 653 } else { 654 - netdev_info(dev, "Too many address, switching to promiscuous\n"); 654 + if (!(readl(ioaddr + EMAC_RX_FRM_FLT) & EMAC_FRM_FLT_RXALL)) 655 + netdev_info(dev, "Too many address, switching to promiscuous\n"); 655 656 v = EMAC_FRM_FLT_RXALL; 656 657 } 657 658
+1 -1
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
··· 448 448 value |= GMAC_PACKET_FILTER_HPF; 449 449 450 450 /* Handle multiple unicast addresses */ 451 - if (netdev_uc_count(dev) > GMAC_MAX_PERFECT_ADDRESSES) { 451 + if (netdev_uc_count(dev) > hw->unicast_filter_entries) { 452 452 /* Switch to promiscuous mode if more than 128 addrs 453 453 * are required 454 454 */
+1
drivers/net/ethernet/stmicro/stmmac/dwmac5.c
··· 515 515 516 516 if (!enable) { 517 517 val |= PPSCMDx(index, 0x5); 518 + val |= PPSEN0; 518 519 writel(val, ioaddr + MAC_PPS_CONTROL); 519 520 return 0; 520 521 }
+9 -5
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
··· 2610 2610 } 2611 2611 2612 2612 if (priv->hw->pcs) 2613 - stmmac_pcs_ctrl_ane(priv, priv->hw, 1, priv->hw->ps, 0); 2613 + stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 1, priv->hw->ps, 0); 2614 2614 2615 2615 /* set TX and RX rings length */ 2616 2616 stmmac_set_rings_length(priv); ··· 4742 4742 stmmac_mac_set(priv, priv->ioaddr, false); 4743 4743 pinctrl_pm_select_sleep_state(priv->device); 4744 4744 /* Disable clock in case of PWM is off */ 4745 - clk_disable(priv->plat->pclk); 4746 - clk_disable(priv->plat->stmmac_clk); 4745 + if (priv->plat->clk_ptp_ref) 4746 + clk_disable_unprepare(priv->plat->clk_ptp_ref); 4747 + clk_disable_unprepare(priv->plat->pclk); 4748 + clk_disable_unprepare(priv->plat->stmmac_clk); 4747 4749 } 4748 4750 mutex_unlock(&priv->lock); 4749 4751 ··· 4808 4806 } else { 4809 4807 pinctrl_pm_select_default_state(priv->device); 4810 4808 /* enable the clk previously disabled */ 4811 - clk_enable(priv->plat->stmmac_clk); 4812 - clk_enable(priv->plat->pclk); 4809 + clk_prepare_enable(priv->plat->stmmac_clk); 4810 + clk_prepare_enable(priv->plat->pclk); 4811 + if (priv->plat->clk_ptp_ref) 4812 + clk_prepare_enable(priv->plat->clk_ptp_ref); 4813 4813 /* reset the phy so that it's ready */ 4814 4814 if (priv->mii) 4815 4815 stmmac_mdio_reset(priv->mii);
+1 -1
drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
··· 164 164 /* structure describing a PTP hardware clock */ 165 165 static struct ptp_clock_info stmmac_ptp_clock_ops = { 166 166 .owner = THIS_MODULE, 167 - .name = "stmmac_ptp_clock", 167 + .name = "stmmac ptp", 168 168 .max_adj = 62500000, 169 169 .n_alarm = 0, 170 170 .n_ext_ts = 0,
+9 -2
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
··· 487 487 488 488 static int stmmac_test_hfilt(struct stmmac_priv *priv) 489 489 { 490 - unsigned char gd_addr[ETH_ALEN] = {0x01, 0x00, 0xcc, 0xcc, 0xdd, 0xdd}; 491 - unsigned char bd_addr[ETH_ALEN] = {0x09, 0x00, 0xaa, 0xaa, 0xbb, 0xbb}; 490 + unsigned char gd_addr[ETH_ALEN] = {0x01, 0xee, 0xdd, 0xcc, 0xbb, 0xaa}; 491 + unsigned char bd_addr[ETH_ALEN] = {0x01, 0x01, 0x02, 0x03, 0x04, 0x05}; 492 492 struct stmmac_packet_attrs attr = { }; 493 493 int ret; 494 494 495 495 ret = stmmac_filter_check(priv); 496 496 if (ret) 497 497 return ret; 498 + 499 + if (netdev_mc_count(priv->dev) >= priv->hw->multicast_filter_bins) 500 + return -EOPNOTSUPP; 498 501 499 502 ret = dev_mc_add(priv->dev, gd_addr); 500 503 if (ret) ··· 576 573 577 574 if (stmmac_filter_check(priv)) 578 575 return -EOPNOTSUPP; 576 + if (!priv->hw->multicast_filter_bins) 577 + return -EOPNOTSUPP; 579 578 580 579 /* Remove all MC addresses */ 581 580 __dev_mc_unsync(priv->dev, NULL); ··· 615 610 int ret; 616 611 617 612 if (stmmac_filter_check(priv)) 613 + return -EOPNOTSUPP; 614 + if (!priv->hw->multicast_filter_bins) 618 615 return -EOPNOTSUPP; 619 616 620 617 /* Remove all UC addresses */
+1 -1
drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
··· 510 510 return NULL; 511 511 } 512 512 513 - struct { 513 + static struct { 514 514 int (*fn)(struct stmmac_priv *priv, struct flow_cls_offload *cls, 515 515 struct stmmac_flow_entry *entry); 516 516 } tc_flow_parsers[] = {
+1 -1
drivers/net/ethernet/ti/davinci_cpdma.c
··· 722 722 * cpdma_chan_split_pool - Splits ctrl pool between all channels. 723 723 * Has to be called under ctlr lock 724 724 */ 725 - int cpdma_chan_split_pool(struct cpdma_ctlr *ctlr) 725 + static int cpdma_chan_split_pool(struct cpdma_ctlr *ctlr) 726 726 { 727 727 int tx_per_ch_desc = 0, rx_per_ch_desc = 0; 728 728 int free_rx_num = 0, free_tx_num = 0;
+2 -1
drivers/net/netdevsim/fib.c
··· 241 241 242 242 void nsim_fib_exit(void) 243 243 { 244 - unregister_pernet_subsys(&nsim_fib_net_ops); 245 244 unregister_fib_notifier(&nsim_fib_nb); 245 + unregister_pernet_subsys(&nsim_fib_net_ops); 246 246 } 247 247 248 248 int nsim_fib_init(void) ··· 258 258 err = register_fib_notifier(&nsim_fib_nb, nsim_fib_dump_inconsistent); 259 259 if (err < 0) { 260 260 pr_err("Failed to register fib notifier\n"); 261 + unregister_pernet_subsys(&nsim_fib_net_ops); 261 262 goto err_out; 262 263 } 263 264
+1
drivers/net/phy/bcm7xxx.c
··· 572 572 .name = _name, \ 573 573 /* PHY_BASIC_FEATURES */ \ 574 574 .flags = PHY_IS_INTERNAL, \ 575 + .soft_reset = genphy_soft_reset, \ 575 576 .config_init = bcm7xxx_config_init, \ 576 577 .suspend = bcm7xxx_suspend, \ 577 578 .resume = bcm7xxx_config_init, \
+37 -5
drivers/net/phy/micrel.c
··· 341 341 return genphy_config_aneg(phydev); 342 342 } 343 343 344 + static int ksz8051_ksz8795_match_phy_device(struct phy_device *phydev, 345 + const u32 ksz_phy_id) 346 + { 347 + int ret; 348 + 349 + if ((phydev->phy_id & MICREL_PHY_ID_MASK) != ksz_phy_id) 350 + return 0; 351 + 352 + ret = phy_read(phydev, MII_BMSR); 353 + if (ret < 0) 354 + return ret; 355 + 356 + /* KSZ8051 PHY and KSZ8794/KSZ8795/KSZ8765 switch share the same 357 + * exact PHY ID. However, they can be told apart by the extended 358 + * capability registers presence. The KSZ8051 PHY has them while 359 + * the switch does not. 360 + */ 361 + ret &= BMSR_ERCAP; 362 + if (ksz_phy_id == PHY_ID_KSZ8051) 363 + return ret; 364 + else 365 + return !ret; 366 + } 367 + 368 + static int ksz8051_match_phy_device(struct phy_device *phydev) 369 + { 370 + return ksz8051_ksz8795_match_phy_device(phydev, PHY_ID_KSZ8051); 371 + } 372 + 344 373 static int ksz8081_config_init(struct phy_device *phydev) 345 374 { 346 375 /* KSZPHY_OMSO_FACTORY_TEST is set at de-assertion of the reset line ··· 391 362 return ret; 392 363 393 364 return kszphy_config_init(phydev); 365 + } 366 + 367 + static int ksz8795_match_phy_device(struct phy_device *phydev) 368 + { 369 + return ksz8051_ksz8795_match_phy_device(phydev, PHY_ID_KSZ87XX); 394 370 } 395 371 396 372 static int ksz9021_load_values_from_of(struct phy_device *phydev, ··· 1051 1017 .suspend = genphy_suspend, 1052 1018 .resume = genphy_resume, 1053 1019 }, { 1054 - .phy_id = PHY_ID_KSZ8051, 1055 - .phy_id_mask = MICREL_PHY_ID_MASK, 1056 1020 .name = "Micrel KSZ8051", 1057 1021 /* PHY_BASIC_FEATURES */ 1058 1022 .driver_data = &ksz8051_type, ··· 1061 1029 .get_sset_count = kszphy_get_sset_count, 1062 1030 .get_strings = kszphy_get_strings, 1063 1031 .get_stats = kszphy_get_stats, 1032 + .match_phy_device = ksz8051_match_phy_device, 1064 1033 .suspend = genphy_suspend, 1065 1034 .resume = genphy_resume, 1066 1035 }, { ··· 1174 1141 .suspend = genphy_suspend, 1175 1142 .resume = genphy_resume, 1176 1143 }, { 1177 - .phy_id = PHY_ID_KSZ8795, 1178 - .phy_id_mask = MICREL_PHY_ID_MASK, 1179 - .name = "Micrel KSZ8795", 1144 + .name = "Micrel KSZ87XX Switch", 1180 1145 /* PHY_BASIC_FEATURES */ 1181 1146 .config_init = kszphy_config_init, 1182 1147 .config_aneg = ksz8873mll_config_aneg, 1183 1148 .read_status = ksz8873mll_read_status, 1149 + .match_phy_device = ksz8795_match_phy_device, 1184 1150 .suspend = genphy_suspend, 1185 1151 .resume = genphy_resume, 1186 1152 }, {
+2
drivers/net/phy/phy-c45.c
··· 323 323 { 324 324 int val; 325 325 326 + linkmode_zero(phydev->lp_advertising); 327 + 326 328 val = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_CTRL1); 327 329 if (val < 0) 328 330 return val;
-3
drivers/net/phy/phy.c
··· 572 572 if (AUTONEG_DISABLE == phydev->autoneg) 573 573 phy_sanitize_settings(phydev); 574 574 575 - /* Invalidate LP advertising flags */ 576 - linkmode_zero(phydev->lp_advertising); 577 - 578 575 err = phy_config_aneg(phydev); 579 576 if (err < 0) 580 577 goto out_unlock;
+10 -1
drivers/net/phy/phy_device.c
··· 1787 1787 { 1788 1788 int lpa, lpagb; 1789 1789 1790 - if (phydev->autoneg == AUTONEG_ENABLE && phydev->autoneg_complete) { 1790 + if (phydev->autoneg == AUTONEG_ENABLE) { 1791 + if (!phydev->autoneg_complete) { 1792 + mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, 1793 + 0); 1794 + mii_lpa_mod_linkmode_lpa_t(phydev->lp_advertising, 0); 1795 + return 0; 1796 + } 1797 + 1791 1798 if (phydev->is_gigabit_capable) { 1792 1799 lpagb = phy_read(phydev, MII_STAT1000); 1793 1800 if (lpagb < 0) ··· 1822 1815 return lpa; 1823 1816 1824 1817 mii_lpa_mod_linkmode_lpa_t(phydev->lp_advertising, lpa); 1818 + } else { 1819 + linkmode_zero(phydev->lp_advertising); 1825 1820 } 1826 1821 1827 1822 return 0;
+1 -1
drivers/net/phy/phylink.c
··· 576 576 577 577 /** 578 578 * phylink_create() - create a phylink instance 579 - * @ndev: a pointer to the &struct net_device 579 + * @config: a pointer to the target &struct phylink_config 580 580 * @fwnode: a pointer to a &struct fwnode_handle describing the network 581 581 * interface 582 582 * @iface: the desired link mode defined by &typedef phy_interface_t
+2 -2
drivers/net/tun.c
··· 526 526 e = tun_flow_find(head, rxhash); 527 527 if (likely(e)) { 528 528 /* TODO: keep queueing to old queue until it's empty? */ 529 - if (e->queue_index != queue_index) 530 - e->queue_index = queue_index; 529 + if (READ_ONCE(e->queue_index) != queue_index) 530 + WRITE_ONCE(e->queue_index, queue_index); 531 531 if (e->updated != jiffies) 532 532 e->updated = jiffies; 533 533 sock_rps_record_flow_hash(e->rps_rxhash);
+9 -4
drivers/net/usb/hso.c
··· 186 186 int intr_completed; 187 187 struct usb_endpoint_descriptor *endp; 188 188 struct urb *urb; 189 - struct hso_serial_state_notification serial_state_notification; 189 + struct hso_serial_state_notification *serial_state_notification; 190 190 u16 prev_UART_state_bitmap; 191 191 struct uart_icount icount; 192 192 }; ··· 1432 1432 usb_rcvintpipe(usb, 1433 1433 tiocmget->endp-> 1434 1434 bEndpointAddress & 0x7F), 1435 - &tiocmget->serial_state_notification, 1435 + tiocmget->serial_state_notification, 1436 1436 sizeof(struct hso_serial_state_notification), 1437 1437 tiocmget_intr_callback, serial, 1438 1438 tiocmget->endp->bInterval); ··· 1479 1479 /* wIndex should be the USB interface number of the port to which the 1480 1480 * notification applies, which should always be the Modem port. 1481 1481 */ 1482 - serial_state_notification = &tiocmget->serial_state_notification; 1482 + serial_state_notification = tiocmget->serial_state_notification; 1483 1483 if (serial_state_notification->bmRequestType != BM_REQUEST_TYPE || 1484 1484 serial_state_notification->bNotification != B_NOTIFICATION || 1485 1485 le16_to_cpu(serial_state_notification->wValue) != W_VALUE || ··· 2565 2565 usb_free_urb(tiocmget->urb); 2566 2566 tiocmget->urb = NULL; 2567 2567 serial->tiocmget = NULL; 2568 + kfree(tiocmget->serial_state_notification); 2569 + tiocmget->serial_state_notification = NULL; 2568 2570 kfree(tiocmget); 2569 2571 } 2570 2572 } ··· 2617 2615 num_urbs = 2; 2618 2616 serial->tiocmget = kzalloc(sizeof(struct hso_tiocmget), 2619 2617 GFP_KERNEL); 2618 + serial->tiocmget->serial_state_notification 2619 + = kzalloc(sizeof(struct hso_serial_state_notification), 2620 + GFP_KERNEL); 2620 2621 /* it isn't going to break our heart if serial->tiocmget 2621 2622 * allocation fails don't bother checking this. 2622 2623 */ 2623 - if (serial->tiocmget) { 2624 + if (serial->tiocmget && serial->tiocmget->serial_state_notification) { 2624 2625 tiocmget = serial->tiocmget; 2625 2626 tiocmget->endp = hso_get_ep(interface, 2626 2627 USB_ENDPOINT_XFER_INT,
+6 -6
drivers/net/usb/lan78xx.c
··· 3782 3782 /* driver requires remote-wakeup capability during autosuspend. */ 3783 3783 intf->needs_remote_wakeup = 1; 3784 3784 3785 + ret = lan78xx_phy_init(dev); 3786 + if (ret < 0) 3787 + goto out4; 3788 + 3785 3789 ret = register_netdev(netdev); 3786 3790 if (ret != 0) { 3787 3791 netif_err(dev, probe, netdev, "couldn't register the device\n"); 3788 - goto out4; 3792 + goto out5; 3789 3793 } 3790 3794 3791 3795 usb_set_intfdata(intf, dev); ··· 3802 3798 pm_runtime_set_autosuspend_delay(&udev->dev, 3803 3799 DEFAULT_AUTOSUSPEND_DELAY); 3804 3800 3805 - ret = lan78xx_phy_init(dev); 3806 - if (ret < 0) 3807 - goto out5; 3808 - 3809 3801 return 0; 3810 3802 3811 3803 out5: 3812 - unregister_netdev(netdev); 3804 + phy_disconnect(netdev->phydev); 3813 3805 out4: 3814 3806 usb_free_urb(dev->urb_intr); 3815 3807 out3:
+1
drivers/net/usb/qmi_wwan.c
··· 1327 1327 {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ 1328 1328 {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */ 1329 1329 {QMI_QUIRK_SET_DTR(0x1bc7, 0x1040, 2)}, /* Telit LE922A */ 1330 + {QMI_QUIRK_SET_DTR(0x1bc7, 0x1050, 2)}, /* Telit FN980 */ 1330 1331 {QMI_FIXED_INTF(0x1bc7, 0x1100, 3)}, /* Telit ME910 */ 1331 1332 {QMI_FIXED_INTF(0x1bc7, 0x1101, 3)}, /* Telit ME910 dual modem */ 1332 1333 {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */
+1 -1
drivers/net/usb/sr9800.c
··· 335 335 static int sr_mdio_read(struct net_device *net, int phy_id, int loc) 336 336 { 337 337 struct usbnet *dev = netdev_priv(net); 338 - __le16 res; 338 + __le16 res = 0; 339 339 340 340 mutex_lock(&dev->phy_mutex); 341 341 sr_set_sw_mii(dev);
+9 -6
drivers/net/wireless/ath/ath10k/core.c
··· 2118 2118 return ret; 2119 2119 } 2120 2120 2121 - if (!uart_print && ar->hw_params.uart_pin_workaround) { 2122 - ret = ath10k_bmi_write32(ar, hi_dbg_uart_txpin, 2123 - ar->hw_params.uart_pin); 2124 - if (ret) { 2125 - ath10k_warn(ar, "failed to set UART TX pin: %d", ret); 2126 - return ret; 2121 + if (!uart_print) { 2122 + if (ar->hw_params.uart_pin_workaround) { 2123 + ret = ath10k_bmi_write32(ar, hi_dbg_uart_txpin, 2124 + ar->hw_params.uart_pin); 2125 + if (ret) { 2126 + ath10k_warn(ar, "failed to set UART TX pin: %d", 2127 + ret); 2128 + return ret; 2129 + } 2127 2130 } 2128 2131 2129 2132 return 0;
+6 -4
drivers/net/wireless/intel/iwlwifi/fw/acpi.c
··· 162 162 163 163 wifi_pkg = iwl_acpi_get_wifi_pkg(dev, data, ACPI_WRDD_WIFI_DATA_SIZE, 164 164 &tbl_rev); 165 - if (IS_ERR(wifi_pkg) || tbl_rev != 0) { 165 + if (IS_ERR(wifi_pkg)) { 166 166 ret = PTR_ERR(wifi_pkg); 167 167 goto out_free; 168 168 } 169 169 170 - if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER) { 170 + if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER || 171 + tbl_rev != 0) { 171 172 ret = -EINVAL; 172 173 goto out_free; 173 174 } ··· 225 224 226 225 wifi_pkg = iwl_acpi_get_wifi_pkg(dev, data, ACPI_ECKV_WIFI_DATA_SIZE, 227 226 &tbl_rev); 228 - if (IS_ERR(wifi_pkg) || tbl_rev != 0) { 227 + if (IS_ERR(wifi_pkg)) { 229 228 ret = PTR_ERR(wifi_pkg); 230 229 goto out_free; 231 230 } 232 231 233 - if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER) { 232 + if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER || 233 + tbl_rev != 0) { 234 234 ret = -EINVAL; 235 235 goto out_free; 236 236 }
+1
drivers/net/wireless/intel/iwlwifi/fw/dbg.c
··· 646 646 if (new_page) 647 647 __free_page(new_page); 648 648 } 649 + kfree(table); 649 650 return NULL; 650 651 } 651 652 alloc_size = min_t(int, size, PAGE_SIZE);
+6 -6
drivers/net/wireless/intel/iwlwifi/iwl-io.h
··· 112 112 */ 113 113 static inline u32 iwl_umac_prph(struct iwl_trans *trans, u32 ofs) 114 114 { 115 - return ofs + trans->cfg->trans.umac_prph_offset; 115 + return ofs + trans->trans_cfg->umac_prph_offset; 116 116 } 117 117 118 118 static inline u32 iwl_read_umac_prph_no_grab(struct iwl_trans *trans, u32 ofs) 119 119 { 120 120 return iwl_read_prph_no_grab(trans, ofs + 121 - trans->cfg->trans.umac_prph_offset); 121 + trans->trans_cfg->umac_prph_offset); 122 122 } 123 123 124 124 static inline u32 iwl_read_umac_prph(struct iwl_trans *trans, u32 ofs) 125 125 { 126 - return iwl_read_prph(trans, ofs + trans->cfg->trans.umac_prph_offset); 126 + return iwl_read_prph(trans, ofs + trans->trans_cfg->umac_prph_offset); 127 127 } 128 128 129 129 static inline void iwl_write_umac_prph_no_grab(struct iwl_trans *trans, u32 ofs, 130 130 u32 val) 131 131 { 132 - iwl_write_prph_no_grab(trans, ofs + trans->cfg->trans.umac_prph_offset, 132 + iwl_write_prph_no_grab(trans, ofs + trans->trans_cfg->umac_prph_offset, 133 133 val); 134 134 } 135 135 136 136 static inline void iwl_write_umac_prph(struct iwl_trans *trans, u32 ofs, 137 137 u32 val) 138 138 { 139 - iwl_write_prph(trans, ofs + trans->cfg->trans.umac_prph_offset, val); 139 + iwl_write_prph(trans, ofs + trans->trans_cfg->umac_prph_offset, val); 140 140 } 141 141 142 142 static inline int iwl_poll_umac_prph_bit(struct iwl_trans *trans, u32 addr, 143 143 u32 bits, u32 mask, int timeout) 144 144 { 145 145 return iwl_poll_prph_bit(trans, addr + 146 - trans->cfg->trans.umac_prph_offset, 146 + trans->trans_cfg->umac_prph_offset, 147 147 bits, mask, timeout); 148 148 } 149 149
+30 -13
drivers/net/wireless/intel/iwlwifi/mvm/fw.c
··· 420 420 }; 421 421 int ret; 422 422 423 + if (mvm->trans->cfg->tx_with_siso_diversity) 424 + init_cfg.init_flags |= cpu_to_le32(BIT(IWL_INIT_PHY)); 425 + 423 426 lockdep_assert_held(&mvm->mutex); 424 427 425 428 mvm->rfkill_safe_init_done = false; ··· 697 694 698 695 wifi_pkg = iwl_acpi_get_wifi_pkg(mvm->dev, data, 699 696 ACPI_WRDS_WIFI_DATA_SIZE, &tbl_rev); 700 - if (IS_ERR(wifi_pkg) || tbl_rev != 0) { 697 + if (IS_ERR(wifi_pkg)) { 701 698 ret = PTR_ERR(wifi_pkg); 702 699 goto out_free; 703 700 } 704 701 705 - if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER) { 702 + if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER || 703 + tbl_rev != 0) { 706 704 ret = -EINVAL; 707 705 goto out_free; 708 706 } ··· 735 731 736 732 wifi_pkg = iwl_acpi_get_wifi_pkg(mvm->dev, data, 737 733 ACPI_EWRD_WIFI_DATA_SIZE, &tbl_rev); 738 - if (IS_ERR(wifi_pkg) || tbl_rev != 0) { 734 + if (IS_ERR(wifi_pkg)) { 739 735 ret = PTR_ERR(wifi_pkg); 740 736 goto out_free; 741 737 } 742 738 743 739 if ((wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER) || 744 - (wifi_pkg->package.elements[2].type != ACPI_TYPE_INTEGER)) { 740 + (wifi_pkg->package.elements[2].type != ACPI_TYPE_INTEGER) || 741 + tbl_rev != 0) { 745 742 ret = -EINVAL; 746 743 goto out_free; 747 744 } ··· 796 791 797 792 wifi_pkg = iwl_acpi_get_wifi_pkg(mvm->dev, data, 798 793 ACPI_WGDS_WIFI_DATA_SIZE, &tbl_rev); 799 - if (IS_ERR(wifi_pkg) || tbl_rev > 1) { 794 + if (IS_ERR(wifi_pkg)) { 800 795 ret = PTR_ERR(wifi_pkg); 796 + goto out_free; 797 + } 798 + 799 + if (tbl_rev != 0) { 800 + ret = -EINVAL; 801 801 goto out_free; 802 802 } 803 803 ··· 899 889 * firmware versions. Unfortunately, we don't have a TLV API 900 890 * flag to rely on, so rely on the major version which is in 901 891 * the first byte of ucode_ver. This was implemented 902 - * initially on version 38 and then backported to29 and 17. 903 - * The intention was to have it in 36 as well, but not all 904 - * 8000 family got this feature enabled. The 8000 family is 905 - * the only one using version 36, so skip this version 906 - * entirely. 892 + * initially on version 38 and then backported to 17. It was 893 + * also backported to 29, but only for 7265D devices. The 894 + * intention was to have it in 36 as well, but not all 8000 895 + * family got this feature enabled. The 8000 family is the 896 + * only one using version 36, so skip this version entirely. 907 897 */ 908 898 return IWL_UCODE_SERIAL(mvm->fw->ucode_ver) >= 38 || 909 - IWL_UCODE_SERIAL(mvm->fw->ucode_ver) == 29 || 910 - IWL_UCODE_SERIAL(mvm->fw->ucode_ver) == 17; 899 + IWL_UCODE_SERIAL(mvm->fw->ucode_ver) == 17 || 900 + (IWL_UCODE_SERIAL(mvm->fw->ucode_ver) == 29 && 901 + ((mvm->trans->hw_rev & CSR_HW_REV_TYPE_MSK) == 902 + CSR_HW_REV_TYPE_7265D)); 911 903 } 912 904 913 905 int iwl_mvm_get_sar_geo_profile(struct iwl_mvm *mvm) ··· 1032 1020 wifi_pkg = iwl_acpi_get_wifi_pkg(mvm->dev, data, 1033 1021 ACPI_PPAG_WIFI_DATA_SIZE, &tbl_rev); 1034 1022 1035 - if (IS_ERR(wifi_pkg) || tbl_rev != 0) { 1023 + if (IS_ERR(wifi_pkg)) { 1036 1024 ret = PTR_ERR(wifi_pkg); 1025 + goto out_free; 1026 + } 1027 + 1028 + if (tbl_rev != 0) { 1029 + ret = -EINVAL; 1037 1030 goto out_free; 1038 1031 } 1039 1032
+5 -4
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
··· 4881 4881 if (!iwl_mvm_has_new_rx_api(mvm)) 4882 4882 return; 4883 4883 4884 - notif->cookie = mvm->queue_sync_cookie; 4885 - 4886 - if (notif->sync) 4884 + if (notif->sync) { 4885 + notif->cookie = mvm->queue_sync_cookie; 4887 4886 atomic_set(&mvm->queue_sync_counter, 4888 4887 mvm->trans->num_rx_queues); 4888 + } 4889 4889 4890 4890 ret = iwl_mvm_notify_rx_queue(mvm, qmask, (u8 *)notif, 4891 4891 size, !notif->sync); ··· 4905 4905 4906 4906 out: 4907 4907 atomic_set(&mvm->queue_sync_counter, 0); 4908 - mvm->queue_sync_cookie++; 4908 + if (notif->sync) 4909 + mvm->queue_sync_cookie++; 4909 4910 } 4910 4911 4911 4912 static void iwl_mvm_sync_rx_queues(struct ieee80211_hw *hw)
+25 -11
drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c
··· 107 107 108 108 /* allocate ucode sections in dram and set addresses */ 109 109 ret = iwl_pcie_init_fw_sec(trans, fw, &prph_scratch->dram); 110 - if (ret) { 111 - dma_free_coherent(trans->dev, 112 - sizeof(*prph_scratch), 113 - prph_scratch, 114 - trans_pcie->prph_scratch_dma_addr); 115 - return ret; 116 - } 110 + if (ret) 111 + goto err_free_prph_scratch; 112 + 117 113 118 114 /* Allocate prph information 119 115 * currently we don't assign to the prph info anything, but it would get ··· 117 121 prph_info = dma_alloc_coherent(trans->dev, sizeof(*prph_info), 118 122 &trans_pcie->prph_info_dma_addr, 119 123 GFP_KERNEL); 120 - if (!prph_info) 121 - return -ENOMEM; 124 + if (!prph_info) { 125 + ret = -ENOMEM; 126 + goto err_free_prph_scratch; 127 + } 122 128 123 129 /* Allocate context info */ 124 130 ctxt_info_gen3 = dma_alloc_coherent(trans->dev, 125 131 sizeof(*ctxt_info_gen3), 126 132 &trans_pcie->ctxt_info_dma_addr, 127 133 GFP_KERNEL); 128 - if (!ctxt_info_gen3) 129 - return -ENOMEM; 134 + if (!ctxt_info_gen3) { 135 + ret = -ENOMEM; 136 + goto err_free_prph_info; 137 + } 130 138 131 139 ctxt_info_gen3->prph_info_base_addr = 132 140 cpu_to_le64(trans_pcie->prph_info_dma_addr); ··· 186 186 iwl_set_bit(trans, CSR_GP_CNTRL, CSR_AUTO_FUNC_INIT); 187 187 188 188 return 0; 189 + 190 + err_free_prph_info: 191 + dma_free_coherent(trans->dev, 192 + sizeof(*prph_info), 193 + prph_info, 194 + trans_pcie->prph_info_dma_addr); 195 + 196 + err_free_prph_scratch: 197 + dma_free_coherent(trans->dev, 198 + sizeof(*prph_scratch), 199 + prph_scratch, 200 + trans_pcie->prph_scratch_dma_addr); 201 + return ret; 202 + 189 203 } 190 204 191 205 void iwl_pcie_ctxt_info_gen3_free(struct iwl_trans *trans)
+137 -137
drivers/net/wireless/intel/iwlwifi/pcie/drv.c
··· 513 513 {IWL_PCI_DEVICE(0x24FD, 0x9074, iwl8265_2ac_cfg)}, 514 514 515 515 /* 9000 Series */ 516 - {IWL_PCI_DEVICE(0x02F0, 0x0030, iwl9560_2ac_160_cfg_quz_a0_jf_b0_soc)}, 517 - {IWL_PCI_DEVICE(0x02F0, 0x0034, iwl9560_2ac_cfg_quz_a0_jf_b0_soc)}, 518 - {IWL_PCI_DEVICE(0x02F0, 0x0038, iwl9560_2ac_160_cfg_quz_a0_jf_b0_soc)}, 519 - {IWL_PCI_DEVICE(0x02F0, 0x003C, iwl9560_2ac_160_cfg_quz_a0_jf_b0_soc)}, 520 - {IWL_PCI_DEVICE(0x02F0, 0x0060, iwl9461_2ac_cfg_quz_a0_jf_b0_soc)}, 521 - {IWL_PCI_DEVICE(0x02F0, 0x0064, iwl9461_2ac_cfg_quz_a0_jf_b0_soc)}, 522 - {IWL_PCI_DEVICE(0x02F0, 0x00A0, iwl9462_2ac_cfg_quz_a0_jf_b0_soc)}, 523 - {IWL_PCI_DEVICE(0x02F0, 0x00A4, iwl9462_2ac_cfg_quz_a0_jf_b0_soc)}, 524 - {IWL_PCI_DEVICE(0x02F0, 0x0230, iwl9560_2ac_cfg_quz_a0_jf_b0_soc)}, 525 - {IWL_PCI_DEVICE(0x02F0, 0x0234, iwl9560_2ac_cfg_quz_a0_jf_b0_soc)}, 526 - {IWL_PCI_DEVICE(0x02F0, 0x0238, iwl9560_2ac_cfg_quz_a0_jf_b0_soc)}, 527 - {IWL_PCI_DEVICE(0x02F0, 0x023C, iwl9560_2ac_cfg_quz_a0_jf_b0_soc)}, 528 - {IWL_PCI_DEVICE(0x02F0, 0x0260, iwl9461_2ac_cfg_quz_a0_jf_b0_soc)}, 529 - {IWL_PCI_DEVICE(0x02F0, 0x0264, iwl9461_2ac_cfg_quz_a0_jf_b0_soc)}, 530 - {IWL_PCI_DEVICE(0x02F0, 0x02A0, iwl9462_2ac_cfg_quz_a0_jf_b0_soc)}, 531 - {IWL_PCI_DEVICE(0x02F0, 0x02A4, iwl9462_2ac_cfg_quz_a0_jf_b0_soc)}, 532 - {IWL_PCI_DEVICE(0x02F0, 0x1551, iwl9560_killer_s_2ac_cfg_quz_a0_jf_b0_soc)}, 533 - {IWL_PCI_DEVICE(0x02F0, 0x1552, iwl9560_killer_i_2ac_cfg_quz_a0_jf_b0_soc)}, 534 - {IWL_PCI_DEVICE(0x02F0, 0x2030, iwl9560_2ac_160_cfg_quz_a0_jf_b0_soc)}, 535 - {IWL_PCI_DEVICE(0x02F0, 0x2034, iwl9560_2ac_160_cfg_quz_a0_jf_b0_soc)}, 536 - {IWL_PCI_DEVICE(0x02F0, 0x4030, iwl9560_2ac_160_cfg_quz_a0_jf_b0_soc)}, 537 - {IWL_PCI_DEVICE(0x02F0, 0x4034, iwl9560_2ac_160_cfg_quz_a0_jf_b0_soc)}, 538 - {IWL_PCI_DEVICE(0x02F0, 0x40A4, iwl9462_2ac_cfg_quz_a0_jf_b0_soc)}, 539 - {IWL_PCI_DEVICE(0x02F0, 0x4234, iwl9560_2ac_cfg_quz_a0_jf_b0_soc)}, 540 - {IWL_PCI_DEVICE(0x02F0, 0x42A4, iwl9462_2ac_cfg_quz_a0_jf_b0_soc)}, 516 + {IWL_PCI_DEVICE(0x02F0, 0x0030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 517 + {IWL_PCI_DEVICE(0x02F0, 0x0034, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 518 + {IWL_PCI_DEVICE(0x02F0, 0x0038, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 519 + {IWL_PCI_DEVICE(0x02F0, 0x003C, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 520 + {IWL_PCI_DEVICE(0x02F0, 0x0060, iwl9461_2ac_cfg_qu_b0_jf_b0)}, 521 + {IWL_PCI_DEVICE(0x02F0, 0x0064, iwl9461_2ac_cfg_qu_b0_jf_b0)}, 522 + {IWL_PCI_DEVICE(0x02F0, 0x00A0, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 523 + {IWL_PCI_DEVICE(0x02F0, 0x00A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 524 + {IWL_PCI_DEVICE(0x02F0, 0x0230, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 525 + {IWL_PCI_DEVICE(0x02F0, 0x0234, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 526 + {IWL_PCI_DEVICE(0x02F0, 0x0238, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 527 + {IWL_PCI_DEVICE(0x02F0, 0x023C, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 528 + {IWL_PCI_DEVICE(0x02F0, 0x0260, iwl9461_2ac_cfg_qu_b0_jf_b0)}, 529 + {IWL_PCI_DEVICE(0x02F0, 0x0264, iwl9461_2ac_cfg_qu_b0_jf_b0)}, 530 + {IWL_PCI_DEVICE(0x02F0, 0x02A0, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 531 + {IWL_PCI_DEVICE(0x02F0, 0x02A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 532 + {IWL_PCI_DEVICE(0x02F0, 0x1030, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 533 + {IWL_PCI_DEVICE(0x02F0, 0x1551, killer1550s_2ac_cfg_qu_b0_jf_b0)}, 534 + {IWL_PCI_DEVICE(0x02F0, 0x1552, killer1550i_2ac_cfg_qu_b0_jf_b0)}, 535 + {IWL_PCI_DEVICE(0x02F0, 0x2030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 536 + {IWL_PCI_DEVICE(0x02F0, 0x2034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 537 + {IWL_PCI_DEVICE(0x02F0, 0x4030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 538 + {IWL_PCI_DEVICE(0x02F0, 0x4034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 539 + {IWL_PCI_DEVICE(0x02F0, 0x40A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 540 + {IWL_PCI_DEVICE(0x02F0, 0x4234, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 541 + {IWL_PCI_DEVICE(0x02F0, 0x42A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 542 + 541 543 {IWL_PCI_DEVICE(0x06F0, 0x0030, iwl9560_2ac_160_cfg_quz_a0_jf_b0_soc)}, 542 544 {IWL_PCI_DEVICE(0x06F0, 0x0034, iwl9560_2ac_cfg_quz_a0_jf_b0_soc)}, 543 545 {IWL_PCI_DEVICE(0x06F0, 0x0038, iwl9560_2ac_160_cfg_quz_a0_jf_b0_soc)}, ··· 645 643 {IWL_PCI_DEVICE(0x2720, 0x40A4, iwl9462_2ac_cfg_soc)}, 646 644 {IWL_PCI_DEVICE(0x2720, 0x4234, iwl9560_2ac_cfg_soc)}, 647 645 {IWL_PCI_DEVICE(0x2720, 0x42A4, iwl9462_2ac_cfg_soc)}, 648 - {IWL_PCI_DEVICE(0x30DC, 0x0030, iwl9560_2ac_160_cfg_soc)}, 649 - {IWL_PCI_DEVICE(0x30DC, 0x0034, iwl9560_2ac_cfg_soc)}, 650 - {IWL_PCI_DEVICE(0x30DC, 0x0038, iwl9560_2ac_160_cfg_soc)}, 651 - {IWL_PCI_DEVICE(0x30DC, 0x003C, iwl9560_2ac_160_cfg_soc)}, 652 - {IWL_PCI_DEVICE(0x30DC, 0x0060, iwl9460_2ac_cfg_soc)}, 653 - {IWL_PCI_DEVICE(0x30DC, 0x0064, iwl9461_2ac_cfg_soc)}, 654 - {IWL_PCI_DEVICE(0x30DC, 0x00A0, iwl9462_2ac_cfg_soc)}, 655 - {IWL_PCI_DEVICE(0x30DC, 0x00A4, iwl9462_2ac_cfg_soc)}, 656 - {IWL_PCI_DEVICE(0x30DC, 0x0230, iwl9560_2ac_cfg_soc)}, 657 - {IWL_PCI_DEVICE(0x30DC, 0x0234, iwl9560_2ac_cfg_soc)}, 658 - {IWL_PCI_DEVICE(0x30DC, 0x0238, iwl9560_2ac_cfg_soc)}, 659 - {IWL_PCI_DEVICE(0x30DC, 0x023C, iwl9560_2ac_cfg_soc)}, 660 - {IWL_PCI_DEVICE(0x30DC, 0x0260, iwl9461_2ac_cfg_soc)}, 661 - {IWL_PCI_DEVICE(0x30DC, 0x0264, iwl9461_2ac_cfg_soc)}, 662 - {IWL_PCI_DEVICE(0x30DC, 0x02A0, iwl9462_2ac_cfg_soc)}, 663 - {IWL_PCI_DEVICE(0x30DC, 0x02A4, iwl9462_2ac_cfg_soc)}, 664 - {IWL_PCI_DEVICE(0x30DC, 0x1010, iwl9260_2ac_cfg)}, 665 - {IWL_PCI_DEVICE(0x30DC, 0x1030, iwl9560_2ac_cfg_soc)}, 666 - {IWL_PCI_DEVICE(0x30DC, 0x1210, iwl9260_2ac_cfg)}, 667 - {IWL_PCI_DEVICE(0x30DC, 0x1551, iwl9560_killer_s_2ac_cfg_soc)}, 668 - {IWL_PCI_DEVICE(0x30DC, 0x1552, iwl9560_killer_2ac_cfg_soc)}, 669 - {IWL_PCI_DEVICE(0x30DC, 0x2030, iwl9560_2ac_160_cfg_soc)}, 670 - {IWL_PCI_DEVICE(0x30DC, 0x2034, iwl9560_2ac_160_cfg_soc)}, 671 - {IWL_PCI_DEVICE(0x30DC, 0x4030, iwl9560_2ac_160_cfg_soc)}, 672 - {IWL_PCI_DEVICE(0x30DC, 0x4034, iwl9560_2ac_160_cfg_soc)}, 673 - {IWL_PCI_DEVICE(0x30DC, 0x40A4, iwl9462_2ac_cfg_soc)}, 674 - {IWL_PCI_DEVICE(0x30DC, 0x4234, iwl9560_2ac_cfg_soc)}, 675 - {IWL_PCI_DEVICE(0x30DC, 0x42A4, iwl9462_2ac_cfg_soc)}, 646 + 647 + {IWL_PCI_DEVICE(0x30DC, 0x0030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 648 + {IWL_PCI_DEVICE(0x30DC, 0x0034, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 649 + {IWL_PCI_DEVICE(0x30DC, 0x0038, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 650 + {IWL_PCI_DEVICE(0x30DC, 0x003C, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 651 + {IWL_PCI_DEVICE(0x30DC, 0x0060, iwl9461_2ac_cfg_qu_b0_jf_b0)}, 652 + {IWL_PCI_DEVICE(0x30DC, 0x0064, iwl9461_2ac_cfg_qu_b0_jf_b0)}, 653 + {IWL_PCI_DEVICE(0x30DC, 0x00A0, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 654 + {IWL_PCI_DEVICE(0x30DC, 0x00A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 655 + {IWL_PCI_DEVICE(0x30DC, 0x0230, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 656 + {IWL_PCI_DEVICE(0x30DC, 0x0234, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 657 + {IWL_PCI_DEVICE(0x30DC, 0x0238, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 658 + {IWL_PCI_DEVICE(0x30DC, 0x023C, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 659 + {IWL_PCI_DEVICE(0x30DC, 0x0260, iwl9461_2ac_cfg_qu_b0_jf_b0)}, 660 + {IWL_PCI_DEVICE(0x30DC, 0x0264, iwl9461_2ac_cfg_qu_b0_jf_b0)}, 661 + {IWL_PCI_DEVICE(0x30DC, 0x02A0, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 662 + {IWL_PCI_DEVICE(0x30DC, 0x02A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 663 + {IWL_PCI_DEVICE(0x30DC, 0x1030, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 664 + {IWL_PCI_DEVICE(0x30DC, 0x1551, killer1550s_2ac_cfg_qu_b0_jf_b0)}, 665 + {IWL_PCI_DEVICE(0x30DC, 0x1552, killer1550i_2ac_cfg_qu_b0_jf_b0)}, 666 + {IWL_PCI_DEVICE(0x30DC, 0x2030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 667 + {IWL_PCI_DEVICE(0x30DC, 0x2034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 668 + {IWL_PCI_DEVICE(0x30DC, 0x4030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 669 + {IWL_PCI_DEVICE(0x30DC, 0x4034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 670 + {IWL_PCI_DEVICE(0x30DC, 0x40A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 671 + {IWL_PCI_DEVICE(0x30DC, 0x4234, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 672 + {IWL_PCI_DEVICE(0x30DC, 0x42A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 673 + 676 674 {IWL_PCI_DEVICE(0x31DC, 0x0030, iwl9560_2ac_160_cfg_shared_clk)}, 677 675 {IWL_PCI_DEVICE(0x31DC, 0x0034, iwl9560_2ac_cfg_shared_clk)}, 678 676 {IWL_PCI_DEVICE(0x31DC, 0x0038, iwl9560_2ac_160_cfg_shared_clk)}, ··· 728 726 {IWL_PCI_DEVICE(0x34F0, 0x4234, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 729 727 {IWL_PCI_DEVICE(0x34F0, 0x42A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 730 728 731 - {IWL_PCI_DEVICE(0x3DF0, 0x0030, iwl9560_2ac_160_cfg_soc)}, 732 - {IWL_PCI_DEVICE(0x3DF0, 0x0034, iwl9560_2ac_cfg_soc)}, 733 - {IWL_PCI_DEVICE(0x3DF0, 0x0038, iwl9560_2ac_160_cfg_soc)}, 734 - {IWL_PCI_DEVICE(0x3DF0, 0x003C, iwl9560_2ac_160_cfg_soc)}, 735 - {IWL_PCI_DEVICE(0x3DF0, 0x0060, iwl9461_2ac_cfg_soc)}, 736 - {IWL_PCI_DEVICE(0x3DF0, 0x0064, iwl9461_2ac_cfg_soc)}, 737 - {IWL_PCI_DEVICE(0x3DF0, 0x00A0, iwl9462_2ac_cfg_soc)}, 738 - {IWL_PCI_DEVICE(0x3DF0, 0x00A4, iwl9462_2ac_cfg_soc)}, 739 - {IWL_PCI_DEVICE(0x3DF0, 0x0230, iwl9560_2ac_cfg_soc)}, 740 - {IWL_PCI_DEVICE(0x3DF0, 0x0234, iwl9560_2ac_cfg_soc)}, 741 - {IWL_PCI_DEVICE(0x3DF0, 0x0238, iwl9560_2ac_cfg_soc)}, 742 - {IWL_PCI_DEVICE(0x3DF0, 0x023C, iwl9560_2ac_cfg_soc)}, 743 - {IWL_PCI_DEVICE(0x3DF0, 0x0260, iwl9461_2ac_cfg_soc)}, 744 - {IWL_PCI_DEVICE(0x3DF0, 0x0264, iwl9461_2ac_cfg_soc)}, 745 - {IWL_PCI_DEVICE(0x3DF0, 0x02A0, iwl9462_2ac_cfg_soc)}, 746 - {IWL_PCI_DEVICE(0x3DF0, 0x02A4, iwl9462_2ac_cfg_soc)}, 747 - {IWL_PCI_DEVICE(0x3DF0, 0x1010, iwl9260_2ac_cfg)}, 748 - {IWL_PCI_DEVICE(0x3DF0, 0x1030, iwl9560_2ac_cfg_soc)}, 749 - {IWL_PCI_DEVICE(0x3DF0, 0x1210, iwl9260_2ac_cfg)}, 750 - {IWL_PCI_DEVICE(0x3DF0, 0x1551, iwl9560_killer_s_2ac_cfg_soc)}, 751 - {IWL_PCI_DEVICE(0x3DF0, 0x1552, iwl9560_killer_2ac_cfg_soc)}, 752 - {IWL_PCI_DEVICE(0x3DF0, 0x2030, iwl9560_2ac_160_cfg_soc)}, 753 - {IWL_PCI_DEVICE(0x3DF0, 0x2034, iwl9560_2ac_160_cfg_soc)}, 754 - {IWL_PCI_DEVICE(0x3DF0, 0x4030, iwl9560_2ac_160_cfg_soc)}, 755 - {IWL_PCI_DEVICE(0x3DF0, 0x4034, iwl9560_2ac_160_cfg_soc)}, 756 - {IWL_PCI_DEVICE(0x3DF0, 0x40A4, iwl9462_2ac_cfg_soc)}, 757 - {IWL_PCI_DEVICE(0x3DF0, 0x4234, iwl9560_2ac_cfg_soc)}, 758 - {IWL_PCI_DEVICE(0x3DF0, 0x42A4, iwl9462_2ac_cfg_soc)}, 759 - {IWL_PCI_DEVICE(0x43F0, 0x0030, iwl9560_2ac_160_cfg_soc)}, 760 - {IWL_PCI_DEVICE(0x43F0, 0x0034, iwl9560_2ac_cfg_soc)}, 761 - {IWL_PCI_DEVICE(0x43F0, 0x0038, iwl9560_2ac_160_cfg_soc)}, 762 - {IWL_PCI_DEVICE(0x43F0, 0x003C, iwl9560_2ac_160_cfg_soc)}, 763 - {IWL_PCI_DEVICE(0x43F0, 0x0060, iwl9461_2ac_cfg_soc)}, 764 - {IWL_PCI_DEVICE(0x43F0, 0x0064, iwl9461_2ac_cfg_soc)}, 765 - {IWL_PCI_DEVICE(0x43F0, 0x00A0, iwl9462_2ac_cfg_soc)}, 766 - {IWL_PCI_DEVICE(0x43F0, 0x00A4, iwl9462_2ac_cfg_soc)}, 767 - {IWL_PCI_DEVICE(0x43F0, 0x0230, iwl9560_2ac_cfg_soc)}, 768 - {IWL_PCI_DEVICE(0x43F0, 0x0234, iwl9560_2ac_cfg_soc)}, 769 - {IWL_PCI_DEVICE(0x43F0, 0x0238, iwl9560_2ac_cfg_soc)}, 770 - {IWL_PCI_DEVICE(0x43F0, 0x023C, iwl9560_2ac_cfg_soc)}, 771 - {IWL_PCI_DEVICE(0x43F0, 0x0260, iwl9461_2ac_cfg_soc)}, 772 - {IWL_PCI_DEVICE(0x43F0, 0x0264, iwl9461_2ac_cfg_soc)}, 773 - {IWL_PCI_DEVICE(0x43F0, 0x02A0, iwl9462_2ac_cfg_soc)}, 774 - {IWL_PCI_DEVICE(0x43F0, 0x02A4, iwl9462_2ac_cfg_soc)}, 775 - {IWL_PCI_DEVICE(0x43F0, 0x1010, iwl9260_2ac_cfg)}, 776 - {IWL_PCI_DEVICE(0x43F0, 0x1030, iwl9560_2ac_cfg_soc)}, 777 - {IWL_PCI_DEVICE(0x43F0, 0x1210, iwl9260_2ac_cfg)}, 778 - {IWL_PCI_DEVICE(0x43F0, 0x1551, iwl9560_killer_s_2ac_cfg_soc)}, 779 - {IWL_PCI_DEVICE(0x43F0, 0x1552, iwl9560_killer_2ac_cfg_soc)}, 780 - {IWL_PCI_DEVICE(0x43F0, 0x2030, iwl9560_2ac_160_cfg_soc)}, 781 - {IWL_PCI_DEVICE(0x43F0, 0x2034, iwl9560_2ac_160_cfg_soc)}, 782 - {IWL_PCI_DEVICE(0x43F0, 0x4030, iwl9560_2ac_160_cfg_soc)}, 783 - {IWL_PCI_DEVICE(0x43F0, 0x4034, iwl9560_2ac_160_cfg_soc)}, 784 - {IWL_PCI_DEVICE(0x43F0, 0x40A4, iwl9462_2ac_cfg_soc)}, 785 - {IWL_PCI_DEVICE(0x43F0, 0x4234, iwl9560_2ac_cfg_soc)}, 786 - {IWL_PCI_DEVICE(0x43F0, 0x42A4, iwl9462_2ac_cfg_soc)}, 729 + {IWL_PCI_DEVICE(0x3DF0, 0x0030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 730 + {IWL_PCI_DEVICE(0x3DF0, 0x0034, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 731 + {IWL_PCI_DEVICE(0x3DF0, 0x0038, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 732 + {IWL_PCI_DEVICE(0x3DF0, 0x003C, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 733 + {IWL_PCI_DEVICE(0x3DF0, 0x0060, iwl9461_2ac_cfg_qu_b0_jf_b0)}, 734 + {IWL_PCI_DEVICE(0x3DF0, 0x0064, iwl9461_2ac_cfg_qu_b0_jf_b0)}, 735 + {IWL_PCI_DEVICE(0x3DF0, 0x00A0, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 736 + {IWL_PCI_DEVICE(0x3DF0, 0x00A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 737 + {IWL_PCI_DEVICE(0x3DF0, 0x0230, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 738 + {IWL_PCI_DEVICE(0x3DF0, 0x0234, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 739 + {IWL_PCI_DEVICE(0x3DF0, 0x0238, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 740 + {IWL_PCI_DEVICE(0x3DF0, 0x023C, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 741 + {IWL_PCI_DEVICE(0x3DF0, 0x0260, iwl9461_2ac_cfg_qu_b0_jf_b0)}, 742 + {IWL_PCI_DEVICE(0x3DF0, 0x0264, iwl9461_2ac_cfg_qu_b0_jf_b0)}, 743 + {IWL_PCI_DEVICE(0x3DF0, 0x02A0, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 744 + {IWL_PCI_DEVICE(0x3DF0, 0x02A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 745 + {IWL_PCI_DEVICE(0x3DF0, 0x1030, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 746 + {IWL_PCI_DEVICE(0x3DF0, 0x1551, killer1550s_2ac_cfg_qu_b0_jf_b0)}, 747 + {IWL_PCI_DEVICE(0x3DF0, 0x1552, killer1550i_2ac_cfg_qu_b0_jf_b0)}, 748 + {IWL_PCI_DEVICE(0x3DF0, 0x2030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 749 + {IWL_PCI_DEVICE(0x3DF0, 0x2034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 750 + {IWL_PCI_DEVICE(0x3DF0, 0x4030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 751 + {IWL_PCI_DEVICE(0x3DF0, 0x4034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 752 + {IWL_PCI_DEVICE(0x3DF0, 0x40A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 753 + {IWL_PCI_DEVICE(0x3DF0, 0x4234, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 754 + {IWL_PCI_DEVICE(0x3DF0, 0x42A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 755 + 756 + {IWL_PCI_DEVICE(0x43F0, 0x0030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 757 + {IWL_PCI_DEVICE(0x43F0, 0x0034, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 758 + {IWL_PCI_DEVICE(0x43F0, 0x0038, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 759 + {IWL_PCI_DEVICE(0x43F0, 0x003C, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 760 + {IWL_PCI_DEVICE(0x43F0, 0x0060, iwl9461_2ac_cfg_qu_b0_jf_b0)}, 761 + {IWL_PCI_DEVICE(0x43F0, 0x0064, iwl9461_2ac_cfg_qu_b0_jf_b0)}, 762 + {IWL_PCI_DEVICE(0x43F0, 0x00A0, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 763 + {IWL_PCI_DEVICE(0x43F0, 0x00A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 764 + {IWL_PCI_DEVICE(0x43F0, 0x0230, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 765 + {IWL_PCI_DEVICE(0x43F0, 0x0234, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 766 + {IWL_PCI_DEVICE(0x43F0, 0x0238, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 767 + {IWL_PCI_DEVICE(0x43F0, 0x023C, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 768 + {IWL_PCI_DEVICE(0x43F0, 0x0260, iwl9461_2ac_cfg_qu_b0_jf_b0)}, 769 + {IWL_PCI_DEVICE(0x43F0, 0x0264, iwl9461_2ac_cfg_qu_b0_jf_b0)}, 770 + {IWL_PCI_DEVICE(0x43F0, 0x02A0, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 771 + {IWL_PCI_DEVICE(0x43F0, 0x02A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 772 + {IWL_PCI_DEVICE(0x43F0, 0x1030, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 773 + {IWL_PCI_DEVICE(0x43F0, 0x1551, killer1550s_2ac_cfg_qu_b0_jf_b0)}, 774 + {IWL_PCI_DEVICE(0x43F0, 0x1552, killer1550i_2ac_cfg_qu_b0_jf_b0)}, 775 + {IWL_PCI_DEVICE(0x43F0, 0x2030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 776 + {IWL_PCI_DEVICE(0x43F0, 0x2034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 777 + {IWL_PCI_DEVICE(0x43F0, 0x4030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 778 + {IWL_PCI_DEVICE(0x43F0, 0x4034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 779 + {IWL_PCI_DEVICE(0x43F0, 0x40A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 780 + {IWL_PCI_DEVICE(0x43F0, 0x4234, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 781 + {IWL_PCI_DEVICE(0x43F0, 0x42A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 782 + 787 783 {IWL_PCI_DEVICE(0x9DF0, 0x0000, iwl9460_2ac_cfg_soc)}, 788 784 {IWL_PCI_DEVICE(0x9DF0, 0x0010, iwl9460_2ac_cfg_soc)}, 789 785 {IWL_PCI_DEVICE(0x9DF0, 0x0030, iwl9560_2ac_160_cfg_soc)}, ··· 821 821 {IWL_PCI_DEVICE(0x9DF0, 0x40A4, iwl9462_2ac_cfg_soc)}, 822 822 {IWL_PCI_DEVICE(0x9DF0, 0x4234, iwl9560_2ac_cfg_soc)}, 823 823 {IWL_PCI_DEVICE(0x9DF0, 0x42A4, iwl9462_2ac_cfg_soc)}, 824 - {IWL_PCI_DEVICE(0xA0F0, 0x0030, iwl9560_2ac_160_cfg_soc)}, 825 - {IWL_PCI_DEVICE(0xA0F0, 0x0034, iwl9560_2ac_cfg_soc)}, 826 - {IWL_PCI_DEVICE(0xA0F0, 0x0038, iwl9560_2ac_160_cfg_soc)}, 827 - {IWL_PCI_DEVICE(0xA0F0, 0x003C, iwl9560_2ac_160_cfg_soc)}, 828 - {IWL_PCI_DEVICE(0xA0F0, 0x0060, iwl9461_2ac_cfg_soc)}, 829 - {IWL_PCI_DEVICE(0xA0F0, 0x0064, iwl9461_2ac_cfg_soc)}, 830 - {IWL_PCI_DEVICE(0xA0F0, 0x00A0, iwl9462_2ac_cfg_soc)}, 831 - {IWL_PCI_DEVICE(0xA0F0, 0x00A4, iwl9462_2ac_cfg_soc)}, 832 - {IWL_PCI_DEVICE(0xA0F0, 0x0230, iwl9560_2ac_cfg_soc)}, 833 - {IWL_PCI_DEVICE(0xA0F0, 0x0234, iwl9560_2ac_cfg_soc)}, 834 - {IWL_PCI_DEVICE(0xA0F0, 0x0238, iwl9560_2ac_cfg_soc)}, 835 - {IWL_PCI_DEVICE(0xA0F0, 0x023C, iwl9560_2ac_cfg_soc)}, 836 - {IWL_PCI_DEVICE(0xA0F0, 0x0260, iwl9461_2ac_cfg_soc)}, 837 - {IWL_PCI_DEVICE(0xA0F0, 0x0264, iwl9461_2ac_cfg_soc)}, 838 - {IWL_PCI_DEVICE(0xA0F0, 0x02A0, iwl9462_2ac_cfg_soc)}, 839 - {IWL_PCI_DEVICE(0xA0F0, 0x02A4, iwl9462_2ac_cfg_soc)}, 840 - {IWL_PCI_DEVICE(0xA0F0, 0x1010, iwl9260_2ac_cfg)}, 841 - {IWL_PCI_DEVICE(0xA0F0, 0x1030, iwl9560_2ac_cfg_soc)}, 842 - {IWL_PCI_DEVICE(0xA0F0, 0x1210, iwl9260_2ac_cfg)}, 843 - {IWL_PCI_DEVICE(0xA0F0, 0x1551, iwl9560_killer_s_2ac_cfg_soc)}, 844 - {IWL_PCI_DEVICE(0xA0F0, 0x1552, iwl9560_killer_2ac_cfg_soc)}, 845 - {IWL_PCI_DEVICE(0xA0F0, 0x2030, iwl9560_2ac_160_cfg_soc)}, 846 - {IWL_PCI_DEVICE(0xA0F0, 0x2034, iwl9560_2ac_160_cfg_soc)}, 847 - {IWL_PCI_DEVICE(0xA0F0, 0x4030, iwl9560_2ac_160_cfg_soc)}, 848 - {IWL_PCI_DEVICE(0xA0F0, 0x4034, iwl9560_2ac_160_cfg_soc)}, 849 - {IWL_PCI_DEVICE(0xA0F0, 0x40A4, iwl9462_2ac_cfg_soc)}, 850 - {IWL_PCI_DEVICE(0xA0F0, 0x4234, iwl9560_2ac_cfg_soc)}, 851 - {IWL_PCI_DEVICE(0xA0F0, 0x42A4, iwl9462_2ac_cfg_soc)}, 824 + 825 + {IWL_PCI_DEVICE(0xA0F0, 0x0030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 826 + {IWL_PCI_DEVICE(0xA0F0, 0x0034, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 827 + {IWL_PCI_DEVICE(0xA0F0, 0x0038, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 828 + {IWL_PCI_DEVICE(0xA0F0, 0x003C, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 829 + {IWL_PCI_DEVICE(0xA0F0, 0x0060, iwl9461_2ac_cfg_qu_b0_jf_b0)}, 830 + {IWL_PCI_DEVICE(0xA0F0, 0x0064, iwl9461_2ac_cfg_qu_b0_jf_b0)}, 831 + {IWL_PCI_DEVICE(0xA0F0, 0x00A0, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 832 + {IWL_PCI_DEVICE(0xA0F0, 0x00A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 833 + {IWL_PCI_DEVICE(0xA0F0, 0x0230, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 834 + {IWL_PCI_DEVICE(0xA0F0, 0x0234, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 835 + {IWL_PCI_DEVICE(0xA0F0, 0x0238, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 836 + {IWL_PCI_DEVICE(0xA0F0, 0x023C, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 837 + {IWL_PCI_DEVICE(0xA0F0, 0x0260, iwl9461_2ac_cfg_qu_b0_jf_b0)}, 838 + {IWL_PCI_DEVICE(0xA0F0, 0x0264, iwl9461_2ac_cfg_qu_b0_jf_b0)}, 839 + {IWL_PCI_DEVICE(0xA0F0, 0x02A0, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 840 + {IWL_PCI_DEVICE(0xA0F0, 0x02A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 841 + {IWL_PCI_DEVICE(0xA0F0, 0x1030, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 842 + {IWL_PCI_DEVICE(0xA0F0, 0x1551, killer1550s_2ac_cfg_qu_b0_jf_b0)}, 843 + {IWL_PCI_DEVICE(0xA0F0, 0x1552, killer1550i_2ac_cfg_qu_b0_jf_b0)}, 844 + {IWL_PCI_DEVICE(0xA0F0, 0x2030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 845 + {IWL_PCI_DEVICE(0xA0F0, 0x2034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 846 + {IWL_PCI_DEVICE(0xA0F0, 0x4030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 847 + {IWL_PCI_DEVICE(0xA0F0, 0x4034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 848 + {IWL_PCI_DEVICE(0xA0F0, 0x40A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 849 + {IWL_PCI_DEVICE(0xA0F0, 0x4234, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 850 + {IWL_PCI_DEVICE(0xA0F0, 0x42A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 851 + 852 852 {IWL_PCI_DEVICE(0xA370, 0x0030, iwl9560_2ac_160_cfg_soc)}, 853 853 {IWL_PCI_DEVICE(0xA370, 0x0034, iwl9560_2ac_cfg_soc)}, 854 854 {IWL_PCI_DEVICE(0xA370, 0x0038, iwl9560_2ac_160_cfg_soc)},
+19 -6
drivers/net/wireless/intel/iwlwifi/pcie/trans.c
··· 3272 3272 ptr = cmdq->write_ptr; 3273 3273 for (i = 0; i < cmdq->n_window; i++) { 3274 3274 u8 idx = iwl_pcie_get_cmd_index(cmdq, ptr); 3275 + u8 tfdidx; 3275 3276 u32 caplen, cmdlen; 3276 3277 3278 + if (trans->trans_cfg->use_tfh) 3279 + tfdidx = idx; 3280 + else 3281 + tfdidx = ptr; 3282 + 3277 3283 cmdlen = iwl_trans_pcie_get_cmdlen(trans, 3278 - cmdq->tfds + 3279 - tfd_size * ptr); 3284 + (u8 *)cmdq->tfds + 3285 + tfd_size * tfdidx); 3280 3286 caplen = min_t(u32, TFD_MAX_PAYLOAD_SIZE, cmdlen); 3281 3287 3282 3288 if (cmdlen) { ··· 3456 3450 spin_lock_init(&trans_pcie->reg_lock); 3457 3451 mutex_init(&trans_pcie->mutex); 3458 3452 init_waitqueue_head(&trans_pcie->ucode_write_waitq); 3453 + 3454 + trans_pcie->rba.alloc_wq = alloc_workqueue("rb_allocator", 3455 + WQ_HIGHPRI | WQ_UNBOUND, 1); 3456 + if (!trans_pcie->rba.alloc_wq) { 3457 + ret = -ENOMEM; 3458 + goto out_free_trans; 3459 + } 3460 + INIT_WORK(&trans_pcie->rba.rx_alloc, iwl_pcie_rx_allocator_work); 3461 + 3459 3462 trans_pcie->tso_hdr_page = alloc_percpu(struct iwl_tso_hdr_page); 3460 3463 if (!trans_pcie->tso_hdr_page) { 3461 3464 ret = -ENOMEM; ··· 3599 3584 trans_pcie->inta_mask = CSR_INI_SET_MASK; 3600 3585 } 3601 3586 3602 - trans_pcie->rba.alloc_wq = alloc_workqueue("rb_allocator", 3603 - WQ_HIGHPRI | WQ_UNBOUND, 1); 3604 - INIT_WORK(&trans_pcie->rba.rx_alloc, iwl_pcie_rx_allocator_work); 3605 - 3606 3587 #ifdef CONFIG_IWLWIFI_DEBUGFS 3607 3588 trans_pcie->fw_mon_data.state = IWL_FW_MON_DBGFS_STATE_CLOSED; 3608 3589 mutex_init(&trans_pcie->fw_mon_data.mutex); ··· 3610 3599 iwl_pcie_free_ict(trans); 3611 3600 out_no_pci: 3612 3601 free_percpu(trans_pcie->tso_hdr_page); 3602 + destroy_workqueue(trans_pcie->rba.alloc_wq); 3603 + out_free_trans: 3613 3604 iwl_trans_free(trans); 3614 3605 return ERR_PTR(ret); 3615 3606 }
+1 -1
drivers/net/wireless/mac80211_hwsim.c
··· 4026 4026 err = dev_alloc_name(hwsim_mon, hwsim_mon->name); 4027 4027 if (err < 0) { 4028 4028 rtnl_unlock(); 4029 - goto out_free_radios; 4029 + goto out_free_mon; 4030 4030 } 4031 4031 4032 4032 err = register_netdevice(hwsim_mon);
-1
drivers/net/wireless/ralink/rt2x00/rt2x00.h
··· 23 23 #include <linux/leds.h> 24 24 #include <linux/mutex.h> 25 25 #include <linux/etherdevice.h> 26 - #include <linux/input-polldev.h> 27 26 #include <linux/kfifo.h> 28 27 #include <linux/hrtimer.h> 29 28 #include <linux/average.h>
+1 -1
drivers/net/wireless/ralink/rt2x00/rt2x00debug.c
··· 555 555 { 556 556 struct rt2x00debug_intf *intf = file->private_data; 557 557 struct rt2x00_dev *rt2x00dev = intf->rt2x00dev; 558 - static unsigned long last_reset; 558 + static unsigned long last_reset = INITIAL_JIFFIES; 559 559 560 560 if (!rt2x00_has_cap_restart_hw(rt2x00dev)) 561 561 return -EOPNOTSUPP;
-1
drivers/net/xen-netback/interface.c
··· 719 719 xenvif_unmap_frontend_data_rings(queue); 720 720 netif_napi_del(&queue->napi); 721 721 err: 722 - module_put(THIS_MODULE); 723 722 return err; 724 723 } 725 724
+8 -1
drivers/nfc/pn533/usb.c
··· 547 547 548 548 rc = pn533_finalize_setup(priv); 549 549 if (rc) 550 - goto error; 550 + goto err_deregister; 551 551 552 552 usb_set_intfdata(interface, phy); 553 553 554 554 return 0; 555 555 556 + err_deregister: 557 + pn533_unregister_device(phy->priv); 556 558 error: 559 + usb_kill_urb(phy->in_urb); 560 + usb_kill_urb(phy->out_urb); 561 + usb_kill_urb(phy->ack_urb); 562 + 557 563 usb_free_urb(phy->in_urb); 558 564 usb_free_urb(phy->out_urb); 559 565 usb_free_urb(phy->ack_urb); 560 566 usb_put_dev(phy->udev); 561 567 kfree(in_buf); 568 + kfree(phy->ack_buffer); 562 569 563 570 return rc; 564 571 }
+2 -2
drivers/ptp/Kconfig
··· 97 97 help 98 98 This driver adds support for using the PCH EG20T as a PTP 99 99 clock. The hardware supports time stamping of PTP packets 100 - when using the end-to-end delay (E2E) mechansim. The peer 101 - delay mechansim (P2P) is not supported. 100 + when using the end-to-end delay (E2E) mechanism. The peer 101 + delay mechanism (P2P) is not supported. 102 102 103 103 This clock is only useful if your PTP programs are getting 104 104 hardware time stamps on the PTP Ethernet packets using the
+15 -8
drivers/s390/net/qeth_l2_main.c
··· 2021 2021 static void qeth_l2_vnicc_init(struct qeth_card *card) 2022 2022 { 2023 2023 u32 *timeout = &card->options.vnicc.learning_timeout; 2024 + bool enable, error = false; 2024 2025 unsigned int chars_len, i; 2025 2026 unsigned long chars_tmp; 2026 2027 u32 sup_cmds, vnicc; 2027 - bool enable, error; 2028 2028 2029 2029 QETH_CARD_TEXT(card, 2, "vniccini"); 2030 2030 /* reset rx_bcast */ ··· 2045 2045 chars_len = sizeof(card->options.vnicc.sup_chars) * BITS_PER_BYTE; 2046 2046 for_each_set_bit(i, &chars_tmp, chars_len) { 2047 2047 vnicc = BIT(i); 2048 - qeth_l2_vnicc_query_cmds(card, vnicc, &sup_cmds); 2049 - if (!(sup_cmds & IPA_VNICC_SET_TIMEOUT) || 2050 - !(sup_cmds & IPA_VNICC_GET_TIMEOUT)) 2048 + if (qeth_l2_vnicc_query_cmds(card, vnicc, &sup_cmds)) { 2049 + sup_cmds = 0; 2050 + error = true; 2051 + } 2052 + if ((sup_cmds & IPA_VNICC_SET_TIMEOUT) && 2053 + (sup_cmds & IPA_VNICC_GET_TIMEOUT)) 2054 + card->options.vnicc.getset_timeout_sup |= vnicc; 2055 + else 2051 2056 card->options.vnicc.getset_timeout_sup &= ~vnicc; 2052 - if (!(sup_cmds & IPA_VNICC_ENABLE) || 2053 - !(sup_cmds & IPA_VNICC_DISABLE)) 2057 + if ((sup_cmds & IPA_VNICC_ENABLE) && 2058 + (sup_cmds & IPA_VNICC_DISABLE)) 2059 + card->options.vnicc.set_char_sup |= vnicc; 2060 + else 2054 2061 card->options.vnicc.set_char_sup &= ~vnicc; 2055 2062 } 2056 2063 /* enforce assumed default values and recover settings, if changed */ 2057 - error = qeth_l2_vnicc_recover_timeout(card, QETH_VNICC_LEARNING, 2058 - timeout); 2064 + error |= qeth_l2_vnicc_recover_timeout(card, QETH_VNICC_LEARNING, 2065 + timeout); 2059 2066 chars_tmp = card->options.vnicc.wanted_chars ^ QETH_VNICC_DEFAULT; 2060 2067 chars_tmp |= QETH_VNICC_BRIDGE_INVISIBLE; 2061 2068 chars_len = sizeof(card->options.vnicc.wanted_chars) * BITS_PER_BYTE;
+1 -1
drivers/xen/pvcalls-back.c
··· 775 775 mappass->reqcopy = *req; 776 776 icsk = inet_csk(mappass->sock->sk); 777 777 queue = &icsk->icsk_accept_queue; 778 - data = queue->rskq_accept_head != NULL; 778 + data = READ_ONCE(queue->rskq_accept_head) != NULL; 779 779 if (data) { 780 780 mappass->reqcopy.cmd = 0; 781 781 ret = 0;
+1 -1
include/linux/micrel_phy.h
··· 31 31 #define PHY_ID_KSZ886X 0x00221430 32 32 #define PHY_ID_KSZ8863 0x00221435 33 33 34 - #define PHY_ID_KSZ8795 0x00221550 34 + #define PHY_ID_KSZ87XX 0x00221550 35 35 36 36 #define PHY_ID_KSZ9477 0x00221631 37 37
+3 -2
include/linux/skbuff.h
··· 3510 3510 int __skb_vlan_pop(struct sk_buff *skb, u16 *vlan_tci); 3511 3511 int skb_vlan_pop(struct sk_buff *skb); 3512 3512 int skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci); 3513 - int skb_mpls_push(struct sk_buff *skb, __be32 mpls_lse, __be16 mpls_proto); 3514 - int skb_mpls_pop(struct sk_buff *skb, __be16 next_proto); 3513 + int skb_mpls_push(struct sk_buff *skb, __be32 mpls_lse, __be16 mpls_proto, 3514 + int mac_len); 3515 + int skb_mpls_pop(struct sk_buff *skb, __be16 next_proto, int mac_len); 3515 3516 int skb_mpls_update_lse(struct sk_buff *skb, __be32 mpls_lse); 3516 3517 int skb_mpls_dec_ttl(struct sk_buff *skb); 3517 3518 struct sk_buff *pskb_extract(struct sk_buff *skb, int off, int to_copy,
+3 -3
include/linux/tcp.h
··· 393 393 /* fastopen_rsk points to request_sock that resulted in this big 394 394 * socket. Used to retransmit SYNACKs etc. 395 395 */ 396 - struct request_sock *fastopen_rsk; 396 + struct request_sock __rcu *fastopen_rsk; 397 397 u32 *saved_syn; 398 398 }; 399 399 ··· 447 447 448 448 static inline bool tcp_passive_fastopen(const struct sock *sk) 449 449 { 450 - return (sk->sk_state == TCP_SYN_RECV && 451 - tcp_sk(sk)->fastopen_rsk != NULL); 450 + return sk->sk_state == TCP_SYN_RECV && 451 + rcu_access_pointer(tcp_sk(sk)->fastopen_rsk) != NULL; 452 452 } 453 453 454 454 static inline void fastopen_queue_tune(struct sock *sk, int backlog)
+8
include/net/cfg80211.h
··· 5550 5550 const char *reg_initiator_name(enum nl80211_reg_initiator initiator); 5551 5551 5552 5552 /** 5553 + * regulatory_pre_cac_allowed - check if pre-CAC allowed in the current regdom 5554 + * @wiphy: wiphy for which pre-CAC capability is checked. 5555 + * 5556 + * Pre-CAC is allowed only in some regdomains (notable ETSI). 5557 + */ 5558 + bool regulatory_pre_cac_allowed(struct wiphy *wiphy); 5559 + 5560 + /** 5553 5561 * DOC: Internal regulatory db functions 5554 5562 * 5555 5563 */
+1 -1
include/net/llc_conn.h
··· 104 104 105 105 /* Access to a connection */ 106 106 int llc_conn_state_process(struct sock *sk, struct sk_buff *skb); 107 - int llc_conn_send_pdu(struct sock *sk, struct sk_buff *skb); 107 + void llc_conn_send_pdu(struct sock *sk, struct sk_buff *skb); 108 108 void llc_conn_rtn_pdu(struct sock *sk, struct sk_buff *skb); 109 109 void llc_conn_resend_i_pdu_as_cmd(struct sock *sk, u8 nr, u8 first_p_bit); 110 110 void llc_conn_resend_i_pdu_as_rsp(struct sock *sk, u8 nr, u8 first_f_bit);
+17 -8
include/net/net_namespace.h
··· 52 52 #define NETDEV_HASHENTRIES (1 << NETDEV_HASHBITS) 53 53 54 54 struct net { 55 + /* First cache line can be often dirtied. 56 + * Do not place here read-mostly fields. 57 + */ 55 58 refcount_t passive; /* To decide when the network 56 59 * namespace should be freed. 57 60 */ ··· 63 60 */ 64 61 spinlock_t rules_mod_lock; 65 62 66 - u32 hash_mix; 63 + unsigned int dev_unreg_count; 64 + 65 + unsigned int dev_base_seq; /* protected by rtnl_mutex */ 66 + int ifindex; 67 + 68 + spinlock_t nsid_lock; 69 + atomic_t fnhe_genid; 67 70 68 71 struct list_head list; /* list of network namespaces */ 69 72 struct list_head exit_list; /* To linked to call pernet exit ··· 85 76 #endif 86 77 struct user_namespace *user_ns; /* Owning user namespace */ 87 78 struct ucounts *ucounts; 88 - spinlock_t nsid_lock; 89 79 struct idr netns_ids; 90 80 91 81 struct ns_common ns; 92 82 83 + struct list_head dev_base_head; 93 84 struct proc_dir_entry *proc_net; 94 85 struct proc_dir_entry *proc_net_stat; 95 86 ··· 102 93 103 94 struct uevent_sock *uevent_sock; /* uevent socket */ 104 95 105 - struct list_head dev_base_head; 106 96 struct hlist_head *dev_name_head; 107 97 struct hlist_head *dev_index_head; 108 - unsigned int dev_base_seq; /* protected by rtnl_mutex */ 109 - int ifindex; 110 - unsigned int dev_unreg_count; 98 + /* Note that @hash_mix can be read millions times per second, 99 + * it is critical that it is on a read_mostly cache line. 100 + */ 101 + u32 hash_mix; 102 + 103 + struct net_device *loopback_dev; /* The loopback */ 111 104 112 105 /* core fib_rules */ 113 106 struct list_head rules_ops; 114 107 115 - struct net_device *loopback_dev; /* The loopback */ 116 108 struct netns_core core; 117 109 struct netns_mib mib; 118 110 struct netns_packet packet; ··· 181 171 struct sock *crypto_nlsk; 182 172 #endif 183 173 struct sock *diag_nlsk; 184 - atomic_t fnhe_genid; 185 174 } __randomize_layout; 186 175 187 176 #include <linux/seq_file_net.h>
+2 -2
include/net/request_sock.h
··· 185 185 186 186 static inline bool reqsk_queue_empty(const struct request_sock_queue *queue) 187 187 { 188 - return queue->rskq_accept_head == NULL; 188 + return READ_ONCE(queue->rskq_accept_head) == NULL; 189 189 } 190 190 191 191 static inline struct request_sock *reqsk_queue_remove(struct request_sock_queue *queue, ··· 197 197 req = queue->rskq_accept_head; 198 198 if (req) { 199 199 sk_acceptq_removed(parent); 200 - queue->rskq_accept_head = req->dl_next; 200 + WRITE_ONCE(queue->rskq_accept_head, req->dl_next); 201 201 if (queue->rskq_accept_head == NULL) 202 202 queue->rskq_accept_tail = NULL; 203 203 }
+5
include/net/sctp/sctp.h
··· 610 610 return sctp_mtu_payload(sp, SCTP_DEFAULT_MINSEGMENT, datasize); 611 611 } 612 612 613 + static inline bool sctp_newsk_ready(const struct sock *sk) 614 + { 615 + return sock_flag(sk, SOCK_DEAD) || sk->sk_socket; 616 + } 617 + 613 618 #endif /* __net_sctp_h__ */
+22 -11
include/net/sock.h
··· 878 878 */ 879 879 static inline int sk_stream_min_wspace(const struct sock *sk) 880 880 { 881 - return sk->sk_wmem_queued >> 1; 881 + return READ_ONCE(sk->sk_wmem_queued) >> 1; 882 882 } 883 883 884 884 static inline int sk_stream_wspace(const struct sock *sk) 885 885 { 886 - return sk->sk_sndbuf - sk->sk_wmem_queued; 886 + return READ_ONCE(sk->sk_sndbuf) - READ_ONCE(sk->sk_wmem_queued); 887 + } 888 + 889 + static inline void sk_wmem_queued_add(struct sock *sk, int val) 890 + { 891 + WRITE_ONCE(sk->sk_wmem_queued, sk->sk_wmem_queued + val); 887 892 } 888 893 889 894 void sk_stream_write_space(struct sock *sk); ··· 1212 1207 1213 1208 static inline bool __sk_stream_memory_free(const struct sock *sk, int wake) 1214 1209 { 1215 - if (sk->sk_wmem_queued >= sk->sk_sndbuf) 1210 + if (READ_ONCE(sk->sk_wmem_queued) >= READ_ONCE(sk->sk_sndbuf)) 1216 1211 return false; 1217 1212 1218 1213 return sk->sk_prot->stream_memory_free ? ··· 1472 1467 static inline void sk_wmem_free_skb(struct sock *sk, struct sk_buff *skb) 1473 1468 { 1474 1469 sock_set_flag(sk, SOCK_QUEUE_SHRUNK); 1475 - sk->sk_wmem_queued -= skb->truesize; 1470 + sk_wmem_queued_add(sk, -skb->truesize); 1476 1471 sk_mem_uncharge(sk, skb->truesize); 1477 1472 if (static_branch_unlikely(&tcp_tx_skb_cache_key) && 1478 1473 !sk->sk_tx_skb_cache && !skb_cloned(skb)) { ··· 2019 2014 skb->len += copy; 2020 2015 skb->data_len += copy; 2021 2016 skb->truesize += copy; 2022 - sk->sk_wmem_queued += copy; 2017 + sk_wmem_queued_add(sk, copy); 2023 2018 sk_mem_charge(sk, copy); 2024 2019 return 0; 2025 2020 } ··· 2225 2220 2226 2221 static inline void sk_stream_moderate_sndbuf(struct sock *sk) 2227 2222 { 2228 - if (!(sk->sk_userlocks & SOCK_SNDBUF_LOCK)) { 2229 - sk->sk_sndbuf = min(sk->sk_sndbuf, sk->sk_wmem_queued >> 1); 2230 - sk->sk_sndbuf = max_t(u32, sk->sk_sndbuf, SOCK_MIN_SNDBUF); 2231 - } 2223 + u32 val; 2224 + 2225 + if (sk->sk_userlocks & SOCK_SNDBUF_LOCK) 2226 + return; 2227 + 2228 + val = min(sk->sk_sndbuf, sk->sk_wmem_queued >> 1); 2229 + 2230 + WRITE_ONCE(sk->sk_sndbuf, max_t(u32, val, SOCK_MIN_SNDBUF)); 2232 2231 } 2233 2232 2234 2233 struct sk_buff *sk_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp, ··· 2260 2251 */ 2261 2252 static inline bool sock_writeable(const struct sock *sk) 2262 2253 { 2263 - return refcount_read(&sk->sk_wmem_alloc) < (sk->sk_sndbuf >> 1); 2254 + return refcount_read(&sk->sk_wmem_alloc) < (READ_ONCE(sk->sk_sndbuf) >> 1); 2264 2255 } 2265 2256 2266 2257 static inline gfp_t gfp_any(void) ··· 2280 2271 2281 2272 static inline int sock_rcvlowat(const struct sock *sk, int waitall, int len) 2282 2273 { 2283 - return (waitall ? len : min_t(int, sk->sk_rcvlowat, len)) ? : 1; 2274 + int v = waitall ? len : min_t(int, READ_ONCE(sk->sk_rcvlowat), len); 2275 + 2276 + return v ?: 1; 2284 2277 } 2285 2278 2286 2279 /* Alas, with timeout socket operations are not restartable.
+6 -4
include/net/tcp.h
··· 258 258 mem_cgroup_under_socket_pressure(sk->sk_memcg)) 259 259 return true; 260 260 261 - return tcp_memory_pressure; 261 + return READ_ONCE(tcp_memory_pressure); 262 262 } 263 263 /* 264 264 * The next routines deal with comparing 32 bit unsigned ints ··· 1380 1380 /* Note: caller must be prepared to deal with negative returns */ 1381 1381 static inline int tcp_space(const struct sock *sk) 1382 1382 { 1383 - return tcp_win_from_space(sk, sk->sk_rcvbuf - sk->sk_backlog.len - 1383 + return tcp_win_from_space(sk, READ_ONCE(sk->sk_rcvbuf) - 1384 + READ_ONCE(sk->sk_backlog.len) - 1384 1385 atomic_read(&sk->sk_rmem_alloc)); 1385 1386 } 1386 1387 1387 1388 static inline int tcp_full_space(const struct sock *sk) 1388 1389 { 1389 - return tcp_win_from_space(sk, sk->sk_rcvbuf); 1390 + return tcp_win_from_space(sk, READ_ONCE(sk->sk_rcvbuf)); 1390 1391 } 1391 1392 1392 1393 extern void tcp_openreq_init_rwin(struct request_sock *req, ··· 1917 1916 static inline bool tcp_stream_memory_free(const struct sock *sk, int wake) 1918 1917 { 1919 1918 const struct tcp_sock *tp = tcp_sk(sk); 1920 - u32 notsent_bytes = tp->write_seq - tp->snd_nxt; 1919 + u32 notsent_bytes = READ_ONCE(tp->write_seq) - 1920 + READ_ONCE(tp->snd_nxt); 1921 1921 1922 1922 return (notsent_bytes << wake) < tcp_notsent_lowat(tp); 1923 1923 }
+9 -9
include/trace/events/rxrpc.h
··· 519 519 ); 520 520 521 521 TRACE_EVENT(rxrpc_peer, 522 - TP_PROTO(struct rxrpc_peer *peer, enum rxrpc_peer_trace op, 522 + TP_PROTO(unsigned int peer_debug_id, enum rxrpc_peer_trace op, 523 523 int usage, const void *where), 524 524 525 - TP_ARGS(peer, op, usage, where), 525 + TP_ARGS(peer_debug_id, op, usage, where), 526 526 527 527 TP_STRUCT__entry( 528 528 __field(unsigned int, peer ) ··· 532 532 ), 533 533 534 534 TP_fast_assign( 535 - __entry->peer = peer->debug_id; 535 + __entry->peer = peer_debug_id; 536 536 __entry->op = op; 537 537 __entry->usage = usage; 538 538 __entry->where = where; ··· 546 546 ); 547 547 548 548 TRACE_EVENT(rxrpc_conn, 549 - TP_PROTO(struct rxrpc_connection *conn, enum rxrpc_conn_trace op, 549 + TP_PROTO(unsigned int conn_debug_id, enum rxrpc_conn_trace op, 550 550 int usage, const void *where), 551 551 552 - TP_ARGS(conn, op, usage, where), 552 + TP_ARGS(conn_debug_id, op, usage, where), 553 553 554 554 TP_STRUCT__entry( 555 555 __field(unsigned int, conn ) ··· 559 559 ), 560 560 561 561 TP_fast_assign( 562 - __entry->conn = conn->debug_id; 562 + __entry->conn = conn_debug_id; 563 563 __entry->op = op; 564 564 __entry->usage = usage; 565 565 __entry->where = where; ··· 606 606 ); 607 607 608 608 TRACE_EVENT(rxrpc_call, 609 - TP_PROTO(struct rxrpc_call *call, enum rxrpc_call_trace op, 609 + TP_PROTO(unsigned int call_debug_id, enum rxrpc_call_trace op, 610 610 int usage, const void *where, const void *aux), 611 611 612 - TP_ARGS(call, op, usage, where, aux), 612 + TP_ARGS(call_debug_id, op, usage, where, aux), 613 613 614 614 TP_STRUCT__entry( 615 615 __field(unsigned int, call ) ··· 620 620 ), 621 621 622 622 TP_fast_assign( 623 - __entry->call = call->debug_id; 623 + __entry->call = call_debug_id; 624 624 __entry->op = op; 625 625 __entry->usage = usage; 626 626 __entry->where = where;
+2 -2
include/trace/events/sock.h
··· 82 82 TP_fast_assign( 83 83 __entry->rmem_alloc = atomic_read(&sk->sk_rmem_alloc); 84 84 __entry->truesize = skb->truesize; 85 - __entry->sk_rcvbuf = sk->sk_rcvbuf; 85 + __entry->sk_rcvbuf = READ_ONCE(sk->sk_rcvbuf); 86 86 ), 87 87 88 88 TP_printk("rmem_alloc=%d truesize=%u sk_rcvbuf=%d", ··· 115 115 __entry->rmem_alloc = atomic_read(&sk->sk_rmem_alloc); 116 116 __entry->sysctl_wmem = sk_get_wmem0(sk, prot); 117 117 __entry->wmem_alloc = refcount_read(&sk->sk_wmem_alloc); 118 - __entry->wmem_queued = sk->sk_wmem_queued; 118 + __entry->wmem_queued = READ_ONCE(sk->sk_wmem_queued); 119 119 __entry->kind = kind; 120 120 ), 121 121
+3
net/bridge/netfilter/nf_conntrack_bridge.c
··· 33 33 { 34 34 int frag_max_size = BR_INPUT_SKB_CB(skb)->frag_max_size; 35 35 unsigned int hlen, ll_rs, mtu; 36 + ktime_t tstamp = skb->tstamp; 36 37 struct ip_frag_state state; 37 38 struct iphdr *iph; 38 39 int err; ··· 81 80 if (iter.frag) 82 81 ip_fraglist_prepare(skb, &iter); 83 82 83 + skb->tstamp = tstamp; 84 84 err = output(net, sk, data, skb); 85 85 if (err || !iter.frag) 86 86 break; ··· 106 104 goto blackhole; 107 105 } 108 106 107 + skb2->tstamp = tstamp; 109 108 err = output(net, sk, data, skb2); 110 109 if (err) 111 110 goto blackhole;
+1 -1
net/core/datagram.c
··· 640 640 skb->len += copied; 641 641 skb->truesize += truesize; 642 642 if (sk && sk->sk_type == SOCK_STREAM) { 643 - sk->sk_wmem_queued += truesize; 643 + sk_wmem_queued_add(sk, truesize); 644 644 sk_mem_charge(sk, truesize); 645 645 } else { 646 646 refcount_add(truesize, &skb->sk->sk_wmem_alloc);
+5 -3
net/core/filter.c
··· 4252 4252 case SO_RCVBUF: 4253 4253 val = min_t(u32, val, sysctl_rmem_max); 4254 4254 sk->sk_userlocks |= SOCK_RCVBUF_LOCK; 4255 - sk->sk_rcvbuf = max_t(int, val * 2, SOCK_MIN_RCVBUF); 4255 + WRITE_ONCE(sk->sk_rcvbuf, 4256 + max_t(int, val * 2, SOCK_MIN_RCVBUF)); 4256 4257 break; 4257 4258 case SO_SNDBUF: 4258 4259 val = min_t(u32, val, sysctl_wmem_max); 4259 4260 sk->sk_userlocks |= SOCK_SNDBUF_LOCK; 4260 - sk->sk_sndbuf = max_t(int, val * 2, SOCK_MIN_SNDBUF); 4261 + WRITE_ONCE(sk->sk_sndbuf, 4262 + max_t(int, val * 2, SOCK_MIN_SNDBUF)); 4261 4263 break; 4262 4264 case SO_MAX_PACING_RATE: /* 32bit version */ 4263 4265 if (val != ~0U) ··· 4276 4274 case SO_RCVLOWAT: 4277 4275 if (val < 0) 4278 4276 val = INT_MAX; 4279 - sk->sk_rcvlowat = val ? : 1; 4277 + WRITE_ONCE(sk->sk_rcvlowat, val ? : 1); 4280 4278 break; 4281 4279 case SO_MARK: 4282 4280 if (sk->sk_mark != val) {
+11 -6
net/core/net_namespace.c
··· 245 245 return __peernet2id_alloc(net, peer, &no); 246 246 } 247 247 248 - static void rtnl_net_notifyid(struct net *net, int cmd, int id); 248 + static void rtnl_net_notifyid(struct net *net, int cmd, int id, u32 portid, 249 + struct nlmsghdr *nlh); 249 250 /* This function returns the id of a peer netns. If no id is assigned, one will 250 251 * be allocated and returned. 251 252 */ ··· 269 268 id = __peernet2id_alloc(net, peer, &alloc); 270 269 spin_unlock_bh(&net->nsid_lock); 271 270 if (alloc && id >= 0) 272 - rtnl_net_notifyid(net, RTM_NEWNSID, id); 271 + rtnl_net_notifyid(net, RTM_NEWNSID, id, 0, NULL); 273 272 if (alive) 274 273 put_net(peer); 275 274 return id; ··· 533 532 idr_remove(&tmp->netns_ids, id); 534 533 spin_unlock_bh(&tmp->nsid_lock); 535 534 if (id >= 0) 536 - rtnl_net_notifyid(tmp, RTM_DELNSID, id); 535 + rtnl_net_notifyid(tmp, RTM_DELNSID, id, 0, NULL); 537 536 if (tmp == last) 538 537 break; 539 538 } ··· 765 764 err = alloc_netid(net, peer, nsid); 766 765 spin_unlock_bh(&net->nsid_lock); 767 766 if (err >= 0) { 768 - rtnl_net_notifyid(net, RTM_NEWNSID, err); 767 + rtnl_net_notifyid(net, RTM_NEWNSID, err, NETLINK_CB(skb).portid, 768 + nlh); 769 769 err = 0; 770 770 } else if (err == -ENOSPC && nsid >= 0) { 771 771 err = -EEXIST; ··· 1053 1051 return err < 0 ? err : skb->len; 1054 1052 } 1055 1053 1056 - static void rtnl_net_notifyid(struct net *net, int cmd, int id) 1054 + static void rtnl_net_notifyid(struct net *net, int cmd, int id, u32 portid, 1055 + struct nlmsghdr *nlh) 1057 1056 { 1058 1057 struct net_fill_args fillargs = { 1058 + .portid = portid, 1059 + .seq = nlh ? nlh->nlmsg_seq : 0, 1059 1060 .cmd = cmd, 1060 1061 .nsid = id, 1061 1062 }; ··· 1073 1068 if (err < 0) 1074 1069 goto err_out; 1075 1070 1076 - rtnl_notify(msg, net, 0, RTNLGRP_NSID, NULL, 0); 1071 + rtnl_notify(msg, net, portid, RTNLGRP_NSID, nlh, 0); 1077 1072 return; 1078 1073 1079 1074 err_out:
+1 -1
net/core/request_sock.c
··· 96 96 97 97 fastopenq = &inet_csk(lsk)->icsk_accept_queue.fastopenq; 98 98 99 - tcp_sk(sk)->fastopen_rsk = NULL; 99 + RCU_INIT_POINTER(tcp_sk(sk)->fastopen_rsk, NULL); 100 100 spin_lock_bh(&fastopenq->lock); 101 101 fastopenq->qlen--; 102 102 tcp_rsk(req)->tfo_listener = false;
+13 -10
net/core/skbuff.c
··· 4415 4415 int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb) 4416 4416 { 4417 4417 if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >= 4418 - (unsigned int)sk->sk_rcvbuf) 4418 + (unsigned int)READ_ONCE(sk->sk_rcvbuf)) 4419 4419 return -ENOMEM; 4420 4420 4421 4421 skb_orphan(skb); ··· 5477 5477 * @skb: buffer 5478 5478 * @mpls_lse: MPLS label stack entry to push 5479 5479 * @mpls_proto: ethertype of the new MPLS header (expects 0x8847 or 0x8848) 5480 + * @mac_len: length of the MAC header 5480 5481 * 5481 5482 * Expects skb->data at mac header. 5482 5483 * 5483 5484 * Returns 0 on success, -errno otherwise. 5484 5485 */ 5485 - int skb_mpls_push(struct sk_buff *skb, __be32 mpls_lse, __be16 mpls_proto) 5486 + int skb_mpls_push(struct sk_buff *skb, __be32 mpls_lse, __be16 mpls_proto, 5487 + int mac_len) 5486 5488 { 5487 5489 struct mpls_shim_hdr *lse; 5488 5490 int err; ··· 5501 5499 return err; 5502 5500 5503 5501 if (!skb->inner_protocol) { 5504 - skb_set_inner_network_header(skb, skb->mac_len); 5502 + skb_set_inner_network_header(skb, mac_len); 5505 5503 skb_set_inner_protocol(skb, skb->protocol); 5506 5504 } 5507 5505 5508 5506 skb_push(skb, MPLS_HLEN); 5509 5507 memmove(skb_mac_header(skb) - MPLS_HLEN, skb_mac_header(skb), 5510 - skb->mac_len); 5508 + mac_len); 5511 5509 skb_reset_mac_header(skb); 5512 - skb_set_network_header(skb, skb->mac_len); 5510 + skb_set_network_header(skb, mac_len); 5513 5511 5514 5512 lse = mpls_hdr(skb); 5515 5513 lse->label_stack_entry = mpls_lse; ··· 5528 5526 * 5529 5527 * @skb: buffer 5530 5528 * @next_proto: ethertype of header after popped MPLS header 5529 + * @mac_len: length of the MAC header 5531 5530 * 5532 5531 * Expects skb->data at mac header. 5533 5532 * 5534 5533 * Returns 0 on success, -errno otherwise. 5535 5534 */ 5536 - int skb_mpls_pop(struct sk_buff *skb, __be16 next_proto) 5535 + int skb_mpls_pop(struct sk_buff *skb, __be16 next_proto, int mac_len) 5537 5536 { 5538 5537 int err; 5539 5538 5540 5539 if (unlikely(!eth_p_mpls(skb->protocol))) 5541 - return -EINVAL; 5540 + return 0; 5542 5541 5543 - err = skb_ensure_writable(skb, skb->mac_len + MPLS_HLEN); 5542 + err = skb_ensure_writable(skb, mac_len + MPLS_HLEN); 5544 5543 if (unlikely(err)) 5545 5544 return err; 5546 5545 5547 5546 skb_postpull_rcsum(skb, mpls_hdr(skb), MPLS_HLEN); 5548 5547 memmove(skb_mac_header(skb) + MPLS_HLEN, skb_mac_header(skb), 5549 - skb->mac_len); 5548 + mac_len); 5550 5549 5551 5550 __skb_pull(skb, MPLS_HLEN); 5552 5551 skb_reset_mac_header(skb); 5553 - skb_set_network_header(skb, skb->mac_len); 5552 + skb_set_network_header(skb, mac_len); 5554 5553 5555 5554 if (skb->dev && skb->dev->type == ARPHRD_ETHER) { 5556 5555 struct ethhdr *hdr;
+18 -14
net/core/sock.c
··· 522 522 rc = sk_backlog_rcv(sk, skb); 523 523 524 524 mutex_release(&sk->sk_lock.dep_map, 1, _RET_IP_); 525 - } else if (sk_add_backlog(sk, skb, sk->sk_rcvbuf)) { 525 + } else if (sk_add_backlog(sk, skb, READ_ONCE(sk->sk_rcvbuf))) { 526 526 bh_unlock_sock(sk); 527 527 atomic_inc(&sk->sk_drops); 528 528 goto discard_and_relse; ··· 785 785 */ 786 786 val = min_t(int, val, INT_MAX / 2); 787 787 sk->sk_userlocks |= SOCK_SNDBUF_LOCK; 788 - sk->sk_sndbuf = max_t(int, val * 2, SOCK_MIN_SNDBUF); 788 + WRITE_ONCE(sk->sk_sndbuf, 789 + max_t(int, val * 2, SOCK_MIN_SNDBUF)); 789 790 /* Wake up sending tasks if we upped the value. */ 790 791 sk->sk_write_space(sk); 791 792 break; ··· 832 831 * returning the value we actually used in getsockopt 833 832 * is the most desirable behavior. 834 833 */ 835 - sk->sk_rcvbuf = max_t(int, val * 2, SOCK_MIN_RCVBUF); 834 + WRITE_ONCE(sk->sk_rcvbuf, 835 + max_t(int, val * 2, SOCK_MIN_RCVBUF)); 836 836 break; 837 837 838 838 case SO_RCVBUFFORCE: ··· 976 974 if (sock->ops->set_rcvlowat) 977 975 ret = sock->ops->set_rcvlowat(sk, val); 978 976 else 979 - sk->sk_rcvlowat = val ? : 1; 977 + WRITE_ONCE(sk->sk_rcvlowat, val ? : 1); 980 978 break; 981 979 982 980 case SO_RCVTIMEO_OLD: ··· 2090 2088 struct sk_buff *sock_wmalloc(struct sock *sk, unsigned long size, int force, 2091 2089 gfp_t priority) 2092 2090 { 2093 - if (force || refcount_read(&sk->sk_wmem_alloc) < sk->sk_sndbuf) { 2091 + if (force || 2092 + refcount_read(&sk->sk_wmem_alloc) < READ_ONCE(sk->sk_sndbuf)) { 2094 2093 struct sk_buff *skb = alloc_skb(size, priority); 2094 + 2095 2095 if (skb) { 2096 2096 skb_set_owner_w(skb, sk); 2097 2097 return skb; ··· 2194 2190 break; 2195 2191 set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); 2196 2192 prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); 2197 - if (refcount_read(&sk->sk_wmem_alloc) < sk->sk_sndbuf) 2193 + if (refcount_read(&sk->sk_wmem_alloc) < READ_ONCE(sk->sk_sndbuf)) 2198 2194 break; 2199 2195 if (sk->sk_shutdown & SEND_SHUTDOWN) 2200 2196 break; ··· 2229 2225 if (sk->sk_shutdown & SEND_SHUTDOWN) 2230 2226 goto failure; 2231 2227 2232 - if (sk_wmem_alloc_get(sk) < sk->sk_sndbuf) 2228 + if (sk_wmem_alloc_get(sk) < READ_ONCE(sk->sk_sndbuf)) 2233 2229 break; 2234 2230 2235 2231 sk_set_bit(SOCKWQ_ASYNC_NOSPACE, sk); ··· 2338 2334 } else { 2339 2335 unsigned long *memory_pressure = sk->sk_prot->memory_pressure; 2340 2336 2341 - if (memory_pressure && *memory_pressure) 2342 - *memory_pressure = 0; 2337 + if (memory_pressure && READ_ONCE(*memory_pressure)) 2338 + WRITE_ONCE(*memory_pressure, 0); 2343 2339 } 2344 2340 } 2345 2341 ··· 2810 2806 /* Do not wake up a writer until he can make "significant" 2811 2807 * progress. --DaveM 2812 2808 */ 2813 - if ((refcount_read(&sk->sk_wmem_alloc) << 1) <= sk->sk_sndbuf) { 2809 + if ((refcount_read(&sk->sk_wmem_alloc) << 1) <= READ_ONCE(sk->sk_sndbuf)) { 2814 2810 wq = rcu_dereference(sk->sk_wq); 2815 2811 if (skwq_has_sleeper(wq)) 2816 2812 wake_up_interruptible_sync_poll(&wq->wait, EPOLLOUT | ··· 3208 3204 memset(mem, 0, sizeof(*mem) * SK_MEMINFO_VARS); 3209 3205 3210 3206 mem[SK_MEMINFO_RMEM_ALLOC] = sk_rmem_alloc_get(sk); 3211 - mem[SK_MEMINFO_RCVBUF] = sk->sk_rcvbuf; 3207 + mem[SK_MEMINFO_RCVBUF] = READ_ONCE(sk->sk_rcvbuf); 3212 3208 mem[SK_MEMINFO_WMEM_ALLOC] = sk_wmem_alloc_get(sk); 3213 - mem[SK_MEMINFO_SNDBUF] = sk->sk_sndbuf; 3209 + mem[SK_MEMINFO_SNDBUF] = READ_ONCE(sk->sk_sndbuf); 3214 3210 mem[SK_MEMINFO_FWD_ALLOC] = sk->sk_forward_alloc; 3215 - mem[SK_MEMINFO_WMEM_QUEUED] = sk->sk_wmem_queued; 3211 + mem[SK_MEMINFO_WMEM_QUEUED] = READ_ONCE(sk->sk_wmem_queued); 3216 3212 mem[SK_MEMINFO_OPTMEM] = atomic_read(&sk->sk_omem_alloc); 3217 - mem[SK_MEMINFO_BACKLOG] = sk->sk_backlog.len; 3213 + mem[SK_MEMINFO_BACKLOG] = READ_ONCE(sk->sk_backlog.len); 3218 3214 mem[SK_MEMINFO_DROPS] = atomic_read(&sk->sk_drops); 3219 3215 } 3220 3216
+1 -1
net/dsa/dsa2.c
··· 46 46 dst->index = index; 47 47 48 48 INIT_LIST_HEAD(&dst->list); 49 - list_add_tail(&dsa_tree_list, &dst->list); 49 + list_add_tail(&dst->list, &dsa_tree_list); 50 50 51 51 kref_init(&dst->refcount); 52 52
+3 -3
net/ipv4/inet_connection_sock.c
··· 906 906 percpu_counter_inc(sk->sk_prot->orphan_count); 907 907 908 908 if (sk->sk_protocol == IPPROTO_TCP && tcp_rsk(req)->tfo_listener) { 909 - BUG_ON(tcp_sk(child)->fastopen_rsk != req); 909 + BUG_ON(rcu_access_pointer(tcp_sk(child)->fastopen_rsk) != req); 910 910 BUG_ON(sk != req->rsk_listener); 911 911 912 912 /* Paranoid, to prevent race condition if ··· 915 915 * Also to satisfy an assertion in 916 916 * tcp_v4_destroy_sock(). 917 917 */ 918 - tcp_sk(child)->fastopen_rsk = NULL; 918 + RCU_INIT_POINTER(tcp_sk(child)->fastopen_rsk, NULL); 919 919 } 920 920 inet_csk_destroy_sock(child); 921 921 } ··· 934 934 req->sk = child; 935 935 req->dl_next = NULL; 936 936 if (queue->rskq_accept_head == NULL) 937 - queue->rskq_accept_head = req; 937 + WRITE_ONCE(queue->rskq_accept_head, req); 938 938 else 939 939 queue->rskq_accept_tail->dl_next = req; 940 940 queue->rskq_accept_tail = req;
+1 -1
net/ipv4/inet_diag.c
··· 193 193 if (ext & (1 << (INET_DIAG_MEMINFO - 1))) { 194 194 struct inet_diag_meminfo minfo = { 195 195 .idiag_rmem = sk_rmem_alloc_get(sk), 196 - .idiag_wmem = sk->sk_wmem_queued, 196 + .idiag_wmem = READ_ONCE(sk->sk_wmem_queued), 197 197 .idiag_fmem = sk->sk_forward_alloc, 198 198 .idiag_tmem = sk_wmem_alloc_get(sk), 199 199 };
+3
net/ipv4/ip_output.c
··· 771 771 struct rtable *rt = skb_rtable(skb); 772 772 unsigned int mtu, hlen, ll_rs; 773 773 struct ip_fraglist_iter iter; 774 + ktime_t tstamp = skb->tstamp; 774 775 struct ip_frag_state state; 775 776 int err = 0; 776 777 ··· 847 846 ip_fraglist_prepare(skb, &iter); 848 847 } 849 848 849 + skb->tstamp = tstamp; 850 850 err = output(net, sk, skb); 851 851 852 852 if (!err) ··· 902 900 /* 903 901 * Put this fragment into the sending queue. 904 902 */ 903 + skb2->tstamp = tstamp; 905 904 err = output(net, sk, skb2); 906 905 if (err) 907 906 goto fail;
+7 -4
net/ipv4/route.c
··· 1482 1482 prev = cmpxchg(p, orig, rt); 1483 1483 if (prev == orig) { 1484 1484 if (orig) { 1485 - dst_dev_put(&orig->dst); 1485 + rt_add_uncached_list(orig); 1486 1486 dst_release(&orig->dst); 1487 1487 } 1488 1488 } else { ··· 2470 2470 int orig_oif = fl4->flowi4_oif; 2471 2471 unsigned int flags = 0; 2472 2472 struct rtable *rth; 2473 - int err = -ENETUNREACH; 2473 + int err; 2474 2474 2475 2475 if (fl4->saddr) { 2476 - rth = ERR_PTR(-EINVAL); 2477 2476 if (ipv4_is_multicast(fl4->saddr) || 2478 2477 ipv4_is_lbcast(fl4->saddr) || 2479 - ipv4_is_zeronet(fl4->saddr)) 2478 + ipv4_is_zeronet(fl4->saddr)) { 2479 + rth = ERR_PTR(-EINVAL); 2480 2480 goto out; 2481 + } 2482 + 2483 + rth = ERR_PTR(-ENETUNREACH); 2481 2484 2482 2485 /* I removed check for oif == dev_out->oif here. 2483 2486 It was wrong for two reasons:
+45 -30
net/ipv4/tcp.c
··· 326 326 { 327 327 unsigned long val; 328 328 329 - if (tcp_memory_pressure) 329 + if (READ_ONCE(tcp_memory_pressure)) 330 330 return; 331 331 val = jiffies; 332 332 ··· 341 341 { 342 342 unsigned long val; 343 343 344 - if (!tcp_memory_pressure) 344 + if (!READ_ONCE(tcp_memory_pressure)) 345 345 return; 346 346 val = xchg(&tcp_memory_pressure, 0); 347 347 if (val) ··· 450 450 451 451 icsk->icsk_sync_mss = tcp_sync_mss; 452 452 453 - sk->sk_sndbuf = sock_net(sk)->ipv4.sysctl_tcp_wmem[1]; 454 - sk->sk_rcvbuf = sock_net(sk)->ipv4.sysctl_tcp_rmem[1]; 453 + WRITE_ONCE(sk->sk_sndbuf, sock_net(sk)->ipv4.sysctl_tcp_wmem[1]); 454 + WRITE_ONCE(sk->sk_rcvbuf, sock_net(sk)->ipv4.sysctl_tcp_rmem[1]); 455 455 456 456 sk_sockets_allocated_inc(sk); 457 457 sk->sk_route_forced_caps = NETIF_F_GSO; ··· 477 477 static inline bool tcp_stream_is_readable(const struct tcp_sock *tp, 478 478 int target, struct sock *sk) 479 479 { 480 - return (tp->rcv_nxt - tp->copied_seq >= target) || 480 + return (READ_ONCE(tp->rcv_nxt) - READ_ONCE(tp->copied_seq) >= target) || 481 481 (sk->sk_prot->stream_memory_read ? 482 482 sk->sk_prot->stream_memory_read(sk) : false); 483 483 } ··· 543 543 544 544 /* Connected or passive Fast Open socket? */ 545 545 if (state != TCP_SYN_SENT && 546 - (state != TCP_SYN_RECV || tp->fastopen_rsk)) { 546 + (state != TCP_SYN_RECV || rcu_access_pointer(tp->fastopen_rsk))) { 547 547 int target = sock_rcvlowat(sk, 0, INT_MAX); 548 548 549 - if (tp->urg_seq == tp->copied_seq && 549 + if (READ_ONCE(tp->urg_seq) == READ_ONCE(tp->copied_seq) && 550 550 !sock_flag(sk, SOCK_URGINLINE) && 551 551 tp->urg_data) 552 552 target++; ··· 607 607 unlock_sock_fast(sk, slow); 608 608 break; 609 609 case SIOCATMARK: 610 - answ = tp->urg_data && tp->urg_seq == tp->copied_seq; 610 + answ = tp->urg_data && 611 + READ_ONCE(tp->urg_seq) == READ_ONCE(tp->copied_seq); 611 612 break; 612 613 case SIOCOUTQ: 613 614 if (sk->sk_state == TCP_LISTEN) ··· 617 616 if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV)) 618 617 answ = 0; 619 618 else 620 - answ = tp->write_seq - tp->snd_una; 619 + answ = READ_ONCE(tp->write_seq) - tp->snd_una; 621 620 break; 622 621 case SIOCOUTQNSD: 623 622 if (sk->sk_state == TCP_LISTEN) ··· 626 625 if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV)) 627 626 answ = 0; 628 627 else 629 - answ = tp->write_seq - tp->snd_nxt; 628 + answ = READ_ONCE(tp->write_seq) - 629 + READ_ONCE(tp->snd_nxt); 630 630 break; 631 631 default: 632 632 return -ENOIOCTLCMD; ··· 659 657 tcb->sacked = 0; 660 658 __skb_header_release(skb); 661 659 tcp_add_write_queue_tail(sk, skb); 662 - sk->sk_wmem_queued += skb->truesize; 660 + sk_wmem_queued_add(sk, skb->truesize); 663 661 sk_mem_charge(sk, skb->truesize); 664 662 if (tp->nonagle & TCP_NAGLE_PUSH) 665 663 tp->nonagle &= ~TCP_NAGLE_PUSH; ··· 1034 1032 skb->len += copy; 1035 1033 skb->data_len += copy; 1036 1034 skb->truesize += copy; 1037 - sk->sk_wmem_queued += copy; 1035 + sk_wmem_queued_add(sk, copy); 1038 1036 sk_mem_charge(sk, copy); 1039 1037 skb->ip_summed = CHECKSUM_PARTIAL; 1040 - tp->write_seq += copy; 1038 + WRITE_ONCE(tp->write_seq, tp->write_seq + copy); 1041 1039 TCP_SKB_CB(skb)->end_seq += copy; 1042 1040 tcp_skb_pcount_set(skb, 0); 1043 1041 ··· 1364 1362 if (!copied) 1365 1363 TCP_SKB_CB(skb)->tcp_flags &= ~TCPHDR_PSH; 1366 1364 1367 - tp->write_seq += copy; 1365 + WRITE_ONCE(tp->write_seq, tp->write_seq + copy); 1368 1366 TCP_SKB_CB(skb)->end_seq += copy; 1369 1367 tcp_skb_pcount_set(skb, 0); 1370 1368 ··· 1670 1668 sk_eat_skb(sk, skb); 1671 1669 if (!desc->count) 1672 1670 break; 1673 - tp->copied_seq = seq; 1671 + WRITE_ONCE(tp->copied_seq, seq); 1674 1672 } 1675 - tp->copied_seq = seq; 1673 + WRITE_ONCE(tp->copied_seq, seq); 1676 1674 1677 1675 tcp_rcv_space_adjust(sk); 1678 1676 ··· 1701 1699 else 1702 1700 cap = sock_net(sk)->ipv4.sysctl_tcp_rmem[2] >> 1; 1703 1701 val = min(val, cap); 1704 - sk->sk_rcvlowat = val ? : 1; 1702 + WRITE_ONCE(sk->sk_rcvlowat, val ? : 1); 1705 1703 1706 1704 /* Check if we need to signal EPOLLIN right now */ 1707 1705 tcp_data_ready(sk); ··· 1711 1709 1712 1710 val <<= 1; 1713 1711 if (val > sk->sk_rcvbuf) { 1714 - sk->sk_rcvbuf = val; 1712 + WRITE_ONCE(sk->sk_rcvbuf, val); 1715 1713 tcp_sk(sk)->window_clamp = tcp_win_from_space(sk, val); 1716 1714 } 1717 1715 return 0; ··· 1821 1819 out: 1822 1820 up_read(&current->mm->mmap_sem); 1823 1821 if (length) { 1824 - tp->copied_seq = seq; 1822 + WRITE_ONCE(tp->copied_seq, seq); 1825 1823 tcp_rcv_space_adjust(sk); 1826 1824 1827 1825 /* Clean up data we have read: This will do ACK frames. */ ··· 2119 2117 if (urg_offset < used) { 2120 2118 if (!urg_offset) { 2121 2119 if (!sock_flag(sk, SOCK_URGINLINE)) { 2122 - ++*seq; 2120 + WRITE_ONCE(*seq, *seq + 1); 2123 2121 urg_hole++; 2124 2122 offset++; 2125 2123 used--; ··· 2141 2139 } 2142 2140 } 2143 2141 2144 - *seq += used; 2142 + WRITE_ONCE(*seq, *seq + used); 2145 2143 copied += used; 2146 2144 len -= used; 2147 2145 ··· 2168 2166 2169 2167 found_fin_ok: 2170 2168 /* Process the FIN. */ 2171 - ++*seq; 2169 + WRITE_ONCE(*seq, *seq + 1); 2172 2170 if (!(flags & MSG_PEEK)) 2173 2171 sk_eat_skb(sk, skb); 2174 2172 break; ··· 2489 2487 } 2490 2488 2491 2489 if (sk->sk_state == TCP_CLOSE) { 2492 - struct request_sock *req = tcp_sk(sk)->fastopen_rsk; 2490 + struct request_sock *req; 2491 + 2492 + req = rcu_dereference_protected(tcp_sk(sk)->fastopen_rsk, 2493 + lockdep_sock_is_held(sk)); 2493 2494 /* We could get here with a non-NULL req if the socket is 2494 2495 * aborted (e.g., closed with unread data) before 3WHS 2495 2496 * finishes. ··· 2564 2559 struct inet_connection_sock *icsk = inet_csk(sk); 2565 2560 struct tcp_sock *tp = tcp_sk(sk); 2566 2561 int old_state = sk->sk_state; 2562 + u32 seq; 2567 2563 2568 2564 if (old_state != TCP_CLOSE) 2569 2565 tcp_set_state(sk, TCP_CLOSE); ··· 2591 2585 __kfree_skb(sk->sk_rx_skb_cache); 2592 2586 sk->sk_rx_skb_cache = NULL; 2593 2587 } 2594 - tp->copied_seq = tp->rcv_nxt; 2588 + WRITE_ONCE(tp->copied_seq, tp->rcv_nxt); 2595 2589 tp->urg_data = 0; 2596 2590 tcp_write_queue_purge(sk); 2597 2591 tcp_fastopen_active_disable_ofo_check(sk); ··· 2607 2601 tp->srtt_us = 0; 2608 2602 tp->mdev_us = jiffies_to_usecs(TCP_TIMEOUT_INIT); 2609 2603 tp->rcv_rtt_last_tsecr = 0; 2610 - tp->write_seq += tp->max_window + 2; 2611 - if (tp->write_seq == 0) 2612 - tp->write_seq = 1; 2604 + 2605 + seq = tp->write_seq + tp->max_window + 2; 2606 + if (!seq) 2607 + seq = 1; 2608 + WRITE_ONCE(tp->write_seq, seq); 2609 + 2613 2610 icsk->icsk_backoff = 0; 2614 2611 tp->snd_cwnd = 2; 2615 2612 icsk->icsk_probes_out = 0; ··· 2939 2930 if (sk->sk_state != TCP_CLOSE) 2940 2931 err = -EPERM; 2941 2932 else if (tp->repair_queue == TCP_SEND_QUEUE) 2942 - tp->write_seq = val; 2933 + WRITE_ONCE(tp->write_seq, val); 2943 2934 else if (tp->repair_queue == TCP_RECV_QUEUE) 2944 - tp->rcv_nxt = val; 2935 + WRITE_ONCE(tp->rcv_nxt, val); 2945 2936 else 2946 2937 err = -EINVAL; 2947 2938 break; ··· 3840 3831 3841 3832 void tcp_done(struct sock *sk) 3842 3833 { 3843 - struct request_sock *req = tcp_sk(sk)->fastopen_rsk; 3834 + struct request_sock *req; 3835 + 3836 + /* We might be called with a new socket, after 3837 + * inet_csk_prepare_forced_close() has been called 3838 + * so we can not use lockdep_sock_is_held(sk) 3839 + */ 3840 + req = rcu_dereference_protected(tcp_sk(sk)->fastopen_rsk, 1); 3844 3841 3845 3842 if (sk->sk_state == TCP_SYN_SENT || sk->sk_state == TCP_SYN_RECV) 3846 3843 TCP_INC_STATS(sock_net(sk), TCP_MIB_ATTEMPTFAILS);
+3 -2
net/ipv4/tcp_diag.c
··· 26 26 } else if (sk->sk_type == SOCK_STREAM) { 27 27 const struct tcp_sock *tp = tcp_sk(sk); 28 28 29 - r->idiag_rqueue = max_t(int, tp->rcv_nxt - tp->copied_seq, 0); 30 - r->idiag_wqueue = tp->write_seq - tp->snd_una; 29 + r->idiag_rqueue = max_t(int, READ_ONCE(tp->rcv_nxt) - 30 + READ_ONCE(tp->copied_seq), 0); 31 + r->idiag_wqueue = READ_ONCE(tp->write_seq) - tp->snd_una; 31 32 } 32 33 if (info) 33 34 tcp_get_info(sk, info);
+1 -1
net/ipv4/tcp_fastopen.c
··· 253 253 */ 254 254 tp = tcp_sk(child); 255 255 256 - tp->fastopen_rsk = req; 256 + rcu_assign_pointer(tp->fastopen_rsk, req); 257 257 tcp_rsk(req)->tfo_listener = true; 258 258 259 259 /* RFC1323: The window in SYN & SYN/ACK segments is never
+22 -15
net/ipv4/tcp_input.c
··· 359 359 sndmem *= nr_segs * per_mss; 360 360 361 361 if (sk->sk_sndbuf < sndmem) 362 - sk->sk_sndbuf = min(sndmem, sock_net(sk)->ipv4.sysctl_tcp_wmem[2]); 362 + WRITE_ONCE(sk->sk_sndbuf, 363 + min(sndmem, sock_net(sk)->ipv4.sysctl_tcp_wmem[2])); 363 364 } 364 365 365 366 /* 2. Tuning advertised window (window_clamp, rcv_ssthresh) ··· 484 483 !(sk->sk_userlocks & SOCK_RCVBUF_LOCK) && 485 484 !tcp_under_memory_pressure(sk) && 486 485 sk_memory_allocated(sk) < sk_prot_mem_limits(sk, 0)) { 487 - sk->sk_rcvbuf = min(atomic_read(&sk->sk_rmem_alloc), 488 - net->ipv4.sysctl_tcp_rmem[2]); 486 + WRITE_ONCE(sk->sk_rcvbuf, 487 + min(atomic_read(&sk->sk_rmem_alloc), 488 + net->ipv4.sysctl_tcp_rmem[2])); 489 489 } 490 490 if (atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf) 491 491 tp->rcv_ssthresh = min(tp->window_clamp, 2U * tp->advmss); ··· 650 648 rcvbuf = min_t(u64, rcvwin * rcvmem, 651 649 sock_net(sk)->ipv4.sysctl_tcp_rmem[2]); 652 650 if (rcvbuf > sk->sk_rcvbuf) { 653 - sk->sk_rcvbuf = rcvbuf; 651 + WRITE_ONCE(sk->sk_rcvbuf, rcvbuf); 654 652 655 653 /* Make the window clamp follow along. */ 656 654 tp->window_clamp = tcp_win_from_space(sk, rcvbuf); ··· 2668 2666 struct tcp_sock *tp = tcp_sk(sk); 2669 2667 bool recovered = !before(tp->snd_una, tp->high_seq); 2670 2668 2671 - if ((flag & FLAG_SND_UNA_ADVANCED || tp->fastopen_rsk) && 2669 + if ((flag & FLAG_SND_UNA_ADVANCED || rcu_access_pointer(tp->fastopen_rsk)) && 2672 2670 tcp_try_undo_loss(sk, false)) 2673 2671 return; 2674 2672 ··· 2992 2990 /* If the retrans timer is currently being used by Fast Open 2993 2991 * for SYN-ACK retrans purpose, stay put. 2994 2992 */ 2995 - if (tp->fastopen_rsk) 2993 + if (rcu_access_pointer(tp->fastopen_rsk)) 2996 2994 return; 2997 2995 2998 2996 if (!tp->packets_out) { ··· 3364 3362 3365 3363 sock_owned_by_me((struct sock *)tp); 3366 3364 tp->bytes_received += delta; 3367 - tp->rcv_nxt = seq; 3365 + WRITE_ONCE(tp->rcv_nxt, seq); 3368 3366 } 3369 3367 3370 3368 /* Update our send window. ··· 5358 5356 } 5359 5357 5360 5358 tp->urg_data = TCP_URG_NOTYET; 5361 - tp->urg_seq = ptr; 5359 + WRITE_ONCE(tp->urg_seq, ptr); 5362 5360 5363 5361 /* Disable header prediction. */ 5364 5362 tp->pred_flags = 0; ··· 5934 5932 /* Ok.. it's good. Set up sequence numbers and 5935 5933 * move to established. 5936 5934 */ 5937 - tp->rcv_nxt = TCP_SKB_CB(skb)->seq + 1; 5935 + WRITE_ONCE(tp->rcv_nxt, TCP_SKB_CB(skb)->seq + 1); 5938 5936 tp->rcv_wup = TCP_SKB_CB(skb)->seq + 1; 5939 5937 5940 5938 /* RFC1323: The window in SYN & SYN/ACK segments is ··· 5963 5961 /* Remember, tcp_poll() does not lock socket! 5964 5962 * Change state from SYN-SENT only after copied_seq 5965 5963 * is initialized. */ 5966 - tp->copied_seq = tp->rcv_nxt; 5964 + WRITE_ONCE(tp->copied_seq, tp->rcv_nxt); 5967 5965 5968 5966 smc_check_reset_syn(tp); 5969 5967 ··· 6037 6035 tp->tcp_header_len = sizeof(struct tcphdr); 6038 6036 } 6039 6037 6040 - tp->rcv_nxt = TCP_SKB_CB(skb)->seq + 1; 6041 - tp->copied_seq = tp->rcv_nxt; 6038 + WRITE_ONCE(tp->rcv_nxt, TCP_SKB_CB(skb)->seq + 1); 6039 + WRITE_ONCE(tp->copied_seq, tp->rcv_nxt); 6042 6040 tp->rcv_wup = TCP_SKB_CB(skb)->seq + 1; 6043 6041 6044 6042 /* RFC1323: The window in SYN & SYN/ACK segments is ··· 6089 6087 6090 6088 static void tcp_rcv_synrecv_state_fastopen(struct sock *sk) 6091 6089 { 6090 + struct request_sock *req; 6091 + 6092 6092 tcp_try_undo_loss(sk, false); 6093 6093 6094 6094 /* Reset rtx states to prevent spurious retransmits_timed_out() */ ··· 6100 6096 /* Once we leave TCP_SYN_RECV or TCP_FIN_WAIT_1, 6101 6097 * we no longer need req so release it. 6102 6098 */ 6103 - reqsk_fastopen_remove(sk, tcp_sk(sk)->fastopen_rsk, false); 6099 + req = rcu_dereference_protected(tcp_sk(sk)->fastopen_rsk, 6100 + lockdep_sock_is_held(sk)); 6101 + reqsk_fastopen_remove(sk, req, false); 6104 6102 6105 6103 /* Re-arm the timer because data may have been sent out. 6106 6104 * This is similar to the regular data transmission case ··· 6177 6171 6178 6172 tcp_mstamp_refresh(tp); 6179 6173 tp->rx_opt.saw_tstamp = 0; 6180 - req = tp->fastopen_rsk; 6174 + req = rcu_dereference_protected(tp->fastopen_rsk, 6175 + lockdep_sock_is_held(sk)); 6181 6176 if (req) { 6182 6177 bool req_stolen; 6183 6178 ··· 6218 6211 tcp_try_undo_spurious_syn(sk); 6219 6212 tp->retrans_stamp = 0; 6220 6213 tcp_init_transfer(sk, BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB); 6221 - tp->copied_seq = tp->rcv_nxt; 6214 + WRITE_ONCE(tp->copied_seq, tp->rcv_nxt); 6222 6215 } 6223 6216 smp_mb(); 6224 6217 tcp_set_state(sk, TCP_ESTABLISHED);
+17 -13
net/ipv4/tcp_ipv4.c
··· 164 164 * without appearing to create any others. 165 165 */ 166 166 if (likely(!tp->repair)) { 167 - tp->write_seq = tcptw->tw_snd_nxt + 65535 + 2; 168 - if (tp->write_seq == 0) 169 - tp->write_seq = 1; 167 + u32 seq = tcptw->tw_snd_nxt + 65535 + 2; 168 + 169 + if (!seq) 170 + seq = 1; 171 + WRITE_ONCE(tp->write_seq, seq); 170 172 tp->rx_opt.ts_recent = tcptw->tw_ts_recent; 171 173 tp->rx_opt.ts_recent_stamp = tcptw->tw_ts_recent_stamp; 172 174 } ··· 255 253 tp->rx_opt.ts_recent = 0; 256 254 tp->rx_opt.ts_recent_stamp = 0; 257 255 if (likely(!tp->repair)) 258 - tp->write_seq = 0; 256 + WRITE_ONCE(tp->write_seq, 0); 259 257 } 260 258 261 259 inet->inet_dport = usin->sin_port; ··· 293 291 294 292 if (likely(!tp->repair)) { 295 293 if (!tp->write_seq) 296 - tp->write_seq = secure_tcp_seq(inet->inet_saddr, 297 - inet->inet_daddr, 298 - inet->inet_sport, 299 - usin->sin_port); 294 + WRITE_ONCE(tp->write_seq, 295 + secure_tcp_seq(inet->inet_saddr, 296 + inet->inet_daddr, 297 + inet->inet_sport, 298 + usin->sin_port)); 300 299 tp->tsoffset = secure_tcp_ts_off(sock_net(sk), 301 300 inet->inet_saddr, 302 301 inet->inet_daddr); ··· 481 478 icsk = inet_csk(sk); 482 479 tp = tcp_sk(sk); 483 480 /* XXX (TFO) - tp->snd_una should be ISN (tcp_create_openreq_child() */ 484 - fastopen = tp->fastopen_rsk; 481 + fastopen = rcu_dereference(tp->fastopen_rsk); 485 482 snd_una = fastopen ? tcp_rsk(fastopen)->snt_isn : tp->snd_una; 486 483 if (sk->sk_state != TCP_LISTEN && 487 484 !between(seq, snd_una, tp->snd_nxt)) { ··· 1647 1644 1648 1645 bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb) 1649 1646 { 1650 - u32 limit = sk->sk_rcvbuf + sk->sk_sndbuf; 1647 + u32 limit = READ_ONCE(sk->sk_rcvbuf) + READ_ONCE(sk->sk_sndbuf); 1651 1648 struct skb_shared_info *shinfo; 1652 1649 const struct tcphdr *th; 1653 1650 struct tcphdr *thtail; ··· 2124 2121 if (inet_csk(sk)->icsk_bind_hash) 2125 2122 inet_put_port(sk); 2126 2123 2127 - BUG_ON(tp->fastopen_rsk); 2124 + BUG_ON(rcu_access_pointer(tp->fastopen_rsk)); 2128 2125 2129 2126 /* If socket is aborted during connect operation */ 2130 2127 tcp_free_fastopen_req(tp); ··· 2458 2455 /* Because we don't lock the socket, 2459 2456 * we might find a transient negative value. 2460 2457 */ 2461 - rx_queue = max_t(int, tp->rcv_nxt - tp->copied_seq, 0); 2458 + rx_queue = max_t(int, READ_ONCE(tp->rcv_nxt) - 2459 + READ_ONCE(tp->copied_seq), 0); 2462 2460 2463 2461 seq_printf(f, "%4d: %08X:%04X %08X:%04X %02X %08X:%08X %02X:%08lX " 2464 2462 "%08X %5u %8d %lu %d %pK %lu %lu %u %u %d", 2465 2463 i, src, srcp, dest, destp, state, 2466 - tp->write_seq - tp->snd_una, 2464 + READ_ONCE(tp->write_seq) - tp->snd_una, 2467 2465 rx_queue, 2468 2466 timer_active, 2469 2467 jiffies_delta_to_clock_t(timer_expires - jiffies),
+11 -6
net/ipv4/tcp_minisocks.c
··· 462 462 struct tcp_request_sock *treq = tcp_rsk(req); 463 463 struct inet_connection_sock *newicsk; 464 464 struct tcp_sock *oldtp, *newtp; 465 + u32 seq; 465 466 466 467 if (!newsk) 467 468 return NULL; ··· 476 475 /* Now setup tcp_sock */ 477 476 newtp->pred_flags = 0; 478 477 479 - newtp->rcv_wup = newtp->copied_seq = 480 - newtp->rcv_nxt = treq->rcv_isn + 1; 478 + seq = treq->rcv_isn + 1; 479 + newtp->rcv_wup = seq; 480 + WRITE_ONCE(newtp->copied_seq, seq); 481 + WRITE_ONCE(newtp->rcv_nxt, seq); 481 482 newtp->segs_in = 1; 482 483 483 - newtp->snd_sml = newtp->snd_una = 484 - newtp->snd_nxt = newtp->snd_up = treq->snt_isn + 1; 484 + seq = treq->snt_isn + 1; 485 + newtp->snd_sml = newtp->snd_una = seq; 486 + WRITE_ONCE(newtp->snd_nxt, seq); 487 + newtp->snd_up = seq; 485 488 486 489 INIT_LIST_HEAD(&newtp->tsq_node); 487 490 INIT_LIST_HEAD(&newtp->tsorted_sent_queue); ··· 500 495 newtp->total_retrans = req->num_retrans; 501 496 502 497 tcp_init_xmit_timers(newsk); 503 - newtp->write_seq = newtp->pushed_seq = treq->snt_isn + 1; 498 + WRITE_ONCE(newtp->write_seq, newtp->pushed_seq = treq->snt_isn + 1); 504 499 505 500 if (sock_flag(newsk, SOCK_KEEPOPEN)) 506 501 inet_csk_reset_keepalive_timer(newsk, ··· 546 541 newtp->rx_opt.mss_clamp = req->mss; 547 542 tcp_ecn_openreq_child(newtp, req); 548 543 newtp->fastopen_req = NULL; 549 - newtp->fastopen_rsk = NULL; 544 + RCU_INIT_POINTER(newtp->fastopen_rsk, NULL); 550 545 551 546 __TCP_INC_STATS(sock_net(sk), TCP_MIB_PASSIVEOPENS); 552 547
+16 -16
net/ipv4/tcp_output.c
··· 67 67 struct tcp_sock *tp = tcp_sk(sk); 68 68 unsigned int prior_packets = tp->packets_out; 69 69 70 - tp->snd_nxt = TCP_SKB_CB(skb)->end_seq; 70 + WRITE_ONCE(tp->snd_nxt, TCP_SKB_CB(skb)->end_seq); 71 71 72 72 __skb_unlink(skb, &sk->sk_write_queue); 73 73 tcp_rbtree_insert(&sk->tcp_rtx_queue, skb); ··· 1196 1196 struct tcp_sock *tp = tcp_sk(sk); 1197 1197 1198 1198 /* Advance write_seq and place onto the write_queue. */ 1199 - tp->write_seq = TCP_SKB_CB(skb)->end_seq; 1199 + WRITE_ONCE(tp->write_seq, TCP_SKB_CB(skb)->end_seq); 1200 1200 __skb_header_release(skb); 1201 1201 tcp_add_write_queue_tail(sk, skb); 1202 - sk->sk_wmem_queued += skb->truesize; 1202 + sk_wmem_queued_add(sk, skb->truesize); 1203 1203 sk_mem_charge(sk, skb->truesize); 1204 1204 } 1205 1205 ··· 1333 1333 return -ENOMEM; /* We'll just try again later. */ 1334 1334 skb_copy_decrypted(buff, skb); 1335 1335 1336 - sk->sk_wmem_queued += buff->truesize; 1336 + sk_wmem_queued_add(sk, buff->truesize); 1337 1337 sk_mem_charge(sk, buff->truesize); 1338 1338 nlen = skb->len - len - nsize; 1339 1339 buff->truesize += nlen; ··· 1443 1443 1444 1444 if (delta_truesize) { 1445 1445 skb->truesize -= delta_truesize; 1446 - sk->sk_wmem_queued -= delta_truesize; 1446 + sk_wmem_queued_add(sk, -delta_truesize); 1447 1447 sk_mem_uncharge(sk, delta_truesize); 1448 1448 sock_set_flag(sk, SOCK_QUEUE_SHRUNK); 1449 1449 } ··· 1888 1888 return -ENOMEM; 1889 1889 skb_copy_decrypted(buff, skb); 1890 1890 1891 - sk->sk_wmem_queued += buff->truesize; 1891 + sk_wmem_queued_add(sk, buff->truesize); 1892 1892 sk_mem_charge(sk, buff->truesize); 1893 1893 buff->truesize += nlen; 1894 1894 skb->truesize -= nlen; ··· 2152 2152 nskb = sk_stream_alloc_skb(sk, probe_size, GFP_ATOMIC, false); 2153 2153 if (!nskb) 2154 2154 return -1; 2155 - sk->sk_wmem_queued += nskb->truesize; 2155 + sk_wmem_queued_add(sk, nskb->truesize); 2156 2156 sk_mem_charge(sk, nskb->truesize); 2157 2157 2158 2158 skb = tcp_send_head(sk); ··· 2482 2482 /* Don't do any loss probe on a Fast Open connection before 3WHS 2483 2483 * finishes. 2484 2484 */ 2485 - if (tp->fastopen_rsk) 2485 + if (rcu_access_pointer(tp->fastopen_rsk)) 2486 2486 return false; 2487 2487 2488 2488 early_retrans = sock_net(sk)->ipv4.sysctl_tcp_early_retrans; ··· 3142 3142 * if FIN had been sent. This is because retransmit path 3143 3143 * does not change tp->snd_nxt. 3144 3144 */ 3145 - tp->snd_nxt++; 3145 + WRITE_ONCE(tp->snd_nxt, tp->snd_nxt + 1); 3146 3146 return; 3147 3147 } 3148 3148 } else { ··· 3222 3222 tcp_rtx_queue_unlink_and_free(skb, sk); 3223 3223 __skb_header_release(nskb); 3224 3224 tcp_rbtree_insert(&sk->tcp_rtx_queue, nskb); 3225 - sk->sk_wmem_queued += nskb->truesize; 3225 + sk_wmem_queued_add(sk, nskb->truesize); 3226 3226 sk_mem_charge(sk, nskb->truesize); 3227 3227 skb = nskb; 3228 3228 } ··· 3426 3426 tp->snd_una = tp->write_seq; 3427 3427 tp->snd_sml = tp->write_seq; 3428 3428 tp->snd_up = tp->write_seq; 3429 - tp->snd_nxt = tp->write_seq; 3429 + WRITE_ONCE(tp->snd_nxt, tp->write_seq); 3430 3430 3431 3431 if (likely(!tp->repair)) 3432 3432 tp->rcv_nxt = 0; 3433 3433 else 3434 3434 tp->rcv_tstamp = tcp_jiffies32; 3435 3435 tp->rcv_wup = tp->rcv_nxt; 3436 - tp->copied_seq = tp->rcv_nxt; 3436 + WRITE_ONCE(tp->copied_seq, tp->rcv_nxt); 3437 3437 3438 3438 inet_csk(sk)->icsk_rto = tcp_timeout_init(sk); 3439 3439 inet_csk(sk)->icsk_retransmits = 0; ··· 3447 3447 3448 3448 tcb->end_seq += skb->len; 3449 3449 __skb_header_release(skb); 3450 - sk->sk_wmem_queued += skb->truesize; 3450 + sk_wmem_queued_add(sk, skb->truesize); 3451 3451 sk_mem_charge(sk, skb->truesize); 3452 - tp->write_seq = tcb->end_seq; 3452 + WRITE_ONCE(tp->write_seq, tcb->end_seq); 3453 3453 tp->packets_out += tcp_skb_pcount(skb); 3454 3454 } 3455 3455 ··· 3586 3586 /* We change tp->snd_nxt after the tcp_transmit_skb() call 3587 3587 * in order to make this packet get counted in tcpOutSegs. 3588 3588 */ 3589 - tp->snd_nxt = tp->write_seq; 3589 + WRITE_ONCE(tp->snd_nxt, tp->write_seq); 3590 3590 tp->pushed_seq = tp->write_seq; 3591 3591 buff = tcp_send_head(sk); 3592 3592 if (unlikely(buff)) { 3593 - tp->snd_nxt = TCP_SKB_CB(buff)->seq; 3593 + WRITE_ONCE(tp->snd_nxt, TCP_SKB_CB(buff)->seq); 3594 3594 tp->pushed_seq = TCP_SKB_CB(buff)->seq; 3595 3595 } 3596 3596 TCP_INC_STATS(sock_net(sk), TCP_MIB_ACTIVEOPENS);
+6 -5
net/ipv4/tcp_timer.c
··· 386 386 * Timer for Fast Open socket to retransmit SYNACK. Note that the 387 387 * sk here is the child socket, not the parent (listener) socket. 388 388 */ 389 - static void tcp_fastopen_synack_timer(struct sock *sk) 389 + static void tcp_fastopen_synack_timer(struct sock *sk, struct request_sock *req) 390 390 { 391 391 struct inet_connection_sock *icsk = inet_csk(sk); 392 392 int max_retries = icsk->icsk_syn_retries ? : 393 393 sock_net(sk)->ipv4.sysctl_tcp_synack_retries + 1; /* add one more retry for fastopen */ 394 394 struct tcp_sock *tp = tcp_sk(sk); 395 - struct request_sock *req; 396 395 397 - req = tcp_sk(sk)->fastopen_rsk; 398 396 req->rsk_ops->syn_ack_timeout(req); 399 397 400 398 if (req->num_timeout >= max_retries) { ··· 433 435 struct tcp_sock *tp = tcp_sk(sk); 434 436 struct net *net = sock_net(sk); 435 437 struct inet_connection_sock *icsk = inet_csk(sk); 438 + struct request_sock *req; 436 439 437 - if (tp->fastopen_rsk) { 440 + req = rcu_dereference_protected(tp->fastopen_rsk, 441 + lockdep_sock_is_held(sk)); 442 + if (req) { 438 443 WARN_ON_ONCE(sk->sk_state != TCP_SYN_RECV && 439 444 sk->sk_state != TCP_FIN_WAIT1); 440 - tcp_fastopen_synack_timer(sk); 445 + tcp_fastopen_synack_timer(sk, req); 441 446 /* Before we receive ACK to our SYN-ACK don't retransmit 442 447 * anything else (e.g., data or FIN segments). 443 448 */
+1
net/ipv6/ip6_gre.c
··· 2192 2192 { 2193 2193 ether_setup(dev); 2194 2194 2195 + dev->max_mtu = 0; 2195 2196 dev->netdev_ops = &ip6erspan_netdev_ops; 2196 2197 dev->needs_free_netdev = true; 2197 2198 dev->priv_destructor = ip6gre_dev_free;
+3
net/ipv6/ip6_output.c
··· 768 768 inet6_sk(skb->sk) : NULL; 769 769 struct ip6_frag_state state; 770 770 unsigned int mtu, hlen, nexthdr_offset; 771 + ktime_t tstamp = skb->tstamp; 771 772 int hroom, err = 0; 772 773 __be32 frag_id; 773 774 u8 *prevhdr, nexthdr = 0; ··· 856 855 if (iter.frag) 857 856 ip6_fraglist_prepare(skb, &iter); 858 857 858 + skb->tstamp = tstamp; 859 859 err = output(net, sk, skb); 860 860 if (!err) 861 861 IP6_INC_STATS(net, ip6_dst_idev(&rt->dst), ··· 915 913 /* 916 914 * Put this fragment into the sending queue. 917 915 */ 916 + frag->tstamp = tstamp; 918 917 err = output(net, sk, frag); 919 918 if (err) 920 919 goto fail;
+3
net/ipv6/netfilter.c
··· 119 119 struct sk_buff *)) 120 120 { 121 121 int frag_max_size = BR_INPUT_SKB_CB(skb)->frag_max_size; 122 + ktime_t tstamp = skb->tstamp; 122 123 struct ip6_frag_state state; 123 124 u8 *prevhdr, nexthdr = 0; 124 125 unsigned int mtu, hlen; ··· 184 183 if (iter.frag) 185 184 ip6_fraglist_prepare(skb, &iter); 186 185 186 + skb->tstamp = tstamp; 187 187 err = output(net, sk, data, skb); 188 188 if (err || !iter.frag) 189 189 break; ··· 217 215 goto blackhole; 218 216 } 219 217 218 + skb2->tstamp = tstamp; 220 219 err = output(net, sk, data, skb2); 221 220 if (err) 222 221 goto blackhole;
+10 -8
net/ipv6/tcp_ipv6.c
··· 215 215 !ipv6_addr_equal(&sk->sk_v6_daddr, &usin->sin6_addr)) { 216 216 tp->rx_opt.ts_recent = 0; 217 217 tp->rx_opt.ts_recent_stamp = 0; 218 - tp->write_seq = 0; 218 + WRITE_ONCE(tp->write_seq, 0); 219 219 } 220 220 221 221 sk->sk_v6_daddr = usin->sin6_addr; ··· 311 311 312 312 if (likely(!tp->repair)) { 313 313 if (!tp->write_seq) 314 - tp->write_seq = secure_tcpv6_seq(np->saddr.s6_addr32, 315 - sk->sk_v6_daddr.s6_addr32, 316 - inet->inet_sport, 317 - inet->inet_dport); 314 + WRITE_ONCE(tp->write_seq, 315 + secure_tcpv6_seq(np->saddr.s6_addr32, 316 + sk->sk_v6_daddr.s6_addr32, 317 + inet->inet_sport, 318 + inet->inet_dport)); 318 319 tp->tsoffset = secure_tcpv6_ts_off(sock_net(sk), 319 320 np->saddr.s6_addr32, 320 321 sk->sk_v6_daddr.s6_addr32); ··· 407 406 408 407 tp = tcp_sk(sk); 409 408 /* XXX (TFO) - tp->snd_una should be ISN (tcp_create_openreq_child() */ 410 - fastopen = tp->fastopen_rsk; 409 + fastopen = rcu_dereference(tp->fastopen_rsk); 411 410 snd_una = fastopen ? tcp_rsk(fastopen)->snt_isn : tp->snd_una; 412 411 if (sk->sk_state != TCP_LISTEN && 413 412 !between(seq, snd_una, tp->snd_nxt)) { ··· 1896 1895 /* Because we don't lock the socket, 1897 1896 * we might find a transient negative value. 1898 1897 */ 1899 - rx_queue = max_t(int, tp->rcv_nxt - tp->copied_seq, 0); 1898 + rx_queue = max_t(int, READ_ONCE(tp->rcv_nxt) - 1899 + READ_ONCE(tp->copied_seq), 0); 1900 1900 1901 1901 seq_printf(seq, 1902 1902 "%4d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X " ··· 1908 1906 dest->s6_addr32[0], dest->s6_addr32[1], 1909 1907 dest->s6_addr32[2], dest->s6_addr32[3], destp, 1910 1908 state, 1911 - tp->write_seq - tp->snd_una, 1909 + READ_ONCE(tp->write_seq) - tp->snd_una, 1912 1910 rx_queue, 1913 1911 timer_active, 1914 1912 jiffies_delta_to_clock_t(timer_expires - jiffies),
+20 -14
net/llc/af_llc.c
··· 113 113 * 114 114 * Send data via reliable llc2 connection. 115 115 * Returns 0 upon success, non-zero if action did not succeed. 116 + * 117 + * This function always consumes a reference to the skb. 116 118 */ 117 119 static int llc_ui_send_data(struct sock* sk, struct sk_buff *skb, int noblock) 118 120 { 119 121 struct llc_sock* llc = llc_sk(sk); 120 - int rc = 0; 121 122 122 123 if (unlikely(llc_data_accept_state(llc->state) || 123 124 llc->remote_busy_flag || 124 125 llc->p_flag)) { 125 126 long timeout = sock_sndtimeo(sk, noblock); 127 + int rc; 126 128 127 129 rc = llc_ui_wait_for_busy_core(sk, timeout); 130 + if (rc) { 131 + kfree_skb(skb); 132 + return rc; 133 + } 128 134 } 129 - if (unlikely(!rc)) 130 - rc = llc_build_and_send_pkt(sk, skb); 131 - return rc; 135 + return llc_build_and_send_pkt(sk, skb); 132 136 } 133 137 134 138 static void llc_ui_sk_init(struct socket *sock, struct sock *sk) ··· 903 899 DECLARE_SOCKADDR(struct sockaddr_llc *, addr, msg->msg_name); 904 900 int flags = msg->msg_flags; 905 901 int noblock = flags & MSG_DONTWAIT; 906 - struct sk_buff *skb; 902 + struct sk_buff *skb = NULL; 907 903 size_t size = 0; 908 904 int rc = -EINVAL, copied = 0, hdrlen; 909 905 ··· 912 908 lock_sock(sk); 913 909 if (addr) { 914 910 if (msg->msg_namelen < sizeof(*addr)) 915 - goto release; 911 + goto out; 916 912 } else { 917 913 if (llc_ui_addr_null(&llc->addr)) 918 - goto release; 914 + goto out; 919 915 addr = &llc->addr; 920 916 } 921 917 /* must bind connection to sap if user hasn't done it. */ ··· 923 919 /* bind to sap with null dev, exclusive. */ 924 920 rc = llc_ui_autobind(sock, addr); 925 921 if (rc) 926 - goto release; 922 + goto out; 927 923 } 928 924 hdrlen = llc->dev->hard_header_len + llc_ui_header_len(sk, addr); 929 925 size = hdrlen + len; ··· 932 928 copied = size - hdrlen; 933 929 rc = -EINVAL; 934 930 if (copied < 0) 935 - goto release; 931 + goto out; 936 932 release_sock(sk); 937 933 skb = sock_alloc_send_skb(sk, size, noblock, &rc); 938 934 lock_sock(sk); 939 935 if (!skb) 940 - goto release; 936 + goto out; 941 937 skb->dev = llc->dev; 942 938 skb->protocol = llc_proto_type(addr->sllc_arphrd); 943 939 skb_reserve(skb, hdrlen); ··· 947 943 if (sk->sk_type == SOCK_DGRAM || addr->sllc_ua) { 948 944 llc_build_and_send_ui_pkt(llc->sap, skb, addr->sllc_mac, 949 945 addr->sllc_sap); 946 + skb = NULL; 950 947 goto out; 951 948 } 952 949 if (addr->sllc_test) { 953 950 llc_build_and_send_test_pkt(llc->sap, skb, addr->sllc_mac, 954 951 addr->sllc_sap); 952 + skb = NULL; 955 953 goto out; 956 954 } 957 955 if (addr->sllc_xid) { 958 956 llc_build_and_send_xid_pkt(llc->sap, skb, addr->sllc_mac, 959 957 addr->sllc_sap); 958 + skb = NULL; 960 959 goto out; 961 960 } 962 961 rc = -ENOPROTOOPT; 963 962 if (!(sk->sk_type == SOCK_STREAM && !addr->sllc_ua)) 964 963 goto out; 965 964 rc = llc_ui_send_data(sk, skb, noblock); 965 + skb = NULL; 966 966 out: 967 - if (rc) { 968 - kfree_skb(skb); 969 - release: 967 + kfree_skb(skb); 968 + if (rc) 970 969 dprintk("%s: failed sending from %02X to %02X: %d\n", 971 970 __func__, llc->laddr.lsap, llc->daddr.lsap, rc); 972 - } 973 971 release_sock(sk); 974 972 return rc ? : copied; 975 973 }
+6 -2
net/llc/llc_c_ac.c
··· 372 372 llc_pdu_init_as_i_cmd(skb, 1, llc->vS, llc->vR); 373 373 rc = llc_mac_hdr_init(skb, llc->dev->dev_addr, llc->daddr.mac); 374 374 if (likely(!rc)) { 375 + skb_get(skb); 375 376 llc_conn_send_pdu(sk, skb); 376 377 llc_conn_ac_inc_vs_by_1(sk, skb); 377 378 } ··· 390 389 llc_pdu_init_as_i_cmd(skb, 0, llc->vS, llc->vR); 391 390 rc = llc_mac_hdr_init(skb, llc->dev->dev_addr, llc->daddr.mac); 392 391 if (likely(!rc)) { 393 - rc = llc_conn_send_pdu(sk, skb); 392 + skb_get(skb); 393 + llc_conn_send_pdu(sk, skb); 394 394 llc_conn_ac_inc_vs_by_1(sk, skb); 395 395 } 396 396 return rc; ··· 408 406 llc_pdu_init_as_i_cmd(skb, 0, llc->vS, llc->vR); 409 407 rc = llc_mac_hdr_init(skb, llc->dev->dev_addr, llc->daddr.mac); 410 408 if (likely(!rc)) { 409 + skb_get(skb); 411 410 llc_conn_send_pdu(sk, skb); 412 411 llc_conn_ac_inc_vs_by_1(sk, skb); 413 412 } ··· 919 916 llc_pdu_init_as_i_cmd(skb, llc->ack_pf, llc->vS, llc->vR); 920 917 rc = llc_mac_hdr_init(skb, llc->dev->dev_addr, llc->daddr.mac); 921 918 if (likely(!rc)) { 922 - rc = llc_conn_send_pdu(sk, skb); 919 + skb_get(skb); 920 + llc_conn_send_pdu(sk, skb); 923 921 llc_conn_ac_inc_vs_by_1(sk, skb); 924 922 } 925 923 return rc;
+18 -51
net/llc/llc_conn.c
··· 30 30 #endif 31 31 32 32 static int llc_find_offset(int state, int ev_type); 33 - static int llc_conn_send_pdus(struct sock *sk, struct sk_buff *skb); 33 + static void llc_conn_send_pdus(struct sock *sk); 34 34 static int llc_conn_service(struct sock *sk, struct sk_buff *skb); 35 35 static int llc_exec_conn_trans_actions(struct sock *sk, 36 36 struct llc_conn_state_trans *trans, ··· 55 55 * (executing it's actions and changing state), upper layer will be 56 56 * indicated or confirmed, if needed. Returns 0 for success, 1 for 57 57 * failure. The socket lock has to be held before calling this function. 58 + * 59 + * This function always consumes a reference to the skb. 58 60 */ 59 61 int llc_conn_state_process(struct sock *sk, struct sk_buff *skb) 60 62 { ··· 64 62 struct llc_sock *llc = llc_sk(skb->sk); 65 63 struct llc_conn_state_ev *ev = llc_conn_ev(skb); 66 64 67 - /* 68 - * We have to hold the skb, because llc_conn_service will kfree it in 69 - * the sending path and we need to look at the skb->cb, where we encode 70 - * llc_conn_state_ev. 71 - */ 72 - skb_get(skb); 73 65 ev->ind_prim = ev->cfm_prim = 0; 74 66 /* 75 67 * Send event to state machine ··· 71 75 rc = llc_conn_service(skb->sk, skb); 72 76 if (unlikely(rc != 0)) { 73 77 printk(KERN_ERR "%s: llc_conn_service failed\n", __func__); 74 - goto out_kfree_skb; 75 - } 76 - 77 - if (unlikely(!ev->ind_prim && !ev->cfm_prim)) { 78 - /* indicate or confirm not required */ 79 - if (!skb->next) 80 - goto out_kfree_skb; 81 78 goto out_skb_put; 82 79 } 83 80 84 - if (unlikely(ev->ind_prim && ev->cfm_prim)) /* Paranoia */ 85 - skb_get(skb); 86 - 87 81 switch (ev->ind_prim) { 88 82 case LLC_DATA_PRIM: 83 + skb_get(skb); 89 84 llc_save_primitive(sk, skb, LLC_DATA_PRIM); 90 85 if (unlikely(sock_queue_rcv_skb(sk, skb))) { 91 86 /* ··· 93 106 * skb->sk pointing to the newly created struct sock in 94 107 * llc_conn_handler. -acme 95 108 */ 109 + skb_get(skb); 96 110 skb_queue_tail(&sk->sk_receive_queue, skb); 97 111 sk->sk_state_change(sk); 98 112 break; ··· 109 121 sk->sk_state_change(sk); 110 122 } 111 123 } 112 - kfree_skb(skb); 113 124 sock_put(sk); 114 125 break; 115 126 case LLC_RESET_PRIM: ··· 117 130 * RESET is not being notified to upper layers for now 118 131 */ 119 132 printk(KERN_INFO "%s: received a reset ind!\n", __func__); 120 - kfree_skb(skb); 121 133 break; 122 134 default: 123 - if (ev->ind_prim) { 135 + if (ev->ind_prim) 124 136 printk(KERN_INFO "%s: received unknown %d prim!\n", 125 137 __func__, ev->ind_prim); 126 - kfree_skb(skb); 127 - } 128 138 /* No indication */ 129 139 break; 130 140 } ··· 163 179 printk(KERN_INFO "%s: received a reset conf!\n", __func__); 164 180 break; 165 181 default: 166 - if (ev->cfm_prim) { 182 + if (ev->cfm_prim) 167 183 printk(KERN_INFO "%s: received unknown %d prim!\n", 168 184 __func__, ev->cfm_prim); 169 - break; 170 - } 171 - goto out_skb_put; /* No confirmation */ 185 + /* No confirmation */ 186 + break; 172 187 } 173 - out_kfree_skb: 174 - kfree_skb(skb); 175 188 out_skb_put: 176 189 kfree_skb(skb); 177 190 return rc; 178 191 } 179 192 180 - int llc_conn_send_pdu(struct sock *sk, struct sk_buff *skb) 193 + void llc_conn_send_pdu(struct sock *sk, struct sk_buff *skb) 181 194 { 182 195 /* queue PDU to send to MAC layer */ 183 196 skb_queue_tail(&sk->sk_write_queue, skb); 184 - return llc_conn_send_pdus(sk, skb); 197 + llc_conn_send_pdus(sk); 185 198 } 186 199 187 200 /** ··· 236 255 if (howmany_resend > 0) 237 256 llc->vS = (llc->vS + 1) % LLC_2_SEQ_NBR_MODULO; 238 257 /* any PDUs to re-send are queued up; start sending to MAC */ 239 - llc_conn_send_pdus(sk, NULL); 258 + llc_conn_send_pdus(sk); 240 259 out:; 241 260 } 242 261 ··· 277 296 if (howmany_resend > 0) 278 297 llc->vS = (llc->vS + 1) % LLC_2_SEQ_NBR_MODULO; 279 298 /* any PDUs to re-send are queued up; start sending to MAC */ 280 - llc_conn_send_pdus(sk, NULL); 299 + llc_conn_send_pdus(sk); 281 300 out:; 282 301 } 283 302 ··· 321 340 /** 322 341 * llc_conn_send_pdus - Sends queued PDUs 323 342 * @sk: active connection 324 - * @hold_skb: the skb held by caller, or NULL if does not care 325 343 * 326 - * Sends queued pdus to MAC layer for transmission. When @hold_skb is 327 - * NULL, always return 0. Otherwise, return 0 if @hold_skb is sent 328 - * successfully, or 1 for failure. 344 + * Sends queued pdus to MAC layer for transmission. 329 345 */ 330 - static int llc_conn_send_pdus(struct sock *sk, struct sk_buff *hold_skb) 346 + static void llc_conn_send_pdus(struct sock *sk) 331 347 { 332 348 struct sk_buff *skb; 333 - int ret = 0; 334 349 335 350 while ((skb = skb_dequeue(&sk->sk_write_queue)) != NULL) { 336 351 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); ··· 338 361 skb_queue_tail(&llc_sk(sk)->pdu_unack_q, skb); 339 362 if (!skb2) 340 363 break; 341 - dev_queue_xmit(skb2); 342 - } else { 343 - bool is_target = skb == hold_skb; 344 - int rc; 345 - 346 - if (is_target) 347 - skb_get(skb); 348 - rc = dev_queue_xmit(skb); 349 - if (is_target) 350 - ret = rc; 364 + skb = skb2; 351 365 } 366 + dev_queue_xmit(skb); 352 367 } 353 - 354 - return ret; 355 368 } 356 369 357 370 /** ··· 813 846 else { 814 847 dprintk("%s: adding to backlog...\n", __func__); 815 848 llc_set_backlog_type(skb, LLC_PACKET); 816 - if (sk_add_backlog(sk, skb, sk->sk_rcvbuf)) 849 + if (sk_add_backlog(sk, skb, READ_ONCE(sk->sk_rcvbuf))) 817 850 goto drop_unlock; 818 851 } 819 852 out:
+8 -4
net/llc/llc_if.c
··· 38 38 * closed and -EBUSY when sending data is not permitted in this state or 39 39 * LLC has send an I pdu with p bit set to 1 and is waiting for it's 40 40 * response. 41 + * 42 + * This function always consumes a reference to the skb. 41 43 */ 42 44 int llc_build_and_send_pkt(struct sock *sk, struct sk_buff *skb) 43 45 { ··· 48 46 struct llc_sock *llc = llc_sk(sk); 49 47 50 48 if (unlikely(llc->state == LLC_CONN_STATE_ADM)) 51 - goto out; 49 + goto out_free; 52 50 rc = -EBUSY; 53 51 if (unlikely(llc_data_accept_state(llc->state) || /* data_conn_refuse */ 54 52 llc->p_flag)) { 55 53 llc->failed_data_req = 1; 56 - goto out; 54 + goto out_free; 57 55 } 58 56 ev = llc_conn_ev(skb); 59 57 ev->type = LLC_CONN_EV_TYPE_PRIM; 60 58 ev->prim = LLC_DATA_PRIM; 61 59 ev->prim_type = LLC_PRIM_TYPE_REQ; 62 60 skb->dev = llc->dev; 63 - rc = llc_conn_state_process(sk, skb); 64 - out: 61 + return llc_conn_state_process(sk, skb); 62 + 63 + out_free: 64 + kfree_skb(skb); 65 65 return rc; 66 66 } 67 67
+9 -3
net/llc/llc_s_ac.c
··· 58 58 ev->daddr.lsap, LLC_PDU_CMD); 59 59 llc_pdu_init_as_ui_cmd(skb); 60 60 rc = llc_mac_hdr_init(skb, ev->saddr.mac, ev->daddr.mac); 61 - if (likely(!rc)) 61 + if (likely(!rc)) { 62 + skb_get(skb); 62 63 rc = dev_queue_xmit(skb); 64 + } 63 65 return rc; 64 66 } 65 67 ··· 83 81 ev->daddr.lsap, LLC_PDU_CMD); 84 82 llc_pdu_init_as_xid_cmd(skb, LLC_XID_NULL_CLASS_2, 0); 85 83 rc = llc_mac_hdr_init(skb, ev->saddr.mac, ev->daddr.mac); 86 - if (likely(!rc)) 84 + if (likely(!rc)) { 85 + skb_get(skb); 87 86 rc = dev_queue_xmit(skb); 87 + } 88 88 return rc; 89 89 } 90 90 ··· 139 135 ev->daddr.lsap, LLC_PDU_CMD); 140 136 llc_pdu_init_as_test_cmd(skb); 141 137 rc = llc_mac_hdr_init(skb, ev->saddr.mac, ev->daddr.mac); 142 - if (likely(!rc)) 138 + if (likely(!rc)) { 139 + skb_get(skb); 143 140 rc = dev_queue_xmit(skb); 141 + } 144 142 return rc; 145 143 } 146 144
+8 -15
net/llc/llc_sap.c
··· 197 197 * After executing actions of the event, upper layer will be indicated 198 198 * if needed(on receiving an UI frame). sk can be null for the 199 199 * datalink_proto case. 200 + * 201 + * This function always consumes a reference to the skb. 200 202 */ 201 203 static void llc_sap_state_process(struct llc_sap *sap, struct sk_buff *skb) 202 204 { 203 205 struct llc_sap_state_ev *ev = llc_sap_ev(skb); 204 206 205 - /* 206 - * We have to hold the skb, because llc_sap_next_state 207 - * will kfree it in the sending path and we need to 208 - * look at the skb->cb, where we encode llc_sap_state_ev. 209 - */ 210 - skb_get(skb); 211 207 ev->ind_cfm_flag = 0; 212 208 llc_sap_next_state(sap, skb); 213 - if (ev->ind_cfm_flag == LLC_IND) { 214 - if (skb->sk->sk_state == TCP_LISTEN) 215 - kfree_skb(skb); 216 - else { 217 - llc_save_primitive(skb->sk, skb, ev->prim); 218 209 219 - /* queue skb to the user. */ 220 - if (sock_queue_rcv_skb(skb->sk, skb)) 221 - kfree_skb(skb); 222 - } 210 + if (ev->ind_cfm_flag == LLC_IND && skb->sk->sk_state != TCP_LISTEN) { 211 + llc_save_primitive(skb->sk, skb, ev->prim); 212 + 213 + /* queue skb to the user. */ 214 + if (sock_queue_rcv_skb(skb->sk, skb) == 0) 215 + return; 223 216 } 224 217 kfree_skb(skb); 225 218 }
+3 -2
net/mac80211/mlme.c
··· 2633 2633 2634 2634 rcu_read_lock(); 2635 2635 ssid = ieee80211_bss_get_ie(cbss, WLAN_EID_SSID); 2636 - if (WARN_ON_ONCE(ssid == NULL)) 2636 + if (WARN_ONCE(!ssid || ssid[1] > IEEE80211_MAX_SSID_LEN, 2637 + "invalid SSID element (len=%d)", ssid ? ssid[1] : -1)) 2637 2638 ssid_len = 0; 2638 2639 else 2639 2640 ssid_len = ssid[1]; ··· 5234 5233 5235 5234 rcu_read_lock(); 5236 5235 ssidie = ieee80211_bss_get_ie(req->bss, WLAN_EID_SSID); 5237 - if (!ssidie) { 5236 + if (!ssidie || ssidie[1] > sizeof(assoc_data->ssid)) { 5238 5237 rcu_read_unlock(); 5239 5238 kfree(assoc_data); 5240 5239 return -EINVAL;
+10 -1
net/mac80211/rx.c
··· 3467 3467 case cpu_to_le16(IEEE80211_STYPE_PROBE_RESP): 3468 3468 /* process for all: mesh, mlme, ibss */ 3469 3469 break; 3470 + case cpu_to_le16(IEEE80211_STYPE_DEAUTH): 3471 + if (is_multicast_ether_addr(mgmt->da) && 3472 + !is_broadcast_ether_addr(mgmt->da)) 3473 + return RX_DROP_MONITOR; 3474 + 3475 + /* process only for station/IBSS */ 3476 + if (sdata->vif.type != NL80211_IFTYPE_STATION && 3477 + sdata->vif.type != NL80211_IFTYPE_ADHOC) 3478 + return RX_DROP_MONITOR; 3479 + break; 3470 3480 case cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP): 3471 3481 case cpu_to_le16(IEEE80211_STYPE_REASSOC_RESP): 3472 - case cpu_to_le16(IEEE80211_STYPE_DEAUTH): 3473 3482 case cpu_to_le16(IEEE80211_STYPE_DISASSOC): 3474 3483 if (is_multicast_ether_addr(mgmt->da) && 3475 3484 !is_broadcast_ether_addr(mgmt->da))
+28 -2
net/mac80211/scan.c
··· 520 520 return 0; 521 521 } 522 522 523 + static bool __ieee80211_can_leave_ch(struct ieee80211_sub_if_data *sdata) 524 + { 525 + struct ieee80211_local *local = sdata->local; 526 + struct ieee80211_sub_if_data *sdata_iter; 527 + 528 + if (!ieee80211_is_radar_required(local)) 529 + return true; 530 + 531 + if (!regulatory_pre_cac_allowed(local->hw.wiphy)) 532 + return false; 533 + 534 + mutex_lock(&local->iflist_mtx); 535 + list_for_each_entry(sdata_iter, &local->interfaces, list) { 536 + if (sdata_iter->wdev.cac_started) { 537 + mutex_unlock(&local->iflist_mtx); 538 + return false; 539 + } 540 + } 541 + mutex_unlock(&local->iflist_mtx); 542 + 543 + return true; 544 + } 545 + 523 546 static bool ieee80211_can_scan(struct ieee80211_local *local, 524 547 struct ieee80211_sub_if_data *sdata) 525 548 { 526 - if (ieee80211_is_radar_required(local)) 549 + if (!__ieee80211_can_leave_ch(sdata)) 527 550 return false; 528 551 529 552 if (!list_empty(&local->roc_list)) ··· 653 630 654 631 lockdep_assert_held(&local->mtx); 655 632 656 - if (local->scan_req || ieee80211_is_radar_required(local)) 633 + if (local->scan_req) 634 + return -EBUSY; 635 + 636 + if (!__ieee80211_can_leave_ch(sdata)) 657 637 return -EBUSY; 658 638 659 639 if (!ieee80211_can_scan(local, sdata)) {
+2 -2
net/netfilter/nf_conntrack_core.c
··· 1792 1792 if (nf_ct_is_confirmed(ct)) 1793 1793 extra_jiffies += nfct_time_stamp; 1794 1794 1795 - if (ct->timeout != extra_jiffies) 1796 - ct->timeout = extra_jiffies; 1795 + if (READ_ONCE(ct->timeout) != extra_jiffies) 1796 + WRITE_ONCE(ct->timeout, extra_jiffies); 1797 1797 acct: 1798 1798 if (do_acct) 1799 1799 nf_ct_acct_update(ct, ctinfo, skb->len);
+3 -2
net/openvswitch/actions.c
··· 165 165 { 166 166 int err; 167 167 168 - err = skb_mpls_push(skb, mpls->mpls_lse, mpls->mpls_ethertype); 168 + err = skb_mpls_push(skb, mpls->mpls_lse, mpls->mpls_ethertype, 169 + skb->mac_len); 169 170 if (err) 170 171 return err; 171 172 ··· 179 178 { 180 179 int err; 181 180 182 - err = skb_mpls_pop(skb, ethertype); 181 + err = skb_mpls_pop(skb, ethertype, skb->mac_len); 183 182 if (err) 184 183 return err; 185 184
+1
net/rxrpc/ar-internal.h
··· 556 556 struct rxrpc_peer *peer; /* Peer record for remote address */ 557 557 struct rxrpc_sock __rcu *socket; /* socket responsible */ 558 558 struct rxrpc_net *rxnet; /* Network namespace to which call belongs */ 559 + const struct rxrpc_security *security; /* applied security module */ 559 560 struct mutex user_mutex; /* User access mutex */ 560 561 unsigned long ack_at; /* When deferred ACK needs to happen */ 561 562 unsigned long ack_lost_at; /* When ACK is figured as lost */
+3 -2
net/rxrpc/call_accept.c
··· 84 84 smp_store_release(&b->conn_backlog_head, 85 85 (head + 1) & (size - 1)); 86 86 87 - trace_rxrpc_conn(conn, rxrpc_conn_new_service, 87 + trace_rxrpc_conn(conn->debug_id, rxrpc_conn_new_service, 88 88 atomic_read(&conn->usage), here); 89 89 } 90 90 ··· 97 97 call->flags |= (1 << RXRPC_CALL_IS_SERVICE); 98 98 call->state = RXRPC_CALL_SERVER_PREALLOC; 99 99 100 - trace_rxrpc_call(call, rxrpc_call_new_service, 100 + trace_rxrpc_call(call->debug_id, rxrpc_call_new_service, 101 101 atomic_read(&call->usage), 102 102 here, (const void *)user_call_ID); 103 103 ··· 307 307 308 308 rxrpc_see_call(call); 309 309 call->conn = conn; 310 + call->security = conn->security; 310 311 call->peer = rxrpc_get_peer(conn->params.peer); 311 312 call->cong_cwnd = call->peer->cong_cwnd; 312 313 return call;
+20 -14
net/rxrpc/call_object.c
··· 240 240 if (p->intr) 241 241 __set_bit(RXRPC_CALL_IS_INTR, &call->flags); 242 242 call->tx_total_len = p->tx_total_len; 243 - trace_rxrpc_call(call, rxrpc_call_new_client, atomic_read(&call->usage), 243 + trace_rxrpc_call(call->debug_id, rxrpc_call_new_client, 244 + atomic_read(&call->usage), 244 245 here, (const void *)p->user_call_ID); 245 246 246 247 /* We need to protect a partially set up call against the user as we ··· 291 290 if (ret < 0) 292 291 goto error; 293 292 294 - trace_rxrpc_call(call, rxrpc_call_connected, atomic_read(&call->usage), 295 - here, NULL); 293 + trace_rxrpc_call(call->debug_id, rxrpc_call_connected, 294 + atomic_read(&call->usage), here, NULL); 296 295 297 296 rxrpc_start_call_timer(call); 298 297 ··· 314 313 error: 315 314 __rxrpc_set_call_completion(call, RXRPC_CALL_LOCAL_ERROR, 316 315 RX_CALL_DEAD, ret); 317 - trace_rxrpc_call(call, rxrpc_call_error, atomic_read(&call->usage), 318 - here, ERR_PTR(ret)); 316 + trace_rxrpc_call(call->debug_id, rxrpc_call_error, 317 + atomic_read(&call->usage), here, ERR_PTR(ret)); 319 318 rxrpc_release_call(rx, call); 320 319 mutex_unlock(&call->user_mutex); 321 320 rxrpc_put_call(call, rxrpc_call_put); ··· 377 376 if (n == 0) 378 377 return false; 379 378 if (rxrpc_queue_work(&call->processor)) 380 - trace_rxrpc_call(call, rxrpc_call_queued, n + 1, here, NULL); 379 + trace_rxrpc_call(call->debug_id, rxrpc_call_queued, n + 1, 380 + here, NULL); 381 381 else 382 382 rxrpc_put_call(call, rxrpc_call_put_noqueue); 383 383 return true; ··· 393 391 int n = atomic_read(&call->usage); 394 392 ASSERTCMP(n, >=, 1); 395 393 if (rxrpc_queue_work(&call->processor)) 396 - trace_rxrpc_call(call, rxrpc_call_queued_ref, n, here, NULL); 394 + trace_rxrpc_call(call->debug_id, rxrpc_call_queued_ref, n, 395 + here, NULL); 397 396 else 398 397 rxrpc_put_call(call, rxrpc_call_put_noqueue); 399 398 return true; ··· 409 406 if (call) { 410 407 int n = atomic_read(&call->usage); 411 408 412 - trace_rxrpc_call(call, rxrpc_call_seen, n, here, NULL); 409 + trace_rxrpc_call(call->debug_id, rxrpc_call_seen, n, 410 + here, NULL); 413 411 } 414 412 } 415 413 ··· 422 418 const void *here = __builtin_return_address(0); 423 419 int n = atomic_inc_return(&call->usage); 424 420 425 - trace_rxrpc_call(call, op, n, here, NULL); 421 + trace_rxrpc_call(call->debug_id, op, n, here, NULL); 426 422 } 427 423 428 424 /* ··· 449 445 450 446 _enter("{%d,%d}", call->debug_id, atomic_read(&call->usage)); 451 447 452 - trace_rxrpc_call(call, rxrpc_call_release, atomic_read(&call->usage), 448 + trace_rxrpc_call(call->debug_id, rxrpc_call_release, 449 + atomic_read(&call->usage), 453 450 here, (const void *)call->flags); 454 451 455 452 ASSERTCMP(call->state, ==, RXRPC_CALL_COMPLETE); ··· 493 488 494 489 _debug("RELEASE CALL %p (%d CONN %p)", call, call->debug_id, conn); 495 490 496 - if (conn) { 491 + if (conn) 497 492 rxrpc_disconnect_call(call); 498 - conn->security->free_call_crypto(call); 499 - } 493 + if (call->security) 494 + call->security->free_call_crypto(call); 500 495 501 496 rxrpc_cleanup_ring(call); 502 497 _leave(""); ··· 539 534 { 540 535 struct rxrpc_net *rxnet = call->rxnet; 541 536 const void *here = __builtin_return_address(0); 537 + unsigned int debug_id = call->debug_id; 542 538 int n; 543 539 544 540 ASSERT(call != NULL); 545 541 546 542 n = atomic_dec_return(&call->usage); 547 - trace_rxrpc_call(call, op, n, here, NULL); 543 + trace_rxrpc_call(debug_id, op, n, here, NULL); 548 544 ASSERTCMP(n, >=, 0); 549 545 if (n == 0) { 550 546 _debug("call %d dead", call->debug_id);
+7 -2
net/rxrpc/conn_client.c
··· 212 212 rxrpc_get_local(conn->params.local); 213 213 key_get(conn->params.key); 214 214 215 - trace_rxrpc_conn(conn, rxrpc_conn_new_client, atomic_read(&conn->usage), 215 + trace_rxrpc_conn(conn->debug_id, rxrpc_conn_new_client, 216 + atomic_read(&conn->usage), 216 217 __builtin_return_address(0)); 217 218 trace_rxrpc_client(conn, -1, rxrpc_client_alloc); 218 219 _leave(" = %p", conn); ··· 353 352 354 353 if (cp->exclusive) { 355 354 call->conn = candidate; 355 + call->security = candidate->security; 356 356 call->security_ix = candidate->security_ix; 357 357 call->service_id = candidate->service_id; 358 358 _leave(" = 0 [exclusive %d]", candidate->debug_id); ··· 405 403 candidate_published: 406 404 set_bit(RXRPC_CONN_IN_CLIENT_CONNS, &candidate->flags); 407 405 call->conn = candidate; 406 + call->security = candidate->security; 408 407 call->security_ix = candidate->security_ix; 409 408 call->service_id = candidate->service_id; 410 409 spin_unlock(&local->client_conns_lock); ··· 428 425 429 426 spin_lock(&conn->channel_lock); 430 427 call->conn = conn; 428 + call->security = conn->security; 431 429 call->security_ix = conn->security_ix; 432 430 call->service_id = conn->service_id; 433 431 list_add_tail(&call->chan_wait_link, &conn->waiting_calls); ··· 989 985 void rxrpc_put_client_conn(struct rxrpc_connection *conn) 990 986 { 991 987 const void *here = __builtin_return_address(0); 988 + unsigned int debug_id = conn->debug_id; 992 989 int n; 993 990 994 991 do { 995 992 n = atomic_dec_return(&conn->usage); 996 - trace_rxrpc_conn(conn, rxrpc_conn_put_client, n, here); 993 + trace_rxrpc_conn(debug_id, rxrpc_conn_put_client, n, here); 997 994 if (n > 0) 998 995 return; 999 996 ASSERTCMP(n, >=, 0);
+7 -6
net/rxrpc/conn_object.c
··· 269 269 if (n == 0) 270 270 return false; 271 271 if (rxrpc_queue_work(&conn->processor)) 272 - trace_rxrpc_conn(conn, rxrpc_conn_queued, n + 1, here); 272 + trace_rxrpc_conn(conn->debug_id, rxrpc_conn_queued, n + 1, here); 273 273 else 274 274 rxrpc_put_connection(conn); 275 275 return true; ··· 284 284 if (conn) { 285 285 int n = atomic_read(&conn->usage); 286 286 287 - trace_rxrpc_conn(conn, rxrpc_conn_seen, n, here); 287 + trace_rxrpc_conn(conn->debug_id, rxrpc_conn_seen, n, here); 288 288 } 289 289 } 290 290 ··· 296 296 const void *here = __builtin_return_address(0); 297 297 int n = atomic_inc_return(&conn->usage); 298 298 299 - trace_rxrpc_conn(conn, rxrpc_conn_got, n, here); 299 + trace_rxrpc_conn(conn->debug_id, rxrpc_conn_got, n, here); 300 300 } 301 301 302 302 /* ··· 310 310 if (conn) { 311 311 int n = atomic_fetch_add_unless(&conn->usage, 1, 0); 312 312 if (n > 0) 313 - trace_rxrpc_conn(conn, rxrpc_conn_got, n + 1, here); 313 + trace_rxrpc_conn(conn->debug_id, rxrpc_conn_got, n + 1, here); 314 314 else 315 315 conn = NULL; 316 316 } ··· 333 333 void rxrpc_put_service_conn(struct rxrpc_connection *conn) 334 334 { 335 335 const void *here = __builtin_return_address(0); 336 + unsigned int debug_id = conn->debug_id; 336 337 int n; 337 338 338 339 n = atomic_dec_return(&conn->usage); 339 - trace_rxrpc_conn(conn, rxrpc_conn_put_service, n, here); 340 + trace_rxrpc_conn(debug_id, rxrpc_conn_put_service, n, here); 340 341 ASSERTCMP(n, >=, 0); 341 342 if (n == 1) 342 343 rxrpc_set_service_reap_timer(conn->params.local->rxnet, ··· 421 420 */ 422 421 if (atomic_cmpxchg(&conn->usage, 1, 0) != 1) 423 422 continue; 424 - trace_rxrpc_conn(conn, rxrpc_conn_reap_service, 0, NULL); 423 + trace_rxrpc_conn(conn->debug_id, rxrpc_conn_reap_service, 0, NULL); 425 424 426 425 if (rxrpc_conn_is_client(conn)) 427 426 BUG();
+1 -1
net/rxrpc/conn_service.c
··· 134 134 list_add_tail(&conn->proc_link, &rxnet->conn_proc_list); 135 135 write_unlock(&rxnet->conn_lock); 136 136 137 - trace_rxrpc_conn(conn, rxrpc_conn_new_service, 137 + trace_rxrpc_conn(conn->debug_id, rxrpc_conn_new_service, 138 138 atomic_read(&conn->usage), 139 139 __builtin_return_address(0)); 140 140 }
+9 -2
net/rxrpc/peer_event.c
··· 147 147 { 148 148 struct sock_exterr_skb *serr; 149 149 struct sockaddr_rxrpc srx; 150 - struct rxrpc_local *local = sk->sk_user_data; 150 + struct rxrpc_local *local; 151 151 struct rxrpc_peer *peer; 152 152 struct sk_buff *skb; 153 153 154 + rcu_read_lock(); 155 + local = rcu_dereference_sk_user_data(sk); 156 + if (unlikely(!local)) { 157 + rcu_read_unlock(); 158 + return; 159 + } 154 160 _enter("%p{%d}", sk, local->debug_id); 155 161 156 162 /* Clear the outstanding error value on the socket so that it doesn't ··· 166 160 167 161 skb = sock_dequeue_err_skb(sk); 168 162 if (!skb) { 163 + rcu_read_unlock(); 169 164 _leave("UDP socket errqueue empty"); 170 165 return; 171 166 } ··· 174 167 serr = SKB_EXT_ERR(skb); 175 168 if (!skb->len && serr->ee.ee_origin == SO_EE_ORIGIN_TIMESTAMPING) { 176 169 _leave("UDP empty message"); 170 + rcu_read_unlock(); 177 171 rxrpc_free_skb(skb, rxrpc_skb_freed); 178 172 return; 179 173 } 180 174 181 - rcu_read_lock(); 182 175 peer = rxrpc_lookup_peer_icmp_rcu(local, skb, &srx); 183 176 if (peer && !rxrpc_get_peer_maybe(peer)) 184 177 peer = NULL;
+10 -6
net/rxrpc/peer_object.c
··· 216 216 peer = kzalloc(sizeof(struct rxrpc_peer), gfp); 217 217 if (peer) { 218 218 atomic_set(&peer->usage, 1); 219 - peer->local = local; 219 + peer->local = rxrpc_get_local(local); 220 220 INIT_HLIST_HEAD(&peer->error_targets); 221 221 peer->service_conns = RB_ROOT; 222 222 seqlock_init(&peer->service_conn_lock); ··· 307 307 unsigned long hash_key; 308 308 309 309 hash_key = rxrpc_peer_hash_key(local, &peer->srx); 310 - peer->local = local; 311 310 rxrpc_init_peer(rx, peer, hash_key); 312 311 313 312 spin_lock(&rxnet->peer_hash_lock); ··· 381 382 int n; 382 383 383 384 n = atomic_inc_return(&peer->usage); 384 - trace_rxrpc_peer(peer, rxrpc_peer_got, n, here); 385 + trace_rxrpc_peer(peer->debug_id, rxrpc_peer_got, n, here); 385 386 return peer; 386 387 } 387 388 ··· 395 396 if (peer) { 396 397 int n = atomic_fetch_add_unless(&peer->usage, 1, 0); 397 398 if (n > 0) 398 - trace_rxrpc_peer(peer, rxrpc_peer_got, n + 1, here); 399 + trace_rxrpc_peer(peer->debug_id, rxrpc_peer_got, n + 1, here); 399 400 else 400 401 peer = NULL; 401 402 } ··· 416 417 list_del_init(&peer->keepalive_link); 417 418 spin_unlock_bh(&rxnet->peer_hash_lock); 418 419 420 + rxrpc_put_local(peer->local); 419 421 kfree_rcu(peer, rcu); 420 422 } 421 423 ··· 426 426 void rxrpc_put_peer(struct rxrpc_peer *peer) 427 427 { 428 428 const void *here = __builtin_return_address(0); 429 + unsigned int debug_id; 429 430 int n; 430 431 431 432 if (peer) { 433 + debug_id = peer->debug_id; 432 434 n = atomic_dec_return(&peer->usage); 433 - trace_rxrpc_peer(peer, rxrpc_peer_put, n, here); 435 + trace_rxrpc_peer(debug_id, rxrpc_peer_put, n, here); 434 436 if (n == 0) 435 437 __rxrpc_put_peer(peer); 436 438 } ··· 445 443 void rxrpc_put_peer_locked(struct rxrpc_peer *peer) 446 444 { 447 445 const void *here = __builtin_return_address(0); 446 + unsigned int debug_id = peer->debug_id; 448 447 int n; 449 448 450 449 n = atomic_dec_return(&peer->usage); 451 - trace_rxrpc_peer(peer, rxrpc_peer_put, n, here); 450 + trace_rxrpc_peer(debug_id, rxrpc_peer_put, n, here); 452 451 if (n == 0) { 453 452 hash_del_rcu(&peer->hash_link); 454 453 list_del_init(&peer->keepalive_link); 454 + rxrpc_put_local(peer->local); 455 455 kfree_rcu(peer, rcu); 456 456 } 457 457 }
+3 -3
net/rxrpc/recvmsg.c
··· 251 251 seq += subpacket; 252 252 } 253 253 254 - return call->conn->security->verify_packet(call, skb, offset, len, 255 - seq, cksum); 254 + return call->security->verify_packet(call, skb, offset, len, 255 + seq, cksum); 256 256 } 257 257 258 258 /* ··· 291 291 292 292 *_offset = offset; 293 293 *_len = len; 294 - call->conn->security->locate_data(call, skb, _offset, _len); 294 + call->security->locate_data(call, skb, _offset, _len); 295 295 return 0; 296 296 } 297 297
+2 -1
net/rxrpc/sendmsg.c
··· 419 419 call->tx_winsize) 420 420 sp->hdr.flags |= RXRPC_MORE_PACKETS; 421 421 422 - ret = conn->security->secure_packet( 422 + ret = call->security->secure_packet( 423 423 call, skb, skb->mark, skb->head); 424 424 if (ret < 0) 425 425 goto out; ··· 661 661 case RXRPC_CALL_SERVER_PREALLOC: 662 662 case RXRPC_CALL_SERVER_SECURING: 663 663 case RXRPC_CALL_SERVER_ACCEPTING: 664 + rxrpc_put_call(call, rxrpc_call_put); 664 665 ret = -EBUSY; 665 666 goto error_release_sock; 666 667 default:
+13 -10
net/sched/act_api.c
··· 832 832 } 833 833 834 834 static const struct nla_policy tcf_action_policy[TCA_ACT_MAX + 1] = { 835 - [TCA_ACT_KIND] = { .type = NLA_NUL_STRING, 836 - .len = IFNAMSIZ - 1 }, 835 + [TCA_ACT_KIND] = { .type = NLA_STRING }, 837 836 [TCA_ACT_INDEX] = { .type = NLA_U32 }, 838 837 [TCA_ACT_COOKIE] = { .type = NLA_BINARY, 839 838 .len = TC_COOKIE_MAX_SIZE }, ··· 864 865 NL_SET_ERR_MSG(extack, "TC action kind must be specified"); 865 866 goto err_out; 866 867 } 867 - nla_strlcpy(act_name, kind, IFNAMSIZ); 868 - 868 + if (nla_strlcpy(act_name, kind, IFNAMSIZ) >= IFNAMSIZ) { 869 + NL_SET_ERR_MSG(extack, "TC action name too long"); 870 + goto err_out; 871 + } 869 872 if (tb[TCA_ACT_COOKIE]) { 870 873 cookie = nla_memdup_cookie(tb); 871 874 if (!cookie) { ··· 1353 1352 struct netlink_ext_ack *extack) 1354 1353 { 1355 1354 size_t attr_size = 0; 1356 - int ret = 0; 1355 + int loop, ret; 1357 1356 struct tc_action *actions[TCA_ACT_MAX_PRIO] = {}; 1358 1357 1359 - ret = tcf_action_init(net, NULL, nla, NULL, NULL, ovr, 0, actions, 1360 - &attr_size, true, extack); 1358 + for (loop = 0; loop < 10; loop++) { 1359 + ret = tcf_action_init(net, NULL, nla, NULL, NULL, ovr, 0, 1360 + actions, &attr_size, true, extack); 1361 + if (ret != -EAGAIN) 1362 + break; 1363 + } 1364 + 1361 1365 if (ret < 0) 1362 1366 return ret; 1363 1367 ret = tcf_add_notify(net, n, actions, portid, attr_size, extack); ··· 1412 1406 */ 1413 1407 if (n->nlmsg_flags & NLM_F_REPLACE) 1414 1408 ovr = 1; 1415 - replay: 1416 1409 ret = tcf_action_add(net, tca[TCA_ACT_TAB], n, portid, ovr, 1417 1410 extack); 1418 - if (ret == -EAGAIN) 1419 - goto replay; 1420 1411 break; 1421 1412 case RTM_DELACTION: 1422 1413 ret = tca_action_gd(net, tca[TCA_ACT_TAB], n,
+5 -1
net/sched/act_mirred.c
··· 484 484 return err; 485 485 486 486 pr_info("Mirror/redirect action on\n"); 487 - return tcf_register_action(&act_mirred_ops, &mirred_net_ops); 487 + err = tcf_register_action(&act_mirred_ops, &mirred_net_ops); 488 + if (err) 489 + unregister_netdevice_notifier(&mirred_device_notifier); 490 + 491 + return err; 488 492 } 489 493 490 494 static void __exit mirred_cleanup_module(void)
+8 -4
net/sched/act_mpls.c
··· 55 55 struct tcf_mpls *m = to_mpls(a); 56 56 struct tcf_mpls_params *p; 57 57 __be32 new_lse; 58 - int ret; 58 + int ret, mac_len; 59 59 60 60 tcf_lastuse_update(&m->tcf_tm); 61 61 bstats_cpu_update(this_cpu_ptr(m->common.cpu_bstats), skb); ··· 63 63 /* Ensure 'data' points at mac_header prior calling mpls manipulating 64 64 * functions. 65 65 */ 66 - if (skb_at_tc_ingress(skb)) 66 + if (skb_at_tc_ingress(skb)) { 67 67 skb_push_rcsum(skb, skb->mac_len); 68 + mac_len = skb->mac_len; 69 + } else { 70 + mac_len = skb_network_header(skb) - skb_mac_header(skb); 71 + } 68 72 69 73 ret = READ_ONCE(m->tcf_action); 70 74 ··· 76 72 77 73 switch (p->tcfm_action) { 78 74 case TCA_MPLS_ACT_POP: 79 - if (skb_mpls_pop(skb, p->tcfm_proto)) 75 + if (skb_mpls_pop(skb, p->tcfm_proto, mac_len)) 80 76 goto drop; 81 77 break; 82 78 case TCA_MPLS_ACT_PUSH: 83 79 new_lse = tcf_mpls_get_lse(NULL, p, !eth_p_mpls(skb->protocol)); 84 - if (skb_mpls_push(skb, new_lse, p->tcfm_proto)) 80 + if (skb_mpls_push(skb, new_lse, p->tcfm_proto, mac_len)) 85 81 goto drop; 86 82 break; 87 83 case TCA_MPLS_ACT_MODIFY:
+33 -3
net/sched/cls_api.c
··· 162 162 return TC_H_MAJ(first); 163 163 } 164 164 165 + static bool tcf_proto_check_kind(struct nlattr *kind, char *name) 166 + { 167 + if (kind) 168 + return nla_strlcpy(name, kind, IFNAMSIZ) >= IFNAMSIZ; 169 + memset(name, 0, IFNAMSIZ); 170 + return false; 171 + } 172 + 165 173 static bool tcf_proto_is_unlocked(const char *kind) 166 174 { 167 175 const struct tcf_proto_ops *ops; 168 176 bool ret; 177 + 178 + if (strlen(kind) == 0) 179 + return false; 169 180 170 181 ops = tcf_proto_lookup_ops(kind, false, NULL); 171 182 /* On error return false to take rtnl lock. Proto lookup/create ··· 1854 1843 { 1855 1844 struct net *net = sock_net(skb->sk); 1856 1845 struct nlattr *tca[TCA_MAX + 1]; 1846 + char name[IFNAMSIZ]; 1857 1847 struct tcmsg *t; 1858 1848 u32 protocol; 1859 1849 u32 prio; ··· 1911 1899 if (err) 1912 1900 return err; 1913 1901 1902 + if (tcf_proto_check_kind(tca[TCA_KIND], name)) { 1903 + NL_SET_ERR_MSG(extack, "Specified TC filter name too long"); 1904 + err = -EINVAL; 1905 + goto errout; 1906 + } 1907 + 1914 1908 /* Take rtnl mutex if rtnl_held was set to true on previous iteration, 1915 1909 * block is shared (no qdisc found), qdisc is not unlocked, classifier 1916 1910 * type is not specified, classifier is not unlocked. 1917 1911 */ 1918 1912 if (rtnl_held || 1919 1913 (q && !(q->ops->cl_ops->flags & QDISC_CLASS_OPS_DOIT_UNLOCKED)) || 1920 - !tca[TCA_KIND] || !tcf_proto_is_unlocked(nla_data(tca[TCA_KIND]))) { 1914 + !tcf_proto_is_unlocked(name)) { 1921 1915 rtnl_held = true; 1922 1916 rtnl_lock(); 1923 1917 } ··· 2081 2063 { 2082 2064 struct net *net = sock_net(skb->sk); 2083 2065 struct nlattr *tca[TCA_MAX + 1]; 2066 + char name[IFNAMSIZ]; 2084 2067 struct tcmsg *t; 2085 2068 u32 protocol; 2086 2069 u32 prio; ··· 2121 2102 if (err) 2122 2103 return err; 2123 2104 2105 + if (tcf_proto_check_kind(tca[TCA_KIND], name)) { 2106 + NL_SET_ERR_MSG(extack, "Specified TC filter name too long"); 2107 + err = -EINVAL; 2108 + goto errout; 2109 + } 2124 2110 /* Take rtnl mutex if flushing whole chain, block is shared (no qdisc 2125 2111 * found), qdisc is not unlocked, classifier type is not specified, 2126 2112 * classifier is not unlocked. 2127 2113 */ 2128 2114 if (!prio || 2129 2115 (q && !(q->ops->cl_ops->flags & QDISC_CLASS_OPS_DOIT_UNLOCKED)) || 2130 - !tca[TCA_KIND] || !tcf_proto_is_unlocked(nla_data(tca[TCA_KIND]))) { 2116 + !tcf_proto_is_unlocked(name)) { 2131 2117 rtnl_held = true; 2132 2118 rtnl_lock(); 2133 2119 } ··· 2240 2216 { 2241 2217 struct net *net = sock_net(skb->sk); 2242 2218 struct nlattr *tca[TCA_MAX + 1]; 2219 + char name[IFNAMSIZ]; 2243 2220 struct tcmsg *t; 2244 2221 u32 protocol; 2245 2222 u32 prio; ··· 2277 2252 if (err) 2278 2253 return err; 2279 2254 2255 + if (tcf_proto_check_kind(tca[TCA_KIND], name)) { 2256 + NL_SET_ERR_MSG(extack, "Specified TC filter name too long"); 2257 + err = -EINVAL; 2258 + goto errout; 2259 + } 2280 2260 /* Take rtnl mutex if block is shared (no qdisc found), qdisc is not 2281 2261 * unlocked, classifier type is not specified, classifier is not 2282 2262 * unlocked. 2283 2263 */ 2284 2264 if ((q && !(q->ops->cl_ops->flags & QDISC_CLASS_OPS_DOIT_UNLOCKED)) || 2285 - !tca[TCA_KIND] || !tcf_proto_is_unlocked(nla_data(tca[TCA_KIND]))) { 2265 + !tcf_proto_is_unlocked(name)) { 2286 2266 rtnl_held = true; 2287 2267 rtnl_lock(); 2288 2268 }
+2 -2
net/sched/em_meta.c
··· 446 446 *err = -1; 447 447 return; 448 448 } 449 - dst->value = sk->sk_wmem_queued; 449 + dst->value = READ_ONCE(sk->sk_wmem_queued); 450 450 } 451 451 452 452 META_COLLECTOR(int_sk_fwd_alloc) ··· 554 554 *err = -1; 555 555 return; 556 556 } 557 - dst->value = sk->sk_rcvlowat; 557 + dst->value = READ_ONCE(sk->sk_rcvlowat); 558 558 } 559 559 560 560 META_COLLECTOR(int_sk_rcvtimeo)
+1 -2
net/sched/sch_api.c
··· 1390 1390 } 1391 1391 1392 1392 const struct nla_policy rtm_tca_policy[TCA_MAX + 1] = { 1393 - [TCA_KIND] = { .type = NLA_NUL_STRING, 1394 - .len = IFNAMSIZ - 1 }, 1393 + [TCA_KIND] = { .type = NLA_STRING }, 1395 1394 [TCA_RATE] = { .type = NLA_BINARY, 1396 1395 .len = sizeof(struct tc_estimator) }, 1397 1396 [TCA_STAB] = { .type = NLA_NESTED },
+1 -1
net/sched/sch_etf.c
··· 177 177 178 178 parent = *p; 179 179 skb = rb_to_skb(parent); 180 - if (ktime_after(txtime, skb->tstamp)) { 180 + if (ktime_compare(txtime, skb->tstamp) >= 0) { 181 181 p = &parent->rb_right; 182 182 leftmost = false; 183 183 } else {
+8 -3
net/sched/sch_netem.c
··· 509 509 if (skb->ip_summed == CHECKSUM_PARTIAL && 510 510 skb_checksum_help(skb)) { 511 511 qdisc_drop(skb, sch, to_free); 512 + skb = NULL; 512 513 goto finish_segs; 513 514 } 514 515 ··· 594 593 finish_segs: 595 594 if (segs) { 596 595 unsigned int len, last_len; 597 - int nb = 0; 596 + int nb; 598 597 599 - len = skb->len; 598 + len = skb ? skb->len : 0; 599 + nb = skb ? 1 : 0; 600 600 601 601 while (segs) { 602 602 skb2 = segs->next; ··· 614 612 } 615 613 segs = skb2; 616 614 } 617 - qdisc_tree_reduce_backlog(sch, -nb, prev_len - len); 615 + /* Parent qdiscs accounted for 1 skb of size @prev_len */ 616 + qdisc_tree_reduce_backlog(sch, -(nb - 1), -(len - prev_len)); 617 + } else if (!skb) { 618 + return NET_XMIT_DROP; 618 619 } 619 620 return NET_XMIT_SUCCESS; 620 621 }
+4
net/sched/sch_taprio.c
··· 1341 1341 NL_SET_ERR_MSG(extack, "Specifying a 'clockid' is mandatory"); 1342 1342 goto out; 1343 1343 } 1344 + 1345 + /* Everything went ok, return success. */ 1346 + err = 0; 1347 + 1344 1348 out: 1345 1349 return err; 1346 1350 }
+1 -1
net/sctp/diag.c
··· 175 175 mem[SK_MEMINFO_FWD_ALLOC] = sk->sk_forward_alloc; 176 176 mem[SK_MEMINFO_WMEM_QUEUED] = sk->sk_wmem_queued; 177 177 mem[SK_MEMINFO_OPTMEM] = atomic_read(&sk->sk_omem_alloc); 178 - mem[SK_MEMINFO_BACKLOG] = sk->sk_backlog.len; 178 + mem[SK_MEMINFO_BACKLOG] = READ_ONCE(sk->sk_backlog.len); 179 179 mem[SK_MEMINFO_DROPS] = atomic_read(&sk->sk_drops); 180 180 181 181 if (nla_put(skb, INET_DIAG_SKMEMINFO, sizeof(mem), &mem) < 0)
+11 -5
net/sctp/input.c
··· 243 243 bh_lock_sock(sk); 244 244 } 245 245 246 - if (sock_owned_by_user(sk)) { 246 + if (sock_owned_by_user(sk) || !sctp_newsk_ready(sk)) { 247 247 if (sctp_add_backlog(sk, skb)) { 248 248 bh_unlock_sock(sk); 249 249 sctp_chunk_free(chunk); ··· 321 321 local_bh_disable(); 322 322 bh_lock_sock(sk); 323 323 324 - if (sock_owned_by_user(sk)) { 325 - if (sk_add_backlog(sk, skb, sk->sk_rcvbuf)) 324 + if (sock_owned_by_user(sk) || !sctp_newsk_ready(sk)) { 325 + if (sk_add_backlog(sk, skb, READ_ONCE(sk->sk_rcvbuf))) 326 326 sctp_chunk_free(chunk); 327 327 else 328 328 backloged = 1; ··· 336 336 if (backloged) 337 337 return 0; 338 338 } else { 339 - sctp_inq_push(inqueue, chunk); 339 + if (!sctp_newsk_ready(sk)) { 340 + if (!sk_add_backlog(sk, skb, READ_ONCE(sk->sk_rcvbuf))) 341 + return 0; 342 + sctp_chunk_free(chunk); 343 + } else { 344 + sctp_inq_push(inqueue, chunk); 345 + } 340 346 } 341 347 342 348 done: ··· 364 358 struct sctp_ep_common *rcvr = chunk->rcvr; 365 359 int ret; 366 360 367 - ret = sk_add_backlog(sk, skb, sk->sk_rcvbuf); 361 + ret = sk_add_backlog(sk, skb, READ_ONCE(sk->sk_rcvbuf)); 368 362 if (!ret) { 369 363 /* Hold the assoc/ep while hanging on the backlog queue. 370 364 * This way, we know structures we need will not disappear
+2 -2
net/sctp/socket.c
··· 9500 9500 .backlog_rcv = sctp_backlog_rcv, 9501 9501 .hash = sctp_hash, 9502 9502 .unhash = sctp_unhash, 9503 - .get_port = sctp_get_port, 9503 + .no_autobind = true, 9504 9504 .obj_size = sizeof(struct sctp_sock), 9505 9505 .useroffset = offsetof(struct sctp_sock, subscribe), 9506 9506 .usersize = offsetof(struct sctp_sock, initmsg) - ··· 9542 9542 .backlog_rcv = sctp_backlog_rcv, 9543 9543 .hash = sctp_hash, 9544 9544 .unhash = sctp_unhash, 9545 - .get_port = sctp_get_port, 9545 + .no_autobind = true, 9546 9546 .obj_size = sizeof(struct sctp6_sock), 9547 9547 .useroffset = offsetof(struct sctp6_sock, sctp.subscribe), 9548 9548 .usersize = offsetof(struct sctp6_sock, sctp.initmsg) -
+4 -1
net/smc/smc_core.c
··· 213 213 lgr = kzalloc(sizeof(*lgr), GFP_KERNEL); 214 214 if (!lgr) { 215 215 rc = SMC_CLC_DECL_MEM; 216 - goto out; 216 + goto ism_put_vlan; 217 217 } 218 218 lgr->is_smcd = ini->is_smcd; 219 219 lgr->sync_err = 0; ··· 289 289 smc_llc_link_clear(lnk); 290 290 free_lgr: 291 291 kfree(lgr); 292 + ism_put_vlan: 293 + if (ini->is_smcd && ini->vlan_id) 294 + smc_ism_put_vlan(ini->ism_dev, ini->vlan_id); 292 295 out: 293 296 if (rc < 0) { 294 297 if (rc == -ENOMEM)
+21 -8
net/smc/smc_rx.c
··· 211 211 rc = sk_wait_event(sk, timeo, 212 212 sk->sk_err || 213 213 sk->sk_shutdown & RCV_SHUTDOWN || 214 - fcrit(conn) || 215 - smc_cdc_rxed_any_close_or_senddone(conn), 214 + fcrit(conn), 216 215 &wait); 217 216 remove_wait_queue(sk_sleep(sk), &wait); 218 217 sk_clear_bit(SOCKWQ_ASYNC_WAITDATA, sk); ··· 261 262 return -EAGAIN; 262 263 } 263 264 265 + static bool smc_rx_recvmsg_data_available(struct smc_sock *smc) 266 + { 267 + struct smc_connection *conn = &smc->conn; 268 + 269 + if (smc_rx_data_available(conn)) 270 + return true; 271 + else if (conn->urg_state == SMC_URG_VALID) 272 + /* we received a single urgent Byte - skip */ 273 + smc_rx_update_cons(smc, 0); 274 + return false; 275 + } 276 + 264 277 /* smc_rx_recvmsg - receive data from RMBE 265 278 * @msg: copy data to receive buffer 266 279 * @pipe: copy data to pipe if set - indicates splice() call ··· 314 303 if (read_done >= target || (pipe && read_done)) 315 304 break; 316 305 317 - if (atomic_read(&conn->bytes_to_rcv)) 306 + if (smc_rx_recvmsg_data_available(smc)) 318 307 goto copy; 319 - else if (conn->urg_state == SMC_URG_VALID) 320 - /* we received a single urgent Byte - skip */ 321 - smc_rx_update_cons(smc, 0); 322 308 323 309 if (sk->sk_shutdown & RCV_SHUTDOWN || 324 - smc_cdc_rxed_any_close_or_senddone(conn) || 325 - conn->local_tx_ctrl.conn_state_flags.peer_conn_abort) 310 + conn->local_tx_ctrl.conn_state_flags.peer_conn_abort) { 311 + /* smc_cdc_msg_recv_action() could have run after 312 + * above smc_rx_recvmsg_data_available() 313 + */ 314 + if (smc_rx_recvmsg_data_available(smc)) 315 + goto copy; 326 316 break; 317 + } 327 318 328 319 if (read_done) { 329 320 if (sk->sk_err ||
+4 -4
net/tipc/socket.c
··· 2119 2119 struct tipc_msg *hdr = buf_msg(skb); 2120 2120 2121 2121 if (unlikely(msg_in_group(hdr))) 2122 - return sk->sk_rcvbuf; 2122 + return READ_ONCE(sk->sk_rcvbuf); 2123 2123 2124 2124 if (unlikely(!msg_connected(hdr))) 2125 - return sk->sk_rcvbuf << msg_importance(hdr); 2125 + return READ_ONCE(sk->sk_rcvbuf) << msg_importance(hdr); 2126 2126 2127 2127 if (likely(tsk->peer_caps & TIPC_BLOCK_FLOWCTL)) 2128 - return sk->sk_rcvbuf; 2128 + return READ_ONCE(sk->sk_rcvbuf); 2129 2129 2130 2130 return FLOWCTL_MSG_LIM; 2131 2131 } ··· 3790 3790 i += scnprintf(buf + i, sz - i, " %d", sk->sk_sndbuf); 3791 3791 i += scnprintf(buf + i, sz - i, " | %d", sk_rmem_alloc_get(sk)); 3792 3792 i += scnprintf(buf + i, sz - i, " %d", sk->sk_rcvbuf); 3793 - i += scnprintf(buf + i, sz - i, " | %d\n", sk->sk_backlog.len); 3793 + i += scnprintf(buf + i, sz - i, " | %d\n", READ_ONCE(sk->sk_backlog.len)); 3794 3794 3795 3795 if (dqueues & TIPC_DUMP_SK_SNDQ) { 3796 3796 i += scnprintf(buf + i, sz - i, "sk_write_queue: ");
+14 -3
net/vmw_vsock/virtio_transport_common.c
··· 204 204 return virtio_transport_get_ops()->send_pkt(pkt); 205 205 } 206 206 207 - static void virtio_transport_inc_rx_pkt(struct virtio_vsock_sock *vvs, 207 + static bool virtio_transport_inc_rx_pkt(struct virtio_vsock_sock *vvs, 208 208 struct virtio_vsock_pkt *pkt) 209 209 { 210 + if (vvs->rx_bytes + pkt->len > vvs->buf_alloc) 211 + return false; 212 + 210 213 vvs->rx_bytes += pkt->len; 214 + return true; 211 215 } 212 216 213 217 static void virtio_transport_dec_rx_pkt(struct virtio_vsock_sock *vvs, ··· 462 458 vvs->buf_size_max = val; 463 459 vvs->buf_size = val; 464 460 vvs->buf_alloc = val; 461 + 462 + virtio_transport_send_credit_update(vsk, VIRTIO_VSOCK_TYPE_STREAM, 463 + NULL); 465 464 } 466 465 EXPORT_SYMBOL_GPL(virtio_transport_set_buffer_size); 467 466 ··· 883 876 struct virtio_vsock_pkt *pkt) 884 877 { 885 878 struct virtio_vsock_sock *vvs = vsk->trans; 886 - bool free_pkt = false; 879 + bool can_enqueue, free_pkt = false; 887 880 888 881 pkt->len = le32_to_cpu(pkt->hdr.len); 889 882 pkt->off = 0; 890 883 891 884 spin_lock_bh(&vvs->rx_lock); 892 885 893 - virtio_transport_inc_rx_pkt(vvs, pkt); 886 + can_enqueue = virtio_transport_inc_rx_pkt(vvs, pkt); 887 + if (!can_enqueue) { 888 + free_pkt = true; 889 + goto out; 890 + } 894 891 895 892 /* Try to copy small packets into the buffer of last packet queued, 896 893 * to avoid wasting memory queueing the entire buffer with a small
+1 -1
net/wireless/nl80211.c
··· 13682 13682 hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, 13683 13683 NL80211_CMD_GET_FTM_RESPONDER_STATS); 13684 13684 if (!hdr) 13685 - return -ENOBUFS; 13685 + goto nla_put_failure; 13686 13686 13687 13687 if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex)) 13688 13688 goto nla_put_failure;
+1
net/wireless/reg.c
··· 3883 3883 3884 3884 return pre_cac_allowed; 3885 3885 } 3886 + EXPORT_SYMBOL(regulatory_pre_cac_allowed); 3886 3887 3887 3888 void regulatory_propagate_dfs_state(struct wiphy *wiphy, 3888 3889 struct cfg80211_chan_def *chandef,
-8
net/wireless/reg.h
··· 156 156 #define REG_PRE_CAC_EXPIRY_GRACE_MS 2000 157 157 158 158 /** 159 - * regulatory_pre_cac_allowed - if pre-CAC allowed in the current dfs domain 160 - * @wiphy: wiphy for which pre-CAC capability is checked. 161 - 162 - * Pre-CAC is allowed only in ETSI domain. 163 - */ 164 - bool regulatory_pre_cac_allowed(struct wiphy *wiphy); 165 - 166 - /** 167 159 * regulatory_propagate_dfs_state - Propagate DFS channel state to other wiphys 168 160 * @wiphy - wiphy on which radar is detected and the event will be propagated 169 161 * to other available wiphys having the same DFS domain
+13 -10
net/wireless/scan.c
··· 1703 1703 static void 1704 1704 cfg80211_update_notlisted_nontrans(struct wiphy *wiphy, 1705 1705 struct cfg80211_bss *nontrans_bss, 1706 - struct ieee80211_mgmt *mgmt, size_t len, 1707 - gfp_t gfp) 1706 + struct ieee80211_mgmt *mgmt, size_t len) 1708 1707 { 1709 1708 u8 *ie, *new_ie, *pos; 1710 1709 const u8 *nontrans_ssid, *trans_ssid, *mbssid; ··· 1713 1714 struct cfg80211_bss_ies *new_ies; 1714 1715 const struct cfg80211_bss_ies *old; 1715 1716 u8 cpy_len; 1717 + 1718 + lockdep_assert_held(&wiphy_to_rdev(wiphy)->bss_lock); 1716 1719 1717 1720 ie = mgmt->u.probe_resp.variable; 1718 1721 ··· 1732 1731 if (!mbssid || mbssid < trans_ssid) 1733 1732 return; 1734 1733 new_ie_len -= mbssid[1]; 1735 - rcu_read_lock(); 1734 + 1736 1735 nontrans_ssid = ieee80211_bss_get_ie(nontrans_bss, WLAN_EID_SSID); 1737 - if (!nontrans_ssid) { 1738 - rcu_read_unlock(); 1736 + if (!nontrans_ssid) 1739 1737 return; 1740 - } 1738 + 1741 1739 new_ie_len += nontrans_ssid[1]; 1742 - rcu_read_unlock(); 1743 1740 1744 1741 /* generate new ie for nontrans BSS 1745 1742 * 1. replace SSID with nontrans BSS' SSID 1746 1743 * 2. skip MBSSID IE 1747 1744 */ 1748 - new_ie = kzalloc(new_ie_len, gfp); 1745 + new_ie = kzalloc(new_ie_len, GFP_ATOMIC); 1749 1746 if (!new_ie) 1750 1747 return; 1751 - new_ies = kzalloc(sizeof(*new_ies) + new_ie_len, gfp); 1748 + 1749 + new_ies = kzalloc(sizeof(*new_ies) + new_ie_len, GFP_ATOMIC); 1752 1750 if (!new_ies) 1753 1751 goto out_free; 1754 1752 ··· 1901 1901 cfg80211_parse_mbssid_frame_data(wiphy, data, mgmt, len, 1902 1902 &non_tx_data, gfp); 1903 1903 1904 + spin_lock_bh(&wiphy_to_rdev(wiphy)->bss_lock); 1905 + 1904 1906 /* check if the res has other nontransmitting bss which is not 1905 1907 * in MBSSID IE 1906 1908 */ ··· 1917 1915 ies2 = rcu_access_pointer(tmp_bss->ies); 1918 1916 if (ies2->tsf < ies1->tsf) 1919 1917 cfg80211_update_notlisted_nontrans(wiphy, tmp_bss, 1920 - mgmt, len, gfp); 1918 + mgmt, len); 1921 1919 } 1920 + spin_unlock_bh(&wiphy_to_rdev(wiphy)->bss_lock); 1922 1921 1923 1922 return res; 1924 1923 }
+6 -2
net/wireless/wext-sme.c
··· 202 202 struct iw_point *data, char *ssid) 203 203 { 204 204 struct wireless_dev *wdev = dev->ieee80211_ptr; 205 + int ret = 0; 205 206 206 207 /* call only for station! */ 207 208 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION)) ··· 220 219 if (ie) { 221 220 data->flags = 1; 222 221 data->length = ie[1]; 223 - memcpy(ssid, ie + 2, data->length); 222 + if (data->length > IW_ESSID_MAX_SIZE) 223 + ret = -EINVAL; 224 + else 225 + memcpy(ssid, ie + 2, data->length); 224 226 } 225 227 rcu_read_unlock(); 226 228 } else if (wdev->wext.connect.ssid && wdev->wext.connect.ssid_len) { ··· 233 229 } 234 230 wdev_unlock(wdev); 235 231 236 - return 0; 232 + return ret; 237 233 } 238 234 239 235 int cfg80211_mgd_wext_siwap(struct net_device *dev,
+1 -1
net/x25/x25_dev.c
··· 55 55 if (!sock_owned_by_user(sk)) { 56 56 queued = x25_process_rx_frame(sk, skb); 57 57 } else { 58 - queued = !sk_add_backlog(sk, skb, sk->sk_rcvbuf); 58 + queued = !sk_add_backlog(sk, skb, READ_ONCE(sk->sk_rcvbuf)); 59 59 } 60 60 bh_unlock_sock(sk); 61 61 sock_put(sk);
+27 -15
net/xdp/xsk.c
··· 305 305 } 306 306 EXPORT_SYMBOL(xsk_umem_consume_tx); 307 307 308 - static int xsk_zc_xmit(struct sock *sk) 308 + static int xsk_zc_xmit(struct xdp_sock *xs) 309 309 { 310 - struct xdp_sock *xs = xdp_sk(sk); 311 310 struct net_device *dev = xs->dev; 312 311 313 312 return dev->netdev_ops->ndo_xsk_wakeup(dev, xs->queue_id, ··· 326 327 sock_wfree(skb); 327 328 } 328 329 329 - static int xsk_generic_xmit(struct sock *sk, struct msghdr *m, 330 - size_t total_len) 330 + static int xsk_generic_xmit(struct sock *sk) 331 331 { 332 - u32 max_batch = TX_BATCH_SIZE; 333 332 struct xdp_sock *xs = xdp_sk(sk); 333 + u32 max_batch = TX_BATCH_SIZE; 334 334 bool sent_frame = false; 335 335 struct xdp_desc desc; 336 336 struct sk_buff *skb; ··· 392 394 return err; 393 395 } 394 396 397 + static int __xsk_sendmsg(struct sock *sk) 398 + { 399 + struct xdp_sock *xs = xdp_sk(sk); 400 + 401 + if (unlikely(!(xs->dev->flags & IFF_UP))) 402 + return -ENETDOWN; 403 + if (unlikely(!xs->tx)) 404 + return -ENOBUFS; 405 + 406 + return xs->zc ? xsk_zc_xmit(xs) : xsk_generic_xmit(sk); 407 + } 408 + 395 409 static int xsk_sendmsg(struct socket *sock, struct msghdr *m, size_t total_len) 396 410 { 397 411 bool need_wait = !(m->msg_flags & MSG_DONTWAIT); ··· 412 402 413 403 if (unlikely(!xsk_is_bound(xs))) 414 404 return -ENXIO; 415 - if (unlikely(!(xs->dev->flags & IFF_UP))) 416 - return -ENETDOWN; 417 - if (unlikely(!xs->tx)) 418 - return -ENOBUFS; 419 - if (need_wait) 405 + if (unlikely(need_wait)) 420 406 return -EOPNOTSUPP; 421 407 422 - return (xs->zc) ? xsk_zc_xmit(sk) : xsk_generic_xmit(sk, m, total_len); 408 + return __xsk_sendmsg(sk); 423 409 } 424 410 425 411 static unsigned int xsk_poll(struct file *file, struct socket *sock, 426 412 struct poll_table_struct *wait) 427 413 { 428 414 unsigned int mask = datagram_poll(file, sock, wait); 429 - struct xdp_sock *xs = xdp_sk(sock->sk); 415 + struct sock *sk = sock->sk; 416 + struct xdp_sock *xs = xdp_sk(sk); 430 417 struct net_device *dev; 431 418 struct xdp_umem *umem; 432 419 ··· 433 426 dev = xs->dev; 434 427 umem = xs->umem; 435 428 436 - if (umem->need_wakeup) 437 - dev->netdev_ops->ndo_xsk_wakeup(dev, xs->queue_id, 438 - umem->need_wakeup); 429 + if (umem->need_wakeup) { 430 + if (dev->netdev_ops->ndo_xsk_wakeup) 431 + dev->netdev_ops->ndo_xsk_wakeup(dev, xs->queue_id, 432 + umem->need_wakeup); 433 + else 434 + /* Poll needs to drive Tx also in copy mode */ 435 + __xsk_sendmsg(sk); 436 + } 439 437 440 438 if (xs->rx && !xskq_empty_desc(xs->rx)) 441 439 mask |= POLLIN | POLLRDNORM;
+12 -1
samples/bpf/asm_goto_workaround.h
··· 3 3 #ifndef __ASM_GOTO_WORKAROUND_H 4 4 #define __ASM_GOTO_WORKAROUND_H 5 5 6 - /* this will bring in asm_volatile_goto macro definition 6 + /* 7 + * This will bring in asm_volatile_goto and asm_inline macro definitions 7 8 * if enabled by compiler and config options. 8 9 */ 9 10 #include <linux/types.h> ··· 12 11 #ifdef asm_volatile_goto 13 12 #undef asm_volatile_goto 14 13 #define asm_volatile_goto(x...) asm volatile("invalid use of asm_volatile_goto") 14 + #endif 15 + 16 + /* 17 + * asm_inline is defined as asm __inline in "include/linux/compiler_types.h" 18 + * if supported by the kernel's CC (i.e CONFIG_CC_HAS_ASM_INLINE) which is not 19 + * supported by CLANG. 20 + */ 21 + #ifdef asm_inline 22 + #undef asm_inline 23 + #define asm_inline asm 15 24 #endif 16 25 17 26 #define volatile(x...) volatile("")
+1
samples/bpf/task_fd_query_user.c
··· 13 13 #include <sys/resource.h> 14 14 #include <sys/types.h> 15 15 #include <sys/stat.h> 16 + #include <linux/perf_event.h> 16 17 17 18 #include "libbpf.h" 18 19 #include "bpf_load.h"
+5 -1
tools/bpf/Makefile
··· 12 12 CFLAGS += -Wall -O2 13 13 CFLAGS += -D__EXPORTED_HEADERS__ -I$(srctree)/include/uapi -I$(srctree)/include 14 14 15 - ifeq ($(srctree),) 15 + # This will work when bpf is built in tools env. where srctree 16 + # isn't set and when invoked from selftests build, where srctree 17 + # is set to ".". building_out_of_srctree is undefined for in srctree 18 + # builds 19 + ifndef building_out_of_srctree 16 20 srctree := $(patsubst %/,%,$(dir $(CURDIR))) 17 21 srctree := $(patsubst %/,%,$(dir $(srctree))) 18 22 endif
+23 -10
tools/lib/bpf/Makefile
··· 8 8 9 9 MAKEFLAGS += --no-print-directory 10 10 11 - ifeq ($(srctree),) 11 + # This will work when bpf is built in tools env. where srctree 12 + # isn't set and when invoked from selftests build, where srctree 13 + # is a ".". building_out_of_srctree is undefined for in srctree 14 + # builds 15 + ifndef building_out_of_srctree 12 16 srctree := $(patsubst %/,%,$(dir $(CURDIR))) 13 17 srctree := $(patsubst %/,%,$(dir $(srctree))) 14 18 srctree := $(patsubst %/,%,$(dir $(srctree))) ··· 114 110 override CFLAGS += -fvisibility=hidden 115 111 override CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 116 112 113 + # flags specific for shared library 114 + SHLIB_FLAGS := -DSHARED 115 + 117 116 ifeq ($(VERBOSE),1) 118 117 Q = 119 118 else ··· 133 126 export srctree OUTPUT CC LD CFLAGS V 134 127 include $(srctree)/tools/build/Makefile.include 135 128 136 - BPF_IN := $(OUTPUT)libbpf-in.o 129 + SHARED_OBJDIR := $(OUTPUT)sharedobjs/ 130 + STATIC_OBJDIR := $(OUTPUT)staticobjs/ 131 + BPF_IN_SHARED := $(SHARED_OBJDIR)libbpf-in.o 132 + BPF_IN_STATIC := $(STATIC_OBJDIR)libbpf-in.o 137 133 VERSION_SCRIPT := libbpf.map 138 134 139 135 LIB_TARGET := $(addprefix $(OUTPUT),$(LIB_TARGET)) 140 136 LIB_FILE := $(addprefix $(OUTPUT),$(LIB_FILE)) 141 137 PC_FILE := $(addprefix $(OUTPUT),$(PC_FILE)) 142 138 143 - GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN) | \ 139 + GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN_SHARED) | \ 144 140 cut -d "@" -f1 | sed 's/_v[0-9]_[0-9]_[0-9].*//' | \ 145 141 awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$8}' | \ 146 142 sort -u | wc -l) ··· 165 155 166 156 all_cmd: $(CMD_TARGETS) check 167 157 168 - $(BPF_IN): force elfdep bpfdep 158 + $(BPF_IN_SHARED): force elfdep bpfdep 169 159 @(test -f ../../include/uapi/linux/bpf.h -a -f ../../../include/uapi/linux/bpf.h && ( \ 170 160 (diff -B ../../include/uapi/linux/bpf.h ../../../include/uapi/linux/bpf.h >/dev/null) || \ 171 161 echo "Warning: Kernel ABI header at 'tools/include/uapi/linux/bpf.h' differs from latest version at 'include/uapi/linux/bpf.h'" >&2 )) || true ··· 181 171 @(test -f ../../include/uapi/linux/if_xdp.h -a -f ../../../include/uapi/linux/if_xdp.h && ( \ 182 172 (diff -B ../../include/uapi/linux/if_xdp.h ../../../include/uapi/linux/if_xdp.h >/dev/null) || \ 183 173 echo "Warning: Kernel ABI header at 'tools/include/uapi/linux/if_xdp.h' differs from latest version at 'include/uapi/linux/if_xdp.h'" >&2 )) || true 184 - $(Q)$(MAKE) $(build)=libbpf 174 + $(Q)$(MAKE) $(build)=libbpf OUTPUT=$(SHARED_OBJDIR) CFLAGS="$(CFLAGS) $(SHLIB_FLAGS)" 175 + 176 + $(BPF_IN_STATIC): force elfdep bpfdep 177 + $(Q)$(MAKE) $(build)=libbpf OUTPUT=$(STATIC_OBJDIR) 185 178 186 179 $(OUTPUT)libbpf.so: $(OUTPUT)libbpf.so.$(LIBBPF_VERSION) 187 180 188 - $(OUTPUT)libbpf.so.$(LIBBPF_VERSION): $(BPF_IN) 181 + $(OUTPUT)libbpf.so.$(LIBBPF_VERSION): $(BPF_IN_SHARED) 189 182 $(QUIET_LINK)$(CC) --shared -Wl,-soname,libbpf.so.$(LIBBPF_MAJOR_VERSION) \ 190 183 -Wl,--version-script=$(VERSION_SCRIPT) $^ -lelf -o $@ 191 184 @ln -sf $(@F) $(OUTPUT)libbpf.so 192 185 @ln -sf $(@F) $(OUTPUT)libbpf.so.$(LIBBPF_MAJOR_VERSION) 193 186 194 - $(OUTPUT)libbpf.a: $(BPF_IN) 187 + $(OUTPUT)libbpf.a: $(BPF_IN_STATIC) 195 188 $(QUIET_LINK)$(RM) $@; $(AR) rcs $@ $^ 196 189 197 190 $(OUTPUT)test_libbpf: test_libbpf.cpp $(OUTPUT)libbpf.a ··· 210 197 211 198 check_abi: $(OUTPUT)libbpf.so 212 199 @if [ "$(GLOBAL_SYM_COUNT)" != "$(VERSIONED_SYM_COUNT)" ]; then \ 213 - echo "Warning: Num of global symbols in $(BPF_IN)" \ 200 + echo "Warning: Num of global symbols in $(BPF_IN_SHARED)" \ 214 201 "($(GLOBAL_SYM_COUNT)) does NOT match with num of" \ 215 202 "versioned symbols in $^ ($(VERSIONED_SYM_COUNT))." \ 216 203 "Please make sure all LIBBPF_API symbols are" \ ··· 268 255 $(Q)$(MAKE) -C $(srctree)/tools/build/feature/ clean >/dev/null 269 256 270 257 clean: 271 - $(call QUIET_CLEAN, libbpf) $(RM) $(TARGETS) $(CXX_TEST_TARGET) \ 258 + $(call QUIET_CLEAN, libbpf) $(RM) -rf $(TARGETS) $(CXX_TEST_TARGET) \ 272 259 *.o *~ *.a *.so *.so.$(LIBBPF_MAJOR_VERSION) .*.d .*.cmd \ 273 - *.pc LIBBPF-CFLAGS 260 + *.pc LIBBPF-CFLAGS $(SHARED_OBJDIR) $(STATIC_OBJDIR) 274 261 $(call QUIET_CLEAN, core-gen) $(RM) $(OUTPUT)FEATURE-DUMP.libbpf 275 262 276 263
+16
tools/lib/bpf/libbpf_internal.h
··· 34 34 (offsetof(TYPE, FIELD) + sizeof(((TYPE *)0)->FIELD)) 35 35 #endif 36 36 37 + /* Symbol versioning is different between static and shared library. 38 + * Properly versioned symbols are needed for shared library, but 39 + * only the symbol of the new version is needed for static library. 40 + */ 41 + #ifdef SHARED 42 + # define COMPAT_VERSION(internal_name, api_name, version) \ 43 + asm(".symver " #internal_name "," #api_name "@" #version); 44 + # define DEFAULT_VERSION(internal_name, api_name, version) \ 45 + asm(".symver " #internal_name "," #api_name "@@" #version); 46 + #else 47 + # define COMPAT_VERSION(internal_name, api_name, version) 48 + # define DEFAULT_VERSION(internal_name, api_name, version) \ 49 + extern typeof(internal_name) api_name \ 50 + __attribute__((alias(#internal_name))); 51 + #endif 52 + 37 53 extern void libbpf_print(enum libbpf_print_level level, 38 54 const char *format, ...) 39 55 __attribute__((format(printf, 2, 3)));
+2 -2
tools/lib/bpf/xsk.c
··· 261 261 return xsk_umem__create_v0_0_4(umem_ptr, umem_area, size, fill, comp, 262 262 &config); 263 263 } 264 - asm(".symver xsk_umem__create_v0_0_2, xsk_umem__create@LIBBPF_0.0.2"); 265 - asm(".symver xsk_umem__create_v0_0_4, xsk_umem__create@@LIBBPF_0.0.4"); 264 + COMPAT_VERSION(xsk_umem__create_v0_0_2, xsk_umem__create, LIBBPF_0.0.2) 265 + DEFAULT_VERSION(xsk_umem__create_v0_0_4, xsk_umem__create, LIBBPF_0.0.4) 266 266 267 267 static int xsk_load_xdp_prog(struct xsk_socket *xsk) 268 268 {
+1 -1
tools/testing/selftests/bpf/prog_tests/sockopt_inherit.c
··· 195 195 196 196 if (CHECK_FAIL(pthread_create(&tid, NULL, server_thread, 197 197 (void *)&server_fd))) 198 - goto close_bpf_object; 198 + goto close_server_fd; 199 199 200 200 pthread_mutex_lock(&server_started_mtx); 201 201 pthread_cond_wait(&server_started, &server_started_mtx);
+2 -1
tools/testing/selftests/bpf/prog_tests/tcp_rtt.c
··· 260 260 261 261 if (CHECK_FAIL(pthread_create(&tid, NULL, server_thread, 262 262 (void *)&server_fd))) 263 - goto close_cgroup_fd; 263 + goto close_server_fd; 264 264 265 265 pthread_mutex_lock(&server_started_mtx); 266 266 pthread_cond_wait(&server_started, &server_started_mtx); 267 267 pthread_mutex_unlock(&server_started_mtx); 268 268 269 269 CHECK_FAIL(run_test(cgroup_fd, server_fd)); 270 + close_server_fd: 270 271 close(server_fd); 271 272 close_cgroup_fd: 272 273 close(cgroup_fd);
+3
tools/testing/selftests/bpf/test_flow_dissector.sh
··· 63 63 64 64 # Setup 65 65 tc qdisc add dev lo ingress 66 + echo 0 > /proc/sys/net/ipv4/conf/default/rp_filter 67 + echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter 68 + echo 0 > /proc/sys/net/ipv4/conf/lo/rp_filter 66 69 67 70 echo "Testing IPv4..." 68 71 # Drops all IP/UDP packets coming from port 9
+3 -3
tools/testing/selftests/bpf/test_lwt_ip_encap.sh
··· 314 314 command -v nc >/dev/null 2>&1 || \ 315 315 { echo >&2 "nc is not available: skipping TSO tests"; return; } 316 316 317 - # listen on IPv*_DST, capture TCP into $TMPFILE 317 + # listen on port 9000, capture TCP into $TMPFILE 318 318 if [ "${PROTO}" == "IPv4" ] ; then 319 319 IP_DST=${IPv4_DST} 320 320 ip netns exec ${NS3} bash -c \ 321 - "nc -4 -l -s ${IPv4_DST} -p 9000 > ${TMPFILE} &" 321 + "nc -4 -l -p 9000 > ${TMPFILE} &" 322 322 elif [ "${PROTO}" == "IPv6" ] ; then 323 323 IP_DST=${IPv6_DST} 324 324 ip netns exec ${NS3} bash -c \ 325 - "nc -6 -l -s ${IPv6_DST} -p 9000 > ${TMPFILE} &" 325 + "nc -6 -l -p 9000 > ${TMPFILE} &" 326 326 RET=$? 327 327 else 328 328 echo " test_gso: unknown PROTO: ${PROTO}"