From: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
To: Shradha Gupta <shradhagupta@linux.microsoft.com>
Cc: linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org,
linux-rdma@vger.kernel.org, netdev@vger.kernel.org,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Ajay Sharma <sharmaajay@microsoft.com>,
Leon Romanovsky <leon@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
"K. Y. Srinivasan" <kys@microsoft.com>,
Haiyang Zhang <haiyangz@microsoft.com>,
Stephen Hemminger <sthemmin@microsoft.com>,
Wei Liu <wei.liu@kernel.org>, Dexuan Cui <decui@microsoft.com>,
Long Li <longli@microsoft.com>,
Michael Kelley <mikelley@microsoft.com>
Subject: Re: [PATCH] net: mana: Add new MANA VF performance counters for easier troubleshooting
Date: Tue, 14 Mar 2023 07:12:35 +0100 [thread overview]
Message-ID: <ZBAQU2qJg6kcud50@localhost.localdomain> (raw)
In-Reply-To: <1678771810-21050-1-git-send-email-shradhagupta@linux.microsoft.com>
On Mon, Mar 13, 2023 at 10:30:10PM -0700, Shradha Gupta wrote:
> Extended performance counter stats in 'ethtool -S <interface>' output
> for MANA VF to facilitate troubleshooting.
>
> Tested-on: Ubuntu22
> Signed-off-by: Shradha Gupta <shradhagupta@linux.microsoft.com>
> ---
> drivers/net/ethernet/microsoft/mana/mana_en.c | 67 ++++++++++++++++++-
> .../ethernet/microsoft/mana/mana_ethtool.c | 52 +++++++++++++-
> include/net/mana/mana.h | 18 +++++
> 3 files changed, 133 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c
> index 6120f2b6684f..9762bdda6df1 100644
> --- a/drivers/net/ethernet/microsoft/mana/mana_en.c
> +++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
> @@ -156,6 +156,8 @@ netdev_tx_t mana_start_xmit(struct sk_buff *skb, struct net_device *ndev)
> struct mana_txq *txq;
> struct mana_cq *cq;
> int err, len;
> + u16 ihs;
> + int hopbyhop = 0;
RCT
>
> if (unlikely(!apc->port_is_up))
> goto tx_drop;
> @@ -166,6 +168,7 @@ netdev_tx_t mana_start_xmit(struct sk_buff *skb, struct net_device *ndev)
> txq = &apc->tx_qp[txq_idx].txq;
> gdma_sq = txq->gdma_sq;
> cq = &apc->tx_qp[txq_idx].tx_cq;
> + tx_stats = &txq->stats;
>
> pkg.tx_oob.s_oob.vcq_num = cq->gdma_id;
> pkg.tx_oob.s_oob.vsq_frame = txq->vsq_frame;
> @@ -179,10 +182,17 @@ netdev_tx_t mana_start_xmit(struct sk_buff *skb, struct net_device *ndev)
>
> pkg.tx_oob.s_oob.pkt_fmt = pkt_fmt;
>
> - if (pkt_fmt == MANA_SHORT_PKT_FMT)
> + if (pkt_fmt == MANA_SHORT_PKT_FMT) {
> pkg.wqe_req.inline_oob_size = sizeof(struct mana_tx_short_oob);
> - else
> + u64_stats_update_begin(&tx_stats->syncp);
> + tx_stats->short_pkt_fmt++;
> + u64_stats_update_end(&tx_stats->syncp);
> + } else {
> pkg.wqe_req.inline_oob_size = sizeof(struct mana_tx_oob);
> + u64_stats_update_begin(&tx_stats->syncp);
> + tx_stats->long_pkt_fmt++;
> + u64_stats_update_end(&tx_stats->syncp);
> + }
>
> pkg.wqe_req.inline_oob_data = &pkg.tx_oob;
> pkg.wqe_req.flags = 0;
> @@ -232,9 +242,37 @@ netdev_tx_t mana_start_xmit(struct sk_buff *skb, struct net_device *ndev)
> &ipv6_hdr(skb)->daddr, 0,
> IPPROTO_TCP, 0);
> }
> +
> + if (skb->encapsulation) {
> + ihs = skb_inner_tcp_all_headers(skb);
> + u64_stats_update_begin(&tx_stats->syncp);
> + tx_stats->tso_inner_packets++;
> + tx_stats->tso_inner_bytes += skb->len - ihs;
> + u64_stats_update_end(&tx_stats->syncp);
> + } else {
hopbyhop can be defined here
> + if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4) {
> + ihs = skb_transport_offset(skb) + sizeof(struct udphdr);
> + } else {
> + ihs = skb_tcp_all_headers(skb);
> + if (ipv6_has_hopopt_jumbo(skb)) {
> + hopbyhop = sizeof(struct hop_jumbo_hdr);
> + ihs -= sizeof(struct hop_jumbo_hdr);
> + }
Maybe I missed sth, but it looks like this part of code can be removed.
hopbyhop is only used to calculate tso_bytes. Instead of substract
hopbyhop from ihs, and calculate tso_bytes as len - ihs - hopbyhop, You
can remove hopbyhop and calculate tso_bytes like len - ihs.
> + }
> +
> + u64_stats_update_begin(&tx_stats->syncp);
> + tx_stats->tso_packets++;
> + tx_stats->tso_bytes += skb->len - ihs - hopbyhop;
> + u64_stats_update_end(&tx_stats->syncp);
> + }
> +
>
[...]
> @@ -1341,11 +1394,17 @@ static void mana_poll_rx_cq(struct mana_cq *cq)
> {
> struct gdma_comp *comp = cq->gdma_comp_buf;
> struct mana_rxq *rxq = cq->rxq;
> + struct net_device *ndev;
> + struct mana_port_context *apc;
RCT
> int comp_read, i;
>
> + ndev = rxq->ndev;
> + apc = netdev_priv(ndev);
maybe:
apc = netdev_priv(rxq->ndev);
> +
> comp_read = mana_gd_poll_cq(cq->gdma_cq, comp, CQE_POLLING_BUFFER);
> WARN_ON_ONCE(comp_read > CQE_POLLING_BUFFER);
>
> + apc->eth_stats.rx_cqes = comp_read;
> rxq->xdp_flush = false;
>
> for (i = 0; i < comp_read; i++) {
> @@ -1357,6 +1416,8 @@ static void mana_poll_rx_cq(struct mana_cq *cq)
> return;
>
> mana_process_rx_cqe(rxq, cq, &comp[i]);
> +
> + apc->eth_stats.rx_cqes--;
> }
>
> if (rxq->xdp_flush)
>
[...]
> --
> 2.37.2
>
prev parent reply other threads:[~2023-03-14 6:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-14 5:30 [PATCH] net: mana: Add new MANA VF performance counters for easier troubleshooting Shradha Gupta
2023-03-14 6:12 ` Michal Swiatkowski [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZBAQU2qJg6kcud50@localhost.localdomain \
--to=michal.swiatkowski@linux.intel.com \
--cc=bigeasy@linutronix.de \
--cc=decui@microsoft.com \
--cc=edumazet@google.com \
--cc=haiyangz@microsoft.com \
--cc=kuba@kernel.org \
--cc=kys@microsoft.com \
--cc=leon@kernel.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=longli@microsoft.com \
--cc=mikelley@microsoft.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sharmaajay@microsoft.com \
--cc=shradhagupta@linux.microsoft.com \
--cc=sthemmin@microsoft.com \
--cc=tglx@linutronix.de \
--cc=wei.liu@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.