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

Commit 3be373ce authored by Amir Levy's avatar Amir Levy
Browse files

msm: ipa: merge ipa_gsi_ep_info into ipa3_ep_mapping



On sdm845, an IPA endpoint can be used for more than one configuration,
where each configuration has its own set of parameters. Therefore, the
endpoint configuration cannot be saved as an array according to endpoint
index.

CRs-Fixed: 1097871
Change-Id: I74e1a61e5785a0a80c5e164dd4cf8e98e385cb17
Signed-off-by: default avatarGidon Studinski <gidons@codeaurora.org>
Signed-off-by: default avatarAmir Levy <alevy@codeaurora.org>
parent 802bc162
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -2510,15 +2510,15 @@ EXPORT_SYMBOL(ipa_create_wdi_mapping);

/**
 * ipa_get_gsi_ep_info() - provide gsi ep information
 * @ipa_ep_idx: IPA endpoint index
 * @client: IPA client type
 *
 * Return value: pointer to ipa_gsi_ep_info
 */
struct ipa_gsi_ep_config *ipa_get_gsi_ep_info(int ipa_ep_idx)
const struct ipa_gsi_ep_config *ipa_get_gsi_ep_info(enum ipa_client_type client)
{
	if (!ipa_api_ctrl || !ipa_api_ctrl->ipa_get_gsi_ep_info)
		return NULL;
	return ipa_api_ctrl->ipa_get_gsi_ep_info(ipa_ep_idx);
	return ipa_api_ctrl->ipa_get_gsi_ep_info(client);
}
EXPORT_SYMBOL(ipa_get_gsi_ep_info);

+3 −2
Original line number Diff line number Diff line
/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -331,7 +331,8 @@ struct ipa_api_controller {
	int (*ipa_create_wdi_mapping)(u32 num_buffers,
		struct ipa_wdi_buffer_info *info);

	struct ipa_gsi_ep_config *(*ipa_get_gsi_ep_info)(int ipa_ep_idx);
	const struct ipa_gsi_ep_config *(*ipa_get_gsi_ep_info)
		(enum ipa_client_type client);

	int (*ipa_register_ipa_ready_cb)(void (*ipa_ready_cb)(void *user_data),
		void *user_data);
+2 −1
Original line number Diff line number Diff line
@@ -4929,7 +4929,8 @@ int ipa2_disable_apps_wan_cons_deaggr(uint32_t agg_size, uint32_t agg_count)
	return res;
}

