File Index
Files and directories
Sign in
FILE

fbnic_hw_stats.h

File preview with syntax highlighting.

linux-6.19.14/drivers/net/ethernet/meta/fbnic/fbnic_hw_stats.h C
  1/* SPDX-License-Identifier: GPL-2.0 */
  2/* Copyright (c) Meta Platforms, Inc. and affiliates. */
  3
  4#ifndef _FBNIC_HW_STATS_H_
  5#define _FBNIC_HW_STATS_H_
  6
  7#include <linux/ethtool.h>
  8#include <linux/spinlock.h>
  9
 10#include "fbnic_csr.h"
 11
 12struct fbnic_stat_counter {
 13	u64 value;
 14	union {
 15		u32 old_reg_value_32;
 16		u64 old_reg_value_64;
 17	} u;
 18	bool reported;
 19};
 20
 21struct fbnic_hw_stat {
 22	struct fbnic_stat_counter frames;
 23	struct fbnic_stat_counter bytes;
 24};
 25
 26struct fbnic_fec_stats {
 27	struct fbnic_stat_counter corrected_blocks, uncorrectable_blocks;
 28};
 29
 30struct fbnic_pcs_stats {
 31	struct {
 32		struct fbnic_stat_counter lanes[FBNIC_PCS_MAX_LANES];
 33	} SymbolErrorDuringCarrier;
 34};
 35
 36/* Note: not updated by fbnic_get_hw_stats() */
 37struct fbnic_eth_ctrl_stats {
 38	struct fbnic_stat_counter MACControlFramesTransmitted;
 39	struct fbnic_stat_counter MACControlFramesReceived;
 40};
 41
 42/* Note: not updated by fbnic_get_hw_stats() */
 43struct fbnic_rmon_stats {
 44	struct fbnic_stat_counter undersize_pkts;
 45	struct fbnic_stat_counter oversize_pkts;
 46	struct fbnic_stat_counter fragments;
 47	struct fbnic_stat_counter jabbers;
 48
 49	struct fbnic_stat_counter hist[ETHTOOL_RMON_HIST_MAX];
 50	struct fbnic_stat_counter hist_tx[ETHTOOL_RMON_HIST_MAX];
 51};
 52
 53/* Note: not updated by fbnic_get_hw_stats() */
 54struct fbnic_pause_stats {
 55	struct fbnic_stat_counter tx_pause_frames;
 56	struct fbnic_stat_counter rx_pause_frames;
 57};
 58
 59struct fbnic_eth_mac_stats {
 60	struct fbnic_stat_counter FramesTransmittedOK;
 61	struct fbnic_stat_counter FramesReceivedOK;
 62	struct fbnic_stat_counter FrameCheckSequenceErrors;
 63	struct fbnic_stat_counter AlignmentErrors;
 64	struct fbnic_stat_counter OctetsTransmittedOK;
 65	struct fbnic_stat_counter FramesLostDueToIntMACXmitError;
 66	struct fbnic_stat_counter OctetsReceivedOK;
 67	struct fbnic_stat_counter FramesLostDueToIntMACRcvError;
 68	struct fbnic_stat_counter MulticastFramesXmittedOK;
 69	struct fbnic_stat_counter BroadcastFramesXmittedOK;
 70	struct fbnic_stat_counter MulticastFramesReceivedOK;
 71	struct fbnic_stat_counter BroadcastFramesReceivedOK;
 72	struct fbnic_stat_counter FrameTooLongErrors;
 73};
 74
 75struct fbnic_phy_stats {
 76	struct fbnic_fec_stats fec;
 77	struct fbnic_pcs_stats pcs;
 78};
 79
 80struct fbnic_mac_stats {
 81	struct fbnic_eth_mac_stats eth_mac;
 82	struct fbnic_pause_stats pause;
 83	struct fbnic_eth_ctrl_stats eth_ctrl;
 84	struct fbnic_rmon_stats rmon;
 85};
 86
 87struct fbnic_tmi_stats {
 88	struct fbnic_hw_stat drop;
 89	struct fbnic_stat_counter ptp_illegal_req, ptp_good_ts, ptp_bad_ts;
 90};
 91
 92struct fbnic_tti_stats {
 93	struct fbnic_hw_stat cm_drop, frame_drop, tbi_drop;
 94};
 95
 96struct fbnic_rpc_stats {
 97	struct fbnic_stat_counter unkn_etype, unkn_ext_hdr;
 98	struct fbnic_stat_counter ipv4_frag, ipv6_frag, ipv4_esp, ipv6_esp;
 99	struct fbnic_stat_counter tcp_opt_err, out_of_hdr_err, ovr_size_err;
100};
101
102struct fbnic_rxb_enqueue_stats {
103	struct fbnic_hw_stat drbo;
104	struct fbnic_stat_counter integrity_err, mac_err;
105	struct fbnic_stat_counter parser_err, frm_err;
106};
107
108struct fbnic_rxb_fifo_stats {
109	struct fbnic_hw_stat drop, trunc;
110	struct fbnic_stat_counter trans_drop, trans_ecn;
111	struct fbnic_stat_counter level;
112};
113
114struct fbnic_rxb_dequeue_stats {
115	struct fbnic_hw_stat intf, pbuf;
116};
117
118struct fbnic_rxb_stats {
119	struct fbnic_rxb_enqueue_stats enq[FBNIC_RXB_ENQUEUE_INDICES];
120	struct fbnic_rxb_fifo_stats fifo[FBNIC_RXB_FIFO_INDICES];
121	struct fbnic_rxb_dequeue_stats deq[FBNIC_RXB_DEQUEUE_INDICES];
122};
123
124struct fbnic_hw_q_stats {
125	struct fbnic_stat_counter rde_pkt_err;
126	struct fbnic_stat_counter rde_pkt_cq_drop;
127	struct fbnic_stat_counter rde_pkt_bdq_drop;
128};
129
130struct fbnic_pcie_stats {
131	struct fbnic_stat_counter ob_rd_tlp, ob_rd_dword;
132	struct fbnic_stat_counter ob_wr_tlp, ob_wr_dword;
133	struct fbnic_stat_counter ob_cpl_tlp, ob_cpl_dword;
134
135	struct fbnic_stat_counter ob_rd_no_tag;
136	struct fbnic_stat_counter ob_rd_no_cpl_cred;
137	struct fbnic_stat_counter ob_rd_no_np_cred;
138};
139
140struct fbnic_hw_stats {
141	struct fbnic_phy_stats phy;
142	struct fbnic_mac_stats mac;
143	struct fbnic_tmi_stats tmi;
144	struct fbnic_tti_stats tti;
145	struct fbnic_rpc_stats rpc;
146	struct fbnic_rxb_stats rxb;
147	struct fbnic_hw_q_stats hw_q[FBNIC_MAX_QUEUES];
148	struct fbnic_pcie_stats pcie;
149
150	/* Lock protecting the access to hw stats */
151	spinlock_t lock;
152};
153
154u64 fbnic_stat_rd64(struct fbnic_dev *fbd, u32 reg, u32 offset);
155
156void fbnic_reset_hw_stats(struct fbnic_dev *fbd);
157void fbnic_init_hw_stats(struct fbnic_dev *fbd);
158void fbnic_get_hw_q_stats(struct fbnic_dev *fbd,
159			  struct fbnic_hw_q_stats *hw_q);
160void fbnic_get_hw_stats32(struct fbnic_dev *fbd);
161void fbnic_get_hw_stats(struct fbnic_dev *fbd);
162
163#endif /* _FBNIC_HW_STATS_H_ */
~/ Read-only file preview.