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

Configure Feed

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

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

Pull networking fixes from Jakub Kicinski:
"Including fixes from CAN and wireless.

Pretty big, but hard to make up any cohesive story that would explain
it, a random collection of fixes. The two reverts of bad patches from
this release here feel like stuff that'd normally show up by rc5 or
rc6. Perhaps obvious thing to say, given the holiday timing.

That said, no active investigations / regressions. Let's see what the
next week brings.

Current release - fix to a fix:

- can: alloc_candev_mqs(): add missing default CAN capabilities

Current release - regressions:

- usbnet: fix crash due to missing BQL accounting after resume

- Revert "net: wwan: mhi_wwan_mbim: Avoid -Wflex-array-member-not ...

Previous releases - regressions:

- Revert "nfc/nci: Add the inconsistency check between the input ...

Previous releases - always broken:

- number of driver fixes for incorrect use of seqlocks on stats

- rxrpc: fix recvmsg() unconditional requeue, don't corrupt rcv queue
when MSG_PEEK was set

- ipvlan: make the addrs_lock be per port avoid races in the port
hash table

- sched: enforce that teql can only be used as root qdisc

- virtio: coalesce only linear skb

- wifi: ath12k: fix dead lock while flushing management frames

- eth: igc: reduce TSN TX packet buffer from 7KB to 5KB per queue"

* tag 'net-6.19-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (96 commits)
Octeontx2-af: Add proper checks for fwdata
dpll: Prevent duplicate registrations
net/sched: act_ife: avoid possible NULL deref
hinic3: Fix netif_queue_set_napi queue_index input parameter error
vsock/test: add stream TX credit bounds test
vsock/virtio: cap TX credit to local buffer size
vsock/test: fix seqpacket message bounds test
vsock/virtio: fix potential underflow in virtio_transport_get_credit()
net: fec: account for VLAN header in frame length calculations
net: openvswitch: fix data race in ovs_vport_get_upcall_stats
octeontx2-af: Fix error handling
net: pcs: pcs-mtk-lynxi: report in-band capability for 2500Base-X
rxrpc: Fix data-race warning and potential load/store tearing
net: dsa: fix off-by-one in maximum bridge ID determination
net: bcmasp: Fix network filter wake for asp-3.0
bonding: provide a net pointer to __skb_flow_dissect()
selftests: net: amt: wait longer for connection before sending packets
be2net: Fix NULL pointer dereference in be_cmd_get_mac_from_list
Revert "net: wwan: mhi_wwan_mbim: Avoid -Wflex-array-member-not-at-end warning"
netrom: fix double-free in nr_route_frame()
...

