mbox series

[iwl-next,v5,00/12] Add support for Rx timestamping for both ice and iavf drivers.

Message ID 20240418052500.50678-1-mateusz.polchlopek@intel.com
Headers show
Series Add support for Rx timestamping for both ice and iavf drivers. | expand

Message

Mateusz Polchlopek April 18, 2024, 5:24 a.m. UTC
Initially, during VF creation it registers the PTP clock in
the system and negotiates with PF it's capabilities. In the
meantime the PF enables the Flexible Descriptor for VF.
Only this type of descriptor allows to receive Rx timestamps.

Enabling virtual clock would be possible, though it would probably
perform poorly due to the lack of direct time access.

Enable timestamping should be done using SIOCSHWTSTAMP ioctl,
e.g.
hwstamp_ctl -i $VF -r 14

In order to report the timestamps to userspace, the VF extends
timestamp to 40b.

To support this feature the flexible descriptors and PTP part
in iavf driver have been introduced.

---
v5:
- fixed all new issues generated by this series in kernel-doc

v4:
- fixed duplicated argument in iavf_virtchnl.c reported by coccicheck
https://lore.kernel.org/netdev/20240410121706.6223-1-mateusz.polchlopek@intel.com/

v3:
- added RB in commit 6
- removed inline keyword in commit 9
- fixed sparse issues in commit 9 and commit 10
- used GENMASK_ULL when possible in commit 9
https://lore.kernel.org/netdev/20240403131927.87021-1-mateusz.polchlopek@intel.com/

v2:
- fixed warning related to wrong specifier to dev_err_once in
  commit 7
- fixed warnings related to unused variables in commit 9
https://lore.kernel.org/netdev/20240327132543.15923-1-mateusz.polchlopek@intel.com/

v1:
- initial series
https://lore.kernel.org/netdev/20240326115116.10040-1-mateusz.polchlopek@intel.com/
---

Jacob Keller (10):
  virtchnl: add support for enabling PTP on iAVF
  virtchnl: add enumeration for the rxdid format
  iavf: add support for negotiating flexible RXDID format
  iavf: negotiate PTP capabilities
  iavf: add initial framework for registering PTP clock
  iavf: add support for indirect access to PHC time
  iavf: periodically cache PHC time
  iavf: refactor iavf_clean_rx_irq to support legacy and flex
    descriptors
  iavf: handle SIOCSHWTSTAMP and SIOCGHWTSTAMP
  iavf: add support for Rx timestamps to hotpath

Mateusz Polchlopek (1):
  iavf: Implement checking DD desc field

Simei Su (1):
  ice: support Rx timestamp on flex descriptor

 drivers/net/ethernet/intel/iavf/Makefile      |   3 +-
 drivers/net/ethernet/intel/iavf/iavf.h        |  33 +-
 drivers/net/ethernet/intel/iavf/iavf_main.c   | 245 +++++++-
 drivers/net/ethernet/intel/iavf/iavf_ptp.c    | 548 ++++++++++++++++++
 drivers/net/ethernet/intel/iavf/iavf_ptp.h    |  46 ++
 drivers/net/ethernet/intel/iavf/iavf_txrx.c   | 426 +++++++++++---
 drivers/net/ethernet/intel/iavf/iavf_txrx.h   |  26 +-
 drivers/net/ethernet/intel/iavf/iavf_type.h   | 150 +++--
 .../net/ethernet/intel/iavf/iavf_virtchnl.c   | 238 ++++++++
 drivers/net/ethernet/intel/ice/ice_base.c     |   3 -
 drivers/net/ethernet/intel/ice/ice_ptp.c      |   4 +-
 drivers/net/ethernet/intel/ice/ice_ptp.h      |   2 +
 drivers/net/ethernet/intel/ice/ice_vf_lib.h   |   2 +
 drivers/net/ethernet/intel/ice/ice_virtchnl.c |  86 ++-
 drivers/net/ethernet/intel/ice/ice_virtchnl.h |   2 +
 .../intel/ice/ice_virtchnl_allowlist.c        |   6 +
 include/linux/avf/virtchnl.h                  | 127 +++-
 17 files changed, 1786 insertions(+), 161 deletions(-)
 create mode 100644 drivers/net/ethernet/intel/iavf/iavf_ptp.c
 create mode 100644 drivers/net/ethernet/intel/iavf/iavf_ptp.h

Comments

Rahul Rameshbabu April 18, 2024, 8:19 p.m. UTC | #1
On Thu, 18 Apr, 2024 01:24:48 -0400 Mateusz Polchlopek <mateusz.polchlopek@intel.com> wrote:
> Initially, during VF creation it registers the PTP clock in
> the system and negotiates with PF it's capabilities. In the
> meantime the PF enables the Flexible Descriptor for VF.
> Only this type of descriptor allows to receive Rx timestamps.
>
> Enabling virtual clock would be possible, though it would probably
> perform poorly due to the lack of direct time access.
>
> Enable timestamping should be done using SIOCSHWTSTAMP ioctl,
> e.g.
> hwstamp_ctl -i $VF -r 14
>
> In order to report the timestamps to userspace, the VF extends
> timestamp to 40b.
>
> To support this feature the flexible descriptors and PTP part
> in iavf driver have been introduced.
>
> ---

Just one general/cosmetic comment. It might make more sense for the
Reviewed-by: trailer to come after the Signed-off-by: trailer, since the
review happens after the patches have been written.

--
Thanks,

