[dpdk-dev,v2,2/3] app/testpmd: add Rx timestamp in testpmd

Message ID 1503560793-21597-2-git-send-email-rasland@mellanox.com (mailing list archive)
State Superseded, archived
Headers

Checks

Context Check Description
ci/Intel-compilation fail Compilation issues
ci/checkpatch success coding style OK

Commit Message

Raslan Darawsheh Aug. 24, 2017, 7:46 a.m. UTC
Added new print in case a PMD exposes Rx timestamp.
Also, added a print for timestamp value in rxonly mode
in case the packet was timestamped.

Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
---
 app/test-pmd/config.c | 3 +++
 app/test-pmd/rxonly.c | 2 ++
 2 files changed, 5 insertions(+)
  

Comments

Nélio Laranjeiro Aug. 24, 2017, 1:49 p.m. UTC | #1
On Thu, Aug 24, 2017 at 10:46:32AM +0300, Raslan Darawsheh wrote:
> Added new print in case a PMD exposes Rx timestamp.
> Also, added a print for timestamp value in rxonly mode
> in case the packet was timestamped.
> 
> Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
> ---
>  app/test-pmd/config.c | 3 +++
>  app/test-pmd/rxonly.c | 2 ++
>  2 files changed, 5 insertions(+)
> 
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index 3ae3e1c..8a5da5d 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -598,6 +598,9 @@ port_offload_cap_display(portid_t port_id)
>  			printf("off\n");
>  	}
>  
> +	if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TIMESTAMP)
> +		printf("HW timestamp:                  on\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/rxonly.c b/app/test-pmd/rxonly.c
> index 5ef0219..f4d35d7 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)
> -- 
> 2.7.4
 
How can we enable this Rx offload?

Thanks,
  

Patch

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 3ae3e1c..8a5da5d 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -598,6 +598,9 @@  port_offload_cap_display(portid_t port_id)
 			printf("off\n");
 	}
 
+	if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TIMESTAMP)
+		printf("HW timestamp:                  on\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/rxonly.c b/app/test-pmd/rxonly.c
index 5ef0219..f4d35d7 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)