On Mon, 1 Sep 2025 15:32:22 +0530 Meghana Malladi wrote:
if (!emac->xdpi.prog && !prog) return 0;
- WRITE_ONCE(emac->xdp_prog, prog);
- if (netif_running(emac->ndev)) {
prueth_destroy_txq(emac);
prueth_destroy_rxq(emac);
- }
- old_prog = xchg(&emac->xdp_prog, prog);
- if (old_prog)
bpf_prog_put(old_prog);
- if (netif_running(emac->ndev)) {
ret = prueth_create_rxq(emac);
shutting the device down and freeing all rx memory for reconfig is not okay. If the system is low on memory the Rx buffer allocations may fail and system may drop off the network. You must either pre-allocate or avoid freeing the memory, and just restart the queues.
if (ret) {
netdev_err(emac->ndev, "Failed to create RX queue: %d\n", ret);
return ret;
}
ret = prueth_create_txq(emac);
if (ret) {
netdev_err(emac->ndev, "Failed to create TX queue: %d\n", ret);
prueth_destroy_rxq(emac);
emac->xdp_prog = NULL;
return ret;
}
- }
xdp_attachment_setup(&emac->xdpi, bpf);
linaro-mm-sig@lists.linaro.org