lkml.org 
[lkml]   [2021]   [Jun]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [RESEND net-next 1/2] net: hns3: add support for PTP
    On Wed, Jun 02, 2021 at 10:57:43AM +0800, Guangbin Huang wrote:

    > @@ -4342,12 +4352,34 @@ static void hclge_periodic_service_task(struct hclge_dev *hdev)
    > hclge_task_schedule(hdev, delta);
    > }
    >
    > +static void hclge_ptp_service_task(struct hclge_dev *hdev)
    > +{
    > + if (!test_bit(HCLGE_STATE_PTP_EN, &hdev->state) ||
    > + !test_bit(HCLGE_STATE_PTP_TX_HANDLING, &hdev->state) ||
    > + !time_is_before_jiffies(hdev->ptp->tx_start + HZ))
    > + return;
    > +
    > + /* to prevent concurrence with the irq handler, disable vector0
    > + * before handling ptp service task.
    > + */
    > + disable_irq(hdev->misc_vector.vector_irq);

    This won't work. After all, the ISR thread might already be running.
    Use a proper spinlock instead.

    > + /* check HCLGE_STATE_PTP_TX_HANDLING here again, since the irq
    > + * handler may handle it just before disable_irq().
    > + */
    > + if (test_bit(HCLGE_STATE_PTP_TX_HANDLING, &hdev->state))
    > + hclge_ptp_clean_tx_hwts(hdev);
    > +
    > + enable_irq(hdev->misc_vector.vector_irq);
    > +}

    Thanks,
    Richard

    \
     
     \ /
      Last update: 2021-06-03 15:15    [W:5.026 / U:0.228 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site