Merge "msm: ipa3: UL event based completion"

This commit is contained in:
Linux Build Service Account 2017-02-15 17:01:13 -08:00 committed by Gerrit - the friendly Code Review server
commit d8fade73fb
8 changed files with 228 additions and 172 deletions

View file

@ -1,4 +1,4 @@
/* 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
@ -113,7 +113,8 @@ const char *ipa_clients_strings[IPA_CLIENT_MAX] = {
__stringify(IPA_CLIENT_A5_WLAN_AMPDU_PROD),
__stringify(IPA_CLIENT_A2_EMBEDDED_PROD),
__stringify(IPA_CLIENT_A2_TETHERED_PROD),
__stringify(IPA_CLIENT_APPS_LAN_WAN_PROD),
__stringify(IPA_CLIENT_APPS_LAN_PROD),
__stringify(IPA_CLIENT_APPS_WAN_PROD),
__stringify(IPA_CLIENT_APPS_CMD_PROD),
__stringify(IPA_CLIENT_ODU_PROD),
__stringify(IPA_CLIENT_MHI_PROD),

View file

@ -86,6 +86,7 @@ static const int ep_mapping[3][IPA_CLIENT_MAX] = {
[IPA_1_1][IPA_CLIENT_A5_WLAN_AMPDU_PROD] = 15,
[IPA_1_1][IPA_CLIENT_A2_EMBEDDED_PROD] = 8,
[IPA_1_1][IPA_CLIENT_A2_TETHERED_PROD] = 6,
[IPA_1_1][IPA_CLIENT_APPS_LAN_PROD] = -1,
[IPA_1_1][IPA_CLIENT_APPS_LAN_WAN_PROD] = 2,
[IPA_1_1][IPA_CLIENT_APPS_CMD_PROD] = 1,
[IPA_1_1][IPA_CLIENT_ODU_PROD] = -1,
@ -133,6 +134,7 @@ static const int ep_mapping[3][IPA_CLIENT_MAX] = {
[IPA_2_0][IPA_CLIENT_A5_WLAN_AMPDU_PROD] = -1,
[IPA_2_0][IPA_CLIENT_A2_EMBEDDED_PROD] = -1,
[IPA_2_0][IPA_CLIENT_A2_TETHERED_PROD] = -1,
[IPA_2_0][IPA_CLIENT_APPS_LAN_PROD] = -1,
[IPA_2_0][IPA_CLIENT_APPS_LAN_WAN_PROD] = 4,
[IPA_2_0][IPA_CLIENT_APPS_CMD_PROD] = 3,
[IPA_2_0][IPA_CLIENT_ODU_PROD] = 12,
@ -207,6 +209,7 @@ static const int ep_mapping[3][IPA_CLIENT_MAX] = {
[IPA_2_6L][IPA_CLIENT_A5_WLAN_AMPDU_PROD] = -1,
[IPA_2_6L][IPA_CLIENT_A2_EMBEDDED_PROD] = -1,
[IPA_2_6L][IPA_CLIENT_A2_TETHERED_PROD] = -1,
[IPA_2_6L][IPA_CLIENT_APPS_LAN_PROD] = -1,
[IPA_2_6L][IPA_CLIENT_APPS_LAN_WAN_PROD] = 4,
[IPA_2_6L][IPA_CLIENT_APPS_CMD_PROD] = 3,
[IPA_2_6L][IPA_CLIENT_ODU_PROD] = -1,

View file

@ -2809,7 +2809,7 @@ static int ipa3_setup_apps_pipes(void)
result = ipa_gsi_ch20_wa();
if (result) {
IPAERR("ipa_gsi_ch20_wa failed %d\n", result);
goto fail_cmd;
goto fail_ch20_wa;
}
}
@ -2820,9 +2820,9 @@ static int ipa3_setup_apps_pipes(void)
sys_in.ipa_ep_cfg.mode.mode = IPA_DMA;
sys_in.ipa_ep_cfg.mode.dst = IPA_CLIENT_APPS_LAN_CONS;
if (ipa3_setup_sys_pipe(&sys_in, &ipa3_ctx->clnt_hdl_cmd)) {
IPAERR(":setup sys pipe failed.\n");
IPAERR(":setup sys pipe (APPS_CMD_PROD) failed.\n");
result = -EPERM;
goto fail_cmd;
goto fail_ch20_wa;
}
IPADBG("Apps to IPA cmd pipe is connected\n");
@ -2847,32 +2847,32 @@ static int ipa3_setup_apps_pipes(void)
if (ipa3_setup_flt_hash_tuple()) {
IPAERR(":fail to configure flt hash tuple\n");
result = -EPERM;
goto fail_schedule_delayed_work;
goto fail_flt_hash_tuple;
}
IPADBG("flt hash tuple is configured\n");
if (ipa3_setup_rt_hash_tuple()) {
IPAERR(":fail to configure rt hash tuple\n");
result = -EPERM;
goto fail_schedule_delayed_work;
goto fail_flt_hash_tuple;
}
IPADBG("rt hash tuple is configured\n");
if (ipa3_setup_exception_path()) {
IPAERR(":fail to setup excp path\n");
result = -EPERM;
goto fail_schedule_delayed_work;
goto fail_flt_hash_tuple;
}
IPADBG("Exception path was successfully set");
if (ipa3_setup_dflt_rt_tables()) {
IPAERR(":fail to setup dflt routes\n");
result = -EPERM;
goto fail_schedule_delayed_work;
goto fail_flt_hash_tuple;
}
IPADBG("default routing was set\n");
/* LAN IN (IPA->A5) */
/* LAN IN (IPA->AP) */
memset(&sys_in, 0, sizeof(struct ipa_sys_connect_params));
sys_in.client = IPA_CLIENT_APPS_LAN_CONS;
sys_in.desc_fifo_sz = IPA_SYS_DESC_FIFO_SZ;
@ -2896,27 +2896,27 @@ static int ipa3_setup_apps_pipes(void)
*/
spin_lock_init(&ipa3_ctx->disconnect_lock);
if (ipa3_setup_sys_pipe(&sys_in, &ipa3_ctx->clnt_hdl_data_in)) {
IPAERR(":setup sys pipe failed.\n");
IPAERR(":setup sys pipe (LAN_CONS) failed.\n");
result = -EPERM;
goto fail_schedule_delayed_work;
goto fail_flt_hash_tuple;
}
/* LAN-WAN OUT (AP->IPA) */
/* LAN OUT (AP->IPA) */
memset(&sys_in, 0, sizeof(struct ipa_sys_connect_params));
sys_in.client = IPA_CLIENT_APPS_LAN_WAN_PROD;
sys_in.client = IPA_CLIENT_APPS_LAN_PROD;
sys_in.desc_fifo_sz = IPA_SYS_TX_DATA_DESC_FIFO_SZ;
sys_in.ipa_ep_cfg.mode.mode = IPA_BASIC;
if (ipa3_setup_sys_pipe(&sys_in, &ipa3_ctx->clnt_hdl_data_out)) {
IPAERR(":setup sys pipe failed.\n");
IPAERR(":setup sys pipe (LAN_PROD) failed.\n");
result = -EPERM;
goto fail_data_out;
goto fail_lan_data_out;
}
return 0;
fail_data_out:
fail_lan_data_out:
ipa3_teardown_sys_pipe(ipa3_ctx->clnt_hdl_data_in);
fail_schedule_delayed_work:
fail_flt_hash_tuple:
if (ipa3_ctx->dflt_v6_rt_rule_hdl)
__ipa3_del_rt_rule(ipa3_ctx->dflt_v6_rt_rule_hdl);
if (ipa3_ctx->dflt_v4_rt_rule_hdl)
@ -2924,7 +2924,7 @@ fail_schedule_delayed_work:
if (ipa3_ctx->excp_hdr_hdl)
__ipa3_del_hdr(ipa3_ctx->excp_hdr_hdl, false);
ipa3_teardown_sys_pipe(ipa3_ctx->clnt_hdl_cmd);
fail_cmd:
fail_ch20_wa:
return result;
}

