mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-14 08:36:12 -04:00
qcacld-3.0: move the ct_peer_mac_table to hdd ctx
Access to tdls_ctx should be protected with mutex since it is being accessed and freed in different contexts. ct_peer_mac_table is a parameter of tdls_ctx and it is being accessed in tx/rx path which runs in softirq context. So we cannot hold the mutex while accessing the tdls_ctx in tx/rx path. In this change the ct_peer_mac_table is moved to hdd_ctx so that we no need access the tdls_ctx in tx/rx path. CRs-Fixed: 1105539 Change-Id: Iafcc450a6e34500929605a11274fb2077b3f81fe
This commit is contained in:
parent
4f955f9474
commit
5159c430b6
3 changed files with 25 additions and 26 deletions
|
|
@ -1392,6 +1392,10 @@ struct hdd_context_s {
|
|||
tdls_scan_context_t tdls_scan_ctxt;
|
||||
/* Lock to avoid race condition during TDLS operations */
|
||||
qdf_spinlock_t tdls_ct_spinlock;
|
||||
/* linear mac address table for counting the packets */
|
||||
struct tdls_ct_mac_table ct_peer_mac_table[TDLS_CT_MAC_MAX_TABLE_SIZE];
|
||||
/* number of valid mac entry in @ct_peer_mac_table */
|
||||
uint8_t valid_mac_entries;
|
||||
struct mutex tdls_lock;
|
||||
uint8_t tdls_off_channel;
|
||||
uint16_t tdls_channel_offset;
|
||||
|
|
|
|||
|
|
@ -380,8 +380,6 @@ struct tdls_set_state_info {
|
|||
* @discovery_sent_cnt: discovery sent count
|
||||
* @ap_rssi: ap rssi
|
||||
* @curr_candidate: current candidate
|
||||
* @ct_peer_mac_table: linear mac address table for counting the packets
|
||||
* @valid_mac_entries: number of valid mac entry in @ct_peer_mac_table
|
||||
* @magic: magic
|
||||
* @last_flush_ts: last timestamp when flush logs was displayed.
|
||||
*
|
||||
|
|
@ -396,8 +394,6 @@ typedef struct {
|
|||
uint32_t discovery_sent_cnt;
|
||||
int8_t ap_rssi;
|
||||
struct _hddTdlsPeer_t *curr_candidate;
|
||||
struct tdls_ct_mac_table ct_peer_mac_table[TDLS_CT_MAC_MAX_TABLE_SIZE];
|
||||
uint8_t valid_mac_entries;
|
||||
uint32_t magic;
|
||||
uint64_t last_flush_ts;
|
||||
} tdlsCtx_t;
|
||||
|
|
|
|||
|
|
@ -802,7 +802,7 @@ int wlan_hdd_tdls_init(hdd_adapter_t *pAdapter)
|
|||
|
||||
pHddTdlsCtx->curr_candidate = NULL;
|
||||
pHddTdlsCtx->magic = 0;
|
||||
pHddTdlsCtx->valid_mac_entries = 0;
|
||||
pHddCtx->valid_mac_entries = 0;
|
||||
pHddTdlsCtx->last_flush_ts = 0;
|
||||
|
||||
/* remember configuration even if it is not used right now. it could be used later */
|
||||
|
|
@ -5267,20 +5267,20 @@ static void wlan_hdd_tdls_ct_sampling_tx_rx(hdd_adapter_t *adapter,
|
|||
|
||||
qdf_spin_lock_bh(&hdd_ctx->tdls_ct_spinlock);
|
||||
|
||||
if (0 == tdls_ctx->valid_mac_entries) {
|
||||
if (0 == hdd_ctx->valid_mac_entries) {
|
||||
qdf_spin_unlock_bh(&hdd_ctx->tdls_ct_spinlock);
|
||||
return;
|
||||
}
|
||||
|
||||
valid_mac_entries = tdls_ctx->valid_mac_entries;
|
||||
valid_mac_entries = hdd_ctx->valid_mac_entries;
|
||||
|
||||
memcpy(ct_peer_mac_table, tdls_ctx->ct_peer_mac_table,
|
||||
memcpy(ct_peer_mac_table, hdd_ctx->ct_peer_mac_table,
|
||||
(sizeof(struct tdls_ct_mac_table)) * valid_mac_entries);
|
||||
|
||||
memset(tdls_ctx->ct_peer_mac_table, 0,
|
||||
memset(hdd_ctx->ct_peer_mac_table, 0,
|
||||
(sizeof(struct tdls_ct_mac_table)) * valid_mac_entries);
|
||||
|
||||
tdls_ctx->valid_mac_entries = 0;
|
||||
hdd_ctx->valid_mac_entries = 0;
|
||||
|
||||
qdf_spin_unlock_bh(&hdd_ctx->tdls_ct_spinlock);
|
||||
|
||||
|
|
@ -5317,7 +5317,6 @@ void wlan_hdd_tdls_update_rx_pkt_cnt(hdd_adapter_t *adapter,
|
|||
{
|
||||
hdd_context_t *hdd_ctx;
|
||||
hdd_station_ctx_t *hdd_sta_ctx;
|
||||
tdlsCtx_t *tdls_ctx;
|
||||
uint8_t mac_cnt;
|
||||
uint8_t valid_mac_entries;
|
||||
struct qdf_mac_addr *mac_addr;
|
||||
|
|
@ -5336,15 +5335,14 @@ void wlan_hdd_tdls_update_rx_pkt_cnt(hdd_adapter_t *adapter,
|
|||
mac_addr, QDF_MAC_ADDR_SIZE) == 0)
|
||||
return;
|
||||
|
||||
tdls_ctx = adapter->sessionCtx.station.pHddTdlsCtx;
|
||||
|
||||
qdf_spin_lock_bh(&hdd_ctx->tdls_ct_spinlock);
|
||||
valid_mac_entries = tdls_ctx->valid_mac_entries;
|
||||
valid_mac_entries = hdd_ctx->valid_mac_entries;
|
||||
|
||||
for (mac_cnt = 0; mac_cnt < valid_mac_entries; mac_cnt++) {
|
||||
if (memcmp(tdls_ctx->ct_peer_mac_table[mac_cnt].mac_address.bytes,
|
||||
if (memcmp(hdd_ctx->ct_peer_mac_table[mac_cnt].mac_address.bytes,
|
||||
mac_addr, QDF_MAC_ADDR_SIZE) == 0) {
|
||||
tdls_ctx->ct_peer_mac_table[mac_cnt].rx_packet_cnt++;
|
||||
hdd_ctx->ct_peer_mac_table[mac_cnt].rx_packet_cnt++;
|
||||
goto rx_cnt_return;
|
||||
}
|
||||
}
|
||||
|
|
@ -5353,10 +5351,10 @@ void wlan_hdd_tdls_update_rx_pkt_cnt(hdd_adapter_t *adapter,
|
|||
* stop tracking till the old entries are removed
|
||||
*/
|
||||
if (mac_cnt < TDLS_CT_MAC_MAX_TABLE_SIZE) {
|
||||
memcpy(tdls_ctx->ct_peer_mac_table[mac_cnt].mac_address.bytes,
|
||||
memcpy(hdd_ctx->ct_peer_mac_table[mac_cnt].mac_address.bytes,
|
||||
mac_addr, QDF_MAC_ADDR_SIZE);
|
||||
tdls_ctx->valid_mac_entries = mac_cnt+1;
|
||||
tdls_ctx->ct_peer_mac_table[mac_cnt].rx_packet_cnt = 1;
|
||||
hdd_ctx->valid_mac_entries = mac_cnt+1;
|
||||
hdd_ctx->ct_peer_mac_table[mac_cnt].rx_packet_cnt = 1;
|
||||
}
|
||||
|
||||
rx_cnt_return:
|
||||
|
|
@ -5406,12 +5404,12 @@ void wlan_hdd_tdls_update_tx_pkt_cnt(hdd_adapter_t *adapter,
|
|||
tdls_ctx = adapter->sessionCtx.station.pHddTdlsCtx;
|
||||
|
||||
qdf_spin_lock_bh(&hdd_ctx->tdls_ct_spinlock);
|
||||
valid_mac_entries = tdls_ctx->valid_mac_entries;
|
||||
valid_mac_entries = hdd_ctx->valid_mac_entries;
|
||||
|
||||
for (mac_cnt = 0; mac_cnt < valid_mac_entries; mac_cnt++) {
|
||||
if (memcmp(tdls_ctx->ct_peer_mac_table[mac_cnt].mac_address.bytes,
|
||||
if (memcmp(hdd_ctx->ct_peer_mac_table[mac_cnt].mac_address.bytes,
|
||||
mac_addr, QDF_MAC_ADDR_SIZE) == 0) {
|
||||
tdls_ctx->ct_peer_mac_table[mac_cnt].tx_packet_cnt++;
|
||||
hdd_ctx->ct_peer_mac_table[mac_cnt].tx_packet_cnt++;
|
||||
goto tx_cnt_return;
|
||||
}
|
||||
}
|
||||
|
|
@ -5420,10 +5418,10 @@ void wlan_hdd_tdls_update_tx_pkt_cnt(hdd_adapter_t *adapter,
|
|||
* stop tracking till the old entries are removed
|
||||
*/
|
||||
if (mac_cnt < TDLS_CT_MAC_MAX_TABLE_SIZE) {
|
||||
memcpy(tdls_ctx->ct_peer_mac_table[mac_cnt].mac_address.bytes,
|
||||
memcpy(hdd_ctx->ct_peer_mac_table[mac_cnt].mac_address.bytes,
|
||||
mac_addr, QDF_MAC_ADDR_SIZE);
|
||||
tdls_ctx->ct_peer_mac_table[mac_cnt].tx_packet_cnt = 1;
|
||||
tdls_ctx->valid_mac_entries++;
|
||||
hdd_ctx->ct_peer_mac_table[mac_cnt].tx_packet_cnt = 1;
|
||||
hdd_ctx->valid_mac_entries++;
|
||||
}
|
||||
|
||||
tx_cnt_return:
|
||||
|
|
@ -5855,6 +5853,7 @@ static void wlan_hdd_tdls_ct_handler(void *user_data)
|
|||
if (0 != (wlan_hdd_validate_context(hdd_ctx)))
|
||||
return;
|
||||
|
||||
mutex_lock(&hdd_ctx->tdls_lock);
|
||||
hdd_tdls_ctx = adapter->sessionCtx.station.pHddTdlsCtx;
|
||||
|
||||
if (NULL == hdd_tdls_ctx) {
|
||||
|
|
@ -5866,7 +5865,7 @@ static void wlan_hdd_tdls_ct_handler(void *user_data)
|
|||
if (!hdd_ctx->enable_tdls_connection_tracker)
|
||||
goto restart_return;
|
||||
|
||||
mutex_lock(&hdd_ctx->tdls_lock);
|
||||
|
||||
|
||||
/* Update tx rx traffic sample in tdls data structures */
|
||||
wlan_hdd_tdls_ct_sampling_tx_rx(adapter, hdd_ctx,
|
||||
|
|
@ -5883,12 +5882,12 @@ static void wlan_hdd_tdls_ct_handler(void *user_data)
|
|||
}
|
||||
}
|
||||
|
||||
mutex_unlock(&hdd_ctx->tdls_lock);
|
||||
|
||||
restart_return:
|
||||
wlan_hdd_tdls_timer_restart(hdd_tdls_ctx->pAdapter,
|
||||
&hdd_tdls_ctx->peer_update_timer,
|
||||
hdd_tdls_ctx->threshold_config.tx_period_t);
|
||||
mutex_unlock(&hdd_ctx->tdls_lock);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue