1 /* SPDX-License-Identifier: GPL-2.0-only */ 1 2 /* 3 * Utilities for cfg80211 unit testing 4 * 5 * Copyright (C) 2023 Intel Corporation 6 */ 7 #ifndef __CFG80211_UTILS_H 8 #define __CFG80211_UTILS_H 9 10 #define CHAN2G(_freq) { \ 11 .band = NL80211_BAND_2GHZ, \ 12 .center_freq = (_freq), \ 13 .hw_value = (_freq), \ 14 } 15 16 static const struct ieee80211_channel channels 17 CHAN2G(2412), /* Channel 1 */ 18 CHAN2G(2417), /* Channel 2 */ 19 CHAN2G(2422), /* Channel 3 */ 20 CHAN2G(2427), /* Channel 4 */ 21 CHAN2G(2432), /* Channel 5 */ 22 CHAN2G(2437), /* Channel 6 */ 23 CHAN2G(2442), /* Channel 7 */ 24 CHAN2G(2447), /* Channel 8 */ 25 CHAN2G(2452), /* Channel 9 */ 26 CHAN2G(2457), /* Channel 10 */ 27 CHAN2G(2462), /* Channel 11 */ 28 CHAN2G(2467), /* Channel 12 */ 29 CHAN2G(2472), /* Channel 13 */ 30 CHAN2G(2484), /* Channel 14 */ 31 }; 32 33 struct t_wiphy_priv { 34 struct kunit *test; 35 struct cfg80211_ops *ops; 36 37 void *ctx; 38 39 struct ieee80211_supported_band band_2 40 struct ieee80211_channel channels_2ghz 41 }; 42 43 #define T_WIPHY(test, ctx) ({ 44 struct wiphy *__wiphy = 45 kunit_alloc_resource(t 46 t 47 G 48 49 KUNIT_ASSERT_NOT_NULL(test, __ 50 __wiphy; 51 }) 52 #define t_wiphy_ctx(wiphy) (((struct t_wiphy_p 53 54 int t_wiphy_init(struct kunit_resource *resour 55 void t_wiphy_exit(struct kunit_resource *resou 56 57 #define t_skb_remove_member(skb, type, member) 58 memmove((skb)->data + (skb)->l 59 offsetof(type, member) 60 (skb)->data + (skb)->l 61 offsetofend(type, memb 62 offsetofend(type, memb 63 skb_trim(skb, (skb)->len - siz 64 } while (0) 65 66 #endif /* __CFG80211_UTILS_H */ 67
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.