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

Pull networking fixes from Jakub Kicinski:
"Including fixes from BPF and big collection of fixes for WiFi core and
drivers.

Current release - regressions:

- vxlan: fix regression when dropping packets due to invalid src
addresses

- bpf: fix a potential use-after-free in bpf_link_free()

- xdp: revert support for redirect to any xsk socket bound to the
same UMEM as it can result in a corruption

- virtio_net:
- add missing lock protection when reading return code from
control_buf
- fix false-positive lockdep splat in DIM
- Revert "wifi: wilc1000: convert list management to RCU"

- wifi: ath11k: fix error path in ath11k_pcic_ext_irq_config

Previous releases - regressions:

- rtnetlink: make the "split" NLM_DONE handling generic, restore the
old behavior for two cases where we started coalescing those
messages with normal messages, breaking sloppily-coded userspace

- wifi:
- cfg80211: validate HE operation element parsing
- cfg80211: fix 6 GHz scan request building
- mt76: mt7615: add missing chanctx ops
- ath11k: move power type check to ASSOC stage, fix connecting to
6 GHz AP
- ath11k: fix WCN6750 firmware crash caused by 17 num_vdevs
- rtlwifi: ignore IEEE80211_CONF_CHANGE_RETRY_LIMITS
- iwlwifi: mvm: fix a crash on 7265

Previous releases - always broken:

- ncsi: prevent multi-threaded channel probing, a spec violation

- vmxnet3: disable rx data ring on dma allocation failure

- ethtool: init tsinfo stats if requested, prevent unintentionally
reporting all-zero stats on devices which don't implement any

- dst_cache: fix possible races in less common IPv6 features

- tcp: auth: don't consider TCP_CLOSE to be in TCP_AO_ESTABLISHED

- ax25: fix two refcounting bugs

- eth: ionic: fix kernel panic in XDP_TX action

Misc:

- tcp: count CLOSE-WAIT sockets for TCP_MIB_CURRESTAB"

* tag 'net-6.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (107 commits)
selftests: net: lib: set 'i' as local
selftests: net: lib: avoid error removing empty netns name
selftests: net: lib: support errexit with busywait
net: ethtool: fix the error condition in ethtool_get_phy_stats_ethtool()
ipv6: fix possible race in __fib6_drop_pcpu_from()
af_unix: Annotate data-race of sk->sk_shutdown in sk_diag_fill().
af_unix: Use skb_queue_len_lockless() in sk_diag_show_rqlen().
af_unix: Use skb_queue_empty_lockless() in unix_release_sock().
af_unix: Use unix_recvq_full_lockless() in unix_stream_connect().
af_unix: Annotate data-race of net->unx.sysctl_max_dgram_qlen.
af_unix: Annotate data-races around sk->sk_sndbuf.
af_unix: Annotate data-races around sk->sk_state in UNIX_DIAG.
af_unix: Annotate data-race of sk->sk_state in unix_stream_read_skb().
af_unix: Annotate data-races around sk->sk_state in sendmsg() and recvmsg().
af_unix: Annotate data-race of sk->sk_state in unix_accept().
af_unix: Annotate data-race of sk->sk_state in unix_stream_connect().
af_unix: Annotate data-races around sk->sk_state in unix_write_space() and poll().
af_unix: Annotate data-race of sk->sk_state in unix_inq_len().
af_unix: Annodate data-races around sk->sk_state for writers.
af_unix: Set sk->sk_state under unix_state_lock() for truly disconencted peer.
...

