diff options
-rw-r--r-- | Documentation/devicetree/bindings/platform/msm/rmnet_ipa.txt | 2 | ||||
-rw-r--r-- | Documentation/devicetree/bindings/platform/msm/rmnet_ipa3.txt | 2 | ||||
-rw-r--r-- | drivers/platform/msm/ipa/ipa_v2/ipa_dp.c | 18 | ||||
-rw-r--r-- | drivers/platform/msm/ipa/ipa_v2/ipa_i.h | 2 | ||||
-rw-r--r-- | drivers/platform/msm/ipa/ipa_v2/rmnet_ipa.c | 23 | ||||
-rw-r--r-- | drivers/platform/msm/ipa/ipa_v3/ipa_dp.c | 27 | ||||
-rw-r--r-- | drivers/platform/msm/ipa/ipa_v3/ipa_i.h | 2 | ||||
-rw-r--r-- | drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c | 25 |
8 files changed, 67 insertions, 34 deletions
diff --git a/Documentation/devicetree/bindings/platform/msm/rmnet_ipa.txt b/Documentation/devicetree/bindings/platform/msm/rmnet_ipa.txt index 102b304f5fb3..d8934c01cc71 100644 --- a/Documentation/devicetree/bindings/platform/msm/rmnet_ipa.txt +++ b/Documentation/devicetree/bindings/platform/msm/rmnet_ipa.txt @@ -12,9 +12,11 @@ Optional: regarding scatter-gather capability - qcom,ipa-napi-enable: Boolean context flag to indicate whether to enable napi framework or not +- qcom,wan-rx-desc-size: size of WAN rx desc fifo ring, default is 256 Example: qcom,rmnet-ipa { compatible = "qcom,rmnet-ipa"; + qcom,wan-rx-desc-size = <256>; } diff --git a/Documentation/devicetree/bindings/platform/msm/rmnet_ipa3.txt b/Documentation/devicetree/bindings/platform/msm/rmnet_ipa3.txt index 7ee28664668b..e9575f150c5e 100644 --- a/Documentation/devicetree/bindings/platform/msm/rmnet_ipa3.txt +++ b/Documentation/devicetree/bindings/platform/msm/rmnet_ipa3.txt @@ -12,9 +12,11 @@ Optional: regarding scatter-gather capability - qcom,ipa-napi-enable: Boolean context flag to indicate whether to enable napi framework or not +- qcom,wan-rx-desc-size: size of WAN rx desc fifo ring, default is 256 Example: qcom,rmnet-ipa3 { compatible = "qcom,rmnet-ipa3"; + qcom,wan-rx-desc-size = <256>; } diff --git a/drivers/platform/msm/ipa/ipa_v2/ipa_dp.c b/drivers/platform/msm/ipa/ipa_v2/ipa_dp.c index 3c2a6d4620ba..3afd9c61daca 100644 --- a/drivers/platform/msm/ipa/ipa_v2/ipa_dp.c +++ b/drivers/platform/msm/ipa/ipa_v2/ipa_dp.c @@ -18,6 +18,7 @@ #include "ipa_i.h" #include "ipa_trace.h" +#define IPA_WAN_AGGR_PKT_CNT 5 #define IPA_LAST_DESC_CNT 0xFFFF #define POLLING_INACTIVITY_RX 40 #define POLLING_INACTIVITY_TX 40 @@ -1099,16 +1100,18 @@ int ipa2_rx_poll(u32 clnt_hdl, int weight) break; ipa_wq_rx_common(ep->sys, iov.size); - cnt += 5; + cnt += IPA_WAN_AGGR_PKT_CNT; }; - if (cnt == 0) { + if (cnt == 0 || cnt < weight) { ep->inactive_cycles++; ep->client_notify(ep->priv, IPA_CLIENT_COMP_NAPI, 0); if (ep->inactive_cycles > 3 || ep->sys->len == 0) { ep->switch_to_intr = true; delay = 0; + } else if (cnt < weight) { + delay = 0; } queue_delayed_work(ep->sys->wq, &ep->sys->switch_to_intr_work, msecs_to_jiffies(delay)); @@ -3162,14 +3165,9 @@ static int ipa_assign_policy_v2(struct ipa_sys_connect_params *in, sys->repl_hdlr = ipa_replenish_rx_cache; } - if (in->napi_enabled) { - sys->rx_pool_sz = - IPA_WAN_NAPI_CONS_RX_POOL_SZ; - if (in->recycle_enabled) { - sys->repl_hdlr = - ipa_replenish_rx_cache_recycle; - } - } + if (in->napi_enabled && in->recycle_enabled) + sys->repl_hdlr = + ipa_replenish_rx_cache_recycle; sys->ep->wakelock_client = IPA_WAKELOCK_REF_CLIENT_WAN_RX; in->ipa_ep_cfg.aggr.aggr_sw_eof_active diff --git a/drivers/platform/msm/ipa/ipa_v2/ipa_i.h b/drivers/platform/msm/ipa/ipa_v2/ipa_i.h index 73206abf9cfd..866170d3324d 100644 --- a/drivers/platform/msm/ipa/ipa_v2/ipa_i.h +++ b/drivers/platform/msm/ipa/ipa_v2/ipa_i.h @@ -51,8 +51,6 @@ #define IPA_UC_FINISH_MAX 6 #define IPA_UC_WAIT_MIN_SLEEP 1000 #define IPA_UC_WAII_MAX_SLEEP 1200 -#define IPA_WAN_NAPI_CONS_RX_POOL_SZ (IPA_GENERIC_RX_POOL_SZ*3) -#define IPA_WAN_CONS_DESC_FIFO_SZ (IPA_SYS_DESC_FIFO_SZ*3) #define IPA_MAX_STATUS_STAT_NUM 30 diff --git a/drivers/platform/msm/ipa/ipa_v2/rmnet_ipa.c b/drivers/platform/msm/ipa/ipa_v2/rmnet_ipa.c index 520f139ee38a..c2e43a62ab69 100644 --- a/drivers/platform/msm/ipa/ipa_v2/rmnet_ipa.c +++ b/drivers/platform/msm/ipa/ipa_v2/rmnet_ipa.c @@ -62,6 +62,7 @@ #define IPA_UEVENT_NUM_EVNP 4 /* number of event pointers */ #define NAPI_WEIGHT 60 +#define IPA_WWAN_CONS_DESC_FIFO_SZ 1024 static struct net_device *ipa_netdevs[IPA_WWAN_DEVICE_COUNT]; static struct ipa_sys_connect_params apps_to_ipa_ep_cfg, ipa_to_apps_ep_cfg; @@ -100,6 +101,7 @@ struct ipa_rmnet_plat_drv_res { bool ipa_loaduC; bool ipa_advertise_sg_support; bool ipa_napi_enable; + u32 wan_rx_desc_size; }; static struct ipa_rmnet_plat_drv_res ipa_rmnet_res; @@ -1291,10 +1293,8 @@ static int handle_ingress_format(struct net_device *dev, ipa_to_apps_ep_cfg.priv = dev; ipa_to_apps_ep_cfg.napi_enabled = ipa_rmnet_res.ipa_napi_enable; - if (ipa_to_apps_ep_cfg.napi_enabled) - ipa_to_apps_ep_cfg.desc_fifo_sz = IPA_WAN_CONS_DESC_FIFO_SZ; - else - ipa_to_apps_ep_cfg.desc_fifo_sz = IPA_SYS_DESC_FIFO_SZ; + ipa_to_apps_ep_cfg.desc_fifo_sz = + ipa_rmnet_res.wan_rx_desc_size * sizeof(struct sps_iovec); mutex_lock(&ipa_to_apps_pipe_handle_guard); if (atomic_read(&is_ssr)) { @@ -1925,6 +1925,9 @@ static struct notifier_block ssr_notifier = { static int get_ipa_rmnet_dts_configuration(struct platform_device *pdev, struct ipa_rmnet_plat_drv_res *ipa_rmnet_drv_res) { + int result; + + ipa_rmnet_drv_res->wan_rx_desc_size = IPA_WWAN_CONS_DESC_FIFO_SZ; ipa_rmnet_drv_res->ipa_rmnet_ssr = of_property_read_bool(pdev->dev.of_node, "qcom,rmnet-ipa-ssr"); @@ -1947,6 +1950,18 @@ static int get_ipa_rmnet_dts_configuration(struct platform_device *pdev, "qcom,ipa-napi-enable"); pr_info("IPA Napi Enable = %s\n", ipa_rmnet_drv_res->ipa_napi_enable ? "True" : "False"); + + /* Get IPA WAN RX desc fifo size */ + result = of_property_read_u32(pdev->dev.of_node, + "qcom,wan-rx-desc-size", + &ipa_rmnet_drv_res->wan_rx_desc_size); + if (result) + pr_info("using default for wan-rx-desc-size = %u\n", + ipa_rmnet_drv_res->wan_rx_desc_size); + else + IPAWANDBG(": found ipa_drv_res->wan-rx-desc-size = %u\n", + ipa_rmnet_drv_res->wan_rx_desc_size); + return 0; } diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c b/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c index cc1cb456ab8a..4b0cd46082a3 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c @@ -21,6 +21,7 @@ #include "ipahal/ipahal.h" #include "ipahal/ipahal_fltrt.h" +#define IPA_WAN_AGGR_PKT_CNT 5 #define IPA_LAST_DESC_CNT 0xFFFF #define POLLING_INACTIVITY_RX 40 #define POLLING_MIN_SLEEP_RX 1010 @@ -60,7 +61,6 @@ #define IPA_ODU_RX_POOL_SZ 64 #define IPA_SIZE_DL_CSUM_META_TRAILER 8 -#define IPA_GSI_EVT_RING_LEN 4096 #define IPA_GSI_MAX_CH_LOW_WEIGHT 15 #define IPA_GSI_EVT_RING_INT_MODT 3200 /* 0.1s under 32KHz clock */ @@ -3298,9 +3298,6 @@ static int ipa3_assign_policy(struct ipa_sys_connect_params *in, sys->repl_hdlr = ipa3_replenish_rx_cache; } - if (in->napi_enabled) - sys->rx_pool_sz = - IPA_WAN_NAPI_CONS_RX_POOL_SZ; if (in->napi_enabled && in->recycle_enabled) sys->repl_hdlr = ipa3_replenish_rx_cache_recycle; @@ -3965,13 +3962,19 @@ static int ipa_gsi_setup_channel(struct ipa_sys_connect_params *in, gsi_evt_ring_props.re_size = GSI_EVT_RING_RE_SIZE_16B; - gsi_evt_ring_props.ring_len = IPA_GSI_EVT_RING_LEN; + /* + * GSI ring length is calculated based on the desc_fifo_sz + * which was meant to define the BAM desc fifo. GSI descriptors + * are 16B as opposed to 8B for BAM. + */ + gsi_evt_ring_props.ring_len = 2 * in->desc_fifo_sz; + gsi_evt_ring_props.ring_base_vaddr = - dma_alloc_coherent(ipa3_ctx->pdev, IPA_GSI_EVT_RING_LEN, - &evt_dma_addr, GFP_KERNEL); + dma_alloc_coherent(ipa3_ctx->pdev, + gsi_evt_ring_props.ring_len, &evt_dma_addr, GFP_KERNEL); if (!gsi_evt_ring_props.ring_base_vaddr) { IPAERR("fail to dma alloc %u bytes\n", - IPA_GSI_EVT_RING_LEN); + gsi_evt_ring_props.ring_len); return -ENOMEM; } gsi_evt_ring_props.ring_base_addr = evt_dma_addr; @@ -4098,7 +4101,7 @@ fail_get_gsi_ep_info: } fail_alloc_evt_ring: if (gsi_evt_ring_props.ring_base_vaddr) - dma_free_coherent(ipa3_ctx->pdev, IPA_GSI_EVT_RING_LEN, + dma_free_coherent(ipa3_ctx->pdev, gsi_evt_ring_props.ring_len, gsi_evt_ring_props.ring_base_vaddr, evt_dma_addr); IPAERR("Return with err: %d\n", result); return result; @@ -4280,16 +4283,18 @@ int ipa3_rx_poll(u32 clnt_hdl, int weight) break; ipa3_wq_rx_common(ep->sys, mem_info.size); - cnt += 5; + cnt += IPA_WAN_AGGR_PKT_CNT; }; - if (cnt == 0) { + if (cnt == 0 || cnt < weight) { ep->inactive_cycles++; ep->client_notify(ep->priv, IPA_CLIENT_COMP_NAPI, 0); if (ep->inactive_cycles > 3 || ep->sys->len == 0) { ep->switch_to_intr = true; delay = 0; + } else if (cnt < weight) { + delay = 0; } queue_delayed_work(ep->sys->wq, &ep->sys->switch_to_intr_work, msecs_to_jiffies(delay)); diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_i.h b/drivers/platform/msm/ipa/ipa_v3/ipa_i.h index 40f1e93653f9..1b78835cda6b 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_i.h +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_i.h @@ -53,8 +53,6 @@ #define IPA_UC_FINISH_MAX 6 #define IPA_UC_WAIT_MIN_SLEEP 1000 #define IPA_UC_WAII_MAX_SLEEP 1200 -#define IPA_WAN_NAPI_CONS_RX_POOL_SZ (IPA_GENERIC_RX_POOL_SZ*3) -#define IPA_WAN_CONS_DESC_FIFO_SZ (IPA_SYS_DESC_FIFO_SZ*3) #define IPA_MAX_STATUS_STAT_NUM 30 diff --git a/drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c b/drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c index 8f6c303d2867..0419249890e9 100644 --- a/drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c +++ b/drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c @@ -65,6 +65,7 @@ ((rmnet_ipa3_ctx && rmnet_ipa3_ctx->wwan_priv) ? \ rmnet_ipa3_ctx->wwan_priv->net : NULL) +#define IPA_WWAN_CONS_DESC_FIFO_SZ 256 static int ipa3_wwan_add_ul_flt_rule_to_ipa(void); static int ipa3_wwan_del_ul_flt_rule_to_ipa(void); @@ -89,6 +90,7 @@ struct ipa3_rmnet_plat_drv_res { bool ipa_loaduC; bool ipa_advertise_sg_support; bool ipa_napi_enable; + u32 wan_rx_desc_size; }; /** @@ -1275,7 +1277,7 @@ static int handle3_ingress_format(struct net_device *dev, ipa_wan_ep_cfg->ipa_ep_cfg.aggr.aggr_pkt_limit = in->u.ingress_format.agg_count; - if (ipa_wan_ep_cfg->napi_enabled) { + if (ipa3_rmnet_res.ipa_napi_enable) { ipa_wan_ep_cfg->recycle_enabled = true; ep_cfg = (struct rmnet_phys_ep_conf_s *) rcu_dereference(dev->rx_handler_data); @@ -1303,10 +1305,8 @@ static int handle3_ingress_format(struct net_device *dev, ipa_wan_ep_cfg->priv = dev; ipa_wan_ep_cfg->napi_enabled = ipa3_rmnet_res.ipa_napi_enable; - if (ipa_wan_ep_cfg->napi_enabled) - ipa_wan_ep_cfg->desc_fifo_sz = IPA_WAN_CONS_DESC_FIFO_SZ; - else - ipa_wan_ep_cfg->desc_fifo_sz = IPA_SYS_DESC_FIFO_SZ; + ipa_wan_ep_cfg->desc_fifo_sz = + ipa3_rmnet_res.wan_rx_desc_size * sizeof(struct sps_iovec); mutex_lock(&rmnet_ipa3_ctx->ipa_to_apps_pipe_handle_guard); @@ -1957,6 +1957,9 @@ static struct notifier_block ipa3_ssr_notifier = { static int get_ipa_rmnet_dts_configuration(struct platform_device *pdev, struct ipa3_rmnet_plat_drv_res *ipa_rmnet_drv_res) { + int result; + + ipa_rmnet_drv_res->wan_rx_desc_size = IPA_WWAN_CONS_DESC_FIFO_SZ; ipa_rmnet_drv_res->ipa_rmnet_ssr = of_property_read_bool(pdev->dev.of_node, "qcom,rmnet-ipa-ssr"); @@ -1979,6 +1982,18 @@ static int get_ipa_rmnet_dts_configuration(struct platform_device *pdev, "qcom,ipa-napi-enable"); pr_info("IPA Napi Enable = %s\n", ipa_rmnet_drv_res->ipa_napi_enable ? "True" : "False"); + + /* Get IPA WAN RX desc fifo size */ + result = of_property_read_u32(pdev->dev.of_node, + "qcom,wan-rx-desc-size", + &ipa_rmnet_drv_res->wan_rx_desc_size); + if (result) + pr_info("using default for wan-rx-desc-size = %u\n", + ipa_rmnet_drv_res->wan_rx_desc_size); + else + IPAWANDBG(": found ipa_drv_res->wan-rx-desc-size = %u\n", + ipa_rmnet_drv_res->wan_rx_desc_size); + return 0; } |