From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 01018A0511; Fri, 8 Apr 2022 04:18:08 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7FF50427E9; Fri, 8 Apr 2022 04:18:04 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 54334410FB for ; Fri, 8 Apr 2022 04:18:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649384283; x=1680920283; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=cRt6eWTTzDIz9TmxzEzSXLXJzGTm6/zoicXupzwcMpU=; b=nZwN4fp4Xb+NbKthVefXu91kCxXttwoBONw5vEWpJ1URtpUW9opy9iLU x7cy0V5oRVY/0k6GxRBjQfeCcDvO1PIJS3xup5YCmqxl/a1eEIYH6Ymg0 X5O2u6d8VpxIV2i7xLtZhDbKBnWOmODeCOMpQia3G8kCsR8jsgs+EssRl gbb9DNIbN1mzMhjOdFOAphsRKSl9lBJcqeuQAlNdSlI8ZcT7wuAlEV6G5 7f49Gln5VSs0uCBMUC/ilGse+oYABYW3dEf1IIvJ1OxltHt+ftizcRwpv d6bK1s6vci7Y6k6xCxCIGep+6lJzHbwZJph1ueAIp2Zla0dGREmuRh7eu Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10310"; a="322180208" X-IronPort-AV: E=Sophos;i="5.90,243,1643702400"; d="scan'208";a="322180208" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Apr 2022 19:18:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,243,1643702400"; d="scan'208";a="550329625" Received: from unknown (HELO npg-dpdk-simeisu-cvl-119d218.sh.intel.com) ([10.67.119.218]) by orsmga007.jf.intel.com with ESMTP; 07 Apr 2022 19:18:01 -0700 From: Simei Su To: qi.z.zhang@intel.com, qiming.yang@intel.com Cc: dev@dpdk.org, wenjun1.wu@intel.com, Simei Su Subject: [PATCH v1 1/3] common/iavf: support Rx timestamp in virtual channel Date: Fri, 8 Apr 2022 10:13:05 +0800 Message-Id: <20220408021307.272746-2-simei.su@intel.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20220408021307.272746-1-simei.su@intel.com> References: <20220408021307.272746-1-simei.su@intel.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Add new ops and structures to support VF to support Rx timestamp on flex descriptor. "VIRTCHNL_OP_1588_PTP_GET_CAPS" ops is sent by the VF to request PTP capablilities and responded by the PF with capabilities enabled for that VF. "VIRTCHNL_OP_1588_PTP_GET_TIME" ops is sent by the VF to request the current time of the PHC. The PF will respond by reading the device time and reporting it back to the VF. Signed-off-by: Simei Su --- drivers/common/iavf/virtchnl.h | 62 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 3 deletions(-) diff --git a/drivers/common/iavf/virtchnl.h b/drivers/common/iavf/virtchnl.h index 3e44eca..d3a99e9 100644 --- a/drivers/common/iavf/virtchnl.h +++ b/drivers/common/iavf/virtchnl.h @@ -159,6 +159,8 @@ enum virtchnl_ops { VIRTCHNL_OP_DISABLE_VLAN_INSERTION_V2 = 57, VIRTCHNL_OP_ENABLE_VLAN_FILTERING_V2 = 58, VIRTCHNL_OP_DISABLE_VLAN_FILTERING_V2 = 59, + VIRTCHNL_OP_1588_PTP_GET_CAPS = 60, + VIRTCHNL_OP_1588_PTP_GET_TIME = 61, VIRTCHNL_OP_GET_QOS_CAPS = 66, VIRTCHNL_OP_CONFIG_QUEUE_TC_MAP = 67, VIRTCHNL_OP_ENABLE_QUEUES_V2 = 107, @@ -274,6 +276,10 @@ static inline const char *virtchnl_op_str(enum virtchnl_ops v_opcode) return "VIRTCHNL_OP_ENABLE_VLAN_FILTERING_V2"; case VIRTCHNL_OP_DISABLE_VLAN_FILTERING_V2: return "VIRTCHNL_OP_DISABLE_VLAN_FILTERING_V2"; + case VIRTCHNL_OP_1588_PTP_GET_CAPS: + return "VIRTCHNL_OP_1588_PTP_GET_CAPS"; + case VIRTCHNL_OP_1588_PTP_GET_TIME: + return "VIRTCHNL_OP_1588_PTP_GET_TIME"; case VIRTCHNL_OP_MAX: return "VIRTCHNL_OP_MAX"; default: @@ -409,8 +415,7 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource); #define VIRTCHNL_VF_OFFLOAD_FDIR_PF BIT(28) #define VIRTCHNL_VF_OFFLOAD_QOS BIT(29) #define VIRTCHNL_VF_CAP_DCF BIT(30) - /* BIT(31) is reserved */ - +#define VIRTCHNL_VF_CAP_PTP BIT(31) #define VF_BASE_MODE_OFFLOADS (VIRTCHNL_VF_OFFLOAD_L2 | \ VIRTCHNL_VF_OFFLOAD_VLAN | \ VIRTCHNL_VF_OFFLOAD_RSS_PF) @@ -496,6 +501,18 @@ enum virtchnl_rx_desc_id_bitmasks { /* 22 through 63 are reserved */ }; +/* virtchnl_rxq_info_flags + * + * Definition of bits in the flags field of the virtchnl_rxq_info structure. + */ +enum virtchnl_rxq_info_flags { + /* If the VIRTCHNL_PTP_RX_TSTAMP bit of the flag field is set, this is + * a request to enable Rx timestamp. Other flag bits are currently + * reserved and they may be extended in the future. + */ + VIRTCHNL_PTP_RX_TSTAMP = BIT(0), +}; + /* VIRTCHNL_OP_CONFIG_RX_QUEUE * VF sends this message to set up parameters for one RX queue. * External data buffer contains one instance of virtchnl_rxq_info. @@ -524,7 +541,8 @@ struct virtchnl_rxq_info { * with VIRTCHNL_RXDID_1_32B_BASE. */ u8 rxdid; - u8 pad1[2]; + u8 flags; /* see virtchnl_rxq_info_flags */ + u8 pad1; u64 dma_ring_addr; /* see enum virtchnl_rx_hsplit; deprecated with AVF 1.0 */ @@ -1978,6 +1996,38 @@ struct virtchnl_queue_vector_maps { VIRTCHNL_CHECK_STRUCT_LEN(24, virtchnl_queue_vector_maps); +#define VIRTCHNL_1588_PTP_CAP_RX_TSTAMP BIT(1) +#define VIRTCHNL_1588_PTP_CAP_READ_PHC BIT(2) + +struct virtchnl_phc_regs { + u32 clock_hi; + u32 clock_lo; + u8 pcie_region; + u8 rsvd[15]; +}; + +VIRTCHNL_CHECK_STRUCT_LEN(24, virtchnl_phc_regs); + +struct virtchnl_ptp_caps { + struct virtchnl_phc_regs phc_regs; + u32 caps; + s32 max_adj; + u8 tx_tstamp_idx; + u8 n_ext_ts; + u8 n_per_out; + u8 n_pins; + u8 tx_tstamp_format; + u8 rsvd[11]; +}; + +VIRTCHNL_CHECK_STRUCT_LEN(48, virtchnl_ptp_caps); + +struct virtchnl_phc_time { + uint64_t time; + uint8_t rsvd[8]; +}; + +VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_phc_time); /* Since VF messages are limited by u16 size, precalculate the maximum possible * values of nested elements in virtchnl structures that virtual channel can @@ -2271,6 +2321,12 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode, case VIRTCHNL_OP_DISABLE_VLAN_FILTERING_V2: valid_len = sizeof(struct virtchnl_vlan_setting); break; + case VIRTCHNL_OP_1588_PTP_GET_CAPS: + valid_len = sizeof(struct virtchnl_ptp_caps); + break; + case VIRTCHNL_OP_1588_PTP_GET_TIME: + valid_len = sizeof(struct virtchnl_phc_time); + break; case VIRTCHNL_OP_ENABLE_QUEUES_V2: case VIRTCHNL_OP_DISABLE_QUEUES_V2: valid_len = sizeof(struct virtchnl_del_ena_dis_queues); -- 2.9.5