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

Pull networking fixes from Paolo Abeni:
"Including fixes from bluetooth, can and IPsec.

Current release - regressions:

- net: add net.core.qdisc_max_burst

- can: propagate CAN device capabilities via ml_priv

Previous releases - regressions:

- dst: fix races in rt6_uncached_list_del() and
rt_del_uncached_list()

- ipv6: fix use-after-free in inet6_addr_del().

- xfrm: fix inner mode lookup in tunnel mode GSO segmentation

- ip_tunnel: spread netdev_lockdep_set_classes()

- ip6_tunnel: use skb_vlan_inet_prepare() in __ip6_tnl_rcv()

- bluetooth: hci_sync: enable PA sync lost event

- eth: virtio-net:
- fix the deadlock when disabling rx NAPI
- fix misalignment bug in struct virtnet_info

Previous releases - always broken:

- ipv4: ip_gre: make ipgre_header() robust

- can: fix SSP_SRC in cases when bit-rate is higher than 1 MBit.

- eth:
- mlx5e: profile change fix
- octeon_ep_vf: fix free_irq dev_id mismatch in IRQ rollback
- macvlan: fix possible UAF in macvlan_forward_source()"

* tag 'net-6.19-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (37 commits)
virtio_net: Fix misalignment bug in struct virtnet_info
net: can: j1939: j1939_xtp_rx_rts_session_active(): deactivate session upon receiving the second rts
can: raw: instantly reject disabled CAN frames
can: propagate CAN device capabilities via ml_priv
Revert "can: raw: instantly reject unsupported CAN frames"
net/sched: sch_qfq: do not free existing class in qfq_change_class()
selftests: drv-net: fix RPS mask handling for high CPU numbers
selftests: drv-net: fix RPS mask handling in toeplitz test
ipv6: Fix use-after-free in inet6_addr_del().
dst: fix races in rt6_uncached_list_del() and rt_del_uncached_list()
net: hv_netvsc: reject RSS hash key programming without RX indirection table
tools: ynl: render event op docs correctly
net: add net.core.qdisc_max_burst
net: airoha: Fix typo in airoha_ppe_setup_tc_block_cb definition
net: phy: motorcomm: fix duplex setting error for phy leds
net: octeon_ep_vf: fix free_irq dev_id mismatch in IRQ rollback
net/mlx5e: Restore destroying state bit after profile cleanup
net/mlx5e: Pass netdev to mlx5e_destroy_netdev instead of priv
net/mlx5e: Don't store mlx5e_priv in mlx5e_dev devlink priv
net/mlx5e: Fix crash on profile change rollback failure
...

