diff mbox

[RFC,API-NEXT,PATCHv2] api: packet: add odp_packet_parse() and odp_packet_classify apis

Message ID 1473245886-17059-1-git-send-email-bill.fischofer@linaro.org
State New
Headers show

Commit Message

Bill Fischofer Sept. 7, 2016, 10:58 a.m. UTC
The odp_packet_parse() call forces an inline reparse of a packet without
reclassifying it. The odp_packet_classify() API causes a packet to be
reclassified asynchronously with or without forced rebuffering.

Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>

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

-- 
2.5.0

Comments

Maxim Uvarov Sept. 8, 2016, 9:47 a.m. UTC | #1
I think it's reasonable api to include. But looks like it will require 
to support hardware classifier
for platforms which support in it hardware. In hardware case common case 
for now might be
to send this packet to loop back and it will be classifier on returning.

On 09/07/16 13:58, Bill Fischofer wrote:
> The odp_packet_parse() call forces an inline reparse of a packet without

> reclassifying it. The odp_packet_classify() API causes a packet to be

> reclassified asynchronously with or without forced rebuffering.

>

> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>

> ---

>   include/odp/api/spec/packet.h | 36 ++++++++++++++++++++++++++++++++++++

>   1 file changed, 36 insertions(+)

>

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

> index 4a14f2d..198f227 100644

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

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

> @@ -155,6 +155,42 @@ void odp_packet_free_multi(const odp_packet_t pkt[], int num);

>   int odp_packet_reset(odp_packet_t pkt, uint32_t len);

>   

>   /**

> + * Parse a packet

> + *

> + * Performs a complete parse of an ODP packet to repopulate parser

> + * metadata associated with the packet. This can be used to perform

> + * inline re-classification of a packet after, for example, decaspulation.

"after packet modification".
> + * Any previous parser metadata is discarded and overwritten by this call.

> + *

> + * @param pkt   Packet to (re)parse

> + *

> + * @return Parse results

> + * @retval 0  Parse successful

> + * @retval <0 Parse unsuccessful (packet format not recognized)

> + */

> +int odp_packet_parse(odp_packet_t pkt);

> +

> +/**

> + * Classify a packet

> + *

> + * Performa a complete reclassification of an ODP packet. This is an

> + * asynchronous operation that reparses and assigns the packet to a new

> + * CoS. The caller may indicate whether rebuffering is or is not required.

> + * If rebuffering is requested, the packet will be rebuffered as part of the

> + * reclassification. If rebuffering is not requested, the packet may or may

> + * not be rebuffered, at the implementation's option.

> + *

> + * @param pkt   Packet to be (re)classified

> + * @param rebuf Indicates whether the packet should or should not be rebuffered

> + *              0 = Rebuffering not required, 1 = rebuffering required.

> + *

rebuf might depend on platform, this option has to be discussed.

> + * @retval 0  Classification request accepted. Caller no longer has access

> + *            to pkt.

> + * @retval <0 Classification request failed. Input pkt unchanged.

Might be hard to keep original packet untouched and it might be damaged.
I think after that call pkt should not be access anyway.
> + */

> +int odp_packet_classify(odp_packet_t pkt, int rebuf);

> +


Function name a little bit confusing for me. How about

odp_cls_parse() and odp_cls_send() (and might corresponding 
odp_cls_send_multi()
?

Maxim.


> +/**

>    * Get packet handle from event

>    *

>    * Converts an ODP_EVENT_PACKET type event to a packet.
diff mbox

Patch

diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h
index 4a14f2d..198f227 100644
--- a/include/odp/api/spec/packet.h
+++ b/include/odp/api/spec/packet.h
@@ -155,6 +155,42 @@  void odp_packet_free_multi(const odp_packet_t pkt[], int num);
 int odp_packet_reset(odp_packet_t pkt, uint32_t len);
 
 /**
+ * Parse a packet
+ *
+ * Performs a complete parse of an ODP packet to repopulate parser
+ * metadata associated with the packet. This can be used to perform
+ * inline re-classification of a packet after, for example, decaspulation.
+ * Any previous parser metadata is discarded and overwritten by this call.
+ *
+ * @param pkt   Packet to (re)parse
+ *
+ * @return Parse results
+ * @retval 0  Parse successful
+ * @retval <0 Parse unsuccessful (packet format not recognized)
+ */
+int odp_packet_parse(odp_packet_t pkt);
+
+/**
+ * Classify a packet
+ *
+ * Performa a complete reclassification of an ODP packet. This is an
+ * asynchronous operation that reparses and assigns the packet to a new
+ * CoS. The caller may indicate whether rebuffering is or is not required.
+ * If rebuffering is requested, the packet will be rebuffered as part of the
+ * reclassification. If rebuffering is not requested, the packet may or may
+ * not be rebuffered, at the implementation's option.
+ *
+ * @param pkt   Packet to be (re)classified
+ * @param rebuf Indicates whether the packet should or should not be rebuffered
+ *              0 = Rebuffering not required, 1 = rebuffering required.
+ *
+ * @retval 0  Classification request accepted. Caller no longer has access
+ *            to pkt.
+ * @retval <0 Classification request failed. Input pkt unchanged.
+ */
+int odp_packet_classify(odp_packet_t pkt, int rebuf);
+
+/**
  * Get packet handle from event
  *
  * Converts an ODP_EVENT_PACKET type event to a packet.