Author: hselasky
Date: Wed May  8 10:31:32 2019
New Revision: 347254
URL: https://svnweb.freebsd.org/changeset/base/347254

Log:
  Update Ethernet extended counters in mlx5en(4).
  
  Expose all Ethernet extended counters those counters via debug_stats
  sysctl:
  dev.mce.X.debug_stats
  
  Submitted by: slavash@
  MFC after:    3 days
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_en/en.h
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  head/sys/dev/mlx5/mlx5_ifc.h

Modified: head/sys/dev/mlx5/mlx5_en/en.h
==============================================================================
--- head/sys/dev/mlx5/mlx5_en/en.h      Wed May  8 10:30:47 2019        
(r347253)
+++ head/sys/dev/mlx5/mlx5_en/en.h      Wed May  8 10:31:32 2019        
(r347254)
@@ -256,6 +256,28 @@ struct mlx5e_vport_stats {
   m(+1, u64 out_multicast_pkts, "out_multicast_pkts", "Out multicast packets") 
\
   m(+1, u64 out_broadcast_pkts, "out_broadcast_pkts", "Out broadcast packets")
 
+#define        MLX5E_PPORT_ETHERNET_EXTENDED_STATS_DEBUG(m)                    
        \
+  m(+1, u64 port_transmit_wait_high, "port_transmit_wait_high", "Port transmit 
wait high") \
+  m(+1, u64 ecn_marked, "ecn_marked", "ECN marked")                    \
+  m(+1, u64 no_buffer_discard_mc, "no_buffer_discard_mc", "No buffer discard 
mc") \
+  m(+1, u64 rx_ebp, "rx_ebp", "RX EBP")                                        
\
+  m(+1, u64 tx_ebp, "tx_ebp", "TX EBP")                                        
\
+  m(+1, u64 rx_buffer_almost_full, "rx_buffer_almost_full", "RX buffer almost 
full") \
+  m(+1, u64 rx_buffer_full, "rx_buffer_full", "RX buffer full")        \
+  m(+1, u64 rx_icrc_encapsulated, "rx_icrc_encapsulated", "RX ICRC 
encapsulated") \
+  m(+1, u64 ex_reserved_0, "ex_reserved_0", "Reserved") \
+  m(+1, u64 ex_reserved_1, "ex_reserved_1", "Reserved") \
+  m(+1, u64 tx_stat_p64octets, "tx_stat_p64octets", "Bytes")                   
\
+  m(+1, u64 tx_stat_p65to127octets, "tx_stat_p65to127octets", "Bytes")         
\
+  m(+1, u64 tx_stat_p128to255octets, "tx_stat_p128to255octets", "Bytes")       
\
+  m(+1, u64 tx_stat_p256to511octets, "tx_stat_p256to511octets", "Bytes")       
\
+  m(+1, u64 tx_stat_p512to1023octets, "tx_stat_p512to1023octets", "Bytes")     
\
+  m(+1, u64 tx_stat_p1024to1518octets, "tx_stat_p1024to1518octets", "Bytes")   
\
+  m(+1, u64 tx_stat_p1519to2047octets, "tx_stat_p1519to2047octets", "Bytes")   
\
+  m(+1, u64 tx_stat_p2048to4095octets, "tx_stat_p2048to4095octets", "Bytes")   
\
+  m(+1, u64 tx_stat_p4096to8191octets, "tx_stat_p4096to8191octets", "Bytes")   
\
+  m(+1, u64 tx_stat_p8192to10239octets, "tx_stat_p8192to10239octets", "Bytes")
+
 #define        MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG(m)                       
                        \
   m(+1, u64 time_since_last_clear, "time_since_last_clear",                    
        \
                        "Time since the last counters clear event (msec)")      
        \
@@ -350,7 +372,8 @@ struct mlx5e_vport_stats {
 #define        MLX5E_PORT_STATS_DEBUG(m)               \
   MLX5E_PPORT_RFC2819_STATS_DEBUG(m)           \
   MLX5E_PPORT_RFC2863_STATS_DEBUG(m)           \
-  MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG(m)
+  MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG(m)    \
+  MLX5E_PPORT_ETHERNET_EXTENDED_STATS_DEBUG(m)
 
 #define        MLX5E_PPORT_IEEE802_3_STATS_NUM \
   (0 MLX5E_PPORT_IEEE802_3_STATS(MLX5E_STATS_COUNT))
@@ -367,6 +390,8 @@ struct mlx5e_vport_stats {
   (0 MLX5E_PPORT_RFC2863_STATS_DEBUG(MLX5E_STATS_COUNT))
 #define        MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG_NUM \
   (0 MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG(MLX5E_STATS_COUNT))
+#define        MLX5E_PPORT_ETHERNET_EXTENDED_STATS_DEBUG_NUM \
+  (0 MLX5E_PPORT_ETHERNET_EXTENDED_STATS_DEBUG(MLX5E_STATS_COUNT))
 #define        MLX5E_PORT_STATS_DEBUG_NUM \
   (0 MLX5E_PORT_STATS_DEBUG(MLX5E_STATS_COUNT))
 

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c    Wed May  8 10:30:47 2019        
(r347253)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c    Wed May  8 10:31:32 2019        
(r347254)
@@ -440,6 +440,12 @@ mlx5e_update_pport_counters(struct mlx5e_priv *priv)
        for (x = 0; x != MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG_NUM; x++, y++)
                s_debug->arg[y] = be64toh(ptr[x]);
 
+       /* read Extended Ethernet counter group using predefined counter layout 
*/
+       MLX5_SET(ppcnt_reg, in, grp, MLX5_ETHERNET_EXTENDED_COUNTERS_GROUP);
+       mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPCNT, 0, 0);
+       for (x = 0; x != MLX5E_PPORT_ETHERNET_EXTENDED_STATS_DEBUG_NUM; x++, 
y++)
+               s_debug->arg[y] = be64toh(ptr[x]);
+
        /* read per-priority counters */
        MLX5_SET(ppcnt_reg, in, grp, MLX5_PER_PRIORITY_COUNTERS_GROUP);
 
@@ -453,6 +459,7 @@ mlx5e_update_pport_counters(struct mlx5e_priv *priv)
                    MLX5E_PPORT_PER_PRIO_STATS_NUM_PRIO); x++, y++)
                        s->arg[y] = be64toh(ptr[x]);
        }
+
 free_out:
        /* free firmware request structures */
        kvfree(in);

Modified: head/sys/dev/mlx5/mlx5_ifc.h
==============================================================================
--- head/sys/dev/mlx5/mlx5_ifc.h        Wed May  8 10:30:47 2019        
(r347253)
+++ head/sys/dev/mlx5/mlx5_ifc.h        Wed May  8 10:31:32 2019        
(r347254)
@@ -8752,7 +8752,69 @@ struct mlx5_ifc_eth_extended_cntrs_grp_data_layout_bit
 
        u8         no_buffer_discard_mc_low[0x20];
 
-       u8         reserved_0[0x700];
+       u8         rx_ebp_high[0x20];
+
+       u8         rx_ebp_low[0x20];
+
+       u8         tx_ebp_high[0x20];
+
+       u8         tx_ebp_low[0x20];
+
+        u8         rx_buffer_almost_full_high[0x20];
+
+        u8         rx_buffer_almost_full_low[0x20];
+
+        u8         rx_buffer_full_high[0x20];
+
+        u8         rx_buffer_full_low[0x20];
+
+        u8         rx_icrc_encapsulated_high[0x20];
+
+        u8         rx_icrc_encapsulated_low[0x20];
+
+       u8         reserved_0[0x80];
+
+        u8         tx_stats_pkts64octets_high[0x20];
+
+        u8         tx_stats_pkts64octets_low[0x20];
+
+        u8         tx_stats_pkts65to127octets_high[0x20];
+
+        u8         tx_stats_pkts65to127octets_low[0x20];
+
+        u8         tx_stats_pkts128to255octets_high[0x20];
+
+        u8         tx_stats_pkts128to255octets_low[0x20];
+
+        u8         tx_stats_pkts256to511octets_high[0x20];
+
+        u8         tx_stats_pkts256to511octets_low[0x20];
+
+        u8         tx_stats_pkts512to1023octets_high[0x20];
+
+        u8         tx_stats_pkts512to1023octets_low[0x20];
+
+        u8         tx_stats_pkts1024to1518octets_high[0x20];
+
+        u8         tx_stats_pkts1024to1518octets_low[0x20];
+
+        u8         tx_stats_pkts1519to2047octets_high[0x20];
+
+        u8         tx_stats_pkts1519to2047octets_low[0x20];
+
+        u8         tx_stats_pkts2048to4095octets_high[0x20];
+
+        u8         tx_stats_pkts2048to4095octets_low[0x20];
+
+        u8         tx_stats_pkts4096to8191octets_high[0x20];
+
+        u8         tx_stats_pkts4096to8191octets_low[0x20];
+
+        u8         tx_stats_pkts8192to10239octets_high[0x20];
+
+        u8         tx_stats_pkts8192to10239octets_low[0x20];
+
+       u8         reserved_1[0x2C0];
 };
 
 struct mlx5_ifc_eth_802_3_cntrs_grp_data_layout_bits {
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to