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

Configure Feed

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

Merge tag 'net-5.18-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

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

Current release - new code bugs:

- bridge: switchdev: check br_vlan_group() return value

- use this_cpu_inc() to increment net->core_stats, fix preempt-rt

Previous releases - regressions:

- eth: stmmac: fix write to sgmii_adapter_base

Previous releases - always broken:

- netfilter: nf_conntrack_tcp: re-init for syn packets only,
resolving issues with TCP fastopen

- tcp: md5: fix incorrect tcp_header_len for incoming connections

- tcp: fix F-RTO may not work correctly when receiving DSACK

- tcp: ensure use of most recently sent skb when filling rate samples

- tcp: fix potential xmit stalls caused by TCP_NOTSENT_LOWAT

- virtio_net: fix wrong buf address calculation when using xdp

- xsk: fix forwarding when combining copy mode with busy poll

- xsk: fix possible crash when multiple sockets are created

- bpf: lwt: fix crash when using bpf_skb_set_tunnel_key() from
bpf_xmit lwt hook

- sctp: null-check asoc strreset_chunk in sctp_generate_reconf_event

- wireguard: device: check for metadata_dst with skb_valid_dst()

- netfilter: update ip6_route_me_harder to consider L3 domain

- gre: make o_seqno start from 0 in native mode

- gre: switch o_seqno to atomic to prevent races in collect_md mode

Misc:

- add Eric Dumazet to networking maintainers

- dt: dsa: realtek: remove realtek,rtl8367s string

- netfilter: flowtable: Remove the empty file"

* tag 'net-5.18-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (65 commits)
tcp: fix F-RTO may not work correctly when receiving DSACK
Revert "ibmvnic: Add ethtool private flag for driver-defined queue limits"
net: enetc: allow tc-etf offload even with NETIF_F_CSUM_MASK
ixgbe: ensure IPsec VF<->PF compatibility
MAINTAINERS: Update BNXT entry with firmware files
netfilter: nft_socket: only do sk lookups when indev is available
net: fec: add missing of_node_put() in fec_enet_init_stop_mode()
bnx2x: fix napi API usage sequence
tls: Skip tls_append_frag on zero copy size
Add Eric Dumazet to networking maintainers
netfilter: conntrack: fix udp offload timeout sysctl
netfilter: nf_conntrack_tcp: re-init for syn packets only
net: dsa: lantiq_gswip: Don't set GSWIP_MII_CFG_RMII_CLK
net: Use this_cpu_inc() to increment net->core_stats
Bluetooth: hci_sync: Cleanup hci_conn if it cannot be aborted
Bluetooth: hci_event: Fix creating hci_conn object on error status
Bluetooth: hci_event: Fix checking for invalid handle on error status
ice: fix use-after-free when deinitializing mailbox snapshot
ice: wait 5 s for EMP reset after firmware flash
ice: Protect vf_state check by cfg_lock in ice_vc_process_vf_msg()
...

