qed*: Add link change count value to ethtool statistics display.
authorSudarsana Reddy Kalluru <sudarsana.kalluru@cavium.com>
Tue, 29 May 2018 09:31:24 +0000 (02:31 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 31 May 2018 18:02:13 +0000 (14:02 -0400)
This patch adds driver changes for capturing the link change count in
ethtool statistics display.

Please consider applying this to "net-next".

Signed-off-by: Sudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com>
Signed-off-by: Ariel Elior <ariel.elior@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qlogic/qed/qed_l2.c
drivers/net/ethernet/qlogic/qede/qede.h
drivers/net/ethernet/qlogic/qede/qede_ethtool.c
drivers/net/ethernet/qlogic/qede/qede_main.c
include/linux/qed/qed_if.h

index 1c0d0c217936cc650d380b7c1b958bd45d6940a0..eed4725761f56fea1b346f4459bdb7df3c208069 100644 (file)
@@ -1854,6 +1854,11 @@ static void __qed_get_vport_port_stats(struct qed_hwfn *p_hwfn,
                p_ah->tx_1519_to_max_byte_packets =
                    port_stats.eth.u1.ah1.t1519_to_max;
        }
+
+       p_common->link_change_count = qed_rd(p_hwfn, p_ptt,
+                                            p_hwfn->mcp_info->port_addr +
+                                            offsetof(struct public_port,
+                                                     link_change_count));
 }
 
 static void __qed_get_vport_stats(struct qed_hwfn *p_hwfn,
@@ -1961,11 +1966,14 @@ void qed_reset_vport_stats(struct qed_dev *cdev)
 
        /* PORT statistics are not necessarily reset, so we need to
         * read and create a baseline for future statistics.
+        * Link change stat is maintained by MFW, return its value as is.
         */
-       if (!cdev->reset_stats)
+       if (!cdev->reset_stats) {
                DP_INFO(cdev, "Reset stats not allocated\n");
-       else
+       } else {
                _qed_get_vport_stats(cdev, cdev->reset_stats);
+               cdev->reset_stats->common.link_change_count = 0;
+       }
 }
 
 static enum gft_profile_type
index 81c5c8dfa2ef939cb258bfc2b887264e19a52110..d7ed0d3dbf71706b88a195256648a06856db47a1 100644 (file)
@@ -88,6 +88,7 @@ struct qede_stats_common {
        u64 coalesced_aborts_num;
        u64 non_coalesced_pkts;
        u64 coalesced_bytes;
+       u64 link_change_count;
 
        /* port */
        u64 rx_64_byte_packets;
index 6906e04b609eb22ce1a7b14ec750c05a8dc2d5c5..f4a0f8ff826108436a3ddb973c7e424c1cd71e4e 100644 (file)
@@ -171,6 +171,8 @@ static const struct {
        QEDE_STAT(coalesced_aborts_num),
        QEDE_STAT(non_coalesced_pkts),
        QEDE_STAT(coalesced_bytes),
+
+       QEDE_STAT(link_change_count),
 };
 
 #define QEDE_NUM_STATS ARRAY_SIZE(qede_stats_arr)
index d118771e1a7b3e0f5ab69c04d8fb8be743814ec6..6a796040a32c47071e7bb677f24436ab930e7ed9 100644 (file)
@@ -399,6 +399,7 @@ void qede_fill_by_demand_stats(struct qede_dev *edev)
        p_common->brb_truncates = stats.common.brb_truncates;
        p_common->brb_discards = stats.common.brb_discards;
        p_common->tx_mac_ctrl_frames = stats.common.tx_mac_ctrl_frames;
+       p_common->link_change_count = stats.common.link_change_count;
 
        if (QEDE_IS_BB(edev)) {
                struct qede_stats_bb *p_bb = &edev->stats.bb;
index ac991a3b8f03b402efec5950b6483b3e66de450a..b4040023cbfba2a637b4e2ba4ee147558fe82a9c 100644 (file)
@@ -1180,6 +1180,7 @@ struct qed_eth_stats_common {
        u64     tx_mac_mc_packets;
        u64     tx_mac_bc_packets;
        u64     tx_mac_ctrl_frames;
+       u64     link_change_count;
 };
 
 struct qed_eth_stats_bb {