diff mbox series

[RFC/API-NEXTv3,1/3] api: classification: add support for packet hashing in classification

Message ID 1500023530-29025-1-git-send-email-bala.manoharan@linaro.org
State New
Headers show
Series [RFC/API-NEXTv3,1/3] api: classification: add support for packet hashing in classification | expand

Commit Message

Balasubramanian Manoharan July 14, 2017, 9:12 a.m. UTC
Enable packet hashing per CoS to be able to distribute incoming packets to
multiple queues linked with a CoS.

Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>

---
 include/odp/api/spec/classification.h |   96 +++++++++++++++++++++++++++++++--
 include/odp/api/spec/packet_io.h      |   21 ++++++++
 2 files changed, 112 insertions(+), 5 deletions(-)

-- 
1.7.9.5

Comments

Savolainen, Petri (Nokia - FI/Espoo) July 14, 2017, 1:48 p.m. UTC | #1
> -----Original Message-----

> From: lng-odp [mailto:lng-odp-bounces@lists.linaro.org] On Behalf Of

> Balasubramanian Manoharan

> Sent: Friday, July 14, 2017 12:12 PM

> To: lng-odp@lists.linaro.org

> Subject: [lng-odp] [RFC/API-NEXTv3 1/3] api: classification: add support

> for packet hashing in classification

> 

> Enable packet hashing per CoS to be able to distribute incoming packets to

> multiple queues linked with a CoS.

> 

> Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>

> ---

>  include/odp/api/spec/classification.h |   96

> +++++++++++++++++++++++++++++++--

>  include/odp/api/spec/packet_io.h      |   21 ++++++++

>  2 files changed, 112 insertions(+), 5 deletions(-)

> 

> diff --git a/include/odp/api/spec/classification.h

> b/include/odp/api/spec/classification.h

> index 39831b2..d31965e 100644

> --- a/include/odp/api/spec/classification.h

> +++ b/include/odp/api/spec/classification.h

> @@ -4,7 +4,6 @@

>   * SPDX-License-Identifier:     BSD-3-Clause

>   */

> 

> -

>  /**

>   * @file

>   *

> @@ -19,12 +18,13 @@

>  extern "C" {

>  #endif

> 

> +#include <odp/api/packet_io.h>

> +#include <odp/api/support.h>

>  /** @defgroup odp_classification ODP CLASSIFICATION

>   *  Classification operations.

>   *  @{

>   */

> 

> -

>  /**

>   * @typedef odp_cos_t

>   * ODP Class of service handle

> @@ -126,6 +126,19 @@ typedef struct odp_cls_capability_t {

>  	/** Maximum number of CoS supported */

>  	unsigned max_cos;

> 

> +	/* support mode for plain queue */

> +	odp_support_t plain_queue;

> +

> +	/* support mode for sched queue */

> +	odp_support_t sched_queue;



This would be the first time we'd allow that a target queue type may be limited. I'd rather not do this. If e.g. sched queue are not good for cls, why not then do the same for all other APIs with target queues, and result a valid ODP implementation where application cannot use scheduled queues in  communication with ODP (results from pktin, cls, crypto, ipsec, timer, ... should be polled).


> +

> +	/** Maximun number of queue supported per CoS

> +	 * if the value is 1, then hashing is not supported*/

> +	unsigned max_queue_supported;


This is apparently max queues for hashing, so the variable should be "max_hash_queues" or similar.

> +

> +	/** Protocol header combination supported for Hashing */

> +	odp_pktin_hash_proto_t hash_supported;


hash_protocols or hash_proto, "supported" is not needed in variable name.


> +

>  	/** A Boolean to denote support of PMR range */

>  	odp_bool_t pmr_range_supported;

>  } odp_cls_capability_t;

