From patchwork Fri Nov 20 23:03:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 11922773 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=-18.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,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 0A0D7C64E7B for ; Fri, 20 Nov 2020 23:04:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A6CC42240B for ; Fri, 20 Nov 2020 23:04:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="OsJxFjtv" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728559AbgKTXEO (ORCPT ); Fri, 20 Nov 2020 18:04:14 -0500 Received: from hqnvemgate25.nvidia.com ([216.228.121.64]:1195 "EHLO hqnvemgate25.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728637AbgKTXEL (ORCPT ); Fri, 20 Nov 2020 18:04:11 -0500 Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Fri, 20 Nov 2020 15:03:59 -0800 Received: from sx1.mtl.com (172.20.13.39) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 20 Nov 2020 23:04:02 +0000 From: Saeed Mahameed To: Saeed Mahameed , Leon Romanovsky CC: , , Eli Cohen , Mark Bloch , Maor Gottlieb Subject: [PATCH mlx5-next 11/16] net/mlx5: Add VDPA priority to NIC RX namespace Date: Fri, 20 Nov 2020 15:03:34 -0800 Message-ID: <20201120230339.651609-12-saeedm@nvidia.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201120230339.651609-1-saeedm@nvidia.com> References: <20201120230339.651609-1-saeedm@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.13.39] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1605913439; bh=eg0ty2XIBWAlcNzqBJzl8yq+DWBoIz5UKxtR3ZdS74M=; h=From:To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:Content-Type: X-Originating-IP:X-ClientProxiedBy; b=OsJxFjtvMm5GvaL8HMu3oUpp4zdkx/I0kYXI3Rees8TTUjDMAZ1aSi8/BFrssdQ9D O9iyDm6ivz4kS+a/SWPIITzdOY2mQq4c5VgTHPEjqg2THzNuluXhTkscUyGlax95px CL86dl5dfqDID1VXuDIarL2s0JE+wWZqX/WCPCJEpRhnX+lgebwo9yFDvWYb8Nxkjr kcg1g+GawqQc8ef0nyMtChWvyL8vQn8I/1MFWQjSt4rEU8dZeHuGaKvfxaj7YzZiSH 9zaGbe63WOt6Q5+5fU1t+auvIql2MgDvGQWD4ZvqCSFW1GOOAt3SgAhI2VKGnUGg68 aimzxH+/S+fdQ== Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Eli Cohen Add a new namespace type to the NIC RX root namespace to allow for inserting VDPA rules before regular NIC but after bypass, thus allowing DPDK to have precedence in packet processing. Signed-off-by: Eli Cohen Reviewed-by: Mark Bloch Reviewed-by: Maor Gottlieb Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 10 +++++++++- include/linux/mlx5/fs.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c index 16091838bfcf..e095c5968e67 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c @@ -118,6 +118,10 @@ #define ANCHOR_NUM_PRIOS 1 #define ANCHOR_MIN_LEVEL (BY_PASS_MIN_LEVEL + 1) +#define VDPA_PRIO_NUM_LEVELS 1 +#define VDPA_NUM_PRIOS 1 +#define VDPA_MIN_LEVEL 1 + #define OFFLOADS_MAX_FT 2 #define OFFLOADS_NUM_PRIOS 2 #define OFFLOADS_MIN_LEVEL (ANCHOR_MIN_LEVEL + OFFLOADS_NUM_PRIOS) @@ -147,7 +151,7 @@ static struct init_tree_node { enum mlx5_flow_table_miss_action def_miss_action; } root_fs = { .type = FS_TYPE_NAMESPACE, - .ar_size = 7, + .ar_size = 8, .children = (struct init_tree_node[]){ ADD_PRIO(0, BY_PASS_MIN_LEVEL, 0, FS_CHAINING_CAPS, ADD_NS(MLX5_FLOW_TABLE_MISS_ACTION_DEF, @@ -165,6 +169,10 @@ static struct init_tree_node { ADD_NS(MLX5_FLOW_TABLE_MISS_ACTION_DEF, ADD_MULTIPLE_PRIO(ETHTOOL_NUM_PRIOS, ETHTOOL_PRIO_NUM_LEVELS))), + ADD_PRIO(0, VDPA_MIN_LEVEL, 0, FS_CHAINING_CAPS, + ADD_NS(MLX5_FLOW_TABLE_MISS_ACTION_DEF, + ADD_MULTIPLE_PRIO(VDPA_NUM_PRIOS, + VDPA_PRIO_NUM_LEVELS))), ADD_PRIO(0, KERNEL_MIN_LEVEL, 0, {}, ADD_NS(MLX5_FLOW_TABLE_MISS_ACTION_DEF, ADD_MULTIPLE_PRIO(KERNEL_NIC_TC_NUM_PRIOS, diff --git a/include/linux/mlx5/fs.h b/include/linux/mlx5/fs.h index 35d2cc1646d3..97176d623d74 100644 --- a/include/linux/mlx5/fs.h +++ b/include/linux/mlx5/fs.h @@ -67,6 +67,7 @@ enum mlx5_flow_namespace_type { MLX5_FLOW_NAMESPACE_LAG, MLX5_FLOW_NAMESPACE_OFFLOADS, MLX5_FLOW_NAMESPACE_ETHTOOL, + MLX5_FLOW_NAMESPACE_VDPA, MLX5_FLOW_NAMESPACE_KERNEL, MLX5_FLOW_NAMESPACE_LEFTOVERS, MLX5_FLOW_NAMESPACE_ANCHOR,