netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/3] Compile-flag for sock RX queue mapping
@ 2021-02-11 11:35 Tariq Toukan
  2021-02-11 11:35 ` [PATCH net-next 1/3] net/sock: Add kernel config SOCK_RX_QUEUE_MAPPING Tariq Toukan
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Tariq Toukan @ 2021-02-11 11:35 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: Boris Pismenny, netdev, Tariq Toukan, Moshe Shemesh,
	Maxim Mikityanskiy, Saeed Mahameed, John Fastabend,
	Daniel Borkmann, Alexei Starovoitov, Tariq Toukan

Hi,

Socket's RX queue mapping logic is useful also for non-XPS use cases.
This series breaks the dependency between the two, introducing a new
kernel config flag SOCK_RX_QUEUE_MAPPING.

Here we select this new kernel flag from TLS_DEVICE, as well as XPS.

Regards,
Tariq

Tariq Toukan (3):
  net/sock: Add kernel config SOCK_RX_QUEUE_MAPPING
  net/tls: Select SOCK_RX_QUEUE_MAPPING from TLS_DEVICE
  net/mlx5: Remove TLS dependencies on XPS

 drivers/net/ethernet/mellanox/mlx5/core/Kconfig |  2 --
 include/net/sock.h                              | 12 ++++++------
 net/Kconfig                                     |  4 ++++
 net/core/filter.c                               |  2 +-
 net/tls/Kconfig                                 |  1 +
 5 files changed, 12 insertions(+), 9 deletions(-)

-- 
2.21.0


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

* [PATCH net-next 1/3] net/sock: Add kernel config SOCK_RX_QUEUE_MAPPING
  2021-02-11 11:35 [PATCH net-next 0/3] Compile-flag for sock RX queue mapping Tariq Toukan
@ 2021-02-11 11:35 ` Tariq Toukan
  2021-02-11 11:35 ` [PATCH net-next 2/3] net/tls: Select SOCK_RX_QUEUE_MAPPING from TLS_DEVICE Tariq Toukan
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Tariq Toukan @ 2021-02-11 11:35 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: Boris Pismenny, netdev, Tariq Toukan, Moshe Shemesh,
	Maxim Mikityanskiy, Saeed Mahameed, John Fastabend,
	Daniel Borkmann, Alexei Starovoitov, Tariq Toukan

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 <tariqt@nvidia.com>
Reviewed-by: Maxim Mikityanskiy <maximmi@nvidia.com>
---
 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,
-- 
2.21.0


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

* [PATCH net-next 2/3] net/tls: Select SOCK_RX_QUEUE_MAPPING from TLS_DEVICE
  2021-02-11 11:35 [PATCH net-next 0/3] Compile-flag for sock RX queue mapping Tariq Toukan
  2021-02-11 11:35 ` [PATCH net-next 1/3] net/sock: Add kernel config SOCK_RX_QUEUE_MAPPING Tariq Toukan
@ 2021-02-11 11:35 ` Tariq Toukan
  2021-02-11 11:35 ` [PATCH net-next 3/3] net/mlx5: Remove TLS dependencies on XPS Tariq Toukan
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Tariq Toukan @ 2021-02-11 11:35 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: Boris Pismenny, netdev, Tariq Toukan, Moshe Shemesh,
	Maxim Mikityanskiy, Saeed Mahameed, John Fastabend,
	Daniel Borkmann, Alexei Starovoitov, Tariq Toukan

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 <tariqt@nvidia.com>
Reviewed-by: Maxim Mikityanskiy <maximmi@nvidia.com>
---
 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.
-- 
2.21.0


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

* [PATCH net-next 3/3] net/mlx5: Remove TLS dependencies on XPS
  2021-02-11 11:35 [PATCH net-next 0/3] Compile-flag for sock RX queue mapping Tariq Toukan
  2021-02-11 11:35 ` [PATCH net-next 1/3] net/sock: Add kernel config SOCK_RX_QUEUE_MAPPING Tariq Toukan
  2021-02-11 11:35 ` [PATCH net-next 2/3] net/tls: Select SOCK_RX_QUEUE_MAPPING from TLS_DEVICE Tariq Toukan