static struct ipa_gsi_ep_config *ipa2_get_gsi_ep_info(int ipa_ep_idx)
static const struct ipa_gsi_ep_config *ipa2_get_gsi_ep_info
	(enum ipa_client_type client)
{
	IPAERR("Not supported for IPA 2.x\n");
	return NULL;
+2 −4
Original line number Diff line number Diff line
@@ -1152,8 +1152,7 @@ int ipa3_request_gsi_channel(struct ipa_request_gsi_channel_params *params,
	struct ipahal_reg_ep_cfg_status ep_status;
	unsigned long gsi_dev_hdl;
	enum gsi_status gsi_res;
	struct ipa_gsi_ep_config gsi_ep_cfg;
	struct ipa_gsi_ep_config *gsi_ep_cfg_ptr = &gsi_ep_cfg;
	const struct ipa_gsi_ep_config *gsi_ep_cfg_ptr;

	IPADBG("entry\n");
	if (params == NULL || out_params == NULL ||
@@ -1227,8 +1226,7 @@ int ipa3_request_gsi_channel(struct ipa_request_gsi_channel_params *params,
		goto write_evt_scratch_fail;
	}

	memset(gsi_ep_cfg_ptr, 0, sizeof(struct ipa_gsi_ep_config));
	gsi_ep_cfg_ptr = ipa_get_gsi_ep_info(ipa_ep_idx);
	gsi_ep_cfg_ptr = ipa3_get_gsi_ep_info(ep->client);
	params->chan_params.evt_ring_hdl = ep->gsi_evt_ring_hdl;
	params->chan_params.ch_id = gsi_ep_cfg_ptr->ipa_gsi_chan_num;
	gsi_res = gsi_alloc_channel(&params->chan_params, gsi_dev_hdl,
+10 −16
Original line number Diff line number Diff line
@@ -474,8 +474,7 @@ int ipa3_send(struct ipa3_sys_context *sys,
	int fail_dma_wrap = 0;
	uint size;
	u32 mem_flag = GFP_ATOMIC;
	int ipa_ep_idx;
	struct ipa_gsi_ep_config *gsi_ep_cfg;
	const struct ipa_gsi_ep_config *gsi_ep_cfg;

	if (unlikely(!in_atomic))
		mem_flag = GFP_KERNEL;
@@ -483,16 +482,10 @@ int ipa3_send(struct ipa3_sys_context *sys,
	size = num_desc * sizeof(struct sps_iovec);

	if (ipa3_ctx->transport_prototype == IPA_TRANSPORT_TYPE_GSI) {
		ipa_ep_idx = ipa3_get_ep_mapping(sys->ep->client);
		if (unlikely(ipa_ep_idx < 0)) {
			IPAERR("invalid ep_index of client = %d\n",
				sys->ep->client);
			return -EFAULT;
		}
		gsi_ep_cfg = ipa3_get_gsi_ep_info(ipa_ep_idx);
		gsi_ep_cfg = ipa3_get_gsi_ep_info(sys->ep->client);
		if (unlikely(!gsi_ep_cfg)) {
			IPAERR("failed to get gsi EP config of ep_idx=%d\n",
				ipa_ep_idx);
			IPAERR("failed to get gsi EP config for client=%d\n",
				sys->ep->client);
			return -EFAULT;
		}
		if (unlikely(num_desc > gsi_ep_cfg->ipa_if_tlv)) {
@@ -1723,7 +1716,7 @@ int ipa3_tx_dp(enum ipa_client_type dst, struct sk_buff *skb,
	struct ipa3_sys_context *sys;
	int src_ep_idx;
	int num_frags, f;
	struct ipa_gsi_ep_config *gsi_ep;
	const struct ipa_gsi_ep_config *gsi_ep;

	if (unlikely(!ipa3_ctx)) {
		IPAERR("IPA3 driver was not initialized\n");
@@ -1777,7 +1770,7 @@ int ipa3_tx_dp(enum ipa_client_type dst, struct sk_buff *skb,
	 * 2 descriptors are needed for IP_PACKET_INIT and TAG_STATUS.
	 * 1 descriptor needed for the linear portion of skb.
	 */
	gsi_ep = ipa3_get_gsi_ep_info(src_ep_idx);
	gsi_ep = ipa3_get_gsi_ep_info(ipa3_ctx->ep[src_ep_idx].client);
	if (gsi_ep && (num_frags + 3 > gsi_ep->ipa_if_tlv)) {
		if (skb_linearize(skb)) {
			IPAERR("Failed to linear skb with %d frags\n",
@@ -3958,7 +3951,7 @@ static int ipa_gsi_setup_channel(struct ipa_sys_connect_params *in,
	struct gsi_evt_ring_props gsi_evt_ring_props;
	struct gsi_chan_props gsi_channel_props;
	union __packed gsi_channel_scratch ch_scratch;
	struct ipa_gsi_ep_config *gsi_ep_info;
	const struct ipa_gsi_ep_config *gsi_ep_info;
	dma_addr_t dma_addr;
	dma_addr_t evt_dma_addr;
	int result;
@@ -4021,9 +4014,10 @@ static int ipa_gsi_setup_channel(struct ipa_sys_connect_params *in,
		gsi_channel_props.max_re_expected = ep->sys->rx_pool_sz;
	}

	gsi_ep_info = ipa3_get_gsi_ep_info(ipa3_get_ep_mapping(ep->client));
	gsi_ep_info = ipa3_get_gsi_ep_info(ep->client);
	if (!gsi_ep_info) {
		IPAERR("Invalid ep number\n");
		IPAERR("Failed getting GSI EP info for client=%d\n",
		       ep->client);
		result = -EINVAL;
		goto fail_get_gsi_ep_info;
	} else
Loading