mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2026-01-27 12:47:24 +01:00
mptcp: snmp: do not use SNMP_MIB_SENTINEL anymore
Use ARRAY_SIZE(), so that we know the limit at compile time. Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Mat Martineau <martineau@kernel.org> Cc: Geliang Tang <geliang@kernel.org> Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20250905165813.1470708-6-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
b7b74953f8
commit
35cb2da0ab
|
|
@ -85,7 +85,6 @@ static const struct snmp_mib mptcp_snmp_list[] = {
|
|||
SNMP_MIB_ITEM("DssFallback", MPTCP_MIB_DSSFALLBACK),
|
||||
SNMP_MIB_ITEM("SimultConnectFallback", MPTCP_MIB_SIMULTCONNFALLBACK),
|
||||
SNMP_MIB_ITEM("FallbackFailed", MPTCP_MIB_FALLBACKFAILED),
|
||||
SNMP_MIB_SENTINEL
|
||||
};
|
||||
|
||||
/* mptcp_mib_alloc - allocate percpu mib counters
|
||||
|
|
@ -108,22 +107,23 @@ bool mptcp_mib_alloc(struct net *net)
|
|||
|
||||
void mptcp_seq_show(struct seq_file *seq)
|
||||
{
|
||||
unsigned long sum[ARRAY_SIZE(mptcp_snmp_list) - 1];
|
||||
unsigned long sum[ARRAY_SIZE(mptcp_snmp_list)];
|
||||
const int cnt = ARRAY_SIZE(mptcp_snmp_list);
|
||||
struct net *net = seq->private;
|
||||
int i;
|
||||
|
||||
seq_puts(seq, "MPTcpExt:");
|
||||
for (i = 0; mptcp_snmp_list[i].name; i++)
|
||||
for (i = 0; i < cnt; i++)
|
||||
seq_printf(seq, " %s", mptcp_snmp_list[i].name);
|
||||
|
||||
seq_puts(seq, "\nMPTcpExt:");
|
||||
|
||||
memset(sum, 0, sizeof(sum));
|
||||
if (net->mib.mptcp_statistics)
|
||||
snmp_get_cpu_field_batch(sum, mptcp_snmp_list,
|
||||
net->mib.mptcp_statistics);
|
||||
snmp_get_cpu_field_batch_cnt(sum, mptcp_snmp_list, cnt,
|
||||
net->mib.mptcp_statistics);
|
||||
|
||||
for (i = 0; mptcp_snmp_list[i].name; i++)
|
||||
for (i = 0; i < cnt; i++)
|
||||
seq_printf(seq, " %lu", sum[i]);
|
||||
|
||||
seq_putc(seq, '\n');
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user