qcacmn: Fix race condition in tx lookup queue during tx completion

Tx lookup queue holds the reference of the packet that is successfully
transmitted via CE pipe. Tx lookup queue  method can be called from
tx path and from tasklet simultaneously for the same endpoint.
One context can get the packet reference in its local lookup Queue and the
other context may not find the reference as this is not brought back
from lookupQueue to TxLookupQueue.

Fix this by adding a per endpoint lookup queue lock.

Change-Id: I0f4872f695e9ab15c27c91e733449f03871f4262
CRs-Fixed: 2047390
This commit is contained in:
Govind Singh
2017-05-16 12:15:51 +05:30
zatwierdzone przez snandini
rodzic 899e775769
commit c505cdc689
3 zmienionych plików z 28 dodań i 11 usunięć

Wyświetl plik

@@ -174,6 +174,7 @@ typedef struct _HTC_ENDPOINT {
#endif
bool TxCreditFlowEnabled;
bool async_update; /* packets can be queued asynchronously */
qdf_spinlock_t lookup_queue_lock;
} HTC_ENDPOINT;
#ifdef HTC_EP_STAT_PROFILING
@@ -279,16 +280,18 @@ do { \
} while (0)
#endif
#define HTC_STATE_STOPPING (1 << 0)
#define HTC_STOPPING(t) ((t)->HTCStateFlags & HTC_STATE_STOPPING)
#define LOCK_HTC(t) qdf_spin_lock_bh(&(t)->HTCLock)
#define UNLOCK_HTC(t) qdf_spin_unlock_bh(&(t)->HTCLock)
#define LOCK_HTC_RX(t) qdf_spin_lock_bh(&(t)->HTCRxLock)
#define UNLOCK_HTC_RX(t) qdf_spin_unlock_bh(&(t)->HTCRxLock)
#define LOCK_HTC_TX(t) qdf_spin_lock_bh(&(t)->HTCTxLock)
#define UNLOCK_HTC_TX(t) qdf_spin_unlock_bh(&(t)->HTCTxLock)
#define LOCK_HTC_CREDIT(t) qdf_spin_lock_bh(&(t)->HTCCreditLock)
#define UNLOCK_HTC_CREDIT(t) qdf_spin_unlock_bh(&(t)->HTCCreditLock)
#define HTC_STATE_STOPPING (1 << 0)
#define HTC_STOPPING(t) ((t)->HTCStateFlags & HTC_STATE_STOPPING)
#define LOCK_HTC(t) qdf_spin_lock_bh(&(t)->HTCLock)
#define UNLOCK_HTC(t) qdf_spin_unlock_bh(&(t)->HTCLock)
#define LOCK_HTC_RX(t) qdf_spin_lock_bh(&(t)->HTCRxLock)
#define UNLOCK_HTC_RX(t) qdf_spin_unlock_bh(&(t)->HTCRxLock)
#define LOCK_HTC_TX(t) qdf_spin_lock_bh(&(t)->HTCTxLock)
#define UNLOCK_HTC_TX(t) qdf_spin_unlock_bh(&(t)->HTCTxLock)
#define LOCK_HTC_CREDIT(t) qdf_spin_lock_bh(&(t)->HTCCreditLock)
#define UNLOCK_HTC_CREDIT(t) qdf_spin_unlock_bh(&(t)->HTCCreditLock)
#define LOCK_HTC_EP_TX_LOOKUP(t) qdf_spin_lock_bh(&(t)->lookup_queue_lock)
#define UNLOCK_HTC_EP_TX_LOOKUP(t) qdf_spin_unlock_bh(&(t)->lookup_queue_lock)
#define GET_HTC_TARGET_FROM_HANDLE(hnd) ((HTC_TARGET *)(hnd))