From: David Howells <dhowells@redhat.com>
To: netdev@vger.kernel.org
Cc: David Howells <dhowells@redhat.com>,
Marc Dionne <marc.dionne@auristor.com>,
Yunsheng Lin <linyunsheng@huawei.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: [PATCH net-next v2 08/39] rxrpc: Use a large kvec[] in rxrpc_local rather than every rxrpc_txbuf
Date: Wed, 4 Dec 2024 07:46:36 +0000 [thread overview]
Message-ID: <20241204074710.990092-9-dhowells@redhat.com> (raw)
In-Reply-To: <20241204074710.990092-1-dhowells@redhat.com>
Use a single large kvec[] in the rxrpc_local struct rather than one in
every rxrpc_txbuf struct to build large packets to save on memory.
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.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: linux-afs@lists.infradead.org
cc: netdev@vger.kernel.org
---
net/rxrpc/ar-internal.h | 6 ++++++
net/rxrpc/output.c | 45 ++++++++++++++++++++++++++++++-----------
2 files changed, 39 insertions(+), 12 deletions(-)
diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h
index d0fd37bdcfe9..ab8e565cb20b 100644
--- a/net/rxrpc/ar-internal.h
+++ b/net/rxrpc/ar-internal.h
@@ -320,6 +320,12 @@ struct rxrpc_local {
struct list_head new_client_calls; /* Newly created client calls need connection */
spinlock_t client_call_lock; /* Lock for ->new_client_calls */
struct sockaddr_rxrpc srx; /* local address */
+ /* Provide a kvec table sufficiently large to manage either a DATA
+ * packet with a maximum set of jumbo subpackets or a PING ACK padded
+ * out to 64K with zeropages for PMTUD.
+ */
+ struct kvec kvec[RXRPC_MAX_NR_JUMBO > 3 + 16 ?
+ RXRPC_MAX_NR_JUMBO : 3 + 16];
};
/*
diff --git a/net/rxrpc/output.c b/net/rxrpc/output.c
index b93a5d50be3e..f8bb5250e849 100644
--- a/net/rxrpc/output.c
+++ b/net/rxrpc/output.c
@@ -175,9 +175,11 @@ static void rxrpc_begin_rtt_probe(struct rxrpc_call *call, rxrpc_serial_t serial
/*
* Transmit an ACK packet.
*/
-static void rxrpc_send_ack_packet(struct rxrpc_call *call, struct rxrpc_txbuf *txb)
+static void rxrpc_send_ack_packet(struct rxrpc_call *call, struct rxrpc_txbuf *txb,
+ int nr_kv)
{
- struct rxrpc_wire_header *whdr = txb->kvec[0].iov_base;
+ struct kvec *kv = call->local->kvec;
+ struct rxrpc_wire_header *whdr = kv[0].iov_base;
struct rxrpc_connection *conn;
struct rxrpc_ackpacket *ack = (struct rxrpc_ackpacket *)(whdr + 1);
struct msghdr msg;
@@ -206,8 +208,9 @@ static void rxrpc_send_ack_packet(struct rxrpc_call *call, struct rxrpc_txbuf *t
rxrpc_inc_stat(call->rxnet, stat_tx_ack_send);
- iov_iter_kvec(&msg.msg_iter, WRITE, txb->kvec, txb->nr_kvec, txb->len);
+ iov_iter_kvec(&msg.msg_iter, WRITE, kv, nr_kv, txb->len);
rxrpc_local_dont_fragment(conn->local, false);
+
ret = do_udp_sendmsg(conn->local->socket, &msg, txb->len);
call->peer->last_tx_at = ktime_get_seconds();
if (ret < 0) {
@@ -233,6 +236,8 @@ void rxrpc_send_ACK(struct rxrpc_call *call, u8 ack_reason,
rxrpc_serial_t serial, enum rxrpc_propose_ack_trace why)
{
struct rxrpc_txbuf *txb;
+ struct kvec *kv = call->local->kvec;
+ int nr_kv;
if (test_bit(RXRPC_CALL_DISCONNECTED, &call->flags))
return;
@@ -248,12 +253,19 @@ void rxrpc_send_ACK(struct rxrpc_call *call, u8 ack_reason,
txb->ack_why = why;
rxrpc_fill_out_ack(call, txb, ack_reason, serial);
+
+ nr_kv = txb->nr_kvec;
+ kv[0] = txb->kvec[0];
+ kv[1] = txb->kvec[1];
+ kv[2] = txb->kvec[2];
+ // TODO: Extend a path MTU probe ACK
+
call->ackr_nr_unacked = 0;
atomic_set(&call->ackr_nr_consumed, 0);
clear_bit(RXRPC_CALL_RX_IS_IDLE, &call->flags);
trace_rxrpc_send_ack(call, why, ack_reason, serial);
- rxrpc_send_ack_packet(call, txb);
+ rxrpc_send_ack_packet(call, txb, nr_kv);
rxrpc_put_txbuf(txb, rxrpc_txbuf_put_ack_tx);
}
@@ -324,12 +336,15 @@ int rxrpc_send_abort_packet(struct rxrpc_call *call)
/*
* Prepare a (sub)packet for transmission.
*/
-static void rxrpc_prepare_data_subpacket(struct rxrpc_call *call, struct rxrpc_txbuf *txb,
- rxrpc_serial_t serial)
+static size_t rxrpc_prepare_data_subpacket(struct rxrpc_call *call, struct rxrpc_txbuf *txb,
+ rxrpc_serial_t serial,
+ int subpkt)
{
struct rxrpc_wire_header *whdr = txb->kvec[0].iov_base;
enum rxrpc_req_ack_trace why;
struct rxrpc_connection *conn = call->conn;
+ struct kvec *kv = &call->local->kvec[subpkt];
+ size_t len = txb->len;
bool last, more;
u8 flags;
@@ -385,8 +400,13 @@ static void rxrpc_prepare_data_subpacket(struct rxrpc_call *call, struct rxrpc_t
whdr->flags = flags;
whdr->serial = htonl(txb->serial);
whdr->cksum = txb->cksum;
+ whdr->serviceId = htons(conn->service_id);
+ kv->iov_base = whdr;
+ // TODO: Convert into a jumbo header for tail subpackets
trace_rxrpc_tx_data(call, txb->seq, txb->serial, flags, false);
+ kv->iov_len = len;
+ return len;
}
/*
@@ -395,13 +415,15 @@ static void rxrpc_prepare_data_subpacket(struct rxrpc_call *call, struct rxrpc_t
static size_t rxrpc_prepare_data_packet(struct rxrpc_call *call, struct rxrpc_txbuf *txb)
{
rxrpc_serial_t serial;
+ size_t len = 0;
/* Each transmission of a Tx packet needs a new serial number */
serial = rxrpc_get_next_serial(call->conn);
- rxrpc_prepare_data_subpacket(call, txb, serial);
+ len += rxrpc_prepare_data_subpacket(call, txb, serial, 0);
+ // TODO: Loop around adding tail subpackets
- return txb->len;
+ return len;
}
/*
@@ -442,7 +464,6 @@ static void rxrpc_tstamp_data_packets(struct rxrpc_call *call, struct rxrpc_txbu
*/
static int rxrpc_send_data_packet(struct rxrpc_call *call, struct rxrpc_txbuf *txb)
{
- struct rxrpc_wire_header *whdr = txb->kvec[0].iov_base;
struct rxrpc_connection *conn = call->conn;
enum rxrpc_tx_point frag;
struct msghdr msg;
@@ -463,7 +484,7 @@ static int rxrpc_send_data_packet(struct rxrpc_call *call, struct rxrpc_txbuf *t
}
}
- iov_iter_kvec(&msg.msg_iter, WRITE, txb->kvec, txb->nr_kvec, len);
+ iov_iter_kvec(&msg.msg_iter, WRITE, call->local->kvec, 1, len);
msg.msg_name = &call->peer->srx.transport;
msg.msg_namelen = call->peer->srx.transport_len;
@@ -480,7 +501,7 @@ static int rxrpc_send_data_packet(struct rxrpc_call *call, struct rxrpc_txbuf *t
/* send the packet with the don't fragment bit set if we currently
* think it's small enough */
- if (txb->len >= call->peer->maxdata) {
+ if (len >= sizeof(struct rxrpc_wire_header) + call->peer->maxdata) {
rxrpc_local_dont_fragment(conn->local, false);
frag = rxrpc_tx_point_call_data_frag;
} else {
@@ -503,7 +524,7 @@ static int rxrpc_send_data_packet(struct rxrpc_call *call, struct rxrpc_txbuf *t
rxrpc_inc_stat(call->rxnet, stat_tx_data_send_fail);
trace_rxrpc_tx_fail(call->debug_id, txb->serial, ret, frag);
} else {
- trace_rxrpc_tx_packet(call->debug_id, whdr, frag);
+ trace_rxrpc_tx_packet(call->debug_id, call->local->kvec[0].iov_base, frag);
}
rxrpc_tx_backoff(call, ret);
next prev parent reply other threads:[~2024-12-04 7:47 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-04 7:46 [PATCH net-next v2 00/39] rxrpc: Implement jumbo DATA transmission and RACK-TLP David Howells
2024-12-04 7:46 ` [PATCH net-next v2 01/39] ktime: Add us_to_ktime() David Howells
2024-12-04 7:46 ` [PATCH net-next v2 02/39] rxrpc: Fix handling of received connection abort David Howells
2024-12-04 7:46 ` [PATCH net-next v2 03/39] rxrpc: Use umin() and umax() rather than min_t()/max_t() where possible David Howells
2024-12-04 7:46 ` [PATCH net-next v2 04/39] rxrpc: Clean up Tx header flags generation handling David Howells
2024-12-04 7:46 ` [PATCH net-next v2 05/39] rxrpc: Don't set the MORE-PACKETS rxrpc wire header flag David Howells
2024-12-04 7:46 ` [PATCH net-next v2 06/39] rxrpc: Show stats counter for received reason-0 ACKs David Howells
2024-12-04 7:46 ` [PATCH net-next v2 07/39] rxrpc: Request an ACK on impending Tx stall David Howells
2024-12-04 7:46 ` David Howells [this message]
2024-12-04 7:46 ` [PATCH net-next v2 09/39] rxrpc: Implement path-MTU probing using padded PING ACKs (RFC8899) David Howells
2024-12-04 7:46 ` [PATCH net-next v2 10/39] rxrpc: Separate the packet length from the data length in rxrpc_txbuf David Howells
2024-12-04 7:46 ` [PATCH net-next v2 11/39] rxrpc: Prepare to be able to send jumbo DATA packets David Howells
2024-12-04 7:46 ` [PATCH net-next v2 12/39] rxrpc: Add a tracepoint to show variables pertinent to jumbo packet size David Howells
2024-12-04 7:46 ` [PATCH net-next v2 13/39] rxrpc: Fix CPU time starvation in I/O thread David Howells
2024-12-04 7:46 ` [PATCH net-next v2 14/39] rxrpc: Fix injection of packet loss David Howells
2024-12-04 7:46 ` [PATCH net-next v2 15/39] rxrpc: Only set DF=1 on initial DATA transmission David Howells
2024-12-04 7:46 ` [PATCH net-next v2 16/39] rxrpc: Timestamp DATA packets before transmitting them David Howells
2024-12-04 7:46 ` [PATCH net-next v2 17/39] rxrpc: Don't need barrier for ->tx_bottom and ->acks_hard_ack David Howells
2024-12-04 7:46 ` [PATCH net-next v2 18/39] rxrpc: Implement progressive transmission queue struct David Howells
2024-12-04 7:46 ` [PATCH net-next v2 19/39] rxrpc: call->acks_hard_ack is now the same call->tx_bottom, so remove it David Howells
2024-12-04 7:46 ` [PATCH net-next v2 20/39] rxrpc: Replace call->acks_first_seq with tracking of the hard ACK point David Howells
2024-12-04 7:46 ` [PATCH net-next v2 21/39] rxrpc: Display stats about jumbo packets transmitted and received David Howells
2024-12-04 7:46 ` [PATCH net-next v2 22/39] rxrpc: Adjust names and types of congestion-related fields David Howells
2024-12-04 7:46 ` [PATCH net-next v2 23/39] rxrpc: Use the new rxrpc_tx_queue struct to more efficiently process ACKs David Howells
2024-12-04 7:46 ` [PATCH net-next v2 24/39] rxrpc: Store the DATA serial in the txqueue and use this in RTT calc David Howells
2024-12-04 7:46 ` [PATCH net-next v2 25/39] rxrpc: Don't use received skbuff timestamps David Howells
2024-12-04 7:46 ` [PATCH net-next v2 26/39] rxrpc: Generate rtt_min David Howells
2024-12-04 7:46 ` [PATCH net-next v2 27/39] rxrpc: Adjust the rxrpc_rtt_rx tracepoint David Howells
2024-12-04 7:46 ` [PATCH net-next v2 28/39] rxrpc: Display userStatus in rxrpc_rx_ack trace David Howells
2024-12-04 7:46 ` [PATCH net-next v2 29/39] rxrpc: Fix the calculation and use of RTO David Howells
2024-12-04 7:46 ` [PATCH net-next v2 30/39] rxrpc: Fix initial resend timeout David Howells
2024-12-04 7:46 ` [PATCH net-next v2 31/39] rxrpc: Send jumbo DATA packets David Howells
2024-12-04 7:47 ` [PATCH net-next v2 32/39] rxrpc: Don't allocate a txbuf for an ACK transmission David Howells
2024-12-04 7:47 ` [PATCH net-next v2 33/39] rxrpc: Use irq-disabling spinlocks between app and I/O thread David Howells
2024-12-04 7:47 ` [PATCH net-next v2 34/39] rxrpc: Tidy up the ACK parsing a bit David Howells
2024-12-04 7:47 ` [PATCH net-next v2 35/39] rxrpc: Add a reason indicator to the tx_data tracepoint David Howells
2024-12-04 7:47 ` [PATCH net-next v2 36/39] rxrpc: Add a reason indicator to the tx_ack tracepoint David Howells
2024-12-04 7:47 ` [PATCH net-next v2 37/39] rxrpc: Manage RTT per-call rather than per-peer David Howells
2024-12-04 7:47 ` [PATCH net-next v2 38/39] rxrpc: Fix request for an ACK when cwnd is minimum David Howells
2024-12-04 7:47 ` [PATCH net-next v2 39/39] rxrpc: Implement RACK/TLP to deal with transmission stalls [RFC8985] David Howells
2024-12-09 22:10 ` [PATCH net-next v2 00/39] rxrpc: Implement jumbo DATA transmission and RACK-TLP patchwork-bot+netdevbpf
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=20241204074710.990092-9-dhowells@redhat.com \
--to=dhowells@redhat.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-afs@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linyunsheng@huawei.com \
--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