diff options
Diffstat (limited to 'drivers/net/wireless/bcmdhd/wl_cfgp2p.h')
-rw-r--r-- | drivers/net/wireless/bcmdhd/wl_cfgp2p.h | 197 |
1 files changed, 132 insertions, 65 deletions
diff --git a/drivers/net/wireless/bcmdhd/wl_cfgp2p.h b/drivers/net/wireless/bcmdhd/wl_cfgp2p.h index 95e7c4ab3..0e63184 100644 --- a/drivers/net/wireless/bcmdhd/wl_cfgp2p.h +++ b/drivers/net/wireless/bcmdhd/wl_cfgp2p.h @@ -1,7 +1,7 @@ /* * Linux cfgp2p driver * - * Copyright (C) 1999-2012, Broadcom Corporation + * Copyright (C) 1999-2014, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you @@ -21,14 +21,14 @@ * software in any way with any other Broadcom software provided under a license * other than the GPL, without Broadcom's express prior written consent. * - * $Id: wl_cfgp2p.h 383351 2013-02-06 13:05:50Z $ + * $Id: wl_cfgp2p.h 444054 2013-12-18 11:33:42Z $ */ #ifndef _wl_cfgp2p_h_ #define _wl_cfgp2p_h_ #include <proto/802.11.h> #include <proto/p2p.h> -struct wl_priv; +struct bcm_cfg80211; extern u32 wl_dbg_level; typedef struct wifi_p2p_ie wifi_wfd_ie_t; @@ -43,6 +43,17 @@ typedef enum { P2PAPI_BSSCFG_MAX } p2p_bsscfg_type_t; +typedef enum { + P2P_SCAN_PURPOSE_MIN, + P2P_SCAN_SOCIAL_CHANNEL, /* scan for social channel */ + P2P_SCAN_AFX_PEER_NORMAL, /* scan for action frame search */ + P2P_SCAN_AFX_PEER_REDUCED, /* scan for action frame search with short time */ + P2P_SCAN_DURING_CONNECTED, /* scan during connected status */ + P2P_SCAN_CONNECT_TRY, /* scan for connecting */ + P2P_SCAN_NORMAL, /* scan during not-connected status */ + P2P_SCAN_PURPOSE_MAX +} p2p_scan_purpose_t; + /* vendor ies max buffer length for probe response or beacon */ #define VNDR_IES_MAX_BUF_LEN 1400 /* normal vendor ies buffer length */ @@ -102,8 +113,7 @@ struct parsed_vndr_ies { enum wl_cfgp2p_status { WLP2P_STATUS_DISCOVERY_ON = 0, WLP2P_STATUS_SEARCH_ENABLED, - WLP2P_STATUS_IF_ADD, - WLP2P_STATUS_IF_DEL, + WLP2P_STATUS_IF_ADDING, WLP2P_STATUS_IF_DELETING, WLP2P_STATUS_IF_CHANGING, WLP2P_STATUS_IF_CHANGED, @@ -116,22 +126,22 @@ enum wl_cfgp2p_status { }; -#define wl_to_p2p_bss_ndev(wl, type) ((wl)->p2p->bss[type].dev) -#define wl_to_p2p_bss_bssidx(wl, type) ((wl)->p2p->bss[type].bssidx) -#define wl_to_p2p_bss_saved_ie(wl, type) ((wl)->p2p->bss[type].saved_ie) -#define wl_to_p2p_bss_private(wl, type) ((wl)->p2p->bss[type].private_data) -#define wl_to_p2p_bss(wl, type) ((wl)->p2p->bss[type]) -#define wl_get_p2p_status(wl, stat) ((!(wl)->p2p_supported) ? 0 : test_bit(WLP2P_STATUS_ ## stat, \ - &(wl)->p2p->status)) -#define wl_set_p2p_status(wl, stat) ((!(wl)->p2p_supported) ? 0 : set_bit(WLP2P_STATUS_ ## stat, \ - &(wl)->p2p->status)) -#define wl_clr_p2p_status(wl, stat) ((!(wl)->p2p_supported) ? 0 : clear_bit(WLP2P_STATUS_ ## stat, \ - &(wl)->p2p->status)) -#define wl_chg_p2p_status(wl, stat) ((!(wl)->p2p_supported) ? 0:change_bit(WLP2P_STATUS_ ## stat, \ - &(wl)->p2p->status)) -#define p2p_on(wl) ((wl)->p2p->on) -#define p2p_scan(wl) ((wl)->p2p->scan) -#define p2p_is_on(wl) ((wl)->p2p && (wl)->p2p->on) +#define wl_to_p2p_bss_ndev(cfg, type) ((cfg)->p2p->bss[type].dev) +#define wl_to_p2p_bss_bssidx(cfg, type) ((cfg)->p2p->bss[type].bssidx) +#define wl_to_p2p_bss_saved_ie(cfg, type) ((cfg)->p2p->bss[type].saved_ie) +#define wl_to_p2p_bss_private(cfg, type) ((cfg)->p2p->bss[type].private_data) +#define wl_to_p2p_bss(cfg, type) ((cfg)->p2p->bss[type]) +#define wl_get_p2p_status(cfg, stat) ((!(cfg)->p2p_supported) ? 0 : \ + test_bit(WLP2P_STATUS_ ## stat, &(cfg)->p2p->status)) +#define wl_set_p2p_status(cfg, stat) ((!(cfg)->p2p_supported) ? 0 : \ + set_bit(WLP2P_STATUS_ ## stat, &(cfg)->p2p->status)) +#define wl_clr_p2p_status(cfg, stat) ((!(cfg)->p2p_supported) ? 0 : \ + clear_bit(WLP2P_STATUS_ ## stat, &(cfg)->p2p->status)) +#define wl_chg_p2p_status(cfg, stat) ((!(cfg)->p2p_supported) ? 0 : \ + change_bit(WLP2P_STATUS_ ## stat, &(cfg)->p2p->status)) +#define p2p_on(cfg) ((cfg)->p2p->on) +#define p2p_scan(cfg) ((cfg)->p2p->scan) +#define p2p_is_on(cfg) ((cfg)->p2p && (cfg)->p2p->on) /* dword align allocation */ #define WLC_IOCTL_MAXLEN 8192 @@ -177,9 +187,44 @@ enum wl_cfgp2p_status { init_timer(timer); \ timer->function = func; \ timer->expires = jiffies + msecs_to_jiffies(duration + extra_delay); \ - timer->data = (unsigned long) wl; \ + timer->data = (unsigned long) cfg; \ add_timer(timer); \ } while (0); + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) +#define WL_CFG80211_P2P_DEV_IF + +#ifdef WL_ENABLE_P2P_IF +#undef WL_ENABLE_P2P_IF +#endif + +#ifdef WL_SUPPORT_BACKPORTED_KPATCHES +#undef WL_SUPPORT_BACKPORTED_KPATCHES +#endif +#endif /* (LINUX_VERSION >= VERSION(3, 8, 0)) */ + +#ifndef WL_CFG80211_P2P_DEV_IF +#ifdef WL_NEWCFG_PRIVCMD_SUPPORT +#undef WL_NEWCFG_PRIVCMD_SUPPORT +#endif +#endif /* WL_CFG80211_P2P_DEV_IF */ + +#if defined(WL_ENABLE_P2P_IF) && (defined(WL_CFG80211_P2P_DEV_IF) || \ + (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0))) +#error Disable 'WL_ENABLE_P2P_IF', if 'WL_CFG80211_P2P_DEV_IF' is enabled \ + or kernel version is 3.8.0 or above +#endif /* WL_ENABLE_P2P_IF && (WL_CFG80211_P2P_DEV_IF || (LINUX_VERSION >= VERSION(3, 8, 0))) */ + +#if !defined(WLP2P) && (defined(WL_ENABLE_P2P_IF) || defined(WL_CFG80211_P2P_DEV_IF)) +#error WLP2P not defined +#endif /* !WLP2P && (WL_ENABLE_P2P_IF || WL_CFG80211_P2P_DEV_IF) */ + +#if defined(WL_CFG80211_P2P_DEV_IF) +#define bcm_struct_cfgdev struct wireless_dev +#else +#define bcm_struct_cfgdev struct net_device +#endif /* WL_CFG80211_P2P_DEV_IF */ + extern void wl_cfgp2p_listen_expired(unsigned long data); extern bool @@ -188,43 +233,51 @@ extern bool wl_cfgp2p_is_p2p_action(void *frame, u32 frame_len); extern bool wl_cfgp2p_is_gas_action(void *frame, u32 frame_len); +extern bool +wl_cfgp2p_find_gas_subtype(u8 subtype, u8* data, u32 len); +#ifdef CUSTOMER_HW4 +extern bool +wl_cfgp2p_is_p2p_gas_action(void *frame, u32 frame_len); +#endif /* CUSTOMER_HW4 */ extern void wl_cfgp2p_print_actframe(bool tx, void *frame, u32 frame_len, u32 channel); extern s32 -wl_cfgp2p_init_priv(struct wl_priv *wl); +wl_cfgp2p_init_priv(struct bcm_cfg80211 *cfg); extern void -wl_cfgp2p_deinit_priv(struct wl_priv *wl); +wl_cfgp2p_deinit_priv(struct bcm_cfg80211 *cfg); extern s32 -wl_cfgp2p_set_firm_p2p(struct wl_priv *wl); +wl_cfgp2p_set_firm_p2p(struct bcm_cfg80211 *cfg); extern s32 -wl_cfgp2p_set_p2p_mode(struct wl_priv *wl, u8 mode, +wl_cfgp2p_set_p2p_mode(struct bcm_cfg80211 *cfg, u8 mode, u32 channel, u16 listen_ms, int bssidx); extern s32 -wl_cfgp2p_ifadd(struct wl_priv *wl, struct ether_addr *mac, u8 if_type, +wl_cfgp2p_ifadd(struct bcm_cfg80211 *cfg, struct ether_addr *mac, u8 if_type, chanspec_t chspec); extern s32 -wl_cfgp2p_ifdisable(struct wl_priv *wl, struct ether_addr *mac); +wl_cfgp2p_ifdisable(struct bcm_cfg80211 *cfg, struct ether_addr *mac); extern s32 -wl_cfgp2p_ifdel(struct wl_priv *wl, struct ether_addr *mac); +wl_cfgp2p_ifdel(struct bcm_cfg80211 *cfg, struct ether_addr *mac); extern s32 -wl_cfgp2p_ifchange(struct wl_priv *wl, struct ether_addr *mac, u8 if_type, chanspec_t chspec); +wl_cfgp2p_ifchange(struct bcm_cfg80211 *cfg, struct ether_addr *mac, u8 if_type, chanspec_t chspec); extern s32 -wl_cfgp2p_ifidx(struct wl_priv *wl, struct ether_addr *mac, s32 *index); +wl_cfgp2p_ifidx(struct bcm_cfg80211 *cfg, struct ether_addr *mac, s32 *index); extern s32 -wl_cfgp2p_init_discovery(struct wl_priv *wl); +wl_cfgp2p_init_discovery(struct bcm_cfg80211 *cfg); extern s32 -wl_cfgp2p_enable_discovery(struct wl_priv *wl, struct net_device *dev, const u8 *ie, u32 ie_len); +wl_cfgp2p_enable_discovery(struct bcm_cfg80211 *cfg, struct net_device *dev, const u8 *ie, + u32 ie_len); extern s32 -wl_cfgp2p_disable_discovery(struct wl_priv *wl); +wl_cfgp2p_disable_discovery(struct bcm_cfg80211 *cfg); extern s32 -wl_cfgp2p_escan(struct wl_priv *wl, struct net_device *dev, u16 active, u32 num_chans, +wl_cfgp2p_escan(struct bcm_cfg80211 *cfg, struct net_device *dev, u16 active, u32 num_chans, u16 *channels, - s32 search_state, u16 action, u32 bssidx, struct ether_addr *tx_dst_addr); + s32 search_state, u16 action, u32 bssidx, struct ether_addr *tx_dst_addr, + p2p_scan_purpose_t p2p_scan_purpose); extern s32 -wl_cfgp2p_act_frm_search(struct wl_priv *wl, struct net_device *ndev, +wl_cfgp2p_act_frm_search(struct bcm_cfg80211 *cfg, struct net_device *ndev, s32 bssidx, s32 channel, struct ether_addr *tx_dst_addr); extern wpa_ie_fixed_t * @@ -239,33 +292,34 @@ wl_cfgp2p_find_p2pie(u8 *parse, u32 len); extern wifi_wfd_ie_t * wl_cfgp2p_find_wfdie(u8 *parse, u32 len); extern s32 -wl_cfgp2p_set_management_ie(struct wl_priv *wl, struct net_device *ndev, s32 bssidx, +wl_cfgp2p_set_management_ie(struct bcm_cfg80211 *cfg, struct net_device *ndev, s32 bssidx, s32 pktflag, const u8 *vndr_ie, u32 vndr_ie_len); extern s32 -wl_cfgp2p_clear_management_ie(struct wl_priv *wl, s32 bssidx); +wl_cfgp2p_clear_management_ie(struct bcm_cfg80211 *cfg, s32 bssidx); extern s32 -wl_cfgp2p_find_idx(struct wl_priv *wl, struct net_device *ndev, s32 *index); +wl_cfgp2p_find_idx(struct bcm_cfg80211 *cfg, struct net_device *ndev, s32 *index); extern struct net_device * -wl_cfgp2p_find_ndev(struct wl_priv *wl, s32 bssidx); +wl_cfgp2p_find_ndev(struct bcm_cfg80211 *cfg, s32 bssidx); extern s32 -wl_cfgp2p_find_type(struct wl_priv *wl, s32 bssidx, s32 *type); +wl_cfgp2p_find_type(struct bcm_cfg80211 *cfg, s32 bssidx, s32 *type); extern s32 -wl_cfgp2p_listen_complete(struct wl_priv *wl, struct net_device *ndev, - const wl_event_msg_t *e, void *data); +wl_cfgp2p_listen_complete(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev, + const wl_event_msg_t *e, void *data); extern s32 -wl_cfgp2p_discover_listen(struct wl_priv *wl, s32 channel, u32 duration_ms); +wl_cfgp2p_discover_listen(struct bcm_cfg80211 *cfg, s32 channel, u32 duration_ms); extern s32 -wl_cfgp2p_discover_enable_search(struct wl_priv *wl, u8 enable); +wl_cfgp2p_discover_enable_search(struct bcm_cfg80211 *cfg, u8 enable); extern s32 -wl_cfgp2p_action_tx_complete(struct wl_priv *wl, struct net_device *ndev, - const wl_event_msg_t *e, void *data); +wl_cfgp2p_action_tx_complete(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev, + const wl_event_msg_t *e, void *data); + extern s32 -wl_cfgp2p_tx_action_frame(struct wl_priv *wl, struct net_device *dev, +wl_cfgp2p_tx_action_frame(struct bcm_cfg80211 *cfg, struct net_device *dev, wl_af_params_t *af_params, s32 bssidx); extern void @@ -278,39 +332,56 @@ extern bool wl_cfgp2p_bss_isup(struct net_device *ndev, int bsscfg_idx); extern s32 -wl_cfgp2p_bss(struct wl_priv *wl, struct net_device *ndev, s32 bsscfg_idx, s32 up); +wl_cfgp2p_bss(struct bcm_cfg80211 *cfg, struct net_device *ndev, s32 bsscfg_idx, s32 up); extern s32 -wl_cfgp2p_supported(struct wl_priv *wl, struct net_device *ndev); +wl_cfgp2p_supported(struct bcm_cfg80211 *cfg, struct net_device *ndev); extern s32 -wl_cfgp2p_down(struct wl_priv *wl); +wl_cfgp2p_down(struct bcm_cfg80211 *cfg); extern s32 -wl_cfgp2p_set_p2p_noa(struct wl_priv *wl, struct net_device *ndev, char* buf, int len); +wl_cfgp2p_set_p2p_noa(struct bcm_cfg80211 *cfg, struct net_device *ndev, char* buf, int len); extern s32 -wl_cfgp2p_get_p2p_noa(struct wl_priv *wl, struct net_device *ndev, char* buf, int len); +wl_cfgp2p_get_p2p_noa(struct bcm_cfg80211 *cfg, struct net_device *ndev, char* buf, int len); extern s32 -wl_cfgp2p_set_p2p_ps(struct wl_priv *wl, struct net_device *ndev, char* buf, int len); +wl_cfgp2p_set_p2p_ps(struct bcm_cfg80211 *cfg, struct net_device *ndev, char* buf, int len); extern u8 * wl_cfgp2p_retreive_p2pattrib(void *buf, u8 element_id); +extern u8* +wl_cfgp2p_find_attrib_in_all_p2p_Ies(u8 *parse, u32 len, u32 attrib); + extern u8 * wl_cfgp2p_retreive_p2p_dev_addr(wl_bss_info_t *bi, u32 bi_length); extern s32 -wl_cfgp2p_register_ndev(struct wl_priv *wl); +wl_cfgp2p_register_ndev(struct bcm_cfg80211 *cfg); extern s32 -wl_cfgp2p_unregister_ndev(struct wl_priv *wl); +wl_cfgp2p_unregister_ndev(struct bcm_cfg80211 *cfg); extern bool wl_cfgp2p_is_ifops(const struct net_device_ops *if_ops); +#if defined(WL_CFG80211_P2P_DEV_IF) +extern struct wireless_dev * +wl_cfgp2p_add_p2p_disc_if(struct bcm_cfg80211 *cfg); + +extern int +wl_cfgp2p_start_p2p_device(struct wiphy *wiphy, struct wireless_dev *wdev); + +extern void +wl_cfgp2p_stop_p2p_device(struct wiphy *wiphy, struct wireless_dev *wdev); + +extern int +wl_cfgp2p_del_p2p_disc_if(struct wireless_dev *wdev, struct bcm_cfg80211 *cfg); +#endif /* WL_CFG80211_P2P_DEV_IF */ + /* WiFi Direct */ #define SOCIAL_CHAN_1 1 #define SOCIAL_CHAN_2 6 @@ -326,20 +397,16 @@ wl_cfgp2p_is_ifops(const struct net_device_ops *if_ops); #define WL_P2P_TEMP_CHAN 11 /* If the provision discovery is for JOIN operations, + * or the device discoverablity frame is destined to GO * then we need not do an internal scan to find GO. -*/ -#define IS_PROV_DISC_WITHOUT_GROUP_ID(p2p_ie, len) \ + */ +#define IS_ACTPUB_WITHOUT_GROUP_ID(p2p_ie, len) \ (wl_cfgp2p_retreive_p2pattrib(p2p_ie, P2P_SEID_GROUP_ID) == NULL) #define IS_GAS_REQ(frame, len) (wl_cfgp2p_is_gas_action(frame, len) && \ ((frame->action == P2PSD_ACTION_ID_GAS_IREQ) || \ (frame->action == P2PSD_ACTION_ID_GAS_CREQ))) -#define IS_P2P_PUB_ACT_REQ(frame, p2p_ie, len) \ - (wl_cfgp2p_is_pub_action(frame, len) && \ - ((frame->subtype == P2P_PAF_GON_REQ) || \ - (frame->subtype == P2P_PAF_INVITE_REQ) || \ - ((frame->subtype == P2P_PAF_PROVDIS_REQ) && \ - IS_PROV_DISC_WITHOUT_GROUP_ID(p2p_ie, len)))) + #define IS_P2P_PUB_ACT_RSP_SUBTYPE(subtype) ((subtype == P2P_PAF_GON_RSP) || \ ((subtype == P2P_PAF_GON_CONF) || \ (subtype == P2P_PAF_INVITE_RSP) || \ |