On 20/04/15 13:10, Petri Savolainen wrote:
Application can indicate which packet parsing results it is
interested in (all, none or selected).
Signed-off-by: Petri Savolainen <[email protected]>
---
include/odp/api/packet_flags.h | 26 ++++++++++++++++++++++++++
include/odp/api/packet_io.h | 19 +++++++++++++++++++
2 files changed, 45 insertions(+)
diff --git a/include/odp/api/packet_flags.h b/include/odp/api/packet_flags.h
index bfbcc94..9444fdc 100644
--- a/include/odp/api/packet_flags.h
+++ b/include/odp/api/packet_flags.h
@@ -26,6 +26,32 @@ extern "C" {
* @{
*/
+
+/**
+ * Packet input parsing flags
+ *
+ * Each flag represents a parser output. See parser output functions for
+ * details.
Now that I implement this for linux-generic, I realized this is
ambiguous: does disabling a lower layer's parsing means that the parser
stops looking into upper layers? Even if their parsing is enabled?
E.g. if (jumbo == 0 && ipv4 == 1), we won't parse the ethernet header if
it's a jumbo frame, that's fine. But do we continue to look into the
rest of the packet for the IPv4 header?
I would say no, but it should be mentioned here explicitly.
+ */
+typedef struct odp_packet_parse_flags_t {
+ uint32_t eth:1; /**< See odp_packet_has_eth() */
+ uint32_t jumbo:1; /**< See odp_packet_has_jumbo() */
+ uint32_t vlan:1; /**< See odp_packet_has_vlan() */
+ uint32_t vlan_qinq:1; /**< See odp_packet_has_vlan_qinq() */
+ uint32_t arp:1; /**< See odp_packet_has_arp() */
+ uint32_t ipv4:1; /**< See odp_packet_has_ipv4() */
+ uint32_t ipv6:1; /**< See odp_packet_has_ipv6() */
+ uint32_t ipfrag:1; /**< See odp_packet_has_ipfrag() */
+ uint32_t ipopt:1; /**< See odp_packet_has_ipopt() */
+ uint32_t ipsec:1; /**< See odp_packet_has_ipsec() */
+ uint32_t udp:1; /**< See odp_packet_has_udp() */
+ uint32_t tcp:1; /**< See odp_packet_has_tcp() */
+ uint32_t sctp:1; /**< See odp_packet_has_sctp() */
+ uint32_t icmp:1; /**< See odp_packet_has_icmp() */
+
+ uint32_t _reserved1:18; /**< Reserved. Do not use. */
+} odp_packet_parse_flags_t;
+
/**
* Check for packet errors
*
diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h
index 77c207e..97f79ee 100644
--- a/include/odp/api/packet_io.h
+++ b/include/odp/api/packet_io.h
@@ -18,6 +18,8 @@
extern "C" {
#endif
+#include <odp/packet_flags.h>
+
/** @defgroup odp_packet_io ODP PACKET IO
* Operations on a packet.
* @{
@@ -58,6 +60,19 @@ enum odp_pktio_input_mode {
};
/**
+ * Packet parsing mode
+ */
+enum odp_pktio_parse_mode {
+ /** Parse all protocols */
+ ODP_PKTIN_PARSE_ALL = 0,
+ /** Parsing not needed */
+ ODP_PKTIN_PARSE_NONE,
+ /** Parsing can be limited to the flags set in
+ odp_packet_parse_flags_t */
+ ODP_PKTIN_PARSE_SELECTED
+};
+
+/**
* Packet IO parameters
*
* In minimum, user must select the input mode. Use 0 for defaults. Initialize
@@ -66,6 +81,10 @@ enum odp_pktio_input_mode {
typedef struct odp_pktio_param_t {
/** Packet input mode */
enum odp_pktio_input_mode in_mode;
+ /** Packet parse mode */
+ enum odp_pktio_parse_mode parse_mode;
+ /** Parse selection when parse_mode is ODP_PKTIN_PARSE_SELECTED */
+ odp_packet_parse_flags_t parse;
} odp_pktio_param_t;
/**
_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp