Hi Jakub,
On Tue, Oct 15, 2019 at 05:03:53PM -0700, Jakub Kicinski wrote:
> On Mon, 14 Oct 2019 12:49:54 +0200, Lorenzo Bianconi wrote:
> > Allow tx buffer array to contain both skb and xdp buffers in order to
> > enable xdp frame recycling adding XDP_TX verdict support
> >
> > Signed-off-by: Lorenzo Bianconi <[email protected]>
> > ---
> > drivers/net/ethernet/marvell/mvneta.c | 66 +++++++++++++++++----------
> > 1 file changed, 43 insertions(+), 23 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/marvell/mvneta.c
> > b/drivers/net/ethernet/marvell/mvneta.c
> > index a79d81c9be7a..477ae6592fa3 100644
> > --- a/drivers/net/ethernet/marvell/mvneta.c
> > +++ b/drivers/net/ethernet/marvell/mvneta.c
> > @@ -561,6 +561,20 @@ struct mvneta_rx_desc {
> > };
> > #endif
> >
> > +enum mvneta_tx_buf_type {
> > + MVNETA_TYPE_SKB,
> > + MVNETA_TYPE_XDP_TX,
> > + MVNETA_TYPE_XDP_NDO,
> > +};
> > +
> > +struct mvneta_tx_buf {
> > + enum mvneta_tx_buf_type type;
>
> I'd be tempted to try to encode type on the low bits of the pointer,
> otherwise you're increasing the cache pressure here. I'm not 100% sure
> it's worth the hassle, perhaps could be a future optimization.
>
Since this is already offering a performance boost (since buffers are not
unmapped, but recycled and synced), we'll consider adding the buffer tracking
capability to the page_pool API. I don't think you'll see any performance
benefits on this device specifically (or any 1gbit interface), but your idea is
nice, if we add it on the page_pool API we'll try implementing it like that.
> > + union {
> > + struct xdp_frame *xdpf;
> > + struct sk_buff *skb;
> > + };
> > +};
>
Thanks
/Ilias