qcacmn: Fix LMAC interrupt mappings

Current data-path interrupt registration/handling assumes PDEV indices to be
in same order as HW MAC IDs, which is not always true. Fixed this by adding
wlan_cfg api to set and get pdev index to mac id mapping.

Change-Id: Iec8e9f4a02cd618a3b244cfd6fc7ead1e7d993c3
CRs-Fixed: 2063673
This commit is contained in:
Karunakar Dasineni
2017-06-19 16:32:06 -07:00
committed by snandini
parent 60c2c9836e
commit 1018547152
4 changed files with 128 additions and 3 deletions

View File

@@ -321,8 +321,10 @@ static uint32_t dp_service_srngs(void *dp_ctx, uint32_t dp_budget)
if (reo_status_mask) if (reo_status_mask)
dp_reo_status_ring_handler(soc); dp_reo_status_ring_handler(soc);
/* Process Rx monitor interrupts */ /* Process LMAC interrupts */
for (ring = 0 ; ring < MAX_PDEV_CNT; ring++) { for (ring = 0 ; ring < MAX_PDEV_CNT; ring++) {
if (soc->pdev_list[ring] == NULL)
continue;
if (int_ctx->rx_mon_ring_mask & (1 << ring)) { if (int_ctx->rx_mon_ring_mask & (1 << ring)) {
work_done = work_done =
dp_mon_process(soc, ring, budget); dp_mon_process(soc, ring, budget);
@@ -380,6 +382,7 @@ static QDF_STATUS dp_soc_interrupt_attach(void *txrx_soc)
soc->intr_ctx[i].rx_err_ring_mask = 0x1; soc->intr_ctx[i].rx_err_ring_mask = 0x1;
soc->intr_ctx[i].rx_wbm_rel_ring_mask = 0x1; soc->intr_ctx[i].rx_wbm_rel_ring_mask = 0x1;
soc->intr_ctx[i].reo_status_ring_mask = 0x1; soc->intr_ctx[i].reo_status_ring_mask = 0x1;
soc->intr_ctx[i].rxdma2host_ring_mask = 0x1;
soc->intr_ctx[i].soc = soc; soc->intr_ctx[i].soc = soc;
soc->intr_ctx[i].lro_ctx = qdf_lro_init(); soc->intr_ctx[i].lro_ctx = qdf_lro_init();
} }
@@ -443,11 +446,14 @@ static QDF_STATUS dp_soc_interrupt_attach(void *txrx_soc)
wlan_cfg_get_rx_wbm_rel_ring_mask(soc->wlan_cfg_ctx, i); wlan_cfg_get_rx_wbm_rel_ring_mask(soc->wlan_cfg_ctx, i);
int reo_status_ring_mask = int reo_status_ring_mask =
wlan_cfg_get_reo_status_ring_mask(soc->wlan_cfg_ctx, i); wlan_cfg_get_reo_status_ring_mask(soc->wlan_cfg_ctx, i);
int rxdma2host_ring_mask =
wlan_cfg_get_rxdma2host_ring_mask(soc->wlan_cfg_ctx, i);
soc->intr_ctx[i].tx_ring_mask = tx_mask; soc->intr_ctx[i].tx_ring_mask = tx_mask;
soc->intr_ctx[i].rx_ring_mask = rx_mask; soc->intr_ctx[i].rx_ring_mask = rx_mask;
soc->intr_ctx[i].rx_mon_ring_mask = rx_mon_mask; soc->intr_ctx[i].rx_mon_ring_mask = rx_mon_mask;
soc->intr_ctx[i].rx_err_ring_mask = rx_err_ring_mask; soc->intr_ctx[i].rx_err_ring_mask = rx_err_ring_mask;
soc->intr_ctx[i].rxdma2host_ring_mask = rxdma2host_ring_mask;
soc->intr_ctx[i].rx_wbm_rel_ring_mask = rx_wbm_rel_ring_mask; soc->intr_ctx[i].rx_wbm_rel_ring_mask = rx_wbm_rel_ring_mask;
soc->intr_ctx[i].reo_status_ring_mask = reo_status_ring_mask; soc->intr_ctx[i].reo_status_ring_mask = reo_status_ring_mask;
@@ -467,10 +473,16 @@ static QDF_STATUS dp_soc_interrupt_attach(void *txrx_soc)
(reo2host_destination_ring1 - j); (reo2host_destination_ring1 - j);
} }
if (rxdma2host_ring_mask & (1 << j)) {
irq_id_map[num_irq++] =
rxdma2host_destination_ring_mac1 -
wlan_cfg_get_hw_mac_idx(soc->wlan_cfg_ctx, j);
}
if (rx_mon_mask & (1 << j)) { if (rx_mon_mask & (1 << j)) {
irq_id_map[num_irq++] = irq_id_map[num_irq++] =
(ppdu_end_interrupts_mac1 ppdu_end_interrupts_mac1 -
- j); wlan_cfg_get_hw_mac_idx(soc->wlan_cfg_ctx, j);
} }
if (rx_wbm_rel_ring_mask & (1 << j)) if (rx_wbm_rel_ring_mask & (1 << j))

