Skip to contentSkip to conversation

mlx5: fix warnings

PATCH In review Stephen Hemminger 4 participants 6 messages Apr 21, 2017 – Apr 22, 2017 2 messages not in the archive

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover mlx5: fix warnings

While looking for sparse and warning output in another driver, I saw several trivial warnings from MLX5 driver. This patch series fixes them.

Stephen Hemminger (3):
mlx5: hide unused functions
mlx5: fix warning about missing prototype
mlx5: fix space waste from ethtool descriptions

 .../net/ethernet/mellanox/mlx5/core/en_ethtool.c   | 208 +++++++++++++++++++++
 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c    |   1 +
 drivers/net/ethernet/mellanox/mlx5/core/en_stats.h | 206 +-------------------
 drivers/net/ethernet/mellanox/mlx5/core/en_tx.c    |   1 +
 drivers/net/ethernet/mellanox/mlx5/core/ipoib.c    |  24 +--
 5 files changed, 224 insertions(+), 216 deletions(-)
Signature · 6 lines
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw

PATCH 1/3 mlx5: hide unused functions

Fix sparse warnings in recent ipoib support.
The RDMA functions are not used yet, hide behind #ifdef. Based on comment, they will eventually be local so make static.

---
 drivers/net/ethernet/mellanox/mlx5/core/ipoib.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/ipoib.c +13 -11
index ec78e637840f..3c84e36af018 100644
@@ -178,7 +178,7 @@ static int mlx5i_init_tx(struct mlx5e_priv *priv)
 	return 0;
 }
 
-void mlx5i_cleanup_tx(struct mlx5e_priv *priv)
+static void mlx5i_cleanup_tx(struct mlx5e_priv *priv)
 {
 	struct mlx5i_priv *ipriv = priv->ppriv;
 
@@ -359,9 +359,10 @@ static int mlx5i_close(struct net_device *netdev)
 	return 0;
 }
 
+#ifdef notusedyet
 /* IPoIB RDMA netdev callbacks */
