* RTE_PTYPE_INNER_L4_UDP.
*/
+#include <stddef.h>
+#include <stdint.h>
+
#ifdef __cplusplus
extern "C" {
#endif
*
* Packet format:
* <'ether type'=0x0800
- * | 'version'=4, 'protocol'=6, 'MF'=0>
+ * | 'version'=4, 'protocol'=6, 'MF'=0, 'frag_offset'=0>
* or,
* <'ether type'=0x86DD
* | 'version'=6, 'next header'=6>
*
* Packet format:
* <'ether type'=0x0800
- * | 'version'=4, 'protocol'=17, 'MF'=0>
+ * | 'version'=4, 'protocol'=17, 'MF'=0, 'frag_offset'=0>
* or,
* <'ether type'=0x86DD
* | 'version'=6, 'next header'=17>
* <'ether type'=0x0800
* | 'version'=4, 'MF'=1>
* or,
+ * <'ether type'=0x0800
+ * | 'version'=4, 'frag_offset'!=0>
+ * or,
* <'ether type'=0x86DD
* | 'version'=6, 'next header'=44>
*/
*
* Packet format:
* <'ether type'=0x0800
- * | 'version'=4, 'protocol'=132, 'MF'=0>
+ * | 'version'=4, 'protocol'=132, 'MF'=0, 'frag_offset'=0>
* or,
* <'ether type'=0x86DD
* | 'version'=6, 'next header'=132>
*
* Packet format:
* <'ether type'=0x0800
- * | 'version'=4, 'protocol'=1, 'MF'=0>
+ * | 'version'=4, 'protocol'=1, 'MF'=0, 'frag_offset'=0>
* or,
* <'ether type'=0x86DD
* | 'version'=6, 'next header'=1>
*
* Packet format:
* <'ether type'=0x0800
- * | 'version'=4, 'protocol'!=[6|17|132|1], 'MF'=0>
+ * | 'version'=4, 'protocol'!=[6|17|132|1], 'MF'=0, 'frag_offset'=0>
* or,
* <'ether type'=0x86DD
* | 'version'=6, 'next header'!=[6|17|44|132|1]>
* Packet format:
* <'ether type'=0x0800
* | 'version'=4, 'protocol'=17
- * | 'destination port'=4798>
+ * | 'destination port'=4789>
* or,
* <'ether type'=0x86DD
* | 'version'=6, 'next header'=17
- * | 'destination port'=4798>
+ * | 'destination port'=4789>
*/
#define RTE_PTYPE_TUNNEL_VXLAN 0x00003000
/**
* <'ether type'=[0x800|0x86DD], vlan=[1-4095]>
*/
#define RTE_PTYPE_INNER_L2_ETHER_VLAN 0x00020000
+/**
+ * QinQ packet type.
+ *
+ * Packet format:
+ * <'ether type'=[0x88A8]>
+ */
+#define RTE_PTYPE_INNER_L2_ETHER_QINQ 0x00030000
/**
* Mask of inner layer 2 packet types.
*/
*
* Packet format (inner only):
* <'ether type'=0x0800
- * | 'version'=4, 'protocol'=6, 'MF'=0>
+ * | 'version'=4, 'protocol'=6, 'MF'=0, 'frag_offset'=0>
* or,
* <'ether type'=0x86DD
* | 'version'=6, 'next header'=6>
*
* Packet format (inner only):
* <'ether type'=0x0800
- * | 'version'=4, 'protocol'=17, 'MF'=0>
+ * | 'version'=4, 'protocol'=17, 'MF'=0, 'frag_offset'=0>
* or,
* <'ether type'=0x86DD
* | 'version'=6, 'next header'=17>
* <'ether type'=0x0800
* | 'version'=4, 'MF'=1>
* or,
+ * <'ether type'=0x0800
+ * | 'version'=4, 'frag_offset'!=0>
+ * or,
* <'ether type'=0x86DD
* | 'version'=6, 'next header'=44>
*/
*
* Packet format (inner only):
* <'ether type'=0x0800
- * | 'version'=4, 'protocol'=132, 'MF'=0>
+ * | 'version'=4, 'protocol'=132, 'MF'=0, 'frag_offset'=0>
* or,
* <'ether type'=0x86DD
* | 'version'=6, 'next header'=132>
*
* Packet format (inner only):
* <'ether type'=0x0800
- * | 'version'=4, 'protocol'=1, 'MF'=0>
+ * | 'version'=4, 'protocol'=1, 'MF'=0, 'frag_offset'=0>
* or,
* <'ether type'=0x86DD
* | 'version'=6, 'next header'=1>
*
* Packet format (inner only):
* <'ether type'=0x0800
- * | 'version'=4, 'protocol'!=[6|17|132|1], 'MF'=0>
+ * | 'version'=4, 'protocol'!=[6|17|132|1], 'MF'=0, 'frag_offset'=0>
* or,
* <'ether type'=0x86DD
* | 'version'=6, 'next header'!=[6|17|44|132|1]>
* Mask of inner layer 4 packet types.
*/
#define RTE_PTYPE_INNER_L4_MASK 0x0f000000
+/**
+ * All valid layer masks.
+ */
+#define RTE_PTYPE_ALL_MASK 0x0fffffff
/**
* Check if the (outer) L3 header is IPv4. To avoid comparing IPv4 types one by
RTE_PTYPE_INNER_L3_MASK | \
RTE_PTYPE_INNER_L4_MASK))
+/**
+ * Get the name of the l2 packet type
+ *
+ * @param ptype
+ * The packet type value.
+ * @return
+ * A non-null string describing the packet type.
+ */
+const char *rte_get_ptype_l2_name(uint32_t ptype);
+
+/**
+ * Get the name of the l3 packet type
+ *
+ * @param ptype
+ * The packet type value.
+ * @return
+ * A non-null string describing the packet type.
+ */
+const char *rte_get_ptype_l3_name(uint32_t ptype);
+
+/**
+ * Get the name of the l4 packet type
+ *
+ * @param ptype
+ * The packet type value.
+ * @return
+ * A non-null string describing the packet type.
+ */
+const char *rte_get_ptype_l4_name(uint32_t ptype);
+
+/**
+ * Get the name of the tunnel packet type
+ *
+ * @param ptype
+ * The packet type value.
+ * @return
+ * A non-null string describing the packet type.
+ */
+const char *rte_get_ptype_tunnel_name(uint32_t ptype);
+
+/**
+ * Get the name of the inner_l2 packet type
+ *
+ * @param ptype
+ * The packet type value.
+ * @return
+ * A non-null string describing the packet type.
+ */
+const char *rte_get_ptype_inner_l2_name(uint32_t ptype);
+
+/**
+ * Get the name of the inner_l3 packet type
+ *
+ * @param ptype
+ * The packet type value.
+ * @return
+ * A non-null string describing the packet type.
+ */
+const char *rte_get_ptype_inner_l3_name(uint32_t ptype);
+
+/**
+ * Get the name of the inner_l4 packet type
+ *
+ * @param ptype
+ * The packet type value.
+ * @return
+ * A non-null string describing the packet type.
+ */
+const char *rte_get_ptype_inner_l4_name(uint32_t ptype);
+
+/**
+ * Write the packet type name into the buffer
+ *
+ * @param ptype
+ * The packet type value.
+ * @param buf
+ * The buffer where the string is written.
+ * @param buflen
+ * The length of the buffer.
+ * @return
+ * - 0 on success
+ * - (-1) if the buffer is too small
+ */
+int rte_get_ptype_name(uint32_t ptype, char *buf, size_t buflen);
+
#ifdef __cplusplus
}
#endif