netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/8] Mellanox driver update, Nov 1 2015
@ 2015-11-01 17:35 Or Gerlitz
  2015-11-01 17:35 ` [PATCH net-next 1/8] net/mlx5e: Avoid NULL pointer access in case of configuration failure Or Gerlitz
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: Or Gerlitz @ 2015-11-01 17:35 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Saeed Mahameed, Or Gerlitz

Hi Dave,

This series contains bunch of small fixes to the mlx5e driver from Achiad.

Applies on net-next commit e7b63ff "Merge branch 'master' of 
git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next"

Or.

Achiad Shochat (8):
  net/mlx5e: Avoid NULL pointer access in case of configuration failure
  net/mlx5e: Wait for RX buffers initialization in a more proper manner
  net/mlx5_core: Use the the real irqn in eq->irqn
  net/mlx5e: Consider IRQ affinity changes in NAPI poll
  net/mlx5e: Don't allow more than max supported channels
  net/mlx5e: Return error in case mlx5e_set_features() fails
  net/mlx5e: Re-eanble client vlan TX acceleration
  net/mlx5e: Fix LSO vlan insertion

 drivers/net/ethernet/mellanox/mlx5/core/en.h       |  9 ++++++++
 .../net/ethernet/mellanox/mlx5/core/en_ethtool.c   |  5 ++---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c  | 17 +++++++++-----
 drivers/net/ethernet/mellanox/mlx5/core/en_tx.c    | 26 +++++++++++++++++++---
 drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c  | 12 +++++++++-
 drivers/net/ethernet/mellanox/mlx5/core/eq.c       |  8 +++----
 6 files changed, 61 insertions(+), 16 deletions(-)

-- 
2.3.7

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

* [PATCH net-next 1/8] net/mlx5e: Avoid NULL pointer access in case of configuration failure
  2015-11-01 17:35 [PATCH net-next 0/8] Mellanox driver update, Nov 1 2015 Or Gerlitz
@ 2015-11-01 17:35 ` Or Gerlitz
  2015-11-01 17:35 ` [PATCH net-next 2/8] net/mlx5e: Wait for RX buffers initialization in a more proper manner Or Gerlitz
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Or Gerlitz @ 2015-11-01 17:35 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Saeed Mahameed, Achiad Shochat, Or Gerlitz

From: Achiad Shochat <achiad@mellanox.com>

In case a configuration operation that involves closing and re-opening
resources (e.g RX/TX queue size change) fails at the re-opening stage
these resources will remain closed.
So when executing (following) configuration operations (e.g ifconfig
down) we cannot assume that these resources are available.

Signed-off-by: Achiad Shochat <achiad@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index bb801a9..9df6f9a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -1404,6 +1404,12 @@ int mlx5e_close_locked(struct net_device *netdev)
 {
 	struct mlx5e_priv *priv = netdev_priv(netdev);
 
+	/* May already be CLOSED in case a previous configuration operation
+	 * (e.g RX/TX queue size change) that involves close&open failed.
+	 */
+	if (!test_bit(MLX5E_STATE_OPENED, &priv->state))
+		return 0;
+
 	clear_bit(MLX5E_STATE_OPENED, &priv->state);
 
 	mlx5e_redirect_rqts(priv);
-- 
2.3.7

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

* [PATCH net-next 2/8] net/mlx5e: Wait for RX buffers initialization in a more proper manner
  2015-11-01 17:35 [PATCH net-next 0/8] Mellanox driver update, Nov 1 2015 Or Gerlitz
  2015-11-01 17:35 ` [PATCH net-next 1/8] net/mlx5e: Avoid NULL pointer access in case of configuration failure Or Gerlitz
@ 2015-11-01 17:35 ` Or Gerlitz
  2015-11-01 17:35 ` [PATCH net-next 3/8] net/mlx5_core: Use the the real irqn in eq->irqn Or Gerlitz
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Or Gerlitz @ 2015-11-01 17:35 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Saeed Mahameed, Achiad Shochat, Or Gerlitz

From: Achiad Shochat <achiad@mellanox.com>

Use jiffies rather than wait loop with msleep().

The wait loop didn't take into consideration time when the
process was not executing.

