netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [pull request][net-next 00/10] Mellanox, mlx5e updates 2019-06-28
@ 2019-06-28 23:18 Saeed Mahameed
  2019-06-28 23:18 ` [net-next 01/10] net/mlx5: MPFS, Cleanup add MAC flow Saeed Mahameed
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: Saeed Mahameed @ 2019-06-28 23:18 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Saeed Mahameed

Hi Dave,

This series adds misc updates to mlx5e driver.
For more information please see tag log below.

Please pull and let me know if there is any problem.

Please note that the series starts with a merge of mlx5-next branch,
to resolve and avoid dependency with rdma tree.
This pull provides the resolution of the conflict reported by Stephen:
https://lkml.org/lkml/2019/6/27/1016

Thanks,
Saeed.

---
The following changes since commit 4f5d1beadc10b62e141338570b9c32d857814bb0:

  Merge branch 'mlx5-next' of git://git.kernel.org/pub/scm/linux/kernel/git/mellanox/linux (2019-06-28 16:03:54 -0700)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5e-updates-2019-06-28

for you to fetch changes up to f6dc1264f1c01976a84239d1038359604ee42001:

  net/mlx5e: Disallow tc redirect offload cases we don't support (2019-06-28 16:04:00 -0700)

----------------------------------------------------------------
mlx5e-updates-2019-06-28

This series adds some misc updates for mlx5e driver

1) Allow adding the same mac more than once in MPFS table
2) Move to HW checksumming advertising
3) Report netdevice MPLS features
4) Correct physical port name of the PF representor
5) Reduce stack usage in mlx5_eswitch_termtbl_create
6) Refresh TIR improvement for representors
7) Expose same physical switch_id for all representors

----------------------------------------------------------------
Ariel Levkovich (2):
      net/mlx5e: Move to HW checksumming advertising
      net/mlx5e: Report netdevice MPLS features

Arnd Bergmann (1):
      net/mlx5e: reduce stack usage in mlx5_eswitch_termtbl_create

Gavi Teitz (3):
      net/mlx5: MPFS, Cleanup add MAC flow
      net/mlx5: MPFS, Allow adding the same MAC more than once
      net/mlx5e: Don't refresh TIRs when updating representor SQs

Parav Pandit (2):
      net/mlx5e: Correct phys_port_name for PF port
      net/mlx5e: Set drvinfo in generic manner

Paul Blakey (2):
      net/mlx5e: Expose same physical switch_id for all representors
      net/mlx5e: Disallow tc redirect offload cases we don't support

 drivers/net/ethernet/mellanox/mlx5/core/en.h       |  2 ++
 .../net/ethernet/mellanox/mlx5/core/en/tc_tun.c    |  4 ++-
 .../net/ethernet/mellanox/mlx5/core/en_ethtool.c   |  2 +-
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c  | 21 ++++++++----
 drivers/net/ethernet/mellanox/mlx5/core/en_rep.c   | 38 ++++++++++------------
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c    | 22 ++++++++++---
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.h    |  3 ++
 .../mellanox/mlx5/core/eswitch_offloads_termtbl.c  |  2 +-
 drivers/net/ethernet/mellanox/mlx5/core/fs_core.c  | 20 ++++++------
 .../net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c  |  3 +-
 .../ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c |  3 +-
 drivers/net/ethernet/mellanox/mlx5/core/lib/mpfs.c | 33 ++++++++++++-------
 include/linux/mlx5/fs.h                            |  2 +-
 13 files changed, 97 insertions(+), 58 deletions(-)

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

* [net-next 01/10] net/mlx5: MPFS, Cleanup add MAC flow
  2019-06-28 23:18 [pull request][net-next 00/10] Mellanox, mlx5e updates 2019-06-28 Saeed Mahameed
@ 2019-06-28 23:18 ` Saeed Mahameed
  2019-06-28 23:18 ` [net-next 02/10] net/mlx5: MPFS, Allow adding the same MAC more than once Saeed Mahameed
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Saeed Mahameed @ 2019-06-28 23:18 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Gavi Teitz, Saeed Mahameed

From: Gavi Teitz <gavi@mellanox.com>

Unify and isolate the error handling flow in mlx5_mpfs_add_mac(),
removing code duplication.

Signed-off-by: Gavi Teitz <gavi@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 .../ethernet/mellanox/mlx5/core/lib/mpfs.c    | 26 +++++++++++--------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/mpfs.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/mpfs.c
index a71d5b9c7ab2..9ae7dad590a9 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lib/mpfs.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/mpfs.c
@@ -134,8 +134,8 @@ int mlx5_mpfs_add_mac(struct mlx5_core_dev *dev, u8 *mac)
 {
 	struct mlx5_mpfs *mpfs = dev->priv.mpfs;
 	struct l2table_node *l2addr;
+	int err = 0;
 	u32 index;
-	int err;
 
 	if (!MLX5_ESWITCH_MANAGER(dev))
 		return 0;
@@ -145,29 +145,33 @@ int mlx5_mpfs_add_mac(struct mlx5_core_dev *dev, u8 *mac)
 	l2addr = l2addr_hash_find(mpfs->hash, mac, struct l2table_node);
 	if (l2addr) {
 		err = -EEXIST;
-		goto abort;
+		goto out;
 	}
 
 	err = alloc_l2table_index(mpfs, &index);
 	if (err)
-		goto abort;
+		goto out;
 
 	l2addr = l2addr_hash_add(mpfs->hash, mac, struct l2table_node, GFP_KERNEL);
 	if (!l2addr) {
-		free_l2table_index(mpfs, index);
 		err = -ENOMEM;
-		goto abort;
+		goto hash_add_err;
 	}
 
-	l2addr->index = index;
 	err = set_l2table_entry_cmd(dev, index, mac);
-	if (err) {
-		l2addr_hash_del(l2addr);
-		free_l2table_index(mpfs, index);
-	}
+	if (err)
+		goto set_table_entry_err;
+
+	l2addr->index = index;
 
 	mlx5_core_dbg(dev, "MPFS mac added %pM, index (%d)\n", mac, index);
-abort:
+	goto out;
+
+set_table_entry_err:
+	l2addr_hash_del(l2addr);
+hash_add_err:
+	free_l2table_index(mpfs, index);
+out:
 	mutex_unlock(&mpfs->lock);
 	return err;
 }
-- 
2.21.0


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

* [net-next 02/10] net/mlx5: MPFS, Allow adding the same MAC more than once
  2019-06-28 23:18 [pull request][net-next 00/10] Mellanox, mlx5e updates 2019-06-28 Saeed Mahameed
  2019-06-28 23:18 ` [net-next 01/10] net/mlx5: MPFS, Cleanup add MAC flow Saeed Mahameed
