~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/net/wireless/tests/util.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-only */
  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_2ghz[] = {
 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_2ghz;
 40         struct ieee80211_channel channels_2ghz[ARRAY_SIZE(channels_2ghz)];
 41 };
 42 
 43 #define T_WIPHY(test, ctx) ({                                           \
 44                 struct wiphy *__wiphy =                                 \
 45                         kunit_alloc_resource(test, t_wiphy_init,        \
 46                                              t_wiphy_exit,              \
 47                                              GFP_KERNEL, &(ctx));       \
 48                                                                         \
 49                 KUNIT_ASSERT_NOT_NULL(test, __wiphy);                   \
 50                 __wiphy;                                                \
 51         })
 52 #define t_wiphy_ctx(wiphy) (((struct t_wiphy_priv *)wiphy_priv(wiphy))->ctx)
 53 
 54 int t_wiphy_init(struct kunit_resource *resource, void *data);
 55 void t_wiphy_exit(struct kunit_resource *resource);
 56 
 57 #define t_skb_remove_member(skb, type, member)  do {                            \
 58                 memmove((skb)->data + (skb)->len - sizeof(type) +               \
 59                         offsetof(type, member),                                 \
 60                         (skb)->data + (skb)->len - sizeof(type) +               \
 61                         offsetofend(type, member),                              \
 62                         offsetofend(type, member));                             \
 63                 skb_trim(skb, (skb)->len - sizeof_field(type, member));         \
 64         } while (0)
 65 
 66 #endif /* __CFG80211_UTILS_H */
 67 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php