-int mlx5i_attach_mcast(struct net_device *netdev, struct ib_device *hca,
-		       union ib_gid *gid, u16 lid, int set_qkey)
+static int mlx5i_attach_mcast(struct net_device *netdev, struct ib_device *hca,
+			      union ib_gid *gid, u16 lid, int set_qkey)
 {
 	struct mlx5e_priv    *epriv = mlx5i_epriv(netdev);
 	struct mlx5_core_dev *mdev  = epriv->mdev;
@@ -377,8 +378,8 @@ int mlx5i_attach_mcast(struct net_device *netdev, struct ib_device *hca,
 	return err;
 }
 
-int mlx5i_detach_mcast(struct net_device *netdev, struct ib_device *hca,
-		       union ib_gid *gid, u16 lid)
+static int mlx5i_detach_mcast(struct net_device *netdev, struct ib_device *hca,
+			      union ib_gid *gid, u16 lid)
 {
 	struct mlx5e_priv    *epriv = mlx5i_epriv(netdev);
 	struct mlx5_core_dev *mdev  = epriv->mdev;
@@ -395,7 +396,7 @@ int mlx5i_detach_mcast(struct net_device *netdev, struct ib_device *hca,
 	return err;
 }
 
-int mlx5i_xmit(struct net_device *dev, struct sk_buff *skb,
+static int mlx5i_xmit(struct net_device *dev, struct sk_buff *skb,
 	       struct ib_ah *address, u32 dqpn, u32 dqkey)
 {
 	struct mlx5e_priv *epriv = mlx5i_epriv(dev);
@@ -404,6 +405,7 @@ int mlx5i_xmit(struct net_device *dev, struct sk_buff *skb,
 
 	return mlx5i_sq_xmit(sq, skb, &mah->av, dqpn, dqkey);
 }
+#endif
 
 static int mlx5i_check_required_hca_cap(struct mlx5_core_dev *mdev)
 {
@@ -418,10 +420,10 @@ static int mlx5i_check_required_hca_cap(struct mlx5_core_dev *mdev)
 	return 0;
 }
 
-struct net_device *mlx5_rdma_netdev_alloc(struct mlx5_core_dev *mdev,
-					  struct ib_device *ibdev,
-					  const char *name,
-					  void (*setup)(struct net_device *))
+static struct net_device *mlx5_rdma_netdev_alloc(struct mlx5_core_dev *mdev,
+						 struct ib_device *ibdev,
+						 const char *name,
+						 void (*setup)(struct net_device *))
 {
 	const struct mlx5e_profile *profile = &mlx5i_nic_profile;
 	int nch = profile->max_nch(mdev);
@@ -480,7 +482,7 @@ struct net_device *mlx5_rdma_netdev_alloc(struct mlx5_core_dev *mdev,
 }
 EXPORT_SYMBOL(mlx5_rdma_netdev_alloc);
 
-void mlx5_rdma_netdev_free(struct net_device *netdev)
+static void mlx5_rdma_netdev_free(struct net_device *netdev)
 {
 	struct mlx5e_priv          *priv    = mlx5i_epriv(netdev);
 	const struct mlx5e_profile *profile = priv->profile;
Signature · 1 line
2.11.0
#2 lore raw

PATCH 2/3 mlx5: fix warning about missing prototype

In reply to Stephen Hemminger

Fix sparse warning about missing prototypes. The rx/tx code path defines functions with prototypes in ipoib.h.

---
 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 1 +
 drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 1 +
 2 files changed, 2 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +1 -0
index 43308243f519..ae66fad98244 100644
@@ -39,6 +39,7 @@
 #include "en.h"
 #include "en_tc.h"
 #include "eswitch.h"
+#include "ipoib.h"
 
 static inline bool mlx5e_rx_hw_stamp(struct mlx5e_tstamp *tstamp)
 {
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +1 -0
index dda7db503043..ab3bb026ff9e 100644
@@ -33,6 +33,7 @@
 #include <linux/tcp.h>
 #include <linux/if_vlan.h>
 #include "en.h"
+#include "ipoib.h"
 
 #define MLX5E_SQ_NOPS_ROOM  MLX5_SEND_WQE_MAX_WQEBBS
 #define MLX5E_SQ_STOP_ROOM (MLX5_SEND_WQE_MAX_WQEBBS +\
Signature · 1 line
2.11.0

A message that is not in the archive (sent off-list or not yet received): 20170421181558.5414-1-sthemmin-0li6OtcxBFHby3iVrkZq2A@public.gmane.org

#4 lore raw

PATCH 3/3 mlx5: fix space waste from ethtool descriptions

The ethtool statistics descriptions were declared as static in en_stats.h but that file is included indirectly in multiple places causing multiple unused redundant copies. This is reported by building with W=1.

The solution is to move the description out of en_stats.h into the one file that uses them en_ethtool.c

---
 .../net/ethernet/mellanox/mlx5/core/en_ethtool.c   | 208 +++++++++++++++++++++
 drivers/net/ethernet/mellanox/mlx5/core/en_stats.h | 206 +-------------------
 2 files changed, 209 insertions(+), 205 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +208 -0
index ce7b09d72ff6..b1d9518b2719 100644
@@ -31,6 +31,214 @@
  */
 
 #include "en.h"
+#include "en_stats.h"
+
+
+static const struct counter_desc sw_stats_desc[] = {
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_packets) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_bytes) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_packets) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_bytes) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tso_packets) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tso_bytes) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tso_inner_packets) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tso_inner_bytes) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_lro_packets) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_lro_bytes) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_unnecessary) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_none) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_complete) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_unnecessary_inner) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xdp_drop) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xdp_tx) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xdp_tx_full) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_csum_partial) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_csum_partial_inner) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_queue_stopped) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_queue_wake) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_queue_dropped) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_xmit_more) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_wqe_err) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_mpwqe_filler) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_buff_alloc_err) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cqe_compress_blks) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cqe_compress_pkts) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cache_reuse) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cache_full) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cache_empty) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cache_busy) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, link_down_events_phy) },
+};
+
+static const struct counter_desc q_stats_desc[] = {
+	{ MLX5E_DECLARE_STAT(struct mlx5e_qcounter_stats, rx_out_of_buffer) },
+};
+
+static const struct counter_desc vport_stats_desc[] = {
+	{ "rx_vport_unicast_packets",
+		VPORT_COUNTER_OFF(received_eth_unicast.packets) },
+	{ "rx_vport_unicast_bytes",
+		VPORT_COUNTER_OFF(received_eth_unicast.octets) },
+	{ "tx_vport_unicast_packets",
+		VPORT_COUNTER_OFF(transmitted_eth_unicast.packets) },
+	{ "tx_vport_unicast_bytes",
+		VPORT_COUNTER_OFF(transmitted_eth_unicast.octets) },
+	{ "rx_vport_multicast_packets",
+		VPORT_COUNTER_OFF(received_eth_multicast.packets) },
+	{ "rx_vport_multicast_bytes",
+		VPORT_COUNTER_OFF(received_eth_multicast.octets) },
+	{ "tx_vport_multicast_packets",
+		VPORT_COUNTER_OFF(transmitted_eth_multicast.packets) },
+	{ "tx_vport_multicast_bytes",
+		VPORT_COUNTER_OFF(transmitted_eth_multicast.octets) },
+	{ "rx_vport_broadcast_packets",
+		VPORT_COUNTER_OFF(received_eth_broadcast.packets) },
+	{ "rx_vport_broadcast_bytes",
+		VPORT_COUNTER_OFF(received_eth_broadcast.octets) },
+	{ "tx_vport_broadcast_packets",
+		VPORT_COUNTER_OFF(transmitted_eth_broadcast.packets) },
+	{ "tx_vport_broadcast_bytes",
+		VPORT_COUNTER_OFF(transmitted_eth_broadcast.octets) },
+	{ "rx_vport_rdma_unicast_packets",
+		VPORT_COUNTER_OFF(received_ib_unicast.packets) },
+	{ "rx_vport_rdma_unicast_bytes",
+		VPORT_COUNTER_OFF(received_ib_unicast.octets) },
+	{ "tx_vport_rdma_unicast_packets",
+		VPORT_COUNTER_OFF(transmitted_ib_unicast.packets) },
+	{ "tx_vport_rdma_unicast_bytes",
+		VPORT_COUNTER_OFF(transmitted_ib_unicast.octets) },
+	{ "rx_vport_rdma_multicast_packets",
+		VPORT_COUNTER_OFF(received_ib_multicast.packets) },
+	{ "rx_vport_rdma_multicast_bytes",
+		VPORT_COUNTER_OFF(received_ib_multicast.octets) },
+	{ "tx_vport_rdma_multicast_packets",
+		VPORT_COUNTER_OFF(transmitted_ib_multicast.packets) },
+	{ "tx_vport_rdma_multicast_bytes",
+		VPORT_COUNTER_OFF(transmitted_ib_multicast.octets) },
+};
+static const struct counter_desc pport_802_3_stats_desc[] = {
+	{ "tx_packets_phy", PPORT_802_3_OFF(a_frames_transmitted_ok) },
+	{ "rx_packets_phy", PPORT_802_3_OFF(a_frames_received_ok) },
+	{ "rx_crc_errors_phy", PPORT_802_3_OFF(a_frame_check_sequence_errors) },
+	{ "tx_bytes_phy", PPORT_802_3_OFF(a_octets_transmitted_ok) },
+	{ "rx_bytes_phy", PPORT_802_3_OFF(a_octets_received_ok) },
+	{ "tx_multicast_phy", PPORT_802_3_OFF(a_multicast_frames_xmitted_ok) },
+	{ "tx_broadcast_phy", PPORT_802_3_OFF(a_broadcast_frames_xmitted_ok) },
+	{ "rx_multicast_phy", PPORT_802_3_OFF(a_multicast_frames_received_ok) },
+	{ "rx_broadcast_phy", PPORT_802_3_OFF(a_broadcast_frames_received_ok) },
+	{ "rx_in_range_len_errors_phy", PPORT_802_3_OFF(a_in_range_length_errors) },
+	{ "rx_out_of_range_len_phy", PPORT_802_3_OFF(a_out_of_range_length_field) },
+	{ "rx_oversize_pkts_phy", PPORT_802_3_OFF(a_frame_too_long_errors) },
+	{ "rx_symbol_err_phy", PPORT_802_3_OFF(a_symbol_error_during_carrier) },
+	{ "tx_mac_control_phy", PPORT_802_3_OFF(a_mac_control_frames_transmitted) },
+	{ "rx_mac_control_phy", PPORT_802_3_OFF(a_mac_control_frames_received) },
+	{ "rx_unsupported_op_phy", PPORT_802_3_OFF(a_unsupported_opcodes_received) },
+	{ "rx_pause_ctrl_phy", PPORT_802_3_OFF(a_pause_mac_ctrl_frames_received) },
+	{ "tx_pause_ctrl_phy", PPORT_802_3_OFF(a_pause_mac_ctrl_frames_transmitted) },
+};
+
+static const struct counter_desc pport_2863_stats_desc[] = {
+	{ "rx_discards_phy", PPORT_2863_OFF(if_in_discards) },
+	{ "tx_discards_phy", PPORT_2863_OFF(if_out_discards) },
+	{ "tx_errors_phy", PPORT_2863_OFF(if_out_errors) },
+};
+
+static const struct counter_desc pport_2819_stats_desc[] = {
+	{ "rx_undersize_pkts_phy", PPORT_2819_OFF(ether_stats_undersize_pkts) },
+	{ "rx_fragments_phy", PPORT_2819_OFF(ether_stats_fragments) },
+	{ "rx_jabbers_phy", PPORT_2819_OFF(ether_stats_jabbers) },
+	{ "rx_64_bytes_phy", PPORT_2819_OFF(ether_stats_pkts64octets) },
+	{ "rx_65_to_127_bytes_phy", PPORT_2819_OFF(ether_stats_pkts65to127octets) },
+	{ "rx_128_to_255_bytes_phy", PPORT_2819_OFF(ether_stats_pkts128to255octets) },
+	{ "rx_256_to_511_bytes_phy", PPORT_2819_OFF(ether_stats_pkts256to511octets) },
+	{ "rx_512_to_1023_bytes_phy", PPORT_2819_OFF(ether_stats_pkts512to1023octets) },
+	{ "rx_1024_to_1518_bytes_phy", PPORT_2819_OFF(ether_stats_pkts1024to1518octets) },
+	{ "rx_1519_to_2047_bytes_phy", PPORT_2819_OFF(ether_stats_pkts1519to2047octets) },
+	{ "rx_2048_to_4095_bytes_phy", PPORT_2819_OFF(ether_stats_pkts2048to4095octets) },
+	{ "rx_4096_to_8191_bytes_phy", PPORT_2819_OFF(ether_stats_pkts4096to8191octets) },
+	{ "rx_8192_to_10239_bytes_phy", PPORT_2819_OFF(ether_stats_pkts8192to10239octets) },
+};
+
+static const struct counter_desc pport_phy_statistical_stats_desc[] = {
+	{ "rx_symbol_errors_phy", PPORT_PHY_STATISTICAL_OFF(phy_symbol_errors) },
+	{ "rx_corrected_bits_phy", PPORT_PHY_STATISTICAL_OFF(phy_corrected_bits) },
+};
+
+static const struct counter_desc pport_per_prio_traffic_stats_desc[] = {
+	{ "rx_prio%d_bytes", PPORT_PER_PRIO_OFF(rx_octets) },
+	{ "rx_prio%d_packets", PPORT_PER_PRIO_OFF(rx_frames) },
+	{ "tx_prio%d_bytes", PPORT_PER_PRIO_OFF(tx_octets) },
+	{ "tx_prio%d_packets", PPORT_PER_PRIO_OFF(tx_frames) },
+};
+
+static const struct counter_desc pport_per_prio_pfc_stats_desc[] = {
+	/* %s is "global" or "prio{i}" */
+	{ "rx_%s_pause", PPORT_PER_PRIO_OFF(rx_pause) },
+	{ "rx_%s_pause_duration", PPORT_PER_PRIO_OFF(rx_pause_duration) },
+	{ "tx_%s_pause", PPORT_PER_PRIO_OFF(tx_pause) },
+	{ "tx_%s_pause_duration", PPORT_PER_PRIO_OFF(tx_pause_duration) },
+	{ "rx_%s_pause_transition", PPORT_PER_PRIO_OFF(rx_pause_transition) },
+};
+
+static const struct counter_desc pcie_perf_stats_desc[] = {
+	{ "rx_pci_signal_integrity", PCIE_PERF_OFF(rx_errors) },
+	{ "tx_pci_signal_integrity", PCIE_PERF_OFF(tx_errors) },
+};
+
+static const struct counter_desc rq_stats_desc[] = {
+	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, packets) },
+	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, bytes) },
+	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_complete) },
+	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_unnecessary_inner) },
+	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_none) },
+	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, xdp_drop) },
+	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, xdp_tx) },
+	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, xdp_tx_full) },
+	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, lro_packets) },
+	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, lro_bytes) },
+	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, wqe_err) },
+	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, mpwqe_filler) },
+	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, buff_alloc_err) },
+	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cqe_compress_blks) },
+	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cqe_compress_pkts) },
+	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cache_reuse) },
+	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cache_full) },
+	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cache_empty) },
+	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cache_busy) },
+};
+
+static const struct counter_desc sq_stats_desc[] = {
+	{ MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, packets) },
+	{ MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, bytes) },
+	{ MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tso_packets) },
+	{ MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tso_bytes) },
+	{ MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tso_inner_packets) },
+	{ MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tso_inner_bytes) },
+	{ MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, csum_partial_inner) },
+	{ MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, nop) },
+	{ MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, csum_none) },
+	{ MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, stopped) },
+	{ MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, wake) },
+	{ MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, dropped) },
+	{ MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, xmit_more) },
+};
+
+static const struct counter_desc mlx5e_pme_status_desc[] = {
+	{ "module_plug", 0 },
+	{ "module_unplug", 8 },
+};
+
+static const struct counter_desc mlx5e_pme_error_desc[] = {
+	{ "module_pwr_budget_exd", 0 },  /* power budget exceed */
+	{ "module_long_range", 8 },      /* long range for non MLNX cable */
+	{ "module_bus_stuck", 16 },      /* bus stuck (I2C or data shorted) */
+	{ "module_no_eeprom", 24 },      /* no eeprom/retry time out */
+	{ "module_enforce_part", 32 },   /* enforce part number list */
+	{ "module_unknown_id", 40 },     /* unknown identifier */
+	{ "module_high_temp", 48 },      /* high temperature */
+	{ "module_bad_shorted", 56 },    /* bad or shorted cable/module */
+	{ "module_unknown_status", 64 },
+};
 
 static void mlx5e_get_drvinfo(struct net_device *dev,
 			      struct ethtool_drvinfo *drvinfo)
drivers/net/ethernet/mellanox/mlx5/core/en_stats.h +1 -205

256 lines not on this page · raw message

Signature · 6 lines
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20170421181558.5414-4-sthemmin-0li6OtcxBFHby3iVrkZq2A@public.gmane.org

#6 lore raw

Re: [PATCH net-next 3/3] mlx5: fix space waste from ethtool descriptions

Quoted 7 lines · Stephen Hemminger

The ethtool statistics descriptions were declared as static in en_stats.h but that file is included indirectly in multiple places causing multiple unused redundant copies. This is reported by building with W=1.

The solution is to move the description out of en_stats.h into the one file that uses them en_ethtool.c

Hi Stephen,

Thanks for the patches,

I really like patches #1 and #2, But i would like to keep this patch out of this series for now.
I have some guys working now on adding and refactoring the stats reporting mechanism in mlx5e and I also would like to keep the stats descriptions outside of en_ethtool.c logic.

I totally agree with you and I will keep the wasted space issue in mind and will ask the guys to fix it in their patches.

Deal ?

Thanks
Saeed.

Quoted 497 lines
---
 .../net/ethernet/mellanox/mlx5/core/en_ethtool.c   | 208 +++++++++++++++++++++
 drivers/net/ethernet/mellanox/mlx5/core/en_stats.h | 206 +-------------------
 2 files changed, 209 insertions(+), 205 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +208 -0
