---
name: "struct_cfg80211_ops"
section: "9"
platform: "linux"
package: "linux-manual-3.16"
version: "3.16.56-1+deb8u1"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/struct_cfg80211_ops"
---

# struct\_cfg80211\_ops(9)

backend description for wireless configuration

## NAME

struct\_cfg80211\_ops - backend description for wireless configuration

## SYNOPSIS

```
struct cfg80211_ops {
  int (* suspend) (struct wiphy *wiphy, struct cfg80211_wowlan *wow);
  int (* resume) (struct wiphy *wiphy);
  void (* set_wakeup) (struct wiphy *wiphy, bool enabled);
  struct wireless_dev * (* add_virtual_intf) (struct wiphy *wiphy,const char *name,enum nl80211_iftype type,u32 *flags,struct vif_params *params);
  int (* del_virtual_intf) (struct wiphy *wiphy,struct wireless_dev *wdev);
  int (* change_virtual_intf) (struct wiphy *wiphy,struct net_device *dev,enum nl80211_iftype type, u32 *flags,struct vif_params *params);
  int (* add_key) (struct wiphy *wiphy, struct net_device *netdev,u8 key_index, bool pairwise, const u8 *mac_addr,struct key_params *params);
  int (* get_key) (struct wiphy *wiphy, struct net_device *netdev,u8 key_index, bool pairwise, const u8 *mac_addr,void *cookie,void (*callback);
  int (* del_key) (struct wiphy *wiphy, struct net_device *netdev,u8 key_index, bool pairwise, const u8 *mac_addr);
  int (* set_default_key) (struct wiphy *wiphy,struct net_device *netdev,u8 key_index, bool unicast, bool multicast);
  int (* set_default_mgmt_key) (struct wiphy *wiphy,struct net_device *netdev,u8 key_index);
  int (* start_ap) (struct wiphy *wiphy, struct net_device *dev,struct cfg80211_ap_settings *settings);
  int (* change_beacon) (struct wiphy *wiphy, struct net_device *dev,struct cfg80211_beacon_data *info);
  int (* stop_ap) (struct wiphy *wiphy, struct net_device *dev);
  int (* add_station) (struct wiphy *wiphy, struct net_device *dev,const u8 *mac,struct station_parameters *params);
  int (* del_station) (struct wiphy *wiphy, struct net_device *dev,const u8 *mac);
  int (* change_station) (struct wiphy *wiphy, struct net_device *dev,const u8 *mac,struct station_parameters *params);
  int (* get_station) (struct wiphy *wiphy, struct net_device *dev,const u8 *mac, struct station_info *sinfo);
  int (* dump_station) (struct wiphy *wiphy, struct net_device *dev,int idx, u8 *mac, struct station_info *sinfo);
  int (* add_mpath) (struct wiphy *wiphy, struct net_device *dev,const u8 *dst, const u8 *next_hop);
  int (* del_mpath) (struct wiphy *wiphy, struct net_device *dev,const u8 *dst);
  int (* change_mpath) (struct wiphy *wiphy, struct net_device *dev,const u8 *dst, const u8 *next_hop);
  int (* get_mpath) (struct wiphy *wiphy, struct net_device *dev,u8 *dst, u8 *next_hop, struct mpath_info *pinfo);
  int (* dump_mpath) (struct wiphy *wiphy, struct net_device *dev,int idx, u8 *dst, u8 *next_hop,struct mpath_info *pinfo);
  int (* get_mesh_config) (struct wiphy *wiphy,struct net_device *dev,struct mesh_config *conf);
  int (* update_mesh_config) (struct wiphy *wiphy,struct net_device *dev, u32 mask,const struct mesh_config *nconf);
  int (* join_mesh) (struct wiphy *wiphy, struct net_device *dev,const struct mesh_config *conf,const struct mesh_setup *setup);
  int (* leave_mesh) (struct wiphy *wiphy, struct net_device *dev);
  int (* change_bss) (struct wiphy *wiphy, struct net_device *dev,struct bss_parameters *params);
  int (* set_txq_params) (struct wiphy *wiphy, struct net_device *dev,struct ieee80211_txq_params *params);
  int (* libertas_set_mesh_channel) (struct wiphy *wiphy,struct net_device *dev,struct ieee80211_channel *chan);
  int (* set_monitor_channel) (struct wiphy *wiphy,struct cfg80211_chan_def *chandef);
  int (* scan) (struct wiphy *wiphy,struct cfg80211_scan_request *request);
  int (* auth) (struct wiphy *wiphy, struct net_device *dev,struct cfg80211_auth_request *req);
  int (* assoc) (struct wiphy *wiphy, struct net_device *dev,struct cfg80211_assoc_request *req);
  int (* deauth) (struct wiphy *wiphy, struct net_device *dev,struct cfg80211_deauth_request *req);
  int (* disassoc) (struct wiphy *wiphy, struct net_device *dev,struct cfg80211_disassoc_request *req);
  int (* connect) (struct wiphy *wiphy, struct net_device *dev,struct cfg80211_connect_params *sme);
  int (* disconnect) (struct wiphy *wiphy, struct net_device *dev,u16 reason_code);
  int (* join_ibss) (struct wiphy *wiphy, struct net_device *dev,struct cfg80211_ibss_params *params);
  int (* leave_ibss) (struct wiphy *wiphy, struct net_device *dev);
  int (* set_mcast_rate) (struct wiphy *wiphy, struct net_device *dev,int rate[IEEE80211_NUM_BANDS]);
  int (* set_wiphy_params) (struct wiphy *wiphy, u32 changed);
  int (* set_tx_power) (struct wiphy *wiphy, struct wireless_dev *wdev,enum nl80211_tx_power_setting type, int mbm);
  int (* get_tx_power) (struct wiphy *wiphy, struct wireless_dev *wdev,int *dbm);
  int (* set_wds_peer) (struct wiphy *wiphy, struct net_device *dev,const u8 *addr);
  void (* rfkill_poll) (struct wiphy *wiphy);
#ifdef CONFIG_NL80211_TESTMODE
  int (* testmode_cmd) (struct wiphy *wiphy, struct wireless_dev *wdev,void *data, int len);
  int (* testmode_dump) (struct wiphy *wiphy, struct sk_buff *skb,struct netlink_callback *cb,void *data, int len);
#endif
  int (* set_bitrate_mask) (struct wiphy *wiphy,struct net_device *dev,const u8 *peer,const struct cfg80211_bitrate_mask *mask);
  int (* dump_survey) (struct wiphy *wiphy, struct net_device *netdev,int idx, struct survey_info *info);
  int (* set_pmksa) (struct wiphy *wiphy, struct net_device *netdev,struct cfg80211_pmksa *pmksa);
  int (* del_pmksa) (struct wiphy *wiphy, struct net_device *netdev,struct cfg80211_pmksa *pmksa);
  int (* flush_pmksa) (struct wiphy *wiphy, struct net_device *netdev);
  int (* remain_on_channel) (struct wiphy *wiphy,struct wireless_dev *wdev,struct ieee80211_channel *chan,unsigned int duration,u64 *cookie);
  int (* cancel_remain_on_channel) (struct wiphy *wiphy,struct wireless_dev *wdev,u64 cookie);
  int (* mgmt_tx) (struct wiphy *wiphy, struct wireless_dev *wdev,struct cfg80211_mgmt_tx_params *params,u64 *cookie);
  int (* mgmt_tx_cancel_wait) (struct wiphy *wiphy,struct wireless_dev *wdev,u64 cookie);
  int (* set_power_mgmt) (struct wiphy *wiphy, struct net_device *dev,bool enabled, int timeout);
  int (* set_cqm_rssi_config) (struct wiphy *wiphy,struct net_device *dev,s32 rssi_thold, u32 rssi_hyst);
  int (* set_cqm_txe_config) (struct wiphy *wiphy,struct net_device *dev,u32 rate, u32 pkts, u32 intvl);
  void (* mgmt_frame_register) (struct wiphy *wiphy,struct wireless_dev *wdev,u16 frame_type, bool reg);
  int (* set_antenna) (struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
  int (* get_antenna) (struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
  int (* set_ringparam) (struct wiphy *wiphy, u32 tx, u32 rx);
  void (* get_ringparam) (struct wiphy *wiphy,u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max);
  int (* sched_scan_start) (struct wiphy *wiphy,struct net_device *dev,struct cfg80211_sched_scan_request *request);
  int (* sched_scan_stop) (struct wiphy *wiphy, struct net_device *dev);
  int (* set_rekey_data) (struct wiphy *wiphy, struct net_device *dev,struct cfg80211_gtk_rekey_data *data);
  int (* tdls_mgmt) (struct wiphy *wiphy, struct net_device *dev,const u8 *peer, u8 action_code,  u8 dialog_token,u16 status_code, u32 peer_capability,const u8 *buf, size_t len);
  int (* tdls_oper) (struct wiphy *wiphy, struct net_device *dev,const u8 *peer, enum nl80211_tdls_operation oper);
  int (* probe_client) (struct wiphy *wiphy, struct net_device *dev,const u8 *peer, u64 *cookie);
  int (* set_noack_map) (struct wiphy *wiphy,struct net_device *dev,u16 noack_map);
  int (* get_et_sset_count) (struct wiphy *wiphy,struct net_device *dev, int sset);
  void (* get_et_stats) (struct wiphy *wiphy, struct net_device *dev,struct ethtool_stats *stats, u64 *data);
  void (* get_et_strings) (struct wiphy *wiphy, struct net_device *dev,u32 sset, u8 *data);
  int (* get_channel) (struct wiphy *wiphy,struct wireless_dev *wdev,struct cfg80211_chan_def *chandef);
  int (* start_p2p_device) (struct wiphy *wiphy,struct wireless_dev *wdev);
  void (* stop_p2p_device) (struct wiphy *wiphy,struct wireless_dev *wdev);
  int (* set_mac_acl) (struct wiphy *wiphy, struct net_device *dev,const struct cfg80211_acl_data *params);
  int (* start_radar_detection) (struct wiphy *wiphy,struct net_device *dev,struct cfg80211_chan_def *chandef,u32 cac_time_ms);
  int (* update_ft_ies) (struct wiphy *wiphy, struct net_device *dev,struct cfg80211_update_ft_ies_params *ftie);
  int (* crit_proto_start) (struct wiphy *wiphy,struct wireless_dev *wdev,enum nl80211_crit_proto_id protocol,u16 duration);
  void (* crit_proto_stop) (struct wiphy *wiphy,struct wireless_dev *wdev);
  int (* set_coalesce) (struct wiphy *wiphy,struct cfg80211_coalesce *coalesce);
  int (* channel_switch) (struct wiphy *wiphy,struct net_device *dev,struct cfg80211_csa_settings *params);
  int (* set_qos_map) (struct wiphy *wiphy,struct net_device *dev,struct cfg80211_qos_map *qos_map);
  int (* set_ap_chanwidth) (struct wiphy *wiphy, struct net_device *dev,struct cfg80211_chan_def *chandef);
};
```

