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