msm: ipa: Add debugfs support for Dual NIC
Retrieves debugfs data for both ethernet clients in case of Dual NIC mode. Change-Id: I62eb6af1dedaa738674979520d393c753c0f0190 Acked-by: Eliad Ben Yishay <ebenyish@qti.qualcomm.com> Signed-off-by: Ilia Lin <quic_ilial@quicinc.com>
Tento commit je obsažen v:

odevzdal
Gerrit - the friendly Code Review server

rodič
754f226ac2
revize
6cf42d86a8
@@ -60,6 +60,11 @@
|
||||
#define GSI_FC_STATE_INDEX_SHRAM (7)
|
||||
#define GSI_FC_PENDING_MASK (0x00080000)
|
||||
|
||||
#define GSI_NTN3_PENDING_DB_AFTER_RB_MASK 18
|
||||
#define GSI_NTN3_PENDING_DB_AFTER_RB_SHIFT 1
|
||||
/* FOR_SEQ_HIGH channel scratch: (((8 * (pipe_id * ctx_size + offset_lines)) + 4) / 4) */
|
||||
#define GSI_GSI_SHRAM_n_EP_FOR_SEQ_HIGH_N_GET(ep_id) (((8 * (ep_id * 10 + 9)) + 4) / 4)
|
||||
|
||||
#ifndef CONFIG_DEBUG_FS
|
||||
void gsi_debugfs_init(void)
|
||||
{
|
||||
@@ -5308,6 +5313,80 @@ int gsi_get_refetch_reg(unsigned long chan_hdl, bool is_rp)
|
||||
}
|
||||
EXPORT_SYMBOL(gsi_get_refetch_reg);
|
||||
|
||||
/*
|
||||
* ; +------------------------------------------------------+
|
||||
* ; | NTN3 Rx Channel Scratch |
|
||||
* ; +-------------+--------------------------------+-------+
|
||||
* ; | 32-bit word | Field | Bits |
|
||||
* ; +-------------+--------------------------------+-------+
|
||||
* ; | 4 | NTN_PENDING_DB_AFTER_ROLLBACK | 18-18 |
|
||||
* ; +-------------+--------------------------------+-------+
|
||||
* ; | 5 | NTN_MSI_DB_INDEX_VALUE | 0-31 |
|
||||
* ; +-------------+--------------------------------+-------+
|
||||
* ; | 6 | NTN_RX_CHAIN_COUNTER | 0-31 |
|
||||
* ; +-------------+--------------------------------+-------+
|
||||
* ; | 7 | NTN_RX_ERR_COUNTER | 0-31 |
|
||||
* ; +-------------+--------------------------------+-------+
|
||||
* ; | 8 | NTN_ACCUMULATED_TRES_HANDLED | 0-31 |
|
||||
* ; +-------------+--------------------------------+-------+
|
||||
* ; | 9 | NTN_ROLLBACKS_COUNTER | 0-31 |
|
||||
* ; +-------------+--------------------------------+-------+
|
||||
* ; | FOR_SEQ_HIGH| NTN_MSI_DB_COUNT | 0-31 |
|
||||
* ; +-------------+--------------------------------+-------+
|
||||
*
|
||||
* ; +------------------------------------------------------+
|
||||
* ; | NTN3 Tx Channel Scratch |
|
||||
* ; +-------------+--------------------------------+-------+
|
||||
* ; | 32-bit word | Field | Bits |
|
||||
* ; +-------------+--------------------------------+-------+
|
||||
* ; | 4 | NTN_PENDING_DB_AFTER_ROLLBACK | 18-18 |
|
||||
* ; +-------------+--------------------------------+-------+
|
||||
* ; | 5 | NTN_MSI_DB_INDEX_VALUE | 0-31 |
|
||||
* ; +-------------+--------------------------------+-------+
|
||||
* ; | 6 | TX_DERR_COUNTER | 0-31 |
|
||||
* ; +-------------+--------------------------------+-------+
|
||||
* ; | 7 | NTN_TX_OOB_COUNTER | 0-31 |
|
||||
* ; +-------------+--------------------------------+-------+
|
||||
* ; | 8 | NTN_ACCUMULATED_TRES_HANDLED | 0-31 |
|
||||
* ; +-------------+--------------------------------+-------+
|
||||
* ; | 9 | NTN_ROLLBACKS_COUNTER | 0-31 |
|
||||
* ; +-------------+--------------------------------+-------+
|
||||
* ; | FOR_SEQ_HIGH| NTN_MSI_DB_COUNT | 0-31 |
|
||||
* ; +-------------+--------------------------------+-------+
|
||||
*/
|
||||
int gsi_ntn3_client_stats_get(unsigned ep_id, int scratch_id, unsigned chan_hdl)
|
||||
{
|
||||
switch (scratch_id) {
|
||||
case -1:
|
||||
return gsihal_read_reg_n(GSI_GSI_SHRAM_n, GSI_GSI_SHRAM_n_EP_FOR_SEQ_HIGH_N_GET(ep_id));
|
||||
case 4:
|
||||
return (gsihal_read_reg_nk(GSI_EE_n_GSI_CH_k_SCRATCH_4, gsi_ctx->per.ee,
|
||||
chan_hdl) >> GSI_NTN3_PENDING_DB_AFTER_RB_MASK) &
|
||||
GSI_NTN3_PENDING_DB_AFTER_RB_SHIFT;
|
||||
break;
|
||||
case 5:
|
||||
return gsihal_read_reg_nk(GSI_EE_n_GSI_CH_k_SCRATCH_5, gsi_ctx->per.ee, chan_hdl);
|
||||
break;
|
||||
case 6:
|
||||
return gsihal_read_reg_nk(GSI_EE_n_GSI_CH_k_SCRATCH_6, gsi_ctx->per.ee, chan_hdl);
|
||||
break;
|
||||
case 7:
|
||||
return gsihal_read_reg_nk(GSI_EE_n_GSI_CH_k_SCRATCH_7, gsi_ctx->per.ee, chan_hdl);
|
||||
break;
|
||||
case 8:
|
||||
return gsihal_read_reg_nk(GSI_EE_n_GSI_CH_k_SCRATCH_8, gsi_ctx->per.ee, chan_hdl);
|
||||
break;
|
||||
case 9:
|
||||
return gsihal_read_reg_nk(GSI_EE_n_GSI_CH_k_SCRATCH_9, gsi_ctx->per.ee, chan_hdl);
|
||||
break;
|
||||
default:
|
||||
GSIERR("invalid scratch id %d\n", scratch_id);
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(gsi_ntn3_client_stats_get);
|
||||
|
||||
int gsi_get_drop_stats(unsigned long ep_id, int scratch_id,
|
||||
unsigned long chan_hdl)
|
||||
{
|
||||
|
@@ -2278,6 +2278,15 @@ void gsi_wdi3_write_evt_ring_db(unsigned long chan_hdl, uint32_t db_addr_low,
|
||||
*/
|
||||
int gsi_get_refetch_reg(unsigned long chan_hdl, bool is_rp);
|
||||
|
||||
/**
|
||||
* gsi_ntn3_client_stats_get - get ntn3 stats
|
||||
*
|
||||
* @ep_id: ep index
|
||||
* @scratch_id: scratch register number
|
||||
* @chan_hdl: gsi channel handle
|
||||
*/
|
||||
int gsi_ntn3_client_stats_get(unsigned ep_id, int scratch_id, unsigned chan_hdl);
|
||||
|
||||
/**
|
||||
* gsi_get_drop_stats - get drop stats by GSI
|
||||
*
|
||||
|
@@ -40,6 +40,7 @@ static const char * const ipa_eth_clients_strings[] = {
|
||||
__stringify(RTK8111K),
|
||||
__stringify(RTK8125B),
|
||||
__stringify(NTN),
|
||||
__stringify(NTN3),
|
||||
__stringify(EMAC),
|
||||
};
|
||||
|
||||
@@ -3638,6 +3639,55 @@ done:
|
||||
return simple_read_from_buffer(ubuf, count, ppos, dbg_buff, cnt);
|
||||
}
|
||||
|
||||
#if IPA_ETH_API_VER >= 2
|
||||
static void __ipa_ntn3_client_stats_read(int *cnt, struct ipa_ntn3_client_stats *s,
|
||||
const char *str_client_tx, const char *str_client_rx)
|
||||
{
|
||||
int nbytes;
|
||||
|
||||
nbytes = scnprintf(dbg_buff + *cnt, IPA_MAX_MSG_LEN - *cnt,
|
||||
"%s_RP=0x%x\n"
|
||||
"%s_WP=0x%x\n"
|
||||
"%s_ntn_pending_db_after_rollback:%u\n"
|
||||
"%s_msi_db_idx_val:%u\n"
|
||||
"%s_tx_derr_counter:%u\n"
|
||||
"%s_ntn_tx_oob_counter:%u\n"
|
||||
"%s_ntn_accumulated_tres_handled:%u\n"
|
||||
"%s_ntn_rollbacks_counter:%u\n"
|
||||
"%s_ntn_msi_db_count:%u\n",
|
||||
str_client_tx, s->tx_stats.rp,
|
||||
str_client_tx, s->tx_stats.wp,
|
||||
str_client_tx, s->tx_stats.pending_db_after_rollback,
|
||||
str_client_tx, s->tx_stats.msi_db_idx,
|
||||
str_client_tx, s->tx_stats.derr_cnt,
|
||||
str_client_tx, s->tx_stats.oob_cnt,
|
||||
str_client_tx, s->tx_stats.tres_handled,
|
||||
str_client_tx, s->tx_stats.rollbacks_cnt,
|
||||
str_client_tx, s->tx_stats.msi_db_cnt);
|
||||
*cnt += nbytes;
|
||||
nbytes = scnprintf(dbg_buff + *cnt, IPA_MAX_MSG_LEN - *cnt,
|
||||
"%s_RP=0x%x\n"
|
||||
"%s_WP=0x%x\n"
|
||||
"%s_ntn_pending_db_after_rollback:%u\n"
|
||||
"%s_msi_db_idx_val:%u\n"
|
||||
"%s_ntn_rx_chain_counter:%u\n"
|
||||
"%s_ntn_rx_err_counter:%u\n"
|
||||
"%s_ntn_accumulated_tres_handled:%u\n"
|
||||
"%s_ntn_rollbacks_counter:%u\n"
|
||||
"%s_ntn_msi_db_count:%u\n",
|
||||
str_client_rx, s->rx_stats.rp,
|
||||
str_client_rx, s->rx_stats.wp,
|
||||
str_client_rx, s->rx_stats.pending_db_after_rollback,
|
||||
str_client_rx, s->rx_stats.msi_db_idx,
|
||||
str_client_rx, s->rx_stats.chain_cnt,
|
||||
str_client_rx, s->rx_stats.err_cnt,
|
||||
str_client_rx, s->rx_stats.tres_handled,
|
||||
str_client_rx, s->rx_stats.rollbacks_cnt,
|
||||
str_client_rx, s->rx_stats.msi_db_cnt);
|
||||
*cnt += nbytes;
|
||||
}
|
||||
#endif
|
||||
|
||||
static ssize_t ipa3_eth_read_err_status(struct file *file,
|
||||
char __user *ubuf, size_t count, loff_t *ppos)
|
||||
{
|
||||
@@ -3648,6 +3698,10 @@ static ssize_t ipa3_eth_read_err_status(struct file *file,
|
||||
struct ipa3_eth_error_stats tx_stats;
|
||||
struct ipa3_eth_error_stats rx_stats;
|
||||
int scratch_num;
|
||||
#if IPA_ETH_API_VER >= 2
|
||||
struct ipa_ntn3_client_stats ntn3_stats;
|
||||
const char *str_client_tx, *str_client_rx;
|
||||
#endif
|
||||
|
||||
memset(&tx_stats, 0, sizeof(struct ipa3_eth_error_stats));
|
||||
memset(&rx_stats, 0, sizeof(struct ipa3_eth_error_stats));
|
||||
@@ -3661,6 +3715,7 @@ static ssize_t ipa3_eth_read_err_status(struct file *file,
|
||||
goto done;
|
||||
}
|
||||
client = (struct ipa_eth_client *)file->private_data;
|
||||
|
||||
switch (client->client_type) {
|
||||
case IPA_ETH_CLIENT_AQC107:
|
||||
case IPA_ETH_CLIENT_AQC113:
|
||||
@@ -3677,6 +3732,22 @@ static ssize_t ipa3_eth_read_err_status(struct file *file,
|
||||
tx_ep = IPA_CLIENT_ETHERNET_CONS;
|
||||
rx_ep = IPA_CLIENT_ETHERNET_PROD;
|
||||
scratch_num = 6;
|
||||
#if IPA_ETH_API_VER >= 2
|
||||
case IPA_ETH_CLIENT_NTN3:
|
||||
|
||||
memset(&ntn3_stats, 0, sizeof(ntn3_stats));
|
||||
if (strstr(file->f_path.dentry->d_name.name, "0_status")) {
|
||||
ipa_eth_ntn3_get_status(&ntn3_stats, 0);
|
||||
str_client_tx = ipa_clients_strings[IPA_CLIENT_ETHERNET_CONS];
|
||||
str_client_rx = ipa_clients_strings[IPA_CLIENT_ETHERNET_PROD];
|
||||
} else {
|
||||
ipa_eth_ntn3_get_status(&ntn3_stats, 1);
|
||||
str_client_tx = ipa_clients_strings[IPA_CLIENT_ETHERNET2_CONS];
|
||||
str_client_rx = ipa_clients_strings[IPA_CLIENT_ETHERNET2_PROD];
|
||||
}
|
||||
__ipa_ntn3_client_stats_read(&cnt, &ntn3_stats, str_client_tx, str_client_rx);
|
||||
goto done;
|
||||
#endif
|
||||
default:
|
||||
IPAERR("Not supported\n");
|
||||
return 0;
|
||||
|
@@ -127,6 +127,8 @@ enum {
|
||||
#define IPA_PAGE_POLL_DEFAULT_THRESHOLD 15
|
||||
#define IPA_PAGE_POLL_THRESHOLD_MAX 30
|
||||
|
||||
#define NTN3_CLIENTS_NUM 2
|
||||
|
||||
|
||||
#define IPA_WDI2_OVER_GSI() (ipa3_ctx->ipa_wdi2_over_gsi \
|
||||
&& (ipa_get_wdi_version() == IPA_WDI_2))
|
||||
@@ -1990,6 +1992,35 @@ struct ipa3_eth_error_stats {
|
||||
u32 err;
|
||||
};
|
||||
|
||||
struct ipa_ntn3_stats_rx {
|
||||
int rp;
|
||||
int wp;
|
||||
bool pending_db_after_rollback;
|
||||
u32 msi_db_idx;
|
||||
u32 chain_cnt;
|
||||
u32 err_cnt;
|
||||
u32 tres_handled;
|
||||
u32 rollbacks_cnt;
|
||||
u32 msi_db_cnt;
|
||||
};
|
||||
|
||||
struct ipa_ntn3_stats_tx {
|
||||
int rp;
|
||||
int wp;
|
||||
bool pending_db_after_rollback;
|
||||
u32 msi_db_idx;
|
||||
u32 derr_cnt;
|
||||
u32 oob_cnt;
|
||||
u32 tres_handled;
|
||||
u32 rollbacks_cnt;
|
||||
u32 msi_db_cnt;
|
||||
};
|
||||
|
||||
struct ipa_ntn3_client_stats {
|
||||
struct ipa_ntn3_stats_rx rx_stats;
|
||||
struct ipa_ntn3_stats_tx tx_stats;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* struct ipa3_context - IPA context
|
||||
@@ -3426,6 +3457,7 @@ int ipa3_eth_disconnect(
|
||||
int ipa3_eth_client_conn_evt(struct ipa_ecm_msg *msg);
|
||||
int ipa3_eth_client_disconn_evt(struct ipa_ecm_msg *msg);
|
||||
#endif
|
||||
void ipa_eth_ntn3_get_status(struct ipa_ntn3_client_stats *s, unsigned inst_id);
|
||||
void ipa3_eth_get_status(u32 client, int scratch_id,
|
||||
struct ipa3_eth_error_stats *stats);
|
||||
int ipa3_get_gsi_chan_info(struct gsi_chan_info *gsi_chan_info,
|
||||
|
@@ -12336,6 +12336,68 @@ int ipa3_get_prot_id(enum ipa_client_type client)
|
||||
return prot_id;
|
||||
}
|
||||
|
||||
void __ipa_ntn3_cons_stats_get(struct ipa_ntn3_stats_rx *stats, enum ipa_client_type client)
|
||||
{
|
||||
int ch_id, ipa_ep_idx;
|
||||
|
||||
IPA_ACTIVE_CLIENTS_INC_SIMPLE();
|
||||
ipa_ep_idx = ipa3_get_ep_mapping(client);
|
||||
if (ipa_ep_idx == IPA_EP_NOT_ALLOCATED)
|
||||
return;
|
||||
ch_id = ipa3_ctx->ep[ipa_ep_idx].gsi_chan_hdl;
|
||||
|
||||
stats->pending_db_after_rollback = gsi_ntn3_client_stats_get(ipa_ep_idx, 4, ch_id);
|
||||
stats->msi_db_idx = gsi_ntn3_client_stats_get(ipa_ep_idx, 5, ch_id);
|
||||
stats->chain_cnt = gsi_ntn3_client_stats_get(ipa_ep_idx, 6, ch_id);
|
||||
stats->err_cnt = gsi_ntn3_client_stats_get(ipa_ep_idx, 7, ch_id);
|
||||
stats->tres_handled = gsi_ntn3_client_stats_get(ipa_ep_idx, 8, ch_id);
|
||||
stats->rollbacks_cnt = gsi_ntn3_client_stats_get(ipa_ep_idx, 9, ch_id);
|
||||
stats->msi_db_cnt = gsi_ntn3_client_stats_get(ipa_ep_idx, -1, ch_id);
|
||||
|
||||
stats->wp = gsi_get_refetch_reg(ch_id, false);
|
||||
stats->rp = gsi_get_refetch_reg(ch_id, true);
|
||||
|
||||
IPA_ACTIVE_CLIENTS_DEC_SIMPLE();
|
||||
|
||||
}
|
||||
|
||||
void __ipa_ntn3_prod_stats_get(struct ipa_ntn3_stats_tx *stats, enum ipa_client_type client)
|
||||
{
|
||||
int ch_id, ipa_ep_idx;
|
||||
|
||||
IPA_ACTIVE_CLIENTS_INC_SIMPLE();
|
||||
ipa_ep_idx = ipa3_get_ep_mapping(client);
|
||||
if (ipa_ep_idx == IPA_EP_NOT_ALLOCATED)
|
||||
return;
|
||||
ch_id = ipa3_ctx->ep[ipa_ep_idx].gsi_chan_hdl;
|
||||
|
||||
stats->pending_db_after_rollback = gsi_ntn3_client_stats_get(ipa_ep_idx, 4, ch_id);
|
||||
stats->msi_db_idx = gsi_ntn3_client_stats_get(ipa_ep_idx, 5, ch_id);
|
||||
stats->derr_cnt = gsi_ntn3_client_stats_get(ipa_ep_idx, 6, ch_id);
|
||||
stats->oob_cnt = gsi_ntn3_client_stats_get(ipa_ep_idx, 7, ch_id);
|
||||
stats->tres_handled = gsi_ntn3_client_stats_get(ipa_ep_idx, 8, ch_id);
|
||||
stats->rollbacks_cnt = gsi_ntn3_client_stats_get(ipa_ep_idx, 9, ch_id);
|
||||
stats->msi_db_cnt = gsi_ntn3_client_stats_get(ipa_ep_idx, -1, ch_id);
|
||||
|
||||
stats->wp = gsi_get_refetch_reg(ch_id, false);
|
||||
stats->rp = gsi_get_refetch_reg(ch_id, true);
|
||||
|
||||
IPA_ACTIVE_CLIENTS_DEC_SIMPLE();
|
||||
|
||||
}
|
||||
|
||||
void ipa_eth_ntn3_get_status(struct ipa_ntn3_client_stats *s, unsigned inst_id)
|
||||
{
|
||||
if (inst_id == 0) {
|
||||
__ipa_ntn3_cons_stats_get(&s->rx_stats, IPA_CLIENT_ETHERNET_CONS);
|
||||
__ipa_ntn3_prod_stats_get(&s->tx_stats, IPA_CLIENT_ETHERNET_PROD);
|
||||
} else {
|
||||
__ipa_ntn3_cons_stats_get(&s->rx_stats, IPA_CLIENT_ETHERNET2_CONS);
|
||||
__ipa_ntn3_prod_stats_get(&s->tx_stats, IPA_CLIENT_ETHERNET2_PROD);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ipa3_eth_get_status(u32 client, int scratch_id,
|
||||
struct ipa3_eth_error_stats *stats)
|
||||
{
|
||||
@@ -12378,7 +12440,7 @@ void ipa3_eth_get_status(u32 client, int scratch_id,
|
||||
stats->rp = gsi_get_refetch_reg(ch_id, true);
|
||||
break;
|
||||
case IPA_CLIENT_ETHERNET_PROD:
|
||||
stats->wp = gsi_get_wp(ch_id);
|
||||
stats->wp = gsi_get_refetch_reg(ch_id, false);
|
||||
stats->rp = gsi_get_refetch_reg(ch_id, true);
|
||||
break;
|
||||
case IPA_CLIENT_ETHERNET_CONS:
|
||||
|
Odkázat v novém úkolu
Zablokovat Uživatele