net/kcm/kcmproc.c

Source file repositories/reference/linux-study-clean/net/kcm/kcmproc.c

File Facts

System
Linux kernel
Corpus path
net/kcm/kcmproc.c
Extension
.c
Size
8873 bytes
Lines
388
Domain
Networking Core
Bucket
Sockets, Protocols, Packet Path, And Network Policy
Inferred role
Networking Core: implementation source
Status
source implementation candidate

Why This File Exists

Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.

Dependency Surface

Detected Declarations

Annotated Snippet

struct kcm_proc_mux_state {
	struct seq_net_private p;
	int idx;
};

static void kcm_format_mux_header(struct seq_file *seq)
{
	struct net *net = seq_file_net(seq);
	struct kcm_net *knet = net_generic(net, kcm_net_id);

	seq_printf(seq,
		   "*** KCM statistics (%d MUX) ****\n",
		   knet->count);

	seq_printf(seq,
		   "%-14s %-10s %-16s %-10s %-16s %-8s %-8s %-8s %-8s %s",
		   "Object",
		   "RX-Msgs",
		   "RX-Bytes",
		   "TX-Msgs",
		   "TX-Bytes",
		   "Recv-Q",
		   "Rmem",
		   "Send-Q",
		   "Smem",
		   "Status");

	/* XXX: pdsts header stuff here */
	seq_puts(seq, "\n");
}

static void kcm_format_sock(struct kcm_sock *kcm, struct seq_file *seq,
			    int i, int *len)
{
	seq_printf(seq,
		   "   kcm-%-7u %-10llu %-16llu %-10llu %-16llu %-8d %-8d %-8d %-8s ",
		   kcm->index,
		   kcm->stats.rx_msgs,
		   kcm->stats.rx_bytes,
		   kcm->stats.tx_msgs,
		   kcm->stats.tx_bytes,
		   kcm->sk.sk_receive_queue.qlen,
		   sk_rmem_alloc_get(&kcm->sk),
		   kcm->sk.sk_write_queue.qlen,
		   "-");

	if (kcm->tx_psock)
		seq_printf(seq, "Psck-%u ", kcm->tx_psock->index);

	if (kcm->tx_wait)
		seq_puts(seq, "TxWait ");

	if (kcm->tx_wait_more)
		seq_puts(seq, "WMore ");

	if (kcm->rx_wait)
		seq_puts(seq, "RxWait ");

	seq_puts(seq, "\n");
}

static void kcm_format_psock(struct kcm_psock *psock, struct seq_file *seq,
			     int i, int *len)
{
	seq_printf(seq,
		   "   psock-%-5u %-10llu %-16llu %-10llu %-16llu %-8d %-8d %-8d %-8d ",
		   psock->index,
		   psock->strp.stats.msgs,
		   psock->strp.stats.bytes,
		   psock->stats.tx_msgs,
		   psock->stats.tx_bytes,
		   psock->sk->sk_receive_queue.qlen,
		   atomic_read(&psock->sk->sk_rmem_alloc),
		   psock->sk->sk_write_queue.qlen,
		   refcount_read(&psock->sk->sk_wmem_alloc));

	if (psock->done)
		seq_puts(seq, "Done ");

	if (psock->tx_stopped)
		seq_puts(seq, "TxStop ");

	if (psock->strp.stopped)
		seq_puts(seq, "RxStop ");

	if (psock->tx_kcm)
		seq_printf(seq, "Rsvd-%d ", psock->tx_kcm->index);

	if (!psock->strp.paused && !psock->ready_rx_msg) {
		if (psock->sk->sk_receive_queue.qlen) {

Annotation

Implementation Notes