@ 2019-06-28 23:18 ` Saeed Mahameed
  2019-06-28 23:18 ` [net-next 03/10] net/mlx5e: Move to HW checksumming advertising Saeed Mahameed
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Saeed Mahameed @ 2019-06-28 23:18 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Gavi Teitz, Saeed Mahameed

From: Gavi Teitz <gavi@mellanox.com>

Remove the limitation preventing adding a vport's MAC address to the
Multi-Physical Function Switch (MPFS) more than once per E-switch, as
there is no difference in the MPFS if an address is being used by an
E-switch more than once.

This allows the E-switch to have multiple vports with the same MAC
address, allowing vports to be classified by VLAN id instead of by MAC
if desired.

Signed-off-by: Gavi Teitz <gavi@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/lib/mpfs.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/mpfs.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/mpfs.c
index 9ae7dad590a9..3118e8d66407 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lib/mpfs.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/mpfs.c
@@ -67,6 +67,7 @@ static int del_l2table_entry_cmd(struct mlx5_core_dev *dev, u32 index)
 struct l2table_node {
 	struct l2addr_node node;
 	u32                index; /* index in HW l2 table */
+	int                ref_count;
 };
 
 struct mlx5_mpfs {
@@ -144,7 +145,7 @@ int mlx5_mpfs_add_mac(struct mlx5_core_dev *dev, u8 *mac)
 
 	l2addr = l2addr_hash_find(mpfs->hash, mac, struct l2table_node);
 	if (l2addr) {
-		err = -EEXIST;
+		l2addr->ref_count++;
 		goto out;
 	}
 
@@ -163,6 +164,7 @@ int mlx5_mpfs_add_mac(struct mlx5_core_dev *dev, u8 *mac)
 		goto set_table_entry_err;
 
 	l2addr->index = index;
+	l2addr->ref_count = 1;
 
 	mlx5_core_dbg(dev, "MPFS mac added %pM, index (%d)\n", mac, index);
 	goto out;
@@ -194,6 +196,9 @@ int mlx5_mpfs_del_mac(struct mlx5_core_dev *dev, u8 *mac)
 		goto unlock;
 	}
 
+	if (--l2addr->ref_count > 0)
+		goto unlock;
+
 	index = l2addr->index;
 	del_l2table_entry_cmd(dev, index);
 	l2addr_hash_del(l2addr);
-- 
2.21.0


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

* [net-next 03/10] net/mlx5e: Move to HW checksumming advertising
  2019-06-28 23:18 [pull request][net-next 00/10] Mellanox, mlx5e updates 2019-06-28 Saeed Mahameed
  2019-06-28 23:18 ` [net-next 01/10] net/mlx5: MPFS, Cleanup add MAC flow Saeed Mahameed
  2019-06-28 23:18 ` [net-next 02/10] net/mlx5: MPFS, Allow adding the same MAC more than once Saeed Mahameed
@ 2019-06-28 23:18 ` Saeed Mahameed
  2019-06-28 23:18 ` [net-next 04/10] net/mlx5e: Report netdevice MPLS features Saeed Mahameed
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Saeed Mahameed @ 2019-06-28 23:18 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Ariel Levkovich, Saeed Mahameed

From: Ariel Levkovich <lariel@mellanox.com>

This patch changes the way the driver advertises its checksum offload
capabilities within the net device features bit mask.

Instead of advertising protocol specific checksumming capabilities
which are limited today to IPv4 and IPv6, we move to reporing
generic HW checksumming capabilities.

This will allow the network stack to let mlx5 device offload checksum
for cases where the IP header is encapsulated within another protocol
and the skb->protocol doesn't indicate one of the IP versions protocol,
specifically in the case of MPLS label encapsulating the IP header and
the skb->protocol indiciates MPLS ethertype rather than IP.

Moving the HW_CSUM reporting is required in the basic net device hw
features mask and also in the extensions (vlan and encpasulation
features) since the extensions are always multiplied by the basic
features set during the packet's traversal through the stack's tx flow.

Signed-off-by: Ariel Levkovich <lariel@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 6 ++----
 1 file changed, 2 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 4789735b8c7f..8995cdd4d24c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -4617,8 +4617,7 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
 	netdev->ethtool_ops	  = &mlx5e_ethtool_ops;
 
 	netdev->vlan_features    |= NETIF_F_SG;
