1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ 2 /* 3 * Copyright (C) 2024 Intel Corporation 4 */ 5 #ifndef __iwl_utils_h__ 6 #define __iwl_utils_h__ 7 8 #include <net/cfg80211.h> 9 10 #ifdef CONFIG_INET 11 /** 12 * iwl_tx_tso_segment - Segments a TSO packet into subframes for A-MSDU. 13 * @skb: buffer to segment. 14 * @num_subframes: number of subframes to create. 15 * @netdev_flags: netdev feature flags. 16 * @mpdus_skbs: list to hold the segmented subframes. 17 * 18 * This function segments a large TCP packet into subframes. 19 * subframes are added to the mpdus_skbs list 20 * 21 * Returns: 0 on success and negative value on failure. 22 */ 23 int iwl_tx_tso_segment(struct sk_buff *skb, unsigned int num_subframes, 24 netdev_features_t netdev_flags, 25 struct sk_buff_head *mpdus_skbs); 26 #else 27 static inline 28 int iwl_tx_tso_segment(struct sk_buff *skb, unsigned int num_subframes, 29 netdev_features_t netdev_flags, 30 struct sk_buff_head *mpdus_skbs) 31 { 32 WARN_ON(1); 33 34 return -1; 35 } 36 #endif /* CONFIG_INET */ 37 38 static inline 39 u32 iwl_find_ie_offset(u8 *beacon, u8 eid, u32 frame_size) 40 { 41 struct ieee80211_mgmt *mgmt = (void *)beacon; 42 const u8 *ie; 43 44 if (WARN_ON_ONCE(frame_size <= (mgmt->u.beacon.variable - beacon))) 45 return 0; 46 47 frame_size -= mgmt->u.beacon.variable - beacon; 48 49 ie = cfg80211_find_ie(eid, mgmt->u.beacon.variable, frame_size); 50 if (!ie) 51 return 0; 52 53 return ie - beacon; 54 } 55 56 #endif /* __iwl_utils_h__ */ 57