Signed-off-by: Achiad Shochat <achiad@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 4 ++--
 1 file 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 9df6f9a..0bab33c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -442,12 +442,12 @@ static void mlx5e_disable_rq(struct mlx5e_rq *rq)
 
 static int mlx5e_wait_for_min_rx_wqes(struct mlx5e_rq *rq)
 {
+	unsigned long exp_time = jiffies + msecs_to_jiffies(20000);
 	struct mlx5e_channel *c = rq->channel;
 	struct mlx5e_priv *priv = c->priv;
 	struct mlx5_wq_ll *wq = &rq->wq;
-	int i;
 
-	for (i = 0; i < 1000; i++) {
+	while (time_before(jiffies, exp_time)) {
 		if (wq->cur_sz >= priv->params.min_rx_wqes)
 			return 0;
 
-- 
2.3.7

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

* [PATCH net-next 3/8] net/mlx5_core: Use the the real irqn in eq->irqn
  2015-11-01 17:35 [PATCH net-next 0/8] Mellanox driver update, Nov 1 2015 Or Gerlitz
  2015-11-01 17:35 ` [PATCH net-next 1/8] net/mlx5e: Avoid NULL pointer access in case of configuration failure Or Gerlitz
  2015-11-01 17:35 ` [PATCH net-next 2/8] net/mlx5e: Wait for RX buffers initialization in a more proper manner Or Gerlitz
@ 2015-11-01 17:35 ` Or Gerlitz
  2015-11-01 17:35 ` [PATCH net-next 4/8] net/mlx5e: Consider IRQ affinity changes in NAPI poll Or Gerlitz
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Or Gerlitz @ 2015-11-01 17:35 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Saeed Mahameed, Achiad Shochat, Or Gerlitz

From: Achiad Shochat <achiad@mellanox.com>

Instead of storing the msix array index in eq->irqn (vecidx),
store the real irq number.

Signed-off-by: Achiad Shochat <achiad@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/eq.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
index 1f01fe8..713ead5 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
@@ -382,10 +382,10 @@ int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx,
 		 name, pci_name(dev->pdev));
 
 	eq->eqn = out.eq_number;
-	eq->irqn = vecidx;
+	eq->irqn = priv->msix_arr[vecidx].vector;
 	eq->dev = dev;
 	eq->doorbell = uar->map + MLX5_EQ_DOORBEL_OFFSET;
-	err = request_irq(priv->msix_arr[vecidx].vector, mlx5_msix_handler, 0,
+	err = request_irq(eq->irqn, mlx5_msix_handler, 0,
 			  priv->irq_info[vecidx].name, eq);
 	if (err)
 		goto err_eq;
@@ -421,12 +421,12 @@ int mlx5_destroy_unmap_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq)
 	int err;
 
 	mlx5_debug_eq_remove(dev, eq);
-	free_irq(dev->priv.msix_arr[eq->irqn].vector, eq);
+	free_irq(eq->irqn, eq);
 	err = mlx5_cmd_destroy_eq(dev, eq->eqn);
 	if (err)
 		mlx5_core_warn(dev, "failed to destroy a previously created eq: eqn %d\n",
 			       eq->eqn);
-	synchronize_irq(dev->priv.msix_arr[eq->irqn].vector);
+	synchronize_irq(eq->irqn);
 	mlx5_buf_free(dev, &eq->buf);
 
 	return err;
-- 
2.3.7

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

* [PATCH net-next 4/8] net/mlx5e: Consider IRQ affinity changes in NAPI poll
  2015-11-01 17:35 [PATCH net-next 0/8] Mellanox driver update, Nov 1 2015 Or Gerlitz
                   ` (2 preceding siblings ...)
  2015-11-01 17:35 ` [PATCH net-next 3/8] net/mlx5_core: Use the the real irqn in eq->irqn Or Gerlitz
@ 2015-11-01 17:35 ` Or Gerlitz
  2015-11-01 22:34   ` David Miller
  2015-11-01 17:35 ` [PATCH net-next 5/8] net/mlx5e: Don't allow more than max supported channels Or Gerlitz
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 10+ messages in thread
From: Or Gerlitz @ 2015-11-01 17:35 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Saeed Mahameed, Achiad Shochat, Or Gerlitz

From: Achiad Shochat <achiad@mellanox.com>

Under heavy network traffic load we may be in NAPI poll mode for
a long time, thus IRQ affinity changes do not affect NAPI as desired.

Now once in a NAPI poll session we check the channel IRQ affinity,
if it points to a different CPU core than the current, stop polling
and the following device interrupt will fix the NAPI affinity.

Signed-off-by: Achiad Shochat <achiad@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en.h      |  3 +++
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c |  1 +
 drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c | 12 +++++++++++-
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h
index 0983a20..3c5c900 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
@@ -406,6 +406,9 @@ struct mlx5e_channel {
 	u8                         num_tc;
 	unsigned long              flags;
 
+	/* data path - accessed per napi poll */
+	struct irq_desc           *irq_desc;
+
 	/* control */
 	struct mlx5e_priv         *priv;
 	int                        ix;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 0bab33c..bdbef9f 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -1004,6 +1004,7 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix,
 		goto err_close_sqs;
 
 	netif_set_xps_queue(netdev, get_cpu_mask(c->cpu), ix);
+	c->irq_desc = irq_to_desc(c->rq.cq.mcq.irqn);
 	*cp = c;
 
 	return 0;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
index 2c7cb67..99e29c9 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
@@ -30,6 +30,7 @@
  * SOFTWARE.
  */
 
+#include <linux/irq.h>
 #include "en.h"
 
 struct mlx5_cqe64 *mlx5e_get_cqe(struct mlx5e_cq *cq)
@@ -49,6 +50,15 @@ struct mlx5_cqe64 *mlx5e_get_cqe(struct mlx5e_cq *cq)
 	return cqe;
 }
 
+static inline bool mlx5e_no_channel_affinity_change(struct mlx5e_channel *c)
+{
+	int current_cpu = smp_processor_id();
+	struct irq_data *d = irq_desc_get_irq_data(c->irq_desc);
+	struct cpumask *aff = irq_data_get_affinity_mask(d);
+
+	return cpumask_test_cpu(current_cpu, aff);
+}
+
 int mlx5e_napi_poll(struct napi_struct *napi, int budget)
 {
 	struct mlx5e_channel *c = container_of(napi, struct mlx5e_channel,
@@ -65,7 +75,7 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget)
 
 	busy |= mlx5e_post_rx_wqes(&c->rq);
 
-	if (busy)
+	if (busy && likely(mlx5e_no_channel_affinity_change(c)))
 		return budget;
 
 	napi_complete(napi);
-- 
2.3.7

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

* [PATCH net-next 5/8] net/mlx5e: Don't allow more than max supported channels
  2015-11-01 17:35 [PATCH net-next 0/8] Mellanox driver update, Nov 1 2015 Or Gerlitz
                   ` (3 preceding siblings ...)
  2015-11-01 17:35 ` [PATCH net-next 4/8] net/mlx5e: Consider IRQ affinity changes in NAPI poll Or Gerlitz
@ 2015-11-01 17:35 ` Or Gerlitz
  2015-11-01 17:35 ` [PATCH net-next 6/8] net/mlx5e: Return error in case mlx5e_set_features() fails Or Gerlitz
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Or Gerlitz @ 2015-11-01 17:35 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Saeed Mahameed, Achiad Shochat, Or Gerlitz

From: Achiad Shochat <achiad@mellanox.com>

Consider MLX5E_MAX_NUM_CHANNELS @ethtool set/get_channels

Signed-off-by: Achiad Shochat <achiad@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en.h         | 6 ++++++
 drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 5 ++---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c    | 3 +--
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h
index 3c5c900..c403a83 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
@@ -620,5 +620,11 @@ static inline void mlx5e_cq_arm(struct mlx5e_cq *cq)
 	mlx5_cq_arm(mcq, MLX5_CQ_DB_REQ_NOT, mcq->uar->map, NULL, cq->wq.cc);
 }
 
+static inline int mlx5e_get_max_num_channels(struct mlx5_core_dev *mdev)
+{
+	return min_t(int, mdev->priv.eq_table.num_comp_vectors,
+		     MLX5E_MAX_NUM_CHANNELS);
+}
+
 extern const struct ethtool_ops mlx5e_ethtool_ops;
 u16 mlx5e_get_max_inline_cap(struct mlx5_core_dev *mdev);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
index bce9126..2e022e9 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
@@ -345,9 +345,8 @@ static void mlx5e_get_channels(struct net_device *dev,
 			       struct ethtool_channels *ch)
 {
 	struct mlx5e_priv *priv = netdev_priv(dev);
-	int ncv = priv->mdev->priv.eq_table.num_comp_vectors;
 
-	ch->max_combined   = ncv;
+	ch->max_combined   = mlx5e_get_max_num_channels(priv->mdev);
 	ch->combined_count = priv->params.num_channels;
 }
 
@@ -355,7 +354,7 @@ static int mlx5e_set_channels(struct net_device *dev,
 			      struct ethtool_channels *ch)
 {
 	struct mlx5e_priv *priv = netdev_priv(dev);
-	int ncv = priv->mdev->priv.eq_table.num_comp_vectors;
+	int ncv = mlx5e_get_max_num_channels(priv->mdev);
 	unsigned int count = ch->combined_count;
 	bool was_opened;
 	int err = 0;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index bdbef9f..df9cecd 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -2048,8 +2048,7 @@ static void *mlx5e_create_netdev(struct mlx5_core_dev *mdev)
 {
 	struct net_device *netdev;
 	struct mlx5e_priv *priv;
-	int nch = min_t(int, mdev->priv.eq_table.num_comp_vectors,
-			MLX5E_MAX_NUM_CHANNELS);
+	int nch = mlx5e_get_max_num_channels(mdev);
 	int err;
 
 	if (mlx5e_check_required_hca_cap(mdev))
-- 
2.3.7

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

* [PATCH net-next 6/8] net/mlx5e: Return error in case mlx5e_set_features() fails
  2015-11-01 17:35 [PATCH net-next 0/8] Mellanox driver update, Nov 1 2015 Or Gerlitz
                   ` (4 preceding siblings ...)
  2015-11-01 17:35 ` [PATCH net-next 5/8] net/mlx5e: Don't allow more than max supported channels Or Gerlitz
@ 2015-11-01 17:35 ` Or Gerlitz
  2015-11-01 17:35 ` [PATCH net-next 7/8] net/mlx5e: Re-eanble client vlan TX acceleration Or Gerlitz
  2015-11-01 17:35 ` [PATCH net-next 8/8] net/mlx5e: Fix LSO vlan insertion Or Gerlitz
  7 siblings, 0 replies; 10+ messages in thread
From: Or Gerlitz @ 2015-11-01 17:35 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Saeed Mahameed, Achiad Shochat, Or Gerlitz

From: Achiad Shochat <achiad@mellanox.com>

In case mlx5e_set_features() fails, return the failure status rather
than 0.

Signed-off-by: Achiad Shochat <achiad@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index df9cecd..b284bfc 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -1844,7 +1844,7 @@ static int mlx5e_set_features(struct net_device *netdev,
 			mlx5e_disable_vlan_filter(priv);
 	}
 
-	return 0;
+	return err;
 }
 
 static int mlx5e_change_mtu(struct net_device *netdev, int new_mtu)
-- 
2.3.7

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

* [PATCH net-next 7/8] net/mlx5e: Re-eanble client vlan TX acceleration
  2015-11-01 17:35 [PATCH net-next 0/8] Mellanox driver update, Nov 1 2015 Or Gerlitz
                   ` (5 preceding siblings ...)
  2015-11-01 17:35 ` [PATCH net-next 6/8] net/mlx5e: Return error in case mlx5e_set_features() fails Or Gerlitz
@ 2015-11-01 17:35 ` Or Gerlitz
  2015-11-01 17:35 ` [PATCH net-next 8/8] net/mlx5e: Fix LSO vlan insertion Or Gerlitz
  7 siblings, 0 replies; 10+ messages in thread
From: Or Gerlitz @ 2015-11-01 17:35 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Saeed Mahameed, Achiad Shochat, Or Gerlitz

From: Achiad Shochat <achiad@mellanox.com>

This reverts commit cd58c714acb9 "net/mlx5e: Disable client vlan TX acceleration".

Bring back client vlan insertion offload, the original
performance issue was found and fixed in the next patch.

Signed-off-by: Achiad Shochat <achiad@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c |  1 +
 drivers/net/ethernet/mellanox/mlx5/core/en_tx.c   | 23 +++++++++++++++++++++--
 2 files changed, 22 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 b284bfc..b87f5f2 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -2005,6 +2005,7 @@ static void mlx5e_build_netdev(struct net_device *netdev)
 		netdev->vlan_features    |= NETIF_F_LRO;
 
 	netdev->hw_features       = netdev->vlan_features;
+	netdev->hw_features      |= NETIF_F_HW_VLAN_CTAG_TX;
 	netdev->hw_features      |= NETIF_F_HW_VLAN_CTAG_RX;
 	netdev->hw_features      |= NETIF_F_HW_VLAN_CTAG_FILTER;
 
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
index b73672f..5105288 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
@@ -124,6 +124,21 @@ static inline u16 mlx5e_get_inline_hdr_size(struct mlx5e_sq *sq,
 	return MLX5E_MIN_INLINE;
 }
 
+static inline void mlx5e_insert_vlan(void *start, struct sk_buff *skb, u16 ihs)
+{
+	struct vlan_ethhdr *vhdr = (struct vlan_ethhdr *)start;
+	int cpy1_sz = 2 * ETH_ALEN;
+	int cpy2_sz = ihs - cpy1_sz - VLAN_HLEN;
+
+	skb_copy_from_linear_data(skb, vhdr, cpy1_sz);
+	skb_pull_inline(skb, cpy1_sz);
+	vhdr->h_vlan_proto = skb->vlan_proto;
+	vhdr->h_vlan_TCI = cpu_to_be16(skb_vlan_tag_get(skb));
+	skb_copy_from_linear_data(skb, &vhdr->h_vlan_encapsulated_proto,
+				  cpy2_sz);
+	skb_pull_inline(skb, cpy2_sz);
+}
+
 static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb)
 {
 	struct mlx5_wq_cyc       *wq   = &sq->wq;
@@ -175,8 +190,12 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb)
 							ETH_ZLEN);
 	}
 
