Skip to content

Commit 96b1a09

Browse files
netoptimizerAlexei Starovoitov
authored andcommitted
veth: bpf_xdp_metadata_rx_hash add xdp rss hash type
Update API for bpf_xdp_metadata_rx_hash() with arg for xdp rss hash type. The veth driver currently only support XDP-hints based on SKB code path. The SKB have lost information about the RSS hash type, by compressing the information down to a single bitfield skb->l4_hash, that only knows if this was a L4 hash value. In preparation for veth, the xdp_rss_hash_type have an L4 indication bit that allow us to return a meaningful L4 indication when working with SKB based packets. Fixes: 306531f ("veth: Support RX XDP metadata") Signed-off-by: Jesper Dangaard Brouer <[email protected]> Acked-by: Toke Høiland-Jørgensen <[email protected]> Acked-by: Stanislav Fomichev <[email protected]> Link: https://lore.kernel.org/r/168132893055.340624.16209448340644513469.stgit@firesoul Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 67f245c commit 96b1a09

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/net/veth.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1652,11 +1652,14 @@ static int veth_xdp_rx_hash(const struct xdp_md *ctx, u32 *hash,
16521652
enum xdp_rss_hash_type *rss_type)
16531653
{
16541654
struct veth_xdp_buff *_ctx = (void *)ctx;
1655+
struct sk_buff *skb = _ctx->skb;
16551656

1656-
if (!_ctx->skb)
1657+
if (!skb)
16571658
return -ENODATA;
16581659

1659-
*hash = skb_get_hash(_ctx->skb);
1660+
*hash = skb_get_hash(skb);
1661+
*rss_type = skb->l4_hash ? XDP_RSS_TYPE_L4_ANY : XDP_RSS_TYPE_NONE;
1662+
16601663
return 0;
16611664
}
16621665

0 commit comments

Comments
 (0)