net/mac80211/tests/tpe.c

Source file repositories/reference/linux-study-clean/net/mac80211/tests/tpe.c

File Facts

System
Linux kernel
Corpus path
net/mac80211/tests/tpe.c
Extension
.c
Size
6743 bytes
Lines
285
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.

Dependency Surface

Detected Declarations

Annotated Snippet

// SPDX-License-Identifier: GPL-2.0-only
/*
 * KUnit tests for TPE element handling
 *
 * Copyright (C) 2024 Intel Corporation
 */
#include <kunit/test.h>
#include "../ieee80211_i.h"

MODULE_IMPORT_NS("EXPORTED_FOR_KUNIT_TESTING");

static struct ieee80211_channel chan6g_1 = {
	.band = NL80211_BAND_6GHZ,
	.center_freq = 5955,
};

static struct ieee80211_channel chan6g_33 = {
	.band = NL80211_BAND_6GHZ,
	.center_freq = 6115,
};

static struct ieee80211_channel chan6g_61 = {
	.band = NL80211_BAND_6GHZ,
	.center_freq = 6255,
};

static const struct subchan_test_case {
	const char *desc;
	struct cfg80211_chan_def c;
	u8 n;
	int expect;
} subchan_offset_cases[] = {
	{
		.desc = "identical 20 MHz",
		.c.width = NL80211_CHAN_WIDTH_20,
		.c.chan = &chan6g_1,
		.c.center_freq1 = 5955,
		.n = 1,
		.expect = 0,
	},
	{
		.desc = "identical 40 MHz",
		.c.width = NL80211_CHAN_WIDTH_40,
		.c.chan = &chan6g_1,
		.c.center_freq1 = 5965,
		.n = 2,
		.expect = 0,
	},
	{
		.desc = "identical 80+80 MHz",
		/* not really is valid? doesn't matter for the test */
		.c.width = NL80211_CHAN_WIDTH_80P80,
		.c.chan = &chan6g_1,
		.c.center_freq1 = 5985,
		.c.center_freq2 = 6225,
		.n = 16,
		.expect = 0,
	},
	{
		.desc = "identical 320 MHz",
		.c.width = NL80211_CHAN_WIDTH_320,
		.c.chan = &chan6g_1,
		.c.center_freq1 = 6105,
		.n = 16,
		.expect = 0,
	},
	{
		.desc = "lower 160 MHz of 320 MHz",
		.c.width = NL80211_CHAN_WIDTH_320,
		.c.chan = &chan6g_1,
		.c.center_freq1 = 6105,
		.n = 8,
		.expect = 0,
	},
	{
		.desc = "upper 160 MHz of 320 MHz",
		.c.width = NL80211_CHAN_WIDTH_320,
		.c.chan = &chan6g_61,
		.c.center_freq1 = 6105,
		.n = 8,
		.expect = 8,
	},
	{
		.desc = "upper 160 MHz of 320 MHz, go to 40",
		.c.width = NL80211_CHAN_WIDTH_320,
		.c.chan = &chan6g_61,
		.c.center_freq1 = 6105,
		.n = 2,
		.expect = 8 + 4 + 2,
	},

Annotation

Implementation Notes