Skip to contentSkip to conversation

Mellanox, mlx5 updates 2017-08-17

GIT PULL Superseded Saeed Mahameed 5 participants 21 messages Aug 17, 2017 – Aug 24, 2017

Subsystems (5)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

Hi Dave,

Tthe following changes provide updates for mlx5 ethernet and IPoIB netdevice driver.

For more details please see tag log message below. Please pull and let me know if there's any problem.

Thanks,
Saeed.

---

The following changes since commit f03b488b2fb1af20a290509b1ed25db08391b4e7:

Merge branch 'vmbus-sendpacket-cleanups' (2017-08-16 16:27:45 -0700)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-updates-2017-08-17

for you to fetch changes up to 9a1ceef8a42cb90406b6adc620e63e9a11e04dbb:

net/mlx5e: Use size_t to store byte offset in statistics descriptors (2017-08-17 15:57:15 +0300)

----------------------------------------------------------------
mlx5-updates-2017-08-17

Some updates for mlx5 ethernet and IPoIB device driver.

Eran added the support for manage physical link state from netdevice upon interface open/close requests.

Feras fixed the driver name showed in ethtool for IPoIB interfaces. Shalom Added the support for IPoIB netdevice ethtool get link settings.

Gal and Eran exposed new diagnostic counters for outbound PCIe stalls and overflow and RX buffer fullness statistics.

Code cleanups from Or Gerlitz.
Variable types cleanup from Gal.

Thanks,
Saeed.

----------------------------------------------------------------
Eran Ben Elisha (2):
net/mlx5e: Send PAOS command on interface up/down net/mlx5e: Add outbound PCI buffer overflow counter

Feras Daoud (1):
net/mlx5e: IPoIB, Fix driver name retrieved by ethtool

Gal Pressman (6):
net/mlx5: Add PCIe outbound stalls counters infrastructure net/mlx5e: Add PCIe outbound stalls counters
net/mlx5: Add RX buffer fullness counters infrastructure net/mlx5e: Add RX buffer fullness counters
net/mlx5e: Use kernel types instead of uint*_t in ethtool callbacks net/mlx5e: Use size_t to store byte offset in statistics descriptors

Or Gerlitz (5):
net/mlx5: Avoid blank lines after/before open/close brace net/mlx5: Add a blank line after declarations net/mlx5e: Properly indent within conditional statements net/mlx5e: Avoid using multiple blank lines net/mlx5e: Place constants on the right side of comparisons

Shalom Lagziel (1):
net/mlx5e: IPoIB, Add support for get_link_ksettings in ethtool

 drivers/net/ethernet/mellanox/mlx5/core/alloc.c    |   1 +
 drivers/net/ethernet/mellanox/mlx5/core/cmd.c      |   1 -
 .../net/ethernet/mellanox/mlx5/core/en_ethtool.c   |  55 ++++++---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c  |  13 ++
 drivers/net/ethernet/mellanox/mlx5/core/en_rep.c   |  20 +--
 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c    |   4 +-
 drivers/net/ethernet/mellanox/mlx5/core/en_stats.h |  46 ++++++-
 drivers/net/ethernet/mellanox/mlx5/core/eq.c       |   1 +
 .../ethernet/mellanox/mlx5/core/ipoib/ethtool.c    | 135 ++++++++++++++++++---
 drivers/net/ethernet/mellanox/mlx5/core/main.c     |   1 -
 drivers/net/ethernet/mellanox/mlx5/core/sriov.c    |   1 -
 include/linux/mlx5/mlx5_ifc.h                      |  34 +++++-
 12 files changed, 261 insertions(+), 51 deletions(-)
#1 lore raw

PATCH 1/15 net/mlx5e: Send PAOS command on interface up/down

From: Eran Ben Elisha <[email protected]>

Upon interface up/down, driver will send POAS (Ports Administrative and Operational Status Register) in order to inform the Firmware on the desired status of the port by the driver.

Since now we might change physical link status on mlx5e_open/close, logical VF representor should not use mlx5e_open/close ndos as is, and should call the logical version mlx5e_open/closed_locked.

---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c |  7 +++++++
 drivers/net/ethernet/mellanox/mlx5/core/en_rep.c  | 20 +++++++++++++-------
 2 files changed, 20 insertions(+), 7 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +7 -0
index 8633ca5af6ed..6921c6fe3087 100644
@@ -2682,6 +2682,8 @@ int mlx5e_open(struct net_device *netdev)
 
 	mutex_lock(&priv->state_lock);
 	err = mlx5e_open_locked(netdev);
+	if (!err)
+		mlx5_set_port_admin_status(priv->mdev, MLX5_PORT_UP);
 	mutex_unlock(&priv->state_lock);
 
 	return err;
@@ -2716,6 +2718,7 @@ int mlx5e_close(struct net_device *netdev)
 		return -ENODEV;
 
 	mutex_lock(&priv->state_lock);
+	mlx5_set_port_admin_status(priv->mdev, MLX5_PORT_DOWN);
 	err = mlx5e_close_locked(netdev);
 	mutex_unlock(&priv->state_lock);
 
@@ -4187,6 +4190,10 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv)
 
 	mlx5e_init_l2_addr(priv);
 
+	/* Marking the link as currently not needed by the Driver */
+	if (!netif_running(netdev))
+		mlx5_set_port_admin_status(mdev, MLX5_PORT_DOWN);
+
 	/* MTU range: 68 - hw-specific max */
 	netdev->min_mtu = ETH_MIN_MTU;
 	mlx5_query_port_max_mtu(priv->mdev, &max_mtu, 1);
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +13 -7
index f34c00fbf78c..5e0f2d234ace 100644
@@ -613,15 +613,18 @@ static int mlx5e_rep_open(struct net_device *dev)
 	struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
 	int err;
 
-	err = mlx5e_open(dev);
+	mutex_lock(&priv->state_lock);
+	err = mlx5e_open_locked(dev);
 	if (err)
-		return err;
+		goto unlock;
 
-	err = mlx5_eswitch_set_vport_state(esw, rep->vport, MLX5_ESW_VPORT_ADMIN_STATE_UP);
-	if (!err)
+	if (!mlx5_eswitch_set_vport_state(esw, rep->vport,
+					  MLX5_ESW_VPORT_ADMIN_STATE_UP))
 		netif_carrier_on(dev);
 
-	return 0;
+unlock:
+	mutex_unlock(&priv->state_lock);
+	return err;
 }
 
 static int mlx5e_rep_close(struct net_device *dev)
@@ -630,10 +633,13 @@ static int mlx5e_rep_close(struct net_device *dev)
 	struct mlx5e_rep_priv *rpriv = priv->ppriv;
 	struct mlx5_eswitch_rep *rep = rpriv->rep;
 	struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
+	int ret;
 
+	mutex_lock(&priv->state_lock);
 	(void)mlx5_eswitch_set_vport_state(esw, rep->vport, MLX5_ESW_VPORT_ADMIN_STATE_DOWN);
