On Sat, Jan 28, 2017 at 11:28:22PM -0800, Sudarsana Kalluru wrote:
> +/* Read Rx timestamp */
> +static int qed_ptp_hw_read_rx_ts(struct qed_dev *cdev, u64 *timestamp)
> +{
> +     struct qed_hwfn *p_hwfn = QED_LEADING_HWFN(cdev);
> +     struct qed_ptt *p_ptt = p_hwfn->p_ptp_ptt;
> +     u32 val;
> +
> +     *timestamp = 0;
> +     val = qed_rd(p_hwfn, p_ptt, NIG_REG_LLH_PTP_HOST_BUF_SEQID);
> +     if (!(val & QED_TIMESTAMP_MASK)) {
> +             DP_INFO(p_hwfn, "Invalid Rx timestamp, buf_seqid = %d\n", val);
> +             return -EINVAL;
> +     }
> +
> +     val = qed_rd(p_hwfn, p_ptt, NIG_REG_LLH_PTP_HOST_BUF_TS_LSB);
> +     *timestamp = qed_rd(p_hwfn, p_ptt, NIG_REG_LLH_PTP_HOST_BUF_TS_MSB);

You can already "Reset timestamp register to allow new timestamp" at
this point, before combining the MSB and LSB.

> +     *timestamp <<= 32;
> +     *timestamp |= val;
> +
> +     /* Reset timestamp register to allow new timestamp */
> +     qed_wr(p_hwfn, p_ptt, NIG_REG_LLH_PTP_HOST_BUF_SEQID,
> +            QED_TIMESTAMP_MASK);
> +
> +     return 0;
> +}

Thanks,
Richard

Reply via email to