[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<AM5PR04MB3139619B482EA03D3B8DEC06882FA@AM5PR04MB3139.eurprd04.prod.outlook.com>
Date: Wed, 5 Jul 2023 01:56:16 +0000
From: Wei Fang <wei.fang@....com>
To: Andrew Lunn <andrew@...n.ch>
CC: "davem@...emloft.net" <davem@...emloft.net>, "edumazet@...gle.com"
<edumazet@...gle.com>, "kuba@...nel.org" <kuba@...nel.org>,
"pabeni@...hat.com" <pabeni@...hat.com>, "ast@...nel.org" <ast@...nel.org>,
"daniel@...earbox.net" <daniel@...earbox.net>, "hawk@...nel.org"
<hawk@...nel.org>, "john.fastabend@...il.com" <john.fastabend@...il.com>,
Shenwei Wang <shenwei.wang@....com>, Clark Wang <xiaoning.wang@....com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>, dl-linux-imx
<linux-imx@....com>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "bpf@...r.kernel.org" <bpf@...r.kernel.org>
Subject: RE: [PATCH net 2/3] net: fec: recycle pages for transmitted XDP
frames
> -----Original Message-----
> From: Andrew Lunn <andrew@...n.ch>
> Sent: 2023年7月5日 7:48
> To: Wei Fang <wei.fang@....com>
> Cc: davem@...emloft.net; edumazet@...gle.com; kuba@...nel.org;
> pabeni@...hat.com; ast@...nel.org; daniel@...earbox.net;
> hawk@...nel.org; john.fastabend@...il.com; Shenwei Wang
> <shenwei.wang@....com>; Clark Wang <xiaoning.wang@....com>;
> netdev@...r.kernel.org; dl-linux-imx <linux-imx@....com>;
> linux-kernel@...r.kernel.org; bpf@...r.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
Powered by blists - more mailing lists