[dpdk-dev] [PATCH v4 03/18] mbuf: add definitions of unified packet types

Olivier MATZ olivier.matz at 6wind.com
Fri Feb 27 16:02:29 CET 2015


Hi Helin,

On 02/27/2015 02:11 PM, Helin Zhang wrote:
> As there are only 6 bit flags in ol_flags for indicating packet
> types, which is not enough to describe all the possible packet
> types hardware can recognize. For example, i40e hardware can
> recognize more than 150 packet types. Unified packet type is
> composed of L2 type, L3 type, L4 type, tunnel type, inner L2 type,
> inner L3 type and inner L4 type fields, and can be stored in
> 'struct rte_mbuf' of 32 bits field 'packet_type'.
> 
> Signed-off-by: Helin Zhang <helin.zhang at intel.com>

That's not what I asked in
http://dpdk.org/ml/archives/dev/2015-February/013423.html

A definition of what is the meaning of a packet type in terms of
packet content is really required for the PMD developer and for
the application developer.

By reading the comment, we should be able to answer to the following
question:
- What are the required conditions on the packet headers to recognize
  this type? The conditions should be formally described in the comment.

By reading the comment, we should be able to know whether the following
packets can or must not be recognized as an RTE_PTYPE_L3_IPV4:

<Ether type=0x800 |<IP  version=4L ihl=5L tos=0x0 len=20 id=1 flags=
frag=0L ttl=64 proto=0 chksum=0x7ce7 src=1.1.1.1 dst=1.1.1.2 |>>

<Ether type=*0x1234* |<IP  version=4L ihl=5L tos=0x0 len=20 id=1 flags=
frag=0L ttl=64 proto=0 chksum=0x7ce7 src=1.1.1.1 dst=1.1.1.2 |>>

<Ether type=0x800 |<IP  version=*3L* ihl=5L tos=0x0 len=20 id=1 flags=
frag=0L ttl=64 proto=0 chksum=0x7ce7 src=1.1.1.1 dst=1.1.1.2 |>>

<Ether type=0x800 |<IP  version=4L ihl=*1L* tos=0x0 len=20 id=1 flags=
frag=0L ttl=64 proto=0 chksum=0x7ce7 src=1.1.1.1 dst=1.1.1.2 |>>

<Ether type=0x800 |<IP  version=4L ihl=*8L* tos=0x0 len=20 id=1 flags=
frag=0L ttl=64 proto=0 chksum=0x7ce7 src=1.1.1.1 dst=1.1.1.2 |>>

<Ether type=0x800 |<IP  version=4L ihl=5L tos=0x0 len=*0* id=1 flags=
frag=0L ttl=64 proto=0 chksum=0x7ce7 src=1.1.1.1 dst=1.1.1.2 |>>

<Ether type=0x800 |<IP  version=4L ihl=5L tos=0x0 len=20 id=1 flags=
frag=0L ttl=64 proto=0 chksum=*0x1234* src=1.1.1.1 dst=1.1.1.2 |>>

<Ether type=0x800 |<IP  version=4L ihl=5L tos=0x0 len=20 id=1 flags=
frag=*1234L* ttl=64 proto=0 chksum=*0* src=1.1.1.1 dst=1.1.1.2 |>>

...


Here is an example about why it is important:

Let's assume the definition of RTE_PTYPE_L3_IPV4 is:
- IP version field is 4
- no IP options (header size is 20, ihl=5)
- layer 2 identified the packet as IP (ex: ethertype=0x800)

If a hardware XYZ is able to recognize that a packet is an IP packet by
just checking the ethertype without checking the IP version field, the
PMD has to check by software that IHL is 5 and IP version is 4.

Regards,
Olivier


More information about the dev mailing list