Skip to content

Commit 5452b2d

Browse files
tlendackydavem330
authored andcommitted
amd-xgbe: Add additional stats to be reported via ethtool
Add additional/extended statistics beyond what is provided by the hardware to be reported via ethtool. The new stats focus on the calls into ndo_start_xmit and the napi_poll routine. Signed-off-by: Tom Lendacky <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6eaf9d1 commit 5452b2d

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

drivers/net/ethernet/amd/xgbe/xgbe-dev.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1533,6 +1533,8 @@ static void xgbe_dev_xmit(struct xgbe_channel *channel)
15331533
packet->tcp_payload_len);
15341534
XGMAC_SET_BITS_LE(rdesc->desc3, TX_NORMAL_DESC3, TCPHDRLEN,
15351535
packet->tcp_header_len / 4);
1536+
1537+
pdata->ext_stats.tx_tso_packets++;
15361538
} else {
15371539
/* Enable CRC and Pad Insertion */
15381540
XGMAC_SET_BITS_LE(rdesc->desc3, TX_NORMAL_DESC3, CPC, 0);
@@ -1618,11 +1620,12 @@ static void xgbe_dev_xmit(struct xgbe_channel *channel)
16181620

16191621
static int xgbe_dev_read(struct xgbe_channel *channel)
16201622
{
1623+
struct xgbe_prv_data *pdata = channel->pdata;
16211624
struct xgbe_ring *ring = channel->rx_ring;
16221625
struct xgbe_ring_data *rdata;
16231626
struct xgbe_ring_desc *rdesc;
16241627
struct xgbe_packet_data *packet = &ring->packet_data;
1625-
struct net_device *netdev = channel->pdata->netdev;
1628+
struct net_device *netdev = pdata->netdev;
16261629
unsigned int err, etlt, l34t;
16271630

16281631
DBGPR("-->xgbe_dev_read: cur = %d\n", ring->cur);
@@ -1661,9 +1664,12 @@ static int xgbe_dev_read(struct xgbe_channel *channel)
16611664
CONTEXT_NEXT, 1);
16621665

16631666
/* Get the header length */
1664-
if (XGMAC_GET_BITS_LE(rdesc->desc3, RX_NORMAL_DESC3, FD))
1667+
if (XGMAC_GET_BITS_LE(rdesc->desc3, RX_NORMAL_DESC3, FD)) {
16651668
rdata->rx.hdr_len = XGMAC_GET_BITS_LE(rdesc->desc2,
16661669
RX_NORMAL_DESC2, HL);
1670+
if (rdata->rx.hdr_len)
1671+
pdata->ext_stats.rx_split_header_packets++;
1672+
}
16671673

16681674
/* Get the RSS hash */
16691675
if (XGMAC_GET_BITS_LE(rdesc->desc3, RX_NORMAL_DESC3, RSV)) {
@@ -1700,7 +1706,7 @@ static int xgbe_dev_read(struct xgbe_channel *channel)
17001706
INCOMPLETE, 0);
17011707

17021708
/* Set checksum done indicator as appropriate */
1703-
if (channel->pdata->netdev->features & NETIF_F_RXCSUM)
1709+
if (netdev->features & NETIF_F_RXCSUM)
17041710
XGMAC_SET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES,
17051711
CSUM_DONE, 1);
17061712

drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,20 @@ struct xgbe_stats {
133133
offsetof(struct xgbe_prv_data, mmc_stats._var), \
134134
}
135135

136+
#define XGMAC_EXT_STAT(_string, _var) \
137+
{ _string, \
138+
FIELD_SIZEOF(struct xgbe_ext_stats, _var), \
139+
offsetof(struct xgbe_prv_data, ext_stats._var), \
140+
}
141+
136142
static const struct xgbe_stats xgbe_gstring_stats[] = {
137143
XGMAC_MMC_STAT("tx_bytes", txoctetcount_gb),
138144
XGMAC_MMC_STAT("tx_packets", txframecount_gb),
139145
XGMAC_MMC_STAT("tx_unicast_packets", txunicastframes_gb),
140146
XGMAC_MMC_STAT("tx_broadcast_packets", txbroadcastframes_gb),
141147
XGMAC_MMC_STAT("tx_multicast_packets", txmulticastframes_gb),
142148
XGMAC_MMC_STAT("tx_vlan_packets", txvlanframes_g),
149+
XGMAC_EXT_STAT("tx_tso_packets", tx_tso_packets),
143150
XGMAC_MMC_STAT("tx_64_byte_packets", tx64octets_gb),
144151
XGMAC_MMC_STAT("tx_65_to_127_byte_packets", tx65to127octets_gb),
145152
XGMAC_MMC_STAT("tx_128_to_255_byte_packets", tx128to255octets_gb),
@@ -171,6 +178,7 @@ static const struct xgbe_stats xgbe_gstring_stats[] = {
171178
XGMAC_MMC_STAT("rx_fifo_overflow_errors", rxfifooverflow),
172179
XGMAC_MMC_STAT("rx_watchdog_errors", rxwatchdogerror),
173180
XGMAC_MMC_STAT("rx_pause_frames", rxpauseframes),
181+
XGMAC_EXT_STAT("rx_split_header_packets", rx_split_header_packets),
174182
};
175183

176184
#define XGBE_STATS_COUNT ARRAY_SIZE(xgbe_gstring_stats)

drivers/net/ethernet/amd/xgbe/xgbe.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,11 @@ struct xgbe_mmc_stats {
492492
u64 rxwatchdogerror;
493493
};
494494

495+
struct xgbe_ext_stats {
496+
u64 tx_tso_packets;
497+
u64 rx_split_header_packets;
498+
};
499+
495500
struct xgbe_hw_if {
496501
int (*tx_complete)(struct xgbe_ring_desc *);
497502

@@ -750,6 +755,7 @@ struct xgbe_prv_data {
750755
netdev_features_t netdev_features;
751756
struct napi_struct napi;
752757
struct xgbe_mmc_stats mmc_stats;
758+
struct xgbe_ext_stats ext_stats;
753759

754760
/* Filtering support */
755761
unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];

0 commit comments

Comments
 (0)