## MEMBERS

suspend

wiphy device needs to be suspended. The variable *wow* will be **NULL** or contain the enabled Wake-on-Wireless triggers that are configured for the device.

resume

wiphy device needs to be resumed

set\_wakeup

Called when WoWLAN is enabled/disabled, use this callback to call **device\_set\_wakeup\_enable** to enable/disable wakeup from the device.

add\_virtual\_intf

create a new virtual interface with the given name, must set the struct wireless\_dev's iftype. Beware: You must create the new netdev in the wiphy's network namespace! Returns the struct wireless\_dev, or an ERR\_PTR. For P2P device wdevs, the driver must also set the address member in the wdev.

del\_virtual\_intf

remove the virtual interface

change\_virtual\_intf

change type/configuration of virtual interface, keep the struct wireless\_dev's iftype updated.

add\_key

add a key with the given parameters. *mac\_addr* will be **NULL** when adding a group key.

get\_key

get information about the key with the given parameters. *mac\_addr* will be **NULL** when requesting information for a group key. All pointers given to the *callback* function need not be valid after it returns. This function should return an error if it is not possible to retrieve the key, -ENOENT if it doesn't exist.

del\_key

remove a key given the *mac\_addr* (**NULL** for a group key) and *key\_index*, return -ENOENT if the key doesn't exist.

