mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
net/tls: add skeleton of MIB statistics
Add a skeleton structure for adding TLS statistics. Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
9ec1c6ac27
commit
d26b698dd3
8 changed files with 110 additions and 1 deletions
37
net/tls/tls_proc.c
Normal file
37
net/tls/tls_proc.c
Normal file
|
@ -0,0 +1,37 @@
|
|||
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
|
||||
/* Copyright (C) 2019 Netronome Systems, Inc. */
|
||||
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <net/snmp.h>
|
||||
#include <net/tls.h>
|
||||
|
||||
static const struct snmp_mib tls_mib_list[] = {
|
||||
SNMP_MIB_SENTINEL
|
||||
};
|
||||
|
||||
static int tls_statistics_seq_show(struct seq_file *seq, void *v)
|
||||
{
|
||||
unsigned long buf[LINUX_MIB_TLSMAX] = {};
|
||||
struct net *net = seq->private;
|
||||
int i;
|
||||
|
||||
snmp_get_cpu_field_batch(buf, tls_mib_list, net->mib.tls_statistics);
|
||||
for (i = 0; tls_mib_list[i].name; i++)
|
||||
seq_printf(seq, "%-32s\t%lu\n", tls_mib_list[i].name, buf[i]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __net_init tls_proc_init(struct net *net)
|
||||
{
|
||||
if (!proc_create_net_single("tls_stat", 0444, net->proc_net,
|
||||
tls_statistics_seq_show, NULL))
|
||||
return -ENOMEM;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void __net_exit tls_proc_fini(struct net *net)
|
||||
{
|
||||
remove_proc_entry("tls_stat", net->proc_net);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue