[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4a894465ea0747d08c96282602bcdf6b@realtek.com>
Date: Wed, 12 Jun 2024 04:20:29 +0000
From: Justin Lai <justinlai0215@...ltek.com>
To: Ratheesh Kannoth <rkannoth@...vell.com>
CC: "kuba@...nel.org" <kuba@...nel.org>,
"davem@...emloft.net"
<davem@...emloft.net>,
"edumazet@...gle.com" <edumazet@...gle.com>,
"pabeni@...hat.com" <pabeni@...hat.com>,
"linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>,
"netdev@...r.kernel.org"
<netdev@...r.kernel.org>,
"andrew@...n.ch" <andrew@...n.ch>,
"jiri@...nulli.us" <jiri@...nulli.us>,
"horms@...nel.org" <horms@...nel.org>,
Ping-Ke Shih <pkshih@...ltek.com>, Larry Chiu <larry.chiu@...ltek.com>
Subject: RE: [PATCH net-next v20 06/13] rtase: Implement .ndo_start_xmit function
> On 2024-06-07 at 14:13:14, Justin Lai (justinlai0215@...ltek.com) wrote:
> > Implement .ndo_start_xmit function to fill the information of the
> > packet to be transmitted into the tx descriptor, and then the hardware
> > will transmit the packet using the information in the tx descriptor.
> > In addition, we also implemented the tx_handler function to enable the
> > tx descriptor to be reused.
> >
> > Signed-off-by: Justin Lai <justinlai0215@...ltek.com>
> > ---
> > .../net/ethernet/realtek/rtase/rtase_main.c | 285 ++++++++++++++++++
> > 1 file changed, 285 insertions(+)
> >
> > diff --git a/drivers/net/ethernet/realtek/rtase/rtase_main.c
> > b/drivers/net/ethernet/realtek/rtase/rtase_main.c
> > index 23406c195cff..6bdb4edbfbc1 100644
> > --- a/drivers/net/ethernet/realtek/rtase/rtase_main.c
> > +++ b/drivers/net/ethernet/realtek/rtase/rtase_main.c
> > @@ -256,6 +256,68 @@ static void rtase_mark_to_asic(union rtase_rx_desc
> *desc, u32 rx_buf_sz)
> > cpu_to_le32(RTASE_DESC_OWN | eor | rx_buf_sz)); }
> >
> > +static u32 rtase_tx_avail(struct rtase_ring *ring) {
> > + return READ_ONCE(ring->dirty_idx) + RTASE_NUM_DESC -
> > + READ_ONCE(ring->cur_idx); }
> dirty_idx and cur_idx wont wrap ? its 32bit in size.
>
> >
cur_idx and dirty_idx may wrap, but all we want is the difference between
them, so this won't have any effect. In addition, the difference between
the two will not exceed RTASE_NUM_DESC, and dirty_idx will not exceed
cur_idx, so the calculation won't go wrong.
Powered by blists - more mailing lists