Path: blob/main/sys/contrib/dev/broadcom/brcm80211/brcmfmac/p2p.h
178665 views
// SPDX-License-Identifier: ISC1/*2* Copyright (c) 2012 Broadcom Corporation3*/4#ifndef WL_CFGP2P_H_5#define WL_CFGP2P_H_67#include <net/cfg80211.h>89struct brcmf_cfg80211_info;1011/**12* enum p2p_bss_type - different type of BSS configurations.13*14* @P2PAPI_BSSCFG_PRIMARY: maps to driver's primary bsscfg.15* @P2PAPI_BSSCFG_DEVICE: maps to driver's P2P device discovery bsscfg.16* @P2PAPI_BSSCFG_CONNECTION: maps to driver's 1st P2P connection bsscfg.17* @P2PAPI_BSSCFG_CONNECTION2: maps to driver's 2nd P2P connection bsscfg.18* @P2PAPI_BSSCFG_MAX: used for range checking.19*/20enum p2p_bss_type {21P2PAPI_BSSCFG_PRIMARY, /* maps to driver's primary bsscfg */22P2PAPI_BSSCFG_DEVICE, /* maps to driver's P2P device discovery bsscfg */23P2PAPI_BSSCFG_CONNECTION, /* driver's 1st P2P connection bsscfg */24P2PAPI_BSSCFG_CONNECTION2, /* driver's 2nd P2P connection bsscfg */25P2PAPI_BSSCFG_MAX26};2728/**29* struct p2p_bss - peer-to-peer bss related information.30*31* @vif: virtual interface of this P2P bss.32* @private_data: TBD33*/34struct p2p_bss {35struct brcmf_cfg80211_vif *vif;36void *private_data;37};3839/**40* enum brcmf_p2p_status - P2P specific dongle status.41*42* @BRCMF_P2P_STATUS_IF_ADD: peer-to-peer vif add sent to dongle.43* @BRCMF_P2P_STATUS_IF_DEL: NOT-USED?44* @BRCMF_P2P_STATUS_IF_DELETING: peer-to-peer vif delete sent to dongle.45* @BRCMF_P2P_STATUS_IF_CHANGING: peer-to-peer vif change sent to dongle.46* @BRCMF_P2P_STATUS_IF_CHANGED: peer-to-peer vif change completed on dongle.47* @BRCMF_P2P_STATUS_ACTION_TX_COMPLETED: action frame tx completed.48* @BRCMF_P2P_STATUS_ACTION_TX_NOACK: action frame tx not acked.49* @BRCMF_P2P_STATUS_GO_NEG_PHASE: P2P GO negotiation ongoing.50* @BRCMF_P2P_STATUS_DISCOVER_LISTEN: P2P listen, remaining on channel.51* @BRCMF_P2P_STATUS_SENDING_ACT_FRAME: In the process of sending action frame.52* @BRCMF_P2P_STATUS_WAITING_NEXT_AF_LISTEN: extra listen time for af tx.53* @BRCMF_P2P_STATUS_WAITING_NEXT_ACT_FRAME: waiting for action frame response.54* @BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL: search channel for AF active.55*/56enum brcmf_p2p_status {57BRCMF_P2P_STATUS_ENABLED,58BRCMF_P2P_STATUS_IF_ADD,59BRCMF_P2P_STATUS_IF_DEL,60BRCMF_P2P_STATUS_IF_DELETING,61BRCMF_P2P_STATUS_IF_CHANGING,62BRCMF_P2P_STATUS_IF_CHANGED,63BRCMF_P2P_STATUS_ACTION_TX_COMPLETED,64BRCMF_P2P_STATUS_ACTION_TX_NOACK,65BRCMF_P2P_STATUS_GO_NEG_PHASE,66BRCMF_P2P_STATUS_DISCOVER_LISTEN,67BRCMF_P2P_STATUS_SENDING_ACT_FRAME,68BRCMF_P2P_STATUS_WAITING_NEXT_AF_LISTEN,69BRCMF_P2P_STATUS_WAITING_NEXT_ACT_FRAME,70BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL71};7273/**74* struct afx_hdl - action frame off channel storage.75*76* @afx_work: worker thread for searching channel77* @act_frm_scan: thread synchronizing struct.78* @is_active: channel searching active.79* @peer_chan: current channel.80* @is_listen: sets mode for afx worker.81* @my_listen_chan: this peers listen channel.82* @peer_listen_chan: remote peers listen channel.83* @tx_dst_addr: mac address where tx af should be sent to.84*/85struct afx_hdl {86struct work_struct afx_work;87struct completion act_frm_scan;88bool is_active;89s32 peer_chan;90bool is_listen;91u16 my_listen_chan;92u16 peer_listen_chan;93u8 tx_dst_addr[ETH_ALEN];94};9596/**97* struct brcmf_p2p_info - p2p specific driver information.98*99* @cfg: driver private data for cfg80211 interface.100* @status: status of P2P (see enum brcmf_p2p_status).101* @dev_addr: P2P device address.102* @int_addr: P2P interface address.103* @bss_idx: informate for P2P bss types.104* @listen_timer: timer for @WL_P2P_DISC_ST_LISTEN discover state.105* @listen_channel: channel for @WL_P2P_DISC_ST_LISTEN discover state.106* @remain_on_channel: contains copy of struct used by cfg80211.107* @remain_on_channel_cookie: cookie counter for remain on channel cmd108* @next_af_subtype: expected action frame subtype.109* @send_af_done: indication that action frame tx is complete.110* @afx_hdl: action frame search handler info.111* @af_sent_channel: channel action frame is sent.112* @af_tx_sent_jiffies: jiffies time when af tx was transmitted.113* @wait_next_af: thread synchronizing struct.114* @gon_req_action: about to send go negotiation requets frame.115* @block_gon_req_tx: drop tx go negotiation requets frame.116* @p2pdev_dynamically: is p2p device if created by module param or supplicant.117* @wait_for_offchan_complete: wait for off-channel tx completion event.118*/119struct brcmf_p2p_info {120struct brcmf_cfg80211_info *cfg;121unsigned long status;122u8 dev_addr[ETH_ALEN];123u8 conn_int_addr[ETH_ALEN];124u8 conn2_int_addr[ETH_ALEN];125struct p2p_bss bss_idx[P2PAPI_BSSCFG_MAX];126struct timer_list listen_timer;127u8 listen_channel;128struct ieee80211_channel remain_on_channel;129u32 remain_on_channel_cookie;130u8 next_af_subtype;131struct completion send_af_done;132struct afx_hdl afx_hdl;133u32 af_sent_channel;134unsigned long af_tx_sent_jiffies;135struct completion wait_next_af;136bool gon_req_action;137bool block_gon_req_tx;138bool p2pdev_dynamically;139bool wait_for_offchan_complete;140};141142s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg, bool p2pdev_forced);143void brcmf_p2p_detach(struct brcmf_p2p_info *p2p);144struct wireless_dev *brcmf_p2p_add_vif(struct wiphy *wiphy, const char *name,145unsigned char name_assign_type,146enum nl80211_iftype type,147struct vif_params *params);148int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev);149int brcmf_p2p_ifchange(struct brcmf_cfg80211_info *cfg,150enum brcmf_fil_p2p_if_types if_type);151void brcmf_p2p_ifp_removed(struct brcmf_if *ifp, bool rtnl_locked);152int brcmf_p2p_start_device(struct wiphy *wiphy, struct wireless_dev *wdev);153void brcmf_p2p_stop_device(struct wiphy *wiphy, struct wireless_dev *wdev);154int brcmf_p2p_scan_prep(struct wiphy *wiphy,155struct cfg80211_scan_request *request,156struct brcmf_cfg80211_vif *vif);157int brcmf_p2p_remain_on_channel(struct wiphy *wiphy, struct wireless_dev *wdev,158struct ieee80211_channel *channel,159unsigned int duration, u64 *cookie);160int brcmf_p2p_notify_listen_complete(struct brcmf_if *ifp,161const struct brcmf_event_msg *e,162void *data);163void brcmf_p2p_cancel_remain_on_channel(struct brcmf_if *ifp);164int brcmf_p2p_notify_action_frame_rx(struct brcmf_if *ifp,165const struct brcmf_event_msg *e,166void *data);167int brcmf_p2p_notify_action_tx_complete(struct brcmf_if *ifp,168const struct brcmf_event_msg *e,169void *data);170bool brcmf_p2p_send_action_frame(struct brcmf_if *ifp,171struct brcmf_fil_af_params_le *af_params);172bool brcmf_p2p_scan_finding_common_channel(struct brcmf_cfg80211_info *cfg,173struct brcmf_bss_info_le *bi);174s32 brcmf_p2p_notify_rx_mgmt_p2p_probereq(struct brcmf_if *ifp,175const struct brcmf_event_msg *e,176void *data);177#endif /* WL_CFGP2P_H_ */178179180