[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <47fa96be-181e-4d71-a0ce-244bfbe93cb8@amd.com>
Date: Tue, 13 Feb 2024 14:05:13 -0800
From: "Nelson, Shannon" <shannon.nelson@....com>
To: Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org,
davem@...emloft.net, kuba@...nel.org, edumazet@...gle.com
Cc: brett.creeley@....com, drivers@...sando.io
Subject: Re: [PATCH v3 net-next 7/9] ionic: Add XDP_REDIRECT support
On 2/13/2024 3:27 AM, Paolo Abeni wrote:
>
> On Fri, 2024-02-09 at 16:48 -0800, Shannon Nelson wrote:
>> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c
>> index 6921fd3a1773..6a2067599bd8 100644
>> --- a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c
>> +++ b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c
>> @@ -413,7 +413,19 @@ static bool ionic_run_xdp(struct ionic_rx_stats *stats,
>> break;
>>
>> case XDP_REDIRECT:
>> - goto out_xdp_abort;
>> + /* unmap the pages before handing them to a different device */
>> + dma_unmap_page(rxq->dev, buf_info->dma_addr,
>> + IONIC_PAGE_SIZE, DMA_FROM_DEVICE);
>> +
>> + err = xdp_do_redirect(netdev, &xdp_buf, xdp_prog);
>> + if (err) {
>> + netdev_dbg(netdev, "xdp_do_redirect err %d\n", err);
>> + goto out_xdp_abort;
>> + }
>> + buf_info->page = NULL;
>> + rxq->xdp_flush = true;
>> + stats->xdp_redirect++;
>> + break;
>
> After this patch, there is a single 'goto out_xdp_abort' statement.
There are three 'goto' statements - error handling for XDP_REDIRECT,
error handling for XDP_TX, and for the XDP_DROP/default case.
>
> If you re-order the case as:
>
> case XDP_TX:
> case XDP_REDIRECT:
> case XDP_REDIRECT:
> default:
>
> in patch 4/9, then you will not need to add the mentioned label in the
> previous patch and the code after this one will be cleaner.
Sure, I can put the XDP_REDIRECT after the XDP_TX, which will clean up
patch 6/9 slightly.
And thanks for taking the time to look at these, I appreciate it.
Cheers,
sln
>
> Cheers,
>
> Paolo
>
Powered by blists - more mailing lists