Re: [PATCH net-next v2 1/6] net: ti: icssg-prueth: Add functions to create and destroy Rx/Tx queues

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

 



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);




[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