set\_default\_key

set the default key on an interface

set\_default\_mgmt\_key

set the default management frame key on an interface

start\_ap

Start acting in AP mode defined by the parameters.

change\_beacon

Change the beacon parameters for an access point mode interface. This should reject the call when AP mode wasn't started.

stop\_ap

Stop being an AP, including stopping beaconing.

add\_station

Add a new station.

del\_station

Remove a station; *mac* may be NULL to remove all stations.

change\_station

Modify a given station. Note that flags changes are not much validated in cfg80211, in particular the auth/assoc/authorized flags might come to the driver in invalid combinations -- make sure to check them, also against the existing state! Drivers must call **cfg80211\_check\_station\_change** to validate the information.

get\_station

get station information for the station identified by *mac*

dump\_station

dump station callback -- resume dump at index *idx*

add\_mpath

add a fixed mesh path

del\_mpath

delete a given mesh path

change\_mpath

change a given mesh path

get\_mpath

get a mesh path for the given parameters

dump\_mpath

dump mesh path callback -- resume dump at index *idx*

get\_mesh\_config

Get the current mesh configuration

update\_mesh\_config

Update mesh parameters on a running mesh. The mask is a bitfield which tells us which parameters to set, and which to leave alone.

join\_mesh

join the mesh network with the specified parameters (invoked with the wireless\_dev mutex held)

