numam-dpdk/doc/guides
Yuan Wang 605975b8b3 ethdev: introduce protocol-based buffer split
Currently, Rx buffer split supports length based split. With Rx queue
offload RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT enabled and Rx packet segment
configured, PMD will be able to split the received packets into
multiple segments.

However, length based buffer split is not suitable for NICs that do split
based on protocol headers. Given an arbitrarily variable length in Rx
packet segment, it is almost impossible to pass a fixed protocol header to
driver. Besides, the existence of tunneling results in the composition of
a packet is various, which makes the situation even worse.

This patch extends current buffer split to support protocol header based
buffer split. A new proto_hdr field is introduced in the reserved field
of rte_eth_rxseg_split structure to specify protocol header. The proto_hdr
field defines the split position of packet, splitting will always happen
after the protocol header defined in the Rx packet segment. When Rx queue
offload RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT is enabled and corresponding
protocol header is configured, driver will split the ingress packets into
multiple segments.

Examples for proto_hdr field defines:
To split after ETH-IPV4-UDP, it should be defined as
proto_hdr = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
            RTE_PTYPE_L4_UDP

For inner ETH-IPV4-UDP, it should be defined as
proto_hdr = RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER |
            RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_UDP

If the protocol header is repeated with the previously defined one,
the repeated part should be omitted. For example, split after ETH, ETH-IPV4
and ETH-IPV4-UDP, it should be defined as
proto_hdr0 = RTE_PTYPE_L2_ETHER
proto_hdr1 = RTE_PTYPE_L3_IPV4_EXT_UNKNOWN
proto_hdr2 = RTE_PTYPE_L4_UDP

If protocol header split can be supported by a PMD, the
rte_eth_buffer_split_get_supported_hdr_ptypes function can
be used to obtain a list of these protocol headers.

For example, let's suppose we configured the Rx queue with the
following segments:
        seg0 - pool0, proto_hdr0=RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4,
               off0=2B
        seg1 - pool1, proto_hdr1=RTE_PTYPE_L4_UDP, off1=128B
        seg2 - pool2, proto_hdr2=0, off1=0B

The packet consists of ETH_IPV4_UDP_PAYLOAD will be split like
following:
        seg0 - ipv4 header @ RTE_PKTMBUF_HEADROOM + 2 in mbuf from pool0
        seg1 - udp header @ 128 in mbuf from pool1
        seg2 - payload @ 0 in mbuf from pool2

Now buffer split can be configured in two modes. User can choose length
or protocol header to configure buffer split according to NIC's
capability. For length based buffer split, the mp, length, offset field
in Rx packet segment should be configured, while the proto_hdr field
must be 0. For protocol header based buffer split, the mp, offset,
proto_hdr field in Rx packet segment should be configured, while the
length field must be 0.

Note: When protocol header split is enabled, NIC may receive packets
which do not match all the protocol headers within the Rx segments.
At this point, NIC will have two possible split behaviors according to
matching results, one is exact match, another is longest match.
The split result of NIC must belong to one of them.

The exact match means NIC only do split when the packets exactly match all
the protocol headers in the segments. Otherwise, the whole packet will be
put into the last valid mempool. The longest match means NIC will do split
until packets mismatch the protocol header in the segments. The rest will
be put into the last valid pool.

Pseudo-code for exact match:
FOR each seg in segs except last one
    IF proto_hdr is not matched THEN
        BREAK
    END IF
END FOR
IF loop breaked THEN
    put whole pkt in last seg
ELSE
    put protocol header in each seg
    put everything else in last seg
END IF

Pseudo-code for longest match:
FOR each seg in segs except last one
    IF proto_hdr is matched THEN
        put protocol header in seg
    ELSE
        BREAK
    END IF
END FOR
put everything else in last seg

Signed-off-by: Yuan Wang <yuanx.wang@intel.com>
Signed-off-by: Xuan Ding <xuan.ding@intel.com>
Signed-off-by: Wenxuan Wu <wenxuanx.wu@intel.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2022-10-09 16:41:27 +02:00
..
bbdevs baseband/acc100: introduce PMD for ACC101 2022-06-21 20:04:49 +02:00
compressdevs replace Mellanox with NVIDIA 2022-10-03 16:01:56 +02:00
contributing eal/loongarch: support LoongArch architecture 2022-10-06 12:45:05 +02:00
cryptodevs crypto/ipsec_mb: support all tag sizes for ZUC-EIA3-256 2022-10-07 19:46:11 +02:00
dmadevs dma/dpaa2: support statistics 2022-06-01 08:58:27 +02:00
eventdevs event/dlb2: optimize producer port probing 2022-09-30 10:24:36 +02:00
faq usertools: remove dpdk-setup.sh 2020-11-27 17:25:24 +01:00
freebsd_gsg doc: make doc roadmap common for Linux and BSD guides 2022-06-26 23:36:39 +02:00
gpus replace Mellanox with NVIDIA 2022-10-03 16:01:56 +02:00
howto doc: relate bifurcated driver and flow isolated mode 2022-10-04 17:01:03 +02:00
linux_gsg eal/loongarch: support LoongArch architecture 2022-10-06 12:45:05 +02:00
mempool drivers: remove octeontx2 drivers 2022-01-12 15:36:32 +01:00
nics ethdev: introduce protocol header API 2022-10-09 16:41:24 +02:00
platform drivers: mark cnxk to support disabling IOVA as PA 2022-10-09 13:14:57 +02:00
prog_guide bbdev: add operation for FFT processing 2022-10-07 08:44:58 +02:00
rawdevs raw/ioat: remove deprecated driver 2022-09-28 14:41:07 +02:00
regexdevs replace Mellanox with NVIDIA 2022-10-03 16:01:56 +02:00
rel_notes ethdev: introduce protocol-based buffer split 2022-10-09 16:41:27 +02:00
sample_app_ug examples/fips_validation: add TDES parsing 2022-10-07 11:06:42 +02:00
testpmd_app_ug app/testpmd: add hairpin queue memory modes 2022-10-08 18:30:50 +02:00
tools app/regex: add match mode option 2022-10-09 15:11:58 +02:00
vdpadevs replace Mellanox with NVIDIA 2022-10-03 16:01:56 +02:00
windows_gsg doc: discourage using Meson 0.58 on Windows 2021-11-17 09:50:23 +01:00
conf.py doc: replace deprecated distutils version parsing 2022-01-11 14:33:09 +01:00
custom.css doc: add SPDX tag to custom CSS file 2021-05-19 11:02:02 +02:00
index.rst gpudev: introduce GPU device class library 2021-11-08 17:20:52 +01:00
meson.build build: change indentation in infrastructure files 2021-04-21 14:04:09 +02:00