Rahul Rameshbabu
Mateusz Polchlopek April 22, 2024, 9:37 a.m. UTC | #2
On 4/18/2024 10:19 PM, Rahul Rameshbabu wrote:
> 
> On Thu, 18 Apr, 2024 01:24:48 -0400 Mateusz Polchlopek <mateusz.polchlopek@intel.com> wrote:
>> Initially, during VF creation it registers the PTP clock in
>> the system and negotiates with PF it's capabilities. In the
>> meantime the PF enables the Flexible Descriptor for VF.
>> Only this type of descriptor allows to receive Rx timestamps.
>>
>> Enabling virtual clock would be possible, though it would probably
>> perform poorly due to the lack of direct time access.
>>
>> Enable timestamping should be done using SIOCSHWTSTAMP ioctl,
>> e.g.
>> hwstamp_ctl -i $VF -r 14
>>
>> In order to report the timestamps to userspace, the VF extends
>> timestamp to 40b.
>>
>> To support this feature the flexible descriptors and PTP part
>> in iavf driver have been introduced.
>>
>> ---
> 
> Just one general/cosmetic comment. It might make more sense for the
> Reviewed-by: trailer to come after the Signed-off-by: trailer, since the
> review happens after the patches have been written.
> 
> --
> Thanks,
> 
> Rahul Rameshbabu

Hmmm... I think that the Signed-off-by added by sender should be the
last one on the list if there is Co-developed-by before.

Thanks for overall review!
Mateusz
Rahul Rameshbabu April 23, 2024, 5:57 a.m. UTC | #3
On Mon, 22 Apr, 2024 11:37:14 +0200 Mateusz Polchlopek <mateusz.polchlopek@intel.com> wrote:
> On 4/18/2024 10:19 PM, Rahul Rameshbabu wrote:
>> On Thu, 18 Apr, 2024 01:24:48 -0400 Mateusz Polchlopek
>> <mateusz.polchlopek@intel.com> wrote:
>>> Initially, during VF creation it registers the PTP clock in
>>> the system and negotiates with PF it's capabilities. In the
>>> meantime the PF enables the Flexible Descriptor for VF.
>>> Only this type of descriptor allows to receive Rx timestamps.
>>>
>>> Enabling virtual clock would be possible, though it would probably
>>> perform poorly due to the lack of direct time access.
>>>
>>> Enable timestamping should be done using SIOCSHWTSTAMP ioctl,
>>> e.g.
>>> hwstamp_ctl -i $VF -r 14
>>>
>>> In order to report the timestamps to userspace, the VF extends
>>> timestamp to 40b.
>>>
>>> To support this feature the flexible descriptors and PTP part
>>> in iavf driver have been introduced.
>>>
>>> ---
>> Just one general/cosmetic comment. It might make more sense for the
>> Reviewed-by: trailer to come after the Signed-off-by: trailer, since the
>> review happens after the patches have been written.
>> --
>> Thanks,
>> Rahul Rameshbabu
>
> Hmmm... I think that the Signed-off-by added by sender should be the
> last one on the list if there is Co-developed-by before.

Sorry, my bad, I should have expressed this better. On the first patch
for example.

My expectation for the trailer order would have been the following.

  Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
  Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
  Signed-off-by: Mateusz Polchlopek <mateusz.polchlopek@intel.com>

instead of

  Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
  Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
  Signed-off-by: Mateusz Polchlopek <mateusz.polchlopek@intel.com>

I think for the ones with Co-developed-by:, you are right that the
ordering would be strange to re-arrange.

--
Thanks,

Rahul Rameshbabu
Mateusz Polchlopek April 23, 2024, 6:08 a.m. UTC | #4
On 4/23/2024 7:57 AM, Rahul Rameshbabu wrote:
> 
> On Mon, 22 Apr, 2024 11:37:14 +0200 Mateusz Polchlopek <mateusz.polchlopek@intel.com> wrote:
>> On 4/18/2024 10:19 PM, Rahul Rameshbabu wrote:
>>> On Thu, 18 Apr, 2024 01:24:48 -0400 Mateusz Polchlopek
>>> <mateusz.polchlopek@intel.com> wrote:
>>>> Initially, during VF creation it registers the PTP clock in
>>>> the system and negotiates with PF it's capabilities. In the
>>>> meantime the PF enables the Flexible Descriptor for VF.
>>>> Only this type of descriptor allows to receive Rx timestamps.
>>>>
>>>> Enabling virtual clock would be possible, though it would probably
>>>> perform poorly due to the lack of direct time access.
>>>>
>>>> Enable timestamping should be done using SIOCSHWTSTAMP ioctl,
>>>> e.g.
>>>> hwstamp_ctl -i $VF -r 14
>>>>
>>>> In order to report the timestamps to userspace, the VF extends
>>>> timestamp to 40b.
>>>>
>>>> To support this feature the flexible descriptors and PTP part
>>>> in iavf driver have been introduced.
>>>>
>>>> ---
>>> Just one general/cosmetic comment. It might make more sense for the
>>> Reviewed-by: trailer to come after the Signed-off-by: trailer, since the
>>> review happens after the patches have been written.
>>> --
>>> Thanks,
>>> Rahul Rameshbabu
>>
>> Hmmm... I think that the Signed-off-by added by sender should be the
>> last one on the list if there is Co-developed-by before.
> 
> Sorry, my bad, I should have expressed this better. On the first patch
> for example.
> 
> My expectation for the trailer order would have been the following.
> 
>    Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
>    Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
>    Signed-off-by: Mateusz Polchlopek <mateusz.polchlopek@intel.com>
> 
> instead of
> 
>    Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
>    Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
>    Signed-off-by: Mateusz Polchlopek <mateusz.polchlopek@intel.com>
> 
> I think for the ones with Co-developed-by:, you are right that the
> ordering would be strange to re-arrange.
> 

Ahhh... Now I see, You are right! I will fix that order in next version.
Thanks

> --
> Thanks,
> 
> Rahul Rameshbabu
>