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.
> + union {
> + struct xdp_frame *xdpf;
> + struct sk_buff *skb;
> + };
> +};