Subject: Re: [PATCH v2 net-next 06/12] net: aquantia: implement data PTP datapath

From: Andrew Lunn <[email-masked]>
Date: Mon, 14 Oct 2019 18:36:12 +0200

> --- a/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c
> +++ b/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c
> @@ -8,12 +8,24 @@
>   */
>  
> +static inline int aq_ptp_tm_offset_egress_get(struct aq_ptp_s *aq_ptp)
> +{
> +	return atomic_read(&aq_ptp->offset_egress);
> +}
> +
> +static inline int aq_ptp_tm_offset_ingress_get(struct aq_ptp_s *aq_ptp)
> +{
> +	return atomic_read(&aq_ptp->offset_ingress);
> +}

inline should not be used in C files. Let the compiler decide.

> +
> +void aq_ptp_tm_offset_set(struct aq_nic_s *aq_nic, unsigned int mbps)
> +{
> +	struct aq_ptp_s *aq_ptp = aq_nic->aq_ptp;
> +	int i, egress, ingress;
> +
> +	if (!aq_ptp)
> +		return;
> +
> +	egress = 0;
> +	ingress = 0;
> +
> +	for (i = 0; i < ARRAY_SIZE(ptp_offset); i++) {
> +		if (mbps == ptp_offset[i].mbps) {
> +			egress = ptp_offset[i].egress;
> +			ingress = ptp_offset[i].ingress;
> +			break;
> +		}
> +	}
> +
> +	atomic_set(&aq_ptp->offset_egress, egress);
> +	atomic_set(&aq_ptp->offset_ingress, ingress);

It seems odd you have wrappers for atomic_read, but not atomic_set. Do
the wrappers actually add anything?

> +}
> +
> +static int __aq_ptp_skb_put(struct ptp_skb_ring *ring, struct sk_buff *skb)
> +{
> +	unsigned int next_head = (ring->head + 1) % ring->size;
> +
> +	if (next_head == ring->tail)
> +		return -1;

ENOMEM?

> +
> +	ring->buff[ring->head] = skb_get(skb);
> +	ring->head = next_head;
> +
> +	return 0;
> +}
> +

  Andrew