> @@ -164,9 +177,40 @@ typedef enum {

>   * Used to communicate class of service creation options

>   */

>  typedef struct odp_cls_cos_param {

> -	odp_queue_t queue;	/**< Queue associated with CoS */

> -	odp_pool_t pool;	/**< Pool associated with CoS */

> -	odp_cls_drop_t drop_policy;	/**< Drop policy associated

> with CoS */

> +	/* Number of queues to be linked to this CoS.

> +	 * If the number is greater than 1 then hashing has to be

> +	 * configured. If number is equal to 1 then hashing is disabled

> +	 * and queue has to be configured by the application.

> +	 * When hashing is enabled the queues are created by the

> implementation

> +	 * then application need not configure any queue to this CoS.

> +	 * Depening on the implementation this number might be rounded-

> off to

> +	 * nearest supported value (e.g power of 2)

> +	 * */

> +	uint32_t num_queue;

> +

> +	/** Queue type */

> +	odp_queue_type_t queue_type;

> +

> +	/** ODP Queue dequeue mode

> +	 *  This value is valid only for PLAIN queue types */

> +	odp_queue_op_mode_t deq_mode;

> +

> +	/** Schedule parameters for the queue created */

> +	odp_schedule_param_t sched_param;



Better use odp_queue_param_t instead of individual types.


> +

> +	/* Protocol header fields which are included in packet input

> +	 * hash calculation */

> +	odp_hash_proto_t hash_proto;



This cannot be enum, but odp_pktin_hash_proto_t since application may need to enable hashing e.g. for both IPv4 and IPv6 simultaneously.


> +

> +	/* If hashing is disabled, then application has to configure

> +	 * this queue and packets are delivered to this queue */

> +	odp_queue_t queue;

> +

> +	/* Pool associated with CoS */

> +	odp_pool_t pool;

> +

> +	/* Drop policy associated with CoS */

> +	odp_cls_drop_t drop_policy;

>  } odp_cls_cos_param_t;

> 

>  /**

> @@ -209,6 +253,23 @@ int odp_cls_capability(odp_cls_capability_t

> *capability);

>  odp_cos_t odp_cls_cos_create(const char *name, odp_cls_cos_param_t

> *param);

> 

>  /**

> + * Queue hash result

> + * Returns the queue within a CoS in which a particular packet will be

> enqueued

> + * based on the packet parameters and hash protocol field configured with

> the

> + * class of service.

> + *

> + * @param	cos	class of service

> + * @param	packet	Packet handle

> + *

> + * @retval		Returns the queue handle on which this

> packet will be

> + *			enqueued.

> + * @retval		ODP_QUEUE_INVALID for error case

> + *

> + * @note The packet has to be updated with valid header pointers L2, L3

> and L4.

> + */

> +odp_queue_t odp_queue_hash_result(odp_cos_t cos, odp_packet_t packet);


It's part of CLS API ... odp_cls_hash_result() or may be odp_cls_dest_queue() is better since this should work also when hashing is not used, right?


> +

> +/**

>   * Discard a class-of-service along with all its associated resources

>   *

>   * @param[in]	cos_id	class-of-service instance.

> @@ -245,6 +306,31 @@ int odp_cos_queue_set(odp_cos_t cos_id, odp_queue_t

> queue_id);

>  odp_queue_t odp_cos_queue(odp_cos_t cos_id);

> 

>  /**

> + * Get the number of queues linked with the specific class-of-service

> + *

> + * @param	cos_id		class-of-service instance.

> + *

> + * @return			Number of queues linked with

> the class-of-service.

> + */

> +uint32_t odp_cos_num_queue(odp_cos_t cos_id);


I'd label all new CLS functions with odp_cls_ ... odp_cls_num_cos_queues()

> +

> +/**

> + * Get the list of queue associated with the specific class-of-service

> + *

> + * @param[in]	cos_id		class-of-service instance.

> + *

> + * @param[out]	queue		Array of queue handles

> associated

> + *				with the class-of-service.

> + *

> + * @param[in]	num		Maximum number of queue handles

> to output.

> + *

> + * @return			Number of queues linked with

> CoS

> + * @retval	<0		on failure

> + */

> +uint32_t odp_cos_queue_multi(odp_cos_t cos_id,

> +			     odp_queue_t queue[], uint32_t num);


Multi is reserved for multi-event/packet/... operations. This would be e.g. odp_cls_cos_queues()


> +

> +/**

>   * Assign packet drop policy for specific class-of-service

>   *

>   * @param[in]	cos_id		class-of-service instance.

> diff --git a/include/odp/api/spec/packet_io.h

> b/include/odp/api/spec/packet_io.h

> index 8802089..1a40a1f 100644

> --- a/include/odp/api/spec/packet_io.h

> +++ b/include/odp/api/spec/packet_io.h

> @@ -131,6 +131,27 @@ typedef union odp_pktin_hash_proto_t {

>  } odp_pktin_hash_proto_t;

> 

>  /**

> + * Packet hash protocols

> + *

> + * The list of protocol header field combination in enum format, which

> are

> + * included in packet hash calculation.

> + */

> +typedef enum odp_hash_proto_t {

> +	/** IPv4 address and UDP port numbers */

> +	ODP_HASH_PROTO_IPV4_UDP,

> +	/** IPv4 addresses and TCP port numbers */

> +	ODP_HASH_PROTO_IPV4_TCP,

> +	/** IPv4 addresses */

> +	ODP_HASH_PROTO_IPV4,

> +	/** IPv6 addresses and UDP port numbers */

> +	ODP_HASH_PROTO_IPV6_UDP,

> +	/** IPv6 addresses and TCP port numbers */

> +	ODP_HASH_PROTO_IPV6_TCP,

> +	/** IPv6 addresses */

> +	ODP_HASH_PROTO_IPV6

> +} odp_hash_proto_t;


This is not needed as multiple protocols need to be selected at the same time.

-Petri


> +

> +/**

>   * Packet IO operation mode

>   */

>  typedef enum odp_pktio_op_mode_t {

> --

> 1.7.9.5
Balasubramanian Manoharan July 14, 2017, 2:17 p.m. UTC | #2
On 14 July 2017 at 19:18, Savolainen, Petri (Nokia - FI/Espoo) <
petri.savolainen@nokia.com> wrote:

>

>

> > -----Original Message-----

> > From: lng-odp [mailto:lng-odp-bounces@lists.linaro.org] On Behalf Of

> > Balasubramanian Manoharan

> > Sent: Friday, July 14, 2017 12:12 PM

> > To: lng-odp@lists.linaro.org

> > Subject: [lng-odp] [RFC/API-NEXTv3 1/3] api: classification: add support

> > for packet hashing in classification

> >

> > Enable packet hashing per CoS to be able to distribute incoming packets

> to

> > multiple queues linked with a CoS.

> >

> > Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>

> > ---

> >  include/odp/api/spec/classification.h |   96

> > +++++++++++++++++++++++++++++++--

> >  include/odp/api/spec/packet_io.h      |   21 ++++++++

> >  2 files changed, 112 insertions(+), 5 deletions(-)

> >

> > diff --git a/include/odp/api/spec/classification.h

> > b/include/odp/api/spec/classification.h

> > index 39831b2..d31965e 100644

> > --- a/include/odp/api/spec/classification.h

> > +++ b/include/odp/api/spec/classification.h

> > @@ -4,7 +4,6 @@

> >   * SPDX-License-Identifier:     BSD-3-Clause

> >   */

> >

> > -

> >  /**

> >   * @file

> >   *

> > @@ -19,12 +18,13 @@

> >  extern "C" {

> >  #endif

> >

> > +#include <odp/api/packet_io.h>

> > +#include <odp/api/support.h>

> >  /** @defgroup odp_classification ODP CLASSIFICATION

> >   *  Classification operations.

> >   *  @{

> >   */

> >

> > -

> >  /**

> >   * @typedef odp_cos_t

> >   * ODP Class of service handle

> > @@ -126,6 +126,19 @@ typedef struct odp_cls_capability_t {

> >       /** Maximum number of CoS supported */

> >       unsigned max_cos;

> >

> > +     /* support mode for plain queue */

> > +     odp_support_t plain_queue;

> > +

> > +     /* support mode for sched queue */

> > +     odp_support_t sched_queue;

>

>

> This would be the first time we'd allow that a target queue type may be

> limited. I'd rather not do this. If e.g. sched queue are not good for cls,

> why not then do the same for all other APIs with target queues, and result

> a valid ODP implementation where application cannot use scheduled queues

> in  communication with ODP (results from pktin, cls, crypto, ipsec, timer,

> ... should be polled).

>


This is required since there are implementation which will not be able to
support poll queues for hashing or vice versa.
If we remove this capability then the only way to support will be to fail
cos creation when hashing is enabled with poll queues or vice versa.


>

> > +

> > +     /** Maximun number of queue supported per CoS

> > +      * if the value is 1, then hashing is not supported*/

> > +     unsigned max_queue_supported;

>

> This is apparently max queues for hashing, so the variable should be

> "max_hash_queues" or similar.

>


Okay.


>

> > +

> > +     /** Protocol header combination supported for Hashing */

> > +     odp_pktin_hash_proto_t hash_supported;

>

> hash_protocols or hash_proto, "supported" is not needed in variable name.

>


Okay.

>

>

> > +

> >       /** A Boolean to denote support of PMR range */

> >       odp_bool_t pmr_range_supported;

> >  } odp_cls_capability_t;

> > @@ -164,9 +177,40 @@ typedef enum {

> >   * Used to communicate class of service creation options

> >   */

> >  typedef struct odp_cls_cos_param {

> > -     odp_queue_t queue;      /**< Queue associated with CoS */

> > -     odp_pool_t pool;        /**< Pool associated with CoS */

> > -     odp_cls_drop_t drop_policy;     /**< Drop policy associated

> > with CoS */

> > +     /* Number of queues to be linked to this CoS.

> > +      * If the number is greater than 1 then hashing has to be

> > +      * configured. If number is equal to 1 then hashing is disabled

> > +      * and queue has to be configured by the application.

> > +      * When hashing is enabled the queues are created by the

> > implementation

> > +      * then application need not configure any queue to this CoS.

> > +      * Depening on the implementation this number might be rounded-

> > off to

> > +      * nearest supported value (e.g power of 2)

> > +      * */

> > +     uint32_t num_queue;

> > +

> > +     /** Queue type */

> > +     odp_queue_type_t queue_type;

> > +

> > +     /** ODP Queue dequeue mode

> > +      *  This value is valid only for PLAIN queue types */

> > +     odp_queue_op_mode_t deq_mode;

> > +

> > +     /** Schedule parameters for the queue created */

> > +     odp_schedule_param_t sched_param;

>

>

> Better use odp_queue_param_t instead of individual types.

>


Okay.

>

>

> > +

> > +     /* Protocol header fields which are included in packet input

> > +      * hash calculation */

> > +     odp_hash_proto_t hash_proto;

>

>

> This cannot be enum, but odp_pktin_hash_proto_t since application may need

> to enable hashing e.g. for both IPv4 and IPv6 simultaneously.

>


Okay. I can change it for now but maybe we need to revisit
odp_pktin_hash_proto_t since it contains ipv4_tcp and ipv4_udp as separate
bitfields instead if application can combine multiple fields then it should
have been ipv4, tcp, udp etc.


>

>

> > +

> > +     /* If hashing is disabled, then application has to configure

> > +      * this queue and packets are delivered to this queue */

> > +     odp_queue_t queue;

> > +

> > +     /* Pool associated with CoS */

> > +     odp_pool_t pool;

> > +

> > +     /* Drop policy associated with CoS */

> > +     odp_cls_drop_t drop_policy;

> >  } odp_cls_cos_param_t;

> >

> >  /**

> > @@ -209,6 +253,23 @@ int odp_cls_capability(odp_cls_capability_t

> > *capability);

> >  odp_cos_t odp_cls_cos_create(const char *name, odp_cls_cos_param_t

> > *param);

> >

> >  /**

> > + * Queue hash result

> > + * Returns the queue within a CoS in which a particular packet will be

> > enqueued

> > + * based on the packet parameters and hash protocol field configured

> with

> > the

> > + * class of service.

> > + *

> > + * @param    cos     class of service

> > + * @param    packet  Packet handle

> > + *

> > + * @retval           Returns the queue handle on which this

> > packet will be

> > + *                   enqueued.

> > + * @retval           ODP_QUEUE_INVALID for error case

> > + *

> > + * @note The packet has to be updated with valid header pointers L2, L3

> > and L4.

> > + */

> > +odp_queue_t odp_queue_hash_result(odp_cos_t cos, odp_packet_t packet);

>

> It's part of CLS API ... odp_cls_hash_result() or may be

> odp_cls_dest_queue() is better since this should work also when hashing is

> not used, right?

>

>

> > +

> > +/**

> >   * Discard a class-of-service along with all its associated resources

> >   *

> >   * @param[in]        cos_id  class-of-service instance.

> > @@ -245,6 +306,31 @@ int odp_cos_queue_set(odp_cos_t cos_id, odp_queue_t

> > queue_id);

> >  odp_queue_t odp_cos_queue(odp_cos_t cos_id);

> >

> >  /**

> > + * Get the number of queues linked with the specific class-of-service

> > + *

> > + * @param    cos_id          class-of-service instance.

> > + *

> > + * @return                   Number of queues linked with

> > the class-of-service.

> > + */

> > +uint32_t odp_cos_num_queue(odp_cos_t cos_id);

>

> I'd label all new CLS functions with odp_cls_ ... odp_cls_num_cos_queues()

>

> > +

> > +/**

> > + * Get the list of queue associated with the specific class-of-service

> > + *

> > + * @param[in]        cos_id          class-of-service instance.

> > + *

> > + * @param[out]       queue           Array of queue handles

> > associated

> > + *                           with the class-of-service.

> > + *

> > + * @param[in]        num             Maximum number of queue handles

> > to output.

> > + *

> > + * @return                   Number of queues linked with

> > CoS

> > + * @retval   <0              on failure

> > + */

> > +uint32_t odp_cos_queue_multi(odp_cos_t cos_id,

> > +                          odp_queue_t queue[], uint32_t num);

>

> Multi is reserved for multi-event/packet/... operations. This would be

> e.g. odp_cls_cos_queues()

>


There is an existing odp_cls_cos_queue() which returns a single queue maybe
I will deprecate the exising API and create a new API odp_cls_cos_queues()


>

>

> > +

> > +/**

> >   * Assign packet drop policy for specific class-of-service

> >   *

> >   * @param[in]        cos_id          class-of-service instance.

> > diff --git a/include/odp/api/spec/packet_io.h

> > b/include/odp/api/spec/packet_io.h

> > index 8802089..1a40a1f 100644

> > --- a/include/odp/api/spec/packet_io.h

> > +++ b/include/odp/api/spec/packet_io.h

> > @@ -131,6 +131,27 @@ typedef union odp_pktin_hash_proto_t {

> >  } odp_pktin_hash_proto_t;

> >

> >  /**

> > + * Packet hash protocols

> > + *

> > + * The list of protocol header field combination in enum format, which

> > are

> > + * included in packet hash calculation.

> > + */

> > +typedef enum odp_hash_proto_t {

> > +     /** IPv4 address and UDP port numbers */

> > +     ODP_HASH_PROTO_IPV4_UDP,

> > +     /** IPv4 addresses and TCP port numbers */

> > +     ODP_HASH_PROTO_IPV4_TCP,

> > +     /** IPv4 addresses */

> > +     ODP_HASH_PROTO_IPV4,

> > +     /** IPv6 addresses and UDP port numbers */

> > +     ODP_HASH_PROTO_IPV6_UDP,

> > +     /** IPv6 addresses and TCP port numbers */

> > +     ODP_HASH_PROTO_IPV6_TCP,

> > +     /** IPv6 addresses */

> > +     ODP_HASH_PROTO_IPV6

> > +} odp_hash_proto_t;

>

> This is not needed as multiple protocols need to be selected at the same

> time.

>

> -Petri

>

>

> > +

> > +/**

> >   * Packet IO operation mode

> >   */

> >  typedef enum odp_pktio_op_mode_t {

> > --

> > 1.7.9.5

>

>
diff mbox series

Patch

diff --git a/include/odp/api/spec/classification.h b/include/odp/api/spec/classification.h
index 39831b2..d31965e 100644
--- a/include/odp/api/spec/classification.h
+++ b/include/odp/api/spec/classification.h
@@ -4,7 +4,6 @@ 
  * SPDX-License-Identifier:     BSD-3-Clause
  */
 
-
 /**
  * @file
  *
@@ -19,12 +18,13 @@ 
 extern "C" {
 #endif
 
+#include <odp/api/packet_io.h>
+#include <odp/api/support.h>
 /** @defgroup odp_classification ODP CLASSIFICATION
  *  Classification operations.
  *  @{
  */
 
-
 /**
  * @typedef odp_cos_t
  * ODP Class of service handle
@@ -126,6 +126,19 @@  typedef struct odp_cls_capability_t {
 	/** Maximum number of CoS supported */
 	unsigned max_cos;
 
+	/* support mode for plain queue */
+	odp_support_t plain_queue;
+
+	/* support mode for sched queue */
+	odp_support_t sched_queue;
+
+	/** Maximun number of queue supported per CoS
+	 * if the value is 1, then hashing is not supported*/
+	unsigned max_queue_supported;
+
+	/** Protocol header combination supported for Hashing */
+	odp_pktin_hash_proto_t hash_supported;
+
 	/** A Boolean to denote support of PMR range */
 	odp_bool_t pmr_range_supported;
 } odp_cls_capability_t;
@@ -164,9 +177,40 @@  typedef enum {
  * Used to communicate class of service creation options
  */
 typedef struct odp_cls_cos_param {
-	odp_queue_t queue;	/**< Queue associated with CoS */
-	odp_pool_t pool;	/**< Pool associated with CoS */
-	odp_cls_drop_t drop_policy;	/**< Drop policy associated with CoS */
+	/* Number of queues to be linked to this CoS.
+	 * If the number is greater than 1 then hashing has to be
+	 * configured. If number is equal to 1 then hashing is disabled
+	 * and queue has to be configured by the application.
+	 * When hashing is enabled the queues are created by the implementation
+	 * then application need not configure any queue to this CoS.
+	 * Depening on the implementation this number might be rounded-off to
+	 * nearest supported value (e.g power of 2)
+	 * */
+	uint32_t num_queue;
+
+	/** Queue type */
+	odp_queue_type_t queue_type;
+
+	/** ODP Queue dequeue mode
+	 *  This value is valid only for PLAIN queue types */
+	odp_queue_op_mode_t deq_mode;
+
+	/** Schedule parameters for the queue created */
+	odp_schedule_param_t sched_param;
+
+	/* Protocol header fields which are included in packet input
+	 * hash calculation */
+	odp_hash_proto_t hash_proto;
+
+	/* If hashing is disabled, then application has to configure
+	 * this queue and packets are delivered to this queue */
+	odp_queue_t queue;
+
+	/* Pool associated with CoS */
+	odp_pool_t pool;
+
+	/* Drop policy associated with CoS */
+	odp_cls_drop_t drop_policy;
 } odp_cls_cos_param_t;
 
 /**
@@ -209,6 +253,23 @@  int odp_cls_capability(odp_cls_capability_t *capability);
 odp_cos_t odp_cls_cos_create(const char *name, odp_cls_cos_param_t *param);
 
 /**
+ * Queue hash result
+ * Returns the queue within a CoS in which a particular packet will be enqueued
+ * based on the packet parameters and hash protocol field configured with the
+ * class of service.
+ *
+ * @param	cos	class of service
+ * @param	packet	Packet handle
+ *
+ * @retval		Returns the queue handle on which this packet will be
+ *			enqueued.
+ * @retval		ODP_QUEUE_INVALID for error case
+ *
+ * @note The packet has to be updated with valid header pointers L2, L3 and L4.
+ */
+odp_queue_t odp_queue_hash_result(odp_cos_t cos, odp_packet_t packet);
+
+/**
  * Discard a class-of-service along with all its associated resources
  *
  * @param[in]	cos_id	class-of-service instance.
@@ -245,6 +306,31 @@  int odp_cos_queue_set(odp_cos_t cos_id, odp_queue_t queue_id);
 odp_queue_t odp_cos_queue(odp_cos_t cos_id);
 
 /**
+ * Get the number of queues linked with the specific class-of-service
+ *
+ * @param	cos_id		class-of-service instance.
+ *
+ * @return			Number of queues linked with the class-of-service.
+ */
+uint32_t odp_cos_num_queue(odp_cos_t cos_id);
+
+/**
+ * Get the list of queue associated with the specific class-of-service
+ *
+ * @param[in]	cos_id		class-of-service instance.
+ *
+ * @param[out]	queue		Array of queue handles associated
+ *				with the class-of-service.
+ *
+ * @param[in]	num		Maximum number of queue handles to output.
+ *
+ * @return			Number of queues linked with CoS
+ * @retval	<0		on failure
+ */
+uint32_t odp_cos_queue_multi(odp_cos_t cos_id,
+			     odp_queue_t queue[], uint32_t num);
+
+/**
  * Assign packet drop policy for specific class-of-service
  *
  * @param[in]	cos_id		class-of-service instance.
diff --git a/include/odp/api/spec/packet_io.h b/include/odp/api/spec/packet_io.h
index 8802089..1a40a1f 100644
--- a/include/odp/api/spec/packet_io.h
+++ b/include/odp/api/spec/packet_io.h
@@ -131,6 +131,27 @@  typedef union odp_pktin_hash_proto_t {
 } odp_pktin_hash_proto_t;
 
 /**
+ * Packet hash protocols
+ *
+ * The list of protocol header field combination in enum format, which are
+ * included in packet hash calculation.
+ */
+typedef enum odp_hash_proto_t {
+	/** IPv4 address and UDP port numbers */
+	ODP_HASH_PROTO_IPV4_UDP,
+	/** IPv4 addresses and TCP port numbers */
+	ODP_HASH_PROTO_IPV4_TCP,
+	/** IPv4 addresses */
+	ODP_HASH_PROTO_IPV4,
+	/** IPv6 addresses and UDP port numbers */
+	ODP_HASH_PROTO_IPV6_UDP,
+	/** IPv6 addresses and TCP port numbers */
+	ODP_HASH_PROTO_IPV6_TCP,
+	/** IPv6 addresses */
+	ODP_HASH_PROTO_IPV6
+} odp_hash_proto_t;
+
+/**
  * Packet IO operation mode
  */
 typedef enum odp_pktio_op_mode_t {