-	skb_copy_from_linear_data(skb, eseg->inline_hdr_start, ihs);
-	skb_pull_inline(skb, ihs);
+	if (skb_vlan_tag_present(skb)) {
+		mlx5e_insert_vlan(eseg->inline_hdr_start, skb, ihs);
+	} else {
+		skb_copy_from_linear_data(skb, eseg->inline_hdr_start, ihs);
+		skb_pull_inline(skb, ihs);
+	}
 
 	eseg->inline_hdr_sz = cpu_to_be16(ihs);
 
-- 
2.3.7

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

* [PATCH net-next 8/8] net/mlx5e: Fix LSO vlan insertion
  2015-11-01 17:35 [PATCH net-next 0/8] Mellanox driver update, Nov 1 2015 Or Gerlitz
                   ` (6 preceding siblings ...)
  2015-11-01 17:35 ` [PATCH net-next 7/8] net/mlx5e: Re-eanble client vlan TX acceleration Or Gerlitz
@ 2015-11-01 17:35 ` Or Gerlitz
  7 siblings, 0 replies; 10+ messages in thread
From: Or Gerlitz @ 2015-11-01 17:35 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Saeed Mahameed, Achiad Shochat, Or Gerlitz

From: Achiad Shochat <achiad@mellanox.com>

Consider vlan insertion impact on headers copy size also for LSO
packets.

Signed-off-by: Achiad Shochat <achiad@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
index 5105288..cd8f85a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
@@ -116,7 +116,7 @@ static inline u16 mlx5e_get_inline_hdr_size(struct mlx5e_sq *sq,
 	 * headers and occur before the data gather.
 	 * Therefore these headers must be copied into the WQE
 	 */
-#define MLX5E_MIN_INLINE (ETH_HLEN + 2/*vlan tag*/)
+#define MLX5E_MIN_INLINE ETH_HLEN
 
 	if (bf && (skb_headlen(skb) <= sq->max_inline))
 		return skb_headlen(skb);
@@ -128,7 +128,7 @@ static inline void mlx5e_insert_vlan(void *start, struct sk_buff *skb, u16 ihs)
 {
 	struct vlan_ethhdr *vhdr = (struct vlan_ethhdr *)start;
 	int cpy1_sz = 2 * ETH_ALEN;
-	int cpy2_sz = ihs - cpy1_sz - VLAN_HLEN;
+	int cpy2_sz = ihs - cpy1_sz;
 
 	skb_copy_from_linear_data(skb, vhdr, cpy1_sz);
 	skb_pull_inline(skb, cpy1_sz);
@@ -192,6 +192,7 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb)
 
 	if (skb_vlan_tag_present(skb)) {
 		mlx5e_insert_vlan(eseg->inline_hdr_start, skb, ihs);
+		ihs += VLAN_HLEN;
 	} else {
 		skb_copy_from_linear_data(skb, eseg->inline_hdr_start, ihs);
 		skb_pull_inline(skb, ihs);
-- 
2.3.7

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

* Re: [PATCH net-next 4/8] net/mlx5e: Consider IRQ affinity changes in NAPI poll
  2015-11-01 17:35 ` [PATCH net-next 4/8] net/mlx5e: Consider IRQ affinity changes in NAPI poll Or Gerlitz
