net/mac80211/tests/util.c
Source file repositories/reference/linux-study-clean/net/mac80211/tests/util.c
File Facts
- System
- Linux kernel
- Corpus path
net/mac80211/tests/util.c- Extension
.c- Size
- 9879 bytes
- Lines
- 310
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: implementation source
- Status
- source implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/ieee80211.hnet/mac80211.hkunit/test.hkunit/test-bug.hutil.h
Detected Declarations
function Copyrightfunction t_sdata_initfunction t_sdata_exit
Annotated Snippet
switch (band) {
case NL80211_BAND_2GHZ:
sband->channels = kmemdup(channels_2ghz,
sizeof(channels_2ghz),
GFP_KERNEL);
sband->n_channels = ARRAY_SIZE(channels_2ghz);
sband->bitrates = kmemdup(bitrates,
sizeof(bitrates),
GFP_KERNEL);
sband->n_bitrates = ARRAY_SIZE(bitrates);
break;
case NL80211_BAND_5GHZ:
sband->channels = kmemdup(channels_5ghz,
sizeof(channels_5ghz),
GFP_KERNEL);
sband->n_channels = ARRAY_SIZE(channels_5ghz);
sband->bitrates = kmemdup(bitrates,
sizeof(bitrates),
GFP_KERNEL);
sband->n_bitrates = ARRAY_SIZE(bitrates);
sband->vht_cap.vht_supported = true;
sband->vht_cap.cap =
IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 |
IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ |
IEEE80211_VHT_CAP_RXLDPC |
IEEE80211_VHT_CAP_SHORT_GI_80 |
IEEE80211_VHT_CAP_SHORT_GI_160 |
IEEE80211_VHT_CAP_TXSTBC |
IEEE80211_VHT_CAP_RXSTBC_4 |
IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK;
sband->vht_cap.vht_mcs.rx_mcs_map =
cpu_to_le16(IEEE80211_VHT_MCS_SUPPORT_0_9 << 0 |
IEEE80211_VHT_MCS_SUPPORT_0_9 << 2 |
IEEE80211_VHT_MCS_SUPPORT_0_9 << 4 |
IEEE80211_VHT_MCS_SUPPORT_0_9 << 6);
sband->vht_cap.vht_mcs.tx_mcs_map =
sband->vht_cap.vht_mcs.rx_mcs_map;
break;
default:
continue;
}
sband->ht_cap.ht_supported = band != NL80211_BAND_6GHZ;
sband->ht_cap.cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
IEEE80211_HT_CAP_GRN_FLD |
IEEE80211_HT_CAP_SGI_20 |
IEEE80211_HT_CAP_SGI_40 |
IEEE80211_HT_CAP_DSSSCCK40;
sband->ht_cap.ampdu_factor = 0x3;
sband->ht_cap.ampdu_density = 0x6;
memset(&sband->ht_cap.mcs, 0, sizeof(sband->ht_cap.mcs));
sband->ht_cap.mcs.rx_mask[0] = 0xff;
sband->ht_cap.mcs.rx_mask[1] = 0xff;
sband->ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED;
}
ieee80211_set_sband_iftype_data(&t_sdata->band_5ghz, sband_capa_5ghz);
return 0;
}
void t_sdata_exit(struct kunit_resource *resource)
{
struct t_sdata *t_sdata = resource->data;
kfree(t_sdata->band_2ghz.channels);
kfree(t_sdata->band_2ghz.bitrates);
kfree(t_sdata->band_5ghz.channels);
kfree(t_sdata->band_5ghz.bitrates);
kfree(t_sdata->sdata);
kfree(t_sdata->wiphy);
kfree(t_sdata);
}
Annotation
- Immediate include surface: `linux/ieee80211.h`, `net/mac80211.h`, `kunit/test.h`, `kunit/test-bug.h`, `util.h`.
- Detected declarations: `function Copyright`, `function t_sdata_init`, `function t_sdata_exit`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.