View File

@@ -366,6 +366,7 @@ struct dp_intr {
uint8_t rx_err_ring_mask; /* REO Exception Ring */ uint8_t rx_err_ring_mask; /* REO Exception Ring */
uint8_t rx_wbm_rel_ring_mask; /* WBM2SW Rx Release Ring */ uint8_t rx_wbm_rel_ring_mask; /* WBM2SW Rx Release Ring */
uint8_t reo_status_ring_mask; /* REO command response ring */ uint8_t reo_status_ring_mask; /* REO command response ring */
uint8_t rxdma2host_ring_mask; /* RXDMA to host destination ring */
struct dp_soc *soc; /* Reference to SoC structure , struct dp_soc *soc; /* Reference to SoC structure ,
to get DMA ring handles */ to get DMA ring handles */
qdf_lro_ctx_t lro_ctx; qdf_lro_ctx_t lro_ctx;

View File

@@ -118,6 +118,11 @@
#define WLAN_CFG_REO_STATUS_RING_MASK_2 0x0 #define WLAN_CFG_REO_STATUS_RING_MASK_2 0x0
#define WLAN_CFG_REO_STATUS_RING_MASK_3 0x0 #define WLAN_CFG_REO_STATUS_RING_MASK_3 0x0
#define WLAN_CFG_RXDMA2HOST_RING_MASK_0 0x1
#define WLAN_CFG_RXDMA2HOST_RING_MASK_1 0x2
#define WLAN_CFG_RXDMA2HOST_RING_MASK_2 0x4
#define WLAN_CFG_RXDMA2HOST_RING_MASK_3 0x0
#define WLAN_CFG_DP_TX_NUM_POOLS 3 #define WLAN_CFG_DP_TX_NUM_POOLS 3
/* Change this to a lower value to enforce scattered idle list mode */ /* Change this to a lower value to enforce scattered idle list mode */
#define WLAN_CFG_MAX_ALLOC_SIZE (2 << 20) #define WLAN_CFG_MAX_ALLOC_SIZE (2 << 20)
@@ -173,6 +178,12 @@ static const int reo_status_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
WLAN_CFG_REO_STATUS_RING_MASK_2, WLAN_CFG_REO_STATUS_RING_MASK_2,
WLAN_CFG_REO_STATUS_RING_MASK_3}; WLAN_CFG_REO_STATUS_RING_MASK_3};
static const int rxdma2host_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
WLAN_CFG_RXDMA2HOST_RING_MASK_0,
WLAN_CFG_RXDMA2HOST_RING_MASK_1,
WLAN_CFG_RXDMA2HOST_RING_MASK_2,
WLAN_CFG_RXDMA2HOST_RING_MASK_3};
/** /**
* struct wlan_cfg_dp_soc_ctxt - Configuration parameters for SoC (core TxRx) * struct wlan_cfg_dp_soc_ctxt - Configuration parameters for SoC (core TxRx)
* @num_int_ctxts - Number of NAPI/Interrupt contexts to be registered for DP * @num_int_ctxts - Number of NAPI/Interrupt contexts to be registered for DP
@@ -194,6 +205,8 @@ static const int reo_status_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
* @int_rx_ring_mask - Bitmap of Rx interrupts mapped to each NAPI/Intr context * @int_rx_ring_mask - Bitmap of Rx interrupts mapped to each NAPI/Intr context
* @int_rx_mon_ring_mask - Bitmap of Rx monitor ring interrupts mapped to each * @int_rx_mon_ring_mask - Bitmap of Rx monitor ring interrupts mapped to each
* NAPI/Intr context * NAPI/Intr context
* @int_rxdma2host_ring_mask - Bitmap of RXDMA2host ring interrupts mapped to
* each NAPI/Intr context
* @int_ce_ring_mask - Bitmap of CE interrupts mapped to each NAPI/Intr context * @int_ce_ring_mask - Bitmap of CE interrupts mapped to each NAPI/Intr context
* @lro_enabled - is LRO enabled * @lro_enabled - is LRO enabled
* @rx_hash - Enable hash based steering of rx packets * @rx_hash - Enable hash based steering of rx packets
@@ -222,6 +235,7 @@ struct wlan_cfg_dp_soc_ctxt {
int int_tx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS]; int int_tx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS];
int int_rx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS]; int int_rx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS];
int int_rx_mon_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS]; int int_rx_mon_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS];
int int_rxdma2host_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS];
int int_ce_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS]; int int_ce_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS];
int int_rx_err_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS]; int int_rx_err_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS];
int int_rx_wbm_rel_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS]; int int_rx_wbm_rel_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS];
@@ -229,6 +243,8 @@ struct wlan_cfg_dp_soc_ctxt {
bool lro_enabled; bool lro_enabled;
bool rx_hash; bool rx_hash;
int nss_cfg; int nss_cfg;
int hw_macid[MAX_PDEV_CNT];
int base_hw_macid;
}; };
/** /**
@@ -294,11 +310,23 @@ struct wlan_cfg_dp_soc_ctxt *wlan_cfg_soc_attach()
rx_wbm_rel_ring_mask[i]; rx_wbm_rel_ring_mask[i];
wlan_cfg_ctx->int_reo_status_ring_mask[i] = wlan_cfg_ctx->int_reo_status_ring_mask[i] =
reo_status_ring_mask[i]; reo_status_ring_mask[i];
wlan_cfg_ctx->int_rxdma2host_ring_mask[i] =
rxdma2host_ring_mask[i];
} }
wlan_cfg_ctx->rx_hash = WLAN_RX_HASH_ENABLE; wlan_cfg_ctx->rx_hash = WLAN_RX_HASH_ENABLE;
wlan_cfg_ctx->lro_enabled = WLAN_LRO_ENABLE; wlan_cfg_ctx->lro_enabled = WLAN_LRO_ENABLE;
/* This is default mapping and can be overridden by HW config
* received from FW */
wlan_cfg_set_hw_macid(wlan_cfg_ctx, 0, 1);
if (MAX_PDEV_CNT > 1)
wlan_cfg_set_hw_macid(wlan_cfg_ctx, 1, 3);
if (MAX_PDEV_CNT > 2)
wlan_cfg_set_hw_macid(wlan_cfg_ctx, 2, 2);
wlan_cfg_ctx->base_hw_macid = 1;
return wlan_cfg_ctx; return wlan_cfg_ctx;
} }
@@ -357,6 +385,37 @@ void wlan_cfg_set_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
cfg->int_rx_mon_ring_mask[context] = mask; cfg->int_rx_mon_ring_mask[context] = mask;
} }
void wlan_cfg_set_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
int context, int mask)
{
cfg->int_rxdma2host_ring_mask[context] = mask;
}
int wlan_cfg_get_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
int context)
{
return cfg->int_rxdma2host_ring_mask[context];
}
void wlan_cfg_set_hw_macid(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx,
int hw_macid)
{
qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
cfg->hw_macid[pdev_idx] = hw_macid;
}
int wlan_cfg_get_hw_macid(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx)
{
qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
return cfg->hw_macid[pdev_idx];
}
int wlan_cfg_get_hw_mac_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx)
{
qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
return cfg->hw_macid[pdev_idx] - cfg->base_hw_macid;
}
void wlan_cfg_set_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, void wlan_cfg_set_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
int context, int mask) int context, int mask)
{ {

View File

@@ -166,6 +166,59 @@ int wlan_cfg_get_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx,
int wlan_cfg_get_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx, int wlan_cfg_get_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx,
int context); int context);
/**
* wlan_cfg_set_rxdma2host_ring_mask() - Set rxdma2host ring interrupt mask
* for the given interrupt context
* @wlan_cfg_ctx - Configuration Handle
* @context - Numerical ID identifying the Interrupt/NAPI context
*
*/
void wlan_cfg_set_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
int context, int mask);
/**
* wlan_cfg_get_rxdma2host_ring_mask() - Return rxdma2host ring interrupt mask
* mapped to an interrupt context
* @wlan_cfg_ctx - Configuration Handle
* @context - Numerical ID identifying the Interrupt/NAPI context
*
* Return: int_rxdma2host_ring_mask[context]
*/
int wlan_cfg_get_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
int context);
/**
* wlan_cfg_set_hw_macid() - Set HW MAC Id for the given PDEV index
*
* @wlan_cfg_ctx - Configuration Handle
* @pdev_idx - Index of SW PDEV
* @hw_macid - HW MAC Id
*
*/
void wlan_cfg_set_hw_macid(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx,
int hw_macid);
/**
* wlan_cfg_get_hw_macid() - Get HW MAC Id for the given PDEV index
*
* @wlan_cfg_ctx - Configuration Handle
* @pdev_idx - Index of SW PDEV
*
* Return: HW MAC Id
*/
int wlan_cfg_get_hw_macid(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx);
/**
* wlan_cfg_get_hw_mac_idx() - Get 0 based HW MAC index for the given
* PDEV index
*
* @wlan_cfg_ctx - Configuration Handle
* @pdev_idx - Index of SW PDEV
*
* Return: HW MAC index
*/
int wlan_cfg_get_hw_mac_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx);
/** /**
* wlan_cfg_get_ce_ring_mask() - Return CE ring interrupt mask * wlan_cfg_get_ce_ring_mask() - Return CE ring interrupt mask
* mapped to an interrupt context * mapped to an interrupt context