Skip to content

Commit 9123397

Browse files
netoptimizerAlexei Starovoitov
authored andcommitted
mlx4: 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 via matching individual Completion Queue Entry (CQE) status bits. Fixes: ab46182 ("net/mlx4_en: 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/168132893562.340624.12779118462402031248.stgit@firesoul Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 96b1a09 commit 9123397

File tree

1 file changed

+18
-1
lines changed
  • drivers/net/ethernet/mellanox/mlx4

1 file changed

+18
-1
lines changed

drivers/net/ethernet/mellanox/mlx4/en_rx.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,11 +685,28 @@ int mlx4_en_xdp_rx_hash(const struct xdp_md *ctx, u32 *hash,
685685
enum xdp_rss_hash_type *rss_type)
686686
{
687687
struct mlx4_en_xdp_buff *_ctx = (void *)ctx;
688+
struct mlx4_cqe *cqe = _ctx->cqe;
689+
enum xdp_rss_hash_type xht = 0;
690+
__be16 status;
688691

689692
if (unlikely(!(_ctx->dev->features & NETIF_F_RXHASH)))
690693
return -ENODATA;
691694

692-
*hash = be32_to_cpu(_ctx->cqe->immed_rss_invalid);
695+
*hash = be32_to_cpu(cqe->immed_rss_invalid);
696+
status = cqe->status;
697+
if (status & cpu_to_be16(MLX4_CQE_STATUS_TCP))
698+
xht = XDP_RSS_L4_TCP;
699+
if (status & cpu_to_be16(MLX4_CQE_STATUS_UDP))
700+
xht = XDP_RSS_L4_UDP;
701+
if (status & cpu_to_be16(MLX4_CQE_STATUS_IPV4 | MLX4_CQE_STATUS_IPV4F))
702+
xht |= XDP_RSS_L3_IPV4;
703+
if (status & cpu_to_be16(MLX4_CQE_STATUS_IPV6)) {
704+
xht |= XDP_RSS_L3_IPV6;
705+
if (cqe->ipv6_ext_mask)
706+
xht |= XDP_RSS_L3_DYNHDR;
707+
}
708+
*rss_type = xht;
709+
693710
return 0;
694711
}
695712

0 commit comments

Comments
 (0)