Commit 423cffcf authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

bnxt: add pause frame stats

These stats are already reported in ethtool -S.
Michael confirms they are equivalent to standard stats.

v2: - fix sparse warning about endian by using the macro
    - use u64 for pointer type
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Reviewed-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
Reviewed-by: default avatarMichael Chan <michael.chan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 242aaf03
...@@ -1778,6 +1778,22 @@ static void bnxt_get_pauseparam(struct net_device *dev, ...@@ -1778,6 +1778,22 @@ static void bnxt_get_pauseparam(struct net_device *dev,
epause->tx_pause = !!(link_info->req_flow_ctrl & BNXT_LINK_PAUSE_TX); epause->tx_pause = !!(link_info->req_flow_ctrl & BNXT_LINK_PAUSE_TX);
} }
static void bnxt_get_pause_stats(struct net_device *dev,
struct ethtool_pause_stats *epstat)
{
struct bnxt *bp = netdev_priv(dev);
u64 *rx, *tx;
if (BNXT_VF(bp) || !(bp->flags & BNXT_FLAG_PORT_STATS))
return;
rx = bp->port_stats.sw_stats;
tx = bp->port_stats.sw_stats + BNXT_TX_PORT_STATS_BYTE_OFFSET / 8;
epstat->rx_pause_frames = BNXT_GET_RX_PORT_STATS64(rx, rx_pause_frames);
epstat->tx_pause_frames = BNXT_GET_TX_PORT_STATS64(tx, tx_pause_frames);
}
static int bnxt_set_pauseparam(struct net_device *dev, static int bnxt_set_pauseparam(struct net_device *dev,
struct ethtool_pauseparam *epause) struct ethtool_pauseparam *epause)
{ {
...@@ -3645,6 +3661,7 @@ const struct ethtool_ops bnxt_ethtool_ops = { ...@@ -3645,6 +3661,7 @@ const struct ethtool_ops bnxt_ethtool_ops = {
ETHTOOL_COALESCE_USE_ADAPTIVE_RX, ETHTOOL_COALESCE_USE_ADAPTIVE_RX,
.get_link_ksettings = bnxt_get_link_ksettings, .get_link_ksettings = bnxt_get_link_ksettings,
.set_link_ksettings = bnxt_set_link_ksettings, .set_link_ksettings = bnxt_set_link_ksettings,
.get_pause_stats = bnxt_get_pause_stats,
.get_pauseparam = bnxt_get_pauseparam, .get_pauseparam = bnxt_get_pauseparam,
.set_pauseparam = bnxt_set_pauseparam, .set_pauseparam = bnxt_set_pauseparam,
.get_drvinfo = bnxt_get_drvinfo, .get_drvinfo = bnxt_get_drvinfo,
......
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