-	netdev->vlan_features    |= NETIF_F_IP_CSUM;
-	netdev->vlan_features    |= NETIF_F_IPV6_CSUM;
+	netdev->vlan_features    |= NETIF_F_HW_CSUM;
 	netdev->vlan_features    |= NETIF_F_GRO;
 	netdev->vlan_features    |= NETIF_F_TSO;
 	netdev->vlan_features    |= NETIF_F_TSO6;
@@ -4640,8 +4639,7 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
 
 	if (mlx5_vxlan_allowed(mdev->vxlan) || mlx5_geneve_tx_allowed(mdev) ||
 	    MLX5_CAP_ETH(mdev, tunnel_stateless_gre)) {
-		netdev->hw_enc_features |= NETIF_F_IP_CSUM;
-		netdev->hw_enc_features |= NETIF_F_IPV6_CSUM;
+		netdev->hw_enc_features |= NETIF_F_HW_CSUM;
 		netdev->hw_enc_features |= NETIF_F_TSO;
 		netdev->hw_enc_features |= NETIF_F_TSO6;
 		netdev->hw_enc_features |= NETIF_F_GSO_PARTIAL;
-- 
2.21.0


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

* [net-next 04/10] net/mlx5e: Report netdevice MPLS features
  2019-06-28 23:18 [pull request][net-next 00/10] Mellanox, mlx5e updates 2019-06-28 Saeed Mahameed
                   ` (2 preceding siblings ...)
  2019-06-28 23:18 ` [net-next 03/10] net/mlx5e: Move to HW checksumming advertising Saeed Mahameed
@ 2019-06-28 23:18 ` Saeed Mahameed
  2019-06-28 23:18 ` [net-next 05/10] net/mlx5e: Correct phys_port_name for PF port Saeed Mahameed
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Saeed Mahameed @ 2019-06-28 23:18 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Ariel Levkovich, Saeed Mahameed

From: Ariel Levkovich <lariel@mellanox.com>

Set supported device features in the netdevice MPLS features mask.
This will enable HW checksumming and TSO for MPLS tagged traffic.

Signed-off-by: Ariel Levkovich <lariel@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 8995cdd4d24c..3df663d6e4d8 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -4624,6 +4624,11 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
 	netdev->vlan_features    |= NETIF_F_RXCSUM;
 	netdev->vlan_features    |= NETIF_F_RXHASH;
 
+	netdev->mpls_features    |= NETIF_F_SG;
+	netdev->mpls_features    |= NETIF_F_HW_CSUM;
+	netdev->mpls_features    |= NETIF_F_TSO;
+	netdev->mpls_features    |= NETIF_F_TSO6;
+
 	netdev->hw_enc_features  |= NETIF_F_HW_VLAN_CTAG_TX;
 	netdev->hw_enc_features  |= NETIF_F_HW_VLAN_CTAG_RX;
 
-- 
2.21.0


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

* [net-next 05/10] net/mlx5e: Correct phys_port_name for PF port
  2019-06-28 23:18 [pull request][net-next 00/10] Mellanox, mlx5e updates 2019-06-28 Saeed Mahameed
                   ` (3 preceding siblings ...)
  2019-06-28 23:18 ` [net-next 04/10] net/mlx5e: Report netdevice MPLS features Saeed Mahameed
@ 2019-06-28 23:18 ` Saeed Mahameed
  2019-06-28 23:18 ` [net-next 06/10] net/mlx5e: Set drvinfo in generic manner Saeed Mahameed
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Saeed Mahameed @ 2019-06-28 23:18 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Parav Pandit, Vu Pham, Saeed Mahameed

From: Parav Pandit <parav@mellanox.com>

Currently PF phys_port_name is named as pfNvf-1 as vport number for PF
vport is 65535.
Correct PF's phys_port name as agreed upon name as pfN.

Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Vu Pham <vuhuong@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
index 3999da3e6314..dee2fbbf3c12 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -1145,6 +1145,8 @@ static int mlx5e_rep_get_phys_port_name(struct net_device *dev,
 
 	if (rep->vport == MLX5_VPORT_UPLINK)
 		ret = snprintf(buf, len, "p%d", fn);
+	else if (rep->vport == MLX5_VPORT_PF)
+		ret = snprintf(buf, len, "pf%d", fn);
 	else
 		ret = snprintf(buf, len, "pf%dvf%d", fn, rep->vport - 1);
 
-- 
2.21.0


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

* [net-next 06/10] net/mlx5e: Set drvinfo in generic manner
  2019-06-28 23:18 [pull request][net-next 00/10] Mellanox, mlx5e updates 2019-06-28 Saeed Mahameed
                   ` (4 preceding siblings ...)
  2019-06-28 23:18 ` [net-next 05/10] net/mlx5e: Correct phys_port_name for PF port Saeed Mahameed
@ 2019-06-28 23:18 ` Saeed Mahameed
  2019-06-28 23:18 ` [net-next 07/10] net/mlx5e: reduce stack usage in mlx5_eswitch_termtbl_create Saeed Mahameed
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Saeed Mahameed @ 2019-06-28 23:18 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Parav Pandit, Vu Pham, Saeed Mahameed

From: Parav Pandit <parav@mellanox.com>

Consider PCI and non PCI device types while setting device name
in get_drvinfo() callback using existing generic device.

Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Vu Pham <vuhuong@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 05f07331ab41..198a52d1e515 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
@@ -46,7 +46,7 @@ void mlx5e_ethtool_get_drvinfo(struct mlx5e_priv *priv,
 		 "%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),
+	strlcpy(drvinfo->bus_info, dev_name(mdev->device),
 		sizeof(drvinfo->bus_info));
 }
 
-- 
2.21.0


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

* [net-next 07/10] net/mlx5e: reduce stack usage in mlx5_eswitch_termtbl_create
  2019-06-28 23:18 [pull request][net-next 00/10] Mellanox, mlx5e updates 2019-06-28 Saeed Mahameed
                   ` (5 preceding siblings ...)
  2019-06-28 23:18 ` [net-next 06/10] net/mlx5e: Set drvinfo in generic manner Saeed Mahameed
@ 2019-06-28 23:18 ` Saeed Mahameed
  2019-06-28 23:18 ` [net-next 08/10] net/mlx5e: Don't refresh TIRs when updating representor SQs Saeed Mahameed
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Saeed Mahameed @ 2019-06-28 23:18 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Arnd Bergmann, Saeed Mahameed, Mark Bloch

From: Arnd Bergmann <arnd@arndb.de>

Putting an empty 'mlx5_flow_spec' structure on the stack is a bit
wasteful and causes a warning on 32-bit architectures when building
with clang -fsanitize-coverage:

drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtbl.c: In function 'mlx5_eswitch_termtbl_create':
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtbl.c:90:1: error: the frame size of 1032 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]

Since the structure is never written to, we can statically allocate
it to avoid the stack usage. To be on the safe side, mark all
subsequent function arguments that we pass it into as 'const'
as well.

Fixes: 10caabdaad5a ("net/mlx5e: Use termination table for VLAN push actions")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Saeed Mahameed <saeedm@mellanox.com>
Acked-by: Mark Bloch <markb@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 .../mlx5/core/eswitch_offloads_termtbl.c      |  2 +-
 .../net/ethernet/mellanox/mlx5/core/fs_core.c | 20 +++++++++----------
 include/linux/mlx5/fs.h                       |  2 +-
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtbl.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtbl.c
index cb7d8ebe2c95..1d55a324a17e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtbl.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtbl.c
@@ -49,8 +49,8 @@ mlx5_eswitch_termtbl_create(struct mlx5_core_dev *dev,
 			    struct mlx5_termtbl_handle *tt,
 			    struct mlx5_flow_act *flow_act)
 {
+	static const struct mlx5_flow_spec spec = {};
 	struct mlx5_flow_namespace *root_ns;
-	struct mlx5_flow_spec spec = {};
 	int prio, flags;
 	int err;
 
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
index 585e7adcbf99..a68a51c5011a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
@@ -584,7 +584,7 @@ static int insert_fte(struct mlx5_flow_group *fg, struct fs_fte *fte)
 }
 
 static struct fs_fte *alloc_fte(struct mlx5_flow_table *ft,
-				struct mlx5_flow_spec *spec,
+				const struct mlx5_flow_spec *spec,
 				struct mlx5_flow_act *flow_act)
 {
 	struct mlx5_flow_steering *steering = get_steering(&ft->node);
@@ -613,7 +613,7 @@ static void dealloc_flow_group(struct mlx5_flow_steering *steering,
 
 static struct mlx5_flow_group *alloc_flow_group(struct mlx5_flow_steering *steering,
 						u8 match_criteria_enable,
-						void *match_criteria,
+						const void *match_criteria,
 						int start_index,
 						int end_index)
 {
@@ -643,7 +643,7 @@ static struct mlx5_flow_group *alloc_flow_group(struct mlx5_flow_steering *steer
 
 static struct mlx5_flow_group *alloc_insert_flow_group(struct mlx5_flow_table *ft,
 						       u8 match_criteria_enable,
-						       void *match_criteria,
+						       const void *match_criteria,
 						       int start_index,
 						       int end_index,
 						       struct list_head *prev)
@@ -1286,7 +1286,7 @@ add_rule_fte(struct fs_fte *fte,
 }
 
 static struct mlx5_flow_group *alloc_auto_flow_group(struct mlx5_flow_table  *ft,
-						     struct mlx5_flow_spec *spec)
+						     const struct mlx5_flow_spec *spec)
 {
 	struct list_head *prev = &ft->node.children;
 	struct mlx5_flow_group *fg;
@@ -1454,7 +1454,7 @@ static int check_conflicting_ftes(struct fs_fte *fte,
 }
 
 static struct mlx5_flow_handle *add_rule_fg(struct mlx5_flow_group *fg,
-					    struct mlx5_flow_spec *spec,
+					    const struct mlx5_flow_spec *spec,
 					    struct mlx5_flow_act *flow_act,
 					    struct mlx5_flow_destination *dest,
 					    int dest_num,
@@ -1539,7 +1539,7 @@ static void free_match_list(struct match_list_head *head)
 
 static int build_match_list(struct match_list_head *match_head,
 			    struct mlx5_flow_table *ft,
-			    struct mlx5_flow_spec *spec)
+			    const struct mlx5_flow_spec *spec)
 {
 	struct rhlist_head *tmp, *list;
 	struct mlx5_flow_group *g;
@@ -1592,7 +1592,7 @@ static u64 matched_fgs_get_version(struct list_head *match_head)
 
 static struct fs_fte *
 lookup_fte_locked(struct mlx5_flow_group *g,
-		  u32 *match_value,
+		  const u32 *match_value,
 		  bool take_write)
 {
 	struct fs_fte *fte_tmp;
@@ -1625,7 +1625,7 @@ lookup_fte_locked(struct mlx5_flow_group *g,
 static struct mlx5_flow_handle *
 try_add_to_existing_fg(struct mlx5_flow_table *ft,
 		       struct list_head *match_head,
-		       struct mlx5_flow_spec *spec,
+		       const struct mlx5_flow_spec *spec,
 		       struct mlx5_flow_act *flow_act,
 		       struct mlx5_flow_destination *dest,
 		       int dest_num,
@@ -1716,7 +1716,7 @@ try_add_to_existing_fg(struct mlx5_flow_table *ft,
 
 static struct mlx5_flow_handle *
 _mlx5_add_flow_rules(struct mlx5_flow_table *ft,
-		     struct mlx5_flow_spec *spec,
+		     const struct mlx5_flow_spec *spec,
 		     struct mlx5_flow_act *flow_act,
 		     struct mlx5_flow_destination *dest,
 		     int dest_num)
@@ -1823,7 +1823,7 @@ static bool fwd_next_prio_supported(struct mlx5_flow_table *ft)
 
 struct mlx5_flow_handle *
 mlx5_add_flow_rules(struct mlx5_flow_table *ft,
-		    struct mlx5_flow_spec *spec,
+		    const struct mlx5_flow_spec *spec,
 		    struct mlx5_flow_act *flow_act,
 		    struct mlx5_flow_destination *dest,
 		    int num_dest)
diff --git a/include/linux/mlx5/fs.h b/include/linux/mlx5/fs.h
index dc7e7aa53a13..04a569568eac 100644
--- a/include/linux/mlx5/fs.h
+++ b/include/linux/mlx5/fs.h
@@ -208,7 +208,7 @@ struct mlx5_flow_act {
  */
 struct mlx5_flow_handle *
 mlx5_add_flow_rules(struct mlx5_flow_table *ft,
-		    struct mlx5_flow_spec *spec,
+		    const struct mlx5_flow_spec *spec,
 		    struct mlx5_flow_act *flow_act,
 		    struct mlx5_flow_destination *dest,
 		    int num_dest);
-- 
2.21.0


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

* [net-next 08/10] net/mlx5e: Don't refresh TIRs when updating representor SQs
  2019-06-28 23:18 [pull request][net-next 00/10] Mellanox, mlx5e updates 2019-06-28 Saeed Mahameed
                   ` (6 preceding siblings ...)
  2019-06-28 23:18 ` [net-next 07/10] net/mlx5e: reduce stack usage in mlx5_eswitch_termtbl_create Saeed Mahameed
@ 2019-06-28 23:18 ` Saeed Mahameed
  2019-06-28 23:18 ` [net-next 09/10] net/mlx5e: Expose same physical switch_id for all representors Saeed Mahameed
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Saeed Mahameed @ 2019-06-28 23:18 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, Gavi Teitz, Roi Dayan, Tariq Toukan, Saeed Mahameed

From: Gavi Teitz <gavi@mellanox.com>

Refreshing TIRs is done in order to update the TIRs with the current
state of SQs in the transport domain, so that the TIRs can filter out
undesired self-loopback packets based on the source SQ of the packet.

Representor TIRs will only receive packets that originate from their
associated vport, due to dedicated steering, and therefore will never
receive self-loopback packets, whose source vport will be the vport of
the E-Switch manager, and therefore not the vport associated with the
representor. As such, it is not necessary to refresh the representors'
TIRs, since self-loopback packets can't reach them.

Since representors only exist in switchdev mode, and there is no
scenario in which a representor will exist in the transport domain
alongside a non-representor, it is not necessary to refresh the
transport domain's TIRs upon changing the state of a representor's
queues. Therefore, do not refresh TIRs upon such a change. Achieve
this by adding an update_rx callback to the mlx5e_profile, which
refreshes TIRs for non-representors and does nothing for representors,
and replace instances of mlx5e_refresh_tirs() upon changing the state
of the queues with update_rx().

Signed-off-by: Gavi Teitz <gavi@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Tariq Toukan <tariqt@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      | 10 ++++++++--
 drivers/net/ethernet/mellanox/mlx5/core/en_rep.c       |  7 +++++++
 drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c  |  3 ++-
 .../net/ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c |  3 ++-
 5 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h
index 3fe3fe128256..3281ace5e126 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
@@ -763,6 +763,7 @@ struct mlx5e_profile {
 	void	(*cleanup_tx)(struct mlx5e_priv *priv);
 	void	(*enable)(struct mlx5e_priv *priv);
 	void	(*disable)(struct mlx5e_priv *priv);
+	int	(*update_rx)(struct mlx5e_priv *priv);
 	void	(*update_stats)(struct mlx5e_priv *priv);
 	void	(*update_carrier)(struct mlx5e_priv *priv);
 	struct {
@@ -1034,6 +1035,7 @@ int mlx5e_create_tis(struct mlx5_core_dev *mdev, int tc,
 void mlx5e_destroy_tis(struct mlx5_core_dev *mdev, u32 tisn);
 
 int mlx5e_create_tises(struct mlx5e_priv *priv);
+int mlx5e_update_nic_rx(struct mlx5e_priv *priv);
 void mlx5e_update_carrier(struct mlx5e_priv *priv);
 int mlx5e_close(struct net_device *netdev);
 int mlx5e_open(struct net_device *netdev);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 3df663d6e4d8..1085040675ae 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -2845,7 +2845,7 @@ static void mlx5e_switch_priv_channels(struct mlx5e_priv *priv,
 	if (hw_modify)
 		hw_modify(priv);
 
-	mlx5e_refresh_tirs(priv, false);
+	priv->profile->update_rx(priv);
 	mlx5e_activate_priv_channels(priv);
 
 	/* return carrier back if needed */
@@ -2892,7 +2892,7 @@ int mlx5e_open_locked(struct net_device *netdev)
 	if (err)
 		goto err_clear_state_opened_flag;
 
-	mlx5e_refresh_tirs(priv, false);
+	priv->profile->update_rx(priv);
 	mlx5e_activate_priv_channels(priv);
 	if (priv->profile->update_carrier)
 		priv->profile->update_carrier(priv);
@@ -4928,6 +4928,11 @@ static void mlx5e_nic_disable(struct mlx5e_priv *priv)
 	mlx5_lag_remove(mdev);
 }
 
+int mlx5e_update_nic_rx(struct mlx5e_priv *priv)
+{
+	return mlx5e_refresh_tirs(priv, false);
+}
+
 static const struct mlx5e_profile mlx5e_nic_profile = {
 	.init		   = mlx5e_nic_init,
 	.cleanup	   = mlx5e_nic_cleanup,
@@ -4937,6 +4942,7 @@ static const struct mlx5e_profile mlx5e_nic_profile = {
 	.cleanup_tx	   = mlx5e_cleanup_nic_tx,
 	.enable		   = mlx5e_nic_enable,
 	.disable	   = mlx5e_nic_disable,
+	.update_rx	   = mlx5e_update_nic_rx,
 	.update_stats	   = mlx5e_update_ndo_stats,
 	.update_carrier	   = mlx5e_update_carrier,
 	.rx_handlers.handle_rx_cqe       = mlx5e_handle_rx_cqe,
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
index dee2fbbf3c12..fce3814bdb2f 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -1638,6 +1638,11 @@ static void mlx5e_rep_enable(struct mlx5e_priv *priv)
 	mlx5e_set_netdev_mtu_boundaries(priv);
 }
 
+static int mlx5e_update_rep_rx(struct mlx5e_priv *priv)
+{
+	return 0;
+}
+
 static int uplink_rep_async_event(struct notifier_block *nb, unsigned long event, void *data)
 {
 	struct mlx5e_priv *priv = container_of(nb, struct mlx5e_priv, events_nb);
@@ -1713,6 +1718,7 @@ static const struct mlx5e_profile mlx5e_rep_profile = {
 	.init_tx		= mlx5e_init_rep_tx,
 	.cleanup_tx		= mlx5e_cleanup_rep_tx,
 	.enable		        = mlx5e_rep_enable,
+	.update_rx		= mlx5e_update_rep_rx,
 	.update_stats           = mlx5e_rep_update_hw_counters,
 	.rx_handlers.handle_rx_cqe       = mlx5e_handle_rx_cqe_rep,
 	.rx_handlers.handle_rx_cqe_mpwqe = mlx5e_handle_rx_cqe_mpwrq,
@@ -1728,6 +1734,7 @@ static const struct mlx5e_profile mlx5e_uplink_rep_profile = {
 	.cleanup_tx		= mlx5e_cleanup_rep_tx,
 	.enable		        = mlx5e_uplink_rep_enable,
 	.disable	        = mlx5e_uplink_rep_disable,
+	.update_rx		= mlx5e_update_rep_rx,
 	.update_stats           = mlx5e_uplink_rep_update_hw_counters,
 	.update_carrier	        = mlx5e_update_carrier,
 	.rx_handlers.handle_rx_cqe       = mlx5e_handle_rx_cqe_rep,
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
index 9ca492b430d8..e68d124eb625 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
@@ -418,6 +418,7 @@ static const struct mlx5e_profile mlx5i_nic_profile = {
 	.cleanup_rx	   = mlx5i_cleanup_rx,
 	.enable		   = NULL, /* mlx5i_enable */
 	.disable	   = NULL, /* mlx5i_disable */
+	.update_rx	   = mlx5e_update_nic_rx,
 	.update_stats	   = NULL, /* mlx5i_update_stats */
 	.update_carrier    = NULL, /* no HW update in IB link */
 	.rx_handlers.handle_rx_cqe       = mlx5i_handle_rx_cqe,
@@ -526,7 +527,7 @@ static int mlx5i_open(struct net_device *netdev)
 	if (err)
 		goto err_remove_fs_underlay_qp;
 
-	mlx5e_refresh_tirs(epriv, false);
+	epriv->profile->update_rx(epriv);
 	mlx5e_activate_priv_channels(epriv);
 
 	mutex_unlock(&epriv->state_lock);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c
index b491b8f5fd6b..e05186ada721 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c
@@ -221,7 +221,7 @@ static int mlx5i_pkey_open(struct net_device *netdev)
 		mlx5_core_warn(mdev, "opening child channels failed, %d\n", err);
 		goto err_clear_state_opened_flag;
 	}
-	mlx5e_refresh_tirs(epriv, false);
+	epriv->profile->update_rx(epriv);
 	mlx5e_activate_priv_channels(epriv);
 	mutex_unlock(&epriv->state_lock);
 
@@ -350,6 +350,7 @@ static const struct mlx5e_profile mlx5i_pkey_nic_profile = {
 	.cleanup_rx	   = mlx5i_pkey_cleanup_rx,
 	.enable		   = NULL,
 	.disable	   = NULL,
+	.update_rx	   = mlx5e_update_nic_rx,
 	.update_stats	   = NULL,
 	.rx_handlers.handle_rx_cqe       = mlx5i_handle_rx_cqe,
 	.rx_handlers.handle_rx_cqe_mpwqe = NULL, /* Not supported */
-- 
2.21.0


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

* [net-next 09/10] net/mlx5e: Expose same physical switch_id for all representors
  2019-06-28 23:18 [pull request][net-next 00/10] Mellanox, mlx5e updates 2019-06-28 Saeed Mahameed
                   ` (7 preceding siblings ...)
  2019-06-28 23:18 ` [net-next 08/10] net/mlx5e: Don't refresh TIRs when updating representor SQs Saeed Mahameed
@ 2019-06-28 23:18 ` Saeed Mahameed
  2019-06-28 23:18 ` [net-next 10/10] net/mlx5e: Disallow tc redirect offload cases we don't support Saeed Mahameed
  2019-07-01  1:42 ` [pull request][net-next 00/10] Mellanox, mlx5e updates 2019-06-28 David Miller
  10 siblings, 0 replies; 12+ messages in thread
From: Saeed Mahameed @ 2019-06-28 23:18 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, Paul Blakey, Parav Pandit, Roi Dayan, Saeed Mahameed

From: Paul Blakey <paulb@mellanox.com>

Report system_image_guid as the E-Switch switch_id, this ensures
that when a NIC contains multiple PCI functions and which
has merged eswitch capability, all representors from
multiple PFs publish same switch_id.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 .../net/ethernet/mellanox/mlx5/core/en_rep.c  | 29 ++++++-------------
 1 file changed, 9 insertions(+), 20 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
index fce3814bdb2f..330034fcdfc5 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -391,30 +391,19 @@ static const struct ethtool_ops mlx5e_uplink_rep_ethtool_ops = {
 static int mlx5e_rep_get_port_parent_id(struct net_device *dev,
 					struct netdev_phys_item_id *ppid)
 {
-	struct mlx5e_priv *priv = netdev_priv(dev);
-	struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
-	struct net_device *uplink_upper = NULL;
-	struct mlx5e_priv *uplink_priv = NULL;
-	struct net_device *uplink_dev;
+	struct mlx5_eswitch *esw;
+	struct mlx5e_priv *priv;
+	u64 parent_id;
+
+	priv = netdev_priv(dev);
+	esw = priv->mdev->priv.eswitch;
 
 	if (esw->mode == SRIOV_NONE)
 		return -EOPNOTSUPP;
 
-	uplink_dev = mlx5_eswitch_uplink_get_proto_dev(esw, REP_ETH);
-	if (uplink_dev) {
-		uplink_upper = netdev_master_upper_dev_get(uplink_dev);
-		uplink_priv = netdev_priv(uplink_dev);
-	}
-
-	ppid->id_len = ETH_ALEN;
-	if (uplink_upper && mlx5_lag_is_sriov(uplink_priv->mdev)) {
-		ether_addr_copy(ppid->id, uplink_upper->dev_addr);
-	} else {
-		struct mlx5e_rep_priv *rpriv = priv->ppriv;
-		struct mlx5_eswitch_rep *rep = rpriv->rep;
-
-		ether_addr_copy(ppid->id, rep->hw_id);
-	}
+	parent_id = mlx5_query_nic_system_image_guid(priv->mdev);
+	ppid->id_len = sizeof(parent_id);
+	memcpy(ppid->id, &parent_id, sizeof(parent_id));
 
 	return 0;
 }
-- 
2.21.0


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

* [net-next 10/10] net/mlx5e: Disallow tc redirect offload cases we don't support
  2019-06-28 23:18 [pull request][net-next 00/10] Mellanox, mlx5e updates 2019-06-28 Saeed Mahameed
                   ` (8 preceding siblings ...)
  2019-06-28 23:18 ` [net-next 09/10] net/mlx5e: Expose same physical switch_id for all representors Saeed Mahameed
@ 2019-06-28 23:18 ` Saeed Mahameed
  2019-07-01  1:42 ` [pull request][net-next 00/10] Mellanox, mlx5e updates 2019-06-28 David Miller
  10 siblings, 0 replies; 12+ messages in thread
From: Saeed Mahameed @ 2019-06-28 23:18 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Paul Blakey, Roi Dayan, Saeed Mahameed

From: Paul Blakey <paulb@mellanox.com>

After changing the parent_id to be the same for both NICs of same
the hardware device, netdev_port_same_parent_id now returns true for
more cases (all the lower devices in the hierarchy are on the same
hardware device).

If merged eswitch isn't enabled, these cases aren't supported, so disallow
them.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 .../ethernet/mellanox/mlx5/core/en/tc_tun.c   |  4 +++-
 .../net/ethernet/mellanox/mlx5/core/en_tc.c   | 22 +++++++++++++++----
 .../net/ethernet/mellanox/mlx5/core/en_tc.h   |  3 +++
 3 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c
index f5ad531e1749..3739646b653f 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c
@@ -5,6 +5,7 @@
 #include <net/gre.h>
 #include <net/geneve.h>
 #include "en/tc_tun.h"
+#include "en_tc.h"
 
 struct mlx5e_tc_tunnel *mlx5e_get_tc_tun(struct net_device *tunnel_dev)
 {
@@ -47,7 +48,8 @@ static int get_route_and_out_devs(struct mlx5e_priv *priv,
 		*route_dev = dev;
 		if (is_vlan_dev(*route_dev))
 			*out_dev = uplink_dev;
-		else if (mlx5e_eswitch_rep(dev))
+		else if (mlx5e_eswitch_rep(dev) &&
+			 mlx5e_is_valid_eswitch_fwd_dev(priv, dev))
 			*out_dev = *route_dev;
 		else
 			return -EOPNOTSUPP;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 1453da6ef559..e6b199cd68ea 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -2802,6 +2802,16 @@ static int add_vlan_pop_action(struct mlx5e_priv *priv,
 	return err;
 }
 
+bool mlx5e_is_valid_eswitch_fwd_dev(struct mlx5e_priv *priv,
+				    struct net_device *out_dev)
+{
+	if (is_merged_eswitch_dev(priv, out_dev))
+		return true;
+
+	return mlx5e_eswitch_rep(out_dev) &&
+	       same_hw_devs(priv, netdev_priv(out_dev));
+}
+
 static int parse_tc_fdb_actions(struct mlx5e_priv *priv,
 				struct flow_action *flow_action,
 				struct mlx5e_tc_flow *flow,
@@ -2867,9 +2877,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv,
 
 			action |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST |
 				  MLX5_FLOW_CONTEXT_ACTION_COUNT;
-			if (netdev_port_same_parent_id(priv->netdev,
-						       out_dev) ||
-			    is_merged_eswitch_dev(priv, out_dev)) {
+			if (netdev_port_same_parent_id(priv->netdev, out_dev)) {
 				struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
 				struct net_device *uplink_dev = mlx5_eswitch_uplink_get_proto_dev(esw, REP_ETH);
 				struct net_device *uplink_upper = netdev_master_upper_dev_get(uplink_dev);
@@ -2886,6 +2894,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv,
 					if (err)
 						return err;
 				}
+
 				if (is_vlan_dev(parse_attr->filter_dev)) {
 					err = add_vlan_pop_action(priv, attr,
 								  &action);
@@ -2893,8 +2902,13 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv,
 						return err;
 				}
 
-				if (!mlx5e_eswitch_rep(out_dev))
+				if (!mlx5e_is_valid_eswitch_fwd_dev(priv, out_dev)) {
+					NL_SET_ERR_MSG_MOD(extack,
+							   "devices are not on same switch HW, can't offload forwarding");
+					pr_err("devices %s %s not on same switch HW, can't offload forwarding\n",
+					       priv->netdev->name, out_dev->name);
 					return -EOPNOTSUPP;
+				}
 
 				out_priv = netdev_priv(out_dev);
 				rpriv = out_priv->ppriv;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.h b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.h
index f62e81902d27..8f288cc53cee 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.h
@@ -74,6 +74,9 @@ int mlx5e_tc_num_filters(struct mlx5e_priv *priv, int flags);
 
 void mlx5e_tc_reoffload_flows_work(struct work_struct *work);
 
+bool mlx5e_is_valid_eswitch_fwd_dev(struct mlx5e_priv *priv,
+				    struct net_device *out_dev);
+
 #else /* CONFIG_MLX5_ESWITCH */
 static inline int  mlx5e_tc_nic_init(struct mlx5e_priv *priv) { return 0; }
 static inline void mlx5e_tc_nic_cleanup(struct mlx5e_priv *priv) {}
-- 
2.21.0


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

* Re: [pull request][net-next 00/10] Mellanox, mlx5e updates 2019-06-28
  2019-06-28 23:18 [pull request][net-next 00/10] Mellanox, mlx5e updates 2019-06-28 Saeed Mahameed
                   ` (9 preceding siblings ...)
  2019-06-28 23:18 ` [net-next 10/10] net/mlx5e: Disallow tc redirect offload cases we don't support Saeed Mahameed
@ 2019-07-01  1:42 ` David Miller
  10 siblings, 0 replies; 12+ messages in thread
From: David Miller @ 2019-07-01  1:42 UTC (permalink / raw)
  To: saeedm; +Cc: netdev

From: Saeed Mahameed <saeedm@mellanox.com>
Date: Fri, 28 Jun 2019 23:18:18 +0000

> This series adds misc updates to mlx5e driver.
> For more information please see tag log below.
> 
> Please pull and let me know if there is any problem.
> 
> Please note that the series starts with a merge of mlx5-next branch,
> to resolve and avoid dependency with rdma tree.
> This pull provides the resolution of the conflict reported by Stephen:
> https://lkml.org/lkml/2019/6/27/1016

Ok, pulled, thank you.

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

end of thread, other threads:[~2019-07-01  1:42 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-28 23:18 [pull request][net-next 00/10] Mellanox, mlx5e updates 2019-06-28 Saeed Mahameed
2019-06-28 23:18 ` [net-next 01/10] net/mlx5: MPFS, Cleanup add MAC flow Saeed Mahameed
2019-06-28 23:18 ` [net-next 02/10] net/mlx5: MPFS, Allow adding the same MAC more than once Saeed Mahameed
2019-06-28 23:18 ` [net-next 03/10] net/mlx5e: Move to HW checksumming advertising Saeed Mahameed
2019-06-28 23:18 ` [net-next 04/10] net/mlx5e: Report netdevice MPLS features Saeed Mahameed
2019-06-28 23:18 ` [net-next 05/10] net/mlx5e: Correct phys_port_name for PF port Saeed Mahameed
2019-06-28 23:18 ` [net-next 06/10] net/mlx5e: Set drvinfo in generic manner Saeed Mahameed
2019-06-28 23:18 ` [net-next 07/10] net/mlx5e: reduce stack usage in mlx5_eswitch_termtbl_create Saeed Mahameed
2019-06-28 23:18 ` [net-next 08/10] net/mlx5e: Don't refresh TIRs when updating representor SQs Saeed Mahameed
2019-06-28 23:18 ` [net-next 09/10] net/mlx5e: Expose same physical switch_id for all representors Saeed Mahameed
2019-06-28 23:18 ` [net-next 10/10] net/mlx5e: Disallow tc redirect offload cases we don't support Saeed Mahameed
2019-07-01  1:42 ` [pull request][net-next 00/10] Mellanox, mlx5e updates 2019-06-28 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).