Merge "msm: ipa3: Fix to handle zero length frag skb packet"

This commit is contained in:
qctecmdr
2021-09-02 04:52:45 -07:00
committed by Gerrit - the friendly Code Review server
3 changed files with 24 additions and 14 deletions

View File

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
*/
#ifdef CONFIG_DEBUG_FS
@@ -1249,8 +1249,9 @@ static ssize_t ipa3_read_stats(struct file *file, char __user *ubuf,
"lan_rx_empty=%u\n"
"lan_repl_rx_empty=%u\n"
"flow_enable=%u\n"
"flow_disable=%u\n",
"rx_page_drop_cnt=%u\n",
"flow_disable=%u\n"
"rx_page_drop_cnt=%u\n"
"zero_len_frag_pkt_cnt=%u\n",
ipa3_ctx->stats.tx_sw_pkts,
ipa3_ctx->stats.tx_hw_pkts,
ipa3_ctx->stats.tx_non_linear,
@@ -1267,7 +1268,8 @@ static ssize_t ipa3_read_stats(struct file *file, char __user *ubuf,
ipa3_ctx->stats.lan_repl_rx_empty,
ipa3_ctx->stats.flow_enable,
ipa3_ctx->stats.flow_disable,
ipa3_ctx->stats.rx_page_drop_cnt);
ipa3_ctx->stats.rx_page_drop_cnt,
ipa3_ctx->stats.zero_len_frag_pkt_cnt);
cnt += nbytes;
for (i = 0; i < IPAHAL_PKT_STATUS_EXCEPTION_MAX; i++) {

View File

@@ -1725,22 +1725,29 @@ int ipa3_tx_dp(enum ipa_client_type dst, struct sk_buff *skb,
data_idx++;
for (f = 0; f < num_frags; f++) {
desc[data_idx + f].frag = &skb_shinfo(skb)->frags[f];
desc[data_idx + f].type = IPA_DATA_DESC_SKB_PAGED;
desc[data_idx + f].len =
skb_frag_size(desc[data_idx + f].frag);
if (skb_frag_size(&skb_shinfo(skb)->frags[f]) != 0) {
desc[data_idx].frag =
&skb_shinfo(skb)->frags[f];
desc[data_idx].type =
IPA_DATA_DESC_SKB_PAGED;
desc[data_idx].len =
skb_frag_size(desc[data_idx].frag);
data_idx++;
} else {
IPAERR_RL("Received zero len SKB frag pkt\n");
IPA_STATS_INC_CNT(
ipa3_ctx->stats.zero_len_frag_pkt_cnt);
}
}
/* don't free skb till frag mappings are released */
if (num_frags) {
desc[data_idx + f - 1].callback =
desc[skb_idx].callback;
desc[data_idx + f - 1].user1 = desc[skb_idx].user1;
desc[data_idx + f - 1].user2 = desc[skb_idx].user2;
desc[data_idx - 1].callback = desc[skb_idx].callback;
desc[data_idx - 1].user1 = desc[skb_idx].user1;
desc[data_idx - 1].user2 = desc[skb_idx].user2;
desc[skb_idx].callback = NULL;
}
if (unlikely(ipa3_send(sys, num_frags + data_idx,
desc, true))) {
if (unlikely(ipa3_send(sys, data_idx, desc, true))) {
IPAERR_RL("fail to send skb %pK num_frags %u SWP\n",
skb, num_frags);
goto fail_send;

View File

@@ -1381,6 +1381,7 @@ struct ipa3_stats {
u32 flow_disable;
u32 tx_non_linear;
u32 rx_page_drop_cnt;
u32 zero_len_frag_pkt_cnt;
struct ipa3_page_recycle_stats page_recycle_stats[2];
};