Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 278057
b: refs/heads/master
c: 990bd91
h: refs/heads/master
i:
  278055: eb1888a
v: v3
  • Loading branch information
Vasanthakumar Thiagarajan authored and Kalle Valo committed Nov 11, 2011
1 parent 6dab8ab commit e9efac4
Show file tree
Hide file tree
Showing 9 changed files with 164 additions and 80 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 478ac0272154023abb813db7ae12dc380caeb68e
refs/heads/master: 990bd9151927ad55c7e3da3b05cf13ecfe7a31bf
66 changes: 41 additions & 25 deletions trunk/drivers/net/wireless/ath/ath6kl/cfg80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ static void ath6kl_set_key_mgmt(struct ath6kl_vif *vif, u32 key_mgmt)
}
}

static bool ath6kl_cfg80211_ready(struct ath6kl *ar)
static bool ath6kl_cfg80211_ready(struct ath6kl_vif *vif)
{
struct ath6kl_vif *vif = ar->vif;
struct ath6kl *ar = vif->ar;

if (!test_bit(WMI_READY, &ar->flag)) {
ath6kl_err("wmi is not ready\n");
Expand Down Expand Up @@ -302,7 +302,7 @@ static int ath6kl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,

vif->sme_state = SME_CONNECTING;

if (!ath6kl_cfg80211_ready(ar))
if (!ath6kl_cfg80211_ready(vif))
return -EIO;

if (test_bit(DESTROY_IN_PROGRESS, &ar->flag)) {
Expand Down Expand Up @@ -614,7 +614,7 @@ static int ath6kl_cfg80211_disconnect(struct wiphy *wiphy,
ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: reason=%u\n", __func__,
reason_code);

if (!ath6kl_cfg80211_ready(ar))
if (!ath6kl_cfg80211_ready(vif))
return -EIO;

if (test_bit(DESTROY_IN_PROGRESS, &ar->flag)) {
Expand Down Expand Up @@ -713,7 +713,7 @@ static int ath6kl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
int ret = 0;
u32 force_fg_scan = 0;

if (!ath6kl_cfg80211_ready(ar))
if (!ath6kl_cfg80211_ready(vif))
return -EIO;

if (!ar->usr_bss_filter) {
Expand Down Expand Up @@ -831,7 +831,7 @@ static int ath6kl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
u8 key_type;
int status = 0;

if (!ath6kl_cfg80211_ready(ar))
if (!ath6kl_cfg80211_ready(vif))
return -EIO;

if (params->cipher == CCKM_KRK_CIPHER_SUITE) {
Expand Down Expand Up @@ -953,7 +953,7 @@ static int ath6kl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev,

ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: index %d\n", __func__, key_index);

if (!ath6kl_cfg80211_ready(ar))
if (!ath6kl_cfg80211_ready(vif))
return -EIO;

if (key_index < WMI_MIN_KEY_INDEX || key_index > WMI_MAX_KEY_INDEX) {
Expand All @@ -980,14 +980,13 @@ static int ath6kl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev,
void (*callback) (void *cookie,
struct key_params *))
{
struct ath6kl *ar = (struct ath6kl *)ath6kl_priv(ndev);
struct ath6kl_vif *vif = netdev_priv(ndev);
struct ath6kl_key *key = NULL;
struct key_params params;

ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: index %d\n", __func__, key_index);

if (!ath6kl_cfg80211_ready(ar))
if (!ath6kl_cfg80211_ready(vif))
return -EIO;

if (key_index < WMI_MIN_KEY_INDEX || key_index > WMI_MAX_KEY_INDEX) {
Expand Down Expand Up @@ -1024,7 +1023,7 @@ static int ath6kl_cfg80211_set_default_key(struct wiphy *wiphy,

ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: index %d\n", __func__, key_index);

if (!ath6kl_cfg80211_ready(ar))
if (!ath6kl_cfg80211_ready(vif))
return -EIO;

if (key_index < WMI_MIN_KEY_INDEX || key_index > WMI_MAX_KEY_INDEX) {
Expand Down Expand Up @@ -1080,12 +1079,17 @@ void ath6kl_cfg80211_tkip_micerr_event(struct ath6kl_vif *vif, u8 keyid,
static int ath6kl_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
{
struct ath6kl *ar = (struct ath6kl *)wiphy_priv(wiphy);
struct ath6kl_vif *vif;
int ret;

ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: changed 0x%x\n", __func__,
changed);

if (!ath6kl_cfg80211_ready(ar))
vif = ath6kl_vif_first(ar);
if (!vif)
return -EIO;

if (!ath6kl_cfg80211_ready(vif))
return -EIO;

if (changed & WIPHY_PARAM_RTS_THRESHOLD) {
Expand All @@ -1108,12 +1112,17 @@ static int ath6kl_cfg80211_set_txpower(struct wiphy *wiphy,
int dbm)
{
struct ath6kl *ar = (struct ath6kl *)wiphy_priv(wiphy);
struct ath6kl_vif *vif;
u8 ath6kl_dbm;

ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: type 0x%x, dbm %d\n", __func__,
type, dbm);

if (!ath6kl_cfg80211_ready(ar))
vif = ath6kl_vif_first(ar);
if (!vif)
return -EIO;

if (!ath6kl_cfg80211_ready(vif))
return -EIO;

switch (type) {
Expand All @@ -1128,23 +1137,27 @@ static int ath6kl_cfg80211_set_txpower(struct wiphy *wiphy,
return -EOPNOTSUPP;
}

ath6kl_wmi_set_tx_pwr_cmd(ar->wmi, ath6kl_dbm);
ath6kl_wmi_set_tx_pwr_cmd(ar->wmi, vif->fw_vif_idx, ath6kl_dbm);

return 0;
}

static int ath6kl_cfg80211_get_txpower(struct wiphy *wiphy, int *dbm)
{
struct ath6kl *ar = (struct ath6kl *)wiphy_priv(wiphy);
struct ath6kl_vif *vif = ar->vif;
struct ath6kl_vif *vif;

vif = ath6kl_vif_first(ar);
if (!vif)
return -EIO;

if (!ath6kl_cfg80211_ready(ar))
if (!ath6kl_cfg80211_ready(vif))
return -EIO;

if (test_bit(CONNECTED, &vif->flags)) {
ar->tx_pwr = 0;

if (ath6kl_wmi_get_tx_pwr_cmd(ar->wmi) != 0) {
if (ath6kl_wmi_get_tx_pwr_cmd(ar->wmi, vif->fw_vif_idx) != 0) {
ath6kl_err("ath6kl_wmi_get_tx_pwr_cmd failed\n");
return -EIO;
}
Expand Down Expand Up @@ -1173,7 +1186,7 @@ static int ath6kl_cfg80211_set_power_mgmt(struct wiphy *wiphy,
ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: pmgmt %d, timeout %d\n",
__func__, pmgmt, timeout);

if (!ath6kl_cfg80211_ready(ar))
if (!ath6kl_cfg80211_ready(vif))
return -EIO;

if (pmgmt) {
Expand Down Expand Up @@ -1204,7 +1217,7 @@ static int ath6kl_cfg80211_change_iface(struct wiphy *wiphy,

ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: type %u\n", __func__, type);

if (!ath6kl_cfg80211_ready(ar))
if (!ath6kl_cfg80211_ready(vif))
return -EIO;

switch (type) {
Expand Down Expand Up @@ -1241,7 +1254,7 @@ static int ath6kl_cfg80211_join_ibss(struct wiphy *wiphy,
struct ath6kl_vif *vif = netdev_priv(dev);
int status;

if (!ath6kl_cfg80211_ready(ar))
if (!ath6kl_cfg80211_ready(vif))
return -EIO;

vif->ssid_len = ibss_param->ssid_len;
Expand Down Expand Up @@ -1306,10 +1319,9 @@ static int ath6kl_cfg80211_join_ibss(struct wiphy *wiphy,
static int ath6kl_cfg80211_leave_ibss(struct wiphy *wiphy,
struct net_device *dev)
{
struct ath6kl *ar = (struct ath6kl *)ath6kl_priv(dev);
struct ath6kl_vif *vif = netdev_priv(dev);

if (!ath6kl_cfg80211_ready(ar))
if (!ath6kl_cfg80211_ready(vif))
return -EIO;

ath6kl_disconnect(vif);
Expand Down Expand Up @@ -1539,10 +1551,9 @@ static int ath6kl_set_channel(struct wiphy *wiphy, struct net_device *dev,
struct ieee80211_channel *chan,
enum nl80211_channel_type channel_type)
{
struct ath6kl *ar = ath6kl_priv(dev);
struct ath6kl_vif *vif = netdev_priv(dev);

if (!ath6kl_cfg80211_ready(ar))
if (!ath6kl_cfg80211_ready(vif))
return -EIO;

ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: center_freq=%u hw_value=%u\n",
Expand Down Expand Up @@ -1609,7 +1620,7 @@ static int ath6kl_ap_beacon(struct wiphy *wiphy, struct net_device *dev,

ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: add=%d\n", __func__, add);

if (!ath6kl_cfg80211_ready(ar))
if (!ath6kl_cfg80211_ready(vif))
return -EIO;

if (vif->next_mode != AP_NETWORK)
Expand Down Expand Up @@ -1991,11 +2002,13 @@ struct ath6kl *ath6kl_core_alloc(struct device *dev)

spin_lock_init(&ar->lock);
spin_lock_init(&ar->mcastpsq_lock);
spin_lock_init(&ar->list_lock);

init_waitqueue_head(&ar->event_wq);
sema_init(&ar->sem, 1);

INIT_LIST_HEAD(&ar->amsdu_rx_buffer_queue);
INIT_LIST_HEAD(&ar->vif_list);

clear_bit(WMI_ENABLED, &ar->flag);
clear_bit(SKIP_SCAN, &ar->flag);
Expand Down Expand Up @@ -2110,7 +2123,6 @@ struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name,
ndev->ieee80211_ptr = &vif->wdev;
vif->wdev.wiphy = ar->wiphy;
vif->ar = ar;
ar->vif = vif;
vif->ndev = ndev;
SET_NETDEV_DEV(ndev, wiphy_dev(vif->wdev.wiphy));
vif->wdev.netdev = ndev;
Expand All @@ -2134,6 +2146,10 @@ struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name,
ar->wlan_pwr_state = WLAN_POWER_STATE_ON;
set_bit(NETDEV_REGISTERED, &vif->flags);

spin_lock(&ar->list_lock);
list_add_tail(&vif->list, &ar->vif_list);
spin_unlock(&ar->list_lock);

return ndev;

err:
Expand Down
6 changes: 5 additions & 1 deletion trunk/drivers/net/wireless/ath/ath6kl/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ enum ath6kl_vif_state {
};

struct ath6kl_vif {
struct list_head list;
struct wireless_dev wdev;
struct net_device *ndev;
struct ath6kl *ar;
Expand Down Expand Up @@ -456,7 +457,9 @@ struct ath6kl {
int total_tx_data_pend;
struct htc_target *htc_target;
void *hif_priv;
struct ath6kl_vif *vif;
struct list_head vif_list;
/* Lock to avoid race in vif_list entries among add/del/traverse */
spinlock_t list_lock;
spinlock_t lock;
struct semaphore sem;
u16 listen_intvl_b;
Expand Down Expand Up @@ -662,4 +665,5 @@ void ath6kl_reset_device(struct ath6kl *ar, u32 target_type,
void ath6kl_init_control_info(struct ath6kl_vif *vif);
void ath6kl_deinit_if_data(struct ath6kl_vif *vif);
void ath6kl_core_free(struct ath6kl *ar);
struct ath6kl_vif *ath6kl_vif_first(struct ath6kl *ar);
#endif /* CORE_H */
25 changes: 18 additions & 7 deletions trunk/drivers/net/wireless/ath/ath6kl/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,15 +397,20 @@ static ssize_t read_file_tgt_stats(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ath6kl *ar = file->private_data;
/* TODO: Findout vif */
struct ath6kl_vif *vif = ar->vif;
struct target_stats *tgt_stats = &vif->target_stats;
struct ath6kl_vif *vif;
struct target_stats *tgt_stats;
char *buf;
unsigned int len = 0, buf_len = 1500;
int i;
long left;
ssize_t ret_cnt;

vif = ath6kl_vif_first(ar);
if (!vif)
return -EIO;

tgt_stats = &vif->target_stats;

buf = kzalloc(buf_len, GFP_KERNEL);
if (!buf)
return -ENOMEM;
Expand Down Expand Up @@ -1249,15 +1254,18 @@ static ssize_t ath6kl_create_qos_write(struct file *file,
{

struct ath6kl *ar = file->private_data;
/* TODO: Findout vif */
struct ath6kl_vif *vif = ar->vif;
struct ath6kl_vif *vif;
char buf[100];
ssize_t len;
char *sptr, *token;
struct wmi_create_pstream_cmd pstream;
u32 val32;
u16 val16;

vif = ath6kl_vif_first(ar);
if (!vif)
return -EIO;

len = min(count, sizeof(buf) - 1);
if (copy_from_user(buf, user_buf, len))
return -EFAULT;
Expand Down Expand Up @@ -1423,14 +1431,17 @@ static ssize_t ath6kl_delete_qos_write(struct file *file,
{

struct ath6kl *ar = file->private_data;
/* TODO: Findout vif */
struct ath6kl_vif *vif = ar->vif;
struct ath6kl_vif *vif;
char buf[100];
ssize_t len;
char *sptr, *token;
u8 traffic_class;
u8 tsid;

vif = ath6kl_vif_first(ar);
if (!vif)
return -EIO;

len = min(count, sizeof(buf) - 1);
if (copy_from_user(buf, user_buf, len))
return -EFAULT;
Expand Down
15 changes: 9 additions & 6 deletions trunk/drivers/net/wireless/ath/ath6kl/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1628,11 +1628,7 @@ static void ath6kl_cleanup_vif(struct ath6kl_vif *vif, bool wmi_ready)

void ath6kl_stop_txrx(struct ath6kl *ar)
{
struct ath6kl_vif *vif = ar->vif;
struct net_device *ndev = vif->ndev;

if (!ndev)
return;
struct ath6kl_vif *vif, *tmp_vif;

set_bit(DESTROY_IN_PROGRESS, &ar->flag);

Expand All @@ -1641,7 +1637,14 @@ void ath6kl_stop_txrx(struct ath6kl *ar)
return;
}

ath6kl_cleanup_vif(ar->vif, test_bit(WMI_READY, &ar->flag));
spin_lock(&ar->list_lock);
list_for_each_entry_safe(vif, tmp_vif, &ar->vif_list, list) {
list_del(&vif->list);
spin_unlock(&ar->list_lock);
ath6kl_cleanup_vif(vif, test_bit(WMI_READY, &ar->flag));
spin_lock(&ar->list_lock);
}
spin_unlock(&ar->list_lock);

clear_bit(WMI_READY, &ar->flag);

Expand Down
Loading

0 comments on commit e9efac4

Please sign in to comment.