Skip to content

Commit aff0824

Browse files
LorenzoBianconidavem330
authored andcommitted
net: marvell: return csum computation result from mvneta_rx_csum/mvpp2_rx_csum
This is a preliminary patch to add hw csum hint support to mvneta/mvpp2 xdp implementation Tested-by: Matteo Croce <[email protected]> Signed-off-by: Lorenzo Bianconi <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f84974e commit aff0824

File tree

2 files changed

+12
-21
lines changed

2 files changed

+12
-21
lines changed

drivers/net/ethernet/marvell/mvneta.c

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1805,18 +1805,14 @@ static void mvneta_rx_error(struct mvneta_port *pp,
18051805
}
18061806

18071807
/* Handle RX checksum offload based on the descriptor's status */
1808-
static void mvneta_rx_csum(struct mvneta_port *pp, u32 status,
1809-
struct sk_buff *skb)
1808+
static int mvneta_rx_csum(struct mvneta_port *pp, u32 status)
18101809
{
18111810
if ((pp->dev->features & NETIF_F_RXCSUM) &&
18121811
(status & MVNETA_RXD_L3_IP4) &&
1813-
(status & MVNETA_RXD_L4_CSUM_OK)) {
1814-
skb->csum = 0;
1815-
skb->ip_summed = CHECKSUM_UNNECESSARY;
1816-
return;
1817-
}
1812+
(status & MVNETA_RXD_L4_CSUM_OK))
1813+
return CHECKSUM_UNNECESSARY;
18181814

1819-
skb->ip_summed = CHECKSUM_NONE;
1815+
return CHECKSUM_NONE;
18201816
}
18211817

18221818
/* Return tx queue pointer (find last set bit) according to <cause> returned
@@ -2335,7 +2331,7 @@ mvneta_swbm_build_skb(struct mvneta_port *pp, struct page_pool *pool,
23352331

23362332
skb_reserve(skb, xdp->data - xdp->data_hard_start);
23372333
skb_put(skb, xdp->data_end - xdp->data);
2338-
mvneta_rx_csum(pp, desc_status, skb);
2334+
skb->ip_summed = mvneta_rx_csum(pp, desc_status);
23392335

23402336
for (i = 0; i < num_frags; i++) {
23412337
skb_frag_t *frag = &sinfo->frags[i];
@@ -2535,7 +2531,7 @@ static int mvneta_rx_hwbm(struct napi_struct *napi,
25352531
rx_bytes);
25362532

25372533
skb->protocol = eth_type_trans(skb, dev);
2538-
mvneta_rx_csum(pp, rx_status, skb);
2534+
skb->ip_summed = mvneta_rx_csum(pp, rx_status);
25392535
napi_gro_receive(napi, skb);
25402536

25412537
rcvd_pkts++;
@@ -2584,8 +2580,7 @@ static int mvneta_rx_hwbm(struct napi_struct *napi,
25842580
skb_put(skb, rx_bytes);
25852581

25862582
skb->protocol = eth_type_trans(skb, dev);
2587-
2588-
mvneta_rx_csum(pp, rx_status, skb);
2583+
skb->ip_summed = mvneta_rx_csum(pp, rx_status);
25892584

25902585
napi_gro_receive(napi, skb);
25912586
}

drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3543,21 +3543,17 @@ static void mvpp2_rx_error(struct mvpp2_port *port,
35433543
}
35443544

35453545
/* Handle RX checksum offload */
3546-
static void mvpp2_rx_csum(struct mvpp2_port *port, u32 status,
3547-
struct sk_buff *skb)
3546+
static int mvpp2_rx_csum(struct mvpp2_port *port, u32 status)
35483547
{
35493548
if (((status & MVPP2_RXD_L3_IP4) &&
35503549
!(status & MVPP2_RXD_IP4_HEADER_ERR)) ||
35513550
(status & MVPP2_RXD_L3_IP6))
35523551
if (((status & MVPP2_RXD_L4_UDP) ||
35533552
(status & MVPP2_RXD_L4_TCP)) &&
3554-
(status & MVPP2_RXD_L4_CSUM_OK)) {
3555-
skb->csum = 0;
3556-
skb->ip_summed = CHECKSUM_UNNECESSARY;
3557-
return;
3558-
}
3553+
(status & MVPP2_RXD_L4_CSUM_OK))
3554+
return CHECKSUM_UNNECESSARY;
35593555

3560-
skb->ip_summed = CHECKSUM_NONE;
3556+
return CHECKSUM_NONE;
35613557
}
35623558

35633559
/* Allocate a new skb and add it to BM pool */
@@ -4012,7 +4008,7 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi,
40124008

40134009
skb_reserve(skb, MVPP2_MH_SIZE + MVPP2_SKB_HEADROOM);
40144010
skb_put(skb, rx_bytes);
4015-
mvpp2_rx_csum(port, rx_status, skb);
4011+
skb->ip_summed = mvpp2_rx_csum(port, rx_status);
40164012
skb->protocol = eth_type_trans(skb, dev);
40174013

40184014
napi_gro_receive(napi, skb);

0 commit comments

Comments
 (0)