/* if the ptp_mb_q_id holds invalid value (0xffff), the secondary * mailbox is not supported.
*/
scnd_mbx->valid = scnd_mbx->peer_mbx_q_id != 0xffff; if (scnd_mbx->valid)
scnd_mbx->peer_id = recv_ptp_caps_msg->peer_id;
/* Determine the access type for the PTP features */
idpf_ptp_get_features_access(adapter);
access_type = ptp->get_dev_clk_time_access; if (access_type != IDPF_PTP_DIRECT) goto cross_tstamp;
/** * idpf_ptp_get_dev_clk_time - Send virtchnl get device clk time message * @adapter: Driver specific private structure * @dev_clk_time: Pointer to the device clock structure where the value is set * * Send virtchnl get time message to get the time of the clock. * * Return: 0 on success, -errno otherwise.
*/ int idpf_ptp_get_dev_clk_time(struct idpf_adapter *adapter, struct idpf_ptp_dev_timers *dev_clk_time)
{ struct virtchnl2_ptp_get_dev_clk_time get_dev_clk_time_msg; struct idpf_vc_xn_params xn_params = {
.vc_op = VIRTCHNL2_OP_PTP_GET_DEV_CLK_TIME,
.send_buf.iov_base = &get_dev_clk_time_msg,
.send_buf.iov_len = sizeof(get_dev_clk_time_msg),
.recv_buf.iov_base = &get_dev_clk_time_msg,
.recv_buf.iov_len = sizeof(get_dev_clk_time_msg),
.timeout_ms = IDPF_VC_XN_DEFAULT_TIMEOUT_MSEC,
}; int reply_sz;
u64 dev_time;
reply_sz = idpf_vc_xn_exec(adapter, &xn_params); if (reply_sz < 0) return reply_sz; if (reply_sz != sizeof(get_dev_clk_time_msg)) return -EIO;
/** * idpf_ptp_get_cross_time - Send virtchnl get cross time message * @adapter: Driver specific private structure * @cross_time: Pointer to the device clock structure where the value is set * * Send virtchnl get cross time message to get the time of the clock and the * system time. * * Return: 0 on success, -errno otherwise.
*/ int idpf_ptp_get_cross_time(struct idpf_adapter *adapter, struct idpf_ptp_dev_timers *cross_time)
{ struct virtchnl2_ptp_get_cross_time cross_time_msg; struct idpf_vc_xn_params xn_params = {
.vc_op = VIRTCHNL2_OP_PTP_GET_CROSS_TIME,
.send_buf.iov_base = &cross_time_msg,
.send_buf.iov_len = sizeof(cross_time_msg),
.recv_buf.iov_base = &cross_time_msg,
.recv_buf.iov_len = sizeof(cross_time_msg),
.timeout_ms = IDPF_VC_XN_DEFAULT_TIMEOUT_MSEC,
}; int reply_sz;
reply_sz = idpf_vc_xn_exec(adapter, &xn_params); if (reply_sz < 0) return reply_sz; if (reply_sz != sizeof(cross_time_msg)) return -EIO;
/** * idpf_ptp_update_tstamp_tracker - Update the Tx timestamp tracker based on * the skb compatibility. * @caps: Tx timestamp capabilities that monitor the latch status * @skb: skb for which the tstamp value is returned through virtchnl message * @current_state: Current state of the Tx timestamp latch * @expected_state: Expected state of the Tx timestamp latch * * Find a proper skb tracker for which the Tx timestamp is received and change * the state to expected value. * * Return: true if the tracker has been found and updated, false otherwise.
*/ staticbool
idpf_ptp_update_tstamp_tracker(struct idpf_ptp_vport_tx_tstamp_caps *caps, struct sk_buff *skb, enum idpf_ptp_tx_tstamp_state current_state, enum idpf_ptp_tx_tstamp_state expected_state)
{ bool updated = false;
spin_lock(&caps->status_lock); for (u16 i = 0; i < caps->num_entries; i++) { struct idpf_ptp_tx_tstamp_status *status;
/** * idpf_ptp_get_tstamp_value - Get the Tx timestamp value and provide it * back to the skb. * @vport: Virtual port structure * @tstamp_latch: Tx timestamp latch structure fulfilled by the Control Plane * @ptp_tx_tstamp: Tx timestamp latch to add to the free list * * Read the value of the Tx timestamp for a given latch received from the * Control Plane, extend it to 64 bit and provide back to the skb. * * Return: 0 on success, -errno otherwise.
*/ staticint
idpf_ptp_get_tstamp_value(struct idpf_vport *vport, struct virtchnl2_ptp_tx_tstamp_latch *tstamp_latch, struct idpf_ptp_tx_tstamp *ptp_tx_tstamp)
{ struct idpf_ptp_vport_tx_tstamp_caps *tx_tstamp_caps; struct skb_shared_hwtstamps shhwtstamps; bool state_upd = false;
u8 tstamp_ns_lo_bit;
u64 tstamp;
/** * idpf_ptp_get_tx_tstamp_async_handler - Async callback for getting Tx tstamps * @adapter: Driver specific private structure * @xn: transaction for message * @ctlq_msg: received message * * Read the tstamps Tx tstamp values from a received message and put them * directly to the skb. The number of timestamps to read is specified by * the virtchnl message. * * Return: 0 on success, -errno otherwise.
*/ staticint
idpf_ptp_get_tx_tstamp_async_handler(struct idpf_adapter *adapter, struct idpf_vc_xn *xn, conststruct idpf_ctlq_msg *ctlq_msg)
{ struct virtchnl2_ptp_get_vport_tx_tstamp_latches *recv_tx_tstamp_msg; struct idpf_ptp_vport_tx_tstamp_caps *tx_tstamp_caps; struct virtchnl2_ptp_tx_tstamp_latch tstamp_latch; struct idpf_ptp_tx_tstamp *tx_tstamp, *tmp; struct idpf_vport *tstamp_vport = NULL; struct list_head *head;
u16 num_latches;
u32 vport_id; int err = 0;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.