drivers/net/wireless/intel/iwlwifi/mvm/vendor-cmd.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/intel/iwlwifi/mvm/vendor-cmd.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/intel/iwlwifi/mvm/vendor-cmd.c- Extension
.c- Size
- 4290 bytes
- Lines
- 154
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
mvm.hlinux/nl80211-vnd-intel.hnet/netlink.h
Detected Declarations
enum iwl_mvm_vendor_events_idxfunction iwl_mvm_vendor_get_csme_conn_infofunction iwl_mvm_vendor_host_get_ownershipfunction iwl_mvm_vendor_cmds_registerfunction iwl_mvm_send_roaming_forbidden_event
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (C) 2021 Intel Corporation
*/
#include "mvm.h"
#include <linux/nl80211-vnd-intel.h>
#include <net/netlink.h>
static const struct nla_policy
iwl_mvm_vendor_attr_policy[NUM_IWL_MVM_VENDOR_ATTR] = {
[IWL_MVM_VENDOR_ATTR_ROAMING_FORBIDDEN] = { .type = NLA_U8 },
[IWL_MVM_VENDOR_ATTR_AUTH_MODE] = { .type = NLA_U32 },
[IWL_MVM_VENDOR_ATTR_CHANNEL_NUM] = { .type = NLA_U8 },
[IWL_MVM_VENDOR_ATTR_SSID] = { .type = NLA_BINARY,
.len = IEEE80211_MAX_SSID_LEN },
[IWL_MVM_VENDOR_ATTR_BAND] = { .type = NLA_U8 },
[IWL_MVM_VENDOR_ATTR_COLLOC_CHANNEL] = { .type = NLA_U8 },
[IWL_MVM_VENDOR_ATTR_COLLOC_ADDR] = { .type = NLA_BINARY, .len = ETH_ALEN },
};
static int iwl_mvm_vendor_get_csme_conn_info(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data, int data_len)
{
struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
struct iwl_mvm_csme_conn_info *csme_conn_info;
struct sk_buff *skb;
int err = 0;
mutex_lock(&mvm->mutex);
csme_conn_info = iwl_mvm_get_csme_conn_info(mvm);
if (!csme_conn_info) {
err = -EINVAL;
goto out_unlock;
}
skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, 200);
if (!skb) {
err = -ENOMEM;
goto out_unlock;
}
if (nla_put_u32(skb, IWL_MVM_VENDOR_ATTR_AUTH_MODE,
csme_conn_info->conn_info.auth_mode) ||
nla_put(skb, IWL_MVM_VENDOR_ATTR_SSID,
csme_conn_info->conn_info.ssid_len,
csme_conn_info->conn_info.ssid) ||
nla_put_u32(skb, IWL_MVM_VENDOR_ATTR_STA_CIPHER,
csme_conn_info->conn_info.pairwise_cipher) ||
nla_put_u8(skb, IWL_MVM_VENDOR_ATTR_CHANNEL_NUM,
csme_conn_info->conn_info.channel) ||
nla_put(skb, IWL_MVM_VENDOR_ATTR_ADDR, ETH_ALEN,
csme_conn_info->conn_info.bssid)) {
kfree_skb(skb);
err = -ENOBUFS;
}
out_unlock:
mutex_unlock(&mvm->mutex);
if (err)
return err;
return cfg80211_vendor_cmd_reply(skb);
}
static int iwl_mvm_vendor_host_get_ownership(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data, int data_len)
{
struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
int ret;
mutex_lock(&mvm->mutex);
ret = iwl_mvm_mei_get_ownership(mvm);
mutex_unlock(&mvm->mutex);
return ret;
}
static const struct wiphy_vendor_command iwl_mvm_vendor_commands[] = {
{
.info = {
.vendor_id = INTEL_OUI,
.subcmd = IWL_MVM_VENDOR_CMD_GET_CSME_CONN_INFO,
},
.doit = iwl_mvm_vendor_get_csme_conn_info,
.flags = WIPHY_VENDOR_CMD_NEED_WDEV,
Annotation
- Immediate include surface: `mvm.h`, `linux/nl80211-vnd-intel.h`, `net/netlink.h`.
- Detected declarations: `enum iwl_mvm_vendor_events_idx`, `function iwl_mvm_vendor_get_csme_conn_info`, `function iwl_mvm_vendor_host_get_ownership`, `function iwl_mvm_vendor_cmds_register`, `function iwl_mvm_send_roaming_forbidden_event`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.