leave\_mesh

leave the current mesh network (invoked with the wireless\_dev mutex held)

change\_bss

Modify parameters for a given BSS.

set\_txq\_params

Set TX queue parameters

libertas\_set\_mesh\_channel

Only for backward compatibility for libertas, as it doesn't implement join\_mesh and needs to set the channel to join the mesh instead.

set\_monitor\_channel

Set the monitor mode channel for the device. If other interfaces are active this callback should reject the configuration. If no interfaces are active or the device is down, the channel should be stored for when a monitor interface becomes active.

scan

Request to do a scan. If returning zero, the scan request is given the driver, and will be valid until passed to **cfg80211\_scan\_done**. For scan results, call **cfg80211\_inform\_bss**; you can call this outside the scan/scan\_done bracket too.

auth

Request to authenticate with the specified peer (invoked with the wireless\_dev mutex held)

assoc

Request to (re)associate with the specified peer (invoked with the wireless\_dev mutex held)

deauth

Request to deauthenticate from the specified peer (invoked with the wireless\_dev mutex held)

disassoc

Request to disassociate from the specified peer (invoked with the wireless\_dev mutex held)

connect

Connect to the ESS with the specified parameters. When connected, call **cfg80211\_connect\_result** with status code **WLAN\_STATUS\_SUCCESS**. If the connection fails for some reason, call **cfg80211\_connect\_result** with the status from the AP. (invoked with the wireless\_dev mutex held)

disconnect

Disconnect from the BSS/ESS. (invoked with the wireless\_dev mutex held)

join\_ibss

Join the specified IBSS (or create if necessary). Once done, call **cfg80211\_ibss\_joined**, also call that function when changing BSSID due to a merge. (invoked with the wireless\_dev mutex held)

leave\_ibss

Leave the IBSS. (invoked with the wireless\_dev mutex held)

set\_mcast\_rate

Set the specified multicast rate (only if vif is in ADHOC or MESH mode)

set\_wiphy\_params

Notify that wiphy parameters have changed; *changed* bitfield (see enum wiphy\_params\_flags) describes which values have changed. The actual parameter values are available in struct wiphy. If returning an error, no value should be changed.

set\_tx\_power

set the transmit power according to the parameters, the power passed is in mBm, to get dBm use **MBM\_TO\_DBM**. The wdev may be **NULL** if power was set for the wiphy, and will always be **NULL** unless the driver supports per-vif TX power (as advertised by the nl80211 feature flag.)

get\_tx\_power

store the current TX power into the dbm variable; return 0 if successful

set\_wds\_peer

set the WDS peer for a WDS interface

rfkill\_poll

polls the hw rfkill line, use cfg80211 reporting functions to adjust rfkill hw state

testmode\_cmd

run a test mode command; *wdev* may be **NULL**

testmode\_dump

Implement a test mode dump. The cb-\>args\[2\] and up may be used by the function, but 0 and 1 must not be touched. Additionally, return error codes other than -ENOBUFS and -ENOENT will terminate the dump and return to userspace with an error, so be careful. If any data was passed in from userspace then the data/len arguments will be present and point to the data contained in **NL80211\_ATTR\_TESTDATA**.

set\_bitrate\_mask

set the bitrate mask configuration

dump\_survey

get site survey information.

set\_pmksa

Cache a PMKID for a BSSID. This is mostly useful for fullmac devices running firmwares capable of generating the (re) association RSN IE. It allows for faster roaming between WPA2 BSSIDs.

del\_pmksa

Delete a cached PMKID.

flush\_pmksa

Flush all cached PMKIDs.

remain\_on\_channel

Request the driver to remain awake on the specified channel for the specified duration to complete an off-channel operation (e.g., public action frame exchange). When the driver is ready on the requested channel, it must indicate this with an event notification by calling **cfg80211\_ready\_on\_channel**.

