DPDK patches and discussions
 help / color / mirror / Atom feed
From: Raslan Darawsheh <rasland@mellanox.com>
To: dev@dpdk.org
Cc: shahafs@mellanox.com, yskoh@mellanox.com, ferruh.yigit@intel.com
Subject: [dpdk-dev] [PATCH v9 2/3] app/testpmd: add Rx HW timestamp
Date: Tue, 10 Oct 2017 17:37:06 +0300	[thread overview]
Message-ID: <1507646227-12338-2-git-send-email-rasland@mellanox.com> (raw)
In-Reply-To: <1507646227-12338-1-git-send-email-rasland@mellanox.com>

Add enabling/disabling Rx HW timestamp from
command line and parameter.

Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
---
 app/test-pmd/cmdline.c    | 15 ++++++++++++---
 app/test-pmd/config.c     |  8 ++++++++
 app/test-pmd/parameters.c |  5 +++++
 app/test-pmd/rxonly.c     |  2 ++
 app/test-pmd/testpmd.c    |  1 +
 5 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 8dc5c85..50744cb 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -693,7 +693,7 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"port config all max-pkt-len (value)\n"
 			"    Set the max packet length.\n\n"
 
-			"port config all (crc-strip|scatter|rx-cksum|hw-vlan|hw-vlan-filter|"
+			"port config all (crc-strip|scatter|rx-cksum|rx-timestamp|hw-vlan|hw-vlan-filter|"
 			"hw-vlan-strip|hw-vlan-extend|drop-en)"
 			" (on|off)\n"
 			"    Set crc-strip/scatter/rx-checksum/hardware-vlan/drop_en"
@@ -1614,6 +1614,15 @@ cmd_config_rx_mode_flag_parsed(void *parsed_result,
 			printf("Unknown parameter\n");
 			return;
 		}