+604 -420
+14 -21
Documentation/devicetree/bindings/net/dsa/realtek.yaml
··· 27 27 The realtek-mdio driver is an MDIO driver and it must be inserted inside 28 28 an MDIO node. 29 29 30 + The compatible string is only used to identify which (silicon) family the 31 + switch belongs to. Roughly speaking, a family is any set of Realtek switches 32 + whose chip identification register(s) have a common location and semantics. 33 + The different models in a given family can be automatically disambiguated by 34 + parsing the chip identification register(s) according to the given family, 35 + avoiding the need for a unique compatible string for each model. 36 + 30 37 properties: 31 38 compatible: 32 39 enum: 33 40 - realtek,rtl8365mb 34 - - realtek,rtl8366 35 41 - realtek,rtl8366rb 36 - - realtek,rtl8366s 37 - - realtek,rtl8367 38 - - realtek,rtl8367b 39 - - realtek,rtl8367rb 40 - - realtek,rtl8367s 41 - - realtek,rtl8368s 42 - - realtek,rtl8369 43 - - realtek,rtl8370 44 42 description: | 45 - realtek,rtl8365mb: 4+1 ports 46 - realtek,rtl8366: 5+1 ports 47 - realtek,rtl8366rb: 5+1 ports 48 - realtek,rtl8366s: 5+1 ports 49 - realtek,rtl8367: 50 - realtek,rtl8367b: 51 - realtek,rtl8367rb: 5+2 ports 52 - realtek,rtl8367s: 5+2 ports 53 - realtek,rtl8368s: 8 ports 54 - realtek,rtl8369: 8+1 ports 55 - realtek,rtl8370: 8+2 ports 43 + realtek,rtl8365mb: 44 + Use with models RTL8363NB, RTL8363NB-VB, RTL8363SC, RTL8363SC-VB, 45 + RTL8364NB, RTL8364NB-VB, RTL8365MB, RTL8366SC, RTL8367RB-VB, RTL8367S, 46 + RTL8367SB, RTL8370MB, RTL8310SR 47 + realtek,rtl8366rb: 48 + Use with models RTL8366RB, RTL8366S 56 49 57 50 mdc-gpios: 58 51 description: GPIO line for the MDC clock line. ··· 328 335 #size-cells = <0>; 329 336 330 337 switch@29 { 331 - compatible = "realtek,rtl8367s"; 338 + compatible = "realtek,rtl8365mb"; 332 339 reg = <29>; 333 340 334 341 reset-gpios = <&gpio2 20 GPIO_ACTIVE_LOW>;
+4
MAINTAINERS
··· 3913 3913 M: Michael Chan <michael.chan@broadcom.com> 3914 3914 L: netdev@vger.kernel.org 3915 3915 S: Supported 3916 + F: drivers/firmware/broadcom/tee_bnxt_fw.c 3916 3917 F: drivers/net/ethernet/broadcom/bnxt/ 3918 + F: include/linux/firmware/broadcom/tee_bnxt_fw.h 3917 3919 3918 3920 BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER 3919 3921 M: Arend van Spriel <aspriel@gmail.com> ··· 13625 13623 13626 13624 NETWORKING DRIVERS 13627 13625 M: "David S. Miller" <davem@davemloft.net> 13626 + M: Eric Dumazet <edumazet@google.com> 13628 13627 M: Jakub Kicinski <kuba@kernel.org> 13629 13628 M: Paolo Abeni <pabeni@redhat.com> 13630 13629 L: netdev@vger.kernel.org ··· 13673 13670 13674 13671 NETWORKING [GENERAL] 13675 13672 M: "David S. Miller" <davem@davemloft.net> 13673 + M: Eric Dumazet <edumazet@google.com> 13676 13674 M: Jakub Kicinski <kuba@kernel.org> 13677 13675 M: Paolo Abeni <pabeni@redhat.com> 13678 13676 L: netdev@vger.kernel.org
-3
drivers/net/dsa/lantiq_gswip.c
··· 1681 1681 break; 1682 1682 case PHY_INTERFACE_MODE_RMII: 1683 1683 miicfg |= GSWIP_MII_CFG_MODE_RMIIM; 1684 - 1685 - /* Configure the RMII clock as output: */ 1686 - miicfg |= GSWIP_MII_CFG_RMII_CLK; 1687 1684 break; 1688 1685 case PHY_INTERFACE_MODE_RGMII: 1689 1686 case PHY_INTERFACE_MODE_RGMII_ID:
+3 -2
drivers/net/dsa/mv88e6xxx/port_hidden.c
··· 40 40 { 41 41 int bit = __bf_shf(MV88E6XXX_PORT_RESERVED_1A_BUSY); 42 42 43 - return mv88e6xxx_wait_bit(chip, MV88E6XXX_PORT_RESERVED_1A_CTRL_PORT, 44 - MV88E6XXX_PORT_RESERVED_1A, bit, 0); 43 + return mv88e6xxx_port_wait_bit(chip, 44 + MV88E6XXX_PORT_RESERVED_1A_CTRL_PORT, 45 + MV88E6XXX_PORT_RESERVED_1A, bit, 0); 45 46 } 46 47 47 48 int mv88e6xxx_port_hidden_read(struct mv88e6xxx_chip *chip, int block, int port,
-1
drivers/net/dsa/realtek/realtek-mdio.c
··· 267 267 #endif 268 268 #if IS_ENABLED(CONFIG_NET_DSA_REALTEK_RTL8365MB) 269 269 { .compatible = "realtek,rtl8365mb", .data = &rtl8365mb_variant, }, 270 - { .compatible = "realtek,rtl8367s", .data = &rtl8365mb_variant, }, 271 270 #endif 272 271 { /* sentinel */ }, 273 272 };
-4
drivers/net/dsa/realtek/realtek-smi.c
··· 551 551 .compatible = "realtek,rtl8365mb", 552 552 .data = &rtl8365mb_variant, 553 553 }, 554 - { 555 - .compatible = "realtek,rtl8367s", 556 - .data = &rtl8365mb_variant, 557 - }, 558 554 #endif 559 555 { /* sentinel */ }, 560 556 };
+5 -4
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
··· 14153 14153 14154 14154 /* Stop Tx */ 14155 14155 bnx2x_tx_disable(bp); 14156 - /* Delete all NAPI objects */ 14157 - bnx2x_del_all_napi(bp); 14158 - if (CNIC_LOADED(bp)) 14159 - bnx2x_del_all_napi_cnic(bp); 14160 14156 netdev_reset_tc(bp->dev); 14161 14157 14162 14158 del_timer_sync(&bp->timer); ··· 14257 14261 bnx2x_drain_tx_queues(bp); 14258 14262 bnx2x_send_unload_req(bp, UNLOAD_RECOVERY); 14259 14263 bnx2x_netif_stop(bp, 1); 14264 + bnx2x_del_all_napi(bp); 14265 + 14266 + if (CNIC_LOADED(bp)) 14267 + bnx2x_del_all_napi_cnic(bp); 14268 + 14260 14269 bnx2x_free_irq(bp); 14261 14270 14262 14271 /* Report UNLOAD_DONE to MCP */
+7
drivers/net/ethernet/broadcom/genet/bcmgenet.c
··· 2035 2035 return skb; 2036 2036 } 2037 2037 2038 + static void bcmgenet_hide_tsb(struct sk_buff *skb) 2039 + { 2040 + __skb_pull(skb, sizeof(struct status_64)); 2041 + } 2042 + 2038 2043 static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev) 2039 2044 { 2040 2045 struct bcmgenet_priv *priv = netdev_priv(dev); ··· 2146 2141 } 2147 2142 2148 2143 GENET_CB(skb)->last_cb = tx_cb_ptr; 2144 + 2145 + bcmgenet_hide_tsb(skb); 2149 2146 skb_tx_timestamp(skb); 2150 2147 2151 2148 /* Decrement total BD count and advance our write pointer */
-4
drivers/net/ethernet/freescale/enetc/enetc_qos.c
··· 297 297 if (tc < 0 || tc >= priv->num_tx_rings) 298 298 return -EINVAL; 299 299 300 - /* Do not support TXSTART and TX CSUM offload simutaniously */ 301 - if (ndev->features & NETIF_F_CSUM_MASK) 302 - return -EBUSY; 303 - 304 300 /* TSD and Qbv are mutually exclusive in hardware */ 305 301 if (enetc_rd(&priv->si->hw, ENETC_QBV_PTGCR_OFFSET) & ENETC_QBV_TGE) 306 302 return -EBUSY;
+1 -1
drivers/net/ethernet/freescale/fec_main.c
··· 3731 3731 ARRAY_SIZE(out_val)); 3732 3732 if (ret) { 3733 3733 dev_dbg(&fep->pdev->dev, "no stop mode property\n"); 3734 - return ret; 3734 + goto out; 3735 3735 } 3736 3736 3737 3737 fep->stop_gpr.gpr = syscon_node_to_regmap(gpr_np);
+5 -1
drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
··· 1065 1065 device_for_each_child_node(dsaf_dev->dev, child) { 1066 1066 ret = fwnode_property_read_u32(child, "reg", &port_id); 1067 1067 if (ret) { 1068 + fwnode_handle_put(child); 1068 1069 dev_err(dsaf_dev->dev, 1069 1070 "get reg fail, ret=%d!\n", ret); 1070 1071 return ret; 1071 1072 } 1072 1073 if (port_id >= max_port_num) { 1074 + fwnode_handle_put(child); 1073 1075 dev_err(dsaf_dev->dev, 1074 1076 "reg(%u) out of range!\n", port_id); 1075 1077 return -EINVAL; 1076 1078 } 1077 1079 mac_cb = devm_kzalloc(dsaf_dev->dev, sizeof(*mac_cb), 1078 1080 GFP_KERNEL); 1079 - if (!mac_cb) 1081 + if (!mac_cb) { 1082 + fwnode_handle_put(child); 1080 1083 return -ENOMEM; 1084 + } 1081 1085 mac_cb->fw_port = child; 1082 1086 mac_cb->mac_id = (u8)port_id; 1083 1087 dsaf_dev->mac_cb[port_id] = mac_cb;
+2 -2
drivers/net/ethernet/hisilicon/hns3/hns3_common/hclge_comm_tqp_stats.c
··· 75 75 ret = hclge_comm_cmd_send(hw, &desc, 1); 76 76 if (ret) { 77 77 dev_err(&hw->cmq.csq.pdev->dev, 78 - "failed to get tqp stat, ret = %d, tx = %u.\n", 78 + "failed to get tqp stat, ret = %d, rx = %u.\n", 79 79 ret, i); 80 80 return ret; 81 81 } ··· 89 89 ret = hclge_comm_cmd_send(hw, &desc, 1); 90 90 if (ret) { 91 91 dev_err(&hw->cmq.csq.pdev->dev, 92 - "failed to get tqp stat, ret = %d, rx = %u.\n", 92 + "failed to get tqp stat, ret = %d, tx = %u.\n", 93 93 ret, i); 94 94 return ret; 95 95 }
+42 -42
drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
··· 562 562 563 563 for (i = 0; i < ring_num; i++) { 564 564 j = 0; 565 - sprintf(result[j++], "%8u", i); 566 - sprintf(result[j++], "%9u", ring->tx_copybreak); 567 - sprintf(result[j++], "%3u", tx_spare->len); 568 - sprintf(result[j++], "%3u", tx_spare->next_to_use); 569 - sprintf(result[j++], "%3u", tx_spare->next_to_clean); 570 - sprintf(result[j++], "%3u", tx_spare->last_to_clean); 565 + sprintf(result[j++], "%u", i); 566 + sprintf(result[j++], "%u", ring->tx_copybreak); 567 + sprintf(result[j++], "%u", tx_spare->len); 568 + sprintf(result[j++], "%u", tx_spare->next_to_use); 569 + sprintf(result[j++], "%u", tx_spare->next_to_clean); 570 + sprintf(result[j++], "%u", tx_spare->last_to_clean); 571 571 sprintf(result[j++], "%pad", &tx_spare->dma); 572 572 hns3_dbg_fill_content(content, sizeof(content), 573 573 tx_spare_info_items, ··· 598 598 u32 base_add_l, base_add_h; 599 599 u32 j = 0; 600 600 601 - sprintf(result[j++], "%8u", index); 601 + sprintf(result[j++], "%u", index); 602 602 603 - sprintf(result[j++], "%6u", readl_relaxed(ring->tqp->io_base + 603 + sprintf(result[j++], "%u", readl_relaxed(ring->tqp->io_base + 604 604 HNS3_RING_RX_RING_BD_NUM_REG)); 605 605 606 - sprintf(result[j++], "%6u", readl_relaxed(ring->tqp->io_base + 606 + sprintf(result[j++], "%u", readl_relaxed(ring->tqp->io_base + 607 607 HNS3_RING_RX_RING_BD_LEN_REG)); 608 608 609 - sprintf(result[j++], "%4u", readl_relaxed(ring->tqp->io_base + 609 + sprintf(result[j++], "%u", readl_relaxed(ring->tqp->io_base + 610 610 HNS3_RING_RX_RING_TAIL_REG)); 611 611 612 - sprintf(result[j++], "%4u", readl_relaxed(ring->tqp->io_base + 612 + sprintf(result[j++], "%u", readl_relaxed(ring->tqp->io_base + 613 613 HNS3_RING_RX_RING_HEAD_REG)); 614 614 615 - sprintf(result[j++], "%6u", readl_relaxed(ring->tqp->io_base + 615 + sprintf(result[j++], "%u", readl_relaxed(ring->tqp->io_base + 616 616 HNS3_RING_RX_RING_FBDNUM_REG)); 617 617 618 - sprintf(result[j++], "%6u", readl_relaxed(ring->tqp->io_base + 618 + sprintf(result[j++], "%u", readl_relaxed(ring->tqp->io_base + 619 619 HNS3_RING_RX_RING_PKTNUM_RECORD_REG)); 620 - sprintf(result[j++], "%9u", ring->rx_copybreak); 620 + sprintf(result[j++], "%u", ring->rx_copybreak); 621 621 622 - sprintf(result[j++], "%7s", readl_relaxed(ring->tqp->io_base + 622 + sprintf(result[j++], "%s", readl_relaxed(ring->tqp->io_base + 623 623 HNS3_RING_EN_REG) ? "on" : "off"); 624 624 625 625 if (hnae3_ae_dev_tqp_txrx_indep_supported(ae_dev)) 626 - sprintf(result[j++], "%10s", readl_relaxed(ring->tqp->io_base + 626 + sprintf(result[j++], "%s", readl_relaxed(ring->tqp->io_base + 627 627 HNS3_RING_RX_EN_REG) ? "on" : "off"); 628 628 else 629 - sprintf(result[j++], "%10s", "NA"); 629 + sprintf(result[j++], "%s", "NA"); 630 630 631 631 base_add_h = readl_relaxed(ring->tqp->io_base + 632 632 HNS3_RING_RX_RING_BASEADDR_H_REG); ··· 700 700 u32 base_add_l, base_add_h; 701 701 u32 j = 0; 702 702 703 - sprintf(result[j++], "%8u", index); 704 - sprintf(result[j++], "%6u", readl_relaxed(ring->tqp->io_base + 703 + sprintf(result[j++], "%u", index); 704 + sprintf(result[j++], "%u", readl_relaxed(ring->tqp->io_base + 705 705 HNS3_RING_TX_RING_BD_NUM_REG)); 706 706 707 - sprintf(result[j++], "%2u", readl_relaxed(ring->tqp->io_base + 707 + sprintf(result[j++], "%u", readl_relaxed(ring->tqp->io_base + 708 708 HNS3_RING_TX_RING_TC_REG)); 709 709 710 - sprintf(result[j++], "%4u", readl_relaxed(ring->tqp->io_base + 710 + sprintf(result[j++], "%u", readl_relaxed(ring->tqp->io_base + 711 711 HNS3_RING_TX_RING_TAIL_REG)); 712 712 713 - sprintf(result[j++], "%4u", readl_relaxed(ring->tqp->io_base + 713 + sprintf(result[j++], "%u", readl_relaxed(ring->tqp->io_base + 714 714 HNS3_RING_TX_RING_HEAD_REG)); 715 715 716 - sprintf(result[j++], "%6u", readl_relaxed(ring->tqp->io_base + 716 + sprintf(result[j++], "%u", readl_relaxed(ring->tqp->io_base + 717 717 HNS3_RING_TX_RING_FBDNUM_REG)); 718 718 719 - sprintf(result[j++], "%6u", readl_relaxed(ring->tqp->io_base + 719 + sprintf(result[j++], "%u", readl_relaxed(ring->tqp->io_base + 720 720 HNS3_RING_TX_RING_OFFSET_REG)); 721 721 722 - sprintf(result[j++], "%6u", readl_relaxed(ring->tqp->io_base + 722 + sprintf(result[j++], "%u", readl_relaxed(ring->tqp->io_base + 723 723 HNS3_RING_TX_RING_PKTNUM_RECORD_REG)); 724 724 725 - sprintf(result[j++], "%7s", readl_relaxed(ring->tqp->io_base + 725 + sprintf(result[j++], "%s", readl_relaxed(ring->tqp->io_base + 726 726 HNS3_RING_EN_REG) ? "on" : "off"); 727 727 728 728 if (hnae3_ae_dev_tqp_txrx_indep_supported(ae_dev)) 729 - sprintf(result[j++], "%10s", readl_relaxed(ring->tqp->io_base + 729 + sprintf(result[j++], "%s", readl_relaxed(ring->tqp->io_base + 730 730 HNS3_RING_TX_EN_REG) ? "on" : "off"); 731 731 else 732 - sprintf(result[j++], "%10s", "NA"); 732 + sprintf(result[j++], "%s", "NA"); 733 733 734 734 base_add_h = readl_relaxed(ring->tqp->io_base + 735 735 HNS3_RING_TX_RING_BASEADDR_H_REG); ··· 848 848 { 849 849 unsigned int j = 0; 850 850 851 - sprintf(result[j++], "%5d", idx); 851 + sprintf(result[j++], "%d", idx); 852 852 sprintf(result[j++], "%#x", le32_to_cpu(desc->rx.l234_info)); 853 - sprintf(result[j++], "%7u", le16_to_cpu(desc->rx.pkt_len)); 854 - sprintf(result[j++], "%4u", le16_to_cpu(desc->rx.size)); 853 + sprintf(result[j++], "%u", le16_to_cpu(desc->rx.pkt_len)); 854 + sprintf(result[j++], "%u", le16_to_cpu(desc->rx.size)); 855 855 sprintf(result[j++], "%#x", le32_to_cpu(desc->rx.rss_hash)); 856 - sprintf(result[j++], "%5u", le16_to_cpu(desc->rx.fd_id)); 857 - sprintf(result[j++], "%8u", le16_to_cpu(desc->rx.vlan_tag)); 858 - sprintf(result[j++], "%15u", le16_to_cpu(desc->rx.o_dm_vlan_id_fb)); 859 - sprintf(result[j++], "%11u", le16_to_cpu(desc->rx.ot_vlan_tag)); 856 + sprintf(result[j++], "%u", le16_to_cpu(desc->rx.fd_id)); 857 + sprintf(result[j++], "%u", le16_to_cpu(desc->rx.vlan_tag)); 858 + sprintf(result[j++], "%u", le16_to_cpu(desc->rx.o_dm_vlan_id_fb)); 859 + sprintf(result[j++], "%u", le16_to_cpu(desc->rx.ot_vlan_tag)); 860 860 sprintf(result[j++], "%#x", le32_to_cpu(desc->rx.bd_base_info)); 861 861 if (test_bit(HNS3_NIC_STATE_RXD_ADV_LAYOUT_ENABLE, &priv->state)) { 862 862 u32 ol_info = le32_to_cpu(desc->rx.ol_info); ··· 930 930 { 931 931 unsigned int j = 0; 932 932 933 - sprintf(result[j++], "%6d", idx); 933 + sprintf(result[j++], "%d", idx); 934 934 sprintf(result[j++], "%#llx", le64_to_cpu(desc->addr)); 935 - sprintf(result[j++], "%5u", le16_to_cpu(desc->tx.vlan_tag)); 936 - sprintf(result[j++], "%5u", le16_to_cpu(desc->tx.send_size)); 935 + sprintf(result[j++], "%u", le16_to_cpu(desc->tx.vlan_tag)); 936 + sprintf(result[j++], "%u", le16_to_cpu(desc->tx.send_size)); 937 937 sprintf(result[j++], "%#x", 938 938 le32_to_cpu(desc->tx.type_cs_vlan_tso_len)); 939 - sprintf(result[j++], "%5u", le16_to_cpu(desc->tx.outer_vlan_tag)); 940 - sprintf(result[j++], "%5u", le16_to_cpu(desc->tx.tv)); 941 - sprintf(result[j++], "%10u", 939 + sprintf(result[j++], "%u", le16_to_cpu(desc->tx.outer_vlan_tag)); 940 + sprintf(result[j++], "%u", le16_to_cpu(desc->tx.tv)); 941 + sprintf(result[j++], "%u", 942 942 le32_to_cpu(desc->tx.ol_type_vlan_len_msec)); 943 943 sprintf(result[j++], "%#x", le32_to_cpu(desc->tx.paylen_ol4cs)); 944 944 sprintf(result[j++], "%#x", le16_to_cpu(desc->tx.bdtp_fe_sc_vld_ra_ri)); 945 - sprintf(result[j++], "%5u", le16_to_cpu(desc->tx.mss_hw_csum)); 945 + sprintf(result[j++], "%u", le16_to_cpu(desc->tx.mss_hw_csum)); 946 946 } 947 947 948 948 static int hns3_dbg_tx_bd_info(struct hns3_dbg_data *d, char *buf, int len)
+9
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
··· 5203 5203 set_bit(HNS3_NIC_STATE_RXD_ADV_LAYOUT_ENABLE, &priv->state); 5204 5204 } 5205 5205 5206 + static void hns3_state_uninit(struct hnae3_handle *handle) 5207 + { 5208 + struct hns3_nic_priv *priv = handle->priv; 5209 + 5210 + clear_bit(HNS3_NIC_STATE_INITED, &priv->state); 5211 + } 5212 + 5206 5213 static int hns3_client_init(struct hnae3_handle *handle) 5207 5214 { 5208 5215 struct pci_dev *pdev = handle->pdev; ··· 5327 5320 return ret; 5328 5321 5329 5322 out_reg_netdev_fail: 5323 + hns3_state_uninit(handle); 5330 5324 hns3_dbg_uninit(handle); 5325 + hns3_client_stop(handle); 5331 5326 out_client_start: 5332 5327 hns3_free_rx_cpu_rmap(netdev); 5333 5328 hns3_nic_uninit_irq(priv);
+20 -11
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
··· 94 94 enum hclge_comm_cmd_status status; 95 95 struct hclge_desc desc; 96 96 97 + if (msg_len > HCLGE_MBX_MAX_MSG_SIZE) { 98 + dev_err(&hdev->pdev->dev, 99 + "msg data length(=%u) exceeds maximum(=%u)\n", 100 + msg_len, HCLGE_MBX_MAX_MSG_SIZE); 101 + return -EMSGSIZE; 102 + } 103 + 97 104 resp_pf_to_vf = (struct hclge_mbx_pf_to_vf_cmd *)desc.data; 98 105 99 106 hclge_cmd_setup_basic_desc(&desc, HCLGEVF_OPC_MBX_PF_TO_VF, false); ··· 183 176 ring_num = req->msg.ring_num; 184 177 185 178 if (ring_num > HCLGE_MBX_MAX_RING_CHAIN_PARAM_NUM) 186 - return -ENOMEM; 179 + return -EINVAL; 187 180 188 181 for (i = 0; i < ring_num; i++) { 189 182 if (req->msg.param[i].tqp_index >= vport->nic.kinfo.rss_size) { ··· 594 587 return hclge_set_vport_mtu(vport, mtu); 595 588 } 596 589 597 - static void hclge_get_queue_id_in_pf(struct hclge_vport *vport, 598 - struct hclge_mbx_vf_to_pf_cmd *mbx_req, 599 - struct hclge_respond_to_vf_msg *resp_msg) 590 + static int hclge_get_queue_id_in_pf(struct hclge_vport *vport, 591 + struct hclge_mbx_vf_to_pf_cmd *mbx_req, 592 + struct hclge_respond_to_vf_msg *resp_msg) 600 593 { 601 594 struct hnae3_handle *handle = &vport->nic; 602 595 struct hclge_dev *hdev = vport->back; ··· 606 599 if (queue_id >= handle->kinfo.num_tqps) { 607 600 dev_err(&hdev->pdev->dev, "Invalid queue id(%u) from VF %u\n", 608 601 queue_id, mbx_req->mbx_src_vfid); 609 - return; 602 + return -EINVAL; 610 603 } 611 604 612 605 qid_in_pf = hclge_covert_handle_qid_global(&vport->nic, queue_id); 613 606 memcpy(resp_msg->data, &qid_in_pf, sizeof(qid_in_pf)); 614 607 resp_msg->len = sizeof(qid_in_pf); 608 + return 0; 615 609 } 616 610 617 - static void hclge_get_rss_key(struct hclge_vport *vport, 618 - struct hclge_mbx_vf_to_pf_cmd *mbx_req, 619 - struct hclge_respond_to_vf_msg *resp_msg) 611 + static int hclge_get_rss_key(struct hclge_vport *vport, 612 + struct hclge_mbx_vf_to_pf_cmd *mbx_req, 613 + struct hclge_respond_to_vf_msg *resp_msg) 620 614 { 621 615 #define HCLGE_RSS_MBX_RESP_LEN 8 622 616 struct hclge_dev *hdev = vport->back; ··· 635 627 dev_warn(&hdev->pdev->dev, 636 628 "failed to get the rss hash key, the index(%u) invalid !\n", 637 629 index); 638 - return; 630 + return -EINVAL; 639 631 } 640 632 641 633 memcpy(resp_msg->data, 642 634 &rss_cfg->rss_hash_key[index * HCLGE_RSS_MBX_RESP_LEN], 643 635 HCLGE_RSS_MBX_RESP_LEN); 644 636 resp_msg->len = HCLGE_RSS_MBX_RESP_LEN; 637 + return 0; 645 638 } 646 639 647 640 static void hclge_link_fail_parse(struct hclge_dev *hdev, u8 link_fail_code) ··· 818 809 "VF fail(%d) to set mtu\n", ret); 819 810 break; 820 811 case HCLGE_MBX_GET_QID_IN_PF: 821 - hclge_get_queue_id_in_pf(vport, req, &resp_msg); 812 + ret = hclge_get_queue_id_in_pf(vport, req, &resp_msg); 822 813 break; 823 814 case HCLGE_MBX_GET_RSS_KEY: 824 - hclge_get_rss_key(vport, req, &resp_msg); 815 + ret = hclge_get_rss_key(vport, req, &resp_msg); 825 816 break; 826 817 case HCLGE_MBX_GET_LINK_MODE: 827 818 hclge_get_link_mode(vport, req);
+41 -100
drivers/net/ethernet/ibm/ibmvnic.c
··· 3210 3210 { 3211 3211 struct ibmvnic_adapter *adapter = netdev_priv(netdev); 3212 3212 3213 - if (adapter->priv_flags & IBMVNIC_USE_SERVER_MAXES) { 3214 - ring->rx_max_pending = adapter->max_rx_add_entries_per_subcrq; 3215 - ring->tx_max_pending = adapter->max_tx_entries_per_subcrq; 3216 - } else { 3217 - ring->rx_max_pending = IBMVNIC_MAX_QUEUE_SZ; 3218 - ring->tx_max_pending = IBMVNIC_MAX_QUEUE_SZ; 3219 - } 3213 + ring->rx_max_pending = adapter->max_rx_add_entries_per_subcrq; 3214 + ring->tx_max_pending = adapter->max_tx_entries_per_subcrq; 3220 3215 ring->rx_mini_max_pending = 0; 3221 3216 ring->rx_jumbo_max_pending = 0; 3222 3217 ring->rx_pending = adapter->req_rx_add_entries_per_subcrq; ··· 3226 3231 struct netlink_ext_ack *extack) 3227 3232 { 3228 3233 struct ibmvnic_adapter *adapter = netdev_priv(netdev); 3229 - int ret; 3230 3234 3231 - ret = 0; 3235 + if (ring->rx_pending > adapter->max_rx_add_entries_per_subcrq || 3236 + ring->tx_pending > adapter->max_tx_entries_per_subcrq) { 3237 + netdev_err(netdev, "Invalid request.\n"); 3238 + netdev_err(netdev, "Max tx buffers = %llu\n", 3239 + adapter->max_rx_add_entries_per_subcrq); 3240 + netdev_err(netdev, "Max rx buffers = %llu\n", 3241 + adapter->max_tx_entries_per_subcrq); 3242 + return -EINVAL; 3243 + } 3244 + 3232 3245 adapter->desired.rx_entries = ring->rx_pending; 3233 3246 adapter->desired.tx_entries = ring->tx_pending; 3234 3247 3235 - ret = wait_for_reset(adapter); 3236 - 3237 - if (!ret && 3238 - (adapter->req_rx_add_entries_per_subcrq != ring->rx_pending || 3239 - adapter->req_tx_entries_per_subcrq != ring->tx_pending)) 3240 - netdev_info(netdev, 3241 - "Could not match full ringsize request. Requested: RX %d, TX %d; Allowed: RX %llu, TX %llu\n", 3242 - ring->rx_pending, ring->tx_pending, 3243 - adapter->req_rx_add_entries_per_subcrq, 3244 - adapter->req_tx_entries_per_subcrq); 3245 - return ret; 3248 + return wait_for_reset(adapter); 3246 3249 } 3247 3250 3248 3251 static void ibmvnic_get_channels(struct net_device *netdev, ··· 3248 3255 { 3249 3256 struct ibmvnic_adapter *adapter = netdev_priv(netdev); 3250 3257 3251 - if (adapter->priv_flags & IBMVNIC_USE_SERVER_MAXES) { 3252 - channels->max_rx = adapter->max_rx_queues; 3253 - channels->max_tx = adapter->max_tx_queues; 3254 - } else { 3255 - channels->max_rx = IBMVNIC_MAX_QUEUES; 3256 - channels->max_tx = IBMVNIC_MAX_QUEUES; 3257 - } 3258 - 3258 + channels->max_rx = adapter->max_rx_queues; 3259 + channels->max_tx = adapter->max_tx_queues; 3259 3260 channels->max_other = 0; 3260 3261 channels->max_combined = 0; 3261 3262 channels->rx_count = adapter->req_rx_queues; ··· 3262 3275 struct ethtool_channels *channels) 3263 3276 { 3264 3277 struct ibmvnic_adapter *adapter = netdev_priv(netdev); 3265 - int ret; 3266 3278 3267 - ret = 0; 3268 3279 adapter->desired.rx_queues = channels->rx_count; 3269 3280 adapter->desired.tx_queues = channels->tx_count; 3270 3281 3271 - ret = wait_for_reset(adapter); 3272 - 3273 - if (!ret && 3274 - (adapter->req_rx_queues != channels->rx_count || 3275 - adapter->req_tx_queues != channels->tx_count)) 3276 - netdev_info(netdev, 3277 - "Could not match full channels request. Requested: RX %d, TX %d; Allowed: RX %llu, TX %llu\n", 3278 - channels->rx_count, channels->tx_count, 3279 - adapter->req_rx_queues, adapter->req_tx_queues); 3280 - return ret; 3282 + return wait_for_reset(adapter); 3281 3283 } 3282 3284 3283 3285 static void ibmvnic_get_strings(struct net_device *dev, u32 stringset, u8 *data) ··· 3274 3298 struct ibmvnic_adapter *adapter = netdev_priv(dev); 3275 3299 int i; 3276 3300 3277 - switch (stringset) { 3278 - case ETH_SS_STATS: 3279 - for (i = 0; i < ARRAY_SIZE(ibmvnic_stats); 3280 - i++, data += ETH_GSTRING_LEN) 3281 - memcpy(data, ibmvnic_stats[i].name, ETH_GSTRING_LEN); 3282 - 3283 - for (i = 0; i < adapter->req_tx_queues; i++) { 3284 - snprintf(data, ETH_GSTRING_LEN, "tx%d_packets", i); 3285 - data += ETH_GSTRING_LEN; 3286 - 3287 - snprintf(data, ETH_GSTRING_LEN, "tx%d_bytes", i); 3288 - data += ETH_GSTRING_LEN; 3289 - 3290 - snprintf(data, ETH_GSTRING_LEN, 3291 - "tx%d_dropped_packets", i); 3292 - data += ETH_GSTRING_LEN; 3293 - } 3294 - 3295 - for (i = 0; i < adapter->req_rx_queues; i++) { 3296 - snprintf(data, ETH_GSTRING_LEN, "rx%d_packets", i); 3297 - data += ETH_GSTRING_LEN; 3298 - 3299 - snprintf(data, ETH_GSTRING_LEN, "rx%d_bytes", i); 3300 - data += ETH_GSTRING_LEN; 3301 - 3302 - snprintf(data, ETH_GSTRING_LEN, "rx%d_interrupts", i); 3303 - data += ETH_GSTRING_LEN; 3304 - } 3305 - break; 3306 - 3307 - case ETH_SS_PRIV_FLAGS: 3308 - for (i = 0; i < ARRAY_SIZE(ibmvnic_priv_flags); i++) 3309 - strcpy(data + i * ETH_GSTRING_LEN, 3310 - ibmvnic_priv_flags[i]); 3311 - break; 3312 - default: 3301 + if (stringset != ETH_SS_STATS) 3313 3302 return; 3303 + 3304 + for (i = 0; i < ARRAY_SIZE(ibmvnic_stats); i++, data += ETH_GSTRING_LEN) 3305 + memcpy(data, ibmvnic_stats[i].name, ETH_GSTRING_LEN); 3306 + 3307 + for (i = 0; i < adapter->req_tx_queues; i++) { 3308 + snprintf(data, ETH_GSTRING_LEN, "tx%d_packets", i); 3309 + data += ETH_GSTRING_LEN; 3310 + 3311 + snprintf(data, ETH_GSTRING_LEN, "tx%d_bytes", i); 3312 + data += ETH_GSTRING_LEN; 3313 + 3314 + snprintf(data, ETH_GSTRING_LEN, "tx%d_dropped_packets", i); 3315 + data += ETH_GSTRING_LEN; 3316 + } 3317 + 3318 + for (i = 0; i < adapter->req_rx_queues; i++) { 3319 + snprintf(data, ETH_GSTRING_LEN, "rx%d_packets", i); 3320 + data += ETH_GSTRING_LEN; 3321 + 3322 + snprintf(data, ETH_GSTRING_LEN, "rx%d_bytes", i); 3323 + data += ETH_GSTRING_LEN; 3324 + 3325 + snprintf(data, ETH_GSTRING_LEN, "rx%d_interrupts", i); 3326 + data += ETH_GSTRING_LEN; 3314 3327 } 3315 3328 } 3316 3329 ··· 3312 3347 return ARRAY_SIZE(ibmvnic_stats) + 3313 3348 adapter->req_tx_queues * NUM_TX_STATS + 3314 3349 adapter->req_rx_queues * NUM_RX_STATS; 3315 - case ETH_SS_PRIV_FLAGS: 3316 - return ARRAY_SIZE(ibmvnic_priv_flags); 3317 3350 default: 3318 3351 return -EOPNOTSUPP; 3319 3352 } ··· 3364 3401 } 3365 3402 } 3366 3403 3367 - static u32 ibmvnic_get_priv_flags(struct net_device *netdev) 3368 - { 3369 - struct ibmvnic_adapter *adapter = netdev_priv(netdev); 3370 - 3371 - return adapter->priv_flags; 3372 - } 3373 - 3374 - static int ibmvnic_set_priv_flags(struct net_device *netdev, u32 flags) 3375 - { 3376 - struct ibmvnic_adapter *adapter = netdev_priv(netdev); 3377 - bool which_maxes = !!(flags & IBMVNIC_USE_SERVER_MAXES); 3378 - 3379 - if (which_maxes) 3380 - adapter->priv_flags |= IBMVNIC_USE_SERVER_MAXES; 3381 - else 3382 - adapter->priv_flags &= ~IBMVNIC_USE_SERVER_MAXES; 3383 - 3384 - return 0; 3385 - } 3386 - 3387 3404 static const struct ethtool_ops ibmvnic_ethtool_ops = { 3388 3405 .get_drvinfo = ibmvnic_get_drvinfo, 3389 3406 .get_msglevel = ibmvnic_get_msglevel, ··· 3377 3434 .get_sset_count = ibmvnic_get_sset_count, 3378 3435 .get_ethtool_stats = ibmvnic_get_ethtool_stats, 3379 3436 .get_link_ksettings = ibmvnic_get_link_ksettings, 3380 - .get_priv_flags = ibmvnic_get_priv_flags, 3381 - .set_priv_flags = ibmvnic_set_priv_flags, 3382 3437 }; 3383 3438 3384 3439 /* Routines for managing CRQs/sCRQs */
-6
drivers/net/ethernet/ibm/ibmvnic.h
··· 41 41 42 42 #define IBMVNIC_RESET_DELAY 100 43 43 44 - static const char ibmvnic_priv_flags[][ETH_GSTRING_LEN] = { 45 - #define IBMVNIC_USE_SERVER_MAXES 0x1 46 - "use-server-maxes" 47 - }; 48 - 49 44 struct ibmvnic_login_buffer { 50 45 __be32 len; 51 46 __be32 version; ··· 878 883 struct ibmvnic_control_ip_offload_buffer ip_offload_ctrl; 879 884 dma_addr_t ip_offload_ctrl_tok; 880 885 u32 msg_enable; 881 - u32 priv_flags; 882 886 883 887 /* Vital Product Data (VPD) */ 884 888 struct ibmvnic_vpd *vpd;
+3
drivers/net/ethernet/intel/ice/ice_main.c
··· 6929 6929 6930 6930 dev_dbg(dev, "rebuilding PF after reset_type=%d\n", reset_type); 6931 6931 6932 + #define ICE_EMP_RESET_SLEEP_MS 5000 6932 6933 if (reset_type == ICE_RESET_EMPR) { 6933 6934 /* If an EMP reset has occurred, any previously pending flash 6934 6935 * update will have completed. We no longer know whether or 6935 6936 * not the NVM update EMP reset is restricted. 6936 6937 */ 6937 6938 pf->fw_emp_reset_disabled = false; 6939 + 6940 + msleep(ICE_EMP_RESET_SLEEP_MS); 6938 6941 } 6939 6942 6940 6943 err = ice_init_all_ctrlq(hw);
+1 -1
drivers/net/ethernet/intel/ice/ice_sriov.c
··· 1046 1046 1047 1047 if (!num_vfs) { 1048 1048 if (!pci_vfs_assigned(pdev)) { 1049 - ice_mbx_deinit_snapshot(&pf->hw); 1050 1049 ice_free_vfs(pf); 1050 + ice_mbx_deinit_snapshot(&pf->hw); 1051 1051 if (pf->lag) 1052 1052 ice_enable_lag(pf->lag); 1053 1053 return 0;
+9 -18
drivers/net/ethernet/intel/ice/ice_virtchnl.c
··· 3625 3625 return; 3626 3626 } 3627 3627 3628 + mutex_lock(&vf->cfg_lock); 3629 + 3628 3630 /* Check if VF is disabled. */ 3629 3631 if (test_bit(ICE_VF_STATE_DIS, vf->vf_states)) { 3630 3632 err = -EPERM; ··· 3644 3642 err = -EINVAL; 3645 3643 } 3646 3644 3647 - if (!ice_vc_is_opcode_allowed(vf, v_opcode)) { 3648 - ice_vc_send_msg_to_vf(vf, v_opcode, 3649 - VIRTCHNL_STATUS_ERR_NOT_SUPPORTED, NULL, 3650 - 0); 3651 - ice_put_vf(vf); 3652 - return; 3653 - } 3654 - 3655 3645 error_handler: 3656 3646 if (err) { 3657 3647 ice_vc_send_msg_to_vf(vf, v_opcode, VIRTCHNL_STATUS_ERR_PARAM, 3658 3648 NULL, 0); 3659 3649 dev_err(dev, "Invalid message from VF %d, opcode %d, len %d, error %d\n", 3660 3650 vf_id, v_opcode, msglen, err); 3661 - ice_put_vf(vf); 3662 - return; 3651 + goto finish; 3663 3652 } 3664 3653 3665 - /* VF is being configured in another context that triggers a VFR, so no 3666 - * need to process this message 3667 - */ 3668 - if (!mutex_trylock(&vf->cfg_lock)) { 3669 - dev_info(dev, "VF %u is being configured in another context that will trigger a VFR, so there is no need to handle this message\n", 3670 - vf->vf_id); 3671 - ice_put_vf(vf); 3672 - return; 3654 + if (!ice_vc_is_opcode_allowed(vf, v_opcode)) { 3655 + ice_vc_send_msg_to_vf(vf, v_opcode, 3656 + VIRTCHNL_STATUS_ERR_NOT_SUPPORTED, NULL, 3657 + 0); 3658 + goto finish; 3673 3659 } 3674 3660 3675 3661 switch (v_opcode) { ··· 3770 3780 vf_id, v_opcode, err); 3771 3781 } 3772 3782 3783 + finish: 3773 3784 mutex_unlock(&vf->cfg_lock); 3774 3785 ice_put_vf(vf); 3775 3786 }
+2 -1
drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
··· 903 903 /* Tx IPsec offload doesn't seem to work on this 904 904 * device, so block these requests for now. 905 905 */ 906 - if (!(sam->flags & XFRM_OFFLOAD_INBOUND)) { 906 + sam->flags = sam->flags & ~XFRM_OFFLOAD_IPV6; 907 + if (sam->flags != XFRM_OFFLOAD_INBOUND) { 907 908 err = -EOPNOTSUPP; 908 909 goto err_out; 909 910 }
+2 -2
drivers/net/ethernet/microchip/lan966x/lan966x_mac.c
··· 346 346 347 347 lan966x_mac_process_raw_entry(&raw_entries[column], 348 348 mac, &vid, &dest_idx); 349 - if (WARN_ON(dest_idx > lan966x->num_phys_ports)) 349 + if (WARN_ON(dest_idx >= lan966x->num_phys_ports)) 350 350 continue; 351 351 352 352 /* If the entry in SW is found, then there is nothing ··· 393 393 394 394 lan966x_mac_process_raw_entry(&raw_entries[column], 395 395 mac, &vid, &dest_idx); 396 - if (WARN_ON(dest_idx > lan966x->num_phys_ports)) 396 + if (WARN_ON(dest_idx >= lan966x->num_phys_ports)) 397 397 continue; 398 398 399 399 mac_entry = lan966x_mac_alloc_entry(mac, vid, dest_idx);
+12 -2
drivers/net/ethernet/mscc/ocelot.c
··· 551 551 struct ocelot_vcap_block *block = &ocelot->block[VCAP_IS1]; 552 552 struct ocelot_port *ocelot_port = ocelot->ports[port]; 553 553 struct ocelot_vcap_filter *filter; 554 - int err; 554 + int err = 0; 555 555 u32 val; 556 556 557 557 list_for_each_entry(filter, &block->rules, list) { ··· 570 570 if (vlan_aware) 571 571 err = ocelot_del_vlan_unaware_pvid(ocelot, port, 572 572 ocelot_port->bridge); 573 - else 573 + else if (ocelot_port->bridge) 574 574 err = ocelot_add_vlan_unaware_pvid(ocelot, port, 575 575 ocelot_port->bridge); 576 576 if (err) ··· 629 629 { 630 630 int err; 631 631 632 + /* Ignore VID 0 added to our RX filter by the 8021q module, since 633 + * that collides with OCELOT_STANDALONE_PVID and changes it from 634 + * egress-untagged to egress-tagged. 635 + */ 636 + if (!vid) 637 + return 0; 638 + 632 639 err = ocelot_vlan_member_add(ocelot, port, vid, untagged); 633 640 if (err) 634 641 return err; ··· 657 650 struct ocelot_port *ocelot_port = ocelot->ports[port]; 658 651 bool del_pvid = false; 659 652 int err; 653 + 654 + if (!vid) 655 + return 0; 660 656 661 657 if (ocelot_port->pvid_vlan && ocelot_port->pvid_vlan->vid == vid) 662 658 del_pvid = true;
+7 -5
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
··· 65 65 struct phy_device *phy_dev = ndev->phydev; 66 66 u32 val; 67 67 68 - writew(SGMII_ADAPTER_DISABLE, 69 - sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG); 68 + if (sgmii_adapter_base) 69 + writew(SGMII_ADAPTER_DISABLE, 70 + sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG); 70 71 71 72 if (splitter_base) { 72 73 val = readl(splitter_base + EMAC_SPLITTER_CTRL_REG); ··· 89 88 writel(val, splitter_base + EMAC_SPLITTER_CTRL_REG); 90 89 } 91 90 92 - writew(SGMII_ADAPTER_ENABLE, 93 - sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG); 94 - if (phy_dev) 91 + if (phy_dev && sgmii_adapter_base) { 92 + writew(SGMII_ADAPTER_ENABLE, 93 + sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG); 95 94 tse_pcs_fix_mac_speed(&dwmac->pcs, phy_dev, speed); 95 + } 96 96 } 97 97 98 98 static int socfpga_dwmac_parse_data(struct socfpga_dwmac *dwmac, struct device *dev)
+1 -1
drivers/net/phy/marvell10g.c
··· 880 880 881 881 cssr1 = phy_read_mmd(phydev, MDIO_MMD_PCS, MV_PCS_CSSR1); 882 882 if (cssr1 < 0) 883 - return val; 883 + return cssr1; 884 884 885 885 /* If the link settings are not resolved, mark the link down */ 886 886 if (!(cssr1 & MV_PCS_CSSR1_RESOLVED)) {
+19 -1
drivers/net/virtio_net.c
··· 1005 1005 * xdp.data_meta were adjusted 1006 1006 */ 1007 1007 len = xdp.data_end - xdp.data + vi->hdr_len + metasize; 1008 + 1009 + /* recalculate headroom if xdp.data or xdp_data_meta 1010 + * were adjusted, note that offset should always point 1011 + * to the start of the reserved bytes for virtio_net 1012 + * header which are followed by xdp.data, that means 1013 + * that offset is equal to the headroom (when buf is 1014 + * starting at the beginning of the page, otherwise 1015 + * there is a base offset inside the page) but it's used 1016 + * with a different starting point (buf start) than 1017 + * xdp.data (buf start + vnet hdr size). If xdp.data or 1018 + * data_meta were adjusted by the xdp prog then the 1019 + * headroom size has changed and so has the offset, we 1020 + * can use data_hard_start, which points at buf start + 1021 + * vnet hdr size, to calculate the new headroom and use 1022 + * it later to compute buf start in page_to_skb() 1023 + */ 1024 + headroom = xdp.data - xdp.data_hard_start - metasize; 1025 + 1008 1026 /* We can only create skb based on xdp_page. */ 1009 1027 if (unlikely(xdp_page != page)) { 1010 1028 rcu_read_unlock(); ··· 1030 1012 head_skb = page_to_skb(vi, rq, xdp_page, offset, 1031 1013 len, PAGE_SIZE, false, 1032 1014 metasize, 1033 - VIRTIO_XDP_HEADROOM); 1015 + headroom); 1034 1016 return head_skb; 1035 1017 } 1036 1018 break;
+1 -1
drivers/net/wan/cosa.c
··· 349 349 } 350 350 } else { 351 351 cosa_major = register_chrdev(0, "cosa", &cosa_fops); 352 - if (!cosa_major) { 352 + if (cosa_major < 0) { 353 353 pr_warn("unable to register chardev\n"); 354 354 err = -EIO; 355 355 goto out;
+2 -1
drivers/net/wireguard/device.c
··· 19 19 #include <linux/if_arp.h> 20 20 #include <linux/icmp.h> 21 21 #include <linux/suspend.h> 22 + #include <net/dst_metadata.h> 22 23 #include <net/icmp.h> 23 24 #include <net/rtnetlink.h> 24 25 #include <net/ip_tunnels.h> ··· 168 167 goto err_peer; 169 168 } 170 169 171 - mtu = skb_dst(skb) ? dst_mtu(skb_dst(skb)) : dev->mtu; 170 + mtu = skb_valid_dst(skb) ? dst_mtu(skb_dst(skb)) : dev->mtu; 172 171 173 172 __skb_queue_head_init(&packets); 174 173 if (!skb_is_gso(skb)) {
+9 -12
include/linux/netdevice.h
··· 199 199 * Try to fit them in a single cache line, for dev_get_stats() sake. 200 200 */ 201 201 struct net_device_core_stats { 202 - local_t rx_dropped; 203 - local_t tx_dropped; 204 - local_t rx_nohandler; 205 - } __aligned(4 * sizeof(local_t)); 202 + unsigned long rx_dropped; 203 + unsigned long tx_dropped; 204 + unsigned long rx_nohandler; 205 + } __aligned(4 * sizeof(unsigned long)); 206 206 207 207 #include <linux/cache.h> 208 208 #include <linux/skbuff.h> ··· 3843 3843 return false; 3844 3844 } 3845 3845 3846 - struct net_device_core_stats *netdev_core_stats_alloc(struct net_device *dev); 3846 + struct net_device_core_stats __percpu *netdev_core_stats_alloc(struct net_device *dev); 3847 3847 3848 - static inline struct net_device_core_stats *dev_core_stats(struct net_device *dev) 3848 + static inline struct net_device_core_stats __percpu *dev_core_stats(struct net_device *dev) 3849 3849 { 3850 3850 /* This READ_ONCE() pairs with the write in netdev_core_stats_alloc() */ 3851 3851 struct net_device_core_stats __percpu *p = READ_ONCE(dev->core_stats); 3852 3852 3853 3853 if (likely(p)) 3854 - return this_cpu_ptr(p); 3854 + return p; 3855 3855 3856 3856 return netdev_core_stats_alloc(dev); 3857 3857 } ··· 3859 3859 #define DEV_CORE_STATS_INC(FIELD) \ 3860 3860 static inline void dev_core_stats_##FIELD##_inc(struct net_device *dev) \ 3861 3861 { \ 3862 - struct net_device_core_stats *p; \ 3862 + struct net_device_core_stats __percpu *p; \ 3863 3863 \ 3864 - preempt_disable(); \ 3865 3864 p = dev_core_stats(dev); \ 3866 - \ 3867 3865 if (p) \ 3868 - local_inc(&p->FIELD); \ 3869 - preempt_enable(); \ 3866 + this_cpu_inc(p->FIELD); \ 3870 3867 } 3871 3868 DEV_CORE_STATS_INC(rx_dropped) 3872 3869 DEV_CORE_STATS_INC(tx_dropped)
+1
include/net/bluetooth/hci.h
··· 578 578 #define HCI_ERROR_CONNECTION_TIMEOUT 0x08 579 579 #define HCI_ERROR_REJ_LIMITED_RESOURCES 0x0d 580 580 #define HCI_ERROR_REJ_BAD_ADDR 0x0f 581 + #define HCI_ERROR_INVALID_PARAMETERS 0x12 581 582 #define HCI_ERROR_REMOTE_USER_TERM 0x13 582 583 #define HCI_ERROR_REMOTE_LOW_RESOURCES 0x14 583 584 #define HCI_ERROR_REMOTE_POWER_OFF 0x15
+1 -1
include/net/bluetooth/hci_core.h
··· 1156 1156 1157 1157 void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active); 1158 1158 1159 - void hci_le_conn_failed(struct hci_conn *conn, u8 status); 1159 + void hci_conn_failed(struct hci_conn *conn, u8 status); 1160 1160 1161 1161 /* 1162 1162 * hci_conn_get() and hci_conn_put() are used to control the life-time of an
+1 -1
include/net/ip6_tunnel.h
··· 58 58 59 59 /* These fields used only by GRE */ 60 60 __u32 i_seqno; /* The last seen seqno */ 61 - __u32 o_seqno; /* The last output seqno */ 61 + atomic_t o_seqno; /* The last output seqno */ 62 62 int hlen; /* tun_hlen + encap_hlen */ 63 63 int tun_hlen; /* Precalculated header length */ 64 64 int encap_hlen; /* Encap header length (FOU,GUE) */
+1 -1
include/net/ip_tunnels.h
··· 116 116 117 117 /* These four fields used only by GRE */ 118 118 u32 i_seqno; /* The last seen seqno */ 119 - u32 o_seqno; /* The last output seqno */ 119 + atomic_t o_seqno; /* The last output seqno */ 120 120 int tun_hlen; /* Precalculated header length */ 121 121 122 122 /* These four fields used only by ERSPAN */
+8
include/net/tcp.h
··· 480 480 u32 cookie); 481 481 struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb); 482 482 struct request_sock *cookie_tcp_reqsk_alloc(const struct request_sock_ops *ops, 483 + const struct tcp_request_sock_ops *af_ops, 483 484 struct sock *sk, struct sk_buff *skb); 484 485 #ifdef CONFIG_SYN_COOKIES 485 486 ··· 621 620 void tcp_reset(struct sock *sk, struct sk_buff *skb); 622 621 void tcp_skb_mark_lost_uncond_verify(struct tcp_sock *tp, struct sk_buff *skb); 623 622 void tcp_fin(struct sock *sk); 623 + void tcp_check_space(struct sock *sk); 624 624 625 625 /* tcp_timer.c */ 626 626 void tcp_init_xmit_timers(struct sock *); ··· 1044 1042 int losses; /* number of packets marked lost upon ACK */ 1045 1043 u32 acked_sacked; /* number of packets newly (S)ACKed upon ACK */ 1046 1044 u32 prior_in_flight; /* in flight before this ACK */ 1045 + u32 last_end_seq; /* end_seq of most recently ACKed packet */ 1047 1046 bool is_app_limited; /* is sample from packet with bubble in pipe? */ 1048 1047 bool is_retrans; /* is sample from retransmission? */ 1049 1048 bool is_ack_delayed; /* is this (likely) a delayed ACK? */ ··· 1166 1163 void tcp_rate_gen(struct sock *sk, u32 delivered, u32 lost, 1167 1164 bool is_sack_reneg, struct rate_sample *rs); 1168 1165 void tcp_rate_check_app_limited(struct sock *sk); 1166 + 1167 + static inline bool tcp_skb_sent_after(u64 t1, u64 t2, u32 seq1, u32 seq2) 1168 + { 1169 + return t1 > t2 || (t1 == t2 && after(seq1, seq2)); 1170 + } 1169 1171 1170 1172 /* These functions determine how the current flow behaves in respect of SACK 1171 1173 * handling. SACK is negotiated with the peer, and therefore it can vary
+1
include/net/xsk_buff_pool.h
··· 97 97 u16 queue_id, u16 flags); 98 98 int xp_assign_dev_shared(struct xsk_buff_pool *pool, struct xdp_umem *umem, 99 99 struct net_device *dev, u16 queue_id); 100 + int xp_alloc_tx_descs(struct xsk_buff_pool *pool, struct xdp_sock *xs); 100 101 void xp_destroy(struct xsk_buff_pool *pool); 101 102 void xp_get_pool(struct xsk_buff_pool *pool); 102 103 bool xp_put_pool(struct xsk_buff_pool *pool);
+1 -1
kernel/kprobes.c
··· 2126 2126 struct kprobe_ctlblk *kcb; 2127 2127 2128 2128 /* The data must NOT be null. This means rethook data structure is broken. */ 2129 - if (WARN_ON_ONCE(!data)) 2129 + if (WARN_ON_ONCE(!data) || !rp->handler) 2130 2130 return; 2131 2131 2132 2132 __this_cpu_write(current_kprobe, &rp->kp);
+24 -8
net/bluetooth/hci_conn.c
··· 670 670 /* Disable LE Advertising */ 671 671 le_disable_advertising(hdev); 672 672 hci_dev_lock(hdev); 673 - hci_le_conn_failed(conn, HCI_ERROR_ADVERTISING_TIMEOUT); 673 + hci_conn_failed(conn, HCI_ERROR_ADVERTISING_TIMEOUT); 674 674 hci_dev_unlock(hdev); 675 675 return; 676 676 } ··· 873 873 EXPORT_SYMBOL(hci_get_route); 874 874 875 875 /* This function requires the caller holds hdev->lock */ 876 - void hci_le_conn_failed(struct hci_conn *conn, u8 status) 876 + static void hci_le_conn_failed(struct hci_conn *conn, u8 status) 877 877 { 878 878 struct hci_dev *hdev = conn->hdev; 879 879 struct hci_conn_params *params; ··· 886 886 params->conn = NULL; 887 887 } 888 888 889 - conn->state = BT_CLOSED; 890 - 891 889 /* If the status indicates successful cancellation of 892 890 * the attempt (i.e. Unknown Connection Id) there's no point of 893 891 * notifying failure since we'll go back to keep trying to ··· 897 899 mgmt_connect_failed(hdev, &conn->dst, conn->type, 898 900 conn->dst_type, status); 899 901 900 - hci_connect_cfm(conn, status); 901 - 902 - hci_conn_del(conn); 903 - 904 902 /* Since we may have temporarily stopped the background scanning in 905 903 * favor of connection establishment, we should restart it. 906 904 */ ··· 906 912 * attempt as a peripheral. 907 913 */ 908 914 hci_enable_advertising(hdev); 915 + } 916 + 917 + /* This function requires the caller holds hdev->lock */ 918 + void hci_conn_failed(struct hci_conn *conn, u8 status) 919 + { 920 + struct hci_dev *hdev = conn->hdev; 921 + 922 + bt_dev_dbg(hdev, "status 0x%2.2x", status); 923 + 924 + switch (conn->type) { 925 + case LE_LINK: 926 + hci_le_conn_failed(conn, status); 927 + break; 928 + case ACL_LINK: 929 + mgmt_connect_failed(hdev, &conn->dst, conn->type, 930 + conn->dst_type, status); 931 + break; 932 + } 933 + 934 + conn->state = BT_CLOSED; 935 + hci_connect_cfm(conn, status); 936 + hci_conn_del(conn); 909 937 } 910 938 911 939 static void create_le_conn_complete(struct hci_dev *hdev, void *data, int err)
+47 -33
net/bluetooth/hci_event.c
··· 2834 2834 bt_dev_dbg(hdev, "status 0x%2.2x", status); 2835 2835 2836 2836 /* All connection failure handling is taken care of by the 2837 - * hci_le_conn_failed function which is triggered by the HCI 2837 + * hci_conn_failed function which is triggered by the HCI 2838 2838 * request completion callbacks used for connecting. 2839 2839 */ 2840 2840 if (status) ··· 2859 2859 bt_dev_dbg(hdev, "status 0x%2.2x", status); 2860 2860 2861 2861 /* All connection failure handling is taken care of by the 2862 - * hci_le_conn_failed function which is triggered by the HCI 2862 + * hci_conn_failed function which is triggered by the HCI 2863 2863 * request completion callbacks used for connecting. 2864 2864 */ 2865 2865 if (status) ··· 3067 3067 { 3068 3068 struct hci_ev_conn_complete *ev = data; 3069 3069 struct hci_conn *conn; 3070 + u8 status = ev->status; 3070 3071 3071 - if (__le16_to_cpu(ev->handle) > HCI_CONN_HANDLE_MAX) { 3072 - bt_dev_err(hdev, "Ignoring HCI_Connection_Complete for invalid handle"); 3073 - return; 3074 - } 3075 - 3076 - bt_dev_dbg(hdev, "status 0x%2.2x", ev->status); 3072 + bt_dev_dbg(hdev, "status 0x%2.2x", status); 3077 3073 3078 3074 hci_dev_lock(hdev); 3079 3075 3080 3076 conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, &ev->bdaddr); 3081 3077 if (!conn) { 3078 + /* In case of error status and there is no connection pending 3079 + * just unlock as there is nothing to cleanup. 3080 + */ 3081 + if (ev->status) 3082 + goto unlock; 3083 + 3082 3084 /* Connection may not exist if auto-connected. Check the bredr 3083 3085 * allowlist to see if this device is allowed to auto connect. 3084 3086 * If link is an ACL type, create a connection class ··· 3124 3122 goto unlock; 3125 3123 } 3126 3124 3127 - if (!ev->status) { 3125 + if (!status) { 3128 3126 conn->handle = __le16_to_cpu(ev->handle); 3127 + if (conn->handle > HCI_CONN_HANDLE_MAX) { 3128 + bt_dev_err(hdev, "Invalid handle: 0x%4.4x > 0x%4.4x", 3129 + conn->handle, HCI_CONN_HANDLE_MAX); 3130 + status = HCI_ERROR_INVALID_PARAMETERS; 3131 + goto done; 3132 + } 3129 3133 3130 3134 if (conn->type == ACL_LINK) { 3131 3135 conn->state = BT_CONFIG; ··· 3172 3164 hci_send_cmd(hdev, HCI_OP_CHANGE_CONN_PTYPE, sizeof(cp), 3173 3165 &cp); 3174 3166 } 3175 - } else { 3176 - conn->state = BT_CLOSED; 3177 - if (conn->type == ACL_LINK) 3178 - mgmt_connect_failed(hdev, &conn->dst, conn->type, 3179 - conn->dst_type, ev->status); 3180 3167 } 3181 3168 3182 3169 if (conn->type == ACL_LINK) 3183 3170 hci_sco_setup(conn, ev->status); 3184 3171 3185 - if (ev->status) { 3186 - hci_connect_cfm(conn, ev->status); 3187 - hci_conn_del(conn); 3172 + done: 3173 + if (status) { 3174 + hci_conn_failed(conn, status); 3188 3175 } else if (ev->link_type == SCO_LINK) { 3189 3176 switch (conn->setting & SCO_AIRMODE_MASK) { 3190 3177 case SCO_AIRMODE_CVSD: ··· 3188 3185 break; 3189 3186 } 3190 3187 3191 - hci_connect_cfm(conn, ev->status); 3188 + hci_connect_cfm(conn, status); 3192 3189 } 3193 3190 3194 3191 unlock: ··· 4679 4676 { 4680 4677 struct hci_ev_sync_conn_complete *ev = data; 4681 4678 struct hci_conn *conn; 4679 + u8 status = ev->status; 4682 4680 4683 4681 switch (ev->link_type) { 4684 4682 case SCO_LINK: ··· 4694 4690 return; 4695 4691 } 4696 4692 4697 - if (__le16_to_cpu(ev->handle) > HCI_CONN_HANDLE_MAX) { 4698 - bt_dev_err(hdev, "Ignoring HCI_Sync_Conn_Complete for invalid handle"); 4699 - return; 4700 - } 4701 - 4702 - bt_dev_dbg(hdev, "status 0x%2.2x", ev->status); 4693 + bt_dev_dbg(hdev, "status 0x%2.2x", status); 4703 4694 4704 4695 hci_dev_lock(hdev); 4705 4696 ··· 4728 4729 goto unlock; 4729 4730 } 4730 4731 4731 - switch (ev->status) { 4732 + switch (status) { 4732 4733 case 0x00: 4733 4734 conn->handle = __le16_to_cpu(ev->handle); 4735 + if (conn->handle > HCI_CONN_HANDLE_MAX) { 4736 + bt_dev_err(hdev, "Invalid handle: 0x%4.4x > 0x%4.4x", 4737 + conn->handle, HCI_CONN_HANDLE_MAX); 4738 + status = HCI_ERROR_INVALID_PARAMETERS; 4739 + conn->state = BT_CLOSED; 4740 + break; 4741 + } 4742 + 4734 4743 conn->state = BT_CONNECTED; 4735 4744 conn->type = ev->link_type; 4736 4745 ··· 4782 4775 } 4783 4776 } 4784 4777 4785 - hci_connect_cfm(conn, ev->status); 4786 - if (ev->status) 4778 + hci_connect_cfm(conn, status); 4779 + if (status) 4787 4780 hci_conn_del(conn); 4788 4781 4789 4782 unlock: ··· 5534 5527 struct smp_irk *irk; 5535 5528 u8 addr_type; 5536 5529 5537 - if (handle > HCI_CONN_HANDLE_MAX) { 5538 - bt_dev_err(hdev, "Ignoring HCI_LE_Connection_Complete for invalid handle"); 5539 - return; 5540 - } 5541 - 5542 5530 hci_dev_lock(hdev); 5543 5531 5544 5532 /* All controllers implicitly stop advertising in the event of a ··· 5543 5541 5544 5542 conn = hci_lookup_le_connect(hdev); 5545 5543 if (!conn) { 5544 + /* In case of error status and there is no connection pending 5545 + * just unlock as there is nothing to cleanup. 5546 + */ 5547 + if (status) 5548 + goto unlock; 5549 + 5546 5550 conn = hci_conn_add(hdev, LE_LINK, bdaddr, role); 5547 5551 if (!conn) { 5548 5552 bt_dev_err(hdev, "no memory for new connection"); ··· 5611 5603 5612 5604 conn->dst_type = ev_bdaddr_type(hdev, conn->dst_type, NULL); 5613 5605 5606 + if (handle > HCI_CONN_HANDLE_MAX) { 5607 + bt_dev_err(hdev, "Invalid handle: 0x%4.4x > 0x%4.4x", handle, 5608 + HCI_CONN_HANDLE_MAX); 5609 + status = HCI_ERROR_INVALID_PARAMETERS; 5610 + } 5611 + 5614 5612 if (status) { 5615 - hci_le_conn_failed(conn, status); 5613 + hci_conn_failed(conn, status); 5616 5614 goto unlock; 5617 5615 } 5618 5616
+10 -1
net/bluetooth/hci_sync.c
··· 4408 4408 static int hci_abort_conn_sync(struct hci_dev *hdev, struct hci_conn *conn, 4409 4409 u8 reason) 4410 4410 { 4411 + int err; 4412 + 4411 4413 switch (conn->state) { 4412 4414 case BT_CONNECTED: 4413 4415 case BT_CONFIG: 4414 4416 return hci_disconnect_sync(hdev, conn, reason); 4415 4417 case BT_CONNECT: 4416 - return hci_connect_cancel_sync(hdev, conn); 4418 + err = hci_connect_cancel_sync(hdev, conn); 4419 + /* Cleanup hci_conn object if it cannot be cancelled as it 4420 + * likelly means the controller and host stack are out of sync. 4421 + */ 4422 + if (err) 4423 + hci_conn_failed(conn, err); 4424 + 4425 + return err; 4417 4426 case BT_CONNECT2: 4418 4427 return hci_reject_conn_sync(hdev, conn, reason); 4419 4428 default:
+3 -2
net/bpf/test_run.c
··· 108 108 struct page_pool *pp; 109 109 struct xdp_frame **frames; 110 110 struct sk_buff **skbs; 111 + struct xdp_mem_info mem; 111 112 u32 batch_size; 112 113 u32 frame_cnt; 113 114 }; ··· 148 147 149 148 static int xdp_test_run_setup(struct xdp_test_data *xdp, struct xdp_buff *orig_ctx) 150 149 { 151 - struct xdp_mem_info mem = {}; 152 150 struct page_pool *pp; 153 151 int err = -ENOMEM; 154 152 struct page_pool_params pp_params = { ··· 174 174 } 175 175 176 176 /* will copy 'mem.id' into pp->xdp_mem_id */ 177 - err = xdp_reg_mem_model(&mem, MEM_TYPE_PAGE_POOL, pp); 177 + err = xdp_reg_mem_model(&xdp->mem, MEM_TYPE_PAGE_POOL, pp); 178 178 if (err) 179 179 goto err_mmodel; 180 180 ··· 202 202 203 203 static void xdp_test_run_teardown(struct xdp_test_data *xdp) 204 204 { 205 + xdp_unreg_mem_model(&xdp->mem); 205 206 page_pool_destroy(xdp->pp); 206 207 kfree(xdp->frames); 207 208 kfree(xdp->skbs);
+2
net/bridge/br_switchdev.c
··· 353 353 attr.orig_dev = br_dev; 354 354 355 355 vg = br_vlan_group(br); 356 + if (!vg) 357 + return 0; 356 358 357 359 list_for_each_entry(v, &vg->vlan_list, vlist) { 358 360 if (v->msti) {
+5 -9
net/core/dev.c
··· 10304 10304 } 10305 10305 EXPORT_SYMBOL(netdev_stats_to_stats64); 10306 10306 10307 - struct net_device_core_stats *netdev_core_stats_alloc(struct net_device *dev) 10307 + struct net_device_core_stats __percpu *netdev_core_stats_alloc(struct net_device *dev) 10308 10308 { 10309 10309 struct net_device_core_stats __percpu *p; 10310 10310 ··· 10315 10315 free_percpu(p); 10316 10316 10317 10317 /* This READ_ONCE() pairs with the cmpxchg() above */ 10318 - p = READ_ONCE(dev->core_stats); 10319 - if (!p) 10320 - return NULL; 10321 - 10322 - return this_cpu_ptr(p); 10318 + return READ_ONCE(dev->core_stats); 10323 10319 } 10324 10320 EXPORT_SYMBOL(netdev_core_stats_alloc); 10325 10321 ··· 10352 10356 10353 10357 for_each_possible_cpu(i) { 10354 10358 core_stats = per_cpu_ptr(p, i); 10355 - storage->rx_dropped += local_read(&core_stats->rx_dropped); 10356 - storage->tx_dropped += local_read(&core_stats->tx_dropped); 10357 - storage->rx_nohandler += local_read(&core_stats->rx_nohandler); 10359 + storage->rx_dropped += READ_ONCE(core_stats->rx_dropped); 10360 + storage->tx_dropped += READ_ONCE(core_stats->tx_dropped); 10361 + storage->rx_nohandler += READ_ONCE(core_stats->rx_nohandler); 10358 10362 } 10359 10363 } 10360 10364 return storage;
+3 -4
net/core/lwt_bpf.c
··· 159 159 return dst->lwtstate->orig_output(net, sk, skb); 160 160 } 161 161 162 - static int xmit_check_hhlen(struct sk_buff *skb) 162 + static int xmit_check_hhlen(struct sk_buff *skb, int hh_len) 163 163 { 164 - int hh_len = skb_dst(skb)->dev->hard_header_len; 165 - 166 164 if (skb_headroom(skb) < hh_len) { 167 165 int nhead = HH_DATA_ALIGN(hh_len - skb_headroom(skb)); 168 166 ··· 272 274 273 275 bpf = bpf_lwt_lwtunnel(dst->lwtstate); 274 276 if (bpf->xmit.prog) { 277 + int hh_len = dst->dev->hard_header_len; 275 278 __be16 proto = skb->protocol; 276 279 int ret; 277 280 ··· 290 291 /* If the header was expanded, headroom might be too 291 292 * small for L2 header to come, expand as needed. 292 293 */ 293 - ret = xmit_check_hhlen(skb); 294 + ret = xmit_check_hhlen(skb, hh_len); 294 295 if (unlikely(ret)) 295 296 return ret; 296 297
+2
net/dsa/port.c
··· 1620 1620 if (ds->ops->phylink_mac_link_down) 1621 1621 ds->ops->phylink_mac_link_down(ds, port, 1622 1622 MLO_AN_FIXED, PHY_INTERFACE_MODE_NA); 1623 + of_node_put(phy_np); 1623 1624 return dsa_port_phylink_register(dp); 1624 1625 } 1626 + of_node_put(phy_np); 1625 1627 return 0; 1626 1628 } 1627 1629
+1 -1
net/dsa/slave.c
··· 285 285 if (other_dp->slave->flags & IFF_ALLMULTI) 286 286 flags.val |= BR_MCAST_FLOOD; 287 287 if (other_dp->slave->flags & IFF_PROMISC) 288 - flags.val |= BR_FLOOD; 288 + flags.val |= BR_FLOOD | BR_MCAST_FLOOD; 289 289 } 290 290 291 291 err = dsa_port_pre_bridge_flags(dp, flags, NULL);
+5 -7
net/ipv4/ip_gre.c
··· 459 459 __be16 proto) 460 460 { 461 461 struct ip_tunnel *tunnel = netdev_priv(dev); 462 - 463 - if (tunnel->parms.o_flags & TUNNEL_SEQ) 464 - tunnel->o_seqno++; 462 + __be16 flags = tunnel->parms.o_flags; 465 463 466 464 /* Push GRE header. */ 467 465 gre_build_header(skb, tunnel->tun_hlen, 468 - tunnel->parms.o_flags, proto, tunnel->parms.o_key, 469 - htonl(tunnel->o_seqno)); 466 + flags, proto, tunnel->parms.o_key, 467 + (flags & TUNNEL_SEQ) ? htonl(atomic_fetch_inc(&tunnel->o_seqno)) : 0); 470 468 471 469 ip_tunnel_xmit(skb, dev, tnl_params, tnl_params->protocol); 472 470 } ··· 502 504 (TUNNEL_CSUM | TUNNEL_KEY | TUNNEL_SEQ); 503 505 gre_build_header(skb, tunnel_hlen, flags, proto, 504 506 tunnel_id_to_key32(tun_info->key.tun_id), 505 - (flags & TUNNEL_SEQ) ? htonl(tunnel->o_seqno++) : 0); 507 + (flags & TUNNEL_SEQ) ? htonl(atomic_fetch_inc(&tunnel->o_seqno)) : 0); 506 508 507 509 ip_md_tunnel_xmit(skb, dev, IPPROTO_GRE, tunnel_hlen); 508 510 ··· 579 581 } 580 582 581 583 gre_build_header(skb, 8, TUNNEL_SEQ, 582 - proto, 0, htonl(tunnel->o_seqno++)); 584 + proto, 0, htonl(atomic_fetch_inc(&tunnel->o_seqno))); 583 585 584 586 ip_md_tunnel_xmit(skb, dev, IPPROTO_GRE, tunnel_hlen); 585 587
net/ipv4/netfilter/nf_flow_table_ipv4.c
+7 -1
net/ipv4/syncookies.c
··· 281 281 EXPORT_SYMBOL(cookie_ecn_ok); 282 282 283 283 struct request_sock *cookie_tcp_reqsk_alloc(const struct request_sock_ops *ops, 284 + const struct tcp_request_sock_ops *af_ops, 284 285 struct sock *sk, 285 286 struct sk_buff *skb) 286 287 { ··· 298 297 return NULL; 299 298 300 299 treq = tcp_rsk(req); 300 + 301 + /* treq->af_specific might be used to perform TCP_MD5 lookup */ 302 + treq->af_specific = af_ops; 303 + 301 304 treq->syn_tos = TCP_SKB_CB(skb)->ip_dsfield; 302 305 #if IS_ENABLED(CONFIG_MPTCP) 303 306 treq->is_mptcp = sk_is_mptcp(sk); ··· 369 364 goto out; 370 365 371 366 ret = NULL; 372 - req = cookie_tcp_reqsk_alloc(&tcp_request_sock_ops, sk, skb); 367 + req = cookie_tcp_reqsk_alloc(&tcp_request_sock_ops, 368 + &tcp_request_sock_ipv4_ops, sk, skb); 373 369 if (!req) 374 370 goto out; 375 371
+13 -2
net/ipv4/tcp_input.c
··· 3867 3867 tcp_process_tlp_ack(sk, ack, flag); 3868 3868 3869 3869 if (tcp_ack_is_dubious(sk, flag)) { 3870 - if (!(flag & (FLAG_SND_UNA_ADVANCED | FLAG_NOT_DUP))) { 3870 + if (!(flag & (FLAG_SND_UNA_ADVANCED | 3871 + FLAG_NOT_DUP | FLAG_DSACKING_ACK))) { 3871 3872 num_dupack = 1; 3872 3873 /* Consider if pure acks were aggregated in tcp_add_backlog() */ 3873 3874 if (!(flag & FLAG_DATA)) ··· 5455 5454 INDIRECT_CALL_1(sk->sk_write_space, sk_stream_write_space, sk); 5456 5455 } 5457 5456 5458 - static void tcp_check_space(struct sock *sk) 5457 + /* Caller made space either from: 5458 + * 1) Freeing skbs in rtx queues (after tp->snd_una has advanced) 5459 + * 2) Sent skbs from output queue (and thus advancing tp->snd_nxt) 5460 + * 5461 + * We might be able to generate EPOLLOUT to the application if: 5462 + * 1) Space consumed in output/rtx queues is below sk->sk_sndbuf/2 5463 + * 2) notsent amount (tp->write_seq - tp->snd_nxt) became 5464 + * small enough that tcp_stream_memory_free() decides it 5465 + * is time to generate EPOLLOUT. 5466 + */ 5467 + void tcp_check_space(struct sock *sk) 5459 5468 { 5460 5469 /* pairs with tcp_poll() */ 5461 5470 smp_mb();
+1 -1
net/ipv4/tcp_minisocks.c
··· 531 531 newtp->tsoffset = treq->ts_off; 532 532 #ifdef CONFIG_TCP_MD5SIG 533 533 newtp->md5sig_info = NULL; /*XXX*/ 534 - if (newtp->af_specific->md5_lookup(sk, newsk)) 534 + if (treq->af_specific->req_md5_lookup(sk, req_to_sk(req))) 535 535 newtp->tcp_header_len += TCPOLEN_MD5SIG_ALIGNED; 536 536 #endif 537 537 if (skb->len >= TCP_MSS_DEFAULT + newtp->tcp_header_len)
+1
net/ipv4/tcp_output.c
··· 82 82 83 83 NET_ADD_STATS(sock_net(sk), LINUX_MIB_TCPORIGDATASENT, 84 84 tcp_skb_pcount(skb)); 85 + tcp_check_space(sk); 85 86 } 86 87 87 88 /* SND.NXT, if window was not shrunk or the amount of shrunk was less than one
+8 -3
net/ipv4/tcp_rate.c
··· 74 74 * 75 75 * If an ACK (s)acks multiple skbs (e.g., stretched-acks), this function is 76 76 * called multiple times. We favor the information from the most recently 77 - * sent skb, i.e., the skb with the highest prior_delivered count. 77 + * sent skb, i.e., the skb with the most recently sent time and the highest 78 + * sequence. 78 79 */ 79 80 void tcp_rate_skb_delivered(struct sock *sk, struct sk_buff *skb, 80 81 struct rate_sample *rs) 81 82 { 82 83 struct tcp_sock *tp = tcp_sk(sk); 83 84 struct tcp_skb_cb *scb = TCP_SKB_CB(skb); 85 + u64 tx_tstamp; 84 86 85 87 if (!scb->tx.delivered_mstamp) 86 88 return; 87 89 90 + tx_tstamp = tcp_skb_timestamp_us(skb); 88 91 if (!rs->prior_delivered || 89 - after(scb->tx.delivered, rs->prior_delivered)) { 92 + tcp_skb_sent_after(tx_tstamp, tp->first_tx_mstamp, 93 + scb->end_seq, rs->last_end_seq)) { 90 94 rs->prior_delivered_ce = scb->tx.delivered_ce; 91 95 rs->prior_delivered = scb->tx.delivered; 92 96 rs->prior_mstamp = scb->tx.delivered_mstamp; 93 97 rs->is_app_limited = scb->tx.is_app_limited; 94 98 rs->is_retrans = scb->sacked & TCPCB_RETRANS; 99 + rs->last_end_seq = scb->end_seq; 95 100 96 101 /* Record send time of most recently ACKed packet: */ 97 - tp->first_tx_mstamp = tcp_skb_timestamp_us(skb); 102 + tp->first_tx_mstamp = tx_tstamp; 98 103 /* Find the duration of the "send phase" of this window: */ 99 104 rs->interval_us = tcp_stamp_us_delta(tp->first_tx_mstamp, 100 105 scb->tx.first_tx_mstamp);
+8 -8
net/ipv6/ip6_gre.c
··· 724 724 { 725 725 struct ip6_tnl *tunnel = netdev_priv(dev); 726 726 __be16 protocol; 727 + __be16 flags; 727 728 728 729 if (dev->type == ARPHRD_ETHER) 729 730 IPCB(skb)->flags = 0; ··· 740 739 if (tunnel->parms.collect_md) { 741 740 struct ip_tunnel_info *tun_info; 742 741 const struct ip_tunnel_key *key; 743 - __be16 flags; 744 742 int tun_hlen; 745 743 746 744 tun_info = skb_tunnel_info_txcheck(skb); ··· 766 766 gre_build_header(skb, tun_hlen, 767 767 flags, protocol, 768 768 tunnel_id_to_key32(tun_info->key.tun_id), 769 - (flags & TUNNEL_SEQ) ? htonl(tunnel->o_seqno++) 769 + (flags & TUNNEL_SEQ) ? htonl(atomic_fetch_inc(&tunnel->o_seqno)) 770 770 : 0); 771 771 772 772 } else { 773 - if (tunnel->parms.o_flags & TUNNEL_SEQ) 774 - tunnel->o_seqno++; 775 - 776 773 if (skb_cow_head(skb, dev->needed_headroom ?: tunnel->hlen)) 777 774 return -ENOMEM; 778 775 779 - gre_build_header(skb, tunnel->tun_hlen, tunnel->parms.o_flags, 776 + flags = tunnel->parms.o_flags; 777 + 778 + gre_build_header(skb, tunnel->tun_hlen, flags, 780 779 protocol, tunnel->parms.o_key, 781 - htonl(tunnel->o_seqno)); 780 + (flags & TUNNEL_SEQ) ? htonl(atomic_fetch_inc(&tunnel->o_seqno)) 781 + : 0); 782 782 } 783 783 784 784 return ip6_tnl_xmit(skb, dev, dsfield, fl6, encap_limit, pmtu, ··· 1056 1056 /* Push GRE header. */ 1057 1057 proto = (t->parms.erspan_ver == 1) ? htons(ETH_P_ERSPAN) 1058 1058 : htons(ETH_P_ERSPAN2); 1059 - gre_build_header(skb, 8, TUNNEL_SEQ, proto, 0, htonl(t->o_seqno++)); 1059 + gre_build_header(skb, 8, TUNNEL_SEQ, proto, 0, htonl(atomic_fetch_inc(&t->o_seqno))); 1060 1060 1061 1061 /* TooBig packet may have updated dst->dev's mtu */ 1062 1062 if (!t->parms.collect_md && dst && dst_mtu(dst) > dst->dev->mtu)
+8 -2
net/ipv6/netfilter.c
··· 24 24 { 25 25 const struct ipv6hdr *iph = ipv6_hdr(skb); 26 26 struct sock *sk = sk_to_full_sk(sk_partial); 27 + struct net_device *dev = skb_dst(skb)->dev; 27 28 struct flow_keys flkeys; 28 29 unsigned int hh_len; 29 30 struct dst_entry *dst; 30 31 int strict = (ipv6_addr_type(&iph->daddr) & 31 32 (IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL)); 32 33 struct flowi6 fl6 = { 33 - .flowi6_oif = sk && sk->sk_bound_dev_if ? sk->sk_bound_dev_if : 34 - strict ? skb_dst(skb)->dev->ifindex : 0, 35 34 .flowi6_mark = skb->mark, 36 35 .flowi6_uid = sock_net_uid(net, sk), 37 36 .daddr = iph->daddr, 38 37 .saddr = iph->saddr, 39 38 }; 40 39 int err; 40 + 41 + if (sk && sk->sk_bound_dev_if) 42 + fl6.flowi6_oif = sk->sk_bound_dev_if; 43 + else if (strict) 44 + fl6.flowi6_oif = dev->ifindex; 45 + else 46 + fl6.flowi6_oif = l3mdev_master_ifindex(dev); 41 47 42 48 fib6_rules_early_flow_dissect(net, skb, &fl6, &flkeys); 43 49 dst = ip6_route_output(net, sk, &fl6);
+2 -1
net/ipv6/syncookies.c
··· 170 170 goto out; 171 171 172 172 ret = NULL; 173 - req = cookie_tcp_reqsk_alloc(&tcp6_request_sock_ops, sk, skb); 173 + req = cookie_tcp_reqsk_alloc(&tcp6_request_sock_ops, 174 + &tcp_request_sock_ipv6_ops, sk, skb); 174 175 if (!req) 175 176 goto out; 176 177
+1 -1
net/mctp/device.c
··· 313 313 void mctp_dev_put(struct mctp_dev *mdev) 314 314 { 315 315 if (mdev && refcount_dec_and_test(&mdev->refs)) { 316 + kfree(mdev->addrs); 316 317 dev_put(mdev->dev); 317 318 kfree_rcu(mdev, rcu); 318 319 } ··· 442 441 443 442 mctp_route_remove_dev(mdev); 444 443 mctp_neigh_remove_dev(mdev); 445 - kfree(mdev->addrs); 446 444 447 445 mctp_dev_put(mdev); 448 446 }
+1 -1
net/netfilter/ipvs/ip_vs_conn.c
··· 1495 1495 pr_info("Connection hash table configured " 1496 1496 "(size=%d, memory=%ldKbytes)\n", 1497 1497 ip_vs_conn_tab_size, 1498 - (long)(ip_vs_conn_tab_size*sizeof(struct list_head))/1024); 1498 + (long)(ip_vs_conn_tab_size*sizeof(*ip_vs_conn_tab))/1024); 1499 1499 IP_VS_DBG(0, "Each connection entry needs %zd bytes at least\n", 1500 1500 sizeof(struct ip_vs_conn)); 1501 1501
+6 -15
net/netfilter/nf_conntrack_proto_tcp.c
··· 556 556 } 557 557 558 558 } 559 - } else if (((state->state == TCP_CONNTRACK_SYN_SENT 560 - && dir == IP_CT_DIR_ORIGINAL) 561 - || (state->state == TCP_CONNTRACK_SYN_RECV 562 - && dir == IP_CT_DIR_REPLY)) 563 - && after(end, sender->td_end)) { 559 + } else if (tcph->syn && 560 + after(end, sender->td_end) && 561 + (state->state == TCP_CONNTRACK_SYN_SENT || 562 + state->state == TCP_CONNTRACK_SYN_RECV)) { 564 563 /* 565 564 * RFC 793: "if a TCP is reinitialized ... then it need 566 565 * not wait at all; it must only be sure to use sequence 567 566 * numbers larger than those recently used." 568 - */ 569 - sender->td_end = 570 - sender->td_maxend = end; 571 - sender->td_maxwin = (win == 0 ? 1 : win); 572 - 573 - tcp_options(skb, dataoff, tcph, sender); 574 - } else if (tcph->syn && dir == IP_CT_DIR_REPLY && 575 - state->state == TCP_CONNTRACK_SYN_SENT) { 576 - /* Retransmitted syn-ack, or syn (simultaneous open). 577 567 * 578 568 * Re-init state for this direction, just like for the first 579 569 * syn(-ack) reply, it might differ in seq, ack or tcp options. ··· 571 581 tcp_init_sender(sender, receiver, 572 582 skb, dataoff, tcph, 573 583 end, win); 574 - if (!tcph->ack) 584 + 585 + if (dir == IP_CT_DIR_REPLY && !tcph->ack) 575 586 return true; 576 587 } 577 588
+1 -1
net/netfilter/nf_conntrack_standalone.c
··· 823 823 .mode = 0644, 824 824 .proc_handler = proc_dointvec_jiffies, 825 825 }, 826 - #if IS_ENABLED(CONFIG_NFT_FLOW_OFFLOAD) 826 + #if IS_ENABLED(CONFIG_NF_FLOW_TABLE) 827 827 [NF_SYSCTL_CT_PROTO_TIMEOUT_UDP_OFFLOAD] = { 828 828 .procname = "nf_flowtable_udp_timeout", 829 829 .maxlen = sizeof(unsigned int),
+5 -1
net/netfilter/nft_set_rbtree.c
··· 349 349 *ext = &rbe->ext; 350 350 return -EEXIST; 351 351 } else { 352 - p = &parent->rb_left; 352 + overlap = false; 353 + if (nft_rbtree_interval_end(rbe)) 354 + p = &parent->rb_left; 355 + else 356 + p = &parent->rb_right; 353 357 } 354 358 } 355 359
+38 -14
net/netfilter/nft_socket.c
··· 54 54 } 55 55 #endif 56 56 57 + static struct sock *nft_socket_do_lookup(const struct nft_pktinfo *pkt) 58 + { 59 + const struct net_device *indev = nft_in(pkt); 60 + const struct sk_buff *skb = pkt->skb; 61 + struct sock *sk = NULL; 62 + 63 + if (!indev) 64 + return NULL; 65 + 66 + switch (nft_pf(pkt)) { 67 + case NFPROTO_IPV4: 68 + sk = nf_sk_lookup_slow_v4(nft_net(pkt), skb, indev); 69 + break; 70 + #if IS_ENABLED(CONFIG_NF_TABLES_IPV6) 71 + case NFPROTO_IPV6: 72 + sk = nf_sk_lookup_slow_v6(nft_net(pkt), skb, indev); 73 + break; 74 + #endif 75 + default: 76 + WARN_ON_ONCE(1); 77 + break; 78 + } 79 + 80 + return sk; 81 + } 82 + 57 83 static void nft_socket_eval(const struct nft_expr *expr, 58 84 struct nft_regs *regs, 59 85 const struct nft_pktinfo *pkt) ··· 93 67 sk = NULL; 94 68 95 69 if (!sk) 96 - switch(nft_pf(pkt)) { 97 - case NFPROTO_IPV4: 98 - sk = nf_sk_lookup_slow_v4(nft_net(pkt), skb, nft_in(pkt)); 99 - break; 100 - #if IS_ENABLED(CONFIG_NF_TABLES_IPV6) 101 - case NFPROTO_IPV6: 102 - sk = nf_sk_lookup_slow_v6(nft_net(pkt), skb, nft_in(pkt)); 103 - break; 104 - #endif 105 - default: 106 - WARN_ON_ONCE(1); 107 - regs->verdict.code = NFT_BREAK; 108 - return; 109 - } 70 + sk = nft_socket_do_lookup(pkt); 110 71 111 72 if (!sk) { 112 73 regs->verdict.code = NFT_BREAK; ··· 237 224 return nft_expr_reduce_bitwise(track, expr); 238 225 } 239 226 227 + static int nft_socket_validate(const struct nft_ctx *ctx, 228 + const struct nft_expr *expr, 229 + const struct nft_data **data) 230 + { 231 + return nft_chain_validate_hooks(ctx->chain, 232 + (1 << NF_INET_PRE_ROUTING) | 233 + (1 << NF_INET_LOCAL_IN) | 234 + (1 << NF_INET_LOCAL_OUT)); 235 + } 236 + 240 237 static struct nft_expr_type nft_socket_type; 241 238 static const struct nft_expr_ops nft_socket_ops = { 242 239 .type = &nft_socket_type, ··· 254 231 .eval = nft_socket_eval, 255 232 .init = nft_socket_init, 256 233 .dump = nft_socket_dump, 234 + .validate = nft_socket_validate, 257 235 .reduce = nft_socket_reduce, 258 236 }; 259 237
+4
net/sctp/sm_sideeffect.c
··· 458 458 goto out_unlock; 459 459 } 460 460 461 + /* This happens when the response arrives after the timer is triggered. */ 462 + if (!asoc->strreset_chunk) 463 + goto out_unlock; 464 + 461 465 error = sctp_do_sm(net, SCTP_EVENT_T_TIMEOUT, 462 466 SCTP_ST_TIMEOUT(SCTP_EVENT_TIMEOUT_RECONF), 463 467 asoc->state, asoc->ep, asoc,
+95 -42
net/smc/af_smc.c
··· 243 243 }; 244 244 EXPORT_SYMBOL_GPL(smc_proto6); 245 245 246 + static void smc_fback_restore_callbacks(struct smc_sock *smc) 247 + { 248 + struct sock *clcsk = smc->clcsock->sk; 249 + 250 + write_lock_bh(&clcsk->sk_callback_lock); 251 + clcsk->sk_user_data = NULL; 252 + 253 + smc_clcsock_restore_cb(&clcsk->sk_state_change, &smc->clcsk_state_change); 254 + smc_clcsock_restore_cb(&clcsk->sk_data_ready, &smc->clcsk_data_ready); 255 + smc_clcsock_restore_cb(&clcsk->sk_write_space, &smc->clcsk_write_space); 256 + smc_clcsock_restore_cb(&clcsk->sk_error_report, &smc->clcsk_error_report); 257 + 258 + write_unlock_bh(&clcsk->sk_callback_lock); 259 + } 260 + 246 261 static void smc_restore_fallback_changes(struct smc_sock *smc) 247 262 { 248 263 if (smc->clcsock->file) { /* non-accepted sockets have no file yet */ 249 264 smc->clcsock->file->private_data = smc->sk.sk_socket; 250 265 smc->clcsock->file = NULL; 266 + smc_fback_restore_callbacks(smc); 251 267 } 252 268 } 253 269 ··· 389 373 sk->sk_prot->hash(sk); 390 374 sk_refcnt_debug_inc(sk); 391 375 mutex_init(&smc->clcsock_release_lock); 376 + smc_init_saved_callbacks(smc); 392 377 393 378 return sk; 394 379 } ··· 761 744 762 745 static void smc_fback_state_change(struct sock *clcsk) 763 746 { 764 - struct smc_sock *smc = 765 - smc_clcsock_user_data(clcsk); 747 + struct smc_sock *smc; 766 748 767 - if (!smc) 768 - return; 769 - smc_fback_forward_wakeup(smc, clcsk, smc->clcsk_state_change); 749 + read_lock_bh(&clcsk->sk_callback_lock); 750 + smc = smc_clcsock_user_data(clcsk); 751 + if (smc) 752 + smc_fback_forward_wakeup(smc, clcsk, 753 + smc->clcsk_state_change); 754 + read_unlock_bh(&clcsk->sk_callback_lock); 770 755 } 771 756 772 757 static void smc_fback_data_ready(struct sock *clcsk) 773 758 { 774 - struct smc_sock *smc = 775 - smc_clcsock_user_data(clcsk); 759 + struct smc_sock *smc; 776 760 777 - if (!smc) 778 - return; 779 - smc_fback_forward_wakeup(smc, clcsk, smc->clcsk_data_ready); 761 + read_lock_bh(&clcsk->sk_callback_lock); 762 + smc = smc_clcsock_user_data(clcsk); 763 + if (smc) 764 + smc_fback_forward_wakeup(smc, clcsk, 765 + smc->clcsk_data_ready); 766 + read_unlock_bh(&clcsk->sk_callback_lock); 780 767 } 781 768 782 769 static void smc_fback_write_space(struct sock *clcsk) 783 770 { 784 - struct smc_sock *smc = 785 - smc_clcsock_user_data(clcsk); 771 + struct smc_sock *smc; 786 772 787 - if (!smc) 788 - return; 789 - smc_fback_forward_wakeup(smc, clcsk, smc->clcsk_write_space); 773 + read_lock_bh(&clcsk->sk_callback_lock); 774 + smc = smc_clcsock_user_data(clcsk); 775 + if (smc) 776 + smc_fback_forward_wakeup(smc, clcsk, 777 + smc->clcsk_write_space); 778 + read_unlock_bh(&clcsk->sk_callback_lock); 790 779 } 791 780 792 781 static void smc_fback_error_report(struct sock *clcsk) 793 782 { 794 - struct smc_sock *smc = 795 - smc_clcsock_user_data(clcsk); 783 + struct smc_sock *smc; 796 784 797 - if (!smc) 798 - return; 799 - smc_fback_forward_wakeup(smc, clcsk, smc->clcsk_error_report); 785 + read_lock_bh(&clcsk->sk_callback_lock); 786 + smc = smc_clcsock_user_data(clcsk); 787 + if (smc) 788 + smc_fback_forward_wakeup(smc, clcsk, 789 + smc->clcsk_error_report); 790 + read_unlock_bh(&clcsk->sk_callback_lock); 791 + } 792 + 793 + static void smc_fback_replace_callbacks(struct smc_sock *smc) 794 + { 795 + struct sock *clcsk = smc->clcsock->sk; 796 + 797 + write_lock_bh(&clcsk->sk_callback_lock); 798 + clcsk->sk_user_data = (void *)((uintptr_t)smc | SK_USER_DATA_NOCOPY); 799 + 800 + smc_clcsock_replace_cb(&clcsk->sk_state_change, smc_fback_state_change, 801 + &smc->clcsk_state_change); 802 + smc_clcsock_replace_cb(&clcsk->sk_data_ready, smc_fback_data_ready, 803 + &smc->clcsk_data_ready); 804 + smc_clcsock_replace_cb(&clcsk->sk_write_space, smc_fback_write_space, 805 + &smc->clcsk_write_space); 806 + smc_clcsock_replace_cb(&clcsk->sk_error_report, smc_fback_error_report, 807 + &smc->clcsk_error_report); 808 + 809 + write_unlock_bh(&clcsk->sk_callback_lock); 800 810 } 801 811 802 812 static int smc_switch_to_fallback(struct smc_sock *smc, int reason_code) 803 813 { 804 - struct sock *clcsk; 805 814 int rc = 0; 806 815 807 816 mutex_lock(&smc->clcsock_release_lock); ··· 835 792 rc = -EBADF; 836 793 goto out; 837 794 } 838 - clcsk = smc->clcsock->sk; 839 795 840 - if (smc->use_fallback) 841 - goto out; 842 796 smc->use_fallback = true; 843 797 smc->fallback_rsn = reason_code; 844 798 smc_stat_fallback(smc); ··· 850 810 * in smc sk->sk_wq and they should be woken up 851 811 * as clcsock's wait queue is woken up. 852 812 */ 853 - smc->clcsk_state_change = clcsk->sk_state_change; 854 - smc->clcsk_data_ready = clcsk->sk_data_ready; 855 - smc->clcsk_write_space = clcsk->sk_write_space; 856 - smc->clcsk_error_report = clcsk->sk_error_report; 857 - 858 - clcsk->sk_state_change = smc_fback_state_change; 859 - clcsk->sk_data_ready = smc_fback_data_ready; 860 - clcsk->sk_write_space = smc_fback_write_space; 861 - clcsk->sk_error_report = smc_fback_error_report; 862 - 863 - smc->clcsock->sk->sk_user_data = 864 - (void *)((uintptr_t)smc | SK_USER_DATA_NOCOPY); 813 + smc_fback_replace_callbacks(smc); 865 814 } 866 815 out: 867 816 mutex_unlock(&smc->clcsock_release_lock); ··· 1504 1475 smc->sk.sk_state = SMC_CLOSED; 1505 1476 if (rc == -EPIPE || rc == -EAGAIN) 1506 1477 smc->sk.sk_err = EPIPE; 1478 + else if (rc == -ECONNREFUSED) 1479 + smc->sk.sk_err = ECONNREFUSED; 1507 1480 else if (signal_pending(current)) 1508 1481 smc->sk.sk_err = -sock_intr_errno(timeo); 1509 1482 sock_put(&smc->sk); /* passive closing */ ··· 1625 1594 * function; switch it back to the original sk_data_ready function 1626 1595 */ 1627 1596 new_clcsock->sk->sk_data_ready = lsmc->clcsk_data_ready; 1597 + 1598 + /* if new clcsock has also inherited the fallback-specific callback 1599 + * functions, switch them back to the original ones. 1600 + */ 1601 + if (lsmc->use_fallback) { 1602 + if (lsmc->clcsk_state_change) 1603 + new_clcsock->sk->sk_state_change = lsmc->clcsk_state_change; 1604 + if (lsmc->clcsk_write_space) 1605 + new_clcsock->sk->sk_write_space = lsmc->clcsk_write_space; 1606 + if (lsmc->clcsk_error_report) 1607 + new_clcsock->sk->sk_error_report = lsmc->clcsk_error_report; 1608 + } 1609 + 1628 1610 (*new_smc)->clcsock = new_clcsock; 1629 1611 out: 1630 1612 return rc; ··· 2397 2353 2398 2354 static void smc_clcsock_data_ready(struct sock *listen_clcsock) 2399 2355 { 2400 - struct smc_sock *lsmc = 2401 - smc_clcsock_user_data(listen_clcsock); 2356 + struct smc_sock *lsmc; 2402 2357 2358 + read_lock_bh(&listen_clcsock->sk_callback_lock); 2359 + lsmc = smc_clcsock_user_data(listen_clcsock); 2403 2360 if (!lsmc) 2404 - return; 2361 + goto out; 2405 2362 lsmc->clcsk_data_ready(listen_clcsock); 2406 2363 if (lsmc->sk.sk_state == SMC_LISTEN) { 2407 2364 sock_hold(&lsmc->sk); /* sock_put in smc_tcp_listen_work() */ 2408 2365 if (!queue_work(smc_tcp_ls_wq, &lsmc->tcp_listen_work)) 2409 2366 sock_put(&lsmc->sk); 2410 2367 } 2368 + out: 2369 + read_unlock_bh(&listen_clcsock->sk_callback_lock); 2411 2370 } 2412 2371 2413 2372 static int smc_listen(struct socket *sock, int backlog) ··· 2442 2395 /* save original sk_data_ready function and establish 2443 2396 * smc-specific sk_data_ready function 2444 2397 */ 2445 - smc->clcsk_data_ready = smc->clcsock->sk->sk_data_ready; 2446 - smc->clcsock->sk->sk_data_ready = smc_clcsock_data_ready; 2398 + write_lock_bh(&smc->clcsock->sk->sk_callback_lock); 2447 2399 smc->clcsock->sk->sk_user_data = 2448 2400 (void *)((uintptr_t)smc | SK_USER_DATA_NOCOPY); 2401 + smc_clcsock_replace_cb(&smc->clcsock->sk->sk_data_ready, 2402 + smc_clcsock_data_ready, &smc->clcsk_data_ready); 2403 + write_unlock_bh(&smc->clcsock->sk->sk_callback_lock); 2449 2404 2450 2405 /* save original ops */ 2451 2406 smc->ori_af_ops = inet_csk(smc->clcsock->sk)->icsk_af_ops; ··· 2462 2413 2463 2414 rc = kernel_listen(smc->clcsock, backlog); 2464 2415 if (rc) { 2465 - smc->clcsock->sk->sk_data_ready = smc->clcsk_data_ready; 2416 + write_lock_bh(&smc->clcsock->sk->sk_callback_lock); 2417 + smc_clcsock_restore_cb(&smc->clcsock->sk->sk_data_ready, 2418 + &smc->clcsk_data_ready); 2419 + smc->clcsock->sk->sk_user_data = NULL; 2420 + write_unlock_bh(&smc->clcsock->sk->sk_callback_lock); 2466 2421 goto out; 2467 2422 } 2468 2423 sk->sk_max_ack_backlog = backlog;
+29
net/smc/smc.h
··· 288 288 return (struct smc_sock *)sk; 289 289 } 290 290 291 + static inline void smc_init_saved_callbacks(struct smc_sock *smc) 292 + { 293 + smc->clcsk_state_change = NULL; 294 + smc->clcsk_data_ready = NULL; 295 + smc->clcsk_write_space = NULL; 296 + smc->clcsk_error_report = NULL; 297 + } 298 + 291 299 static inline struct smc_sock *smc_clcsock_user_data(const struct sock *clcsk) 292 300 { 293 301 return (struct smc_sock *) 294 302 ((uintptr_t)clcsk->sk_user_data & ~SK_USER_DATA_NOCOPY); 303 + } 304 + 305 + /* save target_cb in saved_cb, and replace target_cb with new_cb */ 306 + static inline void smc_clcsock_replace_cb(void (**target_cb)(struct sock *), 307 + void (*new_cb)(struct sock *), 308 + void (**saved_cb)(struct sock *)) 309 + { 310 + /* only save once */ 311 + if (!*saved_cb) 312 + *saved_cb = *target_cb; 313 + *target_cb = new_cb; 314 + } 315 + 316 + /* restore target_cb to saved_cb, and reset saved_cb to NULL */ 317 + static inline void smc_clcsock_restore_cb(void (**target_cb)(struct sock *), 318 + void (**saved_cb)(struct sock *)) 319 + { 320 + if (!*saved_cb) 321 + return; 322 + *target_cb = *saved_cb; 323 + *saved_cb = NULL; 295 324 } 296 325 297 326 extern struct workqueue_struct *smc_hs_wq; /* wq for handshake work */
+4 -1
net/smc/smc_close.c
··· 214 214 sk->sk_state = SMC_CLOSED; 215 215 sk->sk_state_change(sk); /* wake up accept */ 216 216 if (smc->clcsock && smc->clcsock->sk) { 217 - smc->clcsock->sk->sk_data_ready = smc->clcsk_data_ready; 217 + write_lock_bh(&smc->clcsock->sk->sk_callback_lock); 218 + smc_clcsock_restore_cb(&smc->clcsock->sk->sk_data_ready, 219 + &smc->clcsk_data_ready); 218 220 smc->clcsock->sk->sk_user_data = NULL; 221 + write_unlock_bh(&smc->clcsock->sk->sk_callback_lock); 219 222 rc = kernel_sock_shutdown(smc->clcsock, SHUT_RDWR); 220 223 } 221 224 smc_close_cleanup_listen(sk);
+7 -5
net/tls/tls_device.c
··· 483 483 copy = min_t(size_t, size, (pfrag->size - pfrag->offset)); 484 484 copy = min_t(size_t, copy, (max_open_record_len - record->len)); 485 485 486 - rc = tls_device_copy_data(page_address(pfrag->page) + 487 - pfrag->offset, copy, msg_iter); 488 - if (rc) 489 - goto handle_error; 490 - tls_append_frag(record, pfrag, copy); 486 + if (copy) { 487 + rc = tls_device_copy_data(page_address(pfrag->page) + 488 + pfrag->offset, copy, msg_iter); 489 + if (rc) 490 + goto handle_error; 491 + tls_append_frag(record, pfrag, copy); 492 + } 491 493 492 494 size -= copy; 493 495 if (!size) {
+14 -1
net/xdp/xsk.c
··· 639 639 if (sk_can_busy_loop(sk)) 640 640 sk_busy_loop(sk, 1); /* only support non-blocking sockets */ 641 641 642 - if (xsk_no_wakeup(sk)) 642 + if (xs->zc && xsk_no_wakeup(sk)) 643 643 return 0; 644 644 645 645 pool = xs->pool; ··· 967 967 968 968 xp_get_pool(umem_xs->pool); 969 969 xs->pool = umem_xs->pool; 970 + 971 + /* If underlying shared umem was created without Tx 972 + * ring, allocate Tx descs array that Tx batching API 973 + * utilizes 974 + */ 975 + if (xs->tx && !xs->pool->tx_descs) { 976 + err = xp_alloc_tx_descs(xs->pool, xs); 977 + if (err) { 978 + xp_put_pool(xs->pool); 979 + sockfd_put(sock); 980 + goto out_unlock; 981 + } 982 + } 970 983 } 971 984 972 985 xdp_get_umem(umem_xs->umem);
+12 -4
net/xdp/xsk_buff_pool.c
··· 42 42 kvfree(pool); 43 43 } 44 44 45 + int xp_alloc_tx_descs(struct xsk_buff_pool *pool, struct xdp_sock *xs) 46 + { 47 + pool->tx_descs = kvcalloc(xs->tx->nentries, sizeof(*pool->tx_descs), 48 + GFP_KERNEL); 49 + if (!pool->tx_descs) 50 + return -ENOMEM; 51 + 52 + return 0; 53 + } 54 + 45 55 struct xsk_buff_pool *xp_create_and_assign_umem(struct xdp_sock *xs, 46 56 struct xdp_umem *umem) 47 57 { ··· 69 59 if (!pool->heads) 70 60 goto out; 71 61 72 - if (xs->tx) { 73 - pool->tx_descs = kcalloc(xs->tx->nentries, sizeof(*pool->tx_descs), GFP_KERNEL); 74 - if (!pool->tx_descs) 62 + if (xs->tx) 63 + if (xp_alloc_tx_descs(pool, xs)) 75 64 goto out; 76 - } 77 65 78 66 pool->chunk_mask = ~((u64)umem->chunk_size - 1); 79 67 pool->addrs_cnt = umem->size;
+1
tools/testing/selftests/wireguard/qemu/arch/i686.config
··· 1 + CONFIG_ACPI=y 1 2 CONFIG_SERIAL_8250=y 2 3 CONFIG_SERIAL_8250_CONSOLE=y 3 4 CONFIG_CMDLINE_BOOL=y
+1
tools/testing/selftests/wireguard/qemu/arch/x86_64.config
··· 1 + CONFIG_ACPI=y 1 2 CONFIG_SERIAL_8250=y 2 3 CONFIG_SERIAL_8250_CONSOLE=y 3 4 CONFIG_CMDLINE_BOOL=y