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 into master

Pull networking fixes from David Miller:

1) Fix RCU locaking in iwlwifi, from Johannes Berg.

2) mt76 can access uninitialized NAPI struct, from Felix Fietkau.

3) Fix race in updating pause settings in bnxt_en, from Vasundhara
Volam.

4) Propagate error return properly during unbind failures in ax88172a,
from George Kennedy.

5) Fix memleak in adf7242_probe, from Liu Jian.

6) smc_drv_probe() can leak, from Wang Hai.

7) Don't muck with the carrier state if register_netdevice() fails in
the bonding driver, from Taehee Yoo.

8) Fix memleak in dpaa_eth_probe, from Liu Jian.

9) Need to check skb_put_padto() return value in hsr_fill_tag(), from
Murali Karicheri.

10) Don't lose ionic RSS hash settings across FW update, from Shannon
Nelson.

11) Fix clobbered SKB control block in act_ct, from Wen Xu.

12) Missing newlink in "tx_timeout" sysfs output, from Xiongfeng Wang.

13) IS_UDPLITE cleanup a long time ago, incorrectly handled
transformations involving UDPLITE_RECV_CC. From Miaohe Lin.

14) Unbalanced locking in netdevsim, from Taehee Yoo.

15) Suppress false-positive error messages in qed driver, from Alexander
Lobakin.

16) Out of bounds read in ax25_connect and ax25_sendmsg, from Peilin Ye.

17) Missing SKB release in cxgb4's uld_send(), from Navid Emamdoost.

18) Uninitialized value in geneve_changelink(), from Cong Wang.

19) Fix deadlock in xen-netfront, from Andera Righi.

19) flush_backlog() frees skbs with IRQs disabled, so should use
dev_kfree_skb_irq() instead of kfree_skb(). From Subash Abhinov
Kasiviswanathan.

* git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (111 commits)
drivers/net/wan: lapb: Corrected the usage of skb_cow
dev: Defer free of skbs in flush_backlog
qrtr: orphan socket in qrtr_release()
xen-netfront: fix potential deadlock in xennet_remove()
flow_offload: Move rhashtable inclusion to the source file
geneve: fix an uninitialized value in geneve_changelink()
bonding: check return value of register_netdevice() in bond_newlink()
tcp: allow at most one TLP probe per flight
AX.25: Prevent integer overflows in connect and sendmsg
cxgb4: add missing release on skb in uld_send()
net: atlantic: fix PTP on AQC10X
AX.25: Prevent out-of-bounds read in ax25_sendmsg()
sctp: shrink stream outq when fails to do addstream reconf
sctp: shrink stream outq only when new outcnt < old outcnt
AX.25: Fix out-of-bounds read in ax25_connect()
enetc: Remove the mdio bus on PF probe bailout
net: ethernet: ti: add NETIF_F_HW_TC hw feature flag for taprio offload
net: ethernet: ave: Fix error returns in ave_init
drivers/net/wan/x25_asy: Fix to make it work
ipvs: fix the connection sync failed in some cases
...

