From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexei Starovoitov Subject: Re: [bpf-next V2 PATCH 13/14] bpf: finally expose xdp_rxq_info to XDP bpf-programs Date: Fri, 22 Dec 2017 20:50:26 -0800 Message-ID: <20171223045024.24blttuz3sc3g2dp@ast-mbp> References: <151396262289.20006.1429172971820409456.stgit@firesoul> <151396276110.20006.14837685590566635319.stgit@firesoul> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Daniel Borkmann , netdev@vger.kernel.org, dsahern@gmail.com, gospo@broadcom.com, bjorn.topel@intel.com, michael.chan@broadcom.com To: Jesper Dangaard Brouer Return-path: Received: from mail-pl0-f66.google.com ([209.85.160.66]:42823 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756184AbdLWEu3 (ORCPT ); Fri, 22 Dec 2017 23:50:29 -0500 Received: by mail-pl0-f66.google.com with SMTP id bd8so13985162plb.9 for ; Fri, 22 Dec 2017 20:50:29 -0800 (PST) Content-Disposition: inline In-Reply-To: <151396276110.20006.14837685590566635319.stgit@firesoul> Sender: netdev-owner@vger.kernel.org List-ID: On Fri, Dec 22, 2017 at 06:12:41PM +0100, Jesper Dangaard Brouer wrote: > Now all XDP driver have been updated to setup xdp_rxq_info and assign > this to xdp_buff->rxq. Thus, it is now safe to enable access to some > of the xdp_rxq_info struct members. > > This patch extend xdp_md and expose UAPI to userspace for > ingress_ifindex and rx_queue_index. Access happens via bpf > instruction rewrite, that load data directly from struct xdp_rxq_info. > > * ingress_ifindex map to xdp_rxq_info->dev->ifindex > * rx_queue_index map to xdp_rxq_info->queue_index > > Signed-off-by: Jesper Dangaard Brouer ... > diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h > index 69eabfcb9bdb..a6000a95d40e 100644 > --- a/include/uapi/linux/bpf.h > +++ b/include/uapi/linux/bpf.h > @@ -899,6 +899,9 @@ struct xdp_md { > __u32 data; > __u32 data_end; > __u32 data_meta; > + /* Below access go though struct xdp_rxq_info */ > + __u32 ingress_ifindex; /* rxq->dev->ifindex */ > + __u32 rx_queue_index; /* rxq->queue_index */ > }; Acked-by: Alexei Starovoitov I think this is very useful extension and I hope driver maintainers will do a timely review of corresponding patches. my only nit: please use SPDX license header for two new files added in patch 14.