444b60f15166d041b8ce7db21929eff3252e09e4
[openwrt/staging/ansuel.git] /
1 From 210ca75d4949f1ace8ea53a75148806cc28224a0 Mon Sep 17 00:00:00 2001
2 From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
3 Date: Mon, 3 Apr 2023 19:30:35 +0100
4 Subject: [PATCH 4/5] net: mvneta: move tso_build_hdr() into
5 mvneta_tso_put_hdr()
6
7 Move tso_build_hdr() into mvneta_tso_put_hdr() so that all the TSO
8 header building code is in one place.
9
10 Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
11 ---
12 drivers/net/ethernet/marvell/mvneta.c | 22 +++++++++++-----------
13 1 file changed, 11 insertions(+), 11 deletions(-)
14
15 --- a/drivers/net/ethernet/marvell/mvneta.c
16 +++ b/drivers/net/ethernet/marvell/mvneta.c
17 @@ -2592,19 +2592,24 @@ err_drop_frame:
18 return rx_done;
19 }
20
21 -static inline void
22 -mvneta_tso_put_hdr(struct sk_buff *skb, struct mvneta_tx_queue *txq)
23 +static void mvneta_tso_put_hdr(struct sk_buff *skb, struct mvneta_tx_queue *txq,
24 + struct tso_t *tso, int size, bool is_last)
25 {
26 - int hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
27 + int tso_offset, hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
28 struct mvneta_tx_buf *buf = &txq->buf[txq->txq_put_index];
29 struct mvneta_tx_desc *tx_desc;
30 + char *hdr;
31 +
32 + tso_offset = txq->txq_put_index * TSO_HEADER_SIZE;
33 +
34 + hdr = txq->tso_hdrs + tso_offset;
35 + tso_build_hdr(skb, hdr, tso, size, is_last);
36
37 tx_desc = mvneta_txq_next_desc_get(txq);
38 tx_desc->data_size = hdr_len;
39 tx_desc->command = mvneta_skb_tx_csum(skb);
40 tx_desc->command |= MVNETA_TXD_F_DESC;
41 - tx_desc->buf_phys_addr = txq->tso_hdrs_phys +
42 - txq->txq_put_index * TSO_HEADER_SIZE;
43 + tx_desc->buf_phys_addr = txq->tso_hdrs_phys + tso_offset;
44 buf->type = MVNETA_TYPE_TSO;
45 buf->skb = NULL;
46
47 @@ -2697,17 +2702,12 @@ static int mvneta_tx_tso(struct sk_buff
48
49 total_len = skb->len - hdr_len;
50 while (total_len > 0) {
51 - char *hdr;
52 -
53 data_left = min_t(int, skb_shinfo(skb)->gso_size, total_len);
54 total_len -= data_left;
55 desc_count++;
56
57 /* prepare packet headers: MAC + IP + TCP */
58 - hdr = txq->tso_hdrs + txq->txq_put_index * TSO_HEADER_SIZE;
59 - tso_build_hdr(skb, hdr, &tso, data_left, total_len == 0);
60 -
61 - mvneta_tso_put_hdr(skb, txq);
62 + mvneta_tso_put_hdr(skb, txq, &tso, data_left, total_len == 0);
63
64 while (data_left > 0) {
65 int size;