From: Simon Horman <horms@kernel.org>
To: David Howells <dhowells@redhat.com>
Cc: netdev@vger.kernel.org, Marc Dionne <marc.dionne@auristor.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v2 14/21] rxrpc: Do zerocopy using MSG_SPLICE_PAGES and page frags
Date: Tue, 5 Mar 2024 14:03:43 +0000 [thread overview]
Message-ID: <20240305140343.GH2357@kernel.org> (raw)
In-Reply-To: <20240304084322.705539-15-dhowells@redhat.com>
On Mon, Mar 04, 2024 at 08:43:11AM +0000, David Howells wrote:
...
> diff --git a/net/rxrpc/rxkad.c b/net/rxrpc/rxkad.c
> index ef0849c8329c..e540501a20ad 100644
> --- a/net/rxrpc/rxkad.c
> +++ b/net/rxrpc/rxkad.c
> @@ -145,16 +145,17 @@ static int rxkad_init_connection_security(struct rxrpc_connection *conn,
> /*
> * Work out how much data we can put in a packet.
> */
> -static int rxkad_how_much_data(struct rxrpc_call *call, size_t remain,
> - size_t *_buf_size, size_t *_data_size, size_t *_offset)
> +static struct rxrpc_txbuf *rxkad_alloc_txbuf(struct rxrpc_call *call, size_t remain, gfp_t gfp)
> {
> - size_t shdr, buf_size, chunk;
> + struct rxrpc_txbuf *txb;
> + size_t shdr, space;
> +
> + remain = min(remain, 65535 - sizeof(struct rxrpc_wire_header));
>
> switch (call->conn->security_level) {
> default:
> - buf_size = chunk = min_t(size_t, remain, RXRPC_JUMBO_DATALEN);
> - shdr = 0;
> - goto out;
> + space = min_t(size_t, remain, RXRPC_JUMBO_DATALEN);
> + return rxrpc_alloc_data_txbuf(call, space, 0, GFP_KERNEL);
Hi David,
should gfp be used here in place of GFP_KERNEL?
> case RXRPC_SECURITY_AUTH:
> shdr = sizeof(struct rxkad_level1_hdr);
> break;
> @@ -163,17 +164,15 @@ static int rxkad_how_much_data(struct rxrpc_call *call, size_t remain,
> break;
> }
>
> - buf_size = round_down(RXRPC_JUMBO_DATALEN, RXKAD_ALIGN);
> -
> - chunk = buf_size - shdr;
> - if (remain < chunk)
> - buf_size = round_up(shdr + remain, RXKAD_ALIGN);
> + space = min_t(size_t, round_down(RXRPC_JUMBO_DATALEN, RXKAD_ALIGN), remain + shdr);
> + space = round_up(space, RXKAD_ALIGN);
>
> -out:
> - *_buf_size = buf_size;
> - *_data_size = chunk;
> - *_offset = shdr;
> - return 0;
> + txb = rxrpc_alloc_data_txbuf(call, space, RXKAD_ALIGN, GFP_KERNEL);
Likewise, here too.
Flagged by Smatch.
> + if (txb) {
> + txb->offset += shdr;
> + txb->space -= shdr;
> + }
> + return txb;
nit: I think this would be a more idiomatic construction.
(Completely untested!)
if (!txb)
return NULL;
txb->offset += shdr;
txb->space -= shdr;
return txb;
> }
>
> /*
...
next prev parent reply other threads:[~2024-03-05 14:03 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-04 8:42 [PATCH net-next v2 00/21] rxrpc: Miscellaneous changes and make use of MSG_SPLICE_PAGES David Howells
2024-03-04 8:42 ` [PATCH net-next v2 01/21] rxrpc: Record the Tx serial in the rxrpc_txbuf and retransmit trace David Howells
2024-03-04 8:42 ` [PATCH net-next v2 02/21] rxrpc: Convert rxrpc_txbuf::flags into a mask and don't use atomics David Howells
2024-03-04 8:43 ` [PATCH net-next v2 03/21] rxrpc: Note cksum in txbuf David Howells
2024-03-04 8:43 ` [PATCH net-next v2 04/21] rxrpc: Fix the names of the fields in the ACK trailer struct David Howells
2024-03-04 8:43 ` [PATCH net-next v2 05/21] rxrpc: Strip barriers and atomics off of timer tracking David Howells
2024-03-04 8:43 ` [PATCH net-next v2 06/21] rxrpc: Remove atomic handling on some fields only used in I/O thread David Howells
2024-03-04 8:43 ` [PATCH net-next v2 07/21] rxrpc: Do lazy DF flag resetting David Howells
2024-03-04 8:43 ` [PATCH net-next v2 08/21] rxrpc: Merge together DF/non-DF branches of data Tx function David Howells
2024-03-04 8:43 ` [PATCH net-next v2 09/21] rxrpc: Add a kvec[] to the rxrpc_txbuf struct David Howells
2024-03-04 8:43 ` [PATCH net-next v2 10/21] rxrpc: Split up the DATA packet transmission function David Howells
2024-03-04 8:43 ` [PATCH net-next v2 11/21] rxrpc: Don't pick values out of the wire header when setting up security David Howells
2024-03-04 8:43 ` [PATCH net-next v2 12/21] rxrpc: Move rxrpc_send_ACK() to output.c with rxrpc_send_ack_packet() David Howells
2024-03-04 8:43 ` [PATCH net-next v2 13/21] rxrpc: Use rxrpc_txbuf::kvec[0] instead of rxrpc_txbuf::wire David Howells
2024-03-04 8:43 ` [PATCH net-next v2 14/21] rxrpc: Do zerocopy using MSG_SPLICE_PAGES and page frags David Howells
2024-03-05 14:03 ` Simon Horman [this message]
2024-03-04 8:43 ` [PATCH net-next v2 15/21] rxrpc: Parse received packets before dealing with timeouts David Howells
2024-03-04 8:43 ` [PATCH net-next v2 16/21] rxrpc: Don't permit resending after all Tx packets acked David Howells
2024-03-04 8:43 ` [PATCH net-next v2 17/21] rxrpc: Differentiate PING ACK transmission traces David Howells
2024-03-04 8:43 ` [PATCH net-next v2 18/21] rxrpc: Use ktimes for call timeout tracking and set the timer lazily David Howells
2024-03-04 8:43 ` [PATCH net-next v2 19/21] rxrpc: Record probes after transmission and reduce number of time-gets David Howells
2024-03-04 8:43 ` [PATCH net-next v2 20/21] rxrpc: Clean up the resend algorithm David Howells
2024-03-04 8:43 ` [PATCH net-next v2 21/21] rxrpc: Extract useful fields from a received ACK to skb priv data David Howells
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=20240305140343.GH2357@kernel.org \
--to=horms@kernel.org \
--cc=davem@davemloft.net \
--cc=dhowells@redhat.com \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-afs@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marc.dionne@auristor.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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 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).