Re: [PATCH net-next v2 01/12] net: stmmac: Get correct timestamp values from XGMAC
From: Jakub Kicinski
Date: Tue Aug 13 2019 - 16:57:37 EST
On Mon, 12 Aug 2019 11:44:00 +0200, Jose Abreu wrote:
> TX Timestamp in XGMAC comes from MAC instead of descriptors. Implement
> this in a new callback.
>
> Also, RX Timestamp in XGMAC must be cheked against corruption and we need
> a barrier to make sure that descriptor fields are read correctly.
>
> Changes from v1:
> - Rework the get timestamp function (David)
>
> Signed-off-by: Jose Abreu <joabreu@xxxxxxxxxxxx>
The barrier sounds like it might be a bug fix, does it occur in he wild?
> @@ -113,13 +119,11 @@ static int dwxgmac2_get_rx_timestamp_status(void *desc, void *next_desc,
> unsigned int rdes3 = le32_to_cpu(p->des3);
> int ret = -EBUSY;
>
> - if (likely(rdes3 & XGMAC_RDES3_CDA)) {
> + if (likely(rdes3 & XGMAC_RDES3_CDA))
> ret = dwxgmac2_rx_check_timestamp(next_desc);
> - if (ret)
> - return ret;
> - }
> -
> - return ret;
> + if (!ret)
> + return 1;
> + return 0;
nit:
return !ret;
> }
>
> static void dwxgmac2_init_rx_desc(struct dma_desc *p, int disable_rx_ic,