@ 2015-11-01 22:34   ` David Miller
  0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2015-11-01 22:34 UTC (permalink / raw)
  To: ogerlitz; +Cc: netdev, saeedm, achiad

From: Or Gerlitz <ogerlitz@mellanox.com>
Date: Sun,  1 Nov 2015 19:35:18 +0200

> @@ -49,6 +50,15 @@ struct mlx5_cqe64 *mlx5e_get_cqe(struct mlx5e_cq *cq)
>  	return cqe;
>  }
>  
> +static inline bool mlx5e_no_channel_affinity_change(struct mlx5e_channel *c)
> +{
> +	int current_cpu = smp_processor_id();
> +	struct irq_data *d = irq_desc_get_irq_data(c->irq_desc);
> +	struct cpumask *aff = irq_data_get_affinity_mask(d);
> +
> +	return cpumask_test_cpu(current_cpu, aff);
> +}

This is so much pointer dereferencing and then a bitmask test as well.

Are you really sure sure an extremely rare situation warrants this
test every single NAPI poll call?

If this is a real problem, then every driver is susceptible to the
issue and it therefore warrants a generic solution.  And if we have
generic infrastructure for this situation in the code NAPI polling
networking code, I guarantee that it will probably be implemented much
more cheaply than this.

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

end of thread, other threads:[~2015-11-01 22:34 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-01 17:35 [PATCH net-next 0/8] Mellanox driver update, Nov 1 2015 Or Gerlitz
2015-11-01 17:35 ` [PATCH net-next 1/8] net/mlx5e: Avoid NULL pointer access in case of configuration failure Or Gerlitz
2015-11-01 17:35 ` [PATCH net-next 2/8] net/mlx5e: Wait for RX buffers initialization in a more proper manner Or Gerlitz
2015-11-01 17:35 ` [PATCH net-next 3/8] net/mlx5_core: Use the the real irqn in eq->irqn Or Gerlitz
2015-11-01 17:35 ` [PATCH net-next 4/8] net/mlx5e: Consider IRQ affinity changes in NAPI poll Or Gerlitz
2015-11-01 22:34   ` David Miller
2015-11-01 17:35 ` [PATCH net-next 5/8] net/mlx5e: Don't allow more than max supported channels Or Gerlitz
2015-11-01 17:35 ` [PATCH net-next 6/8] net/mlx5e: Return error in case mlx5e_set_features() fails Or Gerlitz
2015-11-01 17:35 ` [PATCH net-next 7/8] net/mlx5e: Re-eanble client vlan TX acceleration Or Gerlitz
2015-11-01 17:35 ` [PATCH net-next 8/8] net/mlx5e: Fix LSO vlan insertion Or Gerlitz

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).