qcacmn: Support for configuring 2nd MAC

Add support to configure the second LMAC ring
which is needed for DBS.

Change-Id: Idb055621d174c994e267dc6dcca2bc798ae79bfc
CRs-Fixed: 1116939
This commit is contained in:
Dhanashri Atre
2017-01-17 15:05:41 -08:00
committed by qcabuildsw
parent 8b3f377928
commit d4032abf27
7 changed files with 207 additions and 42 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
* Copyright (c) 2011-2017 The Linux Foundation. All rights reserved.
*
*
* Permission to use, copy, modify, and/or distribute this software for
@@ -490,7 +490,7 @@ struct ol_if_ops {
uint8_t vdev_id, uint8_t *peer_macaddr,
uint32_t tid_mask);
int (*peer_unref_delete)(void *ol_soc_handle);
bool (*is_hw_dbs_2x2_capable)(void);
/* TODO: Add any other control path calls required to OL_IF/WMA layer */
};

View File

@@ -223,13 +223,13 @@ static int htt_h2t_ver_req_msg(struct htt_soc *soc)
/*
* htt_srng_setup() - Send SRNG setup message to target
* @htt_soc: HTT SOC handle
* @pdev_id: PDEV Id
* @mac_id: MAC Id
* @hal_srng: Opaque HAL SRNG pointer
* @hal_ring_type: SRNG ring type
*
* Return: 0 on success; error code on failure
*/
int htt_srng_setup(void *htt_soc, int pdev_id, void *hal_srng,
int htt_srng_setup(void *htt_soc, int mac_id, void *hal_srng,
int hal_ring_type)
{
struct htt_soc *soc = (struct htt_soc *)htt_soc;
@@ -258,8 +258,8 @@ int htt_srng_setup(void *htt_soc, int pdev_id, void *hal_srng,
switch (hal_ring_type) {
case RXDMA_BUF:
switch (srng_params.ring_id) {
case HAL_SRNG_WMAC1_SW2RXDMA0_BUF:
if (srng_params.ring_id ==
HAL_SRNG_WMAC1_SW2RXDMA0_BUF) {
#ifdef QCA_HOST2FW_RXBUF_RING
htt_ring_id = HTT_HOST1_TO_FW_RXBUF_RING;
htt_ring_type = HTT_SW_TO_SW_RING;
@@ -267,25 +267,26 @@ int htt_srng_setup(void *htt_soc, int pdev_id, void *hal_srng,
htt_ring_id = HTT_RXDMA_HOST_BUF_RING;
htt_ring_type = HTT_SW_TO_HW_RING;
#endif
break;
case HAL_SRNG_WMAC1_SW2RXDMA1_BUF:
} else if (srng_params.ring_id ==
(HAL_SRNG_WMAC1_SW2RXDMA1_BUF +
(mac_id * HAL_MAX_RINGS_PER_LMAC))) {
htt_ring_id = HTT_RXDMA_HOST_BUF_RING;
htt_ring_type = HTT_SW_TO_HW_RING;
break;
default:
} else {
QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
"%s: Ring %d currently not supported\n",
__func__, srng_params.ring_id);
goto fail1;
}
QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
"%s: ring_type %d ring_id %d\n",
__func__, hal_ring_type, srng_params.ring_id);
QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
"hp_addr 0x%llx tp_addr 0x%llx\n",
(uint64_t)hp_addr, (uint64_t)tp_addr);
"%s: hp_addr 0x%llx tp_addr 0x%llx\n",
__func__, (uint64_t)hp_addr, (uint64_t)tp_addr);
QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
"htt_ring_id %d\n", htt_ring_id);
"%s: htt_ring_id %d\n", __func__, htt_ring_id);
break;
case RXDMA_MONITOR_BUF:
htt_ring_id = HTT_RXDMA_MONITOR_BUF_RING;
@@ -327,7 +328,9 @@ int htt_srng_setup(void *htt_soc, int pdev_id, void *hal_srng,
/* word 0 */
*msg_word = 0;
HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_SRING_SETUP);
HTT_SRING_SETUP_PDEV_ID_SET(*msg_word, pdev_id);
HTT_SRING_SETUP_PDEV_ID_SET(*msg_word, mac_id);
QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
"%s: mac_id %d\n", __func__, mac_id);
HTT_SRING_SETUP_RING_TYPE_SET(*msg_word, htt_ring_type);
/* TODO: Discuss with FW on changing this to unique ID and using
* htt_ring_type to send the type of ring
@@ -352,6 +355,15 @@ int htt_srng_setup(void *htt_soc, int pdev_id, void *hal_srng,
HTT_SRING_SETUP_ENTRY_SIZE_SET(*msg_word, ring_entry_size);
HTT_SRING_SETUP_RING_SIZE_SET(*msg_word,
(ring_entry_size * srng_params.num_entries));
QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
"%s: entry_size %d\n", __func__,
ring_entry_size);
QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
"%s: num_entries %d\n", __func__,
srng_params.num_entries);
QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
"%s: ring_size %d\n", __func__,
(ring_entry_size * srng_params.num_entries));
if (htt_ring_type == HTT_SW_TO_HW_RING)
HTT_SRING_SETUP_RING_MISC_CFG_FLAG_LOOPCOUNT_DISABLE_SET(
*msg_word, 1);

View File

@@ -35,7 +35,7 @@
* dp_setup_srng - Internal function to setup SRNG rings used by data path
*/
static int dp_srng_setup(struct dp_soc *soc, struct dp_srng *srng,
int ring_type, int ring_num, int pdev_id, uint32_t num_entries)
int ring_type, int ring_num, int mac_id, uint32_t num_entries)
{
void *hal_soc = soc->hal_soc;
uint32_t entry_size = hal_srng_get_entrysize(hal_soc, ring_type);
@@ -92,7 +92,7 @@ static int dp_srng_setup(struct dp_soc *soc, struct dp_srng *srng,
}
srng->hal_srng = hal_srng_setup(hal_soc, ring_type, ring_num,
pdev_id, &ring_params);
mac_id, &ring_params);
return 0;
}
@@ -696,7 +696,8 @@ static void dp_hw_link_desc_pool_cleanup(struct dp_soc *soc)
#define REO_EXCEPTION_RING_SIZE 128
#define REO_CMD_RING_SIZE 32
#define REO_STATUS_RING_SIZE 32
#define RXDMA_BUF_RING_SIZE 2048
#define RXDMA_BUF_RING_SIZE 1024
#define RXDMA_REFILL_RING_SIZE 2048
#define RXDMA_MONITOR_BUF_RING_SIZE 2048
#define RXDMA_MONITOR_DST_RING_SIZE 2048
#define RXDMA_MONITOR_STATUS_RING_SIZE 2048
@@ -866,6 +867,43 @@ fail0:
static void dp_pdev_detach_wifi3(void *txrx_pdev, int force);
/*
* dp_rxdma_ring_setup() - configure the RX DMA rings
* @soc: data path SoC handle
* @pdev: Physical device handle
*
* Return: 0 - success, > 0 - failure
*/
#ifdef QCA_HOST2FW_RXBUF_RING
static int dp_rxdma_ring_setup(struct dp_soc *soc,
struct dp_pdev *pdev)
{
int max_mac_rings =
wlan_cfg_get_num_mac_rings
(pdev->wlan_cfg_ctx);
int i;
for (i = 0; i < max_mac_rings; i++) {
QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
"%s: pdev_id %d mac_id %d\n",
__func__, pdev->pdev_id, i);
if (dp_srng_setup(soc, &pdev->rx_mac_buf_ring[i],
RXDMA_BUF, 1, i, RXDMA_BUF_RING_SIZE)) {
QDF_TRACE(QDF_MODULE_ID_DP,
QDF_TRACE_LEVEL_ERROR,
FL("failed rx mac ring setup"));
return QDF_STATUS_E_FAILURE;
}
}
return QDF_STATUS_SUCCESS;
}
#else
static int dp_rxdma_ring_setup(struct dp_soc *soc,
struct dp_pdev *pdev)
{
return QDF_STATUS_SUCCESS;
}
#endif
/*
* dp_pdev_attach_wifi3() - attach txrx pdev
* @osif_pdev: Opaque PDEV handle from OSIF/HDD
@@ -949,22 +987,18 @@ static void *dp_pdev_attach_wifi3(struct cdp_soc_t *txrx_soc, void *ctrl_pdev,
}
if (dp_srng_setup(soc, &pdev->rx_refill_buf_ring, RXDMA_BUF, 0, pdev_id,
RXDMA_BUF_RING_SIZE)) {
RXDMA_REFILL_RING_SIZE)) {
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
FL("dp_srng_setup failed rx refill ring"));
goto fail1;
}
#ifdef QCA_HOST2FW_RXBUF_RING
if (dp_srng_setup(soc, &pdev->rx_mac_buf_ring, RXDMA_BUF, 1, pdev_id,
RXDMA_BUF_RING_SIZE)) {
if (dp_rxdma_ring_setup(soc, pdev)) {
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
FL("dp_srng_setup failed rx mac ring"));
FL("RXDMA ring config failed"));
goto fail1;
}
#endif
/* TODO: RXDMA destination ring is not planned to be used currently.
* Setup the ring when required
*/
if (dp_srng_setup(soc, &pdev->rxdma_mon_buf_ring, RXDMA_MONITOR_BUF, 0,
pdev_id, RXDMA_MONITOR_BUF_RING_SIZE)) {
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
@@ -1009,6 +1043,33 @@ fail0:
return NULL;
}
/*
* dp_rxdma_ring_cleanup() - configure the RX DMA rings
* @soc: data path SoC handle
* @pdev: Physical device handle
*
* Return: void
*/
#ifdef QCA_HOST2FW_RXBUF_RING
static void dp_rxdma_ring_cleanup(struct dp_soc *soc,
struct dp_pdev *pdev)
{
int max_mac_rings =
wlan_cfg_get_num_mac_rings(pdev->wlan_cfg_ctx);
int i;
max_mac_rings = max_mac_rings < MAX_RX_MAC_RINGS ?
max_mac_rings : MAX_RX_MAC_RINGS;
for (i = 0; i < MAX_RX_MAC_RINGS; i++)
dp_srng_cleanup(soc, &pdev->rx_mac_buf_ring[i],
RXDMA_BUF, 1);
}
#else
static void dp_rxdma_ring_cleanup(struct dp_soc *soc,
struct dp_pdev *pdev)
{
}
#endif
/*
* dp_pdev_detach_wifi3() - detach txrx pdev
* @txrx_pdev: Datapath PDEV handle
@@ -1039,9 +1100,8 @@ static void dp_pdev_detach_wifi3(void *txrx_pdev, int force)
dp_srng_cleanup(soc, &pdev->rx_refill_buf_ring, RXDMA_BUF, 0);
#ifdef QCA_HOST2FW_RXBUF_RING
dp_srng_cleanup(soc, &pdev->rx_mac_buf_ring, RXDMA_BUF, 1);
#endif
dp_rxdma_ring_cleanup(soc, pdev);
dp_srng_cleanup(soc, &pdev->rxdma_mon_buf_ring, RXDMA_MONITOR_BUF, 0);
dp_srng_cleanup(soc, &pdev->rxdma_mon_dst_ring, RXDMA_MONITOR_DST, 0);
@@ -1133,6 +1193,69 @@ static void dp_soc_detach_wifi3(void *txrx_soc)
htt_soc_detach(soc->htt_handle);
}
/*
* dp_rxdma_ring_config() - configure the RX DMA rings
*
* This function is used to configure the MAC rings.
* On MCL host provides buffers in Host2FW ring
* FW refills (copies) buffers to the ring and updates
* ring_idx in register
*
* @soc: data path SoC handle
* @pdev: Physical device handle
*
* Return: void
*/
#ifdef QCA_HOST2FW_RXBUF_RING
static void dp_rxdma_ring_config(struct dp_soc *soc,
struct dp_pdev *pdev)
{
int mac_id = 0;
int j;
int max_mac_rings =
wlan_cfg_get_num_mac_rings
(pdev->wlan_cfg_ctx);
max_mac_rings =
max_mac_rings < MAX_RX_MAC_RINGS ?
max_mac_rings : MAX_RX_MAC_RINGS;
if (!soc->cdp_soc.ol_ops->
is_hw_dbs_2x2_capable()) {
max_mac_rings = 1;
QDF_TRACE(QDF_MODULE_ID_TXRX,
QDF_TRACE_LEVEL_ERROR,
FL("DBS enabled, max_mac_rings %d\n"),
max_mac_rings);
} else {
QDF_TRACE(QDF_MODULE_ID_TXRX,
QDF_TRACE_LEVEL_ERROR,
FL("DBS disabled max_mac_rings %d\n"),
max_mac_rings);
}
QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
FL("pdev_id %d max_mac_rings %d\n"),
pdev->pdev_id, max_mac_rings);
for (j = 0; j < max_mac_rings; j++) {
QDF_TRACE(QDF_MODULE_ID_TXRX,
QDF_TRACE_LEVEL_ERROR,
FL("mac_id %d\n"), mac_id);
htt_srng_setup(soc->htt_handle, mac_id,
pdev->rx_mac_buf_ring[j]
.hal_srng,
RXDMA_BUF);
mac_id++;
}
}
#else
static void dp_rxdma_ring_config(struct dp_soc *soc,
struct dp_pdev *pdev)
{
}
#endif
/*
* dp_soc_attach_target_wifi3() - SOC initialization in the target
* @txrx_soc: Datapath SOC handle
@@ -1140,19 +1263,19 @@ static void dp_soc_detach_wifi3(void *txrx_soc)
static int dp_soc_attach_target_wifi3(struct cdp_soc_t *cdp_soc)
{
struct dp_soc *soc = (struct dp_soc *)cdp_soc;
int i;
int i; /* variable to track the pdev number */
htt_soc_attach_target(soc->htt_handle);
for (i = 0; i < MAX_PDEV_CNT; i++) {
struct dp_pdev *pdev = soc->pdev_list[i];
if (pdev) {
htt_srng_setup(soc->htt_handle, i,
pdev->rx_refill_buf_ring.hal_srng, RXDMA_BUF);
#ifdef QCA_HOST2FW_RXBUF_RING
htt_srng_setup(soc->htt_handle, i,
pdev->rx_mac_buf_ring.hal_srng, RXDMA_BUF);
#endif
dp_rxdma_ring_config(soc, pdev);
#ifdef notyet /* FW doesn't handle monitor rings yet */
htt_srng_setup(soc->htt_handle, i,
pdev->rxdma_mon_buf_ring.hal_srng,

View File

@@ -34,7 +34,11 @@
#include <hal_tx.h>
#include <hal_reo.h>
#if defined(CONFIG_MCL)
#define MAX_PDEV_CNT 1
#else
#define MAX_PDEV_CNT 3
#endif
#define MAX_LINK_DESC_BANKS 8
#define MAX_TXDESC_POOLS 4
#define MAX_RXDESC_POOLS 4
@@ -445,6 +449,7 @@ struct dp_soc {
#endif
};
#define MAX_RX_MAC_RINGS 2
/* PDEV level structure for data path */
struct dp_pdev {
@@ -461,7 +466,7 @@ struct dp_pdev {
struct dp_srng rx_refill_buf_ring;
/* Empty ring used by firmware to post rx buffers to the MAC */
struct dp_srng rx_mac_buf_ring;
struct dp_srng rx_mac_buf_ring[MAX_RX_MAC_RINGS];
/* wlan_cfg pdev ctxt*/
struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_ctx;

View File

@@ -998,6 +998,10 @@ void *hal_srng_setup(void *hal_soc, int ring_type, int ring_num,
if (ring_id < 0)
return NULL;
QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
"%s: mac_id %d ring_id %d\n",
__func__, mac_id, ring_id);
srng = hal_get_srng(hal_soc, ring_id);
if (srng->initialized) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016 The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -72,6 +72,12 @@
#define WLAN_CFG_HTT_PKT_TYPE 2
#define WLAN_CFG_MAX_PEER_ID 16
#ifdef CONFIG_MCL
#define NUM_RXDMA_RINGS_PER_PDEV 2
#else
#define NUM_RXDMA_RINGS_PER_PDEV 1
#endif
static const int tx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
WLAN_CFG_TX_RING_MASK_0,
WLAN_CFG_TX_RING_MASK_1,
@@ -146,6 +152,7 @@ struct wlan_cfg_dp_pdev_ctxt {
int dma_mon_buf_ring_size;
int dma_mon_dest_ring_size;
int dma_mon_status_ring_size;
int num_mac_rings;
};
/**
@@ -202,6 +209,7 @@ struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_pdev_attach(void)
wlan_cfg_ctx->dma_mon_buf_ring_size = RXDMA_MONITOR_BUF_RING_SIZE;
wlan_cfg_ctx->dma_mon_dest_ring_size = RXDMA_MONITOR_DEST_RING_SIZE;
wlan_cfg_ctx->dma_mon_status_ring_size = RXDMA_MONITOR_STATUS_RING_SIZE;
wlan_cfg_ctx->num_mac_rings = NUM_RXDMA_RINGS_PER_PDEV;
return wlan_cfg_ctx;
}
@@ -351,3 +359,8 @@ int wlan_cfg_get_rx_dma_buf_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
{
return cfg->rx_dma_buf_ring_size;
}
int wlan_cfg_get_num_mac_rings(struct wlan_cfg_dp_pdev_ctxt *cfg)
{
return cfg->num_mac_rings;
}

View File

@@ -276,4 +276,12 @@ int wlan_cfg_get_dma_mon_stat_ring_size(
int wlan_cfg_get_rx_dma_buf_ring_size(
struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_pdev_ctx);
/*
* wlan_cfg_get_num_mac_rings - Return the number of MAC RX DMA rings
* per pdev
* @wlan_cfg_pdev_ctx
*
* Return: number of mac DMA rings per pdev
*/
int wlan_cfg_get_num_mac_rings(struct wlan_cfg_dp_pdev_ctxt *cfg);
#endif