+381 -293
+8
Documentation/admin-guide/sysctl/net.rst
··· 303 303 Maximum number of packets, queued on the INPUT side, when the interface 304 304 receives packets faster than kernel can process them. 305 305 306 + qdisc_max_burst 307 + ------------------ 308 + 309 + Maximum number of packets that can be temporarily stored before 310 + reaching qdisc. 311 + 312 + Default: 1000 313 + 306 314 netdev_rss_key 307 315 -------------- 308 316
+3 -1
MAINTAINERS
··· 18424 18424 M: Sabrina Dubroca <sd@queasysnail.net> 18425 18425 L: netdev@vger.kernel.org 18426 18426 S: Maintained 18427 + F: Documentation/networking/tls* 18427 18428 F: include/net/tls.h 18428 18429 F: include/uapi/linux/tls.h 18429 - F: net/tls/* 18430 + F: net/tls/ 18431 + F: tools/testing/selftests/net/tls.c 18430 18432 18431 18433 NETWORKING [SOCKETS] 18432 18434 M: Eric Dumazet <edumazet@google.com>
+5 -2
drivers/net/can/Kconfig
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 3 3 menuconfig CAN_DEV 4 - bool "CAN Device Drivers" 4 + tristate "CAN Device Drivers" 5 5 default y 6 6 depends on CAN 7 7 help ··· 17 17 virtual ones. If you own such devices or plan to use the virtual CAN 18 18 interfaces to develop applications, say Y here. 19 19 20 - if CAN_DEV && CAN 20 + To compile as a module, choose M here: the module will be called 21 + can-dev. 22 + 23 + if CAN_DEV 21 24 22 25 config CAN_VCAN 23 26 tristate "Virtual Local CAN Interface (vcan)"
+1 -1
drivers/net/can/Makefile
··· 7 7 obj-$(CONFIG_CAN_VXCAN) += vxcan.o 8 8 obj-$(CONFIG_CAN_SLCAN) += slcan/ 9 9 10 - obj-$(CONFIG_CAN_DEV) += dev/ 10 + obj-y += dev/ 11 11 obj-y += esd/ 12 12 obj-y += rcar/ 13 13 obj-y += rockchip/
+1 -1
drivers/net/can/ctucanfd/ctucanfd_base.c
··· 310 310 } 311 311 312 312 ssp_cfg = FIELD_PREP(REG_TRV_DELAY_SSP_OFFSET, ssp_offset); 313 - ssp_cfg |= FIELD_PREP(REG_TRV_DELAY_SSP_SRC, 0x1); 313 + ssp_cfg |= FIELD_PREP(REG_TRV_DELAY_SSP_SRC, 0x0); 314 314 } 315 315 316 316 ctucan_write32(priv, CTUCANFD_TRV_DELAY, ssp_cfg);
+3 -2
drivers/net/can/dev/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 3 - obj-$(CONFIG_CAN) += can-dev.o 3 + obj-$(CONFIG_CAN_DEV) += can-dev.o 4 4 5 - can-dev-$(CONFIG_CAN_DEV) += skb.o 5 + can-dev-y += skb.o 6 + 6 7 can-dev-$(CONFIG_CAN_CALC_BITTIMING) += calc_bittiming.o 7 8 can-dev-$(CONFIG_CAN_NETLINK) += bittiming.o 8 9 can-dev-$(CONFIG_CAN_NETLINK) += dev.o
+27
drivers/net/can/dev/dev.c
··· 375 375 } 376 376 } 377 377 378 + void can_set_cap_info(struct net_device *dev) 379 + { 380 + struct can_priv *priv = netdev_priv(dev); 381 + u32 can_cap; 382 + 383 + if (can_dev_in_xl_only_mode(priv)) { 384 + /* XL only mode => no CC/FD capability */ 385 + can_cap = CAN_CAP_XL; 386 + } else { 387 + /* mixed mode => CC + FD/XL capability */ 388 + can_cap = CAN_CAP_CC; 389 + 390 + if (priv->ctrlmode & CAN_CTRLMODE_FD) 391 + can_cap |= CAN_CAP_FD; 392 + 393 + if (priv->ctrlmode & CAN_CTRLMODE_XL) 394 + can_cap |= CAN_CAP_XL; 395 + } 396 + 397 + if (priv->ctrlmode & (CAN_CTRLMODE_LISTENONLY | 398 + CAN_CTRLMODE_RESTRICTED)) 399 + can_cap |= CAN_CAP_RO; 400 + 401 + can_set_cap(dev, can_cap); 402 + } 403 + 378 404 /* helper to define static CAN controller features at device creation time */ 379 405 int can_set_static_ctrlmode(struct net_device *dev, u32 static_mode) 380 406 { ··· 416 390 417 391 /* override MTU which was set by default in can_setup()? */ 418 392 can_set_default_mtu(dev); 393 + can_set_cap_info(dev); 419 394 420 395 return 0; 421 396 }
+1
drivers/net/can/dev/netlink.c
··· 377 377 } 378 378 379 379 can_set_default_mtu(dev); 380 + can_set_cap_info(dev); 380 381 381 382 return 0; 382 383 }
+1 -1
drivers/net/can/usb/etas_es58x/es58x_core.c
··· 1736 1736 dev_dbg(dev, "%s: Allocated %d rx URBs each of size %u\n", 1737 1737 __func__, i, rx_buf_len); 1738 1738 1739 - return ret; 1739 + return 0; 1740 1740 } 1741 1741 1742 1742 /**
+2
drivers/net/can/usb/gs_usb.c
··· 751 751 hf, parent->hf_size_rx, 752 752 gs_usb_receive_bulk_callback, parent); 753 753 754 + usb_anchor_urb(urb, &parent->rx_submitted); 755 + 754 756 rc = usb_submit_urb(urb, GFP_ATOMIC); 755 757 756 758 /* USB failure take down all interfaces */
+15
drivers/net/can/vcan.c
··· 130 130 return NETDEV_TX_OK; 131 131 } 132 132 133 + static void vcan_set_cap_info(struct net_device *dev) 134 + { 135 + u32 can_cap = CAN_CAP_CC; 136 + 137 + if (dev->mtu > CAN_MTU) 138 + can_cap |= CAN_CAP_FD; 139 + 140 + if (dev->mtu >= CANXL_MIN_MTU) 141 + can_cap |= CAN_CAP_XL; 142 + 143 + can_set_cap(dev, can_cap); 144 + } 145 + 133 146 static int vcan_change_mtu(struct net_device *dev, int new_mtu) 134 147 { 135 148 /* Do not allow changing the MTU while running */ ··· 154 141 return -EINVAL; 155 142 156 143 WRITE_ONCE(dev->mtu, new_mtu); 144 + vcan_set_cap_info(dev); 157 145 return 0; 158 146 } 159 147 ··· 176 162 dev->tx_queue_len = 0; 177 163 dev->flags = IFF_NOARP; 178 164 can_set_ml_priv(dev, netdev_priv(dev)); 165 + vcan_set_cap_info(dev); 179 166 180 167 /* set flags according to driver capabilities */ 181 168 if (echo)
+15
drivers/net/can/vxcan.c
··· 125 125 return iflink; 126 126 } 127 127 128 + static void vxcan_set_cap_info(struct net_device *dev) 129 + { 130 + u32 can_cap = CAN_CAP_CC; 131 + 132 + if (dev->mtu > CAN_MTU) 133 + can_cap |= CAN_CAP_FD; 134 + 135 + if (dev->mtu >= CANXL_MIN_MTU) 136 + can_cap |= CAN_CAP_XL; 137 + 138 + can_set_cap(dev, can_cap); 139 + } 140 + 128 141 static int vxcan_change_mtu(struct net_device *dev, int new_mtu) 129 142 { 130 143 /* Do not allow changing the MTU while running */ ··· 149 136 return -EINVAL; 150 137 151 138 WRITE_ONCE(dev->mtu, new_mtu); 139 + vxcan_set_cap_info(dev); 152 140 return 0; 153 141 } 154 142 ··· 181 167 182 168 can_ml = netdev_priv(dev) + ALIGN(sizeof(struct vxcan_priv), NETDEV_ALIGN); 183 169 can_set_ml_priv(dev, can_ml); 170 + vxcan_set_cap_info(dev); 184 171 } 185 172 186 173 /* forward declaration for rtnl_create_link() */
+1 -1
drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_main.c
··· 218 218 ioq_irq_err: 219 219 while (i) { 220 220 --i; 221 - free_irq(oct->msix_entries[i].vector, oct); 221 + free_irq(oct->msix_entries[i].vector, oct->ioq_vector[i]); 222 222 } 223 223 return -1; 224 224 }
+8 -5
drivers/net/ethernet/mellanox/mlx5/core/en.h
··· 962 962 }; 963 963 964 964 struct mlx5e_dev { 965 - struct mlx5e_priv *priv; 965 + struct net_device *netdev; 966 966 struct devlink_port dl_port; 967 967 }; 968 968 ··· 1242 1242 mlx5e_create_netdev(struct mlx5_core_dev *mdev, const struct mlx5e_profile *profile); 1243 1243 int mlx5e_attach_netdev(struct mlx5e_priv *priv); 1244 1244 void mlx5e_detach_netdev(struct mlx5e_priv *priv); 1245 - void mlx5e_destroy_netdev(struct mlx5e_priv *priv); 1246 - int mlx5e_netdev_change_profile(struct mlx5e_priv *priv, 1247 - const struct mlx5e_profile *new_profile, void *new_ppriv); 1248 - void mlx5e_netdev_attach_nic_profile(struct mlx5e_priv *priv); 1245 + void mlx5e_destroy_netdev(struct net_device *netdev); 1246 + int mlx5e_netdev_change_profile(struct net_device *netdev, 1247 + struct mlx5_core_dev *mdev, 1248 + const struct mlx5e_profile *new_profile, 1249 + void *new_ppriv); 1250 + void mlx5e_netdev_attach_nic_profile(struct net_device *netdev, 1251 + struct mlx5_core_dev *mdev); 1249 1252 void mlx5e_set_netdev_mtu_boundaries(struct mlx5e_priv *priv); 1250 1253 void mlx5e_build_nic_params(struct mlx5e_priv *priv, struct mlx5e_xsk *xsk, u16 mtu); 1251 1254
+56 -30
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
··· 6325 6325 6326 6326 void mlx5e_priv_cleanup(struct mlx5e_priv *priv) 6327 6327 { 6328 + bool destroying = test_bit(MLX5E_STATE_DESTROYING, &priv->state); 6328 6329 int i; 6329 6330 6330 6331 /* bail if change profile failed and also rollback failed */ ··· 6353 6352 } 6354 6353 6355 6354 memset(priv, 0, sizeof(*priv)); 6355 + if (destroying) /* restore destroying bit, to allow unload */ 6356 + set_bit(MLX5E_STATE_DESTROYING, &priv->state); 6356 6357 } 6357 6358 6358 6359 static unsigned int mlx5e_get_max_num_txqs(struct mlx5_core_dev *mdev, ··· 6587 6584 return err; 6588 6585 } 6589 6586 6590 - int mlx5e_netdev_change_profile(struct mlx5e_priv *priv, 6591 - const struct mlx5e_profile *new_profile, void *new_ppriv) 6587 + int mlx5e_netdev_change_profile(struct net_device *netdev, 6588 + struct mlx5_core_dev *mdev, 6589 + const struct mlx5e_profile *new_profile, 6590 + void *new_ppriv) 6592 6591 { 6593 - const struct mlx5e_profile *orig_profile = priv->profile; 6594 - struct net_device *netdev = priv->netdev; 6595 - struct mlx5_core_dev *mdev = priv->mdev; 6596 - void *orig_ppriv = priv->ppriv; 6592 + struct mlx5e_priv *priv = netdev_priv(netdev); 6593 + const struct mlx5e_profile *orig_profile; 6597 6594 int err, rollback_err; 6595 + void *orig_ppriv; 6598 6596 6599 - /* cleanup old profile */ 6600 - mlx5e_detach_netdev(priv); 6601 - priv->profile->cleanup(priv); 6602 - mlx5e_priv_cleanup(priv); 6597 + orig_profile = priv->profile; 6598 + orig_ppriv = priv->ppriv; 6599 + 6600 + /* NULL could happen if previous change_profile failed to rollback */ 6601 + if (priv->profile) { 6602 + WARN_ON_ONCE(priv->mdev != mdev); 6603 + /* cleanup old profile */ 6604 + mlx5e_detach_netdev(priv); 6605 + priv->profile->cleanup(priv); 6606 + mlx5e_priv_cleanup(priv); 6607 + } 6608 + /* priv members are not valid from this point ... */ 6603 6609 6604 6610 if (mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { 6605 6611 mlx5e_netdev_init_profile(netdev, mdev, new_profile, new_ppriv); ··· 6625 6613 return 0; 6626 6614 6627 6615 rollback: 6616 + if (!orig_profile) { 6617 + netdev_warn(netdev, "no original profile to rollback to\n"); 6618 + priv->profile = NULL; 6619 + return err; 6620 + } 6621 + 6628 6622 rollback_err = mlx5e_netdev_attach_profile(netdev, mdev, orig_profile, orig_ppriv); 6629 - if (rollback_err) 6630 - netdev_err(netdev, "%s: failed to rollback to orig profile, %d\n", 6631 - __func__, rollback_err); 6623 + if (rollback_err) { 6624 + netdev_err(netdev, "failed to rollback to orig profile, %d\n", 6625 + rollback_err); 6626 + priv->profile = NULL; 6627 + } 6632 6628 return err; 6633 6629 } 6634 6630 6635 - void mlx5e_netdev_attach_nic_profile(struct mlx5e_priv *priv) 6631 + void mlx5e_netdev_attach_nic_profile(struct net_device *netdev, 6632 + struct mlx5_core_dev *mdev) 6636 6633 { 6637 - mlx5e_netdev_change_profile(priv, &mlx5e_nic_profile, NULL); 6634 + mlx5e_netdev_change_profile(netdev, mdev, &mlx5e_nic_profile, NULL); 6638 6635 } 6639 6636 6640 - void mlx5e_destroy_netdev(struct mlx5e_priv *priv) 6637 + void mlx5e_destroy_netdev(struct net_device *netdev) 6641 6638 { 6642 - struct net_device *netdev = priv->netdev; 6639 + struct mlx5e_priv *priv = netdev_priv(netdev); 6643 6640 6644 - mlx5e_priv_cleanup(priv); 6641 + if (priv->profile) 6642 + mlx5e_priv_cleanup(priv); 6645 6643 free_netdev(netdev); 6646 6644 } 6647 6645 ··· 6659 6637 { 6660 6638 struct mlx5_adev *edev = container_of(adev, struct mlx5_adev, adev); 6661 6639 struct mlx5e_dev *mlx5e_dev = auxiliary_get_drvdata(adev); 6662 - struct mlx5e_priv *priv = mlx5e_dev->priv; 6663 - struct net_device *netdev = priv->netdev; 6640 + struct mlx5e_priv *priv = netdev_priv(mlx5e_dev->netdev); 6641 + struct net_device *netdev = mlx5e_dev->netdev; 6664 6642 struct mlx5_core_dev *mdev = edev->mdev; 6665 6643 struct mlx5_core_dev *pos, *to; 6666 6644 int err, i; ··· 6706 6684 6707 6685 static int _mlx5e_suspend(struct auxiliary_device *adev, bool pre_netdev_reg) 6708 6686 { 6687 + struct mlx5_adev *edev = container_of(adev, struct mlx5_adev, adev); 6709 6688 struct mlx5e_dev *mlx5e_dev = auxiliary_get_drvdata(adev); 6710 - struct mlx5e_priv *priv = mlx5e_dev->priv; 6711 - struct net_device *netdev = priv->netdev; 6712 - struct mlx5_core_dev *mdev = priv->mdev; 6689 + struct mlx5e_priv *priv = netdev_priv(mlx5e_dev->netdev); 6690 + struct net_device *netdev = mlx5e_dev->netdev; 6691 + struct mlx5_core_dev *mdev = edev->mdev; 6713 6692 struct mlx5_core_dev *pos; 6714 6693 int i; 6715 6694 ··· 6771 6748 goto err_devlink_port_unregister; 6772 6749 } 6773 6750 SET_NETDEV_DEVLINK_PORT(netdev, &mlx5e_dev->dl_port); 6751 + mlx5e_dev->netdev = netdev; 6774 6752 6775 6753 mlx5e_build_nic_netdev(netdev); 6776 6754 6777 6755 priv = netdev_priv(netdev); 6778 - mlx5e_dev->priv = priv; 6779 6756 6780 6757 priv->profile = profile; 6781 6758 priv->ppriv = NULL; ··· 6808 6785 err_profile_cleanup: 6809 6786 profile->cleanup(priv); 6810 6787 err_destroy_netdev: 6811 - mlx5e_destroy_netdev(priv); 6788 + mlx5e_destroy_netdev(netdev); 6812 6789 err_devlink_port_unregister: 6813 6790 mlx5e_devlink_port_unregister(mlx5e_dev); 6814 6791 err_devlink_unregister: ··· 6838 6815 { 6839 6816 struct mlx5_adev *edev = container_of(adev, struct mlx5_adev, adev); 6840 6817 struct mlx5e_dev *mlx5e_dev = auxiliary_get_drvdata(adev); 6841 - struct mlx5e_priv *priv = mlx5e_dev->priv; 6818 + struct net_device *netdev = mlx5e_dev->netdev; 6819 + struct mlx5e_priv *priv = netdev_priv(netdev); 6842 6820 struct mlx5_core_dev *mdev = edev->mdev; 6843 6821 6844 6822 mlx5_core_uplink_netdev_set(mdev, NULL); 6845 - mlx5e_dcbnl_delete_app(priv); 6823 + 6824 + if (priv->profile) 6825 + mlx5e_dcbnl_delete_app(priv); 6846 6826 /* When unload driver, the netdev is in registered state 6847 6827 * if it's from legacy mode. If from switchdev mode, it 6848 6828 * is already unregistered before changing to NIC profile. 6849 6829 */ 6850 - if (priv->netdev->reg_state == NETREG_REGISTERED) { 6851 - unregister_netdev(priv->netdev); 6830 + if (netdev->reg_state == NETREG_REGISTERED) { 6831 + unregister_netdev(netdev); 6852 6832 _mlx5e_suspend(adev, false); 6853 6833 } else { 6854 6834 struct mlx5_core_dev *pos; ··· 6866 6840 /* Avoid cleanup if profile rollback failed. */ 6867 6841 if (priv->profile) 6868 6842 priv->profile->cleanup(priv); 6869 - mlx5e_destroy_netdev(priv); 6843 + mlx5e_destroy_netdev(netdev); 6870 6844 mlx5e_devlink_port_unregister(mlx5e_dev); 6871 6845 mlx5e_destroy_devlink(mlx5e_dev); 6872 6846 }
+7 -8
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
··· 1508 1508 { 1509 1509 struct mlx5e_rep_priv *rpriv = mlx5e_rep_to_rep_priv(rep); 1510 1510 struct net_device *netdev; 1511 - struct mlx5e_priv *priv; 1512 1511 int err; 1513 1512 1514 1513 netdev = mlx5_uplink_netdev_get(dev); 1515 1514 if (!netdev) 1516 1515 return 0; 1517 1516 1518 - priv = netdev_priv(netdev); 1519 - rpriv->netdev = priv->netdev; 1520 - err = mlx5e_netdev_change_profile(priv, &mlx5e_uplink_rep_profile, 1521 - rpriv); 1517 + /* must not use netdev_priv(netdev), it might not be initialized yet */ 1518 + rpriv->netdev = netdev; 1519 + err = mlx5e_netdev_change_profile(netdev, dev, 1520 + &mlx5e_uplink_rep_profile, rpriv); 1522 1521 mlx5_uplink_netdev_put(dev, netdev); 1523 1522 return err; 1524 1523 } ··· 1545 1546 if (!(priv->mdev->priv.flags & MLX5_PRIV_FLAGS_SWITCH_LEGACY)) 1546 1547 unregister_netdev(netdev); 1547 1548 1548 - mlx5e_netdev_attach_nic_profile(priv); 1549 + mlx5e_netdev_attach_nic_profile(netdev, priv->mdev); 1549 1550 } 1550 1551 1551 1552 static int ··· 1611 1612 priv->profile->cleanup(priv); 1612 1613 1613 1614 err_destroy_netdev: 1614 - mlx5e_destroy_netdev(netdev_priv(netdev)); 1615 + mlx5e_destroy_netdev(netdev); 1615 1616 return err; 1616 1617 } 1617 1618 ··· 1666 1667 mlx5e_rep_vnic_reporter_destroy(priv); 1667 1668 mlx5e_detach_netdev(priv); 1668 1669 priv->profile->cleanup(priv); 1669 - mlx5e_destroy_netdev(priv); 1670 + mlx5e_destroy_netdev(netdev); 1670 1671 free_ppriv: 1671 1672 kvfree(ppriv); /* mlx5e_rep_priv */ 1672 1673 }
+3
drivers/net/hyperv/netvsc_drv.c
··· 1750 1750 rxfh->hfunc != ETH_RSS_HASH_TOP) 1751 1751 return -EOPNOTSUPP; 1752 1752 1753 + if (!ndc->rx_table_sz) 1754 + return -EOPNOTSUPP; 1755 + 1753 1756 rndis_dev = ndev->extension; 1754 1757 if (rxfh->indir) { 1755 1758 for (i = 0; i < ndc->rx_table_sz; i++)
+13 -7
drivers/net/macvlan.c
··· 59 59 60 60 struct macvlan_source_entry { 61 61 struct hlist_node hlist; 62 - struct macvlan_dev *vlan; 62 + struct macvlan_dev __rcu *vlan; 63 63 unsigned char addr[6+2] __aligned(sizeof(u16)); 64 64 struct rcu_head rcu; 65 65 }; ··· 146 146 147 147 hlist_for_each_entry_rcu(entry, h, hlist, lockdep_rtnl_is_held()) { 148 148 if (ether_addr_equal_64bits(entry->addr, addr) && 149 - entry->vlan == vlan) 149 + rcu_access_pointer(entry->vlan) == vlan) 150 150 return entry; 151 151 } 152 152 return NULL; ··· 168 168 return -ENOMEM; 169 169 170 170 ether_addr_copy(entry->addr, addr); 171 - entry->vlan = vlan; 171 + RCU_INIT_POINTER(entry->vlan, vlan); 172 172 h = &port->vlan_source_hash[macvlan_eth_hash(addr)]; 173 173 hlist_add_head_rcu(&entry->hlist, h); 174 174 vlan->macaddr_count++; ··· 187 187 188 188 static void macvlan_hash_del_source(struct macvlan_source_entry *entry) 189 189 { 190 + RCU_INIT_POINTER(entry->vlan, NULL); 190 191 hlist_del_rcu(&entry->hlist); 191 192 kfree_rcu(entry, rcu); 192 193 } ··· 391 390 int i; 392 391 393 392 hash_for_each_safe(port->vlan_source_hash, i, next, entry, hlist) 394 - if (entry->vlan == vlan) 393 + if (rcu_access_pointer(entry->vlan) == vlan) 395 394 macvlan_hash_del_source(entry); 396 395 397 396 vlan->macaddr_count = 0; ··· 434 433 435 434 hlist_for_each_entry_rcu(entry, h, hlist) { 436 435 if (ether_addr_equal_64bits(entry->addr, addr)) { 437 - if (entry->vlan->flags & MACVLAN_FLAG_NODST) 436 + struct macvlan_dev *vlan = rcu_dereference(entry->vlan); 437 + 438 + if (!vlan) 439 + continue; 440 + 441 + if (vlan->flags & MACVLAN_FLAG_NODST) 438 442 consume = true; 439 - macvlan_forward_source_one(skb, entry->vlan); 443 + macvlan_forward_source_one(skb, vlan); 440 444 } 441 445 } 442 446 ··· 1686 1680 struct macvlan_source_entry *entry; 1687 1681 1688 1682 hlist_for_each_entry_rcu(entry, h, hlist, lockdep_rtnl_is_held()) { 1689 - if (entry->vlan != vlan) 1683 + if (rcu_access_pointer(entry->vlan) != vlan) 1690 1684 continue; 1691 1685 if (nla_put(skb, IFLA_MACVLAN_MACADDR, ETH_ALEN, entry->addr)) 1692 1686 return 1;
+2 -2
drivers/net/phy/motorcomm.c
··· 1741 1741 val |= YT8521_LED_1000_ON_EN; 1742 1742 1743 1743 if (test_bit(TRIGGER_NETDEV_FULL_DUPLEX, &rules)) 1744 - val |= YT8521_LED_HDX_ON_EN; 1744 + val |= YT8521_LED_FDX_ON_EN; 1745 1745 1746 1746 if (test_bit(TRIGGER_NETDEV_HALF_DUPLEX, &rules)) 1747 - val |= YT8521_LED_FDX_ON_EN; 1747 + val |= YT8521_LED_HDX_ON_EN; 1748 1748 1749 1749 if (test_bit(TRIGGER_NETDEV_TX, &rules) || 1750 1750 test_bit(TRIGGER_NETDEV_RX, &rules))
+43 -132
drivers/net/virtio_net.c
··· 425 425 u16 rss_indir_table_size; 426 426 u32 rss_hash_types_supported; 427 427 u32 rss_hash_types_saved; 428 - struct virtio_net_rss_config_hdr *rss_hdr; 429 - struct virtio_net_rss_config_trailer rss_trailer; 430 - u8 rss_hash_key_data[VIRTIO_NET_RSS_MAX_KEY_SIZE]; 431 428 432 429 /* Has control virtqueue */ 433 430 bool has_cvq; ··· 438 441 /* Packet virtio header size */ 439 442 u8 hdr_len; 440 443 441 - /* Work struct for delayed refilling if we run low on memory. */ 442 - struct delayed_work refill; 443 - 444 444 /* UDP tunnel support */ 445 445 bool tx_tnl; 446 446 447 447 bool rx_tnl; 448 448 449 449 bool rx_tnl_csum; 450 - 451 - /* Is delayed refill enabled? */ 452 - bool refill_enabled; 453 - 454 - /* The lock to synchronize the access to refill_enabled */ 455 - spinlock_t refill_lock; 456 450 457 451 /* Work struct for config space updates */ 458 452 struct work_struct config_work; ··· 481 493 struct failover *failover; 482 494 483 495 u64 device_stats_cap; 496 + 497 + struct virtio_net_rss_config_hdr *rss_hdr; 498 + 499 + /* Must be last as it ends in a flexible-array member. */ 500 + TRAILING_OVERLAP(struct virtio_net_rss_config_trailer, rss_trailer, hash_key_data, 501 + u8 rss_hash_key_data[VIRTIO_NET_RSS_MAX_KEY_SIZE]; 502 + ); 484 503 }; 504 + static_assert(offsetof(struct virtnet_info, rss_trailer.hash_key_data) == 505 + offsetof(struct virtnet_info, rss_hash_key_data)); 485 506 486 507 struct padded_vnet_hdr { 487 508 struct virtio_net_hdr_v1_hash hdr; ··· 715 718 give_pages(rq, buf); 716 719 else 717 720 put_page(virt_to_head_page(buf)); 718 - } 719 - 720 - static void enable_delayed_refill(struct virtnet_info *vi) 721 - { 722 - spin_lock_bh(&vi->refill_lock); 723 - vi->refill_enabled = true; 724 - spin_unlock_bh(&vi->refill_lock); 725 - } 726 - 727 - static void disable_delayed_refill(struct virtnet_info *vi) 728 - { 729 - spin_lock_bh(&vi->refill_lock); 730 - vi->refill_enabled = false; 731 - spin_unlock_bh(&vi->refill_lock); 732 721 } 733 722 734 723 static void enable_rx_mode_work(struct virtnet_info *vi) ··· 2931 2948 napi_disable(napi); 2932 2949 } 2933 2950 2934 - static void refill_work(struct work_struct *work) 2935 - { 2936 - struct virtnet_info *vi = 2937 - container_of(work, struct virtnet_info, refill.work); 2938 - bool still_empty; 2939 - int i; 2940 - 2941 - for (i = 0; i < vi->curr_queue_pairs; i++) { 2942 - struct receive_queue *rq = &vi->rq[i]; 2943 - 2944 - /* 2945 - * When queue API support is added in the future and the call 2946 - * below becomes napi_disable_locked, this driver will need to 2947 - * be refactored. 2948 - * 2949 - * One possible solution would be to: 2950 - * - cancel refill_work with cancel_delayed_work (note: 2951 - * non-sync) 2952 - * - cancel refill_work with cancel_delayed_work_sync in 2953 - * virtnet_remove after the netdev is unregistered 2954 - * - wrap all of the work in a lock (perhaps the netdev 2955 - * instance lock) 2956 - * - check netif_running() and return early to avoid a race 2957 - */ 2958 - napi_disable(&rq->napi); 2959 - still_empty = !try_fill_recv(vi, rq, GFP_KERNEL); 2960 - virtnet_napi_do_enable(rq->vq, &rq->napi); 2961 - 2962 - /* In theory, this can happen: if we don't get any buffers in 2963 - * we will *never* try to fill again. 2964 - */ 2965 - if (still_empty) 2966 - schedule_delayed_work(&vi->refill, HZ/2); 2967 - } 2968 - } 2969 - 2970 2951 static int virtnet_receive_xsk_bufs(struct virtnet_info *vi, 2971 2952 struct receive_queue *rq, 2972 2953 int budget, ··· 2993 3046 else 2994 3047 packets = virtnet_receive_packets(vi, rq, budget, xdp_xmit, &stats); 2995 3048 3049 + u64_stats_set(&stats.packets, packets); 2996 3050 if (rq->vq->num_free > min((unsigned int)budget, virtqueue_get_vring_size(rq->vq)) / 2) { 2997 - if (!try_fill_recv(vi, rq, GFP_ATOMIC)) { 2998 - spin_lock(&vi->refill_lock); 2999 - if (vi->refill_enabled) 3000 - schedule_delayed_work(&vi->refill, 0); 3001 - spin_unlock(&vi->refill_lock); 3002 - } 3051 + if (!try_fill_recv(vi, rq, GFP_ATOMIC)) 3052 + /* We need to retry refilling in the next NAPI poll so 3053 + * we must return budget to make sure the NAPI is 3054 + * repolled. 3055 + */ 3056 + packets = budget; 3003 3057 } 3004 3058 3005 - u64_stats_set(&stats.packets, packets); 3006 3059 u64_stats_update_begin(&rq->stats.syncp); 3007 3060 for (i = 0; i < ARRAY_SIZE(virtnet_rq_stats_desc); i++) { 3008 3061 size_t offset = virtnet_rq_stats_desc[i].offset; ··· 3173 3226 struct virtnet_info *vi = netdev_priv(dev); 3174 3227 int i, err; 3175 3228 3176 - enable_delayed_refill(vi); 3177 - 3178 3229 for (i = 0; i < vi->max_queue_pairs; i++) { 3179 3230 if (i < vi->curr_queue_pairs) 3180 - /* Make sure we have some buffers: if oom use wq. */ 3181 - if (!try_fill_recv(vi, &vi->rq[i], GFP_KERNEL)) 3182 - schedule_delayed_work(&vi->refill, 0); 3231 + /* Pre-fill rq agressively, to make sure we are ready to 3232 + * get packets immediately. 3233 + */ 3234 + try_fill_recv(vi, &vi->rq[i], GFP_KERNEL); 3183 3235 3184 3236 err = virtnet_enable_queue_pair(vi, i); 3185 3237 if (err < 0) ··· 3197 3251 return 0; 3198 3252 3199 3253 err_enable_qp: 3200 - disable_delayed_refill(vi); 3201 - cancel_delayed_work_sync(&vi->refill); 3202 - 3203 3254 for (i--; i >= 0; i--) { 3204 3255 virtnet_disable_queue_pair(vi, i); 3205 3256 virtnet_cancel_dim(vi, &vi->rq[i].dim); ··· 3375 3432 return NETDEV_TX_OK; 3376 3433 } 3377 3434 3378 - static void __virtnet_rx_pause(struct virtnet_info *vi, 3379 - struct receive_queue *rq) 3435 + static void virtnet_rx_pause(struct virtnet_info *vi, 3436 + struct receive_queue *rq) 3380 3437 { 3381 3438 bool running = netif_running(vi->dev); 3382 3439 ··· 3390 3447 { 3391 3448 int i; 3392 3449 3393 - /* 3394 - * Make sure refill_work does not run concurrently to 3395 - * avoid napi_disable race which leads to deadlock. 3396 - */ 3397 - disable_delayed_refill(vi); 3398 - cancel_delayed_work_sync(&vi->refill); 3399 3450 for (i = 0; i < vi->max_queue_pairs; i++) 3400 - __virtnet_rx_pause(vi, &vi->rq[i]); 3451 + virtnet_rx_pause(vi, &vi->rq[i]); 3401 3452 } 3402 3453 3403 - static void virtnet_rx_pause(struct virtnet_info *vi, struct receive_queue *rq) 3454 + static void virtnet_rx_resume(struct virtnet_info *vi, 3455 + struct receive_queue *rq, 3456 + bool refill) 3404 3457 { 3405 - /* 3406 - * Make sure refill_work does not run concurrently to 3407 - * avoid napi_disable race which leads to deadlock. 3408 - */ 3409 - disable_delayed_refill(vi); 3410 - cancel_delayed_work_sync(&vi->refill); 3411 - __virtnet_rx_pause(vi, rq); 3412 - } 3458 + if (netif_running(vi->dev)) { 3459 + /* Pre-fill rq agressively, to make sure we are ready to get 3460 + * packets immediately. 3461 + */ 3462 + if (refill) 3463 + try_fill_recv(vi, rq, GFP_KERNEL); 3413 3464 3414 - static void __virtnet_rx_resume(struct virtnet_info *vi, 3415 - struct receive_queue *rq, 3416 - bool refill) 3417 - { 3418 - bool running = netif_running(vi->dev); 3419 - bool schedule_refill = false; 3420 - 3421 - if (refill && !try_fill_recv(vi, rq, GFP_KERNEL)) 3422 - schedule_refill = true; 3423 - if (running) 3424 3465 virtnet_napi_enable(rq); 3425 - 3426 - if (schedule_refill) 3427 - schedule_delayed_work(&vi->refill, 0); 3466 + } 3428 3467 } 3429 3468 3430 3469 static void virtnet_rx_resume_all(struct virtnet_info *vi) 3431 3470 { 3432 3471 int i; 3433 3472 3434 - enable_delayed_refill(vi); 3435 3473 for (i = 0; i < vi->max_queue_pairs; i++) { 3436 3474 if (i < vi->curr_queue_pairs) 3437 - __virtnet_rx_resume(vi, &vi->rq[i], true); 3475 + virtnet_rx_resume(vi, &vi->rq[i], true); 3438 3476 else 3439 - __virtnet_rx_resume(vi, &vi->rq[i], false); 3477 + virtnet_rx_resume(vi, &vi->rq[i], false); 3440 3478 } 3441 - } 3442 - 3443 - static void virtnet_rx_resume(struct virtnet_info *vi, struct receive_queue *rq) 3444 - { 3445 - enable_delayed_refill(vi); 3446 - __virtnet_rx_resume(vi, rq, true); 3447 3479 } 3448 3480 3449 3481 static int virtnet_rx_resize(struct virtnet_info *vi, ··· 3434 3516 if (err) 3435 3517 netdev_err(vi->dev, "resize rx fail: rx queue index: %d err: %d\n", qindex, err); 3436 3518 3437 - virtnet_rx_resume(vi, rq); 3519 + virtnet_rx_resume(vi, rq, true); 3438 3520 return err; 3439 3521 } 3440 3522 ··· 3747 3829 } 3748 3830 succ: 3749 3831 vi->curr_queue_pairs = queue_pairs; 3750 - /* virtnet_open() will refill when device is going to up. */ 3751 - spin_lock_bh(&vi->refill_lock); 3752 - if (dev->flags & IFF_UP && vi->refill_enabled) 3753 - schedule_delayed_work(&vi->refill, 0); 3754 - spin_unlock_bh(&vi->refill_lock); 3832 + if (dev->flags & IFF_UP) { 3833 + local_bh_disable(); 3834 + for (int i = 0; i < vi->curr_queue_pairs; ++i) 3835 + virtqueue_napi_schedule(&vi->rq[i].napi, vi->rq[i].vq); 3836 + local_bh_enable(); 3837 + } 3755 3838 3756 3839 return 0; 3757 3840 } ··· 3762 3843 struct virtnet_info *vi = netdev_priv(dev); 3763 3844 int i; 3764 3845 3765 - /* Make sure NAPI doesn't schedule refill work */ 3766 - disable_delayed_refill(vi); 3767 - /* Make sure refill_work doesn't re-enable napi! */ 3768 - cancel_delayed_work_sync(&vi->refill); 3769 3846 /* Prevent the config change callback from changing carrier 3770 3847 * after close 3771 3848 */ ··· 5717 5802 5718 5803 virtio_device_ready(vdev); 5719 5804 5720 - enable_delayed_refill(vi); 5721 5805 enable_rx_mode_work(vi); 5722 5806 5723 5807 if (netif_running(vi->dev)) { ··· 5806 5892 5807 5893 rq->xsk_pool = pool; 5808 5894 5809 - virtnet_rx_resume(vi, rq); 5895 + virtnet_rx_resume(vi, rq, true); 5810 5896 5811 5897 if (pool) 5812 5898 return 0; ··· 6473 6559 if (!vi->rq) 6474 6560 goto err_rq; 6475 6561 6476 - INIT_DELAYED_WORK(&vi->refill, refill_work); 6477 6562 for (i = 0; i < vi->max_queue_pairs; i++) { 6478 6563 vi->rq[i].pages = NULL; 6479 6564 netif_napi_add_config(vi->dev, &vi->rq[i].napi, virtnet_poll, ··· 6814 6901 6815 6902 INIT_WORK(&vi->config_work, virtnet_config_changed_work); 6816 6903 INIT_WORK(&vi->rx_mode_work, virtnet_rx_mode_work); 6817 - spin_lock_init(&vi->refill_lock); 6818 6904 6819 6905 if (virtio_has_feature(vdev, VIRTIO_NET_F_MRG_RXBUF)) { 6820 6906 vi->mergeable_rx_bufs = true; ··· 7077 7165 net_failover_destroy(vi->failover); 7078 7166 free_vqs: 7079 7167 virtio_reset_device(vdev); 7080 - cancel_delayed_work_sync(&vi->refill); 7081 7168 free_receive_page_frags(vi); 7082 7169 virtnet_del_vqs(vi); 7083 7170 free:
+24
include/linux/can/can-ml.h
··· 46 46 #include <linux/list.h> 47 47 #include <linux/netdevice.h> 48 48 49 + /* exposed CAN device capabilities for network layer */ 50 + #define CAN_CAP_CC BIT(0) /* CAN CC aka Classical CAN */ 51 + #define CAN_CAP_FD BIT(1) /* CAN FD */ 52 + #define CAN_CAP_XL BIT(2) /* CAN XL */ 53 + #define CAN_CAP_RO BIT(3) /* read-only mode (LISTEN/RESTRICTED) */ 54 + 49 55 #define CAN_SFF_RCV_ARRAY_SZ (1 << CAN_SFF_ID_BITS) 50 56 #define CAN_EFF_RCV_HASH_BITS 10 51 57 #define CAN_EFF_RCV_ARRAY_SZ (1 << CAN_EFF_RCV_HASH_BITS) ··· 70 64 #ifdef CAN_J1939 71 65 struct j1939_priv *j1939_priv; 72 66 #endif 67 + u32 can_cap; 73 68 }; 74 69 75 70 static inline struct can_ml_priv *can_get_ml_priv(struct net_device *dev) ··· 82 75 struct can_ml_priv *ml_priv) 83 76 { 84 77 netdev_set_ml_priv(dev, ml_priv, ML_PRIV_CAN); 78 + } 79 + 80 + static inline bool can_cap_enabled(struct net_device *dev, u32 cap) 81 + { 82 + struct can_ml_priv *can_ml = can_get_ml_priv(dev); 83 + 84 + if (!can_ml) 85 + return false; 86 + 87 + return (can_ml->can_cap & cap); 88 + } 89 + 90 + static inline void can_set_cap(struct net_device *dev, u32 cap) 91 + { 92 + struct can_ml_priv *can_ml = can_get_ml_priv(dev); 93 + 94 + can_ml->can_cap = cap; 85 95 } 86 96 87 97 #endif /* CAN_ML_H */
+1 -7
include/linux/can/dev.h
··· 111 111 void free_candev(struct net_device *dev); 112 112 113 113 /* a candev safe wrapper around netdev_priv */ 114 - #if IS_ENABLED(CONFIG_CAN_NETLINK) 115 114 struct can_priv *safe_candev_priv(struct net_device *dev); 116 - #else 117 - static inline struct can_priv *safe_candev_priv(struct net_device *dev) 118 - { 119 - return NULL; 120 - } 121 - #endif 122 115 123 116 int open_candev(struct net_device *dev); 124 117 void close_candev(struct net_device *dev); 125 118 void can_set_default_mtu(struct net_device *dev); 119 + void can_set_cap_info(struct net_device *dev); 126 120 int __must_check can_set_static_ctrlmode(struct net_device *dev, 127 121 u32 static_mode); 128 122 int can_hwtstamp_get(struct net_device *netdev,
+2 -2
include/linux/soc/airoha/airoha_offload.h
··· 52 52 { 53 53 } 54 54 55 - static inline int airoha_ppe_setup_tc_block_cb(struct airoha_ppe_dev *dev, 56 - void *type_data) 55 + static inline int airoha_ppe_dev_setup_tc_block_cb(struct airoha_ppe_dev *dev, 56 + void *type_data) 57 57 { 58 58 return -EOPNOTSUPP; 59 59 }
+6
include/net/dropreason-core.h
··· 67 67 FN(TC_EGRESS) \ 68 68 FN(SECURITY_HOOK) \ 69 69 FN(QDISC_DROP) \ 70 + FN(QDISC_BURST_DROP) \ 70 71 FN(QDISC_OVERLIMIT) \ 71 72 FN(QDISC_CONGESTED) \ 72 73 FN(CAKE_FLOOD) \ ··· 375 374 * failed to enqueue to current qdisc) 376 375 */ 377 376 SKB_DROP_REASON_QDISC_DROP, 377 + /** 378 + * @SKB_DROP_REASON_QDISC_BURST_DROP: dropped when net.core.qdisc_max_burst 379 + * limit is hit. 380 + */ 381 + SKB_DROP_REASON_QDISC_BURST_DROP, 378 382 /** 379 383 * @SKB_DROP_REASON_QDISC_OVERLIMIT: dropped by qdisc when a qdisc 380 384 * instance exceeds its total buffer size limit.
+1
include/net/hotdata.h
··· 42 42 int netdev_budget_usecs; 43 43 int tstamp_prequeue; 44 44 int max_backlog; 45 + int qdisc_max_burst; 45 46 int dev_tx_weight; 46 47 int dev_rx_weight; 47 48 int sysctl_max_skb_frags;
+12 -1
include/net/ip_tunnels.h
··· 19 19 #include <net/rtnetlink.h> 20 20 #include <net/lwtunnel.h> 21 21 #include <net/dst_cache.h> 22 + #include <net/netdev_lock.h> 22 23 23 24 #if IS_ENABLED(CONFIG_IPV6) 24 25 #include <net/ipv6.h> ··· 373 372 fl4->flowi4_flags = flow_flags; 374 373 } 375 374 376 - int ip_tunnel_init(struct net_device *dev); 375 + int __ip_tunnel_init(struct net_device *dev); 376 + #define ip_tunnel_init(DEV) \ 377 + ({ \ 378 + struct net_device *__dev = (DEV); \ 379 + int __res = __ip_tunnel_init(__dev); \ 380 + \ 381 + if (!__res) \ 382 + netdev_lockdep_set_classes(__dev);\ 383 + __res; \ 384 + }) 385 + 377 386 void ip_tunnel_uninit(struct net_device *dev); 378 387 void ip_tunnel_dellink(struct net_device *dev, struct list_head *head); 379 388 struct net *ip_tunnel_get_link_net(const struct net_device *dev);
+1
net/bluetooth/hci_sync.c
··· 4420 4420 if (bis_capable(hdev)) { 4421 4421 events[1] |= 0x20; /* LE PA Report */ 4422 4422 events[1] |= 0x40; /* LE PA Sync Established */ 4423 + events[1] |= 0x80; /* LE PA Sync Lost */ 4423 4424 events[3] |= 0x04; /* LE Create BIG Complete */ 4424 4425 events[3] |= 0x08; /* LE Terminate BIG Complete */ 4425 4426 events[3] |= 0x10; /* LE BIG Sync Established */
+16 -12
net/bridge/br_fdb.c
··· 70 70 { 71 71 return !test_bit(BR_FDB_STATIC, &fdb->flags) && 72 72 !test_bit(BR_FDB_ADDED_BY_EXT_LEARN, &fdb->flags) && 73 - time_before_eq(fdb->updated + hold_time(br), jiffies); 73 + time_before_eq(READ_ONCE(fdb->updated) + hold_time(br), jiffies); 74 74 } 75 75 76 76 static int fdb_to_nud(const struct net_bridge *br, ··· 126 126 if (nla_put_u32(skb, NDA_FLAGS_EXT, ext_flags)) 127 127 goto nla_put_failure; 128 128 129 - ci.ndm_used = jiffies_to_clock_t(now - fdb->used); 129 + ci.ndm_used = jiffies_to_clock_t(now - READ_ONCE(fdb->used)); 130 130 ci.ndm_confirmed = 0; 131 - ci.ndm_updated = jiffies_to_clock_t(now - fdb->updated); 131 + ci.ndm_updated = jiffies_to_clock_t(now - READ_ONCE(fdb->updated)); 132 132 ci.ndm_refcnt = 0; 133 133 if (nla_put(skb, NDA_CACHEINFO, sizeof(ci), &ci)) 134 134 goto nla_put_failure; ··· 551 551 */ 552 552 rcu_read_lock(); 553 553 hlist_for_each_entry_rcu(f, &br->fdb_list, fdb_node) { 554 - unsigned long this_timer = f->updated + delay; 554 + unsigned long this_timer = READ_ONCE(f->updated) + delay; 555 555 556 556 if (test_bit(BR_FDB_STATIC, &f->flags) || 557 557 test_bit(BR_FDB_ADDED_BY_EXT_LEARN, &f->flags)) { ··· 924 924 { 925 925 struct net_bridge_fdb_entry *f; 926 926 struct __fdb_entry *fe = buf; 927 + unsigned long delta; 927 928 int num = 0; 928 929 929 930 memset(buf, 0, maxnum*sizeof(struct __fdb_entry)); ··· 954 953 fe->port_hi = f->dst->port_no >> 8; 955 954 956 955 fe->is_local = test_bit(BR_FDB_LOCAL, &f->flags); 957 - if (!test_bit(BR_FDB_STATIC, &f->flags)) 958 - fe->ageing_timer_value = jiffies_delta_to_clock_t(jiffies - f->updated); 956 + if (!test_bit(BR_FDB_STATIC, &f->flags)) { 957 + delta = jiffies - READ_ONCE(f->updated); 958 + fe->ageing_timer_value = 959 + jiffies_delta_to_clock_t(delta); 960 + } 959 961 ++fe; 960 962 ++num; 961 963 } ··· 1006 1002 unsigned long now = jiffies; 1007 1003 bool fdb_modified = false; 1008 1004 1009 - if (now != fdb->updated) { 1010 - fdb->updated = now; 1005 + if (now != READ_ONCE(fdb->updated)) { 1006 + WRITE_ONCE(fdb->updated, now); 1011 1007 fdb_modified = __fdb_mark_active(fdb); 1012 1008 } 1013 1009 ··· 1246 1242 if (fdb_handle_notify(fdb, notify)) 1247 1243 modified = true; 1248 1244 1249 - fdb->used = jiffies; 1245 + WRITE_ONCE(fdb->used, jiffies); 1250 1246 if (modified) { 1251 1247 if (refresh) 1252 - fdb->updated = jiffies; 1248 + WRITE_ONCE(fdb->updated, jiffies); 1253 1249 fdb_notify(br, fdb, RTM_NEWNEIGH, true); 1254 1250 } 1255 1251 ··· 1560 1556 goto err_unlock; 1561 1557 } 1562 1558 1563 - fdb->updated = jiffies; 1559 + WRITE_ONCE(fdb->updated, jiffies); 1564 1560 1565 1561 if (READ_ONCE(fdb->dst) != p) { 1566 1562 WRITE_ONCE(fdb->dst, p); ··· 1569 1565 1570 1566 if (test_and_set_bit(BR_FDB_ADDED_BY_EXT_LEARN, &fdb->flags)) { 1571 1567 /* Refresh entry */ 1572 - fdb->used = jiffies; 1568 + WRITE_ONCE(fdb->used, jiffies); 1573 1569 } else { 1574 1570 modified = true; 1575 1571 }
+2 -2
net/bridge/br_input.c
··· 221 221 if (test_bit(BR_FDB_LOCAL, &dst->flags)) 222 222 return br_pass_frame_up(skb, false); 223 223 224 - if (now != dst->used) 225 - dst->used = now; 224 + if (now != READ_ONCE(dst->used)) 225 + WRITE_ONCE(dst->used, now); 226 226 br_forward(dst->dst, skb, local_rcv, false); 227 227 } else { 228 228 if (!mcast_hit)
+9 -1
net/can/j1939/transport.c
··· 1695 1695 1696 1696 j1939_session_timers_cancel(session); 1697 1697 j1939_session_cancel(session, J1939_XTP_ABORT_BUSY); 1698 - if (session->transmission) 1698 + if (session->transmission) { 1699 1699 j1939_session_deactivate_activate_next(session); 1700 + } else if (session->state == J1939_SESSION_WAITING_ABORT) { 1701 + /* Force deactivation for the receiver. 1702 + * If we rely on the timer starting in j1939_session_cancel, 1703 + * a second RTS call here will cancel that timer and fail 1704 + * to restart it because the state is already WAITING_ABORT. 1705 + */ 1706 + j1939_session_deactivate_activate_next(session); 1707 + } 1700 1708 1701 1709 return -EBUSY; 1702 1710 }
+10 -41
net/can/raw.c
··· 49 49 #include <linux/if_arp.h> 50 50 #include <linux/skbuff.h> 51 51 #include <linux/can.h> 52 + #include <linux/can/can-ml.h> 52 53 #include <linux/can/core.h> 53 - #include <linux/can/dev.h> /* for can_is_canxl_dev_mtu() */ 54 54 #include <linux/can/skb.h> 55 55 #include <linux/can/raw.h> 56 56 #include <net/sock.h> ··· 892 892 } 893 893 } 894 894 895 - static inline bool raw_dev_cc_enabled(struct net_device *dev, 896 - struct can_priv *priv) 897 - { 898 - /* The CANXL-only mode disables error-signalling on the CAN bus 899 - * which is needed to send CAN CC/FD frames 900 - */ 901 - if (priv) 902 - return !can_dev_in_xl_only_mode(priv); 903 - 904 - /* virtual CAN interfaces always support CAN CC */ 905 - return true; 906 - } 907 - 908 - static inline bool raw_dev_fd_enabled(struct net_device *dev, 909 - struct can_priv *priv) 910 - { 911 - /* check FD ctrlmode on real CAN interfaces */ 912 - if (priv) 913 - return (priv->ctrlmode & CAN_CTRLMODE_FD); 914 - 915 - /* check MTU for virtual CAN FD interfaces */ 916 - return (READ_ONCE(dev->mtu) >= CANFD_MTU); 917 - } 918 - 919 - static inline bool raw_dev_xl_enabled(struct net_device *dev, 920 - struct can_priv *priv) 921 - { 922 - /* check XL ctrlmode on real CAN interfaces */ 923 - if (priv) 924 - return (priv->ctrlmode & CAN_CTRLMODE_XL); 925 - 926 - /* check MTU for virtual CAN XL interfaces */ 927 - return can_is_canxl_dev_mtu(READ_ONCE(dev->mtu)); 928 - } 929 - 930 895 static unsigned int raw_check_txframe(struct raw_sock *ro, struct sk_buff *skb, 931 896 struct net_device *dev) 932 897 { 933 - struct can_priv *priv = safe_candev_priv(dev); 934 - 935 898 /* Classical CAN */ 936 - if (can_is_can_skb(skb) && raw_dev_cc_enabled(dev, priv)) 899 + if (can_is_can_skb(skb) && can_cap_enabled(dev, CAN_CAP_CC)) 937 900 return CAN_MTU; 938 901 939 902 /* CAN FD */ 940 903 if (ro->fd_frames && can_is_canfd_skb(skb) && 941 - raw_dev_fd_enabled(dev, priv)) 904 + can_cap_enabled(dev, CAN_CAP_FD)) 942 905 return CANFD_MTU; 943 906 944 907 /* CAN XL */ 945 908 if (ro->xl_frames && can_is_canxl_skb(skb) && 946 - raw_dev_xl_enabled(dev, priv)) 909 + can_cap_enabled(dev, CAN_CAP_XL)) 947 910 return CANXL_MTU; 948 911 949 912 return 0; ··· 944 981 dev = dev_get_by_index(sock_net(sk), ifindex); 945 982 if (!dev) 946 983 return -ENXIO; 984 + 985 + /* no sending on a CAN device in read-only mode */ 986 + if (can_cap_enabled(dev, CAN_CAP_RO)) { 987 + err = -EACCES; 988 + goto put_dev; 989 + } 947 990 948 991 skb = sock_alloc_send_skb(sk, size + sizeof(struct can_skb_priv), 949 992 msg->msg_flags & MSG_DONTWAIT, &err);
+22 -9
net/core/dev.c
··· 478 478 ARPHRD_IEEE1394, ARPHRD_EUI64, ARPHRD_INFINIBAND, ARPHRD_SLIP, 479 479 ARPHRD_CSLIP, ARPHRD_SLIP6, ARPHRD_CSLIP6, ARPHRD_RSRVD, 480 480 ARPHRD_ADAPT, ARPHRD_ROSE, ARPHRD_X25, ARPHRD_HWX25, 481 + ARPHRD_CAN, ARPHRD_MCTP, 481 482 ARPHRD_PPP, ARPHRD_CISCO, ARPHRD_LAPB, ARPHRD_DDCMP, 482 - ARPHRD_RAWHDLC, ARPHRD_TUNNEL, ARPHRD_TUNNEL6, ARPHRD_FRAD, 483 + ARPHRD_RAWHDLC, ARPHRD_RAWIP, 484 + ARPHRD_TUNNEL, ARPHRD_TUNNEL6, ARPHRD_FRAD, 483 485 ARPHRD_SKIP, ARPHRD_LOOPBACK, ARPHRD_LOCALTLK, ARPHRD_FDDI, 484 486 ARPHRD_BIF, ARPHRD_SIT, ARPHRD_IPDDP, ARPHRD_IPGRE, 485 487 ARPHRD_PIMREG, ARPHRD_HIPPI, ARPHRD_ASH, ARPHRD_ECONET, 486 488 ARPHRD_IRDA, ARPHRD_FCPP, ARPHRD_FCAL, ARPHRD_FCPL, 487 489 ARPHRD_FCFABRIC, ARPHRD_IEEE80211, ARPHRD_IEEE80211_PRISM, 488 - ARPHRD_IEEE80211_RADIOTAP, ARPHRD_PHONET, ARPHRD_PHONET_PIPE, 489 - ARPHRD_IEEE802154, ARPHRD_VOID, ARPHRD_NONE}; 490 + ARPHRD_IEEE80211_RADIOTAP, 491 + ARPHRD_IEEE802154, ARPHRD_IEEE802154_MONITOR, 492 + ARPHRD_PHONET, ARPHRD_PHONET_PIPE, 493 + ARPHRD_CAIF, ARPHRD_IP6GRE, ARPHRD_NETLINK, ARPHRD_6LOWPAN, 494 + ARPHRD_VSOCKMON, 495 + ARPHRD_VOID, ARPHRD_NONE}; 490 496 491 497 static const char *const netdev_lock_name[] = { 492 498 "_xmit_NETROM", "_xmit_ETHER", "_xmit_EETHER", "_xmit_AX25", ··· 501 495 "_xmit_IEEE1394", "_xmit_EUI64", "_xmit_INFINIBAND", "_xmit_SLIP", 502 496 "_xmit_CSLIP", "_xmit_SLIP6", "_xmit_CSLIP6", "_xmit_RSRVD", 503 497 "_xmit_ADAPT", "_xmit_ROSE", "_xmit_X25", "_xmit_HWX25", 498 + "_xmit_CAN", "_xmit_MCTP", 504 499 "_xmit_PPP", "_xmit_CISCO", "_xmit_LAPB", "_xmit_DDCMP", 505 - "_xmit_RAWHDLC", "_xmit_TUNNEL", "_xmit_TUNNEL6", "_xmit_FRAD", 500 + "_xmit_RAWHDLC", "_xmit_RAWIP", 501 + "_xmit_TUNNEL", "_xmit_TUNNEL6", "_xmit_FRAD", 506 502 "_xmit_SKIP", "_xmit_LOOPBACK", "_xmit_LOCALTLK", "_xmit_FDDI", 507 503 "_xmit_BIF", "_xmit_SIT", "_xmit_IPDDP", "_xmit_IPGRE", 508 504 "_xmit_PIMREG", "_xmit_HIPPI", "_xmit_ASH", "_xmit_ECONET", 509 505 "_xmit_IRDA", "_xmit_FCPP", "_xmit_FCAL", "_xmit_FCPL", 510 506 "_xmit_FCFABRIC", "_xmit_IEEE80211", "_xmit_IEEE80211_PRISM", 511 - "_xmit_IEEE80211_RADIOTAP", "_xmit_PHONET", "_xmit_PHONET_PIPE", 512 - "_xmit_IEEE802154", "_xmit_VOID", "_xmit_NONE"}; 507 + "_xmit_IEEE80211_RADIOTAP", 508 + "_xmit_IEEE802154", "_xmit_IEEE802154_MONITOR", 509 + "_xmit_PHONET", "_xmit_PHONET_PIPE", 510 + "_xmit_CAIF", "_xmit_IP6GRE", "_xmit_NETLINK", "_xmit_6LOWPAN", 511 + "_xmit_VSOCKMON", 512 + "_xmit_VOID", "_xmit_NONE"}; 513 513 514 514 static struct lock_class_key netdev_xmit_lock_key[ARRAY_SIZE(netdev_lock_type)]; 515 515 static struct lock_class_key netdev_addr_lock_key[ARRAY_SIZE(netdev_lock_type)]; ··· 528 516 if (netdev_lock_type[i] == dev_type) 529 517 return i; 530 518 /* the last key is used by default */ 519 + WARN_ONCE(1, "netdev_lock_pos() could not find dev_type=%u\n", dev_type); 531 520 return ARRAY_SIZE(netdev_lock_type) - 1; 532 521 } 533 522 ··· 4203 4190 do { 4204 4191 if (first_n && !defer_count) { 4205 4192 defer_count = atomic_long_inc_return(&q->defer_count); 4206 - if (unlikely(defer_count > READ_ONCE(q->limit))) { 4207 - kfree_skb_reason(skb, SKB_DROP_REASON_QDISC_DROP); 4193 + if (unlikely(defer_count > READ_ONCE(net_hotdata.qdisc_max_burst))) { 4194 + kfree_skb_reason(skb, SKB_DROP_REASON_QDISC_BURST_DROP); 4208 4195 return NET_XMIT_DROP; 4209 4196 } 4210 4197 } ··· 4222 4209 ll_list = llist_del_all(&q->defer_list); 4223 4210 /* There is a small race because we clear defer_count not atomically 4224 4211 * with the prior llist_del_all(). This means defer_list could grow 4225 - * over q->limit. 4212 + * over qdisc_max_burst. 4226 4213 */ 4227 4214 atomic_long_set(&q->defer_count, 0); 4228 4215
+1
net/core/dst.c
··· 68 68 dst->lwtstate = NULL; 69 69 rcuref_init(&dst->__rcuref, 1); 70 70 INIT_LIST_HEAD(&dst->rt_uncached); 71 + dst->rt_uncached_list = NULL; 71 72 dst->__use = 0; 72 73 dst->lastuse = jiffies; 73 74 dst->flags = flags;
+1
net/core/hotdata.c
··· 17 17 18 18 .tstamp_prequeue = 1, 19 19 .max_backlog = 1000, 20 + .qdisc_max_burst = 1000, 20 21 .dev_tx_weight = 64, 21 22 .dev_rx_weight = 64, 22 23 .sysctl_max_skb_frags = MAX_SKB_FRAGS,
+7
net/core/sysctl_net_core.c
··· 430 430 .proc_handler = proc_dointvec 431 431 }, 432 432 { 433 + .procname = "qdisc_max_burst", 434 + .data = &net_hotdata.qdisc_max_burst, 435 + .maxlen = sizeof(int), 436 + .mode = 0644, 437 + .proc_handler = proc_dointvec 438 + }, 439 + { 433 440 .procname = "netdev_rss_key", 434 441 .data = &netdev_rss_key, 435 442 .maxlen = sizeof(int),
+2 -2
net/ipv4/esp4_offload.c
··· 122 122 struct sk_buff *skb, 123 123 netdev_features_t features) 124 124 { 125 - const struct xfrm_mode *inner_mode = xfrm_ip2inner_mode(x, 126 - XFRM_MODE_SKB_CB(skb)->protocol); 125 + struct xfrm_offload *xo = xfrm_offload(skb); 126 + const struct xfrm_mode *inner_mode = xfrm_ip2inner_mode(x, xo->proto); 127 127 __be16 type = inner_mode->family == AF_INET6 ? htons(ETH_P_IPV6) 128 128 : htons(ETH_P_IP); 129 129
+9 -2
net/ipv4/ip_gre.c
··· 891 891 const void *daddr, const void *saddr, unsigned int len) 892 892 { 893 893 struct ip_tunnel *t = netdev_priv(dev); 894 - struct iphdr *iph; 895 894 struct gre_base_hdr *greh; 895 + struct iphdr *iph; 896 + int needed; 896 897 897 - iph = skb_push(skb, t->hlen + sizeof(*iph)); 898 + needed = t->hlen + sizeof(*iph); 899 + if (skb_headroom(skb) < needed && 900 + pskb_expand_head(skb, HH_DATA_ALIGN(needed - skb_headroom(skb)), 901 + 0, GFP_ATOMIC)) 902 + return -needed; 903 + 904 + iph = skb_push(skb, needed); 898 905 greh = (struct gre_base_hdr *)(iph+1); 899 906 greh->flags = gre_tnl_flags_to_gre_flags(t->parms.o_flags); 900 907 greh->protocol = htons(type);
+2 -3
net/ipv4/ip_tunnel.c
··· 1281 1281 } 1282 1282 EXPORT_SYMBOL_GPL(ip_tunnel_changelink); 1283 1283 1284 - int ip_tunnel_init(struct net_device *dev) 1284 + int __ip_tunnel_init(struct net_device *dev) 1285 1285 { 1286 1286 struct ip_tunnel *tunnel = netdev_priv(dev); 1287 1287 struct iphdr *iph = &tunnel->parms.iph; ··· 1308 1308 1309 1309 if (tunnel->collect_md) 1310 1310 netif_keep_dst(dev); 1311 - netdev_lockdep_set_classes(dev); 1312 1311 return 0; 1313 1312 } 1314 - EXPORT_SYMBOL_GPL(ip_tunnel_init); 1313 + EXPORT_SYMBOL_GPL(__ip_tunnel_init); 1315 1314 1316 1315 void ip_tunnel_uninit(struct net_device *dev) 1317 1316 {
+2 -2
net/ipv4/route.c
··· 1537 1537 1538 1538 void rt_del_uncached_list(struct rtable *rt) 1539 1539 { 1540 - if (!list_empty(&rt->dst.rt_uncached)) { 1541 - struct uncached_list *ul = rt->dst.rt_uncached_list; 1540 + struct uncached_list *ul = rt->dst.rt_uncached_list; 1542 1541 1542 + if (ul) { 1543 1543 spin_lock_bh(&ul->lock); 1544 1544 list_del_init(&rt->dst.rt_uncached); 1545 1545 spin_unlock_bh(&ul->lock);
+2 -2
net/ipv6/addrconf.c
··· 3112 3112 in6_ifa_hold(ifp); 3113 3113 read_unlock_bh(&idev->lock); 3114 3114 3115 - ipv6_del_addr(ifp); 3116 - 3117 3115 if (!(ifp->flags & IFA_F_TEMPORARY) && 3118 3116 (ifp->flags & IFA_F_MANAGETEMPADDR)) 3119 3117 delete_tempaddrs(idev, ifp); 3118 + 3119 + ipv6_del_addr(ifp); 3120 3120 3121 3121 addrconf_verify_rtnl(net); 3122 3122 if (ipv6_addr_is_multicast(pfx)) {
+2 -2
net/ipv6/esp6_offload.c
··· 158 158 struct sk_buff *skb, 159 159 netdev_features_t features) 160 160 { 161 - const struct xfrm_mode *inner_mode = xfrm_ip2inner_mode(x, 162 - XFRM_MODE_SKB_CB(skb)->protocol); 161 + struct xfrm_offload *xo = xfrm_offload(skb); 162 + const struct xfrm_mode *inner_mode = xfrm_ip2inner_mode(x, xo->proto); 163 163 __be16 type = inner_mode->family == AF_INET ? htons(ETH_P_IP) 164 164 : htons(ETH_P_IPV6); 165 165
+1 -1
net/ipv6/ip6_tunnel.c
··· 844 844 845 845 skb_reset_network_header(skb); 846 846 847 - if (!pskb_inet_may_pull(skb)) { 847 + if (skb_vlan_inet_prepare(skb, true)) { 848 848 DEV_STATS_INC(tunnel->dev, rx_length_errors); 849 849 DEV_STATS_INC(tunnel->dev, rx_errors); 850 850 goto drop;
+2 -2
net/ipv6/route.c
··· 148 148 149 149 void rt6_uncached_list_del(struct rt6_info *rt) 150 150 { 151 - if (!list_empty(&rt->dst.rt_uncached)) { 152 - struct uncached_list *ul = rt->dst.rt_uncached_list; 151 + struct uncached_list *ul = rt->dst.rt_uncached_list; 153 152 153 + if (ul) { 154 154 spin_lock_bh(&ul->lock); 155 155 list_del_init(&rt->dst.rt_uncached); 156 156 spin_unlock_bh(&ul->lock);
+4 -2
net/sched/sch_qfq.c
··· 529 529 return 0; 530 530 531 531 destroy_class: 532 - qdisc_put(cl->qdisc); 533 - kfree(cl); 532 + if (!existing) { 533 + qdisc_put(cl->qdisc); 534 + kfree(cl); 535 + } 534 536 return err; 535 537 } 536 538
+1
net/xfrm/xfrm_state.c
··· 3151 3151 int err; 3152 3152 3153 3153 if (family == AF_INET && 3154 + (!x->dir || x->dir == XFRM_SA_DIR_OUT) && 3154 3155 READ_ONCE(xs_net(x)->ipv4.sysctl_ip_no_pmtu_disc)) 3155 3156 x->props.flags |= XFRM_STATE_NOPMTUDISC; 3156 3157
+6 -3
tools/net/ynl/pyynl/lib/doc_generator.py
··· 166 166 continue 167 167 lines.append(self.fmt.rst_paragraph(self.fmt.bold(key), level + 1)) 168 168 if key in ['request', 'reply']: 169 - lines.append(self.parse_do_attributes(do_dict[key], level + 1) + "\n") 169 + lines.append(self.parse_op_attributes(do_dict[key], level + 1) + "\n") 170 170 else: 171 171 lines.append(self.fmt.headroom(level + 2) + do_dict[key] + "\n") 172 172 173 173 return "\n".join(lines) 174 174 175 - def parse_do_attributes(self, attrs: Dict[str, Any], level: int = 0) -> str: 175 + def parse_op_attributes(self, attrs: Dict[str, Any], level: int = 0) -> str: 176 176 """Parse 'attributes' section""" 177 177 if "attributes" not in attrs: 178 178 return "" ··· 184 184 185 185 def parse_operations(self, operations: List[Dict[str, Any]], namespace: str) -> str: 186 186 """Parse operations block""" 187 - preprocessed = ["name", "doc", "title", "do", "dump", "flags"] 187 + preprocessed = ["name", "doc", "title", "do", "dump", "flags", "event"] 188 188 linkable = ["fixed-header", "attribute-set"] 189 189 lines = [] 190 190 ··· 217 217 if "dump" in operation: 218 218 lines.append(self.fmt.rst_paragraph(":dump:", 0)) 219 219 lines.append(self.parse_do(operation["dump"], 0)) 220 + if "event" in operation: 221 + lines.append(self.fmt.rst_paragraph(":event:", 0)) 222 + lines.append(self.parse_op_attributes(operation["event"], 0)) 220 223 221 224 # New line after fields 222 225 lines.append("\n")
+2 -2
tools/testing/selftests/drivers/net/hw/toeplitz.c
··· 485 485 486 486 bitmap = strtoul(arg, NULL, 0); 487 487 488 - if (bitmap & ~(RPS_MAX_CPUS - 1)) 489 - error(1, 0, "rps bitmap 0x%lx out of bounds 0..%lu", 488 + if (bitmap & ~((1UL << RPS_MAX_CPUS) - 1)) 489 + error(1, 0, "rps bitmap 0x%lx out of bounds, max cpu %lu", 490 490 bitmap, RPS_MAX_CPUS - 1); 491 491 492 492 for (i = 0; i < RPS_MAX_CPUS; i++)
+4 -2
tools/testing/selftests/drivers/net/hw/toeplitz.py
··· 94 94 mask = 0 95 95 for cpu in rps_cpus: 96 96 mask |= (1 << cpu) 97 - mask = hex(mask)[2:] 97 + 98 + mask = hex(mask) 98 99 99 100 # Set RPS bitmap for all rx queues 100 101 for rps_file in glob.glob(f"/sys/class/net/{cfg.ifname}/queues/rx-*/rps_cpus"): 101 102 with open(rps_file, "w", encoding="utf-8") as fp: 102 - fp.write(mask) 103 + # sysfs expects hex without '0x' prefix, toeplitz.c needs the prefix 104 + fp.write(mask[2:]) 103 105 104 106 return mask 105 107
+12
tools/testing/vsock/util.c
··· 511 511 512 512 printf("ok\n"); 513 513 } 514 + 515 + printf("All tests have been executed. Waiting other peer..."); 516 + fflush(stdout); 517 + 518 + /* 519 + * Final full barrier, to ensure that all tests have been run and 520 + * that even the last one has been successful on both sides. 521 + */ 522 + control_writeln("COMPLETED"); 523 + control_expectln("COMPLETED"); 524 + 525 + printf("ok\n"); 514 526 } 515 527 516 528 void list_tests(const struct test_case *test_cases)