Skip to content

Commit c313d35

Browse files
LorenzoBianconikuba-moo
authored andcommitted
net: mana: Add metadata support for xdp mode
Set metadata size building the skb from xdp_buff in mana driver. mana driver sets xdp headroom to XDP_PACKET_HEADROOM so the headroom is large enough to contain xdp_frame and xdp metadata. Please note this patch is just compiled tested. Reviewed-by: Michal Kubiak <[email protected]> Signed-off-by: Lorenzo Bianconi <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 74fb134 commit c313d35

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

drivers/net/ethernet/microsoft/mana/mana_bpf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ u32 mana_run_xdp(struct net_device *ndev, struct mana_rxq *rxq,
9191
goto out;
9292

9393
xdp_init_buff(xdp, PAGE_SIZE, &rxq->xdp_rxq);
94-
xdp_prepare_buff(xdp, buf_va, XDP_PACKET_HEADROOM, pkt_len, false);
94+
xdp_prepare_buff(xdp, buf_va, XDP_PACKET_HEADROOM, pkt_len, true);
9595

9696
act = bpf_prog_run_xdp(prog, xdp);
9797

drivers/net/ethernet/microsoft/mana/mana_en.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,8 +1559,12 @@ static struct sk_buff *mana_build_skb(struct mana_rxq *rxq, void *buf_va,
15591559
return NULL;
15601560

15611561
if (xdp->data_hard_start) {
1562+
u32 metasize = xdp->data - xdp->data_meta;
1563+
15621564
skb_reserve(skb, xdp->data - xdp->data_hard_start);
15631565
skb_put(skb, xdp->data_end - xdp->data);
1566+
if (metasize)
1567+
skb_metadata_set(skb, metasize);
15641568
return skb;
15651569
}
15661570

0 commit comments

Comments
 (0)