* [PATCH net-next V1 00/10] mlx5 driver updates
@ 2016-02-28 15:09 Saeed Mahameed
2016-02-28 15:09 ` [PATCH net-next V1 01/10] net/mlx5e: Replace async events spinlock with synchronize_irq() Saeed Mahameed
` (9 more replies)
0 siblings, 10 replies; 13+ messages in thread
From: Saeed Mahameed @ 2016-02-28 15:09 UTC (permalink / raw)
To: David S. Miller
Cc: netdev, Or Gerlitz, Eran Ben Elisha, Tal Alon, Majd Dibbiny,
Saeed Mahameed
Hi Dave,
This series includes some bug fixes and updates for the mlx5 core
and ethernet driver.
>From Gal, two fixes that protects the update CQ moderation flows
when it is not allowed.
>From Moshe, two fixes for the core and ethernet driver in
non-cached(NC) and write combining(WC) buffers mappings,
which prevents the driver from double memory mappings.
>From Or, reduce the firmware command completion timeout.
>From Tariq, several small trivial fixes.
Changes from v0:
- "Fix global UAR mapping" commit messages updated to explain ARCH_HAS_IOREMAP_WC usage.
- rebased to commit 8d3f2806f8fb 'Merge branch ethtool-ksettings'
Thanks,
Saeed
Gal Pressman (2):
net/mlx5e: Don't try to modify CQ moderation if it is not supported
net/mlx5e: Don't modify CQ before it was created
Moshe Lazer (2):
net/mlx5: Fix global UAR mapping
net/mlx5: Avoid double mapping of io mapped memory
Or Gerlitz (1):
net/mlx5: Make command timeout way shorter
Tariq Toukan (5):
net/mlx5e: Replace async events spinlock with synchronize_irq()
net/mlx5e: Placement changed for carrier state updates
net/mlx5e: Changed naming convention of tx queues in ethtool stats
net/mlx5e: Move common case counters within sq_stats struct
net/mlx5e: Set drop RQ's necessary parameters only
drivers/net/ethernet/mellanox/mlx5/core/en.h | 27 ++++-----
.../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 27 ++++++--
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 64 ++++++++++---------
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 2 +-
drivers/net/ethernet/mellanox/mlx5/core/eq.c | 5 ++
drivers/net/ethernet/mellanox/mlx5/core/main.c | 28 +--------
.../net/ethernet/mellanox/mlx5/core/mlx5_core.h | 1 +
drivers/net/ethernet/mellanox/mlx5/core/uar.c | 31 ++++++----
include/linux/mlx5/driver.h | 7 +-
9 files changed, 97 insertions(+), 95 deletions(-)
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH net-next V1 01/10] net/mlx5e: Replace async events spinlock with synchronize_irq()
2016-02-28 15:09 [PATCH net-next V1 00/10] mlx5 driver updates Saeed Mahameed
@ 2016-02-28 15:09 ` Saeed Mahameed
2016-02-28 15:09 ` [PATCH net-next V1 02/10] net/mlx5e: Placement changed for carrier state updates Saeed Mahameed
` (8 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Saeed Mahameed @ 2016-02-28 15:09 UTC (permalink / raw)
To: David S. Miller
Cc: netdev, Or Gerlitz, Eran Ben Elisha, Tal Alon, Majd Dibbiny,
Tariq Toukan, Saeed Mahameed
From: Tariq Toukan <tariqt@mellanox.com>
We only need to flush the irq handler to make sure it does not
queue a work into the global work queue after we start to flush it.
So using synchronize_irq() is more appropriate than a spin lock.
Signed-off-by: Tariq Toukan <tariqt@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 | 24 ++++++-------------
drivers/net/ethernet/mellanox/mlx5/core/eq.c | 5 ++++
.../net/ethernet/mellanox/mlx5/core/mlx5_core.h | 1 +
4 files changed, 14 insertions(+), 17 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h
index 1dca3dc..4511984 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
@@ -555,7 +555,6 @@ struct mlx5e_priv {
struct mlx5e_vxlan_db vxlan;
struct mlx5e_params params;
- spinlock_t async_events_spinlock; /* sync hw events */
struct work_struct update_carrier_work;
struct work_struct set_rx_mode_work;
struct delayed_work update_stats_work;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 0d45f35..38944b8 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -275,9 +275,14 @@ static void mlx5e_update_stats_work(struct work_struct *work)
mutex_unlock(&priv->state_lock);
}
-static void __mlx5e_async_event(struct mlx5e_priv *priv,
- enum mlx5_dev_event event)
+static void mlx5e_async_event(struct mlx5_core_dev *mdev, void *vpriv,
+ enum mlx5_dev_event event, unsigned long param)
{
+ struct mlx5e_priv *priv = vpriv;
+
+ if (!test_bit(MLX5E_STATE_ASYNC_EVENTS_ENABLE, &priv->state))
+ return;
+
switch (event) {
case MLX5_DEV_EVENT_PORT_UP:
case MLX5_DEV_EVENT_PORT_DOWN:
@@ -289,17 +294,6 @@ static void __mlx5e_async_event(struct mlx5e_priv *priv,
}
}
-static void mlx5e_async_event(struct mlx5_core_dev *mdev, void *vpriv,
- enum mlx5_dev_event event, unsigned long param)
-{
- struct mlx5e_priv *priv = vpriv;
-
- spin_lock(&priv->async_events_spinlock);
- if (test_bit(MLX5E_STATE_ASYNC_EVENTS_ENABLE, &priv->state))
- __mlx5e_async_event(priv, event);
- spin_unlock(&priv->async_events_spinlock);
-}
-
static void mlx5e_enable_async_events(struct mlx5e_priv *priv)
{
set_bit(MLX5E_STATE_ASYNC_EVENTS_ENABLE, &priv->state);
@@ -307,9 +301,8 @@ static void mlx5e_enable_async_events(struct mlx5e_priv *priv)
static void mlx5e_disable_async_events(struct mlx5e_priv *priv)
{
- spin_lock_irq(&priv->async_events_spinlock);
clear_bit(MLX5E_STATE_ASYNC_EVENTS_ENABLE, &priv->state);
- spin_unlock_irq(&priv->async_events_spinlock);
+ synchronize_irq(mlx5_get_msix_vec(priv->mdev, MLX5_EQ_VEC_ASYNC));
}
#define MLX5E_HW2SW_MTU(hwmtu) (hwmtu - (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN))
@@ -2290,7 +2283,6 @@ static void mlx5e_build_netdev_priv(struct mlx5_core_dev *mdev,
mlx5e_ets_init(priv);
#endif
- spin_lock_init(&priv->async_events_spinlock);
mutex_init(&priv->state_lock);
INIT_WORK(&priv->update_carrier_work, mlx5e_update_carrier_work);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
index 647a3ca..18fccec 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
@@ -442,6 +442,11 @@ int mlx5_destroy_unmap_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq)
}
EXPORT_SYMBOL_GPL(mlx5_destroy_unmap_eq);
+u32 mlx5_get_msix_vec(struct mlx5_core_dev *dev, int vecidx)
+{
+ return dev->priv.msix_arr[MLX5_EQ_VEC_ASYNC].vector;
+}
+
int mlx5_eq_init(struct mlx5_core_dev *dev)
{
int err;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
index 0336847..0b0b226 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
@@ -99,6 +99,7 @@ int mlx5_core_enable_hca(struct mlx5_core_dev *dev, u16 func_id);
int mlx5_core_disable_hca(struct mlx5_core_dev *dev, u16 func_id);
int mlx5_wait_for_vf_pages(struct mlx5_core_dev *dev);
cycle_t mlx5_read_internal_timer(struct mlx5_core_dev *dev);
+u32 mlx5_get_msix_vec(struct mlx5_core_dev *dev, int vecidx);
void mlx5e_init(void);
void mlx5e_cleanup(void);
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next V1 02/10] net/mlx5e: Placement changed for carrier state updates
2016-02-28 15:09 [PATCH net-next V1 00/10] mlx5 driver updates Saeed Mahameed
2016-02-28 15:09 ` [PATCH net-next V1 01/10] net/mlx5e: Replace async events spinlock with synchronize_irq() Saeed Mahameed
@ 2016-02-28 15:09 ` Saeed Mahameed
2016-02-28 15:09 ` [PATCH net-next V1 03/10] net/mlx5e: Changed naming convention of tx queues in ethtool stats Saeed Mahameed
` (7 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Saeed Mahameed @ 2016-02-28 15:09 UTC (permalink / raw)
To: David S. Miller
Cc: netdev, Or Gerlitz, Eran Ben Elisha, Tal Alon, Majd Dibbiny,
Tariq Toukan, Saeed Mahameed
From: Tariq Toukan <tariqt@mellanox.com>
More proper to declare carrier state UP only after the channels
are ready for traffic.
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 38944b8..013be09 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -1451,8 +1451,8 @@ int mlx5e_open_locked(struct net_device *netdev)
goto err_close_channels;
}
- mlx5e_update_carrier(priv);
mlx5e_redirect_rqts(priv);
+ mlx5e_update_carrier(priv);
mlx5e_timestamp_init(priv);
schedule_delayed_work(&priv->update_stats_work, 0);
@@ -1491,8 +1491,8 @@ int mlx5e_close_locked(struct net_device *netdev)
clear_bit(MLX5E_STATE_OPENED, &priv->state);
mlx5e_timestamp_cleanup(priv);
- mlx5e_redirect_rqts(priv);
netif_carrier_off(priv->netdev);
+ mlx5e_redirect_rqts(priv);
mlx5e_close_channels(priv);
return 0;
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next V1 03/10] net/mlx5e: Changed naming convention of tx queues in ethtool stats
2016-02-28 15:09 [PATCH net-next V1 00/10] mlx5 driver updates Saeed Mahameed
2016-02-28 15:09 ` [PATCH net-next V1 01/10] net/mlx5e: Replace async events spinlock with synchronize_irq() Saeed Mahameed
2016-02-28 15:09 ` [PATCH net-next V1 02/10] net/mlx5e: Placement changed for carrier state updates Saeed Mahameed
@ 2016-02-28 15:09 ` Saeed Mahameed
2016-02-28 15:09 ` [PATCH net-next V1 04/10] net/mlx5e: Move common case counters within sq_stats struct Saeed Mahameed
` (6 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Saeed Mahameed @ 2016-02-28 15:09 UTC (permalink / raw)
To: David S. Miller
Cc: netdev, Or Gerlitz, Eran Ben Elisha, Tal Alon, Majd Dibbiny,
Tariq Toukan, Saeed Mahameed
From: Tariq Toukan <tariqt@mellanox.com>
Instead of the pair (channel, tc), we now use a single number that
goes over all tx queues of a TC, for all TCs.
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
.../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
index e9760f8..577b4b1 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
@@ -211,13 +211,14 @@ static void mlx5e_get_strings(struct net_device *dev,
sprintf(data + (idx++) * ETH_GSTRING_LEN,
"rx%d_%s", i, rq_stats_strings[j]);
- for (i = 0; i < priv->params.num_channels; i++)
- for (tc = 0; tc < priv->params.num_tc; tc++)
+ for (tc = 0; tc < priv->params.num_tc; tc++)
+ for (i = 0; i < priv->params.num_channels; i++)
for (j = 0; j < NUM_SQ_STATS; j++)
sprintf(data +
- (idx++) * ETH_GSTRING_LEN,
- "tx%d_%d_%s", i, tc,
- sq_stats_strings[j]);
+ (idx++) * ETH_GSTRING_LEN,
+ "tx%d_%s",
+ priv->channeltc_to_txq_map[i][tc],
+ sq_stats_strings[j]);
break;
}
}
@@ -249,8 +250,8 @@ static void mlx5e_get_ethtool_stats(struct net_device *dev,
&priv->state) ? 0 :
((u64 *)&priv->channel[i]->rq.stats)[j];
- for (i = 0; i < priv->params.num_channels; i++)
- for (tc = 0; tc < priv->params.num_tc; tc++)
+ for (tc = 0; tc < priv->params.num_tc; tc++)
+ for (i = 0; i < priv->params.num_channels; i++)
for (j = 0; j < NUM_SQ_STATS; j++)
data[idx++] = !test_bit(MLX5E_STATE_OPENED,
&priv->state) ? 0 :
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next V1 04/10] net/mlx5e: Move common case counters within sq_stats struct
2016-02-28 15:09 [PATCH net-next V1 00/10] mlx5 driver updates Saeed Mahameed
` (2 preceding siblings ...)
2016-02-28 15:09 ` [PATCH net-next V1 03/10] net/mlx5e: Changed naming convention of tx queues in ethtool stats Saeed Mahameed
@ 2016-02-28 15:09 ` Saeed Mahameed
2016-02-28 15:09 ` [PATCH net-next V1 05/10] net/mlx5e: Set drop RQ's necessary parameters only Saeed Mahameed
` (5 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Saeed Mahameed @ 2016-02-28 15:09 UTC (permalink / raw)
To: David S. Miller
Cc: netdev, Or Gerlitz, Eran Ben Elisha, Tal Alon, Majd Dibbiny,
Tariq Toukan, Saeed Mahameed
From: Tariq Toukan <tariqt@mellanox.com>
For data cache locality considerations, we moved the nop and
csum_offload_inner within sq_stats struct as they are more
commonly accessed in xmit path.
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en.h | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h
index 4511984..b289660 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
@@ -260,26 +260,28 @@ static const char sq_stats_strings[][ETH_GSTRING_LEN] = {
"tso_bytes",
"tso_inner_packets",
"tso_inner_bytes",
- "csum_offload_none",
"csum_offload_inner",
+ "nop",
+ "csum_offload_none",
"stopped",
"wake",
"dropped",
- "nop"
};
struct mlx5e_sq_stats {
+ /* commonly accessed in data path */
u64 packets;
u64 tso_packets;
u64 tso_bytes;
u64 tso_inner_packets;
u64 tso_inner_bytes;
- u64 csum_offload_none;
u64 csum_offload_inner;
+ u64 nop;
+ /* less likely accessed in data path */
+ u64 csum_offload_none;
u64 stopped;
u64 wake;
u64 dropped;
- u64 nop;
#define NUM_SQ_STATS 11
};
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next V1 05/10] net/mlx5e: Set drop RQ's necessary parameters only
2016-02-28 15:09 [PATCH net-next V1 00/10] mlx5 driver updates Saeed Mahameed
` (3 preceding siblings ...)
2016-02-28 15:09 ` [PATCH net-next V1 04/10] net/mlx5e: Move common case counters within sq_stats struct Saeed Mahameed
@ 2016-02-28 15:09 ` Saeed Mahameed
2016-02-28 15:09 ` [PATCH net-next V1 06/10] net/mlx5e: Don't try to modify CQ moderation if it is not supported Saeed Mahameed
` (4 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Saeed Mahameed @ 2016-02-28 15:09 UTC (permalink / raw)
To: David S. Miller
Cc: netdev, Or Gerlitz, Eran Ben Elisha, Tal Alon, Majd Dibbiny,
Tariq Toukan, Saeed Mahameed
From: Tariq Toukan <tariqt@mellanox.com>
By its role, there is no need to set all the other parameters
for the drop RQ.
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 013be09..30fd971 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -1064,6 +1064,15 @@ static void mlx5e_build_rq_param(struct mlx5e_priv *priv,
param->wq.linear = 1;
}
+static void mlx5e_build_drop_rq_param(struct mlx5e_rq_param *param)
+{
+ void *rqc = param->rqc;
+ void *wq = MLX5_ADDR_OF(rqc, rqc, wq);
+
+ MLX5_SET(wq, wq, wq_type, MLX5_WQ_TYPE_LINKED_LIST);
+ MLX5_SET(wq, wq, log_wq_stride, ilog2(sizeof(struct mlx5e_rx_wqe)));
+}
+
static void mlx5e_build_sq_param(struct mlx5e_priv *priv,
struct mlx5e_sq_param *param)
{
@@ -1574,8 +1583,7 @@ static int mlx5e_open_drop_rq(struct mlx5e_priv *priv)
memset(&cq_param, 0, sizeof(cq_param));
memset(&rq_param, 0, sizeof(rq_param));
- mlx5e_build_rx_cq_param(priv, &cq_param);
- mlx5e_build_rq_param(priv, &rq_param);
+ mlx5e_build_drop_rq_param(&rq_param);
err = mlx5e_create_drop_cq(priv, cq, &cq_param);
if (err)
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next V1 06/10] net/mlx5e: Don't try to modify CQ moderation if it is not supported
2016-02-28 15:09 [PATCH net-next V1 00/10] mlx5 driver updates Saeed Mahameed
` (4 preceding siblings ...)
2016-02-28 15:09 ` [PATCH net-next V1 05/10] net/mlx5e: Set drop RQ's necessary parameters only Saeed Mahameed
@ 2016-02-28 15:09 ` Saeed Mahameed
2016-02-28 15:09 ` [PATCH net-next V1 07/10] net/mlx5e: Don't modify CQ before it was created Saeed Mahameed
` (3 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Saeed Mahameed @ 2016-02-28 15:09 UTC (permalink / raw)
To: David S. Miller
Cc: netdev, Or Gerlitz, Eran Ben Elisha, Tal Alon, Majd Dibbiny,
Gal Pressman, Saeed Mahameed
From: Gal Pressman <galp@mellanox.com>
If CQ moderation is not supported by the device, print a warning on
netdevice load, and return error when trying to modify/query cq
moderation via ethtool.
Fixes: f62b8bb8f2d3 ('net/mlx5: Extend mlx5_core to support ConnectX-4
Ethernet functionality')
Signed-off-by: Gal Pressman <galp@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
.../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 6 ++++++
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 12 ++++++------
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
index 577b4b1..a1b3bb4 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
@@ -400,6 +400,9 @@ static int mlx5e_get_coalesce(struct net_device *netdev,
{
struct mlx5e_priv *priv = netdev_priv(netdev);
+ if (!MLX5_CAP_GEN(priv->mdev, cq_moderation))
+ return -ENOTSUPP;
+
coal->rx_coalesce_usecs = priv->params.rx_cq_moderation_usec;
coal->rx_max_coalesced_frames = priv->params.rx_cq_moderation_pkts;
coal->tx_coalesce_usecs = priv->params.tx_cq_moderation_usec;
@@ -417,6 +420,9 @@ static int mlx5e_set_coalesce(struct net_device *netdev,
int tc;
int i;
+ if (!MLX5_CAP_GEN(mdev, cq_moderation))
+ return -ENOTSUPP;
+
priv->params.tx_cq_moderation_usec = coal->tx_coalesce_usecs;
priv->params.tx_cq_moderation_pkts = coal->tx_max_coalesced_frames;
priv->params.rx_cq_moderation_usec = coal->rx_coalesce_usecs;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 30fd971..b20a35b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -870,12 +870,10 @@ static int mlx5e_open_cq(struct mlx5e_channel *c,
if (err)
goto err_destroy_cq;
- err = mlx5_core_modify_cq_moderation(mdev, &cq->mcq,
- moderation_usecs,
- moderation_frames);
- if (err)
- goto err_destroy_cq;
-
+ if (MLX5_CAP_GEN(mdev, cq_moderation))
+ mlx5_core_modify_cq_moderation(mdev, &cq->mcq,
+ moderation_usecs,
+ moderation_frames);
return 0;
err_destroy_cq:
@@ -2218,6 +2216,8 @@ static int mlx5e_check_required_hca_cap(struct mlx5_core_dev *mdev)
}
if (!MLX5_CAP_ETH(mdev, self_lb_en_modifiable))
mlx5_core_warn(mdev, "Self loop back prevention is not supported\n");
+ if (!MLX5_CAP_GEN(mdev, cq_moderation))
+ mlx5_core_warn(mdev, "CQ modiration is not supported\n");
return 0;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next V1 07/10] net/mlx5e: Don't modify CQ before it was created
2016-02-28 15:09 [PATCH net-next V1 00/10] mlx5 driver updates Saeed Mahameed
` (5 preceding siblings ...)
2016-02-28 15:09 ` [PATCH net-next V1 06/10] net/mlx5e: Don't try to modify CQ moderation if it is not supported Saeed Mahameed
@ 2016-02-28 15:09 ` Saeed Mahameed
2016-02-28 15:09 ` [PATCH net-next V1 08/10] net/mlx5: Make command timeout way shorter Saeed Mahameed
` (2 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Saeed Mahameed @ 2016-02-28 15:09 UTC (permalink / raw)
To: David S. Miller
Cc: netdev, Or Gerlitz, Eran Ben Elisha, Tal Alon, Majd Dibbiny,
Gal Pressman, Saeed Mahameed
From: Gal Pressman <galp@mellanox.com>
Calling mlx5e_set_coalesce while the interface is down will result in
modifying CQs that don't exist.
Fixes: f62b8bb8f2d3 ('net/mlx5: Extend mlx5_core to support ConnectX-4
Ethernet functionality')
Signed-off-by: Gal Pressman <galp@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
.../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
index a1b3bb4..0959656 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
@@ -423,11 +423,15 @@ static int mlx5e_set_coalesce(struct net_device *netdev,
if (!MLX5_CAP_GEN(mdev, cq_moderation))
return -ENOTSUPP;
+ mutex_lock(&priv->state_lock);
priv->params.tx_cq_moderation_usec = coal->tx_coalesce_usecs;
priv->params.tx_cq_moderation_pkts = coal->tx_max_coalesced_frames;
priv->params.rx_cq_moderation_usec = coal->rx_coalesce_usecs;
priv->params.rx_cq_moderation_pkts = coal->rx_max_coalesced_frames;
+ if (!test_bit(MLX5E_STATE_OPENED, &priv->state))
+ goto out;
+
for (i = 0; i < priv->params.num_channels; ++i) {
c = priv->channel[i];
@@ -443,6 +447,8 @@ static int mlx5e_set_coalesce(struct net_device *netdev,
coal->rx_max_coalesced_frames);
}
+out:
+ mutex_unlock(&priv->state_lock);
return 0;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next V1 08/10] net/mlx5: Make command timeout way shorter
2016-02-28 15:09 [PATCH net-next V1 00/10] mlx5 driver updates Saeed Mahameed
` (6 preceding siblings ...)
2016-02-28 15:09 ` [PATCH net-next V1 07/10] net/mlx5e: Don't modify CQ before it was created Saeed Mahameed
@ 2016-02-28 15:09 ` Saeed Mahameed
2016-02-28 15:09 ` [PATCH net-next V1 09/10] net/mlx5: Fix global UAR mapping Saeed Mahameed
2016-02-28 15:09 ` [PATCH net-next V1 10/10] net/mlx5: Avoid double mapping of io mapped memory Saeed Mahameed
9 siblings, 0 replies; 13+ messages in thread
From: Saeed Mahameed @ 2016-02-28 15:09 UTC (permalink / raw)
To: David S. Miller
Cc: netdev, Or Gerlitz, Eran Ben Elisha, Tal Alon, Majd Dibbiny,
Leon Romanovsky, Saeed Mahameed
From: Or Gerlitz <ogerlitz@mellanox.com>
The command timeout is terribly long, whole two hours. Make it 60s so if
things do go wrong, the user gets feedback in relatively short time, so
they can take corrective actions and/or investigate using tools and such.
Fixes: e126ba97dba9 ('mlx5: Add driver for Mellanox Connect-IB adapters')
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
include/linux/mlx5/driver.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index a815da9..3388a43 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -54,7 +54,7 @@ enum {
/* one minute for the sake of bringup. Generally, commands must always
* complete and we may need to increase this timeout value
*/
- MLX5_CMD_TIMEOUT_MSEC = 7200 * 1000,
+ MLX5_CMD_TIMEOUT_MSEC = 60 * 1000,
MLX5_CMD_WQ_MAX_NAME = 32,
};
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next V1 09/10] net/mlx5: Fix global UAR mapping
2016-02-28 15:09 [PATCH net-next V1 00/10] mlx5 driver updates Saeed Mahameed
` (7 preceding siblings ...)
2016-02-28 15:09 ` [PATCH net-next V1 08/10] net/mlx5: Make command timeout way shorter Saeed Mahameed
@ 2016-02-28 15:09 ` Saeed Mahameed
2016-02-29 4:28 ` David Miller
2016-02-28 15:09 ` [PATCH net-next V1 10/10] net/mlx5: Avoid double mapping of io mapped memory Saeed Mahameed
9 siblings, 1 reply; 13+ messages in thread
From: Saeed Mahameed @ 2016-02-28 15:09 UTC (permalink / raw)
To: David S. Miller
Cc: netdev, Or Gerlitz, Eran Ben Elisha, Tal Alon, Majd Dibbiny,
Moshe Lazer, Saeed Mahameed
From: Moshe Lazer <moshel@mellanox.com>
Remove the global WC mapping of the total UARs since
UAR mapping should be decided per UAR (e.g we want
different mappings for EQs, CQs vs QPs).
We use ARCH_HAS_IOREMAP_WC to know if the current arch supports WC
(Write combining) IO memory mapping, if it is not supported
"uar->bf_map" will be NULL, thus we will use NC (Non Cached) mapping
"uar->map".
Fixes: 88a85f99e51f ('TX latency optimization to save DMA reads')
Signed-off-by: Moshe Lazer <moshel@mellanox.com>
Reviewed-by: Achiad Shochat <achiad@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx5/core/main.c | 28 +-----------------------
drivers/net/ethernet/mellanox/mlx5/core/uar.c | 12 +++++-----
include/linux/mlx5/driver.h | 2 -
3 files changed, 7 insertions(+), 35 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index 1545a94..8b7133d 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -767,22 +767,6 @@ static int mlx5_core_set_issi(struct mlx5_core_dev *dev)
return -ENOTSUPP;
}
-static int map_bf_area(struct mlx5_core_dev *dev)
-{
- resource_size_t bf_start = pci_resource_start(dev->pdev, 0);
- resource_size_t bf_len = pci_resource_len(dev->pdev, 0);
-
- dev->priv.bf_mapping = io_mapping_create_wc(bf_start, bf_len);
-
- return dev->priv.bf_mapping ? 0 : -ENOMEM;
-}
-
-static void unmap_bf_area(struct mlx5_core_dev *dev)
-{
- if (dev->priv.bf_mapping)
- io_mapping_free(dev->priv.bf_mapping);
-}
-
static void mlx5_add_device(struct mlx5_interface *intf, struct mlx5_priv *priv)
{
struct mlx5_device_context *dev_ctx;
@@ -1103,14 +1087,9 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv)
goto err_stop_eqs;
}
- if (map_bf_area(dev))
- dev_err(&pdev->dev, "Failed to map blue flame area\n");
-
err = mlx5_irq_set_affinity_hints(dev);
- if (err) {
+ if (err)
dev_err(&pdev->dev, "Failed to alloc affinity hint cpumask\n");
- goto err_unmap_bf_area;
- }
MLX5_INIT_DOORBELL_LOCK(&priv->cq_uar_lock);
@@ -1169,10 +1148,6 @@ err_fs:
mlx5_cleanup_qp_table(dev);
mlx5_cleanup_cq_table(dev);
mlx5_irq_clear_affinity_hints(dev);
-
-err_unmap_bf_area:
- unmap_bf_area(dev);
-
free_comp_eqs(dev);
err_stop_eqs:
@@ -1242,7 +1217,6 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv)
mlx5_cleanup_qp_table(dev);
mlx5_cleanup_cq_table(dev);
mlx5_irq_clear_affinity_hints(dev);
- unmap_bf_area(dev);
free_comp_eqs(dev);
mlx5_stop_eqs(dev);
mlx5_free_uuars(dev, &priv->uuari);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/uar.c b/drivers/net/ethernet/mellanox/mlx5/core/uar.c
index eb05c84..d287bcb 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/uar.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/uar.c
@@ -246,11 +246,11 @@ int mlx5_alloc_map_uar(struct mlx5_core_dev *mdev, struct mlx5_uar *uar)
err = -ENOMEM;
goto err_free_uar;
}
-
- if (mdev->priv.bf_mapping)
- uar->bf_map = io_mapping_map_wc(mdev->priv.bf_mapping,
- uar->index << PAGE_SHIFT);
-
+#ifdef ARCH_HAS_IOREMAP_WC
+ uar->bf_map = ioremap_wc(pfn << PAGE_SHIFT, PAGE_SIZE);
+ if (!uar->bf_map)
+ mlx5_core_warn(mdev, "ioremap_wc() failed\n");
+#endif
return 0;
err_free_uar:
@@ -262,7 +262,7 @@ EXPORT_SYMBOL(mlx5_alloc_map_uar);
void mlx5_unmap_free_uar(struct mlx5_core_dev *mdev, struct mlx5_uar *uar)
{
- io_mapping_unmap(uar->bf_map);
+ iounmap(uar->bf_map);
iounmap(uar->map);
mlx5_cmd_free_uar(mdev, uar->index);
}
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 3388a43..335d43a 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -460,8 +460,6 @@ struct mlx5_priv {
struct mlx5_uuar_info uuari;
MLX5_DECLARE_DOORBELL_LOCK(cq_uar_lock);
- struct io_mapping *bf_mapping;
-
/* pages stuff */
struct workqueue_struct *pg_wq;
struct rb_root page_root;
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next V1 10/10] net/mlx5: Avoid double mapping of io mapped memory
2016-02-28 15:09 [PATCH net-next V1 00/10] mlx5 driver updates Saeed Mahameed
` (8 preceding siblings ...)
2016-02-28 15:09 ` [PATCH net-next V1 09/10] net/mlx5: Fix global UAR mapping Saeed Mahameed
@ 2016-02-28 15:09 ` Saeed Mahameed
9 siblings, 0 replies; 13+ messages in thread
From: Saeed Mahameed @ 2016-02-28 15:09 UTC (permalink / raw)
To: David S. Miller
Cc: netdev, Or Gerlitz, Eran Ben Elisha, Tal Alon, Majd Dibbiny,
Moshe Lazer, Saeed Mahameed
From: Moshe Lazer <moshel@mellanox.com>
Device page may be mapped to non-cached(NC) or to write combining(WC).
The code before this fix tries to map it both to WC and NC
contrary to what stated in Intel's software developer manual.
Fixes: 88a85f99e51f ('TX latency optimization to save DMA reads')
Signed-off-by: Moshe Lazer <moshel@mellanox.com>
Reviewed-by: Achiad Shochat <achiad@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en.h | 16 ++++------
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 12 +++++--
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 2 +-
drivers/net/ethernet/mellanox/mlx5/core/uar.c | 33 +++++++++++++-------
include/linux/mlx5/driver.h | 3 +-
5 files changed, 38 insertions(+), 28 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h
index b289660..9c0e80e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
@@ -388,6 +388,7 @@ struct mlx5e_sq_dma {
enum {
MLX5E_SQ_STATE_WAKE_TXQ_ENABLE,
+ MLX5E_SQ_STATE_BF_ENABLE,
};
struct mlx5e_sq {
@@ -416,7 +417,6 @@ struct mlx5e_sq {
struct mlx5_wq_cyc wq;
u32 dma_fifo_mask;
void __iomem *uar_map;
- void __iomem *uar_bf_map;
struct netdev_queue *txq;
u32 sqn;
u16 bf_buf_size;
@@ -664,16 +664,12 @@ static inline void mlx5e_tx_notify_hw(struct mlx5e_sq *sq,
* doorbell
*/
wmb();
-
- if (bf_sz) {
- __iowrite64_copy(sq->uar_bf_map + ofst, &wqe->ctrl, bf_sz);
-
- /* flush the write-combining mapped buffer */
- wmb();
-
- } else {
+ if (bf_sz)
+ __iowrite64_copy(sq->uar_map + ofst, &wqe->ctrl, bf_sz);
+ else
mlx5_write64((__be32 *)&wqe->ctrl, sq->uar_map + ofst, NULL);
- }
+ /* flush the write-combining mapped buffer */
+ wmb();
sq->bf_offset ^= sq->bf_buf_size;
}
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index b20a35b..5063c0e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -548,7 +548,7 @@ static int mlx5e_create_sq(struct mlx5e_channel *c,
int txq_ix;
int err;
- err = mlx5_alloc_map_uar(mdev, &sq->uar);
+ err = mlx5_alloc_map_uar(mdev, &sq->uar, true);
if (err)
return err;
@@ -560,8 +560,12 @@ static int mlx5e_create_sq(struct mlx5e_channel *c,
goto err_unmap_free_uar;
sq->wq.db = &sq->wq.db[MLX5_SND_DBR];
- sq->uar_map = sq->uar.map;
- sq->uar_bf_map = sq->uar.bf_map;
+ if (sq->uar.bf_map) {
+ set_bit(MLX5E_SQ_STATE_BF_ENABLE, &sq->state);
+ sq->uar_map = sq->uar.bf_map;
+ } else {
+ sq->uar_map = sq->uar.map;
+ }
sq->bf_buf_size = (1 << MLX5_CAP_GEN(mdev, log_bf_reg_size)) / 2;
sq->max_inline = param->max_inline;
@@ -2418,7 +2422,7 @@ static void *mlx5e_create_netdev(struct mlx5_core_dev *mdev)
priv = netdev_priv(netdev);
- err = mlx5_alloc_map_uar(mdev, &priv->cq_uar);
+ err = mlx5_alloc_map_uar(mdev, &priv->cq_uar, false);
if (err) {
mlx5_core_err(mdev, "alloc_map uar failed, %d\n", err);
goto err_free_netdev;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
index a05c070..c34f4f3 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
@@ -303,7 +303,7 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb)
if (!skb->xmit_more || netif_xmit_stopped(sq->txq)) {
int bf_sz = 0;
- if (bf && sq->uar_bf_map)
+ if (bf && test_bit(MLX5E_SQ_STATE_BF_ENABLE, &sq->state))
bf_sz = wi->num_wqebbs << 3;
cseg->fm_ce_se = MLX5_WQE_CTRL_CQ_UPDATE;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/uar.c b/drivers/net/ethernet/mellanox/mlx5/core/uar.c
index d287bcb..512f9cb 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/uar.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/uar.c
@@ -226,7 +226,8 @@ int mlx5_free_uuars(struct mlx5_core_dev *dev, struct mlx5_uuar_info *uuari)
return 0;
}
-int mlx5_alloc_map_uar(struct mlx5_core_dev *mdev, struct mlx5_uar *uar)
+int mlx5_alloc_map_uar(struct mlx5_core_dev *mdev, struct mlx5_uar *uar,
+ bool map_wc)
{
phys_addr_t pfn;
phys_addr_t uar_bar_start;
@@ -240,20 +241,28 @@ int mlx5_alloc_map_uar(struct mlx5_core_dev *mdev, struct mlx5_uar *uar)
uar_bar_start = pci_resource_start(mdev->pdev, 0);
pfn = (uar_bar_start >> PAGE_SHIFT) + uar->index;
- uar->map = ioremap(pfn << PAGE_SHIFT, PAGE_SIZE);
- if (!uar->map) {
- mlx5_core_warn(mdev, "ioremap() failed, %d\n", err);
- err = -ENOMEM;
- goto err_free_uar;
- }
-#ifdef ARCH_HAS_IOREMAP_WC
- uar->bf_map = ioremap_wc(pfn << PAGE_SHIFT, PAGE_SIZE);
- if (!uar->bf_map)
- mlx5_core_warn(mdev, "ioremap_wc() failed\n");
+#ifndef ARCH_HAS_IOREMAP_WC
+ map_wc = 0;
#endif
+ if (map_wc) {
+ uar->bf_map = ioremap_wc(pfn << PAGE_SHIFT, PAGE_SIZE);
+ if (!uar->bf_map) {
+ mlx5_core_warn(mdev, "ioremap_wc() failed\n");
+ uar->map = ioremap(pfn << PAGE_SHIFT, PAGE_SIZE);
+ if (!uar->map)
+ goto err_free_uar;
+ }
+ } else {
+ uar->map = ioremap(pfn << PAGE_SHIFT, PAGE_SIZE);
+ if (!uar->map)
+ goto err_free_uar;
+ }
+
return 0;
err_free_uar:
+ mlx5_core_warn(mdev, "ioremap() failed\n");
+ err = -ENOMEM;
mlx5_cmd_free_uar(mdev, uar->index);
return err;
@@ -262,8 +271,8 @@ EXPORT_SYMBOL(mlx5_alloc_map_uar);
void mlx5_unmap_free_uar(struct mlx5_core_dev *mdev, struct mlx5_uar *uar)
{
- iounmap(uar->bf_map);
iounmap(uar->map);
+ iounmap(uar->bf_map);
mlx5_cmd_free_uar(mdev, uar->index);
}
EXPORT_SYMBOL(mlx5_unmap_free_uar);
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 335d43a..bb1a880 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -717,7 +717,8 @@ int mlx5_cmd_alloc_uar(struct mlx5_core_dev *dev, u32 *uarn);
int mlx5_cmd_free_uar(struct mlx5_core_dev *dev, u32 uarn);
int mlx5_alloc_uuars(struct mlx5_core_dev *dev, struct mlx5_uuar_info *uuari);
int mlx5_free_uuars(struct mlx5_core_dev *dev, struct mlx5_uuar_info *uuari);
-int mlx5_alloc_map_uar(struct mlx5_core_dev *mdev, struct mlx5_uar *uar);
+int mlx5_alloc_map_uar(struct mlx5_core_dev *mdev, struct mlx5_uar *uar,
+ bool map_wc);
void mlx5_unmap_free_uar(struct mlx5_core_dev *mdev, struct mlx5_uar *uar);
void mlx5_health_cleanup(struct mlx5_core_dev *dev);
int mlx5_health_init(struct mlx5_core_dev *dev);
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH net-next V1 09/10] net/mlx5: Fix global UAR mapping
2016-02-28 15:09 ` [PATCH net-next V1 09/10] net/mlx5: Fix global UAR mapping Saeed Mahameed
@ 2016-02-29 4:28 ` David Miller
2016-02-29 19:41 ` Saeed Mahameed
0 siblings, 1 reply; 13+ messages in thread
From: David Miller @ 2016-02-29 4:28 UTC (permalink / raw)
To: saeedm; +Cc: netdev, ogerlitz, eranbe, talal, majd, moshel
From: Saeed Mahameed <saeedm@mellanox.com>
Date: Sun, 28 Feb 2016 17:09:10 +0200
> We use ARCH_HAS_IOREMAP_WC to know if the current arch supports WC
> (Write combining) IO memory mapping, if it is not supported
> "uar->bf_map" will be NULL, thus we will use NC (Non Cached) mapping
> "uar->map".
This description sucks.
You're just saying what will happen if the CPP is defined or not
(uar->bf_map ends up being NULL).
Well anyone can see that from the code.
You have to explain why.
And BTW, ARCH_HAS_IOREMAP_WC doesn't even tell you if the platform
will actually give you a write-combining mapping.
So if it's the driver operates properly if a non-WC mapping is used
for uar->bf_map, then get rid of this CPP test altogether PLEASE!
Otherwise your driver is buggy, because ARCH_HAS_IOREMAP_WC only says
whether the default implementation of ioremap_wc() needs to be
provided by include/asm-generic/iomap.h It does not guarantee that a
write-combining mapping will be provided.
I really can't think of any reason why you absolutely require a
WC mapping, and the CPP test just makes your driver look more
ugly than it needs to me.
So can you please explain what the hell is happening here and why you
are doing things this way rather than just reading the code to me?
Thanks.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net-next V1 09/10] net/mlx5: Fix global UAR mapping
2016-02-29 4:28 ` David Miller
@ 2016-02-29 19:41 ` Saeed Mahameed
0 siblings, 0 replies; 13+ messages in thread
From: Saeed Mahameed @ 2016-02-29 19:41 UTC (permalink / raw)
To: David Miller
Cc: Saeed Mahameed, Linux Netdev List, Or Gerlitz, Eran Ben Elisha,
Tal Alon, Majd Dibbiny, moshel
>
> Well anyone can see that from the code.
>
> You have to explain why.
In a simple words as partially explained in the commit message we want
to have both mappings (NC and WC) available so upper layer can decide
which to choose e.g. for SQs/QPs in some cases (Small Packets) and
only when WC is supported we would like to write TX descriptors (WQEs)
using ConnectX BlueFlame feature via WC mapping and if WC is not
supported the TX descriptors would be posted in the usual way
(doorbell) via NC mapping.
this would give a latency boost for small packets.
The problem is when posting BlueFlame buffers when the mapping is not
WC i.e via NC mapping the latency will get worst than writing using
the usual way (doorbell).
so this is why we use ARCH_HAS_IOREMAP_WC to give a hint to upper
layer whether to use BlueFlame writes (WC) or doorbell writes (NC).
>
> And BTW, ARCH_HAS_IOREMAP_WC doesn't even tell you if the platform
> will actually give you a write-combining mapping.
We did some research after your comment and we are considering
removing ARCH_HAS_IOREMAP_WC from the code, we will update the patches
soon.
>
> So if it's the driver operates properly if a non-WC mapping is used
> for uar->bf_map, then get rid of this CPP test altogether PLEASE!
>
> Otherwise your driver is buggy, because ARCH_HAS_IOREMAP_WC only says
> whether the default implementation of ioremap_wc() needs to be
> provided by include/asm-generic/iomap.h It does not guarantee that a
> write-combining mapping will be provided.
>
> I really can't think of any reason why you absolutely require a
> WC mapping, and the CPP test just makes your driver look more
> ugly than it needs to me.
WC mapping is required in order to know if BlueFlame writes would give
a better latency or not.
>
> So can you please explain what the hell is happening here and why you
> are doing things this way rather than just reading the code to me?
I hope the above explains what we are trying to do here, I know it is
not perfect, but as you know the kernel IO mapping API doesn't tell if
the WC mapping was successful or not, so we used the CPP test.
but after your comment we understood it is not perfect, and we are
looking into it.
Thanks
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2016-02-29 19:41 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-28 15:09 [PATCH net-next V1 00/10] mlx5 driver updates Saeed Mahameed
2016-02-28 15:09 ` [PATCH net-next V1 01/10] net/mlx5e: Replace async events spinlock with synchronize_irq() Saeed Mahameed
2016-02-28 15:09 ` [PATCH net-next V1 02/10] net/mlx5e: Placement changed for carrier state updates Saeed Mahameed
2016-02-28 15:09 ` [PATCH net-next V1 03/10] net/mlx5e: Changed naming convention of tx queues in ethtool stats Saeed Mahameed
2016-02-28 15:09 ` [PATCH net-next V1 04/10] net/mlx5e: Move common case counters within sq_stats struct Saeed Mahameed
2016-02-28 15:09 ` [PATCH net-next V1 05/10] net/mlx5e: Set drop RQ's necessary parameters only Saeed Mahameed
2016-02-28 15:09 ` [PATCH net-next V1 06/10] net/mlx5e: Don't try to modify CQ moderation if it is not supported Saeed Mahameed
2016-02-28 15:09 ` [PATCH net-next V1 07/10] net/mlx5e: Don't modify CQ before it was created Saeed Mahameed
2016-02-28 15:09 ` [PATCH net-next V1 08/10] net/mlx5: Make command timeout way shorter Saeed Mahameed
2016-02-28 15:09 ` [PATCH net-next V1 09/10] net/mlx5: Fix global UAR mapping Saeed Mahameed
2016-02-29 4:28 ` David Miller
2016-02-29 19:41 ` Saeed Mahameed
2016-02-28 15:09 ` [PATCH net-next V1 10/10] net/mlx5: Avoid double mapping of io mapped memory Saeed Mahameed
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).