On 3/26/2021 8:56 AM, Min Hu (Connor) wrote:
Add hns3 support for new ethdev APIs to enable and read IEEE1588/
802.1AS PTP timestamps.
Signed-off-by: Min Hu (Connor) <humi...@huawei.com>
---
doc/guides/nics/features/hns3.ini | 2 +
doc/guides/nics/hns3.rst | 1 +
drivers/net/hns3/hns3_cmd.h | 33 +++++
drivers/net/hns3/hns3_ethdev.c | 59 +++++++-
drivers/net/hns3/hns3_ethdev.h | 25 ++++
drivers/net/hns3/hns3_ptp.c | 294 ++++++++++++++++++++++++++++++++++++++
drivers/net/hns3/hns3_regs.h | 25 ++++
drivers/net/hns3/hns3_rxtx.c | 56 +++++++-
drivers/net/hns3/hns3_rxtx.h | 12 ++
drivers/net/hns3/hns3_rxtx_vec.c | 19 ++-
drivers/net/hns3/meson.build | 3 +-
11 files changed, 516 insertions(+), 13 deletions(-)
create mode 100644 drivers/net/hns3/hns3_ptp.c
diff --git a/doc/guides/nics/features/hns3.ini
b/doc/guides/nics/features/hns3.ini
index 3988be4..502bfe7 100644
--- a/doc/guides/nics/features/hns3.ini
+++ b/doc/guides/nics/features/hns3.ini
@@ -43,6 +43,8 @@ Stats per queue = Y
FW version = Y
Registers dump = Y
Module EEPROM dump = Y
+Timesync = Y
+Timestamp offload = Y
Multiprocess aware = Y
Linux = Y
ARMv8 = Y
diff --git a/doc/guides/nics/hns3.rst b/doc/guides/nics/hns3.rst
index ccd2f6f..3366562 100644
--- a/doc/guides/nics/hns3.rst
+++ b/doc/guides/nics/hns3.rst
@@ -37,6 +37,7 @@ Features of the HNS3 PMD are:
- MTU update
- NUMA support
- Generic flow API
+- IEEE1588/802.1AS timestamping
Prerequisites
-------------
diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h
index e704d0c..abc853b 100644
--- a/drivers/net/hns3/hns3_cmd.h
+++ b/drivers/net/hns3/hns3_cmd.h
@@ -123,6 +123,12 @@ enum hns3_opcode_type {
HNS3_OPC_CLEAR_MAC_TNL_INT = 0x0312,
HNS3_OPC_CONFIG_FEC_MODE = 0x031A,
+#ifdef RTE_LIBRTE_IEEE1588
+ /* PTP command */
+ HNS3_OPC_PTP_INT_EN = 0x0501,
+ HNS3_OPC_CFG_PTP_MODE = 0x0507,
+#endif
+
Hi Connor,
Does it needs to be a compile time configuration? What happens if it is always
enabled, or controlled by device argument?