+1025 -679
+12
Documentation/driver-api/ptp.rst
··· 23 23 + Ancillary clock features 24 24 - Time stamp external events 25 25 - Period output signals configurable from user space 26 + - Low Pass Filter (LPF) access from user space 26 27 - Synchronization of the Linux system time via the PPS subsystem 27 28 28 29 PTP hardware clock kernel API ··· 95 94 96 95 - Auxiliary Slave/Master Mode Snapshot (optional interrupt) 97 96 - Target Time (optional interrupt) 97 + 98 + * Renesas (IDT) ClockMatrix™ 99 + 100 + - Up to 4 independent PHC channels 101 + - Integrated low pass filter (LPF), access via .adjPhase (compliant to ITU-T G.8273.2) 102 + - Programmable output periodic signals 103 + - Programmable inputs can time stamp external triggers 104 + - Driver and/or hardware configuration through firmware (idtcm.bin) 105 + - LPF settings (bandwidth, phase limiting, automatic holdover, physical layer assist (per ITU-T G.8273.2)) 106 + - Programmable output PTP clocks, any frequency up to 1GHz (to other PHY/MAC time stampers, refclk to ASSPs/SoCs/FPGAs) 107 + - Lock to GNSS input, automatic switching between GNSS and user-space PHC control (optional)
+13 -6
Documentation/networking/bareudp.rst
··· 26 26 27 27 1) Device creation & deletion 28 28 29 - a) ip link add dev bareudp0 type bareudp dstport 6635 ethertype 0x8847. 29 + a) ip link add dev bareudp0 type bareudp dstport 6635 ethertype mpls_uc 30 30 31 31 This creates a bareudp tunnel device which tunnels L3 traffic with ethertype 32 32 0x8847 (MPLS traffic). The destination port of the UDP header will be set to ··· 34 34 35 35 b) ip link delete bareudp0 36 36 37 - 2) Device creation with multiple proto mode enabled 37 + 2) Device creation with multiproto mode enabled 38 38 39 - There are two ways to create a bareudp device for MPLS & IP with multiproto mode 40 - enabled. 39 + The multiproto mode allows bareudp tunnels to handle several protocols of the 40 + same family. It is currently only available for IP and MPLS. This mode has to 41 + be enabled explicitly with the "multiproto" flag. 41 42 42 - a) ip link add dev bareudp0 type bareudp dstport 6635 ethertype 0x8847 multiproto 43 + a) ip link add dev bareudp0 type bareudp dstport 6635 ethertype ipv4 multiproto 43 44 44 - b) ip link add dev bareudp0 type bareudp dstport 6635 ethertype mpls 45 + For an IPv4 tunnel the multiproto mode allows the tunnel to also handle 46 + IPv6. 47 + 48 + b) ip link add dev bareudp0 type bareudp dstport 6635 ethertype mpls_uc multiproto 49 + 50 + For MPLS, the multiproto mode allows the tunnel to handle both unicast 51 + and multicast MPLS packets. 45 52 46 53 3) Device Usage 47 54
+1 -4
arch/arm64/boot/dts/marvell/armada-8040-clearfog-gt-8k.dts
··· 454 454 status = "okay"; 455 455 phy-mode = "2500base-x"; 456 456 phys = <&cp1_comphy5 2>; 457 - fixed-link { 458 - speed = <2500>; 459 - full-duplex; 460 - }; 457 + managed = "in-band-status"; 461 458 }; 462 459 463 460 &cp1_spi1 {
+1 -1
drivers/crypto/chelsio/chtls/chtls_cm.c
··· 102 102 case PF_INET: 103 103 if (likely(!inet_sk(sk)->inet_rcv_saddr)) 104 104 return ndev; 105 - ndev = ip_dev_find(&init_net, inet_sk(sk)->inet_rcv_saddr); 105 + ndev = __ip_dev_find(&init_net, inet_sk(sk)->inet_rcv_saddr, false); 106 106 break; 107 107 #if IS_ENABLED(CONFIG_IPV6) 108 108 case PF_INET6:
+4 -3
drivers/crypto/chelsio/chtls/chtls_io.c
··· 1052 1052 &record_type); 1053 1053 if (err) 1054 1054 goto out_err; 1055 + 1056 + /* Avoid appending tls handshake, alert to tls data */ 1057 + if (skb) 1058 + tx_skb_finalize(skb); 1055 1059 } 1056 1060 1057 1061 recordsz = size; 1058 1062 csk->tlshws.txleft = recordsz; 1059 1063 csk->tlshws.type = record_type; 1060 - 1061 - if (skb) 1062 - ULP_SKB_CB(skb)->ulp.tls.type = record_type; 1063 1064 } 1064 1065 1065 1066 if (!skb || (ULP_SKB_CB(skb)->flags & ULPCB_FLAG_NO_APPEND) ||
+7 -3
drivers/net/bonding/bond_main.c
··· 5053 5053 bond_dev->rtnl_link_ops = &bond_link_ops; 5054 5054 5055 5055 res = register_netdevice(bond_dev); 5056 + if (res < 0) { 5057 + free_netdev(bond_dev); 5058 + rtnl_unlock(); 5059 + 5060 + return res; 5061 + } 5056 5062 5057 5063 netif_carrier_off(bond_dev); 5058 5064 5059 5065 bond_work_init_all(bond); 5060 5066 5061 5067 rtnl_unlock(); 5062 - if (res < 0) 5063 - free_netdev(bond_dev); 5064 - return res; 5068 + return 0; 5065 5069 } 5066 5070 5067 5071 static int __net_init bond_net_init(struct net *net)
+1 -2
drivers/net/bonding/bond_netlink.c
··· 456 456 return err; 457 457 458 458 err = register_netdevice(bond_dev); 459 - 460 - netif_carrier_off(bond_dev); 461 459 if (!err) { 462 460 struct bonding *bond = netdev_priv(bond_dev); 463 461 462 + netif_carrier_off(bond_dev); 464 463 bond_work_init_all(bond); 465 464 } 466 465
+23 -19
drivers/net/dsa/microchip/ksz9477.c
··· 974 974 PORT_MIRROR_SNIFFER, false); 975 975 } 976 976 977 - static void ksz9477_phy_setup(struct ksz_device *dev, int port, 978 - struct phy_device *phy) 979 - { 980 - /* Only apply to port with PHY. */ 981 - if (port >= dev->phy_port_cnt) 982 - return; 983 - 984 - /* The MAC actually cannot run in 1000 half-duplex mode. */ 985 - phy_remove_link_mode(phy, 986 - ETHTOOL_LINK_MODE_1000baseT_Half_BIT); 987 - 988 - /* PHY does not support gigabit. */ 989 - if (!(dev->features & GBIT_SUPPORT)) 990 - phy_remove_link_mode(phy, 991 - ETHTOOL_LINK_MODE_1000baseT_Full_BIT); 992 - } 993 - 994 977 static bool ksz9477_get_gbit(struct ksz_device *dev, u8 data) 995 978 { 996 979 bool gbit; ··· 1586 1603 .get_port_addr = ksz9477_get_port_addr, 1587 1604 .cfg_port_member = ksz9477_cfg_port_member, 1588 1605 .flush_dyn_mac_table = ksz9477_flush_dyn_mac_table, 1589 - .phy_setup = ksz9477_phy_setup, 1590 1606 .port_setup = ksz9477_port_setup, 1591 1607 .r_mib_cnt = ksz9477_r_mib_cnt, 1592 1608 .r_mib_pkt = ksz9477_r_mib_pkt, ··· 1599 1617 1600 1618 int ksz9477_switch_register(struct ksz_device *dev) 1601 1619 { 1602 - return ksz_switch_register(dev, &ksz9477_dev_ops); 1620 + int ret, i; 1621 + struct phy_device *phydev; 1622 + 1623 + ret = ksz_switch_register(dev, &ksz9477_dev_ops); 1624 + if (ret) 1625 + return ret; 1626 + 1627 + for (i = 0; i < dev->phy_port_cnt; ++i) { 1628 + if (!dsa_is_user_port(dev->ds, i)) 1629 + continue; 1630 + 1631 + phydev = dsa_to_port(dev->ds, i)->slave->phydev; 1632 + 1633 + /* The MAC actually cannot run in 1000 half-duplex mode. */ 1634 + phy_remove_link_mode(phydev, 1635 + ETHTOOL_LINK_MODE_1000baseT_Half_BIT); 1636 + 1637 + /* PHY does not support gigabit. */ 1638 + if (!(dev->features & GBIT_SUPPORT)) 1639 + phy_remove_link_mode(phydev, 1640 + ETHTOOL_LINK_MODE_1000baseT_Full_BIT); 1641 + } 1642 + return ret; 1603 1643 } 1604 1644 EXPORT_SYMBOL(ksz9477_switch_register); 1605 1645
-2
drivers/net/dsa/microchip/ksz_common.c
··· 358 358 359 359 /* setup slave port */ 360 360 dev->dev_ops->port_setup(dev, port, false); 361 - if (dev->dev_ops->phy_setup) 362 - dev->dev_ops->phy_setup(dev, port, phy); 363 361 364 362 /* port_stp_state_set() will be called after to enable the port so 365 363 * there is no need to do anything.
-2
drivers/net/dsa/microchip/ksz_common.h
··· 119 119 u32 (*get_port_addr)(int port, int offset); 120 120 void (*cfg_port_member)(struct ksz_device *dev, int port, u8 member); 121 121 void (*flush_dyn_mac_table)(struct ksz_device *dev, int port); 122 - void (*phy_setup)(struct ksz_device *dev, int port, 123 - struct phy_device *phy); 124 122 void (*port_cleanup)(struct ksz_device *dev, int port); 125 123 void (*port_setup)(struct ksz_device *dev, int port, bool cpu_port); 126 124 void (*r_phy)(struct ksz_device *dev, u16 phy, u16 reg, u16 *val);
+19 -3
drivers/net/dsa/mv88e6xxx/chip.c
··· 664 664 const struct phylink_link_state *state) 665 665 { 666 666 struct mv88e6xxx_chip *chip = ds->priv; 667 + struct mv88e6xxx_port *p; 667 668 int err; 669 + 670 + p = &chip->ports[port]; 668 671 669 672 /* FIXME: is this the correct test? If we're in fixed mode on an 670 673 * internal port, why should we process this any different from ··· 678 675 return; 679 676 680 677 mv88e6xxx_reg_lock(chip); 681 - /* FIXME: should we force the link down here - but if we do, how 682 - * do we restore the link force/unforce state? The driver layering 683 - * gets in the way. 678 + /* In inband mode, the link may come up at any time while the link 679 + * is not forced down. Force the link down while we reconfigure the 680 + * interface mode. 684 681 */ 682 + if (mode == MLO_AN_INBAND && p->interface != state->interface && 683 + chip->info->ops->port_set_link) 684 + chip->info->ops->port_set_link(chip, port, LINK_FORCED_DOWN); 685 + 685 686 err = mv88e6xxx_port_config_interface(chip, port, state->interface); 686 687 if (err && err != -EOPNOTSUPP) 687 688 goto err_unlock; ··· 697 690 */ 698 691 if (err > 0) 699 692 err = 0; 693 + 694 + /* Undo the forced down state above after completing configuration 695 + * irrespective of its state on entry, which allows the link to come up. 696 + */ 697 + if (mode == MLO_AN_INBAND && p->interface != state->interface && 698 + chip->info->ops->port_set_link) 699 + chip->info->ops->port_set_link(chip, port, LINK_UNFORCED); 700 + 701 + p->interface = state->interface; 700 702 701 703 err_unlock: 702 704 mv88e6xxx_reg_unlock(chip);
+1
drivers/net/dsa/mv88e6xxx/chip.h
··· 232 232 u64 atu_full_violation; 233 233 u64 vtu_member_violation; 234 234 u64 vtu_miss_violation; 235 + phy_interface_t interface; 235 236 u8 cmode; 236 237 bool mirror_ingress; 237 238 bool mirror_egress;
+1
drivers/net/ethernet/aquantia/atlantic/aq_hw.h
··· 64 64 u8 rx_rings; 65 65 bool flow_control; 66 66 bool is_64_dma; 67 + u32 quirks; 67 68 u32 priv_data_len; 68 69 }; 69 70
+9
drivers/net/ethernet/aquantia/atlantic/aq_nic.c
··· 415 415 self->aq_nic_cfg.aq_hw_caps->media_type == AQ_HW_MEDIA_TYPE_TP) { 416 416 self->aq_hw->phy_id = HW_ATL_PHY_ID_MAX; 417 417 err = aq_phy_init(self->aq_hw); 418 + 419 + /* Disable the PTP on NICs where it's known to cause datapath 420 + * problems. 421 + * Ideally this should have been done by PHY provisioning, but 422 + * many units have been shipped with enabled PTP block already. 423 + */ 424 + if (self->aq_nic_cfg.aq_hw_caps->quirks & AQ_NIC_QUIRK_BAD_PTP) 425 + if (self->aq_hw->phy_id != HW_ATL_PHY_ID_MAX) 426 + aq_phy_disable_ptp(self->aq_hw); 418 427 } 419 428 420 429 for (i = 0U; i < self->aq_vecs; i++) {
+2
drivers/net/ethernet/aquantia/atlantic/aq_nic.h
··· 81 81 #define AQ_NIC_FLAG_ERR_UNPLUG 0x40000000U 82 82 #define AQ_NIC_FLAG_ERR_HW 0x80000000U 83 83 84 + #define AQ_NIC_QUIRK_BAD_PTP BIT(0) 85 + 84 86 #define AQ_NIC_WOL_MODES (WAKE_MAGIC |\ 85 87 WAKE_PHY) 86 88
+27 -2
drivers/net/ethernet/aquantia/atlantic/aq_phy.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-only 2 - /* aQuantia Corporation Network Driver 3 - * Copyright (C) 2018-2019 aQuantia Corporation. All rights reserved 2 + /* Atlantic Network Driver 3 + * 4 + * Copyright (C) 2018-2019 aQuantia Corporation 5 + * Copyright (C) 2019-2020 Marvell International Ltd. 4 6 */ 5 7 6 8 #include "aq_phy.h" 9 + 10 + #define HW_ATL_PTP_DISABLE_MSK BIT(10) 7 11 8 12 bool aq_mdio_busy_wait(struct aq_hw_s *aq_hw) 9 13 { ··· 148 144 } 149 145 150 146 return true; 147 + } 148 + 149 + void aq_phy_disable_ptp(struct aq_hw_s *aq_hw) 150 + { 151 + static const u16 ptp_registers[] = { 152 + 0x031e, 153 + 0x031d, 154 + 0x031c, 155 + 0x031b, 156 + }; 157 + u16 val; 158 + int i; 159 + 160 + for (i = 0; i < ARRAY_SIZE(ptp_registers); i++) { 161 + val = aq_phy_read_reg(aq_hw, MDIO_MMD_VEND1, 162 + ptp_registers[i]); 163 + 164 + aq_phy_write_reg(aq_hw, MDIO_MMD_VEND1, 165 + ptp_registers[i], 166 + val & ~HW_ATL_PTP_DISABLE_MSK); 167 + } 151 168 }
+6 -2
drivers/net/ethernet/aquantia/atlantic/aq_phy.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* aQuantia Corporation Network Driver 3 - * Copyright (C) 2018-2019 aQuantia Corporation. All rights reserved 2 + /* Atlantic Network Driver 3 + * 4 + * Copyright (C) 2018-2019 aQuantia Corporation 5 + * Copyright (C) 2019-2020 Marvell International Ltd. 4 6 */ 5 7 6 8 #ifndef AQ_PHY_H ··· 30 28 bool aq_phy_init_phy_id(struct aq_hw_s *aq_hw); 31 29 32 30 bool aq_phy_init(struct aq_hw_s *aq_hw); 31 + 32 + void aq_phy_disable_ptp(struct aq_hw_s *aq_hw); 33 33 34 34 #endif /* AQ_PHY_H */
+25 -1
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
··· 93 93 AQ_NIC_RATE_100M, 94 94 }; 95 95 96 + const struct aq_hw_caps_s hw_atl_b0_caps_aqc111 = { 97 + DEFAULT_B0_BOARD_BASIC_CAPABILITIES, 98 + .media_type = AQ_HW_MEDIA_TYPE_TP, 99 + .link_speed_msk = AQ_NIC_RATE_5G | 100 + AQ_NIC_RATE_2G5 | 101 + AQ_NIC_RATE_1G | 102 + AQ_NIC_RATE_100M, 103 + .quirks = AQ_NIC_QUIRK_BAD_PTP, 104 + }; 105 + 106 + const struct aq_hw_caps_s hw_atl_b0_caps_aqc112 = { 107 + DEFAULT_B0_BOARD_BASIC_CAPABILITIES, 108 + .media_type = AQ_HW_MEDIA_TYPE_TP, 109 + .link_speed_msk = AQ_NIC_RATE_2G5 | 110 + AQ_NIC_RATE_1G | 111 + AQ_NIC_RATE_100M, 112 + .quirks = AQ_NIC_QUIRK_BAD_PTP, 113 + }; 114 + 96 115 static int hw_atl_b0_hw_reset(struct aq_hw_s *self) 97 116 { 98 117 int err = 0; ··· 373 354 374 355 /* WSP, if min_rate is set for at least one TC. 375 356 * RR otherwise. 357 + * 358 + * NB! MAC FW sets arb mode itself if PTP is enabled. We shouldn't 359 + * overwrite it here in that case. 376 360 */ 377 - hw_atl_tps_tx_pkt_shed_data_arb_mode_set(self, min_rate_msk ? 1U : 0U); 361 + if (!nic_cfg->is_ptp) 362 + hw_atl_tps_tx_pkt_shed_data_arb_mode_set(self, min_rate_msk ? 1U : 0U); 363 + 378 364 /* Data TC Arbiter takes precedence over Descriptor TC Arbiter, 379 365 * leave Descriptor TC Arbiter as RR. 380 366 */
+4 -6
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.h
··· 18 18 extern const struct aq_hw_caps_s hw_atl_b0_caps_aqc107; 19 19 extern const struct aq_hw_caps_s hw_atl_b0_caps_aqc108; 20 20 extern const struct aq_hw_caps_s hw_atl_b0_caps_aqc109; 21 - 22 - #define hw_atl_b0_caps_aqc111 hw_atl_b0_caps_aqc108 23 - #define hw_atl_b0_caps_aqc112 hw_atl_b0_caps_aqc109 21 + extern const struct aq_hw_caps_s hw_atl_b0_caps_aqc111; 22 + extern const struct aq_hw_caps_s hw_atl_b0_caps_aqc112; 24 23 25 24 #define hw_atl_b0_caps_aqc100s hw_atl_b0_caps_aqc100 26 25 #define hw_atl_b0_caps_aqc107s hw_atl_b0_caps_aqc107 27 26 #define hw_atl_b0_caps_aqc108s hw_atl_b0_caps_aqc108 28 27 #define hw_atl_b0_caps_aqc109s hw_atl_b0_caps_aqc109 29 - 30 - #define hw_atl_b0_caps_aqc111s hw_atl_b0_caps_aqc108 31 - #define hw_atl_b0_caps_aqc112s hw_atl_b0_caps_aqc109 28 + #define hw_atl_b0_caps_aqc111s hw_atl_b0_caps_aqc111 29 + #define hw_atl_b0_caps_aqc112s hw_atl_b0_caps_aqc112 32 30 33 31 extern const struct aq_hw_ops hw_atl_ops_b0; 34 32
+2 -1
drivers/net/ethernet/atheros/ag71xx.c
··· 556 556 ag->mdio_reset = of_reset_control_get_exclusive(np, "mdio"); 557 557 if (IS_ERR(ag->mdio_reset)) { 558 558 netif_err(ag, probe, ndev, "Failed to get reset mdio.\n"); 559 - return PTR_ERR(ag->mdio_reset); 559 + err = PTR_ERR(ag->mdio_reset); 560 + goto mdio_err_put_clk; 560 561 } 561 562 562 563 mii_bus->name = "ag71xx_mdio";
+15 -7
drivers/net/ethernet/broadcom/bnxt/bnxt.c
··· 3418 3418 */ 3419 3419 void bnxt_set_ring_params(struct bnxt *bp) 3420 3420 { 3421 - u32 ring_size, rx_size, rx_space; 3421 + u32 ring_size, rx_size, rx_space, max_rx_cmpl; 3422 3422 u32 agg_factor = 0, agg_ring_size = 0; 3423 3423 3424 3424 /* 8 for CRC and VLAN */ ··· 3474 3474 bp->tx_nr_pages = bnxt_calc_nr_ring_pages(ring_size, TX_DESC_CNT); 3475 3475 bp->tx_ring_mask = (bp->tx_nr_pages * TX_DESC_CNT) - 1; 3476 3476 3477 - ring_size = bp->rx_ring_size * (2 + agg_factor) + bp->tx_ring_size; 3477 + max_rx_cmpl = bp->rx_ring_size; 3478 + /* MAX TPA needs to be added because TPA_START completions are 3479 + * immediately recycled, so the TPA completions are not bound by 3480 + * the RX ring size. 3481 + */ 3482 + if (bp->flags & BNXT_FLAG_TPA) 3483 + max_rx_cmpl += bp->max_tpa; 3484 + /* RX and TPA completions are 32-byte, all others are 16-byte */ 3485 + ring_size = max_rx_cmpl * 2 + agg_ring_size + bp->tx_ring_size; 3478 3486 bp->cp_ring_size = ring_size; 3479 3487 3480 3488 bp->cp_nr_pages = bnxt_calc_nr_ring_pages(ring_size, CP_DESC_CNT); ··· 10393 10385 &bp->sp_event)) 10394 10386 bnxt_hwrm_phy_qcaps(bp); 10395 10387 10396 - if (test_and_clear_bit(BNXT_LINK_CFG_CHANGE_SP_EVENT, 10397 - &bp->sp_event)) 10398 - bnxt_init_ethtool_link_settings(bp); 10399 - 10400 10388 rc = bnxt_update_link(bp, true); 10401 - mutex_unlock(&bp->link_lock); 10402 10389 if (rc) 10403 10390 netdev_err(bp->dev, "SP task can't update link (rc: %x)\n", 10404 10391 rc); 10392 + 10393 + if (test_and_clear_bit(BNXT_LINK_CFG_CHANGE_SP_EVENT, 10394 + &bp->sp_event)) 10395 + bnxt_init_ethtool_link_settings(bp); 10396 + mutex_unlock(&bp->link_lock); 10405 10397 } 10406 10398 if (test_and_clear_bit(BNXT_UPDATE_PHY_SP_EVENT, &bp->sp_event)) { 10407 10399 int rc;
+4 -1
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
··· 1765 1765 if (epause->tx_pause) 1766 1766 link_info->req_flow_ctrl |= BNXT_LINK_PAUSE_TX; 1767 1767 1768 - if (netif_running(dev)) 1768 + if (netif_running(dev)) { 1769 + mutex_lock(&bp->link_lock); 1769 1770 rc = bnxt_hwrm_set_pause(bp); 1771 + mutex_unlock(&bp->link_lock); 1772 + } 1770 1773 return rc; 1771 1774 } 1772 1775
+65 -79
drivers/net/ethernet/broadcom/genet/bcmgenet.c
··· 543 543 #define VALIDATE_MASK(x) \ 544 544 bcmgenet_hfb_validate_mask(&(x), sizeof(x)) 545 545 546 - static int bcmgenet_hfb_insert_data(u32 *f, int offset, 547 - void *val, void *mask, size_t size) 546 + static int bcmgenet_hfb_insert_data(struct bcmgenet_priv *priv, u32 f_index, 547 + u32 offset, void *val, void *mask, 548 + size_t size) 548 549 { 549 - int index; 550 - u32 tmp; 550 + u32 index, tmp; 551 551 552 - index = offset / 2; 553 - tmp = f[index]; 552 + index = f_index * priv->hw_params->hfb_filter_size + offset / 2; 553 + tmp = bcmgenet_hfb_readl(priv, index * sizeof(u32)); 554 554 555 555 while (size--) { 556 556 if (offset++ & 1) { ··· 567 567 tmp |= 0x10000; 568 568 break; 569 569 } 570 - f[index++] = tmp; 570 + bcmgenet_hfb_writel(priv, tmp, index++ * sizeof(u32)); 571 571 if (size) 572 - tmp = f[index]; 572 + tmp = bcmgenet_hfb_readl(priv, 573 + index * sizeof(u32)); 573 574 } else { 574 575 tmp &= ~0xCFF00; 575 576 tmp |= (*(unsigned char *)val++) << 8; ··· 586 585 break; 587 586 } 588 587 if (!size) 589 - f[index] = tmp; 588 + bcmgenet_hfb_writel(priv, tmp, index * sizeof(u32)); 590 589 } 591 590 } 592 591 593 592 return 0; 594 593 } 595 594 596 - static void bcmgenet_hfb_set_filter(struct bcmgenet_priv *priv, u32 *f_data, 597 - u32 f_length, u32 rx_queue, int f_index) 598 - { 599 - u32 base = f_index * priv->hw_params->hfb_filter_size; 600 - int i; 601 - 602 - for (i = 0; i < f_length; i++) 603 - bcmgenet_hfb_writel(priv, f_data[i], (base + i) * sizeof(u32)); 604 - 605 - bcmgenet_hfb_set_filter_length(priv, f_index, 2 * f_length); 606 - bcmgenet_hfb_set_filter_rx_queue_mapping(priv, f_index, rx_queue); 607 - } 608 - 609 - static int bcmgenet_hfb_create_rxnfc_filter(struct bcmgenet_priv *priv, 610 - struct bcmgenet_rxnfc_rule *rule) 595 + static void bcmgenet_hfb_create_rxnfc_filter(struct bcmgenet_priv *priv, 596 + struct bcmgenet_rxnfc_rule *rule) 611 597 { 612 598 struct ethtool_rx_flow_spec *fs = &rule->fs; 613 - int err = 0, offset = 0, f_length = 0; 599 + u32 offset = 0, f_length = 0, f; 614 600 u8 val_8, mask_8; 615 601 __be16 val_16; 616 602 u16 mask_16; 617 603 size_t size; 618 - u32 *f_data; 619 604 620 - f_data = kcalloc(priv->hw_params->hfb_filter_size, sizeof(u32), 621 - GFP_KERNEL); 622 - if (!f_data) 623 - return -ENOMEM; 624 - 605 + f = fs->location; 625 606 if (fs->flow_type & FLOW_MAC_EXT) { 626 - bcmgenet_hfb_insert_data(f_data, 0, 607 + bcmgenet_hfb_insert_data(priv, f, 0, 627 608 &fs->h_ext.h_dest, &fs->m_ext.h_dest, 628 609 sizeof(fs->h_ext.h_dest)); 629 610 } ··· 613 630 if (fs->flow_type & FLOW_EXT) { 614 631 if (fs->m_ext.vlan_etype || 615 632 fs->m_ext.vlan_tci) { 616 - bcmgenet_hfb_insert_data(f_data, 12, 633 + bcmgenet_hfb_insert_data(priv, f, 12, 617 634 &fs->h_ext.vlan_etype, 618 635 &fs->m_ext.vlan_etype, 619 636 sizeof(fs->h_ext.vlan_etype)); 620 - bcmgenet_hfb_insert_data(f_data, 14, 637 + bcmgenet_hfb_insert_data(priv, f, 14, 621 638 &fs->h_ext.vlan_tci, 622 639 &fs->m_ext.vlan_tci, 623 640 sizeof(fs->h_ext.vlan_tci)); ··· 629 646 switch (fs->flow_type & ~(FLOW_EXT | FLOW_MAC_EXT)) { 630 647 case ETHER_FLOW: 631 648 f_length += DIV_ROUND_UP(ETH_HLEN, 2); 632 - bcmgenet_hfb_insert_data(f_data, 0, 649 + bcmgenet_hfb_insert_data(priv, f, 0, 633 650 &fs->h_u.ether_spec.h_dest, 634 651 &fs->m_u.ether_spec.h_dest, 635 652 sizeof(fs->h_u.ether_spec.h_dest)); 636 - bcmgenet_hfb_insert_data(f_data, ETH_ALEN, 653 + bcmgenet_hfb_insert_data(priv, f, ETH_ALEN, 637 654 &fs->h_u.ether_spec.h_source, 638 655 &fs->m_u.ether_spec.h_source, 639 656 sizeof(fs->h_u.ether_spec.h_source)); 640 - bcmgenet_hfb_insert_data(f_data, (2 * ETH_ALEN) + offset, 657 + bcmgenet_hfb_insert_data(priv, f, (2 * ETH_ALEN) + offset, 641 658 &fs->h_u.ether_spec.h_proto, 642 659 &fs->m_u.ether_spec.h_proto, 643 660 sizeof(fs->h_u.ether_spec.h_proto)); ··· 647 664 /* Specify IP Ether Type */ 648 665 val_16 = htons(ETH_P_IP); 649 666 mask_16 = 0xFFFF; 650 - bcmgenet_hfb_insert_data(f_data, (2 * ETH_ALEN) + offset, 667 + bcmgenet_hfb_insert_data(priv, f, (2 * ETH_ALEN) + offset, 651 668 &val_16, &mask_16, sizeof(val_16)); 652 - bcmgenet_hfb_insert_data(f_data, 15 + offset, 669 + bcmgenet_hfb_insert_data(priv, f, 15 + offset, 653 670 &fs->h_u.usr_ip4_spec.tos, 654 671 &fs->m_u.usr_ip4_spec.tos, 655 672 sizeof(fs->h_u.usr_ip4_spec.tos)); 656 - bcmgenet_hfb_insert_data(f_data, 23 + offset, 673 + bcmgenet_hfb_insert_data(priv, f, 23 + offset, 657 674 &fs->h_u.usr_ip4_spec.proto, 658 675 &fs->m_u.usr_ip4_spec.proto, 659 676 sizeof(fs->h_u.usr_ip4_spec.proto)); 660 - bcmgenet_hfb_insert_data(f_data, 26 + offset, 677 + bcmgenet_hfb_insert_data(priv, f, 26 + offset, 661 678 &fs->h_u.usr_ip4_spec.ip4src, 662 679 &fs->m_u.usr_ip4_spec.ip4src, 663 680 sizeof(fs->h_u.usr_ip4_spec.ip4src)); 664 - bcmgenet_hfb_insert_data(f_data, 30 + offset, 681 + bcmgenet_hfb_insert_data(priv, f, 30 + offset, 665 682 &fs->h_u.usr_ip4_spec.ip4dst, 666 683 &fs->m_u.usr_ip4_spec.ip4dst, 667 684 sizeof(fs->h_u.usr_ip4_spec.ip4dst)); ··· 671 688 /* Only supports 20 byte IPv4 header */ 672 689 val_8 = 0x45; 673 690 mask_8 = 0xFF; 674 - bcmgenet_hfb_insert_data(f_data, ETH_HLEN + offset, 691 + bcmgenet_hfb_insert_data(priv, f, ETH_HLEN + offset, 675 692 &val_8, &mask_8, 676 693 sizeof(val_8)); 677 694 size = sizeof(fs->h_u.usr_ip4_spec.l4_4_bytes); 678 - bcmgenet_hfb_insert_data(f_data, 695 + bcmgenet_hfb_insert_data(priv, f, 679 696 ETH_HLEN + 20 + offset, 680 697 &fs->h_u.usr_ip4_spec.l4_4_bytes, 681 698 &fs->m_u.usr_ip4_spec.l4_4_bytes, ··· 684 701 break; 685 702 } 686 703 704 + bcmgenet_hfb_set_filter_length(priv, f, 2 * f_length); 687 705 if (!fs->ring_cookie || fs->ring_cookie == RX_CLS_FLOW_WAKE) { 688 706 /* Ring 0 flows can be handled by the default Descriptor Ring 689 707 * We'll map them to ring 0, but don't enable the filter 690 708 */ 691 - bcmgenet_hfb_set_filter(priv, f_data, f_length, 0, 692 - fs->location); 709 + bcmgenet_hfb_set_filter_rx_queue_mapping(priv, f, 0); 693 710 rule->state = BCMGENET_RXNFC_STATE_DISABLED; 694 711 } else { 695 712 /* Other Rx rings are direct mapped here */ 696 - bcmgenet_hfb_set_filter(priv, f_data, f_length, 697 - fs->ring_cookie, fs->location); 698 - bcmgenet_hfb_enable_filter(priv, fs->location); 713 + bcmgenet_hfb_set_filter_rx_queue_mapping(priv, f, 714 + fs->ring_cookie); 715 + bcmgenet_hfb_enable_filter(priv, f); 699 716 rule->state = BCMGENET_RXNFC_STATE_ENABLED; 700 717 } 701 - 702 - kfree(f_data); 703 - 704 - return err; 705 718 } 706 719 707 720 /* bcmgenet_hfb_clear 708 721 * 709 722 * Clear Hardware Filter Block and disable all filtering. 710 723 */ 724 + static void bcmgenet_hfb_clear_filter(struct bcmgenet_priv *priv, u32 f_index) 725 + { 726 + u32 base, i; 727 + 728 + base = f_index * priv->hw_params->hfb_filter_size; 729 + for (i = 0; i < priv->hw_params->hfb_filter_size; i++) 730 + bcmgenet_hfb_writel(priv, 0x0, (base + i) * sizeof(u32)); 731 + } 732 + 711 733 static void bcmgenet_hfb_clear(struct bcmgenet_priv *priv) 712 734 { 713 735 u32 i; 736 + 737 + if (GENET_IS_V1(priv) || GENET_IS_V2(priv)) 738 + return; 714 739 715 740 bcmgenet_hfb_reg_writel(priv, 0x0, HFB_CTRL); 716 741 bcmgenet_hfb_reg_writel(priv, 0x0, HFB_FLT_ENABLE_V3PLUS); ··· 731 740 bcmgenet_hfb_reg_writel(priv, 0x0, 732 741 HFB_FLT_LEN_V3PLUS + i * sizeof(u32)); 733 742 734 - for (i = 0; i < priv->hw_params->hfb_filter_cnt * 735 - priv->hw_params->hfb_filter_size; i++) 736 - bcmgenet_hfb_writel(priv, 0x0, i * sizeof(u32)); 743 + for (i = 0; i < priv->hw_params->hfb_filter_cnt; i++) 744 + bcmgenet_hfb_clear_filter(priv, i); 737 745 } 738 746 739 747 static void bcmgenet_hfb_init(struct bcmgenet_priv *priv) 740 748 { 741 749 int i; 742 750 751 + INIT_LIST_HEAD(&priv->rxnfc_list); 743 752 if (GENET_IS_V1(priv) || GENET_IS_V2(priv)) 744 753 return; 745 754 746 - INIT_LIST_HEAD(&priv->rxnfc_list); 747 755 for (i = 0; i < MAX_NUM_OF_FS_RULES; i++) { 748 756 INIT_LIST_HEAD(&priv->rxnfc_rules[i].list); 749 757 priv->rxnfc_rules[i].state = BCMGENET_RXNFC_STATE_UNUSED; ··· 1427 1437 loc_rule = &priv->rxnfc_rules[cmd->fs.location]; 1428 1438 if (loc_rule->state == BCMGENET_RXNFC_STATE_ENABLED) 1429 1439 bcmgenet_hfb_disable_filter(priv, cmd->fs.location); 1430 - if (loc_rule->state != BCMGENET_RXNFC_STATE_UNUSED) 1440 + if (loc_rule->state != BCMGENET_RXNFC_STATE_UNUSED) { 1431 1441 list_del(&loc_rule->list); 1442 + bcmgenet_hfb_clear_filter(priv, cmd->fs.location); 1443 + } 1432 1444 loc_rule->state = BCMGENET_RXNFC_STATE_UNUSED; 1433 1445 memcpy(&loc_rule->fs, &cmd->fs, 1434 1446 sizeof(struct ethtool_rx_flow_spec)); 1435 1447 1436 - err = bcmgenet_hfb_create_rxnfc_filter(priv, loc_rule); 1437 - if (err) { 1438 - netdev_err(dev, "rxnfc: Could not install rule (%d)\n", 1439 - err); 1440 - return err; 1441 - } 1448 + bcmgenet_hfb_create_rxnfc_filter(priv, loc_rule); 1442 1449 1443 1450 list_add_tail(&loc_rule->list, &priv->rxnfc_list); 1444 1451 ··· 1460 1473 1461 1474 if (rule->state == BCMGENET_RXNFC_STATE_ENABLED) 1462 1475 bcmgenet_hfb_disable_filter(priv, cmd->fs.location); 1463 - if (rule->state != BCMGENET_RXNFC_STATE_UNUSED) 1476 + if (rule->state != BCMGENET_RXNFC_STATE_UNUSED) { 1464 1477 list_del(&rule->list); 1478 + bcmgenet_hfb_clear_filter(priv, cmd->fs.location); 1479 + } 1465 1480 rule->state = BCMGENET_RXNFC_STATE_UNUSED; 1466 1481 memset(&rule->fs, 0, sizeof(struct ethtool_rx_flow_spec)); 1467 1482 ··· 3988 3999 if (err) 3989 4000 err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); 3990 4001 if (err) 3991 - goto err; 4002 + goto err_clk_disable; 3992 4003 3993 4004 /* Mii wait queue */ 3994 4005 init_waitqueue_head(&priv->wq); ··· 4000 4011 if (IS_ERR(priv->clk_wol)) { 4001 4012 dev_dbg(&priv->pdev->dev, "failed to get enet-wol clock\n"); 4002 4013 err = PTR_ERR(priv->clk_wol); 4003 - goto err; 4014 + goto err_clk_disable; 4004 4015 } 4005 4016 4006 4017 priv->clk_eee = devm_clk_get_optional(&priv->pdev->dev, "enet-eee"); 4007 4018 if (IS_ERR(priv->clk_eee)) { 4008 4019 dev_dbg(&priv->pdev->dev, "failed to get enet-eee clock\n"); 4009 4020 err = PTR_ERR(priv->clk_eee); 4010 - goto err; 4021 + goto err_clk_disable; 4011 4022 } 4012 4023 4013 4024 /* If this is an internal GPHY, power it on now, before UniMAC is ··· 4118 4129 { 4119 4130 struct net_device *dev = dev_get_drvdata(d); 4120 4131 struct bcmgenet_priv *priv = netdev_priv(dev); 4132 + struct bcmgenet_rxnfc_rule *rule; 4121 4133 unsigned long dma_ctrl; 4122 - u32 offset, reg; 4134 + u32 reg; 4123 4135 int ret; 4124 4136 4125 4137 if (!netif_running(dev)) ··· 4151 4161 4152 4162 bcmgenet_set_hw_addr(priv, dev->dev_addr); 4153 4163 4154 - offset = HFB_FLT_ENABLE_V3PLUS; 4155 - bcmgenet_hfb_reg_writel(priv, priv->hfb_en[1], offset); 4156 - bcmgenet_hfb_reg_writel(priv, priv->hfb_en[2], offset + sizeof(u32)); 4157 - bcmgenet_hfb_reg_writel(priv, priv->hfb_en[0], HFB_CTRL); 4164 + /* Restore hardware filters */ 4165 + bcmgenet_hfb_clear(priv); 4166 + list_for_each_entry(rule, &priv->rxnfc_list, list) 4167 + if (rule->state != BCMGENET_RXNFC_STATE_UNUSED) 4168 + bcmgenet_hfb_create_rxnfc_filter(priv, rule); 4158 4169 4159 4170 if (priv->internal_phy) { 4160 4171 reg = bcmgenet_ext_readl(priv, EXT_EXT_PWR_MGMT); ··· 4199 4208 { 4200 4209 struct net_device *dev = dev_get_drvdata(d); 4201 4210 struct bcmgenet_priv *priv = netdev_priv(dev); 4202 - u32 offset; 4203 4211 4204 4212 if (!netif_running(dev)) 4205 4213 return 0; ··· 4210 4220 if (!device_may_wakeup(d)) 4211 4221 phy_suspend(dev->phydev); 4212 4222 4213 - /* Preserve filter state and disable filtering */ 4214 - priv->hfb_en[0] = bcmgenet_hfb_reg_readl(priv, HFB_CTRL); 4215 - offset = HFB_FLT_ENABLE_V3PLUS; 4216 - priv->hfb_en[1] = bcmgenet_hfb_reg_readl(priv, offset); 4217 - priv->hfb_en[2] = bcmgenet_hfb_reg_readl(priv, offset + sizeof(u32)); 4223 + /* Disable filtering */ 4218 4224 bcmgenet_hfb_reg_writel(priv, 0, HFB_CTRL); 4219 4225 4220 4226 return 0;
-1
drivers/net/ethernet/broadcom/genet/bcmgenet.h
··· 696 696 u32 wolopts; 697 697 u8 sopass[SOPASS_MAX]; 698 698 bool wol_active; 699 - u32 hfb_en[3]; 700 699 701 700 struct bcmgenet_mib_counters mib; 702 701
+15 -7
drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c
··· 217 217 218 218 priv->wol_active = 0; 219 219 clk_disable_unprepare(priv->clk_wol); 220 + priv->crc_fwd_en = 0; 220 221 221 222 /* Disable Magic Packet Detection */ 222 - reg = bcmgenet_umac_readl(priv, UMAC_MPD_CTRL); 223 - reg &= ~(MPD_EN | MPD_PW_EN); 224 - bcmgenet_umac_writel(priv, reg, UMAC_MPD_CTRL); 223 + if (priv->wolopts & (WAKE_MAGIC | WAKE_MAGICSECURE)) { 224 + reg = bcmgenet_umac_readl(priv, UMAC_MPD_CTRL); 225 + if (!(reg & MPD_EN)) 226 + return; /* already reset so skip the rest */ 227 + reg &= ~(MPD_EN | MPD_PW_EN); 228 + bcmgenet_umac_writel(priv, reg, UMAC_MPD_CTRL); 229 + } 225 230 226 231 /* Disable WAKE_FILTER Detection */ 227 - reg = bcmgenet_hfb_reg_readl(priv, HFB_CTRL); 228 - reg &= ~(RBUF_HFB_EN | RBUF_ACPI_EN); 229 - bcmgenet_hfb_reg_writel(priv, reg, HFB_CTRL); 232 + if (priv->wolopts & WAKE_FILTER) { 233 + reg = bcmgenet_hfb_reg_readl(priv, HFB_CTRL); 234 + if (!(reg & RBUF_ACPI_EN)) 235 + return; /* already reset so skip the rest */ 236 + reg &= ~(RBUF_HFB_EN | RBUF_ACPI_EN); 237 + bcmgenet_hfb_reg_writel(priv, reg, HFB_CTRL); 238 + } 230 239 231 240 /* Disable CRC Forward */ 232 241 reg = bcmgenet_umac_readl(priv, UMAC_CMD); 233 242 reg &= ~CMD_CRC_FWD; 234 243 bcmgenet_umac_writel(priv, reg, UMAC_CMD); 235 - priv->crc_fwd_en = 0; 236 244 }
+1 -1
drivers/net/ethernet/cadence/macb_main.c
··· 3736 3736 3737 3737 if (!(bp->caps & MACB_CAPS_USRIO_DISABLED)) { 3738 3738 val = 0; 3739 - if (bp->phy_interface == PHY_INTERFACE_MODE_RGMII) 3739 + if (phy_interface_mode_is_rgmii(bp->phy_interface)) 3740 3740 val = GEM_BIT(RGMII); 3741 3741 else if (bp->phy_interface == PHY_INTERFACE_MODE_RMII && 3742 3742 (bp->caps & MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII))
+1
drivers/net/ethernet/chelsio/cxgb4/sge.c
··· 2938 2938 txq_info = adap->sge.uld_txq_info[tx_uld_type]; 2939 2939 if (unlikely(!txq_info)) { 2940 2940 WARN_ON(true); 2941 + kfree_skb(skb); 2941 2942 return NET_XMIT_DROP; 2942 2943 } 2943 2944
+1 -1
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
··· 2938 2938 DMA_BIT_MASK(40)); 2939 2939 if (err) { 2940 2940 netdev_err(net_dev, "dma_coerce_mask_and_coherent() failed\n"); 2941 - return err; 2941 + goto free_netdev; 2942 2942 } 2943 2943 2944 2944 /* If fsl_fm_max_frm is set to a higher value than the all-common 1500,
+1 -1
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
··· 3632 3632 3633 3633 dpni_dev = to_fsl_mc_device(priv->net_dev->dev.parent); 3634 3634 dpmac_dev = fsl_mc_get_endpoint(dpni_dev); 3635 - if (IS_ERR(dpmac_dev) || dpmac_dev->dev.type != &fsl_mc_bus_dpmac_type) 3635 + if (IS_ERR_OR_NULL(dpmac_dev) || dpmac_dev->dev.type != &fsl_mc_bus_dpmac_type) 3636 3636 return 0; 3637 3637 3638 3638 if (dpaa2_mac_is_type_fixed(dpmac_dev, priv->mc_io))
+1
drivers/net/ethernet/freescale/enetc/enetc_pf.c
··· 906 906 return 0; 907 907 908 908 err_reg_netdev: 909 + enetc_mdio_remove(pf); 909 910 enetc_of_put_phy(priv); 910 911 enetc_free_msix(priv); 911 912 err_alloc_msix:
+1
drivers/net/ethernet/freescale/fec.h
··· 590 590 void fec_ptp_init(struct platform_device *pdev, int irq_idx); 591 591 void fec_ptp_stop(struct platform_device *pdev); 592 592 void fec_ptp_start_cyclecounter(struct net_device *ndev); 593 + void fec_ptp_disable_hwts(struct net_device *ndev); 593 594 int fec_ptp_set(struct net_device *ndev, struct ifreq *ifr); 594 595 int fec_ptp_get(struct net_device *ndev, struct ifreq *ifr); 595 596
+17 -6
drivers/net/ethernet/freescale/fec_main.c
··· 1294 1294 ndev->stats.tx_bytes += skb->len; 1295 1295 } 1296 1296 1297 - if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_IN_PROGRESS) && 1298 - fep->bufdesc_ex) { 1297 + /* NOTE: SKBTX_IN_PROGRESS being set does not imply it's we who 1298 + * are to time stamp the packet, so we still need to check time 1299 + * stamping enabled flag. 1300 + */ 1301 + if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_IN_PROGRESS && 1302 + fep->hwts_tx_en) && 1303 + fep->bufdesc_ex) { 1299 1304 struct skb_shared_hwtstamps shhwtstamps; 1300 1305 struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp; 1301 1306 ··· 2728 2723 return -ENODEV; 2729 2724 2730 2725 if (fep->bufdesc_ex) { 2731 - if (cmd == SIOCSHWTSTAMP) 2732 - return fec_ptp_set(ndev, rq); 2733 - if (cmd == SIOCGHWTSTAMP) 2734 - return fec_ptp_get(ndev, rq); 2726 + bool use_fec_hwts = !phy_has_hwtstamp(phydev); 2727 + 2728 + if (cmd == SIOCSHWTSTAMP) { 2729 + if (use_fec_hwts) 2730 + return fec_ptp_set(ndev, rq); 2731 + fec_ptp_disable_hwts(ndev); 2732 + } else if (cmd == SIOCGHWTSTAMP) { 2733 + if (use_fec_hwts) 2734 + return fec_ptp_get(ndev, rq); 2735 + } 2735 2736 } 2736 2737 2737 2738 return phy_mii_ioctl(phydev, rq, cmd);
+12
drivers/net/ethernet/freescale/fec_ptp.c
··· 452 452 return -EOPNOTSUPP; 453 453 } 454 454 455 + /** 456 + * fec_ptp_disable_hwts - disable hardware time stamping 457 + * @ndev: pointer to net_device 458 + */ 459 + void fec_ptp_disable_hwts(struct net_device *ndev) 460 + { 461 + struct fec_enet_private *fep = netdev_priv(ndev); 462 + 463 + fep->hwts_tx_en = 0; 464 + fep->hwts_rx_en = 0; 465 + } 466 + 455 467 int fec_ptp_set(struct net_device *ndev, struct ifreq *ifr) 456 468 { 457 469 struct fec_enet_private *fep = netdev_priv(ndev);
+5 -1
drivers/net/ethernet/freescale/gianfar.c
··· 779 779 780 780 mac_addr = of_get_mac_address(np); 781 781 782 - if (!IS_ERR(mac_addr)) 782 + if (!IS_ERR(mac_addr)) { 783 783 ether_addr_copy(dev->dev_addr, mac_addr); 784 + } else { 785 + eth_hw_addr_random(dev); 786 + dev_info(&ofdev->dev, "Using random MAC address: %pM\n", dev->dev_addr); 787 + } 784 788 785 789 if (model && !strcasecmp(model, "TSEC")) 786 790 priv->device_flags |= FSL_GIANFAR_DEV_HAS_GIGABIT |
+1
drivers/net/ethernet/hisilicon/hns3/hnae3.h
··· 77 77 ((ring)->p = ((ring)->p - 1 + (ring)->desc_num) % (ring)->desc_num) 78 78 79 79 enum hns_desc_type { 80 + DESC_TYPE_UNKNOWN, 80 81 DESC_TYPE_SKB, 81 82 DESC_TYPE_FRAGLIST_SKB, 82 83 DESC_TYPE_PAGE,
+12 -12
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
··· 1118 1118 return -ENOMEM; 1119 1119 } 1120 1120 1121 + desc_cb->priv = priv; 1121 1122 desc_cb->length = size; 1123 + desc_cb->dma = dma; 1124 + desc_cb->type = type; 1122 1125 1123 1126 if (likely(size <= HNS3_MAX_BD_SIZE)) { 1124 - desc_cb->priv = priv; 1125 - desc_cb->dma = dma; 1126 - desc_cb->type = type; 1127 1127 desc->addr = cpu_to_le64(dma); 1128 1128 desc->tx.send_size = cpu_to_le16(size); 1129 1129 desc->tx.bdtp_fe_sc_vld_ra_ri = ··· 1135 1135 } 1136 1136 1137 1137 frag_buf_num = hns3_tx_bd_count(size); 1138 - sizeoflast = size & HNS3_TX_LAST_SIZE_M; 1138 + sizeoflast = size % HNS3_MAX_BD_SIZE; 1139 1139 sizeoflast = sizeoflast ? sizeoflast : HNS3_MAX_BD_SIZE; 1140 1140 1141 1141 /* When frag size is bigger than hardware limit, split this frag */ 1142 1142 for (k = 0; k < frag_buf_num; k++) { 1143 - /* The txbd's baseinfo of DESC_TYPE_PAGE & DESC_TYPE_SKB */ 1144 - desc_cb->priv = priv; 1145 - desc_cb->dma = dma + HNS3_MAX_BD_SIZE * k; 1146 - desc_cb->type = ((type == DESC_TYPE_FRAGLIST_SKB || 1147 - type == DESC_TYPE_SKB) && !k) ? 1148 - type : DESC_TYPE_PAGE; 1149 - 1150 1143 /* now, fill the descriptor */ 1151 1144 desc->addr = cpu_to_le64(dma + HNS3_MAX_BD_SIZE * k); 1152 1145 desc->tx.send_size = cpu_to_le16((k == frag_buf_num - 1) ? ··· 1151 1158 /* move ring pointer to next */ 1152 1159 ring_ptr_move_fw(ring, next_to_use); 1153 1160 1154 - desc_cb = &ring->desc_cb[ring->next_to_use]; 1155 1161 desc = &ring->desc[ring->next_to_use]; 1156 1162 } 1157 1163 ··· 1338 1346 unsigned int i; 1339 1347 1340 1348 for (i = 0; i < ring->desc_num; i++) { 1349 + struct hns3_desc *desc = &ring->desc[ring->next_to_use]; 1350 + 1351 + memset(desc, 0, sizeof(*desc)); 1352 + 1341 1353 /* check if this is where we started */ 1342 1354 if (ring->next_to_use == next_to_use_orig) 1343 1355 break; 1344 1356 1345 1357 /* rollback one */ 1346 1358 ring_ptr_move_bw(ring, next_to_use); 1359 + 1360 + if (!ring->desc_cb[ring->next_to_use].dma) 1361 + continue; 1347 1362 1348 1363 /* unmap the descriptor dma address */ 1349 1364 if (ring->desc_cb[ring->next_to_use].type == DESC_TYPE_SKB || ··· 1368 1369 1369 1370 ring->desc_cb[ring->next_to_use].length = 0; 1370 1371 ring->desc_cb[ring->next_to_use].dma = 0; 1372 + ring->desc_cb[ring->next_to_use].type = DESC_TYPE_UNKNOWN; 1371 1373 } 1372 1374 } 1373 1375
-2
drivers/net/ethernet/hisilicon/hns3/hns3_enet.h
··· 165 165 #define HNS3_TXD_MSS_S 0 166 166 #define HNS3_TXD_MSS_M (0x3fff << HNS3_TXD_MSS_S) 167 167 168 - #define HNS3_TX_LAST_SIZE_M 0xffff 169 - 170 168 #define HNS3_VECTOR_TX_IRQ BIT_ULL(0) 171 169 #define HNS3_VECTOR_RX_IRQ BIT_ULL(1) 172 170
+22 -27
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
··· 2673 2673 delay_time); 2674 2674 } 2675 2675 2676 - static int hclge_get_mac_link_status(struct hclge_dev *hdev) 2676 + static int hclge_get_mac_link_status(struct hclge_dev *hdev, int *link_status) 2677 2677 { 2678 2678 struct hclge_link_status_cmd *req; 2679 2679 struct hclge_desc desc; 2680 - int link_status; 2681 2680 int ret; 2682 2681 2683 2682 hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_QUERY_LINK_STATUS, true); ··· 2688 2689 } 2689 2690 2690 2691 req = (struct hclge_link_status_cmd *)desc.data; 2691 - link_status = req->status & HCLGE_LINK_STATUS_UP_M; 2692 + *link_status = (req->status & HCLGE_LINK_STATUS_UP_M) > 0 ? 2693 + HCLGE_LINK_STATUS_UP : HCLGE_LINK_STATUS_DOWN; 2692 2694 2693 - return !!link_status; 2695 + return 0; 2694 2696 } 2695 2697 2696 - static int hclge_get_mac_phy_link(struct hclge_dev *hdev) 2698 + static int hclge_get_mac_phy_link(struct hclge_dev *hdev, int *link_status) 2697 2699 { 2698 - unsigned int mac_state; 2699 - int link_stat; 2700 + struct phy_device *phydev = hdev->hw.mac.phydev; 2701 + 2702 + *link_status = HCLGE_LINK_STATUS_DOWN; 2700 2703 2701 2704 if (test_bit(HCLGE_STATE_DOWN, &hdev->state)) 2702 2705 return 0; 2703 2706 2704 - mac_state = hclge_get_mac_link_status(hdev); 2707 + if (phydev && (phydev->state != PHY_RUNNING || !phydev->link)) 2708 + return 0; 2705 2709 2706 - if (hdev->hw.mac.phydev) { 2707 - if (hdev->hw.mac.phydev->state == PHY_RUNNING) 2708 - link_stat = mac_state & 2709 - hdev->hw.mac.phydev->link; 2710 - else 2711 - link_stat = 0; 2712 - 2713 - } else { 2714 - link_stat = mac_state; 2715 - } 2716 - 2717 - return !!link_stat; 2710 + return hclge_get_mac_link_status(hdev, link_status); 2718 2711 } 2719 2712 2720 2713 static void hclge_update_link_status(struct hclge_dev *hdev) ··· 2716 2725 struct hnae3_handle *rhandle; 2717 2726 struct hnae3_handle *handle; 2718 2727 int state; 2728 + int ret; 2719 2729 int i; 2720 2730 2721 2731 if (!client) ··· 2725 2733 if (test_and_set_bit(HCLGE_STATE_LINK_UPDATING, &hdev->state)) 2726 2734 return; 2727 2735 2728 - state = hclge_get_mac_phy_link(hdev); 2736 + ret = hclge_get_mac_phy_link(hdev, &state); 2737 + if (ret) { 2738 + clear_bit(HCLGE_STATE_LINK_UPDATING, &hdev->state); 2739 + return; 2740 + } 2741 + 2729 2742 if (state != hdev->hw.mac.link) { 2730 2743 for (i = 0; i < hdev->num_vmdq_vport + 1; i++) { 2731 2744 handle = &hdev->vport[i].nic; ··· 6521 6524 { 6522 6525 #define HCLGE_MAC_LINK_STATUS_NUM 100 6523 6526 6527 + int link_status; 6524 6528 int i = 0; 6525 6529 int ret; 6526 6530 6527 6531 do { 6528 - ret = hclge_get_mac_link_status(hdev); 6529 - if (ret < 0) 6532 + ret = hclge_get_mac_link_status(hdev, &link_status); 6533 + if (ret) 6530 6534 return ret; 6531 - else if (ret == link_ret) 6535 + if (link_status == link_ret) 6532 6536 return 0; 6533 6537 6534 6538 msleep(HCLGE_LINK_STATUS_MS); ··· 6540 6542 static int hclge_mac_phy_link_status_wait(struct hclge_dev *hdev, bool en, 6541 6543 bool is_phy) 6542 6544 { 6543 - #define HCLGE_LINK_STATUS_DOWN 0 6544 - #define HCLGE_LINK_STATUS_UP 1 6545 - 6546 6545 int link_ret; 6547 6546 6548 6547 link_ret = en ? HCLGE_LINK_STATUS_UP : HCLGE_LINK_STATUS_DOWN;
+3
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
··· 317 317 HCLGE_LF_XSFP_ABSENT, 318 318 }; 319 319 320 + #define HCLGE_LINK_STATUS_DOWN 0 321 + #define HCLGE_LINK_STATUS_UP 1 322 + 320 323 #define HCLGE_PG_NUM 4 321 324 #define HCLGE_SCH_MODE_SP 0 322 325 #define HCLGE_SCH_MODE_DWRR 1
+2 -1
drivers/net/ethernet/mellanox/mlxsw/core.c
··· 710 710 err = mlxsw_core_trap_register(mlxsw_core, &mlxsw_emad_rx_listener, 711 711 mlxsw_core); 712 712 if (err) 713 - return err; 713 + goto err_trap_register; 714 714 715 715 err = mlxsw_core->driver->basic_trap_groups_set(mlxsw_core); 716 716 if (err) ··· 722 722 err_emad_trap_set: 723 723 mlxsw_core_trap_unregister(mlxsw_core, &mlxsw_emad_rx_listener, 724 724 mlxsw_core); 725 + err_trap_register: 725 726 destroy_workqueue(mlxsw_core->emad_wq); 726 727 return err; 727 728 }
+32 -16
drivers/net/ethernet/mellanox/mlxsw/core_env.c
··· 45 45 static int 46 46 mlxsw_env_query_module_eeprom(struct mlxsw_core *mlxsw_core, int module, 47 47 u16 offset, u16 size, void *data, 48 - unsigned int *p_read_size) 48 + bool qsfp, unsigned int *p_read_size) 49 49 { 50 50 char eeprom_tmp[MLXSW_REG_MCIA_EEPROM_SIZE]; 51 51 char mcia_pl[MLXSW_REG_MCIA_LEN]; ··· 54 54 int status; 55 55 int err; 56 56 57 + /* MCIA register accepts buffer size <= 48. Page of size 128 should be 58 + * read by chunks of size 48, 48, 32. Align the size of the last chunk 59 + * to avoid reading after the end of the page. 60 + */ 57 61 size = min_t(u16, size, MLXSW_REG_MCIA_EEPROM_SIZE); 58 62 59 63 if (offset < MLXSW_REG_MCIA_EEPROM_PAGE_LENGTH && ··· 67 63 68 64 i2c_addr = MLXSW_REG_MCIA_I2C_ADDR_LOW; 69 65 if (offset >= MLXSW_REG_MCIA_EEPROM_PAGE_LENGTH) { 70 - page = MLXSW_REG_MCIA_PAGE_GET(offset); 71 - offset -= MLXSW_REG_MCIA_EEPROM_UP_PAGE_LENGTH * page; 72 - /* When reading upper pages 1, 2 and 3 the offset starts at 73 - * 128. Please refer to "QSFP+ Memory Map" figure in SFF-8436 74 - * specification for graphical depiction. 75 - * MCIA register accepts buffer size <= 48. Page of size 128 76 - * should be read by chunks of size 48, 48, 32. Align the size 77 - * of the last chunk to avoid reading after the end of the 78 - * page. 79 - */ 80 - if (offset + size > MLXSW_REG_MCIA_EEPROM_PAGE_LENGTH) 81 - size = MLXSW_REG_MCIA_EEPROM_PAGE_LENGTH - offset; 66 + if (qsfp) { 67 + /* When reading upper pages 1, 2 and 3 the offset 68 + * starts at 128. Please refer to "QSFP+ Memory Map" 69 + * figure in SFF-8436 specification for graphical 70 + * depiction. 71 + */ 72 + page = MLXSW_REG_MCIA_PAGE_GET(offset); 73 + offset -= MLXSW_REG_MCIA_EEPROM_UP_PAGE_LENGTH * page; 74 + if (offset + size > MLXSW_REG_MCIA_EEPROM_PAGE_LENGTH) 75 + size = MLXSW_REG_MCIA_EEPROM_PAGE_LENGTH - offset; 76 + } else { 77 + /* When reading upper pages 1, 2 and 3 the offset 78 + * starts at 0 and I2C high address is used. Please refer 79 + * refer to "Memory Organization" figure in SFF-8472 80 + * specification for graphical depiction. 81 + */ 82 + i2c_addr = MLXSW_REG_MCIA_I2C_ADDR_HIGH; 83 + offset -= MLXSW_REG_MCIA_EEPROM_PAGE_LENGTH; 84 + } 82 85 } 83 86 84 87 mlxsw_reg_mcia_pack(mcia_pl, module, 0, page, offset, size, i2c_addr); ··· 177 166 int err; 178 167 179 168 err = mlxsw_env_query_module_eeprom(mlxsw_core, module, 0, offset, 180 - module_info, &read_size); 169 + module_info, false, &read_size); 181 170 if (err) 182 171 return err; 183 172 ··· 208 197 /* Verify if transceiver provides diagnostic monitoring page */ 209 198 err = mlxsw_env_query_module_eeprom(mlxsw_core, module, 210 199 SFP_DIAGMON, 1, &diag_mon, 211 - &read_size); 200 + false, &read_size); 212 201 if (err) 213 202 return err; 214 203 ··· 236 225 int offset = ee->offset; 237 226 unsigned int read_size; 238 227 int i = 0; 228 + bool qsfp; 239 229 int err; 240 230 241 231 if (!ee->len) 242 232 return -EINVAL; 243 233 244 234 memset(data, 0, ee->len); 235 + /* Validate module identifier value. */ 236 + err = mlxsw_env_validate_cable_ident(mlxsw_core, module, &qsfp); 237 + if (err) 238 + return err; 245 239 246 240 while (i < ee->len) { 247 241 err = mlxsw_env_query_module_eeprom(mlxsw_core, module, offset, 248 242 ee->len - i, data + i, 249 - &read_size); 243 + qsfp, &read_size); 250 244 if (err) { 251 245 netdev_err(netdev, "Eeprom query failed\n"); 252 246 return err;
+1 -1
drivers/net/ethernet/neterion/vxge/vxge-main.c
··· 98 98 { 99 99 struct sk_buff **skb_ptr = NULL; 100 100 struct sk_buff **temp; 101 - #define NR_SKB_COMPLETED 128 101 + #define NR_SKB_COMPLETED 16 102 102 struct sk_buff *completed[NR_SKB_COMPLETED]; 103 103 int more; 104 104
+5 -2
drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
··· 103 103 void *p) 104 104 { 105 105 struct ionic_lif *lif = netdev_priv(netdev); 106 + unsigned int offset; 106 107 unsigned int size; 107 108 108 109 regs->version = IONIC_DEV_CMD_REG_VERSION; 109 110 111 + offset = 0; 110 112 size = IONIC_DEV_INFO_REG_COUNT * sizeof(u32); 111 - memcpy_fromio(p, lif->ionic->idev.dev_info_regs->words, size); 113 + memcpy_fromio(p + offset, lif->ionic->idev.dev_info_regs->words, size); 112 114 115 + offset += size; 113 116 size = IONIC_DEV_CMD_REG_COUNT * sizeof(u32); 114 - memcpy_fromio(p, lif->ionic->idev.dev_cmd_regs->words, size); 117 + memcpy_fromio(p + offset, lif->ionic->idev.dev_cmd_regs->words, size); 115 118 } 116 119 117 120 static int ionic_get_link_ksettings(struct net_device *netdev,
+25 -25
drivers/net/ethernet/pensando/ionic/ionic_lif.c
··· 96 96 u16 link_status; 97 97 bool link_up; 98 98 99 - if (!test_bit(IONIC_LIF_F_LINK_CHECK_REQUESTED, lif->state) || 100 - test_bit(IONIC_LIF_F_QUEUE_RESET, lif->state)) 99 + if (!test_bit(IONIC_LIF_F_LINK_CHECK_REQUESTED, lif->state)) 101 100 return; 102 101 103 102 link_status = le16_to_cpu(lif->info->status.link_status); ··· 113 114 netif_carrier_on(netdev); 114 115 } 115 116 116 - if (lif->netdev->flags & IFF_UP && netif_running(lif->netdev)) 117 + if (lif->netdev->flags & IFF_UP && netif_running(lif->netdev)) { 118 + mutex_lock(&lif->queue_lock); 117 119 ionic_start_queues(lif); 120 + mutex_unlock(&lif->queue_lock); 121 + } 118 122 } else { 119 123 if (netif_carrier_ok(netdev)) { 120 124 netdev_info(netdev, "Link down\n"); 121 125 netif_carrier_off(netdev); 122 126 } 123 127 124 - if (lif->netdev->flags & IFF_UP && netif_running(lif->netdev)) 128 + if (lif->netdev->flags & IFF_UP && netif_running(lif->netdev)) { 129 + mutex_lock(&lif->queue_lock); 125 130 ionic_stop_queues(lif); 131 + mutex_unlock(&lif->queue_lock); 132 + } 126 133 } 127 134 128 135 clear_bit(IONIC_LIF_F_LINK_CHECK_REQUESTED, lif->state); ··· 868 863 if (f) 869 864 return 0; 870 865 871 - netdev_dbg(lif->netdev, "rx_filter add ADDR %pM (id %d)\n", addr, 872 - ctx.comp.rx_filter_add.filter_id); 866 + netdev_dbg(lif->netdev, "rx_filter add ADDR %pM\n", addr); 873 867 874 868 memcpy(ctx.cmd.rx_filter_add.mac.addr, addr, ETH_ALEN); 875 869 err = ionic_adminq_post_wait(lif, &ctx); ··· 897 893 return -ENOENT; 898 894 } 899 895 896 + netdev_dbg(lif->netdev, "rx_filter del ADDR %pM (id %d)\n", 897 + addr, f->filter_id); 898 + 900 899 ctx.cmd.rx_filter_del.filter_id = cpu_to_le32(f->filter_id); 901 900 ionic_rx_filter_free(lif, f); 902 901 spin_unlock_bh(&lif->rx_filters.lock); ··· 907 900 err = ionic_adminq_post_wait(lif, &ctx); 908 901 if (err && err != -EEXIST) 909 902 return err; 910 - 911 - netdev_dbg(lif->netdev, "rx_filter del ADDR %pM (id %d)\n", addr, 912 - ctx.cmd.rx_filter_del.filter_id); 913 903 914 904 return 0; 915 905 } ··· 1355 1351 }; 1356 1352 int err; 1357 1353 1354 + netdev_dbg(netdev, "rx_filter add VLAN %d\n", vid); 1358 1355 err = ionic_adminq_post_wait(lif, &ctx); 1359 1356 if (err) 1360 1357 return err; 1361 - 1362 - netdev_dbg(netdev, "rx_filter add VLAN %d (id %d)\n", vid, 1363 - ctx.comp.rx_filter_add.filter_id); 1364 1358 1365 1359 return ionic_rx_filter_save(lif, 0, IONIC_RXQ_INDEX_ANY, 0, &ctx); 1366 1360 } ··· 1384 1382 return -ENOENT; 1385 1383 } 1386 1384 1387 - netdev_dbg(netdev, "rx_filter del VLAN %d (id %d)\n", vid, 1388 - le32_to_cpu(ctx.cmd.rx_filter_del.filter_id)); 1385 + netdev_dbg(netdev, "rx_filter del VLAN %d (id %d)\n", 1386 + vid, f->filter_id); 1389 1387 1390 1388 ctx.cmd.rx_filter_del.filter_id = cpu_to_le32(f->filter_id); 1391 1389 ionic_rx_filter_free(lif, f); ··· 1995 1993 bool running; 1996 1994 int err = 0; 1997 1995 1998 - err = ionic_wait_for_bit(lif, IONIC_LIF_F_QUEUE_RESET); 1999 - if (err) 2000 - return err; 2001 - 1996 + mutex_lock(&lif->queue_lock); 2002 1997 running = netif_running(lif->netdev); 2003 1998 if (running) { 2004 1999 netif_device_detach(lif->netdev); 2005 2000 err = ionic_stop(lif->netdev); 2006 2001 if (err) 2007 - goto reset_out; 2002 + return err; 2008 2003 } 2009 2004 2010 2005 if (cb) ··· 2011 2012 err = ionic_open(lif->netdev); 2012 2013 netif_device_attach(lif->netdev); 2013 2014 } 2014 - 2015 - reset_out: 2016 - clear_bit(IONIC_LIF_F_QUEUE_RESET, lif->state); 2015 + mutex_unlock(&lif->queue_lock); 2017 2016 2018 2017 return err; 2019 2018 } ··· 2158 2161 2159 2162 if (test_bit(IONIC_LIF_F_UP, lif->state)) { 2160 2163 dev_info(ionic->dev, "Surprise FW stop, stopping queues\n"); 2164 + mutex_lock(&lif->queue_lock); 2161 2165 ionic_stop_queues(lif); 2166 + mutex_unlock(&lif->queue_lock); 2162 2167 } 2163 2168 2164 2169 if (netif_running(lif->netdev)) { ··· 2279 2280 cancel_work_sync(&lif->deferred.work); 2280 2281 cancel_work_sync(&lif->tx_timeout_work); 2281 2282 ionic_rx_filters_deinit(lif); 2283 + if (lif->netdev->features & NETIF_F_RXHASH) 2284 + ionic_lif_rss_deinit(lif); 2282 2285 } 2283 - 2284 - if (lif->netdev->features & NETIF_F_RXHASH) 2285 - ionic_lif_rss_deinit(lif); 2286 2286 2287 2287 napi_disable(&lif->adminqcq->napi); 2288 2288 ionic_lif_qcq_deinit(lif, lif->notifyqcq); 2289 2289 ionic_lif_qcq_deinit(lif, lif->adminqcq); 2290 2290 2291 + mutex_destroy(&lif->queue_lock); 2291 2292 ionic_lif_reset(lif); 2292 2293 } 2293 2294 ··· 2464 2465 return err; 2465 2466 2466 2467 lif->hw_index = le16_to_cpu(comp.hw_index); 2468 + mutex_init(&lif->queue_lock); 2467 2469 2468 2470 /* now that we have the hw_index we can figure out our doorbell page */ 2469 2471 lif->dbid_count = le32_to_cpu(lif->ionic->ident.dev.ndbpgs_per_lif);
+1 -7
drivers/net/ethernet/pensando/ionic/ionic_lif.h
··· 135 135 IONIC_LIF_F_SW_DEBUG_STATS, 136 136 IONIC_LIF_F_UP, 137 137 IONIC_LIF_F_LINK_CHECK_REQUESTED, 138 - IONIC_LIF_F_QUEUE_RESET, 139 138 IONIC_LIF_F_FW_RESET, 140 139 141 140 /* leave this as last */ ··· 164 165 unsigned int hw_index; 165 166 unsigned int kern_pid; 166 167 u64 __iomem *kern_dbpage; 168 + struct mutex queue_lock; /* lock for queue structures */ 167 169 spinlock_t adminq_lock; /* lock for AdminQ operations */ 168 170 struct ionic_qcq *adminqcq; 169 171 struct ionic_qcq *notifyqcq; ··· 212 212 #define lif_to_rxstats(lif, i) ((lif)->rxqcqs[i].stats->rx) 213 213 #define lif_to_txq(lif, i) (&lif_to_txqcq((lif), i)->q) 214 214 #define lif_to_rxq(lif, i) (&lif_to_txqcq((lif), i)->q) 215 - 216 - /* return 0 if successfully set the bit, else non-zero */ 217 - static inline int ionic_wait_for_bit(struct ionic_lif *lif, int bitname) 218 - { 219 - return wait_on_bit_lock(lif->state, bitname, TASK_INTERRUPTIBLE); 220 - } 221 215 222 216 static inline u32 ionic_coal_usec_to_hw(struct ionic *ionic, u32 usecs) 223 217 {
+29
drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c
··· 21 21 void ionic_rx_filter_replay(struct ionic_lif *lif) 22 22 { 23 23 struct ionic_rx_filter_add_cmd *ac; 24 + struct hlist_head new_id_list; 24 25 struct ionic_admin_ctx ctx; 25 26 struct ionic_rx_filter *f; 26 27 struct hlist_head *head; 27 28 struct hlist_node *tmp; 29 + unsigned int key; 28 30 unsigned int i; 29 31 int err; 30 32 33 + INIT_HLIST_HEAD(&new_id_list); 31 34 ac = &ctx.cmd.rx_filter_add; 32 35 33 36 for (i = 0; i < IONIC_RX_FILTER_HLISTS; i++) { ··· 61 58 ac->mac.addr); 62 59 break; 63 60 } 61 + spin_lock_bh(&lif->rx_filters.lock); 62 + ionic_rx_filter_free(lif, f); 63 + spin_unlock_bh(&lif->rx_filters.lock); 64 + 65 + continue; 64 66 } 67 + 68 + /* remove from old id list, save new id in tmp list */ 69 + spin_lock_bh(&lif->rx_filters.lock); 70 + hlist_del(&f->by_id); 71 + spin_unlock_bh(&lif->rx_filters.lock); 72 + f->filter_id = le32_to_cpu(ctx.comp.rx_filter_add.filter_id); 73 + hlist_add_head(&f->by_id, &new_id_list); 65 74 } 66 75 } 76 + 77 + /* rebuild the by_id hash lists with the new filter ids */ 78 + spin_lock_bh(&lif->rx_filters.lock); 79 + hlist_for_each_entry_safe(f, tmp, &new_id_list, by_id) { 80 + key = f->filter_id & IONIC_RX_FILTER_HLISTS_MASK; 81 + head = &lif->rx_filters.by_id[key]; 82 + hlist_add_head(&f->by_id, head); 83 + } 84 + spin_unlock_bh(&lif->rx_filters.lock); 67 85 } 68 86 69 87 int ionic_rx_filters_init(struct ionic_lif *lif) ··· 93 69 94 70 spin_lock_init(&lif->rx_filters.lock); 95 71 72 + spin_lock_bh(&lif->rx_filters.lock); 96 73 for (i = 0; i < IONIC_RX_FILTER_HLISTS; i++) { 97 74 INIT_HLIST_HEAD(&lif->rx_filters.by_hash[i]); 98 75 INIT_HLIST_HEAD(&lif->rx_filters.by_id[i]); 99 76 } 77 + spin_unlock_bh(&lif->rx_filters.lock); 100 78 101 79 return 0; 102 80 } ··· 110 84 struct hlist_node *tmp; 111 85 unsigned int i; 112 86 87 + spin_lock_bh(&lif->rx_filters.lock); 113 88 for (i = 0; i < IONIC_RX_FILTER_HLISTS; i++) { 114 89 head = &lif->rx_filters.by_id[i]; 115 90 hlist_for_each_entry_safe(f, tmp, head, by_id) 116 91 ionic_rx_filter_free(lif, f); 117 92 } 93 + spin_unlock_bh(&lif->rx_filters.lock); 118 94 } 119 95 120 96 int ionic_rx_filter_save(struct ionic_lif *lif, u32 flow_id, u16 rxq_index, ··· 152 124 f->filter_id = le32_to_cpu(ctx->comp.rx_filter_add.filter_id); 153 125 f->rxq_index = rxq_index; 154 126 memcpy(&f->cmd, ac, sizeof(f->cmd)); 127 + netdev_dbg(lif->netdev, "rx_filter add filter_id %d\n", f->filter_id); 155 128 156 129 INIT_HLIST_NODE(&f->by_hash); 157 130 INIT_HLIST_NODE(&f->by_id);
-6
drivers/net/ethernet/pensando/ionic/ionic_txrx.c
··· 161 161 return; 162 162 } 163 163 164 - /* no packet processing while resetting */ 165 - if (unlikely(test_bit(IONIC_LIF_F_QUEUE_RESET, q->lif->state))) { 166 - stats->dropped++; 167 - return; 168 - } 169 - 170 164 stats->pkts++; 171 165 stats->bytes += le16_to_cpu(comp->len); 172 166
+2 -2
drivers/net/ethernet/qlogic/qed/qed_cxt.c
··· 2008 2008 enum protocol_type proto; 2009 2009 2010 2010 if (p_hwfn->mcp_info->func_info.protocol == QED_PCI_ETH_RDMA) { 2011 - DP_NOTICE(p_hwfn, 2012 - "Current day drivers don't support RoCE & iWARP simultaneously on the same PF. Default to RoCE-only\n"); 2011 + DP_VERBOSE(p_hwfn, QED_MSG_SP, 2012 + "Current day drivers don't support RoCE & iWARP simultaneously on the same PF. Default to RoCE-only\n"); 2013 2013 p_hwfn->hw_info.personality = QED_PCI_ETH_ROCE; 2014 2014 } 2015 2015
+1 -1
drivers/net/ethernet/qlogic/qed/qed_dev.c
··· 3102 3102 } 3103 3103 3104 3104 /* Log and clear previous pglue_b errors if such exist */ 3105 - qed_pglueb_rbc_attn_handler(p_hwfn, p_hwfn->p_main_ptt); 3105 + qed_pglueb_rbc_attn_handler(p_hwfn, p_hwfn->p_main_ptt, true); 3106 3106 3107 3107 /* Enable the PF's internal FID_enable in the PXP */ 3108 3108 rc = qed_pglueb_set_pfid_enable(p_hwfn, p_hwfn->p_main_ptt,
+31 -22
drivers/net/ethernet/qlogic/qed/qed_int.c
··· 257 257 #define PGLUE_ATTENTION_ZLR_VALID (1 << 25) 258 258 #define PGLUE_ATTENTION_ILT_VALID (1 << 23) 259 259 260 - int qed_pglueb_rbc_attn_handler(struct qed_hwfn *p_hwfn, 261 - struct qed_ptt *p_ptt) 260 + int qed_pglueb_rbc_attn_handler(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt, 261 + bool hw_init) 262 262 { 263 + char msg[256]; 263 264 u32 tmp; 264 265 265 266 tmp = qed_rd(p_hwfn, p_ptt, PGLUE_B_REG_TX_ERR_WR_DETAILS2); ··· 274 273 details = qed_rd(p_hwfn, p_ptt, 275 274 PGLUE_B_REG_TX_ERR_WR_DETAILS); 276 275 277 - DP_NOTICE(p_hwfn, 278 - "Illegal write by chip to [%08x:%08x] blocked.\n" 279 - "Details: %08x [PFID %02x, VFID %02x, VF_VALID %02x]\n" 280 - "Details2 %08x [Was_error %02x BME deassert %02x FID_enable deassert %02x]\n", 281 - addr_hi, addr_lo, details, 282 - (u8)GET_FIELD(details, PGLUE_ATTENTION_DETAILS_PFID), 283 - (u8)GET_FIELD(details, PGLUE_ATTENTION_DETAILS_VFID), 284 - GET_FIELD(details, 285 - PGLUE_ATTENTION_DETAILS_VF_VALID) ? 1 : 0, 286 - tmp, 287 - GET_FIELD(tmp, 288 - PGLUE_ATTENTION_DETAILS2_WAS_ERR) ? 1 : 0, 289 - GET_FIELD(tmp, 290 - PGLUE_ATTENTION_DETAILS2_BME) ? 1 : 0, 291 - GET_FIELD(tmp, 292 - PGLUE_ATTENTION_DETAILS2_FID_EN) ? 1 : 0); 276 + snprintf(msg, sizeof(msg), 277 + "Illegal write by chip to [%08x:%08x] blocked.\n" 278 + "Details: %08x [PFID %02x, VFID %02x, VF_VALID %02x]\n" 279 + "Details2 %08x [Was_error %02x BME deassert %02x FID_enable deassert %02x]", 280 + addr_hi, addr_lo, details, 281 + (u8)GET_FIELD(details, PGLUE_ATTENTION_DETAILS_PFID), 282 + (u8)GET_FIELD(details, PGLUE_ATTENTION_DETAILS_VFID), 283 + !!GET_FIELD(details, PGLUE_ATTENTION_DETAILS_VF_VALID), 284 + tmp, 285 + !!GET_FIELD(tmp, PGLUE_ATTENTION_DETAILS2_WAS_ERR), 286 + !!GET_FIELD(tmp, PGLUE_ATTENTION_DETAILS2_BME), 287 + !!GET_FIELD(tmp, PGLUE_ATTENTION_DETAILS2_FID_EN)); 288 + 289 + if (hw_init) 290 + DP_VERBOSE(p_hwfn, NETIF_MSG_INTR, "%s\n", msg); 291 + else 292 + DP_NOTICE(p_hwfn, "%s\n", msg); 293 293 } 294 294 295 295 tmp = qed_rd(p_hwfn, p_ptt, PGLUE_B_REG_TX_ERR_RD_DETAILS2); ··· 323 321 } 324 322 325 323 tmp = qed_rd(p_hwfn, p_ptt, PGLUE_B_REG_TX_ERR_WR_DETAILS_ICPL); 326 - if (tmp & PGLUE_ATTENTION_ICPL_VALID) 327 - DP_NOTICE(p_hwfn, "ICPL error - %08x\n", tmp); 324 + if (tmp & PGLUE_ATTENTION_ICPL_VALID) { 325 + snprintf(msg, sizeof(msg), "ICPL error - %08x", tmp); 326 + 327 + if (hw_init) 328 + DP_VERBOSE(p_hwfn, NETIF_MSG_INTR, "%s\n", msg); 329 + else 330 + DP_NOTICE(p_hwfn, "%s\n", msg); 331 + } 328 332 329 333 tmp = qed_rd(p_hwfn, p_ptt, PGLUE_B_REG_MASTER_ZLR_ERR_DETAILS); 330 334 if (tmp & PGLUE_ATTENTION_ZLR_VALID) { ··· 369 361 370 362 static int qed_pglueb_rbc_attn_cb(struct qed_hwfn *p_hwfn) 371 363 { 372 - return qed_pglueb_rbc_attn_handler(p_hwfn, p_hwfn->p_dpc_ptt); 364 + return qed_pglueb_rbc_attn_handler(p_hwfn, p_hwfn->p_dpc_ptt, false); 373 365 } 374 366 375 367 static int qed_fw_assertion(struct qed_hwfn *p_hwfn) ··· 1201 1193 index, attn_bits, attn_acks, asserted_bits, 1202 1194 deasserted_bits, p_sb_attn_sw->known_attn); 1203 1195 } else if (asserted_bits == 0x100) { 1204 - DP_INFO(p_hwfn, "MFW indication via attention\n"); 1196 + DP_VERBOSE(p_hwfn, NETIF_MSG_INTR, 1197 + "MFW indication via attention\n"); 1205 1198 } else { 1206 1199 DP_VERBOSE(p_hwfn, NETIF_MSG_INTR, 1207 1200 "MFW indication [deassertion]\n");
+2 -2
drivers/net/ethernet/qlogic/qed/qed_int.h
··· 442 442 443 443 #define QED_MAPPING_MEMORY_SIZE(dev) (NUM_OF_SBS(dev)) 444 444 445 - int qed_pglueb_rbc_attn_handler(struct qed_hwfn *p_hwfn, 446 - struct qed_ptt *p_ptt); 445 + int qed_pglueb_rbc_attn_handler(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt, 446 + bool hw_init); 447 447 448 448 #endif
+24 -2
drivers/net/ethernet/renesas/ravb_main.c
··· 1450 1450 struct ravb_private *priv = container_of(work, struct ravb_private, 1451 1451 work); 1452 1452 struct net_device *ndev = priv->ndev; 1453 + int error; 1453 1454 1454 1455 netif_tx_stop_all_queues(ndev); 1455 1456 ··· 1459 1458 ravb_ptp_stop(ndev); 1460 1459 1461 1460 /* Wait for DMA stopping */ 1462 - ravb_stop_dma(ndev); 1461 + if (ravb_stop_dma(ndev)) { 1462 + /* If ravb_stop_dma() fails, the hardware is still operating 1463 + * for TX and/or RX. So, this should not call the following 1464 + * functions because ravb_dmac_init() is possible to fail too. 1465 + * Also, this should not retry ravb_stop_dma() again and again 1466 + * here because it's possible to wait forever. So, this just 1467 + * re-enables the TX and RX and skip the following 1468 + * re-initialization procedure. 1469 + */ 1470 + ravb_rcv_snd_enable(ndev); 1471 + goto out; 1472 + } 1463 1473 1464 1474 ravb_ring_free(ndev, RAVB_BE); 1465 1475 ravb_ring_free(ndev, RAVB_NC); 1466 1476 1467 1477 /* Device init */ 1468 - ravb_dmac_init(ndev); 1478 + error = ravb_dmac_init(ndev); 1479 + if (error) { 1480 + /* If ravb_dmac_init() fails, descriptors are freed. So, this 1481 + * should return here to avoid re-enabling the TX and RX in 1482 + * ravb_emac_init(). 1483 + */ 1484 + netdev_err(ndev, "%s: ravb_dmac_init() failed, error %d\n", 1485 + __func__, error); 1486 + return; 1487 + } 1469 1488 ravb_emac_init(ndev); 1470 1489 1490 + out: 1471 1491 /* Initialise PTP Clock driver */ 1472 1492 if (priv->chip_id == RCAR_GEN2) 1473 1493 ravb_ptp_init(ndev, priv->pdev);
+2 -2
drivers/net/ethernet/smsc/smc91x.c
··· 2274 2274 ret = try_toggle_control_gpio(&pdev->dev, &lp->power_gpio, 2275 2275 "power", 0, 0, 100); 2276 2276 if (ret) 2277 - return ret; 2277 + goto out_free_netdev; 2278 2278 2279 2279 /* 2280 2280 * Optional reset GPIO configured? Minimum 100 ns reset needed ··· 2283 2283 ret = try_toggle_control_gpio(&pdev->dev, &lp->reset_gpio, 2284 2284 "reset", 0, 0, 100); 2285 2285 if (ret) 2286 - return ret; 2286 + goto out_free_netdev; 2287 2287 2288 2288 /* 2289 2289 * Need to wait for optional EEPROM to load, max 750 us according
+1 -1
drivers/net/ethernet/socionext/sni_ave.c
··· 1191 1191 ret = regmap_update_bits(priv->regmap, SG_ETPINMODE, 1192 1192 priv->pinmode_mask, priv->pinmode_val); 1193 1193 if (ret) 1194 - return ret; 1194 + goto out_reset_assert; 1195 1195 1196 1196 ave_global_reset(ndev); 1197 1197
+2 -1
drivers/net/ethernet/ti/am65-cpsw-nuss.c
··· 1850 1850 port->ndev->max_mtu = AM65_CPSW_MAX_PACKET_SIZE; 1851 1851 port->ndev->hw_features = NETIF_F_SG | 1852 1852 NETIF_F_RXCSUM | 1853 - NETIF_F_HW_CSUM; 1853 + NETIF_F_HW_CSUM | 1854 + NETIF_F_HW_TC; 1854 1855 port->ndev->features = port->ndev->hw_features | 1855 1856 NETIF_F_HW_VLAN_CTAG_FILTER; 1856 1857 port->ndev->vlan_features |= NETIF_F_SG;
+1 -1
drivers/net/geneve.c
··· 1615 1615 struct netlink_ext_ack *extack) 1616 1616 { 1617 1617 struct geneve_dev *geneve = netdev_priv(dev); 1618 + enum ifla_geneve_df df = geneve->df; 1618 1619 struct geneve_sock *gs4, *gs6; 1619 1620 struct ip_tunnel_info info; 1620 1621 bool metadata; 1621 1622 bool use_udp6_rx_checksums; 1622 - enum ifla_geneve_df df; 1623 1623 bool ttl_inherit; 1624 1624 int err; 1625 1625
+1 -1
drivers/net/hippi/rrunner.c
··· 1242 1242 rrpriv->info = NULL; 1243 1243 } 1244 1244 if (rrpriv->rx_ctrl) { 1245 - pci_free_consistent(pdev, sizeof(struct ring_ctrl), 1245 + pci_free_consistent(pdev, 256 * sizeof(struct ring_ctrl), 1246 1246 rrpriv->rx_ctrl, rrpriv->rx_ctrl_dma); 1247 1247 rrpriv->rx_ctrl = NULL; 1248 1248 }
+4 -2
drivers/net/ieee802154/adf7242.c
··· 4 4 * 5 5 * Copyright 2009-2017 Analog Devices Inc. 6 6 * 7 - * http://www.analog.com/ADF7242 7 + * https://www.analog.com/ADF7242 8 8 */ 9 9 10 10 #include <linux/kernel.h> ··· 1262 1262 WQ_MEM_RECLAIM); 1263 1263 if (unlikely(!lp->wqueue)) { 1264 1264 ret = -ENOMEM; 1265 - goto err_hw_init; 1265 + goto err_alloc_wq; 1266 1266 } 1267 1267 1268 1268 ret = adf7242_hw_init(lp); ··· 1294 1294 return ret; 1295 1295 1296 1296 err_hw_init: 1297 + destroy_workqueue(lp->wqueue); 1298 + err_alloc_wq: 1297 1299 mutex_destroy(&lp->bmux); 1298 1300 ieee802154_free_hw(lp->hw); 1299 1301
+2 -2
drivers/net/netdevsim/netdev.c
··· 302 302 rtnl_lock(); 303 303 err = nsim_bpf_init(ns); 304 304 if (err) 305 - goto err_free_netdev; 305 + goto err_rtnl_unlock; 306 306 307 307 nsim_ipsec_init(ns); 308 308 ··· 316 316 err_ipsec_teardown: 317 317 nsim_ipsec_teardown(ns); 318 318 nsim_bpf_uninit(ns); 319 + err_rtnl_unlock: 319 320 rtnl_unlock(); 320 - err_free_netdev: 321 321 free_netdev(dev); 322 322 return ERR_PTR(err); 323 323 }
+4
drivers/net/phy/dp83640.c
··· 1260 1260 dp83640->hwts_rx_en = 1; 1261 1261 dp83640->layer = PTP_CLASS_L4; 1262 1262 dp83640->version = PTP_CLASS_V1; 1263 + cfg.rx_filter = HWTSTAMP_FILTER_PTP_V1_L4_EVENT; 1263 1264 break; 1264 1265 case HWTSTAMP_FILTER_PTP_V2_L4_EVENT: 1265 1266 case HWTSTAMP_FILTER_PTP_V2_L4_SYNC: ··· 1268 1267 dp83640->hwts_rx_en = 1; 1269 1268 dp83640->layer = PTP_CLASS_L4; 1270 1269 dp83640->version = PTP_CLASS_V2; 1270 + cfg.rx_filter = HWTSTAMP_FILTER_PTP_V2_L4_EVENT; 1271 1271 break; 1272 1272 case HWTSTAMP_FILTER_PTP_V2_L2_EVENT: 1273 1273 case HWTSTAMP_FILTER_PTP_V2_L2_SYNC: ··· 1276 1274 dp83640->hwts_rx_en = 1; 1277 1275 dp83640->layer = PTP_CLASS_L2; 1278 1276 dp83640->version = PTP_CLASS_V2; 1277 + cfg.rx_filter = HWTSTAMP_FILTER_PTP_V2_L2_EVENT; 1279 1278 break; 1280 1279 case HWTSTAMP_FILTER_PTP_V2_EVENT: 1281 1280 case HWTSTAMP_FILTER_PTP_V2_SYNC: ··· 1284 1281 dp83640->hwts_rx_en = 1; 1285 1282 dp83640->layer = PTP_CLASS_L4 | PTP_CLASS_L2; 1286 1283 dp83640->version = PTP_CLASS_V2; 1284 + cfg.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT; 1287 1285 break; 1288 1286 default: 1289 1287 return -ERANGE;
+1
drivers/net/usb/ax88172a.c
··· 187 187 ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf, 0); 188 188 if (ret < ETH_ALEN) { 189 189 netdev_err(dev->net, "Failed to read MAC address: %d\n", ret); 190 + ret = -EIO; 190 191 goto free; 191 192 } 192 193 memcpy(dev->net->dev_addr, buf, ETH_ALEN);
+3 -2
drivers/net/usb/hso.c
··· 1390 1390 unsigned long flags; 1391 1391 1392 1392 if (old) 1393 - hso_dbg(0x16, "Termios called with: cflags new[%d] - old[%d]\n", 1394 - tty->termios.c_cflag, old->c_cflag); 1393 + hso_dbg(0x16, "Termios called with: cflags new[%u] - old[%u]\n", 1394 + (unsigned int)tty->termios.c_cflag, 1395 + (unsigned int)old->c_cflag); 1395 1396 1396 1397 /* the actual setup */ 1397 1398 spin_lock_irqsave(&serial->serial_lock, flags);
+3 -1
drivers/net/wan/hdlc_x25.c
··· 71 71 { 72 72 unsigned char *ptr; 73 73 74 - if (skb_cow(skb, 1)) 74 + if (skb_cow(skb, 1)) { 75 + kfree_skb(skb); 75 76 return NET_RX_DROP; 77 + } 76 78 77 79 skb_push(skb, 1); 78 80 skb_reset_network_header(skb);
+5 -3
drivers/net/wan/lapbether.c
··· 128 128 { 129 129 unsigned char *ptr; 130 130 131 - skb_push(skb, 1); 132 - 133 - if (skb_cow(skb, 1)) 131 + if (skb_cow(skb, 1)) { 132 + kfree_skb(skb); 134 133 return NET_RX_DROP; 134 + } 135 + 136 + skb_push(skb, 1); 135 137 136 138 ptr = skb->data; 137 139 *ptr = X25_IFACE_DATA;
+14 -7
drivers/net/wan/x25_asy.c
··· 183 183 netif_wake_queue(sl->dev); 184 184 } 185 185 186 - /* Send one completely decapsulated IP datagram to the IP layer. */ 186 + /* Send an LAPB frame to the LAPB module to process. */ 187 187 188 188 static void x25_asy_bump(struct x25_asy *sl) 189 189 { ··· 195 195 count = sl->rcount; 196 196 dev->stats.rx_bytes += count; 197 197 198 - skb = dev_alloc_skb(count+1); 198 + skb = dev_alloc_skb(count); 199 199 if (skb == NULL) { 200 200 netdev_warn(sl->dev, "memory squeeze, dropping packet\n"); 201 201 dev->stats.rx_dropped++; 202 202 return; 203 203 } 204 - skb_push(skb, 1); /* LAPB internal control */ 205 204 skb_put_data(skb, sl->rbuff, count); 206 205 skb->protocol = x25_type_trans(skb, sl->dev); 207 206 err = lapb_data_received(skb->dev, skb); ··· 208 209 kfree_skb(skb); 209 210 printk(KERN_DEBUG "x25_asy: data received err - %d\n", err); 210 211 } else { 211 - netif_rx(skb); 212 212 dev->stats.rx_packets++; 213 213 } 214 214 } ··· 354 356 */ 355 357 356 358 /* 357 - * Called when I frame data arrives. We did the work above - throw it 358 - * at the net layer. 359 + * Called when I frame data arrive. We add a pseudo header for upper 360 + * layers and pass it to upper layers. 359 361 */ 360 362 361 363 static int x25_asy_data_indication(struct net_device *dev, struct sk_buff *skb) 362 364 { 365 + if (skb_cow(skb, 1)) { 366 + kfree_skb(skb); 367 + return NET_RX_DROP; 368 + } 369 + skb_push(skb, 1); 370 + skb->data[0] = X25_IFACE_DATA; 371 + 372 + skb->protocol = x25_type_trans(skb, dev); 373 + 363 374 return netif_rx(skb); 364 375 } 365 376 ··· 664 657 switch (s) { 665 658 case X25_END: 666 659 if (!test_and_clear_bit(SLF_ERROR, &sl->flags) && 667 - sl->rcount > 2) 660 + sl->rcount >= 2) 668 661 x25_asy_bump(sl); 669 662 clear_bit(SLF_ESCAPE, &sl->flags); 670 663 sl->rcount = 0;
+1 -1
drivers/net/wireless/ath/ath10k/ahb.c
··· 820 820 ath10k_ahb_release_irq_legacy(ar); 821 821 822 822 err_free_pipes: 823 - ath10k_pci_free_pipes(ar); 823 + ath10k_pci_release_resource(ar); 824 824 825 825 err_resource_deinit: 826 826 ath10k_ahb_resource_deinit(ar);
+37 -41
drivers/net/wireless/ath/ath10k/pci.c
··· 3473 3473 3474 3474 timer_setup(&ar_pci->rx_post_retry, ath10k_pci_rx_replenish_retry, 0); 3475 3475 3476 + ar_pci->attr = kmemdup(pci_host_ce_config_wlan, 3477 + sizeof(pci_host_ce_config_wlan), 3478 + GFP_KERNEL); 3479 + if (!ar_pci->attr) 3480 + return -ENOMEM; 3481 + 3482 + ar_pci->pipe_config = kmemdup(pci_target_ce_config_wlan, 3483 + sizeof(pci_target_ce_config_wlan), 3484 + GFP_KERNEL); 3485 + if (!ar_pci->pipe_config) { 3486 + ret = -ENOMEM; 3487 + goto err_free_attr; 3488 + } 3489 + 3490 + ar_pci->serv_to_pipe = kmemdup(pci_target_service_to_ce_map_wlan, 3491 + sizeof(pci_target_service_to_ce_map_wlan), 3492 + GFP_KERNEL); 3493 + if (!ar_pci->serv_to_pipe) { 3494 + ret = -ENOMEM; 3495 + goto err_free_pipe_config; 3496 + } 3497 + 3476 3498 if (QCA_REV_6174(ar) || QCA_REV_9377(ar)) 3477 3499 ath10k_pci_override_ce_config(ar); 3478 3500 ··· 3502 3480 if (ret) { 3503 3481 ath10k_err(ar, "failed to allocate copy engine pipes: %d\n", 3504 3482 ret); 3505 - return ret; 3483 + goto err_free_serv_to_pipe; 3506 3484 } 3507 3485 3508 3486 return 0; 3487 + 3488 + err_free_serv_to_pipe: 3489 + kfree(ar_pci->serv_to_pipe); 3490 + err_free_pipe_config: 3491 + kfree(ar_pci->pipe_config); 3492 + err_free_attr: 3493 + kfree(ar_pci->attr); 3494 + return ret; 3509 3495 } 3510 3496 3511 3497 void ath10k_pci_release_resource(struct ath10k *ar) 3512 3498 { 3499 + struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); 3500 + 3513 3501 ath10k_pci_rx_retry_sync(ar); 3514 3502 netif_napi_del(&ar->napi); 3515 3503 ath10k_pci_ce_deinit(ar); 3516 3504 ath10k_pci_free_pipes(ar); 3505 + kfree(ar_pci->attr); 3506 + kfree(ar_pci->pipe_config); 3507 + kfree(ar_pci->serv_to_pipe); 3517 3508 } 3518 3509 3519 3510 static const struct ath10k_bus_ops ath10k_pci_bus_ops = { ··· 3636 3601 3637 3602 timer_setup(&ar_pci->ps_timer, ath10k_pci_ps_timer, 0); 3638 3603 3639 - ar_pci->attr = kmemdup(pci_host_ce_config_wlan, 3640 - sizeof(pci_host_ce_config_wlan), 3641 - GFP_KERNEL); 3642 - if (!ar_pci->attr) { 3643 - ret = -ENOMEM; 3644 - goto err_free; 3645 - } 3646 - 3647 - ar_pci->pipe_config = kmemdup(pci_target_ce_config_wlan, 3648 - sizeof(pci_target_ce_config_wlan), 3649 - GFP_KERNEL); 3650 - if (!ar_pci->pipe_config) { 3651 - ret = -ENOMEM; 3652 - goto err_free; 3653 - } 3654 - 3655 - ar_pci->serv_to_pipe = kmemdup(pci_target_service_to_ce_map_wlan, 3656 - sizeof(pci_target_service_to_ce_map_wlan), 3657 - GFP_KERNEL); 3658 - if (!ar_pci->serv_to_pipe) { 3659 - ret = -ENOMEM; 3660 - goto err_free; 3661 - } 3662 - 3663 3604 ret = ath10k_pci_setup_resource(ar); 3664 3605 if (ret) { 3665 3606 ath10k_err(ar, "failed to setup resource: %d\n", ret); ··· 3716 3705 3717 3706 err_free_irq: 3718 3707 ath10k_pci_free_irq(ar); 3719 - ath10k_pci_rx_retry_sync(ar); 3720 3708 3721 3709 err_deinit_irq: 3722 - ath10k_pci_deinit_irq(ar); 3710 + ath10k_pci_release_resource(ar); 3723 3711 3724 3712 err_sleep: 3725 3713 ath10k_pci_sleep_sync(ar); ··· 3730 3720 err_core_destroy: 3731 3721 ath10k_core_destroy(ar); 3732 3722 3733 - err_free: 3734 - kfree(ar_pci->attr); 3735 - kfree(ar_pci->pipe_config); 3736 - kfree(ar_pci->serv_to_pipe); 3737 - 3738 3723 return ret; 3739 3724 } 3740 3725 3741 3726 static void ath10k_pci_remove(struct pci_dev *pdev) 3742 3727 { 3743 3728 struct ath10k *ar = pci_get_drvdata(pdev); 3744 - struct ath10k_pci *ar_pci; 3745 3729 3746 3730 ath10k_dbg(ar, ATH10K_DBG_PCI, "pci remove\n"); 3747 3731 3748 3732 if (!ar) 3749 - return; 3750 - 3751 - ar_pci = ath10k_pci_priv(ar); 3752 - 3753 - if (!ar_pci) 3754 3733 return; 3755 3734 3756 3735 ath10k_core_unregister(ar); ··· 3749 3750 ath10k_pci_sleep_sync(ar); 3750 3751 ath10k_pci_release(ar); 3751 3752 ath10k_core_destroy(ar); 3752 - kfree(ar_pci->attr); 3753 - kfree(ar_pci->pipe_config); 3754 - kfree(ar_pci->serv_to_pipe); 3755 3753 } 3756 3754 3757 3755 MODULE_DEVICE_TABLE(pci, ath10k_pci_id_table);
+3 -1
drivers/net/wireless/ath/ath9k/hif_usb.c
··· 733 733 return; 734 734 } 735 735 736 + rx_buf->skb = nskb; 737 + 736 738 usb_fill_int_urb(urb, hif_dev->udev, 737 739 usb_rcvintpipe(hif_dev->udev, 738 740 USB_REG_IN_PIPE), 739 741 nskb->data, MAX_REG_IN_BUF_SIZE, 740 - ath9k_hif_usb_reg_in_cb, nskb, 1); 742 + ath9k_hif_usb_reg_in_cb, rx_buf, 1); 741 743 } 742 744 743 745 resubmit:
+14 -2
drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c
··· 271 271 { 272 272 struct iwl_fw_ini_trigger_tlv *trig = (void *)tlv->data; 273 273 u32 tp = le32_to_cpu(trig->time_point); 274 + struct iwl_ucode_tlv *dup = NULL; 275 + int ret; 274 276 275 277 if (le32_to_cpu(tlv->length) < sizeof(*trig)) 276 278 return -EINVAL; ··· 285 283 return -EINVAL; 286 284 } 287 285 288 - if (!le32_to_cpu(trig->occurrences)) 286 + if (!le32_to_cpu(trig->occurrences)) { 287 + dup = kmemdup(tlv, sizeof(*tlv) + le32_to_cpu(tlv->length), 288 + GFP_KERNEL); 289 + if (!dup) 290 + return -ENOMEM; 291 + trig = (void *)dup->data; 289 292 trig->occurrences = cpu_to_le32(-1); 293 + tlv = dup; 294 + } 290 295 291 - return iwl_dbg_tlv_add(tlv, &trans->dbg.time_point[tp].trig_list); 296 + ret = iwl_dbg_tlv_add(tlv, &trans->dbg.time_point[tp].trig_list); 297 + kfree(dup); 298 + 299 + return ret; 292 300 } 293 301 294 302 static int (*dbg_tlv_alloc[])(struct iwl_trans *trans,
+3 -5
drivers/net/wireless/intel/iwlwifi/mvm/sta.c
··· 1189 1189 for_each_set_bit(i, &changetid_queues, IWL_MAX_HW_QUEUES) 1190 1190 iwl_mvm_change_queue_tid(mvm, i); 1191 1191 1192 + rcu_read_unlock(); 1193 + 1192 1194 if (free_queue >= 0 && alloc_for_sta != IWL_MVM_INVALID_STA) { 1193 1195 ret = iwl_mvm_free_inactive_queue(mvm, free_queue, queue_owner, 1194 1196 alloc_for_sta); 1195 - if (ret) { 1196 - rcu_read_unlock(); 1197 + if (ret) 1197 1198 return ret; 1198 - } 1199 1199 } 1200 - 1201 - rcu_read_unlock(); 1202 1200 1203 1201 return free_queue; 1204 1202 }
+2
drivers/net/wireless/intel/iwlwifi/pcie/drv.c
··· 582 582 IWL_DEV_INFO(0x30DC, 0x1552, iwl9560_2ac_cfg_soc, iwl9560_killer_1550i_name), 583 583 IWL_DEV_INFO(0x31DC, 0x1551, iwl9560_2ac_cfg_soc, iwl9560_killer_1550s_name), 584 584 IWL_DEV_INFO(0x31DC, 0x1552, iwl9560_2ac_cfg_soc, iwl9560_killer_1550i_name), 585 + IWL_DEV_INFO(0xA370, 0x1551, iwl9560_2ac_cfg_soc, iwl9560_killer_1550s_name), 586 + IWL_DEV_INFO(0xA370, 0x1552, iwl9560_2ac_cfg_soc, iwl9560_killer_1550i_name), 585 587 586 588 IWL_DEV_INFO(0x271C, 0x0214, iwl9260_2ac_cfg, iwl9260_1_name), 587 589
+1
drivers/net/wireless/mediatek/mt76/mt76.h
··· 301 301 #define MT_DRV_TX_ALIGNED4_SKBS BIT(1) 302 302 #define MT_DRV_SW_RX_AIRTIME BIT(2) 303 303 #define MT_DRV_RX_DMA_HDR BIT(3) 304 + #define MT_DRV_HW_MGMT_TXQ BIT(4) 304 305 305 306 struct mt76_driver_ops { 306 307 u32 drv_flags;
+2
drivers/net/wireless/mediatek/mt76/mt7603/main.c
··· 642 642 { 643 643 struct mt7603_dev *dev = hw->priv; 644 644 645 + mutex_lock(&dev->mt76.mutex); 645 646 dev->coverage_class = max_t(s16, coverage_class, 0); 646 647 mt7603_mac_set_timing(dev); 648 + mutex_unlock(&dev->mt76.mutex); 647 649 } 648 650 649 651 static void mt7603_tx(struct ieee80211_hw *hw,
+5 -4
drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c
··· 234 234 int i; 235 235 236 236 for (i = 0; i < 16; i++) { 237 - int j, acs = i / 4, index = i % 4; 237 + int j, wmm_idx = i % MT7615_MAX_WMM_SETS; 238 + int acs = i / MT7615_MAX_WMM_SETS; 238 239 u32 ctrl, val, qlen = 0; 239 240 240 - val = mt76_rr(dev, MT_PLE_AC_QEMPTY(acs, index)); 241 + val = mt76_rr(dev, MT_PLE_AC_QEMPTY(acs, wmm_idx)); 241 242 ctrl = BIT(31) | BIT(15) | (acs << 8); 242 243 243 244 for (j = 0; j < 32; j++) { ··· 246 245 continue; 247 246 248 247 mt76_wr(dev, MT_PLE_FL_Q0_CTRL, 249 - ctrl | (j + (index << 5))); 248 + ctrl | (j + (wmm_idx << 5))); 250 249 qlen += mt76_get_field(dev, MT_PLE_FL_Q3_CTRL, 251 250 GENMASK(11, 0)); 252 251 } 253 - seq_printf(s, "AC%d%d: queued=%d\n", acs, index, qlen); 252 + seq_printf(s, "AC%d%d: queued=%d\n", wmm_idx, acs, qlen); 254 253 } 255 254 256 255 return 0;
+5 -4
drivers/net/wireless/mediatek/mt76/mt7615/dma.c
··· 36 36 mt7622_init_tx_queues_multi(struct mt7615_dev *dev) 37 37 { 38 38 static const u8 wmm_queue_map[] = { 39 - MT7622_TXQ_AC0, 40 - MT7622_TXQ_AC1, 41 - MT7622_TXQ_AC2, 42 - MT7622_TXQ_AC3, 39 + [IEEE80211_AC_BK] = MT7622_TXQ_AC0, 40 + [IEEE80211_AC_BE] = MT7622_TXQ_AC1, 41 + [IEEE80211_AC_VI] = MT7622_TXQ_AC2, 42 + [IEEE80211_AC_VO] = MT7622_TXQ_AC3, 43 43 }; 44 44 int ret; 45 45 int i; ··· 100 100 int i; 101 101 102 102 mt76_queue_tx_cleanup(dev, MT_TXQ_MCU, false); 103 + mt76_queue_tx_cleanup(dev, MT_TXQ_PSD, false); 103 104 if (is_mt7615(&dev->mt76)) { 104 105 mt76_queue_tx_cleanup(dev, MT_TXQ_BE, false); 105 106 } else {
+1 -2
drivers/net/wireless/mediatek/mt76/mt7615/eeprom.c
··· 72 72 { 73 73 int ret; 74 74 75 - ret = mt76_eeprom_init(&dev->mt76, MT7615_EEPROM_SIZE + 76 - MT7615_EEPROM_EXTRA_DATA); 75 + ret = mt76_eeprom_init(&dev->mt76, MT7615_EEPROM_FULL_SIZE); 77 76 if (ret < 0) 78 77 return ret; 79 78
+1 -1
drivers/net/wireless/mediatek/mt76/mt7615/eeprom.h
··· 17 17 #define MT7615_EEPROM_TXDPD_SIZE 216 18 18 #define MT7615_EEPROM_TXDPD_COUNT (44 + 3) 19 19 20 - #define MT7615_EEPROM_EXTRA_DATA (MT7615_EEPROM_TXDPD_OFFSET + \ 20 + #define MT7615_EEPROM_FULL_SIZE (MT7615_EEPROM_TXDPD_OFFSET + \ 21 21 MT7615_EEPROM_TXDPD_COUNT * \ 22 22 MT7615_EEPROM_TXDPD_SIZE) 23 23
+8 -14
drivers/net/wireless/mediatek/mt76/mt7615/mac.c
··· 526 526 fc_type = (le16_to_cpu(fc) & IEEE80211_FCTL_FTYPE) >> 2; 527 527 fc_stype = (le16_to_cpu(fc) & IEEE80211_FCTL_STYPE) >> 4; 528 528 529 - if (ieee80211_is_data(fc) || ieee80211_is_bufferable_mmpdu(fc)) { 530 - q_idx = wmm_idx * MT7615_MAX_WMM_SETS + 531 - skb_get_queue_mapping(skb); 532 - p_fmt = is_usb ? MT_TX_TYPE_SF : MT_TX_TYPE_CT; 533 - } else if (beacon) { 534 - if (ext_phy) 535 - q_idx = MT_LMAC_BCN1; 536 - else 537 - q_idx = MT_LMAC_BCN0; 529 + if (beacon) { 538 530 p_fmt = MT_TX_TYPE_FW; 539 - } else { 540 - if (ext_phy) 541 - q_idx = MT_LMAC_ALTX1; 542 - else 543 - q_idx = MT_LMAC_ALTX0; 531 + q_idx = ext_phy ? MT_LMAC_BCN1 : MT_LMAC_BCN0; 532 + } else if (skb_get_queue_mapping(skb) >= MT_TXQ_PSD) { 544 533 p_fmt = is_usb ? MT_TX_TYPE_SF : MT_TX_TYPE_CT; 534 + q_idx = ext_phy ? MT_LMAC_ALTX1 : MT_LMAC_ALTX0; 535 + } else { 536 + p_fmt = is_usb ? MT_TX_TYPE_SF : MT_TX_TYPE_CT; 537 + q_idx = wmm_idx * MT7615_MAX_WMM_SETS + 538 + mt7615_lmac_mapping(dev, skb_get_queue_mapping(skb)); 545 539 } 546 540 547 541 val = FIELD_PREP(MT_TXD0_TX_BYTES, skb->len + sz_txd) |
-15
drivers/net/wireless/mediatek/mt76/mt7615/mac.h
··· 124 124 MT_TX_TYPE_FW, 125 125 }; 126 126 127 - enum tx_pkt_queue_idx { 128 - MT_LMAC_AC00, 129 - MT_LMAC_AC01, 130 - MT_LMAC_AC02, 131 - MT_LMAC_AC03, 132 - MT_LMAC_ALTX0 = 0x10, 133 - MT_LMAC_BMC0, 134 - MT_LMAC_BCN0, 135 - MT_LMAC_PSMP0, 136 - MT_LMAC_ALTX1, 137 - MT_LMAC_BMC1, 138 - MT_LMAC_BCN1, 139 - MT_LMAC_PSMP1, 140 - }; 141 - 142 127 enum tx_port_idx { 143 128 MT_TX_PORT_IDX_LMAC, 144 129 MT_TX_PORT_IDX_MCU
+4
drivers/net/wireless/mediatek/mt76/mt7615/main.c
··· 397 397 struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv; 398 398 struct mt7615_dev *dev = mt7615_hw_dev(hw); 399 399 400 + queue = mt7615_lmac_mapping(dev, queue); 400 401 queue += mvif->wmm_idx * MT7615_MAX_WMM_SETS; 401 402 402 403 return mt7615_mcu_set_wmm(dev, queue, params); ··· 736 735 mt7615_set_coverage_class(struct ieee80211_hw *hw, s16 coverage_class) 737 736 { 738 737 struct mt7615_phy *phy = mt7615_hw_phy(hw); 738 + struct mt7615_dev *dev = phy->dev; 739 739 740 + mutex_lock(&dev->mt76.mutex); 740 741 phy->coverage_class = max_t(s16, coverage_class, 0); 741 742 mt7615_mac_set_timing(phy); 743 + mutex_unlock(&dev->mt76.mutex); 742 744 } 743 745 744 746 static int
+1 -1
drivers/net/wireless/mediatek/mt76/mt7615/mmio.c
··· 146 146 static const struct mt76_driver_ops drv_ops = { 147 147 /* txwi_size = txd size + txp size */ 148 148 .txwi_size = MT_TXD_SIZE + sizeof(struct mt7615_txp_common), 149 - .drv_flags = MT_DRV_TXWI_NO_FREE, 149 + .drv_flags = MT_DRV_TXWI_NO_FREE | MT_DRV_HW_MGMT_TXQ, 150 150 .survey_flags = SURVEY_INFO_TIME_TX | 151 151 SURVEY_INFO_TIME_RX | 152 152 SURVEY_INFO_TIME_BSS_RX,
+30
drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h
··· 282 282 struct list_head wd_head; 283 283 }; 284 284 285 + enum tx_pkt_queue_idx { 286 + MT_LMAC_AC00, 287 + MT_LMAC_AC01, 288 + MT_LMAC_AC02, 289 + MT_LMAC_AC03, 290 + MT_LMAC_ALTX0 = 0x10, 291 + MT_LMAC_BMC0, 292 + MT_LMAC_BCN0, 293 + MT_LMAC_PSMP0, 294 + MT_LMAC_ALTX1, 295 + MT_LMAC_BMC1, 296 + MT_LMAC_BCN1, 297 + MT_LMAC_PSMP1, 298 + }; 299 + 285 300 enum { 286 301 HW_BSSID_0 = 0x0, 287 302 HW_BSSID_1, ··· 460 445 return MT7663_WTBL_SIZE; 461 446 else 462 447 return MT7615_WTBL_SIZE; 448 + } 449 + 450 + static inline u8 mt7615_lmac_mapping(struct mt7615_dev *dev, u8 ac) 451 + { 452 + static const u8 lmac_queue_map[] = { 453 + [IEEE80211_AC_BK] = MT_LMAC_AC00, 454 + [IEEE80211_AC_BE] = MT_LMAC_AC01, 455 + [IEEE80211_AC_VI] = MT_LMAC_AC02, 456 + [IEEE80211_AC_VO] = MT_LMAC_AC03, 457 + }; 458 + 459 + if (WARN_ON_ONCE(ac >= ARRAY_SIZE(lmac_queue_map))) 460 + return MT_LMAC_AC01; /* BE */ 461 + 462 + return lmac_queue_map[ac]; 463 463 } 464 464 465 465 void mt7615_dma_reset(struct mt7615_dev *dev);
+7 -6
drivers/net/wireless/mediatek/mt76/mt7615/usb.c
··· 270 270 { 271 271 static const struct mt76_driver_ops drv_ops = { 272 272 .txwi_size = MT_USB_TXD_SIZE, 273 - .drv_flags = MT_DRV_RX_DMA_HDR, 273 + .drv_flags = MT_DRV_RX_DMA_HDR | MT_DRV_HW_MGMT_TXQ, 274 274 .tx_prepare_skb = mt7663u_tx_prepare_skb, 275 275 .tx_complete_skb = mt7663u_tx_complete_skb, 276 276 .tx_status_data = mt7663u_tx_status_data, ··· 329 329 if (!mt76_poll_msec(dev, MT_CONN_ON_MISC, MT_TOP_MISC2_FW_PWR_ON, 330 330 FW_STATE_PWR_ON << 1, 500)) { 331 331 dev_err(dev->mt76.dev, "Timeout for power on\n"); 332 - return -EIO; 332 + ret = -EIO; 333 + goto error; 333 334 } 334 335 335 336 alloc_queues: 336 337 ret = mt76u_alloc_mcu_queue(&dev->mt76); 337 338 if (ret) 338 - goto error; 339 + goto error_free_q; 339 340 340 341 ret = mt76u_alloc_queues(&dev->mt76); 341 342 if (ret) 342 - goto error; 343 + goto error_free_q; 343 344 344 345 ret = mt7663u_register_device(dev); 345 346 if (ret) 346 - goto error_freeq; 347 + goto error_free_q; 347 348 348 349 return 0; 349 350 350 - error_freeq: 351 + error_free_q: 351 352 mt76u_queues_deinit(&dev->mt76); 352 353 error: 353 354 mt76u_deinit(&dev->mt76);
+3 -2
drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c
··· 456 456 tasklet_disable(&dev->mt76.tx_tasklet); 457 457 napi_disable(&dev->mt76.tx_napi); 458 458 459 - for (i = 0; i < ARRAY_SIZE(dev->mt76.napi); i++) 459 + mt76_for_each_q_rx(&dev->mt76, i) { 460 460 napi_disable(&dev->mt76.napi[i]); 461 + } 461 462 462 463 mutex_lock(&dev->mt76.mutex); 463 464 ··· 516 515 517 516 tasklet_enable(&dev->mt76.pre_tbtt_tasklet); 518 517 519 - for (i = 0; i < ARRAY_SIZE(dev->mt76.napi); i++) { 518 + mt76_for_each_q_rx(&dev->mt76, i) { 520 519 napi_enable(&dev->mt76.napi[i]); 521 520 napi_schedule(&dev->mt76.napi[i]); 522 521 }
+3
drivers/net/wireless/mediatek/mt76/mt7915/main.c
··· 716 716 mt7915_set_coverage_class(struct ieee80211_hw *hw, s16 coverage_class) 717 717 { 718 718 struct mt7915_phy *phy = mt7915_hw_phy(hw); 719 + struct mt7915_dev *dev = phy->dev; 719 720 721 + mutex_lock(&dev->mt76.mutex); 720 722 phy->coverage_class = max_t(s16, coverage_class, 0); 721 723 mt7915_mac_set_timing(phy); 724 + mutex_unlock(&dev->mt76.mutex); 722 725 } 723 726 724 727 static int
+7
drivers/net/wireless/mediatek/mt76/tx.c
··· 264 264 skb_set_queue_mapping(skb, qid); 265 265 } 266 266 267 + if ((dev->drv->drv_flags & MT_DRV_HW_MGMT_TXQ) && 268 + !ieee80211_is_data(hdr->frame_control) && 269 + !ieee80211_is_bufferable_mmpdu(hdr->frame_control)) { 270 + qid = MT_TXQ_PSD; 271 + skb_set_queue_mapping(skb, qid); 272 + } 273 + 267 274 if (!(wcid->tx_info & MT_WCID_TX_INFO_SET)) 268 275 ieee80211_get_tx_rates(info->control.vif, sta, skb, 269 276 info->control.rates, 1);
+26 -13
drivers/net/wireless/mediatek/mt76/usb.c
··· 1010 1010 static u8 mt76u_ac_to_hwq(struct mt76_dev *dev, u8 ac) 1011 1011 { 1012 1012 if (mt76_chip(dev) == 0x7663) { 1013 - static const u8 wmm_queue_map[] = { 1014 - [IEEE80211_AC_VO] = 0, 1015 - [IEEE80211_AC_VI] = 1, 1016 - [IEEE80211_AC_BE] = 2, 1017 - [IEEE80211_AC_BK] = 4, 1013 + static const u8 lmac_queue_map[] = { 1014 + /* ac to lmac mapping */ 1015 + [IEEE80211_AC_BK] = 0, 1016 + [IEEE80211_AC_BE] = 1, 1017 + [IEEE80211_AC_VI] = 2, 1018 + [IEEE80211_AC_VO] = 4, 1018 1019 }; 1019 1020 1020 - if (WARN_ON(ac >= ARRAY_SIZE(wmm_queue_map))) 1021 - return 2; /* BE */ 1021 + if (WARN_ON(ac >= ARRAY_SIZE(lmac_queue_map))) 1022 + return 1; /* BE */ 1022 1023 1023 - return wmm_queue_map[ac]; 1024 + return lmac_queue_map[ac]; 1024 1025 } 1025 1026 1026 1027 return mt76_ac_to_hwq(ac); ··· 1067 1066 1068 1067 static void mt76u_free_tx(struct mt76_dev *dev) 1069 1068 { 1070 - struct mt76_queue *q; 1071 - int i, j; 1069 + int i; 1072 1070 1073 1071 for (i = 0; i < IEEE80211_NUM_ACS; i++) { 1072 + struct mt76_queue *q; 1073 + int j; 1074 + 1074 1075 q = dev->q_tx[i].q; 1076 + if (!q) 1077 + continue; 1078 + 1075 1079 for (j = 0; j < q->ndesc; j++) 1076 1080 usb_free_urb(q->entry[j].urb); 1077 1081 } ··· 1084 1078 1085 1079 void mt76u_stop_tx(struct mt76_dev *dev) 1086 1080 { 1087 - struct mt76_queue_entry entry; 1088 - struct mt76_queue *q; 1089 - int i, j, ret; 1081 + int ret; 1090 1082 1091 1083 ret = wait_event_timeout(dev->tx_wait, !mt76_has_tx_pending(&dev->phy), 1092 1084 HZ / 5); 1093 1085 if (!ret) { 1086 + struct mt76_queue_entry entry; 1087 + struct mt76_queue *q; 1088 + int i, j; 1089 + 1094 1090 dev_err(dev->dev, "timed out waiting for pending tx\n"); 1095 1091 1096 1092 for (i = 0; i < IEEE80211_NUM_ACS; i++) { 1097 1093 q = dev->q_tx[i].q; 1094 + if (!q) 1095 + continue; 1096 + 1098 1097 for (j = 0; j < q->ndesc; j++) 1099 1098 usb_kill_urb(q->entry[j].urb); 1100 1099 } ··· 1111 1100 */ 1112 1101 for (i = 0; i < IEEE80211_NUM_ACS; i++) { 1113 1102 q = dev->q_tx[i].q; 1103 + if (!q) 1104 + continue; 1114 1105 1115 1106 /* Assure we are in sync with killed tasklet. */ 1116 1107 spin_lock_bh(&q->lock);
+44 -24
drivers/net/xen-netfront.c
··· 63 63 MODULE_PARM_DESC(max_queues, 64 64 "Maximum number of queues per virtual interface"); 65 65 66 + #define XENNET_TIMEOUT (5 * HZ) 67 + 66 68 static const struct ethtool_ops xennet_ethtool_ops; 67 69 68 70 struct netfront_cb { ··· 1336 1334 1337 1335 netif_carrier_off(netdev); 1338 1336 1339 - xenbus_switch_state(dev, XenbusStateInitialising); 1340 - wait_event(module_wq, 1341 - xenbus_read_driver_state(dev->otherend) != 1342 - XenbusStateClosed && 1343 - xenbus_read_driver_state(dev->otherend) != 1344 - XenbusStateUnknown); 1337 + do { 1338 + xenbus_switch_state(dev, XenbusStateInitialising); 1339 + err = wait_event_timeout(module_wq, 1340 + xenbus_read_driver_state(dev->otherend) != 1341 + XenbusStateClosed && 1342 + xenbus_read_driver_state(dev->otherend) != 1343 + XenbusStateUnknown, XENNET_TIMEOUT); 1344 + } while (!err); 1345 + 1345 1346 return netdev; 1346 1347 1347 1348 exit: ··· 2144 2139 }; 2145 2140 #endif /* CONFIG_SYSFS */ 2146 2141 2142 + static void xennet_bus_close(struct xenbus_device *dev) 2143 + { 2144 + int ret; 2145 + 2146 + if (xenbus_read_driver_state(dev->otherend) == XenbusStateClosed) 2147 + return; 2148 + do { 2149 + xenbus_switch_state(dev, XenbusStateClosing); 2150 + ret = wait_event_timeout(module_wq, 2151 + xenbus_read_driver_state(dev->otherend) == 2152 + XenbusStateClosing || 2153 + xenbus_read_driver_state(dev->otherend) == 2154 + XenbusStateClosed || 2155 + xenbus_read_driver_state(dev->otherend) == 2156 + XenbusStateUnknown, 2157 + XENNET_TIMEOUT); 2158 + } while (!ret); 2159 + 2160 + if (xenbus_read_driver_state(dev->otherend) == XenbusStateClosed) 2161 + return; 2162 + 2163 + do { 2164 + xenbus_switch_state(dev, XenbusStateClosed); 2165 + ret = wait_event_timeout(module_wq, 2166 + xenbus_read_driver_state(dev->otherend) == 2167 + XenbusStateClosed || 2168 + xenbus_read_driver_state(dev->otherend) == 2169 + XenbusStateUnknown, 2170 + XENNET_TIMEOUT); 2171 + } while (!ret); 2172 + } 2173 + 2147 2174 static int xennet_remove(struct xenbus_device *dev) 2148 2175 { 2149 2176 struct netfront_info *info = dev_get_drvdata(&dev->dev); 2150 2177 2151 - dev_dbg(&dev->dev, "%s\n", dev->nodename); 2152 - 2153 - if (xenbus_read_driver_state(dev->otherend) != XenbusStateClosed) { 2154 - xenbus_switch_state(dev, XenbusStateClosing); 2155 - wait_event(module_wq, 2156 - xenbus_read_driver_state(dev->otherend) == 2157 - XenbusStateClosing || 2158 - xenbus_read_driver_state(dev->otherend) == 2159 - XenbusStateUnknown); 2160 - 2161 - xenbus_switch_state(dev, XenbusStateClosed); 2162 - wait_event(module_wq, 2163 - xenbus_read_driver_state(dev->otherend) == 2164 - XenbusStateClosed || 2165 - xenbus_read_driver_state(dev->otherend) == 2166 - XenbusStateUnknown); 2167 - } 2168 - 2178 + xennet_bus_close(dev); 2169 2179 xennet_disconnect_backend(info); 2170 2180 2171 2181 if (info->netdev->reg_state == NETREG_REGISTERED)
+1
drivers/nfc/s3fwrn5/core.c
··· 198 198 case S3FWRN5_MODE_FW: 199 199 return s3fwrn5_fw_recv_frame(ndev, skb); 200 200 default: 201 + kfree_skb(skb); 201 202 return -ENODEV; 202 203 } 203 204 }
+1 -1
include/linux/rhashtable.h
··· 33 33 * of two or more hash tables when the rhashtable is being resized. 34 34 * The end of the chain is marked with a special nulls marks which has 35 35 * the least significant bit set but otherwise stores the address of 36 - * the hash bucket. This allows us to be be sure we've found the end 36 + * the hash bucket. This allows us to be sure we've found the end 37 37 * of the right list. 38 38 * The value stored in the hash bucket has BIT(0) used as a lock bit. 39 39 * This bit must be atomically set before any changes are made to
+4 -2
include/linux/tcp.h
··· 220 220 } rack; 221 221 u16 advmss; /* Advertised MSS */ 222 222 u8 compressed_ack; 223 - u8 dup_ack_counter; 223 + u8 dup_ack_counter:2, 224 + tlp_retrans:1, /* TLP is a retransmission */ 225 + unused:5; 224 226 u32 chrono_start; /* Start time in jiffies of a TCP chrono */ 225 227 u32 chrono_stat[3]; /* Time in jiffies for chrono_stat stats */ 226 228 u8 chrono_type:2, /* current chronograph type */ ··· 245 243 save_syn:1, /* Save headers of SYN packet */ 246 244 is_cwnd_limited:1,/* forward progress limited by snd_cwnd? */ 247 245 syn_smc:1; /* SYN includes SMC */ 248 - u32 tlp_high_seq; /* snd_nxt at the time of TLP retransmit. */ 246 + u32 tlp_high_seq; /* snd_nxt at the time of TLP */ 249 247 250 248 u32 tcp_tx_delay; /* delay (in usec) added to TX packets */ 251 249 u64 tcp_wstamp_ns; /* departure time for next sent data packet */
-1
include/net/flow_offload.h
··· 5 5 #include <linux/list.h> 6 6 #include <linux/netlink.h> 7 7 #include <net/flow_dissector.h> 8 - #include <linux/rhashtable.h> 9 8 10 9 struct flow_match { 11 10 struct flow_dissector *dissector;
+8 -2
net/ax25/af_ax25.c
··· 1187 1187 if (addr_len > sizeof(struct sockaddr_ax25) && 1188 1188 fsa->fsa_ax25.sax25_ndigis != 0) { 1189 1189 /* Valid number of digipeaters ? */ 1190 - if (fsa->fsa_ax25.sax25_ndigis < 1 || fsa->fsa_ax25.sax25_ndigis > AX25_MAX_DIGIS) { 1190 + if (fsa->fsa_ax25.sax25_ndigis < 1 || 1191 + fsa->fsa_ax25.sax25_ndigis > AX25_MAX_DIGIS || 1192 + addr_len < sizeof(struct sockaddr_ax25) + 1193 + sizeof(ax25_address) * fsa->fsa_ax25.sax25_ndigis) { 1191 1194 err = -EINVAL; 1192 1195 goto out_release; 1193 1196 } ··· 1510 1507 struct full_sockaddr_ax25 *fsa = (struct full_sockaddr_ax25 *)usax; 1511 1508 1512 1509 /* Valid number of digipeaters ? */ 1513 - if (usax->sax25_ndigis < 1 || usax->sax25_ndigis > AX25_MAX_DIGIS) { 1510 + if (usax->sax25_ndigis < 1 || 1511 + usax->sax25_ndigis > AX25_MAX_DIGIS || 1512 + addr_len < sizeof(struct sockaddr_ax25) + 1513 + sizeof(ax25_address) * usax->sax25_ndigis) { 1514 1514 err = -EINVAL; 1515 1515 goto out; 1516 1516 }
+1 -1
net/core/dev.c
··· 5601 5601 skb_queue_walk_safe(&sd->input_pkt_queue, skb, tmp) { 5602 5602 if (skb->dev->reg_state == NETREG_UNREGISTERING) { 5603 5603 __skb_unlink(skb, &sd->input_pkt_queue); 5604 - kfree_skb(skb); 5604 + dev_kfree_skb_irq(skb); 5605 5605 input_queue_head_incr(sd); 5606 5606 } 5607 5607 }
+1
net/core/flow_offload.c
··· 4 4 #include <net/flow_offload.h> 5 5 #include <linux/rtnetlink.h> 6 6 #include <linux/mutex.h> 7 + #include <linux/rhashtable.h> 7 8 8 9 struct flow_rule *flow_rule_alloc(unsigned int num_actions) 9 10 {
+1 -1
net/core/net-sysfs.c
··· 1108 1108 trans_timeout = queue->trans_timeout; 1109 1109 spin_unlock_irq(&queue->_xmit_lock); 1110 1110 1111 - return sprintf(buf, "%lu", trans_timeout); 1111 + return sprintf(buf, fmt_ulong, trans_timeout); 1112 1112 } 1113 1113 1114 1114 static unsigned int get_netdev_queue_index(struct netdev_queue *queue)
+2 -1
net/core/rtnetlink.c
··· 3343 3343 */ 3344 3344 if (err < 0) { 3345 3345 /* If device is not registered at all, free it now */ 3346 - if (dev->reg_state == NETREG_UNINITIALIZED) 3346 + if (dev->reg_state == NETREG_UNINITIALIZED || 3347 + dev->reg_state == NETREG_UNREGISTERED) 3347 3348 free_netdev(dev); 3348 3349 goto out; 3349 3350 }
+1
net/core/sock_reuseport.c
··· 101 101 more_reuse->prog = reuse->prog; 102 102 more_reuse->reuseport_id = reuse->reuseport_id; 103 103 more_reuse->bind_inany = reuse->bind_inany; 104 + more_reuse->has_conns = reuse->has_conns; 104 105 105 106 memcpy(more_reuse->socks, reuse->socks, 106 107 reuse->num_socks * sizeof(struct sock *));
+13 -5
net/hsr/hsr_forward.c
··· 120 120 return skb_clone(frame->skb_std, GFP_ATOMIC); 121 121 } 122 122 123 - static void hsr_fill_tag(struct sk_buff *skb, struct hsr_frame_info *frame, 124 - struct hsr_port *port, u8 proto_version) 123 + static struct sk_buff *hsr_fill_tag(struct sk_buff *skb, 124 + struct hsr_frame_info *frame, 125 + struct hsr_port *port, u8 proto_version) 125 126 { 126 127 struct hsr_ethhdr *hsr_ethhdr; 127 128 int lane_id; 128 129 int lsdu_size; 130 + 131 + /* pad to minimum packet size which is 60 + 6 (HSR tag) */ 132 + if (skb_put_padto(skb, ETH_ZLEN + HSR_HLEN)) 133 + return NULL; 129 134 130 135 if (port->type == HSR_PT_SLAVE_A) 131 136 lane_id = 0; ··· 149 144 hsr_ethhdr->hsr_tag.encap_proto = hsr_ethhdr->ethhdr.h_proto; 150 145 hsr_ethhdr->ethhdr.h_proto = htons(proto_version ? 151 146 ETH_P_HSR : ETH_P_PRP); 147 + 148 + return skb; 152 149 } 153 150 154 151 static struct sk_buff *create_tagged_skb(struct sk_buff *skb_o, ··· 179 172 memmove(dst, src, movelen); 180 173 skb_reset_mac_header(skb); 181 174 182 - hsr_fill_tag(skb, frame, port, port->hsr->prot_version); 183 - 184 - return skb; 175 + /* skb_put_padto free skb on error and hsr_fill_tag returns NULL in 176 + * that case 177 + */ 178 + return hsr_fill_tag(skb, frame, port, port->hsr->prot_version); 185 179 } 186 180 187 181 /* If the original frame was an HSR tagged frame, just clone it to be sent
+2 -1
net/hsr/hsr_framereg.c
··· 325 325 if (port->type != node_dst->addr_B_port) 326 326 return; 327 327 328 - ether_addr_copy(eth_hdr(skb)->h_dest, node_dst->macaddress_B); 328 + if (is_valid_ether_addr(node_dst->macaddress_B)) 329 + ether_addr_copy(eth_hdr(skb)->h_dest, node_dst->macaddress_B); 329 330 } 330 331 331 332 void hsr_register_frame_in(struct hsr_node *node, struct hsr_port *port,
+6 -5
net/ipv4/tcp_input.c
··· 3488 3488 } 3489 3489 } 3490 3490 3491 - /* This routine deals with acks during a TLP episode. 3492 - * We mark the end of a TLP episode on receiving TLP dupack or when 3493 - * ack is after tlp_high_seq. 3494 - * Ref: loss detection algorithm in draft-dukkipati-tcpm-tcp-loss-probe. 3491 + /* This routine deals with acks during a TLP episode and ends an episode by 3492 + * resetting tlp_high_seq. Ref: TLP algorithm in draft-ietf-tcpm-rack 3495 3493 */ 3496 3494 static void tcp_process_tlp_ack(struct sock *sk, u32 ack, int flag) 3497 3495 { ··· 3498 3500 if (before(ack, tp->tlp_high_seq)) 3499 3501 return; 3500 3502 3501 - if (flag & FLAG_DSACKING_ACK) { 3503 + if (!tp->tlp_retrans) { 3504 + /* TLP of new data has been acknowledged */ 3505 + tp->tlp_high_seq = 0; 3506 + } else if (flag & FLAG_DSACKING_ACK) { 3502 3507 /* This DSACK means original and TLP probe arrived; no loss */ 3503 3508 tp->tlp_high_seq = 0; 3504 3509 } else if (after(ack, tp->tlp_high_seq)) {
+8 -5
net/ipv4/tcp_output.c
··· 2624 2624 int pcount; 2625 2625 int mss = tcp_current_mss(sk); 2626 2626 2627 + /* At most one outstanding TLP */ 2628 + if (tp->tlp_high_seq) 2629 + goto rearm_timer; 2630 + 2631 + tp->tlp_retrans = 0; 2627 2632 skb = tcp_send_head(sk); 2628 2633 if (skb && tcp_snd_wnd_test(tp, skb, mss)) { 2629 2634 pcount = tp->packets_out; ··· 2645 2640 inet_csk(sk)->icsk_pending = 0; 2646 2641 return; 2647 2642 } 2648 - 2649 - /* At most one outstanding TLP retransmission. */ 2650 - if (tp->tlp_high_seq) 2651 - goto rearm_timer; 2652 2643 2653 2644 if (skb_still_in_host_queue(sk, skb)) 2654 2645 goto rearm_timer; ··· 2667 2666 if (__tcp_retransmit_skb(sk, skb, 1)) 2668 2667 goto rearm_timer; 2669 2668 2669 + tp->tlp_retrans = 1; 2670 + 2671 + probe_sent: 2670 2672 /* Record snd_nxt for loss detection. */ 2671 2673 tp->tlp_high_seq = tp->snd_nxt; 2672 2674 2673 - probe_sent: 2674 2675 NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPLOSSPROBES); 2675 2676 /* Reset s.t. tcp_rearm_rto will restart timer from now */ 2676 2677 inet_csk(sk)->icsk_pending = 0;
+10 -7
net/ipv4/udp.c
··· 416 416 struct udp_hslot *hslot2, 417 417 struct sk_buff *skb) 418 418 { 419 - struct sock *sk, *result; 419 + struct sock *sk, *result, *reuseport_result; 420 420 int score, badness; 421 421 u32 hash = 0; 422 422 ··· 426 426 score = compute_score(sk, net, saddr, sport, 427 427 daddr, hnum, dif, sdif); 428 428 if (score > badness) { 429 + reuseport_result = NULL; 430 + 429 431 if (sk->sk_reuseport && 430 432 sk->sk_state != TCP_ESTABLISHED) { 431 433 hash = udp_ehashfn(net, daddr, hnum, 432 434 saddr, sport); 433 - result = reuseport_select_sock(sk, hash, skb, 434 - sizeof(struct udphdr)); 435 - if (result && !reuseport_has_conns(sk, false)) 436 - return result; 435 + reuseport_result = reuseport_select_sock(sk, hash, skb, 436 + sizeof(struct udphdr)); 437 + if (reuseport_result && !reuseport_has_conns(sk, false)) 438 + return reuseport_result; 437 439 } 440 + 441 + result = reuseport_result ? : sk; 438 442 badness = score; 439 - result = sk; 440 443 } 441 444 } 442 445 return result; ··· 2054 2051 /* 2055 2052 * UDP-Lite specific tests, ignored on UDP sockets 2056 2053 */ 2057 - if ((is_udplite & UDPLITE_RECV_CC) && UDP_SKB_CB(skb)->partial_cov) { 2054 + if ((up->pcflag & UDPLITE_RECV_CC) && UDP_SKB_CB(skb)->partial_cov) { 2058 2055 2059 2056 /* 2060 2057 * MIB statistics other than incrementing the error count are
+6 -5
net/ipv6/ip6_gre.c
··· 1562 1562 static int __net_init ip6gre_init_net(struct net *net) 1563 1563 { 1564 1564 struct ip6gre_net *ign = net_generic(net, ip6gre_net_id); 1565 + struct net_device *ndev; 1565 1566 int err; 1566 1567 1567 1568 if (!net_has_fallback_tunnels(net)) 1568 1569 return 0; 1569 - ign->fb_tunnel_dev = alloc_netdev(sizeof(struct ip6_tnl), "ip6gre0", 1570 - NET_NAME_UNKNOWN, 1571 - ip6gre_tunnel_setup); 1572 - if (!ign->fb_tunnel_dev) { 1570 + ndev = alloc_netdev(sizeof(struct ip6_tnl), "ip6gre0", 1571 + NET_NAME_UNKNOWN, ip6gre_tunnel_setup); 1572 + if (!ndev) { 1573 1573 err = -ENOMEM; 1574 1574 goto err_alloc_dev; 1575 1575 } 1576 + ign->fb_tunnel_dev = ndev; 1576 1577 dev_net_set(ign->fb_tunnel_dev, net); 1577 1578 /* FB netdevice is special: we have one, and only one per netns. 1578 1579 * Allowing to move it to another netns is clearly unsafe. ··· 1593 1592 return 0; 1594 1593 1595 1594 err_reg_dev: 1596 - free_netdev(ign->fb_tunnel_dev); 1595 + free_netdev(ndev); 1597 1596 err_alloc_dev: 1598 1597 return err; 1599 1598 }
+10 -7
net/ipv6/udp.c
··· 148 148 int dif, int sdif, struct udp_hslot *hslot2, 149 149 struct sk_buff *skb) 150 150 { 151 - struct sock *sk, *result; 151 + struct sock *sk, *result, *reuseport_result; 152 152 int score, badness; 153 153 u32 hash = 0; 154 154 ··· 158 158 score = compute_score(sk, net, saddr, sport, 159 159 daddr, hnum, dif, sdif); 160 160 if (score > badness) { 161 + reuseport_result = NULL; 162 + 161 163 if (sk->sk_reuseport && 162 164 sk->sk_state != TCP_ESTABLISHED) { 163 165 hash = udp6_ehashfn(net, daddr, hnum, 164 166 saddr, sport); 165 167 166 - result = reuseport_select_sock(sk, hash, skb, 167 - sizeof(struct udphdr)); 168 - if (result && !reuseport_has_conns(sk, false)) 169 - return result; 168 + reuseport_result = reuseport_select_sock(sk, hash, skb, 169 + sizeof(struct udphdr)); 170 + if (reuseport_result && !reuseport_has_conns(sk, false)) 171 + return reuseport_result; 170 172 } 171 - result = sk; 173 + 174 + result = reuseport_result ? : sk; 172 175 badness = score; 173 176 } 174 177 } ··· 646 643 /* 647 644 * UDP-Lite specific tests, ignored on UDP sockets (see net/ipv4/udp.c). 648 645 */ 649 - if ((is_udplite & UDPLITE_RECV_CC) && UDP_SKB_CB(skb)->partial_cov) { 646 + if ((up->pcflag & UDPLITE_RECV_CC) && UDP_SKB_CB(skb)->partial_cov) { 650 647 651 648 if (up->pcrlen == 0) { /* full coverage was set */ 652 649 net_dbg_ratelimited("UDPLITE6: partial coverage %d while full coverage %d requested\n",
+8 -4
net/netfilter/ipvs/ip_vs_sync.c
··· 1717 1717 { 1718 1718 struct ip_vs_sync_thread_data *tinfo = data; 1719 1719 struct netns_ipvs *ipvs = tinfo->ipvs; 1720 + struct sock *sk = tinfo->sock->sk; 1721 + struct udp_sock *up = udp_sk(sk); 1720 1722 int len; 1721 1723 1722 1724 pr_info("sync thread started: state = BACKUP, mcast_ifn = %s, " ··· 1726 1724 ipvs->bcfg.mcast_ifn, ipvs->bcfg.syncid, tinfo->id); 1727 1725 1728 1726 while (!kthread_should_stop()) { 1729 - wait_event_interruptible(*sk_sleep(tinfo->sock->sk), 1730 - !skb_queue_empty(&tinfo->sock->sk->sk_receive_queue) 1731 - || kthread_should_stop()); 1727 + wait_event_interruptible(*sk_sleep(sk), 1728 + !skb_queue_empty_lockless(&sk->sk_receive_queue) || 1729 + !skb_queue_empty_lockless(&up->reader_queue) || 1730 + kthread_should_stop()); 1732 1731 1733 1732 /* do we have data now? */ 1734 - while (!skb_queue_empty(&(tinfo->sock->sk->sk_receive_queue))) { 1733 + while (!skb_queue_empty_lockless(&sk->sk_receive_queue) || 1734 + !skb_queue_empty_lockless(&up->reader_queue)) { 1735 1735 len = ip_vs_receive(tinfo->sock, tinfo->buf, 1736 1736 ipvs->bcfg.sync_maxlen); 1737 1737 if (len <= 0) {
+14 -27
net/netfilter/nf_tables_api.c
··· 188 188 nf_unregister_net_hook(net, &hook->ops); 189 189 } 190 190 191 - static int nft_register_basechain_hooks(struct net *net, int family, 192 - struct nft_base_chain *basechain) 193 - { 194 - if (family == NFPROTO_NETDEV) 195 - return nft_netdev_register_hooks(net, &basechain->hook_list); 196 - 197 - return nf_register_net_hook(net, &basechain->ops); 198 - } 199 - 200 - static void nft_unregister_basechain_hooks(struct net *net, int family, 201 - struct nft_base_chain *basechain) 202 - { 203 - if (family == NFPROTO_NETDEV) 204 - nft_netdev_unregister_hooks(net, &basechain->hook_list); 205 - else 206 - nf_unregister_net_hook(net, &basechain->ops); 207 - } 208 - 209 191 static int nf_tables_register_hook(struct net *net, 210 192 const struct nft_table *table, 211 193 struct nft_chain *chain) ··· 205 223 if (basechain->type->ops_register) 206 224 return basechain->type->ops_register(net, ops); 207 225 208 - return nft_register_basechain_hooks(net, table->family, basechain); 226 + if (table->family == NFPROTO_NETDEV) 227 + return nft_netdev_register_hooks(net, &basechain->hook_list); 228 + 229 + return nf_register_net_hook(net, &basechain->ops); 209 230 } 210 231 211 232 static void nf_tables_unregister_hook(struct net *net, ··· 227 242 if (basechain->type->ops_unregister) 228 243 return basechain->type->ops_unregister(net, ops); 229 244 230 - nft_unregister_basechain_hooks(net, table->family, basechain); 245 + if (table->family == NFPROTO_NETDEV) 246 + nft_netdev_unregister_hooks(net, &basechain->hook_list); 247 + else 248 + nf_unregister_net_hook(net, &basechain->ops); 231 249 } 232 250 233 251 static int nft_trans_table_add(struct nft_ctx *ctx, int msg_type) ··· 820 832 if (cnt && i++ == cnt) 821 833 break; 822 834 823 - nft_unregister_basechain_hooks(net, table->family, 824 - nft_base_chain(chain)); 835 + nf_tables_unregister_hook(net, table, chain); 825 836 } 826 837 } 827 838 ··· 835 848 if (!nft_is_base_chain(chain)) 836 849 continue; 837 850 838 - err = nft_register_basechain_hooks(net, table->family, 839 - nft_base_chain(chain)); 851 + err = nf_tables_register_hook(net, table, chain); 840 852 if (err < 0) 841 853 goto err_register_hooks; 842 854 ··· 880 894 nft_trans_table_enable(trans) = false; 881 895 } else if (!(flags & NFT_TABLE_F_DORMANT) && 882 896 ctx->table->flags & NFT_TABLE_F_DORMANT) { 897 + ctx->table->flags &= ~NFT_TABLE_F_DORMANT; 883 898 ret = nf_tables_table_enable(ctx->net, ctx->table); 884 - if (ret >= 0) { 885 - ctx->table->flags &= ~NFT_TABLE_F_DORMANT; 899 + if (ret >= 0) 886 900 nft_trans_table_enable(trans) = true; 887 - } 901 + else 902 + ctx->table->flags |= NFT_TABLE_F_DORMANT; 888 903 } 889 904 if (ret < 0) 890 905 goto err;
+4 -1
net/nfc/nci/core.c
··· 1228 1228 1229 1229 rc = nfc_register_device(ndev->nfc_dev); 1230 1230 if (rc) 1231 - goto destroy_rx_wq_exit; 1231 + goto destroy_tx_wq_exit; 1232 1232 1233 1233 goto exit; 1234 + 1235 + destroy_tx_wq_exit: 1236 + destroy_workqueue(ndev->tx_wq); 1234 1237 1235 1238 destroy_rx_wq_exit: 1236 1239 destroy_workqueue(ndev->rx_wq);
+1
net/qrtr/qrtr.c
··· 1180 1180 sk->sk_state_change(sk); 1181 1181 1182 1182 sock_set_flag(sk, SOCK_DEAD); 1183 + sock_orphan(sk); 1183 1184 sock->sk = NULL; 1184 1185 1185 1186 if (!sock_flag(sk, SOCK_ZAPPED))
+1 -1
net/rxrpc/recvmsg.c
··· 543 543 list_empty(&rx->recvmsg_q) && 544 544 rx->sk.sk_state != RXRPC_SERVER_LISTENING) { 545 545 release_sock(&rx->sk); 546 - return -ENODATA; 546 + return -EAGAIN; 547 547 } 548 548 549 549 if (list_empty(&rx->recvmsg_q)) {
+1 -1
net/rxrpc/sendmsg.c
··· 304 304 /* this should be in poll */ 305 305 sk_clear_bit(SOCKWQ_ASYNC_NOSPACE, sk); 306 306 307 - if (sk->sk_err || (sk->sk_shutdown & SEND_SHUTDOWN)) 307 + if (sk->sk_shutdown & SEND_SHUTDOWN) 308 308 return -EPIPE; 309 309 310 310 more = msg->msg_flags & MSG_MORE;
+14 -2
net/sched/act_ct.c
··· 673 673 } 674 674 675 675 static int tcf_ct_handle_fragments(struct net *net, struct sk_buff *skb, 676 - u8 family, u16 zone) 676 + u8 family, u16 zone, bool *defrag) 677 677 { 678 678 enum ip_conntrack_info ctinfo; 679 + struct qdisc_skb_cb cb; 679 680 struct nf_conn *ct; 680 681 int err = 0; 681 682 bool frag; ··· 694 693 return err; 695 694 696 695 skb_get(skb); 696 + cb = *qdisc_skb_cb(skb); 697 697 698 698 if (family == NFPROTO_IPV4) { 699 699 enum ip_defrag_users user = IP_DEFRAG_CONNTRACK_IN + zone; ··· 705 703 local_bh_enable(); 706 704 if (err && err != -EINPROGRESS) 707 705 goto out_free; 706 + 707 + if (!err) 708 + *defrag = true; 708 709 } else { /* NFPROTO_IPV6 */ 709 710 #if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6) 710 711 enum ip6_defrag_users user = IP6_DEFRAG_CONNTRACK_IN + zone; ··· 716 711 err = nf_ct_frag6_gather(net, skb, user); 717 712 if (err && err != -EINPROGRESS) 718 713 goto out_free; 714 + 715 + if (!err) 716 + *defrag = true; 719 717 #else 720 718 err = -EOPNOTSUPP; 721 719 goto out_free; 722 720 #endif 723 721 } 724 722 723 + *qdisc_skb_cb(skb) = cb; 725 724 skb_clear_hash(skb); 726 725 skb->ignore_df = 1; 727 726 return err; ··· 923 914 int nh_ofs, err, retval; 924 915 struct tcf_ct_params *p; 925 916 bool skip_add = false; 917 + bool defrag = false; 926 918 struct nf_conn *ct; 927 919 u8 family; 928 920 ··· 956 946 */ 957 947 nh_ofs = skb_network_offset(skb); 958 948 skb_pull_rcsum(skb, nh_ofs); 959 - err = tcf_ct_handle_fragments(net, skb, family, p->zone); 949 + err = tcf_ct_handle_fragments(net, skb, family, p->zone, &defrag); 960 950 if (err == -EINPROGRESS) { 961 951 retval = TC_ACT_STOLEN; 962 952 goto out; ··· 1024 1014 1025 1015 out: 1026 1016 tcf_action_update_bstats(&c->common, skb); 1017 + if (defrag) 1018 + qdisc_skb_cb(skb)->pkt_len = skb->len; 1027 1019 return retval; 1028 1020 1029 1021 drop:
-1
net/sched/cls_api.c
··· 20 20 #include <linux/kmod.h> 21 21 #include <linux/slab.h> 22 22 #include <linux/idr.h> 23 - #include <linux/rhashtable.h> 24 23 #include <linux/jhash.h> 25 24 #include <linux/rculist.h> 26 25 #include <net/net_namespace.h>
+18 -9
net/sctp/stream.c
··· 22 22 #include <net/sctp/sm.h> 23 23 #include <net/sctp/stream_sched.h> 24 24 25 - /* Migrates chunks from stream queues to new stream queues if needed, 26 - * but not across associations. Also, removes those chunks to streams 27 - * higher than the new max. 28 - */ 29 - static void sctp_stream_outq_migrate(struct sctp_stream *stream, 30 - struct sctp_stream *new, __u16 outcnt) 25 + static void sctp_stream_shrink_out(struct sctp_stream *stream, __u16 outcnt) 31 26 { 32 27 struct sctp_association *asoc; 33 28 struct sctp_chunk *ch, *temp; 34 29 struct sctp_outq *outq; 35 - int i; 36 30 37 31 asoc = container_of(stream, struct sctp_association, stream); 38 32 outq = &asoc->outqueue; ··· 50 56 51 57 sctp_chunk_free(ch); 52 58 } 59 + } 60 + 61 + /* Migrates chunks from stream queues to new stream queues if needed, 62 + * but not across associations. Also, removes those chunks to streams 63 + * higher than the new max. 64 + */ 65 + static void sctp_stream_outq_migrate(struct sctp_stream *stream, 66 + struct sctp_stream *new, __u16 outcnt) 67 + { 68 + int i; 69 + 70 + if (stream->outcnt > outcnt) 71 + sctp_stream_shrink_out(stream, outcnt); 53 72 54 73 if (new) { 55 74 /* Here we actually move the old ext stuff into the new ··· 1044 1037 nums = ntohs(addstrm->number_of_streams); 1045 1038 number = stream->outcnt - nums; 1046 1039 1047 - if (result == SCTP_STRRESET_PERFORMED) 1040 + if (result == SCTP_STRRESET_PERFORMED) { 1048 1041 for (i = number; i < stream->outcnt; i++) 1049 1042 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN; 1050 - else 1043 + } else { 1044 + sctp_stream_shrink_out(stream, number); 1051 1045 stream->outcnt = number; 1046 + } 1052 1047 1053 1048 *evp = sctp_ulpevent_make_stream_change_event(asoc, flags, 1054 1049 0, nums, GFP_ATOMIC);
+8 -4
net/smc/af_smc.c
··· 126 126 127 127 static void smc_restore_fallback_changes(struct smc_sock *smc) 128 128 { 129 - smc->clcsock->file->private_data = smc->sk.sk_socket; 130 - smc->clcsock->file = NULL; 129 + if (smc->clcsock->file) { /* non-accepted sockets have no file yet */ 130 + smc->clcsock->file->private_data = smc->sk.sk_socket; 131 + smc->clcsock->file = NULL; 132 + } 131 133 } 132 134 133 135 static int __smc_release(struct smc_sock *smc) ··· 354 352 */ 355 353 mutex_lock(&lgr->llc_conf_mutex); 356 354 for (i = 0; i < SMC_LINKS_PER_LGR_MAX; i++) { 357 - if (lgr->lnk[i].state != SMC_LNK_ACTIVE) 355 + if (!smc_link_active(&lgr->lnk[i])) 358 356 continue; 359 357 rc = smcr_link_reg_rmb(&lgr->lnk[i], rmb_desc); 360 358 if (rc) ··· 634 632 for (i = 0; i < SMC_LINKS_PER_LGR_MAX; i++) { 635 633 struct smc_link *l = &smc->conn.lgr->lnk[i]; 636 634 637 - if (l->peer_qpn == ntoh24(aclc->qpn)) { 635 + if (l->peer_qpn == ntoh24(aclc->qpn) && 636 + !memcmp(l->peer_gid, &aclc->lcl.gid, SMC_GID_SIZE) && 637 + !memcmp(l->peer_mac, &aclc->lcl.mac, sizeof(l->peer_mac))) { 638 638 link = l; 639 639 break; 640 640 }
+5 -1
net/smc/smc_cdc.c
··· 66 66 rc = smc_wr_tx_get_free_slot(link, smc_cdc_tx_handler, wr_buf, 67 67 wr_rdma_buf, 68 68 (struct smc_wr_tx_pend_priv **)pend); 69 - if (conn->killed) 69 + if (conn->killed) { 70 70 /* abnormal termination */ 71 + if (!rc) 72 + smc_wr_tx_put_slot(link, 73 + (struct smc_wr_tx_pend_priv *)pend); 71 74 rc = -EPIPE; 75 + } 72 76 return rc; 73 77 } 74 78
+24 -85
net/smc/smc_core.c
··· 45 45 static atomic_t lgr_cnt = ATOMIC_INIT(0); /* number of existing link groups */ 46 46 static DECLARE_WAIT_QUEUE_HEAD(lgrs_deleted); 47 47 48 - struct smc_ib_up_work { 49 - struct work_struct work; 50 - struct smc_link_group *lgr; 51 - struct smc_ib_device *smcibdev; 52 - u8 ibport; 53 - }; 54 - 55 48 static void smc_buf_free(struct smc_link_group *lgr, bool is_rmb, 56 49 struct smc_buf_desc *buf_desc); 57 50 static void __smc_lgr_terminate(struct smc_link_group *lgr, bool soft); 58 51 59 - static void smc_link_up_work(struct work_struct *work); 60 52 static void smc_link_down_work(struct work_struct *work); 61 53 62 54 /* return head of link group list and its lock for a given link group */ ··· 318 326 319 327 get_device(&ini->ib_dev->ibdev->dev); 320 328 atomic_inc(&ini->ib_dev->lnk_cnt); 321 - lnk->state = SMC_LNK_ACTIVATING; 322 329 lnk->link_id = smcr_next_link_id(lgr); 323 330 lnk->lgr = lgr; 324 331 lnk->link_idx = link_idx; ··· 353 362 rc = smc_wr_create_link(lnk); 354 363 if (rc) 355 364 goto destroy_qp; 365 + lnk->state = SMC_LNK_ACTIVATING; 356 366 return 0; 357 367 358 368 destroy_qp: ··· 444 452 } 445 453 smc->conn.lgr = lgr; 446 454 spin_lock_bh(lgr_lock); 447 - list_add(&lgr->list, lgr_list); 455 + list_add_tail(&lgr->list, lgr_list); 448 456 spin_unlock_bh(lgr_lock); 449 457 return 0; 450 458 ··· 542 550 smc_wr_wakeup_tx_wait(from_lnk); 543 551 544 552 for (i = 0; i < SMC_LINKS_PER_LGR_MAX; i++) { 545 - if (lgr->lnk[i].state != SMC_LNK_ACTIVE || 546 - i == from_lnk->link_idx) 553 + if (!smc_link_active(&lgr->lnk[i]) || i == from_lnk->link_idx) 547 554 continue; 548 555 if (is_dev_err && from_lnk->smcibdev == lgr->lnk[i].smcibdev && 549 556 from_lnk->ibport == lgr->lnk[i].ibport) { ··· 1097 1106 sock_put(&smc->sk); /* sock_hold done by schedulers of abort_work */ 1098 1107 } 1099 1108 1100 - /* link is up - establish alternate link if applicable */ 1101 - static void smcr_link_up(struct smc_link_group *lgr, 1102 - struct smc_ib_device *smcibdev, u8 ibport) 1103 - { 1104 - struct smc_link *link = NULL; 1105 - 1106 - if (list_empty(&lgr->list) || 1107 - lgr->type == SMC_LGR_SYMMETRIC || 1108 - lgr->type == SMC_LGR_ASYMMETRIC_PEER) 1109 - return; 1110 - 1111 - if (lgr->role == SMC_SERV) { 1112 - /* trigger local add link processing */ 1113 - link = smc_llc_usable_link(lgr); 1114 - if (!link) 1115 - return; 1116 - smc_llc_srv_add_link_local(link); 1117 - } else { 1118 - /* invite server to start add link processing */ 1119 - u8 gid[SMC_GID_SIZE]; 1120 - 1121 - if (smc_ib_determine_gid(smcibdev, ibport, lgr->vlan_id, gid, 1122 - NULL)) 1123 - return; 1124 - if (lgr->llc_flow_lcl.type != SMC_LLC_FLOW_NONE) { 1125 - /* some other llc task is ongoing */ 1126 - wait_event_timeout(lgr->llc_flow_waiter, 1127 - (list_empty(&lgr->list) || 1128 - lgr->llc_flow_lcl.type == SMC_LLC_FLOW_NONE), 1129 - SMC_LLC_WAIT_TIME); 1130 - } 1131 - /* lgr or device no longer active? */ 1132 - if (!list_empty(&lgr->list) && 1133 - smc_ib_port_active(smcibdev, ibport)) 1134 - link = smc_llc_usable_link(lgr); 1135 - if (link) 1136 - smc_llc_send_add_link(link, smcibdev->mac[ibport - 1], 1137 - gid, NULL, SMC_LLC_REQ); 1138 - wake_up(&lgr->llc_flow_waiter); /* wake up next waiter */ 1139 - } 1140 - } 1141 - 1142 1109 void smcr_port_add(struct smc_ib_device *smcibdev, u8 ibport) 1143 1110 { 1144 - struct smc_ib_up_work *ib_work; 1145 1111 struct smc_link_group *lgr, *n; 1146 1112 1147 1113 list_for_each_entry_safe(lgr, n, &smc_lgr_list.list, list) { 1114 + struct smc_link *link; 1115 + 1148 1116 if (strncmp(smcibdev->pnetid[ibport - 1], lgr->pnet_id, 1149 1117 SMC_MAX_PNETID_LEN) || 1150 1118 lgr->type == SMC_LGR_SYMMETRIC || 1151 1119 lgr->type == SMC_LGR_ASYMMETRIC_PEER) 1152 1120 continue; 1153 - ib_work = kmalloc(sizeof(*ib_work), GFP_KERNEL); 1154 - if (!ib_work) 1155 - continue; 1156 - INIT_WORK(&ib_work->work, smc_link_up_work); 1157 - ib_work->lgr = lgr; 1158 - ib_work->smcibdev = smcibdev; 1159 - ib_work->ibport = ibport; 1160 - schedule_work(&ib_work->work); 1121 + 1122 + /* trigger local add link processing */ 1123 + link = smc_llc_usable_link(lgr); 1124 + if (link) 1125 + smc_llc_add_link_local(link); 1161 1126 } 1162 1127 } 1163 1128 ··· 1151 1204 SMC_LLC_WAIT_TIME); 1152 1205 mutex_lock(&lgr->llc_conf_mutex); 1153 1206 } 1154 - if (!list_empty(&lgr->list)) 1207 + if (!list_empty(&lgr->list)) { 1155 1208 smc_llc_send_delete_link(to_lnk, del_link_id, 1156 1209 SMC_LLC_REQ, true, 1157 1210 SMC_LLC_DEL_LOST_PATH); 1211 + smcr_link_clear(lnk, true); 1212 + } 1158 1213 wake_up(&lgr->llc_flow_waiter); /* wake up next waiter */ 1159 1214 } 1160 1215 } ··· 1194 1245 smcr_link_down_cond_sched(lnk); 1195 1246 } 1196 1247 } 1197 - } 1198 - 1199 - static void smc_link_up_work(struct work_struct *work) 1200 - { 1201 - struct smc_ib_up_work *ib_work = container_of(work, 1202 - struct smc_ib_up_work, 1203 - work); 1204 - struct smc_link_group *lgr = ib_work->lgr; 1205 - 1206 - if (list_empty(&lgr->list)) 1207 - goto out; 1208 - smcr_link_up(lgr, ib_work->smcibdev, ib_work->ibport); 1209 - out: 1210 - kfree(ib_work); 1211 1248 } 1212 1249 1213 1250 static void smc_link_down_work(struct work_struct *work) ··· 1268 1333 return false; 1269 1334 1270 1335 for (i = 0; i < SMC_LINKS_PER_LGR_MAX; i++) { 1271 - if (lgr->lnk[i].state != SMC_LNK_ACTIVE) 1336 + if (!smc_link_active(&lgr->lnk[i])) 1272 1337 continue; 1273 1338 if ((lgr->role == SMC_SERV || lgr->lnk[i].peer_qpn == clcqpn) && 1274 1339 !memcmp(lgr->lnk[i].peer_gid, &lcl->gid, SMC_GID_SIZE) && ··· 1311 1376 smcr_lgr_match(lgr, ini->ib_lcl, role, ini->ib_clcqpn)) && 1312 1377 !lgr->sync_err && 1313 1378 lgr->vlan_id == ini->vlan_id && 1314 - (role == SMC_CLNT || 1379 + (role == SMC_CLNT || ini->is_smcd || 1315 1380 lgr->conns_num < SMC_RMBS_PER_LGR_MAX)) { 1316 1381 /* link group found */ 1317 1382 ini->cln_first_contact = SMC_REUSE_CONTACT; ··· 1716 1781 1717 1782 void smc_sndbuf_sync_sg_for_cpu(struct smc_connection *conn) 1718 1783 { 1719 - if (!conn->lgr || conn->lgr->is_smcd || !smc_link_usable(conn->lnk)) 1784 + if (!conn->lgr || conn->lgr->is_smcd || !smc_link_active(conn->lnk)) 1720 1785 return; 1721 1786 smc_ib_sync_sg_for_cpu(conn->lnk, conn->sndbuf_desc, DMA_TO_DEVICE); 1722 1787 } 1723 1788 1724 1789 void smc_sndbuf_sync_sg_for_device(struct smc_connection *conn) 1725 1790 { 1726 - if (!conn->lgr || conn->lgr->is_smcd || !smc_link_usable(conn->lnk)) 1791 + if (!conn->lgr || conn->lgr->is_smcd || !smc_link_active(conn->lnk)) 1727 1792 return; 1728 1793 smc_ib_sync_sg_for_device(conn->lnk, conn->sndbuf_desc, DMA_TO_DEVICE); 1729 1794 } ··· 1735 1800 if (!conn->lgr || conn->lgr->is_smcd) 1736 1801 return; 1737 1802 for (i = 0; i < SMC_LINKS_PER_LGR_MAX; i++) { 1738 - if (!smc_link_usable(&conn->lgr->lnk[i])) 1803 + if (!smc_link_active(&conn->lgr->lnk[i])) 1739 1804 continue; 1740 1805 smc_ib_sync_sg_for_cpu(&conn->lgr->lnk[i], conn->rmb_desc, 1741 1806 DMA_FROM_DEVICE); ··· 1749 1814 if (!conn->lgr || conn->lgr->is_smcd) 1750 1815 return; 1751 1816 for (i = 0; i < SMC_LINKS_PER_LGR_MAX; i++) { 1752 - if (!smc_link_usable(&conn->lgr->lnk[i])) 1817 + if (!smc_link_active(&conn->lgr->lnk[i])) 1753 1818 continue; 1754 1819 smc_ib_sync_sg_for_device(&conn->lgr->lnk[i], conn->rmb_desc, 1755 1820 DMA_FROM_DEVICE); ··· 1772 1837 return rc; 1773 1838 /* create rmb */ 1774 1839 rc = __smc_buf_create(smc, is_smcd, true); 1775 - if (rc) 1840 + if (rc) { 1841 + mutex_lock(&smc->conn.lgr->sndbufs_lock); 1842 + list_del(&smc->conn.sndbuf_desc->list); 1843 + mutex_unlock(&smc->conn.lgr->sndbufs_lock); 1776 1844 smc_buf_free(smc->conn.lgr, false, smc->conn.sndbuf_desc); 1845 + } 1777 1846 return rc; 1778 1847 } 1779 1848
+5
net/smc/smc_core.h
··· 349 349 return true; 350 350 } 351 351 352 + static inline bool smc_link_active(struct smc_link *lnk) 353 + { 354 + return lnk->state == SMC_LNK_ACTIVE; 355 + } 356 + 352 357 struct smc_sock; 353 358 struct smc_clc_msg_accept_confirm; 354 359 struct smc_clc_msg_local;
+13 -3
net/smc/smc_ib.c
··· 506 506 int cqe_size_order, smc_order; 507 507 long rc; 508 508 509 + mutex_lock(&smcibdev->mutex); 510 + rc = 0; 511 + if (smcibdev->initialized) 512 + goto out; 509 513 /* the calculated number of cq entries fits to mlx5 cq allocation */ 510 514 cqe_size_order = cache_line_size() == 128 ? 7 : 6; 511 515 smc_order = MAX_ORDER - cqe_size_order - 1; ··· 521 517 rc = PTR_ERR_OR_ZERO(smcibdev->roce_cq_send); 522 518 if (IS_ERR(smcibdev->roce_cq_send)) { 523 519 smcibdev->roce_cq_send = NULL; 524 - return rc; 520 + goto out; 525 521 } 526 522 smcibdev->roce_cq_recv = ib_create_cq(smcibdev->ibdev, 527 523 smc_wr_rx_cq_handler, NULL, ··· 533 529 } 534 530 smc_wr_add_dev(smcibdev); 535 531 smcibdev->initialized = 1; 536 - return rc; 532 + goto out; 537 533 538 534 err: 539 535 ib_destroy_cq(smcibdev->roce_cq_send); 536 + out: 537 + mutex_unlock(&smcibdev->mutex); 540 538 return rc; 541 539 } 542 540 543 541 static void smc_ib_cleanup_per_ibdev(struct smc_ib_device *smcibdev) 544 542 { 543 + mutex_lock(&smcibdev->mutex); 545 544 if (!smcibdev->initialized) 546 - return; 545 + goto out; 547 546 smcibdev->initialized = 0; 548 547 ib_destroy_cq(smcibdev->roce_cq_recv); 549 548 ib_destroy_cq(smcibdev->roce_cq_send); 550 549 smc_wr_remove_dev(smcibdev); 550 + out: 551 + mutex_unlock(&smcibdev->mutex); 551 552 } 552 553 553 554 static struct ib_client smc_ib_client; ··· 575 566 INIT_WORK(&smcibdev->port_event_work, smc_ib_port_event_work); 576 567 atomic_set(&smcibdev->lnk_cnt, 0); 577 568 init_waitqueue_head(&smcibdev->lnks_deleted); 569 + mutex_init(&smcibdev->mutex); 578 570 mutex_lock(&smc_ib_devices.mutex); 579 571 list_add_tail(&smcibdev->list, &smc_ib_devices.list); 580 572 mutex_unlock(&smc_ib_devices.mutex);
+1
net/smc/smc_ib.h
··· 52 52 DECLARE_BITMAP(ports_going_away, SMC_MAX_PORTS); 53 53 atomic_t lnk_cnt; /* number of links on ibdev */ 54 54 wait_queue_head_t lnks_deleted; /* wait 4 removal of all links*/ 55 + struct mutex mutex; /* protect dev setup+cleanup */ 55 56 }; 56 57 57 58 struct smc_buf_desc;
+85 -42
net/smc/smc_llc.c
··· 428 428 rtok_ix = 1; 429 429 for (i = 0; i < SMC_LINKS_PER_LGR_MAX; i++) { 430 430 link = &send_link->lgr->lnk[i]; 431 - if (link->state == SMC_LNK_ACTIVE && link != send_link) { 431 + if (smc_link_active(link) && link != send_link) { 432 432 rkeyllc->rtoken[rtok_ix].link_id = link->link_id; 433 433 rkeyllc->rtoken[rtok_ix].rmb_key = 434 434 htonl(rmb_desc->mr_rx[link->link_idx]->rkey); ··· 895 895 return rc; 896 896 } 897 897 898 + /* as an SMC client, invite server to start the add_link processing */ 899 + static void smc_llc_cli_add_link_invite(struct smc_link *link, 900 + struct smc_llc_qentry *qentry) 901 + { 902 + struct smc_link_group *lgr = smc_get_lgr(link); 903 + struct smc_init_info ini; 904 + 905 + if (lgr->type == SMC_LGR_SYMMETRIC || 906 + lgr->type == SMC_LGR_ASYMMETRIC_PEER) 907 + goto out; 908 + 909 + ini.vlan_id = lgr->vlan_id; 910 + smc_pnet_find_alt_roce(lgr, &ini, link->smcibdev); 911 + if (!ini.ib_dev) 912 + goto out; 913 + 914 + smc_llc_send_add_link(link, ini.ib_dev->mac[ini.ib_port - 1], 915 + ini.ib_gid, NULL, SMC_LLC_REQ); 916 + out: 917 + kfree(qentry); 918 + } 919 + 920 + static bool smc_llc_is_local_add_link(union smc_llc_msg *llc) 921 + { 922 + if (llc->raw.hdr.common.type == SMC_LLC_ADD_LINK && 923 + !llc->add_link.qp_mtu && !llc->add_link.link_num) 924 + return true; 925 + return false; 926 + } 927 + 898 928 static void smc_llc_process_cli_add_link(struct smc_link_group *lgr) 899 929 { 900 930 struct smc_llc_qentry *qentry; ··· 932 902 qentry = smc_llc_flow_qentry_clr(&lgr->llc_flow_lcl); 933 903 934 904 mutex_lock(&lgr->llc_conf_mutex); 935 - smc_llc_cli_add_link(qentry->link, qentry); 905 + if (smc_llc_is_local_add_link(&qentry->msg)) 906 + smc_llc_cli_add_link_invite(qentry->link, qentry); 907 + else 908 + smc_llc_cli_add_link(qentry->link, qentry); 936 909 mutex_unlock(&lgr->llc_conf_mutex); 937 910 } 938 911 ··· 944 911 int i, link_count = 0; 945 912 946 913 for (i = 0; i < SMC_LINKS_PER_LGR_MAX; i++) { 947 - if (!smc_link_usable(&lgr->lnk[i])) 914 + if (!smc_link_active(&lgr->lnk[i])) 948 915 continue; 949 916 link_count++; 950 917 } ··· 1084 1051 if (rc) 1085 1052 return -ENOLINK; 1086 1053 /* receive CONFIRM LINK response over the RoCE fabric */ 1087 - qentry = smc_llc_wait(lgr, link, SMC_LLC_WAIT_FIRST_TIME, 1088 - SMC_LLC_CONFIRM_LINK); 1089 - if (!qentry) { 1054 + qentry = smc_llc_wait(lgr, link, SMC_LLC_WAIT_FIRST_TIME, 0); 1055 + if (!qentry || 1056 + qentry->msg.raw.hdr.common.type != SMC_LLC_CONFIRM_LINK) { 1090 1057 /* send DELETE LINK */ 1091 1058 smc_llc_send_delete_link(link, link_new->link_id, SMC_LLC_REQ, 1092 1059 false, SMC_LLC_DEL_LOST_PATH); 1060 + if (qentry) 1061 + smc_llc_flow_qentry_del(&lgr->llc_flow_lcl); 1093 1062 return -ENOLINK; 1094 1063 } 1095 1064 smc_llc_save_peer_uid(qentry); ··· 1193 1158 mutex_unlock(&lgr->llc_conf_mutex); 1194 1159 } 1195 1160 1196 - /* enqueue a local add_link req to trigger a new add_link flow, only as SERV */ 1197 - void smc_llc_srv_add_link_local(struct smc_link *link) 1161 + /* enqueue a local add_link req to trigger a new add_link flow */ 1162 + void smc_llc_add_link_local(struct smc_link *link) 1198 1163 { 1199 1164 struct smc_llc_msg_add_link add_llc = {0}; 1200 1165 1201 1166 add_llc.hd.length = sizeof(add_llc); 1202 1167 add_llc.hd.common.type = SMC_LLC_ADD_LINK; 1203 - /* no dev and port needed, we as server ignore client data anyway */ 1168 + /* no dev and port needed */ 1204 1169 smc_llc_enqueue(link, (union smc_llc_msg *)&add_llc); 1205 1170 } 1206 1171 ··· 1380 1345 1381 1346 if (lgr->type == SMC_LGR_SINGLE && !list_empty(&lgr->list)) { 1382 1347 /* trigger setup of asymm alt link */ 1383 - smc_llc_srv_add_link_local(lnk); 1348 + smc_llc_add_link_local(lnk); 1384 1349 } 1385 1350 out: 1386 1351 mutex_unlock(&lgr->llc_conf_mutex); ··· 1509 1474 if (list_empty(&lgr->list)) 1510 1475 goto out; /* lgr is terminating */ 1511 1476 if (lgr->role == SMC_CLNT) { 1512 - if (lgr->llc_flow_lcl.type == SMC_LLC_FLOW_ADD_LINK) { 1477 + if (smc_llc_is_local_add_link(llc)) { 1478 + if (lgr->llc_flow_lcl.type == 1479 + SMC_LLC_FLOW_ADD_LINK) 1480 + break; /* add_link in progress */ 1481 + if (smc_llc_flow_start(&lgr->llc_flow_lcl, 1482 + qentry)) { 1483 + schedule_work(&lgr->llc_add_link_work); 1484 + } 1485 + return; 1486 + } 1487 + if (lgr->llc_flow_lcl.type == SMC_LLC_FLOW_ADD_LINK && 1488 + !lgr->llc_flow_lcl.qentry) { 1513 1489 /* a flow is waiting for this message */ 1514 1490 smc_llc_flow_qentry_set(&lgr->llc_flow_lcl, 1515 1491 qentry); ··· 1544 1498 } 1545 1499 break; 1546 1500 case SMC_LLC_DELETE_LINK: 1547 - if (lgr->role == SMC_CLNT) { 1548 - /* server requests to delete this link, send response */ 1549 - if (lgr->llc_flow_lcl.type != SMC_LLC_FLOW_NONE) { 1550 - /* DEL LINK REQ during ADD LINK SEQ */ 1551 - smc_llc_flow_qentry_set(&lgr->llc_flow_lcl, 1552 - qentry); 1553 - wake_up(&lgr->llc_msg_waiter); 1554 - } else if (smc_llc_flow_start(&lgr->llc_flow_lcl, 1555 - qentry)) { 1556 - schedule_work(&lgr->llc_del_link_work); 1557 - } 1558 - } else { 1559 - if (lgr->llc_flow_lcl.type == SMC_LLC_FLOW_ADD_LINK && 1560 - !lgr->llc_flow_lcl.qentry) { 1561 - /* DEL LINK REQ during ADD LINK SEQ */ 1562 - smc_llc_flow_qentry_set(&lgr->llc_flow_lcl, 1563 - qentry); 1564 - wake_up(&lgr->llc_msg_waiter); 1565 - } else if (smc_llc_flow_start(&lgr->llc_flow_lcl, 1566 - qentry)) { 1567 - schedule_work(&lgr->llc_del_link_work); 1568 - } 1501 + if (lgr->llc_flow_lcl.type == SMC_LLC_FLOW_ADD_LINK && 1502 + !lgr->llc_flow_lcl.qentry) { 1503 + /* DEL LINK REQ during ADD LINK SEQ */ 1504 + smc_llc_flow_qentry_set(&lgr->llc_flow_lcl, qentry); 1505 + wake_up(&lgr->llc_msg_waiter); 1506 + } else if (smc_llc_flow_start(&lgr->llc_flow_lcl, qentry)) { 1507 + schedule_work(&lgr->llc_del_link_work); 1569 1508 } 1570 1509 return; 1571 1510 case SMC_LLC_CONFIRM_RKEY: ··· 1616 1585 static void smc_llc_rx_response(struct smc_link *link, 1617 1586 struct smc_llc_qentry *qentry) 1618 1587 { 1588 + enum smc_llc_flowtype flowtype = link->lgr->llc_flow_lcl.type; 1589 + struct smc_llc_flow *flow = &link->lgr->llc_flow_lcl; 1619 1590 u8 llc_type = qentry->msg.raw.hdr.common.type; 1620 1591 1621 1592 switch (llc_type) { 1622 1593 case SMC_LLC_TEST_LINK: 1623 - if (link->state == SMC_LNK_ACTIVE) 1594 + if (smc_link_active(link)) 1624 1595 complete(&link->llc_testlink_resp); 1625 1596 break; 1626 1597 case SMC_LLC_ADD_LINK: 1627 - case SMC_LLC_DELETE_LINK: 1628 - case SMC_LLC_CONFIRM_LINK: 1629 1598 case SMC_LLC_ADD_LINK_CONT: 1599 + case SMC_LLC_CONFIRM_LINK: 1600 + if (flowtype != SMC_LLC_FLOW_ADD_LINK || flow->qentry) 1601 + break; /* drop out-of-flow response */ 1602 + goto assign; 1603 + case SMC_LLC_DELETE_LINK: 1604 + if (flowtype != SMC_LLC_FLOW_DEL_LINK || flow->qentry) 1605 + break; /* drop out-of-flow response */ 1606 + goto assign; 1630 1607 case SMC_LLC_CONFIRM_RKEY: 1631 1608 case SMC_LLC_DELETE_RKEY: 1632 - /* assign responses to the local flow, we requested them */ 1633 - smc_llc_flow_qentry_set(&link->lgr->llc_flow_lcl, qentry); 1634 - wake_up(&link->lgr->llc_msg_waiter); 1635 - return; 1609 + if (flowtype != SMC_LLC_FLOW_RKEY || flow->qentry) 1610 + break; /* drop out-of-flow response */ 1611 + goto assign; 1636 1612 case SMC_LLC_CONFIRM_RKEY_CONT: 1637 1613 /* not used because max links is 3 */ 1638 1614 break; ··· 1648 1610 break; 1649 1611 } 1650 1612 kfree(qentry); 1613 + return; 1614 + assign: 1615 + /* assign responses to the local flow, we requested them */ 1616 + smc_llc_flow_qentry_set(&link->lgr->llc_flow_lcl, qentry); 1617 + wake_up(&link->lgr->llc_msg_waiter); 1651 1618 } 1652 1619 1653 1620 static void smc_llc_enqueue(struct smc_link *link, union smc_llc_msg *llc) ··· 1706 1663 u8 user_data[16] = { 0 }; 1707 1664 int rc; 1708 1665 1709 - if (link->state != SMC_LNK_ACTIVE) 1666 + if (!smc_link_active(link)) 1710 1667 return; /* don't reschedule worker */ 1711 1668 expire_time = link->wr_rx_tstamp + link->llc_testlink_time; 1712 1669 if (time_is_after_jiffies(expire_time)) { ··· 1718 1675 /* receive TEST LINK response over RoCE fabric */ 1719 1676 rc = wait_for_completion_interruptible_timeout(&link->llc_testlink_resp, 1720 1677 SMC_LLC_WAIT_TIME); 1721 - if (link->state != SMC_LNK_ACTIVE) 1678 + if (!smc_link_active(link)) 1722 1679 return; /* link state changed */ 1723 1680 if (rc <= 0) { 1724 1681 smcr_link_down_cond_sched(link);
+1 -1
net/smc/smc_llc.h
··· 103 103 u32 rsn); 104 104 int smc_llc_cli_add_link(struct smc_link *link, struct smc_llc_qentry *qentry); 105 105 int smc_llc_srv_add_link(struct smc_link *link); 106 - void smc_llc_srv_add_link_local(struct smc_link *link); 106 + void smc_llc_add_link_local(struct smc_link *link); 107 107 int smc_llc_init(void) __init; 108 108 109 109 #endif /* SMC_LLC_H */
+1 -1
net/tipc/link.c
··· 827 827 state |= l->bc_rcvlink->rcv_unacked; 828 828 state |= l->rcv_unacked; 829 829 state |= !skb_queue_empty(&l->transmq); 830 - state |= !skb_queue_empty(&l->deferdq); 831 830 probe = mstate->probing; 832 831 probe |= l->silent_intv_cnt; 833 832 if (probe || mstate->monitoring) 834 833 l->silent_intv_cnt++; 834 + probe |= !skb_queue_empty(&l->deferdq); 835 835 if (l->snd_nxt == l->checkpoint) { 836 836 tipc_link_update_cwin(l, 0, 0); 837 837 probe = true;
+1 -1
net/vmw_vsock/virtio_transport.c
··· 22 22 #include <net/af_vsock.h> 23 23 24 24 static struct workqueue_struct *virtio_vsock_workqueue; 25 - static struct virtio_vsock *the_virtio_vsock; 25 + static struct virtio_vsock __rcu *the_virtio_vsock; 26 26 static DEFINE_MUTEX(the_virtio_vsock_mutex); /* protects the_virtio_vsock */ 27 27 28 28 struct virtio_vsock {
+1 -1
tools/testing/selftests/net/fib_nexthop_multiprefix.sh
··· 144 144 145 145 cleanup() 146 146 { 147 - for n in h1 r1 h2 h3 h4 147 + for n in h0 r1 h1 h2 h3 148 148 do 149 149 ip netns del ${n} 2>/dev/null 150 150 done
+2
tools/testing/selftests/net/ip_defrag.sh
··· 6 6 set +x 7 7 set -e 8 8 9 + modprobe -q nf_defrag_ipv6 10 + 9 11 readonly NETNS="ns-$(mktemp -u XXXXXX)" 10 12 11 13 setup() {
+1 -1
tools/testing/selftests/net/txtimestamp.sh
··· 75 75 fi 76 76 } 77 77 78 - if [[ "$(ip netns identify)" == "root" ]]; then 78 + if [[ -z "$(ip netns identify)" ]]; then 79 79 ./in_netns.sh $0 $@ 80 80 else 81 81 main $@