From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32B41C433EF for ; Thu, 2 Sep 2021 19:06:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 195556054E for ; Thu, 2 Sep 2021 19:06:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347321AbhIBTHe (ORCPT ); Thu, 2 Sep 2021 15:07:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:55084 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347338AbhIBTHI (ORCPT ); Thu, 2 Sep 2021 15:07:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C607C60F11; Thu, 2 Sep 2021 19:06:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1630609570; bh=nJ7vKu686Ge3w0w+LqR5ksFpU8EP6duJ8QC3lwhrT28=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QUXSwI0W9XctRMAVU+z9HuC0pAEJm2GyDH3I8GXinxtLjMGsKRE/B7FtOfZD0AKVS VUKhyDlKgUwTgvTjaZw4dFT56sPjJFeun1SI3HWiEafcxf7YKc2Opes9Qzg7UJfBZY p2p1Ad2isfENMKoyjQEa51JnbMXX7SCH5vs4qSL43sZVFdYBtyvct/5wJB9Ox57/Bu /XC4yruTpHl+ZlVwCR+8Nuu5rfmyHUSY52Ig1X3K8MwzT2KGR5nhQtm94J4N9JX/dP /SCI/witswlZOu0yIR5mp/y7+qd/cN0xfB3Vvaeds3sT56wFqCb6JnWki1x48Jh2jH 6PhRKJMMaBwRQ== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Dima Chumak , Vlad Buslov , Saeed Mahameed Subject: [net-next 12/15] net/mlx5e: Enable TC offload for ingress MACVLAN Date: Thu, 2 Sep 2021 12:05:51 -0700 Message-Id: <20210902190554.211497-13-saeed@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210902190554.211497-1-saeed@kernel.org> References: <20210902190554.211497-1-saeed@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Dima Chumak Support offloading of TC rules that filter ingress traffic from a MACVLAN device, which is attached to uplink representor. Signed-off-by: Dima Chumak Reviewed-by: Vlad Buslov Signed-off-by: Saeed Mahameed --- .../ethernet/mellanox/mlx5/core/en/rep/tc.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) 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 405e9da5c7e9..d46cba30683c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -412,6 +413,13 @@ static void mlx5e_rep_indr_block_unbind(void *cb_priv) static LIST_HEAD(mlx5e_block_cb_list); +static bool mlx5e_rep_macvlan_mode_supported(const struct net_device *dev) +{ + struct macvlan_dev *macvlan = netdev_priv(dev); + + return macvlan->mode == MACVLAN_MODE_PASSTHRU; +} + static int mlx5e_rep_indr_setup_block(struct net_device *netdev, struct Qdisc *sch, struct mlx5e_rep_priv *rpriv, @@ -425,8 +433,14 @@ mlx5e_rep_indr_setup_block(struct net_device *netdev, struct Qdisc *sch, struct flow_block_cb *block_cb; if (!mlx5e_tc_tun_device_to_offload(priv, netdev) && - !(is_vlan_dev(netdev) && vlan_dev_real_dev(netdev) == rpriv->netdev)) - return -EOPNOTSUPP; + !(is_vlan_dev(netdev) && vlan_dev_real_dev(netdev) == rpriv->netdev)) { + if (!(netif_is_macvlan(netdev) && macvlan_dev_real_dev(netdev) == rpriv->netdev)) + return -EOPNOTSUPP; + if (!mlx5e_rep_macvlan_mode_supported(netdev)) { + netdev_warn(netdev, "Offloading ingress filter is supported only with macvlan passthru mode"); + return -EOPNOTSUPP; + } + } if (f->binder_type != FLOW_BLOCK_BINDER_TYPE_CLSACT_INGRESS) return -EOPNOTSUPP; -- 2.31.1