index ce7b09d72ff6..b1d9518b2719 100644
@@ -31,6 +31,214 @@
  */
 
 #include "en.h"
+#include "en_stats.h"
+
+
+static const struct counter_desc sw_stats_desc[] = {
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_packets) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_bytes) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_packets) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_bytes) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tso_packets) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tso_bytes) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tso_inner_packets) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tso_inner_bytes) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_lro_packets) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_lro_bytes) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_unnecessary) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_none) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_complete) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_unnecessary_inner) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xdp_drop) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xdp_tx) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xdp_tx_full) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_csum_partial) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_csum_partial_inner) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_queue_stopped) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_queue_wake) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_queue_dropped) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_xmit_more) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_wqe_err) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_mpwqe_filler) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_buff_alloc_err) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cqe_compress_blks) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cqe_compress_pkts) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cache_reuse) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cache_full) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cache_empty) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cache_busy) },
+       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, link_down_events_phy) },
+};
+
+static const struct counter_desc q_stats_desc[] = {
+       { MLX5E_DECLARE_STAT(struct mlx5e_qcounter_stats, rx_out_of_buffer) },
+};
+
+static const struct counter_desc vport_stats_desc[] = {
+       { "rx_vport_unicast_packets",
+               VPORT_COUNTER_OFF(received_eth_unicast.packets) },
+       { "rx_vport_unicast_bytes",
+               VPORT_COUNTER_OFF(received_eth_unicast.octets) },
+       { "tx_vport_unicast_packets",
+               VPORT_COUNTER_OFF(transmitted_eth_unicast.packets) },
+       { "tx_vport_unicast_bytes",
+               VPORT_COUNTER_OFF(transmitted_eth_unicast.octets) },
+       { "rx_vport_multicast_packets",
+               VPORT_COUNTER_OFF(received_eth_multicast.packets) },
+       { "rx_vport_multicast_bytes",
+               VPORT_COUNTER_OFF(received_eth_multicast.octets) },
+       { "tx_vport_multicast_packets",
+               VPORT_COUNTER_OFF(transmitted_eth_multicast.packets) },
+       { "tx_vport_multicast_bytes",
+               VPORT_COUNTER_OFF(transmitted_eth_multicast.octets) },
+       { "rx_vport_broadcast_packets",
+               VPORT_COUNTER_OFF(received_eth_broadcast.packets) },
+       { "rx_vport_broadcast_bytes",
+               VPORT_COUNTER_OFF(received_eth_broadcast.octets) },
+       { "tx_vport_broadcast_packets",
+               VPORT_COUNTER_OFF(transmitted_eth_broadcast.packets) },
+       { "tx_vport_broadcast_bytes",
+               VPORT_COUNTER_OFF(transmitted_eth_broadcast.octets) },
+       { "rx_vport_rdma_unicast_packets",
+               VPORT_COUNTER_OFF(received_ib_unicast.packets) },
+       { "rx_vport_rdma_unicast_bytes",
+               VPORT_COUNTER_OFF(received_ib_unicast.octets) },
+       { "tx_vport_rdma_unicast_packets",
+               VPORT_COUNTER_OFF(transmitted_ib_unicast.packets) },
+       { "tx_vport_rdma_unicast_bytes",
+               VPORT_COUNTER_OFF(transmitted_ib_unicast.octets) },
+       { "rx_vport_rdma_multicast_packets",
+               VPORT_COUNTER_OFF(received_ib_multicast.packets) },
+       { "rx_vport_rdma_multicast_bytes",
+               VPORT_COUNTER_OFF(received_ib_multicast.octets) },
+       { "tx_vport_rdma_multicast_packets",
+               VPORT_COUNTER_OFF(transmitted_ib_multicast.packets) },
+       { "tx_vport_rdma_multicast_bytes",
+               VPORT_COUNTER_OFF(transmitted_ib_multicast.octets) },
+};
+static const struct counter_desc pport_802_3_stats_desc[] = {
+       { "tx_packets_phy", PPORT_802_3_OFF(a_frames_transmitted_ok) },
+       { "rx_packets_phy", PPORT_802_3_OFF(a_frames_received_ok) },
+       { "rx_crc_errors_phy", PPORT_802_3_OFF(a_frame_check_sequence_errors) },
+       { "tx_bytes_phy", PPORT_802_3_OFF(a_octets_transmitted_ok) },
+       { "rx_bytes_phy", PPORT_802_3_OFF(a_octets_received_ok) },
+       { "tx_multicast_phy", PPORT_802_3_OFF(a_multicast_frames_xmitted_ok) },
+       { "tx_broadcast_phy", PPORT_802_3_OFF(a_broadcast_frames_xmitted_ok) },
+       { "rx_multicast_phy", PPORT_802_3_OFF(a_multicast_frames_received_ok) },
+       { "rx_broadcast_phy", PPORT_802_3_OFF(a_broadcast_frames_received_ok) },
+       { "rx_in_range_len_errors_phy", PPORT_802_3_OFF(a_in_range_length_errors) },
+       { "rx_out_of_range_len_phy", PPORT_802_3_OFF(a_out_of_range_length_field) },
+       { "rx_oversize_pkts_phy", PPORT_802_3_OFF(a_frame_too_long_errors) },
+       { "rx_symbol_err_phy", PPORT_802_3_OFF(a_symbol_error_during_carrier) },
+       { "tx_mac_control_phy", PPORT_802_3_OFF(a_mac_control_frames_transmitted) },
+       { "rx_mac_control_phy", PPORT_802_3_OFF(a_mac_control_frames_received) },
+       { "rx_unsupported_op_phy", PPORT_802_3_OFF(a_unsupported_opcodes_received) },
+       { "rx_pause_ctrl_phy", PPORT_802_3_OFF(a_pause_mac_ctrl_frames_received) },
+       { "tx_pause_ctrl_phy", PPORT_802_3_OFF(a_pause_mac_ctrl_frames_transmitted) },
+};
+
+static const struct counter_desc pport_2863_stats_desc[] = {
+       { "rx_discards_phy", PPORT_2863_OFF(if_in_discards) },
+       { "tx_discards_phy", PPORT_2863_OFF(if_out_discards) },
+       { "tx_errors_phy", PPORT_2863_OFF(if_out_errors) },
+};
+
+static const struct counter_desc pport_2819_stats_desc[] = {
+       { "rx_undersize_pkts_phy", PPORT_2819_OFF(ether_stats_undersize_pkts) },
+       { "rx_fragments_phy", PPORT_2819_OFF(ether_stats_fragments) },
+       { "rx_jabbers_phy", PPORT_2819_OFF(ether_stats_jabbers) },
+       { "rx_64_bytes_phy", PPORT_2819_OFF(ether_stats_pkts64octets) },
+       { "rx_65_to_127_bytes_phy", PPORT_2819_OFF(ether_stats_pkts65to127octets) },
+       { "rx_128_to_255_bytes_phy", PPORT_2819_OFF(ether_stats_pkts128to255octets) },
+       { "rx_256_to_511_bytes_phy", PPORT_2819_OFF(ether_stats_pkts256to511octets) },
+       { "rx_512_to_1023_bytes_phy", PPORT_2819_OFF(ether_stats_pkts512to1023octets) },
+       { "rx_1024_to_1518_bytes_phy", PPORT_2819_OFF(ether_stats_pkts1024to1518octets) },
+       { "rx_1519_to_2047_bytes_phy", PPORT_2819_OFF(ether_stats_pkts1519to2047octets) },
+       { "rx_2048_to_4095_bytes_phy", PPORT_2819_OFF(ether_stats_pkts2048to4095octets) },
+       { "rx_4096_to_8191_bytes_phy", PPORT_2819_OFF(ether_stats_pkts4096to8191octets) },
+       { "rx_8192_to_10239_bytes_phy", PPORT_2819_OFF(ether_stats_pkts8192to10239octets) },
+};
+
+static const struct counter_desc pport_phy_statistical_stats_desc[] = {
+       { "rx_symbol_errors_phy", PPORT_PHY_STATISTICAL_OFF(phy_symbol_errors) },
+       { "rx_corrected_bits_phy", PPORT_PHY_STATISTICAL_OFF(phy_corrected_bits) },
+};
+
+static const struct counter_desc pport_per_prio_traffic_stats_desc[] = {
+       { "rx_prio%d_bytes", PPORT_PER_PRIO_OFF(rx_octets) },
+       { "rx_prio%d_packets", PPORT_PER_PRIO_OFF(rx_frames) },
+       { "tx_prio%d_bytes", PPORT_PER_PRIO_OFF(tx_octets) },
+       { "tx_prio%d_packets", PPORT_PER_PRIO_OFF(tx_frames) },
+};
+
+static const struct counter_desc pport_per_prio_pfc_stats_desc[] = {
+       /* %s is "global" or "prio{i}" */
+       { "rx_%s_pause", PPORT_PER_PRIO_OFF(rx_pause) },
+       { "rx_%s_pause_duration", PPORT_PER_PRIO_OFF(rx_pause_duration) },
+       { "tx_%s_pause", PPORT_PER_PRIO_OFF(tx_pause) },
+       { "tx_%s_pause_duration", PPORT_PER_PRIO_OFF(tx_pause_duration) },
+       { "rx_%s_pause_transition", PPORT_PER_PRIO_OFF(rx_pause_transition) },
+};
+
+static const struct counter_desc pcie_perf_stats_desc[] = {
+       { "rx_pci_signal_integrity", PCIE_PERF_OFF(rx_errors) },
+       { "tx_pci_signal_integrity", PCIE_PERF_OFF(tx_errors) },
+};
+
+static const struct counter_desc rq_stats_desc[] = {
+       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, packets) },
+       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, bytes) },
+       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_complete) },
+       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_unnecessary_inner) },
+       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_none) },
+       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, xdp_drop) },
+       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, xdp_tx) },
+       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, xdp_tx_full) },
+       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, lro_packets) },
+       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, lro_bytes) },
+       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, wqe_err) },
+       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, mpwqe_filler) },
+       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, buff_alloc_err) },
+       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cqe_compress_blks) },
+       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cqe_compress_pkts) },
+       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cache_reuse) },
+       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cache_full) },
+       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cache_empty) },
+       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cache_busy) },
+};
+
+static const struct counter_desc sq_stats_desc[] = {
+       { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, packets) },
+       { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, bytes) },
+       { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tso_packets) },
+       { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tso_bytes) },
+       { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tso_inner_packets) },
+       { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tso_inner_bytes) },
+       { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, csum_partial_inner) },
+       { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, nop) },
+       { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, csum_none) },
+       { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, stopped) },
+       { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, wake) },
+       { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, dropped) },
+       { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, xmit_more) },
+};
+
+static const struct counter_desc mlx5e_pme_status_desc[] = {
+       { "module_plug", 0 },
+       { "module_unplug", 8 },
+};
+
+static const struct counter_desc mlx5e_pme_error_desc[] = {
+       { "module_pwr_budget_exd", 0 },  /* power budget exceed */
+       { "module_long_range", 8 },      /* long range for non MLNX cable */
+       { "module_bus_stuck", 16 },      /* bus stuck (I2C or data shorted) */
+       { "module_no_eeprom", 24 },      /* no eeprom/retry time out */
+       { "module_enforce_part", 32 },   /* enforce part number list */
+       { "module_unknown_id", 40 },     /* unknown identifier */
+       { "module_high_temp", 48 },      /* high temperature */
+       { "module_bad_shorted", 56 },    /* bad or shorted cable/module */
+       { "module_unknown_status", 64 },
+};
 
 static void mlx5e_get_drvinfo(struct net_device *dev,
                              struct ethtool_drvinfo *drvinfo)
drivers/net/ethernet/mellanox/mlx5/core/en_stats.h +1 -206
index 53e4992d6511..1c867ee973f2 100644
@@ -47,7 +47,7 @@
 
 struct counter_desc {
        char            format[ETH_GSTRING_LEN];
-       int             offset; /* Byte offset */
+       size_t          offset; /* Byte offset */
 };
 
 struct mlx5e_sw_stats {
@@ -88,49 +88,10 @@ struct mlx5e_sw_stats {
        u64 link_down_events_phy;
 };
 
-static const struct counter_desc sw_stats_desc[] = {
-       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_packets) },
-       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_bytes) },
-       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_packets) },
-       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_bytes) },
-       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tso_packets) },
-       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tso_bytes) },
-       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tso_inner_packets) },
-       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tso_inner_bytes) },
-       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_lro_packets) },
-       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_lro_bytes) },
-       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_unnecessary) },
-       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_none) },
-       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_complete) },
-       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_unnecessary_inner) },
-       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xdp_drop) },
-       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xdp_tx) },
-       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xdp_tx_full) },
-       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_csum_partial) },
-       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_csum_partial_inner) },
-       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_queue_stopped) },
-       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_queue_wake) },
-       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_queue_dropped) },
-       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_xmit_more) },
-       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_wqe_err) },
-       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_mpwqe_filler) },
-       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_buff_alloc_err) },
-       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cqe_compress_blks) },
-       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cqe_compress_pkts) },
-       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cache_reuse) },
-       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cache_full) },
-       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cache_empty) },
-       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cache_busy) },
-       { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, link_down_events_phy) },
-};
-
 struct mlx5e_qcounter_stats {
        u32 rx_out_of_buffer;
 };
 
