Commit d0e41eff authored by Ajay Singh's avatar Ajay Singh Committed by Greg Kroah-Hartman

staging: wilc1000: added 'WILC_' prefix for constants to have clear namespace

For better namespace added 'WILC_' prefix for driver specific constants.
Signed-off-by: default avatarAjay Singh <ajay.kathat@microchip.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d378599a
This diff is collapsed.
......@@ -9,20 +9,25 @@
#include <linux/ieee80211.h>
#include "wilc_wlan_if.h"
#define IDLE_MODE 0x00
#define AP_MODE 0x01
#define STATION_MODE 0x02
#define GO_MODE 0x03
#define CLIENT_MODE 0x04
#define MAX_NUM_STA 9
#define ADDKEY 0x1
#define REMOVEKEY 0x2
#define DEFAULTKEY 0x4
#define ADDKEY_AP 0x8
enum {
WILC_IDLE_MODE = 0x0,
WILC_AP_MODE = 0x1,
WILC_STATION_MODE = 0x2,
WILC_GO_MODE = 0x3,
WILC_CLIENT_MODE = 0x4
};
enum {
WILC_ADD_KEY = 0x1,
WILC_REMOVE_KEY = 0x2,
WILC_DEFAULT_KEY = 0x4,
WILC_ADD_KEY_AP = 0x8
};
#define WILC_MAX_NUM_STA 9
#define MAX_NUM_SCANNED_NETWORKS 100
#define MAX_NUM_SCANNED_NETWORKS_SHADOW 130
#define MAX_NUM_PROBED_SSID 10
#define WILC_MAX_NUM_PROBED_SSID 10
#define TX_MIC_KEY_LEN 8
#define RX_MIC_KEY_LEN 8
......@@ -34,16 +39,18 @@
#define PMKSA_KEY_LEN 22
#define WILC_MAX_NUM_PMKIDS 16
#define WILC_ADD_STA_LENGTH 40
#define NUM_CONCURRENT_IFC 2
#define DRV_HANDLER_SIZE 5
#define WILC_NUM_CONCURRENT_IFC 2
#define WILC_DRV_HANDLER_SIZE 5
#define DRV_HANDLER_MASK 0x000000FF
#define NUM_RSSI 5
#define SET_CFG 0
#define GET_CFG 1
enum {
WILC_SET_CFG = 0,
WILC_GET_CFG
};
#define MAX_ASSOC_RESP_FRAME_SIZE 256
#define WILC_MAX_ASSOC_RESP_FRAME_SIZE 256
struct rssi_history_buffer {
bool full;
......@@ -130,10 +137,10 @@ struct cfg_param_attr {
};
enum cfg_param {
RETRY_SHORT = BIT(0),
RETRY_LONG = BIT(1),
FRAG_THRESHOLD = BIT(2),
RTS_THRESHOLD = BIT(3),
WILC_CFG_PARAM_RETRY_SHORT = BIT(0),
WILC_CFG_PARAM_RETRY_LONG = BIT(1),
WILC_CFG_PARAM_FRAG_THRESHOLD = BIT(2),
WILC_CFG_PARAM_RTS_THRESHOLD = BIT(3)
};
struct found_net_info {
......@@ -155,10 +162,10 @@ enum conn_event {
};
enum KEY_TYPE {
WEP,
WPA_RX_GTK,
WPA_PTK,
PMKSA,
WILC_KEY_TYPE_WEP,
WILC_KEY_TYPE_WPA_RX_GTK,
WILC_KEY_TYPE_WPA_PTK,
WILC_KEY_TYPE_PMKSA,
};
typedef void (*wilc_scan_result)(enum scan_event, struct network_info *,
......@@ -268,7 +275,7 @@ struct host_if_drv {
bool ifc_up;
int driver_handler_id;
u8 assoc_resp[MAX_ASSOC_RESP_FRAME_SIZE];
u8 assoc_resp[WILC_MAX_ASSOC_RESP_FRAME_SIZE];
};
struct add_sta_param {
......
......@@ -46,7 +46,8 @@ static int dev_state_ev_handler(struct notifier_block *this,
switch (event) {
case NETDEV_UP:
if (vif->iftype == STATION_MODE || vif->iftype == CLIENT_MODE) {
if (vif->iftype == WILC_STATION_MODE ||
vif->iftype == WILC_CLIENT_MODE) {
hif_drv->ifc_up = 1;
vif->obtaining_ip = false;
del_timer(&vif->during_ip_timer);
......@@ -65,7 +66,8 @@ static int dev_state_ev_handler(struct notifier_block *this,
break;
case NETDEV_DOWN:
if (vif->iftype == STATION_MODE || vif->iftype == CLIENT_MODE) {
if (vif->iftype == WILC_STATION_MODE ||
vif->iftype == WILC_CLIENT_MODE) {
hif_drv->ifc_up = 0;
vif->obtaining_ip = false;
}
......@@ -179,11 +181,11 @@ static struct net_device *get_if_handler(struct wilc *wilc, u8 *mac_header)
bssid1 = mac_header + 4;
for (i = 0; i < wilc->vif_num; i++) {
if (wilc->vif[i]->mode == STATION_MODE)
if (wilc->vif[i]->mode == WILC_STATION_MODE)
if (ether_addr_equal_unaligned(bssid,
wilc->vif[i]->bssid))
return wilc->vif[i]->ndev;
if (wilc->vif[i]->mode == AP_MODE)
if (wilc->vif[i]->mode == WILC_AP_MODE)
if (ether_addr_equal_unaligned(bssid1,
wilc->vif[i]->bssid))
return wilc->vif[i]->ndev;
......@@ -1021,12 +1023,12 @@ void wilc_netdev_cleanup(struct wilc *wilc)
}
if (wilc->vif[0]->ndev || wilc->vif[1]->ndev) {
for (i = 0; i < NUM_CONCURRENT_IFC; i++)
for (i = 0; i < WILC_NUM_CONCURRENT_IFC; i++)
if (wilc->vif[i]->ndev)
if (wilc->vif[i]->mac_opened)
wilc_mac_close(wilc->vif[i]->ndev);
for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
for (i = 0; i < WILC_NUM_CONCURRENT_IFC; i++) {
unregister_netdev(wilc->vif[i]->ndev);
wilc_free_wiphy(wilc->vif[i]->ndev);
free_netdev(wilc->vif[i]->ndev);
......@@ -1082,7 +1084,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
register_inetaddr_notifier(&g_dev_notifier);
for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
for (i = 0; i < WILC_NUM_CONCURRENT_IFC; i++) {
struct wireless_dev *wdev;
ndev = alloc_etherdev(sizeof(struct wilc_vif));
......@@ -1130,7 +1132,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
if (ret)
goto free_ndev;
vif->iftype = STATION_MODE;
vif->iftype = WILC_STATION_MODE;
vif->mac_opened = 0;
}
......@@ -1139,7 +1141,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
free_ndev:
for (; i >= 0; i--) {
if (wl->vif[i]) {
if (wl->vif[i]->iftype == STATION_MODE)
if (wl->vif[i]->iftype == WILC_STATION_MODE)
unregister_netdev(wl->vif[i]->ndev);
if (wl->vif[i]->ndev) {
......
......@@ -465,7 +465,7 @@ static void cfg_connect_result(enum conn_event conn_disconn_evt,
conn_info->status == WLAN_STATUS_SUCCESS) {
connect_status = WLAN_STATUS_UNSPECIFIED_FAILURE;
wilc_wlan_set_bssid(priv->dev, null_bssid,
STATION_MODE);
WILC_STATION_MODE);
if (!wfi_drv->p2p_connect)
wlan_channel = INVALID_CHANNEL;
......@@ -507,7 +507,7 @@ static void cfg_connect_result(enum conn_event conn_disconn_evt,
priv->p2p.recv_random = 0x00;
priv->p2p.is_wilc_ie = false;
eth_zero_addr(priv->associated_bss);
wilc_wlan_set_bssid(priv->dev, null_bssid, STATION_MODE);
wilc_wlan_set_bssid(priv->dev, null_bssid, WILC_STATION_MODE);
if (!wfi_drv->p2p_connect)
wlan_channel = INVALID_CHANNEL;
......@@ -768,7 +768,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
if (!wfi_drv->p2p_connect)
wlan_channel = nw_info->ch;
wilc_wlan_set_bssid(dev, nw_info->bssid, STATION_MODE);
wilc_wlan_set_bssid(dev, nw_info->bssid, WILC_STATION_MODE);
ret = wilc_set_join_req(vif, nw_info->bssid, sme->ssid,
sme->ssid_len, sme->ie, sme->ie_len,
......@@ -781,7 +781,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
netdev_err(dev, "wilc_set_join_req(): Error\n");
ret = -ENOENT;
wilc_wlan_set_bssid(dev, null_bssid, STATION_MODE);
wilc_wlan_set_bssid(dev, null_bssid, WILC_STATION_MODE);
goto out_error;
}
return 0;
......@@ -815,7 +815,7 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev,
wfi_drv = (struct host_if_drv *)priv->hif_drv;
if (!wfi_drv->p2p_connect)
wlan_channel = INVALID_CHANNEL;
wilc_wlan_set_bssid(priv->dev, null_bssid, STATION_MODE);
wilc_wlan_set_bssid(priv->dev, null_bssid, WILC_STATION_MODE);
priv->p2p.local_random = 0x01;
priv->p2p.recv_random = 0x00;
......@@ -961,7 +961,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
if (ret)
return -ENOMEM;
op_mode = AP_MODE;
op_mode = WILC_AP_MODE;
} else {
if (params->key_len > 16 &&
params->cipher == WLAN_CIPHER_SUITE_TKIP) {
......@@ -970,7 +970,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
keylen = params->key_len - 16;
}
op_mode = STATION_MODE;
op_mode = WILC_STATION_MODE;
}
if (!pairwise)
......@@ -1079,7 +1079,7 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev,
u32 associatedsta = ~0;
u32 inactive_time = 0;
if (vif->iftype == AP_MODE || vif->iftype == GO_MODE) {
if (vif->iftype == WILC_AP_MODE || vif->iftype == WILC_GO_MODE) {
for (i = 0; i < NUM_STA_ASSOCIATED; i++) {
if (!(memcmp(mac,
priv->assoc_stainfo.sta_associated_bss[i],
......@@ -1098,7 +1098,7 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev,
wilc_get_inactive_time(vif, mac, &inactive_time);
sinfo->inactive_time = 1000 * inactive_time;
} else if (vif->iftype == STATION_MODE) {
} else if (vif->iftype == WILC_STATION_MODE) {
struct rf_info stats;
wilc_get_statistics(vif, &stats, true);
......@@ -1143,14 +1143,14 @@ static int set_wiphy_params(struct wiphy *wiphy, u32 changed)
netdev_dbg(vif->ndev,
"Setting WIPHY_PARAM_RETRY_SHORT %d\n",
wiphy->retry_short);
cfg_param_val.flag |= RETRY_SHORT;
cfg_param_val.flag |= WILC_CFG_PARAM_RETRY_SHORT;
cfg_param_val.short_retry_limit = wiphy->retry_short;
}
if (changed & WIPHY_PARAM_RETRY_LONG) {
netdev_dbg(vif->ndev,
"Setting WIPHY_PARAM_RETRY_LONG %d\n",
wiphy->retry_long);
cfg_param_val.flag |= RETRY_LONG;
cfg_param_val.flag |= WILC_CFG_PARAM_RETRY_LONG;
cfg_param_val.long_retry_limit = wiphy->retry_long;
}
if (changed & WIPHY_PARAM_FRAG_THRESHOLD) {
......@@ -1159,7 +1159,7 @@ static int set_wiphy_params(struct wiphy *wiphy, u32 changed)
netdev_dbg(vif->ndev,
"Setting WIPHY_PARAM_FRAG_THRESHOLD %d\n",
wiphy->frag_threshold);
cfg_param_val.flag |= FRAG_THRESHOLD;
cfg_param_val.flag |= WILC_CFG_PARAM_FRAG_THRESHOLD;
cfg_param_val.frag_threshold = wiphy->frag_threshold;
} else {
netdev_err(vif->ndev,
......@@ -1173,7 +1173,7 @@ static int set_wiphy_params(struct wiphy *wiphy, u32 changed)
netdev_dbg(vif->ndev,
"Setting WIPHY_PARAM_RTS_THRESHOLD %d\n",
wiphy->rts_threshold);
cfg_param_val.flag |= RTS_THRESHOLD;
cfg_param_val.flag |= WILC_CFG_PARAM_RTS_THRESHOLD;
cfg_param_val.rts_threshold = wiphy->rts_threshold;
} else {
netdev_err(vif->ndev, "RTS threshold out of range\n");
......@@ -1768,11 +1768,11 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
dev->ieee80211_ptr->iftype = type;
priv->wdev->iftype = type;
vif->monitor_flag = 0;
vif->iftype = STATION_MODE;
wilc_set_operation_mode(vif, STATION_MODE);
vif->iftype = WILC_STATION_MODE;
wilc_set_operation_mode(vif, WILC_STATION_MODE);
memset(priv->assoc_stainfo.sta_associated_bss, 0,
MAX_NUM_STA * ETH_ALEN);
WILC_MAX_NUM_STA * ETH_ALEN);
wl->enable_ps = true;
wilc_set_power_mgmt(vif, 1, 0);
......@@ -1783,8 +1783,8 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
dev->ieee80211_ptr->iftype = type;
priv->wdev->iftype = type;
vif->monitor_flag = 0;
vif->iftype = CLIENT_MODE;
wilc_set_operation_mode(vif, STATION_MODE);
vif->iftype = WILC_CLIENT_MODE;
wilc_set_operation_mode(vif, WILC_STATION_MODE);
wl->enable_ps = false;
wilc_set_power_mgmt(vif, 0, 0);
......@@ -1794,12 +1794,12 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
wl->enable_ps = false;
dev->ieee80211_ptr->iftype = type;
priv->wdev->iftype = type;
vif->iftype = AP_MODE;
vif->iftype = WILC_AP_MODE;
if (wl->initialized) {
wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif),
0, vif->ifc_id, false);
wilc_set_operation_mode(vif, AP_MODE);
wilc_set_operation_mode(vif, WILC_AP_MODE);
wilc_set_power_mgmt(vif, 0, 0);
}
break;
......@@ -1808,10 +1808,10 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
vif->obtaining_ip = true;
mod_timer(&vif->during_ip_timer,
jiffies + msecs_to_jiffies(DURING_IP_TIME_OUT));
wilc_set_operation_mode(vif, AP_MODE);
wilc_set_operation_mode(vif, WILC_AP_MODE);
dev->ieee80211_ptr->iftype = type;
priv->wdev->iftype = type;
vif->iftype = GO_MODE;
vif->iftype = WILC_GO_MODE;
wl->enable_ps = false;
wilc_set_power_mgmt(vif, 0, 0);
......@@ -1838,7 +1838,7 @@ static int start_ap(struct wiphy *wiphy, struct net_device *dev,
if (ret != 0)
netdev_err(dev, "Error in setting channel\n");
wilc_wlan_set_bssid(dev, wl->vif[vif->idx]->src_addr, AP_MODE);
wilc_wlan_set_bssid(dev, wl->vif[vif->idx]->src_addr, WILC_AP_MODE);
wilc_set_power_mgmt(vif, 0, 0);
return wilc_add_beacon(vif, settings->beacon_interval,
......@@ -1865,7 +1865,7 @@ static int stop_ap(struct wiphy *wiphy, struct net_device *dev)
struct wilc_vif *vif = netdev_priv(priv->dev);
u8 null_bssid[ETH_ALEN] = {0};
wilc_wlan_set_bssid(dev, null_bssid, AP_MODE);
wilc_wlan_set_bssid(dev, null_bssid, WILC_AP_MODE);
ret = wilc_del_beacon(vif);
......@@ -1883,7 +1883,7 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev,
struct add_sta_param sta_params = { {0} };
struct wilc_vif *vif = netdev_priv(dev);
if (vif->iftype == AP_MODE || vif->iftype == GO_MODE) {
if (vif->iftype == WILC_AP_MODE || vif->iftype == WILC_GO_MODE) {
memcpy(sta_params.bssid, mac, ETH_ALEN);
memcpy(priv->assoc_stainfo.sta_associated_bss[params->aid], mac,
ETH_ALEN);
......@@ -1918,7 +1918,7 @@ static int del_station(struct wiphy *wiphy, struct net_device *dev,
struct wilc_vif *vif = netdev_priv(dev);
struct sta_info *info;
if (!(vif->iftype == AP_MODE || vif->iftype == GO_MODE))
if (!(vif->iftype == WILC_AP_MODE || vif->iftype == WILC_GO_MODE))
return ret;
info = &priv->assoc_stainfo;
......@@ -1939,7 +1939,7 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev,
struct add_sta_param sta_params = { {0} };
struct wilc_vif *vif = netdev_priv(dev);
if (vif->iftype == AP_MODE || vif->iftype == GO_MODE) {
if (vif->iftype == WILC_AP_MODE || vif->iftype == WILC_GO_MODE) {
memcpy(sta_params.bssid, mac, ETH_ALEN);
sta_params.aid = params->aid;
sta_params.rates_len = params->supported_rates_len;
......@@ -2141,7 +2141,7 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net,
priv = wdev_priv(wdev);
priv->wdev = wdev;
wdev->wiphy->max_scan_ssids = MAX_NUM_PROBED_SSID;
wdev->wiphy->max_scan_ssids = WILC_MAX_NUM_PROBED_SSID;
#ifdef CONFIG_PM
wdev->wiphy->wowlan = &wowlan_support;
#endif
......
......@@ -57,7 +57,7 @@ struct wilc_wfi_wep_key {
};
struct sta_info {
u8 sta_associated_bss[MAX_NUM_STA][ETH_ALEN];
u8 sta_associated_bss[WILC_MAX_NUM_STA][ETH_ALEN];
};
/*Parameters needed for host interface for remaining on channel*/
......@@ -94,8 +94,8 @@ struct wilc_priv {
u8 wep_key_len[4];
/* The real interface that the monitor is on */
struct net_device *real_ndev;
struct wilc_wfi_key *wilc_gtk[MAX_NUM_STA];
struct wilc_wfi_key *wilc_ptk[MAX_NUM_STA];
struct wilc_wfi_key *wilc_gtk[WILC_MAX_NUM_STA];
struct wilc_wfi_key *wilc_ptk[WILC_MAX_NUM_STA];
u8 wilc_groupkey;
/* mutexes */
struct mutex scan_req_lock;
......@@ -168,7 +168,7 @@ struct wilc {
int dev_irq_num;
int close;
u8 vif_num;
struct wilc_vif *vif[NUM_CONCURRENT_IFC];
struct wilc_vif *vif[WILC_NUM_CONCURRENT_IFC];
u8 open_ifcs;
/*protect head of transmit queue*/
struct mutex txq_add_to_head_cs;
......
......@@ -1205,7 +1205,7 @@ int wilc_send_config_pkt(struct wilc_vif *vif, u8 mode, struct wid *wids,
int i;
int ret = 0;
if (mode == GET_CFG) {
if (mode == WILC_GET_CFG) {
for (i = 0; i < count; i++) {
if (!wilc_wlan_cfg_get(vif, !i,
wids[i].id,
......@@ -1221,7 +1221,7 @@ int wilc_send_config_pkt(struct wilc_vif *vif, u8 mode, struct wid *wids,
wids[i].val,
wids[i].size);
}
} else if (mode == SET_CFG) {
} else if (mode == WILC_SET_CFG) {
for (i = 0; i < count; i++) {
if (!wilc_wlan_cfg_set(vif, !i,
wids[i].id,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment