Subject: Re: [PATCH net-next 2/4] chelsio: Convert chtls_sendpage() to use MSG_SPLICE_PAGES

From: Simon Horman <[email-masked]>
Date: Thu, 25 May 2023 09:50:54 +0200

On Wed, May 24, 2023 at 03:49:21PM +0100, David Howells wrote:
> Convert chtls_sendpage() to use sendmsg() with MSG_SPLICE_PAGES rather than
> directly splicing in the pages itself.
> 
> This allows ->sendpage() to be replaced by something that can handle
> multiple multipage folios in a single transaction.
> 
> Signed-off-by: David Howells <[email-masked]>
> cc: Ayush Sawal <[email-masked]>
> cc: "David S. Miller" <[email-masked]>
> cc: Eric Dumazet <[email-masked]>
> cc: Jakub Kicinski <[email-masked]>
> cc: Paolo Abeni <[email-masked]>
> cc: Jens Axboe <[email-masked]>
> cc: Matthew Wilcox <[email-masked]>
> cc: [email-masked]
> ---
>  .../chelsio/inline_crypto/chtls/chtls_io.c    | 109 ++----------------
>  1 file changed, 7 insertions(+), 102 deletions(-)
> 
> diff --git a/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_io.c b/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_io.c
> index 1d08386ac916..65efd20ec796 100644
> --- a/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_io.c
> +++ b/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_io.c
> @@ -1240,110 +1240,15 @@ int chtls_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
>  int chtls_sendpage(struct sock *sk, struct page *page,
>  		   int offset, size_t size, int flags)
>  {
> -	struct chtls_sock *csk;
> -	struct chtls_dev *cdev;
> -	int mss, err, copied;
> -	struct tcp_sock *tp;
> -	long timeo;
> -
> -	tp = tcp_sk(sk);
> -	copied = 0;
> -	csk = rcu_dereference_sk_user_data(sk);
> -	cdev = csk->cdev;
> -	lock_sock(sk);
> -	timeo = sock_sndtimeo(sk, flags & MSG_DONTWAIT);
> +	struct bio_vec bvec;
> +	struct msghdr msg = { .msg_flags = flags | MSG_SPLICE_PAGES, };
>  

Hi David,

a minor nit, in case you need to repost this series for some other reason.

Please use reverse Xmas tree - longest line to shortest - order for
Networking code. I understand this file doesn't adhere to that, and
we probably don't want churn due to addressing it throughout this file.
But my preference is to move towards this standard, or at least not away
from it.

So in this case:

	struct msghdr msg = { .msg_flags = flags | MSG_SPLICE_PAGES, };
	struct bio_vec bvec;

This tool can be useful:

	https://github.com/ecree-solarflare/xmastree