mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 09:04:39 +02:00
net: lan966x: refactor buffer reload function
Now that we store everything in the fdma structs, refactor lan966x_fdma_reload() to store and restore the entire struct. Signed-off-by: Daniel Machon <daniel.machon@microchip.com> Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
9fbc5719f6
commit
89ba464fcf
|
|
@ -810,14 +810,11 @@ static int lan966x_qsys_sw_status(struct lan966x *lan966x)
|
||||||
static int lan966x_fdma_reload(struct lan966x *lan966x, int new_mtu)
|
static int lan966x_fdma_reload(struct lan966x *lan966x, int new_mtu)
|
||||||
{
|
{
|
||||||
struct page_pool *page_pool;
|
struct page_pool *page_pool;
|
||||||
dma_addr_t rx_dma;
|
struct fdma fdma_rx_old;
|
||||||
void *rx_dcbs;
|
|
||||||
u32 size;
|
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
/* Store these for later to free them */
|
/* Store these for later to free them */
|
||||||
rx_dma = lan966x->rx.fdma.dma;
|
memcpy(&fdma_rx_old, &lan966x->rx.fdma, sizeof(struct fdma));
|
||||||
rx_dcbs = lan966x->rx.fdma.dcbs;
|
|
||||||
page_pool = lan966x->rx.page_pool;
|
page_pool = lan966x->rx.page_pool;
|
||||||
|
|
||||||
napi_synchronize(&lan966x->napi);
|
napi_synchronize(&lan966x->napi);
|
||||||
|
|
@ -833,9 +830,7 @@ static int lan966x_fdma_reload(struct lan966x *lan966x, int new_mtu)
|
||||||
goto restore;
|
goto restore;
|
||||||
lan966x_fdma_rx_start(&lan966x->rx);
|
lan966x_fdma_rx_start(&lan966x->rx);
|
||||||
|
|
||||||
size = sizeof(struct fdma_dcb) * lan966x->rx.fdma.n_dcbs;
|
fdma_free_coherent(lan966x->dev, &fdma_rx_old);
|
||||||
size = ALIGN(size, PAGE_SIZE);
|
|
||||||
dma_free_coherent(lan966x->dev, size, rx_dcbs, rx_dma);
|
|
||||||
|
|
||||||
page_pool_destroy(page_pool);
|
page_pool_destroy(page_pool);
|
||||||
|
|
||||||
|
|
@ -845,8 +840,7 @@ static int lan966x_fdma_reload(struct lan966x *lan966x, int new_mtu)
|
||||||
return err;
|
return err;
|
||||||
restore:
|
restore:
|
||||||
lan966x->rx.page_pool = page_pool;
|
lan966x->rx.page_pool = page_pool;
|
||||||
lan966x->rx.fdma.dma = rx_dma;
|
memcpy(&lan966x->rx.fdma, &fdma_rx_old, sizeof(struct fdma));
|
||||||
lan966x->rx.fdma.dcbs = rx_dcbs;
|
|
||||||
lan966x_fdma_rx_start(&lan966x->rx);
|
lan966x_fdma_rx_start(&lan966x->rx);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user