Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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
Signed-off-by: Shradha Gupta <shradhagupta@linux.microsoft.com>
Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Shradha Gupta and committed by
David S. Miller
ac3899c6 a20b4c5f

+142
+40
drivers/net/ethernet/microsoft/mana/mana_en.c
··· 2295 2295 return 0; 2296 2296 } 2297 2297 2298 + void mana_query_gf_stats(struct mana_port_context *apc) 2299 + { 2300 + struct mana_query_gf_stat_resp resp = {}; 2301 + struct mana_query_gf_stat_req req = {}; 2302 + struct net_device *ndev = apc->ndev; 2303 + int err; 2304 + 2305 + mana_gd_init_req_hdr(&req.hdr, MANA_QUERY_GF_STAT, 2306 + sizeof(req), sizeof(resp)); 2307 + req.req_stats = STATISTICS_FLAGS_HC_TX_BYTES | 2308 + STATISTICS_FLAGS_HC_TX_UCAST_PACKETS | 2309 + STATISTICS_FLAGS_HC_TX_UCAST_BYTES | 2310 + STATISTICS_FLAGS_HC_TX_MCAST_PACKETS | 2311 + STATISTICS_FLAGS_HC_TX_MCAST_BYTES | 2312 + STATISTICS_FLAGS_HC_TX_BCAST_PACKETS | 2313 + STATISTICS_FLAGS_HC_TX_BCAST_BYTES; 2314 + 2315 + err = mana_send_request(apc->ac, &req, sizeof(req), &resp, 2316 + sizeof(resp)); 2317 + if (err) { 2318 + netdev_err(ndev, "Failed to query GF stats: %d\n", err); 2319 + return; 2320 + } 2321 + err = mana_verify_resp_hdr(&resp.hdr, MANA_QUERY_GF_STAT, 2322 + sizeof(resp)); 2323 + if (err || resp.hdr.status) { 2324 + netdev_err(ndev, "Failed to query GF stats: %d, 0x%x\n", err, 2325 + resp.hdr.status); 2326 + return; 2327 + } 2328 + 2329 + apc->eth_stats.hc_tx_bytes = resp.hc_tx_bytes; 2330 + apc->eth_stats.hc_tx_ucast_pkts = resp.hc_tx_ucast_pkts; 2331 + apc->eth_stats.hc_tx_ucast_bytes = resp.hc_tx_ucast_bytes; 2332 + apc->eth_stats.hc_tx_bcast_pkts = resp.hc_tx_bcast_pkts; 2333 + apc->eth_stats.hc_tx_bcast_bytes = resp.hc_tx_bcast_bytes; 2334 + apc->eth_stats.hc_tx_mcast_pkts = resp.hc_tx_mcast_pkts; 2335 + apc->eth_stats.hc_tx_mcast_bytes = resp.hc_tx_mcast_bytes; 2336 + } 2337 + 2298 2338 static int mana_init_port(struct net_device *ndev) 2299 2339 { 2300 2340 struct mana_port_context *apc = netdev_priv(ndev);
+15
drivers/net/ethernet/microsoft/mana/mana_ethtool.c
··· 13 13 } mana_eth_stats[] = { 14 14 {"stop_queue", offsetof(struct mana_ethtool_stats, stop_queue)}, 15 15 {"wake_queue", offsetof(struct mana_ethtool_stats, wake_queue)}, 16 + {"hc_tx_bytes", offsetof(struct mana_ethtool_stats, hc_tx_bytes)}, 17 + {"hc_tx_ucast_pkts", offsetof(struct mana_ethtool_stats, 18 + hc_tx_ucast_pkts)}, 19 + {"hc_tx_ucast_bytes", offsetof(struct mana_ethtool_stats, 20 + hc_tx_ucast_bytes)}, 21 + {"hc_tx_bcast_pkts", offsetof(struct mana_ethtool_stats, 22 + hc_tx_bcast_pkts)}, 23 + {"hc_tx_bcast_bytes", offsetof(struct mana_ethtool_stats, 24 + hc_tx_bcast_bytes)}, 25 + {"hc_tx_mcast_pkts", offsetof(struct mana_ethtool_stats, 26 + hc_tx_mcast_pkts)}, 27 + {"hc_tx_mcast_bytes", offsetof(struct mana_ethtool_stats, 28 + hc_tx_mcast_bytes)}, 16 29 {"tx_cq_err", offsetof(struct mana_ethtool_stats, tx_cqe_err)}, 17 30 {"tx_cqe_unknown_type", offsetof(struct mana_ethtool_stats, 18 31 tx_cqe_unknown_type)}, ··· 127 114 128 115 if (!apc->port_is_up) 129 116 return; 117 + /* we call mana function to update stats from GDMA */ 118 + mana_query_gf_stats(apc); 130 119 131 120 for (q = 0; q < ARRAY_SIZE(mana_eth_stats); q++) 132 121 data[i++] = *(u64 *)(eth_stats + mana_eth_stats[q].offset);
+87
include/net/mana/mana.h
··· 352 352 struct mana_ethtool_stats { 353 353 u64 stop_queue; 354 354 u64 wake_queue; 355 + u64 hc_tx_bytes; 356 + u64 hc_tx_ucast_pkts; 357 + u64 hc_tx_ucast_bytes; 358 + u64 hc_tx_bcast_pkts; 359 + u64 hc_tx_bcast_bytes; 360 + u64 hc_tx_mcast_pkts; 361 + u64 hc_tx_mcast_bytes; 355 362 u64 tx_cqe_err; 356 363 u64 tx_cqe_unknown_type; 357 364 u64 rx_coalesced_err; ··· 449 442 struct bpf_prog *mana_xdp_get(struct mana_port_context *apc); 450 443 void mana_chn_setxdp(struct mana_port_context *apc, struct bpf_prog *prog); 451 444 int mana_bpf(struct net_device *ndev, struct netdev_bpf *bpf); 445 + void mana_query_gf_stats(struct mana_port_context *apc); 452 446 453 447 extern const struct ethtool_ops mana_ethtool_ops; 454 448 ··· 591 583 struct gdma_resp_hdr hdr; 592 584 }; /* HW DATA */ 593 585 586 + /* Query stats RQ */ 587 + struct mana_query_gf_stat_req { 588 + struct gdma_req_hdr hdr; 589 + u64 req_stats; 590 + }; /* HW DATA */ 591 + 592 + struct mana_query_gf_stat_resp { 593 + struct gdma_resp_hdr hdr; 594 + u64 reported_stats; 595 + /* rx errors/discards */ 596 + u64 discard_rx_nowqe; 597 + u64 err_rx_vport_disabled; 598 + /* rx bytes/packets */ 599 + u64 hc_rx_bytes; 600 + u64 hc_rx_ucast_pkts; 601 + u64 hc_rx_ucast_bytes; 602 + u64 hc_rx_bcast_pkts; 603 + u64 hc_rx_bcast_bytes; 604 + u64 hc_rx_mcast_pkts; 605 + u64 hc_rx_mcast_bytes; 606 + /* tx errors */ 607 + u64 err_tx_gf_disabled; 608 + u64 err_tx_vport_disabled; 609 + u64 err_tx_inval_vport_offset_pkt; 610 + u64 err_tx_vlan_enforcement; 611 + u64 err_tx_ethtype_enforcement; 612 + u64 err_tx_SA_enforecement; 613 + u64 err_tx_SQPDID_enforcement; 614 + u64 err_tx_CQPDID_enforcement; 615 + u64 err_tx_mtu_violation; 616 + u64 err_tx_inval_oob; 617 + /* tx bytes/packets */ 618 + u64 hc_tx_bytes; 619 + u64 hc_tx_ucast_pkts; 620 + u64 hc_tx_ucast_bytes; 621 + u64 hc_tx_bcast_pkts; 622 + u64 hc_tx_bcast_bytes; 623 + u64 hc_tx_mcast_pkts; 624 + u64 hc_tx_mcast_bytes; 625 + /* tx error */ 626 + u64 err_tx_gdma; 627 + }; /* HW DATA */ 628 + 594 629 /* Configure vPort Rx Steering */ 595 630 struct mana_cfg_rx_steer_req_v2 { 596 631 struct gdma_req_hdr hdr; ··· 712 661 struct mana_deregister_filter_resp { 713 662 struct gdma_resp_hdr hdr; 714 663 }; /* HW DATA */ 664 + 665 + /* Requested GF stats Flags */ 666 + /* Rx discards/Errors */ 667 + #define STATISTICS_FLAGS_RX_DISCARDS_NO_WQE 0x0000000000000001 668 + #define STATISTICS_FLAGS_RX_ERRORS_VPORT_DISABLED 0x0000000000000002 669 + /* Rx bytes/pkts */ 670 + #define STATISTICS_FLAGS_HC_RX_BYTES 0x0000000000000004 671 + #define STATISTICS_FLAGS_HC_RX_UCAST_PACKETS 0x0000000000000008 672 + #define STATISTICS_FLAGS_HC_RX_UCAST_BYTES 0x0000000000000010 673 + #define STATISTICS_FLAGS_HC_RX_MCAST_PACKETS 0x0000000000000020 674 + #define STATISTICS_FLAGS_HC_RX_MCAST_BYTES 0x0000000000000040 675 + #define STATISTICS_FLAGS_HC_RX_BCAST_PACKETS 0x0000000000000080 676 + #define STATISTICS_FLAGS_HC_RX_BCAST_BYTES 0x0000000000000100 677 + /* Tx errors */ 678 + #define STATISTICS_FLAGS_TX_ERRORS_GF_DISABLED 0x0000000000000200 679 + #define STATISTICS_FLAGS_TX_ERRORS_VPORT_DISABLED 0x0000000000000400 680 + #define STATISTICS_FLAGS_TX_ERRORS_INVAL_VPORT_OFFSET_PACKETS \ 681 + 0x0000000000000800 682 + #define STATISTICS_FLAGS_TX_ERRORS_VLAN_ENFORCEMENT 0x0000000000001000 683 + #define STATISTICS_FLAGS_TX_ERRORS_ETH_TYPE_ENFORCEMENT \ 684 + 0x0000000000002000 685 + #define STATISTICS_FLAGS_TX_ERRORS_SA_ENFORCEMENT 0x0000000000004000 686 + #define STATISTICS_FLAGS_TX_ERRORS_SQPDID_ENFORCEMENT 0x0000000000008000 687 + #define STATISTICS_FLAGS_TX_ERRORS_CQPDID_ENFORCEMENT 0x0000000000010000 688 + #define STATISTICS_FLAGS_TX_ERRORS_MTU_VIOLATION 0x0000000000020000 689 + #define STATISTICS_FLAGS_TX_ERRORS_INVALID_OOB 0x0000000000040000 690 + /* Tx bytes/pkts */ 691 + #define STATISTICS_FLAGS_HC_TX_BYTES 0x0000000000080000 692 + #define STATISTICS_FLAGS_HC_TX_UCAST_PACKETS 0x0000000000100000 693 + #define STATISTICS_FLAGS_HC_TX_UCAST_BYTES 0x0000000000200000 694 + #define STATISTICS_FLAGS_HC_TX_MCAST_PACKETS 0x0000000000400000 695 + #define STATISTICS_FLAGS_HC_TX_MCAST_BYTES 0x0000000000800000 696 + #define STATISTICS_FLAGS_HC_TX_BCAST_PACKETS 0x0000000001000000 697 + #define STATISTICS_FLAGS_HC_TX_BCAST_BYTES 0x0000000002000000 698 + /* Tx error */ 699 + #define STATISTICS_FLAGS_TX_ERRORS_GDMA_ERROR 0x0000000004000000 715 700 716 701 #define MANA_MAX_NUM_QUEUES 64 717 702