netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/2] mlx4 driver encapsulation/steering fixes
@ 2014-10-30 13:59 Or Gerlitz
  2014-10-30 13:59 ` [PATCH net 1/2] net/mlx4_en: Don't attempt to TX offload the outer UDP checksum for VXLAN Or Gerlitz
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Or Gerlitz @ 2014-10-30 13:59 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, Matan Barak, Amir Vadai, Saeed Mahameed, Or Gerlitz

Hi Dave,

The 1st patch fixes a bug in the TX path that supports offloading the 
TX checksum of (VXLAN) encapsulated TCP packets. It turns out that the 
bug is revealed only when the receiver runs in non-offloaded mode, so
we somehow missed it so far... please queue it for -stable >= 3.14 

The 2nd patch makes sure not to leak steering entry on error flow, 
please queue it to 3.17-stable 

thanks,

Or.

Or Gerlitz (2):
  net/mlx4_en: Don't attempt to TX offload the outer UDP checksum for VXLAN
  mlx4: Avoid leaking steering rules on flow creation error flow

 drivers/infiniband/hw/mlx4/main.c          |   10 ++++++++--
 drivers/net/ethernet/mellanox/mlx4/en_tx.c |    7 +++++--
 drivers/net/ethernet/mellanox/mlx4/mcg.c   |    4 ++++
 3 files changed, 17 insertions(+), 4 deletions(-)

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

* [PATCH net 1/2] net/mlx4_en: Don't attempt to TX offload the outer UDP checksum for VXLAN
  2014-10-30 13:59 [PATCH net 0/2] mlx4 driver encapsulation/steering fixes Or Gerlitz
@ 2014-10-30 13:59 ` Or Gerlitz
  2014-10-30 13:59 ` [PATCH net 2/2] mlx4: Avoid leaking steering rules on flow creation error flow Or Gerlitz
  2014-10-30 23:49 ` [PATCH net 0/2] mlx4 driver encapsulation/steering fixes David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Or Gerlitz @ 2014-10-30 13:59 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, Matan Barak, Amir Vadai, Saeed Mahameed, Or Gerlitz

For VXLAN/NVGRE encapsulation, the current HW doesn't support offloading
both the outer UDP TX checksum and the inner TCP/UDP TX checksum. 

The driver doesn't advertize SKB_GSO_UDP_TUNNEL_CSUM, however we are wrongly
telling the HW to offload the outer UDP checksum for encapsulated packets,
fix that.

Fixes: 837052d0ccc5 ('net/mlx4_en: Add netdev support for TCP/IP
		     offloads of vxlan tunneling')
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx4/en_tx.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
index 34c1378..454d9fe 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
@@ -836,8 +836,11 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
 	 * whether LSO is used */
 	tx_desc->ctrl.srcrb_flags = priv->ctrl_flags;
 	if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) {
-		tx_desc->ctrl.srcrb_flags |= cpu_to_be32(MLX4_WQE_CTRL_IP_CSUM |
-							 MLX4_WQE_CTRL_TCP_UDP_CSUM);
+		if (!skb->encapsulation)
+			tx_desc->ctrl.srcrb_flags |= cpu_to_be32(MLX4_WQE_CTRL_IP_CSUM |
+								 MLX4_WQE_CTRL_TCP_UDP_CSUM);
+		else
+			tx_desc->ctrl.srcrb_flags |= cpu_to_be32(MLX4_WQE_CTRL_IP_CSUM);
 		ring->tx_csum++;
 	}
 
-- 
1.7.1

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

