dataipa: IPA HW TTL update offload - debugfs

Count TTL HW updates and add to debugfs status and stats logging.

Change-Id: I72cf48a2aa6cc6fcee0c709d1366920b5430576f
Signed-off-by: Eliad Ben Yishay <quic_ebenyish@quicinc.com>
这个提交包含在:
Eliad Ben Yishay
2022-01-23 14:03:30 +02:00
提交者 Gerrit - the friendly Code Review server
父节点 7f064cd7a1
当前提交 7a7fa3c544
修改 3 个文件,包含 122 行新增6 行删除

查看文件

@@ -1,6 +1,40 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/* /*
* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved. * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
*
* Changes from Qualcomm Innovation Center are provided under the following license:
*
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted (subject to the limitations in the
* disclaimer below) provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
* GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
*/ */
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
@@ -1075,6 +1109,7 @@ static ssize_t ipa3_read_rt(struct file *file, char __user *ubuf, size_t count,
mutex_lock(&ipa3_ctx->lock); mutex_lock(&ipa3_ctx->lock);
pr_err("==== Routing Tables Start ====\n");
if (ipa3_ctx->rt_tbl_hash_lcl[ip]) if (ipa3_ctx->rt_tbl_hash_lcl[ip])
pr_err("Hashable table resides on local memory\n"); pr_err("Hashable table resides on local memory\n");
else else
@@ -1129,11 +1164,14 @@ static ssize_t ipa3_read_rt(struct file *file, char __user *ubuf, size_t count,
if (ipa3_ctx->ipa_hw_type >= IPA_HW_v5_0) if (ipa3_ctx->ipa_hw_type >= IPA_HW_v5_0)
pr_err("close_aggr_irq_mod: %u\n", pr_err("close_aggr_irq_mod: %u\n",
entry->rule.close_aggr_irq_mod); entry->rule.close_aggr_irq_mod);
if (ipa3_ctx->ipa_hw_type >= IPA_HW_v5_5)
pr_err("ttl_update: %u\n", entry->rule.ttl_update);
ipa3_attrib_dump(&entry->rule.attrib, ip); ipa3_attrib_dump(&entry->rule.attrib, ip);
i++; i++;
} }
} }
pr_err("==== Routing Tables End ====\n");
mutex_unlock(&ipa3_ctx->lock); mutex_unlock(&ipa3_ctx->lock);
return 0; return 0;
@@ -1310,6 +1348,7 @@ static ssize_t ipa3_read_flt(struct file *file, char __user *ubuf, size_t count,
mutex_lock(&ipa3_ctx->lock); mutex_lock(&ipa3_ctx->lock);
pr_err("==== Filtering Tables Start ====\n");
if (ipa3_ctx->flt_tbl_hash_lcl[ip]) if (ipa3_ctx->flt_tbl_hash_lcl[ip])
pr_err("Hashable table resides on local memory\n"); pr_err("Hashable table resides on local memory\n");
else else
@@ -1377,9 +1416,12 @@ static ssize_t ipa3_read_flt(struct file *file, char __user *ubuf, size_t count,
ipa3_attrib_dump( ipa3_attrib_dump(
&entry->rule.attrib, ip); &entry->rule.attrib, ip);
i++; i++;
if (ipa3_ctx->ipa_hw_type >= IPA_HW_v5_5)
pr_err("ttl_update %u ", entry->rule.ttl_update);
} }
} }
bail: bail:
pr_err("==== Filtering Tables End ====\n");
mutex_unlock(&ipa3_ctx->lock); mutex_unlock(&ipa3_ctx->lock);
return res; return res;
@@ -1538,7 +1580,8 @@ static ssize_t ipa3_read_stats(struct file *file, char __user *ubuf,
"num_buff_below_thresh_for_def_pipe_notified=%u\n" "num_buff_below_thresh_for_def_pipe_notified=%u\n"
"num_buff_above_thresh_for_coal_pipe_notified=%u\n" "num_buff_above_thresh_for_coal_pipe_notified=%u\n"
"num_buff_below_thresh_for_coal_pipe_notified=%u\n" "num_buff_below_thresh_for_coal_pipe_notified=%u\n"
"pipe_setup_fail_cnt=%u\n", "pipe_setup_fail_cnt=%u\n"
"ttl_count=%u\n",
ipa3_ctx->stats.tx_sw_pkts, ipa3_ctx->stats.tx_sw_pkts,
ipa3_ctx->stats.tx_hw_pkts, ipa3_ctx->stats.tx_hw_pkts,
ipa3_ctx->stats.tx_non_linear, ipa3_ctx->stats.tx_non_linear,
@@ -1565,7 +1608,8 @@ static ssize_t ipa3_read_stats(struct file *file, char __user *ubuf,
atomic_read(&ipa3_ctx->stats.num_buff_below_thresh_for_def_pipe_notified), atomic_read(&ipa3_ctx->stats.num_buff_below_thresh_for_def_pipe_notified),
atomic_read(&ipa3_ctx->stats.num_buff_above_thresh_for_coal_pipe_notified), atomic_read(&ipa3_ctx->stats.num_buff_above_thresh_for_coal_pipe_notified),
atomic_read(&ipa3_ctx->stats.num_buff_below_thresh_for_coal_pipe_notified), atomic_read(&ipa3_ctx->stats.num_buff_below_thresh_for_coal_pipe_notified),
ipa3_ctx->stats.pipe_setup_fail_cnt ipa3_ctx->stats.pipe_setup_fail_cnt,
ipa3_ctx->stats.ttl_cnt
); );
cnt += nbytes; cnt += nbytes;
@@ -2409,7 +2453,7 @@ static ssize_t ipa3_read_nat4(
bool any_table_active = (nm_ptr->ddr_in_use || nm_ptr->sram_in_use); bool any_table_active = (nm_ptr->ddr_in_use || nm_ptr->sram_in_use);
pr_err("IPA3 NAT stats\n"); pr_err("==== NAT Tables Start ====\n");
if (!dev->is_dev_init) { if (!dev->is_dev_init) {
pr_err("NAT hasn't been initialized or not supported\n"); pr_err("NAT hasn't been initialized or not supported\n");
@@ -2496,6 +2540,7 @@ static ssize_t ipa3_read_nat4(
} }
bail: bail:
pr_err("==== NAT Tables End ====\n");
mutex_unlock(&dev->lock); mutex_unlock(&dev->lock);
ret: ret:
@@ -2932,6 +2977,7 @@ static void ipa_dump_status(struct ipahal_pkt_status *status)
IPA_DUMP_STATUS_FIELD(hdr_offset); IPA_DUMP_STATUS_FIELD(hdr_offset);
IPA_DUMP_STATUS_FIELD(frag_hit); IPA_DUMP_STATUS_FIELD(frag_hit);
IPA_DUMP_STATUS_FIELD(frag_rule); IPA_DUMP_STATUS_FIELD(frag_rule);
IPA_DUMP_STATUS_FIELD(ttl_dec);
} }
static ssize_t ipa_status_stats_read(struct file *file, char __user *ubuf, static ssize_t ipa_status_stats_read(struct file *file, char __user *ubuf,

查看文件

@@ -2,6 +2,40 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/* /*
* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved. * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
*
* Changes from Qualcomm Innovation Center are provided under the following license:
*
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted (subject to the limitations in the
* disclaimer below) provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
* GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
*/ */
#include <linux/delay.h> #include <linux/delay.h>
@@ -3905,9 +3939,9 @@ static int ipa3_wan_rx_pyld_hdlr(struct sk_buff *skb,
} }
ipahal_pkt_status_parse(skb->data, &status); ipahal_pkt_status_parse(skb->data, &status);
skb_data = skb->data; skb_data = skb->data;
IPADBG_LOW("STATUS opcode=%d src=%d dst=%d len=%d\n", IPADBG_LOW("STATUS opcode=%d src=%d dst=%d len=%d ttl_dec=%d\n",
status.status_opcode, status.endp_src_idx, status.status_opcode, status.endp_src_idx, status.endp_dest_idx,
status.endp_dest_idx, status.pkt_len); status.pkt_len, status.ttl_dec);
if (sys->status_stat) { if (sys->status_stat) {
sys->status_stat->status[sys->status_stat->curr] = sys->status_stat->status[sys->status_stat->curr] =
@@ -3930,6 +3964,8 @@ static int ipa3_wan_rx_pyld_hdlr(struct sk_buff *skb,
} }
IPA_STATS_INC_CNT(ipa3_ctx->stats.rx_pkts); IPA_STATS_INC_CNT(ipa3_ctx->stats.rx_pkts);
if (status.ttl_dec)
IPA_STATS_INC_CNT(ipa3_ctx->stats.ttl_cnt);
if (status.endp_dest_idx >= ipa3_ctx->ipa_num_pipes || if (status.endp_dest_idx >= ipa3_ctx->ipa_num_pipes ||
status.endp_src_idx >= ipa3_ctx->ipa_num_pipes) { status.endp_src_idx >= ipa3_ctx->ipa_num_pipes) {
IPAERR("status fields invalid\n"); IPAERR("status fields invalid\n");

查看文件

@@ -1,7 +1,40 @@
/* SPDX-License-Identifier: GPL-2.0-only */ /* SPDX-License-Identifier: GPL-2.0-only */
/* /*
* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved. * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
*
* Changes from Qualcomm Innovation Center are provided under the following license:
*
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted (subject to the limitations in the
* disclaimer below) provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
* GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
*/ */
#ifndef _IPA3_I_H_ #ifndef _IPA3_I_H_
@@ -1579,6 +1612,7 @@ struct ipa3_stats {
u64 num_sort_tasklet_sched[3]; u64 num_sort_tasklet_sched[3];
u64 num_of_times_wq_reschd; u64 num_of_times_wq_reschd;
u64 page_recycle_cnt_in_tasklet; u64 page_recycle_cnt_in_tasklet;
u32 ttl_cnt;
}; };
/* offset for each stats */ /* offset for each stats */