From ac6004def6d9e63d58420e89fb337d8f224f3bff Mon Sep 17 00:00:00 2001 From: Bojun Pan Date: Tue, 16 Jun 2020 14:08:44 -0700 Subject: [PATCH] msm:ipa: fix for EOB scatter & gather support 1. Fix the issue where IPA adds the fragments into the skb in reverse. 2. Fix the size update to stack for EOB packet. Change-Id: I24e33391859dfe735cd3258a797e2c86d90bdfd6 --- drivers/platform/msm/ipa/ipa_v3/ipa_dp.c | 16 ++++++++++------ drivers/platform/msm/ipa/ipa_v3/ipa_i.h | 4 +++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c b/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c index 164308be9639..8671da34ee93 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c @@ -3558,6 +3558,7 @@ static struct sk_buff *handle_page_completion(struct gsi_chan_xfer_notify struct list_head *head; struct ipa3_sys_context *sys; struct ipa_rx_page_data rx_page; + int size; sys = (struct ipa3_sys_context *) notify->chan_user_data; rx_pkt = (struct ipa3_rx_pkt_wrapper *) notify->xfer_user_data; @@ -3567,9 +3568,12 @@ static struct sk_buff *handle_page_completion(struct gsi_chan_xfer_notify rx_pkt->sys->len--; spin_unlock_bh(&rx_pkt->sys->spinlock); - /* TODO: truesize handle for EOB */ - if (update_truesize) - IPAERR("update_truesize not supported\n"); + if (likely(notify->bytes_xfered)) + rx_pkt->data_len = notify->bytes_xfered; + else { + IPAERR_RL("unexpected 0 byte_xfered\n"); + rx_pkt->data_len = rx_pkt->len; + } if (notify->veid >= GSI_VEID_MAX) { IPAERR("notify->veid > GSI_VEID_MAX\n"); @@ -3610,9 +3614,9 @@ static struct sk_buff *handle_page_completion(struct gsi_chan_xfer_notify IPA_STATS_INC_CNT(ipa3_ctx->stats.rx_page_drop_cnt); return NULL; } - /* go over the list backward to save computations on updating length */ - list_for_each_entry_safe_reverse(rx_pkt, tmp, head, link) { + list_for_each_entry_safe(rx_pkt, tmp, head, link) { rx_page = rx_pkt->page_data; + size = rx_pkt->data_len; list_del(&rx_pkt->link); if (rx_page.is_tmp_alloc) @@ -3627,7 +3631,7 @@ static struct sk_buff *handle_page_completion(struct gsi_chan_xfer_notify skb_add_rx_frag(rx_skb, skb_shinfo(rx_skb)->nr_frags, rx_page.page, 0, - notify->bytes_xfered, + size, PAGE_SIZE << IPA_WAN_PAGE_ORDER); } } else { diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_i.h b/drivers/platform/msm/ipa/ipa_v3/ipa_i.h index 272c44d37930..245d40aa37cd 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_i.h +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_i.h @@ -1192,7 +1192,8 @@ struct ipa3_desc { * @skb: skb * @dma_address: DMA address of this Rx packet * @link: linked to the Rx packets on that pipe - * @len: how many bytes are copied into skb's flat buffer + * @len: fixed allocated skb length (i.e. times of page size) + * @data_len: how many bytes are copied into skb's flat buffer */ struct ipa3_rx_pkt_wrapper { struct list_head link; @@ -1201,6 +1202,7 @@ struct ipa3_rx_pkt_wrapper { struct ipa_rx_page_data page_data; }; u32 len; + u32 data_len; struct work_struct work; struct ipa3_sys_context *sys; };