+	} else if (!strcmp(res->name, "rx-timestamp")) {
+		if (!strcmp(res->value, "on"))
+			rx_mode.hw_timestamp = 1;
+		else if (!strcmp(res->value, "off"))
+			rx_mode.hw_timestamp = 0;
+		else {
+			printf("Unknown parameter\n");
+			return;
+		}
 	} else if (!strcmp(res->name, "hw-vlan")) {
 		if (!strcmp(res->value, "on")) {
 			rx_mode.hw_vlan_filter = 1;
@@ -1682,7 +1691,7 @@ cmdline_parse_token_string_t cmd_config_rx_mode_flag_all =
 	TOKEN_STRING_INITIALIZER(struct cmd_config_rx_mode_flag, all, "all");
 cmdline_parse_token_string_t cmd_config_rx_mode_flag_name =
 	TOKEN_STRING_INITIALIZER(struct cmd_config_rx_mode_flag, name,
-					"crc-strip#scatter#rx-cksum#hw-vlan#"
+					"crc-strip#scatter#rx-cksum#rx-timestamp#hw-vlan#"
 					"hw-vlan-filter#hw-vlan-strip#hw-vlan-extend");
 cmdline_parse_token_string_t cmd_config_rx_mode_flag_value =
 	TOKEN_STRING_INITIALIZER(struct cmd_config_rx_mode_flag, value,
@@ -1691,7 +1700,7 @@ cmdline_parse_token_string_t cmd_config_rx_mode_flag_value =
 cmdline_parse_inst_t cmd_config_rx_mode_flag = {
 	.f = cmd_config_rx_mode_flag_parsed,
 	.data = NULL,
-	.help_str = "port config all crc-strip|scatter|rx-cksum|hw-vlan|"
+	.help_str = "port config all crc-strip|scatter|rx-cksum|rx-timestamp|hw-vlan|"
 		"hw-vlan-filter|hw-vlan-strip|hw-vlan-extend on|off",
 	.tokens = {
 		(void *)&cmd_config_rx_mode_flag_port,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index ecd5166..7ff0bb2 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -607,6 +607,14 @@ port_offload_cap_display(portid_t port_id)
 			printf("off\n");
 	}
 
+	if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TIMESTAMP) {
+		printf("HW timestamp:                  ");
+		if (dev->data->dev_conf.rxmode.hw_timestamp)
+			printf("on\n");
+		else
+			printf("off\n");
+	}
+
 	if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_QINQ_INSERT) {
 		printf("Double VLANs insert:           ");
 		if (ports[port_id].tx_ol_flags &
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index 72ff971..5d64f0d 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -162,6 +162,7 @@ usage(char* progname)
 	printf("  --disable-crc-strip: disable CRC stripping by hardware.\n");
 	printf("  --enable-lro: enable large receive offload.\n");
 	printf("  --enable-rx-cksum: enable rx hardware checksum offload.\n");
+	printf("  --enable-rx-timestamp: enable rx hardware timestamp offload.\n");
 	printf("  --disable-hw-vlan: disable hardware vlan.\n");
 	printf("  --disable-hw-vlan-filter: disable hardware vlan filter.\n");
 	printf("  --disable-hw-vlan-strip: disable hardware vlan strip.\n");
@@ -605,6 +606,7 @@ launch_args_parse(int argc, char** argv)
 		{ "disable-crc-strip",          0, 0, 0 },
 		{ "enable-lro",                 0, 0, 0 },
 		{ "enable-rx-cksum",            0, 0, 0 },
+		{ "enable-rx-timestamp",        0, 0, 0 },
 		{ "enable-scatter",             0, 0, 0 },
 		{ "disable-hw-vlan",            0, 0, 0 },
 		{ "disable-hw-vlan-filter",     0, 0, 0 },
@@ -903,6 +905,9 @@ launch_args_parse(int argc, char** argv)
 				rx_mode.enable_scatter = 1;
 			if (!strcmp(lgopts[opt_idx].name, "enable-rx-cksum"))
 				rx_mode.hw_ip_checksum = 1;
+			if (!strcmp(lgopts[opt_idx].name,
+					"enable-rx-timestamp"))
+				rx_mode.hw_timestamp = 1;
 
 			if (!strcmp(lgopts[opt_idx].name, "disable-hw-vlan")) {
 				rx_mode.hw_vlan_filter = 0;
diff --git a/app/test-pmd/rxonly.c b/app/test-pmd/rxonly.c
index 57df014..2a27f72 100644
--- a/app/test-pmd/rxonly.c
+++ b/app/test-pmd/rxonly.c
@@ -158,6 +158,8 @@ pkt_burst_receive(struct fwd_stream *fs)
 				printf("hash=0x%x ID=0x%x ",
 				       mb->hash.fdir.hash, mb->hash.fdir.id);
 		}
+		if (ol_flags & PKT_RX_TIMESTAMP)
+			printf(" - timestamp %lu ", mb->timestamp);
 		if (ol_flags & PKT_RX_VLAN_STRIPPED)
 			printf(" - VLAN tci=0x%x", mb->vlan_tci);
 		if (ol_flags & PKT_RX_QINQ_STRIPPED)
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 667c228..1b1d75f 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -343,6 +343,7 @@ struct rte_eth_rxmode rx_mode = {
 	.hw_vlan_extend = 0, /**< Extended VLAN disabled. */
 	.jumbo_frame    = 0, /**< Jumbo Frame Support disabled. */
 	.hw_strip_crc   = 1, /**< CRC stripping by hardware enabled. */
+	.hw_timestamp   = 0, /**< HW timestamp enabled. */
 };
 
 struct rte_fdir_conf fdir_conf = {
-- 
2.7.4

  reply	other threads:[~2017-10-10 14:37 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-22 13:46 [dpdk-dev] [PATCH 1/3] ethdev: expose Rx hardware timestamp Raslan Darawsheh
2017-08-22 13:46 ` [dpdk-dev] [PATCH 2/3] app/testpmd: add Rx timestamp in testpmd Raslan Darawsheh
2017-08-22 13:46 ` [dpdk-dev] [PATCH 3/3] net/mlx5: add hardware timestamp Raslan Darawsheh
2017-08-23 15:02   ` Nélio Laranjeiro
2017-08-24  7:46   ` [dpdk-dev] [PATCH v2 1/3] ethdev: expose Rx " Raslan Darawsheh
2017-08-24  7:46     ` [dpdk-dev] [PATCH v2 2/3] app/testpmd: add Rx timestamp in testpmd Raslan Darawsheh
2017-08-24 13:49       ` Nélio Laranjeiro
2017-08-24  7:46     ` [dpdk-dev] [PATCH v2 3/3] net/mlx5: add hardware timestamp Raslan Darawsheh
2017-08-24 14:01       ` Nélio Laranjeiro
2017-08-24 13:47     ` [dpdk-dev] [PATCH v2 1/3] ethdev: expose Rx " Nélio Laranjeiro
2017-09-28 16:48     ` [dpdk-dev] [PATCH v3 1/3] ethdev: add Rx HW timestamp capability Raslan Darawsheh
2017-09-28 16:48       ` [dpdk-dev] [PATCH v3 2/3] app/testpmd: add Rx HW timestamp Raslan Darawsheh
2017-09-28 16:48       ` [dpdk-dev] [PATCH v3 3/3] net/mlx5: " Raslan Darawsheh
2017-09-29  7:25       ` [dpdk-dev] [PATCH v3 1/3] ethdev: add Rx HW timestamp capability Andrew Rybchenko
2017-10-01  6:44         ` Shahaf Shuler
2017-10-02 14:50       ` [dpdk-dev] [PATCH " Raslan Darawsheh
2017-10-02 14:50         ` [dpdk-dev] [PATCH 2/3] app/testpmd: add Rx HW timestamp Raslan Darawsheh
2017-10-02 14:50         ` [dpdk-dev] [PATCH 3/3] net/mlx5: " Raslan Darawsheh
2017-10-02 18:48         ` [dpdk-dev] [PATCH 1/3] ethdev: add Rx HW timestamp capability Ferruh Yigit
2017-10-03  0:39           ` Yongseok Koh
2017-10-03  6:33       ` [dpdk-dev] [PATCH v5 " Raslan Darawsheh
2017-10-03  6:33         ` [dpdk-dev] [PATCH v5 2/3] app/testpmd: add Rx HW timestamp Raslan Darawsheh
2017-10-03  6:33         ` [dpdk-dev] [PATCH v5 3/3] net/mlx5: " Raslan Darawsheh
2017-10-03  6:40         ` [dpdk-dev] [PATCH v5 1/3] ethdev: add Rx HW timestamp capability Andrew Rybchenko
2017-10-03  6:53           ` Yongseok Koh
2017-10-03  7:24             ` Andrew Rybchenko
2017-10-03 11:00       ` [dpdk-dev] [PATCH v6 " Raslan Darawsheh
2017-10-03 11:00         ` [dpdk-dev] [PATCH v6 2/3] app/testpmd: add Rx HW timestamp Raslan Darawsheh
2017-10-05 23:11           ` Yongseok Koh
2017-10-03 11:00         ` [dpdk-dev] [PATCH v6 3/3] net/mlx5: " Raslan Darawsheh
2017-10-05 23:23           ` Yongseok Koh
2017-10-08  8:24           ` [dpdk-dev] [PATCH v7 1/3] ethdev: add Rx HW timestamp capability Raslan Darawsheh
2017-10-08  8:24             ` [dpdk-dev] [PATCH v7 2/3] app/testpmd: add Rx HW timestamp Raslan Darawsheh
2017-10-08  8:24             ` [dpdk-dev] [PATCH v7 3/3] net/mlx5: " Raslan Darawsheh
2017-10-09 19:17               ` Ferruh Yigit
2017-10-10  7:45           ` [dpdk-dev] [PATCH v8 1/3] ethdev: add Rx HW timestamp capability Raslan Darawsheh
2017-10-10  7:45             ` [dpdk-dev] [PATCH v8 2/3] app/testpmd: add Rx HW timestamp Raslan Darawsheh
2017-10-10  7:45             ` [dpdk-dev] [PATCH v8 3/3] net/mlx5: " Raslan Darawsheh
2017-10-10 13:33             ` [dpdk-dev] [PATCH v8 1/3] ethdev: add Rx HW timestamp capability Yongseok Koh
2017-10-10 14:37           ` [dpdk-dev] [PATCH v9 " Raslan Darawsheh
2017-10-10 14:37             ` Raslan Darawsheh [this message]
2017-10-10 14:37             ` [dpdk-dev] [PATCH v9 3/3] net/mlx5: add Rx HW timestamp Raslan Darawsheh
2017-10-10 14:40               ` Yongseok Koh
2017-10-11  1:14             ` [dpdk-dev] [PATCH v9 1/3] ethdev: add Rx HW timestamp capability Ferruh Yigit
2017-10-11  1:22               ` Yongseok Koh
2017-10-11  1:30                 ` Ferruh Yigit
2017-10-04  5:57         ` [dpdk-dev] [PATCH v6 " Shahaf Shuler
2017-10-06  0:54         ` Ferruh Yigit
2017-10-02 14:01     ` [dpdk-dev] [PATCH " Raslan Darawsheh
2017-10-02 14:01       ` [dpdk-dev] [PATCH 2/3] app/testpmd: add Rx HW timestamp Raslan Darawsheh
2017-10-02 14:01       ` [dpdk-dev] [PATCH 3/3] net/mlx5: " Raslan Darawsheh

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=1507646227-12338-2-git-send-email-rasland@mellanox.com \
    --to=rasland@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=shahafs@mellanox.com \
    --cc=yskoh@mellanox.com \
    /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).