0002-edma_tx_rx-support-newer-kernels-time-stamping-API.patch 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. From 3357c64b3fc63fe003d5ef02ba7f6abca64d80bf Mon Sep 17 00:00:00 2001
  2. From: Baruch Siach <[email protected]>
  3. Date: Mon, 3 May 2021 20:07:36 +0300
  4. Subject: [PATCH 2/8] edma_tx_rx: support newer kernels time stamping API
  5. Timestamping API has changed in kernel 5.6, so update the implementation
  6. for newer kernels.
  7. Signed-off-by: Baruch Siach <[email protected]>
  8. ---
  9. hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c | 11 +++++++++++
  10. 1 file changed, 11 insertions(+)
  11. --- a/hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c
  12. +++ b/hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c
  13. @@ -227,10 +227,16 @@ void nss_phy_tstamp_rx_buf(__attribute__
  14. * set to the correct PTP class value by calling ptp_classify_raw
  15. * in drv->rxtstamp function.
  16. */
  17. +#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0))
  18. if (ndev && ndev->phydev && ndev->phydev->drv &&
  19. ndev->phydev->drv->rxtstamp)
  20. if(ndev->phydev->drv->rxtstamp(ndev->phydev, skb, 0))
  21. return;
  22. +#else
  23. + if (ndev && phy_has_rxtstamp(ndev->phydev))
  24. + if (phy_rxtstamp(ndev->phydev, skb, 0))
  25. + return;
  26. +#endif
  27. netif_receive_skb(skb);
  28. }
  29. @@ -248,9 +254,14 @@ void nss_phy_tstamp_tx_buf(struct net_de
  30. * set to the correct PTP class value by calling ptp_classify_raw
  31. * in the drv->txtstamp function.
  32. */
  33. +#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0))
  34. if (ndev && ndev->phydev && ndev->phydev->drv &&
  35. ndev->phydev->drv->txtstamp)
  36. ndev->phydev->drv->txtstamp(ndev->phydev, skb, 0);
  37. +#else
  38. + if (ndev && phy_has_txtstamp(ndev->phydev))
  39. + phy_txtstamp(ndev->phydev, skb, 0);
  40. +#endif
  41. }
  42. EXPORT_SYMBOL(nss_phy_tstamp_tx_buf);