-----Original Message-----
From: lng-odp [mailto:[email protected]] On Behalf Of ext
Zoltan Kiss
Sent: Wednesday, April 15, 2015 7:01 PM
To: [email protected]
Subject: [lng-odp] [RFC API-NEXT PATCH] packet_io: add bitmap to specify
what level of parsing needed
odp_pktio_open() will have a 32 bit bitmask to specify what kind of header
parsing is required by the application.
Signed-off-by: Zoltan Kiss <[email protected]>
---
include/odp/api/packet_flags.h | 49
++++++++++++++++++++++++++++++++++++++++++
include/odp/api/packet_io.h | 14 ++++++++----
2 files changed, 59 insertions(+), 4 deletions(-)
diff --git a/include/odp/api/packet_flags.h
b/include/odp/api/packet_flags.h
index b1e179e..467d4f1 100644
--- a/include/odp/api/packet_flags.h
+++ b/include/odp/api/packet_flags.h
@@ -327,6 +327,55 @@ void odp_packet_has_sctp_set(odp_packet_t pkt, int
val);
void odp_packet_has_icmp_set(odp_packet_t pkt, int val);
/**
+ * Shift values for enum odp_packet_parse. Has to be updated together
with
+ * odp_packet_parse_e type. The parameter passed to odp_pktio_open is a
32 bit
+ * mask.
+ */
+typedef enum odp_packet_parse_shift {
+ ODP_PARSE_SHIFT_ETH,
+ ODP_PARSE_SHIFT_JUMBO,
+ ODP_PARSE_SHIFT_VLAN,
+ ODP_PARSE_SHIFT_VLAN_QINQ,
+ ODP_PARSE_SHIFT_ARP,
+ ODP_PARSE_SHIFT_IPV4,
+ ODP_PARSE_SHIFT_IPV6,
+ ODP_PARSE_SHIFT_IPFRAG,
+ ODP_PARSE_SHIFT_IPOPT,
+ ODP_PARSE_SHIFT_IPSEC,
+ ODP_PARSE_SHIFT_UDP,
+ ODP_PARSE_SHIFT_TCP,
+ ODP_PARSE_SHIFT_SCTP,
+ ODP_PARSE_SHIFT_ICMP,
+ ODP_PARSE_SHIFT_MAX = 31
+} odp_packet_parse_shift_e;
+
+#define ODP_PARSE(FIELD) ODP_PARSE_##FIELD = (ODP_PARSE_SHIFT_##FIELD <<
1)
+
+/**
+ * Values to be used when calling odp_pktio_open. The parser_mask
parameter has
+ * to be one or more of these values joined with bitwise OR. Or one of
the two
+ * special values: ODP_PARSE_NONE or ODP_PARSE_ALL.
+ * Has to be updated together with odp_packet_parse_shift_e
+ */
+typedef enum odp_packet_parse {
+ ODP_PARSE_NONE = 0, /* The application don't want any parsing */
+ ODP_PARSE(ETH), /* Parse Ethernet header */
+ ODP_PARSE(JUMBO), /* Parse Ethernet header if a jumbo frame */
+ ODP_PARSE(VLAN), /* Parse VLAN header */
+ ODP_PARSE(VLAN_QINQ), /* Parse VLAN QinQ header */
+ ODP_PARSE(ARP), /* Parse ARP header */
+ ODP_PARSE(IPV4), /* Parse IPv4 header */
+ ODP_PARSE(IPV6), /* Parse IPv6 header */
+ ODP_PARSE(IPFRAG), /* Parse IPv4 header if fragmented */
+ ODP_PARSE(IPOPT), /* Parse IP options */
+ ODP_PARSE(IPSEC), /* Parse IPsec header */
+ ODP_PARSE(UDP), /* Parse UDP header */
+ ODP_PARSE(TCP), /* Parse TCP header */
+ ODP_PARSE(SCTP), /* Parse SCTP header */
+ ODP_PARSE(ICMP), /* Parse ICMP header */
+ ODP_PARSE_ALL = UINT32_MAX /* The application wants full parsing */
+} odp_packet_parse_e;
+/**
* @}
*/
diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h
index 6d31aeb..8c989f3 100644
--- a/include/odp/api/packet_io.h
+++ b/include/odp/api/packet_io.h
@@ -51,9 +51,14 @@ extern "C" {
* open device will fail, returning ODP_PKTIO_INVALID with errno set.
* odp_pktio_lookup() may be used to obtain a handle to an already open
device.
*
- * @param dev Packet IO device name
- * @param pool Pool from which to allocate buffers for storing packets
- * received over this packet IO
+ * @param dev Packet IO device name
+ * @param pool Pool from which to allocate buffers for storing
packets
+ * received over this packet IO
+ * @param parsing_mask Mask to request parsing. Must be one or more
ODP_PARSE_*
+ * value joined with bitwise OR to request
particular
+ * fields to be parsed. Or one of two special
values:
+ * ODP_PARSE_NONE or ODP_PARSE_ALL. See
odp_packet_parse_e
+ * in packet_flags.h for more details
*
* @return ODP packet IO handle
* @retval ODP_PKTIO_INVALID on failure
@@ -62,7 +67,8 @@ extern "C" {
* device used for testing. Usually it's loop back
* interface.
*/
-odp_pktio_t odp_pktio_open(const char *dev, odp_pool_t pool);
+odp_pktio_t odp_pktio_open(const char *dev, odp_pool_t pool,
+ uint32_t parsing_mask);
/**
* Close an ODP packet IO instance
--
1.9.1
_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp