qcacmn: Changes to Init TX Rings for BE

DP/CFG changes to initialize extra TX/TX Comp Rings in BE.

CRs-Fixed: 2937302
Change-Id: Ia8a8ed717eb0e1bfa9d2e1ff917941a7ea91bc28
This commit is contained in:
Mohit Khanna
2021-04-30 08:19:14 -07:00
committed by Madan Koyyalamudi
parent 08c76c5170
commit af887c113d
19 changed files with 619 additions and 378 deletions

View File

@@ -30,24 +30,21 @@
#include "hal_api.h"
#include "dp_types.h"
/*
* FIX THIS -
* For now, all these configuration parameters are hardcoded.
* Many of these should actually be coming from dts file/ini file
*/
/*
* The max allowed size for tx comp ring is 8191.
* This is limitted by h/w ring max size.
* This is limited by h/w ring max size.
* As this is not a power of 2 it does not work with nss offload so the
* nearest available size which is power of 2 is 4096 chosen for nss
*/
#define WLAN_CFG_TX_RING_MASK_0 0x1
#define WLAN_CFG_TX_RING_MASK_1 0x2
#define WLAN_CFG_TX_RING_MASK_2 0x4
#define WLAN_CFG_TX_RING_MASK_3 0x0
#define WLAN_CFG_TX_RING_MASK_0 BIT(0)
#define WLAN_CFG_TX_RING_MASK_1 BIT(1)
#define WLAN_CFG_TX_RING_MASK_2 BIT(2)
#define WLAN_CFG_TX_RING_MASK_3 0
#define WLAN_CFG_TX_RING_MASK_4 BIT(4)
#define WLAN_CFG_TX_RING_MASK_5 BIT(5)
#define WLAN_CFG_TX_RING_MASK_6 BIT(6)
#define WLAN_CFG_RX_MON_RING_MASK_0 0x1
#define WLAN_CFG_RX_MON_RING_MASK_1 0x2
@@ -104,105 +101,143 @@ struct dp_int_mask_assignment {
};
#if defined(WLAN_MAX_PDEVS) && (WLAN_MAX_PDEVS == 1)
#define NUM_INTERRUPT_COMBINATIONS 1
/*
* This structure contains the best possible mask assignment for a given
* number of MSIs available in the system.
* For BE, there are 18 available MSI interrupts, assigned in the manner
* below.
* TX(5) + RX(8) + (REO ERR + WBM ERR)(1) +
* (REO status + RXDMA[0] + RXDMA[1])(1) + NEAR_Full_RX(2) + NEAR_Full_TX(1)
* For IPA_OFFLOAD enabled case, 2 TX/RX rings would be assigned to IPA.
*/
static struct dp_int_mask_assignment dp_mask_assignment[NUM_INTERRUPT_COMBINATIONS] = {
/*Default configuration */
{
/* tx ring masks */
{ WLAN_CFG_TX_RING_MASK_0,
0, 0, 0, 0, 0, 0},
/* rx ring masks */
#ifdef CONFIG_BERYLLIUM
#ifdef IPA_OFFLOAD
{ 0,
WLAN_CFG_RX_RING_MASK_0,
WLAN_CFG_RX_RING_MASK_1,
WLAN_CFG_RX_RING_MASK_2, 0, 0, 0,
WLAN_CFG_RX_RING_MASK_4,
WLAN_CFG_RX_RING_MASK_5,
WLAN_CFG_RX_RING_MASK_6,
0},
#else /* IPA_OFFLOAD */
{ 0,
WLAN_CFG_RX_RING_MASK_0,
WLAN_CFG_RX_RING_MASK_1,
WLAN_CFG_RX_RING_MASK_2,
WLAN_CFG_RX_RING_MASK_3,
0, 0,
WLAN_CFG_RX_RING_MASK_4,
WLAN_CFG_RX_RING_MASK_5,
WLAN_CFG_RX_RING_MASK_6,
0},
#endif /* IPA_OFFLOAD */
#else /* CONFIG_BERYLLIUM */
#ifdef IPA_OFFLOAD
{ 0,
WLAN_CFG_RX_RING_MASK_0,
WLAN_CFG_RX_RING_MASK_1,
WLAN_CFG_RX_RING_MASK_2,
0, 0, 0},
#else /* IPA_OFFLOAD */
{ 0,
WLAN_CFG_RX_RING_MASK_0,
WLAN_CFG_RX_RING_MASK_1,
WLAN_CFG_RX_RING_MASK_2,
WLAN_CFG_RX_RING_MASK_3,
0, 0},
#endif /* IPA_OFFLOAD */
static const uint8_t tx_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
[0] = WLAN_CFG_TX_RING_MASK_0, [1] = WLAN_CFG_TX_RING_MASK_5,
[2] = WLAN_CFG_TX_RING_MASK_6};
#else
static const uint8_t tx_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
[0] = WLAN_CFG_TX_RING_MASK_0, [1] = WLAN_CFG_TX_RING_MASK_4,
[2] = WLAN_CFG_TX_RING_MASK_2, [3] = WLAN_CFG_TX_RING_MASK_5,
[4] = WLAN_CFG_TX_RING_MASK_6};
#endif
#else
static const uint8_t tx_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
WLAN_CFG_TX_RING_MASK_0, 0, 0, 0, 0, 0, 0};
#endif /* CONFIG_BERYLLIUM */
/* rx mon ring masks */
{ 0,
WLAN_CFG_RX_MON_RING_MASK_0,
WLAN_CFG_RX_MON_RING_MASK_1,
0, 0, 0, 0},
/* host2rxdma ring masks */
{ 0, 0, 0, 0, 0, 0, 0},
/* rxdma2host ring masks */
{ 0, 0, 0, 0, 0,
WLAN_CFG_RXDMA2HOST_RING_MASK_0,
WLAN_CFG_RXDMA2HOST_RING_MASK_1 },
/* host2rxdma mon ring masks */
{ 0, 0, 0, 0, 0, 0, 0},
/* rxdma2host mon ring masks */
{ 0, 0, 0, 0, 0, 0, 0},
/* rx err ring masks */
{ 0, 0, 0, 0, 0, 0,
WLAN_CFG_RX_ERR_RING_MASK_0},
/* rx wbm rel ring masks */
{ 0, 0, 0, 0, 0, 0,
WLAN_CFG_RX_WBM_REL_RING_MASK_0},
/* reo status ring masks */
{ 0, 0, 0, 0, 0, 0,
WLAN_CFG_REO_STATUS_RING_MASK_0},
#ifdef CONFIG_BERYLLIUM
/* rx near full irq1 mask */
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
WLAN_CFG_RX_NEAR_FULL_IRQ_MASK_1,
0, 0},
/* rx near full irq2 mask */
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0,
WLAN_CFG_RX_NEAR_FULL_IRQ_MASK_2,
0},
/* tx near full irq mask */
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0,
WLAN_CFG_TX_RING_NEAR_FULL_IRQ_MASK},
#else /* CONFIG_BERYLLIUM */
/* rx near full irq1 mask */
{ 0, 0, 0, 0, 0, 0, 0},
/* rx near full irq2 mask */
{ 0, 0, 0, 0, 0, 0, 0},
/* tx near full irq mask */
{ 0, 0, 0, 0, 0, 0, 0},
#ifdef IPA_OFFLOAD
static const uint8_t rx_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
[5] = WLAN_CFG_RX_RING_MASK_0, [6] = WLAN_CFG_RX_RING_MASK_1,
[7] = WLAN_CFG_RX_RING_MASK_2, [9] = WLAN_CFG_RX_RING_MASK_4,
[10] = WLAN_CFG_RX_RING_MASK_5, [11] = WLAN_CFG_RX_RING_MASK_6};
#else
static const uint8_t rx_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
[5] = WLAN_CFG_RX_RING_MASK_0, [6] = WLAN_CFG_RX_RING_MASK_1,
[7] = WLAN_CFG_RX_RING_MASK_2, [8] = WLAN_CFG_RX_RING_MASK_3,
[9] = WLAN_CFG_RX_RING_MASK_4, [10] = WLAN_CFG_RX_RING_MASK_5,
[11] = WLAN_CFG_RX_RING_MASK_6, [12] = WLAN_CFG_RX_RING_MASK_7};
#endif /* IPA_OFFLOAD */
#else /* !defined(CONFIG_BERYLLIUM) */
#ifdef IPA_OFFLOAD
static const uint8_t rx_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
0, WLAN_CFG_RX_RING_MASK_0, WLAN_CFG_RX_RING_MASK_1,
WLAN_CFG_RX_RING_MASK_2, 0, 0, 0};
#else
static const uint8_t rx_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
0, WLAN_CFG_RX_RING_MASK_0, WLAN_CFG_RX_RING_MASK_1,
WLAN_CFG_RX_RING_MASK_2, WLAN_CFG_RX_RING_MASK_3, 0, 0};
#endif
#endif /* CONFIG_BERYLLIUM */
},
#ifdef CONFIG_BERYLLIUM
static const uint8_t rxdma2host_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
[13] = WLAN_CFG_RXDMA2HOST_RING_MASK_0 |
WLAN_CFG_RXDMA2HOST_RING_MASK_1};
#else
static const uint8_t rxdma2host_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
0, 0, 0, 0, 0, WLAN_CFG_RXDMA2HOST_RING_MASK_0,
WLAN_CFG_RXDMA2HOST_RING_MASK_1};
#endif /* CONFIG_BERYLLIUM */
static const uint8_t rx_mon_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
[1] = WLAN_CFG_RX_MON_RING_MASK_0,
[2] = WLAN_CFG_RX_MON_RING_MASK_1};
static const uint8_t host2rxdma_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {0};
static const uint8_t host2rxdma_mon_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {0};
static const uint8_t rxdma2host_mon_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {0};
#ifdef CONFIG_BERYLLIUM
static const uint8_t rx_err_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
[14] = WLAN_CFG_RX_ERR_RING_MASK_0};
static const uint8_t rx_wbm_rel_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
[14] = WLAN_CFG_RX_WBM_REL_RING_MASK_0};
static const uint8_t reo_status_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
[13] = WLAN_CFG_REO_STATUS_RING_MASK_0};
#else
static const uint8_t rx_err_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
0, 0, 0, 0, 0, 0, WLAN_CFG_RX_ERR_RING_MASK_0};
static const uint8_t rx_wbm_rel_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
0, 0, 0, 0, 0, 0, WLAN_CFG_RX_WBM_REL_RING_MASK_0};
static const uint8_t reo_status_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
0, 0, 0, 0, 0, 0, WLAN_CFG_REO_STATUS_RING_MASK_0};
#endif
#ifdef CONFIG_BERYLLIUM
#ifdef WLAN_FEATURE_NEAR_FULL_IRQ
static const uint8_t rx_ring_near_full_irq_1_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
[15] = WLAN_CFG_RX_NEAR_FULL_IRQ_MASK_1};
static const uint8_t rx_ring_near_full_irq_2_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
[16] = WLAN_CFG_RX_NEAR_FULL_IRQ_MASK_1};
static const uint8_t tx_ring_near_full_irq_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
[17] = WLAN_CFG_TX_RING_NEAR_FULL_IRQ_MASK};
#else
static const uint8_t rx_ring_near_full_irq_1_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
0 };
static const uint8_t rx_ring_near_full_irq_2_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
0 };
static const uint8_t tx_ring_near_full_irq_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
0 };
#endif
#else
static const uint8_t rx_ring_near_full_irq_1_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
0 };
static const uint8_t rx_ring_near_full_irq_2_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
0 };
static const uint8_t tx_ring_near_full_irq_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
0 };
#endif
#ifdef CONFIG_BERYLLIUM
#ifdef IPA_OFFLOAD
struct wlan_cfg_tcl_wbm_ring_num_map tcl_wbm_map_array[MAX_TCL_DATA_RINGS] = {
{.tcl_ring_num = 0, .wbm_ring_num = 0, .for_ipa = 0},
{1, 4, 1}, /* For IPA */
{2, 2, 1}, /* For IPA */
{3, 5, 0},
{4, 6, 0},
};
#else
struct wlan_cfg_tcl_wbm_ring_num_map tcl_wbm_map_array[MAX_TCL_DATA_RINGS] = {
{.tcl_ring_num = 0, .wbm_ring_num = 0, .for_ipa = 0},
{1, 4, 0},
{2, 2, 0},
{3, 5, 0},
{4, 6, 0},
};
#endif /* IPA_OFFLOAD */
#else
struct wlan_cfg_tcl_wbm_ring_num_map tcl_wbm_map_array[MAX_TCL_DATA_RINGS] = {
{.tcl_ring_num = 0, .wbm_ring_num = 0, .for_ipa = 0},
{1, 4, 1}, /* For IPA */
{2, 2, 1}, /* For IPA */
};
#endif
#else
/* Integrated configuration + 8 possible MSI configurations */
@@ -791,6 +826,14 @@ static struct dp_int_mask_assignment dp_mask_assignment[NUM_INTERRUPT_COMBINATIO
0, 0, 0, 0},
},
};
struct wlan_cfg_tcl_wbm_ring_num_map tcl_wbm_map_array[MAX_TCL_DATA_RINGS] = {
{0, 0, 0},
{1, 1, 0},
{2, 2, 0},
{3, 3, 0},
{4, 4, 0},
};
#endif
/**
@@ -877,20 +920,54 @@ static const uint8_t rx_fst_toeplitz_key[WLAN_CFG_RX_FST_TOEPLITZ_KEYLEN] = {
0x6a, 0x42, 0xb7, 0x3b, 0xbe, 0xac, 0x01, 0xfa
};
/**
* wlan_cfg_fill_interrupt_mask() - set interrupt mask
*
* @wlan_cfg_dp_soc_ctxt: soc configuration context
* @num_dp_msi: Number of DP interrupts available (0 for integrated)
* @interrupt_mode: Type of interrupt
* @is_monitor_mode: is monitor mode enabled
*
* Return: void
*/
#if defined(WLAN_MAX_PDEVS) && (WLAN_MAX_PDEVS == 1)
void wlan_cfg_fill_interrupt_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx,
int num_dp_msi,
int interrupt_mode,
bool is_monitor_mode)
{ int i = 0;
for (i = 0; i < WLAN_CFG_INT_NUM_CONTEXTS; i++) {
wlan_cfg_ctx->int_tx_ring_mask[i] = tx_ring_mask_msi[i];
wlan_cfg_ctx->int_rx_mon_ring_mask[i] =
rx_mon_ring_mask_msi[i];
wlan_cfg_ctx->int_rx_err_ring_mask[i] =
rx_err_ring_mask_msi[i];
wlan_cfg_ctx->int_rx_wbm_rel_ring_mask[i] =
rx_wbm_rel_ring_mask_msi[i];
wlan_cfg_ctx->int_reo_status_ring_mask[i] =
reo_status_ring_mask_msi[i];
if (is_monitor_mode) {
wlan_cfg_ctx->int_rx_ring_mask[i] = 0;
wlan_cfg_ctx->int_rxdma2host_ring_mask[i] = 0;
} else {
wlan_cfg_ctx->int_rx_ring_mask[i] =
rx_ring_mask_msi[i];
wlan_cfg_ctx->int_rxdma2host_ring_mask[i] =
rxdma2host_ring_mask_msi[i];
}
wlan_cfg_ctx->int_host2rxdma_ring_mask[i] =
host2rxdma_ring_mask_msi[i];
wlan_cfg_ctx->int_host2rxdma_mon_ring_mask[i] =
host2rxdma_mon_ring_mask_msi[i];
wlan_cfg_ctx->int_rxdma2host_mon_ring_mask[i] =
rxdma2host_mon_ring_mask_msi[i];
wlan_cfg_ctx->int_rx_ring_near_full_irq_1_mask[i] =
rx_ring_near_full_irq_1_mask_msi[i];
wlan_cfg_ctx->int_rx_ring_near_full_irq_2_mask[i] =
rx_ring_near_full_irq_2_mask_msi[i];
wlan_cfg_ctx->int_tx_ring_near_full_irq_mask[i] =
tx_ring_near_full_irq_mask_msi[i];
}
}
#else
void wlan_cfg_fill_interrupt_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx,
int num_dp_msi,
int interrupt_mode,
bool is_monitor_mode) {
bool is_monitor_mode)
{
int i = 0;
int interrupt_index = 0;
@@ -903,7 +980,6 @@ void wlan_cfg_fill_interrupt_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx,
qdf_err("Interrupt mode %d", interrupt_mode);
}
for (i = 0; i < WLAN_CFG_INT_NUM_CONTEXTS; i++) {
wlan_cfg_ctx->int_tx_ring_mask[i] =
dp_mask_assignment[interrupt_index].tx_ring_mask[i];
@@ -938,6 +1014,7 @@ void wlan_cfg_fill_interrupt_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx,
dp_mask_assignment[interrupt_index].tx_ring_near_full_irq_mask[i];
}
}
#endif
#ifdef IPA_OFFLOAD
/**
@@ -1401,6 +1478,12 @@ int wlan_cfg_get_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
return cfg->int_tx_ring_mask[context];
}
void wlan_cfg_get_tcl_wbm_ring_num_for_index(int index, int *tcl, int *wbm)
{
*tcl = tcl_wbm_map_array[index].tcl_ring_num;
*wbm = tcl_wbm_map_array[index].wbm_ring_num;
}
int wlan_cfg_get_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
{
return cfg->int_rx_ring_mask[context];