bnxt_en: Add PFC statistics.
Report PFC statistics to ethtool -S and DCBNL. Signed-off-by: Michael Chan <michael.chan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
7df4ae9fe8
commit
c77192f204
|
@ -1124,6 +1124,13 @@ struct bnxt {
|
|||
u32 lpi_tmr_hi;
|
||||
};
|
||||
|
||||
#define BNXT_RX_STATS_OFFSET(counter) \
|
||||
(offsetof(struct rx_port_stats, counter) / 8)
|
||||
|
||||
#define BNXT_TX_STATS_OFFSET(counter) \
|
||||
((offsetof(struct tx_port_stats, counter) + \
|
||||
sizeof(struct rx_port_stats) + 512) / 8)
|
||||
|
||||
#ifdef CONFIG_NET_RX_BUSY_POLL
|
||||
static inline void bnxt_enable_poll(struct bnxt_napi *bnapi)
|
||||
{
|
||||
|
|
|
@ -347,8 +347,10 @@ static int bnxt_dcbnl_ieee_setets(struct net_device *dev, struct ieee_ets *ets)
|
|||
static int bnxt_dcbnl_ieee_getpfc(struct net_device *dev, struct ieee_pfc *pfc)
|
||||
{
|
||||
struct bnxt *bp = netdev_priv(dev);
|
||||
__le64 *stats = (__le64 *)bp->hw_rx_port_stats;
|
||||
struct ieee_pfc *my_pfc = bp->ieee_pfc;
|
||||
int rc;
|
||||
long rx_off, tx_off;
|
||||
int i, rc;
|
||||
|
||||
pfc->pfc_cap = bp->max_lltc;
|
||||
|
||||
|
@ -369,6 +371,16 @@ static int bnxt_dcbnl_ieee_getpfc(struct net_device *dev, struct ieee_pfc *pfc)
|
|||
pfc->mbc = my_pfc->mbc;
|
||||
pfc->delay = my_pfc->delay;
|
||||
|
||||
if (!stats)
|
||||
return 0;
|
||||
|
||||
rx_off = BNXT_RX_STATS_OFFSET(rx_pfc_ena_frames_pri0);
|
||||
tx_off = BNXT_TX_STATS_OFFSET(tx_pfc_ena_frames_pri0);
|
||||
for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++, rx_off++, tx_off++) {
|
||||
pfc->requests[i] = le64_to_cpu(*(stats + tx_off));
|
||||
pfc->indications[i] = le64_to_cpu(*(stats + rx_off));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -107,16 +107,9 @@ static int bnxt_set_coalesce(struct net_device *dev,
|
|||
|
||||
#define BNXT_NUM_STATS 21
|
||||
|
||||
#define BNXT_RX_STATS_OFFSET(counter) \
|
||||
(offsetof(struct rx_port_stats, counter) / 8)
|
||||
|
||||
#define BNXT_RX_STATS_ENTRY(counter) \
|
||||
{ BNXT_RX_STATS_OFFSET(counter), __stringify(counter) }
|
||||
|
||||
#define BNXT_TX_STATS_OFFSET(counter) \
|
||||
((offsetof(struct tx_port_stats, counter) + \
|
||||
sizeof(struct rx_port_stats) + 512) / 8)
|
||||
|
||||
#define BNXT_TX_STATS_ENTRY(counter) \
|
||||
{ BNXT_TX_STATS_OFFSET(counter), __stringify(counter) }
|
||||
|
||||
|
@ -150,6 +143,14 @@ static const struct {
|
|||
BNXT_RX_STATS_ENTRY(rx_tagged_frames),
|
||||
BNXT_RX_STATS_ENTRY(rx_double_tagged_frames),
|
||||
BNXT_RX_STATS_ENTRY(rx_good_frames),
|
||||
BNXT_RX_STATS_ENTRY(rx_pfc_ena_frames_pri0),
|
||||
BNXT_RX_STATS_ENTRY(rx_pfc_ena_frames_pri1),
|
||||
BNXT_RX_STATS_ENTRY(rx_pfc_ena_frames_pri2),
|
||||
BNXT_RX_STATS_ENTRY(rx_pfc_ena_frames_pri3),
|
||||
BNXT_RX_STATS_ENTRY(rx_pfc_ena_frames_pri4),
|
||||
BNXT_RX_STATS_ENTRY(rx_pfc_ena_frames_pri5),
|
||||
BNXT_RX_STATS_ENTRY(rx_pfc_ena_frames_pri6),
|
||||
BNXT_RX_STATS_ENTRY(rx_pfc_ena_frames_pri7),
|
||||
BNXT_RX_STATS_ENTRY(rx_undrsz_frames),
|
||||
BNXT_RX_STATS_ENTRY(rx_eee_lpi_events),
|
||||
BNXT_RX_STATS_ENTRY(rx_eee_lpi_duration),
|
||||
|
@ -179,6 +180,14 @@ static const struct {
|
|||
BNXT_TX_STATS_ENTRY(tx_fcs_err_frames),
|
||||
BNXT_TX_STATS_ENTRY(tx_err),
|
||||
BNXT_TX_STATS_ENTRY(tx_fifo_underruns),
|
||||
BNXT_TX_STATS_ENTRY(tx_pfc_ena_frames_pri0),
|
||||
BNXT_TX_STATS_ENTRY(tx_pfc_ena_frames_pri1),
|
||||
BNXT_TX_STATS_ENTRY(tx_pfc_ena_frames_pri2),
|
||||
BNXT_TX_STATS_ENTRY(tx_pfc_ena_frames_pri3),
|
||||
BNXT_TX_STATS_ENTRY(tx_pfc_ena_frames_pri4),
|
||||
BNXT_TX_STATS_ENTRY(tx_pfc_ena_frames_pri5),
|
||||
BNXT_TX_STATS_ENTRY(tx_pfc_ena_frames_pri6),
|
||||
BNXT_TX_STATS_ENTRY(tx_pfc_ena_frames_pri7),
|
||||
BNXT_TX_STATS_ENTRY(tx_eee_lpi_events),
|
||||
BNXT_TX_STATS_ENTRY(tx_eee_lpi_duration),
|
||||
BNXT_TX_STATS_ENTRY(tx_total_collisions),
|
||||
|
|
Loading…
Reference in New Issue