lkml.org 
[lkml]   [2023]   [May]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH net-next 2/4] chelsio: Convert chtls_sendpage() to use MSG_SPLICE_PAGES
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 <dhowells@redhat.com>
> cc: Ayush Sawal <ayush.sawal@chelsio.com>
> cc: "David S. Miller" <davem@davemloft.net>
> cc: Eric Dumazet <edumazet@google.com>
> cc: Jakub Kicinski <kuba@kernel.org>
> cc: Paolo Abeni <pabeni@redhat.com>
> cc: Jens Axboe <axboe@kernel.dk>
> cc: Matthew Wilcox <willy@infradead.org>
> cc: netdev@vger.kernel.org
> ---
> .../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

\
 
 \ /
  Last update: 2023-05-25 09:53    [W:0.385 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site