bnxt_en: Add hardware PTP timestamping support on 575XX devices.
Michael Chan
maintainercover bnxt_en: Add hardware PTP timestamping support on 575XX devices.
Add PTP RX and TX hardware timestamp support on 575XX devices. These devices use the two-step method to implement the IEEE-1588 timestamping support.
Michael Chan (4):
bnxt_en: Update firmware interface to 1.10.2.34.
bnxt_en: Get PTP hardware capability from firmware.
bnxt_en: Add PTP clock APIs, ioctls, and ethtool methods.
bnxt_en: Enable hardware PTP support.
Pavan Chebbi (3):
bnxt_en: Get the full 48-bit hardware timestamp periodically.
bnxt_en: Get the RX packet timestamp.
bnxt_en: Transmit and retrieve packet timestamps.
drivers/net/ethernet/broadcom/Kconfig | 1 + drivers/net/ethernet/broadcom/bnxt/Makefile | 2 +- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 125 ++++- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 8 +- .../net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 34 ++ drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h | 434 +++++++++++++++++- drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c | 406 ++++++++++++++++ drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h | 62 +++ 8 files changed, 1046 insertions(+), 26 deletions(-) create mode 100644 drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c create mode 100644 drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h
Signature · 1 line
2.18.1
Michael Chan
maintainerPATCH 1/7 bnxt_en: Update firmware interface to 1.10.2.34.
Adding the PTP related firmware interface is the main change.
--- drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h | 434 +++++++++++++++++- 1 file changed, 417 insertions(+), 17 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h +417 -17
@@ -189,6 +189,8 @@ struct cmd_nums {#define HWRM_QUEUE_VLANPRI_QCAPS 0x83UL#define HWRM_QUEUE_VLANPRI2PRI_QCFG 0x84UL#define HWRM_QUEUE_VLANPRI2PRI_CFG 0x85UL +#define HWRM_QUEUE_GLOBAL_CFG 0x86UL +#define HWRM_QUEUE_GLOBAL_QCFG 0x87UL#define HWRM_CFA_L2_FILTER_ALLOC 0x90UL#define HWRM_CFA_L2_FILTER_FREE 0x91UL#define HWRM_CFA_L2_FILTER_CFG 0x92UL
@@ -305,6 +307,8 @@ struct cmd_nums {#define HWRM_CFA_EEM_OP 0x123UL#define HWRM_CFA_ADV_FLOW_MGNT_QCAPS 0x124UL#define HWRM_CFA_TFLIB 0x125UL +#define HWRM_CFA_LAG_GROUP_MEMBER_RGTR 0x126UL +#define HWRM_CFA_LAG_GROUP_MEMBER_UNRGTR 0x127UL#define HWRM_ENGINE_CKV_STATUS 0x12eUL#define HWRM_ENGINE_CKV_CKEK_ADD 0x12fUL#define HWRM_ENGINE_CKV_CKEK_DELETE 0x130UL
@@ -356,6 +360,10 @@ struct cmd_nums {#define HWRM_STAT_EXT_CTX_QUERY 0x199UL#define HWRM_FUNC_SPD_CFG 0x19aUL#define HWRM_FUNC_SPD_QCFG 0x19bUL +#define HWRM_FUNC_PTP_PIN_QCFG 0x19cUL +#define HWRM_FUNC_PTP_PIN_CFG 0x19dUL +#define HWRM_FUNC_PTP_CFG 0x19eUL +#define HWRM_FUNC_PTP_TS_QUERY 0x19fUL#define HWRM_SELFTEST_QLIST 0x200UL#define HWRM_SELFTEST_EXEC 0x201UL#define HWRM_SELFTEST_IRQ 0x202UL
@@ -385,6 +393,7 @@ struct cmd_nums {#define HWRM_TF_SESSION_RESC_ALLOC 0x2cdUL#define HWRM_TF_SESSION_RESC_FREE 0x2ceUL#define HWRM_TF_SESSION_RESC_FLUSH 0x2cfUL +#define HWRM_TF_SESSION_RESC_INFO 0x2d0UL#define HWRM_TF_TBL_TYPE_GET 0x2daUL#define HWRM_TF_TBL_TYPE_SET 0x2dbUL#define HWRM_TF_TBL_TYPE_BULK_GET 0x2dcUL
@@ -399,6 +408,7 @@ struct cmd_nums {#define HWRM_TF_EM_INSERT 0x2eaUL#define HWRM_TF_EM_DELETE 0x2ebUL#define HWRM_TF_EM_HASH_INSERT 0x2ecUL +#define HWRM_TF_EM_MOVE 0x2edUL#define HWRM_TF_TCAM_SET 0x2f8UL#define HWRM_TF_TCAM_GET 0x2f9UL#define HWRM_TF_TCAM_MOVE 0x2faUL
@@ -427,6 +437,15 @@ struct cmd_nums {#define HWRM_DBG_QCAPS 0xff20UL#define HWRM_DBG_QCFG 0xff21UL#define HWRM_DBG_CRASHDUMP_MEDIUM_CFG 0xff22UL +#define HWRM_DBG_USEQ_ALLOC 0xff23UL +#define HWRM_DBG_USEQ_FREE 0xff24UL +#define HWRM_DBG_USEQ_FLUSH 0xff25UL +#define HWRM_DBG_USEQ_QCAPS 0xff26UL +#define HWRM_DBG_USEQ_CW_CFG 0xff27UL +#define HWRM_DBG_USEQ_SCHED_CFG 0xff28UL +#define HWRM_DBG_USEQ_RUN 0xff29UL +#define HWRM_DBG_USEQ_DELIVERY_REQ 0xff2aUL +#define HWRM_DBG_USEQ_RESP_HDR 0xff2bUL#define HWRM_NVM_REQ_ARBITRATION 0xffedUL#define HWRM_NVM_FACTORY_DEFAULTS 0xffeeUL#define HWRM_NVM_VALIDATE_OPTION 0xffefUL
@@ -502,8 +521,8 @@ struct hwrm_err_output {#define HWRM_VERSION_MAJOR 1#define HWRM_VERSION_MINOR 10#define HWRM_VERSION_UPDATE 2 -#define HWRM_VERSION_RSVD 16 -#define HWRM_VERSION_STR "1.10.2.16" +#define HWRM_VERSION_RSVD 34 +#define HWRM_VERSION_STR "1.10.2.34"/* hwrm_ver_get_input (size:192b/24B) */ struct hwrm_ver_get_input {
@@ -725,7 +744,9 @@ struct hwrm_async_event_cmpl {#define ASYNC_EVENT_CMPL_EVENT_ID_DEFERRED_RESPONSE 0x40UL#define ASYNC_EVENT_CMPL_EVENT_ID_PFC_WATCHDOG_CFG_CHANGE 0x41UL#define ASYNC_EVENT_CMPL_EVENT_ID_ECHO_REQUEST 0x42UL -#define ASYNC_EVENT_CMPL_EVENT_ID_MAX_RGTR_EVENT_ID 0x43UL +#define ASYNC_EVENT_CMPL_EVENT_ID_PHC_MASTER 0x43UL +#define ASYNC_EVENT_CMPL_EVENT_ID_PPS_TIMESTAMP 0x44UL +#define ASYNC_EVENT_CMPL_EVENT_ID_MAX_RGTR_EVENT_ID 0x45UL#define ASYNC_EVENT_CMPL_EVENT_ID_FW_TRACE_MSG 0xfeUL#define ASYNC_EVENT_CMPL_EVENT_ID_HWRM_ERROR 0xffUL#define ASYNC_EVENT_CMPL_EVENT_ID_LAST ASYNC_EVENT_CMPL_EVENT_ID_HWRM_ERROR
@@ -919,6 +940,8 @@ struct hwrm_async_event_cmpl_vf_cfg_change {#define ASYNC_EVENT_CMPL_VF_CFG_CHANGE_EVENT_ID_VF_CFG_CHANGE 0x33UL#define ASYNC_EVENT_CMPL_VF_CFG_CHANGE_EVENT_ID_LAST ASYNC_EVENT_CMPL_VF_CFG_CHANGE_EVENT_ID_VF_CFG_CHANGE__le32 event_data2; +#define ASYNC_EVENT_CMPL_VF_CFG_CHANGE_EVENT_DATA2_VF_ID_MASK 0xffffUL +#define ASYNC_EVENT_CMPL_VF_CFG_CHANGE_EVENT_DATA2_VF_ID_SFT 0u8 opaque_v;#define ASYNC_EVENT_CMPL_VF_CFG_CHANGE_V 0x1UL#define ASYNC_EVENT_CMPL_VF_CFG_CHANGE_OPAQUE_MASK 0xfeUL
@@ -1074,6 +1097,60 @@ struct hwrm_async_event_cmpl_echo_request {__le32 event_data1; }; +/* hwrm_async_event_cmpl_phc_master (size:128b/16B) */ +struct hwrm_async_event_cmpl_phc_master { +__le16 type; +#define ASYNC_EVENT_CMPL_PHC_MASTER_TYPE_MASK 0x3fUL +#define ASYNC_EVENT_CMPL_PHC_MASTER_TYPE_SFT 0 +#define ASYNC_EVENT_CMPL_PHC_MASTER_TYPE_HWRM_ASYNC_EVENT 0x2eUL +#define ASYNC_EVENT_CMPL_PHC_MASTER_TYPE_LAST ASYNC_EVENT_CMPL_PHC_MASTER_TYPE_HWRM_ASYNC_EVENT +__le16 event_id; +#define ASYNC_EVENT_CMPL_PHC_MASTER_EVENT_ID_PHC_MASTER 0x43UL +#define ASYNC_EVENT_CMPL_PHC_MASTER_EVENT_ID_LAST ASYNC_EVENT_CMPL_PHC_MASTER_EVENT_ID_PHC_MASTER +__le32 event_data2; +u8 opaque_v; +#define ASYNC_EVENT_CMPL_PHC_MASTER_V 0x1UL +#define ASYNC_EVENT_CMPL_PHC_MASTER_OPAQUE_MASK 0xfeUL +#define ASYNC_EVENT_CMPL_PHC_MASTER_OPAQUE_SFT 1 +u8 timestamp_lo; +__le16 timestamp_hi; +__le32 event_data1; +#define ASYNC_EVENT_CMPL_PHC_MASTER_EVENT_DATA1_FLAGS_MASK 0xffUL +#define ASYNC_EVENT_CMPL_PHC_MASTER_EVENT_DATA1_FLAGS_SFT 0 +#define ASYNC_EVENT_CMPL_PHC_MASTER_EVENT_DATA1_FLAGS_MASTER_FUNC 0x1UL +#define ASYNC_EVENT_CMPL_PHC_MASTER_EVENT_DATA1_FLAGS_MASTER_SELECTED 0x2UL +}; + +/* hwrm_async_event_cmpl_pps_timestamp (size:128b/16B) */ +struct hwrm_async_event_cmpl_pps_timestamp { +__le16 type; +#define ASYNC_EVENT_CMPL_PPS_TIMESTAMP_TYPE_MASK 0x3fUL +#define ASYNC_EVENT_CMPL_PPS_TIMESTAMP_TYPE_SFT 0 +#define ASYNC_EVENT_CMPL_PPS_TIMESTAMP_TYPE_HWRM_ASYNC_EVENT 0x2eUL +#define ASYNC_EVENT_CMPL_PPS_TIMESTAMP_TYPE_LAST ASYNC_EVENT_CMPL_PPS_TIMESTAMP_TYPE_HWRM_ASYNC_EVENT +__le16 event_id; +#define ASYNC_EVENT_CMPL_PPS_TIMESTAMP_EVENT_ID_PPS_TIMESTAMP 0x44UL +#define ASYNC_EVENT_CMPL_PPS_TIMESTAMP_EVENT_ID_LAST ASYNC_EVENT_CMPL_PPS_TIMESTAMP_EVENT_ID_PPS_TIMESTAMP +__le32 event_data2; +#define ASYNC_EVENT_CMPL_PPS_TIMESTAMP_EVENT_DATA2_EVENT_TYPE 0x1UL +#define ASYNC_EVENT_CMPL_PPS_TIMESTAMP_EVENT_DATA2_EVENT_TYPE_INTERNAL 0x0UL +#define ASYNC_EVENT_CMPL_PPS_TIMESTAMP_EVENT_DATA2_EVENT_TYPE_EXTERNAL 0x1UL +#define ASYNC_EVENT_CMPL_PPS_TIMESTAMP_EVENT_DATA2_EVENT_TYPE_LAST ASYNC_EVENT_CMPL_PPS_TIMESTAMP_EVENT_DATA2_EVENT_TYPE_EXTERNAL +#define ASYNC_EVENT_CMPL_PPS_TIMESTAMP_EVENT_DATA2_PIN_NUMBER_MASK 0xeUL +#define ASYNC_EVENT_CMPL_PPS_TIMESTAMP_EVENT_DATA2_PIN_NUMBER_SFT 1 +#define ASYNC_EVENT_CMPL_PPS_TIMESTAMP_EVENT_DATA2_PPS_TIMESTAMP_UPPER_MASK 0xffff0UL +#define ASYNC_EVENT_CMPL_PPS_TIMESTAMP_EVENT_DATA2_PPS_TIMESTAMP_UPPER_SFT 4 +u8 opaque_v; +#define ASYNC_EVENT_CMPL_PPS_TIMESTAMP_V 0x1UL +#define ASYNC_EVENT_CMPL_PPS_TIMESTAMP_OPAQUE_MASK 0xfeUL +#define ASYNC_EVENT_CMPL_PPS_TIMESTAMP_OPAQUE_SFT 1 +u8 timestamp_lo; +__le16 timestamp_hi; +__le32 event_data1; +#define ASYNC_EVENT_CMPL_PPS_TIMESTAMP_EVENT_DATA1_PPS_TIMESTAMP_LOWER_MASK 0xffffffffUL +#define ASYNC_EVENT_CMPL_PPS_TIMESTAMP_EVENT_DATA1_PPS_TIMESTAMP_LOWER_SFT 0 +}; +/* hwrm_func_reset_input (size:192b/24B) */ struct hwrm_func_reset_input {__le16 req_type;
@@ -1320,6 +1397,13 @@ struct hwrm_func_qcaps_output {#define FUNC_QCAPS_RESP_FLAGS_EXT_NVM_OPTION_ACTION_SUPPORTED 0x2000UL#define FUNC_QCAPS_RESP_FLAGS_EXT_BD_METADATA_SUPPORTED 0x4000UL#define FUNC_QCAPS_RESP_FLAGS_EXT_ECHO_REQUEST_SUPPORTED 0x8000UL +#define FUNC_QCAPS_RESP_FLAGS_EXT_NPAR_1_2_SUPPORTED 0x10000UL +#define FUNC_QCAPS_RESP_FLAGS_EXT_PTP_PTM_SUPPORTED 0x20000UL +#define FUNC_QCAPS_RESP_FLAGS_EXT_PTP_PPS_SUPPORTED 0x40000UL +#define FUNC_QCAPS_RESP_FLAGS_EXT_VF_CFG_ASYNC_FOR_PF_SUPPORTED 0x80000UL +#define FUNC_QCAPS_RESP_FLAGS_EXT_PARTITION_BW_SUPPORTED 0x100000UL +#define FUNC_QCAPS_RESP_FLAGS_EXT_DFLT_VLAN_TPID_PCP_SUPPORTED 0x200000UL +#define FUNC_QCAPS_RESP_FLAGS_EXT_KTLS_SUPPORTED 0x400000ULu8 max_schqs;u8 mpc_chnls_cap;#define FUNC_QCAPS_RESP_MPC_CHNLS_CAP_TCE 0x1UL
@@ -1342,7 +1426,7 @@ struct hwrm_func_qcfg_input {u8 unused_0[6 ]; }; -/* hwrm_func_qcfg_output (size:768b/96B) */ +/* hwrm_func_qcfg_output (size:832b/104B) */ struct hwrm_func_qcfg_output {__le16 error_code;__le16 req_type;
@@ -1383,6 +1467,7 @@ struct hwrm_func_qcfg_output {#define FUNC_QCFG_RESP_PORT_PARTITION_TYPE_NPAR1_0 0x2UL#define FUNC_QCFG_RESP_PORT_PARTITION_TYPE_NPAR1_5 0x3UL#define FUNC_QCFG_RESP_PORT_PARTITION_TYPE_NPAR2_0 0x4UL +#define FUNC_QCFG_RESP_PORT_PARTITION_TYPE_NPAR1_2 0x5UL#define FUNC_QCFG_RESP_PORT_PARTITION_TYPE_UNKNOWN 0xffUL#define FUNC_QCFG_RESP_PORT_PARTITION_TYPE_LAST FUNC_QCFG_RESP_PORT_PARTITION_TYPE_UNKNOWNu8 port_pf_cnt;
@@ -1463,11 +1548,34 @@ struct hwrm_func_qcfg_output {#define FUNC_QCFG_RESP_MPC_CHNLS_TE_CFA_ENABLED 0x4UL#define FUNC_QCFG_RESP_MPC_CHNLS_RE_CFA_ENABLED 0x8UL#define FUNC_QCFG_RESP_MPC_CHNLS_PRIMATE_ENABLED 0x10UL -u8 unused_2[6 ]; +u8 unused_2[3 ]; +__le32 partition_min_bw; +#define FUNC_QCFG_RESP_PARTITION_MIN_BW_BW_VALUE_MASK 0xfffffffUL +#define FUNC_QCFG_RESP_PARTITION_MIN_BW_BW_VALUE_SFT 0 +#define FUNC_QCFG_RESP_PARTITION_MIN_BW_SCALE 0x10000000UL +#define FUNC_QCFG_RESP_PARTITION_MIN_BW_SCALE_BITS (0x0UL << 28) +#define FUNC_QCFG_RESP_PARTITION_MIN_BW_SCALE_BYTES (0x1UL << 28) +#define FUNC_QCFG_RESP_PARTITION_MIN_BW_SCALE_LAST FUNC_QCFG_RESP_PARTITION_MIN_BW_SCALE_BYTES +#define FUNC_QCFG_RESP_PARTITION_MIN_BW_BW_VALUE_UNIT_MASK 0xe0000000UL +#define FUNC_QCFG_RESP_PARTITION_MIN_BW_BW_VALUE_UNIT_SFT 29 +#define FUNC_QCFG_RESP_PARTITION_MIN_BW_BW_VALUE_UNIT_PERCENT1_100 (0x1UL << 29) +#define FUNC_QCFG_RESP_PARTITION_MIN_BW_BW_VALUE_UNIT_LAST FUNC_QCFG_RESP_PARTITION_MIN_BW_BW_VALUE_UNIT_PERCENT1_100 +__le32 partition_max_bw; +#define FUNC_QCFG_RESP_PARTITION_MAX_BW_BW_VALUE_MASK 0xfffffffUL +#define FUNC_QCFG_RESP_PARTITION_MAX_BW_BW_VALUE_SFT 0 +#define FUNC_QCFG_RESP_PARTITION_MAX_BW_SCALE 0x10000000UL +#define FUNC_QCFG_RESP_PARTITION_MAX_BW_SCALE_BITS (0x0UL << 28) +#define FUNC_QCFG_RESP_PARTITION_MAX_BW_SCALE_BYTES (0x1UL << 28) +#define FUNC_QCFG_RESP_PARTITION_MAX_BW_SCALE_LAST FUNC_QCFG_RESP_PARTITION_MAX_BW_SCALE_BYTES +#define FUNC_QCFG_RESP_PARTITION_MAX_BW_BW_VALUE_UNIT_MASK 0xe0000000UL +#define FUNC_QCFG_RESP_PARTITION_MAX_BW_BW_VALUE_UNIT_SFT 29 +#define FUNC_QCFG_RESP_PARTITION_MAX_BW_BW_VALUE_UNIT_PERCENT1_100 (0x1UL << 29) +#define FUNC_QCFG_RESP_PARTITION_MAX_BW_BW_VALUE_UNIT_LAST FUNC_QCFG_RESP_PARTITION_MAX_BW_BW_VALUE_UNIT_PERCENT1_100 +u8 unused_3[3 ];u8 valid; }; -/* hwrm_func_cfg_input (size:768b/96B) */ +/* hwrm_func_cfg_input (size:832b/104B) */ struct hwrm_func_cfg_input {__le16 req_type;__le16 cmpl_ring;
@@ -1530,6 +1638,9 @@ struct hwrm_func_cfg_input {#define FUNC_CFG_REQ_ENABLES_HOT_RESET_IF_SUPPORT 0x800000UL#define FUNC_CFG_REQ_ENABLES_SCHQ_ID 0x1000000UL#define FUNC_CFG_REQ_ENABLES_MPC_CHNLS 0x2000000UL +#define FUNC_CFG_REQ_ENABLES_PARTITION_MIN_BW 0x4000000UL +#define FUNC_CFG_REQ_ENABLES_PARTITION_MAX_BW 0x8000000UL +#define FUNC_CFG_REQ_ENABLES_TPID 0x10000000UL__le16 mtu;__le16 mru;__le16 num_rsscos_ctxs;
@@ -1615,7 +1726,30 @@ struct hwrm_func_cfg_input {#define FUNC_CFG_REQ_MPC_CHNLS_RE_CFA_DISABLE 0x80UL#define FUNC_CFG_REQ_MPC_CHNLS_PRIMATE_ENABLE 0x100UL#define FUNC_CFG_REQ_MPC_CHNLS_PRIMATE_DISABLE 0x200UL -u8 unused_0[4 ]; +__le32 partition_min_bw; +#define FUNC_CFG_REQ_PARTITION_MIN_BW_BW_VALUE_MASK 0xfffffffUL +#define FUNC_CFG_REQ_PARTITION_MIN_BW_BW_VALUE_SFT 0 +#define FUNC_CFG_REQ_PARTITION_MIN_BW_SCALE 0x10000000UL +#define FUNC_CFG_REQ_PARTITION_MIN_BW_SCALE_BITS (0x0UL << 28) +#define FUNC_CFG_REQ_PARTITION_MIN_BW_SCALE_BYTES (0x1UL << 28) +#define FUNC_CFG_REQ_PARTITION_MIN_BW_SCALE_LAST FUNC_CFG_REQ_PARTITION_MIN_BW_SCALE_BYTES +#define FUNC_CFG_REQ_PARTITION_MIN_BW_BW_VALUE_UNIT_MASK 0xe0000000UL +#define FUNC_CFG_REQ_PARTITION_MIN_BW_BW_VALUE_UNIT_SFT 29 +#define FUNC_CFG_REQ_PARTITION_MIN_BW_BW_VALUE_UNIT_PERCENT1_100 (0x1UL << 29) +#define FUNC_CFG_REQ_PARTITION_MIN_BW_BW_VALUE_UNIT_LAST FUNC_CFG_REQ_PARTITION_MIN_BW_BW_VALUE_UNIT_PERCENT1_100 +__le32 partition_max_bw; +#define FUNC_CFG_REQ_PARTITION_MAX_BW_BW_VALUE_MASK 0xfffffffUL +#define FUNC_CFG_REQ_PARTITION_MAX_BW_BW_VALUE_SFT 0 +#define FUNC_CFG_REQ_PARTITION_MAX_BW_SCALE 0x10000000UL +#define FUNC_CFG_REQ_PARTITION_MAX_BW_SCALE_BITS (0x0UL << 28) +#define FUNC_CFG_REQ_PARTITION_MAX_BW_SCALE_BYTES (0x1UL << 28) +#define FUNC_CFG_REQ_PARTITION_MAX_BW_SCALE_LAST FUNC_CFG_REQ_PARTITION_MAX_BW_SCALE_BYTES +#define FUNC_CFG_REQ_PARTITION_MAX_BW_BW_VALUE_UNIT_MASK 0xe0000000UL +#define FUNC_CFG_REQ_PARTITION_MAX_BW_BW_VALUE_UNIT_SFT 29 +#define FUNC_CFG_REQ_PARTITION_MAX_BW_BW_VALUE_UNIT_PERCENT1_100 (0x1UL << 29) +#define FUNC_CFG_REQ_PARTITION_MAX_BW_BW_VALUE_UNIT_LAST FUNC_CFG_REQ_PARTITION_MAX_BW_BW_VALUE_UNIT_PERCENT1_100 +__be16 tpid; +u8 unused_0[2 ]; };/* hwrm_func_cfg_output (size:128b/16B) */
@@ -2047,7 +2181,7 @@ struct hwrm_func_backing_store_qcaps_input {__le64 resp_addr; }; -/* hwrm_func_backing_store_qcaps_output (size:704b/88B) */ +/* hwrm_func_backing_store_qcaps_output (size:832b/104B) */ struct hwrm_func_backing_store_qcaps_output {__le16 error_code;__le16 req_type;
@@ -2085,6 +2219,8 @@ struct hwrm_func_backing_store_qcaps_output {#define FUNC_BACKING_STORE_QCAPS_RESP_CTX_INIT_MASK_VNIC 0x8UL#define FUNC_BACKING_STORE_QCAPS_RESP_CTX_INIT_MASK_STAT 0x10UL#define FUNC_BACKING_STORE_QCAPS_RESP_CTX_INIT_MASK_MRAV 0x20UL +#define FUNC_BACKING_STORE_QCAPS_RESP_CTX_INIT_MASK_TKC 0x40UL +#define FUNC_BACKING_STORE_QCAPS_RESP_CTX_INIT_MASK_RKC 0x80ULu8 qp_init_offset;u8 srq_init_offset;u8 cq_init_offset;
@@ -2093,7 +2229,13 @@ struct hwrm_func_backing_store_qcaps_output {u8 stat_init_offset;u8 mrav_init_offset;u8 tqm_fp_rings_count_ext; -u8 rsvd[5 ]; +u8 tkc_init_offset; +u8 rkc_init_offset; +__le16 tkc_entry_size; +__le16 rkc_entry_size; +__le32 tkc_max_entries; +__le32 rkc_max_entries; +u8 rsvd[7 ];u8 valid; };
@@ -2120,7 +2262,7 @@ struct tqm_fp_ring_cfg {__le64 tqm_ring_page_dir; }; -/* hwrm_func_backing_store_cfg_input (size:2432b/304B) */ +/* hwrm_func_backing_store_cfg_input (size:2688b/336B) */ struct hwrm_func_backing_store_cfg_input {__le16 req_type;__le16 cmpl_ring;
@@ -2150,6 +2292,8 @@ struct hwrm_func_backing_store_cfg_input {#define FUNC_BACKING_STORE_CFG_REQ_ENABLES_TQM_RING8 0x10000UL#define FUNC_BACKING_STORE_CFG_REQ_ENABLES_TQM_RING9 0x20000UL#define FUNC_BACKING_STORE_CFG_REQ_ENABLES_TQM_RING10 0x40000UL +#define FUNC_BACKING_STORE_CFG_REQ_ENABLES_TKC 0x80000UL +#define FUNC_BACKING_STORE_CFG_REQ_ENABLES_RKC 0x100000ULu8 qpc_pg_size_qpc_lvl;#define FUNC_BACKING_STORE_CFG_REQ_QPC_LVL_MASK 0xfUL#define FUNC_BACKING_STORE_CFG_REQ_QPC_LVL_SFT 0
@@ -2508,6 +2652,45 @@ struct hwrm_func_backing_store_cfg_input {u8 ring10_unused[3 ];__le32 tqm_ring10_num_entries;__le64 tqm_ring10_page_dir; +__le32 tkc_num_entries; +__le32 rkc_num_entries; +__le64 tkc_page_dir; +__le64 rkc_page_dir; +__le16 tkc_entry_size; +__le16 rkc_entry_size; +u8 tkc_pg_size_tkc_lvl; +#define FUNC_BACKING_STORE_CFG_REQ_TKC_LVL_MASK 0xfUL +#define FUNC_BACKING_STORE_CFG_REQ_TKC_LVL_SFT 0 +#define FUNC_BACKING_STORE_CFG_REQ_TKC_LVL_LVL_0 0x0UL +#define FUNC_BACKING_STORE_CFG_REQ_TKC_LVL_LVL_1 0x1UL +#define FUNC_BACKING_STORE_CFG_REQ_TKC_LVL_LVL_2 0x2UL +#define FUNC_BACKING_STORE_CFG_REQ_TKC_LVL_LAST FUNC_BACKING_STORE_CFG_REQ_TKC_LVL_LVL_2 +#define FUNC_BACKING_STORE_CFG_REQ_TKC_PG_SIZE_MASK 0xf0UL +#define FUNC_BACKING_STORE_CFG_REQ_TKC_PG_SIZE_SFT 4 +#define FUNC_BACKING_STORE_CFG_REQ_TKC_PG_SIZE_PG_4K (0x0UL << 4) +#define FUNC_BACKING_STORE_CFG_REQ_TKC_PG_SIZE_PG_8K (0x1UL << 4) +#define FUNC_BACKING_STORE_CFG_REQ_TKC_PG_SIZE_PG_64K (0x2UL << 4) +#define FUNC_BACKING_STORE_CFG_REQ_TKC_PG_SIZE_PG_2M (0x3UL << 4) +#define FUNC_BACKING_STORE_CFG_REQ_TKC_PG_SIZE_PG_8M (0x4UL << 4) +#define FUNC_BACKING_STORE_CFG_REQ_TKC_PG_SIZE_PG_1G (0x5UL << 4) +#define FUNC_BACKING_STORE_CFG_REQ_TKC_PG_SIZE_LAST FUNC_BACKING_STORE_CFG_REQ_TKC_PG_SIZE_PG_1G +u8 rkc_pg_size_tkc_lvl; +#define FUNC_BACKING_STORE_CFG_REQ_RKC_LVL_MASK 0xfUL +#define FUNC_BACKING_STORE_CFG_REQ_RKC_LVL_SFT 0 +#define FUNC_BACKING_STORE_CFG_REQ_RKC_LVL_LVL_0 0x0UL +#define FUNC_BACKING_STORE_CFG_REQ_RKC_LVL_LVL_1 0x1UL +#define FUNC_BACKING_STORE_CFG_REQ_RKC_LVL_LVL_2 0x2UL +#define FUNC_BACKING_STORE_CFG_REQ_RKC_LVL_LAST FUNC_BACKING_STORE_CFG_REQ_RKC_LVL_LVL_2 +#define FUNC_BACKING_STORE_CFG_REQ_RKC_PG_SIZE_MASK 0xf0UL +#define FUNC_BACKING_STORE_CFG_REQ_RKC_PG_SIZE_SFT 4 +#define FUNC_BACKING_STORE_CFG_REQ_RKC_PG_SIZE_PG_4K (0x0UL << 4) +#define FUNC_BACKING_STORE_CFG_REQ_RKC_PG_SIZE_PG_8K (0x1UL << 4) +#define FUNC_BACKING_STORE_CFG_REQ_RKC_PG_SIZE_PG_64K (0x2UL << 4) +#define FUNC_BACKING_STORE_CFG_REQ_RKC_PG_SIZE_PG_2M (0x3UL << 4) +#define FUNC_BACKING_STORE_CFG_REQ_RKC_PG_SIZE_PG_8M (0x4UL << 4) +#define FUNC_BACKING_STORE_CFG_REQ_RKC_PG_SIZE_PG_1G (0x5UL << 4) +#define FUNC_BACKING_STORE_CFG_REQ_RKC_PG_SIZE_LAST FUNC_BACKING_STORE_CFG_REQ_RKC_PG_SIZE_PG_1G +u8 rsvd[2 ]; };/* hwrm_func_backing_store_cfg_output (size:128b/16B) */
@@ -2634,6 +2817,212 @@ struct hwrm_func_echo_response_output {u8 valid; }; +/* hwrm_func_ptp_pin_qcfg_input (size:192b/24B) */ +struct hwrm_func_ptp_pin_qcfg_input { +__le16 req_type; +__le16 cmpl_ring; +__le16 seq_id; +__le16 target_id; +__le64 resp_addr; +u8 unused_0[8 ]; +}; + +/* hwrm_func_ptp_pin_qcfg_output (size:128b/16B) */ +struct hwrm_func_ptp_pin_qcfg_output { +__le16 error_code; +__le16 req_type; +__le16 seq_id; +__le16 resp_len; +u8 num_pins; +u8 state; +#define FUNC_PTP_PIN_QCFG_RESP_STATE_PIN0_ENABLED 0x1UL +#define FUNC_PTP_PIN_QCFG_RESP_STATE_PIN1_ENABLED 0x2UL +#define FUNC_PTP_PIN_QCFG_RESP_STATE_PIN2_ENABLED 0x4UL +#define FUNC_PTP_PIN_QCFG_RESP_STATE_PIN3_ENABLED 0x8UL +u8 pin0_usage; +#define FUNC_PTP_PIN_QCFG_RESP_PIN0_USAGE_NONE 0x0UL +#define FUNC_PTP_PIN_QCFG_RESP_PIN0_USAGE_PPS_IN 0x1UL +#define FUNC_PTP_PIN_QCFG_RESP_PIN0_USAGE_PPS_OUT 0x2UL +#define FUNC_PTP_PIN_QCFG_RESP_PIN0_USAGE_SYNC_IN 0x3UL +#define FUNC_PTP_PIN_QCFG_RESP_PIN0_USAGE_SYNC_OUT 0x4UL +#define FUNC_PTP_PIN_QCFG_RESP_PIN0_USAGE_LAST FUNC_PTP_PIN_QCFG_RESP_PIN0_USAGE_SYNC_OUT +u8 pin1_usage; +#define FUNC_PTP_PIN_QCFG_RESP_PIN1_USAGE_NONE 0x0UL +#define FUNC_PTP_PIN_QCFG_RESP_PIN1_USAGE_PPS_IN 0x1UL +#define FUNC_PTP_PIN_QCFG_RESP_PIN1_USAGE_PPS_OUT 0x2UL +#define FUNC_PTP_PIN_QCFG_RESP_PIN1_USAGE_SYNC_IN 0x3UL +#define FUNC_PTP_PIN_QCFG_RESP_PIN1_USAGE_SYNC_OUT 0x4UL +#define FUNC_PTP_PIN_QCFG_RESP_PIN1_USAGE_LAST FUNC_PTP_PIN_QCFG_RESP_PIN1_USAGE_SYNC_OUT +u8 pin2_usage; +#define FUNC_PTP_PIN_QCFG_RESP_PIN2_USAGE_NONE 0x0UL +#define FUNC_PTP_PIN_QCFG_RESP_PIN2_USAGE_PPS_IN 0x1UL +#define FUNC_PTP_PIN_QCFG_RESP_PIN2_USAGE_PPS_OUT 0x2UL +#define FUNC_PTP_PIN_QCFG_RESP_PIN2_USAGE_SYNC_IN 0x3UL +#define FUNC_PTP_PIN_QCFG_RESP_PIN2_USAGE_SYNC_OUT 0x4UL +#define FUNC_PTP_PIN_QCFG_RESP_PIN2_USAGE_LAST FUNC_PTP_PIN_QCFG_RESP_PIN2_USAGE_SYNC_OUT +u8 pin3_usage; +#define FUNC_PTP_PIN_QCFG_RESP_PIN3_USAGE_NONE 0x0UL +#define FUNC_PTP_PIN_QCFG_RESP_PIN3_USAGE_PPS_IN 0x1UL +#define FUNC_PTP_PIN_QCFG_RESP_PIN3_USAGE_PPS_OUT 0x2UL +#define FUNC_PTP_PIN_QCFG_RESP_PIN3_USAGE_SYNC_IN 0x3UL +#define FUNC_PTP_PIN_QCFG_RESP_PIN3_USAGE_SYNC_OUT 0x4UL +#define FUNC_PTP_PIN_QCFG_RESP_PIN3_USAGE_LAST FUNC_PTP_PIN_QCFG_RESP_PIN3_USAGE_SYNC_OUT +u8 unused_0; +u8 valid; +}; + +/* hwrm_func_ptp_pin_cfg_input (size:256b/32B) */ +struct hwrm_func_ptp_pin_cfg_input { +__le16 req_type; +__le16 cmpl_ring; +__le16 seq_id; +__le16 target_id; +__le64 resp_addr; +__le32 enables; +#define FUNC_PTP_PIN_CFG_REQ_ENABLES_PIN0_STATE 0x1UL +#define FUNC_PTP_PIN_CFG_REQ_ENABLES_PIN0_USAGE 0x2UL +#define FUNC_PTP_PIN_CFG_REQ_ENABLES_PIN1_STATE 0x4UL +#define FUNC_PTP_PIN_CFG_REQ_ENABLES_PIN1_USAGE 0x8UL +#define FUNC_PTP_PIN_CFG_REQ_ENABLES_PIN2_STATE 0x10UL +#define FUNC_PTP_PIN_CFG_REQ_ENABLES_PIN2_USAGE 0x20UL +#define FUNC_PTP_PIN_CFG_REQ_ENABLES_PIN3_STATE 0x40UL +#define FUNC_PTP_PIN_CFG_REQ_ENABLES_PIN3_USAGE 0x80UL +u8 pin0_state; +#define FUNC_PTP_PIN_CFG_REQ_PIN0_STATE_DISABLED 0x0UL +#define FUNC_PTP_PIN_CFG_REQ_PIN0_STATE_ENABLED 0x1UL +#define FUNC_PTP_PIN_CFG_REQ_PIN0_STATE_LAST FUNC_PTP_PIN_CFG_REQ_PIN0_STATE_ENABLED +u8 pin0_usage; +#define FUNC_PTP_PIN_CFG_REQ_PIN0_USAGE_NONE 0x0UL +#define FUNC_PTP_PIN_CFG_REQ_PIN0_USAGE_PPS_IN 0x1UL +#define FUNC_PTP_PIN_CFG_REQ_PIN0_USAGE_PPS_OUT 0x2UL +#define FUNC_PTP_PIN_CFG_REQ_PIN0_USAGE_SYNC_IN 0x3UL +#define FUNC_PTP_PIN_CFG_REQ_PIN0_USAGE_SYNC_OUT 0x4UL +#define FUNC_PTP_PIN_CFG_REQ_PIN0_USAGE_LAST FUNC_PTP_PIN_CFG_REQ_PIN0_USAGE_SYNC_OUT +u8 pin1_state; +#define FUNC_PTP_PIN_CFG_REQ_PIN1_STATE_DISABLED 0x0UL +#define FUNC_PTP_PIN_CFG_REQ_PIN1_STATE_ENABLED 0x1UL +#define FUNC_PTP_PIN_CFG_REQ_PIN1_STATE_LAST FUNC_PTP_PIN_CFG_REQ_PIN1_STATE_ENABLED +u8 pin1_usage; +#define FUNC_PTP_PIN_CFG_REQ_PIN1_USAGE_NONE 0x0UL +#define FUNC_PTP_PIN_CFG_REQ_PIN1_USAGE_PPS_IN 0x1UL +#define FUNC_PTP_PIN_CFG_REQ_PIN1_USAGE_PPS_OUT 0x2UL +#define FUNC_PTP_PIN_CFG_REQ_PIN1_USAGE_SYNC_IN 0x3UL +#define FUNC_PTP_PIN_CFG_REQ_PIN1_USAGE_SYNC_OUT 0x4UL +#define FUNC_PTP_PIN_CFG_REQ_PIN1_USAGE_LAST FUNC_PTP_PIN_CFG_REQ_PIN1_USAGE_SYNC_OUT +u8 pin2_state; +#define FUNC_PTP_PIN_CFG_REQ_PIN2_STATE_DISABLED 0x0UL +#define FUNC_PTP_PIN_CFG_REQ_PIN2_STATE_ENABLED 0x1UL +#define FUNC_PTP_PIN_CFG_REQ_PIN2_STATE_LAST FUNC_PTP_PIN_CFG_REQ_PIN2_STATE_ENABLED +u8 pin2_usage; +#define FUNC_PTP_PIN_CFG_REQ_PIN2_USAGE_NONE 0x0UL +#define FUNC_PTP_PIN_CFG_REQ_PIN2_USAGE_PPS_IN 0x1UL +#define FUNC_PTP_PIN_CFG_REQ_PIN2_USAGE_PPS_OUT 0x2UL +#define FUNC_PTP_PIN_CFG_REQ_PIN2_USAGE_SYNC_IN 0x3UL +#define FUNC_PTP_PIN_CFG_REQ_PIN2_USAGE_SYNC_OUT 0x4UL +#define FUNC_PTP_PIN_CFG_REQ_PIN2_USAGE_LAST FUNC_PTP_PIN_CFG_REQ_PIN2_USAGE_SYNC_OUT +u8 pin3_state; +#define FUNC_PTP_PIN_CFG_REQ_PIN3_STATE_DISABLED 0x0UL +#define FUNC_PTP_PIN_CFG_REQ_PIN3_STATE_ENABLED 0x1UL +#define FUNC_PTP_PIN_CFG_REQ_PIN3_STATE_LAST FUNC_PTP_PIN_CFG_REQ_PIN3_STATE_ENABLED +u8 pin3_usage; +#define FUNC_PTP_PIN_CFG_REQ_PIN3_USAGE_NONE 0x0UL +#define FUNC_PTP_PIN_CFG_REQ_PIN3_USAGE_PPS_IN 0x1UL +#define FUNC_PTP_PIN_CFG_REQ_PIN3_USAGE_PPS_OUT 0x2UL +#define FUNC_PTP_PIN_CFG_REQ_PIN3_USAGE_SYNC_IN 0x3UL +#define FUNC_PTP_PIN_CFG_REQ_PIN3_USAGE_SYNC_OUT 0x4UL +#define FUNC_PTP_PIN_CFG_REQ_PIN3_USAGE_LAST FUNC_PTP_PIN_CFG_REQ_PIN3_USAGE_SYNC_OUT +u8 unused_0[4 ]; +}; + +/* hwrm_func_ptp_pin_cfg_output (size:128b/16B) */ +struct hwrm_func_ptp_pin_cfg_output { +__le16 error_code; +__le16 req_type; +__le16 seq_id; +__le16 resp_len; +u8 unused_0[7 ]; +u8 valid; +}; + +/* hwrm_func_ptp_cfg_input (size:320b/40B) */ +struct hwrm_func_ptp_cfg_input { +__le16 req_type; +__le16 cmpl_ring; +__le16 seq_id; +__le16 target_id; +__le64 resp_addr; +__le16 enables; +#define FUNC_PTP_CFG_REQ_ENABLES_PTP_PPS_EVENT 0x1UL +#define FUNC_PTP_CFG_REQ_ENABLES_PTP_FREQ_ADJ_DLL_SOURCE 0x2UL +#define FUNC_PTP_CFG_REQ_ENABLES_PTP_FREQ_ADJ_DLL_PHASE 0x4UL +#define FUNC_PTP_CFG_REQ_ENABLES_PTP_FREQ_ADJ_EXT_PERIOD 0x8UL +#define FUNC_PTP_CFG_REQ_ENABLES_PTP_FREQ_ADJ_EXT_UP 0x10UL +#define FUNC_PTP_CFG_REQ_ENABLES_PTP_FREQ_ADJ_EXT_PHASE 0x20UL +u8 ptp_pps_event; +#define FUNC_PTP_CFG_REQ_PTP_PPS_EVENT_INTERNAL 0x1UL +#define FUNC_PTP_CFG_REQ_PTP_PPS_EVENT_EXTERNAL 0x2UL +u8 ptp_freq_adj_dll_source; +#define FUNC_PTP_CFG_REQ_PTP_FREQ_ADJ_DLL_SOURCE_NONE 0x0UL +#define FUNC_PTP_CFG_REQ_PTP_FREQ_ADJ_DLL_SOURCE_TSIO_0 0x1UL +#define FUNC_PTP_CFG_REQ_PTP_FREQ_ADJ_DLL_SOURCE_TSIO_1 0x2UL +#define FUNC_PTP_CFG_REQ_PTP_FREQ_ADJ_DLL_SOURCE_TSIO_2 0x3UL +#define FUNC_PTP_CFG_REQ_PTP_FREQ_ADJ_DLL_SOURCE_TSIO_3 0x4UL +#define FUNC_PTP_CFG_REQ_PTP_FREQ_ADJ_DLL_SOURCE_PORT_0 0x5UL +#define FUNC_PTP_CFG_REQ_PTP_FREQ_ADJ_DLL_SOURCE_PORT_1 0x6UL +#define FUNC_PTP_CFG_REQ_PTP_FREQ_ADJ_DLL_SOURCE_PORT_2 0x7UL +#define FUNC_PTP_CFG_REQ_PTP_FREQ_ADJ_DLL_SOURCE_PORT_3 0x8UL +#define FUNC_PTP_CFG_REQ_PTP_FREQ_ADJ_DLL_SOURCE_INVALID 0xffUL +#define FUNC_PTP_CFG_REQ_PTP_FREQ_ADJ_DLL_SOURCE_LAST FUNC_PTP_CFG_REQ_PTP_FREQ_ADJ_DLL_SOURCE_INVALID +u8 ptp_freq_adj_dll_phase; +#define FUNC_PTP_CFG_REQ_PTP_FREQ_ADJ_DLL_PHASE_NONE 0x0UL +#define FUNC_PTP_CFG_REQ_PTP_FREQ_ADJ_DLL_PHASE_4K 0x1UL +#define FUNC_PTP_CFG_REQ_PTP_FREQ_ADJ_DLL_PHASE_8K 0x2UL +#define FUNC_PTP_CFG_REQ_PTP_FREQ_ADJ_DLL_PHASE_10M 0x3UL +#define FUNC_PTP_CFG_REQ_PTP_FREQ_ADJ_DLL_PHASE_LAST FUNC_PTP_CFG_REQ_PTP_FREQ_ADJ_DLL_PHASE_10M +u8 unused_0[3 ]; +__le32 ptp_freq_adj_ext_period; +__le32 ptp_freq_adj_ext_up; +__le32 ptp_freq_adj_ext_phase_lower; +__le32 ptp_freq_adj_ext_phase_upper; +}; + +/* hwrm_func_ptp_cfg_output (size:128b/16B) */ +struct hwrm_func_ptp_cfg_output { +__le16 error_code; +__le16 req_type; +__le16 seq_id; +__le16 resp_len; +u8 unused_0[7 ]; +u8 valid; +}; + +/* hwrm_func_ptp_ts_query_input (size:192b/24B) */ +struct hwrm_func_ptp_ts_query_input { +__le16 req_type; +__le16 cmpl_ring; +__le16 seq_id; +__le16 target_id; +__le64 resp_addr; +__le32 flags; +#define FUNC_PTP_TS_QUERY_REQ_FLAGS_PPS_TIME 0x1UL +#define FUNC_PTP_TS_QUERY_REQ_FLAGS_PTM_TIME 0x2UL +u8 unused_0[4 ]; +}; + +/* hwrm_func_ptp_ts_query_output (size:320b/40B) */ +struct hwrm_func_ptp_ts_query_output { +__le16 error_code; +__le16 req_type; +__le16 seq_id; +__le16 resp_len; +__le64 pps_event_ts; +__le64 ptm_res_local_ts; +__le64 ptm_pmstr_ts; +__le32 ptm_mstr_prop_dly; +u8 unused_0[3 ]; +u8 valid; +}; +/* hwrm_func_drv_if_change_input (size:192b/24B) */ struct hwrm_func_drv_if_change_input {__le16 req_type;
@@ -3647,7 +4036,7 @@ struct hwrm_port_lpbk_clr_stats_output {u8 valid; }; -/* hwrm_port_ts_query_input (size:192b/24B) */ +/* hwrm_port_ts_query_input (size:256b/32B) */ struct hwrm_port_ts_query_input {__le16 req_type;__le16 cmpl_ring;
@@ -3662,6 +4051,11 @@ struct hwrm_port_ts_query_input {#define PORT_TS_QUERY_REQ_FLAGS_CURRENT_TIME 0x2UL__le16 port_id;u8 unused_0[2 ]; +__le16 enables; +#define PORT_TS_QUERY_REQ_ENABLES_TS_REQ_TIMEOUT 0x1UL +#define PORT_TS_QUERY_REQ_ENABLES_PTP_SEQ_ID 0x2UL +__le16 ts_req_timeout; +__le32 ptp_seq_id; };/* hwrm_port_ts_query_output (size:192b/24B) */
@@ -4215,7 +4609,8 @@ struct hwrm_queue_qportcfg_output {u8 max_configurable_lossless_queues;u8 queue_cfg_allowed;u8 queue_cfg_info; -#define QUEUE_QPORTCFG_RESP_QUEUE_CFG_INFO_ASYM_CFG 0x1UL +#define QUEUE_QPORTCFG_RESP_QUEUE_CFG_INFO_ASYM_CFG 0x1UL +#define QUEUE_QPORTCFG_RESP_QUEUE_CFG_INFO_USE_PROFILE_TYPE 0x2ULu8 queue_pfcenable_cfg_allowed;u8 queue_pri2cos_cfg_allowed;u8 queue_cos2bw_cfg_allowed;
@@ -7224,6 +7619,7 @@ struct hwrm_cfa_adv_flow_mgnt_qcaps_output {#define CFA_ADV_FLOW_MGNT_QCAPS_RESP_FLAGS_NTUPLE_FLOW_RX_ETHERTYPE_IP_SUPPORTED 0x4000UL#define CFA_ADV_FLOW_MGNT_QCAPS_RESP_FLAGS_TRUFLOW_CAPABLE 0x8000UL#define CFA_ADV_FLOW_MGNT_QCAPS_RESP_FLAGS_L2_FILTER_TRAFFIC_TYPE_L2_ROCE_SUPPORTED 0x10000UL +#define CFA_ADV_FLOW_MGNT_QCAPS_RESP_FLAGS_LAG_SUPPORTED 0x20000ULu8 unused_0[3 ];u8 valid; };
@@ -7914,11 +8310,14 @@ struct hwrm_temp_monitor_query_output {u8 phy_temp;u8 om_temp;u8 flags; -#define TEMP_MONITOR_QUERY_RESP_FLAGS_TEMP_NOT_AVAILABLE 0x1UL -#define TEMP_MONITOR_QUERY_RESP_FLAGS_PHY_TEMP_NOT_AVAILABLE 0x2UL -#define TEMP_MONITOR_QUERY_RESP_FLAGS_OM_NOT_PRESENT 0x4UL -#define TEMP_MONITOR_QUERY_RESP_FLAGS_OM_TEMP_NOT_AVAILABLE 0x8UL -u8 unused_0[3 ]; +#define TEMP_MONITOR_QUERY_RESP_FLAGS_TEMP_NOT_AVAILABLE 0x1UL +#define TEMP_MONITOR_QUERY_RESP_FLAGS_PHY_TEMP_NOT_AVAILABLE 0x2UL +#define TEMP_MONITOR_QUERY_RESP_FLAGS_OM_NOT_PRESENT 0x4UL +#define TEMP_MONITOR_QUERY_RESP_FLAGS_OM_TEMP_NOT_AVAILABLE 0x8UL +#define TEMP_MONITOR_QUERY_RESP_FLAGS_EXT_TEMP_FIELDS_AVAILABLE 0x10UL +u8 temp2; +u8 phy_temp2; +u8 om_temp2;u8 valid; };
@@ -8876,6 +9275,7 @@ struct fw_status_reg {#define FW_STATUS_REG_CRASHDUMP_COMPLETE 0x80000UL#define FW_STATUS_REG_SHUTDOWN 0x100000UL#define FW_STATUS_REG_CRASHED_NO_MASTER 0x200000UL +#define FW_STATUS_REG_RECOVERING 0x400000UL };/* hcomm_status (size:64b/8B) */
Signature · 1 line
2.18.1
Michael Chan
maintainerPATCH 2/7 bnxt_en: Get PTP hardware capability from firmware.
In reply to Michael ChanStore PTP hardware info in a structure if hardware and firmware support PTP.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 46 +++++++++++++++++++ drivers/net/ethernet/broadcom/bnxt/bnxt.h | 2 + drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h | 44 ++++++++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h
drivers/net/ethernet/broadcom/bnxt/bnxt.c +46 -0
@@ -49,6 +49,8 @@#include <linux/log2.h> #include <linux/aer.h> #include <linux/bitmap.h> +#include <linux/ptp_clock_kernel.h> +#include <linux/timecounter.h> #include <linux/cpu_rmap.h> #include <linux/cpumask.h> #include <net/pkt_cls.h>
@@ -63,6 +65,7 @@#include "bnxt_ethtool.h" #include "bnxt_dcb.h" #include "bnxt_xdp.h" +#include "bnxt_ptp.h" #include "bnxt_vfr.h" #include "bnxt_tc.h" #include "bnxt_devlink.h"
@@ -7391,6 +7394,45 @@ int bnxt_hwrm_func_resc_qcaps(struct bnxt *bp, bool all)return rc; } +/* bp->hwrm_cmd_lock already held. */ +static int __bnxt_hwrm_ptp_qcfg (struct bnxt *bp) +{ +struct hwrm_port_mac_ptp_qcfg_output *resp = bp->hwrm_cmd_resp_addr; +struct hwrm_port_mac_ptp_qcfg_input req = {0 }; +struct bnxt_ptp_cfg *ptp = bp->ptp_cfg; +int rc; + +if (bp->hwrm_spec_code <0x10801 ) { + rc = -ENODEV ; + goto no_ptp; + } + + req.port_id =cpu_to_le16 (bp->pf.port_id); +bnxt_hwrm_cmd_hdr_init (bp, &req,HWRM_PORT_MAC_PTP_QCFG ,-1 ,-1 ); + rc =_hwrm_send_message (bp, &req,sizeof (req),HWRM_CMD_TIMEOUT ); +if (rc) + goto no_ptp; + +if (!(resp->flags &PORT_MAC_PTP_QCFG_RESP_FLAGS_HWRM_ACCESS )) { + rc = -ENODEV ; + goto no_ptp; + } +if (!ptp) { + ptp =kzalloc (sizeof (*ptp),GFP_KERNEL ); +if (!ptp) +return -ENOMEM ; + ptp->bp = bp; + bp->ptp_cfg = ptp; + } +return 0 ; + +no_ptp: +kfree (ptp); + bp->ptp_cfg =NULL ; +return rc; + +} +static int __bnxt_hwrm_func_qcaps (struct bnxt *bp) {int rc =0 ;
@@ -7462,6 +7504,8 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp) bp->flags &= ~BNXT_FLAG_WOL_CAP ;if (flags &FUNC_QCAPS_RESP_FLAGS_WOL_MAGICPKT_SUPPORTED ) bp->flags |=BNXT_FLAG_WOL_CAP ; +if (flags &FUNC_QCAPS_RESP_FLAGS_PTP_SUPPORTED ) +__bnxt_hwrm_ptp_qcfg (bp); }else {#ifdef CONFIG_BNXT_SRIOV struct bnxt_vf_info *vf = &bp->vf;
@@ -12566,6 +12610,8 @@ static void bnxt_remove_one(struct pci_dev *pdev)bnxt_dcb_free (bp);kfree (bp->edev); bp->edev =NULL ; +kfree (bp->ptp_cfg); + bp->ptp_cfg =NULL ;kfree (bp->fw_health); bp->fw_health =NULL ;bnxt_cleanup_pci (bp);
drivers/net/ethernet/broadcom/bnxt/bnxt.h +2 -0
@@ -2042,6 +2042,8 @@ struct bnxt {struct bpf_prog *xdp_prog; +struct bnxt_ptp_cfg *ptp_cfg; +/* devlink interface and vf-rep structs */ struct devlink *dl;struct devlink_port dl_port;
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h new file +44 -0
44 lines not on this page · raw message
Signature · 1 line
2.18.1
Michael Chan
maintainerPATCH 3/7 bnxt_en: Add PTP clock APIs, ioctls, and ethtool methods.
In reply to Michael ChanAdd the clock APIs to set/get/adjust the hw clock, and the related ioctls and ethtool methods.
--- drivers/net/ethernet/broadcom/Kconfig | 1 + drivers/net/ethernet/broadcom/bnxt/Makefile | 2 +- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 6 + .../net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 34 ++ drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c | 291 ++++++++++++++++++ drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h | 13 + 6 files changed, 346 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c
drivers/net/ethernet/broadcom/Kconfig +1 -0
@@ -206,6 +206,7 @@ config SYSTEMPORT config BNXT tristate "Broadcom NetXtreme-C/E support" depends on PCI + imply PTP_1588_CLOCK select FW_LOADER select LIBCRC32C select NET_DEVLINK
drivers/net/ethernet/broadcom/bnxt/Makefile +1 -1
@@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0-only obj-$(CONFIG_BNXT) += bnxt_en.o -bnxt_en-y := bnxt.o bnxt_sriov.o bnxt_ethtool.o bnxt_dcb.o bnxt_ulp.o bnxt_xdp.o bnxt_vfr.o bnxt_devlink.o bnxt_dim.o +bnxt_en-y := bnxt.o bnxt_sriov.o bnxt_ethtool.o bnxt_dcb.o bnxt_ulp.o bnxt_xdp.o bnxt_ptp.o bnxt_vfr.o bnxt_devlink.o bnxt_dim.o bnxt_en-$(CONFIG_BNXT_FLOWER_OFFLOAD) += bnxt_tc.o bnxt_en-$(CONFIG_DEBUG_FS) += bnxt_debugfs.o
drivers/net/ethernet/broadcom/bnxt/bnxt.c +6 -0
@@ -10379,6 +10379,12 @@ static int bnxt_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)return bnxt_hwrm_port_phy_write (bp, mdio->phy_id, mdio->reg_num, mdio->val_in); +case SIOCSHWTSTAMP : +return bnxt_hwtstamp_set (dev, ifr); + +case SIOCGHWTSTAMP : +return bnxt_hwtstamp_get (dev, ifr); +default :/* do nothing */ break ;
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +34 -0
@@ -19,9 +19,13 @@#include <linux/firmware.h> #include <linux/utsname.h> #include <linux/time.h> +#include <linux/ptp_clock_kernel.h> +#include <linux/net_tstamp.h> +#include <linux/timecounter.h> #include "bnxt_hsi.h" #include "bnxt.h" #include "bnxt_xdp.h" +#include "bnxt_ptp.h" #include "bnxt_ethtool.h" #include "bnxt_nvm_defs.h" /* NVRAM content constant and structure defs */ #include "bnxt_fw_hdr.h" /* Firmware hdr constant and structure defs */
@@ -3926,6 +3930,35 @@ static int bnxt_get_dump_data(struct net_device *dev, struct ethtool_dump *dump,return 0 ; } +static int bnxt_get_ts_info (struct net_device *dev, +struct ethtool_ts_info *info) +{ +struct bnxt *bp =netdev_priv (dev); +struct bnxt_ptp_cfg *ptp; + + ptp = bp->ptp_cfg; + info->so_timestamping =SOF_TIMESTAMPING_TX_SOFTWARE | +SOF_TIMESTAMPING_RX_SOFTWARE | +SOF_TIMESTAMPING_SOFTWARE ; + + info->phc_index =-1 ; +if (!ptp) +return 0 ; + + info->so_timestamping |=SOF_TIMESTAMPING_TX_HARDWARE | +SOF_TIMESTAMPING_RX_HARDWARE | +SOF_TIMESTAMPING_RAW_HARDWARE ; +if (ptp->ptp_clock) + info->phc_index =ptp_clock_index (ptp->ptp_clock); + + info->tx_types = (1 <<HWTSTAMP_TX_OFF ) | (1 <<HWTSTAMP_TX_ON ); + + info->rx_filters = (1 <<HWTSTAMP_FILTER_NONE ) | + (1 <<HWTSTAMP_FILTER_PTP_V2_L2_EVENT ) | + (1 <<HWTSTAMP_FILTER_PTP_V2_L4_EVENT ); +return 0 ; +} +void bnxt_ethtool_init (struct bnxt *bp) {struct hwrm_selftest_qlist_output *resp = bp->hwrm_cmd_resp_addr;
@@ -4172,6 +4205,7 @@ const struct ethtool_ops bnxt_ethtool_ops = { .nway_reset = bnxt_nway_reset, .set_phys_id = bnxt_set_phys_id, .self_test = bnxt_self_test, + .get_ts_info = bnxt_get_ts_info, .reset = bnxt_reset, .set_dump = bnxt_set_dump, .get_dump_flag = bnxt_get_dump_flag,
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c new file +291 -0
291 lines not on this page · raw message
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h +13 -0
@@ -10,6 +10,14 @@ #ifndef BNXT_PTP_H #define BNXT_PTP_H +#define BNXT_MAX_PHC_DRIFT 31000000 +#define BNXT_LO_TIMER_MASK 0x0000ffffffffUL +#define BNXT_HI_TIMER_MASK 0xffff00000000UL + +#define BNXT_PTP_QTS_TIMEOUT 1000 +#define BNXT_PTP_QTS_TX_ENABLES (PORT_TS_QUERY_REQ_ENABLES_PTP_SEQ_ID | \ + PORT_TS_QUERY_REQ_ENABLES_TS_REQ_TIMEOUT) + struct bnxt_ptp_cfg { struct ptp_clock_info ptp_info; struct ptp_clock *ptp_clock;
@@ -41,4 +49,9 @@ struct bnxt_ptp_cfg { u8 tx_tstamp_en:1; int rx_filter; }; + +int bnxt_hwtstamp_set (struct net_device *dev,struct ifreq *ifr); +int bnxt_hwtstamp_get (struct net_device *dev,struct ifreq *ifr); +int bnxt_ptp_init (struct bnxt *bp); +void bnxt_ptp_clear (struct bnxt *bp);#endif
Signature · 1 line
2.18.1
Michael Chan
maintainerPATCH 4/7 bnxt_en: Get the full 48-bit hardware timestamp periodically.
In reply to Michael ChanFrom: Pavan Chebbi <[email protected]>
From the bnxt_timer(), read the 48-bit hardware running clock periodically and store it in ptp->current_time. The previous snapshot of the clock will be stored in ptp->old_time. The old_time snapshot will be used in the next patches to compute the RX packet timestamps.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 9 ++++++ drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1 + drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c | 29 +++++++++++++++++++ drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h | 2 ++ 4 files changed, 41 insertions(+)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +9 -0
@@ -10064,6 +10064,7 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init) } } +bnxt_ptp_start (bp); rc =bnxt_init_nic (bp, irq_re_init);if (rc) {netdev_err (bp->dev,"bnxt_init_nic err: %x\n" , rc);
@@ -11154,6 +11155,11 @@ static void bnxt_timer(struct timer_list *t)bnxt_queue_sp_work (bp); } +if (bp->ptp_cfg && (bp->flags &BNXT_FLAG_CHIP_P5 )) { +set_bit (BNXT_PTP_CURRENT_TIME_EVENT , &bp->sp_event); +bnxt_queue_sp_work (bp); + } +#ifdef CONFIG_RFS_ACCEL if ((bp->flags &BNXT_FLAG_RFS ) && bp->ntp_fltr_count) {set_bit (BNXT_RX_NTP_FLTR_SP_EVENT , &bp->sp_event);
@@ -11558,6 +11564,9 @@ static void bnxt_sp_task(struct work_struct *work)if (test_and_clear_bit (BNXT_RING_COAL_NOW_SP_EVENT , &bp->sp_event))bnxt_chk_missed_irq (bp); +if (test_and_clear_bit (BNXT_PTP_CURRENT_TIME_EVENT , &bp->sp_event)) +bnxt_ptp_get_current_time (bp); +if (test_and_clear_bit (BNXT_FW_ECHO_REQUEST_SP_EVENT , &bp->sp_event))bnxt_fw_echo_reply (bp);
drivers/net/ethernet/broadcom/bnxt/bnxt.h +1 -0
@@ -1957,6 +1957,7 @@ struct bnxt {#define BNXT_FW_RESET_NOTIFY_SP_EVENT 18#define BNXT_FW_EXCEPTION_SP_EVENT 19#define BNXT_LINK_CFG_CHANGE_SP_EVENT 21 +#define BNXT_PTP_CURRENT_TIME_EVENT 22#define BNXT_FW_ECHO_REQUEST_SP_EVENT 23struct delayed_work fw_reset_task;
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c +29 -0
@@ -55,6 +55,17 @@ static int bnxt_hwrm_port_ts_query(struct bnxt *bp, u32 flags, u64 *ts,return rc; } +int bnxt_ptp_get_current_time (struct bnxt *bp) +{ +u32 flags =PORT_TS_QUERY_REQ_FLAGS_CURRENT_TIME ; +struct bnxt_ptp_cfg *ptp = bp->ptp_cfg; + +if (!ptp) +return 0 ; + ptp->old_time = ptp->current_time; +return bnxt_hwrm_port_ts_query (bp, flags, &ptp->current_time,NULL ); +} +static int bnxt_ptp_gettimex (struct ptp_clock_info *ptp_info,struct timespec64 *ts,struct ptp_system_timestamp *sts)
@@ -236,6 +247,24 @@ static u64 bnxt_cc_read(const struct cyclecounter *cc)return ns; } +int bnxt_ptp_start (struct bnxt *bp) +{ +struct bnxt_ptp_cfg *ptp = bp->ptp_cfg; +int rc =0 ; + +if (!ptp) +return 0 ; + +if (bp->flags &BNXT_FLAG_CHIP_P5 ) { +u32 flags =PORT_TS_QUERY_REQ_FLAGS_CURRENT_TIME ; + + rc =bnxt_hwrm_port_ts_query (bp, flags, &ptp->current_time, +NULL ); + ptp->old_time = ptp->current_time; + } +return rc; +} +static const struct ptp_clock_info bnxt_ptp_caps = { .owner =THIS_MODULE , .name ="bnxt clock" ,
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h +2 -0
@@ -50,8 +50,10 @@ struct bnxt_ptp_cfg { int rx_filter; }; +int bnxt_ptp_get_current_time (struct bnxt *bp);int bnxt_hwtstamp_set (struct net_device *dev,struct ifreq *ifr);int bnxt_hwtstamp_get (struct net_device *dev,struct ifreq *ifr); +int bnxt_ptp_start (struct bnxt *bp);int bnxt_ptp_init (struct bnxt *bp);void bnxt_ptp_clear (struct bnxt *bp);#endif
Signature · 1 line
2.18.1
Michael Chan
maintainerPATCH 5/7 bnxt_en: Get the RX packet timestamp.
In reply to Michael ChanFrom: Pavan Chebbi <[email protected]>
If the RX packet is timestamped by the hardware, the RX completion record will contain the lower 32-bit of the timestamp. This needs to be combined with the upper 16-bit of the periodic timestamp that we get from the timer. The previous snapshot in ptp->old_timer is used to make sure that the snapshot is not ahead of the RX timestamp and we adjust for wrap-around if needed.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 19 +++++++++++++++++-- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 3 ++- drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c | 16 ++++++++++++++++ drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h | 1 + 4 files changed, 36 insertions(+), 3 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +17 -2
@@ -1709,9 +1709,9 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,u8 *data_ptr, agg_bufs, cmp_type;dma_addr_t dma_addr;struct sk_buff *skb; +u32 flags, misc;void *data;int rc =0 ; -u32 misc; rxcmp = (struct rx_cmp *) &cpr->cp_desc_ring[CP_RING (cp_cons)][CP_IDX (cp_cons)];
@@ -1809,7 +1809,8 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, goto next_rx_no_len; } - len =le32_to_cpu (rxcmp->rx_cmp_len_flags_type) >>RX_CMP_LEN_SHIFT ; + flags =le32_to_cpu (rxcmp->rx_cmp_len_flags_type); + len = flags >>RX_CMP_LEN_SHIFT ; dma_addr = rx_buf->mapping;if (bnxt_rx_xdp (bp, rxr, cons, data, &data_ptr, &len, event)) {
@@ -1886,6 +1887,20 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, } } +if (unlikely ((flags &RX_CMP_FLAGS_ITYPES_MASK ) == +RX_CMP_FLAGS_ITYPE_PTP_W_TS )) { +if (bp->flags &BNXT_FLAG_CHIP_P5 ) { +u32 cmpl_ts =le32_to_cpu (rxcmp1->rx_cmp_timestamp); +u64 ns, ts; + +if (!bnxt_get_rx_ts_p5 (bp, &ts, cmpl_ts)) { + ns =timecounter_cyc2time (&bp->ptp_cfg->tc, ts); +memset (skb_hwtstamps (skb),0 , +sizeof (*skb_hwtstamps (skb))); +skb_hwtstamps (skb)->hwtstamp =ns_to_ktime (ns); + } + } + }bnxt_deliver_skb (bp, bnapi, skb); rc =1 ;
drivers/net/ethernet/broadcom/bnxt/bnxt.h +2 -1
@@ -159,6 +159,7 @@ struct rx_cmp {#define RX_CMP_FLAGS_RSS_VALID (1 << 10)#define RX_CMP_FLAGS_UNUSED (1 << 11)#define RX_CMP_FLAGS_ITYPES_SHIFT 12 +#define RX_CMP_FLAGS_ITYPES_MASK 0xf000#define RX_CMP_FLAGS_ITYPE_UNKNOWN (0 << 12)#define RX_CMP_FLAGS_ITYPE_IP (1 << 12)#define RX_CMP_FLAGS_ITYPE_TCP (2 << 12)
@@ -240,7 +241,7 @@ struct rx_cmp_ext {#define RX_CMPL_CFA_CODE_MASK (0xffff << 16)#define RX_CMPL_CFA_CODE_SFT 16 -__le32 rx_cmp_unused3; +__le32 rx_cmp_timestamp; };#define RX_CMP_L2_ERRORS \
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c +16 -0
@@ -247,6 +247,22 @@ static u64 bnxt_cc_read(const struct cyclecounter *cc)return ns; } +int bnxt_get_rx_ts_p5 (struct bnxt *bp,u64 *ts,u32 pkt_ts) +{ +struct bnxt_ptp_cfg *ptp = bp->ptp_cfg; +u64 time; + +if (!ptp) +return -ENODEV ; + + time =READ_ONCE (ptp->old_time); + *ts = (time &BNXT_HI_TIMER_MASK ) | pkt_ts; +if (pkt_ts < (time &BNXT_LO_TIMER_MASK )) + *ts +=BNXT_LO_TIMER_MASK +1 ; + +return 0 ; +} +int bnxt_ptp_start (struct bnxt *bp) {struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h +1 -0
@@ -53,6 +53,7 @@ struct bnxt_ptp_cfg {int bnxt_ptp_get_current_time (struct bnxt *bp);int bnxt_hwtstamp_set (struct net_device *dev,struct ifreq *ifr);int bnxt_hwtstamp_get (struct net_device *dev,struct ifreq *ifr); +int bnxt_get_rx_ts_p5 (struct bnxt *bp,u64 *ts,u32 pkt_ts);int bnxt_ptp_start (struct bnxt *bp);int bnxt_ptp_init (struct bnxt *bp);void bnxt_ptp_clear (struct bnxt *bp);
Signature · 1 line
2.18.1
Michael Chan
maintainerPATCH 6/7 bnxt_en: Transmit and retrieve packet timestamps.
In reply to Michael ChanFrom: Pavan Chebbi <[email protected]>
Setup the TXBD to enable TX timestamp if requested. At TX packet DMA completion, if we requested TX timestamp on that packet, we defer to a worqueue to obtain the TX timestamp from the firmware before we free the TX SKB.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 38 ++++++++-- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 2 + drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c | 70 +++++++++++++++++++ drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h | 2 + 4 files changed, 107 insertions(+), 5 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +33 -5
@@ -421,12 +421,25 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev) vlan_tag_flags |=1 <<TX_BD_CFA_META_TPID_SHIFT ; } -if (unlikely (skb->no_fcs)) { - lflags |=cpu_to_le32 (TX_BD_FLAGS_NO_CRC ); - goto normal_tx; +if (unlikely (skb_shinfo (skb)->tx_flags &SKBTX_HW_TSTAMP )) { +struct bnxt_ptp_cfg *ptp = bp->ptp_cfg; + +if (ptp && ptp->tx_tstamp_en && !skb_is_gso (skb) && +atomic_dec_if_positive (&ptp->tx_avail) >=0 ) { +if (!bnxt_ptp_parse (skb, &ptp->tx_seqid)) { + lflags |=cpu_to_le32 (TX_BD_FLAGS_STAMP ); +skb_shinfo (skb)->tx_flags |=SKBTX_IN_PROGRESS ; + }else { +atomic_inc (&bp->ptp_cfg->tx_avail); + } + } } -if (free_size == bp->tx_ring_size && length <= bp->tx_push_thresh) { +if (unlikely (skb->no_fcs)) + lflags |=cpu_to_le32 (TX_BD_FLAGS_NO_CRC ); + +if (free_size == bp->tx_ring_size && length <= bp->tx_push_thresh && + !lflags) {struct tx_push_buffer *tx_push_buf = txr->tx_push;struct tx_push_bd *tx_push = &tx_push_buf->push_bd;struct tx_bd_ext *tx_push1 = &tx_push->txbd2;
@@ -593,6 +606,8 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev)netdev_tx_sent_queue (txq, skb->len); +skb_tx_timestamp (skb); +/* Sync BD data before updating doorbell */ wmb ();
@@ -622,6 +637,9 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev)return NETDEV_TX_OK ; tx_dma_error: +if (BNXT_TX_PTP_IS_SET (lflags)) +atomic_inc (&bp->ptp_cfg->tx_avail); + last_frag = i;/* start back at beginning and unmap skb */
@@ -656,6 +674,7 @@ static void bnxt_tx_int(struct bnxt *bp, struct bnxt_napi *bnapi, int nr_pkts)for (i =0 ; i < nr_pkts; i++) {struct bnxt_sw_tx_bd *tx_buf; +bool compl_deferred = false;struct sk_buff *skb;int j, last;
@@ -682,12 +701,21 @@ static void bnxt_tx_int(struct bnxt *bp, struct bnxt_napi *bnapi, int nr_pkts)skb_frag_size (&skb_shinfo (skb)->frags[j]), PCI_DMA_TODEVICE); } +if (unlikely (skb_shinfo (skb)->tx_flags &SKBTX_IN_PROGRESS )) { +if (bp->flags &BNXT_FLAG_CHIP_P5 ) { +if (!bnxt_get_tx_ts_p5 (bp, skb)) + compl_deferred = true; +else +atomic_inc (&bp->ptp_cfg->tx_avail); + } + } next_tx_int: cons =NEXT_TX (cons); tx_bytes += skb->len; -dev_kfree_skb_any (skb); +if (!compl_deferred) +dev_kfree_skb_any (skb); }netdev_tx_completed_queue (txq, nr_pkts, tx_bytes);
drivers/net/ethernet/broadcom/bnxt/bnxt.h +2 -0
@@ -89,6 +89,8 @@ struct tx_bd_ext {#define TX_BD_CFA_META_KEY_VLAN (1 << 28) }; +#define BNXT_TX_PTP_IS_SET (lflags) ((lflags) & cpu_to_le32(TX_BD_FLAGS_STAMP)) +struct rx_bd {__le32 rx_bd_len_flags_type;#define RX_BD_TYPE (0x3f << 0)
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c +70 -0
96 lines not on this page · raw message
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h +2 -0
@@ -50,9 +50,11 @@ struct bnxt_ptp_cfg {int rx_filter; }; +int bnxt_ptp_parse (struct sk_buff *skb,u16 *seq_id);int bnxt_ptp_get_current_time (struct bnxt *bp);int bnxt_hwtstamp_set (struct net_device *dev,struct ifreq *ifr);int bnxt_hwtstamp_get (struct net_device *dev,struct ifreq *ifr); +int bnxt_get_tx_ts_p5 (struct bnxt *bp,struct sk_buff *skb);int bnxt_get_rx_ts_p5 (struct bnxt *bp,u64 *ts,u32 pkt_ts);int bnxt_ptp_start (struct bnxt *bp);int bnxt_ptp_init (struct bnxt *bp);
Signature · 1 line
2.18.1
Michael Chan
maintainerPATCH 7/7 bnxt_en: Enable hardware PTP support.
In reply to Michael ChanCall bnxt_ptp_init() to initialize and register with the clock driver to enable PTP support. Call bnxt_ptp_free() to unregister and clean up during shutdown.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +7 -0
@@ -12648,6 +12648,8 @@ static void bnxt_remove_one(struct pci_dev *pdev)if (BNXT_PF (bp))devlink_port_type_clear (&bp->dl_port); + +bnxt_ptp_clear (bp);pci_disable_pcie_error_reporting (pdev);unregister_netdev (dev);clear_bit (BNXT_STATE_IN_FW_RESET , &bp->state);
@@ -13231,6 +13233,11 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) rc); } +if (bnxt_ptp_init (bp)) { +netdev_warn (dev,"PTP initialization failed.\n" ); +kfree (bp->ptp_cfg); + bp->ptp_cfg =NULL ; + }bnxt_inv_fw_health_reg (bp);bnxt_dl_register (bp);
Signature · 1 line
2.18.1
Jakub Kicinski
maintainerRe: [PATCH net-next 3/7] bnxt_en: Add PTP clock APIs, ioctls, and ethtool methods.
In reply to Michael ChanQuoted 6 lines · On Fri, 28 May 2021 20:53:17 -0400 Michael Chan wrote:
Add the clock APIs to set/get/adjust the hw clock, and the related ioctls and ethtool methods.
Reviewed-by Edwin Peer <[email protected]>Signed-off-by Pavan Chebbi <[email protected]>Signed-off-by Michael Chan <[email protected]>
I think you're missing locking in all clock callbacks and timecounter accesses from the data path.
Jakub Kicinski
maintainerRe: [PATCH net-next 5/7] bnxt_en: Get the RX packet timestamp.
In reply to Michael Chandrivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c static u64 bnxt_cc_read(const struct cyclecounter *cc) · line 258
Quoted 7 lines · On Fri, 28 May 2021 20:53:19 -0400 Michael Chan wrote:
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c +7
-0+struct bnxt_ptp_cfg *ptp = bp->ptp_cfg; +u64 time; + +if (!ptp) +return -ENODEV ; + + time =READ_ONCE (ptp->old_time);
READ_ONCE() on a u64? That's not gonna prevent tearing the read on 32 bit architectures, right?
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c static u64 bnxt_cc_read(const struct cyclecounter *cc) · line 261
Quoted 3 lines
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c +3
-0+ *ts = (time &BNXT_HI_TIMER_MASK ) | pkt_ts; +if (pkt_ts < (time &BNXT_LO_TIMER_MASK )) + *ts +=BNXT_LO_TIMER_MASK +1 ;
The stamp is from the MAC, I hope, or otherwise packet which could have been sitting on the ring for some approximation of eternity. You can easily see a packet stamp older than the value stashed in ptp->old_time if you run soon after the refresh.
Jakub Kicinski
maintainerRe: [PATCH net-next 3/7] bnxt_en: Add PTP clock APIs, ioctls, and ethtool methods.
In reply to Michael ChanQuoted 1 line · On Fri, 28 May 2021 20:53:17 -0400 Michael Chan wrote:
+int
bnxt_ptp_init(struct bnxt *bp)
This function never fails.
Quoted 9 lines
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c new file +9
-0+struct bnxt_ptp_cfg *ptp = bp->ptp_cfg; + +if (!ptp) +return 0 ; + +atomic_set (&ptp->tx_avail,BNXT_MAX_TX_TS ); + +memset (&ptp->cc,0 ,sizeof (ptp->cc)); + ptp->cc.read = bnxt_cc_read;
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c line 275
Quoted 10 lines
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c new file +10
-0+ ptp->cc.mask =CYCLECOUNTER_MASK (64 ); + ptp->cc.shift =0 ; + ptp->cc.mult =1 ; + +timecounter_init (&ptp->tc, &ptp->cc,ktime_to_ns (ktime_get_real ())); + + ptp->ptp_info = bnxt_ptp_caps; + ptp->ptp_clock =ptp_clock_register (&ptp->ptp_info, &bp->pdev->dev); +if (IS_ERR (ptp->ptp_clock)) + ptp->ptp_clock =NULL ;
Why not propagate the error? I thought only NULL should be silently ignored? I could be confused about the rules, tho :)
Quoted 1 line
(quoted diff) +1
-0+ return 0;
Michael Chan
maintainerRe: [PATCH net-next 5/7] bnxt_en: Get the RX packet timestamp.
In reply to Jakub KicinskiQuoted 12 lines · Jakub Kicinski
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c static u64 bnxt_cc_read(const struct cyclecounter *cc) · line 258
Quoted 7 lines · On Fri, 28 May 2021 20:53:19 -0400 Michael Chan wrote:
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c +7
-0+struct bnxt_ptp_cfg *ptp = bp->ptp_cfg; +u64 time; + +if (!ptp) +return -ENODEV ; + + time =READ_ONCE (ptp->old_time);
READ_ONCE()on a u64? That's not gonna prevent tearing the read on 32 bit architectures, right?
Right, we should add a conditional lock for 32-bit architectures.
Quoted 9 lines
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c static u64 bnxt_cc_read(const struct cyclecounter *cc) · line 261
Quoted 4 lines
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c +3
-0+ *ts = (time &BNXT_HI_TIMER_MASK ) | pkt_ts; +if (pkt_ts < (time &BNXT_LO_TIMER_MASK )) + *ts +=BNXT_LO_TIMER_MASK +1 ;The stamp is from the MAC, I hope, or otherwise packet which could have been sitting on the ring for some approximation of eternity. You can easily see a packet stamp older than the value stashed in
ptp->old_timeif you run soon after the refresh.
The hardware returns the low 32-bit timestamp of the packet. ptp->old_time contains the full 48-bit of the time counter that we sample periodically. We're getting the upper 16-bit from ptp->old_time to form the complete timestamp for the packet. ptp->old_time is between 1 and 2 sampling periods before the current time. The sampling period should be 1 second.
Yeah, if the RX packet is older than 1 to 2 seconds, the upper part can potentially be wrong if it has wrapped around.
Jakub Kicinski
maintainerRe: [PATCH net-next 5/7] bnxt_en: Get the RX packet timestamp.
Quoted 13 lines · On Fri, 28 May 2021 19:31:30 -0700 Michael Chan wrote:
Quoted 11 lines · Jakub Kicinski
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c static u64 bnxt_cc_read(const struct cyclecounter *cc) · line 258
Quoted 7 lines · On Fri, 28 May 2021 20:53:19 -0400 Michael Chan wrote:
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c +7
-0+struct bnxt_ptp_cfg *ptp = bp->ptp_cfg; +u64 time; + +if (!ptp) +return -ENODEV ; + + time =READ_ONCE (ptp->old_time);
READ_ONCE()on a u64? That's not gonna prevent tearing the read on 32 bit architectures, right?
Quoted 1 line
Right, we should add a conditional lock for 32-bit architectures.
Or only store the top 32 bit of the full counter. I don't think you need the bottom 16.
Quoted 16 lines
Quoted 8 lines
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c static u64 bnxt_cc_read(const struct cyclecounter *cc) · line 261
Quoted 3 lines
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c +3
-0+ *ts = (time &BNXT_HI_TIMER_MASK ) | pkt_ts; +if (pkt_ts < (time &BNXT_LO_TIMER_MASK )) + *ts +=BNXT_LO_TIMER_MASK +1 ;The stamp is from the MAC, I hope, or otherwise packet which could have been sitting on the ring for some approximation of eternity. You can easily see a packet stamp older than the value stashed in
ptp->old_timeif you run soon after the refresh.The hardware returns the low 32-bit timestamp of the packet.
ptp->old_timecontains the full 48-bit of the time counter that we sample periodically. We're getting the upper 16-bit fromptp->old_timeto form the complete timestamp for the packet.ptp->old_timeis between 1 and 2 sampling periods before the current time. The sampling period should be 1 second.
Quoted 2 lines
Yeah, if the RX packet is older than 1 to 2 seconds, the upper part can potentially be wrong if it has wrapped around.
Ah, you're comparing to the previous sample, I see.
Michael Chan
maintainerRe: [PATCH net-next 3/7] bnxt_en: Add PTP clock APIs, ioctls, and ethtool methods.
In reply to Jakub KicinskiQuoted 20 lines · Jakub Kicinski
Quoted 1 line · On Fri, 28 May 2021 20:53:17 -0400 Michael Chan wrote:
+int
bnxt_ptp_init(struct bnxt *bp)This function never fails.
Quoted 14 lines
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c new file +14
-0+struct bnxt_ptp_cfg *ptp = bp->ptp_cfg; + +if (!ptp) +return 0 ; + +atomic_set (&ptp->tx_avail,BNXT_MAX_TX_TS ); + +memset (&ptp->cc,0 ,sizeof (ptp->cc)); + ptp->cc.read = bnxt_cc_read; + ptp->cc.mask =CYCLECOUNTER_MASK (64 ); + ptp->cc.shift =0 ; + ptp->cc.mult =1 ; + +timecounter_init (&ptp->tc, &ptp->cc,ktime_to_ns (ktime_get_real ()));
Quoted 8 lines
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c line 275
Quoted 5 lines
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c new file +5
-0+ + ptp->ptp_info = bnxt_ptp_caps; + ptp->ptp_clock =ptp_clock_register (&ptp->ptp_info, &bp->pdev->dev); +if (IS_ERR (ptp->ptp_clock)) + ptp->ptp_clock =NULL ;Why not propagate the error? I thought only NULL should be silently ignored? I could be confused about the rules, tho :)
Yeah, we should propagate the error so the caller can print a warning.
Quoted 2 lines
Quoted 2 lines
+ return 0;
Re: [PATCH net-next 3/7] bnxt_en: Add PTP clock APIs, ioctls, and ethtool methods.
In reply to Jakub KicinskiQuoted 2 lines · Jakub Kicinski
I think you're missing locking in all clock callbacks and timecounter accesses from the data path.
+1
Re: [PATCH net-next 6/7] bnxt_en: Transmit and retrieve packet timestamps.
In reply to Michael Chandrivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c int bnxt_ptp_init(struct bnxt *bp) · line 386
Quoted 5 lines · Michael Chan
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c +1
-0@@ -319,6 +383,7 @@ int bnxt_ptp_init(struct bnxt *bp)if (IS_ERR (ptp->ptp_clock)) ptp->ptp_clock =NULL ; +INIT_WORK (&ptp->ptp_ts_task, bnxt_ptp_ts_task);
Instead of using generic work, consider using the PHC kernel thread. See ptp_schedule_worker().
Experience shows that under heavy workloads, work can be delayed for unacceptably long periods of time. The advantage of the kthread is that the admin can use chrt to give the thread appropriate priority.
You could also use the kthread to perform the period time reading from Patch #4.
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c void bnxt_ptp_clear(struct bnxt *bp) · line 401
Quoted 8 lines
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c +1
-0return 0 ; }@@ -333,4 +398,9 @@ void bnxt_ptp_clear(struct bnxt *bp)ptp_clock_unregister (ptp->ptp_clock); ptp->ptp_clock =NULL ; +cancel_work_sync (&ptp->ptp_ts_task);
Thanks,
Richard