rxrpc: Note cksum in txbuf
authorDavid Howells <dhowells@redhat.com>
Mon, 29 Jan 2024 14:37:52 +0000 (14:37 +0000)
committerDavid Howells <dhowells@redhat.com>
Thu, 29 Feb 2024 15:49:57 +0000 (15:49 +0000)
Add a field to rxrpc_txbuf in which to store the checksum to go in the
header as this may get overwritten in the wire header struct when
transmitting as part of a jumbo packet.

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
net/rxrpc/output.c
net/rxrpc/rxkad.c
net/rxrpc/txbuf.c

index 54d1dc97cb0f7dd3e8adf828ddee73e90300faf0..c9a2882627aace76ee3b67408aef2cdbf9ea5beb 100644 (file)
@@ -803,6 +803,7 @@ struct rxrpc_txbuf {
        unsigned int            flags;
 #define RXRPC_TXBUF_WIRE_FLAGS 0xff            /* The wire protocol flags */
 #define RXRPC_TXBUF_RESENT     0x100           /* Set if has been resent */
+       __be16                  cksum;          /* Checksum to go in header */
        u8 /*enum rxrpc_propose_ack_trace*/ ack_why;    /* If ack, why */
        struct {
                /* The packet for encrypting and DMA'ing.  We align it such
index 8344ece5358aebca81a1377da6f38a052e1e3e3c..828b145edc56031c2980867b616b8d1813b5ebf0 100644 (file)
@@ -335,6 +335,7 @@ int rxrpc_send_data_packet(struct rxrpc_call *call, struct rxrpc_txbuf *txb)
        /* Each transmission of a Tx packet+ needs a new serial number */
        txb->serial = rxrpc_get_next_serial(conn);
        txb->wire.serial = htonl(txb->serial);
+       txb->wire.cksum = txb->cksum;
 
        if (test_bit(RXRPC_CONN_PROBING_FOR_UPGRADE, &conn->flags) &&
            txb->seq == 1)
index 6b32d61d4cdc46719d4a011987f6ea112ae59fc1..28c9ce763be4f76a9b993c674058a8ac73646b68 100644 (file)
@@ -378,7 +378,7 @@ static int rxkad_secure_packet(struct rxrpc_call *call, struct rxrpc_txbuf *txb)
        y = (y >> 16) & 0xffff;
        if (y == 0)
                y = 1; /* zero checksums are not permitted */
-       txb->wire.cksum = htons(y);
+       txb->cksum = htons(y);
 
        switch (call->conn->security_level) {
        case RXRPC_SECURITY_PLAIN:
index 48d5a8f644e5bbf0b9333718331fa63463f1b777..7273615afe94dea9a8ff3e96547374a48b378341 100644 (file)
@@ -35,6 +35,7 @@ struct rxrpc_txbuf *rxrpc_alloc_txbuf(struct rxrpc_call *call, u8 packet_type,
                txb->ack_why            = 0;
                txb->seq                = call->tx_prepared + 1;
                txb->serial             = 0;
+               txb->cksum              = 0;
                txb->wire.epoch         = htonl(call->conn->proto.epoch);
                txb->wire.cid           = htonl(call->cid);
                txb->wire.callNumber    = htonl(call->call_id);