net: mana: Add gdma stats to ethtool output for mana
Subsystems (5)
PATCH 1/1 net: mana: Add gdma stats to ethtool output for mana
Extended performance counter stats in 'ethtool -S <interface>' for MANA VF to include GDMA tx LSO packets and bytes count.
Tested-on: Ubuntu22
Testcases:
1. LISA testcase:
PERF-NETWORK-TCP-THROUGHPUT-MULTICONNECTION-NTTTCP-Synthetic
2. LISA testcase:
PERF-NETWORK-TCP-THROUGHPUT-MULTICONNECTION-NTTTCP-SRIOV
3. Validated the GDMA stat packets and byte counters
--- drivers/net/ethernet/microsoft/mana/mana_en.c | 40 +++++++++ .../ethernet/microsoft/mana/mana_ethtool.c | 15 ++++ include/net/mana/mana.h | 88 +++++++++++++++++++ 3 files changed, 143 insertions(+)
drivers/net/ethernet/microsoft/mana/mana_en.c +40 -0
@@ -2234,6 +2234,46 @@ int mana_config_rss(struct mana_port_context *apc, enum TRI_STATE rx,return 0 ; } +void mana_query_gf_stats (struct mana_port_context *apc) +{ +struct mana_query_gf_stat_req req = {}; +struct mana_query_gf_stat_resp resp = {}; +struct net_device *ndev = apc->ndev; +int err; + +mana_gd_init_req_hdr (&req.hdr,MANA_QUERY_GF_STAT , +sizeof (req),sizeof (resp)); + req.req_stats =STATISTICS_FLAGS_HC_TX_BYTES | +STATISTICS_FLAGS_HC_TX_UCAST_PACKETS | +STATISTICS_FLAGS_HC_TX_UCAST_BYTES | +STATISTICS_FLAGS_HC_TX_MCAST_PACKETS | +STATISTICS_FLAGS_HC_TX_MCAST_BYTES | +STATISTICS_FLAGS_HC_TX_BCAST_PACKETS | +STATISTICS_FLAGS_HC_TX_BCAST_BYTES ; + + err =mana_send_request (apc->ac, &req,sizeof (req), &resp, +sizeof (resp)); +if (err) { +netdev_err (ndev,"Failed to query GF stats: %d\n" , err); +return ; + } + err =mana_verify_resp_hdr (&resp.hdr,MANA_QUERY_GF_STAT , +sizeof (resp)); +if (err || resp.hdr.status) { +netdev_err (ndev,"Failed to query GF stats: %d, 0x%x\n" , err, + resp.hdr.status); +return ; + } + + apc->eth_stats.hc_tx_bytes = resp.hc_tx_bytes; + apc->eth_stats.hc_tx_ucast_pkts = resp.hc_tx_ucast_pkts; + apc->eth_stats.hc_tx_ucast_bytes = resp.hc_tx_ucast_bytes; + apc->eth_stats.hc_tx_bcast_pkts = resp.hc_tx_bcast_pkts; + apc->eth_stats.hc_tx_bcast_bytes = resp.hc_tx_bcast_bytes; + apc->eth_stats.hc_tx_mcast_pkts = resp.hc_tx_mcast_pkts; + apc->eth_stats.hc_tx_mcast_bytes = resp.hc_tx_mcast_bytes; +} +static int mana_init_port (struct net_device *ndev) {struct mana_port_context *apc =netdev_priv (ndev);
drivers/net/ethernet/microsoft/mana/mana_ethtool.c +15 -0
@@ -13,6 +13,19 @@ static const struct { } mana_eth_stats[] = { {"stop_queue", offsetof(struct mana_ethtool_stats, stop_queue)}, {"wake_queue", offsetof(struct mana_ethtool_stats, wake_queue)}, + {"hc_tx_bytes", offsetof(struct mana_ethtool_stats, hc_tx_bytes)}, + {"hc_tx_ucast_pkts", offsetof(struct mana_ethtool_stats, + hc_tx_ucast_pkts)}, + {"hc_tx_ucast_bytes", offsetof(struct mana_ethtool_stats, + hc_tx_ucast_bytes)}, + {"hc_tx_bcast_pkts", offsetof(struct mana_ethtool_stats, + hc_tx_bcast_pkts)}, + {"hc_tx_bcast_bytes", offsetof(struct mana_ethtool_stats, + hc_tx_bcast_bytes)}, + {"hc_tx_mcast_pkts", offsetof(struct mana_ethtool_stats, + hc_tx_mcast_pkts)}, + {"hc_tx_mcast_bytes", offsetof(struct mana_ethtool_stats, + hc_tx_mcast_bytes)}, {"tx_cq_err", offsetof(struct mana_ethtool_stats, tx_cqe_err)}, {"tx_cqe_unknown_type", offsetof(struct mana_ethtool_stats, tx_cqe_unknown_type)},
@@ -114,6 +127,8 @@ static void mana_get_ethtool_stats(struct net_device *ndev,if (!apc->port_is_up)return ; +/* we call mana function to update stats from GDMA */ +mana_query_gf_stats (apc);for (q =0 ; q <ARRAY_SIZE (mana_eth_stats); q++) data[i++] = *(u64 *)(eth_stats + mana_eth_stats[q].offset);
include/net/mana/mana.h +88 -0
112 lines not on this page · raw message
Signature · 1 line
2.34.1
Quoted 23 lines · Shradha Gupta
Extended performance counter stats in 'ethtool -S <interface>' for MANA VF to include GDMA tx LSO packets and bytes count.
Tested-on: Ubuntu22
Testcases:
1. LISA testcase:
PERF-NETWORK-TCP-THROUGHPUT-MULTICONNECTION-NTTTCP-Synthetic
2. LISA testcase:
PERF-NETWORK-TCP-THROUGHPUT-MULTICONNECTION-NTTTCP-SRIOV
3. Validated the GDMA stat packets and byte countersSigned-off-by Shradha Gupta <[email protected]>--- drivers/net/ethernet/microsoft/mana/mana_en.c | 40 +++++++++ .../ethernet/microsoft/mana/mana_ethtool.c | 15 ++++ include/net/mana/mana.h | 88 +++++++++++++++++++ 3 files changed, 143 insertions(+)drivers/net/ethernet/microsoft/mana/mana_en.c +0
-0
drivers/net/ethernet/microsoft/mana/mana_en.c int mana_config_rss(struct mana_port_context *apc, enum TRI_STATE rx, · line 2239
Quoted 6 lines
drivers/net/ethernet/microsoft/mana/mana_en.c +3
-0@@ -2234,6 +2234,46 @@ int mana_config_rss(struct mana_port_context *apc, enum TRI_STATE rx,return 0 ; } +void mana_query_gf_stats (struct mana_port_context *apc) +{ +struct mana_query_gf_stat_req req = {};
nit: remove the space before 'req' and rearrange in reverse x-mas order
drivers/net/ethernet/microsoft/mana/mana_en.c int mana_config_rss(struct mana_port_context *apc, enum TRI_STATE rx, · line 2248
Quoted 9 lines
drivers/net/ethernet/microsoft/mana/mana_en.c +8
-0+struct mana_query_gf_stat_resp resp = {}; +struct net_device *ndev = apc->ndev; +#define STATISTICS_FLAGS_HC_TX_BCAST_PACKETS 0x0000000001000000 +#define STATISTICS_FLAGS_HC_TX_BCAST_BYTES 0x0000000002000000 +/* Tx error */ +#define STATISTICS_FLAGS_TX_ERRORS_GDMA_ERROR 0x0000000004000000 + +
Checkpatch is warning about this.
Otherwise it looks good.
Quoted 7 lines
drivers/net/ethernet/microsoft/mana/mana_en.c +0
-1#define MANA_MAX_NUM_QUEUES 64#define MANA_SHORT_VPORT_OFFSET_MAX ((1U << 8) - 1) --2.34.1