+1092 -582
+13 -18
Documentation/networking/af_xdp.rst
··· 329 329 sxdp_shared_umem_fd field as you registered the UMEM on that 330 330 socket. These two sockets will now share one and the same UMEM. 331 331 332 - In this case, it is possible to use the NIC's packet steering 333 - capabilities to steer the packets to the right queue. This is not 334 - possible in the previous example as there is only one queue shared 335 - among sockets, so the NIC cannot do this steering as it can only steer 336 - between queues. 332 + There is no need to supply an XDP program like the one in the previous 333 + case where sockets were bound to the same queue id and 334 + device. Instead, use the NIC's packet steering capabilities to steer 335 + the packets to the right queue. In the previous example, there is only 336 + one queue shared among sockets, so the NIC cannot do this steering. It 337 + can only steer between queues. 337 338 338 - In libxdp (or libbpf prior to version 1.0), you need to use the 339 - xsk_socket__create_shared() API as it takes a reference to a FILL ring 340 - and a COMPLETION ring that will be created for you and bound to the 341 - shared UMEM. You can use this function for all the sockets you create, 342 - or you can use it for the second and following ones and use 343 - xsk_socket__create() for the first one. Both methods yield the same 344 - result. 339 + In libbpf, you need to use the xsk_socket__create_shared() API as it 340 + takes a reference to a FILL ring and a COMPLETION ring that will be 341 + created for you and bound to the shared UMEM. You can use this 342 + function for all the sockets you create, or you can use it for the 343 + second and following ones and use xsk_socket__create() for the first 344 + one. Both methods yield the same result. 345 345 346 346 Note that a UMEM can be shared between sockets on the same queue id 347 347 and device, as well as between queues on the same device and between 348 - devices at the same time. It is also possible to redirect to any 349 - socket as long as it is bound to the same umem with XDP_SHARED_UMEM. 348 + devices at the same time. 350 349 351 350 XDP_USE_NEED_WAKEUP bind flag 352 351 ----------------------------- ··· 821 822 to the same queue id Y. In zero-copy mode, you should use the 822 823 switch, or other distribution mechanism, in your NIC to direct 823 824 traffic to the correct queue id and socket. 824 - 825 - Note that if you are using the XDP_SHARED_UMEM option, it is 826 - possible to switch traffic between any socket bound to the same 827 - umem. 828 825 829 826 Q: My packets are sometimes corrupted. What is wrong? 830 827
-1
MAINTAINERS
··· 15237 15237 F: include/linux/most.h 15238 15238 15239 15239 MOTORCOMM PHY DRIVER 15240 - M: Peter Geis <pgwipeout@gmail.com> 15241 15240 M: Frank <Frank.Sae@motor-comm.com> 15242 15241 L: netdev@vger.kernel.org 15243 15242 S: Maintained
+31 -13
drivers/net/ethernet/intel/ice/ice.h
··· 409 409 struct ice_tc_cfg tc_cfg; 410 410 struct bpf_prog *xdp_prog; 411 411 struct ice_tx_ring **xdp_rings; /* XDP ring array */ 412 - unsigned long *af_xdp_zc_qps; /* tracks AF_XDP ZC enabled qps */ 413 412 u16 num_xdp_txq; /* Used XDP queues */ 414 413 u8 xdp_mapping_mode; /* ICE_MAP_MODE_[CONTIG|SCATTER] */ 415 414 ··· 746 747 } 747 748 748 749 /** 750 + * ice_get_xp_from_qid - get ZC XSK buffer pool bound to a queue ID 751 + * @vsi: pointer to VSI 752 + * @qid: index of a queue to look at XSK buff pool presence 753 + * 754 + * Return: A pointer to xsk_buff_pool structure if there is a buffer pool 755 + * attached and configured as zero-copy, NULL otherwise. 756 + */ 757 + static inline struct xsk_buff_pool *ice_get_xp_from_qid(struct ice_vsi *vsi, 758 + u16 qid) 759 + { 760 + struct xsk_buff_pool *pool = xsk_get_pool_from_qid(vsi->netdev, qid); 761 + 762 + if (!ice_is_xdp_ena_vsi(vsi)) 763 + return NULL; 764 + 765 + return (pool && pool->dev) ? pool : NULL; 766 + } 767 + 768 + /** 749 769 * ice_xsk_pool - get XSK buffer pool bound to a ring 750 770 * @ring: Rx ring to use 751 771 * ··· 776 758 struct ice_vsi *vsi = ring->vsi; 777 759 u16 qid = ring->q_index; 778 760 779 - if (!ice_is_xdp_ena_vsi(vsi) || !test_bit(qid, vsi->af_xdp_zc_qps)) 780 - return NULL; 781 - 782 - return xsk_get_pool_from_qid(vsi->netdev, qid); 761 + return ice_get_xp_from_qid(vsi, qid); 783 762 } 784 763 785 764 /** ··· 801 786 if (!ring) 802 787 return; 803 788 804 - if (!ice_is_xdp_ena_vsi(vsi) || !test_bit(qid, vsi->af_xdp_zc_qps)) { 805 - ring->xsk_pool = NULL; 806 - return; 807 - } 808 - 809 - ring->xsk_pool = xsk_get_pool_from_qid(vsi->netdev, qid); 789 + ring->xsk_pool = ice_get_xp_from_qid(vsi, qid); 810 790 } 811 791 812 792 /** ··· 930 920 int ice_down_up(struct ice_vsi *vsi); 931 921 int ice_vsi_cfg_lan(struct ice_vsi *vsi); 932 922 struct ice_vsi *ice_lb_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi); 923 + 924 + enum ice_xdp_cfg { 925 + ICE_XDP_CFG_FULL, /* Fully apply new config in .ndo_bpf() */ 926 + ICE_XDP_CFG_PART, /* Save/use part of config in VSI rebuild */ 927 + }; 928 + 933 929 int ice_vsi_determine_xdp_res(struct ice_vsi *vsi); 934 - int ice_prepare_xdp_rings(struct ice_vsi *vsi, struct bpf_prog *prog); 935 - int ice_destroy_xdp_rings(struct ice_vsi *vsi); 930 + int ice_prepare_xdp_rings(struct ice_vsi *vsi, struct bpf_prog *prog, 931 + enum ice_xdp_cfg cfg_type); 932 + int ice_destroy_xdp_rings(struct ice_vsi *vsi, enum ice_xdp_cfg cfg_type); 933 + void ice_map_xdp_rings(struct ice_vsi *vsi); 936 934 int 937 935 ice_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames, 938 936 u32 flags);
+3
drivers/net/ethernet/intel/ice/ice_base.c
··· 842 842 } 843 843 rx_rings_rem -= rx_rings_per_v; 844 844 } 845 + 846 + if (ice_is_xdp_ena_vsi(vsi)) 847 + ice_map_xdp_rings(vsi); 845 848 } 846 849 847 850 /**
+11 -18
drivers/net/ethernet/intel/ice/ice_lib.c
··· 114 114 if (!vsi->q_vectors) 115 115 goto err_vectors; 116 116 117 - vsi->af_xdp_zc_qps = bitmap_zalloc(max_t(int, vsi->alloc_txq, vsi->alloc_rxq), GFP_KERNEL); 118 - if (!vsi->af_xdp_zc_qps) 119 - goto err_zc_qps; 120 - 121 117 return 0; 122 118 123 - err_zc_qps: 124 - devm_kfree(dev, vsi->q_vectors); 125 119 err_vectors: 126 120 devm_kfree(dev, vsi->rxq_map); 127 121 err_rxq_map: ··· 303 309 304 310 dev = ice_pf_to_dev(pf); 305 311 306 - bitmap_free(vsi->af_xdp_zc_qps); 307 - vsi->af_xdp_zc_qps = NULL; 308 312 /* free the ring and vector containers */ 309 313 devm_kfree(dev, vsi->q_vectors); 310 314 vsi->q_vectors = NULL; ··· 2274 2282 if (ret) 2275 2283 goto unroll_vector_base; 2276 2284 2285 + if (ice_is_xdp_ena_vsi(vsi)) { 2286 + ret = ice_vsi_determine_xdp_res(vsi); 2287 + if (ret) 2288 + goto unroll_vector_base; 2289 + ret = ice_prepare_xdp_rings(vsi, vsi->xdp_prog, 2290 + ICE_XDP_CFG_PART); 2291 + if (ret) 2292 + goto unroll_vector_base; 2293 + } 2294 + 2277 2295 ice_vsi_map_rings_to_vectors(vsi); 2278 2296 2279 2297 /* Associate q_vector rings to napi */ 2280 2298 ice_vsi_set_napi_queues(vsi); 2281 2299 2282 2300 vsi->stat_offsets_loaded = false; 2283 - 2284 - if (ice_is_xdp_ena_vsi(vsi)) { 2285 - ret = ice_vsi_determine_xdp_res(vsi); 2286 - if (ret) 2287 - goto unroll_vector_base; 2288 - ret = ice_prepare_xdp_rings(vsi, vsi->xdp_prog); 2289 - if (ret) 2290 - goto unroll_vector_base; 2291 - } 2292 2301 2293 2302 /* ICE_VSI_CTRL does not need RSS so skip RSS processing */ 2294 2303 if (vsi->type != ICE_VSI_CTRL) ··· 2430 2437 /* return value check can be skipped here, it always returns 2431 2438 * 0 if reset is in progress 2432 2439 */ 2433 - ice_destroy_xdp_rings(vsi); 2440 + ice_destroy_xdp_rings(vsi, ICE_XDP_CFG_PART); 2434 2441 2435 2442 ice_vsi_clear_rings(vsi); 2436 2443 ice_vsi_free_q_vectors(vsi);
+82 -62
drivers/net/ethernet/intel/ice/ice_main.c
··· 2707 2707 bpf_prog_put(old_prog); 2708 2708 } 2709 2709 2710 - /** 2711 - * ice_prepare_xdp_rings - Allocate, configure and setup Tx rings for XDP 2712 - * @vsi: VSI to bring up Tx rings used by XDP 2713 - * @prog: bpf program that will be assigned to VSI 2714 - * 2715 - * Return 0 on success and negative value on error 2716 - */ 2717 - int ice_prepare_xdp_rings(struct ice_vsi *vsi, struct bpf_prog *prog) 2710 + static struct ice_tx_ring *ice_xdp_ring_from_qid(struct ice_vsi *vsi, int qid) 2718 2711 { 2719 - u16 max_txqs[ICE_MAX_TRAFFIC_CLASS] = { 0 }; 2720 - int xdp_rings_rem = vsi->num_xdp_txq; 2721 - struct ice_pf *pf = vsi->back; 2722 - struct ice_qs_cfg xdp_qs_cfg = { 2723 - .qs_mutex = &pf->avail_q_mutex, 2724 - .pf_map = pf->avail_txqs, 2725 - .pf_map_size = pf->max_pf_txqs, 2726 - .q_count = vsi->num_xdp_txq, 2727 - .scatter_count = ICE_MAX_SCATTER_TXQS, 2728 - .vsi_map = vsi->txq_map, 2729 - .vsi_map_offset = vsi->alloc_txq, 2730 - .mapping_mode = ICE_VSI_MAP_CONTIG 2731 - }; 2732 - struct device *dev; 2733 - int i, v_idx; 2734 - int status; 2735 - 2736 - dev = ice_pf_to_dev(pf); 2737 - vsi->xdp_rings = devm_kcalloc(dev, vsi->num_xdp_txq, 2738 - sizeof(*vsi->xdp_rings), GFP_KERNEL); 2739 - if (!vsi->xdp_rings) 2740 - return -ENOMEM; 2741 - 2742 - vsi->xdp_mapping_mode = xdp_qs_cfg.mapping_mode; 2743 - if (__ice_vsi_get_qs(&xdp_qs_cfg)) 2744 - goto err_map_xdp; 2712 + struct ice_q_vector *q_vector; 2713 + struct ice_tx_ring *ring; 2745 2714 2746 2715 if (static_key_enabled(&ice_xdp_locking_key)) 2747 - netdev_warn(vsi->netdev, 2748 - "Could not allocate one XDP Tx ring per CPU, XDP_TX/XDP_REDIRECT actions will be slower\n"); 2716 + return vsi->xdp_rings[qid % vsi->num_xdp_txq]; 2749 2717 2750 - if (ice_xdp_alloc_setup_rings(vsi)) 2751 - goto clear_xdp_rings; 2718 + q_vector = vsi->rx_rings[qid]->q_vector; 2719 + ice_for_each_tx_ring(ring, q_vector->tx) 2720 + if (ice_ring_is_xdp(ring)) 2721 + return ring; 2722 + 2723 + return NULL; 2724 + } 2725 + 2726 + /** 2727 + * ice_map_xdp_rings - Map XDP rings to interrupt vectors 2728 + * @vsi: the VSI with XDP rings being configured 2729 + * 2730 + * Map XDP rings to interrupt vectors and perform the configuration steps 2731 + * dependent on the mapping. 2732 + */ 2733 + void ice_map_xdp_rings(struct ice_vsi *vsi) 2734 + { 2735 + int xdp_rings_rem = vsi->num_xdp_txq; 2736 + int v_idx, q_idx; 2752 2737 2753 2738 /* follow the logic from ice_vsi_map_rings_to_vectors */ 2754 2739 ice_for_each_q_vector(vsi, v_idx) { ··· 2754 2769 xdp_rings_rem -= xdp_rings_per_v; 2755 2770 } 2756 2771 2757 - ice_for_each_rxq(vsi, i) { 2758 - if (static_key_enabled(&ice_xdp_locking_key)) { 2759 - vsi->rx_rings[i]->xdp_ring = vsi->xdp_rings[i % vsi->num_xdp_txq]; 2760 - } else { 2761 - struct ice_q_vector *q_vector = vsi->rx_rings[i]->q_vector; 2762 - struct ice_tx_ring *ring; 2763 - 2764 - ice_for_each_tx_ring(ring, q_vector->tx) { 2765 - if (ice_ring_is_xdp(ring)) { 2766 - vsi->rx_rings[i]->xdp_ring = ring; 2767 - break; 2768 - } 2769 - } 2770 - } 2771 - ice_tx_xsk_pool(vsi, i); 2772 + ice_for_each_rxq(vsi, q_idx) { 2773 + vsi->rx_rings[q_idx]->xdp_ring = ice_xdp_ring_from_qid(vsi, 2774 + q_idx); 2775 + ice_tx_xsk_pool(vsi, q_idx); 2772 2776 } 2777 + } 2778 + 2779 + /** 2780 + * ice_prepare_xdp_rings - Allocate, configure and setup Tx rings for XDP 2781 + * @vsi: VSI to bring up Tx rings used by XDP 2782 + * @prog: bpf program that will be assigned to VSI 2783 + * @cfg_type: create from scratch or restore the existing configuration 2784 + * 2785 + * Return 0 on success and negative value on error 2786 + */ 2787 + int ice_prepare_xdp_rings(struct ice_vsi *vsi, struct bpf_prog *prog, 2788 + enum ice_xdp_cfg cfg_type) 2789 + { 2790 + u16 max_txqs[ICE_MAX_TRAFFIC_CLASS] = { 0 }; 2791 + struct ice_pf *pf = vsi->back; 2792 + struct ice_qs_cfg xdp_qs_cfg = { 2793 + .qs_mutex = &pf->avail_q_mutex, 2794 + .pf_map = pf->avail_txqs, 2795 + .pf_map_size = pf->max_pf_txqs, 2796 + .q_count = vsi->num_xdp_txq, 2797 + .scatter_count = ICE_MAX_SCATTER_TXQS, 2798 + .vsi_map = vsi->txq_map, 2799 + .vsi_map_offset = vsi->alloc_txq, 2800 + .mapping_mode = ICE_VSI_MAP_CONTIG 2801 + }; 2802 + struct device *dev; 2803 + int status, i; 2804 + 2805 + dev = ice_pf_to_dev(pf); 2806 + vsi->xdp_rings = devm_kcalloc(dev, vsi->num_xdp_txq, 2807 + sizeof(*vsi->xdp_rings), GFP_KERNEL); 2808 + if (!vsi->xdp_rings) 2809 + return -ENOMEM; 2810 + 2811 + vsi->xdp_mapping_mode = xdp_qs_cfg.mapping_mode; 2812 + if (__ice_vsi_get_qs(&xdp_qs_cfg)) 2813 + goto err_map_xdp; 2814 + 2815 + if (static_key_enabled(&ice_xdp_locking_key)) 2816 + netdev_warn(vsi->netdev, 2817 + "Could not allocate one XDP Tx ring per CPU, XDP_TX/XDP_REDIRECT actions will be slower\n"); 2818 + 2819 + if (ice_xdp_alloc_setup_rings(vsi)) 2820 + goto clear_xdp_rings; 2773 2821 2774 2822 /* omit the scheduler update if in reset path; XDP queues will be 2775 2823 * taken into account at the end of ice_vsi_rebuild, where 2776 2824 * ice_cfg_vsi_lan is being called 2777 2825 */ 2778 - if (ice_is_reset_in_progress(pf->state)) 2826 + if (cfg_type == ICE_XDP_CFG_PART) 2779 2827 return 0; 2828 + 2829 + ice_map_xdp_rings(vsi); 2780 2830 2781 2831 /* tell the Tx scheduler that right now we have 2782 2832 * additional queues ··· 2862 2842 /** 2863 2843 * ice_destroy_xdp_rings - undo the configuration made by ice_prepare_xdp_rings 2864 2844 * @vsi: VSI to remove XDP rings 2845 + * @cfg_type: disable XDP permanently or allow it to be restored later 2865 2846 * 2866 2847 * Detach XDP rings from irq vectors, clean up the PF bitmap and free 2867 2848 * resources 2868 2849 */ 2869 - int ice_destroy_xdp_rings(struct ice_vsi *vsi) 2850 + int ice_destroy_xdp_rings(struct ice_vsi *vsi, enum ice_xdp_cfg cfg_type) 2870 2851 { 2871 2852 u16 max_txqs[ICE_MAX_TRAFFIC_CLASS] = { 0 }; 2872 2853 struct ice_pf *pf = vsi->back; 2873 2854 int i, v_idx; 2874 2855 2875 2856 /* q_vectors are freed in reset path so there's no point in detaching 2876 - * rings; in case of rebuild being triggered not from reset bits 2877 - * in pf->state won't be set, so additionally check first q_vector 2878 - * against NULL 2857 + * rings 2879 2858 */ 2880 - if (ice_is_reset_in_progress(pf->state) || !vsi->q_vectors[0]) 2859 + if (cfg_type == ICE_XDP_CFG_PART) 2881 2860 goto free_qmap; 2882 2861 2883 2862 ice_for_each_q_vector(vsi, v_idx) { ··· 2917 2898 if (static_key_enabled(&ice_xdp_locking_key)) 2918 2899 static_branch_dec(&ice_xdp_locking_key); 2919 2900 2920 - if (ice_is_reset_in_progress(pf->state) || !vsi->q_vectors[0]) 2901 + if (cfg_type == ICE_XDP_CFG_PART) 2921 2902 return 0; 2922 2903 2923 2904 ice_vsi_assign_bpf_prog(vsi, NULL); ··· 3028 3009 if (xdp_ring_err) { 3029 3010 NL_SET_ERR_MSG_MOD(extack, "Not enough Tx resources for XDP"); 3030 3011 } else { 3031 - xdp_ring_err = ice_prepare_xdp_rings(vsi, prog); 3012 + xdp_ring_err = ice_prepare_xdp_rings(vsi, prog, 3013 + ICE_XDP_CFG_FULL); 3032 3014 if (xdp_ring_err) 3033 3015 NL_SET_ERR_MSG_MOD(extack, "Setting up XDP Tx resources failed"); 3034 3016 } ··· 3040 3020 NL_SET_ERR_MSG_MOD(extack, "Setting up XDP Rx resources failed"); 3041 3021 } else if (ice_is_xdp_ena_vsi(vsi) && !prog) { 3042 3022 xdp_features_clear_redirect_target(vsi->netdev); 3043 - xdp_ring_err = ice_destroy_xdp_rings(vsi); 3023 + xdp_ring_err = ice_destroy_xdp_rings(vsi, ICE_XDP_CFG_FULL); 3044 3024 if (xdp_ring_err) 3045 3025 NL_SET_ERR_MSG_MOD(extack, "Freeing XDP Tx resources failed"); 3046 3026 /* reallocate Rx queues that were used for zero-copy */
+108 -8
drivers/net/ethernet/intel/ice/ice_nvm.c
··· 374 374 * 375 375 * Read the specified word from the copy of the Shadow RAM found in the 376 376 * specified NVM module. 377 + * 378 + * Note that the Shadow RAM copy is always located after the CSS header, and 379 + * is aligned to 64-byte (32-word) offsets. 377 380 */ 378 381 static int 379 382 ice_read_nvm_sr_copy(struct ice_hw *hw, enum ice_bank_select bank, u32 offset, u16 *data) 380 383 { 381 - return ice_read_nvm_module(hw, bank, ICE_NVM_SR_COPY_WORD_OFFSET + offset, data); 384 + u32 sr_copy; 385 + 386 + switch (bank) { 387 + case ICE_ACTIVE_FLASH_BANK: 388 + sr_copy = roundup(hw->flash.banks.active_css_hdr_len, 32); 389 + break; 390 + case ICE_INACTIVE_FLASH_BANK: 391 + sr_copy = roundup(hw->flash.banks.inactive_css_hdr_len, 32); 392 + break; 393 + } 394 + 395 + return ice_read_nvm_module(hw, bank, sr_copy + offset, data); 382 396 } 383 397 384 398 /** ··· 454 440 ice_get_pfa_module_tlv(struct ice_hw *hw, u16 *module_tlv, u16 *module_tlv_len, 455 441 u16 module_type) 456 442 { 457 - u16 pfa_len, pfa_ptr; 458 - u16 next_tlv; 443 + u16 pfa_len, pfa_ptr, next_tlv, max_tlv; 459 444 int status; 460 445 461 446 status = ice_read_sr_word(hw, ICE_SR_PFA_PTR, &pfa_ptr); ··· 467 454 ice_debug(hw, ICE_DBG_INIT, "Failed to read PFA length.\n"); 468 455 return status; 469 456 } 457 + 458 + /* The Preserved Fields Area contains a sequence of Type-Length-Value 459 + * structures which define its contents. The PFA length includes all 460 + * of the TLVs, plus the initial length word itself, *and* one final 461 + * word at the end after all of the TLVs. 462 + */ 463 + if (check_add_overflow(pfa_ptr, pfa_len - 1, &max_tlv)) { 464 + dev_warn(ice_hw_to_dev(hw), "PFA starts at offset %u. PFA length of %u caused 16-bit arithmetic overflow.\n", 465 + pfa_ptr, pfa_len); 466 + return -EINVAL; 467 + } 468 + 470 469 /* Starting with first TLV after PFA length, iterate through the list 471 470 * of TLVs to find the requested one. 472 471 */ 473 472 next_tlv = pfa_ptr + 1; 474 - while (next_tlv < pfa_ptr + pfa_len) { 473 + while (next_tlv < max_tlv) { 475 474 u16 tlv_sub_module_type; 476 475 u16 tlv_len; 477 476 ··· 507 482 } 508 483 return -EINVAL; 509 484 } 510 - /* Check next TLV, i.e. current TLV pointer + length + 2 words 511 - * (for current TLV's type and length) 512 - */ 513 - next_tlv = next_tlv + tlv_len + 2; 485 + 486 + if (check_add_overflow(next_tlv, 2, &next_tlv) || 487 + check_add_overflow(next_tlv, tlv_len, &next_tlv)) { 488 + dev_warn(ice_hw_to_dev(hw), "TLV of type %u and length 0x%04x caused 16-bit arithmetic overflow. The PFA starts at 0x%04x and has length of 0x%04x\n", 489 + tlv_sub_module_type, tlv_len, pfa_ptr, pfa_len); 490 + return -EINVAL; 491 + } 514 492 } 515 493 /* Module does not exist */ 516 494 return -ENOENT; ··· 1038 1010 } 1039 1011 1040 1012 /** 1013 + * ice_get_nvm_css_hdr_len - Read the CSS header length from the NVM CSS header 1014 + * @hw: pointer to the HW struct 1015 + * @bank: whether to read from the active or inactive flash bank 1016 + * @hdr_len: storage for header length in words 1017 + * 1018 + * Read the CSS header length from the NVM CSS header and add the Authentication 1019 + * header size, and then convert to words. 1020 + * 1021 + * Return: zero on success, or a negative error code on failure. 1022 + */ 1023 + static int 1024 + ice_get_nvm_css_hdr_len(struct ice_hw *hw, enum ice_bank_select bank, 1025 + u32 *hdr_len) 1026 + { 1027 + u16 hdr_len_l, hdr_len_h; 1028 + u32 hdr_len_dword; 1029 + int status; 1030 + 1031 + status = ice_read_nvm_module(hw, bank, ICE_NVM_CSS_HDR_LEN_L, 1032 + &hdr_len_l); 1033 + if (status) 1034 + return status; 1035 + 1036 + status = ice_read_nvm_module(hw, bank, ICE_NVM_CSS_HDR_LEN_H, 1037 + &hdr_len_h); 1038 + if (status) 1039 + return status; 1040 + 1041 + /* CSS header length is in DWORD, so convert to words and add 1042 + * authentication header size 1043 + */ 1044 + hdr_len_dword = hdr_len_h << 16 | hdr_len_l; 1045 + *hdr_len = (hdr_len_dword * 2) + ICE_NVM_AUTH_HEADER_LEN; 1046 + 1047 + return 0; 1048 + } 1049 + 1050 + /** 1051 + * ice_determine_css_hdr_len - Discover CSS header length for the device 1052 + * @hw: pointer to the HW struct 1053 + * 1054 + * Determine the size of the CSS header at the start of the NVM module. This 1055 + * is useful for locating the Shadow RAM copy in the NVM, as the Shadow RAM is 1056 + * always located just after the CSS header. 1057 + * 1058 + * Return: zero on success, or a negative error code on failure. 1059 + */ 1060 + static int ice_determine_css_hdr_len(struct ice_hw *hw) 1061 + { 1062 + struct ice_bank_info *banks = &hw->flash.banks; 1063 + int status; 1064 + 1065 + status = ice_get_nvm_css_hdr_len(hw, ICE_ACTIVE_FLASH_BANK, 1066 + &banks->active_css_hdr_len); 1067 + if (status) 1068 + return status; 1069 + 1070 + status = ice_get_nvm_css_hdr_len(hw, ICE_INACTIVE_FLASH_BANK, 1071 + &banks->inactive_css_hdr_len); 1072 + if (status) 1073 + return status; 1074 + 1075 + return 0; 1076 + } 1077 + 1078 + /** 1041 1079 * ice_init_nvm - initializes NVM setting 1042 1080 * @hw: pointer to the HW struct 1043 1081 * ··· 1146 1052 status = ice_determine_active_flash_banks(hw); 1147 1053 if (status) { 1148 1054 ice_debug(hw, ICE_DBG_NVM, "Failed to determine active flash banks.\n"); 1055 + return status; 1056 + } 1057 + 1058 + status = ice_determine_css_hdr_len(hw); 1059 + if (status) { 1060 + ice_debug(hw, ICE_DBG_NVM, "Failed to determine Shadow RAM copy offsets.\n"); 1149 1061 return status; 1150 1062 } 1151 1063
+6 -8
drivers/net/ethernet/intel/ice/ice_type.h
··· 482 482 u32 orom_size; /* Size of OROM bank */ 483 483 u32 netlist_ptr; /* Pointer to 1st Netlist bank */ 484 484 u32 netlist_size; /* Size of Netlist bank */ 485 + u32 active_css_hdr_len; /* Active CSS header length */ 486 + u32 inactive_css_hdr_len; /* Inactive CSS header length */ 485 487 enum ice_flash_bank nvm_bank; /* Active NVM bank */ 486 488 enum ice_flash_bank orom_bank; /* Active OROM bank */ 487 489 enum ice_flash_bank netlist_bank; /* Active Netlist bank */ ··· 1089 1087 #define ICE_SR_SECTOR_SIZE_IN_WORDS 0x800 1090 1088 1091 1089 /* CSS Header words */ 1090 + #define ICE_NVM_CSS_HDR_LEN_L 0x02 1091 + #define ICE_NVM_CSS_HDR_LEN_H 0x03 1092 1092 #define ICE_NVM_CSS_SREV_L 0x14 1093 1093 #define ICE_NVM_CSS_SREV_H 0x15 1094 1094 1095 - /* Length of CSS header section in words */ 1096 - #define ICE_CSS_HEADER_LENGTH 330 1097 - 1098 - /* Offset of Shadow RAM copy in the NVM bank area. */ 1099 - #define ICE_NVM_SR_COPY_WORD_OFFSET roundup(ICE_CSS_HEADER_LENGTH, 32) 1100 - 1101 - /* Size in bytes of Option ROM trailer */ 1102 - #define ICE_NVM_OROM_TRAILER_LENGTH (2 * ICE_CSS_HEADER_LENGTH) 1095 + /* Length of Authentication header section in words */ 1096 + #define ICE_NVM_AUTH_HEADER_LEN 0x08 1103 1097 1104 1098 /* The Link Topology Netlist section is stored as a series of words. It is 1105 1099 * stored in the NVM as a TLV, with the first two words containing the type
+6 -7
drivers/net/ethernet/intel/ice/ice_xsk.c
··· 269 269 if (!pool) 270 270 return -EINVAL; 271 271 272 - clear_bit(qid, vsi->af_xdp_zc_qps); 273 272 xsk_pool_dma_unmap(pool, ICE_RX_DMA_ATTR); 274 273 275 274 return 0; ··· 298 299 ICE_RX_DMA_ATTR); 299 300 if (err) 300 301 return err; 301 - 302 - set_bit(qid, vsi->af_xdp_zc_qps); 303 302 304 303 return 0; 305 304 } ··· 346 349 int ice_realloc_zc_buf(struct ice_vsi *vsi, bool zc) 347 350 { 348 351 struct ice_rx_ring *rx_ring; 349 - unsigned long q; 352 + uint i; 350 353 351 - for_each_set_bit(q, vsi->af_xdp_zc_qps, 352 - max_t(int, vsi->alloc_txq, vsi->alloc_rxq)) { 353 - rx_ring = vsi->rx_rings[q]; 354 + ice_for_each_rxq(vsi, i) { 355 + rx_ring = vsi->rx_rings[i]; 356 + if (!rx_ring->xsk_pool) 357 + continue; 358 + 354 359 if (ice_realloc_rx_xdp_bufs(rx_ring, zc)) 355 360 return -ENOMEM; 356 361 }
+7 -2
drivers/net/ethernet/intel/igc/igc_ethtool.c
··· 1629 1629 struct igc_hw *hw = &adapter->hw; 1630 1630 u32 eeer; 1631 1631 1632 + linkmode_set_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, 1633 + edata->supported); 1634 + linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, 1635 + edata->supported); 1636 + linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, 1637 + edata->supported); 1638 + 1632 1639 if (hw->dev_spec._base.eee_enable) 1633 1640 mii_eee_cap1_mod_linkmode_t(edata->advertised, 1634 1641 adapter->eee_advert); 1635 - 1636 - *edata = adapter->eee; 1637 1642 1638 1643 eeer = rd32(IGC_EEER); 1639 1644
+4
drivers/net/ethernet/intel/igc/igc_main.c
··· 12 12 #include <linux/bpf_trace.h> 13 13 #include <net/xdp_sock_drv.h> 14 14 #include <linux/pci.h> 15 + #include <linux/mdio.h> 15 16 16 17 #include <net/ipv6.h> 17 18 ··· 4976 4975 /* start the watchdog. */ 4977 4976 hw->mac.get_link_status = true; 4978 4977 schedule_work(&adapter->watchdog_task); 4978 + 4979 + adapter->eee_advert = MDIO_EEE_100TX | MDIO_EEE_1000T | 4980 + MDIO_EEE_2_5GT; 4979 4981 } 4980 4982 4981 4983 /**
+22 -11
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
··· 2519 2519 * - when available free entries are less. 2520 2520 * Lower priority ones out of avaialble free entries are always 2521 2521 * chosen when 'high vs low' question arises. 2522 + * 2523 + * For a VF base MCAM match rule is set by its PF. And all the 2524 + * further MCAM rules installed by VF on its own are 2525 + * concatenated with the base rule set by its PF. Hence PF entries 2526 + * should be at lower priority compared to VF entries. Otherwise 2527 + * base rule is hit always and rules installed by VF will be of 2528 + * no use. Hence if the request is from PF then allocate low 2529 + * priority entries. 2522 2530 */ 2531 + if (!(pcifunc & RVU_PFVF_FUNC_MASK)) 2532 + goto lprio_alloc; 2523 2533 2524 2534 /* Get the search range for priority allocation request */ 2525 2535 if (req->priority) { ··· 2537 2527 &start, &end, &reverse); 2538 2528 goto alloc; 2539 2529 } 2540 - 2541 - /* For a VF base MCAM match rule is set by its PF. And all the 2542 - * further MCAM rules installed by VF on its own are 2543 - * concatenated with the base rule set by its PF. Hence PF entries 2544 - * should be at lower priority compared to VF entries. Otherwise 2545 - * base rule is hit always and rules installed by VF will be of 2546 - * no use. Hence if the request is from PF and NOT a priority 2547 - * allocation request then allocate low priority entries. 2548 - */ 2549 - if (!(pcifunc & RVU_PFVF_FUNC_MASK)) 2550 - goto lprio_alloc; 2551 2530 2552 2531 /* Find out the search range for non-priority allocation request 2553 2532 * ··· 2567 2568 reverse = true; 2568 2569 start = 0; 2569 2570 end = mcam->bmap_entries; 2571 + /* Ensure PF requests are always at bottom and if PF requests 2572 + * for higher/lower priority entry wrt reference entry then 2573 + * honour that criteria and start search for entries from bottom 2574 + * and not in mid zone. 2575 + */ 2576 + if (!(pcifunc & RVU_PFVF_FUNC_MASK) && 2577 + req->priority == NPC_MCAM_HIGHER_PRIO) 2578 + end = req->ref_entry; 2579 + 2580 + if (!(pcifunc & RVU_PFVF_FUNC_MASK) && 2581 + req->priority == NPC_MCAM_LOWER_PRIO) 2582 + start = req->ref_entry; 2570 2583 } 2571 2584 2572 2585 alloc:
+71 -35
drivers/net/ethernet/mediatek/mtk_eth_soc.c
··· 1131 1131 { 1132 1132 const struct mtk_soc_data *soc = eth->soc; 1133 1133 dma_addr_t phy_ring_tail; 1134 - int cnt = MTK_QDMA_RING_SIZE; 1134 + int cnt = soc->tx.fq_dma_size; 1135 1135 dma_addr_t dma_addr; 1136 - int i; 1136 + int i, j, len; 1137 1137 1138 1138 if (MTK_HAS_CAPS(eth->soc->caps, MTK_SRAM)) 1139 1139 eth->scratch_ring = eth->sram_base; ··· 1142 1142 cnt * soc->tx.desc_size, 1143 1143 &eth->phy_scratch_ring, 1144 1144 GFP_KERNEL); 1145 + 1145 1146 if (unlikely(!eth->scratch_ring)) 1146 - return -ENOMEM; 1147 - 1148 - eth->scratch_head = kcalloc(cnt, MTK_QDMA_PAGE_SIZE, GFP_KERNEL); 1149 - if (unlikely(!eth->scratch_head)) 1150 - return -ENOMEM; 1151 - 1152 - dma_addr = dma_map_single(eth->dma_dev, 1153 - eth->scratch_head, cnt * MTK_QDMA_PAGE_SIZE, 1154 - DMA_FROM_DEVICE); 1155 - if (unlikely(dma_mapping_error(eth->dma_dev, dma_addr))) 1156 1147 return -ENOMEM; 1157 1148 1158 1149 phy_ring_tail = eth->phy_scratch_ring + soc->tx.desc_size * (cnt - 1); 1159 1150 1160 - for (i = 0; i < cnt; i++) { 1161 - dma_addr_t addr = dma_addr + i * MTK_QDMA_PAGE_SIZE; 1162 - struct mtk_tx_dma_v2 *txd; 1151 + for (j = 0; j < DIV_ROUND_UP(soc->tx.fq_dma_size, MTK_FQ_DMA_LENGTH); j++) { 1152 + len = min_t(int, cnt - j * MTK_FQ_DMA_LENGTH, MTK_FQ_DMA_LENGTH); 1153 + eth->scratch_head[j] = kcalloc(len, MTK_QDMA_PAGE_SIZE, GFP_KERNEL); 1163 1154 1164 - txd = eth->scratch_ring + i * soc->tx.desc_size; 1165 - txd->txd1 = addr; 1166 - if (i < cnt - 1) 1167 - txd->txd2 = eth->phy_scratch_ring + 1168 - (i + 1) * soc->tx.desc_size; 1155 + if (unlikely(!eth->scratch_head[j])) 1156 + return -ENOMEM; 1169 1157 1170 - txd->txd3 = TX_DMA_PLEN0(MTK_QDMA_PAGE_SIZE); 1171 - if (MTK_HAS_CAPS(soc->caps, MTK_36BIT_DMA)) 1172 - txd->txd3 |= TX_DMA_PREP_ADDR64(addr); 1173 - txd->txd4 = 0; 1174 - if (mtk_is_netsys_v2_or_greater(eth)) { 1175 - txd->txd5 = 0; 1176 - txd->txd6 = 0; 1177 - txd->txd7 = 0; 1178 - txd->txd8 = 0; 1158 + dma_addr = dma_map_single(eth->dma_dev, 1159 + eth->scratch_head[j], len * MTK_QDMA_PAGE_SIZE, 1160 + DMA_FROM_DEVICE); 1161 + 1162 + if (unlikely(dma_mapping_error(eth->dma_dev, dma_addr))) 1163 + return -ENOMEM; 1164 + 1165 + for (i = 0; i < cnt; i++) { 1166 + struct mtk_tx_dma_v2 *txd; 1167 + 1168 + txd = eth->scratch_ring + (j * MTK_FQ_DMA_LENGTH + i) * soc->tx.desc_size; 1169 + txd->txd1 = dma_addr + i * MTK_QDMA_PAGE_SIZE; 1170 + if (j * MTK_FQ_DMA_LENGTH + i < cnt) 1171 + txd->txd2 = eth->phy_scratch_ring + 1172 + (j * MTK_FQ_DMA_LENGTH + i + 1) * soc->tx.desc_size; 1173 + 1174 + txd->txd3 = TX_DMA_PLEN0(MTK_QDMA_PAGE_SIZE); 1175 + if (MTK_HAS_CAPS(soc->caps, MTK_36BIT_DMA)) 1176 + txd->txd3 |= TX_DMA_PREP_ADDR64(dma_addr + i * MTK_QDMA_PAGE_SIZE); 1177 + 1178 + txd->txd4 = 0; 1179 + if (mtk_is_netsys_v2_or_greater(eth)) { 1180 + txd->txd5 = 0; 1181 + txd->txd6 = 0; 1182 + txd->txd7 = 0; 1183 + txd->txd8 = 0; 1184 + } 1179 1185 } 1180 1186 } 1181 1187 ··· 2463 2457 if (MTK_HAS_CAPS(soc->caps, MTK_QDMA)) 2464 2458 ring_size = MTK_QDMA_RING_SIZE; 2465 2459 else 2466 - ring_size = MTK_DMA_SIZE; 2460 + ring_size = soc->tx.dma_size; 2467 2461 2468 2462 ring->buf = kcalloc(ring_size, sizeof(*ring->buf), 2469 2463 GFP_KERNEL); ··· 2471 2465 goto no_tx_mem; 2472 2466 2473 2467 if (MTK_HAS_CAPS(soc->caps, MTK_SRAM)) { 2474 - ring->dma = eth->sram_base + ring_size * sz; 2475 - ring->phys = eth->phy_scratch_ring + ring_size * (dma_addr_t)sz; 2468 + ring->dma = eth->sram_base + soc->tx.fq_dma_size * sz; 2469 + ring->phys = eth->phy_scratch_ring + soc->tx.fq_dma_size * (dma_addr_t)sz; 2476 2470 } else { 2477 2471 ring->dma = dma_alloc_coherent(eth->dma_dev, ring_size * sz, 2478 2472 &ring->phys, GFP_KERNEL); ··· 2594 2588 static int mtk_rx_alloc(struct mtk_eth *eth, int ring_no, int rx_flag) 2595 2589 { 2596 2590 const struct mtk_reg_map *reg_map = eth->soc->reg_map; 2591 + const struct mtk_soc_data *soc = eth->soc; 2597 2592 struct mtk_rx_ring *ring; 2598 2593 int rx_data_len, rx_dma_size, tx_ring_size; 2599 2594 int i; ··· 2602 2595 if (MTK_HAS_CAPS(eth->soc->caps, MTK_QDMA)) 2603 2596 tx_ring_size = MTK_QDMA_RING_SIZE; 2604 2597 else 2605 - tx_ring_size = MTK_DMA_SIZE; 2598 + tx_ring_size = soc->tx.dma_size; 2606 2599 2607 2600 if (rx_flag == MTK_RX_FLAGS_QDMA) { 2608 2601 if (ring_no) ··· 2617 2610 rx_dma_size = MTK_HW_LRO_DMA_SIZE; 2618 2611 } else { 2619 2612 rx_data_len = ETH_DATA_LEN; 2620 - rx_dma_size = MTK_DMA_SIZE; 2613 + rx_dma_size = soc->rx.dma_size; 2621 2614 } 2622 2615 2623 2616 ring->frag_size = mtk_max_frag_size(rx_data_len); ··· 3146 3139 mtk_rx_clean(eth, &eth->rx_ring[i], false); 3147 3140 } 3148 3141 3149 - kfree(eth->scratch_head); 3142 + for (i = 0; i < DIV_ROUND_UP(soc->tx.fq_dma_size, MTK_FQ_DMA_LENGTH); i++) { 3143 + kfree(eth->scratch_head[i]); 3144 + eth->scratch_head[i] = NULL; 3145 + } 3150 3146 } 3151 3147 3152 3148 static bool mtk_hw_reset_check(struct mtk_eth *eth) ··· 5062 5052 .desc_size = sizeof(struct mtk_tx_dma), 5063 5053 .dma_max_len = MTK_TX_DMA_BUF_LEN, 5064 5054 .dma_len_offset = 16, 5055 + .dma_size = MTK_DMA_SIZE(2K), 5056 + .fq_dma_size = MTK_DMA_SIZE(2K), 5065 5057 }, 5066 5058 .rx = { 5067 5059 .desc_size = sizeof(struct mtk_rx_dma), 5068 5060 .irq_done_mask = MTK_RX_DONE_INT, 5069 5061 .dma_l4_valid = RX_DMA_L4_VALID, 5062 + .dma_size = MTK_DMA_SIZE(2K), 5070 5063 .dma_max_len = MTK_TX_DMA_BUF_LEN, 5071 5064 .dma_len_offset = 16, 5072 5065 }, ··· 5089 5076 .desc_size = sizeof(struct mtk_tx_dma), 5090 5077 .dma_max_len = MTK_TX_DMA_BUF_LEN, 5091 5078 .dma_len_offset = 16, 5079 + .dma_size = MTK_DMA_SIZE(2K), 5080 + .fq_dma_size = MTK_DMA_SIZE(2K), 5092 5081 }, 5093 5082 .rx = { 5094 5083 .desc_size = sizeof(struct mtk_rx_dma), 5095 5084 .irq_done_mask = MTK_RX_DONE_INT, 5096 5085 .dma_l4_valid = RX_DMA_L4_VALID, 5086 + .dma_size = MTK_DMA_SIZE(2K), 5097 5087 .dma_max_len = MTK_TX_DMA_BUF_LEN, 5098 5088 .dma_len_offset = 16, 5099 5089 }, ··· 5118 5102 .desc_size = sizeof(struct mtk_tx_dma), 5119 5103 .dma_max_len = MTK_TX_DMA_BUF_LEN, 5120 5104 .dma_len_offset = 16, 5105 + .dma_size = MTK_DMA_SIZE(2K), 5106 + .fq_dma_size = MTK_DMA_SIZE(2K), 5121 5107 }, 5122 5108 .rx = { 5123 5109 .desc_size = sizeof(struct mtk_rx_dma), 5124 5110 .irq_done_mask = MTK_RX_DONE_INT, 5125 5111 .dma_l4_valid = RX_DMA_L4_VALID, 5112 + .dma_size = MTK_DMA_SIZE(2K), 5126 5113 .dma_max_len = MTK_TX_DMA_BUF_LEN, 5127 5114 .dma_len_offset = 16, 5128 5115 }, ··· 5146 5127 .desc_size = sizeof(struct mtk_tx_dma), 5147 5128 .dma_max_len = MTK_TX_DMA_BUF_LEN, 5148 5129 .dma_len_offset = 16, 5130 + .dma_size = MTK_DMA_SIZE(2K), 5131 + .fq_dma_size = MTK_DMA_SIZE(2K), 5149 5132 }, 5150 5133 .rx = { 5151 5134 .desc_size = sizeof(struct mtk_rx_dma), 5152 5135 .irq_done_mask = MTK_RX_DONE_INT, 5153 5136 .dma_l4_valid = RX_DMA_L4_VALID, 5137 + .dma_size = MTK_DMA_SIZE(2K), 5154 5138 .dma_max_len = MTK_TX_DMA_BUF_LEN, 5155 5139 .dma_len_offset = 16, 5156 5140 }, ··· 5172 5150 .desc_size = sizeof(struct mtk_tx_dma), 5173 5151 .dma_max_len = MTK_TX_DMA_BUF_LEN, 5174 5152 .dma_len_offset = 16, 5153 + .dma_size = MTK_DMA_SIZE(2K), 5154 + .fq_dma_size = MTK_DMA_SIZE(2K), 5175 5155 }, 5176 5156 .rx = { 5177 5157 .desc_size = sizeof(struct mtk_rx_dma), 5178 5158 .irq_done_mask = MTK_RX_DONE_INT, 5179 5159 .dma_l4_valid = RX_DMA_L4_VALID, 5160 + .dma_size = MTK_DMA_SIZE(2K), 5180 5161 .dma_max_len = MTK_TX_DMA_BUF_LEN, 5181 5162 .dma_len_offset = 16, 5182 5163 }, ··· 5201 5176 .desc_size = sizeof(struct mtk_tx_dma_v2), 5202 5177 .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, 5203 5178 .dma_len_offset = 8, 5179 + .dma_size = MTK_DMA_SIZE(2K), 5180 + .fq_dma_size = MTK_DMA_SIZE(2K), 5204 5181 }, 5205 5182 .rx = { 5206 5183 .desc_size = sizeof(struct mtk_rx_dma), ··· 5210 5183 .dma_l4_valid = RX_DMA_L4_VALID_V2, 5211 5184 .dma_max_len = MTK_TX_DMA_BUF_LEN, 5212 5185 .dma_len_offset = 16, 5186 + .dma_size = MTK_DMA_SIZE(2K), 5213 5187 }, 5214 5188 }; 5215 5189 ··· 5230 5202 .desc_size = sizeof(struct mtk_tx_dma_v2), 5231 5203 .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, 5232 5204 .dma_len_offset = 8, 5205 + .dma_size = MTK_DMA_SIZE(2K), 5206 + .fq_dma_size = MTK_DMA_SIZE(2K), 5233 5207 }, 5234 5208 .rx = { 5235 5209 .desc_size = sizeof(struct mtk_rx_dma), ··· 5239 5209 .dma_l4_valid = RX_DMA_L4_VALID_V2, 5240 5210 .dma_max_len = MTK_TX_DMA_BUF_LEN, 5241 5211 .dma_len_offset = 16, 5212 + .dma_size = MTK_DMA_SIZE(2K), 5242 5213 }, 5243 5214 }; 5244 5215 ··· 5259 5228 .desc_size = sizeof(struct mtk_tx_dma_v2), 5260 5229 .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, 5261 5230 .dma_len_offset = 8, 5231 + .dma_size = MTK_DMA_SIZE(2K), 5232 + .fq_dma_size = MTK_DMA_SIZE(4K), 5262 5233 }, 5263 5234 .rx = { 5264 5235 .desc_size = sizeof(struct mtk_rx_dma_v2), ··· 5268 5235 .dma_l4_valid = RX_DMA_L4_VALID_V2, 5269 5236 .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, 5270 5237 .dma_len_offset = 8, 5238 + .dma_size = MTK_DMA_SIZE(2K), 5271 5239 }, 5272 5240 }; 5273 5241 ··· 5283 5249 .desc_size = sizeof(struct mtk_tx_dma), 5284 5250 .dma_max_len = MTK_TX_DMA_BUF_LEN, 5285 5251 .dma_len_offset = 16, 5252 + .dma_size = MTK_DMA_SIZE(2K), 5286 5253 }, 5287 5254 .rx = { 5288 5255 .desc_size = sizeof(struct mtk_rx_dma), ··· 5291 5256 .dma_l4_valid = RX_DMA_L4_VALID_PDMA, 5292 5257 .dma_max_len = MTK_TX_DMA_BUF_LEN, 5293 5258 .dma_len_offset = 16, 5259 + .dma_size = MTK_DMA_SIZE(2K), 5294 5260 }, 5295 5261 }; 5296 5262
+7 -2
drivers/net/ethernet/mediatek/mtk_eth_soc.h
··· 32 32 #define MTK_TX_DMA_BUF_LEN 0x3fff 33 33 #define MTK_TX_DMA_BUF_LEN_V2 0xffff 34 34 #define MTK_QDMA_RING_SIZE 2048 35 - #define MTK_DMA_SIZE 512 35 + #define MTK_DMA_SIZE(x) (SZ_##x) 36 + #define MTK_FQ_DMA_HEAD 32 37 + #define MTK_FQ_DMA_LENGTH 2048 36 38 #define MTK_RX_ETH_HLEN (ETH_HLEN + ETH_FCS_LEN) 37 39 #define MTK_RX_HLEN (NET_SKB_PAD + MTK_RX_ETH_HLEN + NET_IP_ALIGN) 38 40 #define MTK_DMA_DUMMY_DESC 0xffffffff ··· 1178 1176 u32 desc_size; 1179 1177 u32 dma_max_len; 1180 1178 u32 dma_len_offset; 1179 + u32 dma_size; 1180 + u32 fq_dma_size; 1181 1181 } tx; 1182 1182 struct { 1183 1183 u32 desc_size; ··· 1187 1183 u32 dma_l4_valid; 1188 1184 u32 dma_max_len; 1189 1185 u32 dma_len_offset; 1186 + u32 dma_size; 1190 1187 } rx; 1191 1188 }; 1192 1189 ··· 1269 1264 struct napi_struct rx_napi; 1270 1265 void *scratch_ring; 1271 1266 dma_addr_t phy_scratch_ring; 1272 - void *scratch_head; 1267 + void *scratch_head[MTK_FQ_DMA_HEAD]; 1273 1268 struct clk *clks[MTK_CLK_MAX]; 1274 1269 1275 1270 struct mii_bus *mii_bus;
+4
drivers/net/ethernet/mellanox/mlx5/core/fw.c
··· 373 373 do { 374 374 if (mlx5_get_nic_state(dev) == MLX5_INITIAL_SEG_NIC_INTERFACE_DISABLED) 375 375 break; 376 + if (pci_channel_offline(dev->pdev)) { 377 + mlx5_core_err(dev, "PCI channel offline, stop waiting for NIC IFC\n"); 378 + return -EACCES; 379 + } 376 380 377 381 cond_resched(); 378 382 } while (!time_after(jiffies, end));
+8
drivers/net/ethernet/mellanox/mlx5/core/health.c
··· 248 248 do { 249 249 if (mlx5_get_nic_state(dev) == MLX5_INITIAL_SEG_NIC_INTERFACE_DISABLED) 250 250 break; 251 + if (pci_channel_offline(dev->pdev)) { 252 + mlx5_core_err(dev, "PCI channel offline, stop waiting for NIC IFC\n"); 253 + goto unlock; 254 + } 251 255 252 256 msleep(20); 253 257 } while (!time_after(jiffies, end)); ··· 320 316 if (test_bit(MLX5_BREAK_FW_WAIT, &dev->intf_state)) { 321 317 mlx5_core_warn(dev, "device is being removed, stop waiting for PCI\n"); 322 318 return -ENODEV; 319 + } 320 + if (pci_channel_offline(dev->pdev)) { 321 + mlx5_core_err(dev, "PCI channel offline, stop waiting for PCI\n"); 322 + return -EACCES; 323 323 } 324 324 msleep(100); 325 325 }
+6 -2
drivers/net/ethernet/mellanox/mlx5/core/lag/port_sel.c
··· 88 88 &dest, 1); 89 89 if (IS_ERR(lag_definer->rules[idx])) { 90 90 err = PTR_ERR(lag_definer->rules[idx]); 91 - while (i--) 92 - while (j--) 91 + do { 92 + while (j--) { 93 + idx = i * ldev->buckets + j; 93 94 mlx5_del_flow_rules(lag_definer->rules[idx]); 95 + } 96 + j = ldev->buckets; 97 + } while (i--); 94 98 goto destroy_fg; 95 99 } 96 100 }
+4
drivers/net/ethernet/mellanox/mlx5/core/lib/pci_vsc.c
··· 74 74 ret = -EBUSY; 75 75 goto pci_unlock; 76 76 } 77 + if (pci_channel_offline(dev->pdev)) { 78 + ret = -EACCES; 79 + goto pci_unlock; 80 + } 77 81 78 82 /* Check if semaphore is already locked */ 79 83 ret = vsc_read(dev, VSC_SEMAPHORE_OFFSET, &lock_val);
+3
drivers/net/ethernet/mellanox/mlx5/core/main.c
··· 1298 1298 1299 1299 if (!err) 1300 1300 mlx5_function_disable(dev, boot); 1301 + else 1302 + mlx5_stop_health_poll(dev, boot); 1303 + 1301 1304 return err; 1302 1305 } 1303 1306
+1
drivers/net/ethernet/pensando/ionic/ionic_txrx.c
··· 586 586 netdev_dbg(netdev, "tx ionic_xdp_post_frame err %d\n", err); 587 587 goto out_xdp_abort; 588 588 } 589 + buf_info->page = NULL; 589 590 stats->xdp_tx++; 590 591 591 592 /* the Tx completion will free the buffers */
+97 -7
drivers/net/phy/micrel.c
··· 866 866 { 867 867 int ret; 868 868 869 + /* Chip can be powered down by the bootstrap code. */ 870 + ret = phy_read(phydev, MII_BMCR); 871 + if (ret < 0) 872 + return ret; 873 + if (ret & BMCR_PDOWN) { 874 + ret = phy_write(phydev, MII_BMCR, ret & ~BMCR_PDOWN); 875 + if (ret < 0) 876 + return ret; 877 + usleep_range(1000, 2000); 878 + } 879 + 869 880 ret = phy_write_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_DEVID1, 0xB61A); 870 881 if (ret) 871 882 return ret; ··· 1950 1939 {0x1c, 0x20, 0xeeee}, 1951 1940 }; 1952 1941 1953 - static int ksz9477_config_init(struct phy_device *phydev) 1942 + static int ksz9477_phy_errata(struct phy_device *phydev) 1954 1943 { 1955 1944 int err; 1956 1945 int i; ··· 1978 1967 return err; 1979 1968 } 1980 1969 1970 + err = genphy_restart_aneg(phydev); 1971 + if (err) 1972 + return err; 1973 + 1974 + return err; 1975 + } 1976 + 1977 + static int ksz9477_config_init(struct phy_device *phydev) 1978 + { 1979 + int err; 1980 + 1981 + /* Only KSZ9897 family of switches needs this fix. */ 1982 + if ((phydev->phy_id & 0xf) == 1) { 1983 + err = ksz9477_phy_errata(phydev); 1984 + if (err) 1985 + return err; 1986 + } 1987 + 1981 1988 /* According to KSZ9477 Errata DS80000754C (Module 4) all EEE modes 1982 1989 * in this switch shall be regarded as broken. 1983 1990 */ 1984 1991 if (phydev->dev_flags & MICREL_NO_EEE) 1985 1992 phydev->eee_broken_modes = -1; 1986 - 1987 - err = genphy_restart_aneg(phydev); 1988 - if (err) 1989 - return err; 1990 1993 1991 1994 return kszphy_config_init(phydev); 1992 1995 } ··· 2097 2072 usleep_range(1000, 2000); 2098 2073 2099 2074 ret = kszphy_config_reset(phydev); 2075 + if (ret) 2076 + return ret; 2077 + 2078 + /* Enable PHY Interrupts */ 2079 + if (phy_interrupt_is_valid(phydev)) { 2080 + phydev->interrupts = PHY_INTERRUPT_ENABLED; 2081 + if (phydev->drv->config_intr) 2082 + phydev->drv->config_intr(phydev); 2083 + } 2084 + 2085 + return 0; 2086 + } 2087 + 2088 + static int ksz9477_resume(struct phy_device *phydev) 2089 + { 2090 + int ret; 2091 + 2092 + /* No need to initialize registers if not powered down. */ 2093 + ret = phy_read(phydev, MII_BMCR); 2094 + if (ret < 0) 2095 + return ret; 2096 + if (!(ret & BMCR_PDOWN)) 2097 + return 0; 2098 + 2099 + genphy_resume(phydev); 2100 + 2101 + /* After switching from power-down to normal mode, an internal global 2102 + * reset is automatically generated. Wait a minimum of 1 ms before 2103 + * read/write access to the PHY registers. 2104 + */ 2105 + usleep_range(1000, 2000); 2106 + 2107 + /* Only KSZ9897 family of switches needs this fix. */ 2108 + if ((phydev->phy_id & 0xf) == 1) { 2109 + ret = ksz9477_phy_errata(phydev); 2110 + if (ret) 2111 + return ret; 2112 + } 2113 + 2114 + /* Enable PHY Interrupts */ 2115 + if (phy_interrupt_is_valid(phydev)) { 2116 + phydev->interrupts = PHY_INTERRUPT_ENABLED; 2117 + if (phydev->drv->config_intr) 2118 + phydev->drv->config_intr(phydev); 2119 + } 2120 + 2121 + return 0; 2122 + } 2123 + 2124 + static int ksz8061_resume(struct phy_device *phydev) 2125 + { 2126 + int ret; 2127 + 2128 + /* This function can be called twice when the Ethernet device is on. */ 2129 + ret = phy_read(phydev, MII_BMCR); 2130 + if (ret < 0) 2131 + return ret; 2132 + if (!(ret & BMCR_PDOWN)) 2133 + return 0; 2134 + 2135 + genphy_resume(phydev); 2136 + usleep_range(1000, 2000); 2137 + 2138 + /* Re-program the value after chip is reset. */ 2139 + ret = phy_write_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_DEVID1, 0xB61A); 2100 2140 if (ret) 2101 2141 return ret; 2102 2142 ··· 5429 5339 .config_intr = kszphy_config_intr, 5430 5340 .handle_interrupt = kszphy_handle_interrupt, 5431 5341 .suspend = kszphy_suspend, 5432 - .resume = kszphy_resume, 5342 + .resume = ksz8061_resume, 5433 5343 }, { 5434 5344 .phy_id = PHY_ID_KSZ9021, 5435 5345 .phy_id_mask = 0x000ffffe, ··· 5583 5493 .config_intr = kszphy_config_intr, 5584 5494 .handle_interrupt = kszphy_handle_interrupt, 5585 5495 .suspend = genphy_suspend, 5586 - .resume = genphy_resume, 5496 + .resume = ksz9477_resume, 5587 5497 .get_features = ksz9477_get_features, 5588 5498 } }; 5589 5499
+20 -22
drivers/net/virtio_net.c
··· 2686 2686 { 2687 2687 struct scatterlist *sgs[5], hdr, stat; 2688 2688 u32 out_num = 0, tmp, in_num = 0; 2689 + bool ok; 2689 2690 int ret; 2690 2691 2691 2692 /* Caller should know better */ ··· 2732 2731 } 2733 2732 2734 2733 unlock: 2734 + ok = vi->ctrl->status == VIRTIO_NET_OK; 2735 2735 mutex_unlock(&vi->cvq_lock); 2736 - return vi->ctrl->status == VIRTIO_NET_OK; 2736 + return ok; 2737 2737 } 2738 2738 2739 2739 static bool virtnet_send_command(struct virtnet_info *vi, u8 class, u8 cmd, ··· 4259 4257 struct virtio_net_ctrl_coal_rx *coal_rx __free(kfree) = NULL; 4260 4258 bool rx_ctrl_dim_on = !!ec->use_adaptive_rx_coalesce; 4261 4259 struct scatterlist sgs_rx; 4262 - int ret = 0; 4263 4260 int i; 4264 4261 4265 4262 if (rx_ctrl_dim_on && !virtio_has_feature(vi->vdev, VIRTIO_NET_F_VQ_NOTF_COAL)) ··· 4268 4267 ec->rx_max_coalesced_frames != vi->intr_coal_rx.max_packets)) 4269 4268 return -EINVAL; 4270 4269 4271 - /* Acquire all queues dim_locks */ 4272 - for (i = 0; i < vi->max_queue_pairs; i++) 4273 - mutex_lock(&vi->rq[i].dim_lock); 4274 - 4275 4270 if (rx_ctrl_dim_on && !vi->rx_dim_enabled) { 4276 4271 vi->rx_dim_enabled = true; 4277 - for (i = 0; i < vi->max_queue_pairs; i++) 4272 + for (i = 0; i < vi->max_queue_pairs; i++) { 4273 + mutex_lock(&vi->rq[i].dim_lock); 4278 4274 vi->rq[i].dim_enabled = true; 4279 - goto unlock; 4275 + mutex_unlock(&vi->rq[i].dim_lock); 4276 + } 4277 + return 0; 4280 4278 } 4281 4279 4282 4280 coal_rx = kzalloc(sizeof(*coal_rx), GFP_KERNEL); 4283 - if (!coal_rx) { 4284 - ret = -ENOMEM; 4285 - goto unlock; 4286 - } 4281 + if (!coal_rx) 4282 + return -ENOMEM; 4287 4283 4288 4284 if (!rx_ctrl_dim_on && vi->rx_dim_enabled) { 4289 4285 vi->rx_dim_enabled = false; 4290 - for (i = 0; i < vi->max_queue_pairs; i++) 4286 + for (i = 0; i < vi->max_queue_pairs; i++) { 4287 + mutex_lock(&vi->rq[i].dim_lock); 4291 4288 vi->rq[i].dim_enabled = false; 4289 + mutex_unlock(&vi->rq[i].dim_lock); 4290 + } 4292 4291 } 4293 4292 4294 4293 /* Since the per-queue coalescing params can be set, ··· 4301 4300 4302 4301 if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_NOTF_COAL, 4303 4302 VIRTIO_NET_CTRL_NOTF_COAL_RX_SET, 4304 - &sgs_rx)) { 4305 - ret = -EINVAL; 4306 - goto unlock; 4307 - } 4303 + &sgs_rx)) 4304 + return -EINVAL; 4308 4305 4309 4306 vi->intr_coal_rx.max_usecs = ec->rx_coalesce_usecs; 4310 4307 vi->intr_coal_rx.max_packets = ec->rx_max_coalesced_frames; 4311 4308 for (i = 0; i < vi->max_queue_pairs; i++) { 4309 + mutex_lock(&vi->rq[i].dim_lock); 4312 4310 vi->rq[i].intr_coal.max_usecs = ec->rx_coalesce_usecs; 4313 4311 vi->rq[i].intr_coal.max_packets = ec->rx_max_coalesced_frames; 4314 - } 4315 - unlock: 4316 - for (i = vi->max_queue_pairs - 1; i >= 0; i--) 4317 4312 mutex_unlock(&vi->rq[i].dim_lock); 4313 + } 4318 4314 4319 - return ret; 4315 + return 0; 4320 4316 } 4321 4317 4322 4318 static int virtnet_send_notf_coal_cmds(struct virtnet_info *vi, ··· 4415 4417 if (err) 4416 4418 pr_debug("%s: Failed to send dim parameters on rxq%d\n", 4417 4419 dev->name, qnum); 4418 - dim->state = DIM_START_MEASURE; 4419 4420 } 4420 4421 out: 4422 + dim->state = DIM_START_MEASURE; 4421 4423 mutex_unlock(&rq->dim_lock); 4422 4424 } 4423 4425
+1 -1
drivers/net/vmxnet3/vmxnet3_drv.c
··· 2034 2034 rq->data_ring.base, 2035 2035 rq->data_ring.basePA); 2036 2036 rq->data_ring.base = NULL; 2037 - rq->data_ring.desc_size = 0; 2038 2037 } 2038 + rq->data_ring.desc_size = 0; 2039 2039 } 2040 2040 } 2041 2041
+4 -4
drivers/net/vxlan/vxlan_core.c
··· 1446 1446 struct vxlan_fdb *f; 1447 1447 u32 ifindex = 0; 1448 1448 1449 + /* Ignore packets from invalid src-address */ 1450 + if (!is_valid_ether_addr(src_mac)) 1451 + return true; 1452 + 1449 1453 #if IS_ENABLED(CONFIG_IPV6) 1450 1454 if (src_ip->sa.sa_family == AF_INET6 && 1451 1455 (ipv6_addr_type(&src_ip->sin6.sin6_addr) & IPV6_ADDR_LINKLOCAL)) ··· 1618 1614 1619 1615 /* Ignore packet loops (and multicast echo) */ 1620 1616 if (ether_addr_equal(eth_hdr(skb)->h_source, vxlan->dev->dev_addr)) 1621 - return false; 1622 - 1623 - /* Ignore packets from invalid src-address */ 1624 - if (!is_valid_ether_addr(eth_hdr(skb)->h_source)) 1625 1617 return false; 1626 1618 1627 1619 /* Get address from the outer IP header */
+1
drivers/net/wireless/ath/ath10k/Kconfig
··· 45 45 depends on ATH10K 46 46 depends on ARCH_QCOM || COMPILE_TEST 47 47 depends on QCOM_SMEM 48 + depends on QCOM_RPROC_COMMON || QCOM_RPROC_COMMON=n 48 49 select QCOM_SCM 49 50 select QCOM_QMI_HELPERS 50 51 help
+1 -1
drivers/net/wireless/ath/ath11k/core.c
··· 604 604 .coldboot_cal_ftm = true, 605 605 .cbcal_restart_fw = false, 606 606 .fw_mem_mode = 0, 607 - .num_vdevs = 16 + 1, 607 + .num_vdevs = 3, 608 608 .num_peers = 512, 609 609 .supports_suspend = false, 610 610 .hal_desc_sz = sizeof(struct hal_rx_desc_qcn9074),
+25 -13
drivers/net/wireless/ath/ath11k/mac.c
··· 7988 7988 struct ath11k_base *ab = ar->ab; 7989 7989 struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); 7990 7990 int ret; 7991 - struct cur_regulatory_info *reg_info; 7992 - enum ieee80211_ap_reg_power power_type; 7993 7991 7994 7992 mutex_lock(&ar->conf_mutex); 7995 7993 ··· 7998 8000 if (ath11k_wmi_supports_6ghz_cc_ext(ar) && 7999 8001 ctx->def.chan->band == NL80211_BAND_6GHZ && 8000 8002 arvif->vdev_type == WMI_VDEV_TYPE_STA) { 8001 - reg_info = &ab->reg_info_store[ar->pdev_idx]; 8002 - power_type = vif->bss_conf.power_type; 8003 - 8004 - ath11k_dbg(ab, ATH11K_DBG_MAC, "chanctx power type %d\n", power_type); 8005 - 8006 - if (power_type == IEEE80211_REG_UNSET_AP) { 8007 - ret = -EINVAL; 8008 - goto out; 8009 - } 8010 - 8011 - ath11k_reg_handle_chan_list(ab, reg_info, power_type); 8012 8003 arvif->chanctx = *ctx; 8013 8004 ath11k_mac_parse_tx_pwr_env(ar, vif, ctx); 8014 8005 } ··· 9613 9626 struct ath11k *ar = hw->priv; 9614 9627 struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); 9615 9628 struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); 9629 + enum ieee80211_ap_reg_power power_type; 9630 + struct cur_regulatory_info *reg_info; 9616 9631 struct ath11k_peer *peer; 9617 9632 int ret = 0; 9618 9633 ··· 9693 9704 if (ret) 9694 9705 ath11k_warn(ar->ab, "Unable to authorize peer %pM vdev %d: %d\n", 9695 9706 sta->addr, arvif->vdev_id, ret); 9707 + } 9708 + 9709 + if (!ret && 9710 + ath11k_wmi_supports_6ghz_cc_ext(ar) && 9711 + arvif->vdev_type == WMI_VDEV_TYPE_STA && 9712 + arvif->chanctx.def.chan && 9713 + arvif->chanctx.def.chan->band == NL80211_BAND_6GHZ) { 9714 + reg_info = &ar->ab->reg_info_store[ar->pdev_idx]; 9715 + power_type = vif->bss_conf.power_type; 9716 + 9717 + if (power_type == IEEE80211_REG_UNSET_AP) { 9718 + ath11k_warn(ar->ab, "invalid power type %d\n", 9719 + power_type); 9720 + ret = -EINVAL; 9721 + } else { 9722 + ret = ath11k_reg_handle_chan_list(ar->ab, 9723 + reg_info, 9724 + power_type); 9725 + if (ret) 9726 + ath11k_warn(ar->ab, 9727 + "failed to handle chan list with power type %d\n", 9728 + power_type); 9729 + } 9696 9730 } 9697 9731 } else if (old_state == IEEE80211_STA_AUTHORIZED && 9698 9732 new_state == IEEE80211_STA_ASSOC) {
+17 -8
drivers/net/wireless/ath/ath11k/pcic.c
··· 561 561 { 562 562 int i, j, n, ret, num_vectors = 0; 563 563 u32 user_base_data = 0, base_vector = 0; 564 + struct ath11k_ext_irq_grp *irq_grp; 564 565 unsigned long irq_flags; 565 566 566 567 ret = ath11k_pcic_get_user_msi_assignment(ab, "DP", &num_vectors, ··· 575 574 irq_flags |= IRQF_NOBALANCING; 576 575 577 576 for (i = 0; i < ATH11K_EXT_IRQ_GRP_NUM_MAX; i++) { 578 - struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; 577 + irq_grp = &ab->ext_irq_grp[i]; 579 578 u32 num_irq = 0; 580 579 581 580 irq_grp->ab = ab; 582 581 irq_grp->grp_id = i; 583 582 irq_grp->napi_ndev = alloc_netdev_dummy(0); 584 - if (!irq_grp->napi_ndev) 585 - return -ENOMEM; 583 + if (!irq_grp->napi_ndev) { 584 + ret = -ENOMEM; 585 + goto fail_allocate; 586 + } 586 587 587 588 netif_napi_add(irq_grp->napi_ndev, &irq_grp->napi, 588 589 ath11k_pcic_ext_grp_napi_poll); ··· 609 606 int irq = ath11k_pcic_get_msi_irq(ab, vector); 610 607 611 608 if (irq < 0) { 612 - for (n = 0; n <= i; n++) { 613 - irq_grp = &ab->ext_irq_grp[n]; 614 - free_netdev(irq_grp->napi_ndev); 615 - } 616 - return irq; 609 + ret = irq; 610 + goto fail_irq; 617 611 } 618 612 619 613 ab->irq_num[irq_idx] = irq; ··· 635 635 } 636 636 637 637 return 0; 638 + fail_irq: 639 + /* i ->napi_ndev was properly allocated. Free it also */ 640 + i += 1; 641 + fail_allocate: 642 + for (n = 0; n < i; n++) { 643 + irq_grp = &ab->ext_irq_grp[n]; 644 + free_netdev(irq_grp->napi_ndev); 645 + } 646 + return ret; 638 647 } 639 648 640 649 int ath11k_pcic_config_irq(struct ath11k_base *ab)
+1 -1
drivers/net/wireless/intel/iwlwifi/iwl-drv.c
··· 1815 1815 err_fw: 1816 1816 #ifdef CONFIG_IWLWIFI_DEBUGFS 1817 1817 debugfs_remove_recursive(drv->dbgfs_drv); 1818 - iwl_dbg_tlv_free(drv->trans); 1819 1818 #endif 1819 + iwl_dbg_tlv_free(drv->trans); 1820 1820 kfree(drv); 1821 1821 err: 1822 1822 return ERR_PTR(ret);
+13 -3
drivers/net/wireless/intel/iwlwifi/mvm/d3.c
··· 595 595 void *_data) 596 596 { 597 597 struct wowlan_key_gtk_type_iter *data = _data; 598 + __le32 *cipher = NULL; 599 + 600 + if (key->keyidx == 4 || key->keyidx == 5) 601 + cipher = &data->kek_kck_cmd->igtk_cipher; 602 + if (key->keyidx == 6 || key->keyidx == 7) 603 + cipher = &data->kek_kck_cmd->bigtk_cipher; 598 604 599 605 switch (key->cipher) { 600 606 default: ··· 612 606 return; 613 607 case WLAN_CIPHER_SUITE_BIP_GMAC_256: 614 608 case WLAN_CIPHER_SUITE_BIP_GMAC_128: 615 - data->kek_kck_cmd->igtk_cipher = cpu_to_le32(STA_KEY_FLG_GCMP); 609 + if (cipher) 610 + *cipher = cpu_to_le32(STA_KEY_FLG_GCMP); 616 611 return; 617 612 case WLAN_CIPHER_SUITE_AES_CMAC: 618 - data->kek_kck_cmd->igtk_cipher = cpu_to_le32(STA_KEY_FLG_CCM); 613 + case WLAN_CIPHER_SUITE_BIP_CMAC_256: 614 + if (cipher) 615 + *cipher = cpu_to_le32(STA_KEY_FLG_CCM); 619 616 return; 620 617 case WLAN_CIPHER_SUITE_CCMP: 621 618 if (!sta) ··· 2350 2341 2351 2342 out: 2352 2343 if (iwl_fw_lookup_notif_ver(mvm->fw, LONG_GROUP, 2353 - WOWLAN_GET_STATUSES, 0) < 10) { 2344 + WOWLAN_GET_STATUSES, 2345 + IWL_FW_CMD_VER_UNKNOWN) < 10) { 2354 2346 mvmvif->seqno_valid = true; 2355 2347 /* +0x10 because the set API expects next-to-use, not last-used */ 2356 2348 mvmvif->seqno = status->non_qos_seq_ctr + 0x10;
+9
drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
··· 1617 1617 &beacon_cmd.tim_size, 1618 1618 beacon->data, beacon->len); 1619 1619 1620 + if (iwl_fw_lookup_cmd_ver(mvm->fw, 1621 + BEACON_TEMPLATE_CMD, 0) >= 14) { 1622 + u32 offset = iwl_mvm_find_ie_offset(beacon->data, 1623 + WLAN_EID_S1G_TWT, 1624 + beacon->len); 1625 + 1626 + beacon_cmd.btwt_offset = cpu_to_le32(offset); 1627 + } 1628 + 1620 1629 iwl_mvm_mac_ctxt_send_beacon_cmd(mvm, beacon, &beacon_cmd, 1621 1630 sizeof(beacon_cmd)); 1622 1631 }
+2 -12
drivers/net/wireless/intel/iwlwifi/mvm/fw.c
··· 94 94 { 95 95 struct iwl_rx_packet *pkt = rxb_addr(rxb); 96 96 struct iwl_mfu_assert_dump_notif *mfu_dump_notif = (void *)pkt->data; 97 - __le32 *dump_data = mfu_dump_notif->data; 98 - int n_words = le32_to_cpu(mfu_dump_notif->data_size) / sizeof(__le32); 99 - int i; 100 97 101 98 if (mfu_dump_notif->index_num == 0) 102 99 IWL_INFO(mvm, "MFUART assert id 0x%x occurred\n", 103 100 le32_to_cpu(mfu_dump_notif->assert_id)); 104 - 105 - for (i = 0; i < n_words; i++) 106 - IWL_DEBUG_INFO(mvm, 107 - "MFUART assert dump, dword %u: 0x%08x\n", 108 - le16_to_cpu(mfu_dump_notif->index_num) * 109 - n_words + i, 110 - le32_to_cpu(dump_data[i])); 111 101 } 112 102 113 103 static bool iwl_alive_fn(struct iwl_notif_wait_data *notif_wait, ··· 885 895 int ret; 886 896 u16 len = 0; 887 897 u32 n_subbands; 888 - u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, 889 - IWL_FW_CMD_VER_UNKNOWN); 898 + u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, 3); 899 + 890 900 if (cmd_ver >= 7) { 891 901 len = sizeof(cmd.v7); 892 902 n_subbands = IWL_NUM_SUB_BANDS_V2;
+1 -1
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
··· 873 873 } 874 874 } 875 875 876 - static u32 iwl_mvm_find_ie_offset(u8 *beacon, u8 eid, u32 frame_size) 876 + u32 iwl_mvm_find_ie_offset(u8 *beacon, u8 eid, u32 frame_size) 877 877 { 878 878 struct ieee80211_mgmt *mgmt = (void *)beacon; 879 879 const u8 *ie;
+38 -1
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
··· 1128 1128 RCU_INIT_POINTER(mvmvif->deflink.probe_resp_data, NULL); 1129 1129 } 1130 1130 1131 + static void iwl_mvm_cleanup_sta_iterator(void *data, struct ieee80211_sta *sta) 1132 + { 1133 + struct iwl_mvm *mvm = data; 1134 + struct iwl_mvm_sta *mvm_sta; 1135 + struct ieee80211_vif *vif; 1136 + int link_id; 1137 + 1138 + mvm_sta = iwl_mvm_sta_from_mac80211(sta); 1139 + vif = mvm_sta->vif; 1140 + 1141 + if (!sta->valid_links) 1142 + return; 1143 + 1144 + for (link_id = 0; link_id < ARRAY_SIZE((sta)->link); link_id++) { 1145 + struct iwl_mvm_link_sta *mvm_link_sta; 1146 + 1147 + mvm_link_sta = 1148 + rcu_dereference_check(mvm_sta->link[link_id], 1149 + lockdep_is_held(&mvm->mutex)); 1150 + if (mvm_link_sta && !(vif->active_links & BIT(link_id))) { 1151 + /* 1152 + * We have a link STA but the link is inactive in 1153 + * mac80211. This will happen if we failed to 1154 + * deactivate the link but mac80211 roll back the 1155 + * deactivation of the link. 1156 + * Delete the stale data to avoid issues later on. 1157 + */ 1158 + iwl_mvm_mld_free_sta_link(mvm, mvm_sta, mvm_link_sta, 1159 + link_id, false); 1160 + } 1161 + } 1162 + } 1163 + 1131 1164 static void iwl_mvm_restart_cleanup(struct iwl_mvm *mvm) 1132 1165 { 1133 1166 iwl_mvm_stop_device(mvm); ··· 1182 1149 * gone down during the HW restart 1183 1150 */ 1184 1151 ieee80211_iterate_interfaces(mvm->hw, 0, iwl_mvm_cleanup_iterator, mvm); 1152 + 1153 + /* cleanup stations as links may be gone after restart */ 1154 + ieee80211_iterate_stations_atomic(mvm->hw, 1155 + iwl_mvm_cleanup_sta_iterator, mvm); 1185 1156 1186 1157 mvm->p2p_device_vif = NULL; 1187 1158 ··· 6385 6348 .len[0] = sizeof(cmd), 6386 6349 .data[1] = data, 6387 6350 .len[1] = size, 6388 - .flags = sync ? 0 : CMD_ASYNC, 6351 + .flags = CMD_SEND_IN_RFKILL | (sync ? 0 : CMD_ASYNC), 6389 6352 }; 6390 6353 int ret; 6391 6354
-2
drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c
··· 75 75 goto out_free_bf; 76 76 77 77 iwl_mvm_tcm_add_vif(mvm, vif); 78 - INIT_DELAYED_WORK(&mvmvif->csa_work, 79 - iwl_mvm_channel_switch_disconnect_wk); 80 78 81 79 if (vif->type == NL80211_IFTYPE_MONITOR) { 82 80 mvm->monitor_on = true;
+7 -6
drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c
··· 515 515 return iwl_mvm_mld_send_sta_cmd(mvm, &cmd); 516 516 } 517 517 518 - static void iwl_mvm_mld_free_sta_link(struct iwl_mvm *mvm, 519 - struct iwl_mvm_sta *mvm_sta, 520 - struct iwl_mvm_link_sta *mvm_sta_link, 521 - unsigned int link_id, 522 - bool is_in_fw) 518 + void iwl_mvm_mld_free_sta_link(struct iwl_mvm *mvm, 519 + struct iwl_mvm_sta *mvm_sta, 520 + struct iwl_mvm_link_sta *mvm_sta_link, 521 + unsigned int link_id, 522 + bool is_in_fw) 523 523 { 524 524 RCU_INIT_POINTER(mvm->fw_id_to_mac_id[mvm_sta_link->sta_id], 525 525 is_in_fw ? ERR_PTR(-EINVAL) : NULL); ··· 1014 1014 1015 1015 cmd.modify.tid = cpu_to_le32(data->tid); 1016 1016 1017 - ret = iwl_mvm_send_cmd_pdu(mvm, cmd_id, 0, sizeof(cmd), &cmd); 1017 + ret = iwl_mvm_send_cmd_pdu(mvm, cmd_id, CMD_SEND_IN_RFKILL, 1018 + sizeof(cmd), &cmd); 1018 1019 data->sta_mask = new_sta_mask; 1019 1020 if (ret) 1020 1021 return ret;
+1
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
··· 1758 1758 void iwl_mvm_get_sync_time(struct iwl_mvm *mvm, int clock_type, u32 *gp2, 1759 1759 u64 *boottime, ktime_t *realtime); 1760 1760 u32 iwl_mvm_get_systime(struct iwl_mvm *mvm); 1761 + u32 iwl_mvm_find_ie_offset(u8 *beacon, u8 eid, u32 frame_size); 1761 1762 1762 1763 /* Tx / Host Commands */ 1763 1764 int __must_check iwl_mvm_send_cmd(struct iwl_mvm *mvm,
+2 -7
drivers/net/wireless/intel/iwlwifi/mvm/rs.h
··· 122 122 123 123 #define LINK_QUAL_AGG_FRAME_LIMIT_DEF (63) 124 124 #define LINK_QUAL_AGG_FRAME_LIMIT_MAX (63) 125 - /* 126 - * FIXME - various places in firmware API still use u8, 127 - * e.g. LQ command and SCD config command. 128 - * This should be 256 instead. 129 - */ 130 - #define LINK_QUAL_AGG_FRAME_LIMIT_GEN2_DEF (255) 131 - #define LINK_QUAL_AGG_FRAME_LIMIT_GEN2_MAX (255) 125 + #define LINK_QUAL_AGG_FRAME_LIMIT_GEN2_DEF (64) 126 + #define LINK_QUAL_AGG_FRAME_LIMIT_GEN2_MAX (64) 132 127 #define LINK_QUAL_AGG_FRAME_LIMIT_MIN (0) 133 128 134 129 #define LQ_SIZE 2 /* 2 mode tables: "Active" and "Search" */
+4 -1
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
··· 2450 2450 * 2451 2451 * We mark it as mac header, for upper layers to know where 2452 2452 * all radio tap header ends. 2453 + * 2454 + * Since data doesn't move data while putting data on skb and that is 2455 + * the only way we use, data + len is the next place that hdr would be put 2453 2456 */ 2454 - skb_reset_mac_header(skb); 2457 + skb_set_mac_header(skb, skb->len); 2455 2458 2456 2459 /* 2457 2460 * Override the nss from the rx_vec since the rate_n_flags has
+8 -4
drivers/net/wireless/intel/iwlwifi/mvm/scan.c
··· 1313 1313 if (IWL_MVM_ADWELL_MAX_BUDGET) 1314 1314 cmd->v7.adwell_max_budget = 1315 1315 cpu_to_le16(IWL_MVM_ADWELL_MAX_BUDGET); 1316 - else if (params->ssids && params->ssids[0].ssid_len) 1316 + else if (params->n_ssids && params->ssids[0].ssid_len) 1317 1317 cmd->v7.adwell_max_budget = 1318 1318 cpu_to_le16(IWL_SCAN_ADWELL_MAX_BUDGET_DIRECTED_SCAN); 1319 1319 else ··· 1418 1418 if (IWL_MVM_ADWELL_MAX_BUDGET) 1419 1419 general_params->adwell_max_budget = 1420 1420 cpu_to_le16(IWL_MVM_ADWELL_MAX_BUDGET); 1421 - else if (params->ssids && params->ssids[0].ssid_len) 1421 + else if (params->n_ssids && params->ssids[0].ssid_len) 1422 1422 general_params->adwell_max_budget = 1423 1423 cpu_to_le16(IWL_SCAN_ADWELL_MAX_BUDGET_DIRECTED_SCAN); 1424 1424 else ··· 1730 1730 break; 1731 1731 } 1732 1732 1733 - if (k == idex_b && idex_b < SCAN_BSSID_MAX_SIZE) { 1733 + if (k == idex_b && idex_b < SCAN_BSSID_MAX_SIZE && 1734 + !WARN_ONCE(!is_valid_ether_addr(scan_6ghz_params[j].bssid), 1735 + "scan: invalid BSSID at index %u, index_b=%u\n", 1736 + j, idex_b)) { 1734 1737 memcpy(&pp->bssid_array[idex_b++], 1735 1738 scan_6ghz_params[j].bssid, ETH_ALEN); 1736 1739 } ··· 3322 3319 3323 3320 ret = iwl_mvm_send_cmd_pdu(mvm, 3324 3321 WIDE_ID(IWL_ALWAYS_LONG_GROUP, SCAN_ABORT_UMAC), 3325 - 0, sizeof(cmd), &cmd); 3322 + CMD_SEND_IN_RFKILL, sizeof(cmd), &cmd); 3326 3323 if (!ret) 3327 3324 mvm->scan_uid_status[uid] = type << IWL_MVM_SCAN_STOPPING_SHIFT; 3328 3325 3326 + IWL_DEBUG_SCAN(mvm, "Scan abort: ret=%d\n", ret); 3329 3327 return ret; 3330 3328 } 3331 3329
+8 -4
drivers/net/wireless/intel/iwlwifi/mvm/sta.c
··· 2848 2848 .action = start ? cpu_to_le32(IWL_RX_BAID_ACTION_ADD) : 2849 2849 cpu_to_le32(IWL_RX_BAID_ACTION_REMOVE), 2850 2850 }; 2851 - u32 cmd_id = WIDE_ID(DATA_PATH_GROUP, RX_BAID_ALLOCATION_CONFIG_CMD); 2851 + struct iwl_host_cmd hcmd = { 2852 + .id = WIDE_ID(DATA_PATH_GROUP, RX_BAID_ALLOCATION_CONFIG_CMD), 2853 + .flags = CMD_SEND_IN_RFKILL, 2854 + .len[0] = sizeof(cmd), 2855 + .data[0] = &cmd, 2856 + }; 2852 2857 int ret; 2853 2858 2854 2859 BUILD_BUG_ON(sizeof(struct iwl_rx_baid_cfg_resp) != sizeof(baid)); ··· 2865 2860 cmd.alloc.ssn = cpu_to_le16(ssn); 2866 2861 cmd.alloc.win_size = cpu_to_le16(buf_size); 2867 2862 baid = -EIO; 2868 - } else if (iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, 1) == 1) { 2863 + } else if (iwl_fw_lookup_cmd_ver(mvm->fw, hcmd.id, 1) == 1) { 2869 2864 cmd.remove_v1.baid = cpu_to_le32(baid); 2870 2865 BUILD_BUG_ON(sizeof(cmd.remove_v1) > sizeof(cmd.remove)); 2871 2866 } else { ··· 2874 2869 cmd.remove.tid = cpu_to_le32(tid); 2875 2870 } 2876 2871 2877 - ret = iwl_mvm_send_cmd_pdu_status(mvm, cmd_id, sizeof(cmd), 2878 - &cmd, &baid); 2872 + ret = iwl_mvm_send_cmd_status(mvm, &hcmd, &baid); 2879 2873 if (ret) 2880 2874 return ret; 2881 2875
+5
drivers/net/wireless/intel/iwlwifi/mvm/sta.h
··· 662 662 struct ieee80211_sta *sta); 663 663 int iwl_mvm_mld_rm_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif, 664 664 struct ieee80211_sta *sta); 665 + void iwl_mvm_mld_free_sta_link(struct iwl_mvm *mvm, 666 + struct iwl_mvm_sta *mvm_sta, 667 + struct iwl_mvm_link_sta *mvm_sta_link, 668 + unsigned int link_id, 669 + bool is_in_fw); 665 670 int iwl_mvm_mld_rm_sta_id(struct iwl_mvm *mvm, u8 sta_id); 666 671 int iwl_mvm_mld_update_sta_links(struct iwl_mvm *mvm, 667 672 struct ieee80211_vif *vif,
+4
drivers/net/wireless/mediatek/mt76/mt7615/main.c
··· 1326 1326 #endif /* CONFIG_PM */ 1327 1327 1328 1328 const struct ieee80211_ops mt7615_ops = { 1329 + .add_chanctx = ieee80211_emulate_add_chanctx, 1330 + .remove_chanctx = ieee80211_emulate_remove_chanctx, 1331 + .change_chanctx = ieee80211_emulate_change_chanctx, 1332 + .switch_vif_chanctx = ieee80211_emulate_switch_vif_chanctx, 1329 1333 .tx = mt7615_tx, 1330 1334 .start = mt7615_start, 1331 1335 .stop = mt7615_stop,
+24 -17
drivers/net/wireless/microchip/wilc1000/cfg80211.c
··· 237 237 struct wilc_vif *vif; 238 238 u32 channelnum; 239 239 int result; 240 + int srcu_idx; 240 241 241 - rcu_read_lock(); 242 + srcu_idx = srcu_read_lock(&wl->srcu); 242 243 vif = wilc_get_wl_to_vif(wl); 243 244 if (IS_ERR(vif)) { 244 - rcu_read_unlock(); 245 + srcu_read_unlock(&wl->srcu, srcu_idx); 245 246 return PTR_ERR(vif); 246 247 } 247 248 ··· 253 252 if (result) 254 253 netdev_err(vif->ndev, "Error in setting channel\n"); 255 254 256 - rcu_read_unlock(); 255 + srcu_read_unlock(&wl->srcu, srcu_idx); 257 256 return result; 258 257 } 259 258 ··· 806 805 struct wilc *wl = wiphy_priv(wiphy); 807 806 struct wilc_vif *vif; 808 807 struct wilc_priv *priv; 808 + int srcu_idx; 809 809 810 - rcu_read_lock(); 810 + srcu_idx = srcu_read_lock(&wl->srcu); 811 811 vif = wilc_get_wl_to_vif(wl); 812 812 if (IS_ERR(vif)) 813 813 goto out; ··· 863 861 netdev_err(priv->dev, "Error in setting WIPHY PARAMS\n"); 864 862 865 863 out: 866 - rcu_read_unlock(); 864 + srcu_read_unlock(&wl->srcu, srcu_idx); 867 865 return ret; 868 866 } 869 867 ··· 1539 1537 1540 1538 if (type == NL80211_IFTYPE_MONITOR) { 1541 1539 struct net_device *ndev; 1540 + int srcu_idx; 1542 1541 1543 - rcu_read_lock(); 1542 + srcu_idx = srcu_read_lock(&wl->srcu); 1544 1543 vif = wilc_get_vif_from_type(wl, WILC_AP_MODE); 1545 1544 if (!vif) { 1546 1545 vif = wilc_get_vif_from_type(wl, WILC_GO_MODE); 1547 1546 if (!vif) { 1548 - rcu_read_unlock(); 1547 + srcu_read_unlock(&wl->srcu, srcu_idx); 1549 1548 goto validate_interface; 1550 1549 } 1551 1550 } 1552 1551 1553 1552 if (vif->monitor_flag) { 1554 - rcu_read_unlock(); 1553 + srcu_read_unlock(&wl->srcu, srcu_idx); 1555 1554 goto validate_interface; 1556 1555 } 1557 1556 ··· 1560 1557 if (ndev) { 1561 1558 vif->monitor_flag = 1; 1562 1559 } else { 1563 - rcu_read_unlock(); 1560 + srcu_read_unlock(&wl->srcu, srcu_idx); 1564 1561 return ERR_PTR(-EINVAL); 1565 1562 } 1566 1563 1567 1564 wdev = &vif->priv.wdev; 1568 - rcu_read_unlock(); 1565 + srcu_read_unlock(&wl->srcu, srcu_idx); 1569 1566 return wdev; 1570 1567 } 1571 1568 ··· 1613 1610 list_del_rcu(&vif->list); 1614 1611 wl->vif_num--; 1615 1612 mutex_unlock(&wl->vif_mutex); 1616 - synchronize_rcu(); 1613 + synchronize_srcu(&wl->srcu); 1617 1614 return 0; 1618 1615 } 1619 1616 ··· 1638 1635 { 1639 1636 struct wilc *wl = wiphy_priv(wiphy); 1640 1637 struct wilc_vif *vif; 1638 + int srcu_idx; 1641 1639 1642 - rcu_read_lock(); 1640 + srcu_idx = srcu_read_lock(&wl->srcu); 1643 1641 vif = wilc_get_wl_to_vif(wl); 1644 1642 if (IS_ERR(vif)) { 1645 - rcu_read_unlock(); 1643 + srcu_read_unlock(&wl->srcu, srcu_idx); 1646 1644 return; 1647 1645 } 1648 1646 1649 1647 netdev_info(vif->ndev, "cfg set wake up = %d\n", enabled); 1650 1648 wilc_set_wowlan_trigger(vif, enabled); 1651 - rcu_read_unlock(); 1649 + srcu_read_unlock(&wl->srcu, srcu_idx); 1652 1650 } 1653 1651 1654 1652 static int set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, 1655 1653 enum nl80211_tx_power_setting type, int mbm) 1656 1654 { 1657 1655 int ret; 1656 + int srcu_idx; 1658 1657 s32 tx_power = MBM_TO_DBM(mbm); 1659 1658 struct wilc *wl = wiphy_priv(wiphy); 1660 1659 struct wilc_vif *vif; ··· 1664 1659 if (!wl->initialized) 1665 1660 return -EIO; 1666 1661 1667 - rcu_read_lock(); 1662 + srcu_idx = srcu_read_lock(&wl->srcu); 1668 1663 vif = wilc_get_wl_to_vif(wl); 1669 1664 if (IS_ERR(vif)) { 1670 - rcu_read_unlock(); 1665 + srcu_read_unlock(&wl->srcu, srcu_idx); 1671 1666 return -EINVAL; 1672 1667 } 1673 1668 ··· 1679 1674 ret = wilc_set_tx_power(vif, tx_power); 1680 1675 if (ret) 1681 1676 netdev_err(vif->ndev, "Failed to set tx power\n"); 1682 - rcu_read_unlock(); 1677 + srcu_read_unlock(&wl->srcu, srcu_idx); 1683 1678 1684 1679 return ret; 1685 1680 } ··· 1762 1757 init_completion(&wl->cfg_event); 1763 1758 init_completion(&wl->sync_event); 1764 1759 init_completion(&wl->txq_thread_started); 1760 + init_srcu_struct(&wl->srcu); 1765 1761 } 1766 1762 1767 1763 void wlan_deinit_locks(struct wilc *wilc) ··· 1773 1767 mutex_destroy(&wilc->txq_add_to_head_cs); 1774 1768 mutex_destroy(&wilc->vif_mutex); 1775 1769 mutex_destroy(&wilc->deinit_lock); 1770 + cleanup_srcu_struct(&wilc->srcu); 1776 1771 } 1777 1772 1778 1773 int wilc_cfg80211_init(struct wilc **wilc, struct device *dev, int io_type,
+10 -7
drivers/net/wireless/microchip/wilc1000/hif.c
··· 1570 1570 struct host_if_drv *hif_drv; 1571 1571 struct host_if_msg *msg; 1572 1572 struct wilc_vif *vif; 1573 + int srcu_idx; 1573 1574 int result; 1574 1575 int id; 1575 1576 1576 1577 id = get_unaligned_le32(&buffer[length - 4]); 1577 - rcu_read_lock(); 1578 + srcu_idx = srcu_read_lock(&wilc->srcu); 1578 1579 vif = wilc_get_vif_from_idx(wilc, id); 1579 1580 if (!vif) 1580 1581 goto out; ··· 1594 1593 msg->body.net_info.rssi = buffer[8]; 1595 1594 msg->body.net_info.mgmt = kmemdup(&buffer[9], 1596 1595 msg->body.net_info.frame_len, 1597 - GFP_ATOMIC); 1596 + GFP_KERNEL); 1598 1597 if (!msg->body.net_info.mgmt) { 1599 1598 kfree(msg); 1600 1599 goto out; ··· 1607 1606 kfree(msg); 1608 1607 } 1609 1608 out: 1610 - rcu_read_unlock(); 1609 + srcu_read_unlock(&wilc->srcu, srcu_idx); 1611 1610 } 1612 1611 1613 1612 void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *buffer, u32 length) ··· 1615 1614 struct host_if_drv *hif_drv; 1616 1615 struct host_if_msg *msg; 1617 1616 struct wilc_vif *vif; 1617 + int srcu_idx; 1618 1618 int result; 1619 1619 int id; 1620 1620 1621 1621 mutex_lock(&wilc->deinit_lock); 1622 1622 1623 1623 id = get_unaligned_le32(&buffer[length - 4]); 1624 - rcu_read_lock(); 1624 + srcu_idx = srcu_read_lock(&wilc->srcu); 1625 1625 vif = wilc_get_vif_from_idx(wilc, id); 1626 1626 if (!vif) 1627 1627 goto out; ··· 1649 1647 kfree(msg); 1650 1648 } 1651 1649 out: 1652 - rcu_read_unlock(); 1650 + srcu_read_unlock(&wilc->srcu, srcu_idx); 1653 1651 mutex_unlock(&wilc->deinit_lock); 1654 1652 } 1655 1653 ··· 1657 1655 { 1658 1656 struct host_if_drv *hif_drv; 1659 1657 struct wilc_vif *vif; 1658 + int srcu_idx; 1660 1659 int result; 1661 1660 int id; 1662 1661 1663 1662 id = get_unaligned_le32(&buffer[length - 4]); 1664 - rcu_read_lock(); 1663 + srcu_idx = srcu_read_lock(&wilc->srcu); 1665 1664 vif = wilc_get_vif_from_idx(wilc, id); 1666 1665 if (!vif) 1667 1666 goto out; ··· 1687 1684 } 1688 1685 } 1689 1686 out: 1690 - rcu_read_unlock(); 1687 + srcu_read_unlock(&wilc->srcu, srcu_idx); 1691 1688 } 1692 1689 1693 1690 int wilc_remain_on_channel(struct wilc_vif *vif, u64 cookie, u16 chan,
+25 -18
drivers/net/wireless/microchip/wilc1000/netdev.c
··· 127 127 128 128 int wilc_wlan_get_num_conn_ifcs(struct wilc *wilc) 129 129 { 130 + int srcu_idx; 130 131 u8 ret_val = 0; 131 132 struct wilc_vif *vif; 132 133 133 - rcu_read_lock(); 134 + srcu_idx = srcu_read_lock(&wilc->srcu); 134 135 wilc_for_each_vif(wilc, vif) { 135 136 if (!is_zero_ether_addr(vif->bssid)) 136 137 ret_val++; 137 138 } 138 - rcu_read_unlock(); 139 + srcu_read_unlock(&wilc->srcu, srcu_idx); 139 140 return ret_val; 140 141 } 141 142 142 143 static void wilc_wake_tx_queues(struct wilc *wl) 143 144 { 145 + int srcu_idx; 144 146 struct wilc_vif *ifc; 145 147 146 - rcu_read_lock(); 148 + srcu_idx = srcu_read_lock(&wl->srcu); 147 149 wilc_for_each_vif(wl, ifc) { 148 150 if (ifc->mac_opened && netif_queue_stopped(ifc->ndev)) 149 151 netif_wake_queue(ifc->ndev); 150 152 } 151 - rcu_read_unlock(); 153 + srcu_read_unlock(&wl->srcu, srcu_idx); 152 154 } 153 155 154 156 static int wilc_txq_task(void *vp) ··· 655 653 struct sockaddr *addr = (struct sockaddr *)p; 656 654 unsigned char mac_addr[ETH_ALEN]; 657 655 struct wilc_vif *tmp_vif; 656 + int srcu_idx; 658 657 659 658 if (!is_valid_ether_addr(addr->sa_data)) 660 659 return -EADDRNOTAVAIL; ··· 667 664 668 665 /* Verify MAC Address is not already in use: */ 669 666 670 - rcu_read_lock(); 667 + srcu_idx = srcu_read_lock(&wilc->srcu); 671 668 wilc_for_each_vif(wilc, tmp_vif) { 672 669 wilc_get_mac_address(tmp_vif, mac_addr); 673 670 if (ether_addr_equal(addr->sa_data, mac_addr)) { 674 671 if (vif != tmp_vif) { 675 - rcu_read_unlock(); 672 + srcu_read_unlock(&wilc->srcu, srcu_idx); 676 673 return -EADDRNOTAVAIL; 677 674 } 678 - rcu_read_unlock(); 675 + srcu_read_unlock(&wilc->srcu, srcu_idx); 679 676 return 0; 680 677 } 681 678 } 682 - rcu_read_unlock(); 679 + srcu_read_unlock(&wilc->srcu, srcu_idx); 683 680 684 681 result = wilc_set_mac_address(vif, (u8 *)addr->sa_data); 685 682 if (result) ··· 767 764 wilc_tx_complete); 768 765 769 766 if (queue_count > FLOW_CONTROL_UPPER_THRESHOLD) { 767 + int srcu_idx; 770 768 struct wilc_vif *vif; 771 769 772 - rcu_read_lock(); 770 + srcu_idx = srcu_read_lock(&wilc->srcu); 773 771 wilc_for_each_vif(wilc, vif) { 774 772 if (vif->mac_opened) 775 773 netif_stop_queue(vif->ndev); 776 774 } 777 - rcu_read_unlock(); 775 + srcu_read_unlock(&wilc->srcu, srcu_idx); 778 776 } 779 777 780 778 return NETDEV_TX_OK; ··· 819 815 unsigned int frame_len = 0; 820 816 struct wilc_vif *vif; 821 817 struct sk_buff *skb; 818 + int srcu_idx; 822 819 int stats; 823 820 824 821 if (!wilc) 825 822 return; 826 823 827 - rcu_read_lock(); 824 + srcu_idx = srcu_read_lock(&wilc->srcu); 828 825 wilc_netdev = get_if_handler(wilc, buff); 829 826 if (!wilc_netdev) 830 827 goto out; ··· 853 848 netdev_dbg(wilc_netdev, "netif_rx ret value is: %d\n", stats); 854 849 } 855 850 out: 856 - rcu_read_unlock(); 851 + srcu_read_unlock(&wilc->srcu, srcu_idx); 857 852 } 858 853 859 854 void wilc_wfi_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size, bool is_auth) 860 855 { 856 + int srcu_idx; 861 857 struct wilc_vif *vif; 862 858 863 - rcu_read_lock(); 859 + srcu_idx = srcu_read_lock(&wilc->srcu); 864 860 wilc_for_each_vif(wilc, vif) { 865 861 struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)buff; 866 862 u16 type = le16_to_cpup((__le16 *)buff); ··· 882 876 if (vif->monitor_flag) 883 877 wilc_wfi_monitor_rx(wilc->monitor_dev, buff, size); 884 878 } 885 - rcu_read_unlock(); 879 + srcu_read_unlock(&wilc->srcu, srcu_idx); 886 880 } 887 881 888 882 static const struct net_device_ops wilc_netdev_ops = { ··· 912 906 list_del_rcu(&vif->list); 913 907 wilc->vif_num--; 914 908 mutex_unlock(&wilc->vif_mutex); 915 - synchronize_rcu(); 909 + synchronize_srcu(&wilc->srcu); 916 910 if (vif->ndev) 917 911 unregister_netdev(vif->ndev); 918 912 } ··· 931 925 { 932 926 int idx = 0; 933 927 struct wilc_vif *vif; 928 + int srcu_idx; 934 929 935 - rcu_read_lock(); 930 + srcu_idx = srcu_read_lock(&wl->srcu); 936 931 wilc_for_each_vif(wl, vif) { 937 932 if (vif->idx == 0) 938 933 idx = 1; 939 934 else 940 935 idx = 0; 941 936 } 942 - rcu_read_unlock(); 937 + srcu_read_unlock(&wl->srcu, srcu_idx); 943 938 return idx; 944 939 } 945 940 ··· 990 983 list_add_tail_rcu(&vif->list, &wl->vif_list); 991 984 wl->vif_num += 1; 992 985 mutex_unlock(&wl->vif_mutex); 993 - synchronize_rcu(); 986 + synchronize_srcu(&wl->srcu); 994 987 995 988 return vif; 996 989
+10 -2
drivers/net/wireless/microchip/wilc1000/netdev.h
··· 32 32 33 33 #define wilc_for_each_vif(w, v) \ 34 34 struct wilc *_w = w; \ 35 - list_for_each_entry_rcu(v, &_w->vif_list, list, \ 36 - rcu_read_lock_held()) 35 + list_for_each_entry_srcu(v, &_w->vif_list, list, \ 36 + srcu_read_lock_held(&_w->srcu)) 37 37 38 38 struct wilc_wfi_stats { 39 39 unsigned long rx_packets; ··· 220 220 221 221 /* protect vif list */ 222 222 struct mutex vif_mutex; 223 + /* Sleepable RCU struct to manipulate vif list. Sleepable version is 224 + * needed over the classic RCU version because the driver's current 225 + * design involves some sleeping code while manipulating a vif 226 + * retrieved from vif list (so in a SRCU critical section), like: 227 + * - sending commands to the chip, using info from retrieved vif 228 + * - registering a new monitoring net device 229 + */ 230 + struct srcu_struct srcu; 223 231 u8 open_ifcs; 224 232 225 233 /* protect head of transmit queue */
+3 -2
drivers/net/wireless/microchip/wilc1000/wlan.c
··· 712 712 u32 *vmm_table = wilc->vmm_table; 713 713 u8 ac_pkt_num_to_chip[NQUEUES] = {0, 0, 0, 0}; 714 714 const struct wilc_hif_func *func; 715 + int srcu_idx; 715 716 u8 *txb = wilc->tx_buffer; 716 717 struct wilc_vif *vif; 717 718 ··· 724 723 725 724 mutex_lock(&wilc->txq_add_to_head_cs); 726 725 727 - rcu_read_lock(); 726 + srcu_idx = srcu_read_lock(&wilc->srcu); 728 727 wilc_for_each_vif(wilc, vif) 729 728 wilc_wlan_txq_filter_dup_tcp_ack(vif->ndev); 730 - rcu_read_unlock(); 729 + srcu_read_unlock(&wilc->srcu, srcu_idx); 731 730 732 731 for (ac = 0; ac < NQUEUES; ac++) 733 732 tqe_q[ac] = wilc_wlan_txq_get_first(wilc, ac);
-15
drivers/net/wireless/realtek/rtlwifi/core.c
··· 633 633 } 634 634 } 635 635 636 - if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS) { 637 - rtl_dbg(rtlpriv, COMP_MAC80211, DBG_LOUD, 638 - "IEEE80211_CONF_CHANGE_RETRY_LIMITS %x\n", 639 - hw->conf.long_frame_max_tx_count); 640 - /* brought up everything changes (changed == ~0) indicates first 641 - * open, so use our default value instead of that of wiphy. 642 - */ 643 - if (changed != ~0) { 644 - mac->retry_long = hw->conf.long_frame_max_tx_count; 645 - mac->retry_short = hw->conf.long_frame_max_tx_count; 646 - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RETRY_LIMIT, 647 - (u8 *)(&hw->conf.long_frame_max_tx_count)); 648 - } 649 - } 650 - 651 636 if (changed & IEEE80211_CONF_CHANGE_CHANNEL && 652 637 !rtlpriv->proximity.proxim_on) { 653 638 struct ieee80211_channel *channel = hw->conf.chandef.chan;
+1 -1
drivers/net/wwan/iosm/iosm_ipc_devlink.c
··· 211 211 rc = PTR_ERR(devlink->cd_regions[i]); 212 212 dev_err(devlink->dev, "Devlink region fail,err %d", rc); 213 213 /* Delete previously created regions */ 214 - for ( ; i >= 0; i--) 214 + for (i--; i >= 0; i--) 215 215 devlink_region_destroy(devlink->cd_regions[i]); 216 216 goto region_create_fail; 217 217 }
+2 -1
drivers/ptp/ptp_chardev.c
··· 85 85 } 86 86 87 87 if (info->verify(info, pin, func, chan)) { 88 - pr_err("driver cannot use function %u on pin %u\n", func, chan); 88 + pr_err("driver cannot use function %u and channel %u on pin %u\n", 89 + func, chan, pin); 89 90 return -EOPNOTSUPP; 90 91 } 91 92
+1
include/net/rtnetlink.h
··· 13 13 RTNL_FLAG_DOIT_UNLOCKED = BIT(0), 14 14 RTNL_FLAG_BULK_DEL_SUPPORTED = BIT(1), 15 15 RTNL_FLAG_DUMP_UNLOCKED = BIT(2), 16 + RTNL_FLAG_DUMP_SPLIT_NLM_DONE = BIT(3), /* legacy behavior */ 16 17 }; 17 18 18 19 enum rtnl_kinds {
+4 -3
include/net/tcp_ao.h
··· 86 86 struct tcp_ao_info { 87 87 /* List of tcp_ao_key's */ 88 88 struct hlist_head head; 89 - /* current_key and rnext_key aren't maintained on listen sockets. 89 + /* current_key and rnext_key are maintained on sockets 90 + * in TCP_AO_ESTABLISHED states. 90 91 * Their purpose is to cache keys on established connections, 91 92 * saving needless lookups. Never dereference any of them from 92 93 * listen sockets. ··· 202 201 }; 203 202 204 203 struct tcp_sigpool; 204 + /* Established states are fast-path and there always is current_key/rnext_key */ 205 205 #define TCP_AO_ESTABLISHED (TCPF_ESTABLISHED | TCPF_FIN_WAIT1 | TCPF_FIN_WAIT2 | \ 206 - TCPF_CLOSE | TCPF_CLOSE_WAIT | \ 207 - TCPF_LAST_ACK | TCPF_CLOSING) 206 + TCPF_CLOSE_WAIT | TCPF_LAST_ACK | TCPF_CLOSING) 208 207 209 208 int tcp_ao_transmit_skb(struct sock *sk, struct sk_buff *skb, 210 209 struct tcp_ao_key *key, struct tcphdr *th,
-3
kernel/bpf/devmap.c
··· 760 760 for (i = 0; i < dtab->n_buckets; i++) { 761 761 head = dev_map_index_hash(dtab, i); 762 762 hlist_for_each_entry_safe(dst, next, head, index_hlist) { 763 - if (!dst) 764 - continue; 765 - 766 763 if (is_ifindex_excluded(excluded_devices, num_excluded, 767 764 dst->dev->ifindex)) 768 765 continue;
+6 -5
kernel/bpf/syscall.c
··· 2998 2998 void bpf_link_init(struct bpf_link *link, enum bpf_link_type type, 2999 2999 const struct bpf_link_ops *ops, struct bpf_prog *prog) 3000 3000 { 3001 + WARN_ON(ops->dealloc && ops->dealloc_deferred); 3001 3002 atomic64_set(&link->refcnt, 1); 3002 3003 link->type = type; 3003 3004 link->id = 0; ··· 3057 3056 /* bpf_link_free is guaranteed to be called from process context */ 3058 3057 static void bpf_link_free(struct bpf_link *link) 3059 3058 { 3059 + const struct bpf_link_ops *ops = link->ops; 3060 3060 bool sleepable = false; 3061 3061 3062 3062 bpf_link_free_id(link->id); 3063 3063 if (link->prog) { 3064 3064 sleepable = link->prog->sleepable; 3065 3065 /* detach BPF program, clean up used resources */ 3066 - link->ops->release(link); 3066 + ops->release(link); 3067 3067 bpf_prog_put(link->prog); 3068 3068 } 3069 - if (link->ops->dealloc_deferred) { 3069 + if (ops->dealloc_deferred) { 3070 3070 /* schedule BPF link deallocation; if underlying BPF program 3071 3071 * is sleepable, we need to first wait for RCU tasks trace 3072 3072 * sync, then go through "classic" RCU grace period ··· 3076 3074 call_rcu_tasks_trace(&link->rcu, bpf_link_defer_dealloc_mult_rcu_gp); 3077 3075 else 3078 3076 call_rcu(&link->rcu, bpf_link_defer_dealloc_rcu_gp); 3079 - } 3080 - if (link->ops->dealloc) 3081 - link->ops->dealloc(link); 3077 + } else if (ops->dealloc) 3078 + ops->dealloc(link); 3082 3079 } 3083 3080 3084 3081 static void bpf_link_put_deferred(struct work_struct *work)
+4
kernel/bpf/verifier.c
··· 11128 11128 #else 11129 11129 BTF_ID_UNUSED 11130 11130 #endif 11131 + #ifdef CONFIG_BPF_EVENTS 11131 11132 BTF_ID(func, bpf_session_cookie) 11133 + #else 11134 + BTF_ID_UNUSED 11135 + #endif 11132 11136 11133 11137 static bool is_kfunc_ret_null(struct bpf_kfunc_call_arg_meta *meta) 11134 11138 {
-2
kernel/trace/bpf_trace.c
··· 3517 3517 } 3518 3518 #endif /* CONFIG_UPROBES */ 3519 3519 3520 - #ifdef CONFIG_FPROBE 3521 3520 __bpf_kfunc_start_defs(); 3522 3521 3523 3522 __bpf_kfunc bool bpf_session_is_return(void) ··· 3565 3566 } 3566 3567 3567 3568 late_initcall(bpf_kprobe_multi_kfuncs_init); 3568 - #endif
+1
lib/test_rhashtable.c
··· 811 811 module_init(test_rht_init); 812 812 module_exit(test_rht_exit); 813 813 814 + MODULE_DESCRIPTION("Resizable, Scalable, Concurrent Hash Table test module"); 814 815 MODULE_LICENSE("GPL v2");
+6
net/ax25/af_ax25.c
··· 1378 1378 { 1379 1379 struct sk_buff *skb; 1380 1380 struct sock *newsk; 1381 + ax25_dev *ax25_dev; 1381 1382 DEFINE_WAIT(wait); 1382 1383 struct sock *sk; 1384 + ax25_cb *ax25; 1383 1385 int err = 0; 1384 1386 1385 1387 if (sock->state != SS_UNCONNECTED) ··· 1436 1434 kfree_skb(skb); 1437 1435 sk_acceptq_removed(sk); 1438 1436 newsock->state = SS_CONNECTED; 1437 + ax25 = sk_to_ax25(newsk); 1438 + ax25_dev = ax25->ax25_dev; 1439 + netdev_hold(ax25_dev->dev, &ax25->dev_tracker, GFP_ATOMIC); 1440 + ax25_dev_hold(ax25_dev); 1439 1441 1440 1442 out: 1441 1443 release_sock(sk);
+1 -1
net/ax25/ax25_dev.c
··· 196 196 list_for_each_entry_safe(s, n, &ax25_dev_list, list) { 197 197 netdev_put(s->dev, &s->dev_tracker); 198 198 list_del(&s->list); 199 - kfree(s); 199 + ax25_dev_put(s); 200 200 } 201 201 spin_unlock_bh(&ax25_dev_lock); 202 202 }
+6
net/bpf/test_run.c
··· 727 727 __bpf_prog_test_run_raw_tp(void *data) 728 728 { 729 729 struct bpf_raw_tp_test_run_info *info = data; 730 + struct bpf_trace_run_ctx run_ctx = {}; 731 + struct bpf_run_ctx *old_run_ctx; 732 + 733 + old_run_ctx = bpf_set_run_ctx(&run_ctx.run_ctx); 730 734 731 735 rcu_read_lock(); 732 736 info->retval = bpf_prog_run(info->prog, info->ctx); 733 737 rcu_read_unlock(); 738 + 739 + bpf_reset_run_ctx(old_run_ctx); 734 740 } 735 741 736 742 int bpf_prog_test_run_raw_tp(struct bpf_prog *prog,
+2 -1
net/core/dev.c
··· 4516 4516 struct rps_dev_flow *rflow, u16 next_cpu) 4517 4517 { 4518 4518 if (next_cpu < nr_cpu_ids) { 4519 + u32 head; 4519 4520 #ifdef CONFIG_RFS_ACCEL 4520 4521 struct netdev_rx_queue *rxqueue; 4521 4522 struct rps_dev_flow_table *flow_table; 4522 4523 struct rps_dev_flow *old_rflow; 4523 - u32 flow_id, head; 4524 4524 u16 rxq_index; 4525 + u32 flow_id; 4525 4526 int rc; 4526 4527 4527 4528 /* Should we steer this flow to a different hardware queue? */
+2
net/core/dst_cache.c
··· 27 27 static void dst_cache_per_cpu_dst_set(struct dst_cache_pcpu *dst_cache, 28 28 struct dst_entry *dst, u32 cookie) 29 29 { 30 + DEBUG_NET_WARN_ON_ONCE(!in_softirq()); 30 31 dst_release(dst_cache->dst); 31 32 if (dst) 32 33 dst_hold(dst); ··· 41 40 { 42 41 struct dst_entry *dst; 43 42 43 + DEBUG_NET_WARN_ON_ONCE(!in_softirq()); 44 44 dst = idst->dst; 45 45 if (!dst) 46 46 goto fail;
+42 -2
net/core/rtnetlink.c
··· 6484 6484 6485 6485 /* Process one rtnetlink message. */ 6486 6486 6487 + static int rtnl_dumpit(struct sk_buff *skb, struct netlink_callback *cb) 6488 + { 6489 + rtnl_dumpit_func dumpit = cb->data; 6490 + int err; 6491 + 6492 + /* Previous iteration have already finished, avoid calling->dumpit() 6493 + * again, it may not expect to be called after it reached the end. 6494 + */ 6495 + if (!dumpit) 6496 + return 0; 6497 + 6498 + err = dumpit(skb, cb); 6499 + 6500 + /* Old dump handlers used to send NLM_DONE as in a separate recvmsg(). 6501 + * Some applications which parse netlink manually depend on this. 6502 + */ 6503 + if (cb->flags & RTNL_FLAG_DUMP_SPLIT_NLM_DONE) { 6504 + if (err < 0 && err != -EMSGSIZE) 6505 + return err; 6506 + if (!err) 6507 + cb->data = NULL; 6508 + 6509 + return skb->len; 6510 + } 6511 + return err; 6512 + } 6513 + 6514 + static int rtnetlink_dump_start(struct sock *ssk, struct sk_buff *skb, 6515 + const struct nlmsghdr *nlh, 6516 + struct netlink_dump_control *control) 6517 + { 6518 + if (control->flags & RTNL_FLAG_DUMP_SPLIT_NLM_DONE) { 6519 + WARN_ON(control->data); 6520 + control->data = control->dump; 6521 + control->dump = rtnl_dumpit; 6522 + } 6523 + 6524 + return netlink_dump_start(ssk, skb, nlh, control); 6525 + } 6526 + 6487 6527 static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, 6488 6528 struct netlink_ext_ack *extack) 6489 6529 { ··· 6588 6548 .module = owner, 6589 6549 .flags = flags, 6590 6550 }; 6591 - err = netlink_dump_start(rtnl, skb, nlh, &c); 6551 + err = rtnetlink_dump_start(rtnl, skb, nlh, &c); 6592 6552 /* netlink_dump_start() will keep a reference on 6593 6553 * module if dump is still in progress. 6594 6554 */ ··· 6734 6694 register_netdevice_notifier(&rtnetlink_dev_notifier); 6735 6695 6736 6696 rtnl_register(PF_UNSPEC, RTM_GETLINK, rtnl_getlink, 6737 - rtnl_dump_ifinfo, 0); 6697 + rtnl_dump_ifinfo, RTNL_FLAG_DUMP_SPLIT_NLM_DONE); 6738 6698 rtnl_register(PF_UNSPEC, RTM_SETLINK, rtnl_setlink, NULL, 0); 6739 6699 rtnl_register(PF_UNSPEC, RTM_NEWLINK, rtnl_newlink, NULL, 0); 6740 6700 rtnl_register(PF_UNSPEC, RTM_DELLINK, rtnl_dellink, NULL, 0);
+1 -1
net/ethtool/ioctl.c
··· 2220 2220 const struct ethtool_ops *ops = dev->ethtool_ops; 2221 2221 int n_stats, ret; 2222 2222 2223 - if (!ops || !ops->get_sset_count || ops->get_ethtool_phy_stats) 2223 + if (!ops || !ops->get_sset_count || !ops->get_ethtool_phy_stats) 2224 2224 return -EOPNOTSUPP; 2225 2225 2226 2226 n_stats = ops->get_sset_count(dev, ETH_SS_PHY_STATS);
+3 -3
net/ethtool/tsinfo.c
··· 38 38 ret = ethnl_ops_begin(dev); 39 39 if (ret < 0) 40 40 return ret; 41 - if (req_base->flags & ETHTOOL_FLAG_STATS && 42 - dev->ethtool_ops->get_ts_stats) { 41 + if (req_base->flags & ETHTOOL_FLAG_STATS) { 43 42 ethtool_stats_init((u64 *)&data->stats, 44 43 sizeof(data->stats) / sizeof(u64)); 45 - dev->ethtool_ops->get_ts_stats(dev, &data->stats); 44 + if (dev->ethtool_ops->get_ts_stats) 45 + dev->ethtool_ops->get_ts_stats(dev, &data->stats); 46 46 } 47 47 ret = __ethtool_get_ts_info(dev, &data->ts_info); 48 48 ethnl_ops_complete(dev);
+1 -1
net/ipv4/devinet.c
··· 2805 2805 rtnl_register(PF_INET, RTM_NEWADDR, inet_rtm_newaddr, NULL, 0); 2806 2806 rtnl_register(PF_INET, RTM_DELADDR, inet_rtm_deladdr, NULL, 0); 2807 2807 rtnl_register(PF_INET, RTM_GETADDR, NULL, inet_dump_ifaddr, 2808 - RTNL_FLAG_DUMP_UNLOCKED); 2808 + RTNL_FLAG_DUMP_UNLOCKED | RTNL_FLAG_DUMP_SPLIT_NLM_DONE); 2809 2809 rtnl_register(PF_INET, RTM_GETNETCONF, inet_netconf_get_devconf, 2810 2810 inet_netconf_dump_devconf, 2811 2811 RTNL_FLAG_DOIT_UNLOCKED | RTNL_FLAG_DUMP_UNLOCKED);
+1 -6
net/ipv4/fib_frontend.c
··· 1050 1050 e++; 1051 1051 } 1052 1052 } 1053 - 1054 - /* Don't let NLM_DONE coalesce into a message, even if it could. 1055 - * Some user space expects NLM_DONE in a separate recv(). 1056 - */ 1057 - err = skb->len; 1058 1053 out: 1059 1054 1060 1055 cb->args[1] = e; ··· 1660 1665 rtnl_register(PF_INET, RTM_NEWROUTE, inet_rtm_newroute, NULL, 0); 1661 1666 rtnl_register(PF_INET, RTM_DELROUTE, inet_rtm_delroute, NULL, 0); 1662 1667 rtnl_register(PF_INET, RTM_GETROUTE, NULL, inet_dump_fib, 1663 - RTNL_FLAG_DUMP_UNLOCKED); 1668 + RTNL_FLAG_DUMP_UNLOCKED | RTNL_FLAG_DUMP_SPLIT_NLM_DONE); 1664 1669 }
+8 -1
net/ipv4/tcp.c
··· 1165 1165 1166 1166 process_backlog++; 1167 1167 1168 + #ifdef CONFIG_SKB_DECRYPTED 1169 + skb->decrypted = !!(flags & MSG_SENDPAGE_DECRYPTED); 1170 + #endif 1168 1171 tcp_skb_entail(sk, skb); 1169 1172 copy = size_goal; 1170 1173 ··· 2649 2646 if (oldstate != TCP_ESTABLISHED) 2650 2647 TCP_INC_STATS(sock_net(sk), TCP_MIB_CURRESTAB); 2651 2648 break; 2649 + case TCP_CLOSE_WAIT: 2650 + if (oldstate == TCP_SYN_RECV) 2651 + TCP_INC_STATS(sock_net(sk), TCP_MIB_CURRESTAB); 2652 + break; 2652 2653 2653 2654 case TCP_CLOSE: 2654 2655 if (oldstate == TCP_CLOSE_WAIT || oldstate == TCP_ESTABLISHED) ··· 2664 2657 inet_put_port(sk); 2665 2658 fallthrough; 2666 2659 default: 2667 - if (oldstate == TCP_ESTABLISHED) 2660 + if (oldstate == TCP_ESTABLISHED || oldstate == TCP_CLOSE_WAIT) 2668 2661 TCP_DEC_STATS(sock_net(sk), TCP_MIB_CURRESTAB); 2669 2662 } 2670 2663
+9 -4
net/ipv4/tcp_ao.c
··· 933 933 struct tcp_ao_key *key; 934 934 __be32 sisn, disn; 935 935 u8 *traffic_key; 936 + int state; 936 937 u32 sne = 0; 937 938 938 939 info = rcu_dereference(tcp_sk(sk)->ao_info); ··· 949 948 disn = 0; 950 949 } 951 950 951 + state = READ_ONCE(sk->sk_state); 952 952 /* Fast-path */ 953 - if (likely((1 << sk->sk_state) & TCP_AO_ESTABLISHED)) { 953 + if (likely((1 << state) & TCP_AO_ESTABLISHED)) { 954 954 enum skb_drop_reason err; 955 955 struct tcp_ao_key *current_key; 956 956 ··· 990 988 return SKB_NOT_DROPPED_YET; 991 989 } 992 990 991 + if (unlikely(state == TCP_CLOSE)) 992 + return SKB_DROP_REASON_TCP_CLOSE; 993 + 993 994 /* Lookup key based on peer address and keyid. 994 995 * current_key and rnext_key must not be used on tcp listen 995 996 * sockets as otherwise: ··· 1006 1001 if (th->syn && !th->ack) 1007 1002 goto verify_hash; 1008 1003 1009 - if ((1 << sk->sk_state) & (TCPF_LISTEN | TCPF_NEW_SYN_RECV)) { 1004 + if ((1 << state) & (TCPF_LISTEN | TCPF_NEW_SYN_RECV)) { 1010 1005 /* Make the initial syn the likely case here */ 1011 1006 if (unlikely(req)) { 1012 1007 sne = tcp_ao_compute_sne(0, tcp_rsk(req)->rcv_isn, ··· 1023 1018 /* no way to figure out initial sisn/disn - drop */ 1024 1019 return SKB_DROP_REASON_TCP_FLAGS; 1025 1020 } 1026 - } else if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV)) { 1021 + } else if ((1 << state) & (TCPF_SYN_SENT | TCPF_SYN_RECV)) { 1027 1022 disn = info->lisn; 1028 1023 if (th->syn || th->rst) 1029 1024 sisn = th->seq; 1030 1025 else 1031 1026 sisn = info->risn; 1032 1027 } else { 1033 - WARN_ONCE(1, "TCP-AO: Unexpected sk_state %d", sk->sk_state); 1028 + WARN_ONCE(1, "TCP-AO: Unexpected sk_state %d", state); 1034 1029 return SKB_DROP_REASON_TCP_AOFAILURE; 1035 1030 } 1036 1031 verify_hash:
+6 -1
net/ipv6/ila/ila_lwt.c
··· 58 58 return orig_dst->lwtstate->orig_output(net, sk, skb); 59 59 } 60 60 61 + local_bh_disable(); 61 62 dst = dst_cache_get(&ilwt->dst_cache); 63 + local_bh_enable(); 62 64 if (unlikely(!dst)) { 63 65 struct ipv6hdr *ip6h = ipv6_hdr(skb); 64 66 struct flowi6 fl6; ··· 88 86 goto drop; 89 87 } 90 88 91 - if (ilwt->connected) 89 + if (ilwt->connected) { 90 + local_bh_disable(); 92 91 dst_cache_set_ip6(&ilwt->dst_cache, dst, &fl6.saddr); 92 + local_bh_enable(); 93 + } 93 94 } 94 95 95 96 skb_dst_set(skb, dst);
+4 -4
net/ipv6/ioam6_iptunnel.c
··· 351 351 goto drop; 352 352 353 353 if (!ipv6_addr_equal(&orig_daddr, &ipv6_hdr(skb)->daddr)) { 354 - preempt_disable(); 354 + local_bh_disable(); 355 355 dst = dst_cache_get(&ilwt->cache); 356 - preempt_enable(); 356 + local_bh_enable(); 357 357 358 358 if (unlikely(!dst)) { 359 359 struct ipv6hdr *hdr = ipv6_hdr(skb); ··· 373 373 goto drop; 374 374 } 375 375 376 - preempt_disable(); 376 + local_bh_disable(); 377 377 dst_cache_set_ip6(&ilwt->cache, dst, &fl6.saddr); 378 - preempt_enable(); 378 + local_bh_enable(); 379 379 } 380 380 381 381 skb_dst_drop(skb);
+5 -1
net/ipv6/ip6_fib.c
··· 966 966 if (!fib6_nh->rt6i_pcpu) 967 967 return; 968 968 969 + rcu_read_lock(); 969 970 /* release the reference to this fib entry from 970 971 * all of its cached pcpu routes 971 972 */ ··· 975 974 struct rt6_info *pcpu_rt; 976 975 977 976 ppcpu_rt = per_cpu_ptr(fib6_nh->rt6i_pcpu, cpu); 978 - pcpu_rt = *ppcpu_rt; 977 + 978 + /* Paired with xchg() in rt6_get_pcpu_route() */ 979 + pcpu_rt = READ_ONCE(*ppcpu_rt); 979 980 980 981 /* only dropping the 'from' reference if the cached route 981 982 * is using 'match'. The cached pcpu_rt->from only changes ··· 991 988 fib6_info_release(from); 992 989 } 993 990 } 991 + rcu_read_unlock(); 994 992 } 995 993 996 994 struct fib6_nh_pcpu_arg {
+1
net/ipv6/route.c
··· 1409 1409 struct rt6_info *prev, **p; 1410 1410 1411 1411 p = this_cpu_ptr(res->nh->rt6i_pcpu); 1412 + /* Paired with READ_ONCE() in __fib6_drop_pcpu_from() */ 1412 1413 prev = xchg(p, NULL); 1413 1414 if (prev) { 1414 1415 dst_dev_put(&prev->dst);
+6 -8
net/ipv6/rpl_iptunnel.c
··· 212 212 if (unlikely(err)) 213 213 goto drop; 214 214 215 - preempt_disable(); 215 + local_bh_disable(); 216 216 dst = dst_cache_get(&rlwt->cache); 217 - preempt_enable(); 217 + local_bh_enable(); 218 218 219 219 if (unlikely(!dst)) { 220 220 struct ipv6hdr *hdr = ipv6_hdr(skb); ··· 234 234 goto drop; 235 235 } 236 236 237 - preempt_disable(); 237 + local_bh_disable(); 238 238 dst_cache_set_ip6(&rlwt->cache, dst, &fl6.saddr); 239 - preempt_enable(); 239 + local_bh_enable(); 240 240 } 241 241 242 242 skb_dst_drop(skb); ··· 268 268 return err; 269 269 } 270 270 271 - preempt_disable(); 271 + local_bh_disable(); 272 272 dst = dst_cache_get(&rlwt->cache); 273 - preempt_enable(); 274 273 275 274 if (!dst) { 276 275 ip6_route_input(skb); 277 276 dst = skb_dst(skb); 278 277 if (!dst->error) { 279 - preempt_disable(); 280 278 dst_cache_set_ip6(&rlwt->cache, dst, 281 279 &ipv6_hdr(skb)->saddr); 282 - preempt_enable(); 283 280 } 284 281 } else { 285 282 skb_dst_drop(skb); 286 283 skb_dst_set(skb, dst); 287 284 } 285 + local_bh_enable(); 288 286 289 287 err = skb_cow_head(skb, LL_RESERVED_SPACE(dst->dev)); 290 288 if (unlikely(err))
+6 -8
net/ipv6/seg6_iptunnel.c
··· 464 464 465 465 slwt = seg6_lwt_lwtunnel(orig_dst->lwtstate); 466 466 467 - preempt_disable(); 467 + local_bh_disable(); 468 468 dst = dst_cache_get(&slwt->cache); 469 - preempt_enable(); 470 469 471 470 if (!dst) { 472 471 ip6_route_input(skb); 473 472 dst = skb_dst(skb); 474 473 if (!dst->error) { 475 - preempt_disable(); 476 474 dst_cache_set_ip6(&slwt->cache, dst, 477 475 &ipv6_hdr(skb)->saddr); 478 - preempt_enable(); 479 476 } 480 477 } else { 481 478 skb_dst_drop(skb); 482 479 skb_dst_set(skb, dst); 483 480 } 481 + local_bh_enable(); 484 482 485 483 err = skb_cow_head(skb, LL_RESERVED_SPACE(dst->dev)); 486 484 if (unlikely(err)) ··· 534 536 535 537 slwt = seg6_lwt_lwtunnel(orig_dst->lwtstate); 536 538 537 - preempt_disable(); 539 + local_bh_disable(); 538 540 dst = dst_cache_get(&slwt->cache); 539 - preempt_enable(); 541 + local_bh_enable(); 540 542 541 543 if (unlikely(!dst)) { 542 544 struct ipv6hdr *hdr = ipv6_hdr(skb); ··· 556 558 goto drop; 557 559 } 558 560 559 - preempt_disable(); 561 + local_bh_disable(); 560 562 dst_cache_set_ip6(&slwt->cache, dst, &fl6.saddr); 561 - preempt_enable(); 563 + local_bh_enable(); 562 564 } 563 565 564 566 skb_dst_drop(skb);
+5 -4
net/mac80211/cfg.c
··· 2958 2958 memcpy(sdata->vif.bss_conf.mcast_rate, rate, 2959 2959 sizeof(int) * NUM_NL80211_BANDS); 2960 2960 2961 - ieee80211_link_info_change_notify(sdata, &sdata->deflink, 2962 - BSS_CHANGED_MCAST_RATE); 2961 + if (ieee80211_sdata_running(sdata)) 2962 + ieee80211_link_info_change_notify(sdata, &sdata->deflink, 2963 + BSS_CHANGED_MCAST_RATE); 2963 2964 2964 2965 return 0; 2965 2966 } ··· 4017 4016 goto out; 4018 4017 } 4019 4018 4020 - link_data->csa_chanreq = chanreq; 4019 + link_data->csa_chanreq = chanreq; 4021 4020 link_conf->csa_active = true; 4022 4021 4023 4022 if (params->block_tx && ··· 4028 4027 } 4029 4028 4030 4029 cfg80211_ch_switch_started_notify(sdata->dev, 4031 - &link_data->csa_chanreq.oper, 0, 4030 + &link_data->csa_chanreq.oper, link_id, 4032 4031 params->count, params->block_tx); 4033 4032 4034 4033 if (changed) {
+8 -2
net/mac80211/he.c
··· 230 230 231 231 if (!he_spr_ie_elem) 232 232 return; 233 + 234 + he_obss_pd->sr_ctrl = he_spr_ie_elem->he_sr_control; 233 235 data = he_spr_ie_elem->optional; 234 236 235 237 if (he_spr_ie_elem->he_sr_control & 236 238 IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT) 237 - data++; 239 + he_obss_pd->non_srg_max_offset = *data++; 240 + 238 241 if (he_spr_ie_elem->he_sr_control & 239 242 IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT) { 240 - he_obss_pd->max_offset = *data++; 241 243 he_obss_pd->min_offset = *data++; 244 + he_obss_pd->max_offset = *data++; 245 + memcpy(he_obss_pd->bss_color_bitmap, data, 8); 246 + data += 8; 247 + memcpy(he_obss_pd->partial_bssid_bitmap, data, 8); 242 248 he_obss_pd->enable = true; 243 249 } 244 250 }
+2
net/mac80211/ieee80211_i.h
··· 1845 1845 void ieee80211_configure_filter(struct ieee80211_local *local); 1846 1846 u64 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata); 1847 1847 1848 + void ieee80211_handle_queued_frames(struct ieee80211_local *local); 1849 + 1848 1850 u64 ieee80211_mgmt_tx_cookie(struct ieee80211_local *local); 1849 1851 int ieee80211_attach_ack_skb(struct ieee80211_local *local, struct sk_buff *skb, 1850 1852 u64 *cookie, gfp_t gfp);
+8 -2
net/mac80211/main.c
··· 423 423 BSS_CHANGED_ERP_SLOT; 424 424 } 425 425 426 - static void ieee80211_tasklet_handler(struct tasklet_struct *t) 426 + void ieee80211_handle_queued_frames(struct ieee80211_local *local) 427 427 { 428 - struct ieee80211_local *local = from_tasklet(local, t, tasklet); 429 428 struct sk_buff *skb; 430 429 431 430 while ((skb = skb_dequeue(&local->skb_queue)) || ··· 447 448 break; 448 449 } 449 450 } 451 + } 452 + 453 + static void ieee80211_tasklet_handler(struct tasklet_struct *t) 454 + { 455 + struct ieee80211_local *local = from_tasklet(local, t, tasklet); 456 + 457 + ieee80211_handle_queued_frames(local); 450 458 } 451 459 452 460 static void ieee80211_restart_work(struct work_struct *work)
+1
net/mac80211/mesh.c
··· 1776 1776 ifmsh->last_preq = jiffies; 1777 1777 ifmsh->next_perr = jiffies; 1778 1778 ifmsh->csa_role = IEEE80211_MESH_CSA_ROLE_NONE; 1779 + ifmsh->nonpeer_pm = NL80211_MESH_POWER_ACTIVE; 1779 1780 /* Allocate all mesh structures when creating the first mesh interface. */ 1780 1781 if (!mesh_allocated) 1781 1782 ieee80211s_init();
+13
net/mac80211/mesh_pathtbl.c
··· 1017 1017 */ 1018 1018 void mesh_path_flush_pending(struct mesh_path *mpath) 1019 1019 { 1020 + struct ieee80211_sub_if_data *sdata = mpath->sdata; 1021 + struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; 1022 + struct mesh_preq_queue *preq, *tmp; 1020 1023 struct sk_buff *skb; 1021 1024 1022 1025 while ((skb = skb_dequeue(&mpath->frame_queue)) != NULL) 1023 1026 mesh_path_discard_frame(mpath->sdata, skb); 1027 + 1028 + spin_lock_bh(&ifmsh->mesh_preq_queue_lock); 1029 + list_for_each_entry_safe(preq, tmp, &ifmsh->preq_queue.list, list) { 1030 + if (ether_addr_equal(mpath->dst, preq->dst)) { 1031 + list_del(&preq->list); 1032 + kfree(preq); 1033 + --ifmsh->preq_queue_len; 1034 + } 1035 + } 1036 + spin_unlock_bh(&ifmsh->mesh_preq_queue_lock); 1024 1037 } 1025 1038 1026 1039 /**
+1 -1
net/mac80211/parse.c
··· 111 111 if (params->mode < IEEE80211_CONN_MODE_HE) 112 112 break; 113 113 if (len >= sizeof(*elems->he_spr) && 114 - len >= ieee80211_he_spr_size(data)) 114 + len >= ieee80211_he_spr_size(data) - 1) 115 115 elems->he_spr = data; 116 116 break; 117 117 case WLAN_EID_EXT_HE_6GHZ_CAPA:
+10 -4
net/mac80211/scan.c
··· 744 744 local->hw_scan_ies_bufsize *= n_bands; 745 745 } 746 746 747 - local->hw_scan_req = kmalloc( 748 - sizeof(*local->hw_scan_req) + 749 - req->n_channels * sizeof(req->channels[0]) + 750 - local->hw_scan_ies_bufsize, GFP_KERNEL); 747 + local->hw_scan_req = kmalloc(struct_size(local->hw_scan_req, 748 + req.channels, 749 + req->n_channels) + 750 + local->hw_scan_ies_bufsize, 751 + GFP_KERNEL); 751 752 if (!local->hw_scan_req) 752 753 return -ENOMEM; 753 754 754 755 local->hw_scan_req->req.ssids = req->ssids; 755 756 local->hw_scan_req->req.n_ssids = req->n_ssids; 757 + /* None of the channels are actually set 758 + * up but let UBSAN know the boundaries. 759 + */ 760 + local->hw_scan_req->req.n_channels = req->n_channels; 761 + 756 762 ies = (u8 *)local->hw_scan_req + 757 763 sizeof(*local->hw_scan_req) + 758 764 req->n_channels * sizeof(req->channels[0]);
+2 -2
net/mac80211/sta_info.c
··· 1724 1724 skb_queue_head_init(&pending); 1725 1725 1726 1726 /* sync with ieee80211_tx_h_unicast_ps_buf */ 1727 - spin_lock(&sta->ps_lock); 1727 + spin_lock_bh(&sta->ps_lock); 1728 1728 /* Send all buffered frames to the station */ 1729 1729 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { 1730 1730 int count = skb_queue_len(&pending), tmp; ··· 1753 1753 */ 1754 1754 clear_sta_flag(sta, WLAN_STA_PSPOLL); 1755 1755 clear_sta_flag(sta, WLAN_STA_UAPSD); 1756 - spin_unlock(&sta->ps_lock); 1756 + spin_unlock_bh(&sta->ps_lock); 1757 1757 1758 1758 atomic_dec(&ps->num_sta_ps); 1759 1759
+2
net/mac80211/util.c
··· 1567 1567 1568 1568 void ieee80211_stop_device(struct ieee80211_local *local) 1569 1569 { 1570 + ieee80211_handle_queued_frames(local); 1571 + 1570 1572 ieee80211_led_radio(local, false); 1571 1573 ieee80211_mod_tpt_led_trig(local, 0, IEEE80211_TPT_LEDTRIG_FL_RADIO); 1572 1574
+7 -2
net/mptcp/protocol.c
··· 2916 2916 if (oldstate != TCP_ESTABLISHED) 2917 2917 MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_CURRESTAB); 2918 2918 break; 2919 - 2919 + case TCP_CLOSE_WAIT: 2920 + /* Unlike TCP, MPTCP sk would not have the TCP_SYN_RECV state: 2921 + * MPTCP "accepted" sockets will be created later on. So no 2922 + * transition from TCP_SYN_RECV to TCP_CLOSE_WAIT. 2923 + */ 2924 + break; 2920 2925 default: 2921 - if (oldstate == TCP_ESTABLISHED) 2926 + if (oldstate == TCP_ESTABLISHED || oldstate == TCP_CLOSE_WAIT) 2922 2927 MPTCP_DEC_STATS(sock_net(sk), MPTCP_MIB_CURRESTAB); 2923 2928 } 2924 2929
+2
net/ncsi/internal.h
··· 325 325 spinlock_t lock; /* Protect the NCSI device */ 326 326 unsigned int package_probe_id;/* Current ID during probe */ 327 327 unsigned int package_num; /* Number of packages */ 328 + unsigned int channel_probe_id;/* Current cahnnel ID during probe */ 328 329 struct list_head packages; /* List of packages */ 329 330 struct ncsi_channel *hot_channel; /* Channel was ever active */ 330 331 struct ncsi_request requests[256]; /* Request table */ ··· 344 343 bool multi_package; /* Enable multiple packages */ 345 344 bool mlx_multi_host; /* Enable multi host Mellanox */ 346 345 u32 package_whitelist; /* Packages to configure */ 346 + unsigned char channel_count; /* Num of channels to probe */ 347 347 }; 348 348 349 349 struct ncsi_cmd_arg {
+37 -38
net/ncsi/ncsi-manage.c
··· 510 510 511 511 break; 512 512 case ncsi_dev_state_suspend_gls: 513 - ndp->pending_req_num = np->channel_num; 513 + ndp->pending_req_num = 1; 514 514 515 515 nca.type = NCSI_PKT_CMD_GLS; 516 516 nca.package = np->id; 517 + nca.channel = ndp->channel_probe_id; 518 + ret = ncsi_xmit_cmd(&nca); 519 + if (ret) 520 + goto error; 521 + ndp->channel_probe_id++; 517 522 518 - nd->state = ncsi_dev_state_suspend_dcnt; 519 - NCSI_FOR_EACH_CHANNEL(np, nc) { 520 - nca.channel = nc->id; 521 - ret = ncsi_xmit_cmd(&nca); 522 - if (ret) 523 - goto error; 523 + if (ndp->channel_probe_id == ndp->channel_count) { 524 + ndp->channel_probe_id = 0; 525 + nd->state = ncsi_dev_state_suspend_dcnt; 524 526 } 525 527 526 528 break; ··· 1347 1345 { 1348 1346 struct ncsi_dev *nd = &ndp->ndev; 1349 1347 struct ncsi_package *np; 1350 - struct ncsi_channel *nc; 1351 1348 struct ncsi_cmd_arg nca; 1352 1349 unsigned char index; 1353 1350 int ret; ··· 1424 1423 1425 1424 nd->state = ncsi_dev_state_probe_cis; 1426 1425 break; 1427 - case ncsi_dev_state_probe_cis: 1428 - ndp->pending_req_num = NCSI_RESERVED_CHANNEL; 1429 - 1430 - /* Clear initial state */ 1431 - nca.type = NCSI_PKT_CMD_CIS; 1432 - nca.package = ndp->active_package->id; 1433 - for (index = 0; index < NCSI_RESERVED_CHANNEL; index++) { 1434 - nca.channel = index; 1435 - ret = ncsi_xmit_cmd(&nca); 1436 - if (ret) 1437 - goto error; 1438 - } 1439 - 1440 - nd->state = ncsi_dev_state_probe_gvi; 1441 - if (IS_ENABLED(CONFIG_NCSI_OEM_CMD_KEEP_PHY)) 1442 - nd->state = ncsi_dev_state_probe_keep_phy; 1443 - break; 1444 1426 case ncsi_dev_state_probe_keep_phy: 1445 1427 ndp->pending_req_num = 1; 1446 1428 ··· 1436 1452 1437 1453 nd->state = ncsi_dev_state_probe_gvi; 1438 1454 break; 1455 + case ncsi_dev_state_probe_cis: 1439 1456 case ncsi_dev_state_probe_gvi: 1440 1457 case ncsi_dev_state_probe_gc: 1441 1458 case ncsi_dev_state_probe_gls: 1442 1459 np = ndp->active_package; 1443 - ndp->pending_req_num = np->channel_num; 1460 + ndp->pending_req_num = 1; 1444 1461 1445 - /* Retrieve version, capability or link status */ 1446 - if (nd->state == ncsi_dev_state_probe_gvi) 1462 + /* Clear initial state Retrieve version, capability or link status */ 1463 + if (nd->state == ncsi_dev_state_probe_cis) 1464 + nca.type = NCSI_PKT_CMD_CIS; 1465 + else if (nd->state == ncsi_dev_state_probe_gvi) 1447 1466 nca.type = NCSI_PKT_CMD_GVI; 1448 1467 else if (nd->state == ncsi_dev_state_probe_gc) 1449 1468 nca.type = NCSI_PKT_CMD_GC; ··· 1454 1467 nca.type = NCSI_PKT_CMD_GLS; 1455 1468 1456 1469 nca.package = np->id; 1457 - NCSI_FOR_EACH_CHANNEL(np, nc) { 1458 - nca.channel = nc->id; 1459 - ret = ncsi_xmit_cmd(&nca); 1460 - if (ret) 1461 - goto error; 1470 + nca.channel = ndp->channel_probe_id; 1471 + 1472 + ret = ncsi_xmit_cmd(&nca); 1473 + if (ret) 1474 + goto error; 1475 + 1476 + if (nd->state == ncsi_dev_state_probe_cis) { 1477 + nd->state = ncsi_dev_state_probe_gvi; 1478 + if (IS_ENABLED(CONFIG_NCSI_OEM_CMD_KEEP_PHY) && ndp->channel_probe_id == 0) 1479 + nd->state = ncsi_dev_state_probe_keep_phy; 1480 + } else if (nd->state == ncsi_dev_state_probe_gvi) { 1481 + nd->state = ncsi_dev_state_probe_gc; 1482 + } else if (nd->state == ncsi_dev_state_probe_gc) { 1483 + nd->state = ncsi_dev_state_probe_gls; 1484 + } else { 1485 + nd->state = ncsi_dev_state_probe_cis; 1486 + ndp->channel_probe_id++; 1462 1487 } 1463 1488 1464 - if (nd->state == ncsi_dev_state_probe_gvi) 1465 - nd->state = ncsi_dev_state_probe_gc; 1466 - else if (nd->state == ncsi_dev_state_probe_gc) 1467 - nd->state = ncsi_dev_state_probe_gls; 1468 - else 1489 + if (ndp->channel_probe_id == ndp->channel_count) { 1490 + ndp->channel_probe_id = 0; 1469 1491 nd->state = ncsi_dev_state_probe_dp; 1492 + } 1470 1493 break; 1471 1494 case ncsi_dev_state_probe_dp: 1472 1495 ndp->pending_req_num = 1; ··· 1777 1780 ndp->requests[i].ndp = ndp; 1778 1781 timer_setup(&ndp->requests[i].timer, ncsi_request_timeout, 0); 1779 1782 } 1783 + ndp->channel_count = NCSI_RESERVED_CHANNEL; 1780 1784 1781 1785 spin_lock_irqsave(&ncsi_dev_lock, flags); 1782 1786 list_add_tail_rcu(&ndp->node, &ncsi_dev_list); ··· 1811 1813 1812 1814 if (!(ndp->flags & NCSI_DEV_PROBED)) { 1813 1815 ndp->package_probe_id = 0; 1816 + ndp->channel_probe_id = 0; 1814 1817 nd->state = ncsi_dev_state_probe; 1815 1818 schedule_work(&ndp->work); 1816 1819 return 0;
+3 -1
net/ncsi/ncsi-rsp.c
··· 795 795 struct ncsi_rsp_gc_pkt *rsp; 796 796 struct ncsi_dev_priv *ndp = nr->ndp; 797 797 struct ncsi_channel *nc; 798 + struct ncsi_package *np; 798 799 size_t size; 799 800 800 801 /* Find the channel */ 801 802 rsp = (struct ncsi_rsp_gc_pkt *)skb_network_header(nr->rsp); 802 803 ncsi_find_package_and_channel(ndp, rsp->rsp.common.channel, 803 - NULL, &nc); 804 + &np, &nc); 804 805 if (!nc) 805 806 return -ENODEV; 806 807 ··· 836 835 */ 837 836 nc->vlan_filter.bitmap = U64_MAX; 838 837 nc->vlan_filter.n_vids = rsp->vlan_cnt; 838 + np->ndp->channel_count = rsp->channel_cnt; 839 839 840 840 return 0; 841 841 }
+1 -1
net/sched/sch_multiq.c
··· 185 185 186 186 qopt->bands = qdisc_dev(sch)->real_num_tx_queues; 187 187 188 - removed = kmalloc(sizeof(*removed) * (q->max_bands - q->bands), 188 + removed = kmalloc(sizeof(*removed) * (q->max_bands - qopt->bands), 189 189 GFP_KERNEL); 190 190 if (!removed) 191 191 return -ENOMEM;
+6 -9
net/sched/sch_taprio.c
··· 1176 1176 { 1177 1177 bool allow_overlapping_txqs = TXTIME_ASSIST_IS_ENABLED(taprio_flags); 1178 1178 1179 - if (!qopt && !dev->num_tc) { 1180 - NL_SET_ERR_MSG(extack, "'mqprio' configuration is necessary"); 1181 - return -EINVAL; 1182 - } 1183 - 1184 - /* If num_tc is already set, it means that the user already 1185 - * configured the mqprio part 1186 - */ 1187 - if (dev->num_tc) 1179 + if (!qopt) { 1180 + if (!dev->num_tc) { 1181 + NL_SET_ERR_MSG(extack, "'mqprio' configuration is necessary"); 1182 + return -EINVAL; 1183 + } 1188 1184 return 0; 1185 + } 1189 1186 1190 1187 /* taprio imposes that traffic classes map 1:n to tx queues */ 1191 1188 if (qopt->num_tc > dev->num_tx_queues) {
+2 -20
net/smc/af_smc.c
··· 459 459 static void smc_adjust_sock_bufsizes(struct sock *nsk, struct sock *osk, 460 460 unsigned long mask) 461 461 { 462 - struct net *nnet = sock_net(nsk); 463 - 464 462 nsk->sk_userlocks = osk->sk_userlocks; 465 - if (osk->sk_userlocks & SOCK_SNDBUF_LOCK) { 463 + if (osk->sk_userlocks & SOCK_SNDBUF_LOCK) 466 464 nsk->sk_sndbuf = osk->sk_sndbuf; 467 - } else { 468 - if (mask == SK_FLAGS_SMC_TO_CLC) 469 - WRITE_ONCE(nsk->sk_sndbuf, 470 - READ_ONCE(nnet->ipv4.sysctl_tcp_wmem[1])); 471 - else 472 - WRITE_ONCE(nsk->sk_sndbuf, 473 - 2 * READ_ONCE(nnet->smc.sysctl_wmem)); 474 - } 475 - if (osk->sk_userlocks & SOCK_RCVBUF_LOCK) { 465 + if (osk->sk_userlocks & SOCK_RCVBUF_LOCK) 476 466 nsk->sk_rcvbuf = osk->sk_rcvbuf; 477 - } else { 478 - if (mask == SK_FLAGS_SMC_TO_CLC) 479 - WRITE_ONCE(nsk->sk_rcvbuf, 480 - READ_ONCE(nnet->ipv4.sysctl_tcp_rmem[1])); 481 - else 482 - WRITE_ONCE(nsk->sk_rcvbuf, 483 - 2 * READ_ONCE(nnet->smc.sysctl_rmem)); 484 - } 485 467 } 486 468 487 469 static void smc_copy_sock_settings(struct sock *nsk, struct sock *osk,
+44 -46
net/unix/af_unix.c
··· 221 221 return unix_peer(osk) == NULL || unix_our_peer(sk, osk); 222 222 } 223 223 224 - static inline int unix_recvq_full(const struct sock *sk) 225 - { 226 - return skb_queue_len(&sk->sk_receive_queue) > sk->sk_max_ack_backlog; 227 - } 228 - 229 224 static inline int unix_recvq_full_lockless(const struct sock *sk) 230 225 { 231 - return skb_queue_len_lockless(&sk->sk_receive_queue) > 232 - READ_ONCE(sk->sk_max_ack_backlog); 226 + return skb_queue_len_lockless(&sk->sk_receive_queue) > sk->sk_max_ack_backlog; 233 227 } 234 228 235 229 struct sock *unix_peer_get(struct sock *s) ··· 524 530 return 0; 525 531 } 526 532 527 - static int unix_writable(const struct sock *sk) 533 + static int unix_writable(const struct sock *sk, unsigned char state) 528 534 { 529 - return sk->sk_state != TCP_LISTEN && 530 - (refcount_read(&sk->sk_wmem_alloc) << 2) <= sk->sk_sndbuf; 535 + return state != TCP_LISTEN && 536 + (refcount_read(&sk->sk_wmem_alloc) << 2) <= READ_ONCE(sk->sk_sndbuf); 531 537 } 532 538 533 539 static void unix_write_space(struct sock *sk) ··· 535 541 struct socket_wq *wq; 536 542 537 543 rcu_read_lock(); 538 - if (unix_writable(sk)) { 544 + if (unix_writable(sk, READ_ONCE(sk->sk_state))) { 539 545 wq = rcu_dereference(sk->sk_wq); 540 546 if (skwq_has_sleeper(wq)) 541 547 wake_up_interruptible_sync_poll(&wq->wait, ··· 564 570 sk_error_report(other); 565 571 } 566 572 } 567 - other->sk_state = TCP_CLOSE; 568 573 } 569 574 570 575 static void unix_sock_destructor(struct sock *sk) ··· 610 617 u->path.dentry = NULL; 611 618 u->path.mnt = NULL; 612 619 state = sk->sk_state; 613 - sk->sk_state = TCP_CLOSE; 620 + WRITE_ONCE(sk->sk_state, TCP_CLOSE); 614 621 615 622 skpair = unix_peer(sk); 616 623 unix_peer(sk) = NULL; ··· 631 638 unix_state_lock(skpair); 632 639 /* No more writes */ 633 640 WRITE_ONCE(skpair->sk_shutdown, SHUTDOWN_MASK); 634 - if (!skb_queue_empty(&sk->sk_receive_queue) || embrion) 641 + if (!skb_queue_empty_lockless(&sk->sk_receive_queue) || embrion) 635 642 WRITE_ONCE(skpair->sk_err, ECONNRESET); 636 643 unix_state_unlock(skpair); 637 644 skpair->sk_state_change(skpair); ··· 732 739 if (backlog > sk->sk_max_ack_backlog) 733 740 wake_up_interruptible_all(&u->peer_wait); 734 741 sk->sk_max_ack_backlog = backlog; 735 - sk->sk_state = TCP_LISTEN; 742 + WRITE_ONCE(sk->sk_state, TCP_LISTEN); 743 + 736 744 /* set credentials so connect can copy them */ 737 745 init_peercred(sk); 738 746 err = 0; ··· 970 976 sk->sk_hash = unix_unbound_hash(sk); 971 977 sk->sk_allocation = GFP_KERNEL_ACCOUNT; 972 978 sk->sk_write_space = unix_write_space; 973 - sk->sk_max_ack_backlog = net->unx.sysctl_max_dgram_qlen; 979 + sk->sk_max_ack_backlog = READ_ONCE(net->unx.sysctl_max_dgram_qlen); 974 980 sk->sk_destruct = unix_sock_destructor; 975 981 u = unix_sk(sk); 976 982 u->listener = NULL; ··· 1396 1402 if (err) 1397 1403 goto out_unlock; 1398 1404 1399 - sk->sk_state = other->sk_state = TCP_ESTABLISHED; 1405 + WRITE_ONCE(sk->sk_state, TCP_ESTABLISHED); 1406 + WRITE_ONCE(other->sk_state, TCP_ESTABLISHED); 1400 1407 } else { 1401 1408 /* 1402 1409 * 1003.1g breaking connected state with AF_UNSPEC ··· 1414 1419 1415 1420 unix_peer(sk) = other; 1416 1421 if (!other) 1417 - sk->sk_state = TCP_CLOSE; 1422 + WRITE_ONCE(sk->sk_state, TCP_CLOSE); 1418 1423 unix_dgram_peer_wake_disconnect_wakeup(sk, old_peer); 1419 1424 1420 1425 unix_state_double_unlock(sk, other); 1421 1426 1422 - if (other != old_peer) 1427 + if (other != old_peer) { 1423 1428 unix_dgram_disconnected(sk, old_peer); 1429 + 1430 + unix_state_lock(old_peer); 1431 + if (!unix_peer(old_peer)) 1432 + WRITE_ONCE(old_peer->sk_state, TCP_CLOSE); 1433 + unix_state_unlock(old_peer); 1434 + } 1435 + 1424 1436 sock_put(old_peer); 1425 1437 } else { 1426 1438 unix_peer(sk) = other; ··· 1475 1473 struct sk_buff *skb = NULL; 1476 1474 long timeo; 1477 1475 int err; 1478 - int st; 1479 1476 1480 1477 err = unix_validate_addr(sunaddr, addr_len); 1481 1478 if (err) ··· 1539 1538 if (other->sk_shutdown & RCV_SHUTDOWN) 1540 1539 goto out_unlock; 1541 1540 1542 - if (unix_recvq_full(other)) { 1541 + if (unix_recvq_full_lockless(other)) { 1543 1542 err = -EAGAIN; 1544 1543 if (!timeo) 1545 1544 goto out_unlock; ··· 1564 1563 1565 1564 Well, and we have to recheck the state after socket locked. 1566 1565 */ 1567 - st = sk->sk_state; 1568 - 1569 - switch (st) { 1566 + switch (READ_ONCE(sk->sk_state)) { 1570 1567 case TCP_CLOSE: 1571 1568 /* This is ok... continue with connect */ 1572 1569 break; ··· 1579 1580 1580 1581 unix_state_lock_nested(sk, U_LOCK_SECOND); 1581 1582 1582 - if (sk->sk_state != st) { 1583 + if (sk->sk_state != TCP_CLOSE) { 1583 1584 unix_state_unlock(sk); 1584 1585 unix_state_unlock(other); 1585 1586 sock_put(other); ··· 1632 1633 copy_peercred(sk, other); 1633 1634 1634 1635 sock->state = SS_CONNECTED; 1635 - sk->sk_state = TCP_ESTABLISHED; 1636 + WRITE_ONCE(sk->sk_state, TCP_ESTABLISHED); 1636 1637 sock_hold(newsk); 1637 1638 1638 1639 smp_mb__after_atomic(); /* sock_hold() does an atomic_inc() */ ··· 1704 1705 goto out; 1705 1706 1706 1707 arg->err = -EINVAL; 1707 - if (sk->sk_state != TCP_LISTEN) 1708 + if (READ_ONCE(sk->sk_state) != TCP_LISTEN) 1708 1709 goto out; 1709 1710 1710 1711 /* If socket state is TCP_LISTEN it cannot change (for now...), ··· 1961 1962 } 1962 1963 1963 1964 err = -EMSGSIZE; 1964 - if (len > sk->sk_sndbuf - 32) 1965 + if (len > READ_ONCE(sk->sk_sndbuf) - 32) 1965 1966 goto out; 1966 1967 1967 1968 if (len > SKB_MAX_ALLOC) { ··· 2043 2044 unix_peer(sk) = NULL; 2044 2045 unix_dgram_peer_wake_disconnect_wakeup(sk, other); 2045 2046 2046 - sk->sk_state = TCP_CLOSE; 2047 + WRITE_ONCE(sk->sk_state, TCP_CLOSE); 2047 2048 unix_state_unlock(sk); 2048 2049 2049 2050 unix_dgram_disconnected(sk, other); ··· 2220 2221 } 2221 2222 2222 2223 if (msg->msg_namelen) { 2223 - err = sk->sk_state == TCP_ESTABLISHED ? -EISCONN : -EOPNOTSUPP; 2224 + err = READ_ONCE(sk->sk_state) == TCP_ESTABLISHED ? -EISCONN : -EOPNOTSUPP; 2224 2225 goto out_err; 2225 2226 } else { 2226 2227 err = -ENOTCONN; ··· 2241 2242 &err, 0); 2242 2243 } else { 2243 2244 /* Keep two messages in the pipe so it schedules better */ 2244 - size = min_t(int, size, (sk->sk_sndbuf >> 1) - 64); 2245 + size = min_t(int, size, (READ_ONCE(sk->sk_sndbuf) >> 1) - 64); 2245 2246 2246 2247 /* allow fallback to order-0 allocations */ 2247 2248 size = min_t(int, size, SKB_MAX_HEAD(0) + UNIX_SKB_FRAGS_SZ); ··· 2334 2335 if (err) 2335 2336 return err; 2336 2337 2337 - if (sk->sk_state != TCP_ESTABLISHED) 2338 + if (READ_ONCE(sk->sk_state) != TCP_ESTABLISHED) 2338 2339 return -ENOTCONN; 2339 2340 2340 2341 if (msg->msg_namelen) ··· 2348 2349 { 2349 2350 struct sock *sk = sock->sk; 2350 2351 2351 - if (sk->sk_state != TCP_ESTABLISHED) 2352 + if (READ_ONCE(sk->sk_state) != TCP_ESTABLISHED) 2352 2353 return -ENOTCONN; 2353 2354 2354 2355 return unix_dgram_recvmsg(sock, msg, size, flags); ··· 2653 2654 2654 2655 static int unix_stream_read_skb(struct sock *sk, skb_read_actor_t recv_actor) 2655 2656 { 2656 - if (unlikely(sk->sk_state != TCP_ESTABLISHED)) 2657 + if (unlikely(READ_ONCE(sk->sk_state) != TCP_ESTABLISHED)) 2657 2658 return -ENOTCONN; 2658 2659 2659 2660 return unix_read_skb(sk, recv_actor); ··· 2677 2678 size_t size = state->size; 2678 2679 unsigned int last_len; 2679 2680 2680 - if (unlikely(sk->sk_state != TCP_ESTABLISHED)) { 2681 + if (unlikely(READ_ONCE(sk->sk_state) != TCP_ESTABLISHED)) { 2681 2682 err = -EINVAL; 2682 2683 goto out; 2683 2684 } ··· 3008 3009 struct sk_buff *skb; 3009 3010 long amount = 0; 3010 3011 3011 - if (sk->sk_state == TCP_LISTEN) 3012 + if (READ_ONCE(sk->sk_state) == TCP_LISTEN) 3012 3013 return -EINVAL; 3013 3014 3014 3015 spin_lock(&sk->sk_receive_queue.lock); ··· 3120 3121 static __poll_t unix_poll(struct file *file, struct socket *sock, poll_table *wait) 3121 3122 { 3122 3123 struct sock *sk = sock->sk; 3124 + unsigned char state; 3123 3125 __poll_t mask; 3124 3126 u8 shutdown; 3125 3127 3126 3128 sock_poll_wait(file, sock, wait); 3127 3129 mask = 0; 3128 3130 shutdown = READ_ONCE(sk->sk_shutdown); 3131 + state = READ_ONCE(sk->sk_state); 3129 3132 3130 3133 /* exceptional events? */ 3131 3134 if (READ_ONCE(sk->sk_err)) ··· 3149 3148 3150 3149 /* Connection-based need to check for termination and startup */ 3151 3150 if ((sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET) && 3152 - sk->sk_state == TCP_CLOSE) 3151 + state == TCP_CLOSE) 3153 3152 mask |= EPOLLHUP; 3154 3153 3155 3154 /* 3156 3155 * we set writable also when the other side has shut down the 3157 3156 * connection. This prevents stuck sockets. 3158 3157 */ 3159 - if (unix_writable(sk)) 3158 + if (unix_writable(sk, state)) 3160 3159 mask |= EPOLLOUT | EPOLLWRNORM | EPOLLWRBAND; 3161 3160 3162 3161 return mask; ··· 3167 3166 { 3168 3167 struct sock *sk = sock->sk, *other; 3169 3168 unsigned int writable; 3169 + unsigned char state; 3170 3170 __poll_t mask; 3171 3171 u8 shutdown; 3172 3172 3173 3173 sock_poll_wait(file, sock, wait); 3174 3174 mask = 0; 3175 3175 shutdown = READ_ONCE(sk->sk_shutdown); 3176 + state = READ_ONCE(sk->sk_state); 3176 3177 3177 3178 /* exceptional events? */ 3178 3179 if (READ_ONCE(sk->sk_err) || ··· 3194 3191 mask |= EPOLLIN | EPOLLRDNORM; 3195 3192 3196 3193 /* Connection-based need to check for termination and startup */ 3197 - if (sk->sk_type == SOCK_SEQPACKET) { 3198 - if (sk->sk_state == TCP_CLOSE) 3199 - mask |= EPOLLHUP; 3200 - /* connection hasn't started yet? */ 3201 - if (sk->sk_state == TCP_SYN_SENT) 3202 - return mask; 3203 - } 3194 + if (sk->sk_type == SOCK_SEQPACKET && state == TCP_CLOSE) 3195 + mask |= EPOLLHUP; 3204 3196 3205 3197 /* No write status requested, avoid expensive OUT tests. */ 3206 3198 if (!(poll_requested_events(wait) & (EPOLLWRBAND|EPOLLWRNORM|EPOLLOUT))) 3207 3199 return mask; 3208 3200 3209 - writable = unix_writable(sk); 3201 + writable = unix_writable(sk, state); 3210 3202 if (writable) { 3211 3203 unix_state_lock(sk); 3212 3204
+6 -6
net/unix/diag.c
··· 65 65 u32 *buf; 66 66 int i; 67 67 68 - if (sk->sk_state == TCP_LISTEN) { 68 + if (READ_ONCE(sk->sk_state) == TCP_LISTEN) { 69 69 spin_lock(&sk->sk_receive_queue.lock); 70 70 71 71 attr = nla_reserve(nlskb, UNIX_DIAG_ICONS, ··· 103 103 { 104 104 struct unix_diag_rqlen rql; 105 105 106 - if (sk->sk_state == TCP_LISTEN) { 107 - rql.udiag_rqueue = sk->sk_receive_queue.qlen; 106 + if (READ_ONCE(sk->sk_state) == TCP_LISTEN) { 107 + rql.udiag_rqueue = skb_queue_len_lockless(&sk->sk_receive_queue); 108 108 rql.udiag_wqueue = sk->sk_max_ack_backlog; 109 109 } else { 110 110 rql.udiag_rqueue = (u32) unix_inq_len(sk); ··· 136 136 rep = nlmsg_data(nlh); 137 137 rep->udiag_family = AF_UNIX; 138 138 rep->udiag_type = sk->sk_type; 139 - rep->udiag_state = sk->sk_state; 139 + rep->udiag_state = READ_ONCE(sk->sk_state); 140 140 rep->pad = 0; 141 141 rep->udiag_ino = sk_ino; 142 142 sock_diag_save_cookie(sk, rep->udiag_cookie); ··· 165 165 sock_diag_put_meminfo(sk, skb, UNIX_DIAG_MEMINFO)) 166 166 goto out_nlmsg_trim; 167 167 168 - if (nla_put_u8(skb, UNIX_DIAG_SHUTDOWN, sk->sk_shutdown)) 168 + if (nla_put_u8(skb, UNIX_DIAG_SHUTDOWN, READ_ONCE(sk->sk_shutdown))) 169 169 goto out_nlmsg_trim; 170 170 171 171 if ((req->udiag_show & UDIAG_SHOW_UID) && ··· 215 215 sk_for_each(sk, &net->unx.table.buckets[slot]) { 216 216 if (num < s_num) 217 217 goto next; 218 - if (!(req->udiag_states & (1 << sk->sk_state))) 218 + if (!(req->udiag_states & (1 << READ_ONCE(sk->sk_state)))) 219 219 goto next; 220 220 if (sk_diag_dump(sk, skb, req, sk_user_ns(skb->sk), 221 221 NETLINK_CB(cb->skb).portid,
+1 -1
net/wireless/core.c
··· 431 431 if (wk) { 432 432 list_del_init(&wk->entry); 433 433 if (!list_empty(&rdev->wiphy_work_list)) 434 - schedule_work(work); 434 + queue_work(system_unbound_wq, work); 435 435 spin_unlock_irq(&rdev->wiphy_work_lock); 436 436 437 437 wk->func(&rdev->wiphy, wk);
+4 -4
net/wireless/pmsr.c
··· 56 56 out->ftm.burst_period = 0; 57 57 if (tb[NL80211_PMSR_FTM_REQ_ATTR_BURST_PERIOD]) 58 58 out->ftm.burst_period = 59 - nla_get_u32(tb[NL80211_PMSR_FTM_REQ_ATTR_BURST_PERIOD]); 59 + nla_get_u16(tb[NL80211_PMSR_FTM_REQ_ATTR_BURST_PERIOD]); 60 60 61 61 out->ftm.asap = !!tb[NL80211_PMSR_FTM_REQ_ATTR_ASAP]; 62 62 if (out->ftm.asap && !capa->ftm.asap) { ··· 75 75 out->ftm.num_bursts_exp = 0; 76 76 if (tb[NL80211_PMSR_FTM_REQ_ATTR_NUM_BURSTS_EXP]) 77 77 out->ftm.num_bursts_exp = 78 - nla_get_u32(tb[NL80211_PMSR_FTM_REQ_ATTR_NUM_BURSTS_EXP]); 78 + nla_get_u8(tb[NL80211_PMSR_FTM_REQ_ATTR_NUM_BURSTS_EXP]); 79 79 80 80 if (capa->ftm.max_bursts_exponent >= 0 && 81 81 out->ftm.num_bursts_exp > capa->ftm.max_bursts_exponent) { ··· 88 88 out->ftm.burst_duration = 15; 89 89 if (tb[NL80211_PMSR_FTM_REQ_ATTR_BURST_DURATION]) 90 90 out->ftm.burst_duration = 91 - nla_get_u32(tb[NL80211_PMSR_FTM_REQ_ATTR_BURST_DURATION]); 91 + nla_get_u8(tb[NL80211_PMSR_FTM_REQ_ATTR_BURST_DURATION]); 92 92 93 93 out->ftm.ftms_per_burst = 0; 94 94 if (tb[NL80211_PMSR_FTM_REQ_ATTR_FTMS_PER_BURST]) ··· 107 107 out->ftm.ftmr_retries = 3; 108 108 if (tb[NL80211_PMSR_FTM_REQ_ATTR_NUM_FTMR_RETRIES]) 109 109 out->ftm.ftmr_retries = 110 - nla_get_u32(tb[NL80211_PMSR_FTM_REQ_ATTR_NUM_FTMR_RETRIES]); 110 + nla_get_u8(tb[NL80211_PMSR_FTM_REQ_ATTR_NUM_FTMR_RETRIES]); 111 111 112 112 out->ftm.request_lci = !!tb[NL80211_PMSR_FTM_REQ_ATTR_REQUEST_LCI]; 113 113 if (out->ftm.request_lci && !capa->ftm.request_lci) {
+5 -1
net/wireless/rdev-ops.h
··· 2 2 /* 3 3 * Portions of this file 4 4 * Copyright(c) 2016-2017 Intel Deutschland GmbH 5 - * Copyright (C) 2018, 2021-2023 Intel Corporation 5 + * Copyright (C) 2018, 2021-2024 Intel Corporation 6 6 */ 7 7 #ifndef __CFG80211_RDEV_OPS 8 8 #define __CFG80211_RDEV_OPS ··· 458 458 struct cfg80211_scan_request *request) 459 459 { 460 460 int ret; 461 + 462 + if (WARN_ON_ONCE(!request->n_ssids && request->ssids)) 463 + return -EINVAL; 464 + 461 465 trace_rdev_scan(&rdev->wiphy, request); 462 466 ret = rdev->ops->scan(&rdev->wiphy, request); 463 467 trace_rdev_return_int(&rdev->wiphy, ret);
+33 -17
net/wireless/scan.c
··· 812 812 LIST_HEAD(coloc_ap_list); 813 813 bool need_scan_psc = true; 814 814 const struct ieee80211_sband_iftype_data *iftd; 815 + size_t size, offs_ssids, offs_6ghz_params, offs_ies; 815 816 816 817 rdev_req->scan_6ghz = true; 817 818 ··· 878 877 spin_unlock_bh(&rdev->bss_lock); 879 878 } 880 879 881 - request = kzalloc(struct_size(request, channels, n_channels) + 882 - sizeof(*request->scan_6ghz_params) * count + 883 - sizeof(*request->ssids) * rdev_req->n_ssids, 884 - GFP_KERNEL); 880 + size = struct_size(request, channels, n_channels); 881 + offs_ssids = size; 882 + size += sizeof(*request->ssids) * rdev_req->n_ssids; 883 + offs_6ghz_params = size; 884 + size += sizeof(*request->scan_6ghz_params) * count; 885 + offs_ies = size; 886 + size += rdev_req->ie_len; 887 + 888 + request = kzalloc(size, GFP_KERNEL); 885 889 if (!request) { 886 890 cfg80211_free_coloc_ap_list(&coloc_ap_list); 887 891 return -ENOMEM; ··· 894 888 895 889 *request = *rdev_req; 896 890 request->n_channels = 0; 897 - request->scan_6ghz_params = 898 - (void *)&request->channels[n_channels]; 891 + request->n_6ghz_params = 0; 892 + if (rdev_req->n_ssids) { 893 + /* 894 + * Add the ssids from the parent scan request to the new 895 + * scan request, so the driver would be able to use them 896 + * in its probe requests to discover hidden APs on PSC 897 + * channels. 898 + */ 899 + request->ssids = (void *)request + offs_ssids; 900 + memcpy(request->ssids, rdev_req->ssids, 901 + sizeof(*request->ssids) * request->n_ssids); 902 + } 903 + request->scan_6ghz_params = (void *)request + offs_6ghz_params; 904 + 905 + if (rdev_req->ie_len) { 906 + void *ie = (void *)request + offs_ies; 907 + 908 + memcpy(ie, rdev_req->ie, rdev_req->ie_len); 909 + request->ie = ie; 910 + } 899 911 900 912 /* 901 913 * PSC channels should not be scanned in case of direct scan with 1 SSID ··· 1002 978 1003 979 if (request->n_channels) { 1004 980 struct cfg80211_scan_request *old = rdev->int_scan_req; 1005 - rdev->int_scan_req = request; 1006 981 1007 - /* 1008 - * Add the ssids from the parent scan request to the new scan 1009 - * request, so the driver would be able to use them in its 1010 - * probe requests to discover hidden APs on PSC channels. 1011 - */ 1012 - request->ssids = (void *)&request->channels[request->n_channels]; 1013 - request->n_ssids = rdev_req->n_ssids; 1014 - memcpy(request->ssids, rdev_req->ssids, sizeof(*request->ssids) * 1015 - request->n_ssids); 982 + rdev->int_scan_req = request; 1016 983 1017 984 /* 1018 985 * If this scan follows a previous scan, save the scan start ··· 2143 2128 struct ieee80211_he_operation *he_oper; 2144 2129 2145 2130 tmp = cfg80211_find_ext_elem(WLAN_EID_EXT_HE_OPERATION, ie, ielen); 2146 - if (tmp && tmp->datalen >= sizeof(*he_oper) + 1) { 2131 + if (tmp && tmp->datalen >= sizeof(*he_oper) + 1 && 2132 + tmp->datalen >= ieee80211_he_oper_size(tmp->data + 1)) { 2147 2133 const struct ieee80211_he_6ghz_oper *he_6ghz_oper; 2148 2134 2149 2135 he_oper = (void *)&tmp->data[1];
+2 -2
net/wireless/sysfs.c
··· 5 5 * 6 6 * Copyright 2005-2006 Jiri Benc <jbenc@suse.cz> 7 7 * Copyright 2006 Johannes Berg <johannes@sipsolutions.net> 8 - * Copyright (C) 2020-2021, 2023 Intel Corporation 8 + * Copyright (C) 2020-2021, 2023-2024 Intel Corporation 9 9 */ 10 10 11 11 #include <linux/device.h> ··· 137 137 if (rdev->wiphy.registered && rdev->ops->resume) 138 138 ret = rdev_resume(rdev); 139 139 rdev->suspended = false; 140 - schedule_work(&rdev->wiphy_work); 140 + queue_work(system_unbound_wq, &rdev->wiphy_work); 141 141 wiphy_unlock(&rdev->wiphy); 142 142 143 143 if (ret)
+6 -1
net/wireless/util.c
··· 2549 2549 { 2550 2550 struct cfg80211_registered_device *rdev; 2551 2551 struct wireless_dev *wdev; 2552 + int ret; 2552 2553 2553 2554 wdev = dev->ieee80211_ptr; 2554 2555 if (!wdev) ··· 2561 2560 2562 2561 memset(sinfo, 0, sizeof(*sinfo)); 2563 2562 2564 - return rdev_get_station(rdev, dev, mac_addr, sinfo); 2563 + wiphy_lock(&rdev->wiphy); 2564 + ret = rdev_get_station(rdev, dev, mac_addr, sinfo); 2565 + wiphy_unlock(&rdev->wiphy); 2566 + 2567 + return ret; 2565 2568 } 2566 2569 EXPORT_SYMBOL(cfg80211_get_station); 2567 2570
+1 -4
net/xdp/xsk.c
··· 313 313 314 314 static int xsk_rcv_check(struct xdp_sock *xs, struct xdp_buff *xdp, u32 len) 315 315 { 316 - struct net_device *dev = xdp->rxq->dev; 317 - u32 qid = xdp->rxq->queue_index; 318 - 319 316 if (!xsk_is_bound(xs)) 320 317 return -ENXIO; 321 318 322 - if (!dev->_rx[qid].pool || xs->umem != dev->_rx[qid].pool->umem) 319 + if (xs->dev != xdp->rxq->dev || xs->queue_id != xdp->rxq->queue_index) 323 320 return -EINVAL; 324 321 325 322 if (len > xsk_pool_get_rx_frame_size(xs->pool) && !xs->sg) {
+2 -1
tools/lib/bpf/features.c
··· 393 393 err = -errno; /* close() can clobber errno */ 394 394 395 395 if (link_fd >= 0 || err != -EBADF) { 396 - close(link_fd); 396 + if (link_fd >= 0) 397 + close(link_fd); 397 398 close(prog_fd); 398 399 return 0; 399 400 }
+1 -1
tools/testing/selftests/bpf/progs/test_sk_storage_tracing.c
··· 84 84 } 85 85 86 86 SEC("fexit/inet_csk_accept") 87 - int BPF_PROG(inet_csk_accept, struct sock *sk, int flags, int *err, bool kern, 87 + int BPF_PROG(inet_csk_accept, struct sock *sk, struct proto_accept_arg *arg, 88 88 struct sock *accepted_sk) 89 89 { 90 90 set_task_info(accepted_sk);
+1
tools/testing/selftests/net/hsr/config
··· 2 2 CONFIG_NET_SCH_NETEM=m 3 3 CONFIG_HSR=y 4 4 CONFIG_VETH=y 5 + CONFIG_BRIDGE=y
+9 -9
tools/testing/selftests/net/lib.sh
··· 15 15 ksft_skip=4 16 16 17 17 # namespace list created by setup_ns 18 - NS_LIST="" 18 + NS_LIST=() 19 19 20 20 ############################################################################## 21 21 # Helpers ··· 27 27 local -A weights 28 28 local weight=0 29 29 30 + local i 30 31 for i in "$@"; do 31 32 weights[$i]=$((weight++)) 32 33 done ··· 68 67 while true 69 68 do 70 69 local out 71 - out=$("$@") 72 - local ret=$? 73 - if ((!ret)); then 70 + if out=$("$@"); then 74 71 echo -n "$out" 75 72 return 0 76 73 fi ··· 138 139 fi 139 140 140 141 for ns in "$@"; do 142 + [ -z "${ns}" ] && continue 141 143 ip netns delete "${ns}" &> /dev/null 142 144 if ! busywait $BUSYWAIT_TIMEOUT ip netns list \| grep -vq "^$ns$" &> /dev/null; then 143 145 echo "Warn: Failed to remove namespace $ns" ··· 152 152 153 153 cleanup_all_ns() 154 154 { 155 - cleanup_ns $NS_LIST 155 + cleanup_ns "${NS_LIST[@]}" 156 156 } 157 157 158 158 # setup netns with given names as prefix. e.g ··· 161 161 { 162 162 local ns="" 163 163 local ns_name="" 164 - local ns_list="" 164 + local ns_list=() 165 165 local ns_exist= 166 166 for ns_name in "$@"; do 167 167 # Some test may setup/remove same netns multi times ··· 177 177 178 178 if ! ip netns add "$ns"; then 179 179 echo "Failed to create namespace $ns_name" 180 - cleanup_ns "$ns_list" 180 + cleanup_ns "${ns_list[@]}" 181 181 return $ksft_skip 182 182 fi 183 183 ip -n "$ns" link set lo up 184 - ! $ns_exist && ns_list="$ns_list $ns" 184 + ! $ns_exist && ns_list+=("$ns") 185 185 done 186 - NS_LIST="$NS_LIST $ns_list" 186 + NS_LIST+=("${ns_list[@]}") 187 187 } 188 188 189 189 tc_rule_stats_get()