Messages in this thread | ![/](/images/icornerl.gif) | | From | Wei Fang <> | Subject | RE: [PATCH net 2/3] net: fec: recycle pages for transmitted XDP frames | Date | Wed, 5 Jul 2023 01:56:16 +0000 |
| |
> -----Original Message----- > From: Andrew Lunn <andrew@lunn.ch> > Sent: 2023年7月5日 7:48 > To: Wei Fang <wei.fang@nxp.com> > Cc: davem@davemloft.net; edumazet@google.com; kuba@kernel.org; > pabeni@redhat.com; ast@kernel.org; daniel@iogearbox.net; > hawk@kernel.org; john.fastabend@gmail.com; Shenwei Wang > <shenwei.wang@nxp.com>; Clark Wang <xiaoning.wang@nxp.com>; > netdev@vger.kernel.org; dl-linux-imx <linux-imx@nxp.com>; > linux-kernel@vger.kernel.org; bpf@vger.kernel.org > Subject: Re: [PATCH net 2/3] net: fec: recycle pages for transmitted XDP frames > > > /* Save skb pointer */ > > - txq->tx_skbuff[index] = skb; > > + txq->tx_buf[index].skb = skb; > > What about txq->tx_buf[index].type ? > we restore the buffer type to FEC_TXBUF_T_SKB when recycling the buffer descriptor, so there is no need to set it again here.
> > @@ -862,7 +860,7 @@ static int fec_enet_txq_submit_tso(struct > fec_enet_priv_tx_q *txq, > > } > > > > /* Save skb pointer */ > > - txq->tx_skbuff[index] = skb; > > + txq->tx_buf[index].skb = skb; > > here as well. > > > + /* restore default tx buffer type: FEC_TXBUF_T_SKB */ > > + txq->tx_buf[i].type = FEC_TXBUF_T_SKB; > > Seems error prone. It would be safer to explicitly set it next to > assigning .skb/.xdp. I also considered this method, but in the case when skb has frags or TSO, we only need to set skb pointer for the first txq->tx_buf, but we need to explicitly set the type for all txq->tx_buf corresponding to the skb. This may confuse others. As for your concern about being error-prone. I don't think it should be, I reset the type to FEC_TXBUF_T_SKB in all places where buffers are recycled or cleared.
> > Andrew
| ![\](/images/icornerr.gif) |