Message ID | 1440583396-29124-1-git-send-email-zoltan.kiss@linaro.org |
---|---|
State | Accepted |
Commit | 403ed5f4424ea5551d8381cc2feb8e5583811da9 |
Headers | show |
On 26/08/15 12:28, Savolainen, Petri (Nokia - FI/Espoo) wrote: > Did you send v6 again by mistake. Don’t see difference in doxygen comments. Yes, I'll resend the patch. > > I think these should be there now in some format: > > "Overwriting the platform provided value doesn't change how > the platform handles this flow after it." > > " - the implementation can choose not to generate any hash at all > - if set_hash were not called on this packet, it returns what the > platform originally generated (if any)" > > > Could correct also the spelling here, > >> +/** >> + * Set packet flow hash value >> + * >> + * Store the packet flow hash for the packet and sets the flow hash >> flag. This >> + * enables (but does not requires!) application to reflect packet >> header >> + * changes in the hash. > "(but does not require)" > > > -Petri > > >> -----Original Message----- >> From: lng-odp [mailto:lng-odp-bounces@lists.linaro.org] On Behalf Of >> ext Zoltan Kiss >> Sent: Wednesday, August 26, 2015 1:03 PM >> To: lng-odp@lists.linaro.org >> Subject: [lng-odp] [API-NEXT PATCH v7] api: packet: allow access to >> packet flow hash values >> >> Applications can read the computed hash (if any) and set it if they >> want >> to store any extra information in it. >> >> Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org> >> --- >> >> v2: >> - focus on RSS hash only >> - use setter/getter's >> >> v3: >> - do not mention pointers >> - add a note >> - add new patches for implementation and test >> >> v4: I've accidentally skipped this version >> >> v5: >> - use separate flag get and clear, as hash can have any value (that >> maps to >> checking ol_flags in DPDK) >> - change terminology to "flow hash", it reflects better what is >> actually hashed >> - add function to generate hash by the platform >> >> v6: >> - remove stale function definition from the end of packet.h >> - spell out in hash_set that if platform cares about the validity of >> this value, >> it has to maintain it internally. >> - with the above change OVS doesn't need the hash generator function >> anymore, >> so remove that too. We can introduce it later on. >> >> v7: add more comments on Bala's request >> >> include/odp/api/packet.h | 33 +++++++++++++++++++++++++++++++++ >> include/odp/api/packet_flags.h | 18 ++++++++++++++++++ >> 2 files changed, 51 insertions(+) >> >> diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h >> index 3a454b5..c983332 100644 >> --- a/include/odp/api/packet.h >> +++ b/include/odp/api/packet.h >> @@ -605,6 +605,39 @@ uint32_t odp_packet_l4_offset(odp_packet_t pkt); >> int odp_packet_l4_offset_set(odp_packet_t pkt, uint32_t offset); >> >> /** >> + * Packet flow hash value >> + * >> + * Returns the hash generated from the packet header. Use >> + * odp_packet_has_flow_hash() to check if packet contains a hash. >> + * >> + * @param pkt Packet handle >> + * >> + * @return Hash value >> + * >> + * @note Zero can be a valid hash value. >> + * @note The hash algorithm and the header fields defining the flow >> (therefore >> + * used for hashing) is platform dependent. >> + */ >> +uint32_t odp_packet_flow_hash(odp_packet_t pkt); >> + >> +/** >> + * Set packet flow hash value >> + * >> + * Store the packet flow hash for the packet and sets the flow hash >> flag. This >> + * enables (but does not requires!) application to reflect packet >> header >> + * changes in the hash. >> + * >> + * @param pkt Packet handle >> + * @param flow_hash Hash value to set >> + * >> + * @note If the platform needs to keep the original hash value, it has >> to >> + * maintain it internally. >> + * @note The application is not required to keep this hash valid for >> new or >> + * modified packets. >> + */ >> +void odp_packet_flow_hash_set(odp_packet_t pkt, uint32_t flow_hash); >> + >> +/** >> * Tests if packet is segmented >> * >> * @param pkt Packet handle >> diff --git a/include/odp/api/packet_flags.h >> b/include/odp/api/packet_flags.h >> index bfbcc94..7c3b247 100644 >> --- a/include/odp/api/packet_flags.h >> +++ b/include/odp/api/packet_flags.h >> @@ -191,6 +191,15 @@ int odp_packet_has_sctp(odp_packet_t pkt); >> int odp_packet_has_icmp(odp_packet_t pkt); >> >> /** >> + * Check for packet flow hash >> + * >> + * @param pkt Packet handle >> + * @retval non-zero if packet contains a hash value >> + * @retval 0 if packet does not contain a hash value >> + */ >> +int odp_packet_has_flow_hash(odp_packet_t pkt); >> + >> +/** >> * Set flag for L2 header, e.g. ethernet >> * >> * @param pkt Packet handle >> @@ -327,6 +336,15 @@ void odp_packet_has_sctp_set(odp_packet_t pkt, int >> val); >> void odp_packet_has_icmp_set(odp_packet_t pkt, int val); >> >> /** >> + * Clear flag for packet flow hash >> + * >> + * @param pkt Packet handle >> + * >> + * @note Set this flag is only possible through >> odp_packet_flow_hash_set() >> + */ >> +void odp_packet_has_flow_hash_clr(odp_packet_t pkt); >> + >> +/** >> * @} >> */ >> >> -- >> 1.9.1 >> >> _______________________________________________ >> lng-odp mailing list >> lng-odp@lists.linaro.org >> https://lists.linaro.org/mailman/listinfo/lng-odp
diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h index 3a454b5..c983332 100644 --- a/include/odp/api/packet.h +++ b/include/odp/api/packet.h @@ -605,6 +605,39 @@ uint32_t odp_packet_l4_offset(odp_packet_t pkt); int odp_packet_l4_offset_set(odp_packet_t pkt, uint32_t offset); /** + * Packet flow hash value + * + * Returns the hash generated from the packet header. Use + * odp_packet_has_flow_hash() to check if packet contains a hash. + * + * @param pkt Packet handle + * + * @return Hash value + * + * @note Zero can be a valid hash value. + * @note The hash algorithm and the header fields defining the flow (therefore + * used for hashing) is platform dependent. + */ +uint32_t odp_packet_flow_hash(odp_packet_t pkt); + +/** + * Set packet flow hash value + * + * Store the packet flow hash for the packet and sets the flow hash flag. This + * enables (but does not requires!) application to reflect packet header + * changes in the hash. + * + * @param pkt Packet handle + * @param flow_hash Hash value to set + * + * @note If the platform needs to keep the original hash value, it has to + * maintain it internally. + * @note The application is not required to keep this hash valid for new or + * modified packets. + */ +void odp_packet_flow_hash_set(odp_packet_t pkt, uint32_t flow_hash); + +/** * Tests if packet is segmented * * @param pkt Packet handle diff --git a/include/odp/api/packet_flags.h b/include/odp/api/packet_flags.h index bfbcc94..7c3b247 100644 --- a/include/odp/api/packet_flags.h +++ b/include/odp/api/packet_flags.h @@ -191,6 +191,15 @@ int odp_packet_has_sctp(odp_packet_t pkt); int odp_packet_has_icmp(odp_packet_t pkt); /** + * Check for packet flow hash + * + * @param pkt Packet handle + * @retval non-zero if packet contains a hash value + * @retval 0 if packet does not contain a hash value + */ +int odp_packet_has_flow_hash(odp_packet_t pkt); + +/** * Set flag for L2 header, e.g. ethernet * * @param pkt Packet handle @@ -327,6 +336,15 @@ void odp_packet_has_sctp_set(odp_packet_t pkt, int val); void odp_packet_has_icmp_set(odp_packet_t pkt, int val); /** + * Clear flag for packet flow hash + * + * @param pkt Packet handle + * + * @note Set this flag is only possible through odp_packet_flow_hash_set() + */ +void odp_packet_has_flow_hash_clr(odp_packet_t pkt); + +/** * @} */
Applications can read the computed hash (if any) and set it if they want to store any extra information in it. Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org> --- v2: - focus on RSS hash only - use setter/getter's v3: - do not mention pointers - add a note - add new patches for implementation and test v4: I've accidentally skipped this version v5: - use separate flag get and clear, as hash can have any value (that maps to checking ol_flags in DPDK) - change terminology to "flow hash", it reflects better what is actually hashed - add function to generate hash by the platform v6: - remove stale function definition from the end of packet.h - spell out in hash_set that if platform cares about the validity of this value, it has to maintain it internally. - with the above change OVS doesn't need the hash generator function anymore, so remove that too. We can introduce it later on. v7: add more comments on Bala's request include/odp/api/packet.h | 33 +++++++++++++++++++++++++++++++++ include/odp/api/packet_flags.h | 18 ++++++++++++++++++ 2 files changed, 51 insertions(+)