Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp144772pxb; Mon, 16 Aug 2021 02:00:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxP6sIZ7zZsAOZhcarMgVO1OOXBJ8U2bQ+s7mP6hU+LwHKfriW8RV4MwfqUm4AtZrrVx/El X-Received: by 2002:a02:cf2e:: with SMTP id s14mr14927191jar.74.1629104402597; Mon, 16 Aug 2021 02:00:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629104402; cv=none; d=google.com; s=arc-20160816; b=daF1t550SbD2x0pm1ZFoBIPY1mgQvsoYAYzfmZ0mxB7jHf9gFJp4CgYWVNvpZSqod2 bKzW2vwxkFt/zl4g2DF7tDjgWQUIRx/WgHTrslFzzzp4iVMJgMHAUt+DxAfyQ7VOOKiH lhIp1c2sy14bWRMddzJkMRKEzeidcs4pupaymbEUFky4j3IpR6K5J2IskexM2FNCBNkz YCsCJcfnDPdst5dRoMlNo9Fdk1HdxPKbmcJRLQMEJzRixC+cix0xW/tFd4DOibsPNhvX pWMN9WlFKguBt6aXzm3fPbxh8QLH3odjRr0f9QL/QT4uJokHxWS+uLVBtS9+VTddUubG rr5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=/fHvrj6QnziHGweark6EjJmpxXLuqtNed4j0q6tsVjA=; b=YPzAJZtuyMgYpQHHd3rPWC7t7VzbkYQiyGxSqePQq6Nacq7GUcfvnP/kydGlrFSxCN xofoCkSXLciL60aGyPXY+qzv9sPUXjIML9HjbEhGZ0XyEFCaANkBqeIgIVKsUeBjH5+B FmwlmNihJxHOHT65y1x5UpLAw1j4vJLy51mJaHVHCLjI1ClpU26KJVDkDdo0TlTJulW0 ySdpBpYSRo5h5TAbNjbv4KkkBBW9Qf0FVEODaLNRe4ptwRXOc4rklLGEs8WWKVYVAT2T dU+jx+TQcZLvgAMJlSyNJglFTrom3mnECuOdM4hi8zMoGv+Nd8G+Z97Ptj6YtXslLuvo CkHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=XbKeo3zL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e14si10796474ilq.20.2021.08.16.01.59.51; Mon, 16 Aug 2021 02:00:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=XbKeo3zL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234988AbhHPI72 (ORCPT + 99 others); Mon, 16 Aug 2021 04:59:28 -0400 Received: from out2.migadu.com ([188.165.223.204]:59102 "EHLO out2.migadu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235105AbhHPI7J (ORCPT ); Mon, 16 Aug 2021 04:59:09 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1629104288; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=/fHvrj6QnziHGweark6EjJmpxXLuqtNed4j0q6tsVjA=; b=XbKeo3zLiRUkEPxdD/A2OqQ8RiMtzkheOHwDWjq/fazPWb9JPRN7K+thsRL4vpQdY/g/7Y xJ1eUD0jcjX+8qu3mFOo0ueIbKCTwcE4yHMQjjcX0hsWLJnMA/Dtcjv3EfjjzFDY/czYPk rrrlwdANSkZFv0rjdfiuDGvFNGpjX54= From: Yajun Deng To: davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Yajun Deng Subject: [PATCH net-next] net: procfs: add seq_puts() statement for dev_mcast Date: Mon, 16 Aug 2021 16:57:57 +0800 Message-Id: <20210816085757.28166-1-yajun.deng@linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: yajun.deng@linux.dev Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- net/core/net-procfs.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/net/core/net-procfs.c b/net/core/net-procfs.c index d8b9dbabd4a4..eab5fc88a002 100644 --- a/net/core/net-procfs.c +++ b/net/core/net-procfs.c @@ -77,8 +77,8 @@ static void dev_seq_printf_stats(struct seq_file *seq, struct net_device *dev) struct rtnl_link_stats64 temp; const struct rtnl_link_stats64 *stats = dev_get_stats(dev, &temp); - seq_printf(seq, "%6s: %7llu %7llu %4llu %4llu %4llu %5llu %10llu %9llu " - "%8llu %7llu %4llu %4llu %4llu %5llu %7llu %10llu\n", + seq_printf(seq, "%9s: %16llu %12llu %4llu %6llu %4llu %5llu %10llu %9llu " + "%16llu %12llu %4llu %6llu %4llu %5llu %7llu %10llu\n", dev->name, stats->rx_bytes, stats->rx_packets, stats->rx_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) { if (v == SEQ_START_TOKEN) - seq_puts(seq, "Inter-| Receive " - " | Transmit\n" - " face |bytes packets errs drop fifo frame " - "compressed multicast|bytes packets errs " - "drop fifo colls carrier compressed\n"); + seq_puts(seq, "Interface| Receive " + " | Transmit\n" + " | bytes packets errs drop fifo frame " + "compressed multicast| bytes packets errs " + " drop fifo colls carrier compressed\n"); else dev_seq_printf_stats(seq, v); return 0; @@ -259,14 +259,14 @@ static int ptype_seq_show(struct seq_file *seq, void *v) struct packet_type *pt = v; 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)) { if (pt->type == htons(ETH_P_ALL)) seq_puts(seq, "ALL "); else 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); } @@ -327,12 +327,14 @@ static int dev_mc_seq_show(struct seq_file *seq, void *v) struct netdev_hw_addr *ha; 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; + } netif_addr_lock_bh(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, ha->refcount, ha->global_use, (int)dev->addr_len, ha->addr); -- 2.32.0