View file

@ -62,7 +62,7 @@
#define IPA_SIZE_DL_CSUM_META_TRAILER 8
#define IPA_GSI_MAX_CH_LOW_WEIGHT 15
#define IPA_GSI_EVT_RING_INT_MODT 3200 /* 0.1s under 32KHz clock */
#define IPA_GSI_EVT_RING_INT_MODT (32 * 1) /* 1ms under 32KHz clock */
#define IPA_GSI_CH_20_WA_NUM_CH_TO_ALLOC 10
/* The below virtual channel cannot be used by any entity */
@ -637,10 +637,12 @@ int ipa3_send(struct ipa3_sys_context *sys,
if (i == (num_desc - 1)) {
gsi_xfer_elem_array[i].flags |=
GSI_XFER_FLAG_EOT;
if (sys->ep->client == IPA_CLIENT_APPS_WAN_PROD
&& sys->policy == IPA_POLICY_INTR_MODE)
gsi_xfer_elem_array[i].flags |=
GSI_XFER_FLAG_BEI;
gsi_xfer_elem_array[i].xfer_user_data =
tx_pkt_first;
/* "mark" the last desc */
tx_pkt->cnt = IPA_LAST_DESC_CNT;
} else
gsi_xfer_elem_array[i].flags |=
GSI_XFER_FLAG_CHAIN;
@ -1262,37 +1264,12 @@ int ipa3_setup_sys_pipe(struct ipa_sys_connect_params *sys_in, u32 *clnt_hdl)
}
ep = &ipa3_ctx->ep[ipa_ep_idx];
IPA_ACTIVE_CLIENTS_INC_EP(sys_in->client);
if (ep->valid == 1) {
if (sys_in->client != IPA_CLIENT_APPS_LAN_WAN_PROD) {
IPAERR("EP already allocated.\n");
goto fail_and_disable_clocks;
} else {
if (ipa3_cfg_ep_hdr(ipa_ep_idx,
&sys_in->ipa_ep_cfg.hdr)) {
IPAERR("fail to configure hdr prop of EP.\n");
result = -EFAULT;
goto fail_and_disable_clocks;
}
if (ipa3_cfg_ep_cfg(ipa_ep_idx,
&sys_in->ipa_ep_cfg.cfg)) {
IPAERR("fail to configure cfg prop of EP.\n");
result = -EFAULT;
goto fail_and_disable_clocks;
}
IPADBG("client %d (ep: %d) overlay ok sys=%p\n",
sys_in->client, ipa_ep_idx, ep->sys);
ep->client_notify = sys_in->notify;
ep->priv = sys_in->priv;
*clnt_hdl = ipa_ep_idx;
if (!ep->keep_ipa_awake)
IPA_ACTIVE_CLIENTS_DEC_EP(sys_in->client);
return 0;
}
IPAERR("EP %d already allocated.\n", ipa_ep_idx);
goto fail_gen;
}
IPA_ACTIVE_CLIENTS_INC_EP(sys_in->client);
memset(ep, 0, offsetof(struct ipa3_ep_context, sys));
if (!ep->sys) {
@ -1369,9 +1346,9 @@ int ipa3_setup_sys_pipe(struct ipa_sys_connect_params *sys_in, u32 *clnt_hdl)
IPAERR("fail to configure status of EP.\n");
goto fail_gen2;
}
IPADBG("ep configuration successful\n");
IPADBG("ep %d configuration successful\n", ipa_ep_idx);
} else {
IPADBG("skipping ep configuration\n");
IPADBG("skipping ep %d configuration\n", ipa_ep_idx);
}
if (ipa3_ctx->transport_prototype == IPA_TRANSPORT_TYPE_GSI) {
@ -1485,7 +1462,7 @@ int ipa3_setup_sys_pipe(struct ipa_sys_connect_params *sys_in, u32 *clnt_hdl)
ipa3_ctx->skip_ep_cfg_shadow[ipa_ep_idx] = ep->skip_ep_cfg;
if (!ep->skip_ep_cfg && IPA_CLIENT_IS_PROD(sys_in->client)) {
if (ipa3_ctx->modem_cfg_emb_pipe_flt &&
sys_in->client == IPA_CLIENT_APPS_LAN_WAN_PROD)
sys_in->client == IPA_CLIENT_APPS_WAN_PROD)
IPADBG("modem cfg emb pipe flt\n");
else
ipa3_install_dflt_flt_rules(ipa_ep_idx);
@ -1632,7 +1609,7 @@ int ipa3_teardown_sys_pipe(u32 clnt_hdl)
if (!ep->skip_ep_cfg && IPA_CLIENT_IS_PROD(ep->client)) {
if (ipa3_ctx->modem_cfg_emb_pipe_flt &&
ep->client == IPA_CLIENT_APPS_LAN_WAN_PROD)
ep->client == IPA_CLIENT_APPS_WAN_PROD)
IPADBG("modem cfg emb pipe flt\n");
else
ipa3_delete_dflt_flt_rules(clnt_hdl);
@ -1723,6 +1700,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;
int data_idx;
struct ipa_gsi_ep_config *gsi_ep;
if (unlikely(!ipa3_ctx)) {
@ -1745,10 +1723,10 @@ int ipa3_tx_dp(enum ipa_client_type dst, struct sk_buff *skb,
*
*/
if (IPA_CLIENT_IS_CONS(dst)) {
src_ep_idx = ipa3_get_ep_mapping(IPA_CLIENT_APPS_LAN_WAN_PROD);
src_ep_idx = ipa3_get_ep_mapping(IPA_CLIENT_APPS_LAN_PROD);
if (-1 == src_ep_idx) {
IPAERR("Client %u is not mapped\n",
IPA_CLIENT_APPS_LAN_WAN_PROD);
IPA_CLIENT_APPS_LAN_PROD);
goto fail_gen;
}
dst_ep_idx = ipa3_get_ep_mapping(dst);
@ -1859,40 +1837,54 @@ int ipa3_tx_dp(enum ipa_client_type dst, struct sk_buff *skb,
IPA_STATS_INC_CNT(ipa3_ctx->stats.tx_sw_pkts);
} else {
/* HW data path */
desc[0].opcode =
ipahal_imm_cmd_get_opcode(
IPA_IMM_CMD_IP_PACKET_TAG_STATUS);
desc[0].type = IPA_IMM_CMD_DESC;
desc[0].callback = ipa3_tag_destroy_imm;
desc[1].pyld = skb->data;
desc[1].len = skb_headlen(skb);
desc[1].type = IPA_DATA_DESC_SKB;
desc[1].callback = ipa3_tx_comp_usr_notify_release;
desc[1].user1 = skb;
desc[1].user2 = src_ep_idx;
data_idx = 0;
if (sys->policy == IPA_POLICY_NOINTR_MODE) {
/*
* For non-interrupt mode channel (where there is no
* event ring) TAG STATUS are used for completion
* notification. IPA will generate a status packet with
* tag info as a result of the TAG STATUS command.
*/
desc[data_idx].opcode =
ipahal_imm_cmd_get_opcode(
IPA_IMM_CMD_IP_PACKET_TAG_STATUS);
desc[data_idx].type = IPA_IMM_CMD_DESC;
desc[data_idx].callback = ipa3_tag_destroy_imm;
data_idx++;
}
desc[data_idx].pyld = skb->data;
desc[data_idx].len = skb_headlen(skb);
desc[data_idx].type = IPA_DATA_DESC_SKB;
desc[data_idx].callback = ipa3_tx_comp_usr_notify_release;
desc[data_idx].user1 = skb;
desc[data_idx].user2 = src_ep_idx;
if (meta && meta->dma_address_valid) {
desc[1].dma_address_valid = true;
desc[1].dma_address = meta->dma_address;
desc[data_idx].dma_address_valid = true;
desc[data_idx].dma_address = meta->dma_address;
}
if (num_frags == 0) {
if (ipa3_send(sys, 2, desc, true)) {
if (ipa3_send(sys, data_idx + 1, desc, true)) {
IPAERR("fail to send skb %p HWP\n", skb);
goto fail_mem;
}
} else {
for (f = 0; f < num_frags; f++) {
desc[2+f].frag = &skb_shinfo(skb)->frags[f];
desc[2+f].type = IPA_DATA_DESC_SKB_PAGED;
desc[2+f].len = skb_frag_size(desc[2+f].frag);
desc[data_idx+f+1].frag =
&skb_shinfo(skb)->frags[f];
desc[data_idx+f+1].type =
IPA_DATA_DESC_SKB_PAGED;
desc[data_idx+f+1].len =
skb_frag_size(desc[data_idx+f+1].frag);
}
/* don't free skb till frag mappings are released */
desc[2+f-1].callback = desc[1].callback;
desc[2+f-1].user1 = desc[1].user1;
desc[2+f-1].user2 = desc[1].user2;
desc[1].callback = NULL;
desc[data_idx+f].callback = desc[data_idx].callback;
desc[data_idx+f].user1 = desc[data_idx].user1;
desc[data_idx+f].user2 = desc[data_idx].user2;
desc[data_idx].callback = NULL;
if (ipa3_send(sys, num_frags + 2, desc, true)) {
if (ipa3_send(sys, num_frags + data_idx + 1,
desc, true)) {
IPAERR("fail to send skb %p num_frags %u HWP\n",
skb, num_frags);
goto fail_mem;
@ -3234,7 +3226,8 @@ static void ipa3_free_rx_wrapper(struct ipa3_rx_pkt_wrapper *rk_pkt)
static int ipa3_assign_policy(struct ipa_sys_connect_params *in,
struct ipa3_sys_context *sys)
{
if (in->client == IPA_CLIENT_APPS_CMD_PROD) {
if (in->client == IPA_CLIENT_APPS_CMD_PROD ||
in->client == IPA_CLIENT_APPS_WAN_PROD) {
sys->policy = IPA_POLICY_INTR_MODE;
sys->sps_option = (SPS_O_AUTO_ENABLE | SPS_O_EOT);
sys->sps_callback = ipa3_sps_irq_tx_no_aggr_notify;
@ -3665,7 +3658,7 @@ int ipa3_sys_setup(struct ipa_sys_connect_params *sys_in,
IPA_ACTIVE_CLIENTS_INC_EP(sys_in->client);
if (ep->valid == 1) {
if (sys_in->client != IPA_CLIENT_APPS_LAN_WAN_PROD) {
if (sys_in->client != IPA_CLIENT_APPS_WAN_PROD) {
IPAERR("EP %d already allocated\n", ipa_ep_idx);
goto fail_and_disable_clocks;
} else {
@ -4002,7 +3995,15 @@ static int ipa_gsi_setup_channel(struct ipa_sys_connect_params *in,
gsi_evt_ring_props.ring_base_vaddr;
gsi_evt_ring_props.int_modt = IPA_GSI_EVT_RING_INT_MODT;
gsi_evt_ring_props.int_modc = 1;
if (ep->client == IPA_CLIENT_APPS_WAN_PROD)
gsi_evt_ring_props.int_modc = 248;
else
gsi_evt_ring_props.int_modc = 1;
IPADBG("client=%d moderation threshold cycles=%u cnt=%u\n",
ep->client,
gsi_evt_ring_props.int_modt,
gsi_evt_ring_props.int_modc);
gsi_evt_ring_props.rp_update_addr = 0;
gsi_evt_ring_props.exclusive = true;
gsi_evt_ring_props.err_cb = ipa_gsi_evt_ring_err_cb;
@ -4038,9 +4039,13 @@ static int ipa_gsi_setup_channel(struct ipa_sys_connect_params *in,
* 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. For PROD pipes there is also an additional descriptor
* for TAG STATUS immediate command.
* for TAG STATUS immediate command. APPS_WAN_PROD pipe is an exception
* as this pipe do not use TAG STATUS for completion. Instead it uses
* event ring based completions.
*/
if (IPA_CLIENT_IS_PROD(ep->client))
if (ep->client == IPA_CLIENT_APPS_WAN_PROD)
gsi_channel_props.ring_len = 2 * in->desc_fifo_sz;
else if (IPA_CLIENT_IS_PROD(ep->client))
gsi_channel_props.ring_len = 4 * in->desc_fifo_sz;
else
gsi_channel_props.ring_len = 2 * in->desc_fifo_sz;

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-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
@ -438,7 +438,7 @@ static bool ipa_flt_skip_pipe_config(int pipe)
return true;
}
if ((ipa3_get_ep_mapping(IPA_CLIENT_APPS_LAN_WAN_PROD) == pipe
if ((ipa3_get_ep_mapping(IPA_CLIENT_APPS_WAN_PROD) == pipe
&& ipa3_ctx->modem_cfg_emb_pipe_flt)) {
IPADBG_LOW("skip %d\n", pipe);
return true;

View file

@ -209,7 +209,12 @@ static const struct ipa_ep_configuration ipa3_ep_mapping
[IPA_3_0][IPA_CLIENT_A5_WLAN_AMPDU_PROD] = IPA_CLIENT_NOT_USED,
[IPA_3_0][IPA_CLIENT_A2_EMBEDDED_PROD] = IPA_CLIENT_NOT_USED,
[IPA_3_0][IPA_CLIENT_A2_TETHERED_PROD] = IPA_CLIENT_NOT_USED,
[IPA_3_0][IPA_CLIENT_APPS_LAN_WAN_PROD] = {14, IPA_GROUP_UL, true,
[IPA_3_0][IPA_CLIENT_APPS_LAN_PROD]
= {14, IPA_GROUP_DL, false,
IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
QMB_MASTER_SELECT_DDR},
[IPA_3_0][IPA_CLIENT_APPS_WAN_PROD]
= {3, IPA_GROUP_UL, true,
IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
QMB_MASTER_SELECT_DDR},
[IPA_3_0][IPA_CLIENT_APPS_CMD_PROD]

View file

@ -47,9 +47,9 @@
#define TAILROOM 0 /* for padding by mux layer */
#define MAX_NUM_OF_MUX_CHANNEL 10 /* max mux channels */
#define UL_FILTER_RULE_HANDLE_START 69
#define DEFAULT_OUTSTANDING_HIGH_CTL 96
#define DEFAULT_OUTSTANDING_HIGH 64
#define DEFAULT_OUTSTANDING_LOW 32
#define DEFAULT_OUTSTANDING_HIGH 128
#define DEFAULT_OUTSTANDING_HIGH_CTL (DEFAULT_OUTSTANDING_HIGH+32)
#define DEFAULT_OUTSTANDING_LOW 64
#define IPA_WWAN_DEV_NAME "rmnet_ipa%d"
#define IPA_UPSTEAM_WLAN_IFACE_NAME "wlan0"
@ -140,7 +140,7 @@ struct rmnet_ipa3_context {
void *subsys_notify_handle;
u32 apps_to_ipa3_hdl;
u32 ipa3_to_apps_hdl;
struct mutex ipa_to_apps_pipe_handle_guard;
struct mutex pipe_handle_guard;
};
static struct rmnet_ipa3_context *rmnet_ipa3_ctx;
@ -661,7 +661,7 @@ static int ipa3_wwan_add_ul_flt_rule_to_ipa(void)
}
param->commit = 1;
param->ep = IPA_CLIENT_APPS_LAN_WAN_PROD;
param->ep = IPA_CLIENT_APPS_WAN_PROD;
param->global = false;
param->num_rules = (uint8_t)1;
@ -700,7 +700,7 @@ static int ipa3_wwan_add_ul_flt_rule_to_ipa(void)
/* send ipa_fltr_installed_notif_req_msg_v01 to Q6*/
req->source_pipe_index =
ipa3_get_ep_mapping(IPA_CLIENT_APPS_LAN_WAN_PROD);
ipa3_get_ep_mapping(IPA_CLIENT_APPS_WAN_PROD);
req->install_status = QMI_RESULT_SUCCESS_V01;
req->rule_id_valid = 1;
req->rule_id_len = rmnet_ipa3_ctx->num_q6_rules;
@ -850,14 +850,14 @@ static int ipa3_wwan_register_to_ipa(int index)
rx_ipv4_property->attrib.meta_data =
rmnet_ipa3_ctx->mux_channel[index].mux_id << WWAN_METADATA_SHFT;
rx_ipv4_property->attrib.meta_data_mask = WWAN_METADATA_MASK;
rx_ipv4_property->src_pipe = IPA_CLIENT_APPS_LAN_WAN_PROD;
rx_ipv4_property->src_pipe = IPA_CLIENT_APPS_WAN_PROD;
rx_ipv6_property = &rx_properties.prop[1];
rx_ipv6_property->ip = IPA_IP_v6;
rx_ipv6_property->attrib.attrib_mask |= IPA_FLT_META_DATA;
rx_ipv6_property->attrib.meta_data =
rmnet_ipa3_ctx->mux_channel[index].mux_id << WWAN_METADATA_SHFT;
rx_ipv6_property->attrib.meta_data_mask = WWAN_METADATA_MASK;
rx_ipv6_property->src_pipe = IPA_CLIENT_APPS_LAN_WAN_PROD;
rx_ipv6_property->src_pipe = IPA_CLIENT_APPS_WAN_PROD;
rx_properties.num_props = 2;
pyld_sz = rmnet_ipa3_ctx->num_q6_rules *
@ -1139,9 +1139,10 @@ send:
memset(&meta, 0, sizeof(meta));
meta.pkt_init_dst_ep_valid = true;
meta.pkt_init_dst_ep_remote = true;
ret = ipa3_tx_dp(IPA_CLIENT_Q6_LAN_CONS, skb, &meta);
meta.pkt_init_dst_ep = IPA_CLIENT_Q6_LAN_CONS;
ret = ipa3_tx_dp(IPA_CLIENT_APPS_WAN_PROD, skb, &meta);
} else {
ret = ipa3_tx_dp(IPA_CLIENT_APPS_LAN_WAN_PROD, skb, NULL);
ret = ipa3_tx_dp(IPA_CLIENT_APPS_WAN_PROD, skb, NULL);
}
if (ret) {
@ -1283,7 +1284,7 @@ static int handle3_ingress_format(struct net_device *dev,
IPA_ENABLE_CS_OFFLOAD_DL;
if ((in->u.data) & RMNET_IOCTL_INGRESS_FORMAT_AGG_DATA) {
IPAWANERR("get AGG size %d count %d\n",
IPAWANDBG("get AGG size %d count %d\n",
in->u.ingress_format.agg_size,
in->u.ingress_format.agg_count);
@ -1328,17 +1329,17 @@ static int handle3_ingress_format(struct net_device *dev,
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);
mutex_lock(&rmnet_ipa3_ctx->pipe_handle_guard);
if (atomic_read(&rmnet_ipa3_ctx->is_ssr)) {
IPAWANDBG("In SSR sequence/recovery\n");
mutex_unlock(&rmnet_ipa3_ctx->ipa_to_apps_pipe_handle_guard);
mutex_unlock(&rmnet_ipa3_ctx->pipe_handle_guard);
return -EFAULT;
}
ret = ipa3_setup_sys_pipe(&rmnet_ipa3_ctx->ipa_to_apps_ep_cfg,
&rmnet_ipa3_ctx->ipa3_to_apps_hdl);
mutex_unlock(&rmnet_ipa3_ctx->ipa_to_apps_pipe_handle_guard);
mutex_unlock(&rmnet_ipa3_ctx->pipe_handle_guard);
if (ret)
IPAWANERR("failed to configure ingress\n");
@ -1346,6 +1347,104 @@ static int handle3_ingress_format(struct net_device *dev,
return ret;
}
/**
* handle3_egress_format() - Egress data format configuration
*
* Setup IPA egress system pipe and Configure:
* header handling, checksum, de-aggregation and fifo size
*
* @dev: network device
* @e: egress configuration
*/
static int handle3_egress_format(struct net_device *dev,
struct rmnet_ioctl_extended_s *e)
{
int rc;
struct ipa_sys_connect_params *ipa_wan_ep_cfg;
IPAWANDBG("get RMNET_IOCTL_SET_EGRESS_DATA_FORMAT\n");
ipa_wan_ep_cfg = &rmnet_ipa3_ctx->apps_to_ipa_ep_cfg;
if ((e->u.data) & RMNET_IOCTL_EGRESS_FORMAT_CHECKSUM) {
ipa_wan_ep_cfg->ipa_ep_cfg.hdr.hdr_len = 8;
ipa_wan_ep_cfg->ipa_ep_cfg.cfg.cs_offload_en =
IPA_ENABLE_CS_OFFLOAD_UL;
ipa_wan_ep_cfg->ipa_ep_cfg.cfg.cs_metadata_hdr_offset = 1;
} else {
ipa_wan_ep_cfg->ipa_ep_cfg.hdr.hdr_len = 4;
}
if ((e->u.data) & RMNET_IOCTL_EGRESS_FORMAT_AGGREGATION) {
IPAWANERR("WAN UL Aggregation not supported!!\n");
WARN_ON(1);
return -EINVAL;
ipa_wan_ep_cfg->ipa_ep_cfg.aggr.aggr_en = IPA_ENABLE_DEAGGR;
ipa_wan_ep_cfg->ipa_ep_cfg.aggr.aggr = IPA_QCMAP;
ipa_wan_ep_cfg->ipa_ep_cfg.deaggr.packet_offset_valid = false;
ipa_wan_ep_cfg->ipa_ep_cfg.hdr.hdr_ofst_pkt_size = 2;
ipa_wan_ep_cfg->ipa_ep_cfg.hdr_ext.hdr_total_len_or_pad_valid =
true;
ipa_wan_ep_cfg->ipa_ep_cfg.hdr_ext.hdr_total_len_or_pad =
IPA_HDR_PAD;
ipa_wan_ep_cfg->ipa_ep_cfg.hdr_ext.hdr_pad_to_alignment =
2;
ipa_wan_ep_cfg->ipa_ep_cfg.hdr_ext.hdr_payload_len_inc_padding =
true;
ipa_wan_ep_cfg->ipa_ep_cfg.hdr_ext.hdr_total_len_or_pad_offset =
0;
ipa_wan_ep_cfg->ipa_ep_cfg.hdr_ext.hdr_little_endian =
false;
} else {
IPAWANDBG("WAN UL Aggregation disabled\n");
ipa_wan_ep_cfg->ipa_ep_cfg.aggr.aggr_en = IPA_BYPASS_AGGR;
}
ipa_wan_ep_cfg->ipa_ep_cfg.hdr.hdr_ofst_metadata_valid = 1;
/* modem want offset at 0! */
ipa_wan_ep_cfg->ipa_ep_cfg.hdr.hdr_ofst_metadata = 0;
ipa_wan_ep_cfg->ipa_ep_cfg.mode.dst = IPA_CLIENT_APPS_WAN_PROD;
ipa_wan_ep_cfg->ipa_ep_cfg.mode.mode = IPA_BASIC;
ipa_wan_ep_cfg->client = IPA_CLIENT_APPS_WAN_PROD;
ipa_wan_ep_cfg->notify = apps_ipa_tx_complete_notify;
ipa_wan_ep_cfg->desc_fifo_sz = IPA_SYS_TX_DATA_DESC_FIFO_SZ;
ipa_wan_ep_cfg->priv = dev;
mutex_lock(&rmnet_ipa3_ctx->pipe_handle_guard);
if (atomic_read(&rmnet_ipa3_ctx->is_ssr)) {
IPAWANDBG("In SSR sequence/recovery\n");
mutex_unlock(&rmnet_ipa3_ctx->pipe_handle_guard);
return -EFAULT;
}
rc = ipa3_setup_sys_pipe(
ipa_wan_ep_cfg, &rmnet_ipa3_ctx->apps_to_ipa3_hdl);
if (rc) {
IPAWANERR("failed to config egress endpoint\n");
mutex_unlock(&rmnet_ipa3_ctx->pipe_handle_guard);
return rc;
}
mutex_unlock(&rmnet_ipa3_ctx->pipe_handle_guard);
if (rmnet_ipa3_ctx->num_q6_rules != 0) {
/* already got Q6 UL filter rules*/
if (ipa3_qmi_ctx->modem_cfg_emb_pipe_flt == false)
rc = ipa3_wwan_add_ul_flt_rule_to_ipa();
if (rc)
IPAWANERR("install UL rules failed\n");
else
rmnet_ipa3_ctx->a7_ul_flt_set = true;
} else {
/* wait Q6 UL filter rules*/
IPAWANDBG("no UL-rules\n");
}
rmnet_ipa3_ctx->egress_set = true;
return rc;
}
/**
* ipa3_wwan_ioctl() - I/O control for wwan network driver.
*
@ -1507,7 +1606,7 @@ static int ipa3_wwan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
case RMNET_IOCTL_GET_EP_PAIR:
IPAWANDBG("get ioctl: RMNET_IOCTL_GET_EP_PAIR\n");
extend_ioctl_data.u.ipa_ep_pair.consumer_pipe_num =
ipa3_get_ep_mapping(IPA_CLIENT_APPS_LAN_WAN_PROD);
ipa3_get_ep_mapping(IPA_CLIENT_APPS_WAN_PROD);
extend_ioctl_data.u.ipa_ep_pair.producer_pipe_num =
ipa3_get_ep_mapping(IPA_CLIENT_APPS_WAN_CONS);
if (copy_to_user((u8 *)ifr->ifr_ifru.ifru_data,
@ -1593,72 +1692,7 @@ static int ipa3_wwan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
rmnet_ipa3_ctx->rmnet_index++;
break;
case RMNET_IOCTL_SET_EGRESS_DATA_FORMAT:
IPAWANDBG("get RMNET_IOCTL_SET_EGRESS_DATA_FORMAT\n");
if ((extend_ioctl_data.u.data) &
RMNET_IOCTL_EGRESS_FORMAT_CHECKSUM) {
rmnet_ipa3_ctx->apps_to_ipa_ep_cfg.
ipa_ep_cfg.hdr.hdr_len = 8;
rmnet_ipa3_ctx->apps_to_ipa_ep_cfg.
ipa_ep_cfg.cfg.cs_offload_en =
IPA_ENABLE_CS_OFFLOAD_UL;
rmnet_ipa3_ctx->apps_to_ipa_ep_cfg.
ipa_ep_cfg.cfg.cs_metadata_hdr_offset
= 1;
} else {
rmnet_ipa3_ctx->apps_to_ipa_ep_cfg.
ipa_ep_cfg.hdr.hdr_len = 4;
}
if ((extend_ioctl_data.u.data) &
RMNET_IOCTL_EGRESS_FORMAT_AGGREGATION)
rmnet_ipa3_ctx->apps_to_ipa_ep_cfg.
ipa_ep_cfg.aggr.aggr_en =
IPA_ENABLE_AGGR;
else
rmnet_ipa3_ctx->apps_to_ipa_ep_cfg.
ipa_ep_cfg.aggr.aggr_en =
IPA_BYPASS_AGGR;
rmnet_ipa3_ctx->apps_to_ipa_ep_cfg.ipa_ep_cfg.hdr.
hdr_ofst_metadata_valid = 1;
/* modem want offset at 0! */
rmnet_ipa3_ctx->apps_to_ipa_ep_cfg.ipa_ep_cfg.hdr.
hdr_ofst_metadata = 0;
rmnet_ipa3_ctx->apps_to_ipa_ep_cfg.ipa_ep_cfg.mode.
dst = IPA_CLIENT_APPS_LAN_WAN_PROD;
rmnet_ipa3_ctx->apps_to_ipa_ep_cfg.ipa_ep_cfg.mode.
mode = IPA_BASIC;
rmnet_ipa3_ctx->apps_to_ipa_ep_cfg.client =
IPA_CLIENT_APPS_LAN_WAN_PROD;
rmnet_ipa3_ctx->apps_to_ipa_ep_cfg.notify =
apps_ipa_tx_complete_notify;
rmnet_ipa3_ctx->apps_to_ipa_ep_cfg.desc_fifo_sz =
IPA_SYS_TX_DATA_DESC_FIFO_SZ;
rmnet_ipa3_ctx->apps_to_ipa_ep_cfg.priv = dev;
rc = ipa3_setup_sys_pipe(
&rmnet_ipa3_ctx->apps_to_ipa_ep_cfg,
&rmnet_ipa3_ctx->apps_to_ipa3_hdl);
if (rc)
IPAWANERR("failed to config egress endpoint\n");
if (rmnet_ipa3_ctx->num_q6_rules != 0) {
/* already got Q6 UL filter rules*/
if (ipa3_qmi_ctx->modem_cfg_emb_pipe_flt
== false)
rc = ipa3_wwan_add_ul_flt_rule_to_ipa();
else
rc = 0;
rmnet_ipa3_ctx->egress_set = true;
if (rc)
IPAWANERR("install UL rules failed\n");
else
rmnet_ipa3_ctx->a7_ul_flt_set = true;
} else {
/* wait Q6 UL filter rules*/
rmnet_ipa3_ctx->egress_set = true;
IPAWANDBG("no UL-rules, egress_set(%d)\n",
rmnet_ipa3_ctx->egress_set);
}
rc = handle3_egress_format(dev, &extend_ioctl_data);
break;
case RMNET_IOCTL_SET_INGRESS_DATA_FORMAT:/* Set IDF */
rc = handle3_ingress_format(dev, &extend_ioctl_data);
@ -2263,15 +2297,20 @@ static int ipa3_wwan_remove(struct platform_device *pdev)
int ret;
pr_info("rmnet_ipa started deinitialization\n");
mutex_lock(&rmnet_ipa3_ctx->ipa_to_apps_pipe_handle_guard);
mutex_lock(&rmnet_ipa3_ctx->pipe_handle_guard);
ret = ipa3_teardown_sys_pipe(rmnet_ipa3_ctx->ipa3_to_apps_hdl);
if (ret < 0)
IPAWANERR("Failed to teardown IPA->APPS pipe\n");
else
rmnet_ipa3_ctx->ipa3_to_apps_hdl = -1;
ret = ipa3_teardown_sys_pipe(rmnet_ipa3_ctx->apps_to_ipa3_hdl);
if (ret < 0)
IPAWANERR("Failed to teardown APPS->IPA pipe\n");
else
rmnet_ipa3_ctx->apps_to_ipa3_hdl = -1;
if (ipa3_rmnet_res.ipa_napi_enable)
netif_napi_del(&(rmnet_ipa3_ctx->wwan_priv->napi));
mutex_unlock(&rmnet_ipa3_ctx->ipa_to_apps_pipe_handle_guard);
mutex_unlock(&rmnet_ipa3_ctx->pipe_handle_guard);
unregister_netdev(IPA_NETDEV());
ret = ipa_rm_delete_dependency(IPA_RM_RESOURCE_WWAN_0_PROD,
IPA_RM_RESOURCE_Q6_CONS);
@ -3160,8 +3199,9 @@ static int __init ipa3_wwan_init(void)
atomic_set(&rmnet_ipa3_ctx->is_initialized, 0);
atomic_set(&rmnet_ipa3_ctx->is_ssr, 0);
mutex_init(&rmnet_ipa3_ctx->ipa_to_apps_pipe_handle_guard);
mutex_init(&rmnet_ipa3_ctx->pipe_handle_guard);
rmnet_ipa3_ctx->ipa3_to_apps_hdl = -1;
rmnet_ipa3_ctx->apps_to_ipa3_hdl = -1;
/* Register for Modem SSR */
rmnet_ipa3_ctx->subsys_notify_handle = subsys_notif_register_notifier(
SUBSYS_MODEM,
@ -3175,7 +3215,7 @@ static int __init ipa3_wwan_init(void)
static void __exit ipa3_wwan_cleanup(void)
{
int ret;
mutex_destroy(&rmnet_ipa3_ctx->ipa_to_apps_pipe_handle_guard);
mutex_destroy(&rmnet_ipa3_ctx->pipe_handle_guard);
ret = subsys_notif_unregister_notifier(
rmnet_ipa3_ctx->subsys_notify_handle, &ipa3_ssr_notifier);
if (ret)

View file

@ -147,7 +147,9 @@ enum ipa_client_type {
IPA_CLIENT_A5_WLAN_AMPDU_PROD,
IPA_CLIENT_A2_EMBEDDED_PROD,
IPA_CLIENT_A2_TETHERED_PROD,
IPA_CLIENT_APPS_LAN_WAN_PROD,
IPA_CLIENT_APPS_LAN_PROD,
IPA_CLIENT_APPS_WAN_PROD,
IPA_CLIENT_APPS_LAN_WAN_PROD = IPA_CLIENT_APPS_WAN_PROD,
IPA_CLIENT_APPS_CMD_PROD,
IPA_CLIENT_ODU_PROD,
IPA_CLIENT_MHI_PROD,