-static const struct counter_desc q_stats_desc[] = {
-       { MLX5E_DECLARE_STAT(struct mlx5e_qcounter_stats, rx_out_of_buffer) },
-};
 
 #define VPORT_COUNTER_OFF(c) MLX5_BYTE_OFF(query_vport_counter_out, c)
 #define VPORT_COUNTER_GET(vstats, c) MLX5_GET64(query_vport_counter_out, \
@@ -140,48 +101,6 @@ struct mlx5e_vport_stats {
        __be64 query_vport_out[MLX5_ST_SZ_QW(query_vport_counter_out)];
 };
 
-static const struct counter_desc vport_stats_desc[] = {
-       { "rx_vport_unicast_packets",
-               VPORT_COUNTER_OFF(received_eth_unicast.packets) },
-       { "rx_vport_unicast_bytes",
-               VPORT_COUNTER_OFF(received_eth_unicast.octets) },
-       { "tx_vport_unicast_packets",
-               VPORT_COUNTER_OFF(transmitted_eth_unicast.packets) },
-       { "tx_vport_unicast_bytes",
-               VPORT_COUNTER_OFF(transmitted_eth_unicast.octets) },
-       { "rx_vport_multicast_packets",
-               VPORT_COUNTER_OFF(received_eth_multicast.packets) },
-       { "rx_vport_multicast_bytes",
-               VPORT_COUNTER_OFF(received_eth_multicast.octets) },
-       { "tx_vport_multicast_packets",
-               VPORT_COUNTER_OFF(transmitted_eth_multicast.packets) },
-       { "tx_vport_multicast_bytes",
-               VPORT_COUNTER_OFF(transmitted_eth_multicast.octets) },
-       { "rx_vport_broadcast_packets",
-               VPORT_COUNTER_OFF(received_eth_broadcast.packets) },
-       { "rx_vport_broadcast_bytes",
-               VPORT_COUNTER_OFF(received_eth_broadcast.octets) },
-       { "tx_vport_broadcast_packets",
-               VPORT_COUNTER_OFF(transmitted_eth_broadcast.packets) },
-       { "tx_vport_broadcast_bytes",
-               VPORT_COUNTER_OFF(transmitted_eth_broadcast.octets) },
-       { "rx_vport_rdma_unicast_packets",
-               VPORT_COUNTER_OFF(received_ib_unicast.packets) },
-       { "rx_vport_rdma_unicast_bytes",
-               VPORT_COUNTER_OFF(received_ib_unicast.octets) },
-       { "tx_vport_rdma_unicast_packets",
-               VPORT_COUNTER_OFF(transmitted_ib_unicast.packets) },
-       { "tx_vport_rdma_unicast_bytes",
-               VPORT_COUNTER_OFF(transmitted_ib_unicast.octets) },
-       { "rx_vport_rdma_multicast_packets",
-               VPORT_COUNTER_OFF(received_ib_multicast.packets) },
-       { "rx_vport_rdma_multicast_bytes",
-               VPORT_COUNTER_OFF(received_ib_multicast.octets) },
-       { "tx_vport_rdma_multicast_packets",
-               VPORT_COUNTER_OFF(transmitted_ib_multicast.packets) },
-       { "tx_vport_rdma_multicast_bytes",
-               VPORT_COUNTER_OFF(transmitted_ib_multicast.octets) },
-};
 
 #define PPORT_802_3_OFF(c) \
        MLX5_BYTE_OFF(ppcnt_reg, \
@@ -224,69 +143,6 @@ struct mlx5e_pport_stats {
        __be64 phy_statistical_counters[MLX5_ST_SZ_QW(ppcnt_reg)];
 };
 
-static const struct counter_desc pport_802_3_stats_desc[] = {
-       { "tx_packets_phy", PPORT_802_3_OFF(a_frames_transmitted_ok) },
-       { "rx_packets_phy", PPORT_802_3_OFF(a_frames_received_ok) },
-       { "rx_crc_errors_phy", PPORT_802_3_OFF(a_frame_check_sequence_errors) },
-       { "tx_bytes_phy", PPORT_802_3_OFF(a_octets_transmitted_ok) },
-       { "rx_bytes_phy", PPORT_802_3_OFF(a_octets_received_ok) },
-       { "tx_multicast_phy", PPORT_802_3_OFF(a_multicast_frames_xmitted_ok) },
-       { "tx_broadcast_phy", PPORT_802_3_OFF(a_broadcast_frames_xmitted_ok) },
-       { "rx_multicast_phy", PPORT_802_3_OFF(a_multicast_frames_received_ok) },
-       { "rx_broadcast_phy", PPORT_802_3_OFF(a_broadcast_frames_received_ok) },
-       { "rx_in_range_len_errors_phy", PPORT_802_3_OFF(a_in_range_length_errors) },
-       { "rx_out_of_range_len_phy", PPORT_802_3_OFF(a_out_of_range_length_field) },
-       { "rx_oversize_pkts_phy", PPORT_802_3_OFF(a_frame_too_long_errors) },
-       { "rx_symbol_err_phy", PPORT_802_3_OFF(a_symbol_error_during_carrier) },
-       { "tx_mac_control_phy", PPORT_802_3_OFF(a_mac_control_frames_transmitted) },
-       { "rx_mac_control_phy", PPORT_802_3_OFF(a_mac_control_frames_received) },
-       { "rx_unsupported_op_phy", PPORT_802_3_OFF(a_unsupported_opcodes_received) },
-       { "rx_pause_ctrl_phy", PPORT_802_3_OFF(a_pause_mac_ctrl_frames_received) },
-       { "tx_pause_ctrl_phy", PPORT_802_3_OFF(a_pause_mac_ctrl_frames_transmitted) },
-};
-
-static const struct counter_desc pport_2863_stats_desc[] = {
-       { "rx_discards_phy", PPORT_2863_OFF(if_in_discards) },
-       { "tx_discards_phy", PPORT_2863_OFF(if_out_discards) },
-       { "tx_errors_phy", PPORT_2863_OFF(if_out_errors) },
-};
-
-static const struct counter_desc pport_2819_stats_desc[] = {
-       { "rx_undersize_pkts_phy", PPORT_2819_OFF(ether_stats_undersize_pkts) },
-       { "rx_fragments_phy", PPORT_2819_OFF(ether_stats_fragments) },
-       { "rx_jabbers_phy", PPORT_2819_OFF(ether_stats_jabbers) },
-       { "rx_64_bytes_phy", PPORT_2819_OFF(ether_stats_pkts64octets) },
-       { "rx_65_to_127_bytes_phy", PPORT_2819_OFF(ether_stats_pkts65to127octets) },
-       { "rx_128_to_255_bytes_phy", PPORT_2819_OFF(ether_stats_pkts128to255octets) },
-       { "rx_256_to_511_bytes_phy", PPORT_2819_OFF(ether_stats_pkts256to511octets) },
-       { "rx_512_to_1023_bytes_phy", PPORT_2819_OFF(ether_stats_pkts512to1023octets) },
-       { "rx_1024_to_1518_bytes_phy", PPORT_2819_OFF(ether_stats_pkts1024to1518octets) },
-       { "rx_1519_to_2047_bytes_phy", PPORT_2819_OFF(ether_stats_pkts1519to2047octets) },
-       { "rx_2048_to_4095_bytes_phy", PPORT_2819_OFF(ether_stats_pkts2048to4095octets) },
-       { "rx_4096_to_8191_bytes_phy", PPORT_2819_OFF(ether_stats_pkts4096to8191octets) },
-       { "rx_8192_to_10239_bytes_phy", PPORT_2819_OFF(ether_stats_pkts8192to10239octets) },
-};
-
-static const struct counter_desc pport_phy_statistical_stats_desc[] = {
-       { "rx_symbol_errors_phy", PPORT_PHY_STATISTICAL_OFF(phy_symbol_errors) },
-       { "rx_corrected_bits_phy", PPORT_PHY_STATISTICAL_OFF(phy_corrected_bits) },
-};
-
-static const struct counter_desc pport_per_prio_traffic_stats_desc[] = {
-       { "rx_prio%d_bytes", PPORT_PER_PRIO_OFF(rx_octets) },
-       { "rx_prio%d_packets", PPORT_PER_PRIO_OFF(rx_frames) },
-       { "tx_prio%d_bytes", PPORT_PER_PRIO_OFF(tx_octets) },
-       { "tx_prio%d_packets", PPORT_PER_PRIO_OFF(tx_frames) },
-};
-
-static const struct counter_desc pport_per_prio_pfc_stats_desc[] = {
-       /* %s is "global" or "prio{i}" */
-       { "rx_%s_pause", PPORT_PER_PRIO_OFF(rx_pause) },
-       { "rx_%s_pause_duration", PPORT_PER_PRIO_OFF(rx_pause_duration) },
-       { "tx_%s_pause", PPORT_PER_PRIO_OFF(tx_pause) },
-       { "tx_%s_pause_duration", PPORT_PER_PRIO_OFF(tx_pause_duration) },
-       { "rx_%s_pause_transition", PPORT_PER_PRIO_OFF(rx_pause_transition) },
-};
 
 #define PCIE_PERF_OFF(c) \
        MLX5_BYTE_OFF(mpcnt_reg, counter_set.pcie_perf_cntrs_grp_data_layout.c)
@@ -298,11 +154,6 @@ struct mlx5e_pcie_stats {
        __be64 pcie_perf_counters[MLX5_ST_SZ_QW(mpcnt_reg)];
 };
 
-static const struct counter_desc pcie_perf_stats_desc[] = {
-       { "rx_pci_signal_integrity", PCIE_PERF_OFF(rx_errors) },
-       { "tx_pci_signal_integrity", PCIE_PERF_OFF(tx_errors) },
-};
-
 struct mlx5e_rq_stats {
        u64 packets;
        u64 bytes;
@@ -325,28 +176,6 @@ struct mlx5e_rq_stats {
        u64 cache_busy;
 };
 
-static const struct counter_desc rq_stats_desc[] = {
-       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, packets) },
-       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, bytes) },
-       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_complete) },
-       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_unnecessary_inner) },
-       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_none) },
-       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, xdp_drop) },
-       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, xdp_tx) },
-       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, xdp_tx_full) },
-       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, lro_packets) },
-       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, lro_bytes) },
-       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, wqe_err) },
-       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, mpwqe_filler) },
-       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, buff_alloc_err) },
-       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cqe_compress_blks) },
-       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cqe_compress_pkts) },
-       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cache_reuse) },
-       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cache_full) },
-       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cache_empty) },
-       { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cache_busy) },
-};
-
 struct mlx5e_sq_stats {
        /* commonly accessed in data path */
        u64 packets;
@@ -365,22 +194,6 @@ struct mlx5e_sq_stats {
        u64 dropped;
 };
 
-static const struct counter_desc sq_stats_desc[] = {
-       { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, packets) },
-       { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, bytes) },
-       { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tso_packets) },
-       { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tso_bytes) },
-       { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tso_inner_packets) },
-       { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tso_inner_bytes) },
-       { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, csum_partial_inner) },
-       { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, nop) },
-       { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, csum_none) },
-       { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, stopped) },
-       { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, wake) },
-       { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, dropped) },
-       { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, xmit_more) },
-};
-
 #define NUM_SW_COUNTERS                        ARRAY_SIZE(sw_stats_desc)
 #define NUM_Q_COUNTERS                 ARRAY_SIZE(q_stats_desc)
 #define NUM_VPORT_COUNTERS             ARRAY_SIZE(vport_stats_desc)
