From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Dumazet Subject: Re: [PATCH v3 net-next 1/6] tcp: Add clean acked data hook Date: Tue, 19 Dec 2017 11:13:24 -0800 Message-ID: <1513710804.64874.3.camel@gmail.com> References: <20171218111033.13256-1-ilyal@mellanox.com> <20171218111033.13256-2-ilyal@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: davejwatson@fb.com, tom@herbertland.com, hannes@stressinduktion.org, borisp@mellanox.com, aviadye@mellanox.com, liranl@mellanox.com To: Ilya Lesokhin , netdev@vger.kernel.org, davem@davemloft.net Return-path: Received: from mail-wm0-f67.google.com ([74.125.82.67]:43064 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752116AbdLSTN2 (ORCPT ); Tue, 19 Dec 2017 14:13:28 -0500 Received: by mail-wm0-f67.google.com with SMTP id n138so5739000wmg.2 for ; Tue, 19 Dec 2017 11:13:27 -0800 (PST) In-Reply-To: <20171218111033.13256-2-ilyal@mellanox.com> Sender: netdev-owner@vger.kernel.org List-ID: On Mon, 2017-12-18 at 13:10 +0200, Ilya Lesokhin wrote: > 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: Boris Pismenny > Signed-off-by: Ilya Lesokhin > Signed-off-by: Aviad Yehezkel > --- > include/net/inet_connection_sock.h | 2 ++ > net/ipv4/tcp_input.c | 3 +++ > 2 files changed, 5 insertions(+) > > diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h > index 8e1bf9ae4a5e..ec405a667a85 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); > 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/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c > index 4d55c4b338ee..961abc5be84c 100644 > --- a/net/ipv4/tcp_input.c > +++ b/net/ipv4/tcp_input.c > @@ -3592,6 +3592,9 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag) > if (!prior_packets) > goto no_queue; > > + if (icsk->icsk_clean_acked) > + icsk->icsk_clean_acked(sk); > + > /* See if we can take anything off of the retransmit queue. */ > flag |= tcp_clean_rtx_queue(sk, prior_fack, prior_snd_una, &sack_state); > 1) tcp_ack() is already very expensive. 2) Since you do not pass any state here, this looks very suspicious to me.