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.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

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

Current release - regressions:

- bpf: synchronize dispatcher update with bpf_dispatcher_xdp_func

- rxrpc:
- fix security setting propagation
- fix null-deref in rxrpc_unuse_local()
- fix switched parameters in peer tracing

Current release - new code bugs:

- rxrpc:
- fix I/O thread startup getting skipped
- fix locking issues in rxrpc_put_peer_locked()
- fix I/O thread stop
- fix uninitialised variable in rxperf server
- fix the return value of rxrpc_new_incoming_call()

- microchip: vcap: fix initialization of value and mask

- nfp: fix unaligned io read of capabilities word

Previous releases - regressions:

- stop in-kernel socket users from corrupting socket's task_frag

- stream: purge sk_error_queue in sk_stream_kill_queues()

- openvswitch: fix flow lookup to use unmasked key

- dsa: mv88e6xxx: avoid reg_lock deadlock in mv88e6xxx_setup_port()

- devlink:
- hold region lock when flushing snapshots
- protect devlink dump by the instance lock

Previous releases - always broken:

- bpf:
- prevent leak of lsm program after failed attach
- resolve fext program type when checking map compatibility

- skbuff: account for tail adjustment during pull operations

- macsec: fix net device access prior to holding a lock

- bonding: switch back when high prio link up

- netfilter: flowtable: really fix NAT IPv6 offload

- enetc: avoid buffer leaks on xdp_do_redirect() failure

- unix: fix race in SOCK_SEQPACKET's unix_dgram_sendmsg()

- dsa: microchip: remove IRQF_TRIGGER_FALLING in
request_threaded_irq"

* tag 'net-6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (64 commits)
net: fec: check the return value of build_skb()
net: simplify sk_page_frag
Treewide: Stop corrupting socket's task_frag
net: Introduce sk_use_task_frag in struct sock.
mctp: Remove device type check at unregister
net: dsa: microchip: remove IRQF_TRIGGER_FALLING in request_threaded_irq
can: kvaser_usb: hydra: help gcc-13 to figure out cmd_len
can: flexcan: avoid unbalanced pm_runtime_enable warning
Documentation: devlink: add missing toc entry for etas_es58x devlink doc
mctp: serial: Fix starting value for frame check sequence
nfp: fix unaligned io read of capabilities word
net: stream: purge sk_error_queue in sk_stream_kill_queues()
myri10ge: Fix an error handling path in myri10ge_probe()
net: microchip: vcap: Fix initialization of value and mask
rxrpc: Fix the return value of rxrpc_new_incoming_call()
rxrpc: rxperf: Fix uninitialised variable
rxrpc: Fix I/O thread stop
rxrpc: Fix switched parameters in peer tracing
rxrpc: Fix locking issues in rxrpc_put_peer_locked()
rxrpc: Fix I/O thread startup getting skipped
...