-
-	return mlx5e_close(dev);
+	ret = mlx5e_close_locked(dev);
+	mutex_unlock(&priv->state_lock);
+	return ret;
 }
 
 static int mlx5e_rep_get_phys_port_name(struct net_device *dev,
Signature · 1 line
2.13.0
#2 lore raw

PATCH 2/15 net/mlx5e: IPoIB, Fix driver name retrieved by ethtool

In reply to Saeed Mahameed

From: Feras Daoud <[email protected]>

Printing an enhanced IPoIB device information using "ethtool -i DEVNAME", prints the low level driver name: mlx5_core. This commit changes the name to mlx5_core [ib_ipoib], to include the ipoib device driver infromation.

Fixes 076b0936e5fb ("net/mlx5e: IPoIB, Add ethtool support")
---
 drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c +2 -0
index eb04e97d8765..b080fabfe8de 100644
@@ -39,6 +39,8 @@ static void mlx5i_get_drvinfo(struct net_device *dev,
 	struct mlx5e_priv *priv = mlx5i_epriv(dev);
 
 	mlx5e_ethtool_get_drvinfo(priv, drvinfo);
+	strlcpy(drvinfo->driver, DRIVER_NAME "[ib_ipoib]",
+		sizeof(drvinfo->driver));
 }
 
 static void mlx5i_get_strings(struct net_device *dev,
Signature · 1 line
2.13.0
#3 lore raw

PATCH 3/15 net/mlx5e: IPoIB, Add support for get_link_ksettings in ethtool

In reply to Saeed Mahameed

From: Shalom Lagziel <[email protected]>

Add support for "ethtool DEVNAME" over ipoib ports, Display standard port information for IPoIB netdevices using ethtool For example:

$ ethtool ib2
Quoted 1 line

Settings for ib2:

Supported ports: [ ]
Supported link modes: Not reported
Supported pause frame use: No
Supports auto-negotiation: No
Advertised link modes: Not reported
Advertised pause frame use: No
Advertised auto-negotiation: No
Speed: 100000Mb/s
Duplex: Full
Port: Other
PHYAD: 0
Transceiver: internal
Auto-negotiation: off
Link detected: yes

---
 .../ethernet/mellanox/mlx5/core/ipoib/ethtool.c    | 130 +++++++++++++++++++--
 1 file changed, 118 insertions(+), 12 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c +118 -12
index b080fabfe8de..dd49a59854e5 100644
@@ -131,17 +131,123 @@ static int mlx5i_flash_device(struct net_device *netdev,
 	return mlx5e_ethtool_flash_device(priv, flash);
 }
 
+enum mlx5_ptys_width {
+	MLX5_PTYS_WIDTH_1X	= 1 << 0,
+	MLX5_PTYS_WIDTH_2X	= 1 << 1,
+	MLX5_PTYS_WIDTH_4X	= 1 << 2,
+	MLX5_PTYS_WIDTH_8X	= 1 << 3,
+	MLX5_PTYS_WIDTH_12X	= 1 << 4,
+};
+
+static inline int mlx5_ptys_width_enum_to_int(enum mlx5_ptys_width width)
+{
+	switch (width) {
+	case MLX5_PTYS_WIDTH_1X:  return  1;
+	case MLX5_PTYS_WIDTH_2X:  return  2;
+	case MLX5_PTYS_WIDTH_4X:  return  4;
+	case MLX5_PTYS_WIDTH_8X:  return  8;
+	case MLX5_PTYS_WIDTH_12X: return 12;
+	default:		  return -1;
+	}
+}
+
+enum mlx5_ptys_rate {
+	MLX5_PTYS_RATE_SDR	= 1 << 0,
+	MLX5_PTYS_RATE_DDR	= 1 << 1,
+	MLX5_PTYS_RATE_QDR	= 1 << 2,
+	MLX5_PTYS_RATE_FDR10	= 1 << 3,
+	MLX5_PTYS_RATE_FDR	= 1 << 4,
+	MLX5_PTYS_RATE_EDR	= 1 << 5,
+	MLX5_PTYS_RATE_HDR	= 1 << 6,
+};
+
+static inline int mlx5_ptys_rate_enum_to_int(enum mlx5_ptys_rate rate)
+{
+	switch (rate) {
+	case MLX5_PTYS_RATE_SDR:   return 2500;
+	case MLX5_PTYS_RATE_DDR:   return 5000;
+	case MLX5_PTYS_RATE_QDR:
+	case MLX5_PTYS_RATE_FDR10: return 10000;
+	case MLX5_PTYS_RATE_FDR:   return 14000;
+	case MLX5_PTYS_RATE_EDR:   return 25000;
+	case MLX5_PTYS_RATE_HDR:   return 50000;
+	default:		   return -1;
+	}
+}
+
+static int mlx5i_get_port_settings(struct net_device *netdev,
+				   u16 *ib_link_width_oper, u16 *ib_proto_oper)
+{
+	struct mlx5e_priv *priv    = mlx5i_epriv(netdev);
+	struct mlx5_core_dev *mdev = priv->mdev;
+	u32 out[MLX5_ST_SZ_DW(ptys_reg)] = {0};
+	int ret;
+
+	ret = mlx5_query_port_ptys(mdev, out, sizeof(out), MLX5_PTYS_IB, 1);
+	if (ret)
+		return ret;
+
+	*ib_link_width_oper = MLX5_GET(ptys_reg, out, ib_link_width_oper);
+	*ib_proto_oper      = MLX5_GET(ptys_reg, out, ib_proto_oper);
+
+	return 0;
+}
+
+static int mlx5i_get_speed_settings(u16 ib_link_width_oper, u16 ib_proto_oper)
+{
+	int rate, width;
+
+	rate = mlx5_ptys_rate_enum_to_int(ib_proto_oper);
+	if (rate < 0)
+		return -EINVAL;
+	width = mlx5_ptys_width_enum_to_int(ib_link_width_oper);
+	if (width < 0)
+		return -EINVAL;
+
+	return rate * width;
+}
+
+static int mlx5i_get_link_ksettings(struct net_device *netdev,
+				    struct ethtool_link_ksettings *link_ksettings)
+{
+	u16 ib_link_width_oper;
+	u16 ib_proto_oper;
+	int speed, ret;
+
+	ret = mlx5i_get_port_settings(netdev, &ib_link_width_oper, &ib_proto_oper);
+	if (ret)
+		return ret;
+
+	ethtool_link_ksettings_zero_link_mode(link_ksettings, supported);
+	ethtool_link_ksettings_zero_link_mode(link_ksettings, advertising);
+
+	speed = mlx5i_get_speed_settings(ib_link_width_oper, ib_proto_oper);
+	if (speed < 0)
+		return -EINVAL;
+
+	link_ksettings->base.duplex = DUPLEX_FULL;
+	link_ksettings->base.port = PORT_OTHER;
+
+	link_ksettings->base.autoneg = AUTONEG_DISABLE;
+
+	link_ksettings->base.speed = speed;
+
+	return 0;
+}
+
 const struct ethtool_ops mlx5i_ethtool_ops = {
-	.get_drvinfo       = mlx5i_get_drvinfo,
-	.get_strings       = mlx5i_get_strings,
-	.get_sset_count    = mlx5i_get_sset_count,
-	.get_ethtool_stats = mlx5i_get_ethtool_stats,
-	.get_ringparam     = mlx5i_get_ringparam,
-	.set_ringparam     = mlx5i_set_ringparam,
-	.flash_device      = mlx5i_flash_device,
-	.get_channels      = mlx5i_get_channels,
-	.set_channels      = mlx5i_set_channels,
-	.get_coalesce      = mlx5i_get_coalesce,
-	.set_coalesce      = mlx5i_set_coalesce,
-	.get_ts_info       = mlx5i_get_ts_info,
+	.get_drvinfo        = mlx5i_get_drvinfo,
+	.get_strings        = mlx5i_get_strings,
+	.get_sset_count     = mlx5i_get_sset_count,
+	.get_ethtool_stats  = mlx5i_get_ethtool_stats,
+	.get_ringparam      = mlx5i_get_ringparam,
+	.set_ringparam      = mlx5i_set_ringparam,
+	.flash_device       = mlx5i_flash_device,
+	.get_channels       = mlx5i_get_channels,
+	.set_channels       = mlx5i_set_channels,
+	.get_coalesce       = mlx5i_get_coalesce,
+	.set_coalesce       = mlx5i_set_coalesce,
+	.get_ts_info        = mlx5i_get_ts_info,
+	.get_link_ksettings = mlx5i_get_link_ksettings,
+	.get_link           = ethtool_op_get_link,
 };
Signature · 1 line
2.13.0
#4 lore raw

PATCH 4/15 net/mlx5: Add PCIe outbound stalls counters infrastructure

In reply to Saeed Mahameed

From: Gal Pressman <[email protected]>

Add capability bit in MCAM register and counters to MPCNT register.

---
 include/linux/mlx5/mlx5_ifc.h | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
include/linux/mlx5/mlx5_ifc.h +14 -3
index c99daffc3c3c..ba533b39c885 100644
@@ -1854,7 +1854,17 @@ struct mlx5_ifc_pcie_perf_cntrs_grp_data_layout_bits {
 
 	u8         crc_error_tlp[0x20];
 
-	u8         reserved_at_140[0x680];
+	u8         reserved_at_140[0x40];
+
+	u8         outbound_stalled_reads[0x20];
+
+	u8         outbound_stalled_writes[0x20];
+
+	u8         outbound_stalled_reads_events[0x20];
+
+	u8         outbound_stalled_writes_events[0x20];
+
+	u8         reserved_at_200[0x5c0];
 };
 
 struct mlx5_ifc_cmd_inter_comp_event_bits {
@@ -7744,8 +7754,9 @@ struct mlx5_ifc_pcam_reg_bits {
 };
 
 struct mlx5_ifc_mcam_enhanced_features_bits {
-	u8         reserved_at_0[0x7d];
-
+	u8         reserved_at_0[0x7b];
+	u8         pcie_outbound_stalled[0x1];
+	u8         reserved_at_7c[0x1];
 	u8         mtpps_enh_out_per_adj[0x1];
 	u8         mtpps_fs[0x1];
 	u8         pcie_performance_group[0x1];
Signature · 1 line
2.13.0
#5 lore raw

PATCH 5/15 net/mlx5e: Add PCIe outbound stalls counters

In reply to Saeed Mahameed

From: Gal Pressman <[email protected]>

outbound_pci_stalled_rd - The percentage of time within the last second that the NIC had outbound non-posted read requests but could not perform the operation due to insufficient non-posted credits.

outbound_pci_stalled_wr - The percentage of time within the last second that the NIC had outbound posted writes requests but could not perform the operation due to insufficient posted credits.

outbound_pci_stalled_rd_events - The number of events where outbound_pci_stalled_rd was above the threshold.

outbound_pci_stalled_wr_events - The number of events where outbound_pci_stalled_wr was above the threshold.

---
 drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c |  8 ++++++++
 drivers/net/ethernet/mellanox/mlx5/core/en_stats.h   | 13 ++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +8 -0
index 917fade5f5d5..07202f7322fc 100644
@@ -246,6 +246,10 @@ static void mlx5e_fill_stats_strings(struct mlx5e_priv *priv, uint8_t *data)
 		strcpy(data + (idx++) * ETH_GSTRING_LEN,
 		       pcie_perf_stats_desc[i].format);
 
+	for (i = 0; i < NUM_PCIE_PERF_STALL_COUNTERS(priv); i++)
+		strcpy(data + (idx++) * ETH_GSTRING_LEN,
+		       pcie_perf_stall_stats_desc[i].format);
+
 	for (prio = 0; prio < NUM_PPORT_PRIO; prio++) {
 		for (i = 0; i < NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS; i++)
 			sprintf(data + (idx++) * ETH_GSTRING_LEN,
@@ -377,6 +381,10 @@ void mlx5e_ethtool_get_ethtool_stats(struct mlx5e_priv *priv,
 		data[idx++] = MLX5E_READ_CTR32_BE(&priv->stats.pcie.pcie_perf_counters,
 						  pcie_perf_stats_desc, i);
 
+	for (i = 0; i < NUM_PCIE_PERF_STALL_COUNTERS(priv); i++)
+		data[idx++] = MLX5E_READ_CTR32_BE(&priv->stats.pcie.pcie_perf_counters,
+						  pcie_perf_stall_stats_desc, i);
+
 	for (prio = 0; prio < NUM_PPORT_PRIO; prio++) {
 		for (i = 0; i < NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS; i++)
 			data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.per_prio_counters[prio],
drivers/net/ethernet/mellanox/mlx5/core/en_stats.h +12 -1
index e65517eafc58..bdddddc46170 100644
@@ -305,6 +305,13 @@ static const struct counter_desc pcie_perf_stats_desc[] = {
 	{ "tx_pci_signal_integrity", PCIE_PERF_OFF(tx_errors) },
 };
 
+static const struct counter_desc pcie_perf_stall_stats_desc[] = {
+	{ "outbound_pci_stalled_rd", PCIE_PERF_OFF(outbound_stalled_reads) },
+	{ "outbound_pci_stalled_wr", PCIE_PERF_OFF(outbound_stalled_writes) },
+	{ "outbound_pci_stalled_rd_events", PCIE_PERF_OFF(outbound_stalled_reads_events) },
+	{ "outbound_pci_stalled_wr_events", PCIE_PERF_OFF(outbound_stalled_writes_events) },
+};
+
 struct mlx5e_rq_stats {
 	u64 packets;
 	u64 bytes;
@@ -397,6 +404,9 @@ static const struct counter_desc sq_stats_desc[] = {
 #define NUM_PCIE_PERF_COUNTERS(priv) \
 	(ARRAY_SIZE(pcie_perf_stats_desc) * \
 	 MLX5_CAP_MCAM_FEATURE((priv)->mdev, pcie_performance_group))
+#define NUM_PCIE_PERF_STALL_COUNTERS(priv) \
+	(ARRAY_SIZE(pcie_perf_stall_stats_desc) * \
+	 MLX5_CAP_MCAM_FEATURE((priv)->mdev, pcie_outbound_stalled))
 #define NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS \
 	ARRAY_SIZE(pport_per_prio_traffic_stats_desc)
 #define NUM_PPORT_PER_PRIO_PFC_COUNTERS \
@@ -407,7 +417,8 @@ static const struct counter_desc sq_stats_desc[] = {
 					 NUM_PPORT_PHY_STATISTICAL_COUNTERS(priv) + \
 					 NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS * \
 					 NUM_PPORT_PRIO)
-#define NUM_PCIE_COUNTERS(priv)		NUM_PCIE_PERF_COUNTERS(priv)
+#define NUM_PCIE_COUNTERS(priv)		(NUM_PCIE_PERF_COUNTERS(priv) + \
+					 NUM_PCIE_PERF_STALL_COUNTERS(priv))
 #define NUM_RQ_STATS			ARRAY_SIZE(rq_stats_desc)
 #define NUM_SQ_STATS			ARRAY_SIZE(sq_stats_desc)
 
Signature · 1 line
2.13.0
#8 lore raw

PATCH 8/15 net/mlx5e: Add outbound PCI buffer overflow counter

In reply to Saeed Mahameed

From: Eran Ben Elisha <[email protected]>

Add outbound_pci_buffer_overflow to ethtool output for monitoring the number of packets that were dropped due to lack of PCIe buffers on receive path from NIC port toward the host(s).

This counter is valid only in case that tx_overflow_buffer_pkt is supported in MCAM enhanced features.

---
 drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 12 ++++++++++--
 drivers/net/ethernet/mellanox/mlx5/core/en_stats.h   | 14 ++++++++++++++
 include/linux/mlx5/mlx5_ifc.h                        |  6 ++++--
 3 files changed, 28 insertions(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +10 -2
index 8c013a521319..d453a11f41fe 100644
@@ -250,9 +250,13 @@ static void mlx5e_fill_stats_strings(struct mlx5e_priv *priv, uint8_t *data)
 		strcpy(data + (idx++) * ETH_GSTRING_LEN,
 		       pcie_perf_stats_desc[i].format);
 
-	for (i = 0; i < NUM_PCIE_PERF_STALL_COUNTERS(priv); i++)
+	for (i = 0; i < NUM_PCIE_PERF_COUNTERS64(priv); i++)
 		strcpy(data + (idx++) * ETH_GSTRING_LEN,
-		       pcie_perf_stall_stats_desc[i].format);
+		       pcie_perf_stats_desc64[i].format);
+
+	for (i = 0; i < NUM_PCIE_PERF_STALL_COUNTERS(priv); i++)
+	 strcpy(data + (idx++) * ETH_GSTRING_LEN,
+		pcie_perf_stall_stats_desc[i].format);
 
 	for (prio = 0; prio < NUM_PPORT_PRIO; prio++) {
 		for (i = 0; i < NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS; i++)
@@ -389,6 +393,10 @@ void mlx5e_ethtool_get_ethtool_stats(struct mlx5e_priv *priv,
 		data[idx++] = MLX5E_READ_CTR32_BE(&priv->stats.pcie.pcie_perf_counters,
 						  pcie_perf_stats_desc, i);
 
+	for (i = 0; i < NUM_PCIE_PERF_COUNTERS64(priv); i++)
+		data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pcie.pcie_perf_counters,
+						  pcie_perf_stats_desc64, i);
+
 	for (i = 0; i < NUM_PCIE_PERF_STALL_COUNTERS(priv); i++)
 		data[idx++] = MLX5E_READ_CTR32_BE(&priv->stats.pcie.pcie_perf_counters,
 						  pcie_perf_stall_stats_desc, i);
drivers/net/ethernet/mellanox/mlx5/core/en_stats.h +14 -0
index be49df4bedd9..40b5c73e5e26 100644
@@ -307,6 +307,12 @@ static const struct counter_desc pport_eth_ext_stats_desc[] = {
 	MLX5_GET(mpcnt_reg, (pcie_stats)->pcie_perf_counters, \
 		 counter_set.pcie_perf_cntrs_grp_data_layout.c)
 
+#define PCIE_PERF_OFF64(c) \
+	MLX5_BYTE_OFF(mpcnt_reg, counter_set.pcie_perf_cntrs_grp_data_layout.c##_high)
+#define PCIE_PERF_GET64(pcie_stats, c) \
+	MLX5_GET64(mpcnt_reg, (pcie_stats)->pcie_perf_counters, \
+		   counter_set.pcie_perf_cntrs_grp_data_layout.c##_high)
+
 struct mlx5e_pcie_stats {
 	__be64 pcie_perf_counters[MLX5_ST_SZ_QW(mpcnt_reg)];
 };
@@ -316,6 +322,10 @@ static const struct counter_desc pcie_perf_stats_desc[] = {
 	{ "tx_pci_signal_integrity", PCIE_PERF_OFF(tx_errors) },
 };
 
+static const struct counter_desc pcie_perf_stats_desc64[] = {
+	{ "outbound_pci_buffer_overflow", PCIE_PERF_OFF64(tx_overflow_buffer_pkt) },
+};
+
 static const struct counter_desc pcie_perf_stall_stats_desc[] = {
 	{ "outbound_pci_stalled_rd", PCIE_PERF_OFF(outbound_stalled_reads) },
 	{ "outbound_pci_stalled_wr", PCIE_PERF_OFF(outbound_stalled_writes) },
@@ -415,6 +425,9 @@ static const struct counter_desc sq_stats_desc[] = {
 #define NUM_PCIE_PERF_COUNTERS(priv) \
 	(ARRAY_SIZE(pcie_perf_stats_desc) * \
 	 MLX5_CAP_MCAM_FEATURE((priv)->mdev, pcie_performance_group))
+#define NUM_PCIE_PERF_COUNTERS64(priv) \
+	(ARRAY_SIZE(pcie_perf_stats_desc64) * \
+	 MLX5_CAP_MCAM_FEATURE((priv)->mdev, tx_overflow_buffer_pkt))
 #define NUM_PCIE_PERF_STALL_COUNTERS(priv) \
 	(ARRAY_SIZE(pcie_perf_stall_stats_desc) * \
 	 MLX5_CAP_MCAM_FEATURE((priv)->mdev, pcie_outbound_stalled))
@@ -433,6 +446,7 @@ static const struct counter_desc sq_stats_desc[] = {
 					 NUM_PPORT_PRIO + \
 					 NUM_PPORT_ETH_EXT_COUNTERS(priv))
 #define NUM_PCIE_COUNTERS(priv)		(NUM_PCIE_PERF_COUNTERS(priv) + \
+					 NUM_PCIE_PERF_COUNTERS64(priv) +\
 					 NUM_PCIE_PERF_STALL_COUNTERS(priv))
 #define NUM_RQ_STATS			ARRAY_SIZE(rq_stats_desc)
 #define NUM_SQ_STATS			ARRAY_SIZE(sq_stats_desc)
include/linux/mlx5/mlx5_ifc.h +4 -2
index cf7ff52c594e..ae7d09b9c52f 100644
@@ -1864,7 +1864,9 @@ struct mlx5_ifc_pcie_perf_cntrs_grp_data_layout_bits {
 
 	u8         crc_error_tlp[0x20];
 
-	u8         reserved_at_140[0x40];
+	u8         tx_overflow_buffer_pkt_high[0x20];
+
+	u8         tx_overflow_buffer_pkt_low[0x20];
 
 	u8         outbound_stalled_reads[0x20];
 
@@ -7767,7 +7769,7 @@ struct mlx5_ifc_pcam_reg_bits {
 struct mlx5_ifc_mcam_enhanced_features_bits {
 	u8         reserved_at_0[0x7b];
 	u8         pcie_outbound_stalled[0x1];
-	u8         reserved_at_7c[0x1];
+	u8         tx_overflow_buffer_pkt[0x1];
 	u8         mtpps_enh_out_per_adj[0x1];
 	u8         mtpps_fs[0x1];
 	u8         pcie_performance_group[0x1];
Signature · 1 line
2.13.0
#6 lore raw

PATCH 6/15 net/mlx5: Add RX buffer fullness counters infrastructure

In reply to Saeed Mahameed

From: Gal Pressman <[email protected]>

Add capability bit in PCAM register and counters to PPCNT register.

---
 include/linux/mlx5/mlx5_ifc.h | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
include/linux/mlx5/mlx5_ifc.h +13 -2
index ba533b39c885..cf7ff52c594e 100644
@@ -1538,7 +1538,17 @@ struct mlx5_ifc_eth_extended_cntrs_grp_data_layout_bits {
 
 	u8         port_transmit_wait_low[0x20];
 
-	u8         reserved_at_40[0x780];
+	u8         reserved_at_40[0x100];
+
+	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         reserved_at_1c0[0x600];
 };
 
 struct mlx5_ifc_eth_3635_cntrs_grp_data_layout_bits {
@@ -7723,8 +7733,9 @@ struct mlx5_ifc_peir_reg_bits {
 };
 
 struct mlx5_ifc_pcam_enhanced_features_bits {
-	u8         reserved_at_0[0x7c];
+	u8         reserved_at_0[0x7b];
 
+	u8         rx_buffer_fullness_counters[0x1];
 	u8         ptys_connector_type[0x1];
 	u8         reserved_at_7d[0x1];
 	u8         ppcnt_discard_group[0x1];
Signature · 1 line
2.13.0
#7 lore raw

PATCH 7/15 net/mlx5e: Add RX buffer fullness counters

In reply to Saeed Mahameed

From: Gal Pressman <[email protected]>

rx_buffer_passed_thres_phy - The number of events where the port RX buffer has passed a fullness threshold.

rx_buffer_full_phy - The number of events where the port RX buffer has reached 100% fullness.

---
 drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c |  8 ++++++++
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c    |  6 ++++++
 drivers/net/ethernet/mellanox/mlx5/core/en_stats.h   | 17 ++++++++++++++++-
 3 files changed, 30 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +8 -0
index 07202f7322fc..8c013a521319 100644
@@ -242,6 +242,10 @@ static void mlx5e_fill_stats_strings(struct mlx5e_priv *priv, uint8_t *data)
 		strcpy(data + (idx++) * ETH_GSTRING_LEN,
 		       pport_phy_statistical_stats_desc[i].format);
 
+	for (i = 0; i < NUM_PPORT_ETH_EXT_COUNTERS(priv); i++)
+		strcpy(data + (idx++) * ETH_GSTRING_LEN,
+		       pport_eth_ext_stats_desc[i].format);
+
 	for (i = 0; i < NUM_PCIE_PERF_COUNTERS(priv); i++)
 		strcpy(data + (idx++) * ETH_GSTRING_LEN,
 		       pcie_perf_stats_desc[i].format);
@@ -377,6 +381,10 @@ void mlx5e_ethtool_get_ethtool_stats(struct mlx5e_priv *priv,
 		data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.phy_statistical_counters,
 						  pport_phy_statistical_stats_desc, i);
 
+	for (i = 0; i < NUM_PPORT_ETH_EXT_COUNTERS(priv); i++)
+		data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.eth_ext_counters,
+						  pport_eth_ext_stats_desc, i);
+
 	for (i = 0; i < NUM_PCIE_PERF_COUNTERS(priv); i++)
 		data[idx++] = MLX5E_READ_CTR32_BE(&priv->stats.pcie.pcie_perf_counters,
 						  pcie_perf_stats_desc, i);
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +6 -0
index 6921c6fe3087..2b0c891ad2a9 100644
@@ -288,6 +288,12 @@ static void mlx5e_update_pport_counters(struct mlx5e_priv *priv, bool full)
 		mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPCNT, 0, 0);
 	}
 
+	if (MLX5_CAP_PCAM_FEATURE(mdev, rx_buffer_fullness_counters)) {
+		out = pstats->eth_ext_counters;
+		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);
+	}
+
 	MLX5_SET(ppcnt_reg, in, grp, MLX5_PER_PRIORITY_COUNTERS_GROUP);
 	for (prio = 0; prio < NUM_PPORT_PRIO; prio++) {
 		out = pstats->per_prio_counters[prio];
drivers/net/ethernet/mellanox/mlx5/core/en_stats.h +16 -1
index bdddddc46170..be49df4bedd9 100644
@@ -216,6 +216,12 @@ static const struct counter_desc vport_stats_desc[] = {
 	MLX5_GET64(ppcnt_reg, pstats->per_prio_counters[prio], \
 		   counter_set.eth_per_prio_grp_data_layout.c##_high)
 #define NUM_PPORT_PRIO				8
+#define PPORT_ETH_EXT_OFF(c) \
+	MLX5_BYTE_OFF(ppcnt_reg, \
+		      counter_set.eth_extended_cntrs_grp_data_layout.c##_high)
+#define PPORT_ETH_EXT_GET(pstats, c) \
+	MLX5_GET64(ppcnt_reg, (pstats)->eth_ext_counters, \
+		   counter_set.eth_extended_cntrs_grp_data_layout.c##_high)
 
 struct mlx5e_pport_stats {
 	__be64 IEEE_802_3_counters[MLX5_ST_SZ_QW(ppcnt_reg)];
@@ -224,6 +230,7 @@ struct mlx5e_pport_stats {
 	__be64 per_prio_counters[NUM_PPORT_PRIO][MLX5_ST_SZ_QW(ppcnt_reg)];
 	__be64 phy_counters[MLX5_ST_SZ_QW(ppcnt_reg)];
 	__be64 phy_statistical_counters[MLX5_ST_SZ_QW(ppcnt_reg)];
+	__be64 eth_ext_counters[MLX5_ST_SZ_QW(ppcnt_reg)];
 };
 
 static const struct counter_desc pport_802_3_stats_desc[] = {
@@ -290,6 +297,10 @@ static const struct counter_desc pport_per_prio_pfc_stats_desc[] = {
 	{ "rx_%s_pause_transition", PPORT_PER_PRIO_OFF(rx_pause_transition) },
 };
 
+static const struct counter_desc pport_eth_ext_stats_desc[] = {
+	{ "rx_buffer_passed_thres_phy", PPORT_ETH_EXT_OFF(rx_buffer_almost_full) },
+};
+
 #define PCIE_PERF_OFF(c) \
 	MLX5_BYTE_OFF(mpcnt_reg, counter_set.pcie_perf_cntrs_grp_data_layout.c)
 #define PCIE_PERF_GET(pcie_stats, c) \
@@ -411,12 +422,16 @@ static const struct counter_desc sq_stats_desc[] = {
 	ARRAY_SIZE(pport_per_prio_traffic_stats_desc)
 #define NUM_PPORT_PER_PRIO_PFC_COUNTERS \
 	ARRAY_SIZE(pport_per_prio_pfc_stats_desc)
+#define NUM_PPORT_ETH_EXT_COUNTERS(priv) \
+	(ARRAY_SIZE(pport_eth_ext_stats_desc) * \
+	 MLX5_CAP_PCAM_FEATURE((priv)->mdev, rx_buffer_fullness_counters))
 #define NUM_PPORT_COUNTERS(priv)	(NUM_PPORT_802_3_COUNTERS + \
 					 NUM_PPORT_2863_COUNTERS  + \
 					 NUM_PPORT_2819_COUNTERS  + \
 					 NUM_PPORT_PHY_STATISTICAL_COUNTERS(priv) + \
 					 NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS * \
-					 NUM_PPORT_PRIO)
+					 NUM_PPORT_PRIO + \
+					 NUM_PPORT_ETH_EXT_COUNTERS(priv))
 #define NUM_PCIE_COUNTERS(priv)		(NUM_PCIE_PERF_COUNTERS(priv) + \
 					 NUM_PCIE_PERF_STALL_COUNTERS(priv))
 #define NUM_RQ_STATS			ARRAY_SIZE(rq_stats_desc)
Signature · 1 line
2.13.0
#9 lore raw

PATCH 9/15 net/mlx5: Avoid blank lines after/before open/close brace

In reply to Saeed Mahameed

From: Or Gerlitz <[email protected]>

To fix these checkpatch complaints:

CHECK: Blank lines aren't necessary after an open brace '{'
CHECK: Blank lines aren't necessary before a close brace '}'

---
 drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 1 -
 drivers/net/ethernet/mellanox/mlx5/core/sriov.c      | 1 -
 2 files changed, 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +0 -1
index d453a11f41fe..a75ac4d11c5b 100644
@@ -176,7 +176,6 @@ static bool mlx5e_query_global_pause_combined(struct mlx5e_priv *priv)
 
 int mlx5e_ethtool_get_sset_count(struct mlx5e_priv *priv, int sset)
 {
-
 	switch (sset) {
 	case ETH_SS_STATS:
 		return NUM_SW_COUNTERS +
drivers/net/ethernet/mellanox/mlx5/core/sriov.c +0 -1
index 5e7ffc9fad78..55b07c5ecd12 100644
@@ -71,7 +71,6 @@ static int mlx5_device_enable_sriov(struct mlx5_core_dev *dev, int num_vfs)
 		sriov->vfs_ctx[vf].enabled = 1;
 		sriov->enabled_vfs++;
 		mlx5_core_dbg(dev, "successfully enabled VF* %d\n", vf);
-
 	}
 
 	return 0;
Signature · 1 line
2.13.0
#10 lore raw

PATCH 10/15 net/mlx5: Add a blank line after declarations

In reply to Saeed Mahameed

From: Or Gerlitz <[email protected]>

To fix these checkpatch complaints:

WARNING: Missing a blank line after declarations

---
 drivers/net/ethernet/mellanox/mlx5/core/alloc.c | 1 +
 drivers/net/ethernet/mellanox/mlx5/core/eq.c    | 1 +
 2 files changed, 2 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/alloc.c +1 -0
index 3c95f7f53802..47239bf7bf43 100644
@@ -258,6 +258,7 @@ EXPORT_SYMBOL_GPL(mlx5_db_alloc);
 void mlx5_db_free(struct mlx5_core_dev *dev, struct mlx5_db *db)
 {
 	u32 db_per_page = PAGE_SIZE / cache_line_size();
+
 	mutex_lock(&dev->priv.pgdir_mutex);
 
 	__set_bit(db->index, db->u.pgdir->bitmap);
drivers/net/ethernet/mellanox/mlx5/core/eq.c +1 -0
index de704ff5619a..a08027b8f3ce 100644
@@ -188,6 +188,7 @@ static enum mlx5_dev_event port_subtype_event(u8 subtype)
 static void eq_update_ci(struct mlx5_eq *eq, int arm)
 {
 	__be32 __iomem *addr = eq->doorbell + (arm ? 0 : 2);
+
 	u32 val = (eq->cons_index & 0xffffff) | (eq->eqn << 24);
 	__raw_writel((__force u32)cpu_to_be32(val), addr);
 	/* We still want ordering, just not swabbing, so add a barrier */
Signature · 1 line
2.13.0
#13 lore raw

PATCH 11/15 net/mlx5e: Properly indent within conditional statements

In reply to Saeed Mahameed

From: Or Gerlitz <[email protected]>

To fix these checkpatch complaints:

WARNING: suspect code indent for conditional statements (8, 24)
+ if (eth_proto & (MLX5E_PROT_MASK(MLX5E_10GBASE_SR)
[...]
+ return PORT_FIBRE;

---
 .../net/ethernet/mellanox/mlx5/core/en_ethtool.c   | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +11 -11
index a75ac4d11c5b..ed161312a773 100644
@@ -988,23 +988,23 @@ static u8 get_connector_port(u32 eth_proto, u8 connector_type)
 		return ptys2connector_type[connector_type];
 
 	if (eth_proto & (MLX5E_PROT_MASK(MLX5E_10GBASE_SR)
-			 | MLX5E_PROT_MASK(MLX5E_40GBASE_SR4)
-			 | MLX5E_PROT_MASK(MLX5E_100GBASE_SR4)
-			 | MLX5E_PROT_MASK(MLX5E_1000BASE_CX_SGMII))) {
-			return PORT_FIBRE;
+	    | MLX5E_PROT_MASK(MLX5E_40GBASE_SR4)
+	    | MLX5E_PROT_MASK(MLX5E_100GBASE_SR4)
+	    | MLX5E_PROT_MASK(MLX5E_1000BASE_CX_SGMII))) {
+		return PORT_FIBRE;
 	}
 
 	if (eth_proto & (MLX5E_PROT_MASK(MLX5E_40GBASE_CR4)
-			 | MLX5E_PROT_MASK(MLX5E_10GBASE_CR)
-			 | MLX5E_PROT_MASK(MLX5E_100GBASE_CR4))) {
-			return PORT_DA;
+	    | MLX5E_PROT_MASK(MLX5E_10GBASE_CR)
+	    | MLX5E_PROT_MASK(MLX5E_100GBASE_CR4))) {
+		return PORT_DA;
 	}
 
 	if (eth_proto & (MLX5E_PROT_MASK(MLX5E_10GBASE_KX4)
-			 | MLX5E_PROT_MASK(MLX5E_10GBASE_KR)
-			 | MLX5E_PROT_MASK(MLX5E_40GBASE_KR4)
-			 | MLX5E_PROT_MASK(MLX5E_100GBASE_KR4))) {
-			return PORT_NONE;
+	    | MLX5E_PROT_MASK(MLX5E_10GBASE_KR)
+	    | MLX5E_PROT_MASK(MLX5E_40GBASE_KR4)
+	    | MLX5E_PROT_MASK(MLX5E_100GBASE_KR4))) {
+		return PORT_NONE;
 	}
 
 	return PORT_OTHER;
Signature · 1 line
2.13.0
#17 lore raw

PATCH 12/15 net/mlx5e: Avoid using multiple blank lines

In reply to Saeed Mahameed

From: Or Gerlitz <[email protected]>

To fix these checkpatch complaints:

CHECK: Please don't use multiple blank lines

---
 drivers/net/ethernet/mellanox/mlx5/core/cmd.c  | 1 -
 drivers/net/ethernet/mellanox/mlx5/core/main.c | 1 -
 2 files changed, 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/cmd.c +0 -1
index 31cbe5e86a01..0ef68a7c051e 100644
@@ -802,7 +802,6 @@ static void cmd_work_handler(struct work_struct *work)
 	bool poll_cmd = ent->polling;
 	int alloc_ret;
 
-
 	sem = ent->page_queue ? &cmd->pages_sem : &cmd->sem;
 	down(sem);
 	if (!ent->page_queue) {
drivers/net/ethernet/mellanox/mlx5/core/main.c +0 -1
index 7e6e24398926..514c22d21729 100644
@@ -836,7 +836,6 @@ static int mlx5_core_set_issi(struct mlx5_core_dev *dev)
 	return -EOPNOTSUPP;
 }
 
-
 static int mlx5_pci_init(struct mlx5_core_dev *dev, struct mlx5_priv *priv)
 {
 	struct pci_dev *pdev = dev->pdev;
Signature · 1 line
2.13.0
#18 lore raw

PATCH 13/15 net/mlx5e: Place constants on the right side of comparisons

In reply to Saeed Mahameed

From: Or Gerlitz <[email protected]>

To fix these checkpatch complaints:

WARNING: Comparisons should place the constant on the right side of the test

---
 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +2 -2
index 8e224bcbc6a6..55a6786d3c4c 100644
@@ -509,8 +509,8 @@ static void mlx5e_lro_update_hdr(struct sk_buff *skb, struct mlx5_cqe64 *cqe,
 	u16 tot_len;
 
 	u8 l4_hdr_type = get_cqe_l4_hdr_type(cqe);
-	int tcp_ack = ((CQE_L4_HDR_TYPE_TCP_ACK_NO_DATA  == l4_hdr_type) ||
-		       (CQE_L4_HDR_TYPE_TCP_ACK_AND_DATA == l4_hdr_type));
+	int tcp_ack = ((l4_hdr_type == CQE_L4_HDR_TYPE_TCP_ACK_NO_DATA) ||
+		       (l4_hdr_type == CQE_L4_HDR_TYPE_TCP_ACK_AND_DATA));
 
 	skb->mac_len = ETH_HLEN;
 	proto = __vlan_get_protocol(skb, eth->h_proto, &network_depth);
Signature · 1 line
2.13.0
#19 lore raw

PATCH 14/15 net/mlx5e: Use kernel types instead of uint*_t in ethtool callbacks

In reply to Saeed Mahameed

From: Gal Pressman <[email protected]>

Fix checkpatch errors:
CHECK:PREFER_KERNEL_TYPES: Prefer kernel type 'u32' over 'uint32_t'

---
 drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c    | 8 +++-----
 drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c | 3 +--
 2 files changed, 4 insertions(+), 7 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +3 -5
index ed161312a773..03b130408359 100644
@@ -206,7 +206,7 @@ static int mlx5e_get_sset_count(struct net_device *dev, int sset)
 	return mlx5e_ethtool_get_sset_count(priv, sset);
 }
 
-static void mlx5e_fill_stats_strings(struct mlx5e_priv *priv, uint8_t *data)
+static void mlx5e_fill_stats_strings(struct mlx5e_priv *priv, u8 *data)
 {
 	int i, j, tc, prio, idx = 0;
 	unsigned long pfc_combined;
@@ -308,8 +308,7 @@ static void mlx5e_fill_stats_strings(struct mlx5e_priv *priv, uint8_t *data)
 					priv->channel_tc2txq[i][tc]);
 }
 
-void mlx5e_ethtool_get_strings(struct mlx5e_priv *priv,
-			       uint32_t stringset, uint8_t *data)
+void mlx5e_ethtool_get_strings(struct mlx5e_priv *priv, u32 stringset, u8 *data)
 {
 	int i;
 
@@ -331,8 +330,7 @@ void mlx5e_ethtool_get_strings(struct mlx5e_priv *priv,
 	}
 }
 
-static void mlx5e_get_strings(struct net_device *dev,
-			      uint32_t stringset, uint8_t *data)
+static void mlx5e_get_strings(struct net_device *dev, u32 stringset, u8 *data)
 {
 	struct mlx5e_priv *priv = netdev_priv(dev);
 
drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c +1 -2
index dd49a59854e5..43c126c63955 100644
@@ -43,8 +43,7 @@ static void mlx5i_get_drvinfo(struct net_device *dev,
 		sizeof(drvinfo->driver));
 }
 
-static void mlx5i_get_strings(struct net_device *dev,
-			      uint32_t stringset, uint8_t *data)
+static void mlx5i_get_strings(struct net_device *dev, u32 stringset, u8 *data)
 {
 	struct mlx5e_priv *priv  = mlx5i_epriv(dev);
 
Signature · 1 line
2.13.0
#20 lore raw

PATCH 15/15 net/mlx5e: Use size_t to store byte offset in statistics descriptors

In reply to Saeed Mahameed

From: Gal Pressman <[email protected]>

The byte offset of counter descriptors should be stored in size_t variable instead of an integer.

---
 drivers/net/ethernet/mellanox/mlx5/core/en_stats.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en_stats.h +1 -1
index 40b5c73e5e26..6761796e803c 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 {
Signature · 1 line
2.13.0
#14 lore raw

RE: [net-next 11/15] net/mlx5e: Properly indent within conditional statements

In reply to Saeed Mahameed

From: Saeed Mahameed

Quoted 27 lines

Sent: 17 August 2017 14:30
To: David S. Miller
Cc: [email protected]; Leon Romanovsky; Or Gerlitz; Saeed Mahameed
Subject: [net-next 11/15] net/mlx5e: Properly indent within conditional statements

From: Or Gerlitz <[email protected]>

To fix these checkpatch complaints:

WARNING: suspect code indent for conditional statements (8, 24)

(quoted diff) +2 -0
+       if (eth_proto & (MLX5E_PROT_MASK(MLX5E_10GBASE_SR)
[...]
+                       return PORT_FIBRE;
---
 .../net/ethernet/mellanox/mlx5/core/en_ethtool.c   | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +0 -0
index a75ac4d11c5b..ed161312a773 100644
@@ -988,23 +988,23 @@ static u8 get_connector_port(u32 eth_proto, u8 connector_type)
 		return ptys2connector_type[connector_type];

drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c static u8 get_connector_port(u32 eth_proto, u8 connector_type) · line 994

Quoted 10 lines
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +4 -4
 
 	if (eth_proto & (MLX5E_PROT_MASK(MLX5E_10GBASE_SR)
-			 | MLX5E_PROT_MASK(MLX5E_40GBASE_SR4)
-			 | MLX5E_PROT_MASK(MLX5E_100GBASE_SR4)
-			 | MLX5E_PROT_MASK(MLX5E_1000BASE_CX_SGMII))) {
-			return PORT_FIBRE;
+	    | MLX5E_PROT_MASK(MLX5E_40GBASE_SR4)
+	    | MLX5E_PROT_MASK(MLX5E_100GBASE_SR4)
+	    | MLX5E_PROT_MASK(MLX5E_1000BASE_CX_SGMII))) {
+		return PORT_FIBRE;

Gah, that is why the rules are stupid.
If anything the continuation lines want indenting a few more bytes.

David

#15 lore raw

Re: [net-next 11/15] net/mlx5e: Properly indent within conditional statements

Quoted 29 lines · David Laight

From: Saeed Mahameed

Quoted 28 lines

Sent: 17 August 2017 14:30
To: David S. Miller
Cc: [email protected]; Leon Romanovsky; Or Gerlitz; Saeed Mahameed
Subject: [net-next 11/15] net/mlx5e: Properly indent within conditional statements

From: Or Gerlitz <[email protected]>

To fix these checkpatch complaints:

WARNING: suspect code indent for conditional statements (8, 24)

(quoted diff) +2 -0
+       if (eth_proto & (MLX5E_PROT_MASK(MLX5E_10GBASE_SR)
[...]
+                       return PORT_FIBRE;
---
 .../net/ethernet/mellanox/mlx5/core/en_ethtool.c   | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +0 -0
index a75ac4d11c5b..ed161312a773 100644
@@ -988,23 +988,23 @@ static u8 get_connector_port(u32 eth_proto, u8 connector_type)
              return ptys2connector_type[connector_type];
 
Quoted 13 lines

drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c static u8 get_connector_port(u32 eth_proto, u8 connector_type) · line 994

Quoted 9 lines
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +4 -4
      if (eth_proto & (MLX5E_PROT_MASK(MLX5E_10GBASE_SR)
-                      | MLX5E_PROT_MASK(MLX5E_40GBASE_SR4)
-                      | MLX5E_PROT_MASK(MLX5E_100GBASE_SR4)
-                      | MLX5E_PROT_MASK(MLX5E_1000BASE_CX_SGMII))) {
-                     return PORT_FIBRE;
+         | MLX5E_PROT_MASK(MLX5E_40GBASE_SR4)
+         | MLX5E_PROT_MASK(MLX5E_100GBASE_SR4)
+         | MLX5E_PROT_MASK(MLX5E_1000BASE_CX_SGMII))) {
+             return PORT_FIBRE;

Gah, that is why the rules are stupid.
If anything the continuation lines want indenting a few more bytes.

Totally agree,
But if Or wants to follow the rules, I won't stand in his way :).

Quoted 2 lines

David

maintainer
#16 lore raw

Re: [net-next 11/15] net/mlx5e: Properly indent within conditional statements

In reply to David Laight

From: David Laight <[email protected]>
Date: Thu, 17 Aug 2017 14:18:29 +0000

Quoted 29 lines

From: Saeed Mahameed

Quoted 28 lines

Sent: 17 August 2017 14:30
To: David S. Miller
Cc: [email protected]; Leon Romanovsky; Or Gerlitz; Saeed Mahameed
Subject: [net-next 11/15] net/mlx5e: Properly indent within conditional statements

From: Or Gerlitz <[email protected]>

To fix these checkpatch complaints:

WARNING: suspect code indent for conditional statements (8, 24)

(quoted diff) +2 -0
+       if (eth_proto & (MLX5E_PROT_MASK(MLX5E_10GBASE_SR)
[...]
+                       return PORT_FIBRE;
---
 .../net/ethernet/mellanox/mlx5/core/en_ethtool.c   | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +0 -0
index a75ac4d11c5b..ed161312a773 100644
@@ -988,23 +988,23 @@ static u8 get_connector_port(u32 eth_proto, u8 connector_type)
 		return ptys2connector_type[connector_type];
 
Quoted 12 lines

drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c static u8 get_connector_port(u32 eth_proto, u8 connector_type) · line 994

Quoted 9 lines
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +4 -4
 	if (eth_proto & (MLX5E_PROT_MASK(MLX5E_10GBASE_SR)
-			 | MLX5E_PROT_MASK(MLX5E_40GBASE_SR4)
-			 | MLX5E_PROT_MASK(MLX5E_100GBASE_SR4)
-			 | MLX5E_PROT_MASK(MLX5E_1000BASE_CX_SGMII))) {
-			return PORT_FIBRE;
+	    | MLX5E_PROT_MASK(MLX5E_40GBASE_SR4)
+	    | MLX5E_PROT_MASK(MLX5E_100GBASE_SR4)
+	    | MLX5E_PROT_MASK(MLX5E_1000BASE_CX_SGMII))) {
+		return PORT_FIBRE;

Gah, that is why the rules are stupid.
If anything the continuation lines want indenting a few more bytes.

And in fact, operators should be at the end rather the beginning of lines. This statement therefore must be formatted like this:

	if (x & (A |
		 B |
		 C |
		 C))

The indentation shows the grouping, therefore each line after the first must start exactly at the column after the inner openning parenthesis.

Please fix this properly.

#11 lore raw

Re: [net-next 10/15] net/mlx5: Add a blank line after declarations

In reply to Saeed Mahameed
Quoted 1 line · Saeed Mahameed

From: Or Gerlitz <[email protected]>

[]

drivers/net/ethernet/mellanox/mlx5/core/eq.c

Quoted 1 line
drivers/net/ethernet/mellanox/mlx5/core/eq.c +0 -0

[]

drivers/net/ethernet/mellanox/mlx5/core/eq.c static enum mlx5_dev_event port_subtype_event(u8 subtype) · line 194

Quoted 8 lines
drivers/net/ethernet/mellanox/mlx5/core/eq.c +1 -0
@@ -188,6 +188,7 @@ static enum mlx5_dev_event port_subtype_event(u8 subtype)
 static void eq_update_ci(struct mlx5_eq *eq, int arm)
 {
 	__be32 __iomem *addr = eq->doorbell + (arm ? 0 : 2);
+
 	u32 val = (eq->cons_index & 0xffffff) | (eq->eqn << 24);
 	__raw_writel((__force u32)cpu_to_be32(val), addr);
 	/* We still want ordering, just not swabbing, so add a barrier */

checkpatch is stupid.

The blank line should be after u32 val = ...
and not after __be32 __iomem *addr = ...

#12 lore raw

Re: [net-next 10/15] net/mlx5: Add a blank line after declarations

Quoted 16 lines · Joe Perches
Quoted 1 line · Saeed Mahameed

From: Or Gerlitz <[email protected]>

[]

drivers/net/ethernet/mellanox/mlx5/core/eq.c

Quoted 1 line
drivers/net/ethernet/mellanox/mlx5/core/eq.c +0 -0

[]

drivers/net/ethernet/mellanox/mlx5/core/eq.c static enum mlx5_dev_event port_subtype_event(u8 subtype) · line 194

Quoted 8 lines
drivers/net/ethernet/mellanox/mlx5/core/eq.c +1 -0
@@ -188,6 +188,7 @@ static enum mlx5_dev_event port_subtype_event(u8 subtype)
 static void eq_update_ci(struct mlx5_eq *eq, int arm)
 {
      __be32 __iomem *addr = eq->doorbell + (arm ? 0 : 2);
+
      u32 val = (eq->cons_index & 0xffffff) | (eq->eqn << 24);
      __raw_writel((__force u32)cpu_to_be32(val), addr);
      /* We still want ordering, just not swabbing, so add a barrier */

checkpatch is stupid.

Quoted 4 lines

The blank line should be after u32 val = ...
and not after __be32 __iomem *addr = ...

You are completely right ! will fix this, Thanks !