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/davem/net

Pull networking fixes from David Miller:

1) Several hash table refcount fixes in batman-adv, from Sven
Eckelmann.

2) Use after free in bpf_evict_inode(), from Daniel Borkmann.

3) Fix mdio bus registration in ixgbe, from Ivan Vecera.

4) Unbounded loop in __skb_try_recv_datagram(), from Paolo Abeni.

5) ila rhashtable corruption fix from Herbert Xu.

6) Don't allow upper-devices to be added to vrf devices, from Sabrina
Dubroca.

7) Add qmi_wwan device ID for Olicard 600, from Bjørn Mork.

8) Don't leave skb->next poisoned in __netif_receive_skb_list_ptype,
from Alexander Lobakin.

9) Missing IDR checks in mlx5 driver, from Aditya Pakki.

10) Fix false connection termination in ktls, from Jakub Kicinski.

11) Work around some ASPM issues with r8169 by disabling rx interrupt
coalescing on certain chips. From Heiner Kallweit.

12) Properly use per-cpu qstat values on NOLOCK qdiscs, from Paolo
Abeni.

13) Fully initialize sockaddr_in structures in SCTP, from Xin Long.

14) Various BPF flow dissector fixes from Stanislav Fomichev.

15) Divide by zero in act_sample, from Davide Caratti.

16) Fix bridging multicast regression introduced by rhashtable
conversion, from Nikolay Aleksandrov.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (106 commits)
ibmvnic: Fix completion structure initialization
ipv6: sit: reset ip header pointer in ipip6_rcv
net: bridge: always clear mcast matching struct on reports and leaves
libcxgb: fix incorrect ppmax calculation
vlan: conditional inclusion of FCoE hooks to match netdevice.h and bnx2x
sch_cake: Make sure we can write the IP header before changing DSCP bits
sch_cake: Use tc_skb_protocol() helper for getting packet protocol
tcp: Ensure DCTCP reacts to losses
net/sched: act_sample: fix divide by zero in the traffic path
net: thunderx: fix NULL pointer dereference in nicvf_open/nicvf_stop
net: hns: Fix sparse: some warnings in HNS drivers
net: hns: Fix WARNING when remove HNS driver with SMMU enabled
net: hns: fix ICMP6 neighbor solicitation messages discard problem
net: hns: Fix probabilistic memory overwrite when HNS driver initialized
net: hns: Use NAPI_POLL_WEIGHT for hns driver
net: hns: fix KASAN: use-after-free in hns_nic_net_xmit_hw()
flow_dissector: rst'ify documentation
ipv6: Fix dangling pointer when ipv6 fragment
net-gro: Fix GRO flush when receiving a GSO packet.
flow_dissector: document BPF flow dissector environment
...