+861 -257
+30 -26
Documentation/bpf/map_sk_storage.rst
··· 34 34 35 35 void *bpf_sk_storage_get(struct bpf_map *map, void *sk, void *value, u64 flags) 36 36 37 - Socket-local storage can be retrieved using the ``bpf_sk_storage_get()`` 38 - helper. The helper gets the storage from ``sk`` that is associated with ``map``. 39 - If the ``BPF_LOCAL_STORAGE_GET_F_CREATE`` flag is used then 40 - ``bpf_sk_storage_get()`` will create the storage for ``sk`` if it does not 41 - already exist. ``value`` can be used together with 42 - ``BPF_LOCAL_STORAGE_GET_F_CREATE`` to initialize the storage value, otherwise it 43 - will be zero initialized. Returns a pointer to the storage on success, or 37 + Socket-local storage for ``map`` can be retrieved from socket ``sk`` using the 38 + ``bpf_sk_storage_get()`` helper. If the ``BPF_LOCAL_STORAGE_GET_F_CREATE`` 39 + flag is used then ``bpf_sk_storage_get()`` will create the storage for ``sk`` 40 + if it does not already exist. ``value`` can be used together with 41 + ``BPF_LOCAL_STORAGE_GET_F_CREATE`` to initialize the storage value, otherwise 42 + it will be zero initialized. Returns a pointer to the storage on success, or 44 43 ``NULL`` in case of failure. 45 44 46 45 .. note:: ··· 53 54 54 55 long bpf_sk_storage_delete(struct bpf_map *map, void *sk) 55 56 56 - Socket-local storage can be deleted using the ``bpf_sk_storage_delete()`` 57 - helper. The helper deletes the storage from ``sk`` that is identified by 58 - ``map``. Returns ``0`` on success, or negative error in case of failure. 57 + Socket-local storage for ``map`` can be deleted from socket ``sk`` using the 58 + ``bpf_sk_storage_delete()`` helper. Returns ``0`` on success, or negative 59 + error in case of failure. 59 60 60 61 User space 61 62 ---------- ··· 67 68 68 69 int bpf_map_update_elem(int map_fd, const void *key, const void *value, __u64 flags) 69 70 70 - Socket-local storage for the socket identified by ``key`` belonging to 71 - ``map_fd`` can be added or updated using the ``bpf_map_update_elem()`` libbpf 72 - function. ``key`` must be a pointer to a valid ``fd`` in the user space 73 - program. The ``flags`` parameter can be used to control the update behaviour: 71 + Socket-local storage for map ``map_fd`` can be added or updated locally to a 72 + socket using the ``bpf_map_update_elem()`` libbpf function. The socket is 73 + identified by a `socket` ``fd`` stored in the pointer ``key``. The pointer 74 + ``value`` has the data to be added or updated to the socket ``fd``. The type 75 + and size of ``value`` should be the same as the value type of the map 76 + definition. 74 77 75 - - ``BPF_ANY`` will create storage for ``fd`` or update existing storage. 76 - - ``BPF_NOEXIST`` will create storage for ``fd`` only if it did not already 77 - exist, otherwise the call will fail with ``-EEXIST``. 78 - - ``BPF_EXIST`` will update existing storage for ``fd`` if it already exists, 79 - otherwise the call will fail with ``-ENOENT``. 78 + The ``flags`` parameter can be used to control the update behaviour: 79 + 80 + - ``BPF_ANY`` will create storage for `socket` ``fd`` or update existing storage. 81 + - ``BPF_NOEXIST`` will create storage for `socket` ``fd`` only if it did not 82 + already exist, otherwise the call will fail with ``-EEXIST``. 83 + - ``BPF_EXIST`` will update existing storage for `socket` ``fd`` if it already 84 + exists, otherwise the call will fail with ``-ENOENT``. 80 85 81 86 Returns ``0`` on success, or negative error in case of failure. 82 87 ··· 91 88 92 89 int bpf_map_lookup_elem(int map_fd, const void *key, void *value) 93 90 94 - Socket-local storage for the socket identified by ``key`` belonging to 95 - ``map_fd`` can be retrieved using the ``bpf_map_lookup_elem()`` libbpf 96 - function. ``key`` must be a pointer to a valid ``fd`` in the user space 97 - program. Returns ``0`` on success, or negative error in case of failure. 91 + Socket-local storage for map ``map_fd`` can be retrieved from a socket using 92 + the ``bpf_map_lookup_elem()`` libbpf function. The storage is retrieved from 93 + the socket identified by a `socket` ``fd`` stored in the pointer 94 + ``key``. Returns ``0`` on success, or negative error in case of failure. 98 95 99 96 bpf_map_delete_elem() 100 97 ~~~~~~~~~~~~~~~~~~~~~ ··· 103 100 104 101 int bpf_map_delete_elem(int map_fd, const void *key) 105 102 106 - Socket-local storage for the socket identified by ``key`` belonging to 107 - ``map_fd`` can be deleted using the ``bpf_map_delete_elem()`` libbpf 108 - function. Returns ``0`` on success, or negative error in case of failure. 103 + Socket-local storage for map ``map_fd`` can be deleted from a socket using the 104 + ``bpf_map_delete_elem()`` libbpf function. The storage is deleted from the 105 + socket identified by a `socket` ``fd`` stored in the pointer ``key``. Returns 106 + ``0`` on success, or negative error in case of failure. 109 107 110 108 Examples 111 109 ========
+1
Documentation/networking/devlink/index.rst
··· 50 50 :maxdepth: 1 51 51 52 52 bnxt 53 + etas_es58x 53 54 hns3 54 55 ionic 55 56 ice
+33
Documentation/networking/nf_conntrack-sysctl.rst
··· 163 163 164 164 Enable connection tracking flow timestamping. 165 165 166 + nf_conntrack_sctp_timeout_closed - INTEGER (seconds) 167 + default 10 168 + 169 + nf_conntrack_sctp_timeout_cookie_wait - INTEGER (seconds) 170 + default 3 171 + 172 + nf_conntrack_sctp_timeout_cookie_echoed - INTEGER (seconds) 173 + default 3 174 + 175 + nf_conntrack_sctp_timeout_established - INTEGER (seconds) 176 + default 432000 (5 days) 177 + 178 + nf_conntrack_sctp_timeout_shutdown_sent - INTEGER (seconds) 179 + default 0.3 180 + 181 + nf_conntrack_sctp_timeout_shutdown_recd - INTEGER (seconds) 182 + default 0.3 183 + 184 + nf_conntrack_sctp_timeout_shutdown_ack_sent - INTEGER (seconds) 185 + default 3 186 + 187 + nf_conntrack_sctp_timeout_heartbeat_sent - INTEGER (seconds) 188 + default 30 189 + 190 + This timeout is used to setup conntrack entry on secondary paths. 191 + Default is set to hb_interval. 192 + 193 + nf_conntrack_sctp_timeout_heartbeat_acked - INTEGER (seconds) 194 + default 210 195 + 196 + This timeout is used to setup conntrack entry on secondary paths. 197 + Default is set to (hb_interval * path_max_retrans + rto_max) 198 + 166 199 nf_conntrack_udp_timeout - INTEGER (seconds) 167 200 default 30 168 201
+3
drivers/block/drbd/drbd_receiver.c
··· 1030 1030 sock.socket->sk->sk_allocation = GFP_NOIO; 1031 1031 msock.socket->sk->sk_allocation = GFP_NOIO; 1032 1032 1033 + sock.socket->sk->sk_use_task_frag = false; 1034 + msock.socket->sk->sk_use_task_frag = false; 1035 + 1033 1036 sock.socket->sk->sk_priority = TC_PRIO_INTERACTIVE_BULK; 1034 1037 msock.socket->sk->sk_priority = TC_PRIO_INTERACTIVE; 1035 1038
+1
drivers/block/nbd.c
··· 512 512 noreclaim_flag = memalloc_noreclaim_save(); 513 513 do { 514 514 sock->sk->sk_allocation = GFP_NOIO | __GFP_MEMALLOC; 515 + sock->sk->sk_use_task_frag = false; 515 516 msg.msg_name = NULL; 516 517 msg.msg_namelen = 0; 517 518 msg.msg_control = NULL;
+13 -6
drivers/isdn/hardware/mISDN/hfcmulti.c
··· 3217 3217 hfcm_l1callback(struct dchannel *dch, u_int cmd) 3218 3218 { 3219 3219 struct hfc_multi *hc = dch->hw; 3220 + struct sk_buff_head free_queue; 3220 3221 u_long flags; 3221 3222 3222 3223 switch (cmd) { ··· 3246 3245 l1_event(dch->l1, HW_POWERUP_IND); 3247 3246 break; 3248 3247 case HW_DEACT_REQ: 3248 + __skb_queue_head_init(&free_queue); 3249 3249 /* start deactivation */ 3250 3250 spin_lock_irqsave(&hc->lock, flags); 3251 3251 if (hc->ctype == HFC_TYPE_E1) { ··· 3266 3264 plxsd_checksync(hc, 0); 3267 3265 } 3268 3266 } 3269 - skb_queue_purge(&dch->squeue); 3267 + skb_queue_splice_init(&dch->squeue, &free_queue); 3270 3268 if (dch->tx_skb) { 3271 - dev_kfree_skb(dch->tx_skb); 3269 + __skb_queue_tail(&free_queue, dch->tx_skb); 3272 3270 dch->tx_skb = NULL; 3273 3271 } 3274 3272 dch->tx_idx = 0; 3275 3273 if (dch->rx_skb) { 3276 - dev_kfree_skb(dch->rx_skb); 3274 + __skb_queue_tail(&free_queue, dch->rx_skb); 3277 3275 dch->rx_skb = NULL; 3278 3276 } 3279 3277 test_and_clear_bit(FLG_TX_BUSY, &dch->Flags); 3280 3278 if (test_and_clear_bit(FLG_BUSY_TIMER, &dch->Flags)) 3281 3279 del_timer(&dch->timer); 3282 3280 spin_unlock_irqrestore(&hc->lock, flags); 3281 + __skb_queue_purge(&free_queue); 3283 3282 break; 3284 3283 case HW_POWERUP_REQ: 3285 3284 spin_lock_irqsave(&hc->lock, flags); ··· 3387 3384 case PH_DEACTIVATE_REQ: 3388 3385 test_and_clear_bit(FLG_L2_ACTIVATED, &dch->Flags); 3389 3386 if (dch->dev.D.protocol != ISDN_P_TE_S0) { 3387 + struct sk_buff_head free_queue; 3388 + 3389 + __skb_queue_head_init(&free_queue); 3390 3390 spin_lock_irqsave(&hc->lock, flags); 3391 3391 if (debug & DEBUG_HFCMULTI_MSG) 3392 3392 printk(KERN_DEBUG ··· 3411 3405 /* deactivate */ 3412 3406 dch->state = 1; 3413 3407 } 3414 - skb_queue_purge(&dch->squeue); 3408 + skb_queue_splice_init(&dch->squeue, &free_queue); 3415 3409 if (dch->tx_skb) { 3416 - dev_kfree_skb(dch->tx_skb); 3410 + __skb_queue_tail(&free_queue, dch->tx_skb); 3417 3411 dch->tx_skb = NULL; 3418 3412 } 3419 3413 dch->tx_idx = 0; 3420 3414 if (dch->rx_skb) { 3421 - dev_kfree_skb(dch->rx_skb); 3415 + __skb_queue_tail(&free_queue, dch->rx_skb); 3422 3416 dch->rx_skb = NULL; 3423 3417 } 3424 3418 test_and_clear_bit(FLG_TX_BUSY, &dch->Flags); ··· 3430 3424 #endif 3431 3425 ret = 0; 3432 3426 spin_unlock_irqrestore(&hc->lock, flags); 3427 + __skb_queue_purge(&free_queue); 3433 3428 } else 3434 3429 ret = l1_event(dch->l1, hh->prim); 3435 3430 break;
+9 -4
drivers/isdn/hardware/mISDN/hfcpci.c
··· 1617 1617 test_and_clear_bit(FLG_L2_ACTIVATED, &dch->Flags); 1618 1618 spin_lock_irqsave(&hc->lock, flags); 1619 1619 if (hc->hw.protocol == ISDN_P_NT_S0) { 1620 + struct sk_buff_head free_queue; 1621 + 1622 + __skb_queue_head_init(&free_queue); 1620 1623 /* prepare deactivation */ 1621 1624 Write_hfc(hc, HFCPCI_STATES, 0x40); 1622 - skb_queue_purge(&dch->squeue); 1625 + skb_queue_splice_init(&dch->squeue, &free_queue); 1623 1626 if (dch->tx_skb) { 1624 - dev_kfree_skb(dch->tx_skb); 1627 + __skb_queue_tail(&free_queue, dch->tx_skb); 1625 1628 dch->tx_skb = NULL; 1626 1629 } 1627 1630 dch->tx_idx = 0; 1628 1631 if (dch->rx_skb) { 1629 - dev_kfree_skb(dch->rx_skb); 1632 + __skb_queue_tail(&free_queue, dch->rx_skb); 1630 1633 dch->rx_skb = NULL; 1631 1634 } 1632 1635 test_and_clear_bit(FLG_TX_BUSY, &dch->Flags); ··· 1642 1639 hc->hw.mst_m &= ~HFCPCI_MASTER; 1643 1640 Write_hfc(hc, HFCPCI_MST_MODE, hc->hw.mst_m); 1644 1641 ret = 0; 1642 + spin_unlock_irqrestore(&hc->lock, flags); 1643 + __skb_queue_purge(&free_queue); 1645 1644 } else { 1646 1645 ret = l1_event(dch->l1, hh->prim); 1646 + spin_unlock_irqrestore(&hc->lock, flags); 1647 1647 } 1648 - spin_unlock_irqrestore(&hc->lock, flags); 1649 1648 break; 1650 1649 } 1651 1650 if (!ret)
+8 -4
drivers/isdn/hardware/mISDN/hfcsusb.c
··· 326 326 test_and_clear_bit(FLG_L2_ACTIVATED, &dch->Flags); 327 327 328 328 if (hw->protocol == ISDN_P_NT_S0) { 329 + struct sk_buff_head free_queue; 330 + 331 + __skb_queue_head_init(&free_queue); 329 332 hfcsusb_ph_command(hw, HFC_L1_DEACTIVATE_NT); 330 333 spin_lock_irqsave(&hw->lock, flags); 331 - skb_queue_purge(&dch->squeue); 334 + skb_queue_splice_init(&dch->squeue, &free_queue); 332 335 if (dch->tx_skb) { 333 - dev_kfree_skb(dch->tx_skb); 336 + __skb_queue_tail(&free_queue, dch->tx_skb); 334 337 dch->tx_skb = NULL; 335 338 } 336 339 dch->tx_idx = 0; 337 340 if (dch->rx_skb) { 338 - dev_kfree_skb(dch->rx_skb); 341 + __skb_queue_tail(&free_queue, dch->rx_skb); 339 342 dch->rx_skb = NULL; 340 343 } 341 344 test_and_clear_bit(FLG_TX_BUSY, &dch->Flags); 342 345 spin_unlock_irqrestore(&hw->lock, flags); 346 + __skb_queue_purge(&free_queue); 343 347 #ifdef FIXME 344 348 if (test_and_clear_bit(FLG_L1_BUSY, &dch->Flags)) 345 349 dchannel_sched_event(&hc->dch, D_CLEARBUSY); ··· 1334 1330 printk("\n"); 1335 1331 } 1336 1332 1337 - dev_kfree_skb(tx_skb); 1333 + dev_consume_skb_irq(tx_skb); 1338 1334 tx_skb = NULL; 1339 1335 if (fifo->dch && get_next_dframe(fifo->dch)) 1340 1336 tx_skb = fifo->dch->tx_skb;
+15 -9
drivers/net/bonding/bond_main.c
··· 2654 2654 2655 2655 static void bond_miimon_commit(struct bonding *bond) 2656 2656 { 2657 - struct list_head *iter; 2658 2657 struct slave *slave, *primary; 2658 + bool do_failover = false; 2659 + struct list_head *iter; 2659 2660 2660 2661 bond_for_each_slave(bond, slave, iter) { 2661 2662 switch (slave->link_new_state) { ··· 2700 2699 2701 2700 bond_miimon_link_change(bond, slave, BOND_LINK_UP); 2702 2701 2703 - if (!bond->curr_active_slave || slave == primary) 2704 - goto do_failover; 2702 + if (!rcu_access_pointer(bond->curr_active_slave) || slave == primary || 2703 + slave->prio > rcu_dereference(bond->curr_active_slave)->prio) 2704 + do_failover = true; 2705 2705 2706 2706 continue; 2707 2707 ··· 2723 2721 bond_miimon_link_change(bond, slave, BOND_LINK_DOWN); 2724 2722 2725 2723 if (slave == rcu_access_pointer(bond->curr_active_slave)) 2726 - goto do_failover; 2724 + do_failover = true; 2727 2725 2728 2726 continue; 2729 2727 ··· 2734 2732 2735 2733 continue; 2736 2734 } 2735 + } 2737 2736 2738 - do_failover: 2737 + if (do_failover) { 2739 2738 block_netpoll_tx(); 2740 2739 bond_select_active_slave(bond); 2741 2740 unblock_netpoll_tx(); ··· 3534 3531 */ 3535 3532 static void bond_ab_arp_commit(struct bonding *bond) 3536 3533 { 3534 + bool do_failover = false; 3537 3535 struct list_head *iter; 3538 3536 unsigned long last_tx; 3539 3537 struct slave *slave; ··· 3564 3560 slave_info(bond->dev, slave->dev, "link status definitely up\n"); 3565 3561 3566 3562 if (!rtnl_dereference(bond->curr_active_slave) || 3567 - slave == rtnl_dereference(bond->primary_slave)) 3568 - goto do_failover; 3563 + slave == rtnl_dereference(bond->primary_slave) || 3564 + slave->prio > rtnl_dereference(bond->curr_active_slave)->prio) 3565 + do_failover = true; 3569 3566 3570 3567 } 3571 3568 ··· 3585 3580 3586 3581 if (slave == rtnl_dereference(bond->curr_active_slave)) { 3587 3582 RCU_INIT_POINTER(bond->current_arp_slave, NULL); 3588 - goto do_failover; 3583 + do_failover = true; 3589 3584 } 3590 3585 3591 3586 continue; ··· 3609 3604 slave->link_new_state); 3610 3605 continue; 3611 3606 } 3607 + } 3612 3608 3613 - do_failover: 3609 + if (do_failover) { 3614 3610 block_netpoll_tx(); 3615 3611 bond_select_active_slave(bond); 3616 3612 unblock_netpoll_tx();
+9 -3
drivers/net/can/flexcan/flexcan-core.c
··· 2349 2349 if (netif_running(dev)) { 2350 2350 int err; 2351 2351 2352 - err = pm_runtime_force_resume(device); 2353 - if (err) 2354 - return err; 2352 + /* For the wakeup in auto stop mode, no need to gate on the 2353 + * clock here, hardware will do this automatically. 2354 + */ 2355 + if (!(device_may_wakeup(device) && 2356 + priv->devtype_data.quirks & FLEXCAN_QUIRK_AUTO_STOP_MODE)) { 2357 + err = pm_runtime_force_resume(device); 2358 + if (err) 2359 + return err; 2360 + } 2355 2361 2356 2362 if (device_may_wakeup(device)) 2357 2363 flexcan_enable_wakeup_irq(priv, false);
+24 -9
drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c
··· 545 545 u8 cmd_no, int channel) 546 546 { 547 547 struct kvaser_cmd *cmd; 548 + size_t cmd_len; 548 549 int err; 549 550 550 551 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); ··· 553 552 return -ENOMEM; 554 553 555 554 cmd->header.cmd_no = cmd_no; 555 + cmd_len = kvaser_usb_hydra_cmd_size(cmd); 556 556 if (channel < 0) { 557 557 kvaser_usb_hydra_set_cmd_dest_he 558 558 (cmd, KVASER_USB_HYDRA_HE_ADDRESS_ILLEGAL); ··· 570 568 kvaser_usb_hydra_set_cmd_transid 571 569 (cmd, kvaser_usb_hydra_get_next_transid(dev)); 572 570 573 - err = kvaser_usb_send_cmd(dev, cmd, kvaser_usb_hydra_cmd_size(cmd)); 571 + err = kvaser_usb_send_cmd(dev, cmd, cmd_len); 574 572 if (err) 575 573 goto end; 576 574 ··· 586 584 { 587 585 struct kvaser_cmd *cmd; 588 586 struct kvaser_usb *dev = priv->dev; 587 + size_t cmd_len; 589 588 int err; 590 589 591 590 cmd = kzalloc(sizeof(*cmd), GFP_ATOMIC); ··· 594 591 return -ENOMEM; 595 592 596 593 cmd->header.cmd_no = cmd_no; 594 + cmd_len = kvaser_usb_hydra_cmd_size(cmd); 597 595 598 596 kvaser_usb_hydra_set_cmd_dest_he 599 597 (cmd, dev->card_data.hydra.channel_to_he[priv->channel]); 600 598 kvaser_usb_hydra_set_cmd_transid 601 599 (cmd, kvaser_usb_hydra_get_next_transid(dev)); 602 600 603 - err = kvaser_usb_send_cmd_async(priv, cmd, 604 - kvaser_usb_hydra_cmd_size(cmd)); 601 + err = kvaser_usb_send_cmd_async(priv, cmd, cmd_len); 605 602 if (err) 606 603 kfree(cmd); 607 604 ··· 745 742 { 746 743 struct kvaser_usb_dev_card_data *card_data = &dev->card_data; 747 744 struct kvaser_cmd *cmd; 745 + size_t cmd_len; 748 746 u32 value = 0; 749 747 u32 mask = 0; 750 748 u16 cap_cmd_res; ··· 757 753 return -ENOMEM; 758 754 759 755 cmd->header.cmd_no = CMD_GET_CAPABILITIES_REQ; 756 + cmd_len = kvaser_usb_hydra_cmd_size(cmd); 760 757 cmd->cap_req.cap_cmd = cpu_to_le16(cap_cmd_req); 761 758 762 759 kvaser_usb_hydra_set_cmd_dest_he(cmd, card_data->hydra.sysdbg_he); 763 760 kvaser_usb_hydra_set_cmd_transid 764 761 (cmd, kvaser_usb_hydra_get_next_transid(dev)); 765 762 766 - err = kvaser_usb_send_cmd(dev, cmd, kvaser_usb_hydra_cmd_size(cmd)); 763 + err = kvaser_usb_send_cmd(dev, cmd, cmd_len); 767 764 if (err) 768 765 goto end; 769 766 ··· 1583 1578 struct kvaser_usb *dev = priv->dev; 1584 1579 struct kvaser_usb_net_hydra_priv *hydra = priv->sub_priv; 1585 1580 struct kvaser_cmd *cmd; 1581 + size_t cmd_len; 1586 1582 int err; 1587 1583 1588 1584 if (!hydra) ··· 1594 1588 return -ENOMEM; 1595 1589 1596 1590 cmd->header.cmd_no = CMD_GET_BUSPARAMS_REQ; 1591 + cmd_len = kvaser_usb_hydra_cmd_size(cmd); 1597 1592 kvaser_usb_hydra_set_cmd_dest_he 1598 1593 (cmd, dev->card_data.hydra.channel_to_he[priv->channel]); 1599 1594 kvaser_usb_hydra_set_cmd_transid ··· 1604 1597 1605 1598 reinit_completion(&priv->get_busparams_comp); 1606 1599 1607 - err = kvaser_usb_send_cmd(dev, cmd, kvaser_usb_hydra_cmd_size(cmd)); 1600 + err = kvaser_usb_send_cmd(dev, cmd, cmd_len); 1608 1601 if (err) 1609 1602 return err; 1610 1603 ··· 1631 1624 struct kvaser_cmd *cmd; 1632 1625 struct kvaser_usb_net_priv *priv = netdev_priv(netdev); 1633 1626 struct kvaser_usb *dev = priv->dev; 1627 + size_t cmd_len; 1634 1628 int err; 1635 1629 1636 1630 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); ··· 1639 1631 return -ENOMEM; 1640 1632 1641 1633 cmd->header.cmd_no = CMD_SET_BUSPARAMS_REQ; 1634 + cmd_len = kvaser_usb_hydra_cmd_size(cmd); 1642 1635 memcpy(&cmd->set_busparams_req.busparams_nominal, busparams, 1643 1636 sizeof(cmd->set_busparams_req.busparams_nominal)); 1644 1637 ··· 1648 1639 kvaser_usb_hydra_set_cmd_transid 1649 1640 (cmd, kvaser_usb_hydra_get_next_transid(dev)); 1650 1641 1651 - err = kvaser_usb_send_cmd(dev, cmd, kvaser_usb_hydra_cmd_size(cmd)); 1642 + err = kvaser_usb_send_cmd(dev, cmd, cmd_len); 1652 1643 1653 1644 kfree(cmd); 1654 1645 ··· 1661 1652 struct kvaser_cmd *cmd; 1662 1653 struct kvaser_usb_net_priv *priv = netdev_priv(netdev); 1663 1654 struct kvaser_usb *dev = priv->dev; 1655 + size_t cmd_len; 1664 1656 int err; 1665 1657 1666 1658 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); ··· 1669 1659 return -ENOMEM; 1670 1660 1671 1661 cmd->header.cmd_no = CMD_SET_BUSPARAMS_FD_REQ; 1662 + cmd_len = kvaser_usb_hydra_cmd_size(cmd); 1672 1663 memcpy(&cmd->set_busparams_req.busparams_data, busparams, 1673 1664 sizeof(cmd->set_busparams_req.busparams_data)); 1674 1665 ··· 1687 1676 kvaser_usb_hydra_set_cmd_transid 1688 1677 (cmd, kvaser_usb_hydra_get_next_transid(dev)); 1689 1678 1690 - err = kvaser_usb_send_cmd(dev, cmd, kvaser_usb_hydra_cmd_size(cmd)); 1679 + err = kvaser_usb_send_cmd(dev, cmd, cmd_len); 1691 1680 1692 1681 kfree(cmd); 1693 1682 ··· 1815 1804 static int kvaser_usb_hydra_get_software_details(struct kvaser_usb *dev) 1816 1805 { 1817 1806 struct kvaser_cmd *cmd; 1807 + size_t cmd_len; 1818 1808 int err; 1819 1809 u32 flags; 1820 1810 struct kvaser_usb_dev_card_data *card_data = &dev->card_data; ··· 1825 1813 return -ENOMEM; 1826 1814 1827 1815 cmd->header.cmd_no = CMD_GET_SOFTWARE_DETAILS_REQ; 1816 + cmd_len = kvaser_usb_hydra_cmd_size(cmd); 1828 1817 cmd->sw_detail_req.use_ext_cmd = 1; 1829 1818 kvaser_usb_hydra_set_cmd_dest_he 1830 1819 (cmd, KVASER_USB_HYDRA_HE_ADDRESS_ILLEGAL); ··· 1833 1820 kvaser_usb_hydra_set_cmd_transid 1834 1821 (cmd, kvaser_usb_hydra_get_next_transid(dev)); 1835 1822 1836 - err = kvaser_usb_send_cmd(dev, cmd, kvaser_usb_hydra_cmd_size(cmd)); 1823 + err = kvaser_usb_send_cmd(dev, cmd, cmd_len); 1837 1824 if (err) 1838 1825 goto end; 1839 1826 ··· 1951 1938 { 1952 1939 struct kvaser_usb *dev = priv->dev; 1953 1940 struct kvaser_cmd *cmd; 1941 + size_t cmd_len; 1954 1942 int err; 1955 1943 1956 1944 if ((priv->can.ctrlmode & ··· 1967 1953 return -ENOMEM; 1968 1954 1969 1955 cmd->header.cmd_no = CMD_SET_DRIVERMODE_REQ; 1956 + cmd_len = kvaser_usb_hydra_cmd_size(cmd); 1970 1957 kvaser_usb_hydra_set_cmd_dest_he 1971 1958 (cmd, dev->card_data.hydra.channel_to_he[priv->channel]); 1972 1959 kvaser_usb_hydra_set_cmd_transid ··· 1977 1962 else 1978 1963 cmd->set_ctrlmode.mode = KVASER_USB_HYDRA_CTRLMODE_NORMAL; 1979 1964 1980 - err = kvaser_usb_send_cmd(dev, cmd, kvaser_usb_hydra_cmd_size(cmd)); 1965 + err = kvaser_usb_send_cmd(dev, cmd, cmd_len); 1981 1966 kfree(cmd); 1982 1967 1983 1968 return err;
+1 -2
drivers/net/dsa/microchip/ksz_common.c
··· 1996 1996 irq_create_mapping(kirq->domain, n); 1997 1997 1998 1998 ret = request_threaded_irq(kirq->irq_num, NULL, ksz_irq_thread_fn, 1999 - IRQF_ONESHOT | IRQF_TRIGGER_FALLING, 2000 - kirq->name, kirq); 1999 + IRQF_ONESHOT, kirq->name, kirq); 2001 2000 if (ret) 2002 2001 goto out; 2003 2002
-3
drivers/net/dsa/mt7530.c
··· 2919 2919 config->mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE | 2920 2920 MAC_10 | MAC_100 | MAC_1000FD; 2921 2921 2922 - if ((priv->id == ID_MT7531) && mt753x_is_mac_port(port)) 2923 - config->mac_capabilities |= MAC_2500FD; 2924 - 2925 2922 /* This driver does not make use of the speed, duplex, pause or the 2926 2923 * advertisement in its mac_config, so it is safe to mark this driver 2927 2924 * as non-legacy.
+4 -5
drivers/net/dsa/mv88e6xxx/chip.c
··· 689 689 690 690 /* Port 4 supports automedia if the serdes is associated with it. */ 691 691 if (port == 4) { 692 - mv88e6xxx_reg_lock(chip); 693 692 err = mv88e6352_g2_scratch_port_has_serdes(chip, port); 694 693 if (err < 0) 695 694 dev_err(chip->dev, "p%d: failed to read scratch\n", 696 695 port); 697 696 if (err <= 0) 698 - goto unlock; 697 + return; 699 698 700 699 cmode = mv88e6352_get_port4_serdes_cmode(chip); 701 700 if (cmode < 0) ··· 702 703 port); 703 704 else 704 705 mv88e6xxx_translate_cmode(cmode, supported); 705 - unlock: 706 - mv88e6xxx_reg_unlock(chip); 707 706 } 708 707 } 709 708 ··· 828 831 { 829 832 struct mv88e6xxx_chip *chip = ds->priv; 830 833 834 + mv88e6xxx_reg_lock(chip); 831 835 chip->info->ops->phylink_get_caps(chip, port, config); 836 + mv88e6xxx_reg_unlock(chip); 832 837 833 838 if (mv88e6xxx_phy_is_internal(ds, port)) { 834 839 __set_bit(PHY_INTERFACE_MODE_INTERNAL, ··· 3306 3307 struct phylink_config pl_config = {}; 3307 3308 unsigned long caps; 3308 3309 3309 - mv88e6xxx_get_caps(ds, port, &pl_config); 3310 + chip->info->ops->phylink_get_caps(chip, port, &pl_config); 3310 3311 3311 3312 caps = pl_config.mac_capabilities; 3312 3313
+8 -27
drivers/net/ethernet/freescale/enetc/enetc.c
··· 1489 1489 rx_ring->stats.xdp_drops++; 1490 1490 } 1491 1491 1492 - static void enetc_xdp_free(struct enetc_bdr *rx_ring, int rx_ring_first, 1493 - int rx_ring_last) 1494 - { 1495 - while (rx_ring_first != rx_ring_last) { 1496 - struct enetc_rx_swbd *rx_swbd = &rx_ring->rx_swbd[rx_ring_first]; 1497 - 1498 - if (rx_swbd->page) { 1499 - dma_unmap_page(rx_ring->dev, rx_swbd->dma, PAGE_SIZE, 1500 - rx_swbd->dir); 1501 - __free_page(rx_swbd->page); 1502 - rx_swbd->page = NULL; 1503 - } 1504 - enetc_bdr_idx_inc(rx_ring, &rx_ring_first); 1505 - } 1506 - rx_ring->stats.xdp_redirect_failures++; 1507 - } 1508 - 1509 1492 static int enetc_clean_rx_ring_xdp(struct enetc_bdr *rx_ring, 1510 1493 struct napi_struct *napi, int work_limit, 1511 1494 struct bpf_prog *prog) ··· 1510 1527 int orig_i, orig_cleaned_cnt; 1511 1528 struct xdp_buff xdp_buff; 1512 1529 struct sk_buff *skb; 1513 - int tmp_orig_i, err; 1514 1530 u32 bd_status; 1531 + int err; 1515 1532 1516 1533 rxbd = enetc_rxbd(rx_ring, i); 1517 1534 bd_status = le32_to_cpu(rxbd->r.lstatus); ··· 1598 1615 break; 1599 1616 } 1600 1617 1601 - tmp_orig_i = orig_i; 1602 - 1603 - while (orig_i != i) { 1604 - enetc_flip_rx_buff(rx_ring, 1605 - &rx_ring->rx_swbd[orig_i]); 1606 - enetc_bdr_idx_inc(rx_ring, &orig_i); 1607 - } 1608 - 1609 1618 err = xdp_do_redirect(rx_ring->ndev, &xdp_buff, prog); 1610 1619 if (unlikely(err)) { 1611 - enetc_xdp_free(rx_ring, tmp_orig_i, i); 1620 + enetc_xdp_drop(rx_ring, orig_i, i); 1621 + rx_ring->stats.xdp_redirect_failures++; 1612 1622 } else { 1623 + while (orig_i != i) { 1624 + enetc_flip_rx_buff(rx_ring, 1625 + &rx_ring->rx_swbd[orig_i]); 1626 + enetc_bdr_idx_inc(rx_ring, &orig_i); 1627 + } 1613 1628 xdp_redirect_frm_cnt++; 1614 1629 rx_ring->stats.xdp_redirect++; 1615 1630 }
+8
drivers/net/ethernet/freescale/fec_main.c
··· 1674 1674 * bridging applications. 1675 1675 */ 1676 1676 skb = build_skb(page_address(page), PAGE_SIZE); 1677 + if (unlikely(!skb)) { 1678 + page_pool_recycle_direct(rxq->page_pool, page); 1679 + ndev->stats.rx_dropped++; 1680 + 1681 + netdev_err_once(ndev, "build_skb failed!\n"); 1682 + goto rx_processing_done; 1683 + } 1684 + 1677 1685 skb_reserve(skb, data_start); 1678 1686 skb_put(skb, pkt_len - sub_len); 1679 1687 skb_mark_for_recycle(skb);
+1 -1
drivers/net/ethernet/intel/igb/igb_main.c
··· 7525 7525 { 7526 7526 struct e1000_hw *hw = &adapter->hw; 7527 7527 unsigned char *vf_mac = adapter->vf_data[vf].vf_mac_addresses; 7528 - u32 reg, msgbuf[3]; 7528 + u32 reg, msgbuf[3] = {}; 7529 7529 u8 *addr = (u8 *)(&msgbuf[1]); 7530 7530 7531 7531 /* process all the same items cleared in a function level reset */
+3
drivers/net/ethernet/intel/igc/igc.h
··· 94 94 u8 queue_index; /* logical index of the ring*/ 95 95 u8 reg_idx; /* physical index of the ring */ 96 96 bool launchtime_enable; /* true if LaunchTime is enabled */ 97 + ktime_t last_tx_cycle; /* end of the cycle with a launchtime transmission */ 98 + ktime_t last_ff_cycle; /* Last cycle with an active first flag */ 97 99 98 100 u32 start_time; 99 101 u32 end_time; ··· 184 182 185 183 ktime_t base_time; 186 184 ktime_t cycle_time; 185 + bool qbv_enable; 187 186 188 187 /* OS defined structs */ 189 188 struct pci_dev *pdev;
+2
drivers/net/ethernet/intel/igc/igc_defines.h
··· 321 321 #define IGC_ADVTXD_L4LEN_SHIFT 8 /* Adv ctxt L4LEN shift */ 322 322 #define IGC_ADVTXD_MSS_SHIFT 16 /* Adv ctxt MSS shift */ 323 323 324 + #define IGC_ADVTXD_TSN_CNTX_FIRST 0x00000080 325 + 324 326 /* Transmit Control */ 325 327 #define IGC_TCTL_EN 0x00000002 /* enable Tx */ 326 328 #define IGC_TCTL_PSP 0x00000008 /* pad short packets */
+180 -30
drivers/net/ethernet/intel/igc/igc_main.c
··· 1000 1000 return netdev_mc_count(netdev); 1001 1001 } 1002 1002 1003 - static __le32 igc_tx_launchtime(struct igc_adapter *adapter, ktime_t txtime) 1003 + static __le32 igc_tx_launchtime(struct igc_ring *ring, ktime_t txtime, 1004 + bool *first_flag, bool *insert_empty) 1004 1005 { 1006 + struct igc_adapter *adapter = netdev_priv(ring->netdev); 1005 1007 ktime_t cycle_time = adapter->cycle_time; 1006 1008 ktime_t base_time = adapter->base_time; 1009 + ktime_t now = ktime_get_clocktai(); 1010 + ktime_t baset_est, end_of_cycle; 1007 1011 u32 launchtime; 1012 + s64 n; 1008 1013 1009 - /* FIXME: when using ETF together with taprio, we may have a 1010 - * case where 'delta' is larger than the cycle_time, this may 1011 - * cause problems if we don't read the current value of 1012 - * IGC_BASET, as the value writen into the launchtime 1013 - * descriptor field may be misinterpreted. 1014 + n = div64_s64(ktime_sub_ns(now, base_time), cycle_time); 1015 + 1016 + baset_est = ktime_add_ns(base_time, cycle_time * (n)); 1017 + end_of_cycle = ktime_add_ns(baset_est, cycle_time); 1018 + 1019 + if (ktime_compare(txtime, end_of_cycle) >= 0) { 1020 + if (baset_est != ring->last_ff_cycle) { 1021 + *first_flag = true; 1022 + ring->last_ff_cycle = baset_est; 1023 + 1024 + if (ktime_compare(txtime, ring->last_tx_cycle) > 0) 1025 + *insert_empty = true; 1026 + } 1027 + } 1028 + 1029 + /* Introducing a window at end of cycle on which packets 1030 + * potentially not honor launchtime. Window of 5us chosen 1031 + * considering software update the tail pointer and packets 1032 + * are dma'ed to packet buffer. 1014 1033 */ 1015 - div_s64_rem(ktime_sub_ns(txtime, base_time), cycle_time, &launchtime); 1034 + if ((ktime_sub_ns(end_of_cycle, now) < 5 * NSEC_PER_USEC)) 1035 + netdev_warn(ring->netdev, "Packet with txtime=%llu may not be honoured\n", 1036 + txtime); 1037 + 1038 + ring->last_tx_cycle = end_of_cycle; 1039 + 1040 + launchtime = ktime_sub_ns(txtime, baset_est); 1041 + if (launchtime > 0) 1042 + div_s64_rem(launchtime, cycle_time, &launchtime); 1043 + else 1044 + launchtime = 0; 1016 1045 1017 1046 return cpu_to_le32(launchtime); 1018 1047 } 1019 1048 1049 + static int igc_init_empty_frame(struct igc_ring *ring, 1050 + struct igc_tx_buffer *buffer, 1051 + struct sk_buff *skb) 1052 + { 1053 + unsigned int size; 1054 + dma_addr_t dma; 1055 + 1056 + size = skb_headlen(skb); 1057 + 1058 + dma = dma_map_single(ring->dev, skb->data, size, DMA_TO_DEVICE); 1059 + if (dma_mapping_error(ring->dev, dma)) { 1060 + netdev_err_once(ring->netdev, "Failed to map DMA for TX\n"); 1061 + return -ENOMEM; 1062 + } 1063 + 1064 + buffer->skb = skb; 1065 + buffer->protocol = 0; 1066 + buffer->bytecount = skb->len; 1067 + buffer->gso_segs = 1; 1068 + buffer->time_stamp = jiffies; 1069 + dma_unmap_len_set(buffer, len, skb->len); 1070 + dma_unmap_addr_set(buffer, dma, dma); 1071 + 1072 + return 0; 1073 + } 1074 + 1075 + static int igc_init_tx_empty_descriptor(struct igc_ring *ring, 1076 + struct sk_buff *skb, 1077 + struct igc_tx_buffer *first) 1078 + { 1079 + union igc_adv_tx_desc *desc; 1080 + u32 cmd_type, olinfo_status; 1081 + int err; 1082 + 1083 + if (!igc_desc_unused(ring)) 1084 + return -EBUSY; 1085 + 1086 + err = igc_init_empty_frame(ring, first, skb); 1087 + if (err) 1088 + return err; 1089 + 1090 + cmd_type = IGC_ADVTXD_DTYP_DATA | IGC_ADVTXD_DCMD_DEXT | 1091 + IGC_ADVTXD_DCMD_IFCS | IGC_TXD_DCMD | 1092 + first->bytecount; 1093 + olinfo_status = first->bytecount << IGC_ADVTXD_PAYLEN_SHIFT; 1094 + 1095 + desc = IGC_TX_DESC(ring, ring->next_to_use); 1096 + desc->read.cmd_type_len = cpu_to_le32(cmd_type); 1097 + desc->read.olinfo_status = cpu_to_le32(olinfo_status); 1098 + desc->read.buffer_addr = cpu_to_le64(dma_unmap_addr(first, dma)); 1099 + 1100 + netdev_tx_sent_queue(txring_txq(ring), skb->len); 1101 + 1102 + first->next_to_watch = desc; 1103 + 1104 + ring->next_to_use++; 1105 + if (ring->next_to_use == ring->count) 1106 + ring->next_to_use = 0; 1107 + 1108 + return 0; 1109 + } 1110 + 1111 + #define IGC_EMPTY_FRAME_SIZE 60 1112 + 1020 1113 static void igc_tx_ctxtdesc(struct igc_ring *tx_ring, 1021 - struct igc_tx_buffer *first, 1114 + __le32 launch_time, bool first_flag, 1022 1115 u32 vlan_macip_lens, u32 type_tucmd, 1023 1116 u32 mss_l4len_idx) 1024 1117 { ··· 1130 1037 if (test_bit(IGC_RING_FLAG_TX_CTX_IDX, &tx_ring->flags)) 1131 1038 mss_l4len_idx |= tx_ring->reg_idx << 4; 1132 1039 1040 + if (first_flag) 1041 + mss_l4len_idx |= IGC_ADVTXD_TSN_CNTX_FIRST; 1042 + 1133 1043 context_desc->vlan_macip_lens = cpu_to_le32(vlan_macip_lens); 1134 1044 context_desc->type_tucmd_mlhl = cpu_to_le32(type_tucmd); 1135 1045 context_desc->mss_l4len_idx = cpu_to_le32(mss_l4len_idx); 1136 - 1137 - /* We assume there is always a valid Tx time available. Invalid times 1138 - * should have been handled by the upper layers. 1139 - */ 1140 - if (tx_ring->launchtime_enable) { 1141 - struct igc_adapter *adapter = netdev_priv(tx_ring->netdev); 1142 - ktime_t txtime = first->skb->tstamp; 1143 - 1144 - skb_txtime_consumed(first->skb); 1145 - context_desc->launch_time = igc_tx_launchtime(adapter, 1146 - txtime); 1147 - } else { 1148 - context_desc->launch_time = 0; 1149 - } 1046 + context_desc->launch_time = launch_time; 1150 1047 } 1151 1048 1152 - static void igc_tx_csum(struct igc_ring *tx_ring, struct igc_tx_buffer *first) 1049 + static void igc_tx_csum(struct igc_ring *tx_ring, struct igc_tx_buffer *first, 1050 + __le32 launch_time, bool first_flag) 1153 1051 { 1154 1052 struct sk_buff *skb = first->skb; 1155 1053 u32 vlan_macip_lens = 0; ··· 1180 1096 vlan_macip_lens |= skb_network_offset(skb) << IGC_ADVTXD_MACLEN_SHIFT; 1181 1097 vlan_macip_lens |= first->tx_flags & IGC_TX_FLAGS_VLAN_MASK; 1182 1098 1183 - igc_tx_ctxtdesc(tx_ring, first, vlan_macip_lens, type_tucmd, 0); 1099 + igc_tx_ctxtdesc(tx_ring, launch_time, first_flag, 1100 + vlan_macip_lens, type_tucmd, 0); 1184 1101 } 1185 1102 1186 1103 static int __igc_maybe_stop_tx(struct igc_ring *tx_ring, const u16 size) ··· 1405 1320 1406 1321 static int igc_tso(struct igc_ring *tx_ring, 1407 1322 struct igc_tx_buffer *first, 1323 + __le32 launch_time, bool first_flag, 1408 1324 u8 *hdr_len) 1409 1325 { 1410 1326 u32 vlan_macip_lens, type_tucmd, mss_l4len_idx; ··· 1492 1406 vlan_macip_lens |= (ip.hdr - skb->data) << IGC_ADVTXD_MACLEN_SHIFT; 1493 1407 vlan_macip_lens |= first->tx_flags & IGC_TX_FLAGS_VLAN_MASK; 1494 1408 1495 - igc_tx_ctxtdesc(tx_ring, first, vlan_macip_lens, 1496 - type_tucmd, mss_l4len_idx); 1409 + igc_tx_ctxtdesc(tx_ring, launch_time, first_flag, 1410 + vlan_macip_lens, type_tucmd, mss_l4len_idx); 1497 1411 1498 1412 return 1; 1499 1413 } ··· 1501 1415 static netdev_tx_t igc_xmit_frame_ring(struct sk_buff *skb, 1502 1416 struct igc_ring *tx_ring) 1503 1417 { 1418 + bool first_flag = false, insert_empty = false; 1504 1419 u16 count = TXD_USE_COUNT(skb_headlen(skb)); 1505 1420 __be16 protocol = vlan_get_protocol(skb); 1506 1421 struct igc_tx_buffer *first; 1422 + __le32 launch_time = 0; 1507 1423 u32 tx_flags = 0; 1508 1424 unsigned short f; 1425 + ktime_t txtime; 1509 1426 u8 hdr_len = 0; 1510 1427 int tso = 0; 1511 1428 ··· 1522 1433 count += TXD_USE_COUNT(skb_frag_size( 1523 1434 &skb_shinfo(skb)->frags[f])); 1524 1435 1525 - if (igc_maybe_stop_tx(tx_ring, count + 3)) { 1436 + if (igc_maybe_stop_tx(tx_ring, count + 5)) { 1526 1437 /* this is a hard error */ 1527 1438 return NETDEV_TX_BUSY; 1528 1439 } 1529 1440 1441 + if (!tx_ring->launchtime_enable) 1442 + goto done; 1443 + 1444 + txtime = skb->tstamp; 1445 + skb->tstamp = ktime_set(0, 0); 1446 + launch_time = igc_tx_launchtime(tx_ring, txtime, &first_flag, &insert_empty); 1447 + 1448 + if (insert_empty) { 1449 + struct igc_tx_buffer *empty_info; 1450 + struct sk_buff *empty; 1451 + void *data; 1452 + 1453 + empty_info = &tx_ring->tx_buffer_info[tx_ring->next_to_use]; 1454 + empty = alloc_skb(IGC_EMPTY_FRAME_SIZE, GFP_ATOMIC); 1455 + if (!empty) 1456 + goto done; 1457 + 1458 + data = skb_put(empty, IGC_EMPTY_FRAME_SIZE); 1459 + memset(data, 0, IGC_EMPTY_FRAME_SIZE); 1460 + 1461 + igc_tx_ctxtdesc(tx_ring, 0, false, 0, 0, 0); 1462 + 1463 + if (igc_init_tx_empty_descriptor(tx_ring, 1464 + empty, 1465 + empty_info) < 0) 1466 + dev_kfree_skb_any(empty); 1467 + } 1468 + 1469 + done: 1530 1470 /* record the location of the first descriptor for this packet */ 1531 1471 first = &tx_ring->tx_buffer_info[tx_ring->next_to_use]; 1532 1472 first->type = IGC_TX_BUFFER_TYPE_SKB; ··· 1592 1474 first->tx_flags = tx_flags; 1593 1475 first->protocol = protocol; 1594 1476 1595 - tso = igc_tso(tx_ring, first, &hdr_len); 1477 + tso = igc_tso(tx_ring, first, launch_time, first_flag, &hdr_len); 1596 1478 if (tso < 0) 1597 1479 goto out_drop; 1598 1480 else if (!tso) 1599 - igc_tx_csum(tx_ring, first); 1481 + igc_tx_csum(tx_ring, first, launch_time, first_flag); 1600 1482 1601 1483 igc_tx_map(tx_ring, first, hdr_len); 1602 1484 ··· 6043 5925 bool queue_configured[IGC_MAX_TX_QUEUES] = { }; 6044 5926 u32 start_time = 0, end_time = 0; 6045 5927 size_t n; 5928 + int i; 5929 + 5930 + adapter->qbv_enable = qopt->enable; 6046 5931 6047 5932 if (!qopt->enable) 6048 5933 return igc_tsn_clear_schedule(adapter); 5934 + 5935 + if (qopt->base_time < 0) 5936 + return -ERANGE; 6049 5937 6050 5938 if (adapter->base_time) 6051 5939 return -EALREADY; ··· 6064 5940 6065 5941 for (n = 0; n < qopt->num_entries; n++) { 6066 5942 struct tc_taprio_sched_entry *e = &qopt->entries[n]; 6067 - int i; 6068 5943 6069 5944 end_time += e->interval; 5945 + 5946 + /* If any of the conditions below are true, we need to manually 5947 + * control the end time of the cycle. 5948 + * 1. Qbv users can specify a cycle time that is not equal 5949 + * to the total GCL intervals. Hence, recalculation is 5950 + * necessary here to exclude the time interval that 5951 + * exceeds the cycle time. 5952 + * 2. According to IEEE Std. 802.1Q-2018 section 8.6.9.2, 5953 + * once the end of the list is reached, it will switch 5954 + * to the END_OF_CYCLE state and leave the gates in the 5955 + * same state until the next cycle is started. 5956 + */ 5957 + if (end_time > adapter->cycle_time || 5958 + n + 1 == qopt->num_entries) 5959 + end_time = adapter->cycle_time; 6070 5960 6071 5961 for (i = 0; i < adapter->num_tx_queues; i++) { 6072 5962 struct igc_ring *ring = adapter->tx_ring[i]; ··· 6100 5962 } 6101 5963 6102 5964 start_time += e->interval; 5965 + } 5966 + 5967 + /* Check whether a queue gets configured. 5968 + * If not, set the start and end time to be end time. 5969 + */ 5970 + for (i = 0; i < adapter->num_tx_queues; i++) { 5971 + if (!queue_configured[i]) { 5972 + struct igc_ring *ring = adapter->tx_ring[i]; 5973 + 5974 + ring->start_time = end_time; 5975 + ring->end_time = end_time; 5976 + } 6103 5977 } 6104 5978 6105 5979 return 0;
+3 -10
drivers/net/ethernet/intel/igc/igc_tsn.c
··· 36 36 { 37 37 unsigned int new_flags = adapter->flags & ~IGC_FLAG_TSN_ANY_ENABLED; 38 38 39 - if (adapter->base_time) 39 + if (adapter->qbv_enable) 40 40 new_flags |= IGC_FLAG_TSN_QBV_ENABLED; 41 41 42 42 if (is_any_launchtime(adapter)) ··· 140 140 wr32(IGC_STQT(i), ring->start_time); 141 141 wr32(IGC_ENDQT(i), ring->end_time); 142 142 143 - if (adapter->base_time) { 144 - /* If we have a base_time we are in "taprio" 145 - * mode and we need to be strict about the 146 - * cycles: only transmit a packet if it can be 147 - * completed during that cycle. 148 - */ 149 - txqctl |= IGC_TXQCTL_STRICT_CYCLE | 150 - IGC_TXQCTL_STRICT_END; 151 - } 143 + txqctl |= IGC_TXQCTL_STRICT_CYCLE | 144 + IGC_TXQCTL_STRICT_END; 152 145 153 146 if (ring->launchtime_enable) 154 147 txqctl |= IGC_TXQCTL_QUEUE_MODE_LAUNCHT;
+2
drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c
··· 83 83 hex = true; 84 84 break; 85 85 case VCAP_FIELD_U128: 86 + value = data->u128.value; 87 + mask = data->u128.mask; 86 88 if (key == VCAP_KF_L3_IP6_SIP || key == VCAP_KF_L3_IP6_DIP) { 87 89 u8 nvalue[16], nmask[16]; 88 90
+1
drivers/net/ethernet/myricom/myri10ge/myri10ge.c
··· 3912 3912 myri10ge_free_slices(mgp); 3913 3913 3914 3914 abort_with_firmware: 3915 + kfree(mgp->msix_vectors); 3915 3916 myri10ge_dummy_rdma(mgp, 0); 3916 3917 3917 3918 abort_with_ioremap:
+1 -1
drivers/net/ethernet/netronome/nfp/nfp_net_common.c
··· 2509 2509 { 2510 2510 /* Get some of the read-only fields from the BAR */ 2511 2511 nn->cap = nn_readl(nn, NFP_NET_CFG_CAP); 2512 - nn->cap_w1 = nn_readq(nn, NFP_NET_CFG_CAP_WORD1); 2512 + nn->cap_w1 = nn_readl(nn, NFP_NET_CFG_CAP_WORD1); 2513 2513 nn->max_mtu = nn_readl(nn, NFP_NET_CFG_MAX_MTU); 2514 2514 2515 2515 /* ABI 4.x and ctrl vNIC always use chained metadata, in other cases
+4 -1
drivers/net/ethernet/rdc/r6040.c
··· 1159 1159 err = register_netdev(dev); 1160 1160 if (err) { 1161 1161 dev_err(&pdev->dev, "Failed to register net device\n"); 1162 - goto err_out_mdio_unregister; 1162 + goto err_out_phy_disconnect; 1163 1163 } 1164 1164 return 0; 1165 1165 1166 + err_out_phy_disconnect: 1167 + phy_disconnect(dev->phydev); 1166 1168 err_out_mdio_unregister: 1167 1169 mdiobus_unregister(lp->mii_bus); 1168 1170 err_out_mdio: ··· 1188 1186 struct r6040_private *lp = netdev_priv(dev); 1189 1187 1190 1188 unregister_netdev(dev); 1189 + phy_disconnect(dev->phydev); 1191 1190 mdiobus_unregister(lp->mii_bus); 1192 1191 mdiobus_free(lp->mii_bus); 1193 1192 netif_napi_del(&lp->napi);
+1 -1
drivers/net/ethernet/renesas/ravb_main.c
··· 2903 2903 priv->desc_bat_dma); 2904 2904 /* Set reset mode */ 2905 2905 ravb_write(ndev, CCC_OPC_RESET, CCC); 2906 - pm_runtime_put_sync(&pdev->dev); 2907 2906 unregister_netdev(ndev); 2908 2907 if (info->nc_queues) 2909 2908 netif_napi_del(&priv->napi[RAVB_NC]); 2910 2909 netif_napi_del(&priv->napi[RAVB_BE]); 2911 2910 ravb_mdio_release(priv); 2911 + pm_runtime_put_sync(&pdev->dev); 2912 2912 pm_runtime_disable(&pdev->dev); 2913 2913 reset_control_assert(priv->rstc); 2914 2914 free_netdev(ndev);
+1
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
··· 7099 7099 priv->wq = create_singlethread_workqueue("stmmac_wq"); 7100 7100 if (!priv->wq) { 7101 7101 dev_err(priv->device, "failed to create workqueue\n"); 7102 + ret = -ENOMEM; 7102 7103 goto error_wq_init; 7103 7104 } 7104 7105
+1 -3
drivers/net/ethernet/ti/am65-cpsw-nuss.c
··· 2878 2878 return 0; 2879 2879 } 2880 2880 2881 - #ifdef CONFIG_PM_SLEEP 2882 2881 static int am65_cpsw_nuss_suspend(struct device *dev) 2883 2882 { 2884 2883 struct am65_cpsw_common *common = dev_get_drvdata(dev); ··· 2963 2964 2964 2965 return 0; 2965 2966 } 2966 - #endif /* CONFIG_PM_SLEEP */ 2967 2967 2968 2968 static const struct dev_pm_ops am65_cpsw_nuss_dev_pm_ops = { 2969 - SET_SYSTEM_SLEEP_PM_OPS(am65_cpsw_nuss_suspend, am65_cpsw_nuss_resume) 2969 + SYSTEM_SLEEP_PM_OPS(am65_cpsw_nuss_suspend, am65_cpsw_nuss_resume) 2970 2970 }; 2971 2971 2972 2972 static struct platform_driver am65_cpsw_nuss_driver = {
+21 -13
drivers/net/macsec.c
··· 2593 2593 const struct macsec_ops *ops; 2594 2594 struct macsec_context ctx; 2595 2595 struct macsec_dev *macsec; 2596 - int ret; 2596 + int ret = 0; 2597 2597 2598 2598 if (!attrs[MACSEC_ATTR_IFINDEX]) 2599 2599 return -EINVAL; ··· 2606 2606 macsec_genl_offload_policy, NULL)) 2607 2607 return -EINVAL; 2608 2608 2609 + rtnl_lock(); 2610 + 2609 2611 dev = get_dev_from_nl(genl_info_net(info), attrs); 2610 - if (IS_ERR(dev)) 2611 - return PTR_ERR(dev); 2612 + if (IS_ERR(dev)) { 2613 + ret = PTR_ERR(dev); 2614 + goto out; 2615 + } 2612 2616 macsec = macsec_priv(dev); 2613 2617 2614 - if (!tb_offload[MACSEC_OFFLOAD_ATTR_TYPE]) 2615 - return -EINVAL; 2618 + if (!tb_offload[MACSEC_OFFLOAD_ATTR_TYPE]) { 2619 + ret = -EINVAL; 2620 + goto out; 2621 + } 2616 2622 2617 2623 offload = nla_get_u8(tb_offload[MACSEC_OFFLOAD_ATTR_TYPE]); 2618 2624 if (macsec->offload == offload) 2619 - return 0; 2625 + goto out; 2620 2626 2621 2627 /* Check if the offloading mode is supported by the underlying layers */ 2622 2628 if (offload != MACSEC_OFFLOAD_OFF && 2623 - !macsec_check_offload(offload, macsec)) 2624 - return -EOPNOTSUPP; 2629 + !macsec_check_offload(offload, macsec)) { 2630 + ret = -EOPNOTSUPP; 2631 + goto out; 2632 + } 2625 2633 2626 2634 /* Check if the net device is busy. */ 2627 - if (netif_running(dev)) 2628 - return -EBUSY; 2629 - 2630 - rtnl_lock(); 2635 + if (netif_running(dev)) { 2636 + ret = -EBUSY; 2637 + goto out; 2638 + } 2631 2639 2632 2640 prev_offload = macsec->offload; 2633 2641 macsec->offload = offload; ··· 2670 2662 2671 2663 rollback: 2672 2664 macsec->offload = prev_offload; 2673 - 2665 + out: 2674 2666 rtnl_unlock(); 2675 2667 return ret; 2676 2668 }
+4 -2
drivers/net/mctp/mctp-serial.c
··· 35 35 #define BYTE_FRAME 0x7e 36 36 #define BYTE_ESC 0x7d 37 37 38 + #define FCS_INIT 0xffff 39 + 38 40 static DEFINE_IDA(mctp_serial_ida); 39 41 40 42 enum mctp_serial_state { ··· 125 123 buf[2] = dev->txlen; 126 124 127 125 if (!dev->txpos) 128 - dev->txfcs = crc_ccitt(0, buf + 1, 2); 126 + dev->txfcs = crc_ccitt(FCS_INIT, buf + 1, 2); 129 127 130 128 txlen = write_chunk(dev, buf + dev->txpos, 3 - dev->txpos); 131 129 if (txlen <= 0) { ··· 305 303 case 1: 306 304 if (c == MCTP_SERIAL_VERSION) { 307 305 dev->rxpos++; 308 - dev->rxfcs = crc_ccitt_byte(0, c); 306 + dev->rxfcs = crc_ccitt_byte(FCS_INIT, c); 309 307 } else { 310 308 dev->rxstate = STATE_ERR; 311 309 }
+4 -4
drivers/net/wireguard/timers.c
··· 46 46 if (peer->timer_handshake_attempts > MAX_TIMER_HANDSHAKES) { 47 47 pr_debug("%s: Handshake for peer %llu (%pISpfsc) did not complete after %d attempts, giving up\n", 48 48 peer->device->dev->name, peer->internal_id, 49 - &peer->endpoint.addr, MAX_TIMER_HANDSHAKES + 2); 49 + &peer->endpoint.addr, (int)MAX_TIMER_HANDSHAKES + 2); 50 50 51 51 del_timer(&peer->timer_send_keepalive); 52 52 /* We drop all packets without a keypair and don't try again, ··· 64 64 ++peer->timer_handshake_attempts; 65 65 pr_debug("%s: Handshake for peer %llu (%pISpfsc) did not complete after %d seconds, retrying (try %d)\n", 66 66 peer->device->dev->name, peer->internal_id, 67 - &peer->endpoint.addr, REKEY_TIMEOUT, 67 + &peer->endpoint.addr, (int)REKEY_TIMEOUT, 68 68 peer->timer_handshake_attempts + 1); 69 69 70 70 /* We clear the endpoint address src address, in case this is ··· 94 94 95 95 pr_debug("%s: Retrying handshake with peer %llu (%pISpfsc) because we stopped hearing back after %d seconds\n", 96 96 peer->device->dev->name, peer->internal_id, 97 - &peer->endpoint.addr, KEEPALIVE_TIMEOUT + REKEY_TIMEOUT); 97 + &peer->endpoint.addr, (int)(KEEPALIVE_TIMEOUT + REKEY_TIMEOUT)); 98 98 /* We clear the endpoint address src address, in case this is the cause 99 99 * of trouble. 100 100 */ ··· 126 126 127 127 pr_debug("%s: Zeroing out all keys for peer %llu (%pISpfsc), since we haven't received a new one in %d seconds\n", 128 128 peer->device->dev->name, peer->internal_id, 129 - &peer->endpoint.addr, REJECT_AFTER_TIME * 3); 129 + &peer->endpoint.addr, (int)REJECT_AFTER_TIME * 3); 130 130 wg_noise_handshake_clear(&peer->handshake); 131 131 wg_noise_keypairs_clear(&peer->keypairs); 132 132 wg_peer_put(peer);
+4
drivers/nfc/pn533/pn533.c
··· 1295 1295 if (IS_ERR(resp)) 1296 1296 return PTR_ERR(resp); 1297 1297 1298 + memset(&nfc_target, 0, sizeof(struct nfc_target)); 1299 + 1298 1300 rsp = (struct pn533_cmd_jump_dep_response *)resp->data; 1299 1301 1300 1302 rc = rsp->status & PN533_CMD_RET_MASK; ··· 1927 1925 struct nfc_target nfc_target; 1928 1926 1929 1927 dev_dbg(dev->dev, "Creating new target\n"); 1928 + 1929 + memset(&nfc_target, 0, sizeof(struct nfc_target)); 1930 1930 1931 1931 nfc_target.supported_protocols = NFC_PROTO_NFC_DEP_MASK; 1932 1932 nfc_target.nfcid1_len = 10;
+1
drivers/nvme/host/tcp.c
··· 1537 1537 queue->sock->sk->sk_rcvtimeo = 10 * HZ; 1538 1538 1539 1539 queue->sock->sk->sk_allocation = GFP_ATOMIC; 1540 + queue->sock->sk->sk_use_task_frag = false; 1540 1541 nvme_tcp_set_queue_io_cpu(queue); 1541 1542 queue->request = NULL; 1542 1543 queue->data_remaining = 0;
+1
drivers/scsi/iscsi_tcp.c
··· 738 738 sk->sk_reuse = SK_CAN_REUSE; 739 739 sk->sk_sndtimeo = 15 * HZ; /* FIXME: make it configurable */ 740 740 sk->sk_allocation = GFP_ATOMIC; 741 + sk->sk_use_task_frag = false; 741 742 sk_set_memalloc(sk); 742 743 sock_no_linger(sk); 743 744
+1
drivers/usb/usbip/usbip_common.c
··· 315 315 316 316 do { 317 317 sock->sk->sk_allocation = GFP_NOIO; 318 + sock->sk->sk_use_task_frag = false; 318 319 319 320 result = sock_recvmsg(sock, &msg, MSG_WAITALL); 320 321 if (result <= 0)
+1
fs/cifs/connect.c
··· 2944 2944 cifs_dbg(FYI, "Socket created\n"); 2945 2945 server->ssocket = socket; 2946 2946 socket->sk->sk_allocation = GFP_NOFS; 2947 + socket->sk->sk_use_task_frag = false; 2947 2948 if (sfamily == AF_INET6) 2948 2949 cifs_reclassify_socket6(socket); 2949 2950 else
+2
fs/dlm/lowcomms.c
··· 645 645 if (dlm_config.ci_protocol == DLM_PROTO_SCTP) 646 646 sk->sk_state_change = lowcomms_state_change; 647 647 sk->sk_allocation = GFP_NOFS; 648 + sk->sk_use_task_frag = false; 648 649 sk->sk_error_report = lowcomms_error_report; 649 650 release_sock(sk); 650 651 } ··· 1770 1769 listen_con.sock = sock; 1771 1770 1772 1771 sock->sk->sk_allocation = GFP_NOFS; 1772 + sock->sk->sk_use_task_frag = false; 1773 1773 sock->sk->sk_data_ready = lowcomms_listen_data_ready; 1774 1774 release_sock(sock->sk); 1775 1775
+1
fs/ocfs2/cluster/tcp.c
··· 1602 1602 sc->sc_sock = sock; /* freed by sc_kref_release */ 1603 1603 1604 1604 sock->sk->sk_allocation = GFP_ATOMIC; 1605 + sock->sk->sk_use_task_frag = false; 1605 1606 1606 1607 myaddr.sin_family = AF_INET; 1607 1608 myaddr.sin_addr.s_addr = mynode->nd_ipv4_address;
+6 -4
include/net/sock.h
··· 318 318 * @sk_stamp: time stamp of last packet received 319 319 * @sk_stamp_seq: lock for accessing sk_stamp on 32 bit architectures only 320 320 * @sk_tsflags: SO_TIMESTAMPING flags 321 + * @sk_use_task_frag: allow sk_page_frag() to use current->task_frag. 322 + * Sockets that can be used under memory reclaim should 323 + * set this to false. 321 324 * @sk_bind_phc: SO_TIMESTAMPING bind PHC index of PTP virtual clock 322 325 * for timestamping 323 326 * @sk_tskey: counter to disambiguate concurrent tstamp requests ··· 515 512 u8 sk_txtime_deadline_mode : 1, 516 513 sk_txtime_report_errors : 1, 517 514 sk_txtime_unused : 6; 515 + bool sk_use_task_frag; 518 516 519 517 struct socket *sk_socket; 520 518 void *sk_user_data; ··· 2564 2560 * Both direct reclaim and page faults can nest inside other 2565 2561 * socket operations and end up recursing into sk_page_frag() 2566 2562 * while it's already in use: explicitly avoid task page_frag 2567 - * usage if the caller is potentially doing any of them. 2568 - * This assumes that page fault handlers use the GFP_NOFS flags. 2563 + * when users disable sk_use_task_frag. 2569 2564 * 2570 2565 * Return: a per task page_frag if context allows that, 2571 2566 * otherwise a per socket one. 2572 2567 */ 2573 2568 static inline struct page_frag *sk_page_frag(struct sock *sk) 2574 2569 { 2575 - if ((sk->sk_allocation & (__GFP_DIRECT_RECLAIM | __GFP_MEMALLOC | __GFP_FS)) == 2576 - (__GFP_DIRECT_RECLAIM | __GFP_FS)) 2570 + if (sk->sk_use_task_frag) 2577 2571 return &current->task_frag; 2578 2572 2579 2573 return &sk->sk_frag;
+1 -1
include/trace/events/rxrpc.h
··· 471 471 TP_STRUCT__entry( 472 472 __field(unsigned int, peer ) 473 473 __field(int, ref ) 474 - __field(int, why ) 474 + __field(enum rxrpc_peer_trace, why ) 475 475 ), 476 476 477 477 TP_fast_assign(
+3 -2
kernel/bpf/core.c
··· 2090 2090 bool bpf_prog_map_compatible(struct bpf_map *map, 2091 2091 const struct bpf_prog *fp) 2092 2092 { 2093 + enum bpf_prog_type prog_type = resolve_prog_type(fp); 2093 2094 bool ret; 2094 2095 2095 2096 if (fp->kprobe_override) ··· 2101 2100 /* There's no owner yet where we could check for 2102 2101 * compatibility. 2103 2102 */ 2104 - map->owner.type = fp->type; 2103 + map->owner.type = prog_type; 2105 2104 map->owner.jited = fp->jited; 2106 2105 map->owner.xdp_has_frags = fp->aux->xdp_has_frags; 2107 2106 ret = true; 2108 2107 } else { 2109 - ret = map->owner.type == fp->type && 2108 + ret = map->owner.type == prog_type && 2110 2109 map->owner.jited == fp->jited && 2111 2110 map->owner.xdp_has_frags == fp->aux->xdp_has_frags; 2112 2111 }
+5
kernel/bpf/dispatcher.c
··· 125 125 126 126 __BPF_DISPATCHER_UPDATE(d, new ?: (void *)&bpf_dispatcher_nop_func); 127 127 128 + /* Make sure all the callers executing the previous/old half of the 129 + * image leave it, so following update call can modify it safely. 130 + */ 131 + synchronize_rcu(); 132 + 128 133 if (new) 129 134 d->image_off = noff; 130 135 }
+3 -3
kernel/bpf/syscall.c
··· 3518 3518 case BPF_PROG_TYPE_LSM: 3519 3519 if (ptype == BPF_PROG_TYPE_LSM && 3520 3520 prog->expected_attach_type != BPF_LSM_CGROUP) 3521 - return -EINVAL; 3522 - 3523 - ret = cgroup_bpf_prog_attach(attr, ptype, prog); 3521 + ret = -EINVAL; 3522 + else 3523 + ret = cgroup_bpf_prog_attach(attr, ptype, prog); 3524 3524 break; 3525 3525 default: 3526 3526 ret = -EINVAL;
+1
net/9p/trans_fd.c
··· 868 868 } 869 869 870 870 csocket->sk->sk_allocation = GFP_NOIO; 871 + csocket->sk->sk_use_task_frag = false; 871 872 file = sock_alloc_file(csocket, 0, NULL); 872 873 if (IS_ERR(file)) { 873 874 pr_err("%s (%d): failed to map fd\n",
+1
net/ceph/messenger.c
··· 446 446 if (ret) 447 447 return ret; 448 448 sock->sk->sk_allocation = GFP_NOFS; 449 + sock->sk->sk_use_task_frag = false; 449 450 450 451 #ifdef CONFIG_LOCKDEP 451 452 lockdep_set_class(&sock->sk->sk_lock, &socket_class);
+5
net/core/devlink.c
··· 1648 1648 continue; 1649 1649 } 1650 1650 1651 + devl_lock(devlink); 1651 1652 err = devlink_nl_fill(msg, devlink, DEVLINK_CMD_NEW, 1652 1653 NETLINK_CB(cb->skb).portid, 1653 1654 cb->nlh->nlmsg_seq, NLM_F_MULTI); 1655 + devl_unlock(devlink); 1654 1656 devlink_put(devlink); 1657 + 1655 1658 if (err) 1656 1659 goto out; 1657 1660 idx++; ··· 11928 11925 devl_assert_locked(devlink); 11929 11926 11930 11927 /* Free all snapshots of region */ 11928 + mutex_lock(&region->snapshot_lock); 11931 11929 list_for_each_entry_safe(snapshot, ts, &region->snapshot_list, list) 11932 11930 devlink_region_snapshot_del(region, snapshot); 11931 + mutex_unlock(&region->snapshot_lock); 11933 11932 11934 11933 list_del(&region->list); 11935 11934 mutex_destroy(&region->snapshot_lock);
+3
net/core/skbuff.c
··· 2482 2482 insp = list; 2483 2483 } else { 2484 2484 /* Eaten partially. */ 2485 + if (skb_is_gso(skb) && !list->head_frag && 2486 + skb_headlen(list)) 2487 + skb_shinfo(skb)->gso_type |= SKB_GSO_DODGY; 2485 2488 2486 2489 if (skb_shared(list)) { 2487 2490 /* Sucks! We need to fork list. :-( */
+1
net/core/sock.c
··· 3390 3390 sk->sk_rcvbuf = READ_ONCE(sysctl_rmem_default); 3391 3391 sk->sk_sndbuf = READ_ONCE(sysctl_wmem_default); 3392 3392 sk->sk_state = TCP_CLOSE; 3393 + sk->sk_use_task_frag = true; 3393 3394 sk_set_socket(sk, sock); 3394 3395 3395 3396 sock_set_flag(sk, SOCK_ZAPPED);
+6
net/core/stream.c
··· 196 196 /* First the read buffer. */ 197 197 __skb_queue_purge(&sk->sk_receive_queue); 198 198 199 + /* Next, the error queue. 200 + * We need to use queue lock, because other threads might 201 + * add packets to the queue without socket lock being held. 202 + */ 203 + skb_queue_purge(&sk->sk_error_queue); 204 + 199 205 /* Next, the write queue. */ 200 206 WARN_ON_ONCE(!skb_queue_empty(&sk->sk_write_queue)); 201 207
+1 -13
net/mctp/device.c
··· 429 429 struct mctp_dev *mdev; 430 430 431 431 mdev = mctp_dev_get_rtnl(dev); 432 - if (mdev && !mctp_known(dev)) { 433 - // Sanity check, should match what was set in mctp_register 434 - netdev_warn(dev, "%s: BUG mctp_ptr set for unknown type %d", 435 - __func__, dev->type); 436 - return; 437 - } 438 432 if (!mdev) 439 433 return; 440 434 ··· 445 451 struct mctp_dev *mdev; 446 452 447 453 /* Already registered? */ 448 - mdev = rtnl_dereference(dev->mctp_ptr); 449 - 450 - if (mdev) { 451 - if (!mctp_known(dev)) 452 - netdev_warn(dev, "%s: BUG mctp_ptr set for unknown type %d", 453 - __func__, dev->type); 454 + if (rtnl_dereference(dev->mctp_ptr)) 454 455 return 0; 455 - } 456 456 457 457 /* only register specific types */ 458 458 if (!mctp_known(dev))
+5
net/netfilter/ipvs/ip_vs_ctl.c
··· 2841 2841 break; 2842 2842 case IP_VS_SO_SET_DELDEST: 2843 2843 ret = ip_vs_del_dest(svc, &udest); 2844 + break; 2845 + default: 2846 + WARN_ON_ONCE(1); 2847 + ret = -EINVAL; 2848 + break; 2844 2849 } 2845 2850 2846 2851 out_unlock:
+3 -3
net/netfilter/nf_flow_table_offload.c
··· 383 383 const __be32 *addr, const __be32 *mask) 384 384 { 385 385 struct flow_action_entry *entry; 386 - int i, j; 386 + int i; 387 387 388 - for (i = 0, j = 0; i < sizeof(struct in6_addr) / sizeof(u32); i += sizeof(u32), j++) { 388 + for (i = 0; i < sizeof(struct in6_addr) / sizeof(u32); i++) { 389 389 entry = flow_action_entry_next(flow_rule); 390 390 flow_offload_mangle(entry, FLOW_ACT_MANGLE_HDR_TYPE_IP6, 391 - offset + i, &addr[j], mask); 391 + offset + i * sizeof(u32), &addr[i], mask); 392 392 } 393 393 } 394 394
+16 -9
net/openvswitch/datapath.c
··· 973 973 struct sw_flow_mask mask; 974 974 struct sk_buff *reply; 975 975 struct datapath *dp; 976 + struct sw_flow_key *key; 976 977 struct sw_flow_actions *acts; 977 978 struct sw_flow_match match; 978 979 u32 ufid_flags = ovs_nla_get_ufid_flags(a[OVS_FLOW_ATTR_UFID_FLAGS]); ··· 1001 1000 } 1002 1001 1003 1002 /* Extract key. */ 1004 - ovs_match_init(&match, &new_flow->key, false, &mask); 1003 + key = kzalloc(sizeof(*key), GFP_KERNEL); 1004 + if (!key) { 1005 + error = -ENOMEM; 1006 + goto err_kfree_key; 1007 + } 1008 + 1009 + ovs_match_init(&match, key, false, &mask); 1005 1010 error = ovs_nla_get_match(net, &match, a[OVS_FLOW_ATTR_KEY], 1006 1011 a[OVS_FLOW_ATTR_MASK], log); 1007 1012 if (error) 1008 1013 goto err_kfree_flow; 1009 1014 1015 + ovs_flow_mask_key(&new_flow->key, key, true, &mask); 1016 + 1010 1017 /* Extract flow identifier. */ 1011 1018 error = ovs_nla_get_identifier(&new_flow->id, a[OVS_FLOW_ATTR_UFID], 1012 - &new_flow->key, log); 1019 + key, log); 1013 1020 if (error) 1014 1021 goto err_kfree_flow; 1015 - 1016 - /* unmasked key is needed to match when ufid is not used. */ 1017 - if (ovs_identifier_is_key(&new_flow->id)) 1018 - match.key = new_flow->id.unmasked_key; 1019 - 1020 - ovs_flow_mask_key(&new_flow->key, &new_flow->key, true, &mask); 1021 1022 1022 1023 /* Validate actions. */ 1023 1024 error = ovs_nla_copy_actions(net, a[OVS_FLOW_ATTR_ACTIONS], ··· 1047 1044 if (ovs_identifier_is_ufid(&new_flow->id)) 1048 1045 flow = ovs_flow_tbl_lookup_ufid(&dp->table, &new_flow->id); 1049 1046 if (!flow) 1050 - flow = ovs_flow_tbl_lookup(&dp->table, &new_flow->key); 1047 + flow = ovs_flow_tbl_lookup(&dp->table, key); 1051 1048 if (likely(!flow)) { 1052 1049 rcu_assign_pointer(new_flow->sf_acts, acts); 1053 1050 ··· 1117 1114 1118 1115 if (reply) 1119 1116 ovs_notify(&dp_flow_genl_family, reply, info); 1117 + 1118 + kfree(key); 1120 1119 return 0; 1121 1120 1122 1121 err_unlock_ovs: ··· 1128 1123 ovs_nla_free_flow_actions(acts); 1129 1124 err_kfree_flow: 1130 1125 ovs_flow_free(new_flow, false); 1126 + err_kfree_key: 1127 + kfree(key); 1131 1128 error: 1132 1129 return error; 1133 1130 }
+4 -4
net/rxrpc/ar-internal.h
··· 287 287 struct hlist_node link; 288 288 struct socket *socket; /* my UDP socket */ 289 289 struct task_struct *io_thread; 290 + struct completion io_thread_ready; /* Indication that the I/O thread started */ 290 291 struct rxrpc_sock __rcu *service; /* Service(s) listening on this endpoint */ 291 292 struct rw_semaphore defrag_sem; /* control re-enablement of IP DF bit */ 292 293 struct sk_buff_head rx_queue; /* Received packets */ ··· 812 811 */ 813 812 int rxrpc_service_prealloc(struct rxrpc_sock *, gfp_t); 814 813 void rxrpc_discard_prealloc(struct rxrpc_sock *); 815 - bool rxrpc_new_incoming_call(struct rxrpc_local *, struct rxrpc_peer *, 816 - struct rxrpc_connection *, struct sockaddr_rxrpc *, 817 - struct sk_buff *); 814 + int rxrpc_new_incoming_call(struct rxrpc_local *, struct rxrpc_peer *, 815 + struct rxrpc_connection *, struct sockaddr_rxrpc *, 816 + struct sk_buff *); 818 817 void rxrpc_accept_incoming_calls(struct rxrpc_local *); 819 818 int rxrpc_user_charge_accept(struct rxrpc_sock *, unsigned long); 820 819 ··· 1073 1072 struct rxrpc_peer *rxrpc_get_peer(struct rxrpc_peer *, enum rxrpc_peer_trace); 1074 1073 struct rxrpc_peer *rxrpc_get_peer_maybe(struct rxrpc_peer *, enum rxrpc_peer_trace); 1075 1074 void rxrpc_put_peer(struct rxrpc_peer *, enum rxrpc_peer_trace); 1076 - void rxrpc_put_peer_locked(struct rxrpc_peer *, enum rxrpc_peer_trace); 1077 1075 1078 1076 /* 1079 1077 * proc.c
+9 -9
net/rxrpc/call_accept.c
··· 326 326 * If we want to report an error, we mark the skb with the packet type and 327 327 * abort code and return false. 328 328 */ 329 - bool rxrpc_new_incoming_call(struct rxrpc_local *local, 330 - struct rxrpc_peer *peer, 331 - struct rxrpc_connection *conn, 332 - struct sockaddr_rxrpc *peer_srx, 333 - struct sk_buff *skb) 329 + int rxrpc_new_incoming_call(struct rxrpc_local *local, 330 + struct rxrpc_peer *peer, 331 + struct rxrpc_connection *conn, 332 + struct sockaddr_rxrpc *peer_srx, 333 + struct sk_buff *skb) 334 334 { 335 335 const struct rxrpc_security *sec = NULL; 336 336 struct rxrpc_skb_priv *sp = rxrpc_skb(skb); ··· 342 342 /* Don't set up a call for anything other than the first DATA packet. */ 343 343 if (sp->hdr.seq != 1 || 344 344 sp->hdr.type != RXRPC_PACKET_TYPE_DATA) 345 - return true; /* Just discard */ 345 + return 0; /* Just discard */ 346 346 347 347 rcu_read_lock(); 348 348 ··· 413 413 _leave(" = %p{%d}", call, call->debug_id); 414 414 rxrpc_input_call_event(call, skb); 415 415 rxrpc_put_call(call, rxrpc_call_put_input); 416 - return true; 416 + return 0; 417 417 418 418 unsupported_service: 419 419 trace_rxrpc_abort(0, "INV", sp->hdr.cid, sp->hdr.callNumber, sp->hdr.seq, ··· 425 425 reject: 426 426 rcu_read_unlock(); 427 427 _leave(" = f [%u]", skb->mark); 428 - return false; 428 + return -EPROTO; 429 429 discard: 430 430 rcu_read_unlock(); 431 - return true; 431 + return 0; 432 432 } 433 433 434 434 /*
+1
net/rxrpc/call_object.c
··· 217 217 call->tx_total_len = p->tx_total_len; 218 218 call->key = key_get(cp->key); 219 219 call->local = rxrpc_get_local(cp->local, rxrpc_local_get_call); 220 + call->security_level = cp->security_level; 220 221 if (p->kernel) 221 222 __set_bit(RXRPC_CALL_KERNEL, &call->flags); 222 223 if (cp->upgrade)
-2
net/rxrpc/conn_client.c
··· 551 551 call->conn = rxrpc_get_connection(conn, rxrpc_conn_get_activate_call); 552 552 call->cid = conn->proto.cid | channel; 553 553 call->call_id = call_id; 554 - call->security = conn->security; 555 - call->security_ix = conn->security_ix; 556 554 call->dest_srx.srx_service = conn->service_id; 557 555 558 556 trace_rxrpc_connect_call(call);
+7 -3
net/rxrpc/io_thread.c
··· 292 292 skb->mark = RXRPC_SKB_MARK_REJECT_ABORT; 293 293 reject_packet: 294 294 rxrpc_reject_packet(local, skb); 295 - return ret; 295 + return 0; 296 296 } 297 297 298 298 /* ··· 384 384 if (rxrpc_to_client(sp)) 385 385 goto bad_message; 386 386 if (rxrpc_new_incoming_call(conn->local, conn->peer, conn, 387 - peer_srx, skb)) 387 + peer_srx, skb) == 0) 388 388 return 0; 389 389 goto reject_packet; 390 390 } ··· 425 425 struct rxrpc_local *local = data; 426 426 struct rxrpc_call *call; 427 427 struct sk_buff *skb; 428 + bool should_stop; 429 + 430 + complete(&local->io_thread_ready); 428 431 429 432 skb_queue_head_init(&rx_queue); 430 433 ··· 479 476 } 480 477 481 478 set_current_state(TASK_INTERRUPTIBLE); 479 + should_stop = kthread_should_stop(); 482 480 if (!skb_queue_empty(&local->rx_queue) || 483 481 !list_empty(&local->call_attend_q)) { 484 482 __set_current_state(TASK_RUNNING); 485 483 continue; 486 484 } 487 485 488 - if (kthread_should_stop()) 486 + if (should_stop) 489 487 break; 490 488 schedule(); 491 489 }
+4 -1
net/rxrpc/local_object.c
··· 97 97 local->rxnet = rxnet; 98 98 INIT_HLIST_NODE(&local->link); 99 99 init_rwsem(&local->defrag_sem); 100 + init_completion(&local->io_thread_ready); 100 101 skb_queue_head_init(&local->rx_queue); 101 102 INIT_LIST_HEAD(&local->call_attend_q); 102 103 local->client_bundles = RB_ROOT; ··· 190 189 goto error_sock; 191 190 } 192 191 192 + wait_for_completion(&local->io_thread_ready); 193 193 local->io_thread = io_thread; 194 194 _leave(" = 0"); 195 195 return 0; ··· 359 357 */ 360 358 void rxrpc_unuse_local(struct rxrpc_local *local, enum rxrpc_local_trace why) 361 359 { 362 - unsigned int debug_id = local->debug_id; 360 + unsigned int debug_id; 363 361 int r, u; 364 362 365 363 if (local) { 364 + debug_id = local->debug_id; 366 365 r = refcount_read(&local->ref); 367 366 u = atomic_dec_return(&local->active_users); 368 367 trace_rxrpc_local(debug_id, why, r, u);
+7 -3
net/rxrpc/peer_event.c
··· 235 235 struct rxrpc_peer *peer; 236 236 const u8 mask = ARRAY_SIZE(rxnet->peer_keepalive) - 1; 237 237 time64_t keepalive_at; 238 + bool use; 238 239 int slot; 239 240 240 241 spin_lock(&rxnet->peer_hash_lock); ··· 248 247 if (!rxrpc_get_peer_maybe(peer, rxrpc_peer_get_keepalive)) 249 248 continue; 250 249 251 - if (__rxrpc_use_local(peer->local, rxrpc_local_use_peer_keepalive)) { 252 - spin_unlock(&rxnet->peer_hash_lock); 250 + use = __rxrpc_use_local(peer->local, rxrpc_local_use_peer_keepalive); 251 + spin_unlock(&rxnet->peer_hash_lock); 253 252 253 + if (use) { 254 254 keepalive_at = peer->last_tx_at + RXRPC_KEEPALIVE_TIME; 255 255 slot = keepalive_at - base; 256 256 _debug("%02x peer %u t=%d {%pISp}", ··· 272 270 spin_lock(&rxnet->peer_hash_lock); 273 271 list_add_tail(&peer->keepalive_link, 274 272 &rxnet->peer_keepalive[slot & mask]); 273 + spin_unlock(&rxnet->peer_hash_lock); 275 274 rxrpc_unuse_local(peer->local, rxrpc_local_unuse_peer_keepalive); 276 275 } 277 - rxrpc_put_peer_locked(peer, rxrpc_peer_put_keepalive); 276 + rxrpc_put_peer(peer, rxrpc_peer_put_keepalive); 277 + spin_lock(&rxnet->peer_hash_lock); 278 278 } 279 279 280 280 spin_unlock(&rxnet->peer_hash_lock);
+2 -21
net/rxrpc/peer_object.c
··· 226 226 rxrpc_peer_init_rtt(peer); 227 227 228 228 peer->cong_ssthresh = RXRPC_TX_MAX_WINDOW; 229 - trace_rxrpc_peer(peer->debug_id, why, 1); 229 + trace_rxrpc_peer(peer->debug_id, 1, why); 230 230 } 231 231 232 232 _leave(" = %p", peer); ··· 382 382 int r; 383 383 384 384 __refcount_inc(&peer->ref, &r); 385 - trace_rxrpc_peer(peer->debug_id, why, r + 1); 385 + trace_rxrpc_peer(peer->debug_id, r + 1, why); 386 386 return peer; 387 387 } 388 388 ··· 435 435 trace_rxrpc_peer(debug_id, r - 1, why); 436 436 if (dead) 437 437 __rxrpc_put_peer(peer); 438 - } 439 - } 440 - 441 - /* 442 - * Drop a ref on a peer record where the caller already holds the 443 - * peer_hash_lock. 444 - */ 445 - void rxrpc_put_peer_locked(struct rxrpc_peer *peer, enum rxrpc_peer_trace why) 446 - { 447 - unsigned int debug_id = peer->debug_id; 448 - bool dead; 449 - int r; 450 - 451 - dead = __refcount_dec_and_test(&peer->ref, &r); 452 - trace_rxrpc_peer(debug_id, r - 1, why); 453 - if (dead) { 454 - hash_del_rcu(&peer->hash_link); 455 - list_del_init(&peer->keepalive_link); 456 - rxrpc_free_peer(peer); 457 438 } 458 439 } 459 440
+1 -1
net/rxrpc/rxperf.c
··· 275 275 struct rxperf_call *call = container_of(work, struct rxperf_call, work); 276 276 enum rxperf_call_state state; 277 277 u32 abort_code, remote_abort = 0; 278 - int ret; 278 + int ret = 0; 279 279 280 280 if (call->state == RXPERF_CALL_COMPLETE) 281 281 return;
+3 -3
net/rxrpc/security.c
··· 67 67 */ 68 68 int rxrpc_init_client_call_security(struct rxrpc_call *call) 69 69 { 70 - const struct rxrpc_security *sec; 70 + const struct rxrpc_security *sec = &rxrpc_no_security; 71 71 struct rxrpc_key_token *token; 72 72 struct key *key = call->key; 73 73 int ret; 74 74 75 75 if (!key) 76 - return 0; 76 + goto found; 77 77 78 78 ret = key_validate(key); 79 79 if (ret < 0) ··· 88 88 89 89 found: 90 90 call->security = sec; 91 - _leave(" = 0"); 91 + call->security_ix = sec->security_index; 92 92 return 0; 93 93 } 94 94
+1 -1
net/rxrpc/sendmsg.c
··· 625 625 if (call->tx_total_len != -1 || 626 626 call->tx_pending || 627 627 call->tx_top != 0) 628 - goto error_put; 628 + goto out_put_unlock; 629 629 call->tx_total_len = p.call.tx_total_len; 630 630 } 631 631 }
+2
net/sched/ematch.c
··· 255 255 * the value carried. 256 256 */ 257 257 if (em_hdr->flags & TCF_EM_SIMPLE) { 258 + if (em->ops->datalen > 0) 259 + goto errout; 258 260 if (data_len < sizeof(u32)) 259 261 goto errout; 260 262 em->data = *(u32 *) data;
+3
net/sunrpc/xprtsock.c
··· 1882 1882 sk->sk_write_space = xs_udp_write_space; 1883 1883 sk->sk_state_change = xs_local_state_change; 1884 1884 sk->sk_error_report = xs_error_report; 1885 + sk->sk_use_task_frag = false; 1885 1886 1886 1887 xprt_clear_connected(xprt); 1887 1888 ··· 2083 2082 sk->sk_user_data = xprt; 2084 2083 sk->sk_data_ready = xs_data_ready; 2085 2084 sk->sk_write_space = xs_udp_write_space; 2085 + sk->sk_use_task_frag = false; 2086 2086 2087 2087 xprt_set_connected(xprt); 2088 2088 ··· 2251 2249 sk->sk_state_change = xs_tcp_state_change; 2252 2250 sk->sk_write_space = xs_tcp_write_space; 2253 2251 sk->sk_error_report = xs_error_report; 2252 + sk->sk_use_task_frag = false; 2254 2253 2255 2254 /* socket options */ 2256 2255 sock_reset_flag(sk, SOCK_LINGER);
+9 -2
net/unix/af_unix.c
··· 1999 1999 unix_state_lock(sk); 2000 2000 2001 2001 err = 0; 2002 - if (unix_peer(sk) == other) { 2002 + if (sk->sk_type == SOCK_SEQPACKET) { 2003 + /* We are here only when racing with unix_release_sock() 2004 + * is clearing @other. Never change state to TCP_CLOSE 2005 + * unlike SOCK_DGRAM wants. 2006 + */ 2007 + unix_state_unlock(sk); 2008 + err = -EPIPE; 2009 + } else if (unix_peer(sk) == other) { 2003 2010 unix_peer(sk) = NULL; 2004 2011 unix_dgram_peer_wake_disconnect_wakeup(sk, other); 2005 2012 2013 + sk->sk_state = TCP_CLOSE; 2006 2014 unix_state_unlock(sk); 2007 2015 2008 - sk->sk_state = TCP_CLOSE; 2009 2016 unix_dgram_disconnected(sk, other); 2010 2017 sock_put(other); 2011 2018 err = -ECONNREFUSED;
+1
net/xfrm/espintcp.c
··· 489 489 490 490 /* avoid using task_frag */ 491 491 sk->sk_allocation = GFP_ATOMIC; 492 + sk->sk_use_task_frag = false; 492 493 493 494 return 0; 494 495
+1
tools/testing/selftests/bpf/config
··· 16 16 CONFIG_DYNAMIC_FTRACE=y 17 17 CONFIG_FPROBE=y 18 18 CONFIG_FTRACE_SYSCALLS=y 19 + CONFIG_FUNCTION_ERROR_INJECTION=y 19 20 CONFIG_FUNCTION_TRACER=y 20 21 CONFIG_GENEVE=y 21 22 CONFIG_IKCONFIG=y
+48
tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c
··· 4 4 #include <network_helpers.h> 5 5 #include <bpf/btf.h> 6 6 #include "bind4_prog.skel.h" 7 + #include "freplace_progmap.skel.h" 8 + #include "xdp_dummy.skel.h" 7 9 8 10 typedef int (*test_cb)(struct bpf_object *obj); 9 11 ··· 502 500 bind4_prog__destroy(skel); 503 501 } 504 502 503 + static void test_func_replace_progmap(void) 504 + { 505 + struct bpf_cpumap_val value = { .qsize = 1 }; 506 + struct freplace_progmap *skel = NULL; 507 + struct xdp_dummy *tgt_skel = NULL; 508 + __u32 key = 0; 509 + int err; 510 + 511 + skel = freplace_progmap__open(); 512 + if (!ASSERT_OK_PTR(skel, "prog_open")) 513 + return; 514 + 515 + tgt_skel = xdp_dummy__open_and_load(); 516 + if (!ASSERT_OK_PTR(tgt_skel, "tgt_prog_load")) 517 + goto out; 518 + 519 + err = bpf_program__set_attach_target(skel->progs.xdp_cpumap_prog, 520 + bpf_program__fd(tgt_skel->progs.xdp_dummy_prog), 521 + "xdp_dummy_prog"); 522 + if (!ASSERT_OK(err, "set_attach_target")) 523 + goto out; 524 + 525 + err = freplace_progmap__load(skel); 526 + if (!ASSERT_OK(err, "obj_load")) 527 + goto out; 528 + 529 + /* Prior to fixing the kernel, loading the PROG_TYPE_EXT 'redirect' 530 + * program above will cause the map owner type of 'cpumap' to be set to 531 + * PROG_TYPE_EXT. This in turn will cause the bpf_map_update_elem() 532 + * below to fail, because the program we are inserting into the map is 533 + * of PROG_TYPE_XDP. After fixing the kernel, the initial ownership will 534 + * be correctly resolved to the *target* of the PROG_TYPE_EXT program 535 + * (i.e., PROG_TYPE_XDP) and the map update will succeed. 536 + */ 537 + value.bpf_prog.fd = bpf_program__fd(skel->progs.xdp_drop_prog); 538 + err = bpf_map_update_elem(bpf_map__fd(skel->maps.cpu_map), 539 + &key, &value, 0); 540 + ASSERT_OK(err, "map_update"); 541 + 542 + out: 543 + xdp_dummy__destroy(tgt_skel); 544 + freplace_progmap__destroy(skel); 545 + } 546 + 505 547 /* NOTE: affect other tests, must run in serial mode */ 506 548 void serial_test_fexit_bpf2bpf(void) 507 549 { ··· 571 525 test_func_replace_global_func(); 572 526 if (test__start_subtest("fentry_to_cgroup_bpf")) 573 527 test_fentry_to_cgroup_bpf(); 528 + if (test__start_subtest("func_replace_progmap")) 529 + test_func_replace_progmap(); 574 530 }
+24
tools/testing/selftests/bpf/progs/freplace_progmap.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + #include <linux/bpf.h> 3 + #include <bpf/bpf_helpers.h> 4 + 5 + struct { 6 + __uint(type, BPF_MAP_TYPE_CPUMAP); 7 + __type(key, __u32); 8 + __type(value, struct bpf_cpumap_val); 9 + __uint(max_entries, 1); 10 + } cpu_map SEC(".maps"); 11 + 12 + SEC("xdp/cpumap") 13 + int xdp_drop_prog(struct xdp_md *ctx) 14 + { 15 + return XDP_DROP; 16 + } 17 + 18 + SEC("freplace") 19 + int xdp_cpumap_prog(struct xdp_md *ctx) 20 + { 21 + return bpf_redirect_map(&cpu_map, 0, XDP_PASS); 22 + } 23 + 24 + char _license[] SEC("license") = "GPL";
+4 -4
tools/testing/selftests/bpf/progs/rcu_read_lock.c
··· 288 288 SEC("?fentry.s/" SYS_PREFIX "sys_getpgid") 289 289 int task_untrusted_non_rcuptr(void *ctx) 290 290 { 291 - struct task_struct *task, *last_wakee; 291 + struct task_struct *task, *group_leader; 292 292 293 293 task = bpf_get_current_task_btf(); 294 294 bpf_rcu_read_lock(); 295 - /* the pointer last_wakee marked as untrusted */ 296 - last_wakee = task->real_parent->last_wakee; 297 - (void)bpf_task_storage_get(&map_a, last_wakee, 0, 0); 295 + /* the pointer group_leader marked as untrusted */ 296 + group_leader = task->real_parent->group_leader; 297 + (void)bpf_task_storage_get(&map_a, group_leader, 0, 0); 298 298 bpf_rcu_read_unlock(); 299 299 return 0; 300 300 }
+1 -1
tools/testing/selftests/bpf/progs/task_kfunc_failure.c
··· 73 73 struct task_struct *acquired; 74 74 75 75 /* Can't invoke bpf_task_acquire() on a trusted pointer obtained from walking a struct. */ 76 - acquired = bpf_task_acquire(task->last_wakee); 76 + acquired = bpf_task_acquire(task->group_leader); 77 77 bpf_task_release(acquired); 78 78 79 79 return 0;
+2 -1
tools/testing/selftests/drivers/net/bonding/Makefile
··· 7 7 bond-lladdr-target.sh \ 8 8 dev_addr_lists.sh \ 9 9 mode-1-recovery-updelay.sh \ 10 - mode-2-recovery-updelay.sh 10 + mode-2-recovery-updelay.sh \ 11 + option_prio.sh 11 12 12 13 TEST_FILES := \ 13 14 lag_lib.sh \
+245
tools/testing/selftests/drivers/net/bonding/option_prio.sh
··· 1 + #!/bin/bash 2 + # SPDX-License-Identifier: GPL-2.0 3 + # 4 + # Test bonding option prio 5 + # 6 + 7 + ALL_TESTS=" 8 + prio_arp_ip_target_test 9 + prio_miimon_test 10 + " 11 + 12 + REQUIRE_MZ=no 13 + REQUIRE_JQ=no 14 + NUM_NETIFS=0 15 + lib_dir=$(dirname "$0") 16 + source "$lib_dir"/net_forwarding_lib.sh 17 + 18 + destroy() 19 + { 20 + ip link del bond0 &>/dev/null 21 + ip link del br0 &>/dev/null 22 + ip link del veth0 &>/dev/null 23 + ip link del veth1 &>/dev/null 24 + ip link del veth2 &>/dev/null 25 + ip netns del ns1 &>/dev/null 26 + ip link del veth3 &>/dev/null 27 + } 28 + 29 + cleanup() 30 + { 31 + pre_cleanup 32 + 33 + destroy 34 + } 35 + 36 + skip() 37 + { 38 + local skip=1 39 + ip link add name bond0 type bond mode 1 miimon 100 &>/dev/null 40 + ip link add name veth0 type veth peer name veth0_p 41 + ip link set veth0 master bond0 42 + 43 + # check if iproute support prio option 44 + ip link set dev veth0 type bond_slave prio 10 45 + [[ $? -ne 0 ]] && skip=0 46 + 47 + # check if bonding support prio option 48 + ip -d link show veth0 | grep -q "prio 10" 49 + [[ $? -ne 0 ]] && skip=0 50 + 51 + ip link del bond0 &>/dev/null 52 + ip link del veth0 53 + 54 + return $skip 55 + } 56 + 57 + active_slave="" 58 + check_active_slave() 59 + { 60 + local target_active_slave=$1 61 + active_slave="$(cat /sys/class/net/bond0/bonding/active_slave)" 62 + test "$active_slave" = "$target_active_slave" 63 + check_err $? "Current active slave is $active_slave but not $target_active_slave" 64 + } 65 + 66 + 67 + # Test bonding prio option with mode=$mode monitor=$monitor 68 + # and primary_reselect=$primary_reselect 69 + prio_test() 70 + { 71 + RET=0 72 + 73 + local monitor=$1 74 + local mode=$2 75 + local primary_reselect=$3 76 + 77 + local bond_ip4="192.169.1.2" 78 + local peer_ip4="192.169.1.1" 79 + local bond_ip6="2009:0a:0b::02" 80 + local peer_ip6="2009:0a:0b::01" 81 + 82 + 83 + # create veths 84 + ip link add name veth0 type veth peer name veth0_p 85 + ip link add name veth1 type veth peer name veth1_p 86 + ip link add name veth2 type veth peer name veth2_p 87 + 88 + # create bond 89 + if [[ "$monitor" == "miimon" ]];then 90 + ip link add name bond0 type bond mode $mode miimon 100 primary veth1 primary_reselect $primary_reselect 91 + elif [[ "$monitor" == "arp_ip_target" ]];then 92 + ip link add name bond0 type bond mode $mode arp_interval 1000 arp_ip_target $peer_ip4 primary veth1 primary_reselect $primary_reselect 93 + elif [[ "$monitor" == "ns_ip6_target" ]];then 94 + ip link add name bond0 type bond mode $mode arp_interval 1000 ns_ip6_target $peer_ip6 primary veth1 primary_reselect $primary_reselect 95 + fi 96 + ip link set bond0 up 97 + ip link set veth0 master bond0 98 + ip link set veth1 master bond0 99 + ip link set veth2 master bond0 100 + # check bonding member prio value 101 + ip link set dev veth0 type bond_slave prio 0 102 + ip link set dev veth1 type bond_slave prio 10 103 + ip link set dev veth2 type bond_slave prio 11 104 + ip -d link show veth0 | grep -q 'prio 0' 105 + check_err $? "veth0 prio is not 0" 106 + ip -d link show veth1 | grep -q 'prio 10' 107 + check_err $? "veth0 prio is not 10" 108 + ip -d link show veth2 | grep -q 'prio 11' 109 + check_err $? "veth0 prio is not 11" 110 + 111 + ip link set veth0 up 112 + ip link set veth1 up 113 + ip link set veth2 up 114 + ip link set veth0_p up 115 + ip link set veth1_p up 116 + ip link set veth2_p up 117 + 118 + # prepare ping target 119 + ip link add name br0 type bridge 120 + ip link set br0 up 121 + ip link set veth0_p master br0 122 + ip link set veth1_p master br0 123 + ip link set veth2_p master br0 124 + ip link add name veth3 type veth peer name veth3_p 125 + ip netns add ns1 126 + ip link set veth3_p master br0 up 127 + ip link set veth3 netns ns1 up 128 + ip netns exec ns1 ip addr add $peer_ip4/24 dev veth3 129 + ip netns exec ns1 ip addr add $peer_ip6/64 dev veth3 130 + ip addr add $bond_ip4/24 dev bond0 131 + ip addr add $bond_ip6/64 dev bond0 132 + sleep 5 133 + 134 + ping $peer_ip4 -c5 -I bond0 &>/dev/null 135 + check_err $? "ping failed 1." 136 + ping6 $peer_ip6 -c5 -I bond0 &>/dev/null 137 + check_err $? "ping6 failed 1." 138 + 139 + # active salve should be the primary slave 140 + check_active_slave veth1 141 + 142 + # active slave should be the higher prio slave 143 + ip link set $active_slave down 144 + ping $peer_ip4 -c5 -I bond0 &>/dev/null 145 + check_err $? "ping failed 2." 146 + check_active_slave veth2 147 + 148 + # when only 1 slave is up 149 + ip link set $active_slave down 150 + ping $peer_ip4 -c5 -I bond0 &>/dev/null 151 + check_err $? "ping failed 3." 152 + check_active_slave veth0 153 + 154 + # when a higher prio slave change to up 155 + ip link set veth2 up 156 + ping $peer_ip4 -c5 -I bond0 &>/dev/null 157 + check_err $? "ping failed 4." 158 + case $primary_reselect in 159 + "0") 160 + check_active_slave "veth2" 161 + ;; 162 + "1") 163 + check_active_slave "veth0" 164 + ;; 165 + "2") 166 + check_active_slave "veth0" 167 + ;; 168 + esac 169 + local pre_active_slave=$active_slave 170 + 171 + # when the primary slave change to up 172 + ip link set veth1 up 173 + ping $peer_ip4 -c5 -I bond0 &>/dev/null 174 + check_err $? "ping failed 5." 175 + case $primary_reselect in 176 + "0") 177 + check_active_slave "veth1" 178 + ;; 179 + "1") 180 + check_active_slave "$pre_active_slave" 181 + ;; 182 + "2") 183 + check_active_slave "$pre_active_slave" 184 + ip link set $active_slave down 185 + ping $peer_ip4 -c5 -I bond0 &>/dev/null 186 + check_err $? "ping failed 6." 187 + check_active_slave "veth1" 188 + ;; 189 + esac 190 + 191 + # Test changing bond salve prio 192 + if [[ "$primary_reselect" == "0" ]];then 193 + ip link set dev veth0 type bond_slave prio 1000000 194 + ip link set dev veth1 type bond_slave prio 0 195 + ip link set dev veth2 type bond_slave prio -50 196 + ip -d link show veth0 | grep -q 'prio 1000000' 197 + check_err $? "veth0 prio is not 1000000" 198 + ip -d link show veth1 | grep -q 'prio 0' 199 + check_err $? "veth1 prio is not 0" 200 + ip -d link show veth2 | grep -q 'prio -50' 201 + check_err $? "veth3 prio is not -50" 202 + check_active_slave "veth1" 203 + 204 + ip link set $active_slave down 205 + ping $peer_ip4 -c5 -I bond0 &>/dev/null 206 + check_err $? "ping failed 7." 207 + check_active_slave "veth0" 208 + fi 209 + 210 + cleanup 211 + 212 + log_test "prio_test" "Test bonding option 'prio' with mode=$mode monitor=$monitor and primary_reselect=$primary_reselect" 213 + } 214 + 215 + prio_miimon_test() 216 + { 217 + local mode 218 + local primary_reselect 219 + 220 + for mode in 1 5 6; do 221 + for primary_reselect in 0 1 2; do 222 + prio_test "miimon" $mode $primary_reselect 223 + done 224 + done 225 + } 226 + 227 + prio_arp_ip_target_test() 228 + { 229 + local primary_reselect 230 + 231 + for primary_reselect in 0 1 2; do 232 + prio_test "arp_ip_target" 1 $primary_reselect 233 + done 234 + } 235 + 236 + if skip;then 237 + log_test_skip "option_prio.sh" "Current iproute doesn't support 'prio'." 238 + exit 0 239 + fi 240 + 241 + trap cleanup EXIT 242 + 243 + tests_run 244 + 245 + exit "$EXIT_STATUS"
+2 -2
tools/testing/selftests/drivers/net/netdevsim/devlink.sh
··· 496 496 497 497 check_reporter_info dummy healthy 3 3 10 true 498 498 499 - echo 8192> $DEBUGFS_DIR/health/binary_len 500 - check_fail $? "Failed set dummy reporter binary len to 8192" 499 + echo 8192 > $DEBUGFS_DIR/health/binary_len 500 + check_err $? "Failed set dummy reporter binary len to 8192" 501 501 502 502 local dump=$(devlink health dump show $DL_HANDLE reporter dummy -j) 503 503 check_err $? "Failed show dump of dummy reporter"