* [PATCH net 2/2] mlx4: Avoid leaking steering rules on flow creation error flow
  2014-10-30 13:59 [PATCH net 0/2] mlx4 driver encapsulation/steering fixes Or Gerlitz
  2014-10-30 13:59 ` [PATCH net 1/2] net/mlx4_en: Don't attempt to TX offload the outer UDP checksum for VXLAN Or Gerlitz
@ 2014-10-30 13:59 ` Or Gerlitz
  2014-10-30 23:49 ` [PATCH net 0/2] mlx4 driver encapsulation/steering fixes David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Or Gerlitz @ 2014-10-30 13:59 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, Matan Barak, Amir Vadai, Saeed Mahameed, Or Gerlitz

If mlx4_ib_create_flow() attempts to create > 1 rules with the
firmware, and one of these registrations fail, we leaked the
already created flow rules.

One example of the leak is when the registration of the VXLAN ghost
steering rule fails, we didn't unregister the original rule requested
by the user, introduced in commit d2fce8a9060d "mlx4: Set
user-space raw Ethernet QPs to properly handle VXLAN traffic".

While here, add dump of the VXLAN portion of steering rules
so it can actually be seen when flow creation fails.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/infiniband/hw/mlx4/main.c        |   10 ++++++++--
 drivers/net/ethernet/mellanox/mlx4/mcg.c |    4 ++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index bda5994..8b72cf3 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -1173,18 +1173,24 @@ static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp,
 		err = __mlx4_ib_create_flow(qp, flow_attr, domain, type[i],
 					    &mflow->reg_id[i]);
 		if (err)
-			goto err_free;
+			goto err_create_flow;
 		i++;
 	}
 
 	if (i < ARRAY_SIZE(type) && flow_attr->type == IB_FLOW_ATTR_NORMAL) {
 		err = mlx4_ib_tunnel_steer_add(qp, flow_attr, &mflow->reg_id[i]);
 		if (err)
-			goto err_free;
+			goto err_create_flow;
+		i++;
 	}
 
 	return &mflow->ibflow;
 
+err_create_flow:
+	while (i) {
+		(void)__mlx4_ib_destroy_flow(to_mdev(qp->device)->dev, mflow->reg_id[i]);
+		i--;
+	}
 err_free:
 	kfree(mflow);
 	return ERR_PTR(err);
diff --git a/drivers/net/ethernet/mellanox/mlx4/mcg.c b/drivers/net/ethernet/mellanox/mlx4/mcg.c
index ca0f98c..8728431 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mcg.c
+++ b/drivers/net/ethernet/mellanox/mlx4/mcg.c
@@ -955,6 +955,10 @@ static void mlx4_err_rule(struct mlx4_dev *dev, char *str,
 					cur->ib.dst_gid_msk);
 			break;
 
+		case MLX4_NET_TRANS_RULE_ID_VXLAN:
+			len += snprintf(buf + len, BUF_SIZE - len,
+					"VNID = %d ", be32_to_cpu(cur->vxlan.vni));
+			break;
 		case MLX4_NET_TRANS_RULE_ID_IPV6:
 			break;
 
-- 
1.7.1

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

* Re: [PATCH net 0/2] mlx4 driver encapsulation/steering fixes
  2014-10-30 13:59 [PATCH net 0/2] mlx4 driver encapsulation/steering fixes Or Gerlitz
  2014-10-30 13:59 ` [PATCH net 1/2] net/mlx4_en: Don't attempt to TX offload the outer UDP checksum for VXLAN Or Gerlitz
  2014-10-30 13:59 ` [PATCH net 2/2] mlx4: Avoid leaking steering rules on flow creation error flow Or Gerlitz
@ 2014-10-30 23:49 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2014-10-30 23:49 UTC (permalink / raw)
  To: ogerlitz; +Cc: netdev, matanb, amirv, saeedm

From: Or Gerlitz <ogerlitz@mellanox.com>
Date: Thu, 30 Oct 2014 15:59:26 +0200

> The 1st patch fixes a bug in the TX path that supports offloading the 
> TX checksum of (VXLAN) encapsulated TCP packets. It turns out that the 
> bug is revealed only when the receiver runs in non-offloaded mode, so
> we somehow missed it so far... please queue it for -stable >= 3.14 
> 
> The 2nd patch makes sure not to leak steering entry on error flow, 
> please queue it to 3.17-stable 

Applied and queue up for -stable.

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

end of thread, other threads:[~2014-10-30 23:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-30 13:59 [PATCH net 0/2] mlx4 driver encapsulation/steering fixes Or Gerlitz
2014-10-30 13:59 ` [PATCH net 1/2] net/mlx4_en: Don't attempt to TX offload the outer UDP checksum for VXLAN Or Gerlitz
2014-10-30 13:59 ` [PATCH net 2/2] mlx4: Avoid leaking steering rules on flow creation error flow Or Gerlitz
2014-10-30 23:49 ` [PATCH net 0/2] mlx4 driver encapsulation/steering fixes David Miller

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