Skip to content

Commit bc1962e

Browse files
Raju Lakkarajudavem330
authored andcommitted
net: lan743x: Add support to display Tx Queue statistics
Tx 4 queue statistics display through ethtool application Signed-off-by: Raju Lakkaraju <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 5edce15 commit bc1962e

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

drivers/net/ethernet/microchip/lan743x_ethtool.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,14 @@ static const char lan743x_set1_sw_cnt_strings[][ETH_GSTRING_LEN] = {
365365
"RX Queue 3 Frames",
366366
};
367367

368+
static const char lan743x_tx_queue_cnt_strings[][ETH_GSTRING_LEN] = {
369+
"TX Queue 0 Frames",
370+
"TX Queue 1 Frames",
371+
"TX Queue 2 Frames",
372+
"TX Queue 3 Frames",
373+
"TX Total Queue Frames",
374+
};
375+
368376
static const char lan743x_set2_hw_cnt_strings[][ETH_GSTRING_LEN] = {
369377
"RX Total Frames",
370378
"EEE RX LPI Transitions",
@@ -462,6 +470,8 @@ static const char lan743x_priv_flags_strings[][ETH_GSTRING_LEN] = {
462470
static void lan743x_ethtool_get_strings(struct net_device *netdev,
463471
u32 stringset, u8 *data)
464472
{
473+
struct lan743x_adapter *adapter = netdev_priv(netdev);
474+
465475
switch (stringset) {
466476
case ETH_SS_STATS:
467477
memcpy(data, lan743x_set0_hw_cnt_strings,
@@ -473,6 +483,13 @@ static void lan743x_ethtool_get_strings(struct net_device *netdev,
473483
sizeof(lan743x_set1_sw_cnt_strings)],
474484
lan743x_set2_hw_cnt_strings,
475485
sizeof(lan743x_set2_hw_cnt_strings));
486+
if (adapter->is_pci11x1x) {
487+
memcpy(&data[sizeof(lan743x_set0_hw_cnt_strings) +
488+
sizeof(lan743x_set1_sw_cnt_strings) +
489+
sizeof(lan743x_set2_hw_cnt_strings)],
490+
lan743x_tx_queue_cnt_strings,
491+
sizeof(lan743x_tx_queue_cnt_strings));
492+
}
476493
break;
477494
case ETH_SS_PRIV_FLAGS:
478495
memcpy(data, lan743x_priv_flags_strings,
@@ -486,7 +503,9 @@ static void lan743x_ethtool_get_ethtool_stats(struct net_device *netdev,
486503
u64 *data)
487504
{
488505
struct lan743x_adapter *adapter = netdev_priv(netdev);
506+
u64 total_queue_count = 0;
489507
int data_index = 0;
508+
u64 pkt_cnt;
490509
u32 buf;
491510
int i;
492511

@@ -500,6 +519,14 @@ static void lan743x_ethtool_get_ethtool_stats(struct net_device *netdev,
500519
buf = lan743x_csr_read(adapter, lan743x_set2_hw_cnt_addr[i]);
501520
data[data_index++] = (u64)buf;
502521
}
522+
if (adapter->is_pci11x1x) {
523+
for (i = 0; i < ARRAY_SIZE(adapter->tx); i++) {
524+
pkt_cnt = (u64)(adapter->tx[i].frame_count);
525+
data[data_index++] = pkt_cnt;
526+
total_queue_count += pkt_cnt;
527+
}
528+
data[data_index++] = total_queue_count;
529+
}
503530
}
504531

505532
static u32 lan743x_ethtool_get_priv_flags(struct net_device *netdev)
@@ -520,6 +547,8 @@ static int lan743x_ethtool_set_priv_flags(struct net_device *netdev, u32 flags)
520547

521548
static int lan743x_ethtool_get_sset_count(struct net_device *netdev, int sset)
522549
{
550+
struct lan743x_adapter *adapter = netdev_priv(netdev);
551+
523552
switch (sset) {
524553
case ETH_SS_STATS:
525554
{
@@ -528,6 +557,8 @@ static int lan743x_ethtool_get_sset_count(struct net_device *netdev, int sset)
528557
ret = ARRAY_SIZE(lan743x_set0_hw_cnt_strings);
529558
ret += ARRAY_SIZE(lan743x_set1_sw_cnt_strings);
530559
ret += ARRAY_SIZE(lan743x_set2_hw_cnt_strings);
560+
if (adapter->is_pci11x1x)
561+
ret += ARRAY_SIZE(lan743x_tx_queue_cnt_strings);
531562
return ret;
532563
}
533564
case ETH_SS_PRIV_FLAGS:

drivers/net/ethernet/microchip/lan743x_main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1776,6 +1776,7 @@ static netdev_tx_t lan743x_tx_xmit_frame(struct lan743x_tx *tx,
17761776
dev_kfree_skb_irq(skb);
17771777
goto unlock;
17781778
}
1779+
tx->frame_count++;
17791780

17801781
if (gso)
17811782
lan743x_tx_frame_add_lso(tx, frame_length, nr_frags);

drivers/net/ethernet/microchip/lan743x_main.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,7 @@ struct lan743x_tx {
715715
int last_tail;
716716

717717
struct napi_struct napi;
718+
u32 frame_count;
718719

719720
struct sk_buff *overflow_skb;
720721
};

0 commit comments

Comments
 (0)