Re: [PATCH net v2] net: renesas: rswitch: Fix timestamp feature after all descriptors are used

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 2023/6/7 15:01, Yoshihiro Shimoda wrote:
> diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c
> index aace87139cea..049adbf5a642 100644
> --- a/drivers/net/ethernet/renesas/rswitch.c
> +++ b/drivers/net/ethernet/renesas/rswitch.c
> @@ -420,7 +420,7 @@ static int rswitch_gwca_queue_format(struct net_device *ndev,
>  }
>  
>  static void rswitch_gwca_ts_queue_fill(struct rswitch_private *priv,
> -				       int start_index, int num)
> +				       int start_index, int num, bool last)
>  {
>  	struct rswitch_gwca_queue *gq = &priv->gwca.ts_queue;
>  	struct rswitch_ts_desc *desc;
> @@ -431,6 +431,12 @@ static void rswitch_gwca_ts_queue_fill(struct rswitch_private *priv,
>  		desc = &gq->ts_ring[index];
>  		desc->desc.die_dt = DT_FEMPTY_ND | DIE;
>  	}
> +
> +	if (last) {
> +		desc = &gq->ts_ring[gq->ring_size];
> +		rswitch_desc_set_dptr(&desc->desc, gq->ring_dma);
> +		desc->desc.die_dt = DT_LINKFIX;
> +	}
>  }
>  
Hello Yoshihiro Shimoda,

Does your function set the last descriptor to hardware on initialization, but not at other times?
I think rswitch_gwca_ts_queue_fill should be implemented in a separate function,
not use the 'last' distinguish the last descriptor.
But if it should be setting every cycle, I think rswitch_gwca_queue_ext_ts_fill should
check if the descriptor is the last in the queue and set the LINKFIX flag.

>  static int rswitch_gwca_queue_ext_ts_fill(struct net_device *ndev,
> @@ -941,7 +947,7 @@ static void rswitch_ts(struct rswitch_private *priv)
>  	}
>  
>  	num = rswitch_get_num_cur_queues(gq);
> -	rswitch_gwca_ts_queue_fill(priv, gq->dirty, num);
> +	rswitch_gwca_ts_queue_fill(priv, gq->dirty, num, false);
>  	gq->dirty = rswitch_next_queue_index(gq, false, num);
>  }
>  
> @@ -1780,7 +1786,7 @@ static int rswitch_init(struct rswitch_private *priv)
>  	if (err < 0)
>  		goto err_ts_queue_alloc;
>  
> -	rswitch_gwca_ts_queue_fill(priv, 0, TS_RING_SIZE);
> +	rswitch_gwca_ts_queue_fill(priv, 0, TS_RING_SIZE, true);
>  	INIT_LIST_HEAD(&priv->gwca.ts_info_list);
>  
>  	for (i = 0; i < RSWITCH_NUM_PORTS; i++) {
> 



[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux