Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions drivers/net/wireless/ath/ath12k/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ ath12k_mem_profile_based_param ath12k_mem_profile_based_param[] = {
.rxdma_monitor_dst_ring_size = 8192,
.num_pool_tx_desc = 32768,
.rx_desc_count = 12288,
.rx_release_ring_size = 16384,
.rxdma_buf_ring_size = 8192,
},
},
[ATH12K_QMI_MEMORY_MODE_LOW_512_M] = {
Expand All @@ -65,6 +67,8 @@ ath12k_mem_profile_based_param ath12k_mem_profile_based_param[] = {
.rxdma_monitor_dst_ring_size = 512,
.num_pool_tx_desc = 16384,
.rx_desc_count = 6144,
.rx_release_ring_size = 8192,
.rxdma_buf_ring_size = 4096,
},
},
};
Expand Down
8 changes: 0 additions & 8 deletions drivers/net/wireless/ath/ath12k/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -936,14 +936,6 @@ struct ath12k_wsi_info {
u32 hw_link_id_base;
};

struct ath12k_dp_profile_params {
u32 tx_comp_ring_size;
u32 rxdma_monitor_buf_ring_size;
u32 rxdma_monitor_dst_ring_size;
u32 num_pool_tx_desc;
u32 rx_desc_count;
};