@@ -416,21 +229,4 @@ struct mlx5e_stats {
        struct mlx5e_pcie_stats pcie;
 };
 
-static const struct counter_desc mlx5e_pme_status_desc[] = {
-       { "module_plug", 0 },
-       { "module_unplug", 8 },
-};
-
-static const struct counter_desc mlx5e_pme_error_desc[] = {
-       { "module_pwr_budget_exd", 0 },  /* power budget exceed */
-       { "module_long_range", 8 },      /* long range for non MLNX cable */
-       { "module_bus_stuck", 16 },      /* bus stuck (I2C or data shorted) */
-       { "module_no_eeprom", 24 },      /* no eeprom/retry time out */
-       { "module_enforce_part", 32 },   /* enforce part number list */
-       { "module_unknown_id", 40 },     /* unknown identifier */
-       { "module_high_temp", 48 },      /* high temperature */
-       { "module_bad_shorted", 56 },    /* bad or shorted cable/module */
-       { "module_unknown_status", 64 },
-};
-
 #endif /* __MLX5_EN_STATS_H__ */
--

2.11.0

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#7 lore raw
In reply to a message not in the archive

From: Stephen Hemminger <[email protected]>
Date: Fri, 21 Apr 2017 11:15:55 -0700

Quoted 3 lines

While looking for sparse and warning output in another driver, I saw several trivial warnings from MLX5 driver. This patch series fixes them.

Saeed, please merge the patches you are OK with into your tree.

Thank you.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html