Subject: [net-next 14/15] net/mlx5e: Enable TC offload for ingress MACVLAN over bond

From: Saeed Mahameed <[email-masked]>
Date: Mon, 13 Mar 2023 22:42:33 -0700

From: Maor Dickman <[email-masked]>

Support offloading of TC rules that filter ingress traffic from a MACVLAN
device, which is attached to bond device.

Signed-off-by: Maor Dickman <[email-masked]>
Reviewed-by: Roi Dayan <[email-masked]>
Signed-off-by: Saeed Mahameed <[email-masked]>
---
 drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c
index b4af006dc494..19c4a83982ca 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c
@@ -433,6 +433,7 @@ mlx5e_rep_check_indr_block_supported(struct mlx5e_rep_priv *rpriv,
 {
 	struct mlx5e_priv *priv = netdev_priv(rpriv->netdev);
 	struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
+	struct net_device *macvlan_real_dev;
 
 	if (f->binder_type != FLOW_BLOCK_BINDER_TYPE_CLSACT_INGRESS &&
 	    f->binder_type != FLOW_BLOCK_BINDER_TYPE_CLSACT_EGRESS)
@@ -450,7 +451,11 @@ mlx5e_rep_check_indr_block_supported(struct mlx5e_rep_priv *rpriv,
 			return false;
 		}
 
-		if (macvlan_dev_real_dev(netdev) == rpriv->netdev)
+		macvlan_real_dev = macvlan_dev_real_dev(netdev);
+
+		if (macvlan_real_dev == rpriv->netdev)
+			return true;
+		if (netif_is_bond_master(macvlan_real_dev))
 			return true;
 	}
 
-- 
2.39.2