DPDK patches and discussions
 help / color / mirror / Atom feed
From: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 1/3] ethdev: add additional ieee1588 support functions
Date: Fri,  2 Oct 2015 17:20:06 +0200	[thread overview]
Message-ID: <1443799208-9408-2-git-send-email-danielx.t.mrzyglod@intel.com> (raw)
In-Reply-To: <1443799208-9408-1-git-send-email-danielx.t.mrzyglod@intel.com>

Add additional functions to support the existing IEEE1588
functionality.

* rte_eth_timesync_settime(), function to set the device clock time.
* rte_eth_timesync_gettime, function to get the device clock time.
* rte_eth_timesync_adjust, function to adjust the device clock time.

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
---
 lib/librte_ether/rte_ethdev.c          | 36 +++++++++++++++++++
 lib/librte_ether/rte_ethdev.h          | 64 ++++++++++++++++++++++++++++++++++
 lib/librte_ether/rte_ether_version.map |  9 +++++
 3 files changed, 109 insertions(+)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index f593f6e..6f26f3a 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -3272,6 +3272,42 @@ rte_eth_timesync_read_rx_timestamp(uint8_t port_id, struct timespec *timestamp,
 }
 
 int
+rte_eth_timesync_adjust(uint8_t port_id, int64_t delta)
+{
+	struct rte_eth_dev *dev;
+
+	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	dev = &rte_eth_devices[port_id];
+
+	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_adjust, -ENOTSUP);
+	return (*dev->dev_ops->timesync_adjust)(dev, delta);
+}
+
+int
+rte_eth_timesync_gettime(uint8_t port_id, struct timespec *timestamp)
+{
+	struct rte_eth_dev *dev;
+
+	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	dev = &rte_eth_devices[port_id];
+
+	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_gettime, -ENOTSUP);
+	return (*dev->dev_ops->timesync_gettime)(dev, timestamp);
+}
+
+int
+rte_eth_timesync_settime(uint8_t port_id, struct timespec *timestamp)
+{
+	struct rte_eth_dev *dev;
+
+	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	dev = &rte_eth_devices[port_id];
+
+	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_settime, -ENOTSUP);
+	return (*dev->dev_ops->timesync_settime)(dev, timestamp);
+}
+
+int
 rte_eth_timesync_read_tx_timestamp(uint8_t port_id, struct timespec *timestamp)
 {
 	struct rte_eth_dev *dev;
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 8a8c82b..6fdaacd 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1129,6 +1129,17 @@ typedef int (*eth_timesync_read_tx_timestamp_t)(struct rte_eth_dev *dev,
 						struct timespec *timestamp);
 /**< @internal Function used to read a TX IEEE1588/802.1AS timestamp. */
 
+typedef int (*eth_timesync_adjust)(struct rte_eth_dev *dev, int64_t);
+/**< @internal Function used to adjust device clock */
+
+typedef int (*eth_timesync_gettime)(struct rte_eth_dev *dev,
+						struct timespec *timestamp);
+/**< @internal Function used to get time from device clock. */
+
+typedef int (*eth_timesync_settime)(struct rte_eth_dev *dev,
+						struct timespec *timestamp);
+/**< @internal Function used to get time from device clock */
+
 typedef int (*eth_get_reg_length_t)(struct rte_eth_dev *dev);
 /**< @internal Retrieve device register count  */
 
@@ -1312,6 +1323,12 @@ struct eth_dev_ops {
 	eth_timesync_read_rx_timestamp_t timesync_read_rx_timestamp;
 	/** Read the IEEE1588/802.1AS TX timestamp. */
 	eth_timesync_read_tx_timestamp_t timesync_read_tx_timestamp;
+	/** Adjust the device clock */
+	eth_timesync_adjust timesync_adjust;
+	/** Get the device clock timespec */
+	eth_timesync_gettime timesync_gettime;
+	/** Set the device clock timespec */
+	eth_timesync_settime timesync_settime;
 };
 
 /**
@@ -3598,6 +3615,53 @@ extern int rte_eth_timesync_read_rx_timestamp(uint8_t port_id,
 extern int rte_eth_timesync_read_tx_timestamp(uint8_t port_id,
 					      struct timespec *timestamp);
 
+/**
+ * Adjust the timesync clock on an Ethernet device..
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device.
+ * @param delta
+ *   The adjustment in nanoseconds
+ *
+ * @return
+ *   - 0: Success.
+ *   - -ENODEV: The port ID is invalid.
+ *   - -ENOTSUP: The function is not supported by the Ethernet driver.
+ */
+extern int rte_eth_timesync_adjust(uint8_t port_id, int64_t delta);
+
+/**
+ * Read the time from the timesync clock on an Ethernet device.
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device.
+ * @param time
+ *   Pointer to the timespec struct.
+ *
+ * @return
+ *   - 0: Success.
+ */
+extern int rte_eth_timesync_gettime(uint8_t port_id,
+	      struct timespec *time);
+
+
+/**
+ * Set the time of the timesync clock on an Ethernet device.
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device.
+ * @param time
+ *   Pointer to the timespec struct.
+ *
+ * @return
+ *   - 0: Success.
+ *   - -EINVAL: No timestamp is available.
+ *   - -ENODEV: The port ID is invalid.
+ *   - -ENOTSUP: The function is not supported by the Ethernet driver.
+ */
+extern int rte_eth_timesync_settime(uint8_t port_id,
+	      struct timespec *time);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
index 8345a6c..0820af3 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -127,3 +127,12 @@ DPDK_2.1 {
 	rte_eth_timesync_read_tx_timestamp;
 
 } DPDK_2.0;
+
+DPDK_2.2 {
+	global:
+
+	rte_eth_timesync_adjust;
+	rte_eth_timesync_gettime;
+	rte_eth_timesync_settime;
+
+} DPDK_2.1;
-- 
2.1.0

  reply	other threads:[~2015-10-02 15:22 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-02 15:20 [dpdk-dev] [PATCH 0/3] add sample ptp slave application Daniel Mrzyglod
2015-10-02 15:20 ` Daniel Mrzyglod [this message]
2015-10-02 15:20 ` [dpdk-dev] [PATCH 2/3] ixgbe: add additional ieee1588 support functions Daniel Mrzyglod
2015-10-02 15:20 ` [dpdk-dev] [PATCH 3/3] example: PTP client slave minimal implementation Daniel Mrzyglod
2015-10-30  9:43 ` [dpdk-dev] [PATCH v2 0/6] add sample ptp slave application Daniel Mrzyglod
2015-10-30  9:43   ` [dpdk-dev] [PATCH v2 1/6] ethdev: add additional ieee1588 support functions Daniel Mrzyglod
2015-10-30  9:43   ` [dpdk-dev] [PATCH v2 2/6] ixgbe: " Daniel Mrzyglod
2015-10-30  9:43   ` [dpdk-dev] [PATCH v2 3/6] igb: " Daniel Mrzyglod
2015-10-30  9:43   ` [dpdk-dev] [PATCH v2 4/6] i40e: " Daniel Mrzyglod
2015-10-30 11:19     ` Ananyev, Konstantin
2015-10-30 11:33       ` De Lara Guarch, Pablo
2015-10-30 11:36         ` Thomas Monjalon
2015-10-30 11:38         ` Ananyev, Konstantin
2015-10-30  9:43   ` [dpdk-dev] [PATCH v2 5/6] example: PTP client slave minimal implementation Daniel Mrzyglod
2015-10-30  9:43   ` [dpdk-dev] [PATCH v2 6/6] doc: add a PTPCLIENT sample guide Daniel Mrzyglod
2015-10-30 11:23   ` [dpdk-dev] [PATCH v2 0/6] add sample ptp slave application Mcnamara, John
2015-11-03 16:38 ` [dpdk-dev] [PATCH v3 0/7] " Daniel Mrzyglod
2015-11-03 16:38   ` [dpdk-dev] [PATCH v3 1/7] ethdev: add additional ieee1588 support functions Daniel Mrzyglod
2015-11-03 16:38   ` [dpdk-dev] [PATCH v3 2/7] net: Add common PTP structures and functions Daniel Mrzyglod
2015-11-03 16:38   ` [dpdk-dev] [PATCH v3 3/7] ixgbe: add additional ieee1588 support functions Daniel Mrzyglod
2015-11-03 16:38   ` [dpdk-dev] [PATCH v3 4/7] igb: " Daniel Mrzyglod
2015-11-03 16:38   ` [dpdk-dev] [PATCH v3 5/7] i40e: " Daniel Mrzyglod
2015-11-03 16:38   ` [dpdk-dev] [PATCH v3 6/7] example: PTP client slave minimal implementation Daniel Mrzyglod
2015-11-03 20:06     ` De Lara Guarch, Pablo
2015-11-03 16:38   ` [dpdk-dev] [PATCH v3 7/7] doc: add a PTPCLIENT sample guide Daniel Mrzyglod
2015-11-04 10:06 ` [dpdk-dev] [PATCH v4 0/7] add sample ptp slave application Daniel Mrzyglod
2015-11-04 10:06   ` [dpdk-dev] [PATCH v4 1/7] ethdev: add additional ieee1588 support functions Daniel Mrzyglod
2015-11-04 10:06   ` [dpdk-dev] [PATCH v4 2/7] net: Add common PTP structures and functions Daniel Mrzyglod
2015-11-04 10:06   ` [dpdk-dev] [PATCH v4 3/7] ixgbe: add additional ieee1588 support functions Daniel Mrzyglod
2015-11-04 10:06   ` [dpdk-dev] [PATCH v4 4/7] igb: " Daniel Mrzyglod
2015-11-04 10:06   ` [dpdk-dev] [PATCH v4 5/7] i40e: " Daniel Mrzyglod
2015-11-04 10:06   ` [dpdk-dev] [PATCH v4 6/7] example: PTP client slave minimal implementation Daniel Mrzyglod
2015-11-04 10:06   ` [dpdk-dev] [PATCH v4 7/7] doc: add a PTPCLIENT sample guide Daniel Mrzyglod
2015-11-05 12:46   ` [dpdk-dev] [PATCH v4 0/7] add sample ptp slave application Mcnamara, John
2015-11-05 15:17     ` Thomas Monjalon
2015-11-05 16:08       ` Mrzyglod, DanielX T
2015-11-05 13:37   ` Mcnamara, John
2015-11-05 14:05 ` [dpdk-dev] [PATCH v5 " Daniel Mrzyglod
2015-11-05 14:06   ` [dpdk-dev] [PATCH v5 1/7] ethdev: add additional ieee1588 support functions Daniel Mrzyglod
2015-11-10 11:03     ` Thomas Monjalon
2015-11-10 11:36       ` Mcnamara, John
2015-11-10 11:58         ` Thomas Monjalon
2015-11-10 14:12           ` Mcnamara, John
2015-11-10 14:16             ` Thomas Monjalon
2015-11-10 15:18             ` Liu, Yong
2015-11-11  1:40               ` Cao, Waterman
2015-11-05 14:06   ` [dpdk-dev] [PATCH v5 2/7] net: Add common PTP structures and functions Daniel Mrzyglod
2015-11-10 11:25     ` Thomas Monjalon
2015-11-11 10:45       ` Mcnamara, John
2015-11-11 11:24         ` Thomas Monjalon
2015-11-05 14:06   ` [dpdk-dev] [PATCH v5 3/7] ixgbe: add additional ieee1588 support functions Daniel Mrzyglod
2015-11-05 14:06   ` [dpdk-dev] [PATCH v5 4/7] igb: " Daniel Mrzyglod
2015-11-05 14:06   ` [dpdk-dev] [PATCH v5 5/7] i40e: " Daniel Mrzyglod
2015-11-05 14:06   ` [dpdk-dev] [PATCH v5 6/7] example: PTP client slave minimal implementation Daniel Mrzyglod
2015-11-05 14:06   ` [dpdk-dev] [PATCH v5 7/7] doc: add a PTPCLIENT sample guide Daniel Mrzyglod
2015-11-05 14:10   ` [dpdk-dev] [PATCH v5 0/7] add sample ptp slave application Mrzyglod, DanielX T
2015-11-05 14:30     ` Mcnamara, John
2015-11-12 12:55   ` [dpdk-dev] [PATCH v6 0/8] " Pablo de Lara
2015-11-12 12:55     ` [dpdk-dev] [PATCH v6 1/8] ethdev: add additional ieee1588 support functions Pablo de Lara
2015-11-12 12:55     ` [dpdk-dev] [PATCH v6 2/8] eal: add common time structures and functions Pablo de Lara
2015-11-12 12:55     ` [dpdk-dev] [PATCH v6 3/8] ixgbe: add additional ieee1588 support functions Pablo de Lara
2015-11-12 12:55     ` [dpdk-dev] [PATCH v6 4/8] igb: " Pablo de Lara
2015-11-12 12:55     ` [dpdk-dev] [PATCH v6 5/8] i40e: " Pablo de Lara
2015-11-12 12:55     ` [dpdk-dev] [PATCH v6 6/8] testpmd: add nanosecond output for ieee1588 fwd Pablo de Lara
2015-11-12 12:55     ` [dpdk-dev] [PATCH v6 7/8] example: minimal ptp client implementation Pablo de Lara
2015-11-12 12:55     ` [dpdk-dev] [PATCH v6 8/8] doc: add a ptpclient sample guide Pablo de Lara
2015-11-13 14:38       ` Thomas Monjalon
2015-11-13 14:58         ` De Lara Guarch, Pablo
2015-11-13 15:10           ` Thomas Monjalon
2015-11-13 15:15             ` De Lara Guarch, Pablo
2015-11-13 15:19               ` Thomas Monjalon
2015-11-12 13:20     ` [dpdk-dev] [PATCH v6 0/8] add sample ptp slave application Mcnamara, John
2015-11-13 16:09     ` [dpdk-dev] [PATCH v7 " Pablo de Lara
2015-11-13 16:09       ` [dpdk-dev] [PATCH v7 1/8] ethdev: add ieee1588 functions for device clock time Pablo de Lara
2015-11-13 16:09       ` [dpdk-dev] [PATCH v7 2/8] eal: add helpers for time conversions Pablo de Lara
2015-11-13 16:09       ` [dpdk-dev] [PATCH v7 3/8] ixgbe: support ieee1588 functions for device time Pablo de Lara
2015-11-13 16:09       ` [dpdk-dev] [PATCH v7 4/8] igb: " Pablo de Lara
2015-11-13 16:09       ` [dpdk-dev] [PATCH v7 5/8] i40e: " Pablo de Lara
2015-11-13 16:09       ` [dpdk-dev] [PATCH v7 6/8] testpmd: add nanosecond output for ieee1588 Pablo de Lara
2015-11-13 16:09       ` [dpdk-dev] [PATCH v7 7/8] example: add minimal PTP client Pablo de Lara
2015-11-13 16:09       ` [dpdk-dev] [PATCH v7 8/8] doc: add a ptpclient sample guide Pablo de Lara
2015-11-13 16:28       ` [dpdk-dev] [PATCH v7 0/8] add sample ptp slave application Thomas Monjalon
2015-11-13 16:38         ` De Lara Guarch, Pablo
2015-11-13 16:49       ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1443799208-9408-2-git-send-email-danielx.t.mrzyglod@intel.com \
    --to=danielx.t.mrzyglod@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).