Netdev List
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeedm@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, Hadar Hen Zion <hadarh@mellanox.com>,
	Saeed Mahameed <saeedm@mellanox.com>
Subject: [net 5/8] net/mlx5e: Support TC encapsulation offloads with upper devices
Date: Fri, 27 Jan 2017 22:38:40 +0200	[thread overview]
Message-ID: <20170127203843.3206-6-saeedm@mellanox.com> (raw)
In-Reply-To: <20170127203843.3206-1-saeedm@mellanox.com>

From: Hadar Hen Zion <hadarh@mellanox.com>

When tunneling is used, some virtualizations systems set the (mlx5e) uplink
device to be stacked under upper devices such as bridge or ovs internal
port, where the VTEP IP address used for the encapsulation is set on
that upper device.

In order to support such use-cases, we also deal with a setup where the
egress mirred device isn't representing a port on the HW e-switch to where
the ingress device belongs. We use eswitch service function which returns
the uplink and set it as the egress device of the tc encap rule.

Fixes: a54e20b4fcae ("net/mlx5e: Add basic TC tunnel set action for SRIOV offloads")
Signed-off-by: Hadar Hen Zion <hadarh@mellanox.com>
Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 46bef6a26a8c..c5282b6aba8b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -663,6 +663,7 @@ static int mlx5e_route_lookup_ipv4(struct mlx5e_priv *priv,
 				   __be32 *saddr,
 				   int *out_ttl)
 {
+	struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
 	struct rtable *rt;
 	struct neighbour *n = NULL;
 	int ttl;
@@ -677,12 +678,11 @@ static int mlx5e_route_lookup_ipv4(struct mlx5e_priv *priv,
 #else
 	return -EOPNOTSUPP;
 #endif
-
-	if (!switchdev_port_same_parent_id(priv->netdev, rt->dst.dev)) {
-		pr_warn("%s: can't offload, devices not on same HW e-switch\n", __func__);
-		ip_rt_put(rt);
-		return -EOPNOTSUPP;
-	}
+	/* if the egress device isn't on the same HW e-switch, we use the uplink */
+	if (!switchdev_port_same_parent_id(priv->netdev, rt->dst.dev))
+		*out_dev = mlx5_eswitch_get_uplink_netdev(esw);
+	else
+		*out_dev = rt->dst.dev;
 
 	ttl = ip4_dst_hoplimit(&rt->dst);
 	n = dst_neigh_lookup(&rt->dst, &fl4->daddr);
@@ -693,7 +693,6 @@ static int mlx5e_route_lookup_ipv4(struct mlx5e_priv *priv,
 	*out_n = n;
 	*saddr = fl4->saddr;
 	*out_ttl = ttl;
-	*out_dev = rt->dst.dev;
 
 	return 0;
 }
-- 
2.11.0

  parent reply	other threads:[~2017-01-27 21:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-27 20:38 [pull request][net 0/8] Mellanox mlx5 fixes 2017-01-27 Saeed Mahameed
2017-01-27 20:38 ` [net 1/8] net/mlx5: Change ENOTSUPP to EOPNOTSUPP Saeed Mahameed
2017-01-27 20:38 ` [net 2/8] net/mlx5: Return EOPNOTSUPP when failing to get steering name-space Saeed Mahameed
2017-01-27 20:38 ` [net 3/8] net/mlx5: E-Switch, Err when retrieving steering name-space fails Saeed Mahameed
2017-01-27 20:38 ` [net 4/8] net/mlx5: E-Switch, Re-enable RoCE on mode change only after FDB destroy Saeed Mahameed
2017-01-27 20:38 ` Saeed Mahameed [this message]
2017-01-27 20:38 ` [net 6/8] net/mlx5e: Modify TIRs hash only when it's needed Saeed Mahameed
2017-01-27 20:38 ` [net 7/8] net/mlx5e: Fix update of hash function/key via ethtool Saeed Mahameed
2017-01-27 21:50   ` Tom Herbert
2017-01-28 11:06     ` Saeed Mahameed
2017-01-27 20:38 ` [net 8/8] net/mlx5e: Check ets capability before ets query FW command Saeed Mahameed
2017-01-29 20:57 ` [pull request][net 0/8] Mellanox mlx5 fixes 2017-01-27 Saeed Mahameed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170127203843.3206-6-saeedm@mellanox.com \
    --to=saeedm@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=hadarh@mellanox.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox