Commit 0e898dd7 authored by Barak Witkowski's avatar Barak Witkowski Committed by David S. Miller

bnx2x: add PFC statistics

Add Priority flow control counters for ethtool -S.
Signed-off-by: default avatarBarak Witkowski <barak@broadcom.com>
Signed-off-by: default avatarEilon Greenstein <eilong@broadcom.com>
Signed-off-by: default avatarMichael Chan <mchan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f0a98ae8
...@@ -1266,6 +1266,7 @@ struct bnx2x { ...@@ -1266,6 +1266,7 @@ struct bnx2x {
#define NO_ISCSI_OOO_FLAG (1 << 13) #define NO_ISCSI_OOO_FLAG (1 << 13)
#define NO_ISCSI_FLAG (1 << 14) #define NO_ISCSI_FLAG (1 << 14)
#define NO_FCOE_FLAG (1 << 15) #define NO_FCOE_FLAG (1 << 15)
#define BC_SUPPORTS_PFC_STATS (1 << 17)
#define NO_ISCSI(bp) ((bp)->flags & NO_ISCSI_FLAG) #define NO_ISCSI(bp) ((bp)->flags & NO_ISCSI_FLAG)
#define NO_ISCSI_OOO(bp) ((bp)->flags & NO_ISCSI_OOO_FLAG) #define NO_ISCSI_OOO(bp) ((bp)->flags & NO_ISCSI_OOO_FLAG)
......
...@@ -107,6 +107,10 @@ static const struct { ...@@ -107,6 +107,10 @@ static const struct {
4, STATS_FLAGS_PORT, "rx_filtered_packets" }, 4, STATS_FLAGS_PORT, "rx_filtered_packets" },
{ STATS_OFFSET32(mf_tag_discard), { STATS_OFFSET32(mf_tag_discard),
4, STATS_FLAGS_PORT, "rx_mf_tag_discard" }, 4, STATS_FLAGS_PORT, "rx_mf_tag_discard" },
{ STATS_OFFSET32(pfc_frames_received_hi),
8, STATS_FLAGS_PORT, "pfc_frames_received" },
{ STATS_OFFSET32(pfc_frames_sent_hi),
8, STATS_FLAGS_PORT, "pfc_frames_sent" },
{ STATS_OFFSET32(brb_drop_hi), { STATS_OFFSET32(brb_drop_hi),
8, STATS_FLAGS_PORT, "rx_brb_discard" }, 8, STATS_FLAGS_PORT, "rx_brb_discard" },
{ STATS_OFFSET32(brb_truncate_hi), { STATS_OFFSET32(brb_truncate_hi),
......
...@@ -1247,6 +1247,7 @@ struct drv_func_mb { ...@@ -1247,6 +1247,7 @@ struct drv_func_mb {
#define DRV_MSG_CODE_VRFY_SPECIFIC_PHY_OPT_MDL 0xa1000000 #define DRV_MSG_CODE_VRFY_SPECIFIC_PHY_OPT_MDL 0xa1000000
#define REQ_BC_VER_4_VRFY_SPECIFIC_PHY_OPT_MDL 0x00050234 #define REQ_BC_VER_4_VRFY_SPECIFIC_PHY_OPT_MDL 0x00050234
#define REQ_BC_VER_4_SFP_TX_DISABLE_SUPPORTED 0x00070014 #define REQ_BC_VER_4_SFP_TX_DISABLE_SUPPORTED 0x00070014
#define REQ_BC_VER_4_PFC_STATS_SUPPORTED 0x00070201
#define DRV_MSG_CODE_DCBX_ADMIN_PMF_MSG 0xb0000000 #define DRV_MSG_CODE_DCBX_ADMIN_PMF_MSG 0xb0000000
#define DRV_MSG_CODE_DCBX_PMF_DRV_OK 0xb2000000 #define DRV_MSG_CODE_DCBX_PMF_DRV_OK 0xb2000000
...@@ -2501,14 +2502,18 @@ struct mac_stx { ...@@ -2501,14 +2502,18 @@ struct mac_stx {
#define MAC_STX_IDX_MAX 2 #define MAC_STX_IDX_MAX 2
struct host_port_stats { struct host_port_stats {
u32 host_port_stats_start; u32 host_port_stats_counter;
struct mac_stx mac_stx[MAC_STX_IDX_MAX]; struct mac_stx mac_stx[MAC_STX_IDX_MAX];
u32 brb_drop_hi; u32 brb_drop_hi;
u32 brb_drop_lo; u32 brb_drop_lo;
u32 host_port_stats_end; u32 not_used; /* obsolete */
u32 pfc_frames_tx_hi;
u32 pfc_frames_tx_lo;
u32 pfc_frames_rx_hi;
u32 pfc_frames_rx_lo;
}; };
......
...@@ -8827,6 +8827,8 @@ static void __devinit bnx2x_get_common_hwinfo(struct bnx2x *bp) ...@@ -8827,6 +8827,8 @@ static void __devinit bnx2x_get_common_hwinfo(struct bnx2x *bp)
bp->link_params.feature_config_flags |= bp->link_params.feature_config_flags |=
(val >= REQ_BC_VER_4_SFP_TX_DISABLE_SUPPORTED) ? (val >= REQ_BC_VER_4_SFP_TX_DISABLE_SUPPORTED) ?
FEATURE_CONFIG_BC_SUPPORTS_SFP_TX_DISABLED : 0; FEATURE_CONFIG_BC_SUPPORTS_SFP_TX_DISABLED : 0;
bp->flags |= (val >= REQ_BC_VER_4_PFC_STATS_SUPPORTED) ?
BC_SUPPORTS_PFC_STATS : 0;
pci_read_config_word(bp->pdev, bp->pm_cap + PCI_PM_PMC, &pmc); pci_read_config_word(bp->pdev, bp->pm_cap + PCI_PM_PMC, &pmc);
bp->flags |= (pmc & PCI_PM_CAP_PME_D3cold) ? 0 : NO_WOL_FLAG; bp->flags |= (pmc & PCI_PM_CAP_PME_D3cold) ? 0 : NO_WOL_FLAG;
......
...@@ -540,6 +540,25 @@ static void bnx2x_bmac_stats_update(struct bnx2x *bp) ...@@ -540,6 +540,25 @@ static void bnx2x_bmac_stats_update(struct bnx2x *bp)
UPDATE_STAT64(tx_stat_gterr, UPDATE_STAT64(tx_stat_gterr,
tx_stat_dot3statsinternalmactransmiterrors); tx_stat_dot3statsinternalmactransmiterrors);
UPDATE_STAT64(tx_stat_gtufl, tx_stat_mac_ufl); UPDATE_STAT64(tx_stat_gtufl, tx_stat_mac_ufl);
/* collect PFC stats */
DIFF_64(diff.hi, new->tx_stat_gtpp_hi,
pstats->pfc_frames_tx_hi,
diff.lo, new->tx_stat_gtpp_lo,
pstats->pfc_frames_tx_lo);
pstats->pfc_frames_tx_hi = new->tx_stat_gtpp_hi;
pstats->pfc_frames_tx_lo = new->tx_stat_gtpp_lo;
ADD_64(pstats->pfc_frames_tx_hi, diff.hi,
pstats->pfc_frames_tx_lo, diff.lo);
DIFF_64(diff.hi, new->rx_stat_grpp_hi,
pstats->pfc_frames_rx_hi,
diff.lo, new->rx_stat_grpp_lo,
pstats->pfc_frames_rx_lo);
pstats->pfc_frames_rx_hi = new->rx_stat_grpp_hi;
pstats->pfc_frames_rx_lo = new->rx_stat_grpp_lo;
ADD_64(pstats->pfc_frames_rx_hi, diff.hi,
pstats->pfc_frames_rx_lo, diff.lo);
} }
estats->pause_frames_received_hi = estats->pause_frames_received_hi =
...@@ -551,6 +570,15 @@ static void bnx2x_bmac_stats_update(struct bnx2x *bp) ...@@ -551,6 +570,15 @@ static void bnx2x_bmac_stats_update(struct bnx2x *bp)
pstats->mac_stx[1].tx_stat_outxoffsent_hi; pstats->mac_stx[1].tx_stat_outxoffsent_hi;
estats->pause_frames_sent_lo = estats->pause_frames_sent_lo =
pstats->mac_stx[1].tx_stat_outxoffsent_lo; pstats->mac_stx[1].tx_stat_outxoffsent_lo;
estats->pfc_frames_received_hi =
pstats->pfc_frames_rx_hi;
estats->pfc_frames_received_lo =
pstats->pfc_frames_rx_lo;
estats->pfc_frames_sent_hi =
pstats->pfc_frames_tx_hi;
estats->pfc_frames_sent_lo =
pstats->pfc_frames_tx_lo;
} }
static void bnx2x_mstat_stats_update(struct bnx2x *bp) static void bnx2x_mstat_stats_update(struct bnx2x *bp)
...@@ -571,6 +599,11 @@ static void bnx2x_mstat_stats_update(struct bnx2x *bp) ...@@ -571,6 +599,11 @@ static void bnx2x_mstat_stats_update(struct bnx2x *bp)
ADD_STAT64(stats_tx.tx_gtxpf, tx_stat_outxoffsent); ADD_STAT64(stats_tx.tx_gtxpf, tx_stat_outxoffsent);
ADD_STAT64(stats_tx.tx_gtxpf, tx_stat_flowcontroldone); ADD_STAT64(stats_tx.tx_gtxpf, tx_stat_flowcontroldone);
/* collect pfc stats */
ADD_64(pstats->pfc_frames_tx_hi, new->stats_tx.tx_gtxpp_hi,
pstats->pfc_frames_tx_lo, new->stats_tx.tx_gtxpp_lo);
ADD_64(pstats->pfc_frames_rx_hi, new->stats_rx.rx_grxpp_hi,
pstats->pfc_frames_rx_lo, new->stats_rx.rx_grxpp_lo);
ADD_STAT64(stats_tx.tx_gt64, tx_stat_etherstatspkts64octets); ADD_STAT64(stats_tx.tx_gt64, tx_stat_etherstatspkts64octets);
ADD_STAT64(stats_tx.tx_gt127, ADD_STAT64(stats_tx.tx_gt127,
...@@ -628,6 +661,15 @@ static void bnx2x_mstat_stats_update(struct bnx2x *bp) ...@@ -628,6 +661,15 @@ static void bnx2x_mstat_stats_update(struct bnx2x *bp)
pstats->mac_stx[1].tx_stat_outxoffsent_hi; pstats->mac_stx[1].tx_stat_outxoffsent_hi;
estats->pause_frames_sent_lo = estats->pause_frames_sent_lo =
pstats->mac_stx[1].tx_stat_outxoffsent_lo; pstats->mac_stx[1].tx_stat_outxoffsent_lo;
estats->pfc_frames_received_hi =
pstats->pfc_frames_rx_hi;
estats->pfc_frames_received_lo =
pstats->pfc_frames_rx_lo;
estats->pfc_frames_sent_hi =
pstats->pfc_frames_tx_hi;
estats->pfc_frames_sent_lo =
pstats->pfc_frames_tx_lo;
} }
static void bnx2x_emac_stats_update(struct bnx2x *bp) static void bnx2x_emac_stats_update(struct bnx2x *bp)
...@@ -740,7 +782,7 @@ static int bnx2x_hw_stats_update(struct bnx2x *bp) ...@@ -740,7 +782,7 @@ static int bnx2x_hw_stats_update(struct bnx2x *bp)
estats->brb_drop_hi = pstats->brb_drop_hi; estats->brb_drop_hi = pstats->brb_drop_hi;
estats->brb_drop_lo = pstats->brb_drop_lo; estats->brb_drop_lo = pstats->brb_drop_lo;
pstats->host_port_stats_start = ++pstats->host_port_stats_end; pstats->host_port_stats_counter++;
if (!BP_NOMCP(bp)) { if (!BP_NOMCP(bp)) {
u32 nig_timer_max = u32 nig_timer_max =
......
...@@ -193,6 +193,12 @@ struct bnx2x_eth_stats { ...@@ -193,6 +193,12 @@ struct bnx2x_eth_stats {
u32 total_tpa_aggregated_frames_lo; u32 total_tpa_aggregated_frames_lo;
u32 total_tpa_bytes_hi; u32 total_tpa_bytes_hi;
u32 total_tpa_bytes_lo; u32 total_tpa_bytes_lo;
/* PFC */
u32 pfc_frames_received_hi;
u32 pfc_frames_received_lo;
u32 pfc_frames_sent_hi;
u32 pfc_frames_sent_lo;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment