Add support to bnxt to report bpf_prog ID during XDP_QUERY_PROG. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Cc: Michael Chan <michael.c...@broadcom.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <dan...@iogearbox.net> --- drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c index 8ce793a0d030..841bc9df65b1 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c @@ -216,10 +216,20 @@ int bnxt_xdp(struct net_device *dev, struct netdev_xdp *xdp) case XDP_SETUP_PROG: rc = bnxt_xdp_set(bp, xdp->prog); break; - case XDP_QUERY_PROG: - xdp->prog_attached = !!bp->xdp_prog; + case XDP_QUERY_PROG: { + const struct bpf_prog *xdp_prog; + + xdp_prog = bp->xdp_prog; + if (xdp_prog) { + xdp->prog_id = xdp_prog->aux->id; + xdp->prog_attached = true; + } else { + xdp->prog_id = 0; + xdp->prog_attached = false; + } rc = 0; break; + } default: rc = -EINVAL; break; -- 2.9.3