mirror of https://gitee.com/openkylin/linux.git
ath6kl: Introduce spinlock to protect vif specific information
Use this spinlock to protect the vif's data instead of one from ath6kl. Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
This commit is contained in:
parent
d66ea4f9d6
commit
478ac02721
|
@ -2077,6 +2077,7 @@ static int ath6kl_init_if_data(struct ath6kl_vif *vif)
|
||||||
setup_timer(&vif->disconnect_timer, disconnect_timer_handler,
|
setup_timer(&vif->disconnect_timer, disconnect_timer_handler,
|
||||||
(unsigned long) vif->ndev);
|
(unsigned long) vif->ndev);
|
||||||
set_bit(WMM_ENABLED, &vif->flags);
|
set_bit(WMM_ENABLED, &vif->flags);
|
||||||
|
spin_lock_init(&vif->if_lock);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -400,6 +400,8 @@ struct ath6kl_vif {
|
||||||
struct wireless_dev wdev;
|
struct wireless_dev wdev;
|
||||||
struct net_device *ndev;
|
struct net_device *ndev;
|
||||||
struct ath6kl *ar;
|
struct ath6kl *ar;
|
||||||
|
/* Lock to protect vif specific net_stats and flags */
|
||||||
|
spinlock_t if_lock;
|
||||||
u8 fw_vif_idx;
|
u8 fw_vif_idx;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
int ssid_len;
|
int ssid_len;
|
||||||
|
|
|
@ -989,11 +989,11 @@ void ath6kl_connect_event(struct ath6kl_vif *vif, u16 channel, u8 *bssid,
|
||||||
netif_wake_queue(vif->ndev);
|
netif_wake_queue(vif->ndev);
|
||||||
|
|
||||||
/* Update connect & link status atomically */
|
/* Update connect & link status atomically */
|
||||||
spin_lock_bh(&ar->lock);
|
spin_lock_bh(&vif->if_lock);
|
||||||
set_bit(CONNECTED, &vif->flags);
|
set_bit(CONNECTED, &vif->flags);
|
||||||
clear_bit(CONNECT_PEND, &vif->flags);
|
clear_bit(CONNECT_PEND, &vif->flags);
|
||||||
netif_carrier_on(vif->ndev);
|
netif_carrier_on(vif->ndev);
|
||||||
spin_unlock_bh(&ar->lock);
|
spin_unlock_bh(&vif->if_lock);
|
||||||
|
|
||||||
aggr_reset_state(vif->aggr_cntxt);
|
aggr_reset_state(vif->aggr_cntxt);
|
||||||
vif->reconnect_flag = 0;
|
vif->reconnect_flag = 0;
|
||||||
|
@ -1345,10 +1345,10 @@ void ath6kl_disconnect_event(struct ath6kl_vif *vif, u8 reason, u8 *bssid,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* update connect & link status atomically */
|
/* update connect & link status atomically */
|
||||||
spin_lock_bh(&ar->lock);
|
spin_lock_bh(&vif->if_lock);
|
||||||
clear_bit(CONNECTED, &vif->flags);
|
clear_bit(CONNECTED, &vif->flags);
|
||||||
netif_carrier_off(vif->ndev);
|
netif_carrier_off(vif->ndev);
|
||||||
spin_unlock_bh(&ar->lock);
|
spin_unlock_bh(&vif->if_lock);
|
||||||
|
|
||||||
if ((reason != CSERV_DISCONNECT) || (vif->reconnect_flag != 1))
|
if ((reason != CSERV_DISCONNECT) || (vif->reconnect_flag != 1))
|
||||||
vif->reconnect_flag = 0;
|
vif->reconnect_flag = 0;
|
||||||
|
@ -1365,11 +1365,8 @@ void ath6kl_disconnect_event(struct ath6kl_vif *vif, u8 reason, u8 *bssid,
|
||||||
|
|
||||||
static int ath6kl_open(struct net_device *dev)
|
static int ath6kl_open(struct net_device *dev)
|
||||||
{
|
{
|
||||||
struct ath6kl *ar = ath6kl_priv(dev);
|
|
||||||
struct ath6kl_vif *vif = netdev_priv(dev);
|
struct ath6kl_vif *vif = netdev_priv(dev);
|
||||||
|
|
||||||
spin_lock_bh(&ar->lock);
|
|
||||||
|
|
||||||
set_bit(WLAN_ENABLED, &vif->flags);
|
set_bit(WLAN_ENABLED, &vif->flags);
|
||||||
|
|
||||||
if (test_bit(CONNECTED, &vif->flags)) {
|
if (test_bit(CONNECTED, &vif->flags)) {
|
||||||
|
@ -1378,8 +1375,6 @@ static int ath6kl_open(struct net_device *dev)
|
||||||
} else
|
} else
|
||||||
netif_carrier_off(dev);
|
netif_carrier_off(dev);
|
||||||
|
|
||||||
spin_unlock_bh(&ar->lock);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -475,9 +475,9 @@ enum htc_send_full_action ath6kl_tx_queue_full(struct htc_target *target,
|
||||||
return HTC_SEND_FULL_DROP;
|
return HTC_SEND_FULL_DROP;
|
||||||
|
|
||||||
stop_net_queues:
|
stop_net_queues:
|
||||||
spin_lock_bh(&ar->lock);
|
spin_lock_bh(&vif->if_lock);
|
||||||
set_bit(NETQ_STOPPED, &vif->flags);
|
set_bit(NETQ_STOPPED, &vif->flags);
|
||||||
spin_unlock_bh(&ar->lock);
|
spin_unlock_bh(&vif->if_lock);
|
||||||
netif_stop_queue(vif->ndev);
|
netif_stop_queue(vif->ndev);
|
||||||
|
|
||||||
return HTC_SEND_FULL_KEEP;
|
return HTC_SEND_FULL_KEEP;
|
||||||
|
@ -1103,12 +1103,12 @@ void ath6kl_rx(struct htc_target *target, struct htc_packet *packet)
|
||||||
* Take lock to protect buffer counts and adaptive power throughput
|
* Take lock to protect buffer counts and adaptive power throughput
|
||||||
* state.
|
* state.
|
||||||
*/
|
*/
|
||||||
spin_lock_bh(&ar->lock);
|
spin_lock_bh(&vif->if_lock);
|
||||||
|
|
||||||
vif->net_stats.rx_packets++;
|
vif->net_stats.rx_packets++;
|
||||||
vif->net_stats.rx_bytes += packet->act_len;
|
vif->net_stats.rx_bytes += packet->act_len;
|
||||||
|
|
||||||
spin_unlock_bh(&ar->lock);
|
spin_unlock_bh(&vif->if_lock);
|
||||||
|
|
||||||
|
|
||||||
ath6kl_dbg_dump(ATH6KL_DBG_RAW_BYTES, __func__, "rx ",
|
ath6kl_dbg_dump(ATH6KL_DBG_RAW_BYTES, __func__, "rx ",
|
||||||
|
|
Loading…
Reference in New Issue