All of lore.kernel.org
 help / color / mirror / Atom feed
* [pull request][net-next 0/7] Mellanox mlx5 updates 2017-04-16
@ 2017-04-07 18:26 Saeed Mahameed
  2017-04-07 18:26 ` [net-next 1/7] net/mlx5: Update the list of the PCI supported devices Saeed Mahameed
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Saeed Mahameed @ 2017-04-07 18:26 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Saeed Mahameed

Hi Dave,

The following changes provide some small features and updates to the mlx5
driver.

For more information please see below.

Please pull and let me know if there's any problem.

Thanks,
Saeed.

---

The following changes since commit bd414860440eebc8a7eb54be94c97e6ed09bb402:

  Merge tag 'batadv-next-for-davem-20170406' of git://git.open-mesh.org/linux-merge (2017-04-06 14:37:50 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-updates-2017-04-16

for you to fetch changes up to 457fcd8a11f7f7f2483b2366d8a98f269c085302:

  net/mlx5e: Set default RX moderation parameters on driver load (2017-04-07 01:21:28 +0300)

----------------------------------------------------------------
mlx5-updates-2017-04-16

This patchset provides some updates for the mlx5 drivers.

>From Majd,
1st patch, Adds ConnectX-6 and ConnectX-6 VF PCI IDs support.

>From Guy,
2nd patch, Adds RXFCS scatter support.
3rd patch, Small cleanup to make a function static.

>From Eran,
4th patch, Adds 4 zeros padding to ethtool FW version.
6th patch, Trevial code reuse cleanup

>From Inbar,
5th patch, Show board id in ethtool driver information

>From Saeed,
7th patch, Set default RX moderation parameters on driver load
as a small fix for the latest fail-safe config feature.

Thanks,
Saeed.

----------------------------------------------------------------
Eran Ben Elisha (2):
      net/mlx5e: Change FW sub_minor display to 4 zeros padding
      net/mlx5e: Reuse alloc cq code for all CQs allocation

Guy Ergas (2):
      net/mlx5e: Add support for RXFCS feature flag
      net/mlx5e: Make mlx5e_modify_rqs_vsd a static function

Inbar Karmy (1):
      net/mlx5e: Show board id in ethtool driver information

Majd Dibbiny (1):
      net/mlx5: Update the list of the PCI supported devices

Saeed Mahameed (1):
      net/mlx5e: Set default RX moderation parameters on driver load

 drivers/net/ethernet/mellanox/mlx5/core/en.h       |   3 +-
 .../net/ethernet/mellanox/mlx5/core/en_ethtool.c   |   5 +-
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c  | 140 +++++++++++++++------
 drivers/net/ethernet/mellanox/mlx5/core/main.c     |   6 +-
 include/linux/mlx5/mlx5_ifc.h                      |   1 +
 5 files changed, 108 insertions(+), 47 deletions(-)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [net-next 1/7] net/mlx5: Update the list of the PCI supported devices
  2017-04-07 18:26 [pull request][net-next 0/7] Mellanox mlx5 updates 2017-04-16 Saeed Mahameed
@ 2017-04-07 18:26 ` Saeed Mahameed
  2017-04-07 18:26 ` [net-next 2/7] net/mlx5e: Add support for RXFCS feature flag Saeed Mahameed
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Saeed Mahameed @ 2017-04-07 18:26 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Majd Dibbiny, Saeed Mahameed

From: Majd Dibbiny <majd@mellanox.com>

Rename the ConnectX-5 PCIe 4.0 to be ConnectX-5 Ex.
Also add the upcoming ConnectX-6 and it's VF IDs to the list.

Signed-off-by: Majd Dibbiny <majd@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index 60154a175bd3..9c2bec732af9 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -1514,8 +1514,10 @@ static const struct pci_device_id mlx5_core_pci_table[] = {
 	{ PCI_VDEVICE(MELLANOX, 0x1016), MLX5_PCI_DEV_IS_VF},	/* ConnectX-4LX VF */
 	{ PCI_VDEVICE(MELLANOX, 0x1017) },			/* ConnectX-5, PCIe 3.0 */
 	{ PCI_VDEVICE(MELLANOX, 0x1018), MLX5_PCI_DEV_IS_VF},	/* ConnectX-5 VF */
-	{ PCI_VDEVICE(MELLANOX, 0x1019) },			/* ConnectX-5, PCIe 4.0 */
-	{ PCI_VDEVICE(MELLANOX, 0x101a), MLX5_PCI_DEV_IS_VF},	/* ConnectX-5, PCIe 4.0 VF */
+	{ PCI_VDEVICE(MELLANOX, 0x1019) },			/* ConnectX-5 Ex */
+	{ PCI_VDEVICE(MELLANOX, 0x101a), MLX5_PCI_DEV_IS_VF},	/* ConnectX-5 Ex VF */
+	{ PCI_VDEVICE(MELLANOX, 0x101b) },			/* ConnectX-6 */
+	{ PCI_VDEVICE(MELLANOX, 0x101c), MLX5_PCI_DEV_IS_VF},	/* ConnectX-6 VF */
 	{ 0, }
 };
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [net-next 2/7] net/mlx5e: Add support for RXFCS feature flag
  2017-04-07 18:26 [pull request][net-next 0/7] Mellanox mlx5 updates 2017-04-16 Saeed Mahameed
  2017-04-07 18:26 ` [net-next 1/7] net/mlx5: Update the list of the PCI supported devices Saeed Mahameed
@ 2017-04-07 18:26 ` Saeed Mahameed
  2017-04-07 18:26 ` [net-next 3/7] net/mlx5e: Make mlx5e_modify_rqs_vsd a static function Saeed Mahameed
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Saeed Mahameed @ 2017-04-07 18:26 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Guy Ergas, Saeed Mahameed

From: Guy Ergas <guye@mellanox.com>

Add support for rx-fcs flag from ethtool.
In case this flag is set, update all RQs to scatter the FCS data into
the packet.

Signed-off-by: Guy Ergas <guye@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en.h      |  1 +
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 71 +++++++++++++++++++++++
 include/linux/mlx5/mlx5_ifc.h                     |  1 +
 3 files changed, 73 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h
index 150fb52a0737..a58031da7fad 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
@@ -221,6 +221,7 @@ struct mlx5e_params {
 	u8  toeplitz_hash_key[40];
 	u32 indirection_rqt[MLX5E_INDIR_RQT_SIZE];
 	bool vlan_strip_disable;
+	bool scatter_fcs_en;
 	bool rx_am_enabled;
 	u32 lro_timeout;
 	u32 pflags;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index d5248637d44f..83796ce17fc3 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -760,6 +760,37 @@ static int mlx5e_modify_rq_state(struct mlx5e_rq *rq, int curr_state,
 	return err;
 }
 
+static int mlx5e_modify_rq_scatter_fcs(struct mlx5e_rq *rq, bool enable)
+{
+	struct mlx5e_channel *c = rq->channel;
+	struct mlx5e_priv *priv = c->priv;
+	struct mlx5_core_dev *mdev = priv->mdev;
+
+	void *in;
+	void *rqc;
+	int inlen;
+	int err;
+
+	inlen = MLX5_ST_SZ_BYTES(modify_rq_in);
+	in = mlx5_vzalloc(inlen);
+	if (!in)
+		return -ENOMEM;
+
+	rqc = MLX5_ADDR_OF(modify_rq_in, in, ctx);
+
+	MLX5_SET(modify_rq_in, in, rq_state, MLX5_RQC_STATE_RDY);
+	MLX5_SET64(modify_rq_in, in, modify_bitmask,
+		   MLX5_MODIFY_RQ_IN_MODIFY_BITMASK_SCATTER_FCS);
+	MLX5_SET(rqc, rqc, scatter_fcs, enable);
+	MLX5_SET(rqc, rqc, state, MLX5_RQC_STATE_RDY);
+
+	err = mlx5_core_modify_rq(mdev, rq->rqn, in, inlen);
+
+	kvfree(in);
+
+	return err;
+}
+
 static int mlx5e_modify_rq_vsd(struct mlx5e_rq *rq, bool vsd)
 {
 	struct mlx5e_channel *c = rq->channel;
@@ -1834,6 +1865,7 @@ static void mlx5e_build_rq_param(struct mlx5e_priv *priv,
 	MLX5_SET(wq, wq, pd,               priv->mdev->mlx5e_res.pdn);
 	MLX5_SET(rqc, rqc, counter_set_id, priv->q_counter);
 	MLX5_SET(rqc, rqc, vsd,            params->vlan_strip_disable);
+	MLX5_SET(rqc, rqc, scatter_fcs,    params->scatter_fcs_en);
 
 	param->wq.buf_numa_node = dev_to_node(&priv->mdev->pdev->dev);
 	param->wq.linear = 1;
@@ -2904,6 +2936,20 @@ void mlx5e_destroy_direct_tirs(struct mlx5e_priv *priv)
 		mlx5e_destroy_tir(priv->mdev, &priv->direct_tir[i]);
 }
 
+static int mlx5e_modify_channels_scatter_fcs(struct mlx5e_channels *chs, bool enable)
+{
+	int err = 0;
+	int i;
+
+	for (i = 0; i < chs->num; i++) {
+		err = mlx5e_modify_rq_scatter_fcs(&chs->c[i]->rq, enable);
+		if (err)
+			return err;
+	}
+
+	return 0;
+}
+
 int mlx5e_modify_channels_vsd(struct mlx5e_channels *chs, bool vsd)
 {
 	int err = 0;
@@ -3121,6 +3167,23 @@ static int set_feature_rx_all(struct net_device *netdev, bool enable)
 	return mlx5_set_port_fcs(mdev, !enable);
 }
 
+static int set_feature_rx_fcs(struct net_device *netdev, bool enable)
+{
+	struct mlx5e_priv *priv = netdev_priv(netdev);
+	int err;
+
+	mutex_lock(&priv->state_lock);
+
+	priv->channels.params.scatter_fcs_en = enable;
+	err = mlx5e_modify_channels_scatter_fcs(&priv->channels, enable);
+	if (err)
+		priv->channels.params.scatter_fcs_en = !enable;
+
+	mutex_unlock(&priv->state_lock);
+
+	return err;
+}
+
 static int set_feature_rx_vlan(struct net_device *netdev, bool enable)
 {
 	struct mlx5e_priv *priv = netdev_priv(netdev);
@@ -3194,6 +3257,8 @@ static int mlx5e_set_features(struct net_device *netdev,
 				    set_feature_tc_num_filters);
 	err |= mlx5e_handle_feature(netdev, features, NETIF_F_RXALL,
 				    set_feature_rx_all);
+	err |= mlx5e_handle_feature(netdev, features, NETIF_F_RXFCS,
+				    set_feature_rx_fcs);
 	err |= mlx5e_handle_feature(netdev, features, NETIF_F_HW_VLAN_CTAG_RX,
 				    set_feature_rx_vlan);
 #ifdef CONFIG_RFS_ACCEL
@@ -3908,6 +3973,9 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
 	if (fcs_supported)
 		netdev->hw_features |= NETIF_F_RXALL;
 
+	if (MLX5_CAP_ETH(mdev, scatter_fcs))
+		netdev->hw_features |= NETIF_F_RXFCS;
+
 	netdev->features          = netdev->hw_features;
 	if (!priv->channels.params.lro_en)
 		netdev->features  &= ~NETIF_F_LRO;
@@ -3915,6 +3983,9 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
 	if (fcs_enabled)
 		netdev->features  &= ~NETIF_F_RXALL;
 
+	if (!priv->channels.params.scatter_fcs_en)
+		netdev->features  &= ~NETIF_F_RXFCS;
+
 #define FT_CAP(f) MLX5_CAP_FLOWTABLE(mdev, flow_table_properties_nic_receive.f)
 	if (FT_CAP(flow_modify_en) &&
 	    FT_CAP(modify_root) &&
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index 56bc842b0620..1993adbd2c82 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -5122,6 +5122,7 @@ struct mlx5_ifc_modify_rq_out_bits {
 
 enum {
 	MLX5_MODIFY_RQ_IN_MODIFY_BITMASK_VSD = 1ULL << 1,
+	MLX5_MODIFY_RQ_IN_MODIFY_BITMASK_SCATTER_FCS = 1ULL << 2,
 	MLX5_MODIFY_RQ_IN_MODIFY_BITMASK_RQ_COUNTER_SET_ID = 1ULL << 3,
 };
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [net-next 3/7] net/mlx5e: Make mlx5e_modify_rqs_vsd a static function
  2017-04-07 18:26 [pull request][net-next 0/7] Mellanox mlx5 updates 2017-04-16 Saeed Mahameed
  2017-04-07 18:26 ` [net-next 1/7] net/mlx5: Update the list of the PCI supported devices Saeed Mahameed
  2017-04-07 18:26 ` [net-next 2/7] net/mlx5e: Add support for RXFCS feature flag Saeed Mahameed
@ 2017-04-07 18:26 ` Saeed Mahameed
  2017-04-07 18:26 ` [net-next 4/7] net/mlx5e: Change FW sub_minor display to 4 zeros padding Saeed Mahameed
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Saeed Mahameed @ 2017-04-07 18:26 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Guy Ergas, Saeed Mahameed

From: Guy Ergas <guye@mellanox.com>

Make mlx5e_modify_rqs_vsd a static function and remove from en.h in
order to reduce redundant exposure of functions.

Signed-off-by: Guy Ergas <guye@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en.h      | 2 --
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h
index a58031da7fad..b7feecfbb5a5 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
@@ -843,8 +843,6 @@ int mlx5e_vlan_rx_kill_vid(struct net_device *dev, __always_unused __be16 proto,
 void mlx5e_enable_vlan_filter(struct mlx5e_priv *priv);
 void mlx5e_disable_vlan_filter(struct mlx5e_priv *priv);
 
-int mlx5e_modify_channels_vsd(struct mlx5e_channels *chs, bool vsd);
-
 struct mlx5e_redirect_rqt_param {
 	bool is_rss;
 	union {
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 83796ce17fc3..b57a6e72cc86 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -2950,7 +2950,7 @@ static int mlx5e_modify_channels_scatter_fcs(struct mlx5e_channels *chs, bool en
 	return 0;
 }
 
-int mlx5e_modify_channels_vsd(struct mlx5e_channels *chs, bool vsd)
+static int mlx5e_modify_channels_vsd(struct mlx5e_channels *chs, bool vsd)
 {
 	int err = 0;
 	int i;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [net-next 4/7] net/mlx5e: Change FW sub_minor display to 4 zeros padding
  2017-04-07 18:26 [pull request][net-next 0/7] Mellanox mlx5 updates 2017-04-16 Saeed Mahameed
                   ` (2 preceding siblings ...)
  2017-04-07 18:26 ` [net-next 3/7] net/mlx5e: Make mlx5e_modify_rqs_vsd a static function Saeed Mahameed
@ 2017-04-07 18:26 ` Saeed Mahameed
  2017-04-07 18:26 ` [net-next 5/7] net/mlx5e: Show board id in ethtool driver information Saeed Mahameed
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Saeed Mahameed @ 2017-04-07 18:26 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Eran Ben Elisha, Saeed Mahameed

From: Eran Ben Elisha <eranbe@mellanox.com>

FW version should be reported as X.Y.ZZZZ, add leading zeroes to sub
minor in order to fix it.

Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
index af039b6c0799..167a8379156e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
@@ -42,7 +42,7 @@ static void mlx5e_get_drvinfo(struct net_device *dev,
 	strlcpy(drvinfo->version, DRIVER_VERSION " (" DRIVER_RELDATE ")",
 		sizeof(drvinfo->version));
 	snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
-		 "%d.%d.%d",
+		 "%d.%d.%04d",
 		 fw_rev_maj(mdev), fw_rev_min(mdev), fw_rev_sub(mdev));
 	strlcpy(drvinfo->bus_info, pci_name(mdev->pdev),
 		sizeof(drvinfo->bus_info));
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [net-next 5/7] net/mlx5e: Show board id in ethtool driver information
  2017-04-07 18:26 [pull request][net-next 0/7] Mellanox mlx5 updates 2017-04-16 Saeed Mahameed
                   ` (3 preceding siblings ...)
  2017-04-07 18:26 ` [net-next 4/7] net/mlx5e: Change FW sub_minor display to 4 zeros padding Saeed Mahameed
@ 2017-04-07 18:26 ` Saeed Mahameed
  2017-04-07 18:26 ` [net-next 6/7] net/mlx5e: Reuse alloc cq code for all CQs allocation Saeed Mahameed
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Saeed Mahameed @ 2017-04-07 18:26 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Inbar Karmy, Saeed Mahameed

From: Inbar Karmy <inbark@mellanox.com>

Add the board id (PSID) to the firmware-version field
in the ethtool -i (driver information).
The PSID is shown in parentheses, next to the fw-version.

$ ethtool -i ens6
firmware-version: 12.14.1101 (MT_2190110032)

Signed-off-by: Inbar Karmy <inbark@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
index 167a8379156e..ce7b09d72ff6 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
@@ -42,8 +42,9 @@ static void mlx5e_get_drvinfo(struct net_device *dev,
 	strlcpy(drvinfo->version, DRIVER_VERSION " (" DRIVER_RELDATE ")",
 		sizeof(drvinfo->version));
 	snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
-		 "%d.%d.%04d",
-		 fw_rev_maj(mdev), fw_rev_min(mdev), fw_rev_sub(mdev));
+		 "%d.%d.%04d (%.16s)",
+		 fw_rev_maj(mdev), fw_rev_min(mdev), fw_rev_sub(mdev),
+		 mdev->board_id);
 	strlcpy(drvinfo->bus_info, pci_name(mdev->pdev),
 		sizeof(drvinfo->bus_info));
 }
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [net-next 6/7] net/mlx5e: Reuse alloc cq code for all CQs allocation
  2017-04-07 18:26 [pull request][net-next 0/7] Mellanox mlx5 updates 2017-04-16 Saeed Mahameed
                   ` (4 preceding siblings ...)
  2017-04-07 18:26 ` [net-next 5/7] net/mlx5e: Show board id in ethtool driver information Saeed Mahameed
@ 2017-04-07 18:26 ` Saeed Mahameed
  2017-04-07 18:26 ` [net-next 7/7] net/mlx5e: Set default RX moderation parameters on driver load Saeed Mahameed
  2017-04-08 13:23 ` [pull request][net-next 0/7] Mellanox mlx5 updates 2017-04-16 David Miller
  7 siblings, 0 replies; 9+ messages in thread
From: Saeed Mahameed @ 2017-04-07 18:26 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Eran Ben Elisha, Saeed Mahameed

From: Eran Ben Elisha <eranbe@mellanox.com>

Reuse the code for mlx5e_alloc_cq and mlx5e_alloc_drop_cq, as they
have a similar flow.

Prior to this patch, the CQEs in the "drop CQ" were not initialized,
fixed
it with the shared flow of alloc CQ.  This is not a critical bug as the
RQ connected to this CQ never moved to RTS, but still better to have
this right.

Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 59 +++++++++--------------
 1 file changed, 23 insertions(+), 36 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index b57a6e72cc86..57844ffca37f 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -1419,21 +1419,16 @@ static void mlx5e_close_xdpsq(struct mlx5e_xdpsq *sq)
 	mlx5e_free_xdpsq(sq);
 }
 
-static int mlx5e_alloc_cq(struct mlx5e_channel *c,
-			  struct mlx5e_cq_param *param,
-			  struct mlx5e_cq *cq)
+static int mlx5e_alloc_cq_common(struct mlx5_core_dev *mdev,
+				 struct mlx5e_cq_param *param,
+				 struct mlx5e_cq *cq)
 {
-	struct mlx5_core_dev *mdev = c->mdev;
 	struct mlx5_core_cq *mcq = &cq->mcq;
 	int eqn_not_used;
 	unsigned int irqn;
 	int err;
 	u32 i;
 
-	param->wq.buf_numa_node = cpu_to_node(c->cpu);
-	param->wq.db_numa_node  = cpu_to_node(c->cpu);
-	param->eq_ix   = c->ix;
-
 	err = mlx5_cqwq_create(mdev, &param->wq, param->cqc, &cq->wq,
 			       &cq->wq_ctrl);
 	if (err)
@@ -1441,8 +1436,6 @@ static int mlx5e_alloc_cq(struct mlx5e_channel *c,
 
 	mlx5_vector2eqn(mdev, param->eq_ix, &eqn_not_used, &irqn);
 
-	cq->napi        = &c->napi;
-
 	mcq->cqe_sz     = 64;
 	mcq->set_ci_db  = cq->wq_ctrl.db.db;
 	mcq->arm_db     = cq->wq_ctrl.db.db + 1;
@@ -1459,12 +1452,30 @@ static int mlx5e_alloc_cq(struct mlx5e_channel *c,
 		cqe->op_own = 0xf1;
 	}
 
-	cq->channel = c;
 	cq->mdev = mdev;
 
 	return 0;
 }
 
+static int mlx5e_alloc_cq(struct mlx5e_channel *c,
+			  struct mlx5e_cq_param *param,
+			  struct mlx5e_cq *cq)
+{
+	struct mlx5_core_dev *mdev = c->priv->mdev;
+	int err;
+
+	param->wq.buf_numa_node = cpu_to_node(c->cpu);
+	param->wq.db_numa_node  = cpu_to_node(c->cpu);
+	param->eq_ix   = c->ix;
+
+	err = mlx5e_alloc_cq_common(mdev, param, cq);
+
+	cq->napi    = &c->napi;
+	cq->channel = c;
+
+	return err;
+}
+
 static void mlx5e_free_cq(struct mlx5e_cq *cq)
 {
 	mlx5_cqwq_destroy(&cq->wq_ctrl);
@@ -2697,31 +2708,7 @@ static int mlx5e_alloc_drop_cq(struct mlx5_core_dev *mdev,
 			       struct mlx5e_cq *cq,
 			       struct mlx5e_cq_param *param)
 {
-	struct mlx5_core_cq *mcq = &cq->mcq;
-	int eqn_not_used;
-	unsigned int irqn;
-	int err;
-
-	err = mlx5_cqwq_create(mdev, &param->wq, param->cqc, &cq->wq,
-			       &cq->wq_ctrl);
-	if (err)
-		return err;
-
-	mlx5_vector2eqn(mdev, param->eq_ix, &eqn_not_used, &irqn);
-
-	mcq->cqe_sz     = 64;
-	mcq->set_ci_db  = cq->wq_ctrl.db.db;
-	mcq->arm_db     = cq->wq_ctrl.db.db + 1;
-	*mcq->set_ci_db = 0;
-	*mcq->arm_db    = 0;
-	mcq->vector     = param->eq_ix;
-	mcq->comp       = mlx5e_completion_event;
-	mcq->event      = mlx5e_cq_error_event;
-	mcq->irqn       = irqn;
-
-	cq->mdev = mdev;
-
-	return 0;
+	return mlx5e_alloc_cq_common(mdev, param, cq);
 }
 
 static int mlx5e_open_drop_rq(struct mlx5_core_dev *mdev,
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [net-next 7/7] net/mlx5e: Set default RX moderation parameters on driver load
  2017-04-07 18:26 [pull request][net-next 0/7] Mellanox mlx5 updates 2017-04-16 Saeed Mahameed
                   ` (5 preceding siblings ...)
  2017-04-07 18:26 ` [net-next 6/7] net/mlx5e: Reuse alloc cq code for all CQs allocation Saeed Mahameed
@ 2017-04-07 18:26 ` Saeed Mahameed
  2017-04-08 13:23 ` [pull request][net-next 0/7] Mellanox mlx5 updates 2017-04-16 David Miller
  7 siblings, 0 replies; 9+ messages in thread
From: Saeed Mahameed @ 2017-04-07 18:26 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Saeed Mahameed

RX moderation default parameters shouldn't be set in
mlx5e_build_rx_cq_param since it would reset the values every time on
netdev open/close.  Instead, it should be set in
mlx5e_set_rx_cq_mode_params which is called on driver load only.

Fixes: 6a9764efb255 ("net/mlx5e: Isolate open_channels from priv->params")
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 57844ffca37f..8b7b7e604ea0 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -1944,10 +1944,6 @@ static void mlx5e_build_rx_cq_param(struct mlx5e_priv *priv,
 	}
 
 	mlx5e_build_common_cq_param(priv, param);
-
-	if (params->rx_am_enabled)
-		params->rx_cq_moderation =
-			mlx5e_am_get_def_profile(params->rx_cq_period_mode);
 }
 
 static void mlx5e_build_tx_cq_param(struct mlx5e_priv *priv,
@@ -3787,6 +3783,10 @@ void mlx5e_set_rx_cq_mode_params(struct mlx5e_params *params, u8 cq_period_mode)
 		params->rx_cq_moderation.usec =
 			MLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_USEC_FROM_CQE;
 
+	if (params->rx_am_enabled)
+		params->rx_cq_moderation =
+			mlx5e_am_get_def_profile(params->rx_cq_period_mode);
+
 	MLX5E_SET_PFLAG(params, MLX5E_PFLAG_RX_CQE_BASED_MODER,
 			params->rx_cq_period_mode == MLX5_CQ_PERIOD_MODE_START_FROM_CQE);
 }
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [pull request][net-next 0/7] Mellanox mlx5 updates 2017-04-16
  2017-04-07 18:26 [pull request][net-next 0/7] Mellanox mlx5 updates 2017-04-16 Saeed Mahameed
                   ` (6 preceding siblings ...)
  2017-04-07 18:26 ` [net-next 7/7] net/mlx5e: Set default RX moderation parameters on driver load Saeed Mahameed
@ 2017-04-08 13:23 ` David Miller
  7 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2017-04-08 13:23 UTC (permalink / raw)
  To: saeedm; +Cc: netdev

From: Saeed Mahameed <saeedm@mellanox.com>
Date: Fri,  7 Apr 2017 21:26:49 +0300

> The following changes provide some small features and updates to the mlx5
> driver.
> 
> For more information please see below.
> 
> Please pull and let me know if there's any problem.

Pulled, thanks.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-04-08 13:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-07 18:26 [pull request][net-next 0/7] Mellanox mlx5 updates 2017-04-16 Saeed Mahameed
2017-04-07 18:26 ` [net-next 1/7] net/mlx5: Update the list of the PCI supported devices Saeed Mahameed
2017-04-07 18:26 ` [net-next 2/7] net/mlx5e: Add support for RXFCS feature flag Saeed Mahameed
2017-04-07 18:26 ` [net-next 3/7] net/mlx5e: Make mlx5e_modify_rqs_vsd a static function Saeed Mahameed
2017-04-07 18:26 ` [net-next 4/7] net/mlx5e: Change FW sub_minor display to 4 zeros padding Saeed Mahameed
2017-04-07 18:26 ` [net-next 5/7] net/mlx5e: Show board id in ethtool driver information Saeed Mahameed
2017-04-07 18:26 ` [net-next 6/7] net/mlx5e: Reuse alloc cq code for all CQs allocation Saeed Mahameed
2017-04-07 18:26 ` [net-next 7/7] net/mlx5e: Set default RX moderation parameters on driver load Saeed Mahameed
2017-04-08 13:23 ` [pull request][net-next 0/7] Mellanox mlx5 updates 2017-04-16 David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.