cancel\_remain\_on\_channel

Cancel an on-going remain-on-channel operation. This allows the operation to be terminated prior to timeout based on the duration value.

mgmt\_tx

Transmit a management frame.

mgmt\_tx\_cancel\_wait

Cancel the wait time from transmitting a management frame on another channel

set\_power\_mgmt

Configure WLAN power management. A timeout value of -1 allows the driver to adjust the dynamic ps timeout value.

set\_cqm\_rssi\_config

Configure connection quality monitor RSSI threshold.

set\_cqm\_txe\_config

Configure connection quality monitor TX error thresholds.

mgmt\_frame\_register

Notify driver that a management frame type was registered. Note that this callback may not sleep, and cannot run concurrently with itself.

set\_antenna

Set antenna configuration (tx\_ant, rx\_ant) on the device. Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may reject TX/RX mask combinations they cannot support by returning -EINVAL (also see nl80211.h *NL80211\_ATTR\_WIPHY\_ANTENNA\_TX*).

get\_antenna

Get current antenna configuration from device (tx\_ant, rx\_ant).

set\_ringparam

Set tx and rx ring sizes.

get\_ringparam

Get tx and rx ring current and maximum sizes.

sched\_scan\_start

Tell the driver to start a scheduled scan.

sched\_scan\_stop

Tell the driver to stop an ongoing scheduled scan. This call must stop the scheduled scan and be ready for starting a new one before it returns, i.e. *sched\_scan\_start* may be called immediately after that again and should not fail in that case. The driver should not call **cfg80211\_sched\_scan\_stopped** for a requested stop (when this method returns 0.)

set\_rekey\_data

give the data necessary for GTK rekeying to the driver

tdls\_mgmt

Transmit a TDLS management frame.

tdls\_oper

Perform a high-level TDLS operation (e.g. TDLS link setup).

probe\_client

probe an associated client, must return a cookie that it later passes to **cfg80211\_probe\_status**.

set\_noack\_map

Set the NoAck Map for the TIDs.

get\_et\_sset\_count

Ethtool API to get string-set count. See *ethtool\_ops*.get\_sset\_count

get\_et\_stats

Ethtool API to get a set of u64 stats. See *ethtool\_ops*.get\_ethtool\_stats

get\_et\_strings

Ethtool API to get a set of strings to describe stats and perhaps other supported types of ethtool data-sets. See *ethtool\_ops*.get\_strings

get\_channel

Get the current operating channel for the virtual interface. For monitor interfaces, it should return **NULL** unless there's a single current monitoring channel.

start\_p2p\_device

Start the given P2P device.

stop\_p2p\_device

Stop the given P2P device.

set\_mac\_acl

Sets MAC address control list in AP and P2P GO mode. Parameters include ACL policy, an array of MAC address of stations and the number of MAC addresses. If there is already a list in driver this new list replaces the existing one. Driver has to clear its ACL when number of MAC addresses entries is passed as 0. Drivers which advertise the support for MAC based ACL have to implement this callback.

start\_radar\_detection

Start radar detection in the driver.

update\_ft\_ies

Provide updated Fast BSS Transition information to the driver. If the SME is in the driver/firmware, this information can be used in building Authentication and Reassociation Request frames.

crit\_proto\_start

Indicates a critical protocol needs more link reliability for a given duration (milliseconds). The protocol is provided so the driver can take the most appropriate actions.

crit\_proto\_stop

Indicates critical protocol no longer needs increased link reliability. This operation can not fail.

set\_coalesce

Set coalesce parameters.

channel\_switch

initiate channel-switch procedure (with CSA)

set\_qos\_map

Set QoS mapping information to the driver

set\_ap\_chanwidth

Set the AP (including P2P GO) mode channel width for the given interface This is used e.g. for dynamic HT 20/40 MHz channel width changes during the lifetime of the BSS.

## DESCRIPTION

This struct is registered by fullmac card drivers and/or wireless stacks in order to handle configuration requests on their interfaces.

All callbacks except where otherwise noted should return 0 on success or a negative error code.

All operations are currently invoked under rtnl for consistency with the wireless extensions but this is subject to reevaluation as soon as this code is used more widely and we have a first user without wext.

## AUTHOR

**Johannes Berg** \<johannes@sipsolutions.net\>

Author.

## COPYRIGHT