+1144 -472
+4
CREDITS
··· 2231 2231 S: L3R 8B2 2232 2232 S: Canada 2233 2233 2234 + N: Krzysztof Kozlowski 2235 + E: krzk@kernel.org 2236 + D: NFC network subsystem and drivers maintainer 2237 + 2234 2238 N: Christian Krafft 2235 2239 D: PowerPC Cell support 2236 2240
+2
Documentation/netlink/specs/fou.yaml
··· 39 39 - 40 40 name: ipproto 41 41 type: u8 42 + checks: 43 + min: 1 42 44 - 43 45 name: type 44 46 type: u8
+12
Documentation/process/maintainer-netdev.rst
··· 363 363 with better review coverage. Re-posting large series also increases the mailing 364 364 list traffic. 365 365 366 + Limit patches outstanding on mailing list 367 + ----------------------------------------- 368 + 369 + Avoid having more than 15 patches, across all series, outstanding for 370 + review on the mailing list for a single tree. In other words, a maximum of 371 + 15 patches under review on net, and a maximum of 15 patches under review on 372 + net-next. 373 + 374 + This limit is intended to focus developer effort on testing patches before 375 + upstream review. Aiding the quality of upstream submissions, and easing the 376 + load on reviewers. 377 + 366 378 .. _rcs: 367 379 368 380 Local variable ordering ("reverse xmas tree", "RCS")
+1 -2
MAINTAINERS
··· 18486 18486 F: net/ipv4/nexthop.c 18487 18487 18488 18488 NFC SUBSYSTEM 18489 - M: Krzysztof Kozlowski <krzk@kernel.org> 18490 18489 L: netdev@vger.kernel.org 18491 - S: Maintained 18490 + S: Orphan 18492 18491 F: Documentation/devicetree/bindings/net/nfc/ 18493 18492 F: drivers/nfc/ 18494 18493 F: include/net/nfc/
+4 -8
drivers/dpll/dpll_core.c
··· 83 83 if (ref->pin != pin) 84 84 continue; 85 85 reg = dpll_pin_registration_find(ref, ops, priv, cookie); 86 - if (reg) { 87 - refcount_inc(&ref->refcount); 88 - return 0; 89 - } 86 + if (reg) 87 + return -EEXIST; 90 88 ref_exists = true; 91 89 break; 92 90 } ··· 162 164 if (ref->dpll != dpll) 163 165 continue; 164 166 reg = dpll_pin_registration_find(ref, ops, priv, cookie); 165 - if (reg) { 166 - refcount_inc(&ref->refcount); 167 - return 0; 168 - } 167 + if (reg) 168 + return -EEXIST; 169 169 ref_exists = true; 170 170 break; 171 171 }
+8 -5
drivers/isdn/mISDN/timerdev.c
··· 109 109 spin_unlock_irq(&dev->lock); 110 110 if (filep->f_flags & O_NONBLOCK) 111 111 return -EAGAIN; 112 - wait_event_interruptible(dev->wait, (dev->work || 112 + wait_event_interruptible(dev->wait, (READ_ONCE(dev->work) || 113 113 !list_empty(list))); 114 114 if (signal_pending(current)) 115 115 return -ERESTARTSYS; 116 116 spin_lock_irq(&dev->lock); 117 117 } 118 118 if (dev->work) 119 - dev->work = 0; 119 + WRITE_ONCE(dev->work, 0); 120 120 if (!list_empty(list)) { 121 121 timer = list_first_entry(list, struct mISDNtimer, list); 122 122 list_del(&timer->list); ··· 141 141 if (*debug & DEBUG_TIMER) 142 142 printk(KERN_DEBUG "%s(%p, %p)\n", __func__, filep, wait); 143 143 if (dev) { 144 + u32 work; 145 + 144 146 poll_wait(filep, &dev->wait, wait); 145 147 mask = 0; 146 - if (dev->work || !list_empty(&dev->expired)) 148 + work = READ_ONCE(dev->work); 149 + if (work || !list_empty(&dev->expired)) 147 150 mask |= (EPOLLIN | EPOLLRDNORM); 148 151 if (*debug & DEBUG_TIMER) 149 152 printk(KERN_DEBUG "%s work(%d) empty(%d)\n", __func__, 150 - dev->work, list_empty(&dev->expired)); 153 + work, list_empty(&dev->expired)); 151 154 } 152 155 return mask; 153 156 } ··· 175 172 struct mISDNtimer *timer; 176 173 177 174 if (!timeout) { 178 - dev->work = 1; 175 + WRITE_ONCE(dev->work, 1); 179 176 wake_up_interruptible(&dev->wait); 180 177 id = 0; 181 178 } else {
+9 -2
drivers/net/bonding/bond_main.c
··· 1862 1862 */ 1863 1863 if (!bond_has_slaves(bond)) { 1864 1864 if (bond_dev->type != slave_dev->type) { 1865 + if (slave_dev->type != ARPHRD_ETHER && 1866 + BOND_MODE(bond) == BOND_MODE_8023AD) { 1867 + SLAVE_NL_ERR(bond_dev, slave_dev, extack, 1868 + "8023AD mode requires Ethernet devices"); 1869 + return -EINVAL; 1870 + } 1865 1871 slave_dbg(bond_dev, slave_dev, "change device type from %d to %d\n", 1866 1872 bond_dev->type, slave_dev->type); 1867 1873 ··· 4096 4090 case BOND_XMIT_POLICY_ENCAP23: 4097 4091 case BOND_XMIT_POLICY_ENCAP34: 4098 4092 memset(fk, 0, sizeof(*fk)); 4099 - return __skb_flow_dissect(NULL, skb, &flow_keys_bonding, 4100 - fk, data, l2_proto, nhoff, hlen, 0); 4093 + return __skb_flow_dissect(dev_net(bond->dev), skb, 4094 + &flow_keys_bonding, fk, data, 4095 + l2_proto, nhoff, hlen, 0); 4101 4096 default: 4102 4097 break; 4103 4098 }
+1
drivers/net/can/dev/dev.c
··· 332 332 333 333 can_ml = (void *)priv + ALIGN(sizeof_priv, NETDEV_ALIGN); 334 334 can_set_ml_priv(dev, can_ml); 335 + can_set_cap(dev, CAN_CAP_CC); 335 336 336 337 if (echo_skb_max) { 337 338 priv->echo_skb_max = echo_skb_max;
+7 -1
drivers/net/can/usb/ems_usb.c
··· 486 486 urb->transfer_buffer, RX_BUFFER_SIZE, 487 487 ems_usb_read_bulk_callback, dev); 488 488 489 + usb_anchor_urb(urb, &dev->rx_submitted); 490 + 489 491 retval = usb_submit_urb(urb, GFP_ATOMIC); 492 + if (!retval) 493 + return; 494 + 495 + usb_unanchor_urb(urb); 490 496 491 497 if (retval == -ENODEV) 492 498 netif_device_detach(netdev); 493 - else if (retval) 499 + else 494 500 netdev_err(netdev, 495 501 "failed resubmitting read bulk urb: %d\n", retval); 496 502 }
+8 -1
drivers/net/can/usb/esd_usb.c
··· 541 541 urb->transfer_buffer, ESD_USB_RX_BUFFER_SIZE, 542 542 esd_usb_read_bulk_callback, dev); 543 543 544 + usb_anchor_urb(urb, &dev->rx_submitted); 545 + 544 546 err = usb_submit_urb(urb, GFP_ATOMIC); 547 + if (!err) 548 + return; 549 + 550 + usb_unanchor_urb(urb); 551 + 545 552 if (err == -ENODEV) { 546 553 for (i = 0; i < dev->net_count; i++) { 547 554 if (dev->nets[i]) 548 555 netif_device_detach(dev->nets[i]->netdev); 549 556 } 550 - } else if (err) { 557 + } else { 551 558 dev_err(dev->udev->dev.parent, 552 559 "failed resubmitting read bulk urb: %pe\n", ERR_PTR(err)); 553 560 }
+7
drivers/net/can/usb/gs_usb.c
··· 754 754 usb_anchor_urb(urb, &parent->rx_submitted); 755 755 756 756 rc = usb_submit_urb(urb, GFP_ATOMIC); 757 + if (!rc) 758 + return; 759 + 760 + usb_unanchor_urb(urb); 757 761 758 762 /* USB failure take down all interfaces */ 759 763 if (rc == -ENODEV) { ··· 766 762 if (parent->canch[rc]) 767 763 netif_device_detach(parent->canch[rc]->netdev); 768 764 } 765 + } else if (rc != -ESHUTDOWN && net_ratelimit()) { 766 + netdev_info(netdev, "failed to re-submit IN URB: %pe\n", 767 + ERR_PTR(urb->status)); 769 768 } 770 769 } 771 770
+8 -1
drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c
··· 361 361 urb->transfer_buffer, KVASER_USB_RX_BUFFER_SIZE, 362 362 kvaser_usb_read_bulk_callback, dev); 363 363 364 + usb_anchor_urb(urb, &dev->rx_submitted); 365 + 364 366 err = usb_submit_urb(urb, GFP_ATOMIC); 367 + if (!err) 368 + return; 369 + 370 + usb_unanchor_urb(urb); 371 + 365 372 if (err == -ENODEV) { 366 373 for (i = 0; i < dev->nchannels; i++) { 367 374 struct kvaser_usb_net_priv *priv; ··· 379 372 380 373 netif_device_detach(priv->netdev); 381 374 } 382 - } else if (err) { 375 + } else { 383 376 dev_err(&dev->intf->dev, 384 377 "Failed resubmitting read bulk urb: %d\n", err); 385 378 }
+7 -1
drivers/net/can/usb/mcba_usb.c
··· 608 608 urb->transfer_buffer, MCBA_USB_RX_BUFF_SIZE, 609 609 mcba_usb_read_bulk_callback, priv); 610 610 611 + usb_anchor_urb(urb, &priv->rx_submitted); 612 + 611 613 retval = usb_submit_urb(urb, GFP_ATOMIC); 614 + if (!retval) 615 + return; 616 + 617 + usb_unanchor_urb(urb); 612 618 613 619 if (retval == -ENODEV) 614 620 netif_device_detach(netdev); 615 - else if (retval) 621 + else 616 622 netdev_err(netdev, "failed resubmitting read bulk urb: %d\n", 617 623 retval); 618 624 }
+7 -1
drivers/net/can/usb/usb_8dev.c
··· 541 541 urb->transfer_buffer, RX_BUFFER_SIZE, 542 542 usb_8dev_read_bulk_callback, priv); 543 543 544 + usb_anchor_urb(urb, &priv->rx_submitted); 545 + 544 546 retval = usb_submit_urb(urb, GFP_ATOMIC); 547 + if (!retval) 548 + return; 549 + 550 + usb_unanchor_urb(urb); 545 551 546 552 if (retval == -ENODEV) 547 553 netif_device_detach(netdev); 548 - else if (retval) 554 + else 549 555 netdev_err(netdev, 550 556 "failed resubmitting read bulk urb: %d\n", retval); 551 557 }
+1 -4
drivers/net/ethernet/amd/xgbe/xgbe-drv.c
··· 1837 1837 s->multicast = pstats->rxmulticastframes_g; 1838 1838 s->rx_length_errors = pstats->rxlengtherror; 1839 1839 s->rx_crc_errors = pstats->rxcrcerror; 1840 - s->rx_fifo_errors = pstats->rxfifooverflow; 1840 + s->rx_over_errors = pstats->rxfifooverflow; 1841 1841 1842 1842 s->tx_packets = pstats->txframecount_gb; 1843 1843 s->tx_bytes = pstats->txoctetcount_gb; ··· 2292 2292 goto read_again; 2293 2293 2294 2294 if (error || packet->errors) { 2295 - if (packet->errors) 2296 - netif_err(pdata, rx_err, netdev, 2297 - "error in received packet\n"); 2298 2295 dev_kfree_skb(skb); 2299 2296 goto next_packet; 2300 2297 }
+3 -2
drivers/net/ethernet/broadcom/asp2/bcmasp.c
··· 156 156 ASP_RX_FILTER_NET_OFFSET_L4(32), 157 157 ASP_RX_FILTER_NET_OFFSET(nfilt->hw_index + 1)); 158 158 159 - rx_filter_core_wl(priv, ASP_RX_FILTER_NET_CFG_CH(nfilt->port + 8) | 159 + rx_filter_core_wl(priv, ASP_RX_FILTER_NET_CFG_CH(nfilt->ch) | 160 160 ASP_RX_FILTER_NET_CFG_EN | 161 161 ASP_RX_FILTER_NET_CFG_L2_EN | 162 162 ASP_RX_FILTER_NET_CFG_L3_EN | ··· 166 166 ASP_RX_FILTER_NET_CFG_UMC(nfilt->port), 167 167 ASP_RX_FILTER_NET_CFG(nfilt->hw_index)); 168 168 169 - rx_filter_core_wl(priv, ASP_RX_FILTER_NET_CFG_CH(nfilt->port + 8) | 169 + rx_filter_core_wl(priv, ASP_RX_FILTER_NET_CFG_CH(nfilt->ch) | 170 170 ASP_RX_FILTER_NET_CFG_EN | 171 171 ASP_RX_FILTER_NET_CFG_L2_EN | 172 172 ASP_RX_FILTER_NET_CFG_L3_EN | ··· 714 714 nfilter = &priv->net_filters[open_index]; 715 715 nfilter->claimed = true; 716 716 nfilter->port = intf->port; 717 + nfilter->ch = intf->channel + priv->tx_chan_offset; 717 718 nfilter->hw_index = open_index; 718 719 } 719 720
+1
drivers/net/ethernet/broadcom/asp2/bcmasp.h
··· 348 348 bool wake_filter; 349 349 350 350 int port; 351 + int ch; 351 352 unsigned int hw_index; 352 353 }; 353 354
+2 -1
drivers/net/ethernet/emulex/benet/be_cmds.c
··· 3801 3801 { 3802 3802 int status; 3803 3803 bool pmac_valid = false; 3804 + u32 pmac_id; 3804 3805 3805 3806 eth_zero_addr(mac); 3806 3807 ··· 3814 3813 adapter->if_handle, 0); 3815 3814 } else { 3816 3815 status = be_cmd_get_mac_from_list(adapter, mac, &pmac_valid, 3817 - NULL, adapter->if_handle, 0); 3816 + &pmac_id, adapter->if_handle, 0); 3818 3817 } 3819 3818 3820 3819 return status;
+5 -3
drivers/net/ethernet/emulex/benet/be_main.c
··· 2141 2141 struct be_aic_obj *aic; 2142 2142 struct be_rx_obj *rxo; 2143 2143 struct be_tx_obj *txo; 2144 - u64 rx_pkts = 0, tx_pkts = 0; 2144 + u64 rx_pkts = 0, tx_pkts = 0, pkts; 2145 2145 ulong now; 2146 2146 u32 pps, delta; 2147 2147 int i; ··· 2157 2157 for_all_rx_queues_on_eq(adapter, eqo, rxo, i) { 2158 2158 do { 2159 2159 start = u64_stats_fetch_begin(&rxo->stats.sync); 2160 - rx_pkts += rxo->stats.rx_pkts; 2160 + pkts = rxo->stats.rx_pkts; 2161 2161 } while (u64_stats_fetch_retry(&rxo->stats.sync, start)); 2162 + rx_pkts += pkts; 2162 2163 } 2163 2164 2164 2165 for_all_tx_queues_on_eq(adapter, eqo, txo, i) { 2165 2166 do { 2166 2167 start = u64_stats_fetch_begin(&txo->stats.sync); 2167 - tx_pkts += txo->stats.tx_reqs; 2168 + pkts = txo->stats.tx_reqs; 2168 2169 } while (u64_stats_fetch_retry(&txo->stats.sync, start)); 2170 + tx_pkts += pkts; 2169 2171 } 2170 2172 2171 2173 /* Skip, if wrapped around or first calculation */
+7 -6
drivers/net/ethernet/freescale/fec_main.c
··· 1150 1150 u32 rcntl = FEC_RCR_MII; 1151 1151 1152 1152 if (OPT_ARCH_HAS_MAX_FL) 1153 - rcntl |= (fep->netdev->mtu + ETH_HLEN + ETH_FCS_LEN) << 16; 1153 + rcntl |= (fep->netdev->mtu + VLAN_ETH_HLEN + ETH_FCS_LEN) << 16; 1154 1154 1155 1155 if (fep->bufdesc_ex) 1156 1156 fec_ptp_save_state(fep); ··· 1285 1285 1286 1286 /* When Jumbo Frame is enabled, the FIFO may not be large enough 1287 1287 * to hold an entire frame. In such cases, if the MTU exceeds 1288 - * (PKT_MAXBUF_SIZE - ETH_HLEN - ETH_FCS_LEN), configure the interface 1289 - * to operate in cut-through mode, triggered by the FIFO threshold. 1288 + * (PKT_MAXBUF_SIZE - VLAN_ETH_HLEN - ETH_FCS_LEN), configure 1289 + * the interface to operate in cut-through mode, triggered by 1290 + * the FIFO threshold. 1290 1291 * Otherwise, enable the ENET store-and-forward mode. 1291 1292 */ 1292 1293 if ((fep->quirks & FEC_QUIRK_JUMBO_FRAME) && 1293 - (ndev->mtu > (PKT_MAXBUF_SIZE - ETH_HLEN - ETH_FCS_LEN))) 1294 + (ndev->mtu > (PKT_MAXBUF_SIZE - VLAN_ETH_HLEN - ETH_FCS_LEN))) 1294 1295 writel(0xF, fep->hwp + FEC_X_WMRK); 1295 1296 else 1296 1297 writel(FEC_TXWMRK_STRFWD, fep->hwp + FEC_X_WMRK); ··· 4038 4037 if (netif_running(ndev)) 4039 4038 return -EBUSY; 4040 4039 4041 - order = get_order(new_mtu + ETH_HLEN + ETH_FCS_LEN 4040 + order = get_order(new_mtu + VLAN_ETH_HLEN + ETH_FCS_LEN 4042 4041 + FEC_DRV_RESERVE_SPACE); 4043 4042 fep->rx_frame_size = (PAGE_SIZE << order) - FEC_DRV_RESERVE_SPACE; 4044 4043 fep->pagepool_order = order; ··· 4589 4588 else 4590 4589 fep->max_buf_size = PKT_MAXBUF_SIZE; 4591 4590 4592 - ndev->max_mtu = fep->max_buf_size - ETH_HLEN - ETH_FCS_LEN; 4591 + ndev->max_mtu = fep->max_buf_size - VLAN_ETH_HLEN - ETH_FCS_LEN; 4593 4592 4594 4593 ret = register_netdev(ndev); 4595 4594 if (ret)
+3 -1
drivers/net/ethernet/freescale/ucc_geth.c
··· 1602 1602 pr_warn("TBI mode requires that the device tree specify a tbi-handle\n"); 1603 1603 1604 1604 tbiphy = of_phy_find_device(ug_info->tbi_node); 1605 - if (!tbiphy) 1605 + if (!tbiphy) { 1606 1606 pr_warn("Could not get TBI device\n"); 1607 + return; 1608 + } 1607 1609 1608 1610 value = phy_read(tbiphy, ENET_TBI_MII_CR); 1609 1611 value &= ~0x1000; /* Turn off autonegotiation */
+36 -33
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
··· 2529 2529 static void hns3_fetch_stats(struct rtnl_link_stats64 *stats, 2530 2530 struct hns3_enet_ring *ring, bool is_tx) 2531 2531 { 2532 + struct ring_stats ring_stats; 2532 2533 unsigned int start; 2533 2534 2534 2535 do { 2535 2536 start = u64_stats_fetch_begin(&ring->syncp); 2536 - if (is_tx) { 2537 - stats->tx_bytes += ring->stats.tx_bytes; 2538 - stats->tx_packets += ring->stats.tx_pkts; 2539 - stats->tx_dropped += ring->stats.sw_err_cnt; 2540 - stats->tx_dropped += ring->stats.tx_vlan_err; 2541 - stats->tx_dropped += ring->stats.tx_l4_proto_err; 2542 - stats->tx_dropped += ring->stats.tx_l2l3l4_err; 2543 - stats->tx_dropped += ring->stats.tx_tso_err; 2544 - stats->tx_dropped += ring->stats.over_max_recursion; 2545 - stats->tx_dropped += ring->stats.hw_limitation; 2546 - stats->tx_dropped += ring->stats.copy_bits_err; 2547 - stats->tx_dropped += ring->stats.skb2sgl_err; 2548 - stats->tx_dropped += ring->stats.map_sg_err; 2549 - stats->tx_errors += ring->stats.sw_err_cnt; 2550 - stats->tx_errors += ring->stats.tx_vlan_err; 2551 - stats->tx_errors += ring->stats.tx_l4_proto_err; 2552 - stats->tx_errors += ring->stats.tx_l2l3l4_err; 2553 - stats->tx_errors += ring->stats.tx_tso_err; 2554 - stats->tx_errors += ring->stats.over_max_recursion; 2555 - stats->tx_errors += ring->stats.hw_limitation; 2556 - stats->tx_errors += ring->stats.copy_bits_err; 2557 - stats->tx_errors += ring->stats.skb2sgl_err; 2558 - stats->tx_errors += ring->stats.map_sg_err; 2559 - } else { 2560 - stats->rx_bytes += ring->stats.rx_bytes; 2561 - stats->rx_packets += ring->stats.rx_pkts; 2562 - stats->rx_dropped += ring->stats.l2_err; 2563 - stats->rx_errors += ring->stats.l2_err; 2564 - stats->rx_errors += ring->stats.l3l4_csum_err; 2565 - stats->rx_crc_errors += ring->stats.l2_err; 2566 - stats->multicast += ring->stats.rx_multicast; 2567 - stats->rx_length_errors += ring->stats.err_pkt_len; 2568 - } 2537 + ring_stats = ring->stats; 2569 2538 } while (u64_stats_fetch_retry(&ring->syncp, start)); 2539 + 2540 + if (is_tx) { 2541 + stats->tx_bytes += ring_stats.tx_bytes; 2542 + stats->tx_packets += ring_stats.tx_pkts; 2543 + stats->tx_dropped += ring_stats.sw_err_cnt; 2544 + stats->tx_dropped += ring_stats.tx_vlan_err; 2545 + stats->tx_dropped += ring_stats.tx_l4_proto_err; 2546 + stats->tx_dropped += ring_stats.tx_l2l3l4_err; 2547 + stats->tx_dropped += ring_stats.tx_tso_err; 2548 + stats->tx_dropped += ring_stats.over_max_recursion; 2549 + stats->tx_dropped += ring_stats.hw_limitation; 2550 + stats->tx_dropped += ring_stats.copy_bits_err; 2551 + stats->tx_dropped += ring_stats.skb2sgl_err; 2552 + stats->tx_dropped += ring_stats.map_sg_err; 2553 + stats->tx_errors += ring_stats.sw_err_cnt; 2554 + stats->tx_errors += ring_stats.tx_vlan_err; 2555 + stats->tx_errors += ring_stats.tx_l4_proto_err; 2556 + stats->tx_errors += ring_stats.tx_l2l3l4_err; 2557 + stats->tx_errors += ring_stats.tx_tso_err; 2558 + stats->tx_errors += ring_stats.over_max_recursion; 2559 + stats->tx_errors += ring_stats.hw_limitation; 2560 + stats->tx_errors += ring_stats.copy_bits_err; 2561 + stats->tx_errors += ring_stats.skb2sgl_err; 2562 + stats->tx_errors += ring_stats.map_sg_err; 2563 + } else { 2564 + stats->rx_bytes += ring_stats.rx_bytes; 2565 + stats->rx_packets += ring_stats.rx_pkts; 2566 + stats->rx_dropped += ring_stats.l2_err; 2567 + stats->rx_errors += ring_stats.l2_err; 2568 + stats->rx_errors += ring_stats.l3l4_csum_err; 2569 + stats->rx_crc_errors += ring_stats.l2_err; 2570 + stats->multicast += ring_stats.rx_multicast; 2571 + stats->rx_length_errors += ring_stats.err_pkt_len; 2572 + } 2570 2573 } 2571 2574 2572 2575 static void hns3_nic_get_stats64(struct net_device *netdev,
+1 -1
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h
··· 731 731 #define HCLGE_FD_AD_QID_M GENMASK(11, 2) 732 732 #define HCLGE_FD_AD_USE_COUNTER_B 12 733 733 #define HCLGE_FD_AD_COUNTER_NUM_S 13 734 - #define HCLGE_FD_AD_COUNTER_NUM_M GENMASK(20, 13) 734 + #define HCLGE_FD_AD_COUNTER_NUM_M GENMASK(19, 13) 735 735 #define HCLGE_FD_AD_NXT_STEP_B 20 736 736 #define HCLGE_FD_AD_NXT_KEY_S 21 737 737 #define HCLGE_FD_AD_NXT_KEY_M GENMASK(25, 21)
+1 -1
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
··· 5690 5690 HCLGE_FD_AD_COUNTER_NUM_S, action->counter_id); 5691 5691 hnae3_set_bit(ad_data, HCLGE_FD_AD_NXT_STEP_B, action->use_next_stage); 5692 5692 hnae3_set_field(ad_data, HCLGE_FD_AD_NXT_KEY_M, HCLGE_FD_AD_NXT_KEY_S, 5693 - action->counter_id); 5693 + action->next_input_key); 5694 5694 5695 5695 req->ad_data = cpu_to_le64(ad_data); 5696 5696 ret = hclge_cmd_send(&hdev->hw, &desc, 1);
+13 -9
drivers/net/ethernet/huawei/hinic3/hinic3_irq.c
··· 43 43 struct hinic3_nic_dev *nic_dev = netdev_priv(irq_cfg->netdev); 44 44 45 45 netif_napi_add(nic_dev->netdev, &irq_cfg->napi, hinic3_poll); 46 - netif_queue_set_napi(irq_cfg->netdev, irq_cfg->irq_id, 47 - NETDEV_QUEUE_TYPE_RX, &irq_cfg->napi); 48 - netif_queue_set_napi(irq_cfg->netdev, irq_cfg->irq_id, 49 - NETDEV_QUEUE_TYPE_TX, &irq_cfg->napi); 50 46 napi_enable(&irq_cfg->napi); 51 47 } 52 48 53 49 static void qp_del_napi(struct hinic3_irq_cfg *irq_cfg) 54 50 { 55 51 napi_disable(&irq_cfg->napi); 56 - netif_queue_set_napi(irq_cfg->netdev, irq_cfg->irq_id, 57 - NETDEV_QUEUE_TYPE_RX, NULL); 58 - netif_queue_set_napi(irq_cfg->netdev, irq_cfg->irq_id, 59 - NETDEV_QUEUE_TYPE_TX, NULL); 60 - netif_stop_subqueue(irq_cfg->netdev, irq_cfg->irq_id); 61 52 netif_napi_del(&irq_cfg->napi); 62 53 } 63 54 ··· 141 150 goto err_release_irqs; 142 151 } 143 152 153 + netif_queue_set_napi(irq_cfg->netdev, q_id, 154 + NETDEV_QUEUE_TYPE_RX, &irq_cfg->napi); 155 + netif_queue_set_napi(irq_cfg->netdev, q_id, 156 + NETDEV_QUEUE_TYPE_TX, &irq_cfg->napi); 157 + 144 158 hinic3_set_msix_auto_mask_state(nic_dev->hwdev, 145 159 irq_cfg->msix_entry_idx, 146 160 HINIC3_SET_MSIX_AUTO_MASK); ··· 160 164 q_id--; 161 165 irq_cfg = &nic_dev->q_params.irq_cfg[q_id]; 162 166 qp_del_napi(irq_cfg); 167 + netif_queue_set_napi(irq_cfg->netdev, q_id, 168 + NETDEV_QUEUE_TYPE_RX, NULL); 169 + netif_queue_set_napi(irq_cfg->netdev, q_id, 170 + NETDEV_QUEUE_TYPE_TX, NULL); 163 171 hinic3_set_msix_state(nic_dev->hwdev, irq_cfg->msix_entry_idx, 164 172 HINIC3_MSIX_DISABLE); 165 173 hinic3_set_msix_auto_mask_state(nic_dev->hwdev, ··· 184 184 for (q_id = 0; q_id < nic_dev->q_params.num_qps; q_id++) { 185 185 irq_cfg = &nic_dev->q_params.irq_cfg[q_id]; 186 186 qp_del_napi(irq_cfg); 187 + netif_queue_set_napi(irq_cfg->netdev, q_id, 188 + NETDEV_QUEUE_TYPE_RX, NULL); 189 + netif_queue_set_napi(irq_cfg->netdev, q_id, 190 + NETDEV_QUEUE_TYPE_TX, NULL); 187 191 hinic3_set_msix_state(nic_dev->hwdev, irq_cfg->msix_entry_idx, 188 192 HINIC3_MSIX_DISABLE); 189 193 hinic3_set_msix_auto_mask_state(nic_dev->hwdev,
+1
drivers/net/ethernet/intel/ice/devlink/devlink.c
··· 460 460 ice_vsi_decfg(ice_get_main_vsi(pf)); 461 461 rtnl_unlock(); 462 462 ice_deinit_pf(pf); 463 + ice_deinit_hw(&pf->hw); 463 464 ice_deinit_dev(pf); 464 465 } 465 466
+1
drivers/net/ethernet/intel/ice/ice.h
··· 979 979 int 980 980 ice_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames, 981 981 u32 flags); 982 + int ice_get_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size); 982 983 int ice_set_rss_lut(struct ice_vsi *vsi, u8 *lut, u16 lut_size); 983 984 int ice_get_rss_lut(struct ice_vsi *vsi, u8 *lut, u16 lut_size); 984 985 int ice_set_rss_key(struct ice_vsi *vsi, u8 *seed);
+1 -1
drivers/net/ethernet/intel/ice/ice_common.c
··· 2251 2251 /* there are some rare cases when trying to release the resource 2252 2252 * results in an admin queue timeout, so handle them correctly 2253 2253 */ 2254 - timeout = jiffies + 10 * ICE_CTL_Q_SQ_CMD_TIMEOUT; 2254 + timeout = jiffies + 10 * usecs_to_jiffies(ICE_CTL_Q_SQ_CMD_TIMEOUT); 2255 2255 do { 2256 2256 status = ice_aq_release_res(hw, res, 0, NULL); 2257 2257 if (status != -EIO)
+1 -5
drivers/net/ethernet/intel/ice/ice_ethtool.c
··· 3626 3626 if (!lut) 3627 3627 return -ENOMEM; 3628 3628 3629 - err = ice_get_rss_key(vsi, rxfh->key); 3630 - if (err) 3631 - goto out; 3632 - 3633 - err = ice_get_rss_lut(vsi, lut, vsi->rss_table_size); 3629 + err = ice_get_rss(vsi, rxfh->key, lut, vsi->rss_table_size); 3634 3630 if (err) 3635 3631 goto out; 3636 3632
+21 -8
drivers/net/ethernet/intel/ice/ice_lib.c
··· 398 398 if (!ring_stats) 399 399 goto err_out; 400 400 401 + u64_stats_init(&ring_stats->syncp); 402 + 401 403 WRITE_ONCE(tx_ring_stats[i], ring_stats); 402 404 } 403 405 ··· 418 416 ring_stats = kzalloc(sizeof(*ring_stats), GFP_KERNEL); 419 417 if (!ring_stats) 420 418 goto err_out; 419 + 420 + u64_stats_init(&ring_stats->syncp); 421 421 422 422 WRITE_ONCE(rx_ring_stats[i], ring_stats); 423 423 } ··· 3809 3805 int ice_vsi_del_vlan_zero(struct ice_vsi *vsi) 3810 3806 { 3811 3807 struct ice_vsi_vlan_ops *vlan_ops = ice_get_compat_vsi_vlan_ops(vsi); 3808 + struct ice_pf *pf = vsi->back; 3812 3809 struct ice_vlan vlan; 3813 3810 int err; 3814 3811 3815 - vlan = ICE_VLAN(0, 0, 0); 3816 - err = vlan_ops->del_vlan(vsi, &vlan); 3817 - if (err && err != -EEXIST) 3818 - return err; 3812 + if (pf->lag && pf->lag->primary) { 3813 + dev_dbg(ice_pf_to_dev(pf), "Interface is primary in aggregate - not deleting prune list\n"); 3814 + } else { 3815 + vlan = ICE_VLAN(0, 0, 0); 3816 + err = vlan_ops->del_vlan(vsi, &vlan); 3817 + if (err && err != -EEXIST) 3818 + return err; 3819 + } 3819 3820 3820 3821 /* in SVM both VLAN 0 filters are identical */ 3821 3822 if (!ice_is_dvm_ena(&vsi->back->hw)) 3822 3823 return 0; 3823 3824 3824 - vlan = ICE_VLAN(ETH_P_8021Q, 0, 0); 3825 - err = vlan_ops->del_vlan(vsi, &vlan); 3826 - if (err && err != -EEXIST) 3827 - return err; 3825 + if (pf->lag && pf->lag->primary) { 3826 + dev_dbg(ice_pf_to_dev(pf), "Interface is primary in aggregate - not deleting QinQ prune list\n"); 3827 + } else { 3828 + vlan = ICE_VLAN(ETH_P_8021Q, 0, 0); 3829 + err = vlan_ops->del_vlan(vsi, &vlan); 3830 + if (err && err != -EEXIST) 3831 + return err; 3832 + } 3828 3833 3829 3834 /* when deleting the last VLAN filter, make sure to disable the VLAN 3830 3835 * promisc mode so the filter isn't left by accident
+29 -2
drivers/net/ethernet/intel/ice/ice_main.c
··· 4836 4836 ice_dpll_deinit(pf); 4837 4837 if (pf->eswitch_mode == DEVLINK_ESWITCH_MODE_SWITCHDEV) 4838 4838 xa_destroy(&pf->eswitch.reprs); 4839 + ice_hwmon_exit(pf); 4839 4840 } 4840 4841 4841 4842 static void ice_init_wakeup(struct ice_pf *pf) ··· 5437 5436 set_bit(ICE_VF_RESETS_DISABLED, pf->state); 5438 5437 ice_free_vfs(pf); 5439 5438 } 5440 - 5441 - ice_hwmon_exit(pf); 5442 5439 5443 5440 if (!ice_is_safe_mode(pf)) 5444 5441 ice_remove_arfs(pf); ··· 7985 7986 status, libie_aq_str(hw->adminq.sq_last_status)); 7986 7987 7987 7988 return status; 7989 + } 7990 + 7991 + /** 7992 + * ice_get_rss - Get RSS LUT and/or key 7993 + * @vsi: Pointer to VSI structure 7994 + * @seed: Buffer to store the key in 7995 + * @lut: Buffer to store the lookup table entries 7996 + * @lut_size: Size of buffer to store the lookup table entries 7997 + * 7998 + * Return: 0 on success, negative on failure 7999 + */ 8000 + int ice_get_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size) 8001 + { 8002 + int err; 8003 + 8004 + if (seed) { 8005 + err = ice_get_rss_key(vsi, seed); 8006 + if (err) 8007 + return err; 8008 + } 8009 + 8010 + if (lut) { 8011 + err = ice_get_rss_lut(vsi, lut, lut_size); 8012 + if (err) 8013 + return err; 8014 + } 8015 + 8016 + return 0; 7988 8017 } 7989 8018 7990 8019 /**
+1 -1
drivers/net/ethernet/intel/idpf/idpf_ptp.c
··· 108 108 ptp_read_system_prets(sts); 109 109 110 110 idpf_ptp_enable_shtime(adapter); 111 + lo = readl(ptp->dev_clk_regs.dev_clk_ns_l); 111 112 112 113 /* Read the system timestamp post PHC read */ 113 114 ptp_read_system_postts(sts); 114 115 115 - lo = readl(ptp->dev_clk_regs.dev_clk_ns_l); 116 116 hi = readl(ptp->dev_clk_regs.dev_clk_ns_h); 117 117 118 118 spin_unlock(&ptp->read_dev_clk_lock);
+11 -5
drivers/net/ethernet/intel/idpf/idpf_txrx.c
··· 3941 3941 static void idpf_net_dim(struct idpf_q_vector *q_vector) 3942 3942 { 3943 3943 struct dim_sample dim_sample = { }; 3944 - u64 packets, bytes; 3944 + u64 packets, bytes, pkts, bts; 3945 3945 u32 i; 3946 3946 3947 3947 if (!IDPF_ITR_IS_DYNAMIC(q_vector->tx_intr_mode)) ··· 3953 3953 3954 3954 do { 3955 3955 start = u64_stats_fetch_begin(&txq->stats_sync); 3956 - packets += u64_stats_read(&txq->q_stats.packets); 3957 - bytes += u64_stats_read(&txq->q_stats.bytes); 3956 + pkts = u64_stats_read(&txq->q_stats.packets); 3957 + bts = u64_stats_read(&txq->q_stats.bytes); 3958 3958 } while (u64_stats_fetch_retry(&txq->stats_sync, start)); 3959 + 3960 + packets += pkts; 3961 + bytes += bts; 3959 3962 } 3960 3963 3961 3964 idpf_update_dim_sample(q_vector, &dim_sample, &q_vector->tx_dim, ··· 3975 3972 3976 3973 do { 3977 3974 start = u64_stats_fetch_begin(&rxq->stats_sync); 3978 - packets += u64_stats_read(&rxq->q_stats.packets); 3979 - bytes += u64_stats_read(&rxq->q_stats.bytes); 3975 + pkts = u64_stats_read(&rxq->q_stats.packets); 3976 + bts = u64_stats_read(&rxq->q_stats.bytes); 3980 3977 } while (u64_stats_fetch_retry(&rxq->stats_sync, start)); 3978 + 3979 + packets += pkts; 3980 + bytes += bts; 3981 3981 } 3982 3982 3983 3983 idpf_update_dim_sample(q_vector, &dim_sample, &q_vector->rx_dim,
+3 -2
drivers/net/ethernet/intel/igc/igc_defines.h
··· 443 443 #define IGC_TXPBSIZE_DEFAULT ( \ 444 444 IGC_TXPB0SIZE(20) | IGC_TXPB1SIZE(0) | IGC_TXPB2SIZE(0) | \ 445 445 IGC_TXPB3SIZE(0) | IGC_OS2BMCPBSIZE(4)) 446 + /* TSN value following I225/I226 SW User Manual Section 7.5.4 */ 446 447 #define IGC_TXPBSIZE_TSN ( \ 447 - IGC_TXPB0SIZE(7) | IGC_TXPB1SIZE(7) | IGC_TXPB2SIZE(7) | \ 448 - IGC_TXPB3SIZE(7) | IGC_OS2BMCPBSIZE(4)) 448 + IGC_TXPB0SIZE(5) | IGC_TXPB1SIZE(5) | IGC_TXPB2SIZE(5) | \ 449 + IGC_TXPB3SIZE(5) | IGC_OS2BMCPBSIZE(4)) 449 450 450 451 #define IGC_DTXMXPKTSZ_TSN 0x19 /* 1600 bytes of max TX DMA packet size */ 451 452 #define IGC_DTXMXPKTSZ_DEFAULT 0x98 /* 9728-byte Jumbo frames */
+2 -2
drivers/net/ethernet/intel/igc/igc_ethtool.c
··· 1565 1565 if (ch->other_count != NON_Q_VECTORS) 1566 1566 return -EINVAL; 1567 1567 1568 - /* Do not allow channel reconfiguration when mqprio is enabled */ 1569 - if (adapter->strict_priority_enable) 1568 + /* Do not allow channel reconfiguration when any TSN qdisc is enabled */ 1569 + if (adapter->flags & IGC_FLAG_TSN_ANY_ENABLED) 1570 1570 return -EINVAL; 1571 1571 1572 1572 /* Verify the number of channels doesn't exceed hw limits */
+5
drivers/net/ethernet/intel/igc/igc_main.c
··· 7759 7759 if (netif_running(netdev)) 7760 7760 err = igc_open(netdev); 7761 7761 7762 + if (!err) { 7763 + /* Restore default IEEE 802.1Qbv schedule after queue reinit */ 7764 + igc_tsn_clear_schedule(adapter); 7765 + } 7766 + 7762 7767 return err; 7763 7768 } 7764 7769
+25 -18
drivers/net/ethernet/intel/igc/igc_ptp.c
··· 774 774 static void igc_ptp_tx_hwtstamp(struct igc_adapter *adapter) 775 775 { 776 776 struct igc_hw *hw = &adapter->hw; 777 + u32 txstmpl_old; 777 778 u64 regval; 778 779 u32 mask; 779 780 int i; 781 + 782 + /* Establish baseline of TXSTMPL_0 before checking TXTT_0. 783 + * This baseline is used to detect if a new timestamp arrives in 784 + * register 0 during the hardware bug workaround below. 785 + */ 786 + txstmpl_old = rd32(IGC_TXSTMPL); 780 787 781 788 mask = rd32(IGC_TSYNCTXCTL) & IGC_TSYNCTXCTL_TXTT_ANY; 782 789 if (mask & IGC_TSYNCTXCTL_TXTT_0) { 783 790 regval = rd32(IGC_TXSTMPL); 784 791 regval |= (u64)rd32(IGC_TXSTMPH) << 32; 785 792 } else { 786 - /* There's a bug in the hardware that could cause 787 - * missing interrupts for TX timestamping. The issue 788 - * is that for new interrupts to be triggered, the 789 - * IGC_TXSTMPH_0 register must be read. 793 + /* TXTT_0 not set - register 0 has no new timestamp initially. 790 794 * 791 - * To avoid discarding a valid timestamp that just 792 - * happened at the "wrong" time, we need to confirm 793 - * that there was no timestamp captured, we do that by 794 - * assuming that no two timestamps in sequence have 795 - * the same nanosecond value. 795 + * Hardware bug: Future timestamp interrupts won't fire unless 796 + * TXSTMPH_0 is read, even if the timestamp was captured in 797 + * registers 1-3. 796 798 * 797 - * So, we read the "low" register, read the "high" 798 - * register (to latch a new timestamp) and read the 799 - * "low" register again, if "old" and "new" versions 800 - * of the "low" register are different, a valid 801 - * timestamp was captured, we can read the "high" 802 - * register again. 799 + * Workaround: Read TXSTMPH_0 here to enable future interrupts. 800 + * However, this read clears TXTT_0. If a timestamp arrives in 801 + * register 0 after checking TXTT_0 but before this read, it 802 + * would be lost. 803 + * 804 + * To detect this race: We saved a baseline read of TXSTMPL_0 805 + * before TXTT_0 check. After performing the workaround read of 806 + * TXSTMPH_0, we read TXSTMPL_0 again. Since consecutive 807 + * timestamps never share the same nanosecond value, a change 808 + * between the baseline and new TXSTMPL_0 indicates a timestamp 809 + * arrived during the race window. If so, read the complete 810 + * timestamp. 803 811 */ 804 - u32 txstmpl_old, txstmpl_new; 812 + u32 txstmpl_new; 805 813 806 - txstmpl_old = rd32(IGC_TXSTMPL); 807 814 rd32(IGC_TXSTMPH); 808 815 txstmpl_new = rd32(IGC_TXSTMPL); 809 816 ··· 825 818 826 819 done: 827 820 /* Now that the problematic first register was handled, we can 828 - * use retrieve the timestamps from the other registers 821 + * retrieve the timestamps from the other registers 829 822 * (starting from '1') with less complications. 830 823 */ 831 824 for (i = 1; i < IGC_MAX_TX_TSTAMP_REGS; i++) {
+64 -22
drivers/net/ethernet/marvell/octeontx2/af/rvu.c
··· 1551 1551 return -ENODEV; 1552 1552 } 1553 1553 1554 - static void rvu_attach_block(struct rvu *rvu, int pcifunc, int blktype, 1555 - int num_lfs, struct rsrc_attach *attach) 1554 + static int rvu_attach_block(struct rvu *rvu, int pcifunc, int blktype, 1555 + int num_lfs, struct rsrc_attach *attach) 1556 1556 { 1557 1557 struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc); 1558 1558 struct rvu_hwinfo *hw = rvu->hw; ··· 1562 1562 u64 cfg; 1563 1563 1564 1564 if (!num_lfs) 1565 - return; 1565 + return -EINVAL; 1566 1566 1567 1567 blkaddr = rvu_get_attach_blkaddr(rvu, blktype, pcifunc, attach); 1568 1568 if (blkaddr < 0) 1569 - return; 1569 + return -EFAULT; 1570 1570 1571 1571 block = &hw->block[blkaddr]; 1572 1572 if (!block->lf.bmap) 1573 - return; 1573 + return -ESRCH; 1574 1574 1575 1575 for (slot = 0; slot < num_lfs; slot++) { 1576 1576 /* Allocate the resource */ 1577 1577 lf = rvu_alloc_rsrc(&block->lf); 1578 1578 if (lf < 0) 1579 - return; 1579 + return -EFAULT; 1580 1580 1581 1581 cfg = (1ULL << 63) | (pcifunc << 8) | slot; 1582 1582 rvu_write64(rvu, blkaddr, block->lfcfg_reg | ··· 1587 1587 /* Set start MSIX vector for this LF within this PF/VF */ 1588 1588 rvu_set_msix_offset(rvu, pfvf, block, lf); 1589 1589 } 1590 + 1591 + return 0; 1590 1592 } 1591 1593 1592 1594 static int rvu_check_rsrc_availability(struct rvu *rvu, ··· 1726 1724 int err; 1727 1725 1728 1726 /* If first request, detach all existing attached resources */ 1729 - if (!attach->modify) 1730 - rvu_detach_rsrcs(rvu, NULL, pcifunc); 1727 + if (!attach->modify) { 1728 + err = rvu_detach_rsrcs(rvu, NULL, pcifunc); 1729 + if (err) 1730 + return err; 1731 + } 1731 1732 1732 1733 mutex_lock(&rvu->rsrc_lock); 1733 1734 1734 1735 /* Check if the request can be accommodated */ 1735 1736 err = rvu_check_rsrc_availability(rvu, attach, pcifunc); 1736 1737 if (err) 1737 - goto exit; 1738 + goto fail1; 1738 1739 1739 1740 /* Now attach the requested resources */ 1740 - if (attach->npalf) 1741 - rvu_attach_block(rvu, pcifunc, BLKTYPE_NPA, 1, attach); 1741 + if (attach->npalf) { 1742 + err = rvu_attach_block(rvu, pcifunc, BLKTYPE_NPA, 1, attach); 1743 + if (err) 1744 + goto fail1; 1745 + } 1742 1746 1743 - if (attach->nixlf) 1744 - rvu_attach_block(rvu, pcifunc, BLKTYPE_NIX, 1, attach); 1747 + if (attach->nixlf) { 1748 + err = rvu_attach_block(rvu, pcifunc, BLKTYPE_NIX, 1, attach); 1749 + if (err) 1750 + goto fail2; 1751 + } 1745 1752 1746 1753 if (attach->sso) { 1747 1754 /* RVU func doesn't know which exact LF or slot is attached ··· 1760 1749 */ 1761 1750 if (attach->modify) 1762 1751 rvu_detach_block(rvu, pcifunc, BLKTYPE_SSO); 1763 - rvu_attach_block(rvu, pcifunc, BLKTYPE_SSO, 1764 - attach->sso, attach); 1752 + err = rvu_attach_block(rvu, pcifunc, BLKTYPE_SSO, 1753 + attach->sso, attach); 1754 + if (err) 1755 + goto fail3; 1765 1756 } 1766 1757 1767 1758 if (attach->ssow) { 1768 1759 if (attach->modify) 1769 1760 rvu_detach_block(rvu, pcifunc, BLKTYPE_SSOW); 1770 - rvu_attach_block(rvu, pcifunc, BLKTYPE_SSOW, 1771 - attach->ssow, attach); 1761 + err = rvu_attach_block(rvu, pcifunc, BLKTYPE_SSOW, 1762 + attach->ssow, attach); 1763 + if (err) 1764 + goto fail4; 1772 1765 } 1773 1766 1774 1767 if (attach->timlfs) { 1775 1768 if (attach->modify) 1776 1769 rvu_detach_block(rvu, pcifunc, BLKTYPE_TIM); 1777 - rvu_attach_block(rvu, pcifunc, BLKTYPE_TIM, 1778 - attach->timlfs, attach); 1770 + err = rvu_attach_block(rvu, pcifunc, BLKTYPE_TIM, 1771 + attach->timlfs, attach); 1772 + if (err) 1773 + goto fail5; 1779 1774 } 1780 1775 1781 1776 if (attach->cptlfs) { 1782 1777 if (attach->modify && 1783 1778 rvu_attach_from_same_block(rvu, BLKTYPE_CPT, attach)) 1784 1779 rvu_detach_block(rvu, pcifunc, BLKTYPE_CPT); 1785 - rvu_attach_block(rvu, pcifunc, BLKTYPE_CPT, 1786 - attach->cptlfs, attach); 1780 + err = rvu_attach_block(rvu, pcifunc, BLKTYPE_CPT, 1781 + attach->cptlfs, attach); 1782 + if (err) 1783 + goto fail6; 1787 1784 } 1788 1785 1789 - exit: 1786 + mutex_unlock(&rvu->rsrc_lock); 1787 + return 0; 1788 + 1789 + fail6: 1790 + if (attach->timlfs) 1791 + rvu_detach_block(rvu, pcifunc, BLKTYPE_TIM); 1792 + 1793 + fail5: 1794 + if (attach->ssow) 1795 + rvu_detach_block(rvu, pcifunc, BLKTYPE_SSOW); 1796 + 1797 + fail4: 1798 + if (attach->sso) 1799 + rvu_detach_block(rvu, pcifunc, BLKTYPE_SSO); 1800 + 1801 + fail3: 1802 + if (attach->nixlf) 1803 + rvu_detach_block(rvu, pcifunc, BLKTYPE_NIX); 1804 + 1805 + fail2: 1806 + if (attach->npalf) 1807 + rvu_detach_block(rvu, pcifunc, BLKTYPE_NPA); 1808 + 1809 + fail1: 1790 1810 mutex_unlock(&rvu->rsrc_lock); 1791 1811 return err; 1792 1812 }
+3
drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c
··· 1222 1222 u8 cgx_idx, lmac; 1223 1223 void *cgxd; 1224 1224 1225 + if (!rvu->fwdata) 1226 + return LMAC_AF_ERR_FIRMWARE_DATA_NOT_MAPPED; 1227 + 1225 1228 if (!is_cgx_config_permitted(rvu, req->hdr.pcifunc)) 1226 1229 return -EPERM; 1227 1230
+1 -1
drivers/net/ethernet/marvell/octeontx2/af/rvu_sdp.c
··· 56 56 struct rvu_pfvf *pfvf; 57 57 u32 i = 0; 58 58 59 - if (rvu->fwdata->channel_data.valid) { 59 + if (rvu->fwdata && rvu->fwdata->channel_data.valid) { 60 60 sdp_pf_num[0] = 0; 61 61 pfvf = &rvu->pf[sdp_pf_num[0]]; 62 62 pfvf->sdp_info = &rvu->fwdata->channel_data.info;
+1 -1
drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c
··· 328 328 329 329 req->data[0] = FIELD_PREP(MCS_TCAM0_MAC_DA_MASK, mac_da); 330 330 req->mask[0] = ~0ULL; 331 - req->mask[0] = ~MCS_TCAM0_MAC_DA_MASK; 331 + req->mask[0] &= ~MCS_TCAM0_MAC_DA_MASK; 332 332 333 333 req->data[1] = FIELD_PREP(MCS_TCAM1_ETYPE_MASK, ETH_P_MACSEC); 334 334 req->mask[1] = ~0ULL;
+1 -6
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
··· 940 940 size_t offset, size_t size, 941 941 enum dma_data_direction dir) 942 942 { 943 - dma_addr_t iova; 944 - 945 - iova = dma_map_page_attrs(pfvf->dev, page, 943 + return dma_map_page_attrs(pfvf->dev, page, 946 944 offset, size, dir, DMA_ATTR_SKIP_CPU_SYNC); 947 - if (unlikely(dma_mapping_error(pfvf->dev, iova))) 948 - return (dma_addr_t)NULL; 949 - return iova; 950 945 } 951 946 952 947 static inline void otx2_dma_unmap_page(struct otx2_nic *pfvf,
+3 -1
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
··· 3249 3249 netdev->watchdog_timeo = OTX2_TX_TIMEOUT; 3250 3250 3251 3251 netdev->netdev_ops = &otx2_netdev_ops; 3252 - netdev->xdp_features = NETDEV_XDP_ACT_BASIC | NETDEV_XDP_ACT_REDIRECT; 3252 + netdev->xdp_features = NETDEV_XDP_ACT_BASIC | NETDEV_XDP_ACT_REDIRECT | 3253 + NETDEV_XDP_ACT_NDO_XMIT | 3254 + NETDEV_XDP_ACT_XSK_ZEROCOPY; 3253 3255 3254 3256 netdev->min_mtu = OTX2_MIN_MTU; 3255 3257 netdev->max_mtu = otx2_get_max_mtu(pf);
+9 -3
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
··· 4359 4359 unsigned int first_entry, tx_packets; 4360 4360 struct stmmac_txq_stats *txq_stats; 4361 4361 struct stmmac_tx_queue *tx_q; 4362 + bool set_ic, is_last_segment; 4362 4363 u32 pay_len, mss, queue; 4363 4364 int i, first_tx, nfrags; 4364 4365 u8 proto_hdr_len, hdr; 4365 4366 dma_addr_t des; 4366 - bool set_ic; 4367 4367 4368 4368 /* Always insert VLAN tag to SKB payload for TSO frames. 4369 4369 * ··· 4551 4551 stmmac_enable_tx_timestamp(priv, first); 4552 4552 } 4553 4553 4554 + /* If we only have one entry used, then the first entry is the last 4555 + * segment. 4556 + */ 4557 + is_last_segment = ((tx_q->cur_tx - first_entry) & 4558 + (priv->dma_conf.dma_tx_size - 1)) == 1; 4559 + 4554 4560 /* Complete the first descriptor before granting the DMA */ 4555 4561 stmmac_prepare_tso_tx_desc(priv, first, 1, proto_hdr_len, 0, 1, 4556 - tx_q->tx_skbuff_dma[first_entry].last_segment, 4557 - hdr / 4, (skb->len - proto_hdr_len)); 4562 + is_last_segment, hdr / 4, 4563 + skb->len - proto_hdr_len); 4558 4564 4559 4565 /* If context desc is used to change MSS */ 4560 4566 if (mss_desc) {
+2 -2
drivers/net/ethernet/wangxun/txgbe/txgbe_aml.c
··· 70 70 buffer.hdr.cmd_or_resp.cmd_resv = FW_CEM_CMD_RESERVED; 71 71 72 72 return wx_host_interface_command(wx, (u32 *)&buffer, sizeof(buffer), 73 - WX_HI_COMMAND_TIMEOUT, true); 73 + WX_HI_COMMAND_TIMEOUT, false); 74 74 } 75 75 76 76 int txgbe_read_eeprom_hostif(struct wx *wx, ··· 148 148 buffer.duplex = duplex; 149 149 150 150 return wx_host_interface_command(wx, (u32 *)&buffer, sizeof(buffer), 151 - WX_HI_COMMAND_TIMEOUT, true); 151 + WX_HI_COMMAND_TIMEOUT, false); 152 152 } 153 153 154 154 static void txgbe_get_link_capabilities(struct wx *wx, int *speed,
+1 -1
drivers/net/ipvlan/ipvlan.h
··· 69 69 DECLARE_BITMAP(mac_filters, IPVLAN_MAC_FILTER_SIZE); 70 70 netdev_features_t sfeatures; 71 71 u32 msg_enable; 72 - spinlock_t addrs_lock; 73 72 }; 74 73 75 74 struct ipvl_addr { ··· 89 90 struct net_device *dev; 90 91 possible_net_t pnet; 91 92 struct hlist_head hlhead[IPVLAN_HASH_SIZE]; 93 + spinlock_t addrs_lock; /* guards hash-table and addrs */ 92 94 struct list_head ipvlans; 93 95 u16 mode; 94 96 u16 flags;
+7 -9
drivers/net/ipvlan/ipvlan_core.c
··· 107 107 struct ipvl_addr *ipvlan_find_addr(const struct ipvl_dev *ipvlan, 108 108 const void *iaddr, bool is_v6) 109 109 { 110 - struct ipvl_addr *addr, *ret = NULL; 110 + struct ipvl_addr *addr; 111 111 112 - rcu_read_lock(); 113 - list_for_each_entry_rcu(addr, &ipvlan->addrs, anode) { 114 - if (addr_equal(is_v6, addr, iaddr)) { 115 - ret = addr; 116 - break; 117 - } 112 + assert_spin_locked(&ipvlan->port->addrs_lock); 113 + 114 + list_for_each_entry(addr, &ipvlan->addrs, anode) { 115 + if (addr_equal(is_v6, addr, iaddr)) 116 + return addr; 118 117 } 119 - rcu_read_unlock(); 120 - return ret; 118 + return NULL; 121 119 } 122 120 123 121 bool ipvlan_addr_busy(struct ipvl_port *port, void *iaddr, bool is_v6)
+29 -20
drivers/net/ipvlan/ipvlan_main.c
··· 75 75 for (idx = 0; idx < IPVLAN_HASH_SIZE; idx++) 76 76 INIT_HLIST_HEAD(&port->hlhead[idx]); 77 77 78 + spin_lock_init(&port->addrs_lock); 78 79 skb_queue_head_init(&port->backlog); 79 80 INIT_WORK(&port->wq, ipvlan_process_multicast); 80 81 ida_init(&port->ida); ··· 182 181 static int ipvlan_open(struct net_device *dev) 183 182 { 184 183 struct ipvl_dev *ipvlan = netdev_priv(dev); 184 + struct ipvl_port *port = ipvlan->port; 185 185 struct ipvl_addr *addr; 186 186 187 187 if (ipvlan->port->mode == IPVLAN_MODE_L3 || ··· 191 189 else 192 190 dev->flags &= ~IFF_NOARP; 193 191 194 - rcu_read_lock(); 195 - list_for_each_entry_rcu(addr, &ipvlan->addrs, anode) 192 + spin_lock_bh(&port->addrs_lock); 193 + list_for_each_entry(addr, &ipvlan->addrs, anode) 196 194 ipvlan_ht_addr_add(ipvlan, addr); 197 - rcu_read_unlock(); 195 + spin_unlock_bh(&port->addrs_lock); 198 196 199 197 return 0; 200 198 } ··· 208 206 dev_uc_unsync(phy_dev, dev); 209 207 dev_mc_unsync(phy_dev, dev); 210 208 211 - rcu_read_lock(); 212 - list_for_each_entry_rcu(addr, &ipvlan->addrs, anode) 209 + spin_lock_bh(&ipvlan->port->addrs_lock); 210 + list_for_each_entry(addr, &ipvlan->addrs, anode) 213 211 ipvlan_ht_addr_del(addr); 214 - rcu_read_unlock(); 212 + spin_unlock_bh(&ipvlan->port->addrs_lock); 215 213 216 214 return 0; 217 215 } ··· 581 579 if (!tb[IFLA_MTU]) 582 580 ipvlan_adjust_mtu(ipvlan, phy_dev); 583 581 INIT_LIST_HEAD(&ipvlan->addrs); 584 - spin_lock_init(&ipvlan->addrs_lock); 585 582 586 583 /* TODO Probably put random address here to be presented to the 587 584 * world but keep using the physical-dev address for the outgoing ··· 658 657 struct ipvl_dev *ipvlan = netdev_priv(dev); 659 658 struct ipvl_addr *addr, *next; 660 659 661 - spin_lock_bh(&ipvlan->addrs_lock); 660 + spin_lock_bh(&ipvlan->port->addrs_lock); 662 661 list_for_each_entry_safe(addr, next, &ipvlan->addrs, anode) { 663 662 ipvlan_ht_addr_del(addr); 664 663 list_del_rcu(&addr->anode); 665 664 kfree_rcu(addr, rcu); 666 665 } 667 - spin_unlock_bh(&ipvlan->addrs_lock); 666 + spin_unlock_bh(&ipvlan->port->addrs_lock); 668 667 669 668 ida_free(&ipvlan->port->ida, dev->dev_id); 670 669 list_del_rcu(&ipvlan->pnode); ··· 818 817 { 819 818 struct ipvl_addr *addr; 820 819 820 + assert_spin_locked(&ipvlan->port->addrs_lock); 821 + 821 822 addr = kzalloc(sizeof(struct ipvl_addr), GFP_ATOMIC); 822 823 if (!addr) 823 824 return -ENOMEM; ··· 850 847 { 851 848 struct ipvl_addr *addr; 852 849 853 - spin_lock_bh(&ipvlan->addrs_lock); 850 + spin_lock_bh(&ipvlan->port->addrs_lock); 854 851 addr = ipvlan_find_addr(ipvlan, iaddr, is_v6); 855 852 if (!addr) { 856 - spin_unlock_bh(&ipvlan->addrs_lock); 853 + spin_unlock_bh(&ipvlan->port->addrs_lock); 857 854 return; 858 855 } 859 856 860 857 ipvlan_ht_addr_del(addr); 861 858 list_del_rcu(&addr->anode); 862 - spin_unlock_bh(&ipvlan->addrs_lock); 859 + spin_unlock_bh(&ipvlan->port->addrs_lock); 863 860 kfree_rcu(addr, rcu); 864 861 } 865 862 ··· 881 878 { 882 879 int ret = -EINVAL; 883 880 884 - spin_lock_bh(&ipvlan->addrs_lock); 881 + spin_lock_bh(&ipvlan->port->addrs_lock); 885 882 if (ipvlan_addr_busy(ipvlan->port, ip6_addr, true)) 886 883 netif_err(ipvlan, ifup, ipvlan->dev, 887 884 "Failed to add IPv6=%pI6c addr for %s intf\n", 888 885 ip6_addr, ipvlan->dev->name); 889 886 else 890 887 ret = ipvlan_add_addr(ipvlan, ip6_addr, true); 891 - spin_unlock_bh(&ipvlan->addrs_lock); 888 + spin_unlock_bh(&ipvlan->port->addrs_lock); 892 889 return ret; 893 890 } 894 891 ··· 927 924 struct in6_validator_info *i6vi = (struct in6_validator_info *)ptr; 928 925 struct net_device *dev = (struct net_device *)i6vi->i6vi_dev->dev; 929 926 struct ipvl_dev *ipvlan = netdev_priv(dev); 927 + int ret = NOTIFY_OK; 930 928 931 929 if (!ipvlan_is_valid_dev(dev)) 932 930 return NOTIFY_DONE; 933 931 934 932 switch (event) { 935 933 case NETDEV_UP: 934 + spin_lock_bh(&ipvlan->port->addrs_lock); 936 935 if (ipvlan_addr_busy(ipvlan->port, &i6vi->i6vi_addr, true)) { 937 936 NL_SET_ERR_MSG(i6vi->extack, 938 937 "Address already assigned to an ipvlan device"); 939 - return notifier_from_errno(-EADDRINUSE); 938 + ret = notifier_from_errno(-EADDRINUSE); 940 939 } 940 + spin_unlock_bh(&ipvlan->port->addrs_lock); 941 941 break; 942 942 } 943 943 944 - return NOTIFY_OK; 944 + return ret; 945 945 } 946 946 #endif 947 947 ··· 952 946 { 953 947 int ret = -EINVAL; 954 948 955 - spin_lock_bh(&ipvlan->addrs_lock); 949 + spin_lock_bh(&ipvlan->port->addrs_lock); 956 950 if (ipvlan_addr_busy(ipvlan->port, ip4_addr, false)) 957 951 netif_err(ipvlan, ifup, ipvlan->dev, 958 952 "Failed to add IPv4=%pI4 on %s intf.\n", 959 953 ip4_addr, ipvlan->dev->name); 960 954 else 961 955 ret = ipvlan_add_addr(ipvlan, ip4_addr, false); 962 - spin_unlock_bh(&ipvlan->addrs_lock); 956 + spin_unlock_bh(&ipvlan->port->addrs_lock); 963 957 return ret; 964 958 } 965 959 ··· 1001 995 struct in_validator_info *ivi = (struct in_validator_info *)ptr; 1002 996 struct net_device *dev = (struct net_device *)ivi->ivi_dev->dev; 1003 997 struct ipvl_dev *ipvlan = netdev_priv(dev); 998 + int ret = NOTIFY_OK; 1004 999 1005 1000 if (!ipvlan_is_valid_dev(dev)) 1006 1001 return NOTIFY_DONE; 1007 1002 1008 1003 switch (event) { 1009 1004 case NETDEV_UP: 1005 + spin_lock_bh(&ipvlan->port->addrs_lock); 1010 1006 if (ipvlan_addr_busy(ipvlan->port, &ivi->ivi_addr, false)) { 1011 1007 NL_SET_ERR_MSG(ivi->extack, 1012 1008 "Address already assigned to an ipvlan device"); 1013 - return notifier_from_errno(-EADDRINUSE); 1009 + ret = notifier_from_errno(-EADDRINUSE); 1014 1010 } 1011 + spin_unlock_bh(&ipvlan->port->addrs_lock); 1015 1012 break; 1016 1013 } 1017 1014 1018 - return NOTIFY_OK; 1015 + return ret; 1019 1016 } 1020 1017 1021 1018 static struct notifier_block ipvlan_addr4_notifier_block __read_mostly = {
+6
drivers/net/netdevsim/bpf.c
··· 244 244 &state->state, &nsim_bpf_string_fops); 245 245 debugfs_create_bool("loaded", 0400, state->ddir, &state->is_loaded); 246 246 247 + mutex_lock(&nsim_dev->progs_list_lock); 247 248 list_add_tail(&state->l, &nsim_dev->bpf_bound_progs); 249 + mutex_unlock(&nsim_dev->progs_list_lock); 248 250 249 251 prog->aux->offload->dev_priv = state; 250 252 ··· 275 273 static void nsim_bpf_destroy_prog(struct bpf_prog *prog) 276 274 { 277 275 struct nsim_bpf_bound_prog *state; 276 + struct nsim_dev *nsim_dev; 278 277 279 278 state = prog->aux->offload->dev_priv; 279 + nsim_dev = state->nsim_dev; 280 280 WARN(state->is_loaded, 281 281 "offload state destroyed while program still bound"); 282 282 debugfs_remove_recursive(state->ddir); 283 + mutex_lock(&nsim_dev->progs_list_lock); 283 284 list_del(&state->l); 285 + mutex_unlock(&nsim_dev->progs_list_lock); 284 286 kfree(state); 285 287 } 286 288
+2
drivers/net/netdevsim/dev.c
··· 1647 1647 nsim_dev->test1 = NSIM_DEV_TEST1_DEFAULT; 1648 1648 nsim_dev->test2 = NSIM_DEV_TEST2_DEFAULT; 1649 1649 spin_lock_init(&nsim_dev->fa_cookie_lock); 1650 + mutex_init(&nsim_dev->progs_list_lock); 1650 1651 1651 1652 dev_set_drvdata(&nsim_bus_dev->dev, nsim_dev); 1652 1653 ··· 1786 1785 devl_unregister(devlink); 1787 1786 kfree(nsim_dev->vfconfigs); 1788 1787 kfree(nsim_dev->fa_cookie); 1788 + mutex_destroy(&nsim_dev->progs_list_lock); 1789 1789 devl_unlock(devlink); 1790 1790 devlink_free(devlink); 1791 1791 dev_set_drvdata(&nsim_bus_dev->dev, NULL);
+1
drivers/net/netdevsim/netdevsim.h
··· 324 324 u32 prog_id_gen; 325 325 struct list_head bpf_bound_progs; 326 326 struct list_head bpf_bound_maps; 327 + struct mutex progs_list_lock; 327 328 struct netdev_phys_item_id switch_id; 328 329 struct list_head port_list; 329 330 bool fw_update_status;
+1 -3
drivers/net/pcs/pcs-mtk-lynxi.c
··· 93 93 { 94 94 switch (interface) { 95 95 case PHY_INTERFACE_MODE_1000BASEX: 96 + case PHY_INTERFACE_MODE_2500BASEX: 96 97 case PHY_INTERFACE_MODE_SGMII: 97 98 return LINK_INBAND_DISABLE | LINK_INBAND_ENABLE; 98 - 99 - case PHY_INTERFACE_MODE_2500BASEX: 100 - return LINK_INBAND_DISABLE; 101 99 102 100 default: 103 101 return 0;
+5 -2
drivers/net/phy/intel-xway.c
··· 277 277 278 278 static int xway_gphy_config_init(struct phy_device *phydev) 279 279 { 280 - struct device_node *np = phydev->mdio.dev.of_node; 280 + struct device_node *np; 281 281 int err; 282 282 283 283 /* Mask all interrupts */ ··· 286 286 return err; 287 287 288 288 /* Use default LED configuration if 'leds' node isn't defined */ 289 - if (!of_get_child_by_name(np, "leds")) 289 + np = of_get_child_by_name(phydev->mdio.dev.of_node, "leds"); 290 + if (np) 291 + of_node_put(np); 292 + else 290 293 xway_gphy_init_leds(phydev); 291 294 292 295 /* Clear all pending interrupts */
+2
drivers/net/phy/sfp.c
··· 519 519 520 520 SFP_QUIRK_F("HALNy", "HL-GSFP", sfp_fixup_halny_gsfp), 521 521 522 + SFP_QUIRK_F("H-COM", "SPP425H-GAB4", sfp_fixup_potron), 523 + 522 524 // HG MXPD-483II-F 2.5G supports 2500Base-X, but incorrectly reports 523 525 // 2600MBd in their EERPOM 524 526 SFP_QUIRK_S("HG GENUINE", "MXPD-483II", sfp_quirk_2500basex),
-4
drivers/net/usb/dm9601.c
··· 604 604 .driver_info = (unsigned long)&dm9601_info, 605 605 }, 606 606 { 607 - USB_DEVICE(0x0fe6, 0x9700), /* DM9601 USB to Fast Ethernet Adapter */ 608 - .driver_info = (unsigned long)&dm9601_info, 609 - }, 610 - { 611 607 USB_DEVICE(0x0a46, 0x9000), /* DM9000E */ 612 608 .driver_info = (unsigned long)&dm9601_info, 613 609 },
+7 -3
drivers/net/usb/usbnet.c
··· 1821 1821 if ((dev->driver_info->flags & FLAG_NOARP) != 0) 1822 1822 net->flags |= IFF_NOARP; 1823 1823 1824 - /* maybe the remote can't receive an Ethernet MTU */ 1825 - if (net->mtu > (dev->hard_mtu - net->hard_header_len)) 1826 - net->mtu = dev->hard_mtu - net->hard_header_len; 1824 + if (net->max_mtu > (dev->hard_mtu - net->hard_header_len)) 1825 + net->max_mtu = dev->hard_mtu - net->hard_header_len; 1826 + 1827 + if (net->mtu > net->max_mtu) 1828 + net->mtu = net->max_mtu; 1829 + 1827 1830 } else if (!info->in || !info->out) 1828 1831 status = usbnet_get_endpoints(dev, udev); 1829 1832 else { ··· 1987 1984 } else { 1988 1985 netif_trans_update(dev->net); 1989 1986 __skb_queue_tail(&dev->txq, skb); 1987 + netdev_sent_queue(dev->net, skb->len); 1990 1988 } 1991 1989 } 1992 1990
+6 -2
drivers/net/veth.c
··· 228 228 const struct veth_rq_stats *rq_stats = &rcv_priv->rq[i].stats; 229 229 const void *base = (void *)&rq_stats->vs; 230 230 unsigned int start, tx_idx = idx; 231 + u64 buf[VETH_TQ_STATS_LEN]; 231 232 size_t offset; 232 233 233 - tx_idx += (i % dev->real_num_tx_queues) * VETH_TQ_STATS_LEN; 234 234 do { 235 235 start = u64_stats_fetch_begin(&rq_stats->syncp); 236 236 for (j = 0; j < VETH_TQ_STATS_LEN; j++) { 237 237 offset = veth_tq_stats_desc[j].offset; 238 - data[tx_idx + j] += *(u64 *)(base + offset); 238 + buf[j] = *(u64 *)(base + offset); 239 239 } 240 240 } while (u64_stats_fetch_retry(&rq_stats->syncp, start)); 241 + 242 + tx_idx += (i % dev->real_num_tx_queues) * VETH_TQ_STATS_LEN; 243 + for (j = 0; j < VETH_TQ_STATS_LEN; j++) 244 + data[tx_idx + j] += buf[j]; 241 245 } 242 246 pp_idx = idx + dev->real_num_tx_queues * VETH_TQ_STATS_LEN; 243 247
+8 -8
drivers/net/wireless/ath/ath10k/ce.c
··· 1727 1727 (ce_state->src_ring->nentries * 1728 1728 sizeof(struct ce_desc) + 1729 1729 CE_DESC_RING_ALIGN), 1730 - ce_state->src_ring->base_addr_owner_space, 1731 - ce_state->src_ring->base_addr_ce_space); 1730 + ce_state->src_ring->base_addr_owner_space_unaligned, 1731 + ce_state->src_ring->base_addr_ce_space_unaligned); 1732 1732 kfree(ce_state->src_ring); 1733 1733 } 1734 1734 ··· 1737 1737 (ce_state->dest_ring->nentries * 1738 1738 sizeof(struct ce_desc) + 1739 1739 CE_DESC_RING_ALIGN), 1740 - ce_state->dest_ring->base_addr_owner_space, 1741 - ce_state->dest_ring->base_addr_ce_space); 1740 + ce_state->dest_ring->base_addr_owner_space_unaligned, 1741 + ce_state->dest_ring->base_addr_ce_space_unaligned); 1742 1742 kfree(ce_state->dest_ring); 1743 1743 } 1744 1744 ··· 1758 1758 (ce_state->src_ring->nentries * 1759 1759 sizeof(struct ce_desc_64) + 1760 1760 CE_DESC_RING_ALIGN), 1761 - ce_state->src_ring->base_addr_owner_space, 1762 - ce_state->src_ring->base_addr_ce_space); 1761 + ce_state->src_ring->base_addr_owner_space_unaligned, 1762 + ce_state->src_ring->base_addr_ce_space_unaligned); 1763 1763 kfree(ce_state->src_ring); 1764 1764 } 1765 1765 ··· 1768 1768 (ce_state->dest_ring->nentries * 1769 1769 sizeof(struct ce_desc_64) + 1770 1770 CE_DESC_RING_ALIGN), 1771 - ce_state->dest_ring->base_addr_owner_space, 1772 - ce_state->dest_ring->base_addr_ce_space); 1771 + ce_state->dest_ring->base_addr_owner_space_unaligned, 1772 + ce_state->dest_ring->base_addr_ce_space_unaligned); 1773 1773 kfree(ce_state->dest_ring); 1774 1774 } 1775 1775
+6 -6
drivers/net/wireless/ath/ath12k/ce.c
··· 984 984 dma_free_coherent(ab->dev, 985 985 pipe->src_ring->nentries * desc_sz + 986 986 CE_DESC_RING_ALIGN, 987 - pipe->src_ring->base_addr_owner_space, 988 - pipe->src_ring->base_addr_ce_space); 987 + pipe->src_ring->base_addr_owner_space_unaligned, 988 + pipe->src_ring->base_addr_ce_space_unaligned); 989 989 kfree(pipe->src_ring); 990 990 pipe->src_ring = NULL; 991 991 } ··· 995 995 dma_free_coherent(ab->dev, 996 996 pipe->dest_ring->nentries * desc_sz + 997 997 CE_DESC_RING_ALIGN, 998 - pipe->dest_ring->base_addr_owner_space, 999 - pipe->dest_ring->base_addr_ce_space); 998 + pipe->dest_ring->base_addr_owner_space_unaligned, 999 + pipe->dest_ring->base_addr_ce_space_unaligned); 1000 1000 kfree(pipe->dest_ring); 1001 1001 pipe->dest_ring = NULL; 1002 1002 } ··· 1007 1007 dma_free_coherent(ab->dev, 1008 1008 pipe->status_ring->nentries * desc_sz + 1009 1009 CE_DESC_RING_ALIGN, 1010 - pipe->status_ring->base_addr_owner_space, 1011 - pipe->status_ring->base_addr_ce_space); 1010 + pipe->status_ring->base_addr_owner_space_unaligned, 1011 + pipe->status_ring->base_addr_ce_space_unaligned); 1012 1012 kfree(pipe->status_ring); 1013 1013 pipe->status_ring = NULL; 1014 1014 }
+10 -6
drivers/net/wireless/ath/ath12k/mac.c
··· 5495 5495 5496 5496 for_each_set_bit(link_id, &links_map, ATH12K_NUM_MAX_LINKS) { 5497 5497 arvif = wiphy_dereference(hw->wiphy, ahvif->link[link_id]); 5498 - if (!arvif || arvif->is_started) 5498 + if (!arvif || !arvif->is_created || 5499 + arvif->ar->scan.arvif != arvif) 5499 5500 continue; 5500 5501 5501 5502 ar = arvif->ar; ··· 9173 9172 return; 9174 9173 } 9175 9174 } else { 9176 - link_id = 0; 9175 + if (vif->type == NL80211_IFTYPE_P2P_DEVICE) 9176 + link_id = ATH12K_FIRST_SCAN_LINK; 9177 + else 9178 + link_id = 0; 9177 9179 } 9178 9180 9179 9181 arvif = rcu_dereference(ahvif->link[link_id]); ··· 12146 12142 if (drop) 12147 12143 return; 12148 12144 12145 + for_each_ar(ah, ar, i) 12146 + wiphy_work_flush(hw->wiphy, &ar->wmi_mgmt_tx_work); 12147 + 12149 12148 /* vif can be NULL when flush() is considered for hw */ 12150 12149 if (!vif) { 12151 12150 for_each_ar(ah, ar, i) 12152 12151 ath12k_mac_flush(ar); 12153 12152 return; 12154 12153 } 12155 - 12156 - for_each_ar(ah, ar, i) 12157 - wiphy_work_flush(hw->wiphy, &ar->wmi_mgmt_tx_work); 12158 12154 12159 12155 ahvif = ath12k_vif_to_ahvif(vif); 12160 12156 links = ahvif->links_map; ··· 13347 13343 ath12k_scan_abort(ar); 13348 13344 13349 13345 cancel_delayed_work_sync(&ar->scan.timeout); 13350 - wiphy_work_cancel(hw->wiphy, &ar->scan.vdev_clean_wk); 13346 + wiphy_work_flush(hw->wiphy, &ar->scan.vdev_clean_wk); 13351 13347 13352 13348 return 0; 13353 13349 }
+1 -8
drivers/net/wireless/ath/ath12k/wmi.c
··· 6575 6575 if (!sband) 6576 6576 continue; 6577 6577 6578 - for (ch = 0; ch < sband->n_channels; ch++, idx++) { 6579 - if (sband->channels[ch].center_freq < 6580 - KHZ_TO_MHZ(ar->freq_range.start_freq) || 6581 - sband->channels[ch].center_freq > 6582 - KHZ_TO_MHZ(ar->freq_range.end_freq)) 6583 - continue; 6584 - 6578 + for (ch = 0; ch < sband->n_channels; ch++, idx++) 6585 6579 if (sband->channels[ch].center_freq == freq) 6586 6580 goto exit; 6587 - } 6588 6581 } 6589 6582 6590 6583 exit:
+3 -3
drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c
··· 825 825 static void mwifiex_update_ampdu_rxwinsize(struct mwifiex_adapter *adapter, 826 826 bool coex_flag) 827 827 { 828 - u8 i; 828 + u8 i, j; 829 829 u32 rx_win_size; 830 830 struct mwifiex_private *priv; 831 831 ··· 863 863 if (rx_win_size != priv->add_ba_param.rx_win_size) { 864 864 if (!priv->media_connected) 865 865 continue; 866 - for (i = 0; i < MAX_NUM_TID; i++) 867 - mwifiex_11n_delba(priv, i); 866 + for (j = 0; j < MAX_NUM_TID; j++) 867 + mwifiex_11n_delba(priv, j); 868 868 } 869 869 } 870 870 }
+1
drivers/net/wireless/rsi/rsi_91x_mac80211.c
··· 2035 2035 2036 2036 hw->queues = MAX_HW_QUEUES; 2037 2037 hw->extra_tx_headroom = RSI_NEEDED_HEADROOM; 2038 + hw->vif_data_size = sizeof(struct vif_priv); 2038 2039 2039 2040 hw->max_rates = 1; 2040 2041 hw->max_rate_tries = MAX_RETRIES;
+8 -9
drivers/net/wwan/mhi_wwan_mbim.c
··· 78 78 79 79 struct mbim_tx_hdr { 80 80 struct usb_cdc_ncm_nth16 nth16; 81 - 82 - /* Must be last as it ends in a flexible-array member. */ 83 81 struct usb_cdc_ncm_ndp16 ndp16; 82 + struct usb_cdc_ncm_dpe16 dpe16[2]; 84 83 } __packed; 85 84 86 85 static struct mhi_mbim_link *mhi_mbim_get_link_rcu(struct mhi_mbim_context *mbim, ··· 107 108 static struct sk_buff *mbim_tx_fixup(struct sk_buff *skb, unsigned int session, 108 109 u16 tx_seq) 109 110 { 110 - DEFINE_RAW_FLEX(struct mbim_tx_hdr, mbim_hdr, ndp16.dpe16, 2); 111 111 unsigned int dgram_size = skb->len; 112 112 struct usb_cdc_ncm_nth16 *nth16; 113 113 struct usb_cdc_ncm_ndp16 *ndp16; 114 + struct mbim_tx_hdr *mbim_hdr; 114 115 115 116 /* Only one NDP is sent, containing the IP packet (no aggregation) */ 116 117 117 118 /* Ensure we have enough headroom for crafting MBIM header */ 118 - if (skb_cow_head(skb, __struct_size(mbim_hdr))) { 119 + if (skb_cow_head(skb, sizeof(struct mbim_tx_hdr))) { 119 120 dev_kfree_skb_any(skb); 120 121 return NULL; 121 122 } 122 123 123 - mbim_hdr = skb_push(skb, __struct_size(mbim_hdr)); 124 + mbim_hdr = skb_push(skb, sizeof(struct mbim_tx_hdr)); 124 125 125 126 /* Fill NTB header */ 126 127 nth16 = &mbim_hdr->nth16; ··· 133 134 /* Fill the unique NDP */ 134 135 ndp16 = &mbim_hdr->ndp16; 135 136 ndp16->dwSignature = cpu_to_le32(USB_CDC_MBIM_NDP16_IPS_SIGN | (session << 24)); 136 - ndp16->wLength = cpu_to_le16(struct_size(ndp16, dpe16, 2)); 137 + ndp16->wLength = cpu_to_le16(sizeof(struct usb_cdc_ncm_ndp16) 138 + + sizeof(struct usb_cdc_ncm_dpe16) * 2); 137 139 ndp16->wNextNdpIndex = 0; 138 140 139 141 /* Datagram follows the mbim header */ 140 - ndp16->dpe16[0].wDatagramIndex = cpu_to_le16(__struct_size(mbim_hdr)); 142 + ndp16->dpe16[0].wDatagramIndex = cpu_to_le16(sizeof(struct mbim_tx_hdr)); 141 143 ndp16->dpe16[0].wDatagramLength = cpu_to_le16(dgram_size); 142 144 143 145 /* null termination */ ··· 584 584 { 585 585 ndev->header_ops = NULL; /* No header */ 586 586 ndev->type = ARPHRD_RAWIP; 587 - ndev->needed_headroom = 588 - struct_size_t(struct mbim_tx_hdr, ndp16.dpe16, 2); 587 + ndev->needed_headroom = sizeof(struct mbim_tx_hdr); 589 588 ndev->hard_header_len = 0; 590 589 ndev->addr_len = 0; 591 590 ndev->flags = IFF_POINTOPOINT | IFF_NOARP;
-4
drivers/nfc/virtual_ncidev.c
··· 125 125 kfree_skb(skb); 126 126 return -EFAULT; 127 127 } 128 - if (strnlen(skb->data, count) != count) { 129 - kfree_skb(skb); 130 - return -EINVAL; 131 - } 132 128 133 129 nci_recv_frame(vdev->ndev, skb); 134 130 return count;
-3
include/net/cfg80211.h
··· 3221 3221 * if this is %NULL for a link, that link is not requested 3222 3222 * @elems: extra elements for the per-STA profile for this link 3223 3223 * @elems_len: length of the elements 3224 - * @disabled: If set this link should be included during association etc. but it 3225 - * should not be used until enabled by the AP MLD. 3226 3224 * @error: per-link error code, must be <= 0. If there is an error, then the 3227 3225 * operation as a whole must fail. 3228 3226 */ ··· 3228 3230 struct cfg80211_bss *bss; 3229 3231 const u8 *elems; 3230 3232 size_t elems_len; 3231 - bool disabled; 3232 3233 int error; 3233 3234 }; 3234 3235
+4
include/trace/events/rxrpc.h
··· 322 322 EM(rxrpc_call_put_kernel, "PUT kernel ") \ 323 323 EM(rxrpc_call_put_poke, "PUT poke ") \ 324 324 EM(rxrpc_call_put_recvmsg, "PUT recvmsg ") \ 325 + EM(rxrpc_call_put_recvmsg_peek_nowait, "PUT peek-nwt") \ 325 326 EM(rxrpc_call_put_release_recvmsg_q, "PUT rls-rcmq") \ 326 327 EM(rxrpc_call_put_release_sock, "PUT rls-sock") \ 327 328 EM(rxrpc_call_put_release_sock_tba, "PUT rls-sk-a") \ ··· 341 340 EM(rxrpc_call_see_input, "SEE input ") \ 342 341 EM(rxrpc_call_see_notify_released, "SEE nfy-rlsd") \ 343 342 EM(rxrpc_call_see_recvmsg, "SEE recvmsg ") \ 343 + EM(rxrpc_call_see_recvmsg_requeue, "SEE recv-rqu") \ 344 + EM(rxrpc_call_see_recvmsg_requeue_first, "SEE recv-rqF") \ 345 + EM(rxrpc_call_see_recvmsg_requeue_move, "SEE recv-rqM") \ 344 346 EM(rxrpc_call_see_release, "SEE release ") \ 345 347 EM(rxrpc_call_see_userid_exists, "SEE u-exists") \ 346 348 EM(rxrpc_call_see_waiting_call, "SEE q-conn ") \
+3 -2
include/uapi/linux/nl80211.h
··· 2880 2880 * index. If the userspace includes more RNR elements than number of 2881 2881 * MBSSID elements then these will be added in every EMA beacon. 2882 2882 * 2883 - * @NL80211_ATTR_MLO_LINK_DISABLED: Flag attribute indicating that the link is 2884 - * disabled. 2883 + * @NL80211_ATTR_MLO_LINK_DISABLED: Unused. It was used to indicate that a link 2884 + * is disabled during association. However, the AP will send the 2885 + * information by including a TTLM in the association response. 2885 2886 * 2886 2887 * @NL80211_ATTR_BSS_DUMP_INCLUDE_USE_DATA: Include BSS usage data, i.e. 2887 2888 * include BSSes that can only be used in restricted scenarios and/or
+4 -3
net/core/skbuff.c
··· 1312 1312 has_mac = skb_mac_header_was_set(skb); 1313 1313 has_trans = skb_transport_header_was_set(skb); 1314 1314 1315 - printk("%sskb len=%u headroom=%u headlen=%u tailroom=%u\n" 1316 - "mac=(%d,%d) mac_len=%u net=(%d,%d) trans=%d\n" 1315 + printk("%sskb len=%u data_len=%u headroom=%u headlen=%u tailroom=%u\n" 1316 + "end-tail=%u mac=(%d,%d) mac_len=%u net=(%d,%d) trans=%d\n" 1317 1317 "shinfo(txflags=%u nr_frags=%u gso(size=%hu type=%u segs=%hu))\n" 1318 1318 "csum(0x%x start=%u offset=%u ip_summed=%u complete_sw=%u valid=%u level=%u)\n" 1319 1319 "hash(0x%x sw=%u l4=%u) proto=0x%04x pkttype=%u iif=%d\n" 1320 1320 "priority=0x%x mark=0x%x alloc_cpu=%u vlan_all=0x%x\n" 1321 1321 "encapsulation=%d inner(proto=0x%04x, mac=%u, net=%u, trans=%u)\n", 1322 - level, skb->len, headroom, skb_headlen(skb), tailroom, 1322 + level, skb->len, skb->data_len, headroom, skb_headlen(skb), 1323 + tailroom, skb->end - skb->tail, 1323 1324 has_mac ? skb->mac_header : -1, 1324 1325 has_mac ? skb_mac_header_len(skb) : -1, 1325 1326 skb->mac_len,
+1 -1
net/dsa/dsa.c
··· 158 158 bridge_num = find_next_zero_bit(&dsa_fwd_offloading_bridges, 159 159 DSA_MAX_NUM_OFFLOADING_BRIDGES, 160 160 1); 161 - if (bridge_num >= max) 161 + if (bridge_num > max) 162 162 return 0; 163 163 164 164 set_bit(bridge_num, &dsa_fwd_offloading_bridges);
+3
net/ipv4/fou_core.c
··· 215 215 return gue_control_message(skb, guehdr); 216 216 217 217 proto_ctype = guehdr->proto_ctype; 218 + if (unlikely(!proto_ctype)) 219 + goto drop; 220 + 218 221 __skb_pull(skb, sizeof(struct udphdr) + hdrlen); 219 222 skb_reset_transport_header(skb); 220 223
+1 -1
net/ipv4/fou_nl.c
··· 15 15 const struct nla_policy fou_nl_policy[FOU_ATTR_IFINDEX + 1] = { 16 16 [FOU_ATTR_PORT] = { .type = NLA_BE16, }, 17 17 [FOU_ATTR_AF] = { .type = NLA_U8, }, 18 - [FOU_ATTR_IPPROTO] = { .type = NLA_U8, }, 18 + [FOU_ATTR_IPPROTO] = NLA_POLICY_MIN(NLA_U8, 1), 19 19 [FOU_ATTR_TYPE] = { .type = NLA_U8, }, 20 20 [FOU_ATTR_REMCSUM_NOPARTIAL] = { .type = NLA_FLAG, }, 21 21 [FOU_ATTR_LOCAL_V4] = { .type = NLA_U32, },
+2 -2
net/ipv6/ndisc.c
··· 1555 1555 memcpy(&n, ((u8 *)(ndopts.nd_opts_mtu+1))+2, sizeof(mtu)); 1556 1556 mtu = ntohl(n); 1557 1557 1558 - if (in6_dev->ra_mtu != mtu) { 1559 - in6_dev->ra_mtu = mtu; 1558 + if (READ_ONCE(in6_dev->ra_mtu) != mtu) { 1559 + WRITE_ONCE(in6_dev->ra_mtu, mtu); 1560 1560 send_ifinfo_notify = true; 1561 1561 } 1562 1562
+5 -3
net/l2tp/l2tp_core.c
··· 1086 1086 tunnel = session->tunnel; 1087 1087 1088 1088 /* Check protocol version */ 1089 - if (version != tunnel->version) 1089 + if (version != tunnel->version) { 1090 + l2tp_session_put(session); 1090 1091 goto invalid; 1092 + } 1091 1093 1092 1094 if (version == L2TP_HDR_VER_3 && 1093 1095 l2tp_v3_ensure_opt_in_linear(session, skb, &ptr, &optr)) { ··· 1416 1414 { 1417 1415 struct l2tp_tunnel *tunnel = container_of(work, struct l2tp_tunnel, 1418 1416 del_work); 1419 - struct sock *sk = tunnel->sock; 1420 - struct socket *sock = sk->sk_socket; 1421 1417 1422 1418 l2tp_tunnel_closeall(tunnel); 1423 1419 ··· 1423 1423 * the sk API to release it here. 1424 1424 */ 1425 1425 if (tunnel->fd < 0) { 1426 + struct socket *sock = tunnel->sock->sk_socket; 1427 + 1426 1428 if (sock) { 1427 1429 kernel_sock_shutdown(sock, SHUT_RDWR); 1428 1430 sock_release(sock);
-2
net/mac80211/ieee80211_i.h
··· 451 451 struct ieee80211_conn_settings conn; 452 452 453 453 u16 status; 454 - 455 - bool disabled; 456 454 } link[IEEE80211_MLD_MAX_NUM_LINKS]; 457 455 458 456 u8 ap_addr[ETH_ALEN] __aligned(2);
+6 -2
net/mac80211/iface.c
··· 350 350 /* we hold the RTNL here so can safely walk the list */ 351 351 list_for_each_entry(nsdata, &local->interfaces, list) { 352 352 if (nsdata != sdata && ieee80211_sdata_running(nsdata)) { 353 + struct ieee80211_link_data *link; 354 + 353 355 /* 354 356 * Only OCB and monitor mode may coexist 355 357 */ ··· 378 376 * will not add another interface while any channel 379 377 * switch is active. 380 378 */ 381 - if (nsdata->vif.bss_conf.csa_active) 382 - return -EBUSY; 379 + for_each_link_data(nsdata, link) { 380 + if (link->conf->csa_active) 381 + return -EBUSY; 382 + } 383 383 384 384 /* 385 385 * The remaining checks are only performed for interfaces
+2 -1
net/mac80211/key.c
··· 987 987 988 988 if (ieee80211_sdata_running(sdata)) { 989 989 list_for_each_entry(key, &sdata->key_list, list) { 990 - increment_tailroom_need_count(sdata); 990 + if (!(key->flags & KEY_FLAG_TAINTED)) 991 + increment_tailroom_need_count(sdata); 991 992 ieee80211_key_enable_hw_accel(key); 992 993 } 993 994 }
+119 -94
net/mac80211/mlme.c
··· 6161 6161 return true; 6162 6162 } 6163 6163 6164 + static u16 ieee80211_get_ttlm(u8 bm_size, u8 *data) 6165 + { 6166 + if (bm_size == 1) 6167 + return *data; 6168 + 6169 + return get_unaligned_le16(data); 6170 + } 6171 + 6172 + static int 6173 + ieee80211_parse_adv_t2l(struct ieee80211_sub_if_data *sdata, 6174 + const struct ieee80211_ttlm_elem *ttlm, 6175 + struct ieee80211_adv_ttlm_info *ttlm_info) 6176 + { 6177 + /* The element size was already validated in 6178 + * ieee80211_tid_to_link_map_size_ok() 6179 + */ 6180 + u8 control, link_map_presence, map_size, tid; 6181 + u8 *pos; 6182 + 6183 + memset(ttlm_info, 0, sizeof(*ttlm_info)); 6184 + pos = (void *)ttlm->optional; 6185 + control = ttlm->control; 6186 + 6187 + if ((control & IEEE80211_TTLM_CONTROL_DIRECTION) != 6188 + IEEE80211_TTLM_DIRECTION_BOTH) { 6189 + sdata_info(sdata, "Invalid advertised T2L map direction\n"); 6190 + return -EINVAL; 6191 + } 6192 + 6193 + link_map_presence = *pos; 6194 + pos++; 6195 + 6196 + if (control & IEEE80211_TTLM_CONTROL_SWITCH_TIME_PRESENT) { 6197 + ttlm_info->switch_time = get_unaligned_le16(pos); 6198 + 6199 + /* Since ttlm_info->switch_time == 0 means no switch time, bump 6200 + * it by 1. 6201 + */ 6202 + if (!ttlm_info->switch_time) 6203 + ttlm_info->switch_time = 1; 6204 + 6205 + pos += 2; 6206 + } 6207 + 6208 + if (control & IEEE80211_TTLM_CONTROL_EXPECTED_DUR_PRESENT) { 6209 + ttlm_info->duration = pos[0] | pos[1] << 8 | pos[2] << 16; 6210 + pos += 3; 6211 + } 6212 + 6213 + if (control & IEEE80211_TTLM_CONTROL_DEF_LINK_MAP) { 6214 + ttlm_info->map = 0xffff; 6215 + return 0; 6216 + } 6217 + 6218 + if (control & IEEE80211_TTLM_CONTROL_LINK_MAP_SIZE) 6219 + map_size = 1; 6220 + else 6221 + map_size = 2; 6222 + 6223 + /* According to Draft P802.11be_D3.0 clause 35.3.7.1.7, an AP MLD shall 6224 + * not advertise a TID-to-link mapping that does not map all TIDs to the 6225 + * same link set, reject frame if not all links have mapping 6226 + */ 6227 + if (link_map_presence != 0xff) { 6228 + sdata_info(sdata, 6229 + "Invalid advertised T2L mapping presence indicator\n"); 6230 + return -EINVAL; 6231 + } 6232 + 6233 + ttlm_info->map = ieee80211_get_ttlm(map_size, pos); 6234 + if (!ttlm_info->map) { 6235 + sdata_info(sdata, 6236 + "Invalid advertised T2L map for TID 0\n"); 6237 + return -EINVAL; 6238 + } 6239 + 6240 + pos += map_size; 6241 + 6242 + for (tid = 1; tid < 8; tid++) { 6243 + u16 map = ieee80211_get_ttlm(map_size, pos); 6244 + 6245 + if (map != ttlm_info->map) { 6246 + sdata_info(sdata, "Invalid advertised T2L map for tid %d\n", 6247 + tid); 6248 + return -EINVAL; 6249 + } 6250 + 6251 + pos += map_size; 6252 + } 6253 + return 0; 6254 + } 6255 + 6164 6256 static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata, 6165 6257 struct ieee80211_mgmt *mgmt, 6166 6258 struct ieee802_11_elems *elems, ··· 6284 6192 continue; 6285 6193 6286 6194 valid_links |= BIT(link_id); 6287 - if (assoc_data->link[link_id].disabled) 6288 - dormant_links |= BIT(link_id); 6289 6195 6290 6196 if (link_id != assoc_data->assoc_link_id) { 6291 6197 err = ieee80211_sta_allocate_link(sta, link_id); 6292 6198 if (err) 6293 6199 goto out_err; 6294 6200 } 6201 + } 6202 + 6203 + /* 6204 + * We do not support setting a negotiated TTLM during 6205 + * association. As such, we can assume that if there is a TTLM, 6206 + * then it is the currently active advertised TTLM. 6207 + * In that case, there must be exactly one TTLM that does not 6208 + * have a switch time set. This mapping should also leave us 6209 + * with at least one usable link. 6210 + */ 6211 + if (elems->ttlm_num > 1) { 6212 + sdata_info(sdata, 6213 + "More than one advertised TTLM in association response\n"); 6214 + goto out_err; 6215 + } else if (elems->ttlm_num == 1) { 6216 + if (ieee80211_parse_adv_t2l(sdata, elems->ttlm[0], 6217 + &sdata->u.mgd.ttlm_info) || 6218 + sdata->u.mgd.ttlm_info.switch_time != 0 || 6219 + !(valid_links & sdata->u.mgd.ttlm_info.map)) { 6220 + sdata_info(sdata, 6221 + "Invalid advertised TTLM in association response\n"); 6222 + goto out_err; 6223 + } 6224 + 6225 + sdata->u.mgd.ttlm_info.active = true; 6226 + dormant_links = 6227 + valid_links & ~sdata->u.mgd.ttlm_info.map; 6295 6228 } 6296 6229 6297 6230 ieee80211_vif_set_links(sdata, valid_links, dormant_links); ··· 7107 6990 7108 6991 sdata->u.mgd.ttlm_info.active = true; 7109 6992 sdata->u.mgd.ttlm_info.switch_time = 0; 7110 - } 7111 - 7112 - static u16 ieee80211_get_ttlm(u8 bm_size, u8 *data) 7113 - { 7114 - if (bm_size == 1) 7115 - return *data; 7116 - else 7117 - return get_unaligned_le16(data); 7118 - } 7119 - 7120 - static int 7121 - ieee80211_parse_adv_t2l(struct ieee80211_sub_if_data *sdata, 7122 - const struct ieee80211_ttlm_elem *ttlm, 7123 - struct ieee80211_adv_ttlm_info *ttlm_info) 7124 - { 7125 - /* The element size was already validated in 7126 - * ieee80211_tid_to_link_map_size_ok() 7127 - */ 7128 - u8 control, link_map_presence, map_size, tid; 7129 - u8 *pos; 7130 - 7131 - memset(ttlm_info, 0, sizeof(*ttlm_info)); 7132 - pos = (void *)ttlm->optional; 7133 - control = ttlm->control; 7134 - 7135 - if ((control & IEEE80211_TTLM_CONTROL_DEF_LINK_MAP) || 7136 - !(control & IEEE80211_TTLM_CONTROL_SWITCH_TIME_PRESENT)) 7137 - return 0; 7138 - 7139 - if ((control & IEEE80211_TTLM_CONTROL_DIRECTION) != 7140 - IEEE80211_TTLM_DIRECTION_BOTH) { 7141 - sdata_info(sdata, "Invalid advertised T2L map direction\n"); 7142 - return -EINVAL; 7143 - } 7144 - 7145 - link_map_presence = *pos; 7146 - pos++; 7147 - 7148 - ttlm_info->switch_time = get_unaligned_le16(pos); 7149 - 7150 - /* Since ttlm_info->switch_time == 0 means no switch time, bump it 7151 - * by 1. 7152 - */ 7153 - if (!ttlm_info->switch_time) 7154 - ttlm_info->switch_time = 1; 7155 - 7156 - pos += 2; 7157 - 7158 - if (control & IEEE80211_TTLM_CONTROL_EXPECTED_DUR_PRESENT) { 7159 - ttlm_info->duration = pos[0] | pos[1] << 8 | pos[2] << 16; 7160 - pos += 3; 7161 - } 7162 - 7163 - if (control & IEEE80211_TTLM_CONTROL_LINK_MAP_SIZE) 7164 - map_size = 1; 7165 - else 7166 - map_size = 2; 7167 - 7168 - /* According to Draft P802.11be_D3.0 clause 35.3.7.1.7, an AP MLD shall 7169 - * not advertise a TID-to-link mapping that does not map all TIDs to the 7170 - * same link set, reject frame if not all links have mapping 7171 - */ 7172 - if (link_map_presence != 0xff) { 7173 - sdata_info(sdata, 7174 - "Invalid advertised T2L mapping presence indicator\n"); 7175 - return -EINVAL; 7176 - } 7177 - 7178 - ttlm_info->map = ieee80211_get_ttlm(map_size, pos); 7179 - if (!ttlm_info->map) { 7180 - sdata_info(sdata, 7181 - "Invalid advertised T2L map for TID 0\n"); 7182 - return -EINVAL; 7183 - } 7184 - 7185 - pos += map_size; 7186 - 7187 - for (tid = 1; tid < 8; tid++) { 7188 - u16 map = ieee80211_get_ttlm(map_size, pos); 7189 - 7190 - if (map != ttlm_info->map) { 7191 - sdata_info(sdata, "Invalid advertised T2L map for tid %d\n", 7192 - tid); 7193 - return -EINVAL; 7194 - } 7195 - 7196 - pos += map_size; 7197 - } 7198 - return 0; 7199 6993 } 7200 6994 7201 6995 static void ieee80211_process_adv_ttlm(struct ieee80211_sub_if_data *sdata, ··· 9765 9737 req, true, i, 9766 9738 &assoc_data->link[i].conn); 9767 9739 assoc_data->link[i].bss = link_cbss; 9768 - assoc_data->link[i].disabled = req->links[i].disabled; 9769 9740 9770 9741 if (!bss->uapsd_supported) 9771 9742 uapsd_supported = false; ··· 10746 10719 &data->link[link_id].conn); 10747 10720 10748 10721 data->link[link_id].bss = link_cbss; 10749 - data->link[link_id].disabled = 10750 - req->add_links[link_id].disabled; 10751 10722 data->link[link_id].elems = 10752 10723 (u8 *)req->add_links[link_id].elems; 10753 10724 data->link[link_id].elems_len =
+7 -2
net/mac80211/scan.c
··· 347 347 mgmt->da)) 348 348 return; 349 349 } else { 350 - /* Beacons are expected only with broadcast address */ 351 - if (!is_broadcast_ether_addr(mgmt->da)) 350 + /* 351 + * Non-S1G beacons are expected only with broadcast address. 352 + * S1G beacons only carry the SA so no DA check is required 353 + * nor possible. 354 + */ 355 + if (!ieee80211_is_s1g_beacon(mgmt->frame_control) && 356 + !is_broadcast_ether_addr(mgmt->da)) 352 357 return; 353 358 } 354 359
+9 -4
net/netrom/nr_route.c
··· 752 752 unsigned char *dptr; 753 753 ax25_cb *ax25s; 754 754 int ret; 755 - struct sk_buff *skbn; 755 + struct sk_buff *nskb, *oskb; 756 756 757 757 /* 758 758 * Reject malformed packets early. Check that it contains at least 2 ··· 811 811 /* We are going to change the netrom headers so we should get our 812 812 own skb, we also did not know until now how much header space 813 813 we had to reserve... - RXQ */ 814 - if ((skbn=skb_copy_expand(skb, dev->hard_header_len, 0, GFP_ATOMIC)) == NULL) { 814 + nskb = skb_copy_expand(skb, dev->hard_header_len, 0, GFP_ATOMIC); 815 + 816 + if (!nskb) { 815 817 nr_node_unlock(nr_node); 816 818 nr_node_put(nr_node); 817 819 dev_put(dev); 818 820 return 0; 819 821 } 820 - kfree_skb(skb); 821 - skb=skbn; 822 + oskb = skb; 823 + skb = nskb; 822 824 skb->data[14]--; 823 825 824 826 dptr = skb_push(skb, 1); ··· 838 836 ret = (nr_neigh->ax25 != NULL); 839 837 nr_node_unlock(nr_node); 840 838 nr_node_put(nr_node); 839 + 840 + if (ret) 841 + kfree_skb(oskb); 841 842 842 843 return ret; 843 844 }
+6 -5
net/openvswitch/vport.c
··· 310 310 */ 311 311 int ovs_vport_get_upcall_stats(struct vport *vport, struct sk_buff *skb) 312 312 { 313 + u64 tx_success = 0, tx_fail = 0; 313 314 struct nlattr *nla; 314 315 int i; 315 316 316 - __u64 tx_success = 0; 317 - __u64 tx_fail = 0; 318 - 319 317 for_each_possible_cpu(i) { 320 318 const struct vport_upcall_stats_percpu *stats; 319 + u64 n_success, n_fail; 321 320 unsigned int start; 322 321 323 322 stats = per_cpu_ptr(vport->upcall_stats, i); 324 323 do { 325 324 start = u64_stats_fetch_begin(&stats->syncp); 326 - tx_success += u64_stats_read(&stats->n_success); 327 - tx_fail += u64_stats_read(&stats->n_fail); 325 + n_success = u64_stats_read(&stats->n_success); 326 + n_fail = u64_stats_read(&stats->n_fail); 328 327 } while (u64_stats_fetch_retry(&stats->syncp, start)); 328 + tx_success += n_success; 329 + tx_fail += n_fail; 329 330 } 330 331 331 332 nla = nla_nest_start_noflag(skb, OVS_VPORT_ATTR_UPCALL_STATS);
+8 -1
net/rxrpc/ar-internal.h
··· 387 387 struct rb_root service_conns; /* Service connections */ 388 388 struct list_head keepalive_link; /* Link in net->peer_keepalive[] */ 389 389 unsigned long app_data; /* Application data (e.g. afs_server) */ 390 - time64_t last_tx_at; /* Last time packet sent here */ 390 + unsigned int last_tx_at; /* Last time packet sent here (time64_t LSW) */ 391 391 seqlock_t service_conn_lock; 392 392 spinlock_t lock; /* access lock */ 393 393 int debug_id; /* debug ID for printks */ ··· 1378 1378 void rxrpc_peer_keepalive_worker(struct work_struct *); 1379 1379 void rxrpc_input_probe_for_pmtud(struct rxrpc_connection *conn, rxrpc_serial_t acked_serial, 1380 1380 bool sendmsg_fail); 1381 + 1382 + /* Update the last transmission time on a peer for keepalive purposes. */ 1383 + static inline void rxrpc_peer_mark_tx(struct rxrpc_peer *peer) 1384 + { 1385 + /* To avoid tearing on 32-bit systems, we only keep the LSW. */ 1386 + WRITE_ONCE(peer->last_tx_at, ktime_get_seconds()); 1387 + } 1381 1388 1382 1389 /* 1383 1390 * peer_object.c
+1 -1
net/rxrpc/conn_event.c
··· 194 194 } 195 195 196 196 ret = kernel_sendmsg(conn->local->socket, &msg, iov, ioc, len); 197 - conn->peer->last_tx_at = ktime_get_seconds(); 197 + rxrpc_peer_mark_tx(conn->peer); 198 198 if (ret < 0) 199 199 trace_rxrpc_tx_fail(chan->call_debug_id, serial, ret, 200 200 rxrpc_tx_point_call_final_resend);
+7 -7
net/rxrpc/output.c
··· 275 275 rxrpc_local_dont_fragment(conn->local, why == rxrpc_propose_ack_ping_for_mtu_probe); 276 276 277 277 ret = do_udp_sendmsg(conn->local->socket, &msg, len); 278 - call->peer->last_tx_at = ktime_get_seconds(); 278 + rxrpc_peer_mark_tx(call->peer); 279 279 if (ret < 0) { 280 280 trace_rxrpc_tx_fail(call->debug_id, serial, ret, 281 281 rxrpc_tx_point_call_ack); ··· 411 411 412 412 iov_iter_kvec(&msg.msg_iter, WRITE, iov, 1, sizeof(pkt)); 413 413 ret = do_udp_sendmsg(conn->local->socket, &msg, sizeof(pkt)); 414 - conn->peer->last_tx_at = ktime_get_seconds(); 414 + rxrpc_peer_mark_tx(conn->peer); 415 415 if (ret < 0) 416 416 trace_rxrpc_tx_fail(call->debug_id, serial, ret, 417 417 rxrpc_tx_point_call_abort); ··· 698 698 ret = 0; 699 699 trace_rxrpc_tx_data(call, txb->seq, txb->serial, txb->flags, 700 700 rxrpc_txdata_inject_loss); 701 - conn->peer->last_tx_at = ktime_get_seconds(); 701 + rxrpc_peer_mark_tx(conn->peer); 702 702 goto done; 703 703 } 704 704 } ··· 711 711 */ 712 712 rxrpc_inc_stat(call->rxnet, stat_tx_data_send); 713 713 ret = do_udp_sendmsg(conn->local->socket, &msg, len); 714 - conn->peer->last_tx_at = ktime_get_seconds(); 714 + rxrpc_peer_mark_tx(conn->peer); 715 715 716 716 if (ret == -EMSGSIZE) { 717 717 rxrpc_inc_stat(call->rxnet, stat_tx_data_send_msgsize); ··· 797 797 798 798 trace_rxrpc_tx_packet(conn->debug_id, &whdr, rxrpc_tx_point_conn_abort); 799 799 800 - conn->peer->last_tx_at = ktime_get_seconds(); 800 + rxrpc_peer_mark_tx(conn->peer); 801 801 } 802 802 803 803 /* ··· 917 917 trace_rxrpc_tx_packet(peer->debug_id, &whdr, 918 918 rxrpc_tx_point_version_keepalive); 919 919 920 - peer->last_tx_at = ktime_get_seconds(); 920 + rxrpc_peer_mark_tx(peer); 921 921 _leave(""); 922 922 } 923 923 ··· 973 973 if (ret < 0) 974 974 goto fail; 975 975 976 - conn->peer->last_tx_at = ktime_get_seconds(); 976 + rxrpc_peer_mark_tx(conn->peer); 977 977 return; 978 978 979 979 fail:
+16 -1
net/rxrpc/peer_event.c
··· 238 238 } 239 239 240 240 /* 241 + * Reconstruct the last transmission time. The difference calculated should be 242 + * valid provided no more than ~68 years elapsed since the last transmission. 243 + */ 244 + static time64_t rxrpc_peer_get_tx_mark(const struct rxrpc_peer *peer, time64_t base) 245 + { 246 + s32 last_tx_at = READ_ONCE(peer->last_tx_at); 247 + s32 base_lsw = base; 248 + s32 diff = last_tx_at - base_lsw; 249 + 250 + diff = clamp(diff, -RXRPC_KEEPALIVE_TIME, RXRPC_KEEPALIVE_TIME); 251 + 252 + return diff + base; 253 + } 254 + 255 + /* 241 256 * Perform keep-alive pings. 242 257 */ 243 258 static void rxrpc_peer_keepalive_dispatch(struct rxrpc_net *rxnet, ··· 280 265 spin_unlock_bh(&rxnet->peer_hash_lock); 281 266 282 267 if (use) { 283 - keepalive_at = peer->last_tx_at + RXRPC_KEEPALIVE_TIME; 268 + keepalive_at = rxrpc_peer_get_tx_mark(peer, base) + RXRPC_KEEPALIVE_TIME; 284 269 slot = keepalive_at - base; 285 270 _debug("%02x peer %u t=%d {%pISp}", 286 271 cursor, peer->debug_id, slot, &peer->srx.transport);
+2 -2
net/rxrpc/proc.c
··· 296 296 297 297 now = ktime_get_seconds(); 298 298 seq_printf(seq, 299 - "UDP %-47.47s %-47.47s %3u %4u %5u %6llus %8d %8d\n", 299 + "UDP %-47.47s %-47.47s %3u %4u %5u %6ds %8d %8d\n", 300 300 lbuff, 301 301 rbuff, 302 302 refcount_read(&peer->ref), 303 303 peer->cong_ssthresh, 304 304 peer->max_data, 305 - now - peer->last_tx_at, 305 + (s32)now - (s32)READ_ONCE(peer->last_tx_at), 306 306 READ_ONCE(peer->recent_srtt_us), 307 307 READ_ONCE(peer->recent_rto_us)); 308 308
+15 -4
net/rxrpc/recvmsg.c
··· 518 518 if (rxrpc_call_has_failed(call)) 519 519 goto call_failed; 520 520 521 - if (!skb_queue_empty(&call->recvmsg_queue)) 521 + if (!(flags & MSG_PEEK) && 522 + !skb_queue_empty(&call->recvmsg_queue)) 522 523 rxrpc_notify_socket(call); 523 524 goto not_yet_complete; 524 525 ··· 550 549 error_requeue_call: 551 550 if (!(flags & MSG_PEEK)) { 552 551 spin_lock_irq(&rx->recvmsg_lock); 553 - list_add(&call->recvmsg_link, &rx->recvmsg_q); 554 - spin_unlock_irq(&rx->recvmsg_lock); 552 + if (list_empty(&call->recvmsg_link)) { 553 + list_add(&call->recvmsg_link, &rx->recvmsg_q); 554 + rxrpc_see_call(call, rxrpc_call_see_recvmsg_requeue); 555 + spin_unlock_irq(&rx->recvmsg_lock); 556 + } else if (list_is_first(&call->recvmsg_link, &rx->recvmsg_q)) { 557 + spin_unlock_irq(&rx->recvmsg_lock); 558 + rxrpc_put_call(call, rxrpc_call_see_recvmsg_requeue_first); 559 + } else { 560 + list_move(&call->recvmsg_link, &rx->recvmsg_q); 561 + spin_unlock_irq(&rx->recvmsg_lock); 562 + rxrpc_put_call(call, rxrpc_call_see_recvmsg_requeue_move); 563 + } 555 564 trace_rxrpc_recvmsg(call_debug_id, rxrpc_recvmsg_requeue, 0); 556 565 } else { 557 - rxrpc_put_call(call, rxrpc_call_put_recvmsg); 566 + rxrpc_put_call(call, rxrpc_call_put_recvmsg_peek_nowait); 558 567 } 559 568 error_no_call: 560 569 release_sock(&rx->sk);
+1 -1
net/rxrpc/rxgk.c
··· 678 678 679 679 ret = do_udp_sendmsg(conn->local->socket, &msg, len); 680 680 if (ret > 0) 681 - conn->peer->last_tx_at = ktime_get_seconds(); 681 + rxrpc_peer_mark_tx(conn->peer); 682 682 __free_page(page); 683 683 684 684 if (ret < 0) {
+1 -1
net/rxrpc/rxkad.c
··· 694 694 return -EAGAIN; 695 695 } 696 696 697 - conn->peer->last_tx_at = ktime_get_seconds(); 697 + rxrpc_peer_mark_tx(conn->peer); 698 698 trace_rxrpc_tx_packet(conn->debug_id, &whdr, 699 699 rxrpc_tx_point_rxkad_challenge); 700 700 _leave(" = 0");
+4 -2
net/sched/act_ife.c
··· 821 821 /* could be stupid policy setup or mtu config 822 822 * so lets be conservative.. */ 823 823 if ((action == TC_ACT_SHOT) || exceed_mtu) { 824 + drop: 824 825 qstats_drop_inc(this_cpu_ptr(ife->common.cpu_qstats)); 825 826 return TC_ACT_SHOT; 826 827 } ··· 830 829 skb_push(skb, skb->dev->hard_header_len); 831 830 832 831 ife_meta = ife_encode(skb, metalen); 832 + if (!ife_meta) 833 + goto drop; 833 834 834 835 spin_lock(&ife->tcf_lock); 835 836 ··· 847 844 if (err < 0) { 848 845 /* too corrupt to keep around if overwritten */ 849 846 spin_unlock(&ife->tcf_lock); 850 - qstats_drop_inc(this_cpu_ptr(ife->common.cpu_qstats)); 851 - return TC_ACT_SHOT; 847 + goto drop; 852 848 } 853 849 skboff += err; 854 850 }
+1 -1
net/sched/sch_qfq.c
··· 373 373 /* Deschedule class and remove it from its parent aggregate. */ 374 374 static void qfq_deact_rm_from_agg(struct qfq_sched *q, struct qfq_class *cl) 375 375 { 376 - if (cl->qdisc->q.qlen > 0) /* class is active */ 376 + if (cl_is_active(cl)) /* class is active */ 377 377 qfq_deactivate_class(q, cl); 378 378 379 379 qfq_rm_from_agg(q, cl);
+5
net/sched/sch_teql.c
··· 178 178 if (m->dev == dev) 179 179 return -ELOOP; 180 180 181 + if (sch->parent != TC_H_ROOT) { 182 + NL_SET_ERR_MSG_MOD(extack, "teql can only be used as root"); 183 + return -EOPNOTSUPP; 184 + } 185 + 181 186 q->m = m; 182 187 183 188 skb_queue_head_init(&q->q);
+5 -5
net/sctp/sm_statefuns.c
··· 603 603 sctp_add_cmd_sf(commands, SCTP_CMD_PEER_INIT, 604 604 SCTP_PEER_INIT(initchunk)); 605 605 606 + /* SCTP-AUTH: generate the association shared keys so that 607 + * we can potentially sign the COOKIE-ECHO. 608 + */ 609 + sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_SHKEY, SCTP_NULL()); 610 + 606 611 /* Reset init error count upon receipt of INIT-ACK. */ 607 612 sctp_add_cmd_sf(commands, SCTP_CMD_INIT_COUNTER_RESET, SCTP_NULL()); 608 613 ··· 621 616 SCTP_TO(SCTP_EVENT_TIMEOUT_T1_COOKIE)); 622 617 sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE, 623 618 SCTP_STATE(SCTP_STATE_COOKIE_ECHOED)); 624 - 625 - /* SCTP-AUTH: generate the association shared keys so that 626 - * we can potentially sign the COOKIE-ECHO. 627 - */ 628 - sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_SHKEY, SCTP_NULL()); 629 619 630 620 /* 5.1 C) "A" shall then send the State Cookie received in the 631 621 * INIT ACK chunk in a COOKIE ECHO chunk, ...
+25 -11
net/vmw_vsock/virtio_transport_common.c
··· 28 28 29 29 static void virtio_transport_cancel_close_work(struct vsock_sock *vsk, 30 30 bool cancel_timeout); 31 + static s64 virtio_transport_has_space(struct virtio_vsock_sock *vvs); 31 32 32 33 static const struct virtio_transport * 33 34 virtio_transport_get_ops(struct vsock_sock *vsk) ··· 500 499 return 0; 501 500 502 501 spin_lock_bh(&vvs->tx_lock); 503 - ret = vvs->peer_buf_alloc - (vvs->tx_cnt - vvs->peer_fwd_cnt); 504 - if (ret > credit) 505 - ret = credit; 502 + ret = min_t(u32, credit, virtio_transport_has_space(vvs)); 506 503 vvs->tx_cnt += ret; 507 504 vvs->bytes_unsent += ret; 508 505 spin_unlock_bh(&vvs->tx_lock); ··· 821 822 } 822 823 EXPORT_SYMBOL_GPL(virtio_transport_seqpacket_dequeue); 823 824 825 + static u32 virtio_transport_tx_buf_size(struct virtio_vsock_sock *vvs) 826 + { 827 + /* The peer advertises its receive buffer via peer_buf_alloc, but we 828 + * cap it to our local buf_alloc so a remote peer cannot force us to 829 + * queue more data than our own buffer configuration allows. 830 + */ 831 + return min(vvs->peer_buf_alloc, vvs->buf_alloc); 832 + } 833 + 824 834 int 825 835 virtio_transport_seqpacket_enqueue(struct vsock_sock *vsk, 826 836 struct msghdr *msg, ··· 839 831 840 832 spin_lock_bh(&vvs->tx_lock); 841 833 842 - if (len > vvs->peer_buf_alloc) { 834 + if (len > virtio_transport_tx_buf_size(vvs)) { 843 835 spin_unlock_bh(&vvs->tx_lock); 844 836 return -EMSGSIZE; 845 837 } ··· 885 877 } 886 878 EXPORT_SYMBOL_GPL(virtio_transport_seqpacket_has_data); 887 879 888 - static s64 virtio_transport_has_space(struct vsock_sock *vsk) 880 + static s64 virtio_transport_has_space(struct virtio_vsock_sock *vvs) 889 881 { 890 - struct virtio_vsock_sock *vvs = vsk->trans; 891 882 s64 bytes; 892 883 893 - bytes = (s64)vvs->peer_buf_alloc - (vvs->tx_cnt - vvs->peer_fwd_cnt); 884 + /* Use s64 arithmetic so if the peer shrinks peer_buf_alloc while 885 + * we have bytes in flight (tx_cnt - peer_fwd_cnt), the subtraction 886 + * does not underflow. 887 + */ 888 + bytes = (s64)virtio_transport_tx_buf_size(vvs) - 889 + (vvs->tx_cnt - vvs->peer_fwd_cnt); 894 890 if (bytes < 0) 895 891 bytes = 0; 896 892 ··· 907 895 s64 bytes; 908 896 909 897 spin_lock_bh(&vvs->tx_lock); 910 - bytes = virtio_transport_has_space(vsk); 898 + bytes = virtio_transport_has_space(vvs); 911 899 spin_unlock_bh(&vvs->tx_lock); 912 900 913 901 return bytes; ··· 1371 1359 1372 1360 /* Try to copy small packets into the buffer of last packet queued, 1373 1361 * to avoid wasting memory queueing the entire buffer with a small 1374 - * payload. 1362 + * payload. Skip non-linear (e.g. zerocopy) skbs; these carry payload 1363 + * in skb_shinfo. 1375 1364 */ 1376 - if (len <= GOOD_COPY_LEN && !skb_queue_empty(&vvs->rx_queue)) { 1365 + if (len <= GOOD_COPY_LEN && !skb_queue_empty(&vvs->rx_queue) && 1366 + !skb_is_nonlinear(skb)) { 1377 1367 struct virtio_vsock_hdr *last_hdr; 1378 1368 struct sk_buff *last_skb; 1379 1369 ··· 1504 1490 spin_lock_bh(&vvs->tx_lock); 1505 1491 vvs->peer_buf_alloc = le32_to_cpu(hdr->buf_alloc); 1506 1492 vvs->peer_fwd_cnt = le32_to_cpu(hdr->fwd_cnt); 1507 - space_available = virtio_transport_has_space(vsk); 1493 + space_available = virtio_transport_has_space(vvs); 1508 1494 spin_unlock_bh(&vvs->tx_lock); 1509 1495 return space_available; 1510 1496 }
-10
net/wireless/nl80211.c
··· 12241 12241 return -EINVAL; 12242 12242 } 12243 12243 } 12244 - 12245 - links[link_id].disabled = 12246 - nla_get_flag(attrs[NL80211_ATTR_MLO_LINK_DISABLED]); 12247 12244 } 12248 12245 12249 12246 return 0; ··· 12416 12419 if (req.links[req.link_id].elems_len) { 12417 12420 GENL_SET_ERR_MSG(info, 12418 12421 "cannot have per-link elems on assoc link"); 12419 - err = -EINVAL; 12420 - goto free; 12421 - } 12422 - 12423 - if (req.links[req.link_id].disabled) { 12424 - GENL_SET_ERR_MSG(info, 12425 - "cannot have assoc link disabled"); 12426 12422 err = -EINVAL; 12427 12423 goto free; 12428 12424 }
+5 -3
net/wireless/util.c
··· 1561 1561 tmp = result; 1562 1562 tmp *= SCALE; 1563 1563 do_div(tmp, mcs_divisors[rate->mcs]); 1564 - result = tmp; 1565 1564 1566 1565 /* and take NSS, DCM into account */ 1567 - result = (result * rate->nss) / 8; 1566 + tmp *= rate->nss; 1567 + do_div(tmp, 8); 1568 1568 if (rate->he_dcm) 1569 - result /= 2; 1569 + do_div(tmp, 2); 1570 + 1571 + result = tmp; 1570 1572 1571 1573 return result / 10000; 1572 1574 }
+2 -1
tools/net/ynl/Makefile
··· 41 41 rm -rf pyynl.egg-info 42 42 rm -rf build 43 43 44 - install: libynl.a lib/*.h 44 + install: libynl.a lib/*.h ynltool 45 45 @echo -e "\tINSTALL libynl.a" 46 46 @$(INSTALL) -d $(DESTDIR)$(libdir) 47 47 @$(INSTALL) -m 0644 libynl.a $(DESTDIR)$(libdir)/libynl.a ··· 51 51 @echo -e "\tINSTALL pyynl" 52 52 @pip install --prefix=$(DESTDIR)$(prefix) . 53 53 @make -C generated install 54 + @make -C ynltool install 54 55 55 56 run_tests: 56 57 @$(MAKE) -C tests run_tests
+1 -1
tools/net/ynl/ynl-regen.sh
··· 21 21 for f in $files; do 22 22 # params: 0 1 2 3 23 23 # $YAML YNL-GEN kernel $mode 24 - params=( $(git grep -B1 -h '/\* YNL-GEN' $f | sed 's@/\*\(.*\)\*/@\1@') ) 24 + params=( $(git grep --no-line-number -B1 -h '/\* YNL-GEN' $f | sed 's@/\*\(.*\)\*/@\1@') ) 25 25 args=$(sed -n 's@/\* YNL-ARG \(.*\) \*/@\1@p' $f) 26 26 27 27 if [ $f -nt ${params[0]} -a -z "$force" ]; then
+1
tools/testing/selftests/net/Makefile
··· 48 48 ipv6_flowlabel.sh \ 49 49 ipv6_force_forwarding.sh \ 50 50 ipv6_route_update_soft_lockup.sh \ 51 + ipvtap_test.sh \ 51 52 l2_tos_ttl_inherit.sh \ 52 53 l2tp.sh \ 53 54 link_netns.py \
+5 -2
tools/testing/selftests/net/amt.sh
··· 73 73 # +------------------------+ 74 74 #============================================================================== 75 75 76 + source lib.sh 77 + 76 78 readonly LISTENER=$(mktemp -u listener-XXXXXXXX) 77 79 readonly GATEWAY=$(mktemp -u gateway-XXXXXXXX) 78 80 readonly RELAY=$(mktemp -u relay-XXXXXXXX) ··· 248 246 249 247 send_mcast4() 250 248 { 251 - sleep 2 249 + sleep 5 250 + wait_local_port_listen ${LISTENER} 4000 udp 252 251 ip netns exec "${SOURCE}" bash -c \ 253 252 'printf "%s %128s" 172.17.0.2 | nc -w 1 -u 239.0.0.1 4000' & 254 253 } 255 254 256 255 send_mcast6() 257 256 { 258 - sleep 2 257 + wait_local_port_listen ${LISTENER} 6000 udp 259 258 ip netns exec "${SOURCE}" bash -c \ 260 259 'printf "%s %128s" 2001:db8:3::2 | nc -w 1 -u ff0e::5:6 6000' & 261 260 }
+2
tools/testing/selftests/net/config
··· 48 48 CONFIG_IPV6_SIT=y 49 49 CONFIG_IPV6_VTI=y 50 50 CONFIG_IPVLAN=m 51 + CONFIG_IPVTAP=m 51 52 CONFIG_KALLSYMS=y 52 53 CONFIG_L2TP=m 53 54 CONFIG_L2TP_ETH=m ··· 117 116 CONFIG_PSAMPLE=m 118 117 CONFIG_RPS=y 119 118 CONFIG_SYSFS=y 119 + CONFIG_TAP=m 120 120 CONFIG_TCP_MD5SIG=y 121 121 CONFIG_TEST_BLACKHOLE_DEV=m 122 122 CONFIG_TEST_BPF=m
+168
tools/testing/selftests/net/ipvtap_test.sh
··· 1 + #!/bin/bash 2 + # SPDX-License-Identifier: GPL-2.0 3 + # 4 + # Simple tests for ipvtap 5 + 6 + 7 + # 8 + # The testing environment looks this way: 9 + # 10 + # |------HNS-------| |------PHY-------| 11 + # | veth<----------------->veth | 12 + # |------|--|------| |----------------| 13 + # | | 14 + # | | |-----TST0-------| 15 + # | |------------|----ipvlan | 16 + # | |----------------| 17 + # | 18 + # | |-----TST1-------| 19 + # |---------------|----ipvlan | 20 + # |----------------| 21 + # 22 + 23 + ALL_TESTS=" 24 + test_ip_set 25 + " 26 + 27 + source lib.sh 28 + 29 + DEBUG=0 30 + 31 + VETH_HOST=vethtst.h 32 + VETH_PHY=vethtst.p 33 + 34 + NS_COUNT=32 35 + IP_ITERATIONS=1024 36 + IPSET_TIMEOUT="60s" 37 + 38 + ns_run() { 39 + ns=$1 40 + shift 41 + if [[ "$ns" == "global" ]]; then 42 + "$@" >/dev/null 43 + else 44 + ip netns exec "$ns" "$@" >/dev/null 45 + fi 46 + } 47 + 48 + test_ip_setup_env() { 49 + setup_ns NS_PHY 50 + setup_ns HST_NS 51 + 52 + # setup simulated other-host (phy) and host itself 53 + ns_run "$HST_NS" ip link add $VETH_HOST type veth peer name $VETH_PHY \ 54 + netns "$NS_PHY" >/dev/null 55 + ns_run "$HST_NS" ip link set $VETH_HOST up 56 + ns_run "$NS_PHY" ip link set $VETH_PHY up 57 + 58 + for ((i=0; i<NS_COUNT; i++)); do 59 + setup_ns ipvlan_ns_$i 60 + ns="ipvlan_ns_$i" 61 + if [ "$DEBUG" = "1" ]; then 62 + echo "created NS ${!ns}" 63 + fi 64 + if ! ns_run "$HST_NS" ip link add netns ${!ns} ipvlan0 \ 65 + link $VETH_HOST \ 66 + type ipvtap mode l2 bridge; then 67 + exit_error "FAIL: Failed to configure ipvlan link." 68 + fi 69 + done 70 + } 71 + 72 + test_ip_cleanup_env() { 73 + ns_run "$HST_NS" ip link del $VETH_HOST 74 + cleanup_all_ns 75 + } 76 + 77 + exit_error() { 78 + echo "$1" 79 + exit $ksft_fail 80 + } 81 + 82 + rnd() { 83 + echo $(( RANDOM % 32 + 16 )) 84 + } 85 + 86 + test_ip_set_thread() { 87 + # Here we are trying to create some IP conflicts between namespaces. 88 + # If just add/remove IP, nothing interesting will happen. 89 + # But if add random IP and then remove random IP, 90 + # eventually conflicts start to apear. 91 + ip link set ipvlan0 up 92 + for ((i=0; i<IP_ITERATIONS; i++)); do 93 + v=$(rnd) 94 + ip a a "172.25.0.$v/24" dev ipvlan0 2>/dev/null 95 + ip a a "fc00::$v/64" dev ipvlan0 2>/dev/null 96 + v=$(rnd) 97 + ip a d "172.25.0.$v/24" dev ipvlan0 2>/dev/null 98 + ip a d "fc00::$v/64" dev ipvlan0 2>/dev/null 99 + done 100 + } 101 + 102 + test_ip_set() { 103 + RET=0 104 + 105 + trap test_ip_cleanup_env EXIT 106 + 107 + test_ip_setup_env 108 + 109 + declare -A ns_pids 110 + for ((i=0; i<NS_COUNT; i++)); do 111 + ns="ipvlan_ns_$i" 112 + ns_run ${!ns} timeout "$IPSET_TIMEOUT" \ 113 + bash -c "$0 test_ip_set_thread"& 114 + ns_pids[$i]=$! 115 + done 116 + 117 + for ((i=0; i<NS_COUNT; i++)); do 118 + wait "${ns_pids[$i]}" 119 + done 120 + 121 + declare -A all_ips 122 + for ((i=0; i<NS_COUNT; i++)); do 123 + ns="ipvlan_ns_$i" 124 + ip_output=$(ip netns exec ${!ns} ip a l dev ipvlan0 | grep inet) 125 + while IFS= read -r nsip_out; do 126 + if [[ -z $nsip_out ]]; then 127 + continue; 128 + fi 129 + nsip=$(awk '{print $2}' <<< "$nsip_out") 130 + if [[ -v all_ips[$nsip] ]]; then 131 + RET=$ksft_fail 132 + log_test "conflict for $nsip" 133 + return "$RET" 134 + else 135 + all_ips[$nsip]=$i 136 + fi 137 + done <<< "$ip_output" 138 + done 139 + 140 + if [ "$DEBUG" = "1" ]; then 141 + for key in "${!all_ips[@]}"; do 142 + echo "$key: ${all_ips[$key]}" 143 + done 144 + fi 145 + 146 + trap - EXIT 147 + test_ip_cleanup_env 148 + 149 + log_test "test multithreaded ip set" 150 + } 151 + 152 + if [[ "$1" == "-d" ]]; then 153 + DEBUG=1 154 + shift 155 + fi 156 + 157 + if [[ "$1" == "-t" ]]; then 158 + shift 159 + TESTS="$*" 160 + fi 161 + 162 + if [[ "$1" == "test_ip_set_thread" ]]; then 163 + test_ip_set_thread 164 + else 165 + require_command ip 166 + 167 + tests_run 168 + fi
+25
tools/testing/selftests/tc-testing/tc-tests/qdiscs/teql.json
··· 81 81 "$TC qdisc del dev $DUMMY handle 1: root", 82 82 "$IP link del dev $DUMMY" 83 83 ] 84 + }, 85 + { 86 + "id": "124e", 87 + "name": "Try to add teql as a child qdisc", 88 + "category": [ 89 + "qdisc", 90 + "ets", 91 + "tbf" 92 + ], 93 + "plugins": { 94 + "requires": [ 95 + "nsPlugin" 96 + ] 97 + }, 98 + "setup": [ 99 + "$TC qdisc add dev $DUMMY root handle 1: qfq", 100 + "$TC class add dev $DUMMY parent 1: classid 1:1 qfq weight 15 maxpkt 16384" 101 + ], 102 + "cmdUnderTest": "$TC qdisc add dev $DUMMY parent 1:1 handle 2:1 teql0", 103 + "expExitCode": "2", 104 + "verifyCmd": "$TC -s -j qdisc ls dev $DUMMY parent 1:1", 105 + "matchJSON": [], 106 + "teardown": [ 107 + "$TC qdisc del dev $DUMMY root handle 1:" 108 + ] 84 109 } 85 110 ]
+1 -1
tools/testing/vsock/util.h
··· 25 25 }; 26 26 27 27 static const char * const transport_ksyms[] = { 28 - #define x(name, symbol) "d " symbol "_transport", 28 + #define x(name, symbol) " " symbol "_transport", 29 29 KNOWN_TRANSPORTS(x) 30 30 #undef x 31 31 };
+117
tools/testing/vsock/vsock_test.c
··· 347 347 } 348 348 349 349 #define SOCK_BUF_SIZE (2 * 1024 * 1024) 350 + #define SOCK_BUF_SIZE_SMALL (64 * 1024) 350 351 #define MAX_MSG_PAGES 4 351 352 352 353 static void test_seqpacket_msg_bounds_client(const struct test_opts *opts) 353 354 { 355 + unsigned long long sock_buf_size; 354 356 unsigned long curr_hash; 355 357 size_t max_msg_size; 356 358 int page_size; ··· 364 362 perror("connect"); 365 363 exit(EXIT_FAILURE); 366 364 } 365 + 366 + sock_buf_size = SOCK_BUF_SIZE; 367 + 368 + setsockopt_ull_check(fd, AF_VSOCK, SO_VM_SOCKETS_BUFFER_MAX_SIZE, 369 + sock_buf_size, 370 + "setsockopt(SO_VM_SOCKETS_BUFFER_MAX_SIZE)"); 371 + 372 + setsockopt_ull_check(fd, AF_VSOCK, SO_VM_SOCKETS_BUFFER_SIZE, 373 + sock_buf_size, 374 + "setsockopt(SO_VM_SOCKETS_BUFFER_SIZE)"); 367 375 368 376 /* Wait, until receiver sets buffer size. */ 369 377 control_expectln("SRVREADY"); ··· 2231 2219 close(fd); 2232 2220 } 2233 2221 2222 + static void test_stream_tx_credit_bounds_client(const struct test_opts *opts) 2223 + { 2224 + unsigned long long sock_buf_size; 2225 + size_t total = 0; 2226 + char buf[4096]; 2227 + int fd; 2228 + 2229 + memset(buf, 'A', sizeof(buf)); 2230 + 2231 + fd = vsock_stream_connect(opts->peer_cid, opts->peer_port); 2232 + if (fd < 0) { 2233 + perror("connect"); 2234 + exit(EXIT_FAILURE); 2235 + } 2236 + 2237 + sock_buf_size = SOCK_BUF_SIZE_SMALL; 2238 + 2239 + setsockopt_ull_check(fd, AF_VSOCK, SO_VM_SOCKETS_BUFFER_MAX_SIZE, 2240 + sock_buf_size, 2241 + "setsockopt(SO_VM_SOCKETS_BUFFER_MAX_SIZE)"); 2242 + 2243 + setsockopt_ull_check(fd, AF_VSOCK, SO_VM_SOCKETS_BUFFER_SIZE, 2244 + sock_buf_size, 2245 + "setsockopt(SO_VM_SOCKETS_BUFFER_SIZE)"); 2246 + 2247 + if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK) < 0) { 2248 + perror("fcntl(F_SETFL)"); 2249 + exit(EXIT_FAILURE); 2250 + } 2251 + 2252 + control_expectln("SRVREADY"); 2253 + 2254 + for (;;) { 2255 + ssize_t sent = send(fd, buf, sizeof(buf), 0); 2256 + 2257 + if (sent == 0) { 2258 + fprintf(stderr, "unexpected EOF while sending bytes\n"); 2259 + exit(EXIT_FAILURE); 2260 + } 2261 + 2262 + if (sent < 0) { 2263 + if (errno == EINTR) 2264 + continue; 2265 + 2266 + if (errno == EAGAIN || errno == EWOULDBLOCK) 2267 + break; 2268 + 2269 + perror("send"); 2270 + exit(EXIT_FAILURE); 2271 + } 2272 + 2273 + total += sent; 2274 + } 2275 + 2276 + control_writeln("CLIDONE"); 2277 + close(fd); 2278 + 2279 + /* We should not be able to send more bytes than the value set as 2280 + * local buffer size. 2281 + */ 2282 + if (total > sock_buf_size) { 2283 + fprintf(stderr, 2284 + "TX credit too large: queued %zu bytes (expected <= %llu)\n", 2285 + total, sock_buf_size); 2286 + exit(EXIT_FAILURE); 2287 + } 2288 + } 2289 + 2290 + static void test_stream_tx_credit_bounds_server(const struct test_opts *opts) 2291 + { 2292 + unsigned long long sock_buf_size; 2293 + int fd; 2294 + 2295 + fd = vsock_stream_accept(VMADDR_CID_ANY, opts->peer_port, NULL); 2296 + if (fd < 0) { 2297 + perror("accept"); 2298 + exit(EXIT_FAILURE); 2299 + } 2300 + 2301 + sock_buf_size = SOCK_BUF_SIZE; 2302 + 2303 + setsockopt_ull_check(fd, AF_VSOCK, SO_VM_SOCKETS_BUFFER_MAX_SIZE, 2304 + sock_buf_size, 2305 + "setsockopt(SO_VM_SOCKETS_BUFFER_MAX_SIZE)"); 2306 + 2307 + setsockopt_ull_check(fd, AF_VSOCK, SO_VM_SOCKETS_BUFFER_SIZE, 2308 + sock_buf_size, 2309 + "setsockopt(SO_VM_SOCKETS_BUFFER_SIZE)"); 2310 + 2311 + control_writeln("SRVREADY"); 2312 + control_expectln("CLIDONE"); 2313 + 2314 + close(fd); 2315 + } 2316 + 2234 2317 static struct test_case test_cases[] = { 2235 2318 { 2236 2319 .name = "SOCK_STREAM connection reset", ··· 2509 2402 .name = "SOCK_STREAM accept()ed socket custom setsockopt()", 2510 2403 .run_client = test_stream_accepted_setsockopt_client, 2511 2404 .run_server = test_stream_accepted_setsockopt_server, 2405 + }, 2406 + { 2407 + .name = "SOCK_STREAM virtio MSG_ZEROCOPY coalescence corruption", 2408 + .run_client = test_stream_msgzcopy_mangle_client, 2409 + .run_server = test_stream_msgzcopy_mangle_server, 2410 + }, 2411 + { 2412 + .name = "SOCK_STREAM TX credit bounds", 2413 + .run_client = test_stream_tx_credit_bounds_client, 2414 + .run_server = test_stream_tx_credit_bounds_server, 2512 2415 }, 2513 2416 {}, 2514 2417 };
+74
tools/testing/vsock/vsock_test_zerocopy.c
··· 9 9 #include <stdio.h> 10 10 #include <stdlib.h> 11 11 #include <string.h> 12 + #include <sys/ioctl.h> 12 13 #include <sys/mman.h> 13 14 #include <unistd.h> 14 15 #include <poll.h> 15 16 #include <linux/errqueue.h> 16 17 #include <linux/kernel.h> 18 + #include <linux/sockios.h> 19 + #include <linux/time64.h> 17 20 #include <errno.h> 18 21 19 22 #include "control.h" 23 + #include "timeout.h" 20 24 #include "vsock_test_zerocopy.h" 21 25 #include "msg_zerocopy_common.h" 22 26 ··· 358 354 } 359 355 360 356 control_expectln("DONE"); 357 + close(fd); 358 + } 359 + 360 + #define GOOD_COPY_LEN 128 /* net/vmw_vsock/virtio_transport_common.c */ 361 + 362 + void test_stream_msgzcopy_mangle_client(const struct test_opts *opts) 363 + { 364 + char sbuf1[PAGE_SIZE + 1], sbuf2[GOOD_COPY_LEN]; 365 + unsigned long hash; 366 + struct pollfd fds; 367 + int fd, i; 368 + 369 + fd = vsock_stream_connect(opts->peer_cid, opts->peer_port); 370 + if (fd < 0) { 371 + perror("connect"); 372 + exit(EXIT_FAILURE); 373 + } 374 + 375 + enable_so_zerocopy_check(fd); 376 + 377 + memset(sbuf1, 'x', sizeof(sbuf1)); 378 + send_buf(fd, sbuf1, sizeof(sbuf1), 0, sizeof(sbuf1)); 379 + 380 + for (i = 0; i < sizeof(sbuf2); i++) 381 + sbuf2[i] = rand() & 0xff; 382 + 383 + send_buf(fd, sbuf2, sizeof(sbuf2), MSG_ZEROCOPY, sizeof(sbuf2)); 384 + 385 + hash = hash_djb2(sbuf2, sizeof(sbuf2)); 386 + control_writeulong(hash); 387 + 388 + fds.fd = fd; 389 + fds.events = 0; 390 + 391 + if (poll(&fds, 1, TIMEOUT * MSEC_PER_SEC) != 1 || 392 + !(fds.revents & POLLERR)) { 393 + perror("poll"); 394 + exit(EXIT_FAILURE); 395 + } 396 + 397 + close(fd); 398 + } 399 + 400 + void test_stream_msgzcopy_mangle_server(const struct test_opts *opts) 401 + { 402 + unsigned long local_hash, remote_hash; 403 + char rbuf[PAGE_SIZE + 1]; 404 + int fd; 405 + 406 + fd = vsock_stream_accept(VMADDR_CID_ANY, opts->peer_port, NULL); 407 + if (fd < 0) { 408 + perror("accept"); 409 + exit(EXIT_FAILURE); 410 + } 411 + 412 + /* Wait, don't race the (buggy) skbs coalescence. */ 413 + vsock_ioctl_int(fd, SIOCINQ, PAGE_SIZE + 1 + GOOD_COPY_LEN); 414 + 415 + /* Discard the first packet. */ 416 + recv_buf(fd, rbuf, PAGE_SIZE + 1, 0, PAGE_SIZE + 1); 417 + 418 + recv_buf(fd, rbuf, GOOD_COPY_LEN, 0, GOOD_COPY_LEN); 419 + remote_hash = control_readulong(); 420 + local_hash = hash_djb2(rbuf, GOOD_COPY_LEN); 421 + 422 + if (local_hash != remote_hash) { 423 + fprintf(stderr, "Data received corrupted\n"); 424 + exit(EXIT_FAILURE); 425 + } 426 + 361 427 close(fd); 362 428 }
+3
tools/testing/vsock/vsock_test_zerocopy.h
··· 12 12 void test_stream_msgzcopy_empty_errq_client(const struct test_opts *opts); 13 13 void test_stream_msgzcopy_empty_errq_server(const struct test_opts *opts); 14 14 15 + void test_stream_msgzcopy_mangle_client(const struct test_opts *opts); 16 + void test_stream_msgzcopy_mangle_server(const struct test_opts *opts); 17 + 15 18 #endif /* VSOCK_TEST_ZEROCOPY_H */