net: stmmac: read descriptor count for IPA rx/tx from dt entry

Add support to read descriptor count for IPA ch from dt entry.

Change-Id: Ice9a4034275904abef374800c99b01abce44c908
Signed-off-by: Sneh Shah <snehshah@codeaurora.org>
tirimbino
Sneh Shah 5 years ago
parent 497e1f669b
commit 20b8d6cad3
  1. 26
      drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ipa.c
  2. 7
      drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ipa.h

@ -95,7 +95,7 @@ static int ethqos_alloc_ipa_tx_queue_struct(struct qcom_ethqos *ethqos)
goto err_out_tx_q_alloc_failed; goto err_out_tx_q_alloc_failed;
} }
eth_ipa_ctx.tx_queue->desc_cnt = IPA_TX_DESC_CNT; eth_ipa_ctx.tx_queue->desc_cnt = eth_ipa_ctx.ipa_dma_tx_desc_cnt;
/* Allocate tx_desc_ptrs */ /* Allocate tx_desc_ptrs */
eth_ipa_ctx.tx_queue->tx_desc_ptrs = eth_ipa_ctx.tx_queue->tx_desc_ptrs =
@ -224,7 +224,7 @@ static int ethqos_alloc_ipa_rx_queue_struct(struct qcom_ethqos *ethqos)
goto err_out_rx_q_alloc_failed; goto err_out_rx_q_alloc_failed;
} }
eth_ipa_ctx.rx_queue->desc_cnt = IPA_RX_DESC_CNT; eth_ipa_ctx.rx_queue->desc_cnt = eth_ipa_ctx.ipa_dma_rx_desc_cnt;
/* Allocate rx_desc_ptrs */ /* Allocate rx_desc_ptrs */
eth_ipa_ctx.rx_queue->rx_desc_ptrs = eth_ipa_ctx.rx_queue->rx_desc_ptrs =
@ -1630,8 +1630,8 @@ static int ethqos_ipa_create_debugfs(struct qcom_ethqos *ethqos)
debugfs_create_file("dma_stats", 0600, debugfs_create_file("dma_stats", 0600,
ethqos->debugfs_dir, ethqos, ethqos->debugfs_dir, ethqos,
&fops_ntn_dma_stats); &fops_ntn_dma_stats);
if (!eth_ipa->debugfs_suspend_ipa_offload || if (!eth_ipa->debugfs_dma_stats ||
IS_ERR(eth_ipa->debugfs_suspend_ipa_offload)) { IS_ERR(eth_ipa->debugfs_dma_stats)) {
ETHQOSERR("Cannot create debugfs_dma_stats %d\n", ETHQOSERR("Cannot create debugfs_dma_stats %d\n",
(int)eth_ipa->debugfs_dma_stats); (int)eth_ipa->debugfs_dma_stats);
goto fail; goto fail;
@ -2159,11 +2159,29 @@ static int ethqos_ipa_uc_ready(struct qcom_ethqos *pdata)
void ethqos_ipa_offload_event_handler(void *data, void ethqos_ipa_offload_event_handler(void *data,
int ev) int ev)
{ {
int ret;
ETHQOSDBG("Enter: event=%d\n", ev); ETHQOSDBG("Enter: event=%d\n", ev);
if (ev == EV_PROBE_INIT) { if (ev == EV_PROBE_INIT) {
eth_ipa_ctx.ethqos = data; eth_ipa_ctx.ethqos = data;
mutex_init(&eth_ipa_ctx.ipa_lock); mutex_init(&eth_ipa_ctx.ipa_lock);
ret =
of_property_read_u32(eth_ipa_ctx.ethqos->pdev->dev.of_node,
"ipa-dma-rx-desc-cnt",
&eth_ipa_ctx.ipa_dma_rx_desc_cnt);
if (ret) {
ETHQOSDBG(":resource ipa-dma-rx-desc-cnt not in dt\n");
eth_ipa_ctx.ipa_dma_rx_desc_cnt = IPA_RX_DESC_CNT;
}
ret =
of_property_read_u32(eth_ipa_ctx.ethqos->pdev->dev.of_node,
"ipa-dma-tx-desc-cnt",
&eth_ipa_ctx.ipa_dma_tx_desc_cnt);
if (ret) {
ETHQOSDBG(":resource ipa-dma-tx-desc-cnt not in dt\n");
eth_ipa_ctx.ipa_dma_tx_desc_cnt = IPA_TX_DESC_CNT;
}
return; return;
} }

@ -79,8 +79,8 @@ static char * const IPA_OFFLOAD_EVENT_string[] = {
#define ETHQOS_ETH_FRAME_LEN_IPA ((1 << 11)) /*IPA can support 2KB max length*/ #define ETHQOS_ETH_FRAME_LEN_IPA ((1 << 11)) /*IPA can support 2KB max length*/
#define IPA_TX_DESC_CNT 128 /*Increase TX desc count to 128 for IPA offload*/ #define IPA_TX_DESC_CNT 128 /*Default TX desc count to 128 for IPA offload*/
#define IPA_RX_DESC_CNT 128 /*Increase RX desc count to 128 for IPA offload*/ #define IPA_RX_DESC_CNT 128 /*Default RX desc count to 128 for IPA offload*/
#define BASE_ADDRESS (ethqos->ioaddr) #define BASE_ADDRESS (ethqos->ioaddr)
@ -647,6 +647,9 @@ struct ethqos_prv_ipa_data {
phys_addr_t uc_db_tx_addr; phys_addr_t uc_db_tx_addr;
u32 ipa_client_hndl; u32 ipa_client_hndl;
u32 ipa_dma_tx_desc_cnt;
u32 ipa_dma_rx_desc_cnt;
/* IPA state variables */ /* IPA state variables */
/* State of EMAC HW initialization */ /* State of EMAC HW initialization */
bool emac_dev_ready; bool emac_dev_ready;

Loading…
Cancel
Save