@ 2021-02-11 11:35 ` Tariq Toukan
  2021-02-12  2:01 ` [PATCH net-next 0/3] Compile-flag for sock RX queue mapping Jakub Kicinski
  2021-02-12 21:20 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: Tariq Toukan @ 2021-02-11 11:35 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: Boris Pismenny, netdev, Tariq Toukan, Moshe Shemesh,
	Maxim Mikityanskiy, Saeed Mahameed, John Fastabend,
	Daniel Borkmann, Alexei Starovoitov, Tariq Toukan

No real dependency on XPS, but on RX queue mapping, which
is being selected by TLS_DEVICE.

Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Maxim Mikityanskiy <maximmi@nvidia.com>
---
 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
-- 
2.21.0


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

* Re: [PATCH net-next 0/3] Compile-flag for sock RX queue mapping
  2021-02-11 11:35 [PATCH net-next 0/3] Compile-flag for sock RX queue mapping Tariq Toukan
                   ` (2 preceding siblings ...)
  2021-02-11 11:35 ` [PATCH net-next 3/3] net/mlx5: Remove TLS dependencies on XPS Tariq Toukan
@ 2021-02-12  2:01 ` Jakub Kicinski
  2021-02-12 21:20 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: Jakub Kicinski @ 2021-02-12  2:01 UTC (permalink / raw)
  To: Tariq Toukan
  Cc: David S. Miller, Boris Pismenny, netdev, Tariq Toukan,
	Moshe Shemesh, Maxim Mikityanskiy, Saeed Mahameed,
	John Fastabend, Daniel Borkmann, Alexei Starovoitov

On Thu, 11 Feb 2021 13:35:50 +0200 Tariq Toukan wrote:
> Socket's RX queue mapping logic is useful also for non-XPS use cases.
> This series breaks the dependency between the two, introducing a new
> kernel config flag SOCK_RX_QUEUE_MAPPING.
> 
> Here we select this new kernel flag from TLS_DEVICE, as well as XPS.

Acked-by: Jakub Kicinski <kuba@kernel.org>

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

* Re: [PATCH net-next 0/3] Compile-flag for sock RX queue mapping
  2021-02-11 11:35 [PATCH net-next 0/3] Compile-flag for sock RX queue mapping Tariq Toukan
                   ` (3 preceding siblings ...)
  2021-02-12  2:01 ` [PATCH net-next 0/3] Compile-flag for sock RX queue mapping Jakub Kicinski
@ 2021-02-12 21:20 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-02-12 21:20 UTC (permalink / raw)
  To: Tariq Toukan
  Cc: davem, kuba, borisp, netdev, ttoukan.linux, moshe, maximmi,
	saeedm, john.fastabend, daniel, ast

Hello:

This series was applied to netdev/net-next.git (refs/heads/master):

On Thu, 11 Feb 2021 13:35:50 +0200 you wrote:
> Hi,
> 
> Socket's RX queue mapping logic is useful also for non-XPS use cases.
> This series breaks the dependency between the two, introducing a new
> kernel config flag SOCK_RX_QUEUE_MAPPING.
> 
> Here we select this new kernel flag from TLS_DEVICE, as well as XPS.
> 
> [...]

Here is the summary with links:
  - [net-next,1/3] net/sock: Add kernel config SOCK_RX_QUEUE_MAPPING
    https://git.kernel.org/netdev/net-next/c/4e1beecc3b58
  - [net-next,2/3] net/tls: Select SOCK_RX_QUEUE_MAPPING from TLS_DEVICE
    https://git.kernel.org/netdev/net-next/c/76f165939ea3
  - [net-next,3/3] net/mlx5: Remove TLS dependencies on XPS
    https://git.kernel.org/netdev/net-next/c/2af3e35c5a04

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2021-02-12 21:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-11 11:35 [PATCH net-next 0/3] Compile-flag for sock RX queue mapping Tariq Toukan
2021-02-11 11:35 ` [PATCH net-next 1/3] net/sock: Add kernel config SOCK_RX_QUEUE_MAPPING Tariq Toukan
2021-02-11 11:35 ` [PATCH net-next 2/3] net/tls: Select SOCK_RX_QUEUE_MAPPING from TLS_DEVICE Tariq Toukan
2021-02-11 11:35 ` [PATCH net-next 3/3] net/mlx5: Remove TLS dependencies on XPS Tariq Toukan
2021-02-12  2:01 ` [PATCH net-next 0/3] Compile-flag for sock RX queue mapping Jakub Kicinski
2021-02-12 21:20 ` patchwork-bot+netdevbpf

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).