net: procfs: add seq_puts() statement for dev_mcast
Add seq_puts() statement for dev_mcast, make it more readable. As also, keep vertical alignment for {dev, ptype, dev_mcast} that under /proc/net. Signed-off-by: Yajun Deng <yajun.deng@linux.dev> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
95d5e6759b
commit
ec18e84554
@ -77,8 +77,8 @@ static void dev_seq_printf_stats(struct seq_file *seq, struct net_device *dev)
|
|||||||
struct rtnl_link_stats64 temp;
|
struct rtnl_link_stats64 temp;
|
||||||
const struct rtnl_link_stats64 *stats = dev_get_stats(dev, &temp);
|
const struct rtnl_link_stats64 *stats = dev_get_stats(dev, &temp);
|
||||||
|
|
||||||
seq_printf(seq, "%6s: %7llu %7llu %4llu %4llu %4llu %5llu %10llu %9llu "
|
seq_printf(seq, "%9s: %16llu %12llu %4llu %6llu %4llu %5llu %10llu %9llu "
|
||||||
"%8llu %7llu %4llu %4llu %4llu %5llu %7llu %10llu\n",
|
"%16llu %12llu %4llu %6llu %4llu %5llu %7llu %10llu\n",
|
||||||
dev->name, stats->rx_bytes, stats->rx_packets,
|
dev->name, stats->rx_bytes, stats->rx_packets,
|
||||||
stats->rx_errors,
|
stats->rx_errors,
|
||||||
stats->rx_dropped + stats->rx_missed_errors,
|
stats->rx_dropped + stats->rx_missed_errors,
|
||||||
@ -103,11 +103,11 @@ static void dev_seq_printf_stats(struct seq_file *seq, struct net_device *dev)
|
|||||||
static int dev_seq_show(struct seq_file *seq, void *v)
|
static int dev_seq_show(struct seq_file *seq, void *v)
|
||||||
{
|
{
|
||||||
if (v == SEQ_START_TOKEN)
|
if (v == SEQ_START_TOKEN)
|
||||||
seq_puts(seq, "Inter-| Receive "
|
seq_puts(seq, "Interface| Receive "
|
||||||
" | Transmit\n"
|
" | Transmit\n"
|
||||||
" face |bytes packets errs drop fifo frame "
|
" | bytes packets errs drop fifo frame "
|
||||||
"compressed multicast|bytes packets errs "
|
"compressed multicast| bytes packets errs "
|
||||||
"drop fifo colls carrier compressed\n");
|
" drop fifo colls carrier compressed\n");
|
||||||
else
|
else
|
||||||
dev_seq_printf_stats(seq, v);
|
dev_seq_printf_stats(seq, v);
|
||||||
return 0;
|
return 0;
|
||||||
@ -259,14 +259,14 @@ static int ptype_seq_show(struct seq_file *seq, void *v)
|
|||||||
struct packet_type *pt = v;
|
struct packet_type *pt = v;
|
||||||
|
|
||||||
if (v == SEQ_START_TOKEN)
|
if (v == SEQ_START_TOKEN)
|
||||||
seq_puts(seq, "Type Device Function\n");
|
seq_puts(seq, "Type Device Function\n");
|
||||||
else if (pt->dev == NULL || dev_net(pt->dev) == seq_file_net(seq)) {
|
else if (pt->dev == NULL || dev_net(pt->dev) == seq_file_net(seq)) {
|
||||||
if (pt->type == htons(ETH_P_ALL))
|
if (pt->type == htons(ETH_P_ALL))
|
||||||
seq_puts(seq, "ALL ");
|
seq_puts(seq, "ALL ");
|
||||||
else
|
else
|
||||||
seq_printf(seq, "%04x", ntohs(pt->type));
|
seq_printf(seq, "%04x", ntohs(pt->type));
|
||||||
|
|
||||||
seq_printf(seq, " %-8s %ps\n",
|
seq_printf(seq, " %-9s %ps\n",
|
||||||
pt->dev ? pt->dev->name : "", pt->func);
|
pt->dev ? pt->dev->name : "", pt->func);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,12 +327,14 @@ static int dev_mc_seq_show(struct seq_file *seq, void *v)
|
|||||||
struct netdev_hw_addr *ha;
|
struct netdev_hw_addr *ha;
|
||||||
struct net_device *dev = v;
|
struct net_device *dev = v;
|
||||||
|
|
||||||
if (v == SEQ_START_TOKEN)
|
if (v == SEQ_START_TOKEN) {
|
||||||
|
seq_puts(seq, "Ifindex Interface Refcount Global_use Address\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
netif_addr_lock_bh(dev);
|
netif_addr_lock_bh(dev);
|
||||||
netdev_for_each_mc_addr(ha, dev) {
|
netdev_for_each_mc_addr(ha, dev) {
|
||||||
seq_printf(seq, "%-4d %-15s %-5d %-5d %*phN\n",
|
seq_printf(seq, "%-7d %-9s %-8d %-10d %*phN\n",
|
||||||
dev->ifindex, dev->name,
|
dev->ifindex, dev->name,
|
||||||
ha->refcount, ha->global_use,
|
ha->refcount, ha->global_use,
|
||||||
(int)dev->addr_len, ha->addr);
|
(int)dev->addr_len, ha->addr);
|
||||||
|
Loading…
Reference in New Issue
Block a user