struct ath12k_mem_profile_based_param {
u32 num_vdevs;
u32 max_client_single;
Expand Down
80 changes: 49 additions & 31 deletions drivers/net/wireless/ath/ath12k/dp.c
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ static void ath12k_dp_srng_common_cleanup(struct ath12k_base *ab)

static int ath12k_dp_srng_common_setup(struct ath12k_base *ab)
{
const struct ath12k_dp_profile_params *dp_params = &ab->profile_param->dp_params;
struct ath12k_dp *dp = ath12k_ab_to_dp(ab);
const struct ath12k_hal_tcl_to_wbm_rbm_map *map;
struct hal_srng *srng;
Expand Down Expand Up @@ -470,7 +471,7 @@ static int ath12k_dp_srng_common_setup(struct ath12k_base *ab)

ret = ath12k_dp_srng_setup(ab, &dp->tx_ring[i].tcl_comp_ring,
HAL_WBM2SW_RELEASE, tx_comp_ring_num, 0,
DP_TX_COMP_RING_SIZE(ab));
ath12k_dp_tx_comp_ring_size(dp_params));
if (ret) {
ath12k_warn(ab, "failed to set up tcl_comp ring (%d) :%d\n",
tx_comp_ring_num, ret);
Expand All @@ -488,7 +489,7 @@ static int ath12k_dp_srng_common_setup(struct ath12k_base *ab)

ret = ath12k_dp_srng_setup(ab, &dp->rx_rel_ring, HAL_WBM2SW_RELEASE,
HAL_WBM2SW_REL_ERR_RING_NUM, 0,
DP_RX_RELEASE_RING_SIZE);
ath12k_dp_rx_release_ring_size(dp_params));
if (ret) {
ath12k_warn(ab, "failed to set up rx_rel ring :%d\n", ret);
goto err;
Expand Down Expand Up @@ -967,23 +968,26 @@ void ath12k_dp_vdev_tx_attach(struct ath12k *ar, struct ath12k_link_vif *arvif)

static void ath12k_dp_cc_cleanup(struct ath12k_base *ab)
{
struct ath12k_rx_desc_info *desc_info;
const struct ath12k_dp_profile_params *dp_params = &ab->profile_param->dp_params;
u32 pool_id, tx_spt_page, tx_spt_pages_per_pool, num_rx_spt_pages;
struct ath12k_tx_desc_info *tx_desc_info, *tmp1;
struct ath12k_dp *dp = ath12k_ab_to_dp(ab);
struct ath12k_rx_desc_info *desc_info;
struct ath12k_skb_cb *skb_cb;
struct sk_buff *skb;
struct ath12k *ar;
int i, j;
u32 pool_id, tx_spt_page;

if (!dp->spt_info)
return;

/* RX Descriptor cleanup */
spin_lock_bh(&dp->rx_desc_lock);

num_rx_spt_pages = ath12k_dp_num_rx_spt_pages(dp_params);

if (dp->rxbaddr) {
for (i = 0; i < ATH12K_NUM_RX_SPT_PAGES(ab); i++) {
for (i = 0; i < num_rx_spt_pages; i++) {
if (!dp->rxbaddr[i])
continue;

Expand Down Expand Up @@ -1056,12 +1060,13 @@ static void ath12k_dp_cc_cleanup(struct ath12k_base *ab)
}

if (dp->txbaddr) {
tx_spt_pages_per_pool = ath12k_dp_tx_spt_pages_per_pool(dp_params);

for (pool_id = 0; pool_id < ATH12K_HW_MAX_QUEUES; pool_id++) {
spin_lock_bh(&dp->tx_desc_lock[pool_id]);

for (i = 0; i < ATH12K_TX_SPT_PAGES_PER_POOL(ab); i++) {
tx_spt_page = i + pool_id *
ATH12K_TX_SPT_PAGES_PER_POOL(ab);
for (i = 0; i < tx_spt_pages_per_pool; i++) {
tx_spt_page = i + pool_id * tx_spt_pages_per_pool;
if (!dp->txbaddr[tx_spt_page])
continue;

Expand Down Expand Up @@ -1155,14 +1160,16 @@ static void *ath12k_dp_cc_get_desc_addr_ptr(struct ath12k_dp *dp,
struct ath12k_rx_desc_info *ath12k_dp_get_rx_desc(struct ath12k_dp *dp,
u32 cookie)
{
const struct ath12k_dp_profile_params *dp_params;
struct ath12k_rx_desc_info **desc_addr_ptr;
u16 start_ppt_idx, end_ppt_idx, ppt_idx, spt_idx;

ppt_idx = u32_get_bits(cookie, ATH12K_DP_CC_COOKIE_PPT);
spt_idx = u32_get_bits(cookie, ATH12K_DP_CC_COOKIE_SPT);
dp_params = &dp->ab->profile_param->dp_params;

start_ppt_idx = dp->rx_ppt_base + ATH12K_RX_SPT_PAGE_OFFSET(dp->ab);
end_ppt_idx = start_ppt_idx + ATH12K_NUM_RX_SPT_PAGES(dp->ab);
start_ppt_idx = dp->rx_ppt_base + ath12k_dp_rx_spt_page_offset(dp_params);
end_ppt_idx = start_ppt_idx + ath12k_dp_num_rx_spt_pages(dp_params);

if (ppt_idx < start_ppt_idx ||
ppt_idx >= end_ppt_idx ||
Expand All @@ -1179,15 +1186,16 @@ EXPORT_SYMBOL(ath12k_dp_get_rx_desc);
struct ath12k_tx_desc_info *ath12k_dp_get_tx_desc(struct ath12k_dp *dp,
u32 cookie)
{
const struct ath12k_dp_profile_params *dp_params;
struct ath12k_tx_desc_info **desc_addr_ptr;
u16 start_ppt_idx, end_ppt_idx, ppt_idx, spt_idx;

ppt_idx = u32_get_bits(cookie, ATH12K_DP_CC_COOKIE_PPT);
spt_idx = u32_get_bits(cookie, ATH12K_DP_CC_COOKIE_SPT);
dp_params = &dp->ab->profile_param->dp_params;

start_ppt_idx = ATH12K_TX_SPT_PAGE_OFFSET;
end_ppt_idx = start_ppt_idx +
(ATH12K_TX_SPT_PAGES_PER_POOL(dp->ab) * ATH12K_HW_MAX_QUEUES);
end_ppt_idx = start_ppt_idx + ath12k_dp_num_tx_spt_pages(dp_params);

if (ppt_idx < start_ppt_idx ||
ppt_idx >= end_ppt_idx ||
Expand All @@ -1202,12 +1210,13 @@ EXPORT_SYMBOL(ath12k_dp_get_tx_desc);

static int ath12k_dp_cc_desc_init(struct ath12k_base *ab)
{
struct ath12k_dp *dp = ath12k_ab_to_dp(ab);
const struct ath12k_dp_profile_params *dp_params = &ab->profile_param->dp_params;
u32 num_rx_spt_pages = ath12k_dp_num_rx_spt_pages(dp_params);
struct ath12k_rx_desc_info *rx_descs, **rx_desc_addr;
struct ath12k_tx_desc_info *tx_descs, **tx_desc_addr;
u32 num_rx_spt_pages = ATH12K_NUM_RX_SPT_PAGES(ab);
u32 i, j, pool_id, tx_spt_page;
u32 ppt_idx, cookie_ppt_idx;
u32 i, j, pool_id, tx_spt_page, tx_spt_pages_per_pool;
u32 ppt_idx, cookie_ppt_idx, rx_spt_page_offset;
struct ath12k_dp *dp = ath12k_ab_to_dp(ab);

spin_lock_bh(&dp->rx_desc_lock);

Expand All @@ -1219,9 +1228,9 @@ static int ath12k_dp_cc_desc_init(struct ath12k_base *ab)
return -ENOMEM;
}

/* First ATH12K_NUM_RX_SPT_PAGES(ab) of allocated SPT pages are used for
* RX
*/
rx_spt_page_offset = ath12k_dp_rx_spt_page_offset(dp_params);

/* First num_rx_spt_pages of allocated SPT pages are used for RX */
for (i = 0; i < num_rx_spt_pages; i++) {
rx_descs = kcalloc(ATH12K_MAX_SPT_ENTRIES, sizeof(*rx_descs),
GFP_ATOMIC);
Expand All @@ -1231,7 +1240,7 @@ static int ath12k_dp_cc_desc_init(struct ath12k_base *ab)
return -ENOMEM;
}

ppt_idx = ATH12K_RX_SPT_PAGE_OFFSET(ab) + i;
ppt_idx = rx_spt_page_offset + i;
cookie_ppt_idx = dp->rx_ppt_base + ppt_idx;
dp->rxbaddr[i] = &rx_descs[0];

Expand All @@ -1249,15 +1258,17 @@ static int ath12k_dp_cc_desc_init(struct ath12k_base *ab)

spin_unlock_bh(&dp->rx_desc_lock);

dp->txbaddr = kcalloc(ATH12K_NUM_TX_SPT_PAGES(ab),
dp->txbaddr = kcalloc(ath12k_dp_num_tx_spt_pages(dp_params),
sizeof(struct ath12k_tx_desc_info *), GFP_ATOMIC);

if (!dp->txbaddr)
return -ENOMEM;

tx_spt_pages_per_pool = ath12k_dp_tx_spt_pages_per_pool(dp_params);

for (pool_id = 0; pool_id < ATH12K_HW_MAX_QUEUES; pool_id++) {
spin_lock_bh(&dp->tx_desc_lock[pool_id]);
for (i = 0; i < ATH12K_TX_SPT_PAGES_PER_POOL(ab); i++) {
for (i = 0; i < tx_spt_pages_per_pool; i++) {
tx_descs = kcalloc(ATH12K_MAX_SPT_ENTRIES, sizeof(*tx_descs),
GFP_ATOMIC);

Expand All @@ -1267,8 +1278,7 @@ static int ath12k_dp_cc_desc_init(struct ath12k_base *ab)
return -ENOMEM;
}

tx_spt_page = i + pool_id *
ATH12K_TX_SPT_PAGES_PER_POOL(ab);
tx_spt_page = i + pool_id * tx_spt_pages_per_pool;
ppt_idx = ATH12K_TX_SPT_PAGE_OFFSET + tx_spt_page;

dp->txbaddr[tx_spt_page] = &tx_descs[0];
Expand All @@ -1294,6 +1304,7 @@ static int ath12k_dp_cmem_init(struct ath12k_base *ab,
struct ath12k_dp *dp,
enum ath12k_dp_desc_type type)
{
const struct ath12k_dp_profile_params *dp_params = &ab->profile_param->dp_params;
u32 cmem_base;
int i, start, end;

Expand All @@ -1302,12 +1313,12 @@ static int ath12k_dp_cmem_init(struct ath12k_base *ab,
switch (type) {
case ATH12K_DP_TX_DESC:
start = ATH12K_TX_SPT_PAGE_OFFSET;
end = start + ATH12K_NUM_TX_SPT_PAGES(ab);
end = start + ath12k_dp_num_tx_spt_pages(dp_params);
break;
case ATH12K_DP_RX_DESC:
cmem_base += ATH12K_PPT_ADDR_OFFSET(dp->rx_ppt_base);
start = ATH12K_RX_SPT_PAGE_OFFSET(ab);
end = start + ATH12K_NUM_RX_SPT_PAGES(ab);
start = ath12k_dp_rx_spt_page_offset(dp_params);
end = start + ath12k_dp_num_rx_spt_pages(dp_params);
break;
default:
ath12k_err(ab, "invalid descriptor type %d in cmem init\n", type);
Expand Down Expand Up @@ -1337,7 +1348,10 @@ void ath12k_dp_partner_cc_init(struct ath12k_base *ab)

static u32 ath12k_dp_get_num_spt_pages(struct ath12k_base *ab)
{
return ATH12K_NUM_RX_SPT_PAGES(ab) + ATH12K_NUM_TX_SPT_PAGES(ab);
const struct ath12k_dp_profile_params *dp_params = &ab->profile_param->dp_params;

return ath12k_dp_num_rx_spt_pages(dp_params) +
ath12k_dp_num_tx_spt_pages(dp_params);
}

static int ath12k_dp_cc_init(struct ath12k_base *ab)
Expand Down Expand Up @@ -1366,7 +1380,8 @@ static int ath12k_dp_cc_init(struct ath12k_base *ab)
return -ENOMEM;
}

dp->rx_ppt_base = ab->device_id * ATH12K_NUM_RX_SPT_PAGES(ab);
dp->rx_ppt_base = ab->device_id *
ath12k_dp_num_rx_spt_pages(&ab->profile_param->dp_params);

for (i = 0; i < dp->num_spt_pages; i++) {
dp->spt_info[i].vaddr = dma_alloc_coherent(ab->dev,
Expand Down Expand Up @@ -1466,6 +1481,7 @@ static int ath12k_dp_reoq_lut_setup(struct ath12k_base *ab)

static int ath12k_dp_setup(struct ath12k_base *ab)
{
const struct ath12k_dp_profile_params *dp_params;
struct ath12k_dp *dp;
struct hal_srng *srng = NULL;
size_t size = 0;
Expand All @@ -1475,6 +1491,7 @@ static int ath12k_dp_setup(struct ath12k_base *ab)

dp = ath12k_ab_to_dp(ab);
dp->ab = ab;
dp_params = &ab->profile_param->dp_params;

INIT_LIST_HEAD(&dp->reo_cmd_list);
INIT_LIST_HEAD(&dp->reo_cmd_cache_flush_list);
Expand Down Expand Up @@ -1529,7 +1546,7 @@ static int ath12k_dp_setup(struct ath12k_base *ab)
goto fail_dp_bank_profiles_cleanup;

size = ab->hal.hal_wbm_release_ring_tx_size *
DP_TX_COMP_RING_SIZE(ab);
ath12k_dp_tx_comp_ring_size(dp_params);

ret = ath12k_dp_reoq_lut_setup(ab);
if (ret) {
Expand All @@ -1541,7 +1558,8 @@ static int ath12k_dp_setup(struct ath12k_base *ab)
dp->tx_ring[i].tcl_data_ring_id = i;

dp->tx_ring[i].tx_status_head = 0;
dp->tx_ring[i].tx_status_tail = DP_TX_COMP_RING_SIZE(ab) - 1;
dp->tx_ring[i].tx_status_tail =
ath12k_dp_tx_comp_ring_size(dp_params) - 1;
dp->tx_ring[i].tx_status = kmalloc(size, GFP_KERNEL);
if (!dp->tx_ring[i].tx_status) {
ret = -ENOMEM;
Expand Down
Loading
Loading