| 1 |
/* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 |
/* |
| 3 |
* Utilities for mac80211 unit testing |
| 4 |
* |
| 5 |
* Copyright (C) 2024 Intel Corporation |
| 6 |
*/ |
| 7 |
#ifndef __MAC80211_UTILS_H |
| 8 |
#define __MAC80211_UTILS_H |
| 9 |
|
| 10 |
#include "../ieee80211_i.h" |
| 11 |
|
| 12 |
struct t_sdata { |
| 13 |
struct ieee80211_sub_if_data *sdata; |
| 14 |
struct wiphy *wiphy; |
| 15 |
struct ieee80211_local local; |
| 16 |
|
| 17 |
void *ctx; |
| 18 |
|
| 19 |
struct ieee80211_supported_band band_2ghz; |
| 20 |
struct ieee80211_supported_band band_5ghz; |
| 21 |
}; |
| 22 |
|
| 23 |
#define T_SDATA(test) ({ \ |
| 24 |
struct t_sdata *__t_sdata = \ |
| 25 |
kunit_alloc_resource(test, t_sdata_init, \ |
| 26 |
t_sdata_exit, \ |
| 27 |
GFP_KERNEL, NULL); \ |
| 28 |
\ |
| 29 |
KUNIT_ASSERT_NOT_NULL(test, __t_sdata); \ |
| 30 |
__t_sdata; \ |
| 31 |
}) |
| 32 |
|
| 33 |
int t_sdata_init(struct kunit_resource *resource, void *data); |
| 34 |
void t_sdata_exit(struct kunit_resource *resource); |
| 35 |
|
| 36 |
#endif /* __MAC80211_UTILS_H */ |