Re: [PATCH net-next v20 06/13] rtase: Implement .ndo_start_xmit function
From: Ratheesh Kannoth
Date: Fri Jun 07 2024 - 11:54:57 EST
On 2024-06-07 at 14:13:14, Justin Lai (justinlai0215@xxxxxxxxxxx) 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@xxxxxxxxxxx>
> ---
> .../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.
>