X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_mbuf%2Frte_mbuf_ptype.h;h=256f024b65bb16c2ec59de05a478fe27853a6341;hb=748298441981f0a6eb6c8c2ed425cc6d028dab70;hp=a955c5a7263875c740dc60f15fca8a3047111f6a;hpb=eb173c8def0a3cb3bf4d7e6ed4e329efbeeb35cf;p=dpdk.git diff --git a/lib/librte_mbuf/rte_mbuf_ptype.h b/lib/librte_mbuf/rte_mbuf_ptype.h index a955c5a726..256f024b65 100644 --- a/lib/librte_mbuf/rte_mbuf_ptype.h +++ b/lib/librte_mbuf/rte_mbuf_ptype.h @@ -91,6 +91,9 @@ * RTE_PTYPE_INNER_L4_UDP. */ +#include +#include + #ifdef __cplusplus extern "C" { #endif @@ -142,6 +145,20 @@ extern "C" { * <'ether type'=[0x8100]> */ #define RTE_PTYPE_L2_ETHER_VLAN 0x00000006 +/** + * QinQ packet type. + * + * Packet format: + * <'ether type'=[0x88A8]> + */ +#define RTE_PTYPE_L2_ETHER_QINQ 0x00000007 +/** + * PPPOE packet type. + * + * Packet format: + * <'ether type'=[0x8863|0x8864]> + */ +#define RTE_PTYPE_L2_ETHER_PPPOE 0x00000008 /** * Mask of layer 2 packet types. * It is used for outer packet for tunneling cases. @@ -220,7 +237,7 @@ extern "C" { * * 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> @@ -232,7 +249,7 @@ extern "C" { * * 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> @@ -251,6 +268,9 @@ extern "C" { * <'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> */ @@ -261,7 +281,7 @@ extern "C" { * * 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> @@ -273,7 +293,7 @@ extern "C" { * * 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> @@ -289,7 +309,7 @@ extern "C" { * * 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]> @@ -328,11 +348,11 @@ extern "C" { * 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 /** @@ -369,6 +389,68 @@ extern "C" { * capability. */ #define RTE_PTYPE_TUNNEL_GRENAT 0x00006000 +/** + * GTP-C (GPRS Tunnelling Protocol) control tunneling packet type. + * Packet format: + * <'ether type'=0x0800 + * | 'version'=4, 'protocol'=17 + * | 'destination port'=2123> + * or, + * <'ether type'=0x86DD + * | 'version'=6, 'next header'=17 + * | 'destination port'=2123> + * or, + * <'ether type'=0x0800 + * | 'version'=4, 'protocol'=17 + * | 'source port'=2123> + * or, + * <'ether type'=0x86DD + * | 'version'=6, 'next header'=17 + * | 'source port'=2123> + */ +#define RTE_PTYPE_TUNNEL_GTPC 0x00007000 +/** + * GTP-U (GPRS Tunnelling Protocol) user data tunneling packet type. + * Packet format: + * <'ether type'=0x0800 + * | 'version'=4, 'protocol'=17 + * | 'destination port'=2152> + * or, + * <'ether type'=0x86DD + * | 'version'=6, 'next header'=17 + * | 'destination port'=2152> + */ +#define RTE_PTYPE_TUNNEL_GTPU 0x00008000 +/** + * ESP (IP Encapsulating Security Payload) tunneling packet type. + * + * Packet format: + * <'ether type'=0x0800 + * | 'version'=4, 'protocol'=51> + * or, + * <'ether type'=0x86DD + * | 'version'=6, 'next header'=51> + */ +#define RTE_PTYPE_TUNNEL_ESP 0x00009000 +/** + * L2TP (Layer 2 Tunneling Protocol) tunnleing packet type. + * + * Packet format: + * <'ether type'=0x0800 + * | 'version'=4, 'protocol'=17> + * | 'destination port'=1701> + * or, + * <'ether type'=0x86DD + * | 'version'=6, 'next header'=17 + * | 'destination port'=1701> + * or, + * <'ether type'=0x0800 + * | 'version'=4, 'protocol'=115> + * or, + * <'ether type'=0x86DD + * | 'version'=6, 'protocol'=115> + */ +#define RTE_PTYPE_TUNNEL_L2TP 0x0000a000 /** * Mask of tunneling packet types. */ @@ -388,6 +470,13 @@ extern "C" { * <'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. */ @@ -459,7 +548,7 @@ extern "C" { * * 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> @@ -471,7 +560,7 @@ extern "C" { * * 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> @@ -485,6 +574,9 @@ extern "C" { * <'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> */ @@ -495,7 +587,7 @@ extern "C" { * * 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> @@ -507,7 +599,7 @@ extern "C" { * * 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> @@ -520,7 +612,7 @@ extern "C" { * * 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]> @@ -530,6 +622,10 @@ extern "C" { * 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 @@ -552,6 +648,91 @@ extern "C" { 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