From patchwork Thu Feb 11 11:35:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tariq Toukan X-Patchwork-Id: 12082939 X-Patchwork-Delegate: kuba@kernel.org 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.3 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 ADBB7C433E0 for ; Thu, 11 Feb 2021 11:40:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8800E64E30 for ; Thu, 11 Feb 2021 11:40:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231461AbhBKLjz (ORCPT ); Thu, 11 Feb 2021 06:39:55 -0500 Received: from hqnvemgate24.nvidia.com ([216.228.121.143]:19345 "EHLO hqnvemgate24.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231483AbhBKLhM (ORCPT ); Thu, 11 Feb 2021 06:37:12 -0500 Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate24.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Thu, 11 Feb 2021 03:36:11 -0800 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 11 Feb 2021 11:36:11 +0000 Received: from vdi.nvidia.com (172.20.145.6) by mail.nvidia.com (172.20.187.18) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 11 Feb 2021 11:36:08 +0000 From: Tariq Toukan To: "David S. Miller" , Jakub Kicinski CC: Boris Pismenny , , Tariq Toukan , Moshe Shemesh , "Maxim Mikityanskiy" , Saeed Mahameed , "John Fastabend" , Daniel Borkmann , Alexei Starovoitov , Tariq Toukan Subject: [PATCH net-next 1/3] net/sock: Add kernel config SOCK_RX_QUEUE_MAPPING Date: Thu, 11 Feb 2021 13:35:51 +0200 Message-ID: <20210211113553.8211-2-tariqt@nvidia.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20210211113553.8211-1-tariqt@nvidia.com> References: <20210211113553.8211-1-tariqt@nvidia.com> MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1613043371; bh=wNkSxJ6qtjKj+T+YVA4Wae9vaJko1V7d8jqLFvarVkA=; h=From:To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:Content-Type; b=ecP3glvF+wnj+Bwcqx56agC+kZJRKsBFPkceh11D2S6avxm5XDhaS1pCqoOr9ByXd +H2b03e/QOsvDEe3V2v/rR12sL9dZwRVA8ArPKB6zWtUZV/Iv9ulNsQpK0nJrZJ0Wi iWowxvc7LOGbFiHC5s0WTu24HgFAz0RPuE7a8mi75WtW8k8taUsbgZBZM5w8GiC9uP T5gXbVQyOHJ9M1tYRTy1+IdxJH1Z8MKzZRlJEZaSgWzhEH2Uqyibn43qGtRdM0L/VZ l36liP16IHbWbxeIemMwJWY7oOa34vmdeP8IQo84g7sUefyBAojITChoakbKxWi64T bGPUZ+kjVfopA== Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Use a new config SOCK_RX_QUEUE_MAPPING to compile-in the socket RX queue field and logic, instead of the XPS config. This breaks dependency in XPS, and allows selecting it from non-XPS use cases, as we do in the next patch. In addition, use the new flag to wrap the logic in sk_rx_queue_get() and protect access to the sk_rx_queue_mapping field, while keeping the function exposed unconditionally, just like sk_rx_queue_set() and sk_rx_queue_clear(). Signed-off-by: Tariq Toukan Reviewed-by: Maxim Mikityanskiy --- include/net/sock.h | 12 ++++++------ net/Kconfig | 4 ++++ net/core/filter.c | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/include/net/sock.h b/include/net/sock.h index 690e496a0e79..855c068c6c86 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -226,7 +226,7 @@ struct sock_common { struct hlist_nulls_node skc_nulls_node; }; unsigned short skc_tx_queue_mapping; -#ifdef CONFIG_XPS +#ifdef CONFIG_SOCK_RX_QUEUE_MAPPING unsigned short skc_rx_queue_mapping; #endif union { @@ -356,7 +356,7 @@ struct sock { #define sk_nulls_node __sk_common.skc_nulls_node #define sk_refcnt __sk_common.skc_refcnt #define sk_tx_queue_mapping __sk_common.skc_tx_queue_mapping -#ifdef CONFIG_XPS +#ifdef CONFIG_SOCK_RX_QUEUE_MAPPING #define sk_rx_queue_mapping __sk_common.skc_rx_queue_mapping #endif @@ -1838,7 +1838,7 @@ static inline int sk_tx_queue_get(const struct sock *sk) static inline void sk_rx_queue_set(struct sock *sk, const struct sk_buff *skb) { -#ifdef CONFIG_XPS +#ifdef CONFIG_SOCK_RX_QUEUE_MAPPING if (skb_rx_queue_recorded(skb)) { u16 rx_queue = skb_get_rx_queue(skb); @@ -1852,20 +1852,20 @@ static inline void sk_rx_queue_set(struct sock *sk, const struct sk_buff *skb) static inline void sk_rx_queue_clear(struct sock *sk) { -#ifdef CONFIG_XPS +#ifdef CONFIG_SOCK_RX_QUEUE_MAPPING sk->sk_rx_queue_mapping = NO_QUEUE_MAPPING; #endif } -#ifdef CONFIG_XPS static inline int sk_rx_queue_get(const struct sock *sk) { +#ifdef CONFIG_SOCK_RX_QUEUE_MAPPING if (sk && sk->sk_rx_queue_mapping != NO_QUEUE_MAPPING) return sk->sk_rx_queue_mapping; +#endif return -1; } -#endif static inline void sk_set_socket(struct sock *sk, struct socket *sock) { diff --git a/net/Kconfig b/net/Kconfig index f4c32d982af6..8cea808ad9e8 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -256,9 +256,13 @@ config RFS_ACCEL select CPU_RMAP default y +config SOCK_RX_QUEUE_MAPPING + bool + config XPS bool depends on SMP + select SOCK_RX_QUEUE_MAPPING default y config HWBM diff --git a/net/core/filter.c b/net/core/filter.c index 9ab94e90d660..2ba03f6597bb 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -8816,7 +8816,7 @@ u32 bpf_sock_convert_ctx_access(enum bpf_access_type type, target_size)); break; case offsetof(struct bpf_sock, rx_queue_mapping): -#ifdef CONFIG_XPS +#ifdef CONFIG_SOCK_RX_QUEUE_MAPPING *insn++ = BPF_LDX_MEM( BPF_FIELD_SIZEOF(struct sock, sk_rx_queue_mapping), si->dst_reg, si->src_reg, From patchwork Thu Feb 11 11:35:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tariq Toukan X-Patchwork-Id: 12082943 X-Patchwork-Delegate: kuba@kernel.org 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.3 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 AEA4EC433E0 for ; Thu, 11 Feb 2021 11:40:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7E47064E2F for ; Thu, 11 Feb 2021 11:40:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230118AbhBKLkg (ORCPT ); Thu, 11 Feb 2021 06:40:36 -0500 Received: from hqnvemgate24.nvidia.com ([216.228.121.143]:19352 "EHLO hqnvemgate24.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229892AbhBKLhM (ORCPT ); Thu, 11 Feb 2021 06:37:12 -0500 Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate24.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Thu, 11 Feb 2021 03:36:14 -0800 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 11 Feb 2021 11:36:14 +0000 Received: from vdi.nvidia.com (172.20.145.6) by mail.nvidia.com (172.20.187.18) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 11 Feb 2021 11:36:11 +0000 From: Tariq Toukan To: "David S. Miller" , Jakub Kicinski CC: Boris Pismenny , , Tariq Toukan , Moshe Shemesh , "Maxim Mikityanskiy" , Saeed Mahameed , "John Fastabend" , Daniel Borkmann , Alexei Starovoitov , Tariq Toukan Subject: [PATCH net-next 2/3] net/tls: Select SOCK_RX_QUEUE_MAPPING from TLS_DEVICE Date: Thu, 11 Feb 2021 13:35:52 +0200 Message-ID: <20210211113553.8211-3-tariqt@nvidia.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20210211113553.8211-1-tariqt@nvidia.com> References: <20210211113553.8211-1-tariqt@nvidia.com> MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1613043374; bh=46Ejv8QFduxYBeMowkQSnD1kJdnzWdQLHpMB10zNevs=; h=From:To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:Content-Type; b=ed/KypqyhegMsQjJecSnAbHPfwxVcXfKvT2qrX2Y7ZYT5Oiw7OU3WTe5+SR6ybSZQ UFiH1oByMVj3EMv9qfgfjCvbqTwe/nvc4h4h2bslo2CBPBnQL/wkU6ZTzd/ufv+3vm vYgTqMkM9aQkmPg193Yw4u/CtV2RNFyje5S4Y5VSTCMZ7O8IJZmDkMb7wrjXBNzicO kgFyZlMBjBZ5BdLpuYjzaTq/uJNwZSF0Wee4nPnfOSUTv0msPYMxKfgaARDc3eF3Vm CLnt3e0etsDftqZGKq11ck2DTTSzGsZvj1QEqyvGbPMu1cl9nbj1uzWbybvnrtBUFM AwJurXRewAEDg== Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Compile-in the socket RX queue mapping field and logic when TLS_DEVICE is enabled. This allows device drivers to pick the recorded socket's RX queue and use it for streams distribution. Signed-off-by: Tariq Toukan Reviewed-by: Maxim Mikityanskiy --- net/tls/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/net/tls/Kconfig b/net/tls/Kconfig index fa0724fd84b4..0cdc1f7b6b08 100644 --- a/net/tls/Kconfig +++ b/net/tls/Kconfig @@ -21,6 +21,7 @@ config TLS_DEVICE bool "Transport Layer Security HW offload" depends on TLS select SOCK_VALIDATE_XMIT + select SOCK_RX_QUEUE_MAPPING default n help Enable kernel support for HW offload of the TLS protocol. From patchwork Thu Feb 11 11:35:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tariq Toukan X-Patchwork-Id: 12082941 X-Patchwork-Delegate: kuba@kernel.org 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.3 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, 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 2F6C5C433E6 for ; Thu, 11 Feb 2021 11:40:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F0E4264E16 for ; Thu, 11 Feb 2021 11:40:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231494AbhBKLkM (ORCPT ); Thu, 11 Feb 2021 06:40:12 -0500 Received: from hqnvemgate24.nvidia.com ([216.228.121.143]:19366 "EHLO hqnvemgate24.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230527AbhBKLhM (ORCPT ); Thu, 11 Feb 2021 06:37:12 -0500 Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate24.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Thu, 11 Feb 2021 03:36:18 -0800 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 11 Feb 2021 11:36:17 +0000 Received: from vdi.nvidia.com (172.20.145.6) by mail.nvidia.com (172.20.187.18) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 11 Feb 2021 11:36:14 +0000 From: Tariq Toukan To: "David S. Miller" , Jakub Kicinski CC: Boris Pismenny , , Tariq Toukan , Moshe Shemesh , Maxim Mikityanskiy , Saeed Mahameed , John Fastabend , Daniel Borkmann , Alexei Starovoitov , Tariq Toukan Subject: [PATCH net-next 3/3] net/mlx5: Remove TLS dependencies on XPS Date: Thu, 11 Feb 2021 13:35:53 +0200 Message-ID: <20210211113553.8211-4-tariqt@nvidia.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20210211113553.8211-1-tariqt@nvidia.com> References: <20210211113553.8211-1-tariqt@nvidia.com> MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1613043378; bh=+3gMQLFY4TlxalhWaD4il2P7z+xRDknu5WPT8tLyZAM=; h=From:To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:Content-Type; b=WrQa0o7nlkJtH+JLat14sB3MA3deIiCmJmHUlAMyd0oh4EWWs3IlsJBHUmPrRefuQ PgOEhkS3wgrAVK+DvF1tMgdq6o6ogPIiZ8Clmz77cBO8+zZDW2DC75j7QcUZzR2Z1Q XC/i/Sd1iUZTxqtKHODo8wDDoPnlCkdjZKgY2oub01ZUTTkNTLpy+BRFA5274YqDra jbMsMUPk5zpa2rbYjHpk6xXea6727Xrq32f8w/7l1218WJXFf8Nf3vyj3SLOUryyO0 M10AJpB9lnMDBCxnFElq3Ma6xzevkw1dn9mnAggXZyRZ471tg7Qzgrr/51nGMzAl2N D4ovC/YmzZl8Q== Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org No real dependency on XPS, but on RX queue mapping, which is being selected by TLS_DEVICE. Signed-off-by: Tariq Toukan Reviewed-by: Maxim Mikityanskiy --- drivers/net/ethernet/mellanox/mlx5/core/Kconfig | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig index ad45d20f9d44..372d902bca5a 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig +++ b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig @@ -166,7 +166,6 @@ config MLX5_FPGA_TLS depends on TLS=y || MLX5_CORE=m depends on MLX5_CORE_EN depends on MLX5_FPGA - depends on XPS select MLX5_EN_TLS default n help @@ -181,7 +180,6 @@ config MLX5_TLS depends on TLS_DEVICE depends on TLS=y || MLX5_CORE=m depends on MLX5_CORE_EN - depends on XPS select MLX5_ACCEL select MLX5_EN_TLS default n