All of lore.kernel.org
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeedm@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, Dave Watson <davejwatson@fb.com>,
	Boris Pismenny <borisp@mellanox.com>,
	Ilya Lesokhin <ilyal@mellanox.com>,
	Aviad Yehezkel <aviadye@mellanox.com>,
	Saeed Mahameed <saeedm@mellanox.com>
Subject: [PATCH V2 net-next 01/14] tcp: Add clean acked data hook
Date: Wed, 21 Mar 2018 14:01:33 -0700	[thread overview]
Message-ID: <20180321210146.22537-2-saeedm@mellanox.com> (raw)
In-Reply-To: <20180321210146.22537-1-saeedm@mellanox.com>

From: Ilya Lesokhin <ilyal@mellanox.com>

Called when a TCP segment is acknowledged.
Could be used by application protocols who hold additional
metadata associated with the stream data.

This is required by TLS device offload to release
metadata associated with acknowledged TLS records.

Signed-off-by: Ilya Lesokhin <ilyal@mellanox.com>
Signed-off-by: Boris Pismenny <borisp@mellanox.com>
Signed-off-by: Aviad Yehezkel <aviadye@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 include/net/inet_connection_sock.h | 2 ++
 include/net/tcp.h                  | 5 +++++
 net/ipv4/tcp.c                     | 5 +++++
 net/ipv4/tcp_input.c               | 6 ++++++
 4 files changed, 18 insertions(+)

diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index b68fea022a82..2ab6667275df 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -77,6 +77,7 @@ struct inet_connection_sock_af_ops {
  * @icsk_af_ops		   Operations which are AF_INET{4,6} specific
  * @icsk_ulp_ops	   Pluggable ULP control hook
  * @icsk_ulp_data	   ULP private data
+ * @icsk_clean_acked	   Clean acked data hook
  * @icsk_listen_portaddr_node	hash to the portaddr listener hashtable
  * @icsk_ca_state:	   Congestion control state
  * @icsk_retransmits:	   Number of unrecovered [RTO] timeouts
@@ -102,6 +103,7 @@ struct inet_connection_sock {
 	const struct inet_connection_sock_af_ops *icsk_af_ops;
 	const struct tcp_ulp_ops  *icsk_ulp_ops;
 	void			  *icsk_ulp_data;
+	void (*icsk_clean_acked)(struct sock *sk, u32 acked_seq);
 	struct hlist_node         icsk_listen_portaddr_node;
 	unsigned int		  (*icsk_sync_mss)(struct sock *sk, u32 pmtu);
 	__u8			  icsk_ca_state:6,
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 9c9b3768b350..dba03b205680 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -2101,4 +2101,9 @@ static inline bool tcp_bpf_ca_needs_ecn(struct sock *sk)
 #if IS_ENABLED(CONFIG_SMC)
 extern struct static_key_false tcp_have_smc;
 #endif
+
+#if IS_ENABLED(CONFIG_TLS_DEVICE)
+extern struct static_key_false clean_acked_data_enabled;
+#endif
+
 #endif	/* _TCP_H */
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index e553f84bde83..70056bb760d2 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -297,6 +297,11 @@ DEFINE_STATIC_KEY_FALSE(tcp_have_smc);
 EXPORT_SYMBOL(tcp_have_smc);
 #endif
 
+#if IS_ENABLED(CONFIG_TLS_DEVICE)
+DEFINE_STATIC_KEY_FALSE(clean_acked_data_enabled);
+EXPORT_SYMBOL_GPL(clean_acked_data_enabled);
+#endif
+
 /*
  * Current number of TCP sockets.
  */
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 451ef3012636..21f5c647f4be 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -3542,6 +3542,12 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
 	if (after(ack, prior_snd_una)) {
 		flag |= FLAG_SND_UNA_ADVANCED;
 		icsk->icsk_retransmits = 0;
+
+#if IS_ENABLED(CONFIG_TLS_DEVICE)
+		if (static_branch_unlikely(&clean_acked_data_enabled))
+			if (icsk->icsk_clean_acked)
+				icsk->icsk_clean_acked(sk, ack);
+#endif
 	}
 
 	prior_fack = tcp_is_sack(tp) ? tcp_highest_sack_seq(tp) : tp->snd_una;
-- 
2.14.3

  reply	other threads:[~2018-03-21 21:02 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-21 21:01 [PATCH V2 net-next 00/14] TLS offload, netdev & MLX5 support Saeed Mahameed
2018-03-21 21:01 ` Saeed Mahameed [this message]
2018-03-21 21:01 ` [PATCH V2 net-next 02/14] net: Rename and export copy_skb_header Saeed Mahameed
2018-03-21 21:01 ` [PATCH V2 net-next 03/14] net: Add Software fallback infrastructure for socket dependent offloads Saeed Mahameed
2018-03-21 21:01 ` [PATCH V2 net-next 04/14] net: Add TLS offload netdev ops Saeed Mahameed
2018-03-21 21:01 ` [PATCH V2 net-next 05/14] net: Add TLS TX offload features Saeed Mahameed
2018-03-21 21:01 ` [PATCH V2 net-next 06/14] net/tls: Add generic NIC offload infrastructure Saeed Mahameed
2018-03-21 21:10   ` Eric Dumazet
2018-03-22 12:45     ` Boris Pismenny
2018-03-21 22:27   ` Kirill Tkhai
2018-03-22 22:33     ` Saeed Mahameed
2018-03-21 21:01 ` [PATCH V2 net-next 07/14] net/tls: Support TLS device offload with IPv6 Saeed Mahameed
2018-03-22  9:36   ` Sergei Shtylyov
2018-03-22 22:18     ` Saeed Mahameed
2018-03-21 21:01 ` [PATCH V2 net-next 08/14] net/mlx5e: Move defines out of ipsec code Saeed Mahameed
2018-03-21 21:01 ` [PATCH V2 net-next 09/14] net/mlx5: Accel, Add TLS tx offload interface Saeed Mahameed
2018-03-21 21:01 ` [PATCH V2 net-next 10/14] net/mlx5e: TLS, Add Innova TLS TX support Saeed Mahameed
2018-03-21 21:01 ` [PATCH V2 net-next 11/14] net/mlx5e: TLS, Add Innova TLS TX offload data path Saeed Mahameed
2018-03-21 21:01 ` [PATCH V2 net-next 12/14] net/mlx5e: TLS, Add error statistics Saeed Mahameed
2018-03-21 21:01 ` [PATCH V2 net-next 13/14] MAINTAINERS: Update mlx5 innova driver maintainers Saeed Mahameed
2018-03-21 21:01 ` [PATCH V2 net-next 14/14] MAINTAINERS: Update TLS maintainers Saeed Mahameed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180321210146.22537-2-saeedm@mellanox.com \
    --to=saeedm@mellanox.com \
    --cc=aviadye@mellanox.com \
    --cc=borisp@mellanox.com \
    --cc=davejwatson@fb.com \
    --cc=davem@davemloft.net \
    --cc=ilyal@mellanox.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.