+1098 -565
+4 -4
Documentation/bpf/btf.rst
··· 148 148 for the type. The maximum value of ``BTF_INT_BITS()`` is 128. 149 149 150 150 The ``BTF_INT_OFFSET()`` specifies the starting bit offset to calculate values 151 - for this int. For example, a bitfield struct member has: * btf member bit 152 - offset 100 from the start of the structure, * btf member pointing to an int 153 - type, * the int type has ``BTF_INT_OFFSET() = 2`` and ``BTF_INT_BITS() = 4`` 151 + for this int. For example, a bitfield struct member has: 152 + * btf member bit offset 100 from the start of the structure, 153 + * btf member pointing to an int type, 154 + * the int type has ``BTF_INT_OFFSET() = 2`` and ``BTF_INT_BITS() = 4`` 154 155 155 156 Then in the struct memory layout, this member will occupy ``4`` bits starting 156 157 from bits ``100 + 2 = 102``. 157 158 158 159 Alternatively, the bitfield struct member can be the following to access the 159 160 same bits as the above: 160 - 161 161 * btf member bit offset 102, 162 162 * btf member pointing to an int type, 163 163 * the int type has ``BTF_INT_OFFSET() = 0`` and ``BTF_INT_BITS() = 4``
+126
Documentation/networking/bpf_flow_dissector.rst
··· 1 + .. SPDX-License-Identifier: GPL-2.0 2 + 3 + ================== 4 + BPF Flow Dissector 5 + ================== 6 + 7 + Overview 8 + ======== 9 + 10 + Flow dissector is a routine that parses metadata out of the packets. It's 11 + used in the various places in the networking subsystem (RFS, flow hash, etc). 12 + 13 + BPF flow dissector is an attempt to reimplement C-based flow dissector logic 14 + in BPF to gain all the benefits of BPF verifier (namely, limits on the 15 + number of instructions and tail calls). 16 + 17 + API 18 + === 19 + 20 + BPF flow dissector programs operate on an ``__sk_buff``. However, only the 21 + limited set of fields is allowed: ``data``, ``data_end`` and ``flow_keys``. 22 + ``flow_keys`` is ``struct bpf_flow_keys`` and contains flow dissector input 23 + and output arguments. 24 + 25 + The inputs are: 26 + * ``nhoff`` - initial offset of the networking header 27 + * ``thoff`` - initial offset of the transport header, initialized to nhoff 28 + * ``n_proto`` - L3 protocol type, parsed out of L2 header 29 + 30 + Flow dissector BPF program should fill out the rest of the ``struct 31 + bpf_flow_keys`` fields. Input arguments ``nhoff/thoff/n_proto`` should be 32 + also adjusted accordingly. 33 + 34 + The return code of the BPF program is either BPF_OK to indicate successful 35 + dissection, or BPF_DROP to indicate parsing error. 36 + 37 + __sk_buff->data 38 + =============== 39 + 40 + In the VLAN-less case, this is what the initial state of the BPF flow 41 + dissector looks like:: 42 + 43 + +------+------+------------+-----------+ 44 + | DMAC | SMAC | ETHER_TYPE | L3_HEADER | 45 + +------+------+------------+-----------+ 46 + ^ 47 + | 48 + +-- flow dissector starts here 49 + 50 + 51 + .. code:: c 52 + 53 + skb->data + flow_keys->nhoff point to the first byte of L3_HEADER 54 + flow_keys->thoff = nhoff 55 + flow_keys->n_proto = ETHER_TYPE 56 + 57 + In case of VLAN, flow dissector can be called with the two different states. 58 + 59 + Pre-VLAN parsing:: 60 + 61 + +------+------+------+-----+-----------+-----------+ 62 + | DMAC | SMAC | TPID | TCI |ETHER_TYPE | L3_HEADER | 63 + +------+------+------+-----+-----------+-----------+ 64 + ^ 65 + | 66 + +-- flow dissector starts here 67 + 68 + .. code:: c 69 + 70 + skb->data + flow_keys->nhoff point the to first byte of TCI 71 + flow_keys->thoff = nhoff 72 + flow_keys->n_proto = TPID 73 + 74 + Please note that TPID can be 802.1AD and, hence, BPF program would 75 + have to parse VLAN information twice for double tagged packets. 76 + 77 + 78 + Post-VLAN parsing:: 79 + 80 + +------+------+------+-----+-----------+-----------+ 81 + | DMAC | SMAC | TPID | TCI |ETHER_TYPE | L3_HEADER | 82 + +------+------+------+-----+-----------+-----------+ 83 + ^ 84 + | 85 + +-- flow dissector starts here 86 + 87 + .. code:: c 88 + 89 + skb->data + flow_keys->nhoff point the to first byte of L3_HEADER 90 + flow_keys->thoff = nhoff 91 + flow_keys->n_proto = ETHER_TYPE 92 + 93 + In this case VLAN information has been processed before the flow dissector 94 + and BPF flow dissector is not required to handle it. 95 + 96 + 97 + The takeaway here is as follows: BPF flow dissector program can be called with 98 + the optional VLAN header and should gracefully handle both cases: when single 99 + or double VLAN is present and when it is not present. The same program 100 + can be called for both cases and would have to be written carefully to 101 + handle both cases. 102 + 103 + 104 + Reference Implementation 105 + ======================== 106 + 107 + See ``tools/testing/selftests/bpf/progs/bpf_flow.c`` for the reference 108 + implementation and ``tools/testing/selftests/bpf/flow_dissector_load.[hc]`` 109 + for the loader. bpftool can be used to load BPF flow dissector program as well. 110 + 111 + The reference implementation is organized as follows: 112 + * ``jmp_table`` map that contains sub-programs for each supported L3 protocol 113 + * ``_dissect`` routine - entry point; it does input ``n_proto`` parsing and 114 + does ``bpf_tail_call`` to the appropriate L3 handler 115 + 116 + Since BPF at this point doesn't support looping (or any jumping back), 117 + jmp_table is used instead to handle multiple levels of encapsulation (and 118 + IPv6 options). 119 + 120 + 121 + Current Limitations 122 + =================== 123 + BPF flow dissector doesn't support exporting all the metadata that in-kernel 124 + C-based implementation can export. Notable example is single VLAN (802.1Q) 125 + and double VLAN (802.1AD) tags. Please refer to the ``struct bpf_flow_keys`` 126 + for a set of information that's currently can be exported from the BPF context.
+1
Documentation/networking/index.rst
··· 9 9 netdev-FAQ 10 10 af_xdp 11 11 batman-adv 12 + bpf_flow_dissector 12 13 can 13 14 can_ucan_protocol 14 15 device_drivers/freescale/dpaa2/index
+2 -2
MAINTAINERS
··· 5833 5833 S: Maintained 5834 5834 F: Documentation/ABI/testing/sysfs-bus-mdio 5835 5835 F: Documentation/devicetree/bindings/net/mdio* 5836 - F: Documentation/networking/phy.txt 5836 + F: Documentation/networking/phy.rst 5837 5837 F: drivers/net/phy/ 5838 5838 F: drivers/of/of_mdio.c 5839 5839 F: drivers/of/of_net.c ··· 13981 13981 SFC NETWORK DRIVER 13982 13982 M: Solarflare linux maintainers <linux-net-drivers@solarflare.com> 13983 13983 M: Edward Cree <ecree@solarflare.com> 13984 - M: Bert Kenward <bkenward@solarflare.com> 13984 + M: Martin Habets <mhabets@solarflare.com> 13985 13985 L: netdev@vger.kernel.org 13986 13986 S: Supported 13987 13987 F: drivers/net/ethernet/sfc/
+3 -1
drivers/net/bonding/bond_sysfs_slave.c
··· 55 55 56 56 static ssize_t perm_hwaddr_show(struct slave *slave, char *buf) 57 57 { 58 - return sprintf(buf, "%pM\n", slave->perm_hwaddr); 58 + return sprintf(buf, "%*phC\n", 59 + slave->dev->addr_len, 60 + slave->perm_hwaddr); 59 61 } 60 62 static SLAVE_ATTR_RO(perm_hwaddr); 61 63
+16 -8
drivers/net/dsa/mv88e6xxx/port.c
··· 427 427 return 0; 428 428 429 429 lane = mv88e6390x_serdes_get_lane(chip, port); 430 - if (lane < 0) 430 + if (lane < 0 && lane != -ENODEV) 431 431 return lane; 432 432 433 - if (chip->ports[port].serdes_irq) { 434 - err = mv88e6390_serdes_irq_disable(chip, port, lane); 433 + if (lane >= 0) { 434 + if (chip->ports[port].serdes_irq) { 435 + err = mv88e6390_serdes_irq_disable(chip, port, lane); 436 + if (err) 437 + return err; 438 + } 439 + 440 + err = mv88e6390x_serdes_power(chip, port, false); 435 441 if (err) 436 442 return err; 437 443 } 438 444 439 - err = mv88e6390x_serdes_power(chip, port, false); 440 - if (err) 441 - return err; 445 + chip->ports[port].cmode = 0; 442 446 443 447 if (cmode) { 444 448 err = mv88e6xxx_port_read(chip, port, MV88E6XXX_PORT_STS, &reg); ··· 456 452 if (err) 457 453 return err; 458 454 455 + chip->ports[port].cmode = cmode; 456 + 457 + lane = mv88e6390x_serdes_get_lane(chip, port); 458 + if (lane < 0) 459 + return lane; 460 + 459 461 err = mv88e6390x_serdes_power(chip, port, true); 460 462 if (err) 461 463 return err; ··· 472 462 return err; 473 463 } 474 464 } 475 - 476 - chip->ports[port].cmode = cmode; 477 465 478 466 return 0; 479 467 }
+12 -8
drivers/net/ethernet/cavium/thunder/nicvf_main.c
··· 1328 1328 struct nicvf_cq_poll *cq_poll = NULL; 1329 1329 union nic_mbx mbx = {}; 1330 1330 1331 - cancel_delayed_work_sync(&nic->link_change_work); 1332 - 1333 1331 /* wait till all queued set_rx_mode tasks completes */ 1334 - drain_workqueue(nic->nicvf_rx_mode_wq); 1332 + if (nic->nicvf_rx_mode_wq) { 1333 + cancel_delayed_work_sync(&nic->link_change_work); 1334 + drain_workqueue(nic->nicvf_rx_mode_wq); 1335 + } 1335 1336 1336 1337 mbx.msg.msg = NIC_MBOX_MSG_SHUTDOWN; 1337 1338 nicvf_send_msg_to_pf(nic, &mbx); ··· 1453 1452 struct nicvf_cq_poll *cq_poll = NULL; 1454 1453 1455 1454 /* wait till all queued set_rx_mode tasks completes if any */ 1456 - drain_workqueue(nic->nicvf_rx_mode_wq); 1455 + if (nic->nicvf_rx_mode_wq) 1456 + drain_workqueue(nic->nicvf_rx_mode_wq); 1457 1457 1458 1458 netif_carrier_off(netdev); 1459 1459 ··· 1552 1550 /* Send VF config done msg to PF */ 1553 1551 nicvf_send_cfg_done(nic); 1554 1552 1555 - INIT_DELAYED_WORK(&nic->link_change_work, 1556 - nicvf_link_status_check_task); 1557 - queue_delayed_work(nic->nicvf_rx_mode_wq, 1558 - &nic->link_change_work, 0); 1553 + if (nic->nicvf_rx_mode_wq) { 1554 + INIT_DELAYED_WORK(&nic->link_change_work, 1555 + nicvf_link_status_check_task); 1556 + queue_delayed_work(nic->nicvf_rx_mode_wq, 1557 + &nic->link_change_work, 0); 1558 + } 1559 1559 1560 1560 return 0; 1561 1561 cleanup:
+14 -16
drivers/net/ethernet/cavium/thunder/nicvf_queues.c
··· 105 105 /* Check if page can be recycled */ 106 106 if (page) { 107 107 ref_count = page_ref_count(page); 108 - /* Check if this page has been used once i.e 'put_page' 109 - * called after packet transmission i.e internal ref_count 110 - * and page's ref_count are equal i.e page can be recycled. 108 + /* This page can be recycled if internal ref_count and page's 109 + * ref_count are equal, indicating that the page has been used 110 + * once for packet transmission. For non-XDP mode, internal 111 + * ref_count is always '1'. 111 112 */ 112 - if (rbdr->is_xdp && (ref_count == pgcache->ref_count)) 113 - pgcache->ref_count--; 114 - else 113 + if (rbdr->is_xdp) { 114 + if (ref_count == pgcache->ref_count) 115 + pgcache->ref_count--; 116 + else 117 + page = NULL; 118 + } else if (ref_count != 1) { 115 119 page = NULL; 116 - 117 - /* In non-XDP mode, page's ref_count needs to be '1' for it 118 - * to be recycled. 119 - */ 120 - if (!rbdr->is_xdp && (ref_count != 1)) 121 - page = NULL; 120 + } 122 121 } 123 122 124 123 if (!page) { ··· 364 365 while (head < rbdr->pgcnt) { 365 366 pgcache = &rbdr->pgcache[head]; 366 367 if (pgcache->page && page_ref_count(pgcache->page) != 0) { 367 - if (!rbdr->is_xdp) { 368 - put_page(pgcache->page); 369 - continue; 368 + if (rbdr->is_xdp) { 369 + page_ref_sub(pgcache->page, 370 + pgcache->ref_count - 1); 370 371 } 371 - page_ref_sub(pgcache->page, pgcache->ref_count - 1); 372 372 put_page(pgcache->page); 373 373 } 374 374 head++;
+8 -1
drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c
··· 354 354 ppmax = max; 355 355 356 356 /* pool size must be multiple of unsigned long */ 357 - bmap = BITS_TO_LONGS(ppmax); 357 + bmap = ppmax / BITS_PER_TYPE(unsigned long); 358 + if (!bmap) 359 + return NULL; 360 + 358 361 ppmax = (bmap * sizeof(unsigned long)) << 3; 359 362 360 363 alloc_sz = sizeof(*pools) + sizeof(unsigned long) * bmap; ··· 405 402 if (reserve_factor) { 406 403 ppmax_pool = ppmax / reserve_factor; 407 404 pool = ppm_alloc_cpu_pool(&ppmax_pool, &pool_index_max); 405 + if (!pool) { 406 + ppmax_pool = 0; 407 + reserve_factor = 0; 408 + } 408 409 409 410 pr_debug("%s: ppmax %u, cpu total %u, per cpu %u.\n", 410 411 ndev->name, ppmax, ppmax_pool, pool_index_max);
+3 -1
drivers/net/ethernet/hisilicon/hns/hnae.c
··· 150 150 /* free desc along with its attached buffer */ 151 151 static void hnae_free_desc(struct hnae_ring *ring) 152 152 { 153 - hnae_free_buffers(ring); 154 153 dma_unmap_single(ring_to_dev(ring), ring->desc_dma_addr, 155 154 ring->desc_num * sizeof(ring->desc[0]), 156 155 ring_to_dma_dir(ring)); ··· 182 183 /* fini ring, also free the buffer for the ring */ 183 184 static void hnae_fini_ring(struct hnae_ring *ring) 184 185 { 186 + if (is_rx_ring(ring)) 187 + hnae_free_buffers(ring); 188 + 185 189 hnae_free_desc(ring); 186 190 kfree(ring->desc_cb); 187 191 ring->desc_cb = NULL;
+1 -1
drivers/net/ethernet/hisilicon/hns/hnae.h
··· 357 357 }; 358 358 359 359 struct hnae_queue { 360 - void __iomem *io_base; 360 + u8 __iomem *io_base; 361 361 phys_addr_t phy_base; 362 362 struct hnae_ae_dev *dev; /* the device who use this queue */ 363 363 struct hnae_ring rx_ring ____cacheline_internodealigned_in_smp;
+1 -1
drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
··· 370 370 static void hns_mac_param_get(struct mac_params *param, 371 371 struct hns_mac_cb *mac_cb) 372 372 { 373 - param->vaddr = (void *)mac_cb->vaddr; 373 + param->vaddr = mac_cb->vaddr; 374 374 param->mac_mode = hns_get_enet_interface(mac_cb); 375 375 ether_addr_copy(param->addr, mac_cb->addr_entry_idx[0].addr); 376 376 param->mac_id = mac_cb->mac_id;
+2 -2
drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h
··· 187 187 /*mac para struct ,mac get param from nic or dsaf when initialize*/ 188 188 struct mac_params { 189 189 char addr[ETH_ALEN]; 190 - void *vaddr; /*virtual address*/ 190 + u8 __iomem *vaddr; /*virtual address*/ 191 191 struct device *dev; 192 192 u8 mac_id; 193 193 /**< Ethernet operation mode (MAC-PHY interface and speed) */ ··· 402 402 enum mac_mode mac_mode; 403 403 u8 mac_id; 404 404 struct hns_mac_cb *mac_cb; 405 - void __iomem *io_base; 405 + u8 __iomem *io_base; 406 406 unsigned int mac_en_flg;/*you'd better don't enable mac twice*/ 407 407 unsigned int virt_dev_num; 408 408 struct device *dev;
+34 -21
drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
··· 1602 1602 DSAF_TBL_TCAM_KEY_VLAN_S, vlan_id); 1603 1603 dsaf_set_field(mac_key->low.bits.port_vlan, DSAF_TBL_TCAM_KEY_PORT_M, 1604 1604 DSAF_TBL_TCAM_KEY_PORT_S, port); 1605 - 1606 - mac_key->low.bits.port_vlan = le16_to_cpu(mac_key->low.bits.port_vlan); 1607 1605 } 1608 1606 1609 1607 /** ··· 1661 1663 /* default config dvc to 0 */ 1662 1664 mac_data.tbl_ucast_dvc = 0; 1663 1665 mac_data.tbl_ucast_out_port = mac_entry->port_num; 1664 - tcam_data.tbl_tcam_data_high = cpu_to_le32(mac_key.high.val); 1665 - tcam_data.tbl_tcam_data_low = cpu_to_le32(mac_key.low.val); 1666 + tcam_data.tbl_tcam_data_high = mac_key.high.val; 1667 + tcam_data.tbl_tcam_data_low = mac_key.low.val; 1666 1668 1667 1669 hns_dsaf_tcam_uc_cfg(dsaf_dev, entry_index, &tcam_data, &mac_data); 1668 1670 ··· 1784 1786 0xff, 1785 1787 mc_mask); 1786 1788 1787 - mask_key.high.val = le32_to_cpu(mask_key.high.val); 1788 - mask_key.low.val = le32_to_cpu(mask_key.low.val); 1789 - 1790 1789 pmask_key = (struct dsaf_tbl_tcam_data *)(&mask_key); 1791 1790 } 1792 1791 ··· 1835 1840 dsaf_dev->ae_dev.name, mac_key.high.val, 1836 1841 mac_key.low.val, entry_index); 1837 1842 1838 - tcam_data.tbl_tcam_data_high = cpu_to_le32(mac_key.high.val); 1839 - tcam_data.tbl_tcam_data_low = cpu_to_le32(mac_key.low.val); 1843 + tcam_data.tbl_tcam_data_high = mac_key.high.val; 1844 + tcam_data.tbl_tcam_data_low = mac_key.low.val; 1840 1845 1841 1846 /* config mc entry with mask */ 1842 1847 hns_dsaf_tcam_mc_cfg(dsaf_dev, entry_index, &tcam_data, ··· 1951 1956 /* config key mask */ 1952 1957 hns_dsaf_set_mac_key(dsaf_dev, &mask_key, 0x00, 0xff, mc_mask); 1953 1958 1954 - mask_key.high.val = le32_to_cpu(mask_key.high.val); 1955 - mask_key.low.val = le32_to_cpu(mask_key.low.val); 1956 - 1957 1959 pmask_key = (struct dsaf_tbl_tcam_data *)(&mask_key); 1958 1960 } 1959 1961 ··· 2004 2012 soft_mac_entry += entry_index; 2005 2013 soft_mac_entry->index = DSAF_INVALID_ENTRY_IDX; 2006 2014 } else { /* not zero, just del port, update */ 2007 - tcam_data.tbl_tcam_data_high = cpu_to_le32(mac_key.high.val); 2008 - tcam_data.tbl_tcam_data_low = cpu_to_le32(mac_key.low.val); 2015 + tcam_data.tbl_tcam_data_high = mac_key.high.val; 2016 + tcam_data.tbl_tcam_data_low = mac_key.low.val; 2009 2017 2010 2018 hns_dsaf_tcam_mc_cfg(dsaf_dev, entry_index, 2011 2019 &tcam_data, ··· 2742 2750 return DSAF_DUMP_REGS_NUM; 2743 2751 } 2744 2752 2753 + static int hns_dsaf_get_port_id(u8 port) 2754 + { 2755 + if (port < DSAF_SERVICE_NW_NUM) 2756 + return port; 2757 + 2758 + if (port >= DSAF_BASE_INNER_PORT_NUM) 2759 + return port - DSAF_BASE_INNER_PORT_NUM + DSAF_SERVICE_NW_NUM; 2760 + 2761 + return -EINVAL; 2762 + } 2763 + 2745 2764 static void set_promisc_tcam_enable(struct dsaf_device *dsaf_dev, u32 port) 2746 2765 { 2747 2766 struct dsaf_tbl_tcam_ucast_cfg tbl_tcam_ucast = {0, 1, 0, 0, 0x80}; ··· 2818 2815 memset(&temp_key, 0x0, sizeof(temp_key)); 2819 2816 mask_entry.addr[0] = 0x01; 2820 2817 hns_dsaf_set_mac_key(dsaf_dev, &mask_key, mask_entry.in_vlan_id, 2821 - port, mask_entry.addr); 2818 + 0xf, mask_entry.addr); 2822 2819 tbl_tcam_mcast.tbl_mcast_item_vld = 1; 2823 2820 tbl_tcam_mcast.tbl_mcast_old_en = 0; 2824 2821 2825 - if (port < DSAF_SERVICE_NW_NUM) { 2826 - mskid = port; 2827 - } else if (port >= DSAF_BASE_INNER_PORT_NUM) { 2828 - mskid = port - DSAF_BASE_INNER_PORT_NUM + DSAF_SERVICE_NW_NUM; 2829 - } else { 2822 + /* set MAC port to handle multicast */ 2823 + mskid = hns_dsaf_get_port_id(port); 2824 + if (mskid == -EINVAL) { 2830 2825 dev_err(dsaf_dev->dev, "%s,pnum(%d)error,key(%#x:%#x)\n", 2831 2826 dsaf_dev->ae_dev.name, port, 2832 2827 mask_key.high.val, mask_key.low.val); 2833 2828 return; 2834 2829 } 2835 - 2836 2830 dsaf_set_bit(tbl_tcam_mcast.tbl_mcast_port_msk[mskid / 32], 2837 2831 mskid % 32, 1); 2832 + 2833 + /* set pool bit map to handle multicast */ 2834 + mskid = hns_dsaf_get_port_id(port_num); 2835 + if (mskid == -EINVAL) { 2836 + dev_err(dsaf_dev->dev, 2837 + "%s, pool bit map pnum(%d)error,key(%#x:%#x)\n", 2838 + dsaf_dev->ae_dev.name, port_num, 2839 + mask_key.high.val, mask_key.low.val); 2840 + return; 2841 + } 2842 + dsaf_set_bit(tbl_tcam_mcast.tbl_mcast_port_msk[mskid / 32], 2843 + mskid % 32, 1); 2844 + 2838 2845 memcpy(&temp_key, &mask_key, sizeof(mask_key)); 2839 2846 hns_dsaf_tcam_mc_cfg_vague(dsaf_dev, entry_index, &tbl_tcam_data_mc, 2840 2847 (struct dsaf_tbl_tcam_data *)(&mask_key),
+2
drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h
··· 467 467 u8 mac_id, u8 port_num); 468 468 int hns_dsaf_wait_pkt_clean(struct dsaf_device *dsaf_dev, int port); 469 469 470 + int hns_dsaf_roce_reset(struct fwnode_handle *dsaf_fwnode, bool dereset); 471 + 470 472 #endif /* __HNS_DSAF_MAIN_H__ */
+1 -1
drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
··· 670 670 dsaf_set_field(origin, 1ull << 10, 10, en); 671 671 dsaf_write_syscon(mac_cb->serdes_ctrl, reg_offset, origin); 672 672 } else { 673 - u8 *base_addr = (u8 *)mac_cb->serdes_vaddr + 673 + u8 __iomem *base_addr = mac_cb->serdes_vaddr + 674 674 (mac_cb->mac_id <= 3 ? 0x00280000 : 0x00200000); 675 675 dsaf_set_reg_field(base_addr, reg_offset, 1ull << 10, 10, en); 676 676 }
+3 -3
drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c
··· 61 61 } 62 62 } 63 63 64 - static void __iomem * 64 + static u8 __iomem * 65 65 hns_ppe_common_get_ioaddr(struct ppe_common_cb *ppe_common) 66 66 { 67 67 return ppe_common->dsaf_dev->ppe_base + PPE_COMMON_REG_OFFSET; ··· 111 111 dsaf_dev->ppe_common[comm_index] = NULL; 112 112 } 113 113 114 - static void __iomem *hns_ppe_get_iobase(struct ppe_common_cb *ppe_common, 115 - int ppe_idx) 114 + static u8 __iomem *hns_ppe_get_iobase(struct ppe_common_cb *ppe_common, 115 + int ppe_idx) 116 116 { 117 117 return ppe_common->dsaf_dev->ppe_base + ppe_idx * PPE_REG_OFFSET; 118 118 }
+2 -2
drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.h
··· 80 80 struct hns_ppe_hw_stats hw_stats; 81 81 82 82 u8 index; /* index in a ppe common device */ 83 - void __iomem *io_base; 83 + u8 __iomem *io_base; 84 84 int virq; 85 85 u32 rss_indir_table[HNS_PPEV2_RSS_IND_TBL_SIZE]; /*shadow indir tab */ 86 86 u32 rss_key[HNS_PPEV2_RSS_KEY_NUM]; /* rss hash key */ ··· 89 89 struct ppe_common_cb { 90 90 struct device *dev; 91 91 struct dsaf_device *dsaf_dev; 92 - void __iomem *io_base; 92 + u8 __iomem *io_base; 93 93 94 94 enum ppe_common_mode ppe_mode; 95 95
+2 -2
drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c
··· 458 458 mdnum_ppkt = HNS_RCB_RING_MAX_BD_PER_PKT; 459 459 } else { 460 460 ring = &q->tx_ring; 461 - ring->io_base = (u8 __iomem *)ring_pair_cb->q.io_base + 461 + ring->io_base = ring_pair_cb->q.io_base + 462 462 HNS_RCB_TX_REG_OFFSET; 463 463 irq_idx = HNS_RCB_IRQ_IDX_TX; 464 464 mdnum_ppkt = is_ver1 ? HNS_RCB_RING_MAX_TXBD_PER_PKT : ··· 764 764 } 765 765 } 766 766 767 - static void __iomem *hns_rcb_common_get_vaddr(struct rcb_common_cb *rcb_common) 767 + static u8 __iomem *hns_rcb_common_get_vaddr(struct rcb_common_cb *rcb_common) 768 768 { 769 769 struct dsaf_device *dsaf_dev = rcb_common->dsaf_dev; 770 770
+6 -6
drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
··· 1018 1018 #define XGMAC_PAUSE_CTL_RSP_MODE_B 2 1019 1019 #define XGMAC_PAUSE_CTL_TX_XOFF_B 3 1020 1020 1021 - static inline void dsaf_write_reg(void __iomem *base, u32 reg, u32 value) 1021 + static inline void dsaf_write_reg(u8 __iomem *base, u32 reg, u32 value) 1022 1022 { 1023 1023 writel(value, base + reg); 1024 1024 } ··· 1053 1053 #define dsaf_set_bit(origin, shift, val) \ 1054 1054 dsaf_set_field((origin), (1ull << (shift)), (shift), (val)) 1055 1055 1056 - static inline void dsaf_set_reg_field(void __iomem *base, u32 reg, u32 mask, 1056 + static inline void dsaf_set_reg_field(u8 __iomem *base, u32 reg, u32 mask, 1057 1057 u32 shift, u32 val) 1058 1058 { 1059 1059 u32 origin = dsaf_read_reg(base, reg); ··· 1073 1073 #define dsaf_get_bit(origin, shift) \ 1074 1074 dsaf_get_field((origin), (1ull << (shift)), (shift)) 1075 1075 1076 - static inline u32 dsaf_get_reg_field(void __iomem *base, u32 reg, u32 mask, 1076 + static inline u32 dsaf_get_reg_field(u8 __iomem *base, u32 reg, u32 mask, 1077 1077 u32 shift) 1078 1078 { 1079 1079 u32 origin; ··· 1089 1089 dsaf_get_reg_field((dev)->io_base, (reg), (1ull << (bit)), (bit)) 1090 1090 1091 1091 #define dsaf_write_b(addr, data)\ 1092 - writeb((data), (__iomem unsigned char *)(addr)) 1092 + writeb((data), (__iomem u8 *)(addr)) 1093 1093 #define dsaf_read_b(addr)\ 1094 - readb((__iomem unsigned char *)(addr)) 1094 + readb((__iomem u8 *)(addr)) 1095 1095 1096 1096 #define hns_mac_reg_read64(drv, offset) \ 1097 - readq((__iomem void *)(((u8 *)(drv)->io_base + 0xc00 + (offset)))) 1097 + readq((__iomem void *)(((drv)->io_base + 0xc00 + (offset)))) 1098 1098 1099 1099 #endif /* _DSAF_REG_H */
+1 -1
drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c
··· 129 129 dsaf_set_bit(val, XGMAC_UNIDIR_EN_B, 0); 130 130 dsaf_set_bit(val, XGMAC_RF_TX_EN_B, 1); 131 131 dsaf_set_field(val, XGMAC_LF_RF_INSERT_M, XGMAC_LF_RF_INSERT_S, 0); 132 - dsaf_write_reg(mac_drv, XGMAC_MAC_TX_LF_RF_CONTROL_REG, val); 132 + dsaf_write_dev(mac_drv, XGMAC_MAC_TX_LF_RF_CONTROL_REG, val); 133 133 } 134 134 135 135 /**
+5 -7
drivers/net/ethernet/hisilicon/hns/hns_enet.c
··· 29 29 30 30 #define SERVICE_TIMER_HZ (1 * HZ) 31 31 32 - #define NIC_TX_CLEAN_MAX_NUM 256 33 - #define NIC_RX_CLEAN_MAX_NUM 64 34 - 35 32 #define RCB_IRQ_NOT_INITED 0 36 33 #define RCB_IRQ_INITED 1 37 34 #define HNS_BUFFER_SIZE_2048 2048 ··· 373 376 wmb(); /* commit all data before submit */ 374 377 assert(skb->queue_mapping < priv->ae_handle->q_num); 375 378 hnae_queue_xmit(priv->ae_handle->qs[skb->queue_mapping], buf_num); 376 - ring->stats.tx_pkts++; 377 - ring->stats.tx_bytes += skb->len; 378 379 379 380 return NETDEV_TX_OK; 380 381 ··· 994 999 /* issue prefetch for next Tx descriptor */ 995 1000 prefetch(&ring->desc_cb[ring->next_to_clean]); 996 1001 } 1002 + /* update tx ring statistics. */ 1003 + ring->stats.tx_pkts += pkts; 1004 + ring->stats.tx_bytes += bytes; 997 1005 998 1006 NETIF_TX_UNLOCK(ring); 999 1007 ··· 2150 2152 hns_nic_tx_fini_pro_v2; 2151 2153 2152 2154 netif_napi_add(priv->netdev, &rd->napi, 2153 - hns_nic_common_poll, NIC_TX_CLEAN_MAX_NUM); 2155 + hns_nic_common_poll, NAPI_POLL_WEIGHT); 2154 2156 rd->ring->irq_init_flag = RCB_IRQ_NOT_INITED; 2155 2157 } 2156 2158 for (i = h->q_num; i < h->q_num * 2; i++) { ··· 2163 2165 hns_nic_rx_fini_pro_v2; 2164 2166 2165 2167 netif_napi_add(priv->netdev, &rd->napi, 2166 - hns_nic_common_poll, NIC_RX_CLEAN_MAX_NUM); 2168 + hns_nic_common_poll, NAPI_POLL_WEIGHT); 2167 2169 rd->ring->irq_init_flag = RCB_IRQ_NOT_INITED; 2168 2170 } 2169 2171
+1 -1
drivers/net/ethernet/hisilicon/hns3/hns3pf/Makefile
··· 3 3 # Makefile for the HISILICON network device drivers. 4 4 # 5 5 6 - ccflags-y := -Idrivers/net/ethernet/hisilicon/hns3 6 + ccflags-y := -I $(srctree)/drivers/net/ethernet/hisilicon/hns3 7 7 8 8 obj-$(CONFIG_HNS3_HCLGE) += hclge.o 9 9 hclge-objs = hclge_main.o hclge_cmd.o hclge_mdio.o hclge_tm.o hclge_mbx.o hclge_err.o hclge_debugfs.o
+1 -1
drivers/net/ethernet/hisilicon/hns3/hns3vf/Makefile
··· 3 3 # Makefile for the HISILICON network device drivers. 4 4 # 5 5 6 - ccflags-y := -Idrivers/net/ethernet/hisilicon/hns3 6 + ccflags-y := -I $(srctree)/drivers/net/ethernet/hisilicon/hns3 7 7 8 8 obj-$(CONFIG_HNS3_HCLGEVF) += hclgevf.o 9 9 hclgevf-objs = hclgevf_main.o hclgevf_cmd.o hclgevf_mbx.o
+7 -11
drivers/net/ethernet/hisilicon/hns_mdio.c
··· 39 39 }; 40 40 41 41 struct hns_mdio_device { 42 - void *vbase; /* mdio reg base address */ 42 + u8 __iomem *vbase; /* mdio reg base address */ 43 43 struct regmap *subctrl_vbase; 44 44 struct hns_mdio_sc_reg sc_reg; 45 45 }; ··· 96 96 #define MDIO_SC_CLK_ST 0x531C 97 97 #define MDIO_SC_RESET_ST 0x5A1C 98 98 99 - static void mdio_write_reg(void *base, u32 reg, u32 value) 99 + static void mdio_write_reg(u8 __iomem *base, u32 reg, u32 value) 100 100 { 101 - u8 __iomem *reg_addr = (u8 __iomem *)base; 102 - 103 - writel_relaxed(value, reg_addr + reg); 101 + writel_relaxed(value, base + reg); 104 102 } 105 103 106 104 #define MDIO_WRITE_REG(a, reg, value) \ 107 105 mdio_write_reg((a)->vbase, (reg), (value)) 108 106 109 - static u32 mdio_read_reg(void *base, u32 reg) 107 + static u32 mdio_read_reg(u8 __iomem *base, u32 reg) 110 108 { 111 - u8 __iomem *reg_addr = (u8 __iomem *)base; 112 - 113 - return readl_relaxed(reg_addr + reg); 109 + return readl_relaxed(base + reg); 114 110 } 115 111 116 112 #define mdio_set_field(origin, mask, shift, val) \ ··· 117 121 118 122 #define mdio_get_field(origin, mask, shift) (((origin) >> (shift)) & (mask)) 119 123 120 - static void mdio_set_reg_field(void *base, u32 reg, u32 mask, u32 shift, 124 + static void mdio_set_reg_field(u8 __iomem *base, u32 reg, u32 mask, u32 shift, 121 125 u32 val) 122 126 { 123 127 u32 origin = mdio_read_reg(base, reg); ··· 129 133 #define MDIO_SET_REG_FIELD(dev, reg, mask, shift, val) \ 130 134 mdio_set_reg_field((dev)->vbase, (reg), (mask), (shift), (val)) 131 135 132 - static u32 mdio_get_reg_field(void *base, u32 reg, u32 mask, u32 shift) 136 + static u32 mdio_get_reg_field(u8 __iomem *base, u32 reg, u32 mask, u32 shift) 133 137 { 134 138 u32 origin; 135 139
+3 -2
drivers/net/ethernet/ibm/ibmvnic.c
··· 1885 1885 */ 1886 1886 adapter->state = VNIC_PROBED; 1887 1887 1888 + reinit_completion(&adapter->init_done); 1888 1889 rc = init_crq_queue(adapter); 1889 1890 if (rc) { 1890 1891 netdev_err(adapter->netdev, ··· 4626 4625 old_num_rx_queues = adapter->req_rx_queues; 4627 4626 old_num_tx_queues = adapter->req_tx_queues; 4628 4627 4629 - init_completion(&adapter->init_done); 4628 + reinit_completion(&adapter->init_done); 4630 4629 adapter->init_done_rc = 0; 4631 4630 ibmvnic_send_crq_init(adapter); 4632 4631 if (!wait_for_completion_timeout(&adapter->init_done, timeout)) { ··· 4681 4680 4682 4681 adapter->from_passive_init = false; 4683 4682 4684 - init_completion(&adapter->init_done); 4685 4683 adapter->init_done_rc = 0; 4686 4684 ibmvnic_send_crq_init(adapter); 4687 4685 if (!wait_for_completion_timeout(&adapter->init_done, timeout)) { ··· 4759 4759 INIT_WORK(&adapter->ibmvnic_reset, __ibmvnic_reset); 4760 4760 INIT_LIST_HEAD(&adapter->rwi_list); 4761 4761 spin_lock_init(&adapter->rwi_lock); 4762 + init_completion(&adapter->init_done); 4762 4763 adapter->resetting = false; 4763 4764 4764 4765 adapter->mac_change_pending = false;
+2
drivers/net/ethernet/intel/fm10k/fm10k_main.c
··· 41 41 /* create driver workqueue */ 42 42 fm10k_workqueue = alloc_workqueue("%s", WQ_MEM_RECLAIM, 0, 43 43 fm10k_driver_name); 44 + if (!fm10k_workqueue) 45 + return -ENOMEM; 44 46 45 47 fm10k_dbg_init(); 46 48
+2 -14
drivers/net/ethernet/intel/i40e/i40e.h
··· 790 790 791 791 /* VSI specific handlers */ 792 792 irqreturn_t (*irq_handler)(int irq, void *data); 793 + 794 + unsigned long *af_xdp_zc_qps; /* tracks AF_XDP ZC enabled qps */ 793 795 } ____cacheline_internodealigned_in_smp; 794 796 795 797 struct i40e_netdev_priv { ··· 1096 1094 static inline bool i40e_enabled_xdp_vsi(struct i40e_vsi *vsi) 1097 1095 { 1098 1096 return !!vsi->xdp_prog; 1099 - } 1100 - 1101 - static inline struct xdp_umem *i40e_xsk_umem(struct i40e_ring *ring) 1102 - { 1103 - bool xdp_on = i40e_enabled_xdp_vsi(ring->vsi); 1104 - int qid = ring->queue_index; 1105 - 1106 - if (ring_is_xdp(ring)) 1107 - qid -= ring->vsi->alloc_queue_pairs; 1108 - 1109 - if (!xdp_on) 1110 - return NULL; 1111 - 1112 - return xdp_get_umem_from_qid(ring->vsi->netdev, qid); 1113 1097 } 1114 1098 1115 1099 int i40e_create_queue_channel(struct i40e_vsi *vsi, struct i40e_channel *ch);
+1 -2
drivers/net/ethernet/intel/i40e/i40e_ethtool.c
··· 2573 2573 return -EOPNOTSUPP; 2574 2574 2575 2575 /* only magic packet is supported */ 2576 - if (wol->wolopts && (wol->wolopts != WAKE_MAGIC) 2577 - | (wol->wolopts != WAKE_FILTER)) 2576 + if (wol->wolopts & ~WAKE_MAGIC) 2578 2577 return -EOPNOTSUPP; 2579 2578 2580 2579 /* is this a new value? */
+28
drivers/net/ethernet/intel/i40e/i40e_main.c
··· 3064 3064 } 3065 3065 3066 3066 /** 3067 + * i40e_xsk_umem - Retrieve the AF_XDP ZC if XDP and ZC is enabled 3068 + * @ring: The Tx or Rx ring 3069 + * 3070 + * Returns the UMEM or NULL. 3071 + **/ 3072 + static struct xdp_umem *i40e_xsk_umem(struct i40e_ring *ring) 3073 + { 3074 + bool xdp_on = i40e_enabled_xdp_vsi(ring->vsi); 3075 + int qid = ring->queue_index; 3076 + 3077 + if (ring_is_xdp(ring)) 3078 + qid -= ring->vsi->alloc_queue_pairs; 3079 + 3080 + if (!xdp_on || !test_bit(qid, ring->vsi->af_xdp_zc_qps)) 3081 + return NULL; 3082 + 3083 + return xdp_get_umem_from_qid(ring->vsi->netdev, qid); 3084 + } 3085 + 3086 + /** 3067 3087 * i40e_configure_tx_ring - Configure a transmit ring context and rest 3068 3088 * @ring: The Tx ring to configure 3069 3089 * ··· 10084 10064 hash_init(vsi->mac_filter_hash); 10085 10065 vsi->irqs_ready = false; 10086 10066 10067 + if (type == I40E_VSI_MAIN) { 10068 + vsi->af_xdp_zc_qps = bitmap_zalloc(pf->num_lan_qps, GFP_KERNEL); 10069 + if (!vsi->af_xdp_zc_qps) 10070 + goto err_rings; 10071 + } 10072 + 10087 10073 ret = i40e_set_num_rings_in_vsi(vsi); 10088 10074 if (ret) 10089 10075 goto err_rings; ··· 10108 10082 goto unlock_pf; 10109 10083 10110 10084 err_rings: 10085 + bitmap_free(vsi->af_xdp_zc_qps); 10111 10086 pf->next_vsi = i - 1; 10112 10087 kfree(vsi); 10113 10088 unlock_pf: ··· 10189 10162 i40e_put_lump(pf->qp_pile, vsi->base_queue, vsi->idx); 10190 10163 i40e_put_lump(pf->irq_pile, vsi->base_vector, vsi->idx); 10191 10164 10165 + bitmap_free(vsi->af_xdp_zc_qps); 10192 10166 i40e_vsi_free_arrays(vsi, true); 10193 10167 i40e_clear_rss_config_user(vsi); 10194 10168
+3 -2
drivers/net/ethernet/intel/i40e/i40e_ptp.c
··· 146 146 static int i40e_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta) 147 147 { 148 148 struct i40e_pf *pf = container_of(ptp, struct i40e_pf, ptp_caps); 149 - struct timespec64 now; 149 + struct timespec64 now, then; 150 150 151 + then = ns_to_timespec64(delta); 151 152 mutex_lock(&pf->tmreg_lock); 152 153 153 154 i40e_ptp_read(pf, &now, NULL); 154 - timespec64_add_ns(&now, delta); 155 + now = timespec64_add(now, then); 155 156 i40e_ptp_write(pf, (const struct timespec64 *)&now); 156 157 157 158 mutex_unlock(&pf->tmreg_lock);
+3
drivers/net/ethernet/intel/i40e/i40e_xsk.c
··· 102 102 if (err) 103 103 return err; 104 104 105 + set_bit(qid, vsi->af_xdp_zc_qps); 106 + 105 107 if_running = netif_running(vsi->netdev) && i40e_enabled_xdp_vsi(vsi); 106 108 107 109 if (if_running) { ··· 150 148 return err; 151 149 } 152 150 151 + clear_bit(qid, vsi->af_xdp_zc_qps); 153 152 i40e_xsk_umem_dma_unmap(vsi, umem); 154 153 155 154 if (if_running) {
+2
drivers/net/ethernet/intel/igb/e1000_defines.h
··· 194 194 /* enable link status from external LINK_0 and LINK_1 pins */ 195 195 #define E1000_CTRL_SWDPIN0 0x00040000 /* SWDPIN 0 value */ 196 196 #define E1000_CTRL_SWDPIN1 0x00080000 /* SWDPIN 1 value */ 197 + #define E1000_CTRL_ADVD3WUC 0x00100000 /* D3 WUC */ 198 + #define E1000_CTRL_EN_PHY_PWR_MGMT 0x00200000 /* PHY PM enable */ 197 199 #define E1000_CTRL_SDP0_DIR 0x00400000 /* SDP0 Data direction */ 198 200 #define E1000_CTRL_SDP1_DIR 0x00800000 /* SDP1 Data direction */ 199 201 #define E1000_CTRL_RST 0x04000000 /* Global reset */
+8 -49
drivers/net/ethernet/intel/igb/igb_main.c
··· 8740 8740 struct e1000_hw *hw = &adapter->hw; 8741 8741 u32 ctrl, rctl, status; 8742 8742 u32 wufc = runtime ? E1000_WUFC_LNKC : adapter->wol; 8743 - #ifdef CONFIG_PM 8744 - int retval = 0; 8745 - #endif 8743 + bool wake; 8746 8744 8747 8745 rtnl_lock(); 8748 8746 netif_device_detach(netdev); ··· 8752 8754 8753 8755 igb_clear_interrupt_scheme(adapter); 8754 8756 rtnl_unlock(); 8755 - 8756 - #ifdef CONFIG_PM 8757 - if (!runtime) { 8758 - retval = pci_save_state(pdev); 8759 - if (retval) 8760 - return retval; 8761 - } 8762 - #endif 8763 8757 8764 8758 status = rd32(E1000_STATUS); 8765 8759 if (status & E1000_STATUS_LU) ··· 8769 8779 } 8770 8780 8771 8781 ctrl = rd32(E1000_CTRL); 8772 - /* advertise wake from D3Cold */ 8773 - #define E1000_CTRL_ADVD3WUC 0x00100000 8774 - /* phy power management enable */ 8775 - #define E1000_CTRL_EN_PHY_PWR_MGMT 0x00200000 8776 8782 ctrl |= E1000_CTRL_ADVD3WUC; 8777 8783 wr32(E1000_CTRL, ctrl); 8778 8784 ··· 8782 8796 wr32(E1000_WUFC, 0); 8783 8797 } 8784 8798 8785 - *enable_wake = wufc || adapter->en_mng_pt; 8786 - if (!*enable_wake) 8799 + wake = wufc || adapter->en_mng_pt; 8800 + if (!wake) 8787 8801 igb_power_down_link(adapter); 8788 8802 else 8789 8803 igb_power_up_link(adapter); 8804 + 8805 + if (enable_wake) 8806 + *enable_wake = wake; 8790 8807 8791 8808 /* Release control of h/w to f/w. If f/w is AMT enabled, this 8792 8809 * would have already happened in close and is redundant. ··· 8833 8844 8834 8845 static int __maybe_unused igb_suspend(struct device *dev) 8835 8846 { 8836 - int retval; 8837 - bool wake; 8838 - struct pci_dev *pdev = to_pci_dev(dev); 8839 - 8840 - retval = __igb_shutdown(pdev, &wake, 0); 8841 - if (retval) 8842 - return retval; 8843 - 8844 - if (wake) { 8845 - pci_prepare_to_sleep(pdev); 8846 - } else { 8847 - pci_wake_from_d3(pdev, false); 8848 - pci_set_power_state(pdev, PCI_D3hot); 8849 - } 8850 - 8851 - return 0; 8847 + return __igb_shutdown(to_pci_dev(dev), NULL, 0); 8852 8848 } 8853 8849 8854 8850 static int __maybe_unused igb_resume(struct device *dev) ··· 8904 8930 8905 8931 static int __maybe_unused igb_runtime_suspend(struct device *dev) 8906 8932 { 8907 - struct pci_dev *pdev = to_pci_dev(dev); 8908 - int retval; 8909 - bool wake; 8910 - 8911 - retval = __igb_shutdown(pdev, &wake, 1); 8912 - if (retval) 8913 - return retval; 8914 - 8915 - if (wake) { 8916 - pci_prepare_to_sleep(pdev); 8917 - } else { 8918 - pci_wake_from_d3(pdev, false); 8919 - pci_set_power_state(pdev, PCI_D3hot); 8920 - } 8921 - 8922 - return 0; 8933 + return __igb_shutdown(to_pci_dev(dev), NULL, 1); 8923 8934 } 8924 8935 8925 8936 static int __maybe_unused igb_runtime_resume(struct device *dev)
+9 -7
drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
··· 905 905 struct pci_dev *pdev = adapter->pdev; 906 906 struct device *dev = &adapter->netdev->dev; 907 907 struct mii_bus *bus; 908 + int err = -ENODEV; 908 909 909 - adapter->mii_bus = devm_mdiobus_alloc(dev); 910 - if (!adapter->mii_bus) 910 + bus = devm_mdiobus_alloc(dev); 911 + if (!bus) 911 912 return -ENOMEM; 912 - 913 - bus = adapter->mii_bus; 914 913 915 914 switch (hw->device_id) { 916 915 /* C3000 SoCs */ ··· 948 949 */ 949 950 hw->phy.mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_SUPPORTS_C22; 950 951 951 - return mdiobus_register(bus); 952 + err = mdiobus_register(bus); 953 + if (!err) { 954 + adapter->mii_bus = bus; 955 + return 0; 956 + } 952 957 953 958 ixgbe_no_mii_bus: 954 959 devm_mdiobus_free(dev, bus); 955 - adapter->mii_bus = NULL; 956 - return -ENODEV; 960 + return err; 957 961 } 958 962 959 963 /**
-3
drivers/net/ethernet/mellanox/mlx5/core/en/port.c
··· 96 96 if (!eproto) 97 97 return -EINVAL; 98 98 99 - if (ext != MLX5_CAP_PCAM_FEATURE(dev, ptys_extended_ethernet)) 100 - return -EOPNOTSUPP; 101 - 102 99 err = mlx5_query_port_ptys(dev, out, sizeof(out), MLX5_PTYS_EN, port); 103 100 if (err) 104 101 return err;
+22 -17
drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c
··· 122 122 return err; 123 123 } 124 124 125 - /* xoff = ((301+2.16 * len [m]) * speed [Gbps] + 2.72 MTU [B]) */ 125 + /* xoff = ((301+2.16 * len [m]) * speed [Gbps] + 2.72 MTU [B]) 126 + * minimum speed value is 40Gbps 127 + */ 126 128 static u32 calculate_xoff(struct mlx5e_priv *priv, unsigned int mtu) 127 129 { 128 130 u32 speed; ··· 132 130 int err; 133 131 134 132 err = mlx5e_port_linkspeed(priv->mdev, &speed); 135 - if (err) { 136 - mlx5_core_warn(priv->mdev, "cannot get port speed\n"); 137 - return 0; 138 - } 133 + if (err) 134 + speed = SPEED_40000; 135 + speed = max_t(u32, speed, SPEED_40000); 139 136 140 137 xoff = (301 + 216 * priv->dcbx.cable_len / 100) * speed / 1000 + 272 * mtu / 100; 141 138 ··· 143 142 } 144 143 145 144 static int update_xoff_threshold(struct mlx5e_port_buffer *port_buffer, 146 - u32 xoff, unsigned int mtu) 145 + u32 xoff, unsigned int max_mtu) 147 146 { 148 147 int i; 149 148 ··· 155 154 } 156 155 157 156 if (port_buffer->buffer[i].size < 158 - (xoff + mtu + (1 << MLX5E_BUFFER_CELL_SHIFT))) 157 + (xoff + max_mtu + (1 << MLX5E_BUFFER_CELL_SHIFT))) 159 158 return -ENOMEM; 160 159 161 160 port_buffer->buffer[i].xoff = port_buffer->buffer[i].size - xoff; 162 - port_buffer->buffer[i].xon = port_buffer->buffer[i].xoff - mtu; 161 + port_buffer->buffer[i].xon = 162 + port_buffer->buffer[i].xoff - max_mtu; 163 163 } 164 164 165 165 return 0; ··· 168 166 169 167 /** 170 168 * update_buffer_lossy() 171 - * mtu: device's MTU 169 + * max_mtu: netdev's max_mtu 172 170 * pfc_en: <input> current pfc configuration 173 171 * buffer: <input> current prio to buffer mapping 174 172 * xoff: <input> xoff value ··· 185 183 * Return 0 if no error. 186 184 * Set change to true if buffer configuration is modified. 187 185 */ 188 - static int update_buffer_lossy(unsigned int mtu, 186 + static int update_buffer_lossy(unsigned int max_mtu, 189 187 u8 pfc_en, u8 *buffer, u32 xoff, 190 188 struct mlx5e_port_buffer *port_buffer, 191 189 bool *change) ··· 222 220 } 223 221 224 222 if (changed) { 225 - err = update_xoff_threshold(port_buffer, xoff, mtu); 223 + err = update_xoff_threshold(port_buffer, xoff, max_mtu); 226 224 if (err) 227 225 return err; 228 226 ··· 232 230 return 0; 233 231 } 234 232 233 + #define MINIMUM_MAX_MTU 9216 235 234 int mlx5e_port_manual_buffer_config(struct mlx5e_priv *priv, 236 235 u32 change, unsigned int mtu, 237 236 struct ieee_pfc *pfc, ··· 244 241 bool update_prio2buffer = false; 245 242 u8 buffer[MLX5E_MAX_PRIORITY]; 246 243 bool update_buffer = false; 244 + unsigned int max_mtu; 247 245 u32 total_used = 0; 248 246 u8 curr_pfc_en; 249 247 int err; 250 248 int i; 251 249 252 250 mlx5e_dbg(HW, priv, "%s: change=%x\n", __func__, change); 251 + max_mtu = max_t(unsigned int, priv->netdev->max_mtu, MINIMUM_MAX_MTU); 253 252 254 253 err = mlx5e_port_query_buffer(priv, &port_buffer); 255 254 if (err) ··· 259 254 260 255 if (change & MLX5E_PORT_BUFFER_CABLE_LEN) { 261 256 update_buffer = true; 262 - err = update_xoff_threshold(&port_buffer, xoff, mtu); 257 + err = update_xoff_threshold(&port_buffer, xoff, max_mtu); 263 258 if (err) 264 259 return err; 265 260 } ··· 269 264 if (err) 270 265 return err; 271 266 272 - err = update_buffer_lossy(mtu, pfc->pfc_en, buffer, xoff, 267 + err = update_buffer_lossy(max_mtu, pfc->pfc_en, buffer, xoff, 273 268 &port_buffer, &update_buffer); 274 269 if (err) 275 270 return err; ··· 281 276 if (err) 282 277 return err; 283 278 284 - err = update_buffer_lossy(mtu, curr_pfc_en, prio2buffer, xoff, 285 - &port_buffer, &update_buffer); 279 + err = update_buffer_lossy(max_mtu, curr_pfc_en, prio2buffer, 280 + xoff, &port_buffer, &update_buffer); 286 281 if (err) 287 282 return err; 288 283 } ··· 306 301 return -EINVAL; 307 302 308 303 update_buffer = true; 309 - err = update_xoff_threshold(&port_buffer, xoff, mtu); 304 + err = update_xoff_threshold(&port_buffer, xoff, max_mtu); 310 305 if (err) 311 306 return err; 312 307 } ··· 314 309 /* Need to update buffer configuration if xoff value is changed */ 315 310 if (!update_buffer && xoff != priv->dcbx.xoff) { 316 311 update_buffer = true; 317 - err = update_xoff_threshold(&port_buffer, xoff, mtu); 312 + err = update_xoff_threshold(&port_buffer, xoff, max_mtu); 318 313 if (err) 319 314 return err; 320 315 }
+11 -2
drivers/net/ethernet/mellanox/mlx5/core/en_common.c
··· 45 45 if (err) 46 46 return err; 47 47 48 + mutex_lock(&mdev->mlx5e_res.td.list_lock); 48 49 list_add(&tir->list, &mdev->mlx5e_res.td.tirs_list); 50 + mutex_unlock(&mdev->mlx5e_res.td.list_lock); 49 51 50 52 return 0; 51 53 } ··· 55 53 void mlx5e_destroy_tir(struct mlx5_core_dev *mdev, 56 54 struct mlx5e_tir *tir) 57 55 { 56 + mutex_lock(&mdev->mlx5e_res.td.list_lock); 58 57 mlx5_core_destroy_tir(mdev, tir->tirn); 59 58 list_del(&tir->list); 59 + mutex_unlock(&mdev->mlx5e_res.td.list_lock); 60 60 } 61 61 62 62 static int mlx5e_create_mkey(struct mlx5_core_dev *mdev, u32 pdn, ··· 118 114 } 119 115 120 116 INIT_LIST_HEAD(&mdev->mlx5e_res.td.tirs_list); 117 + mutex_init(&mdev->mlx5e_res.td.list_lock); 121 118 122 119 return 0; 123 120 ··· 146 141 { 147 142 struct mlx5_core_dev *mdev = priv->mdev; 148 143 struct mlx5e_tir *tir; 149 - int err = -ENOMEM; 144 + int err = 0; 150 145 u32 tirn = 0; 151 146 int inlen; 152 147 void *in; 153 148 154 149 inlen = MLX5_ST_SZ_BYTES(modify_tir_in); 155 150 in = kvzalloc(inlen, GFP_KERNEL); 156 - if (!in) 151 + if (!in) { 152 + err = -ENOMEM; 157 153 goto out; 154 + } 158 155 159 156 if (enable_uc_lb) 160 157 MLX5_SET(modify_tir_in, in, ctx.self_lb_block, ··· 164 157 165 158 MLX5_SET(modify_tir_in, in, bitmask.self_lb_en, 1); 166 159 160 + mutex_lock(&mdev->mlx5e_res.td.list_lock); 167 161 list_for_each_entry(tir, &mdev->mlx5e_res.td.tirs_list, list) { 168 162 tirn = tir->tirn; 169 163 err = mlx5_core_modify_tir(mdev, tirn, in, inlen); ··· 176 168 kvfree(in); 177 169 if (err) 178 170 netdev_err(priv->netdev, "refresh tir(0x%x) failed, %d\n", tirn, err); 171 + mutex_unlock(&mdev->mlx5e_res.td.list_lock); 179 172 180 173 return err; 181 174 }
+34 -18
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
··· 603 603 __ETHTOOL_LINK_MODE_MASK_NBITS); 604 604 } 605 605 606 - static void ptys2ethtool_adver_link(struct mlx5_core_dev *mdev, 607 - unsigned long *advertising_modes, 608 - u32 eth_proto_cap) 606 + static void ptys2ethtool_adver_link(unsigned long *advertising_modes, 607 + u32 eth_proto_cap, bool ext) 609 608 { 610 609 unsigned long proto_cap = eth_proto_cap; 611 610 struct ptys2ethtool_config *table; 612 611 u32 max_size; 613 612 int proto; 614 613 615 - mlx5e_ethtool_get_speed_arr(mdev, &table, &max_size); 614 + table = ext ? ptys2ext_ethtool_table : ptys2legacy_ethtool_table; 615 + max_size = ext ? ARRAY_SIZE(ptys2ext_ethtool_table) : 616 + ARRAY_SIZE(ptys2legacy_ethtool_table); 617 + 616 618 for_each_set_bit(proto, &proto_cap, max_size) 617 619 bitmap_or(advertising_modes, advertising_modes, 618 620 table[proto].advertised, ··· 796 794 ethtool_link_ksettings_add_link_mode(link_ksettings, supported, Pause); 797 795 } 798 796 799 - static void get_advertising(struct mlx5_core_dev *mdev, u32 eth_proto_cap, 800 - u8 tx_pause, u8 rx_pause, 801 - struct ethtool_link_ksettings *link_ksettings) 797 + static void get_advertising(u32 eth_proto_cap, u8 tx_pause, u8 rx_pause, 798 + struct ethtool_link_ksettings *link_ksettings, 799 + bool ext) 802 800 { 803 801 unsigned long *advertising = link_ksettings->link_modes.advertising; 804 - ptys2ethtool_adver_link(mdev, advertising, eth_proto_cap); 802 + ptys2ethtool_adver_link(advertising, eth_proto_cap, ext); 805 803 806 804 if (rx_pause) 807 805 ethtool_link_ksettings_add_link_mode(link_ksettings, advertising, Pause); ··· 856 854 struct ethtool_link_ksettings *link_ksettings) 857 855 { 858 856 unsigned long *lp_advertising = link_ksettings->link_modes.lp_advertising; 857 + bool ext = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet); 859 858 860 - ptys2ethtool_adver_link(mdev, lp_advertising, eth_proto_lp); 859 + ptys2ethtool_adver_link(lp_advertising, eth_proto_lp, ext); 861 860 } 862 861 863 862 int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv, ··· 875 872 u8 an_disable_admin; 876 873 u8 an_status; 877 874 u8 connector_type; 875 + bool admin_ext; 878 876 bool ext; 879 877 int err; 880 878 ··· 890 886 eth_proto_capability); 891 887 eth_proto_admin = MLX5_GET_ETH_PROTO(ptys_reg, out, ext, 892 888 eth_proto_admin); 889 + /* Fields: eth_proto_admin and ext_eth_proto_admin are 890 + * mutually exclusive. Hence try reading legacy advertising 891 + * when extended advertising is zero. 892 + * admin_ext indicates how eth_proto_admin should be 893 + * interpreted 894 + */ 895 + admin_ext = ext; 896 + if (ext && !eth_proto_admin) { 897 + eth_proto_admin = MLX5_GET_ETH_PROTO(ptys_reg, out, false, 898 + eth_proto_admin); 899 + admin_ext = false; 900 + } 901 + 893 902 eth_proto_oper = MLX5_GET_ETH_PROTO(ptys_reg, out, ext, 894 903 eth_proto_oper); 895 904 eth_proto_lp = MLX5_GET(ptys_reg, out, eth_proto_lp_advertise); ··· 916 899 ethtool_link_ksettings_zero_link_mode(link_ksettings, advertising); 917 900 918 901 get_supported(mdev, eth_proto_cap, link_ksettings); 919 - get_advertising(mdev, eth_proto_admin, tx_pause, rx_pause, link_ksettings); 902 + get_advertising(eth_proto_admin, tx_pause, rx_pause, link_ksettings, 903 + admin_ext); 920 904 get_speed_duplex(priv->netdev, eth_proto_oper, link_ksettings); 921 905 922 906 eth_proto_oper = eth_proto_oper ? eth_proto_oper : eth_proto_cap; ··· 1015 997 1016 998 #define MLX5E_PTYS_EXT ((1ULL << ETHTOOL_LINK_MODE_50000baseKR_Full_BIT) - 1) 1017 999 1018 - ext_requested = (link_ksettings->link_modes.advertising[0] > 1019 - MLX5E_PTYS_EXT); 1000 + ext_requested = !!(link_ksettings->link_modes.advertising[0] > 1001 + MLX5E_PTYS_EXT || 1002 + link_ksettings->link_modes.advertising[1]); 1020 1003 ext_supported = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet); 1021 - 1022 - /*when ptys_extended_ethernet is set legacy link modes are deprecated */ 1023 - if (ext_requested != ext_supported) 1024 - return -EPROTONOSUPPORT; 1004 + ext_requested &= ext_supported; 1025 1005 1026 1006 speed = link_ksettings->base.speed; 1027 1007 ethtool2ptys_adver_func = ext_requested ? 1028 1008 mlx5e_ethtool2ptys_ext_adver_link : 1029 1009 mlx5e_ethtool2ptys_adver_link; 1030 - err = mlx5_port_query_eth_proto(mdev, 1, ext_supported, &eproto); 1010 + err = mlx5_port_query_eth_proto(mdev, 1, ext_requested, &eproto); 1031 1011 if (err) { 1032 1012 netdev_err(priv->netdev, "%s: query port eth proto failed: %d\n", 1033 1013 __func__, err); ··· 1053 1037 if (!an_changes && link_modes == eproto.admin) 1054 1038 goto out; 1055 1039 1056 - mlx5_port_set_eth_ptys(mdev, an_disable, link_modes, ext_supported); 1040 + mlx5_port_set_eth_ptys(mdev, an_disable, link_modes, ext_requested); 1057 1041 mlx5_toggle_port_link(mdev); 1058 1042 1059 1043 out:
+68 -14
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
··· 2158 2158 return true; 2159 2159 } 2160 2160 2161 + struct ip_ttl_word { 2162 + __u8 ttl; 2163 + __u8 protocol; 2164 + __sum16 check; 2165 + }; 2166 + 2167 + struct ipv6_hoplimit_word { 2168 + __be16 payload_len; 2169 + __u8 nexthdr; 2170 + __u8 hop_limit; 2171 + }; 2172 + 2173 + static bool is_action_keys_supported(const struct flow_action_entry *act) 2174 + { 2175 + u32 mask, offset; 2176 + u8 htype; 2177 + 2178 + htype = act->mangle.htype; 2179 + offset = act->mangle.offset; 2180 + mask = ~act->mangle.mask; 2181 + /* For IPv4 & IPv6 header check 4 byte word, 2182 + * to determine that modified fields 2183 + * are NOT ttl & hop_limit only. 2184 + */ 2185 + if (htype == FLOW_ACT_MANGLE_HDR_TYPE_IP4) { 2186 + struct ip_ttl_word *ttl_word = 2187 + (struct ip_ttl_word *)&mask; 2188 + 2189 + if (offset != offsetof(struct iphdr, ttl) || 2190 + ttl_word->protocol || 2191 + ttl_word->check) { 2192 + return true; 2193 + } 2194 + } else if (htype == FLOW_ACT_MANGLE_HDR_TYPE_IP6) { 2195 + struct ipv6_hoplimit_word *hoplimit_word = 2196 + (struct ipv6_hoplimit_word *)&mask; 2197 + 2198 + if (offset != offsetof(struct ipv6hdr, payload_len) || 2199 + hoplimit_word->payload_len || 2200 + hoplimit_word->nexthdr) { 2201 + return true; 2202 + } 2203 + } 2204 + return false; 2205 + } 2206 + 2161 2207 static bool modify_header_match_supported(struct mlx5_flow_spec *spec, 2162 2208 struct flow_action *flow_action, 2163 2209 u32 actions, ··· 2211 2165 { 2212 2166 const struct flow_action_entry *act; 2213 2167 bool modify_ip_header; 2214 - u8 htype, ip_proto; 2215 2168 void *headers_v; 2216 2169 u16 ethertype; 2170 + u8 ip_proto; 2217 2171 int i; 2218 2172 2219 2173 if (actions & MLX5_FLOW_CONTEXT_ACTION_DECAP) ··· 2233 2187 act->id != FLOW_ACTION_ADD) 2234 2188 continue; 2235 2189 2236 - htype = act->mangle.htype; 2237 - if (htype == FLOW_ACT_MANGLE_HDR_TYPE_IP4 || 2238 - htype == FLOW_ACT_MANGLE_HDR_TYPE_IP6) { 2190 + if (is_action_keys_supported(act)) { 2239 2191 modify_ip_header = true; 2240 2192 break; 2241 2193 } ··· 2384 2340 return 0; 2385 2341 } 2386 2342 2387 - static inline int cmp_encap_info(struct ip_tunnel_key *a, 2388 - struct ip_tunnel_key *b) 2343 + struct encap_key { 2344 + struct ip_tunnel_key *ip_tun_key; 2345 + int tunnel_type; 2346 + }; 2347 + 2348 + static inline int cmp_encap_info(struct encap_key *a, 2349 + struct encap_key *b) 2389 2350 { 2390 - return memcmp(a, b, sizeof(*a)); 2351 + return memcmp(a->ip_tun_key, b->ip_tun_key, sizeof(*a->ip_tun_key)) || 2352 + a->tunnel_type != b->tunnel_type; 2391 2353 } 2392 2354 2393 - static inline int hash_encap_info(struct ip_tunnel_key *key) 2355 + static inline int hash_encap_info(struct encap_key *key) 2394 2356 { 2395 - return jhash(key, sizeof(*key), 0); 2357 + return jhash(key->ip_tun_key, sizeof(*key->ip_tun_key), 2358 + key->tunnel_type); 2396 2359 } 2397 2360 2398 2361 ··· 2430 2379 struct mlx5_esw_flow_attr *attr = flow->esw_attr; 2431 2380 struct mlx5e_tc_flow_parse_attr *parse_attr; 2432 2381 struct ip_tunnel_info *tun_info; 2433 - struct ip_tunnel_key *key; 2382 + struct encap_key key, e_key; 2434 2383 struct mlx5e_encap_entry *e; 2435 2384 unsigned short family; 2436 2385 uintptr_t hash_key; ··· 2440 2389 parse_attr = attr->parse_attr; 2441 2390 tun_info = &parse_attr->tun_info[out_index]; 2442 2391 family = ip_tunnel_info_af(tun_info); 2443 - key = &tun_info->key; 2392 + key.ip_tun_key = &tun_info->key; 2393 + key.tunnel_type = mlx5e_tc_tun_get_type(mirred_dev); 2444 2394 2445 - hash_key = hash_encap_info(key); 2395 + hash_key = hash_encap_info(&key); 2446 2396 2447 2397 hash_for_each_possible_rcu(esw->offloads.encap_tbl, e, 2448 2398 encap_hlist, hash_key) { 2449 - if (!cmp_encap_info(&e->tun_info.key, key)) { 2399 + e_key.ip_tun_key = &e->tun_info.key; 2400 + e_key.tunnel_type = e->tunnel_type; 2401 + if (!cmp_encap_info(&e_key, &key)) { 2450 2402 found = true; 2451 2403 break; 2452 2404 } ··· 2711 2657 2712 2658 if (hdrs[TCA_PEDIT_KEY_EX_CMD_SET].pedits || 2713 2659 hdrs[TCA_PEDIT_KEY_EX_CMD_ADD].pedits) { 2714 - err = alloc_tc_pedit_action(priv, MLX5_FLOW_NAMESPACE_KERNEL, 2660 + err = alloc_tc_pedit_action(priv, MLX5_FLOW_NAMESPACE_FDB, 2715 2661 parse_attr, hdrs, extack); 2716 2662 if (err) 2717 2663 return err;
+5 -4
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
··· 105 105 opcode, MLX5_CMD_OP_MODIFY_NIC_VPORT_CONTEXT); 106 106 MLX5_SET(modify_nic_vport_context_in, in, field_select.change_event, 1); 107 107 MLX5_SET(modify_nic_vport_context_in, in, vport_number, vport); 108 - if (vport) 109 - MLX5_SET(modify_nic_vport_context_in, in, other_vport, 1); 108 + MLX5_SET(modify_nic_vport_context_in, in, other_vport, 1); 110 109 nic_vport_ctx = MLX5_ADDR_OF(modify_nic_vport_context_in, 111 110 in, nic_vport_context); 112 111 ··· 133 134 MLX5_SET(modify_esw_vport_context_in, in, opcode, 134 135 MLX5_CMD_OP_MODIFY_ESW_VPORT_CONTEXT); 135 136 MLX5_SET(modify_esw_vport_context_in, in, vport_number, vport); 136 - if (vport) 137 - MLX5_SET(modify_esw_vport_context_in, in, other_vport, 1); 137 + MLX5_SET(modify_esw_vport_context_in, in, other_vport, 1); 138 138 return mlx5_cmd_exec(dev, in, inlen, out, sizeof(out)); 139 139 } 140 140 ··· 428 430 static int esw_create_legacy_table(struct mlx5_eswitch *esw) 429 431 { 430 432 int err; 433 + 434 + memset(&esw->fdb_table.legacy, 0, sizeof(struct legacy_fdb)); 431 435 432 436 err = esw_create_legacy_vepa_table(esw); 433 437 if (err) ··· 2157 2157 2158 2158 /* Star rule to forward all traffic to uplink vport */ 2159 2159 memset(spec, 0, sizeof(*spec)); 2160 + memset(&dest, 0, sizeof(dest)); 2160 2161 dest.type = MLX5_FLOW_DESTINATION_TYPE_VPORT; 2161 2162 dest.vport.num = MLX5_VPORT_UPLINK; 2162 2163 flow_act.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
+1
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
··· 1611 1611 { 1612 1612 int err; 1613 1613 1614 + memset(&esw->fdb_table.offloads, 0, sizeof(struct offloads_fdb)); 1614 1615 mutex_init(&esw->fdb_table.offloads.fdb_prio_lock); 1615 1616 1616 1617 err = esw_create_offloads_fdb_tables(esw, nvports);
+11 -3
drivers/net/ethernet/mellanox/mlx5/core/fpga/tls.c
··· 217 217 void *cmd; 218 218 int ret; 219 219 220 + rcu_read_lock(); 221 + flow = idr_find(&mdev->fpga->tls->rx_idr, ntohl(handle)); 222 + rcu_read_unlock(); 223 + 224 + if (!flow) { 225 + WARN_ONCE(1, "Received NULL pointer for handle\n"); 226 + return -EINVAL; 227 + } 228 + 220 229 buf = kzalloc(size, GFP_ATOMIC); 221 230 if (!buf) 222 231 return -ENOMEM; 223 232 224 233 cmd = (buf + 1); 225 234 226 - rcu_read_lock(); 227 - flow = idr_find(&mdev->fpga->tls->rx_idr, ntohl(handle)); 228 - rcu_read_unlock(); 229 235 mlx5_fpga_tls_flow_to_cmd(flow, cmd); 230 236 231 237 MLX5_SET(tls_cmd, cmd, swid, ntohl(handle)); ··· 244 238 buf->complete = mlx_tls_kfree_complete; 245 239 246 240 ret = mlx5_fpga_sbu_conn_sendmsg(mdev->fpga->tls->conn, buf); 241 + if (ret < 0) 242 + kfree(buf); 247 243 248 244 return ret; 249 245 }
-20
drivers/net/ethernet/mellanox/mlx5/core/main.c
··· 164 164 .size = 8, 165 165 .limit = 4 166 166 }, 167 - .mr_cache[16] = { 168 - .size = 8, 169 - .limit = 4 170 - }, 171 - .mr_cache[17] = { 172 - .size = 8, 173 - .limit = 4 174 - }, 175 - .mr_cache[18] = { 176 - .size = 8, 177 - .limit = 4 178 - }, 179 - .mr_cache[19] = { 180 - .size = 4, 181 - .limit = 2 182 - }, 183 - .mr_cache[20] = { 184 - .size = 4, 185 - .limit = 2 186 - }, 187 167 }, 188 168 }; 189 169
+1 -2
drivers/net/ethernet/netronome/nfp/flower/action.c
··· 48 48 49 49 tmp_push_vlan_tci = 50 50 FIELD_PREP(NFP_FL_PUSH_VLAN_PRIO, act->vlan.prio) | 51 - FIELD_PREP(NFP_FL_PUSH_VLAN_VID, act->vlan.vid) | 52 - NFP_FL_PUSH_VLAN_CFI; 51 + FIELD_PREP(NFP_FL_PUSH_VLAN_VID, act->vlan.vid); 53 52 push_vlan->vlan_tci = cpu_to_be16(tmp_push_vlan_tci); 54 53 } 55 54
+1 -2
drivers/net/ethernet/netronome/nfp/flower/cmsg.h
··· 26 26 #define NFP_FLOWER_LAYER2_GENEVE_OP BIT(6) 27 27 28 28 #define NFP_FLOWER_MASK_VLAN_PRIO GENMASK(15, 13) 29 - #define NFP_FLOWER_MASK_VLAN_CFI BIT(12) 29 + #define NFP_FLOWER_MASK_VLAN_PRESENT BIT(12) 30 30 #define NFP_FLOWER_MASK_VLAN_VID GENMASK(11, 0) 31 31 32 32 #define NFP_FLOWER_MASK_MPLS_LB GENMASK(31, 12) ··· 82 82 #define NFP_FL_OUT_FLAGS_TYPE_IDX GENMASK(2, 0) 83 83 84 84 #define NFP_FL_PUSH_VLAN_PRIO GENMASK(15, 13) 85 - #define NFP_FL_PUSH_VLAN_CFI BIT(12) 86 85 #define NFP_FL_PUSH_VLAN_VID GENMASK(11, 0) 87 86 88 87 #define IPV6_FLOW_LABEL_MASK cpu_to_be32(0x000fffff)
+13 -14
drivers/net/ethernet/netronome/nfp/flower/match.c
··· 30 30 31 31 flow_rule_match_vlan(rule, &match); 32 32 /* Populate the tci field. */ 33 - if (match.key->vlan_id || match.key->vlan_priority) { 34 - tmp_tci = FIELD_PREP(NFP_FLOWER_MASK_VLAN_PRIO, 35 - match.key->vlan_priority) | 36 - FIELD_PREP(NFP_FLOWER_MASK_VLAN_VID, 37 - match.key->vlan_id) | 38 - NFP_FLOWER_MASK_VLAN_CFI; 39 - ext->tci = cpu_to_be16(tmp_tci); 40 - tmp_tci = FIELD_PREP(NFP_FLOWER_MASK_VLAN_PRIO, 41 - match.mask->vlan_priority) | 42 - FIELD_PREP(NFP_FLOWER_MASK_VLAN_VID, 43 - match.mask->vlan_id) | 44 - NFP_FLOWER_MASK_VLAN_CFI; 45 - msk->tci = cpu_to_be16(tmp_tci); 46 - } 33 + tmp_tci = NFP_FLOWER_MASK_VLAN_PRESENT; 34 + tmp_tci |= FIELD_PREP(NFP_FLOWER_MASK_VLAN_PRIO, 35 + match.key->vlan_priority) | 36 + FIELD_PREP(NFP_FLOWER_MASK_VLAN_VID, 37 + match.key->vlan_id); 38 + ext->tci = cpu_to_be16(tmp_tci); 39 + 40 + tmp_tci = NFP_FLOWER_MASK_VLAN_PRESENT; 41 + tmp_tci |= FIELD_PREP(NFP_FLOWER_MASK_VLAN_PRIO, 42 + match.mask->vlan_priority) | 43 + FIELD_PREP(NFP_FLOWER_MASK_VLAN_VID, 44 + match.mask->vlan_id); 45 + msk->tci = cpu_to_be16(tmp_tci); 47 46 } 48 47 } 49 48
+2 -2
drivers/net/ethernet/netronome/nfp/nfp_net_repr.c
··· 195 195 ret = dev_queue_xmit(skb); 196 196 nfp_repr_inc_tx_stats(netdev, len, ret); 197 197 198 - return ret; 198 + return NETDEV_TX_OK; 199 199 } 200 200 201 201 static int nfp_repr_stop(struct net_device *netdev) ··· 383 383 netdev->features &= ~(NETIF_F_TSO | NETIF_F_TSO6); 384 384 netdev->gso_max_segs = NFP_NET_LSO_MAX_SEGS; 385 385 386 - netdev->priv_flags |= IFF_NO_QUEUE; 386 + netdev->priv_flags |= IFF_NO_QUEUE | IFF_DISABLE_NETPOLL; 387 387 netdev->features |= NETIF_F_LLTX; 388 388 389 389 if (nfp_app_has_tc(app)) {
+1 -1
drivers/net/ethernet/realtek/r8169.c
··· 5460 5460 tp->cp_cmd |= PktCntrDisable | INTT_1; 5461 5461 RTL_W16(tp, CPlusCmd, tp->cp_cmd); 5462 5462 5463 - RTL_W16(tp, IntrMitigate, 0x5151); 5463 + RTL_W16(tp, IntrMitigate, 0x5100); 5464 5464 5465 5465 /* Work around for RxFIFO overflow. */ 5466 5466 if (tp->mac_version == RTL_GIGA_MAC_VER_11) {
+14 -8
drivers/net/ethernet/stmicro/stmmac/descs_com.h
··· 29 29 /* Specific functions used for Ring mode */ 30 30 31 31 /* Enhanced descriptors */ 32 - static inline void ehn_desc_rx_set_on_ring(struct dma_desc *p, int end) 32 + static inline void ehn_desc_rx_set_on_ring(struct dma_desc *p, int end, 33 + int bfsize) 33 34 { 34 - p->des1 |= cpu_to_le32((BUF_SIZE_8KiB 35 - << ERDES1_BUFFER2_SIZE_SHIFT) 36 - & ERDES1_BUFFER2_SIZE_MASK); 35 + if (bfsize == BUF_SIZE_16KiB) 36 + p->des1 |= cpu_to_le32((BUF_SIZE_8KiB 37 + << ERDES1_BUFFER2_SIZE_SHIFT) 38 + & ERDES1_BUFFER2_SIZE_MASK); 37 39 38 40 if (end) 39 41 p->des1 |= cpu_to_le32(ERDES1_END_RING); ··· 61 59 } 62 60 63 61 /* Normal descriptors */ 64 - static inline void ndesc_rx_set_on_ring(struct dma_desc *p, int end) 62 + static inline void ndesc_rx_set_on_ring(struct dma_desc *p, int end, int bfsize) 65 63 { 66 - p->des1 |= cpu_to_le32(((BUF_SIZE_2KiB - 1) 67 - << RDES1_BUFFER2_SIZE_SHIFT) 68 - & RDES1_BUFFER2_SIZE_MASK); 64 + if (bfsize >= BUF_SIZE_2KiB) { 65 + int bfsize2; 66 + 67 + bfsize2 = min(bfsize - BUF_SIZE_2KiB + 1, BUF_SIZE_2KiB - 1); 68 + p->des1 |= cpu_to_le32((bfsize2 << RDES1_BUFFER2_SIZE_SHIFT) 69 + & RDES1_BUFFER2_SIZE_MASK); 70 + } 69 71 70 72 if (end) 71 73 p->des1 |= cpu_to_le32(RDES1_END_RING);
+1 -1
drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
··· 296 296 } 297 297 298 298 static void dwmac4_rd_init_rx_desc(struct dma_desc *p, int disable_rx_ic, 299 - int mode, int end) 299 + int mode, int end, int bfsize) 300 300 { 301 301 dwmac4_set_rx_owner(p, disable_rx_ic); 302 302 }
+1 -1
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c
··· 123 123 } 124 124 125 125 static void dwxgmac2_init_rx_desc(struct dma_desc *p, int disable_rx_ic, 126 - int mode, int end) 126 + int mode, int end, int bfsize) 127 127 { 128 128 dwxgmac2_set_rx_owner(p, disable_rx_ic); 129 129 }
+16 -6
drivers/net/ethernet/stmicro/stmmac/enh_desc.c
··· 201 201 if (unlikely(rdes0 & RDES0_OWN)) 202 202 return dma_own; 203 203 204 + if (unlikely(!(rdes0 & RDES0_LAST_DESCRIPTOR))) { 205 + stats->rx_length_errors++; 206 + return discard_frame; 207 + } 208 + 204 209 if (unlikely(rdes0 & RDES0_ERROR_SUMMARY)) { 205 210 if (unlikely(rdes0 & RDES0_DESCRIPTOR_ERROR)) { 206 211 x->rx_desc++; ··· 236 231 * It doesn't match with the information reported into the databook. 237 232 * At any rate, we need to understand if the CSUM hw computation is ok 238 233 * and report this info to the upper layers. */ 239 - ret = enh_desc_coe_rdes0(!!(rdes0 & RDES0_IPC_CSUM_ERROR), 240 - !!(rdes0 & RDES0_FRAME_TYPE), 241 - !!(rdes0 & ERDES0_RX_MAC_ADDR)); 234 + if (likely(ret == good_frame)) 235 + ret = enh_desc_coe_rdes0(!!(rdes0 & RDES0_IPC_CSUM_ERROR), 236 + !!(rdes0 & RDES0_FRAME_TYPE), 237 + !!(rdes0 & ERDES0_RX_MAC_ADDR)); 242 238 243 239 if (unlikely(rdes0 & RDES0_DRIBBLING)) 244 240 x->dribbling_bit++; ··· 265 259 } 266 260 267 261 static void enh_desc_init_rx_desc(struct dma_desc *p, int disable_rx_ic, 268 - int mode, int end) 262 + int mode, int end, int bfsize) 269 263 { 264 + int bfsize1; 265 + 270 266 p->des0 |= cpu_to_le32(RDES0_OWN); 271 - p->des1 |= cpu_to_le32(BUF_SIZE_8KiB & ERDES1_BUFFER1_SIZE_MASK); 267 + 268 + bfsize1 = min(bfsize, BUF_SIZE_8KiB); 269 + p->des1 |= cpu_to_le32(bfsize1 & ERDES1_BUFFER1_SIZE_MASK); 272 270 273 271 if (mode == STMMAC_CHAIN_MODE) 274 272 ehn_desc_rx_set_on_chain(p); 275 273 else 276 - ehn_desc_rx_set_on_ring(p, end); 274 + ehn_desc_rx_set_on_ring(p, end, bfsize); 277 275 278 276 if (disable_rx_ic) 279 277 p->des1 |= cpu_to_le32(ERDES1_DISABLE_IC);
+1 -1
drivers/net/ethernet/stmicro/stmmac/hwif.h
··· 33 33 struct stmmac_desc_ops { 34 34 /* DMA RX descriptor ring initialization */ 35 35 void (*init_rx_desc)(struct dma_desc *p, int disable_rx_ic, int mode, 36 - int end); 36 + int end, int bfsize); 37 37 /* DMA TX descriptor ring initialization */ 38 38 void (*init_tx_desc)(struct dma_desc *p, int mode, int end); 39 39 /* Invoked by the xmit function to prepare the tx descriptor */
+7 -5
drivers/net/ethernet/stmicro/stmmac/norm_desc.c
··· 91 91 return dma_own; 92 92 93 93 if (unlikely(!(rdes0 & RDES0_LAST_DESCRIPTOR))) { 94 - pr_warn("%s: Oversized frame spanned multiple buffers\n", 95 - __func__); 96 94 stats->rx_length_errors++; 97 95 return discard_frame; 98 96 } ··· 133 135 } 134 136 135 137 static void ndesc_init_rx_desc(struct dma_desc *p, int disable_rx_ic, int mode, 136 - int end) 138 + int end, int bfsize) 137 139 { 140 + int bfsize1; 141 + 138 142 p->des0 |= cpu_to_le32(RDES0_OWN); 139 - p->des1 |= cpu_to_le32((BUF_SIZE_2KiB - 1) & RDES1_BUFFER1_SIZE_MASK); 143 + 144 + bfsize1 = min(bfsize, BUF_SIZE_2KiB - 1); 145 + p->des1 |= cpu_to_le32(bfsize & RDES1_BUFFER1_SIZE_MASK); 140 146 141 147 if (mode == STMMAC_CHAIN_MODE) 142 148 ndesc_rx_set_on_chain(p, end); 143 149 else 144 - ndesc_rx_set_on_ring(p, end); 150 + ndesc_rx_set_on_ring(p, end, bfsize); 145 151 146 152 if (disable_rx_ic) 147 153 p->des1 |= cpu_to_le32(RDES1_DISABLE_IC);
+19 -15
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
··· 1136 1136 if (priv->extend_desc) 1137 1137 stmmac_init_rx_desc(priv, &rx_q->dma_erx[i].basic, 1138 1138 priv->use_riwt, priv->mode, 1139 - (i == DMA_RX_SIZE - 1)); 1139 + (i == DMA_RX_SIZE - 1), 1140 + priv->dma_buf_sz); 1140 1141 else 1141 1142 stmmac_init_rx_desc(priv, &rx_q->dma_rx[i], 1142 1143 priv->use_riwt, priv->mode, 1143 - (i == DMA_RX_SIZE - 1)); 1144 + (i == DMA_RX_SIZE - 1), 1145 + priv->dma_buf_sz); 1144 1146 } 1145 1147 1146 1148 /** ··· 3354 3352 { 3355 3353 struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue]; 3356 3354 struct stmmac_channel *ch = &priv->channel[queue]; 3357 - unsigned int entry = rx_q->cur_rx; 3355 + unsigned int next_entry = rx_q->cur_rx; 3358 3356 int coe = priv->hw->rx_csum; 3359 - unsigned int next_entry; 3360 3357 unsigned int count = 0; 3361 3358 bool xmac; 3362 3359 ··· 3373 3372 stmmac_display_ring(priv, rx_head, DMA_RX_SIZE, true); 3374 3373 } 3375 3374 while (count < limit) { 3376 - int status; 3375 + int entry, status; 3377 3376 struct dma_desc *p; 3378 3377 struct dma_desc *np; 3378 + 3379 + entry = next_entry; 3379 3380 3380 3381 if (priv->extend_desc) 3381 3382 p = (struct dma_desc *)(rx_q->dma_erx + entry); ··· 3434 3431 * ignored 3435 3432 */ 3436 3433 if (frame_len > priv->dma_buf_sz) { 3437 - netdev_err(priv->dev, 3438 - "len %d larger than size (%d)\n", 3439 - frame_len, priv->dma_buf_sz); 3434 + if (net_ratelimit()) 3435 + netdev_err(priv->dev, 3436 + "len %d larger than size (%d)\n", 3437 + frame_len, priv->dma_buf_sz); 3440 3438 priv->dev->stats.rx_length_errors++; 3441 - break; 3439 + continue; 3442 3440 } 3443 3441 3444 3442 /* ACS is set; GMAC core strips PAD/FCS for IEEE 802.3 ··· 3474 3470 dev_warn(priv->device, 3475 3471 "packet dropped\n"); 3476 3472 priv->dev->stats.rx_dropped++; 3477 - break; 3473 + continue; 3478 3474 } 3479 3475 3480 3476 dma_sync_single_for_cpu(priv->device, ··· 3494 3490 } else { 3495 3491 skb = rx_q->rx_skbuff[entry]; 3496 3492 if (unlikely(!skb)) { 3497 - netdev_err(priv->dev, 3498 - "%s: Inconsistent Rx chain\n", 3499 - priv->dev->name); 3493 + if (net_ratelimit()) 3494 + netdev_err(priv->dev, 3495 + "%s: Inconsistent Rx chain\n", 3496 + priv->dev->name); 3500 3497 priv->dev->stats.rx_dropped++; 3501 - break; 3498 + continue; 3502 3499 } 3503 3500 prefetch(skb->data - NET_IP_ALIGN); 3504 3501 rx_q->rx_skbuff[entry] = NULL; ··· 3534 3529 priv->dev->stats.rx_packets++; 3535 3530 priv->dev->stats.rx_bytes += frame_len; 3536 3531 } 3537 - entry = next_entry; 3538 3532 } 3539 3533 3540 3534 stmmac_rx_refill(priv, queue);
+1
drivers/net/hyperv/hyperv_net.h
··· 987 987 988 988 wait_queue_head_t wait_drain; 989 989 bool destroy; 990 + bool tx_disable; /* if true, do not wake up queue again */ 990 991 991 992 /* Receive buffer allocated by us but manages by NetVSP */ 992 993 void *recv_buf;
+4 -2
drivers/net/hyperv/netvsc.c
··· 110 110 111 111 init_waitqueue_head(&net_device->wait_drain); 112 112 net_device->destroy = false; 113 + net_device->tx_disable = false; 113 114 114 115 net_device->max_pkt = RNDIS_MAX_PKT_DEFAULT; 115 116 net_device->pkt_align = RNDIS_PKT_ALIGN_DEFAULT; ··· 720 719 } else { 721 720 struct netdev_queue *txq = netdev_get_tx_queue(ndev, q_idx); 722 721 723 - if (netif_tx_queue_stopped(txq) && 722 + if (netif_tx_queue_stopped(txq) && !net_device->tx_disable && 724 723 (hv_get_avail_to_write_percent(&channel->outbound) > 725 724 RING_AVAIL_PERCENT_HIWATER || queue_sends < 1)) { 726 725 netif_tx_wake_queue(txq); ··· 875 874 } else if (ret == -EAGAIN) { 876 875 netif_tx_stop_queue(txq); 877 876 ndev_ctx->eth_stats.stop_queue++; 878 - if (atomic_read(&nvchan->queue_sends) < 1) { 877 + if (atomic_read(&nvchan->queue_sends) < 1 && 878 + !net_device->tx_disable) { 879 879 netif_tx_wake_queue(txq); 880 880 ndev_ctx->eth_stats.wake_queue++; 881 881 ret = -ENOSPC;
+26 -6
drivers/net/hyperv/netvsc_drv.c
··· 109 109 rcu_read_unlock(); 110 110 } 111 111 112 + static void netvsc_tx_enable(struct netvsc_device *nvscdev, 113 + struct net_device *ndev) 114 + { 115 + nvscdev->tx_disable = false; 116 + virt_wmb(); /* ensure queue wake up mechanism is on */ 117 + 118 + netif_tx_wake_all_queues(ndev); 119 + } 120 + 112 121 static int netvsc_open(struct net_device *net) 113 122 { 114 123 struct net_device_context *ndev_ctx = netdev_priv(net); ··· 138 129 rdev = nvdev->extension; 139 130 if (!rdev->link_state) { 140 131 netif_carrier_on(net); 141 - netif_tx_wake_all_queues(net); 132 + netvsc_tx_enable(nvdev, net); 142 133 } 143 134 144 135 if (vf_netdev) { ··· 193 184 } 194 185 } 195 186 187 + static void netvsc_tx_disable(struct netvsc_device *nvscdev, 188 + struct net_device *ndev) 189 + { 190 + if (nvscdev) { 191 + nvscdev->tx_disable = true; 192 + virt_wmb(); /* ensure txq will not wake up after stop */ 193 + } 194 + 195 + netif_tx_disable(ndev); 196 + } 197 + 196 198 static int netvsc_close(struct net_device *net) 197 199 { 198 200 struct net_device_context *net_device_ctx = netdev_priv(net); ··· 212 192 struct netvsc_device *nvdev = rtnl_dereference(net_device_ctx->nvdev); 213 193 int ret; 214 194 215 - netif_tx_disable(net); 195 + netvsc_tx_disable(nvdev, net); 216 196 217 197 /* No need to close rndis filter if it is removed already */ 218 198 if (!nvdev) ··· 940 920 941 921 /* If device was up (receiving) then shutdown */ 942 922 if (netif_running(ndev)) { 943 - netif_tx_disable(ndev); 923 + netvsc_tx_disable(nvdev, ndev); 944 924 945 925 ret = rndis_filter_close(nvdev); 946 926 if (ret) { ··· 1928 1908 if (rdev->link_state) { 1929 1909 rdev->link_state = false; 1930 1910 netif_carrier_on(net); 1931 - netif_tx_wake_all_queues(net); 1911 + netvsc_tx_enable(net_device, net); 1932 1912 } else { 1933 1913 notify = true; 1934 1914 } ··· 1938 1918 if (!rdev->link_state) { 1939 1919 rdev->link_state = true; 1940 1920 netif_carrier_off(net); 1941 - netif_tx_stop_all_queues(net); 1921 + netvsc_tx_disable(net_device, net); 1942 1922 } 1943 1923 kfree(event); 1944 1924 break; ··· 1947 1927 if (!rdev->link_state) { 1948 1928 rdev->link_state = true; 1949 1929 netif_carrier_off(net); 1950 - netif_tx_stop_all_queues(net); 1930 + netvsc_tx_disable(net_device, net); 1951 1931 event->event = RNDIS_STATUS_MEDIA_CONNECT; 1952 1932 spin_lock_irqsave(&ndev_ctx->lock, flags); 1953 1933 list_add(&event->list, &ndev_ctx->reconfig_events);
+1
drivers/net/usb/qmi_wwan.c
··· 1203 1203 {QMI_FIXED_INTF(0x19d2, 0x2002, 4)}, /* ZTE (Vodafone) K3765-Z */ 1204 1204 {QMI_FIXED_INTF(0x2001, 0x7e19, 4)}, /* D-Link DWM-221 B1 */ 1205 1205 {QMI_FIXED_INTF(0x2001, 0x7e35, 4)}, /* D-Link DWM-222 */ 1206 + {QMI_FIXED_INTF(0x2020, 0x2031, 4)}, /* Olicard 600 */ 1206 1207 {QMI_FIXED_INTF(0x2020, 0x2033, 4)}, /* BroadMobi BM806U */ 1207 1208 {QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)}, /* Sierra Wireless MC7700 */ 1208 1209 {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */
+1
drivers/net/vrf.c
··· 1273 1273 1274 1274 /* default to no qdisc; user can add if desired */ 1275 1275 dev->priv_flags |= IFF_NO_QUEUE; 1276 + dev->priv_flags |= IFF_NO_RX_HANDLER; 1276 1277 1277 1278 dev->min_mtu = 0; 1278 1279 dev->max_mtu = 0;
+1 -1
include/linux/mii.h
··· 469 469 if (linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT, 470 470 advertising)) 471 471 lcl_adv |= ADVERTISE_PAUSE_CAP; 472 - if (linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT, 472 + if (linkmode_test_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, 473 473 advertising)) 474 474 lcl_adv |= ADVERTISE_PAUSE_ASYM; 475 475
+2
include/linux/mlx5/driver.h
··· 594 594 }; 595 595 596 596 struct mlx5_td { 597 + /* protects tirs list changes while tirs refresh */ 598 + struct mutex list_lock; 597 599 struct list_head tirs_list; 598 600 u32 tdn; 599 601 };
+1 -1
include/net/ip.h
··· 677 677 unsigned char __user *data, int optlen); 678 678 void ip_options_undo(struct ip_options *opt); 679 679 void ip_forward_options(struct sk_buff *skb); 680 - int ip_options_rcv_srr(struct sk_buff *skb); 680 + int ip_options_rcv_srr(struct sk_buff *skb, struct net_device *dev); 681 681 682 682 /* 683 683 * Functions provided by ip_sockglue.c
+1
include/net/net_namespace.h
··· 59 59 */ 60 60 spinlock_t rules_mod_lock; 61 61 62 + u32 hash_mix; 62 63 atomic64_t cookie_gen; 63 64 64 65 struct list_head list; /* list of network namespaces */
+2 -8
include/net/netns/hash.h
··· 2 2 #ifndef __NET_NS_HASH_H__ 3 3 #define __NET_NS_HASH_H__ 4 4 5 - #include <asm/cache.h> 6 - 7 - struct net; 5 + #include <net/net_namespace.h> 8 6 9 7 static inline u32 net_hash_mix(const struct net *net) 10 8 { 11 - #ifdef CONFIG_NET_NS 12 - return (u32)(((unsigned long)net) >> ilog2(sizeof(*net))); 13 - #else 14 - return 0; 15 - #endif 9 + return net->hash_mix; 16 10 } 17 11 #endif
+37 -7
include/net/sch_generic.h
··· 923 923 sch->qstats.overlimits++; 924 924 } 925 925 926 + static inline int qdisc_qstats_copy(struct gnet_dump *d, struct Qdisc *sch) 927 + { 928 + __u32 qlen = qdisc_qlen_sum(sch); 929 + 930 + return gnet_stats_copy_queue(d, sch->cpu_qstats, &sch->qstats, qlen); 931 + } 932 + 933 + static inline void qdisc_qstats_qlen_backlog(struct Qdisc *sch, __u32 *qlen, 934 + __u32 *backlog) 935 + { 936 + struct gnet_stats_queue qstats = { 0 }; 937 + __u32 len = qdisc_qlen_sum(sch); 938 + 939 + __gnet_stats_copy_queue(&qstats, sch->cpu_qstats, &sch->qstats, len); 940 + *qlen = qstats.qlen; 941 + *backlog = qstats.backlog; 942 + } 943 + 944 + static inline void qdisc_tree_flush_backlog(struct Qdisc *sch) 945 + { 946 + __u32 qlen, backlog; 947 + 948 + qdisc_qstats_qlen_backlog(sch, &qlen, &backlog); 949 + qdisc_tree_reduce_backlog(sch, qlen, backlog); 950 + } 951 + 952 + static inline void qdisc_purge_queue(struct Qdisc *sch) 953 + { 954 + __u32 qlen, backlog; 955 + 956 + qdisc_qstats_qlen_backlog(sch, &qlen, &backlog); 957 + qdisc_reset(sch); 958 + qdisc_tree_reduce_backlog(sch, qlen, backlog); 959 + } 960 + 926 961 static inline void qdisc_skb_head_init(struct qdisc_skb_head *qh) 927 962 { 928 963 qh->head = NULL; ··· 1141 1106 sch_tree_lock(sch); 1142 1107 old = *pold; 1143 1108 *pold = new; 1144 - if (old != NULL) { 1145 - unsigned int qlen = old->q.qlen; 1146 - unsigned int backlog = old->qstats.backlog; 1147 - 1148 - qdisc_reset(old); 1149 - qdisc_tree_reduce_backlog(old, qlen, backlog); 1150 - } 1109 + if (old != NULL) 1110 + qdisc_tree_flush_backlog(old); 1151 1111 sch_tree_unlock(sch); 1152 1112 1153 1113 return old;
+10 -3
kernel/bpf/cpumap.c
··· 162 162 static struct sk_buff *cpu_map_build_skb(struct bpf_cpu_map_entry *rcpu, 163 163 struct xdp_frame *xdpf) 164 164 { 165 + unsigned int hard_start_headroom; 165 166 unsigned int frame_size; 166 167 void *pkt_data_start; 167 168 struct sk_buff *skb; 169 + 170 + /* Part of headroom was reserved to xdpf */ 171 + hard_start_headroom = sizeof(struct xdp_frame) + xdpf->headroom; 168 172 169 173 /* build_skb need to place skb_shared_info after SKB end, and 170 174 * also want to know the memory "truesize". Thus, need to ··· 187 183 * is not at a fixed memory location, with mixed length 188 184 * packets, which is bad for cache-line hotness. 189 185 */ 190 - frame_size = SKB_DATA_ALIGN(xdpf->len + xdpf->headroom) + 186 + frame_size = SKB_DATA_ALIGN(xdpf->len + hard_start_headroom) + 191 187 SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); 192 188 193 - pkt_data_start = xdpf->data - xdpf->headroom; 189 + pkt_data_start = xdpf->data - hard_start_headroom; 194 190 skb = build_skb(pkt_data_start, frame_size); 195 191 if (!skb) 196 192 return NULL; 197 193 198 - skb_reserve(skb, xdpf->headroom); 194 + skb_reserve(skb, hard_start_headroom); 199 195 __skb_put(skb, xdpf->len); 200 196 if (xdpf->metasize) 201 197 skb_metadata_set(skb, xdpf->metasize); ··· 208 204 * - HW RX hash (skb_set_hash) 209 205 * - RX ring dev queue index (skb_record_rx_queue) 210 206 */ 207 + 208 + /* Allow SKB to reuse area used by xdp_frame */ 209 + xdp_scrub_frame(xdpf); 211 210 212 211 return skb; 213 212 }
+18 -14
kernel/bpf/inode.c
··· 554 554 } 555 555 EXPORT_SYMBOL(bpf_prog_get_type_path); 556 556 557 - static void bpf_evict_inode(struct inode *inode) 558 - { 559 - enum bpf_type type; 560 - 561 - truncate_inode_pages_final(&inode->i_data); 562 - clear_inode(inode); 563 - 564 - if (S_ISLNK(inode->i_mode)) 565 - kfree(inode->i_link); 566 - if (!bpf_inode_type(inode, &type)) 567 - bpf_any_put(inode->i_private, type); 568 - } 569 - 570 557 /* 571 558 * Display the mount options in /proc/mounts. 572 559 */ ··· 566 579 return 0; 567 580 } 568 581 582 + static void bpf_destroy_inode_deferred(struct rcu_head *head) 583 + { 584 + struct inode *inode = container_of(head, struct inode, i_rcu); 585 + enum bpf_type type; 586 + 587 + if (S_ISLNK(inode->i_mode)) 588 + kfree(inode->i_link); 589 + if (!bpf_inode_type(inode, &type)) 590 + bpf_any_put(inode->i_private, type); 591 + free_inode_nonrcu(inode); 592 + } 593 + 594 + static void bpf_destroy_inode(struct inode *inode) 595 + { 596 + call_rcu(&inode->i_rcu, bpf_destroy_inode_deferred); 597 + } 598 + 569 599 static const struct super_operations bpf_super_ops = { 570 600 .statfs = simple_statfs, 571 601 .drop_inode = generic_delete_inode, 572 602 .show_options = bpf_show_options, 573 - .evict_inode = bpf_evict_inode, 603 + .destroy_inode = bpf_destroy_inode, 574 604 }; 575 605 576 606 enum {
+3 -2
kernel/bpf/verifier.c
··· 1897 1897 } 1898 1898 frame++; 1899 1899 if (frame >= MAX_CALL_FRAMES) { 1900 - WARN_ONCE(1, "verifier bug. Call stack is too deep\n"); 1901 - return -EFAULT; 1900 + verbose(env, "the call stack of %d frames is too deep !\n", 1901 + frame); 1902 + return -E2BIG; 1902 1903 } 1903 1904 goto process_func; 1904 1905 }
+16 -12
net/8021q/vlan_dev.c
··· 443 443 return rc; 444 444 } 445 445 446 - static int vlan_dev_fcoe_get_wwn(struct net_device *dev, u64 *wwn, int type) 447 - { 448 - struct net_device *real_dev = vlan_dev_priv(dev)->real_dev; 449 - const struct net_device_ops *ops = real_dev->netdev_ops; 450 - int rc = -EINVAL; 451 - 452 - if (ops->ndo_fcoe_get_wwn) 453 - rc = ops->ndo_fcoe_get_wwn(real_dev, wwn, type); 454 - return rc; 455 - } 456 - 457 446 static int vlan_dev_fcoe_ddp_target(struct net_device *dev, u16 xid, 458 447 struct scatterlist *sgl, unsigned int sgc) 459 448 { ··· 453 464 if (ops->ndo_fcoe_ddp_target) 454 465 rc = ops->ndo_fcoe_ddp_target(real_dev, xid, sgl, sgc); 455 466 467 + return rc; 468 + } 469 + #endif 470 + 471 + #ifdef NETDEV_FCOE_WWNN 472 + static int vlan_dev_fcoe_get_wwn(struct net_device *dev, u64 *wwn, int type) 473 + { 474 + struct net_device *real_dev = vlan_dev_priv(dev)->real_dev; 475 + const struct net_device_ops *ops = real_dev->netdev_ops; 476 + int rc = -EINVAL; 477 + 478 + if (ops->ndo_fcoe_get_wwn) 479 + rc = ops->ndo_fcoe_get_wwn(real_dev, wwn, type); 456 480 return rc; 457 481 } 458 482 #endif ··· 796 794 .ndo_fcoe_ddp_done = vlan_dev_fcoe_ddp_done, 797 795 .ndo_fcoe_enable = vlan_dev_fcoe_enable, 798 796 .ndo_fcoe_disable = vlan_dev_fcoe_disable, 799 - .ndo_fcoe_get_wwn = vlan_dev_fcoe_get_wwn, 800 797 .ndo_fcoe_ddp_target = vlan_dev_fcoe_ddp_target, 798 + #endif 799 + #ifdef NETDEV_FCOE_WWNN 800 + .ndo_fcoe_get_wwn = vlan_dev_fcoe_get_wwn, 801 801 #endif 802 802 #ifdef CONFIG_NET_POLL_CONTROLLER 803 803 .ndo_poll_controller = vlan_dev_poll_controller,
+4 -2
net/batman-adv/bat_v_elp.c
··· 104 104 105 105 ret = cfg80211_get_station(real_netdev, neigh->addr, &sinfo); 106 106 107 - /* free the TID stats immediately */ 108 - cfg80211_sinfo_release_content(&sinfo); 107 + if (!ret) { 108 + /* free the TID stats immediately */ 109 + cfg80211_sinfo_release_content(&sinfo); 110 + } 109 111 110 112 dev_put(real_netdev); 111 113 if (ret == -ENOENT) {
+13 -3
net/batman-adv/bridge_loop_avoidance.c
··· 803 803 const u8 *mac, const unsigned short vid) 804 804 { 805 805 struct batadv_bla_claim search_claim, *claim; 806 + struct batadv_bla_claim *claim_removed_entry; 807 + struct hlist_node *claim_removed_node; 806 808 807 809 ether_addr_copy(search_claim.addr, mac); 808 810 search_claim.vid = vid; ··· 815 813 batadv_dbg(BATADV_DBG_BLA, bat_priv, "%s(): %pM, vid %d\n", __func__, 816 814 mac, batadv_print_vid(vid)); 817 815 818 - batadv_hash_remove(bat_priv->bla.claim_hash, batadv_compare_claim, 819 - batadv_choose_claim, claim); 820 - batadv_claim_put(claim); /* reference from the hash is gone */ 816 + claim_removed_node = batadv_hash_remove(bat_priv->bla.claim_hash, 817 + batadv_compare_claim, 818 + batadv_choose_claim, claim); 819 + if (!claim_removed_node) 820 + goto free_claim; 821 821 822 + /* reference from the hash is gone */ 823 + claim_removed_entry = hlist_entry(claim_removed_node, 824 + struct batadv_bla_claim, hash_entry); 825 + batadv_claim_put(claim_removed_entry); 826 + 827 + free_claim: 822 828 /* don't need the reference from hash_find() anymore */ 823 829 batadv_claim_put(claim); 824 830 }
+5 -2
net/batman-adv/sysfs.c
··· 1116 1116 struct attribute *attr, 1117 1117 char *buff, size_t count) 1118 1118 { 1119 - struct batadv_priv *bat_priv = batadv_kobj_to_batpriv(kobj); 1120 1119 struct net_device *net_dev = batadv_kobj_to_netdev(kobj); 1121 1120 struct batadv_hard_iface *hard_iface; 1121 + struct batadv_priv *bat_priv; 1122 1122 u32 tp_override; 1123 1123 u32 old_tp_override; 1124 1124 bool ret; ··· 1147 1147 1148 1148 atomic_set(&hard_iface->bat_v.throughput_override, tp_override); 1149 1149 1150 - batadv_netlink_notify_hardif(bat_priv, hard_iface); 1150 + if (hard_iface->soft_iface) { 1151 + bat_priv = netdev_priv(hard_iface->soft_iface); 1152 + batadv_netlink_notify_hardif(bat_priv, hard_iface); 1153 + } 1151 1154 1152 1155 out: 1153 1156 batadv_hardif_put(hard_iface);
+24 -8
net/batman-adv/translation-table.c
··· 616 616 struct batadv_tt_global_entry *tt_global, 617 617 const char *message) 618 618 { 619 + struct batadv_tt_global_entry *tt_removed_entry; 620 + struct hlist_node *tt_removed_node; 621 + 619 622 batadv_dbg(BATADV_DBG_TT, bat_priv, 620 623 "Deleting global tt entry %pM (vid: %d): %s\n", 621 624 tt_global->common.addr, 622 625 batadv_print_vid(tt_global->common.vid), message); 623 626 624 - batadv_hash_remove(bat_priv->tt.global_hash, batadv_compare_tt, 625 - batadv_choose_tt, &tt_global->common); 626 - batadv_tt_global_entry_put(tt_global); 627 + tt_removed_node = batadv_hash_remove(bat_priv->tt.global_hash, 628 + batadv_compare_tt, 629 + batadv_choose_tt, 630 + &tt_global->common); 631 + if (!tt_removed_node) 632 + return; 633 + 634 + /* drop reference of remove hash entry */ 635 + tt_removed_entry = hlist_entry(tt_removed_node, 636 + struct batadv_tt_global_entry, 637 + common.hash_entry); 638 + batadv_tt_global_entry_put(tt_removed_entry); 627 639 } 628 640 629 641 /** ··· 1349 1337 unsigned short vid, const char *message, 1350 1338 bool roaming) 1351 1339 { 1340 + struct batadv_tt_local_entry *tt_removed_entry; 1352 1341 struct batadv_tt_local_entry *tt_local_entry; 1353 1342 u16 flags, curr_flags = BATADV_NO_FLAGS; 1354 - void *tt_entry_exists; 1343 + struct hlist_node *tt_removed_node; 1355 1344 1356 1345 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid); 1357 1346 if (!tt_local_entry) ··· 1381 1368 */ 1382 1369 batadv_tt_local_event(bat_priv, tt_local_entry, BATADV_TT_CLIENT_DEL); 1383 1370 1384 - tt_entry_exists = batadv_hash_remove(bat_priv->tt.local_hash, 1371 + tt_removed_node = batadv_hash_remove(bat_priv->tt.local_hash, 1385 1372 batadv_compare_tt, 1386 1373 batadv_choose_tt, 1387 1374 &tt_local_entry->common); 1388 - if (!tt_entry_exists) 1375 + if (!tt_removed_node) 1389 1376 goto out; 1390 1377 1391 - /* extra call to free the local tt entry */ 1392 - batadv_tt_local_entry_put(tt_local_entry); 1378 + /* drop reference of remove hash entry */ 1379 + tt_removed_entry = hlist_entry(tt_removed_node, 1380 + struct batadv_tt_local_entry, 1381 + common.hash_entry); 1382 + batadv_tt_local_entry_put(tt_removed_entry); 1393 1383 1394 1384 out: 1395 1385 if (tt_local_entry)
+3
net/bridge/br_multicast.c
··· 601 601 if (ipv4_is_local_multicast(group)) 602 602 return 0; 603 603 604 + memset(&br_group, 0, sizeof(br_group)); 604 605 br_group.u.ip4 = group; 605 606 br_group.proto = htons(ETH_P_IP); 606 607 br_group.vid = vid; ··· 1498 1497 1499 1498 own_query = port ? &port->ip4_own_query : &br->ip4_own_query; 1500 1499 1500 + memset(&br_group, 0, sizeof(br_group)); 1501 1501 br_group.u.ip4 = group; 1502 1502 br_group.proto = htons(ETH_P_IP); 1503 1503 br_group.vid = vid; ··· 1522 1520 1523 1521 own_query = port ? &port->ip6_own_query : &br->ip6_own_query; 1524 1522 1523 + memset(&br_group, 0, sizeof(br_group)); 1525 1524 br_group.u.ip6 = *group; 1526 1525 br_group.proto = htons(ETH_P_IPV6); 1527 1526 br_group.vid = vid;
+1 -1
net/core/datagram.c
··· 279 279 break; 280 280 281 281 sk_busy_loop(sk, flags & MSG_DONTWAIT); 282 - } while (!skb_queue_empty(&sk->sk_receive_queue)); 282 + } while (sk->sk_receive_queue.prev != *last); 283 283 284 284 error = -EAGAIN; 285 285
+3 -1
net/core/dev.c
··· 5014 5014 if (pt_prev->list_func != NULL) 5015 5015 pt_prev->list_func(head, pt_prev, orig_dev); 5016 5016 else 5017 - list_for_each_entry_safe(skb, next, head, list) 5017 + list_for_each_entry_safe(skb, next, head, list) { 5018 + skb_list_del_init(skb); 5018 5019 pt_prev->func(skb, skb->dev, pt_prev, orig_dev); 5020 + } 5019 5021 } 5020 5022 5021 5023 static void __netif_receive_skb_list_core(struct list_head *head, bool pfmemalloc)
+30 -16
net/core/ethtool.c
··· 1797 1797 WARN_ON_ONCE(!ret); 1798 1798 1799 1799 gstrings.len = ret; 1800 - data = vzalloc(array_size(gstrings.len, ETH_GSTRING_LEN)); 1801 - if (gstrings.len && !data) 1802 - return -ENOMEM; 1803 1800 1804 - __ethtool_get_strings(dev, gstrings.string_set, data); 1801 + if (gstrings.len) { 1802 + data = vzalloc(array_size(gstrings.len, ETH_GSTRING_LEN)); 1803 + if (!data) 1804 + return -ENOMEM; 1805 + 1806 + __ethtool_get_strings(dev, gstrings.string_set, data); 1807 + } else { 1808 + data = NULL; 1809 + } 1805 1810 1806 1811 ret = -EFAULT; 1807 1812 if (copy_to_user(useraddr, &gstrings, sizeof(gstrings))) ··· 1902 1897 return -EFAULT; 1903 1898 1904 1899 stats.n_stats = n_stats; 1905 - data = vzalloc(array_size(n_stats, sizeof(u64))); 1906 - if (n_stats && !data) 1907 - return -ENOMEM; 1908 1900 1909 - ops->get_ethtool_stats(dev, &stats, data); 1901 + if (n_stats) { 1902 + data = vzalloc(array_size(n_stats, sizeof(u64))); 1903 + if (!data) 1904 + return -ENOMEM; 1905 + ops->get_ethtool_stats(dev, &stats, data); 1906 + } else { 1907 + data = NULL; 1908 + } 1910 1909 1911 1910 ret = -EFAULT; 1912 1911 if (copy_to_user(useraddr, &stats, sizeof(stats))) ··· 1950 1941 return -EFAULT; 1951 1942 1952 1943 stats.n_stats = n_stats; 1953 - data = vzalloc(array_size(n_stats, sizeof(u64))); 1954 - if (n_stats && !data) 1955 - return -ENOMEM; 1956 1944 1957 - if (dev->phydev && !ops->get_ethtool_phy_stats) { 1958 - ret = phy_ethtool_get_stats(dev->phydev, &stats, data); 1959 - if (ret < 0) 1960 - return ret; 1945 + if (n_stats) { 1946 + data = vzalloc(array_size(n_stats, sizeof(u64))); 1947 + if (!data) 1948 + return -ENOMEM; 1949 + 1950 + if (dev->phydev && !ops->get_ethtool_phy_stats) { 1951 + ret = phy_ethtool_get_stats(dev->phydev, &stats, data); 1952 + if (ret < 0) 1953 + goto out; 1954 + } else { 1955 + ops->get_ethtool_phy_stats(dev, &stats, data); 1956 + } 1961 1957 } else { 1962 - ops->get_ethtool_phy_stats(dev, &stats, data); 1958 + data = NULL; 1963 1959 } 1964 1960 1965 1961 ret = -EFAULT;
+3 -13
net/core/filter.c
··· 6613 6613 const struct bpf_prog *prog, 6614 6614 struct bpf_insn_access_aux *info) 6615 6615 { 6616 - if (type == BPF_WRITE) { 6617 - switch (off) { 6618 - case bpf_ctx_range_till(struct __sk_buff, cb[0], cb[4]): 6619 - break; 6620 - default: 6621 - return false; 6622 - } 6623 - } 6616 + if (type == BPF_WRITE) 6617 + return false; 6624 6618 6625 6619 switch (off) { 6626 6620 case bpf_ctx_range(struct __sk_buff, data): ··· 6626 6632 case bpf_ctx_range_ptr(struct __sk_buff, flow_keys): 6627 6633 info->reg_type = PTR_TO_FLOW_KEYS; 6628 6634 break; 6629 - case bpf_ctx_range(struct __sk_buff, tc_classid): 6630 - case bpf_ctx_range(struct __sk_buff, data_meta): 6631 - case bpf_ctx_range_till(struct __sk_buff, family, local_port): 6632 - case bpf_ctx_range(struct __sk_buff, tstamp): 6633 - case bpf_ctx_range(struct __sk_buff, wire_len): 6635 + default: 6634 6636 return false; 6635 6637 } 6636 6638
+3 -1
net/core/flow_dissector.c
··· 707 707 /* Pass parameters to the BPF program */ 708 708 memset(flow_keys, 0, sizeof(*flow_keys)); 709 709 cb->qdisc_cb.flow_keys = flow_keys; 710 + flow_keys->n_proto = skb->protocol; 710 711 flow_keys->nhoff = skb_network_offset(skb); 711 712 flow_keys->thoff = flow_keys->nhoff; 712 713 ··· 717 716 /* Restore state */ 718 717 memcpy(cb, &cb_saved, sizeof(cb_saved)); 719 718 720 - flow_keys->nhoff = clamp_t(u16, flow_keys->nhoff, 0, skb->len); 719 + flow_keys->nhoff = clamp_t(u16, flow_keys->nhoff, 720 + skb_network_offset(skb), skb->len); 721 721 flow_keys->thoff = clamp_t(u16, flow_keys->thoff, 722 722 flow_keys->nhoff, skb->len); 723 723
+1
net/core/net_namespace.c
··· 304 304 305 305 refcount_set(&net->count, 1); 306 306 refcount_set(&net->passive, 1); 307 + get_random_bytes(&net->hash_mix, sizeof(u32)); 307 308 net->dev_base_seq = 1; 308 309 net->user_ns = user_ns; 309 310 idr_init(&net->netns_ids);
+1 -1
net/core/skbuff.c
··· 3801 3801 unsigned int delta_truesize; 3802 3802 struct sk_buff *lp; 3803 3803 3804 - if (unlikely(p->len + len >= 65536)) 3804 + if (unlikely(p->len + len >= 65536 || NAPI_GRO_CB(skb)->flush)) 3805 3805 return -E2BIG; 3806 3806 3807 3807 lp = NAPI_GRO_CB(p)->last;
+6 -1
net/dccp/feat.c
··· 738 738 if (dccp_feat_clone_sp_val(&fval, sp_val, sp_len)) 739 739 return -ENOMEM; 740 740 741 - return dccp_feat_push_change(fn, feat, is_local, mandatory, &fval); 741 + if (dccp_feat_push_change(fn, feat, is_local, mandatory, &fval)) { 742 + kfree(fval.sp.vec); 743 + return -ENOMEM; 744 + } 745 + 746 + return 0; 742 747 } 743 748 744 749 /**
+10
net/dsa/tag_qca.c
··· 98 98 return skb; 99 99 } 100 100 101 + static int qca_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto, 102 + int *offset) 103 + { 104 + *offset = QCA_HDR_LEN; 105 + *proto = ((__be16 *)skb->data)[0]; 106 + 107 + return 0; 108 + } 109 + 101 110 const struct dsa_device_ops qca_netdev_ops = { 102 111 .xmit = qca_tag_xmit, 103 112 .rcv = qca_tag_rcv, 113 + .flow_dissect = qca_tag_flow_dissect, 104 114 .overhead = QCA_HDR_LEN, 105 115 };
+3 -4
net/ipv4/ip_input.c
··· 257 257 ip_local_deliver_finish); 258 258 } 259 259 260 - static inline bool ip_rcv_options(struct sk_buff *skb) 260 + static inline bool ip_rcv_options(struct sk_buff *skb, struct net_device *dev) 261 261 { 262 262 struct ip_options *opt; 263 263 const struct iphdr *iph; 264 - struct net_device *dev = skb->dev; 265 264 266 265 /* It looks as overkill, because not all 267 266 IP options require packet mangling. ··· 296 297 } 297 298 } 298 299 299 - if (ip_options_rcv_srr(skb)) 300 + if (ip_options_rcv_srr(skb, dev)) 300 301 goto drop; 301 302 } 302 303 ··· 352 353 } 353 354 #endif 354 355 355 - if (iph->ihl > 5 && ip_rcv_options(skb)) 356 + if (iph->ihl > 5 && ip_rcv_options(skb, dev)) 356 357 goto drop; 357 358 358 359 rt = skb_rtable(skb);
+2 -2
net/ipv4/ip_options.c
··· 612 612 } 613 613 } 614 614 615 - int ip_options_rcv_srr(struct sk_buff *skb) 615 + int ip_options_rcv_srr(struct sk_buff *skb, struct net_device *dev) 616 616 { 617 617 struct ip_options *opt = &(IPCB(skb)->opt); 618 618 int srrspace, srrptr; ··· 647 647 648 648 orefdst = skb->_skb_refdst; 649 649 skb_dst_set(skb, NULL); 650 - err = ip_route_input(skb, nexthop, iph->saddr, iph->tos, skb->dev); 650 + err = ip_route_input(skb, nexthop, iph->saddr, iph->tos, dev); 651 651 rt2 = skb_rtable(skb); 652 652 if (err || (rt2->rt_type != RTN_UNICAST && rt2->rt_type != RTN_LOCAL)) { 653 653 skb_dst_drop(skb);
+18 -18
net/ipv4/tcp_dctcp.c
··· 67 67 module_param(dctcp_alpha_on_init, uint, 0644); 68 68 MODULE_PARM_DESC(dctcp_alpha_on_init, "parameter for initial alpha value"); 69 69 70 - static unsigned int dctcp_clamp_alpha_on_loss __read_mostly; 71 - module_param(dctcp_clamp_alpha_on_loss, uint, 0644); 72 - MODULE_PARM_DESC(dctcp_clamp_alpha_on_loss, 73 - "parameter for clamping alpha on loss"); 74 - 75 70 static struct tcp_congestion_ops dctcp_reno; 76 71 77 72 static void dctcp_reset(const struct tcp_sock *tp, struct dctcp *ca) ··· 159 164 } 160 165 } 161 166 167 + static void dctcp_react_to_loss(struct sock *sk) 168 + { 169 + struct dctcp *ca = inet_csk_ca(sk); 170 + struct tcp_sock *tp = tcp_sk(sk); 171 + 172 + ca->loss_cwnd = tp->snd_cwnd; 173 + tp->snd_ssthresh = max(tp->snd_cwnd >> 1U, 2U); 174 + } 175 + 162 176 static void dctcp_state(struct sock *sk, u8 new_state) 163 177 { 164 - if (dctcp_clamp_alpha_on_loss && new_state == TCP_CA_Loss) { 165 - struct dctcp *ca = inet_csk_ca(sk); 166 - 167 - /* If this extension is enabled, we clamp dctcp_alpha to 168 - * max on packet loss; the motivation is that dctcp_alpha 169 - * is an indicator to the extend of congestion and packet 170 - * loss is an indicator of extreme congestion; setting 171 - * this in practice turned out to be beneficial, and 172 - * effectively assumes total congestion which reduces the 173 - * window by half. 174 - */ 175 - ca->dctcp_alpha = DCTCP_MAX_ALPHA; 176 - } 178 + if (new_state == TCP_CA_Recovery && 179 + new_state != inet_csk(sk)->icsk_ca_state) 180 + dctcp_react_to_loss(sk); 181 + /* We handle RTO in dctcp_cwnd_event to ensure that we perform only 182 + * one loss-adjustment per RTT. 183 + */ 177 184 } 178 185 179 186 static void dctcp_cwnd_event(struct sock *sk, enum tcp_ca_event ev) ··· 186 189 case CA_EVENT_ECN_IS_CE: 187 190 case CA_EVENT_ECN_NO_CE: 188 191 dctcp_ece_ack_update(sk, ev, &ca->prior_rcv_nxt, &ca->ce_state); 192 + break; 193 + case CA_EVENT_LOSS: 194 + dctcp_react_to_loss(sk); 189 195 break; 190 196 default: 191 197 /* Don't care for the rest. */
+2 -1
net/ipv4/tcp_ipv4.c
··· 2578 2578 { 2579 2579 int cpu; 2580 2580 2581 - module_put(net->ipv4.tcp_congestion_control->owner); 2581 + if (net->ipv4.tcp_congestion_control) 2582 + module_put(net->ipv4.tcp_congestion_control->owner); 2582 2583 2583 2584 for_each_possible_cpu(cpu) 2584 2585 inet_ctl_sock_destroy(*per_cpu_ptr(net->ipv4.tcp_sk, cpu));
+1
net/ipv6/ila/ila_xlat.c
··· 417 417 418 418 done: 419 419 rhashtable_walk_stop(&iter); 420 + rhashtable_walk_exit(&iter); 420 421 return ret; 421 422 } 422 423
+3 -1
net/ipv6/ip6_output.c
··· 601 601 inet6_sk(skb->sk) : NULL; 602 602 struct ipv6hdr *tmp_hdr; 603 603 struct frag_hdr *fh; 604 - unsigned int mtu, hlen, left, len; 604 + unsigned int mtu, hlen, left, len, nexthdr_offset; 605 605 int hroom, troom; 606 606 __be32 frag_id; 607 607 int ptr, offset = 0, err = 0; ··· 612 612 goto fail; 613 613 hlen = err; 614 614 nexthdr = *prevhdr; 615 + nexthdr_offset = prevhdr - skb_network_header(skb); 615 616 616 617 mtu = ip6_skb_dst_mtu(skb); 617 618 ··· 647 646 (err = skb_checksum_help(skb))) 648 647 goto fail; 649 648 649 + prevhdr = skb_network_header(skb) + nexthdr_offset; 650 650 hroom = LL_RESERVED_SPACE(rt->dst.dev); 651 651 if (skb_has_frag_list(skb)) { 652 652 unsigned int first_len = skb_pagelen(skb);
+2 -2
net/ipv6/ip6_tunnel.c
··· 627 627 rt = ip_route_output_ports(dev_net(skb->dev), &fl4, NULL, 628 628 eiph->daddr, eiph->saddr, 0, 0, 629 629 IPPROTO_IPIP, RT_TOS(eiph->tos), 0); 630 - if (IS_ERR(rt) || rt->dst.dev->type != ARPHRD_TUNNEL) { 630 + if (IS_ERR(rt) || rt->dst.dev->type != ARPHRD_TUNNEL6) { 631 631 if (!IS_ERR(rt)) 632 632 ip_rt_put(rt); 633 633 goto out; ··· 636 636 } else { 637 637 if (ip_route_input(skb2, eiph->daddr, eiph->saddr, eiph->tos, 638 638 skb2->dev) || 639 - skb_dst(skb2)->dev->type != ARPHRD_TUNNEL) 639 + skb_dst(skb2)->dev->type != ARPHRD_TUNNEL6) 640 640 goto out; 641 641 } 642 642
+4
net/ipv6/sit.c
··· 669 669 !net_eq(tunnel->net, dev_net(tunnel->dev)))) 670 670 goto out; 671 671 672 + /* skb can be uncloned in iptunnel_pull_header, so 673 + * old iph is no longer valid 674 + */ 675 + iph = (const struct iphdr *)skb_mac_header(skb); 672 676 err = IP_ECN_decapsulate(iph, skb); 673 677 if (unlikely(err)) { 674 678 if (log_ecn_error)
+8 -8
net/kcm/kcmsock.c
··· 2054 2054 if (err) 2055 2055 goto fail; 2056 2056 2057 - err = sock_register(&kcm_family_ops); 2058 - if (err) 2059 - goto sock_register_fail; 2060 - 2061 2057 err = register_pernet_device(&kcm_net_ops); 2062 2058 if (err) 2063 2059 goto net_ops_fail; 2060 + 2061 + err = sock_register(&kcm_family_ops); 2062 + if (err) 2063 + goto sock_register_fail; 2064 2064 2065 2065 err = kcm_proc_init(); 2066 2066 if (err) ··· 2069 2069 return 0; 2070 2070 2071 2071 proc_init_fail: 2072 - unregister_pernet_device(&kcm_net_ops); 2073 - 2074 - net_ops_fail: 2075 2072 sock_unregister(PF_KCM); 2076 2073 2077 2074 sock_register_fail: 2075 + unregister_pernet_device(&kcm_net_ops); 2076 + 2077 + net_ops_fail: 2078 2078 proto_unregister(&kcm_proto); 2079 2079 2080 2080 fail: ··· 2090 2090 static void __exit kcm_exit(void) 2091 2091 { 2092 2092 kcm_proc_exit(); 2093 - unregister_pernet_device(&kcm_net_ops); 2094 2093 sock_unregister(PF_KCM); 2094 + unregister_pernet_device(&kcm_net_ops); 2095 2095 proto_unregister(&kcm_proto); 2096 2096 destroy_workqueue(kcm_wq); 2097 2097
+2 -2
net/openvswitch/flow_netlink.c
··· 2306 2306 2307 2307 struct sw_flow_actions *acts; 2308 2308 int new_acts_size; 2309 - int req_size = NLA_ALIGN(attr_len); 2309 + size_t req_size = NLA_ALIGN(attr_len); 2310 2310 int next_offset = offsetof(struct sw_flow_actions, actions) + 2311 2311 (*sfa)->actions_len; 2312 2312 2313 2313 if (req_size <= (ksize(*sfa) - next_offset)) 2314 2314 goto out; 2315 2315 2316 - new_acts_size = ksize(*sfa) * 2; 2316 + new_acts_size = max(next_offset + req_size, ksize(*sfa) * 2); 2317 2317 2318 2318 if (new_acts_size > MAX_ACTIONS_BUFSIZE) { 2319 2319 if ((MAX_ACTIONS_BUFSIZE - next_offset) < req_size) {
+1 -1
net/rds/tcp.c
··· 608 608 list_for_each_entry_safe(tc, _tc, &rds_tcp_conn_list, t_tcp_node) { 609 609 struct net *c_net = read_pnet(&tc->t_cpath->cp_conn->c_net); 610 610 611 - if (net != c_net || !tc->t_sock) 611 + if (net != c_net) 612 612 continue; 613 613 if (!list_has_conn(&tmp_list, tc->t_cpath->cp_conn)) { 614 614 list_move_tail(&tc->t_tcp_node, &tmp_list);
+8 -2
net/sched/act_sample.c
··· 45 45 struct nlattr *tb[TCA_SAMPLE_MAX + 1]; 46 46 struct psample_group *psample_group; 47 47 struct tcf_chain *goto_ch = NULL; 48 + u32 psample_group_num, rate; 48 49 struct tc_sample *parm; 49 - u32 psample_group_num; 50 50 struct tcf_sample *s; 51 51 bool exists = false; 52 52 int ret, err; ··· 85 85 if (err < 0) 86 86 goto release_idr; 87 87 88 + rate = nla_get_u32(tb[TCA_SAMPLE_RATE]); 89 + if (!rate) { 90 + NL_SET_ERR_MSG(extack, "invalid sample rate"); 91 + err = -EINVAL; 92 + goto put_chain; 93 + } 88 94 psample_group_num = nla_get_u32(tb[TCA_SAMPLE_PSAMPLE_GROUP]); 89 95 psample_group = psample_group_get(net, psample_group_num); 90 96 if (!psample_group) { ··· 102 96 103 97 spin_lock_bh(&s->tcf_lock); 104 98 goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch); 105 - s->rate = nla_get_u32(tb[TCA_SAMPLE_RATE]); 99 + s->rate = rate; 106 100 s->psample_group_num = psample_group_num; 107 101 RCU_INIT_POINTER(s->psample_group, psample_group); 108 102
+5
net/sched/cls_matchall.c
··· 130 130 131 131 static void *mall_get(struct tcf_proto *tp, u32 handle) 132 132 { 133 + struct cls_mall_head *head = rtnl_dereference(tp->root); 134 + 135 + if (head && head->handle == handle) 136 + return head; 137 + 133 138 return NULL; 134 139 } 135 140
+12 -1
net/sched/sch_cake.c
··· 1517 1517 1518 1518 static u8 cake_handle_diffserv(struct sk_buff *skb, u16 wash) 1519 1519 { 1520 + int wlen = skb_network_offset(skb); 1520 1521 u8 dscp; 1521 1522 1522 - switch (skb->protocol) { 1523 + switch (tc_skb_protocol(skb)) { 1523 1524 case htons(ETH_P_IP): 1525 + wlen += sizeof(struct iphdr); 1526 + if (!pskb_may_pull(skb, wlen) || 1527 + skb_try_make_writable(skb, wlen)) 1528 + return 0; 1529 + 1524 1530 dscp = ipv4_get_dsfield(ip_hdr(skb)) >> 2; 1525 1531 if (wash && dscp) 1526 1532 ipv4_change_dsfield(ip_hdr(skb), INET_ECN_MASK, 0); 1527 1533 return dscp; 1528 1534 1529 1535 case htons(ETH_P_IPV6): 1536 + wlen += sizeof(struct ipv6hdr); 1537 + if (!pskb_may_pull(skb, wlen) || 1538 + skb_try_make_writable(skb, wlen)) 1539 + return 0; 1540 + 1530 1541 dscp = ipv6_get_dsfield(ipv6_hdr(skb)) >> 2; 1531 1542 if (wash && dscp) 1532 1543 ipv6_change_dsfield(ipv6_hdr(skb), INET_ECN_MASK, 0);
+4 -6
net/sched/sch_cbq.c
··· 1358 1358 { 1359 1359 struct cbq_sched_data *q = qdisc_priv(sch); 1360 1360 struct cbq_class *cl = (struct cbq_class *)arg; 1361 + __u32 qlen; 1361 1362 1362 1363 cl->xstats.avgidle = cl->avgidle; 1363 1364 cl->xstats.undertime = 0; 1365 + qdisc_qstats_qlen_backlog(cl->q, &qlen, &cl->qstats.backlog); 1364 1366 1365 1367 if (cl->undertime != PSCHED_PASTPERFECT) 1366 1368 cl->xstats.undertime = cl->undertime - q->now; ··· 1370 1368 if (gnet_stats_copy_basic(qdisc_root_sleeping_running(sch), 1371 1369 d, NULL, &cl->bstats) < 0 || 1372 1370 gnet_stats_copy_rate_est(d, &cl->rate_est) < 0 || 1373 - gnet_stats_copy_queue(d, NULL, &cl->qstats, cl->q->q.qlen) < 0) 1371 + gnet_stats_copy_queue(d, NULL, &cl->qstats, qlen) < 0) 1374 1372 return -1; 1375 1373 1376 1374 return gnet_stats_copy_app(d, &cl->xstats, sizeof(cl->xstats)); ··· 1667 1665 { 1668 1666 struct cbq_sched_data *q = qdisc_priv(sch); 1669 1667 struct cbq_class *cl = (struct cbq_class *)arg; 1670 - unsigned int qlen, backlog; 1671 1668 1672 1669 if (cl->filters || cl->children || cl == &q->link) 1673 1670 return -EBUSY; 1674 1671 1675 1672 sch_tree_lock(sch); 1676 1673 1677 - qlen = cl->q->q.qlen; 1678 - backlog = cl->q->qstats.backlog; 1679 - qdisc_reset(cl->q); 1680 - qdisc_tree_reduce_backlog(cl->q, qlen, backlog); 1674 + qdisc_purge_queue(cl->q); 1681 1675 1682 1676 if (cl->next_alive) 1683 1677 cbq_deactivate_class(cl);
+4 -12
net/sched/sch_drr.c
··· 50 50 return container_of(clc, struct drr_class, common); 51 51 } 52 52 53 - static void drr_purge_queue(struct drr_class *cl) 54 - { 55 - unsigned int len = cl->qdisc->q.qlen; 56 - unsigned int backlog = cl->qdisc->qstats.backlog; 57 - 58 - qdisc_reset(cl->qdisc); 59 - qdisc_tree_reduce_backlog(cl->qdisc, len, backlog); 60 - } 61 - 62 53 static const struct nla_policy drr_policy[TCA_DRR_MAX + 1] = { 63 54 [TCA_DRR_QUANTUM] = { .type = NLA_U32 }, 64 55 }; ··· 158 167 159 168 sch_tree_lock(sch); 160 169 161 - drr_purge_queue(cl); 170 + qdisc_purge_queue(cl->qdisc); 162 171 qdisc_class_hash_remove(&q->clhash, &cl->common); 163 172 164 173 sch_tree_unlock(sch); ··· 260 269 struct gnet_dump *d) 261 270 { 262 271 struct drr_class *cl = (struct drr_class *)arg; 263 - __u32 qlen = cl->qdisc->q.qlen; 272 + __u32 qlen = qdisc_qlen_sum(cl->qdisc); 273 + struct Qdisc *cl_q = cl->qdisc; 264 274 struct tc_drr_stats xstats; 265 275 266 276 memset(&xstats, 0, sizeof(xstats)); ··· 271 279 if (gnet_stats_copy_basic(qdisc_root_sleeping_running(sch), 272 280 d, NULL, &cl->bstats) < 0 || 273 281 gnet_stats_copy_rate_est(d, &cl->rate_est) < 0 || 274 - gnet_stats_copy_queue(d, NULL, &cl->qdisc->qstats, qlen) < 0) 282 + gnet_stats_copy_queue(d, cl_q->cpu_qstats, &cl_q->qstats, qlen) < 0) 275 283 return -1; 276 284 277 285 return gnet_stats_copy_app(d, &xstats, sizeof(xstats));
+5 -14
net/sched/sch_hfsc.c
··· 845 845 } 846 846 847 847 static void 848 - hfsc_purge_queue(struct Qdisc *sch, struct hfsc_class *cl) 849 - { 850 - unsigned int len = cl->qdisc->q.qlen; 851 - unsigned int backlog = cl->qdisc->qstats.backlog; 852 - 853 - qdisc_reset(cl->qdisc); 854 - qdisc_tree_reduce_backlog(cl->qdisc, len, backlog); 855 - } 856 - 857 - static void 858 848 hfsc_adjust_levels(struct hfsc_class *cl) 859 849 { 860 850 struct hfsc_class *p; ··· 1066 1076 qdisc_class_hash_insert(&q->clhash, &cl->cl_common); 1067 1077 list_add_tail(&cl->siblings, &parent->children); 1068 1078 if (parent->level == 0) 1069 - hfsc_purge_queue(sch, parent); 1079 + qdisc_purge_queue(parent->qdisc); 1070 1080 hfsc_adjust_levels(parent); 1071 1081 sch_tree_unlock(sch); 1072 1082 ··· 1102 1112 list_del(&cl->siblings); 1103 1113 hfsc_adjust_levels(cl->cl_parent); 1104 1114 1105 - hfsc_purge_queue(sch, cl); 1115 + qdisc_purge_queue(cl->qdisc); 1106 1116 qdisc_class_hash_remove(&q->clhash, &cl->cl_common); 1107 1117 1108 1118 sch_tree_unlock(sch); ··· 1318 1328 { 1319 1329 struct hfsc_class *cl = (struct hfsc_class *)arg; 1320 1330 struct tc_hfsc_stats xstats; 1331 + __u32 qlen; 1321 1332 1322 - cl->qstats.backlog = cl->qdisc->qstats.backlog; 1333 + qdisc_qstats_qlen_backlog(cl->qdisc, &qlen, &cl->qstats.backlog); 1323 1334 xstats.level = cl->level; 1324 1335 xstats.period = cl->cl_vtperiod; 1325 1336 xstats.work = cl->cl_total; ··· 1328 1337 1329 1338 if (gnet_stats_copy_basic(qdisc_root_sleeping_running(sch), d, NULL, &cl->bstats) < 0 || 1330 1339 gnet_stats_copy_rate_est(d, &cl->rate_est) < 0 || 1331 - gnet_stats_copy_queue(d, NULL, &cl->qstats, cl->qdisc->q.qlen) < 0) 1340 + gnet_stats_copy_queue(d, NULL, &cl->qstats, qlen) < 0) 1332 1341 return -1; 1333 1342 1334 1343 return gnet_stats_copy_app(d, &xstats, sizeof(xstats));
+6 -16
net/sched/sch_htb.c
··· 1127 1127 }; 1128 1128 __u32 qlen = 0; 1129 1129 1130 - if (!cl->level && cl->leaf.q) { 1131 - qlen = cl->leaf.q->q.qlen; 1132 - qs.backlog = cl->leaf.q->qstats.backlog; 1133 - } 1130 + if (!cl->level && cl->leaf.q) 1131 + qdisc_qstats_qlen_backlog(cl->leaf.q, &qlen, &qs.backlog); 1132 + 1134 1133 cl->xstats.tokens = clamp_t(s64, PSCHED_NS2TICKS(cl->tokens), 1135 1134 INT_MIN, INT_MAX); 1136 1135 cl->xstats.ctokens = clamp_t(s64, PSCHED_NS2TICKS(cl->ctokens), ··· 1269 1270 1270 1271 sch_tree_lock(sch); 1271 1272 1272 - if (!cl->level) { 1273 - unsigned int qlen = cl->leaf.q->q.qlen; 1274 - unsigned int backlog = cl->leaf.q->qstats.backlog; 1275 - 1276 - qdisc_reset(cl->leaf.q); 1277 - qdisc_tree_reduce_backlog(cl->leaf.q, qlen, backlog); 1278 - } 1273 + if (!cl->level) 1274 + qdisc_purge_queue(cl->leaf.q); 1279 1275 1280 1276 /* delete from hash and active; remainder in destroy_class */ 1281 1277 qdisc_class_hash_remove(&q->clhash, &cl->common); ··· 1398 1404 classid, NULL); 1399 1405 sch_tree_lock(sch); 1400 1406 if (parent && !parent->level) { 1401 - unsigned int qlen = parent->leaf.q->q.qlen; 1402 - unsigned int backlog = parent->leaf.q->qstats.backlog; 1403 - 1404 1407 /* turn parent into inner node */ 1405 - qdisc_reset(parent->leaf.q); 1406 - qdisc_tree_reduce_backlog(parent->leaf.q, qlen, backlog); 1408 + qdisc_purge_queue(parent->leaf.q); 1407 1409 qdisc_put(parent->leaf.q); 1408 1410 if (parent->prio_activity) 1409 1411 htb_deactivate(q, parent);
+1 -1
net/sched/sch_mq.c
··· 249 249 250 250 sch = dev_queue->qdisc_sleeping; 251 251 if (gnet_stats_copy_basic(&sch->running, d, NULL, &sch->bstats) < 0 || 252 - gnet_stats_copy_queue(d, NULL, &sch->qstats, sch->q.qlen) < 0) 252 + qdisc_qstats_copy(d, sch) < 0) 253 253 return -1; 254 254 return 0; 255 255 }
+1 -2
net/sched/sch_mqprio.c
··· 561 561 sch = dev_queue->qdisc_sleeping; 562 562 if (gnet_stats_copy_basic(qdisc_root_sleeping_running(sch), 563 563 d, NULL, &sch->bstats) < 0 || 564 - gnet_stats_copy_queue(d, NULL, 565 - &sch->qstats, sch->q.qlen) < 0) 564 + qdisc_qstats_copy(d, sch) < 0) 566 565 return -1; 567 566 } 568 567 return 0;
+4 -6
net/sched/sch_multiq.c
··· 201 201 for (i = q->bands; i < q->max_bands; i++) { 202 202 if (q->queues[i] != &noop_qdisc) { 203 203 struct Qdisc *child = q->queues[i]; 204 + 204 205 q->queues[i] = &noop_qdisc; 205 - qdisc_tree_reduce_backlog(child, child->q.qlen, 206 - child->qstats.backlog); 206 + qdisc_tree_flush_backlog(child); 207 207 qdisc_put(child); 208 208 } 209 209 } ··· 225 225 qdisc_hash_add(child, true); 226 226 227 227 if (old != &noop_qdisc) { 228 - qdisc_tree_reduce_backlog(old, 229 - old->q.qlen, 230 - old->qstats.backlog); 228 + qdisc_tree_flush_backlog(old); 231 229 qdisc_put(old); 232 230 } 233 231 sch_tree_unlock(sch); ··· 342 344 cl_q = q->queues[cl - 1]; 343 345 if (gnet_stats_copy_basic(qdisc_root_sleeping_running(sch), 344 346 d, NULL, &cl_q->bstats) < 0 || 345 - gnet_stats_copy_queue(d, NULL, &cl_q->qstats, cl_q->q.qlen) < 0) 347 + qdisc_qstats_copy(d, cl_q) < 0) 346 348 return -1; 347 349 348 350 return 0;
+3 -7
net/sched/sch_prio.c
··· 216 216 q->bands = qopt->bands; 217 217 memcpy(q->prio2band, qopt->priomap, TC_PRIO_MAX+1); 218 218 219 - for (i = q->bands; i < oldbands; i++) { 220 - struct Qdisc *child = q->queues[i]; 221 - 222 - qdisc_tree_reduce_backlog(child, child->q.qlen, 223 - child->qstats.backlog); 224 - } 219 + for (i = q->bands; i < oldbands; i++) 220 + qdisc_tree_flush_backlog(q->queues[i]); 225 221 226 222 for (i = oldbands; i < q->bands; i++) { 227 223 q->queues[i] = queues[i]; ··· 361 365 cl_q = q->queues[cl - 1]; 362 366 if (gnet_stats_copy_basic(qdisc_root_sleeping_running(sch), 363 367 d, NULL, &cl_q->bstats) < 0 || 364 - gnet_stats_copy_queue(d, NULL, &cl_q->qstats, cl_q->q.qlen) < 0) 368 + qdisc_qstats_copy(d, cl_q) < 0) 365 369 return -1; 366 370 367 371 return 0;
+2 -12
net/sched/sch_qfq.c
··· 217 217 return container_of(clc, struct qfq_class, common); 218 218 } 219 219 220 - static void qfq_purge_queue(struct qfq_class *cl) 221 - { 222 - unsigned int len = cl->qdisc->q.qlen; 223 - unsigned int backlog = cl->qdisc->qstats.backlog; 224 - 225 - qdisc_reset(cl->qdisc); 226 - qdisc_tree_reduce_backlog(cl->qdisc, len, backlog); 227 - } 228 - 229 220 static const struct nla_policy qfq_policy[TCA_QFQ_MAX + 1] = { 230 221 [TCA_QFQ_WEIGHT] = { .type = NLA_U32 }, 231 222 [TCA_QFQ_LMAX] = { .type = NLA_U32 }, ··· 542 551 543 552 sch_tree_lock(sch); 544 553 545 - qfq_purge_queue(cl); 554 + qdisc_purge_queue(cl->qdisc); 546 555 qdisc_class_hash_remove(&q->clhash, &cl->common); 547 556 548 557 sch_tree_unlock(sch); ··· 646 655 if (gnet_stats_copy_basic(qdisc_root_sleeping_running(sch), 647 656 d, NULL, &cl->bstats) < 0 || 648 657 gnet_stats_copy_rate_est(d, &cl->rate_est) < 0 || 649 - gnet_stats_copy_queue(d, NULL, 650 - &cl->qdisc->qstats, cl->qdisc->q.qlen) < 0) 658 + qdisc_qstats_copy(d, cl->qdisc) < 0) 651 659 return -1; 652 660 653 661 return gnet_stats_copy_app(d, &xstats, sizeof(xstats));
+1 -2
net/sched/sch_red.c
··· 233 233 q->flags = ctl->flags; 234 234 q->limit = ctl->limit; 235 235 if (child) { 236 - qdisc_tree_reduce_backlog(q->qdisc, q->qdisc->q.qlen, 237 - q->qdisc->qstats.backlog); 236 + qdisc_tree_flush_backlog(q->qdisc); 238 237 old_child = q->qdisc; 239 238 q->qdisc = child; 240 239 }
+1 -2
net/sched/sch_sfb.c
··· 521 521 qdisc_hash_add(child, true); 522 522 sch_tree_lock(sch); 523 523 524 - qdisc_tree_reduce_backlog(q->qdisc, q->qdisc->q.qlen, 525 - q->qdisc->qstats.backlog); 524 + qdisc_tree_flush_backlog(q->qdisc); 526 525 qdisc_put(q->qdisc); 527 526 q->qdisc = child; 528 527
+1 -1
net/sched/sch_taprio.c
··· 895 895 896 896 sch = dev_queue->qdisc_sleeping; 897 897 if (gnet_stats_copy_basic(&sch->running, d, NULL, &sch->bstats) < 0 || 898 - gnet_stats_copy_queue(d, NULL, &sch->qstats, sch->q.qlen) < 0) 898 + qdisc_qstats_copy(d, sch) < 0) 899 899 return -1; 900 900 return 0; 901 901 }
+1 -2
net/sched/sch_tbf.c
··· 391 391 392 392 sch_tree_lock(sch); 393 393 if (child) { 394 - qdisc_tree_reduce_backlog(q->qdisc, q->qdisc->q.qlen, 395 - q->qdisc->qstats.backlog); 394 + qdisc_tree_flush_backlog(q->qdisc); 396 395 qdisc_put(q->qdisc); 397 396 q->qdisc = child; 398 397 }
+1
net/sctp/protocol.c
··· 600 600 static int sctp_v4_addr_to_user(struct sctp_sock *sp, union sctp_addr *addr) 601 601 { 602 602 /* No address mapping for V4 sockets */ 603 + memset(addr->v4.sin_zero, 0, sizeof(addr->v4.sin_zero)); 603 604 return sizeof(struct sockaddr_in); 604 605 } 605 606
+2
net/tls/tls_sw.c
··· 1484 1484 1485 1485 return err; 1486 1486 } 1487 + } else { 1488 + *zc = false; 1487 1489 } 1488 1490 1489 1491 rxm->full_len -= padding_length(ctx, tls_ctx, skb);
+4 -3
tools/lib/bpf/Makefile
··· 177 177 178 178 $(OUTPUT)libbpf.so.$(LIBBPF_VERSION): $(BPF_IN) 179 179 $(QUIET_LINK)$(CC) --shared -Wl,-soname,libbpf.so.$(VERSION) \ 180 - -Wl,--version-script=$(VERSION_SCRIPT) $^ -o $@ 180 + -Wl,--version-script=$(VERSION_SCRIPT) $^ -lelf -o $@ 181 181 @ln -sf $(@F) $(OUTPUT)libbpf.so 182 182 @ln -sf $(@F) $(OUTPUT)libbpf.so.$(VERSION) 183 183 ··· 220 220 install_headers: 221 221 $(call QUIET_INSTALL, headers) \ 222 222 $(call do_install,bpf.h,$(prefix)/include/bpf,644); \ 223 - $(call do_install,libbpf.h,$(prefix)/include/bpf,644); 224 - $(call do_install,btf.h,$(prefix)/include/bpf,644); 223 + $(call do_install,libbpf.h,$(prefix)/include/bpf,644); \ 224 + $(call do_install,btf.h,$(prefix)/include/bpf,644); \ 225 + $(call do_install,xsk.h,$(prefix)/include/bpf,644); 225 226 226 227 install: install_lib 227 228
+3
tools/lib/bpf/btf.c
··· 2107 2107 return fwd_kind == real_kind; 2108 2108 } 2109 2109 2110 + if (cand_kind != canon_kind) 2111 + return 0; 2112 + 2110 2113 switch (cand_kind) { 2111 2114 case BTF_KIND_INT: 2112 2115 return btf_equal_int(cand_type, canon_type);
+68
tools/testing/selftests/bpf/prog_tests/flow_dissector.c
··· 39 39 .n_proto = __bpf_constant_htons(ETH_P_IPV6), 40 40 }; 41 41 42 + #define VLAN_HLEN 4 43 + 44 + static struct { 45 + struct ethhdr eth; 46 + __u16 vlan_tci; 47 + __u16 vlan_proto; 48 + struct iphdr iph; 49 + struct tcphdr tcp; 50 + } __packed pkt_vlan_v4 = { 51 + .eth.h_proto = __bpf_constant_htons(ETH_P_8021Q), 52 + .vlan_proto = __bpf_constant_htons(ETH_P_IP), 53 + .iph.ihl = 5, 54 + .iph.protocol = IPPROTO_TCP, 55 + .iph.tot_len = __bpf_constant_htons(MAGIC_BYTES), 56 + .tcp.urg_ptr = 123, 57 + .tcp.doff = 5, 58 + }; 59 + 60 + static struct bpf_flow_keys pkt_vlan_v4_flow_keys = { 61 + .nhoff = VLAN_HLEN, 62 + .thoff = VLAN_HLEN + sizeof(struct iphdr), 63 + .addr_proto = ETH_P_IP, 64 + .ip_proto = IPPROTO_TCP, 65 + .n_proto = __bpf_constant_htons(ETH_P_IP), 66 + }; 67 + 68 + static struct { 69 + struct ethhdr eth; 70 + __u16 vlan_tci; 71 + __u16 vlan_proto; 72 + __u16 vlan_tci2; 73 + __u16 vlan_proto2; 74 + struct ipv6hdr iph; 75 + struct tcphdr tcp; 76 + } __packed pkt_vlan_v6 = { 77 + .eth.h_proto = __bpf_constant_htons(ETH_P_8021AD), 78 + .vlan_proto = __bpf_constant_htons(ETH_P_8021Q), 79 + .vlan_proto2 = __bpf_constant_htons(ETH_P_IPV6), 80 + .iph.nexthdr = IPPROTO_TCP, 81 + .iph.payload_len = __bpf_constant_htons(MAGIC_BYTES), 82 + .tcp.urg_ptr = 123, 83 + .tcp.doff = 5, 84 + }; 85 + 86 + static struct bpf_flow_keys pkt_vlan_v6_flow_keys = { 87 + .nhoff = VLAN_HLEN * 2, 88 + .thoff = VLAN_HLEN * 2 + sizeof(struct ipv6hdr), 89 + .addr_proto = ETH_P_IPV6, 90 + .ip_proto = IPPROTO_TCP, 91 + .n_proto = __bpf_constant_htons(ETH_P_IPV6), 92 + }; 93 + 42 94 void test_flow_dissector(void) 43 95 { 44 96 struct bpf_flow_keys flow_keys; ··· 119 67 "err %d errno %d retval %d duration %d size %u/%lu\n", 120 68 err, errno, retval, duration, size, sizeof(flow_keys)); 121 69 CHECK_FLOW_KEYS("ipv6_flow_keys", flow_keys, pkt_v6_flow_keys); 70 + 71 + err = bpf_prog_test_run(prog_fd, 10, &pkt_vlan_v4, sizeof(pkt_vlan_v4), 72 + &flow_keys, &size, &retval, &duration); 73 + CHECK(size != sizeof(flow_keys) || err || retval != 1, "vlan_ipv4", 74 + "err %d errno %d retval %d duration %d size %u/%lu\n", 75 + err, errno, retval, duration, size, sizeof(flow_keys)); 76 + CHECK_FLOW_KEYS("vlan_ipv4_flow_keys", flow_keys, 77 + pkt_vlan_v4_flow_keys); 78 + 79 + err = bpf_prog_test_run(prog_fd, 10, &pkt_vlan_v6, sizeof(pkt_vlan_v6), 80 + &flow_keys, &size, &retval, &duration); 81 + CHECK(size != sizeof(flow_keys) || err || retval != 1, "vlan_ipv6", 82 + "err %d errno %d retval %d duration %d size %u/%lu\n", 83 + err, errno, retval, duration, size, sizeof(flow_keys)); 84 + CHECK_FLOW_KEYS("vlan_ipv6_flow_keys", flow_keys, 85 + pkt_vlan_v6_flow_keys); 122 86 123 87 bpf_object__close(obj); 124 88 }
+7 -12
tools/testing/selftests/bpf/progs/bpf_flow.c
··· 92 92 { 93 93 struct bpf_flow_keys *keys = skb->flow_keys; 94 94 95 - keys->n_proto = proto; 96 95 switch (proto) { 97 96 case bpf_htons(ETH_P_IP): 98 97 bpf_tail_call(skb, &jmp_table, IP); ··· 118 119 SEC("flow_dissector") 119 120 int _dissect(struct __sk_buff *skb) 120 121 { 121 - if (!skb->vlan_present) 122 - return parse_eth_proto(skb, skb->protocol); 123 - else 124 - return parse_eth_proto(skb, skb->vlan_proto); 122 + struct bpf_flow_keys *keys = skb->flow_keys; 123 + 124 + return parse_eth_proto(skb, keys->n_proto); 125 125 } 126 126 127 127 /* Parses on IPPROTO_* */ ··· 334 336 { 335 337 struct bpf_flow_keys *keys = skb->flow_keys; 336 338 struct vlan_hdr *vlan, _vlan; 337 - __be16 proto; 338 - 339 - /* Peek back to see if single or double-tagging */ 340 - if (bpf_skb_load_bytes(skb, keys->thoff - sizeof(proto), &proto, 341 - sizeof(proto))) 342 - return BPF_DROP; 343 339 344 340 /* Account for double-tagging */ 345 - if (proto == bpf_htons(ETH_P_8021AD)) { 341 + if (keys->n_proto == bpf_htons(ETH_P_8021AD)) { 346 342 vlan = bpf_flow_dissect_get_header(skb, sizeof(*vlan), &_vlan); 347 343 if (!vlan) 348 344 return BPF_DROP; ··· 344 352 if (vlan->h_vlan_encapsulated_proto != bpf_htons(ETH_P_8021Q)) 345 353 return BPF_DROP; 346 354 355 + keys->nhoff += sizeof(*vlan); 347 356 keys->thoff += sizeof(*vlan); 348 357 } 349 358 ··· 352 359 if (!vlan) 353 360 return BPF_DROP; 354 361 362 + keys->nhoff += sizeof(*vlan); 355 363 keys->thoff += sizeof(*vlan); 356 364 /* Only allow 8021AD + 8021Q double tagging and no triple tagging.*/ 357 365 if (vlan->h_vlan_encapsulated_proto == bpf_htons(ETH_P_8021AD) || 358 366 vlan->h_vlan_encapsulated_proto == bpf_htons(ETH_P_8021Q)) 359 367 return BPF_DROP; 360 368 369 + keys->n_proto = vlan->h_vlan_encapsulated_proto; 361 370 return parse_eth_proto(skb, vlan->h_vlan_encapsulated_proto); 362 371 } 363 372
+47
tools/testing/selftests/bpf/test_btf.c
··· 5777 5777 }, 5778 5778 }, 5779 5779 { 5780 + .descr = "dedup: void equiv check", 5781 + /* 5782 + * // CU 1: 5783 + * struct s { 5784 + * struct {} *x; 5785 + * }; 5786 + * // CU 2: 5787 + * struct s { 5788 + * int *x; 5789 + * }; 5790 + */ 5791 + .input = { 5792 + .raw_types = { 5793 + /* CU 1 */ 5794 + BTF_STRUCT_ENC(0, 0, 1), /* [1] struct {} */ 5795 + BTF_PTR_ENC(1), /* [2] ptr -> [1] */ 5796 + BTF_STRUCT_ENC(NAME_NTH(1), 1, 8), /* [3] struct s */ 5797 + BTF_MEMBER_ENC(NAME_NTH(2), 2, 0), 5798 + /* CU 2 */ 5799 + BTF_PTR_ENC(0), /* [4] ptr -> void */ 5800 + BTF_STRUCT_ENC(NAME_NTH(1), 1, 8), /* [5] struct s */ 5801 + BTF_MEMBER_ENC(NAME_NTH(2), 4, 0), 5802 + BTF_END_RAW, 5803 + }, 5804 + BTF_STR_SEC("\0s\0x"), 5805 + }, 5806 + .expect = { 5807 + .raw_types = { 5808 + /* CU 1 */ 5809 + BTF_STRUCT_ENC(0, 0, 1), /* [1] struct {} */ 5810 + BTF_PTR_ENC(1), /* [2] ptr -> [1] */ 5811 + BTF_STRUCT_ENC(NAME_NTH(1), 1, 8), /* [3] struct s */ 5812 + BTF_MEMBER_ENC(NAME_NTH(2), 2, 0), 5813 + /* CU 2 */ 5814 + BTF_PTR_ENC(0), /* [4] ptr -> void */ 5815 + BTF_STRUCT_ENC(NAME_NTH(1), 1, 8), /* [5] struct s */ 5816 + BTF_MEMBER_ENC(NAME_NTH(2), 4, 0), 5817 + BTF_END_RAW, 5818 + }, 5819 + BTF_STR_SEC("\0s\0x"), 5820 + }, 5821 + .opts = { 5822 + .dont_resolve_fwds = false, 5823 + .dedup_table_size = 1, /* force hash collisions */ 5824 + }, 5825 + }, 5826 + { 5780 5827 .descr = "dedup: all possible kinds (no duplicates)", 5781 5828 .input = { 5782 5829 .raw_types = {
+38
tools/testing/selftests/bpf/verifier/calls.c
··· 908 908 .result = REJECT, 909 909 }, 910 910 { 911 + "calls: stack depth check in dead code", 912 + .insns = { 913 + /* main */ 914 + BPF_MOV64_IMM(BPF_REG_1, 0), 915 + BPF_RAW_INSN(BPF_JMP|BPF_CALL, 0, 1, 0, 1), /* call A */ 916 + BPF_EXIT_INSN(), 917 + /* A */ 918 + BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 0, 1), 919 + BPF_RAW_INSN(BPF_JMP|BPF_CALL, 0, 1, 0, 2), /* call B */ 920 + BPF_MOV64_IMM(BPF_REG_0, 0), 921 + BPF_EXIT_INSN(), 922 + /* B */ 923 + BPF_RAW_INSN(BPF_JMP|BPF_CALL, 0, 1, 0, 1), /* call C */ 924 + BPF_EXIT_INSN(), 925 + /* C */ 926 + BPF_RAW_INSN(BPF_JMP|BPF_CALL, 0, 1, 0, 1), /* call D */ 927 + BPF_EXIT_INSN(), 928 + /* D */ 929 + BPF_RAW_INSN(BPF_JMP|BPF_CALL, 0, 1, 0, 1), /* call E */ 930 + BPF_EXIT_INSN(), 931 + /* E */ 932 + BPF_RAW_INSN(BPF_JMP|BPF_CALL, 0, 1, 0, 1), /* call F */ 933 + BPF_EXIT_INSN(), 934 + /* F */ 935 + BPF_RAW_INSN(BPF_JMP|BPF_CALL, 0, 1, 0, 1), /* call G */ 936 + BPF_EXIT_INSN(), 937 + /* G */ 938 + BPF_RAW_INSN(BPF_JMP|BPF_CALL, 0, 1, 0, 1), /* call H */ 939 + BPF_EXIT_INSN(), 940 + /* H */ 941 + BPF_MOV64_IMM(BPF_REG_0, 0), 942 + BPF_EXIT_INSN(), 943 + }, 944 + .prog_type = BPF_PROG_TYPE_XDP, 945 + .errstr = "call stack", 946 + .result = REJECT, 947 + }, 948 + { 911 949 "calls: spill into caller stack frame", 912 950 .insns = { 913 951 BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0),
+24
tools/testing/selftests/tc-testing/tc-tests/actions/sample.json
··· 144 144 ] 145 145 }, 146 146 { 147 + "id": "7571", 148 + "name": "Add sample action with invalid rate", 149 + "category": [ 150 + "actions", 151 + "sample" 152 + ], 153 + "setup": [ 154 + [ 155 + "$TC actions flush action sample", 156 + 0, 157 + 1, 158 + 255 159 + ] 160 + ], 161 + "cmdUnderTest": "$TC actions add action sample rate 0 group 1 index 2", 162 + "expExitCode": "255", 163 + "verifyCmd": "$TC actions get action sample index 2", 164 + "matchPattern": "action order [0-9]+: sample rate 1/0 group 1.*index 2 ref", 165 + "matchCount": "0", 166 + "teardown": [ 167 + "$TC actions flush action sample" 168 + ] 169 + }, 170 + { 147 171 "id": "b6d4", 148 172 "name": "Add sample action with mandatory arguments and invalid control action", 149 173 "category": [