diff mbox

[API-NEXT,v2] api: packet: allow access to packet RSS hash values

Message ID 1439488346-5676-1-git-send-email-zoltan.kiss@linaro.org
State New
Headers show

Commit Message

Zoltan Kiss Aug. 13, 2015, 5:52 p.m. UTC
Applications can read the computed hash (if any) and set it if they
changed the packet headers or if the platform haven't calculated the hash.

Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org>
---

v2:
- focus on RSS hash only
- use setter/getter's

 include/odp/api/packet.h | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

Comments

Bill Fischofer Aug. 13, 2015, 7:59 p.m. UTC | #1
On Thu, Aug 13, 2015 at 12:52 PM, Zoltan Kiss <zoltan.kiss@linaro.org>
wrote:

> Applications can read the computed hash (if any) and set it if they
> changed the packet headers or if the platform haven't calculated the hash.
>
> Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org>
> ---
>
> v2:
> - focus on RSS hash only
> - use setter/getter's
>
>  include/odp/api/packet.h | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
>
> diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h
> index 3a454b5..c6e8a4b 100644
> --- a/include/odp/api/packet.h
> +++ b/include/odp/api/packet.h
> @@ -48,6 +48,11 @@ extern "C" {
>   * Invalid packet segment
>   */
>
> +/**
> + * @def ODP_PACKET_RSS_INVALID
> + * RSS hash is not set
> + */
> +
>  /*
>   *
>   * Alloc and free
> @@ -605,6 +610,29 @@ uint32_t odp_packet_l4_offset(odp_packet_t pkt);
>  int odp_packet_l4_offset_set(odp_packet_t pkt, uint32_t offset);
>
>  /**
> + * RSS hash value
> + *
> + * Returns the RSS hash stored for the packet.
> + *
> + * @param      pkt      Packet handle
> + *
> + * @return  Hash pointer
>

Should be @return Hash value


> + * @retval ODP_PACKET_RSS_INVALID if RSS hash is not set.
> + */
> +uint32_t odp_packet_rss_hash(odp_packet_t pkt);
> +
> +/**
> + * Set RSS hash value
> + *
> + * Store the RSS hash for the packet.
> + *
> + * @param      pkt      Packet handle
> + * @param      rss_hash Hash value to set
> + *
> + */
> +void odp_packet_rss_hash_set(odp_packet_t pkt, uint32_t rss_hash);
> +
> +/**
>   * Tests if packet is segmented
>   *
>   * @param pkt  Packet handle
> --
> 1.9.1
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
Maxim Uvarov Aug. 14, 2015, 3:06 p.m. UTC | #2
Should it be per pktio rss hash then per packet?

I'm reading here:
https://www.kernel.org/doc/Documentation/networking/scaling.txt

that rss is hash per device how to split traffic. If it's per device 
than in odp terms it's for pktio.

Maxim.

On 08/13/15 22:59, Bill Fischofer wrote:
>
>
> On Thu, Aug 13, 2015 at 12:52 PM, Zoltan Kiss <zoltan.kiss@linaro.org 
> <mailto:zoltan.kiss@linaro.org>> wrote:
>
>     Applications can read the computed hash (if any) and set it if they
>     changed the packet headers or if the platform haven't calculated
>     the hash.
>
>     Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org
>     <mailto:zoltan.kiss@linaro.org>>
>     ---
>
>     v2:
>     - focus on RSS hash only
>     - use setter/getter's
>
>      include/odp/api/packet.h | 28 ++++++++++++++++++++++++++++
>      1 file changed, 28 insertions(+)
>
>     diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h
>     index 3a454b5..c6e8a4b 100644
>     --- a/include/odp/api/packet.h
>     +++ b/include/odp/api/packet.h
>     @@ -48,6 +48,11 @@ extern "C" {
>       * Invalid packet segment
>       */
>
>     +/**
>     + * @def ODP_PACKET_RSS_INVALID
>     + * RSS hash is not set
>     + */
>     +
>      /*
>       *
>       * Alloc and free
>     @@ -605,6 +610,29 @@ uint32_t odp_packet_l4_offset(odp_packet_t pkt);
>      int odp_packet_l4_offset_set(odp_packet_t pkt, uint32_t offset);
>
>      /**
>     + * RSS hash value
>     + *
>     + * Returns the RSS hash stored for the packet.
>     + *
>     + * @param      pkt      Packet handle
>     + *
>     + * @return  Hash pointer
>
>
> Should be @return Hash value
>
>     + * @retval ODP_PACKET_RSS_INVALID if RSS hash is not set.
>     + */
>     +uint32_t odp_packet_rss_hash(odp_packet_t pkt);
>     +
>     +/**
>     + * Set RSS hash value
>     + *
>     + * Store the RSS hash for the packet.
>     + *
>     + * @param      pkt      Packet handle
>     + * @param      rss_hash Hash value to set
>     + *
>     + */
>     +void odp_packet_rss_hash_set(odp_packet_t pkt, uint32_t rss_hash);
>     +
>     +/**
>       * Tests if packet is segmented
>       *
>       * @param pkt  Packet handle
>     --
>     1.9.1
>
>     _______________________________________________
>     lng-odp mailing list
>     lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>     https://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
Zoltan Kiss Aug. 14, 2015, 3:12 p.m. UTC | #3
No, you need the hash of a particular packet you process:

"The filter used in RSS is typically a hash function over the network
and/or transport layer headers-- for example, a 4-tuple hash over
IP addresses and TCP ports of a packet"

On 14/08/15 16:06, Maxim Uvarov wrote:
> Should it be per pktio rss hash then per packet?
>
> I'm reading here:
> https://www.kernel.org/doc/Documentation/networking/scaling.txt
>
> that rss is hash per device how to split traffic. If it's per device
> than in odp terms it's for pktio.
>
> Maxim.
>
> On 08/13/15 22:59, Bill Fischofer wrote:
>>
>>
>> On Thu, Aug 13, 2015 at 12:52 PM, Zoltan Kiss <zoltan.kiss@linaro.org
>> <mailto:zoltan.kiss@linaro.org>> wrote:
>>
>>     Applications can read the computed hash (if any) and set it if they
>>     changed the packet headers or if the platform haven't calculated
>>     the hash.
>>
>>     Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org
>>     <mailto:zoltan.kiss@linaro.org>>
>>     ---
>>
>>     v2:
>>     - focus on RSS hash only
>>     - use setter/getter's
>>
>>      include/odp/api/packet.h | 28 ++++++++++++++++++++++++++++
>>      1 file changed, 28 insertions(+)
>>
>>     diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h
>>     index 3a454b5..c6e8a4b 100644
>>     --- a/include/odp/api/packet.h
>>     +++ b/include/odp/api/packet.h
>>     @@ -48,6 +48,11 @@ extern "C" {
>>       * Invalid packet segment
>>       */
>>
>>     +/**
>>     + * @def ODP_PACKET_RSS_INVALID
>>     + * RSS hash is not set
>>     + */
>>     +
>>      /*
>>       *
>>       * Alloc and free
>>     @@ -605,6 +610,29 @@ uint32_t odp_packet_l4_offset(odp_packet_t pkt);
>>      int odp_packet_l4_offset_set(odp_packet_t pkt, uint32_t offset);
>>
>>      /**
>>     + * RSS hash value
>>     + *
>>     + * Returns the RSS hash stored for the packet.
>>     + *
>>     + * @param      pkt      Packet handle
>>     + *
>>     + * @return  Hash pointer
>>
>>
>> Should be @return Hash value
>>
>>     + * @retval ODP_PACKET_RSS_INVALID if RSS hash is not set.
>>     + */
>>     +uint32_t odp_packet_rss_hash(odp_packet_t pkt);
>>     +
>>     +/**
>>     + * Set RSS hash value
>>     + *
>>     + * Store the RSS hash for the packet.
>>     + *
>>     + * @param      pkt      Packet handle
>>     + * @param      rss_hash Hash value to set
>>     + *
>>     + */
>>     +void odp_packet_rss_hash_set(odp_packet_t pkt, uint32_t rss_hash);
>>     +
>>     +/**
>>       * Tests if packet is segmented
>>       *
>>       * @param pkt  Packet handle
>>     --
>>     1.9.1
>>
>>     _______________________________________________
>>     lng-odp mailing list
>>     lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>>     https://lists.linaro.org/mailman/listinfo/lng-odp
>>
>>
>>
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> https://lists.linaro.org/mailman/listinfo/lng-odp
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
Maxim Uvarov Aug. 14, 2015, 3:45 p.m. UTC | #4
On 08/14/15 18:12, Zoltan Kiss wrote:
> No, you need the hash of a particular packet you process:
>
> "The filter used in RSS is typically a hash function over the network
> and/or transport layer headers-- for example, a 4-tuple hash over
> IP addresses and TCP ports of a packet"

ok, it's not hash function how to distribute packets. It's actual hash 
value, i.e. flow id.
Got it now.

Maxim.

>
> On 14/08/15 16:06, Maxim Uvarov wrote:
>> Should it be per pktio rss hash then per packet?
>>
>> I'm reading here:
>> https://www.kernel.org/doc/Documentation/networking/scaling.txt
>>
>> that rss is hash per device how to split traffic. If it's per device
>> than in odp terms it's for pktio.
>>
>> Maxim.
>>
>> On 08/13/15 22:59, Bill Fischofer wrote:
>>>
>>>
>>> On Thu, Aug 13, 2015 at 12:52 PM, Zoltan Kiss <zoltan.kiss@linaro.org
>>> <mailto:zoltan.kiss@linaro.org>> wrote:
>>>
>>>     Applications can read the computed hash (if any) and set it if they
>>>     changed the packet headers or if the platform haven't calculated
>>>     the hash.
>>>
>>>     Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org
>>>     <mailto:zoltan.kiss@linaro.org>>
>>>     ---
>>>
>>>     v2:
>>>     - focus on RSS hash only
>>>     - use setter/getter's
>>>
>>>      include/odp/api/packet.h | 28 ++++++++++++++++++++++++++++
>>>      1 file changed, 28 insertions(+)
>>>
>>>     diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h
>>>     index 3a454b5..c6e8a4b 100644
>>>     --- a/include/odp/api/packet.h
>>>     +++ b/include/odp/api/packet.h
>>>     @@ -48,6 +48,11 @@ extern "C" {
>>>       * Invalid packet segment
>>>       */
>>>
>>>     +/**
>>>     + * @def ODP_PACKET_RSS_INVALID
>>>     + * RSS hash is not set
>>>     + */
>>>     +
>>>      /*
>>>       *
>>>       * Alloc and free
>>>     @@ -605,6 +610,29 @@ uint32_t odp_packet_l4_offset(odp_packet_t 
>>> pkt);
>>>      int odp_packet_l4_offset_set(odp_packet_t pkt, uint32_t offset);
>>>
>>>      /**
>>>     + * RSS hash value
>>>     + *
>>>     + * Returns the RSS hash stored for the packet.
>>>     + *
>>>     + * @param      pkt      Packet handle
>>>     + *
>>>     + * @return  Hash pointer
>>>
>>>
>>> Should be @return Hash value
>>>
>>>     + * @retval ODP_PACKET_RSS_INVALID if RSS hash is not set.
>>>     + */
>>>     +uint32_t odp_packet_rss_hash(odp_packet_t pkt);
>>>     +
>>>     +/**
>>>     + * Set RSS hash value
>>>     + *
>>>     + * Store the RSS hash for the packet.
>>>     + *
>>>     + * @param      pkt      Packet handle
>>>     + * @param      rss_hash Hash value to set
>>>     + *
>>>     + */
>>>     +void odp_packet_rss_hash_set(odp_packet_t pkt, uint32_t rss_hash);
>>>     +
>>>     +/**
>>>       * Tests if packet is segmented
>>>       *
>>>       * @param pkt  Packet handle
>>>     --
>>>     1.9.1
>>>
>>>     _______________________________________________
>>>     lng-odp mailing list
>>>     lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>>>     https://lists.linaro.org/mailman/listinfo/lng-odp
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> lng-odp mailing list
>>> lng-odp@lists.linaro.org
>>> https://lists.linaro.org/mailman/listinfo/lng-odp
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> https://lists.linaro.org/mailman/listinfo/lng-odp
diff mbox

Patch

diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h
index 3a454b5..c6e8a4b 100644
--- a/include/odp/api/packet.h
+++ b/include/odp/api/packet.h
@@ -48,6 +48,11 @@  extern "C" {
  * Invalid packet segment
  */
 
+/**
+ * @def ODP_PACKET_RSS_INVALID
+ * RSS hash is not set
+ */
+
 /*
  *
  * Alloc and free
@@ -605,6 +610,29 @@  uint32_t odp_packet_l4_offset(odp_packet_t pkt);
 int odp_packet_l4_offset_set(odp_packet_t pkt, uint32_t offset);
 
 /**
+ * RSS hash value
+ *
+ * Returns the RSS hash stored for the packet.
+ *
+ * @param      pkt      Packet handle
+ *
+ * @return  Hash pointer
+ * @retval ODP_PACKET_RSS_INVALID if RSS hash is not set.
+ */
+uint32_t odp_packet_rss_hash(odp_packet_t pkt);
+
+/**
+ * Set RSS hash value
+ *
+ * Store the RSS hash for the packet.
+ *
+ * @param      pkt      Packet handle
+ * @param      rss_hash Hash value to set
+ *
+ */
+void odp_packet_rss_hash_set(odp_packet_t pkt, uint32_t rss_hash);
+
+/**
  * Tests if packet is segmented
  *
  * @param pkt  Packet handle