drivers/net/wireless/ath/ath6kl/testmode.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath6kl/testmode.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath6kl/testmode.c- Extension
.c- Size
- 2779 bytes
- Lines
- 102
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
testmode.hdebug.hnet/netlink.h
Detected Declarations
enum ath6kl_tm_attrenum ath6kl_tm_cmdfunction ath6kl_tm_rx_eventfunction ath6kl_tm_cmd
Annotated Snippet
#include "testmode.h"
#include "debug.h"
#include <net/netlink.h>
enum ath6kl_tm_attr {
__ATH6KL_TM_ATTR_INVALID = 0,
ATH6KL_TM_ATTR_CMD = 1,
ATH6KL_TM_ATTR_DATA = 2,
/* keep last */
__ATH6KL_TM_ATTR_AFTER_LAST,
ATH6KL_TM_ATTR_MAX = __ATH6KL_TM_ATTR_AFTER_LAST - 1,
};
enum ath6kl_tm_cmd {
ATH6KL_TM_CMD_TCMD = 0,
ATH6KL_TM_CMD_RX_REPORT = 1, /* not used anymore */
};
#define ATH6KL_TM_DATA_MAX_LEN 5000
static const struct nla_policy ath6kl_tm_policy[ATH6KL_TM_ATTR_MAX + 1] = {
[ATH6KL_TM_ATTR_CMD] = { .type = NLA_U32 },
[ATH6KL_TM_ATTR_DATA] = { .type = NLA_BINARY,
.len = ATH6KL_TM_DATA_MAX_LEN },
};
void ath6kl_tm_rx_event(struct ath6kl *ar, void *buf, size_t buf_len)
{
struct sk_buff *skb;
if (!buf || buf_len == 0)
return;
skb = cfg80211_testmode_alloc_event_skb(ar->wiphy, buf_len, GFP_KERNEL);
if (!skb) {
ath6kl_warn("failed to allocate testmode rx skb!\n");
return;
}
if (nla_put_u32(skb, ATH6KL_TM_ATTR_CMD, ATH6KL_TM_CMD_TCMD) ||
nla_put(skb, ATH6KL_TM_ATTR_DATA, buf_len, buf))
goto nla_put_failure;
cfg80211_testmode_event(skb, GFP_KERNEL);
return;
nla_put_failure:
kfree_skb(skb);
ath6kl_warn("nla_put failed on testmode rx skb!\n");
}
int ath6kl_tm_cmd(struct wiphy *wiphy, struct wireless_dev *wdev,
void *data, int len)
{
struct ath6kl *ar = wiphy_priv(wiphy);
struct nlattr *tb[ATH6KL_TM_ATTR_MAX + 1];
int err, buf_len;
void *buf;
err = nla_parse_deprecated(tb, ATH6KL_TM_ATTR_MAX, data, len,
ath6kl_tm_policy, NULL);
if (err)
return err;
if (!tb[ATH6KL_TM_ATTR_CMD])
return -EINVAL;
switch (nla_get_u32(tb[ATH6KL_TM_ATTR_CMD])) {
case ATH6KL_TM_CMD_TCMD:
if (!tb[ATH6KL_TM_ATTR_DATA])
return -EINVAL;
buf = nla_data(tb[ATH6KL_TM_ATTR_DATA]);
buf_len = nla_len(tb[ATH6KL_TM_ATTR_DATA]);
ath6kl_wmi_test_cmd(ar->wmi, buf, buf_len);
return 0;
case ATH6KL_TM_CMD_RX_REPORT:
default:
return -EOPNOTSUPP;
}
}
Annotation
- Immediate include surface: `testmode.h`, `debug.h`, `net/netlink.h`.
- Detected declarations: `enum ath6kl_tm_attr`, `enum ath6kl_tm_cmd`, `function ath6kl_tm_rx_event`, `function ath6kl_tm_cmd`.
- Atlas domain: Driver Families / drivers/net.
- 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.