Message ID | 158446616289.702578.7889111879119296431.stgit@firesoul |
---|---|
State | RFC |
Delegated to: | BPF Maintainers |
Headers | show |
Series | XDP extend with knowledge of frame size | expand |
On Tue, Mar 17, 2020 at 06:29:22PM +0100, Jesper Dangaard Brouer wrote: > This driver uses full PAGE_SIZE pages when XDP is enabled. > > Cc: Michael Chan <michael.chan@broadcom.com> > Cc: Andy Gospodarek <andrew.gospodarek@broadcom.com> > Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com> > --- > drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c > index c6f6f2033880..5e3b4a3b69ea 100644 > --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c > +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c > @@ -138,6 +138,7 @@ bool bnxt_rx_xdp(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, u16 cons, > xdp_set_data_meta_invalid(&xdp); > xdp.data_end = *data_ptr + *len; > xdp.rxq = &rxr->xdp_rxq; > + xdp.frame_sz = PAGE_SIZE; /* BNXT_RX_PAGE_MODE(bp) when XDP enabled */ So if we want this to be the true size that the packet inside the the DMA buffer could grow to, I _think_ this would need to be: xdp.frame_sz = PAGE_SIZE - XDP_PACKET_HEADROOM; but I also noted that in patch 8 of the series that there is a check against data_end - data_hard_start, so functionally your original patch appears to be correct. If the intent was just to capture the size of the [DMA] buffer available for the datagram, maybe calling this new field 'buf_sz' or similar would be nice as it does not convey anything about the on-wire size like 'frame_sz' does. > orig_data = xdp.data; > > rcu_read_lock(); > >
On Tue, Mar 17, 2020 at 06:29:22PM +0100, Jesper Dangaard Brouer wrote: > This driver uses full PAGE_SIZE pages when XDP is enabled. Talked with Jesper about this some more on IRC and he clarified something for me that was bugging me. > Cc: Michael Chan <michael.chan@broadcom.com> > Cc: Andy Gospodarek <andrew.gospodarek@broadcom.com> I know this is only an RFC, but feel free to add: Reviewed-by: Andy Gospodarek <gospo@broadcom.com> to this patch. Thanks for your work on this! > Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com> > --- > drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c > index c6f6f2033880..5e3b4a3b69ea 100644 > --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c > +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c > @@ -138,6 +138,7 @@ bool bnxt_rx_xdp(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, u16 cons, > xdp_set_data_meta_invalid(&xdp); > xdp.data_end = *data_ptr + *len; > xdp.rxq = &rxr->xdp_rxq; > + xdp.frame_sz = PAGE_SIZE; /* BNXT_RX_PAGE_MODE(bp) when XDP enabled */ > orig_data = xdp.data; > > rcu_read_lock(); > >
On Mon, 23 Mar 2020 10:18:33 -0400 Andy Gospodarek <andy@greyhouse.net> wrote: > On Tue, Mar 17, 2020 at 06:29:22PM +0100, Jesper Dangaard Brouer wrote: > > This driver uses full PAGE_SIZE pages when XDP is enabled. > > Talked with Jesper about this some more on IRC and he clarified > something for me that was bugging me. Yes, nice talking to you on IRC. Note some XDP developers are hanging out on freenode channel #xdp (my nick is netoptimizer from my GitHub name) > > Cc: Michael Chan <michael.chan@broadcom.com> > > Cc: Andy Gospodarek <andrew.gospodarek@broadcom.com> > > I know this is only an RFC, but feel free to add: > > Reviewed-by: Andy Gospodarek <gospo@broadcom.com> Great, I've added this to my current patchset :-) > to this patch. Thanks for your work on this! Thanks!
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c index c6f6f2033880..5e3b4a3b69ea 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c @@ -138,6 +138,7 @@ bool bnxt_rx_xdp(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, u16 cons, xdp_set_data_meta_invalid(&xdp); xdp.data_end = *data_ptr + *len; xdp.rxq = &rxr->xdp_rxq; + xdp.frame_sz = PAGE_SIZE; /* BNXT_RX_PAGE_MODE(bp) when XDP enabled */ orig_data = xdp.data; rcu_read_lock();
This driver uses full PAGE_SIZE pages when XDP is enabled. Cc: Michael Chan <michael.chan@broadcom.com> Cc: Andy Gospodarek <andrew.gospodarek@broadcom.com> Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com> --- drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c | 1 + 1 file changed, 1 insertion(+)