[dpdk-dev,v5,1/3] ethdev: add Rx HW timestamp capability

Message ID 1507012430-8421-1-git-send-email-rasland@mellanox.com (mailing list archive)
State Superseded, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail apply patch file failure

Commit Message

Raslan Darawsheh Oct. 3, 2017, 6:33 a.m. UTC
Add a new offload capability flag for Rx HW
timestamp and enabling/disabling this via rte_eth_rxmode.

Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
---
This patch should be applied after after this series:
http://dpdk.org/dev/patchwork/patch/29368/
---
 doc/guides/nics/features.rst  | 11 +++++++++++
 lib/librte_ether/rte_ethdev.c |  6 ++++++
 lib/librte_ether/rte_ethdev.h |  5 ++++-
 3 files changed, 21 insertions(+), 1 deletion(-)
  

Comments

Andrew Rybchenko Oct. 3, 2017, 6:40 a.m. UTC | #1
On 10/03/2017 09:33 AM, Raslan Darawsheh wrote:
> Add a new offload capability flag for Rx HW
> timestamp and enabling/disabling this via rte_eth_rxmode.
>
> Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
> ---
> This patch should be applied after after this series:
> http://dpdk.org/dev/patchwork/patch/29368/
> ---
>   doc/guides/nics/features.rst  | 11 +++++++++++
>   lib/librte_ether/rte_ethdev.c |  6 ++++++
>   lib/librte_ether/rte_ethdev.h |  5 ++++-
>   3 files changed, 21 insertions(+), 1 deletion(-)

<...>

> diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
> index ffd2ee5..bd63730 100644
> --- a/lib/librte_ether/rte_ethdev.h
> +++ b/lib/librte_ether/rte_ethdev.h
> @@ -368,7 +368,8 @@ struct rte_eth_rxmode {
>   		jumbo_frame      : 1, /**< Jumbo Frame Receipt enable. */
>   		hw_strip_crc     : 1, /**< Enable CRC stripping by hardware. */
>   		enable_scatter   : 1, /**< Enable scatter packets rx handler */
> -		enable_lro       : 1; /**< Enable LRO */
> +		enable_lro       : 1, /**< Enable LRO */
> +		hw_timestamp	 : 1; /**< Enable HW timestamp */

The code is definitely not rebased on top of a new Rx offload API patch 
which adds
      ignore_offload_bitfield : 1;
exactly in this place.


<...>
  
Yongseok Koh Oct. 3, 2017, 6:53 a.m. UTC | #2
> On Oct 2, 2017, at 11:40 PM, Andrew Rybchenko <arybchenko@solarflare.com> wrote:
> 
> On 10/03/2017 09:33 AM, Raslan Darawsheh wrote:
>> Add a new offload capability flag for Rx HW
>> timestamp and enabling/disabling this via rte_eth_rxmode.
>> 
>> Signed-off-by: Raslan Darawsheh 
>> <rasland@mellanox.com>
>> 
>> ---
>> This patch should be applied after after this series:
>> 
>> http://dpdk.org/dev/patchwork/patch/29368/
>> 
>> ---
>>  doc/guides/nics/features.rst  | 11 +++++++++++
>>  lib/librte_ether/rte_ethdev.c |  6 ++++++
>>  lib/librte_ether/rte_ethdev.h |  5 ++++-
>>  3 files changed, 21 insertions(+), 1 deletion(-)
>> 
> 
> <...>
> 
>> diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
>> index ffd2ee5..bd63730 100644
>> --- a/lib/librte_ether/rte_ethdev.h
>> +++ b/lib/librte_ether/rte_ethdev.h
>> @@ -368,7 +368,8 @@ struct rte_eth_rxmode {
>>  		jumbo_frame      : 1, /**< Jumbo Frame Receipt enable. */
>>  		hw_strip_crc     : 1, /**< Enable CRC stripping by hardware. */
>>  		enable_scatter   : 1, /**< Enable scatter packets rx handler */
>> -		enable_lro       : 1; /**< Enable LRO */
>> +		enable_lro       : 1, /**< Enable LRO */
>> +		hw_timestamp	 : 1; /**< Enable HW timestamp */
>> 
> 
> The code is definitely not rebased on top of a new Rx offload API patch which adds
>      ignore_offload_bitfield : 1;
> exactly in this place.

Hi Andrew,
Did you check Shahaf's email regarding this? Looks like Shahaf suggests keeping it as is for now.

> On Sep 30, 2017, at 11:44 PM, Shahaf Shuler <shahafs@mellanox.com> wrote:

> >[1] http://dpdk.org/ml/archives/dev/2017-September/076872.html
>  
> I agree it should be on top of [1].
> Unfortunately since the PMDs will move to the new API only on 18.02, and in the current state Rx offloads are disabled by default, there will be no way to enable this feature without a dedicated bit.
>  
> So my suggestion is to keep the timestamp bit on rxmode, and to update the convert function introduced on [1]. This bit will be removed along with the entire bit-field array once the old offloads API will be deprecated.


Thanks,
Yongseok
  
Andrew Rybchenko Oct. 3, 2017, 7:24 a.m. UTC | #3
On 10/03/2017 09:53 AM, Yongseok Koh wrote:
>> On Oct 2, 2017, at 11:40 PM, Andrew Rybchenko <arybchenko@solarflare.com> wrote:
>>
>> On 10/03/2017 09:33 AM, Raslan Darawsheh wrote:
>>> Add a new offload capability flag for Rx HW
>>> timestamp and enabling/disabling this via rte_eth_rxmode.
>>>
>>> Signed-off-by: Raslan Darawsheh
>>> <rasland@mellanox.com>
>>>
>>> ---
>>> This patch should be applied after after this series:
>>>
>>> http://dpdk.org/dev/patchwork/patch/29368/
>>>
>>> ---
>>>   doc/guides/nics/features.rst  | 11 +++++++++++
>>>   lib/librte_ether/rte_ethdev.c |  6 ++++++
>>>   lib/librte_ether/rte_ethdev.h |  5 ++++-
>>>   3 files changed, 21 insertions(+), 1 deletion(-)
>>>
>> <...>
>>
>>> diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
>>> index ffd2ee5..bd63730 100644
>>> --- a/lib/librte_ether/rte_ethdev.h
>>> +++ b/lib/librte_ether/rte_ethdev.h
>>> @@ -368,7 +368,8 @@ struct rte_eth_rxmode {
>>>   		jumbo_frame      : 1, /**< Jumbo Frame Receipt enable. */
>>>   		hw_strip_crc     : 1, /**< Enable CRC stripping by hardware. */
>>>   		enable_scatter   : 1, /**< Enable scatter packets rx handler */
>>> -		enable_lro       : 1; /**< Enable LRO */
>>> +		enable_lro       : 1, /**< Enable LRO */
>>> +		hw_timestamp	 : 1; /**< Enable HW timestamp */
>>>
>> The code is definitely not rebased on top of a new Rx offload API patch which adds
>>       ignore_offload_bitfield : 1;
>> exactly in this place.
> Hi Andrew,
> Did you check Shahaf's email regarding this? Looks like Shahaf suggests keeping it as is for now.

Yes. But it simply fails to apply on top a new Rx offload API patch.
Above you say that it should be applied after that series.

>> On Sep 30, 2017, at 11:44 PM, Shahaf Shuler <shahafs@mellanox.com> wrote:
>>> [1] http://dpdk.org/ml/archives/dev/2017-September/076872.html
>>   
>> I agree it should be on top of [1].
>> Unfortunately since the PMDs will move to the new API only on 18.02, and in the current state Rx offloads are disabled by default, there will be no way to enable this feature without a dedicated bit.
>>   
>> So my suggestion is to keep the timestamp bit on rxmode, and to update the convert function introduced on [1]. This bit will be removed along with the entire bit-field array once the old offloads API will be deprecated.
>
> Thanks,
> Yongseok
>
  

Patch

diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst
index ba0d19f..fbdd6eb 100644
--- a/doc/guides/nics/features.rst
+++ b/doc/guides/nics/features.rst
@@ -566,6 +566,17 @@  Supports L4 checksum offload.
 * **[provides] rte_eth_dev_info**: ``rx_offload_capa:DEV_RX_OFFLOAD_UDP_CKSUM,DEV_RX_OFFLOAD_TCP_CKSUM``,
   ``tx_offload_capa:DEV_TX_OFFLOAD_UDP_CKSUM,DEV_TX_OFFLOAD_TCP_CKSUM,DEV_TX_OFFLOAD_SCTP_CKSUM``.
 
+.. _nic_features_hw_timestamp:
+
+Timestamp offload
+-----------------
+
+Supports Timestamp.
+
+* **[uses]     rte_eth_rxconf,rte_eth_rxmode**: ``offloads:DEV_RX_OFFLOAD_TIMESTAMP``.
+* **[provides] mbuf**: ``mbuf.ol_flags:PKT_RX_TIMESTAMP``.
+  ``mbuf.timestamp``.
+  **[provides] rte_eth_dev_info**: ``rx_offload_capa:DEV_RX_OFFLOAD_TIMESTAMP``
 
 .. _nic_features_macsec_offload:
 
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 9b73d23..c5c5164 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -715,6 +715,8 @@  rte_eth_convert_rx_offload_bitfield(const struct rte_eth_rxmode *rxmode,
 		offloads |= DEV_RX_OFFLOAD_SCATTER;
 	if (rxmode->enable_lro == 1)
 		offloads |= DEV_RX_OFFLOAD_TCP_LRO;
+	if (rxmode->hw_timestamp == 1)
+		offloads |= DEV_RX_OFFLOAD_TIMESTAMP;
 
 	*rx_offloads = offloads;
 }
@@ -763,6 +765,10 @@  rte_eth_convert_rx_offloads(const uint64_t rx_offloads,
 		rxmode->enable_lro = 1;
 	else
 		rxmode->enable_lro = 0;
+	if (rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP)
+		rxmode->hw_timestamp = 1;
+	else
+		rxmode->hw_timestamp = 0;
 }
 
 int
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index ffd2ee5..bd63730 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -368,7 +368,8 @@  struct rte_eth_rxmode {
 		jumbo_frame      : 1, /**< Jumbo Frame Receipt enable. */
 		hw_strip_crc     : 1, /**< Enable CRC stripping by hardware. */
 		enable_scatter   : 1, /**< Enable scatter packets rx handler */
-		enable_lro       : 1; /**< Enable LRO */
+		enable_lro       : 1, /**< Enable LRO */
+		hw_timestamp	 : 1; /**< Enable HW timestamp */
 };
 
 /**
@@ -924,6 +925,8 @@  struct rte_eth_conf {
 #define DEV_RX_OFFLOAD_QINQ_STRIP  0x00000020
 #define DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM 0x00000040
 #define DEV_RX_OFFLOAD_MACSEC_STRIP     0x00000080
+#define DEV_RX_OFFLOAD_TIMESTAMP 0x00000100
+/**< Device delivers timestamp of packet arrival. */
 
 /**
  * TX offload capabilities of a device.