RE: [PATCH V4 net 5/5] net: stmmac: re-init rx buffers when mac resume back
flat view
From: Joakim Zhang <hidden>
Date: 2021-02-20 07:58:05
-----Original Message----- From: Jakub Kicinski <kuba@kernel.org> Sent: 2021年2月7日 4:38 To: Joakim Zhang <redacted> Cc: peppe.cavallaro@st.com; alexandre.torgue@st.com; joabreu@synopsys.com; davem@davemloft.net; netdev@vger.kernel.org; dl-linux-imx [off-list ref] Subject: Re: [PATCH V4 net 5/5] net: stmmac: re-init rx buffers when mac resume back On Thu, 4 Feb 2021 19:21:44 +0800 Joakim Zhang wrote:quoted
+err_reinit_rx_buffers: + while (queue >= 0) { + while (--i >= 0) + stmmac_free_rx_buffer(priv, queue, i); + + if (queue == 0) + break; + + i = priv->dma_rx_size; + queue--; + }nit: do { ... } while (queue-- > 0);
OK, will change it.
quoted
+ + return -ENOMEM;the caller ignores the return value anyway, so you make make this function void.
OK.
I'm not sure why you recycle and reallocate every buffer. Isn't it enough to reinitialize the descriptors with the buffers which are already allocated?
As I know, the receive buffer address is not fixed after allocated, it will recycle and re-allocate in stmmac_rx(), where to handle the receive buffers. It should be enough to re-initialize the descriptors with the buffers if it is possible. Could you point me how to do it? Best Regards, Joakim Zhang