Re: [PATCH net-next v3 6/7] net: lan966x: Add support for XDP_TX

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The 11/22/2022 17:56, Alexander Lobakin wrote:
> 
> From: Horatiu Vultur <horatiu.vultur@xxxxxxxxxxxxx>
> Date: Mon, 21 Nov 2022 22:28:49 +0100
> 
> > Extend lan966x XDP support with the action XDP_TX. In this case when the
> > received buffer needs to execute XDP_TX, the buffer will be moved to the
> > TX buffers. So a new RX buffer will be allocated.
> > When the TX finish with the frame, it would give back the buffer to the
> > page pool.
> >
> > Signed-off-by: Horatiu Vultur <horatiu.vultur@xxxxxxxxxxxxx>
> > ---
> >  .../ethernet/microchip/lan966x/lan966x_fdma.c | 78 +++++++++++++++++--
> >  .../ethernet/microchip/lan966x/lan966x_main.c |  4 +-
> >  .../ethernet/microchip/lan966x/lan966x_main.h |  8 ++
> >  .../ethernet/microchip/lan966x/lan966x_xdp.c  |  8 ++
> >  4 files changed, 90 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c
> > index f8287a6a86ed5..b14fdb8e15e22 100644
> > --- a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c
> > +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c
> > @@ -411,12 +411,18 @@ static void lan966x_fdma_tx_clear_buf(struct lan966x *lan966x, int weight)
> >               dcb_buf->dev->stats.tx_bytes += dcb_buf->len;
> >
> >               dcb_buf->used = false;
> > -             dma_unmap_single(lan966x->dev,
> > -                              dcb_buf->dma_addr,
> > -                              dcb_buf->len,
> > -                              DMA_TO_DEVICE);
> > -             if (!dcb_buf->ptp)
> > -                     dev_kfree_skb_any(dcb_buf->skb);
> > +             if (dcb_buf->skb) {
> > +                     dma_unmap_single(lan966x->dev,
> > +                                      dcb_buf->dma_addr,
> > +                                      dcb_buf->len,
> > +                                      DMA_TO_DEVICE);
> > +
> > +                     if (!dcb_buf->ptp)
> > +                             dev_kfree_skb_any(dcb_buf->skb);
> 
> Damn, forgot to remind you you wanted to switch to
> napi_consume_skb() :s

Correct, I forgot to update this. Will do in the next series.

> 
> > +             }
> > +
> > +             if (dcb_buf->xdpf)
> > +                     xdp_return_frame_rx_napi(dcb_buf->xdpf);
> >
> >               clear = true;
> >       }
> 
> [...]
> 
> > --
> > 2.38.0
> 
> Thanks,
> Olek

-- 
/Horatiu



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux