Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 87874f76 authored by Skylar Chang's avatar Skylar Chang Committed by Mohammed Javid
Browse files

msm: ipa: pass napi struct from rmnet_ipa



Instead of passing events from IPA driver to Rmnet IPA
to control napi operations, Rmnet_IPA passes the napi
struct to IPA driver and IPA driver controls it directly.
This allows flexibility to call any napi APIs from IPA driver.

Change-Id: I3bd82cb6ad28b7663b8209c32f855ddb62e16e52
Acked-by: default avatarAdy Abraham <adya@qti.qualcomm.com>
Acked-by: default avatarAshok Vuyyuru <avuyyuru@qti.qualcomm.com>
Signed-off-by: default avatarSkylar Chang <chiaweic@codeaurora.org>
parent f63747b8
Loading
Loading
Loading
Loading
+12 −15
Original line number Diff line number Diff line
@@ -829,7 +829,7 @@ static void ipa3_switch_to_intr_rx_work_func(struct work_struct *work)
	dwork = container_of(work, struct delayed_work, work);
	sys = container_of(dwork, struct ipa3_sys_context, switch_to_intr_work);

	if (sys->ep->napi_enabled) {
	if (sys->napi_obj) {
		/* interrupt mode is done in ipa3_rx_poll context */
		ipa_assert();
	} else
@@ -1004,7 +1004,7 @@ int ipa3_setup_sys_pipe(struct ipa_sys_connect_params *sys_in, u32 *clnt_hdl)
	ep->valid = 1;
	ep->client = sys_in->client;
	ep->client_notify = sys_in->notify;
	ep->napi_enabled = sys_in->napi_enabled;
	ep->sys->napi_obj = sys_in->napi_obj;
	ep->priv = sys_in->priv;
	ep->keep_ipa_awake = sys_in->keep_ipa_awake;
	atomic_set(&ep->avail_fifo_desc,
@@ -1168,7 +1168,7 @@ int ipa3_teardown_sys_pipe(u32 clnt_hdl)
		return result;
	}

	if (ep->napi_enabled) {
	if (ep->sys->napi_obj) {
		do {
			usleep_range(95, 105);
		} while (atomic_read(&ep->sys->curr_polling_state));
@@ -1523,13 +1523,12 @@ static void ipa3_wq_handle_rx(struct work_struct *work)

	sys = container_of(work, struct ipa3_sys_context, work);

	if (sys->ep->napi_enabled) {
	if (sys->napi_obj) {
		if (!ipa3_ctx->use_ipa_pm)
			IPA_ACTIVE_CLIENTS_INC_SPECIAL("NAPI");
		else
			ipa_pm_activate_sync(sys->pm_hdl);
		sys->ep->client_notify(sys->ep->priv,
				IPA_CLIENT_START_POLL, 0);
		napi_schedule(sys->napi_obj);
	} else
		ipa3_handle_rx(sys);
}
@@ -2988,7 +2987,7 @@ static int ipa3_assign_policy(struct ipa_sys_connect_params *in,
					sys->repl_hdlr =
					   ipa3_replenish_rx_cache;
				}
				if (in->napi_enabled && in->recycle_enabled)
				if (in->napi_obj && in->recycle_enabled)
					sys->repl_hdlr =
					 ipa3_replenish_rx_cache_recycle;
				in->ipa_ep_cfg.aggr.aggr_sw_eof_active
@@ -3556,24 +3555,22 @@ void __ipa_gsi_irq_rx_scedule_poll(struct ipa3_sys_context *sys)
	 */
	if (ipa3_ctx->use_ipa_pm) {
		clk_off = ipa_pm_activate(sys->pm_hdl);
		if (!clk_off && sys->ep->napi_enabled) {
			sys->ep->client_notify(sys->ep->priv,
				IPA_CLIENT_START_POLL, 0);
		if (!clk_off && sys->napi_obj) {
			napi_schedule(sys->napi_obj);
			return;
		}
		queue_work(sys->wq, &sys->work);
		return;
	}

	if (sys->ep->napi_enabled) {
	if (sys->napi_obj) {
		struct ipa_active_client_logging_info log;

		IPA_ACTIVE_CLIENTS_PREP_SPECIAL(log, "NAPI");
		clk_off = ipa3_inc_client_enable_clks_no_block(
			&log);
		if (!clk_off) {
			sys->ep->client_notify(sys->ep->priv,
				IPA_CLIENT_START_POLL, 0);
			napi_schedule(sys->napi_obj);
			return;
		}
	}
@@ -3775,7 +3772,7 @@ static int ipa_gsi_setup_channel(struct ipa_sys_connect_params *in,
		ep->gsi_mem_info.evt_ring_base_vaddr =
			gsi_evt_ring_props.ring_base_vaddr;

		if (ep->napi_enabled) {
		if (ep->sys->napi_obj) {
			gsi_evt_ring_props.int_modt = IPA_GSI_EVT_RING_INT_MODT;
			gsi_evt_ring_props.int_modc = IPA_GSI_EVT_RING_INT_MODC;
		} else {
@@ -4088,7 +4085,7 @@ int ipa3_rx_poll(u32 clnt_hdl, int weight)
	}
	cnt += weight - remain_aggr_weight * IPA_WAN_AGGR_PKT_CNT;
	if (cnt < weight) {
		ep->client_notify(ep->priv, IPA_CLIENT_COMP_NAPI, 0);
		napi_complete(ep->sys->napi_obj);
		ipa3_rx_switch_to_intr_mode(ep->sys);
		if (ipa3_ctx->use_ipa_pm)
			ipa_pm_deferred_deactivate(ep->sys->pm_hdl);
+1 −2
Original line number Diff line number Diff line
@@ -761,7 +761,6 @@ struct ipa3_status_stats {
 * @disconnect_in_progress: Indicates client disconnect in progress.
 * @qmi_request_sent: Indicates whether QMI request to enable clear data path
 *					request is sent or not.
 * @napi_enabled: when true, IPA call client callback to start polling
 * @client_lock_unlock: callback function to take mutex lock/unlock for USB
 *				clients
 */
@@ -793,7 +792,6 @@ struct ipa3_ep_context {
	u32 gsi_offload_state;
	bool disconnect_in_progress;
	u32 qmi_request_sent;
	bool napi_enabled;
	u32 eot_in_poll_err;
	bool ep_delay_set;

@@ -882,6 +880,7 @@ struct ipa3_sys_context {
	void (*repl_hdlr)(struct ipa3_sys_context *sys);
	struct ipa3_repl_ctx repl;
	u32 pkt_sent;
	struct napi_struct *napi_obj;

	/* ordering is important - mutable fields go above */
	struct ipa3_ep_context *ep;
+1 −1
Original line number Diff line number Diff line
@@ -315,7 +315,7 @@ int ipa_setup_odl_pipe(void)
	ipa_odl_ep_cfg->client = IPA_CLIENT_ODL_DPL_CONS;
	ipa_odl_ep_cfg->notify = odl_ipa_packet_receive_notify;

	ipa_odl_ep_cfg->napi_enabled = false;
	ipa_odl_ep_cfg->napi_obj = NULL;
	ipa_odl_ep_cfg->desc_fifo_sz = IPA_ODL_RX_RING_SIZE *
						IPA_FIFO_ELEMENT_SIZE;

+4 −14
Original line number Diff line number Diff line
@@ -89,7 +89,6 @@ static void rmnet_ipa_get_stats_and_update(void);
static int ipa3_wwan_add_ul_flt_rule_to_ipa(void);
static int ipa3_wwan_del_ul_flt_rule_to_ipa(void);
static void ipa3_wwan_msg_free_cb(void*, u32, u32);
static void ipa3_rmnet_rx_cb(void *priv);
static int ipa3_rmnet_poll(struct napi_struct *napi, int budget);

static void ipa3_wake_tx_queue(struct work_struct *work);
@@ -1278,14 +1277,10 @@ static void apps_ipa_packet_receive_notify(void *priv,
		}
		dev->stats.rx_packets++;
		dev->stats.rx_bytes += packet_len;
	} else if (evt == IPA_CLIENT_START_POLL)
		ipa3_rmnet_rx_cb(priv);
	else if (evt == IPA_CLIENT_COMP_NAPI) {
		if (ipa3_rmnet_res.ipa_napi_enable)
			napi_complete(&(rmnet_ipa3_ctx->wwan_priv->napi));
	} else
	} else {
		IPAWANERR("Invalid evt %d received in wan_ipa_receive\n", evt);
	}
}

static int handle3_ingress_format(struct net_device *dev,
			struct rmnet_ioctl_extended_s *in)
@@ -1341,7 +1336,8 @@ static int handle3_ingress_format(struct net_device *dev,
	ipa_wan_ep_cfg->notify = apps_ipa_packet_receive_notify;
	ipa_wan_ep_cfg->priv = dev;

	ipa_wan_ep_cfg->napi_enabled = ipa3_rmnet_res.ipa_napi_enable;
	if (ipa3_rmnet_res.ipa_napi_enable)
		ipa_wan_ep_cfg->napi_obj = &(rmnet_ipa3_ctx->wwan_priv->napi);
	ipa_wan_ep_cfg->desc_fifo_sz =
		ipa3_rmnet_res.wan_rx_desc_size * IPA_FIFO_ELEMENT_SIZE;

@@ -4184,12 +4180,6 @@ static void ipa3_wwan_msg_free_cb(void *buff, u32 len, u32 type)
	kfree(buff);
}

static void ipa3_rmnet_rx_cb(void *priv)
{
	IPAWANDBG_LOW("\n");
	napi_schedule(&(rmnet_ipa3_ctx->wwan_priv->napi));
}

static int ipa3_rmnet_poll(struct napi_struct *napi, int budget)
{
	int rcvd_pkts = 0;
+1 −3
Original line number Diff line number Diff line
@@ -100,8 +100,6 @@ enum ipa_aggr_mode {
enum ipa_dp_evt_type {
	IPA_RECEIVE,
	IPA_WRITE_DONE,
	IPA_CLIENT_START_POLL,
	IPA_CLIENT_COMP_NAPI,
};

/**
@@ -608,7 +606,7 @@ struct ipa_sys_connect_params {
	ipa_notify_cb notify;
	bool skip_ep_cfg;
	bool keep_ipa_awake;
	bool napi_enabled;
	struct napi_struct *napi_obj;
	bool recycle_enabled;
};