First round of documentation cleanup for oran_e_maintenance_release_v1.0
[o-du/phy.git] / docs / ecpri_ddp_profile.rst
1 ..    Copyright (c) 2019-2022 Intel
2 ..
3 ..  Licensed under the Apache License, Version 2.0 (the "License");
4 ..  you may not use this file except in compliance with the License.
5 ..  You may obtain a copy of the License at
6 ..
7 ..      http://www.apache.org/licenses/LICENSE-2.0
8 ..
9 ..  Unless required by applicable law or agreed to in writing, software
10 ..  distributed under the License is distributed on an "AS IS" BASIS,
11 ..  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 ..  See the License for the specific language governing permissions and
13 ..  limitations under the License.
14
15
16 eCPRI DDP Profile for Columbiaville (Experimental Feature)
17 ==========================================================
18
19 .. _introduction-3:
20
21 Introduction
22 ============
23
24 The Intel® Ethernet 800 Series is the next generation of Intel® Ethernet
25 Controllers and Network Adapters. The Intel® Ethernet 800 Series is
26 designed with an enhanced programmable pipeline, allowing deeper and
27 more diverse protocol header processing. This on-chip capability is
28 called Dynamic Device Personalization (DDP). In the Intel® Ethernet 800
29 Series, a DDP profile is loaded dynamically on driver load per device.
30
31 A general-purpose DDP package is automatically installed with all
32 supported Intel® Ethernet 800 Series drivers on Windows*, ESX*,
33 FreeBSD*, and Linux\* operating systems, including those provided by the
34 Data Plane Development Kit (DPDK). This general-purpose DDP package is
35 known as the OS-default package.
36
37 For more information on DDP technology in the Intel® Ethernet 800 Series
38 products and the OS-default package, refer to the Intel® Ethernet
39 Controller E810 Dynamic Device Personalization (DDP) Technology Guide,
40 published here: https://cdrdv2.intel.com/v1/dl/getContent/617015.
41
42 This document describes an optional DDP package targeted towards the
43 needs of Wireless and Edge (Wireless Edge) customers. This Wireless Edge
44 DDP package (v1.3.22.101) adds support for eCPRI protocols in addition
45 to the protocols in the OS-default package. The Wireless Edge DDP
46 package is supported by DPDK.
47
48 Starting from DPDK 21.02 drivers and in the future will also be
49 supported by the Intel® Ethernet 800 Series ice driver. on Linux
50 operating systems. The Wireless DDP Package can be loaded on all Intel®
51 Ethernet 800 Series devices, or different packages can be selected via
52 serial number per device.
53
54 Software/Firmware Requirements
55 ==============================
56
57 The specific DDP package requires certain firmware and DPDK versions and
58 Intel® Ethernet 800 Series firmware/NVM versions. Support for eCPRI DDP
59 profile included starting from Columbiaville (CVL)release 2.4 or later.
60 This section is for general information purposes as the binaries provided
61 for this FlexRan release in github.com are built with DPDK 20.11.1 and the
62 mix and match of binaries is not supported.
63 The required DPDK version contains the support of loading the specific
64 Wireless Edge DDP package.
65
66 -  Intel® Ethernet 800 Series Linux Driver (ice) — 1.4.0 (or later)
67
68 -  Wireless Edge DDP Package version (ice_wireless_edge) — 1.3.22.101
69
70 -  Intel® Ethernet 800 Series firmware version — 1.5.4.2 (or later)
71
72 -  Intel® Ethernet 800 Series NVM version — 2.4 (or later)
73
74 -  DPDK version— 21.02 (or later)
75
76 -  For FlexRAN oran_e_maintenance_release_v1.0, corresponding support of CVL 2.4 driver pack and DPDK 21.02 is “experimental” and subject to additional 
77    testing and potential changes.
78
79 DDP Package Setup
80 =================
81
82 The Intel® Ethernet 800 Series Comms DDP package supports only
83 Linux-based operating systems currently.
84
85 Currently, the eCPRI is fully supported only by DPDK 21.02. It can be
86 loaded either by DPDK or the Intel® Ethernet 800 Series Linux base
87 driver.
88
89 Wireless Edge DDP Package
90 =========================
91
92 For details on how to set up DPDK, refer to Intel® Ethernet Controller
93 E810 Data Plane Development Kit (DPDK) Configuration Guide (Doc ID:
94 633514).
95
96 There are two methods where DDP package can be loaded and used under
97 DPDK (see Section C.3.2  and
98 Section C.3.2 ). For both methods, the
99 user must obtain the ice_wireless_edge-1.3.22.101.pkg or later from
100 Intel (please contact your Intel representative for more information)
101
102 Option 1: *ice* Linux Base Driver
103 =================================
104
105 The first option is to have the ice Linux base driver load the package.
106
107 The *ice* Linux base driver looks for the symbolic link
108 *intel/ice/ddp/ice.pkg* under the default firmware search path, checking
109 the following folders in order:
110
111 -  */lib/firmware/updates/*
112
113 -  */lib/firmware/*
114
115 To install the Comms package, copy the extracted .pkg file and its
116 symbolic link to */lib/firmware/updates/intel/ice/ddp* as follows, and
117 reload the ice driver::
118
119   # cp /usr/tmp/ice_wireless_edge-1.3.22.101.pkg /lib/firmware/updates/intel/ice/ddp/
120   # ln -sf /lib/firmware/updates/intel/ice/ddp/ice_wireless_edge-1.3.22.101.pkg /lib/firmware/updates/intel/ice/ddp/ice.pkg
121   # modprobe -r irdma
122   # modprobe -r ice
123   # modprobe ice
124
125
126 The kernel message log (*dmesg*) indicates status of package loading in
127 the system. If the driver successfully finds and loads the DDP package,
128 *dmesg* indicates that the DDP package successfully loaded. If not, the
129 driver transitions to safe mode.
130
131 Once the driver loads the package, the user can unbind the *ice* driver
132 from a desired port on the device so that DPDK can utilize the port.
133
134 The following example unbinds Port 0 and Port 1 of device on Bus 6,
135 Device 0. Then, the port is bound to either igb_uio or vfio-pci. ::
136
137   # ifdown <interface>
138   # dpdk-devbind -u 06:00.0
139   # dpdk-devbind -u 06:00.1
140   # dpdk-devbind -b igb_uio 06:00.0 06:00.1
141
142 Option 2: DPDK Driver Only
143 ==========================
144
145 The second method is if the system does not have the *ice* driver
146 installed. In this case, the user can download the DDP package from the
147 Intel download center and extract the zip file to obtain the package
148 (*.pkg*) file. Similar to the Linux base driver, the DPDK driver looks
149 for the *intel/ddp/ice.pkg* symbolic link in the kernel default firmware
150 search path */lib/firmware/updates and /lib/firmware/*.
151
152 Copy the extracted DDP *.pkg* file and its symbolic link to
153 */lib/firmware/intel/ice/ddp*, as follows. ::
154
155   # cp /usr/tmp/ice_wireless_edge-1.3.22.101 /lib/firmware/intel/ice/ddp/
156   # cp /usr/tmp/ice.pkg /lib/firmware/intel/ice/ddp/
157
158 When DPDK driver loads, it looks for *ice.pkg* to load. If the file
159 exists, the driver downloads it into the device. If not, the driver
160 transitions into safe mode.
161
162 Loading DDP Package to a Specific Intel® Ethernet 800 Series Device
163 ===================================================================
164
165 On a host system running with multiple Intel® Ethernet 800 Series
166 devices, there is sometimes a need to load a specific DDP package on a
167 selected device while loading a different package on the remaining
168 devices.
169
170 The Intel® Ethernet 800 Series Linux base driver and DPDK driver can
171 both load a specific DDP package to a selected adapter based on the
172 device's serial number. The driver does this by looking for a specific
173 symbolic link package filename containing the selected device's serial
174 number.
175
176 The following example illustrates how a user can load a specific package
177 (e.g., *ice_wireless_edge-1.3.22.101*) on the device of Bus 6.
178
179 1. Find device serial number.
180
181 ..
182
183 To view bus, device, and function of all Intel® Ethernet 800 Series
184 Network Adapters in the system:::
185
186   # lspci | grep -i Ethernet | grep -i Intel
187   06:00.0 Ethernet controller: Intel Corporation Ethernet Controller E810-C for QSFP (rev 01)
188   06:00.1 Ethernet controller: Intel Corporation Ethernet Controller E810-C for QSFP (rev 01)
189   82:00.0 Ethernet controller: Intel Corporation Ethernet Controller E810-C for SFP (rev 01)
190   82:00.1 Ethernet controller: Intel Corporation Ethernet Controller E810-C for SFP (rev 01)
191   82:00.2 Ethernet controller: Intel Corporation Ethernet Controller E810-C for SFP (rev 01)
192   82:00.3 Ethernet controller: Intel Corporation Ethernet Controller E810-C for SFP (rev 01)
193
194 Use the **lspci** command to obtain the selected device serial
195 number:::
196
197   # lspci -vv -s 06:00.0 \| grep -i Serial
198   Capabilities: [150 v1] Device Serial Number 35-11-a0-ff-ff-ca-05-68
199
200 Or, fully parsed without punctuation:::
201
202   # lspci -vv -s 06:00.0 \|grep Serial \|awk '{print $7}'|sed s/-//g
203   3511a0ffffca0568
204
205 2. Rename the package file with the device serial number in the name.
206
207 ..
208
209 Copy the specific package over to /lib/firmware/updates/intel/ice/ddp
210 (or /lib/firmware/intel/ice/ ddp) and create a symbolic link with the
211 serial number linking to the package, as shown. The specific symbolic
212 link filename starts with “ice-” followed by the device serial in
213 lower case without dash ('-'). ::
214
215   # ln -s
216   /lib/firmware/updates/intel/ice/ddp/ice_wireless_edge-1.3.22.101.pkg
217   /lib/firmware/updates/intel/ice/ddp/ice-3511a0ffffca0568.pkg
218
219 3. If using Linux kernel driver (*ice*), reload the base driver (not
220 required if using only DPDK driver). ::
221
222   # rmmod ice
223   # modprobe ice
224
225 The driver loads the specific package to the selected device and the
226 OS-default package to the remaining Intel® Ethernet 800 Series
227 devices in the system.
228
229 4. Verify.
230
231 For kernel driver:
232 ==================
233
234 Example of output of successful load of Wireless Edge Package to all
235 devices:::
236
237   # dmesg | grep -i "ddp \| safe"
238   [606960.921404] ice 0000:18:00.0: The DDP package was successfully loaded: ICE Wireless Edge Package version 1.3.22.101
239   [606961.672999] ice 0000:18:00.1: DDP package already present on device: ICE Wireless Edge Package version 1.3.22.101
240   [606962.439067] ice 0000:18:00.2: DDP package already present on device: ICE Wireless Edge Package version 1.3.22.101
241   [606963.198305] ice 0000:18:00.3: DDP package already present on device: ICE Wireless Edge Package version 1.3.22.101
242   [606964.252076] ice 0000:51:00.0: The DDP package was successfully loaded: ICE Wireless Edge Package version 1.3.22.101
243   [606965.017082] ice 0000:51:00.1: DDP package already present on device: ICE Wireless Edge Package version 1.3.22.101
244   [606965.802115] ice 0000:51:00.2: DDP package already present on device: ICE Wireless Edge Package version 1.3.22.101
245   [606966.576517] ice 0000:51:00.3: DDP package already present on device: ICE Wireless Edge Package version 1.3.22.101
246
247
248 If using only DPDK driver:
249 ==========================
250
251 Verify using DPDK's **testpmd** application to indicate the status
252 And version of the loaded DDP package.
253
254 Example of eCPRI config with dpdk-testpmd
255 -----------------------------------------
256
257 16 O-RAN eCPRI IQ streams mapped to 16 independent HW queues each.::
258
259   #./dpdk-testpmd -l 22-25 -n 4 -a 0000:af:01.0 -- -i  --rxq=16 --txq=16 --cmdline-file=/home/flexran_xran/ddp.txt
260
261   cat /home/flexran_xran/ddp.txt
262   port stop 0
263   port config mtu 0 9600
264   port config 0 rx_offload vlan_strip on
265   port start 0
266   flow create 0 ingress pattern eth / ecpri common type iq_data pc_id is 0x0000 / end actions queue index 0 / mark / end
267   flow create 0 ingress pattern eth / ecpri common type iq_data pc_id is 0x0001 / end actions queue index 1 / mark / end
268   flow create 0 ingress pattern eth / ecpri common type iq_data pc_id is 0x0002 / end actions queue index 2 / mark / end
269   flow create 0 ingress pattern eth / ecpri common type iq_data pc_id is 0x0003 / end actions queue index 3 / mark / end
270   flow create 0 ingress pattern eth / ecpri common type iq_data pc_id is 0x0004 / end actions queue index 4 / mark / end
271   flow create 0 ingress pattern eth / ecpri common type iq_data pc_id is 0x0005 / end actions queue index 5 / mark / end
272   flow create 0 ingress pattern eth / ecpri common type iq_data pc_id is 0x0006 / end actions queue index 6 / mark / end
273   flow create 0 ingress pattern eth / ecpri common type iq_data pc_id is 0x0007 / end actions queue index 7 / mark / end
274   flow create 0 ingress pattern eth / ecpri common type iq_data pc_id is 0x0008 / end actions queue index 8 / mark / end
275   flow create 0 ingress pattern eth / ecpri common type iq_data pc_id is 0x0009 / end actions queue index 9 / mark / end
276   flow create 0 ingress pattern eth / ecpri common type iq_data pc_id is 0x000a / end actions queue index 10 / mark / end
277   flow create 0 ingress pattern eth / ecpri common type iq_data pc_id is 0x000b / end actions queue index 11 / mark / end
278   flow create 0 ingress pattern eth / ecpri common type iq_data pc_id is 0x000c / end actions queue index 12 / mark / end
279   flow create 0 ingress pattern eth / ecpri common type iq_data pc_id is 0x000d / end actions queue index 13 / mark / end
280   flow create 0 ingress pattern eth / ecpri common type iq_data pc_id is 0x000e / end actions queue index 14 / mark / end
281   flow create 0 ingress pattern eth / ecpri common type iq_data pc_id is 0x000f / end actions queue index 15 / mark / end
282   set fwd rxonly
283   start
284   show fwd stats all
285
286
287 O-RAN Front haul eCPRI
288 ======================
289
290 Intel® Ethernet 800 Series DDP capabilities support several
291 functionalities important for the O-RAN FH.
292
293 -  RSS for packet steering based on ecpriMessage
294
295 -  RSS for packet steering based on ecpriRtcid/ecpriPcid
296
297 -  Queue mapping based on ecpriRtcid/ecpriPcid
298
299 -  Queue mapping based on ecpriMessage
300
301 .. image:: images/O-RAN-FH-VNF.jpg
302   :width: 400
303   :alt: Figure . O-RAN FH VNF
304
305 Figure 30. O-RAN FH VNF
306
307 Table 13. Patterns & Input Sets for Flow Director and RSS (DPDK 21.02)
308
309 ============================= ========================================
310 Pattern                       Input Set
311 ============================= ========================================
312 ETH / VLAN / eCPRI            ecpriMessage \| ecpriRtcid/ecpriPcid
313 ETH / VLAN /IPv4(6)/UDP/eCPRI ecpriMessage \| ecpriRtcid/ecpriPcid (*)
314 ============================= ========================================
315
316 *Note:* \* IP/UDP is not used with FlexRAN
317
318 Limitations
319 ===========
320
321 DPDK 21.02 allows up to 1024 queues per VF and RSS across up to 64
322 receive queues.
323
324 RTE Flow API
325 ============
326
327 The DPDK Generic flow API (rte_flow) will be used to the configure the
328 Intel® Ethernet 800 Series to match specific ingress traffic and forward
329 it to specified queues.
330
331 For further information, please refer to section 11 of the DPDK
332 Programmers
333 guide <https://doc.dpdk.org/guides/prog_guide/rte_flow.html>.
334
335 The specific ingress traffic is identified by a matching pattern which
336 is composed of one or more Pattern items (represented by struct
337 rte_flow_item). Once a match has been determined one or more associated
338 Actions (represented by struct rte_flow_action) will be performed.
339
340 A number of flow rules can be combined such that one rule directs
341 traffic to a queue group based on *ecpriMessage/ ecpriRtcid/ecpriPcid*
342 etc. and a second rule distributes matching packets within that queue
343 group using RSS.
344
345 The following subset of the RTE Flow API functions can be used to
346 validate, create and destroy RTE Flow rules.
347
348 RTE Flow Rule Validation
349 ========================
350
351 A RTE Flow rule is created via a call to the function
352 *rte_flow_validate*. This can be used to check the rule for correctness
353 and whether it would be accepted by the device given sufficient
354 resources.::
355
356   int   rte_flow_validate(uint16_t port_id,
357         const struct rte_flow_attr *attr,
358         const struct rte_flow_item pattern[],
359         const struct rte_flow_action *actions[]
360         struct rte_flow_error *error);
361
362
363 port_id : port identifier of Ethernet device
364
365 attr : flow rule attributes(ingress/egress)
366
367 pattern : pattern specification (list terminated by the END pattern
368 item).
369
370 action : associated actions (list terminated by the END action).
371
372 error : perform verbose error reporting if not NULL.
373
374 0 is returned upon success, negative errno otherwise.
375
376 RTE Flow Rule Creation
377 ======================
378
379 A RTE Flow rule is created via a call to the function *rte_flow_create*.::
380
381   struct rte_flow * rte_flow_create(uint16_t port_id,
382           const struct rte_flow_attr *attr,
383           const struct rte_flow_item pattern[],
384           const struct rte_flow_action *actions[]
385           struct rte_flow_error *error);
386
387 port_id : port identifier of Ethernet device
388
389 attr : flow rule attributes(ingress/egress)
390
391 pattern : pattern specification (list terminated by the END pattern
392 item).
393
394 action : associated actions (list terminated by the END action).
395
396 error : perform verbose error reporting if not NULL.
397
398 A valid handle is returned upon success, NULL otherwise.
399
400 RTE Flow Rule Destruction
401 =========================
402
403 A RTE Flow rule is destroyed via a call to the function
404 *rte_flow_destroy*.::
405
406   int rte_flow_destroy(uint16_t port_id,
407     struct rte_flow \*flow,
408     struct rte_flow_error \*error);
409
410 port_id : port identifier of Ethernet device
411
412 flow : flow rule handle to destroy.
413
414 error : perform verbose error reporting if not NULL.
415
416 0 is returned upon success, negative errno otherwise.
417
418 RTE Flow Flush
419 ==============
420
421 All flow rule handles associated with a port can be released using
422 *rte_flow_flush*. They are released as with successive calls to function
423 *rte_flow_destroy*.::
424
425   int rte_flow_flush(uint16_t port_id,
426     struct rte_flow_error \*error);
427
428 port_id : port identifier of Ethernet device
429
430 error : perform verbose error reporting if not NULL.
431
432 0 is returned upon success, negative errno otherwise.
433
434 RTE Flow Query
435 ==============
436
437 A RTE Flow rule is queried via a call to the function *rte_flow_query*.::
438
439   int rte_flow_query(uint16_t port_id,
440                   struct rte_flow *flow,
441                   const struct rte_flow_action *action,
442                   void *data,
443                   struct rte_flow_error *error);
444
445 port_id : port identifier of Ethernet device
446
447 flow : flow rule handle to query
448
449 action : action to query, this must match prototype from flow rule.
450
451 data : pointer to storage for the associated query data type
452
453 error : perform verbose error reporting if not NULL.
454
455 0 is returned upon success, negative errno otherwise.
456
457 RTE Flow Rules
458 ==============
459
460 A flow rule is the combination of attributes with a matching pattern and
461 a list of actions. Each flow rules consists of:
462
463 -  **Attributes (represented by struct rte_flow_attr):** properties of a flow rule such as its direction (ingress or egress) and priority.
464
465 -  **Pattern Items (represented by struct rte_flow_item):** is part of a matching pattern that either matches specific packet data or traffic properties.
466
467 -  **Matching pattern:** traffic properties to look for, a combination of any number of items.
468
469 -  **Actions (represented by struct rte_flow_action):** operations to perform whenever a packet is matched by a pattern.
470
471 Attributes
472 ==========
473
474 Flow rule patterns apply to inbound and/or outbound traffic. For the
475 purposes described in later sections the rules apply to ingress only.
476 For further information, please refer to section 11 of the DPDK
477 Programmers guide <https://doc.dpdk.org/guides/prog_guide/rte_flow.html>.::
478
479   *struct*\ rte_flow_attr <https://doc.dpdk.org/api/structrte__flow__attr.html>\ *{*
480   *uint32_t*\ group <https://doc.dpdk.org/api/structrte__flow__attr.html#a0d20c78ce80e301ed514bd4b4dec9ec0>\ *;*
481   *uint32_t*\ priority <https://doc.dpdk.org/api/structrte__flow__attr.html#a90249de64da5ae5d7acd34da7ea1b857>\ *;*
482   *uint32_t*\ ingress <https://doc.dpdk.org/api/structrte__flow__attr.html#ae4d19341d5298a2bc61f9eb941b1179c>\ *:1;*
483   *uint32_t*\ egress <https://doc.dpdk.org/api/structrte__flow__attr.html#a33bdc3cfc314d71f3187a8186bc570a9>\ *:1;*
484   *uint32_t*\ transfer <https://doc.dpdk.org/api/structrte__flow__attr.html#a9371183486f590ef35fef41dec806fef>\ *:1;*
485   *uint32_t*\ reserved <https://doc.dpdk.org/api/structrte__flow__attr.html#aa43c4c21b173ada1b6b7568956f0d650>\ *:29;*
486   *};*
487
488 Pattern items
489 =============
490
491 For the purposes described in later sections Pattern items are primarily
492 for matching protocol headers and packet data, usually associated with a
493 specification structure. These must be stacked in the same order as the
494 protocol layers to match inside packets, starting from the lowest.
495
496 Item specification structures are used to match specific values among
497 protocol fields (or item properties).
498
499 Up to three structures of the same type can be set for a given item:
500
501 -  **spec:** values to match (e.g. a given IPv4 address).
502
503 -  **last:** upper bound for an inclusive range with corresponding fields in spec.
504
505 -  **mask:** bit-mask applied to both spec and last whose purpose is to distinguish the values to take into account and/or partially mask them out (e.g. in order to match an IPv4 address prefix).
506
507 Table 14. Example RTE FLOW Item Types
508
509 +-------------+---------------------------------------+-------------------------+
510 | Item Type\* | Description                           | Specification Structure |
511 +=============+=======================================+=========================+
512 | END         | End marker for item lists             | None                    |
513 +-------------+---------------------------------------+-------------------------+
514 | VOID        | Used as a placeholder for convenience | None                    |
515 +-------------+---------------------------------------+-------------------------+
516 | ETH         | Matches an Ethernet header            | rte_flow_item_eth       |
517 +-------------+---------------------------------------+-------------------------+
518 | VLAN        | Matches an 802.1Q/ad VLAN tag.        | rte_flow_item_vlan      |
519 +-------------+---------------------------------------+-------------------------+
520 | IPV4        | Matches an IPv4 header                | rte_flow_item_ipv4      |
521 +-------------+---------------------------------------+-------------------------+
522 | IPV6        | Matches an IPv6 header                | rte_flow_item_ipv6      |
523 +-------------+---------------------------------------+-------------------------+
524 | ICMP        | Matches an ICMP header.               | rte_flow_item_icmp      |
525 +-------------+---------------------------------------+-------------------------+
526 | UDP         | Matches an UDP header.                | rte_flow_item_udp       |
527 +-------------+---------------------------------------+-------------------------+
528 | TCP         | Matches a TCP header.                 | rte_flow_item_tcp       |
529 +-------------+---------------------------------------+-------------------------+
530 | SCTP        | Matches a SCTP header.                | rte_flow_item_sctp      |
531 +-------------+---------------------------------------+-------------------------+
532 | VXLAN       | Matches a VXLAN header.               | rte_flow_item_vxlan     |
533 +-------------+---------------------------------------+-------------------------+
534 | NVGRE       | Matches a NVGRE header.               | rte_flow_item_nvgre     |
535 +-------------+---------------------------------------+-------------------------+
536 | ECPRI       | Matches ECPRI Header                  | rte_flow_item_ecpri     |
537 +-------------+---------------------------------------+-------------------------+
538
539 ::
540
541   RTE_FLOW_ITEM_TYPE_ETH
542
543   struct rte_flow_item_eth {
544           struct rte_ether_addr dst; /**< Destination MAC. */
545           struct rte_ether_addr src; /**< Source MAC. > */
546           rte_be16_t type; /**< EtherType or TPID.> */
547   };
548
549   struct rte_ether_addr {
550           uint8_t addr_bytes[RTE_ETHER_ADDR_LEN]; /**< Addr bytes in tx order */
551   }
552
553 ::
554
555   RTE_FLOW_ITEM_TYPE_IPV4 
556   
557   struct rte_flow_item_ipv4 {
558           struct rte_ipv4_hdr hdr; /**< IPv4 header definition. */
559   };
560
561   struct rte_ipv4_hdr {
562           uint8_t  version_ihl;           /**< version and header length */
563           uint8_t  type_of_service;       /**< type of service */
564           rte_be16_t total_length;        /**< length of packet */
565           rte_be16_t packet_id;           /**< packet ID */
566           rte_be16_t fragment_offset;     /**< fragmentation offset */
567           uint8_t  time_to_live;          /**< time to live */
568           uint8_t  next_proto_id;         /**< protocol ID */
569           rte_be16_t hdr_checksum;        /**< header checksum */
570           rte_be32_t src_addr;            /**< source address */
571           rte_be32_t dst_addr;            /**< destination address */
572   }
573
574   RTE_FLOW_ITEM_TYPE_UDP
575
576   struct rte_flow_item_udp {
577           struct rte_udp_hdr hdr; /**< UDP header definition. */
578   };
579
580   struct rte_udp_hdr {
581           rte_be16_t src_port;    /**< UDP source port. */
582           rte_be16_t dst_port;    /**< UDP destination port. */
583           rte_be16_t dgram_len;   /**< UDP datagram length */
584           rte_be16_t dgram_cksum; /**< UDP datagram checksum */
585   }
586
587   RTE_FLOW_ITEM_TYPE_ECPRI 
588   
589   struct rte_flow_item_ecpri {
590     struct rte_ecpri_combined_msg_hdr hdr;
591   };
592
593   struct rte_ecpri_combined_msg_hdr {
594     struct rte_ecpri_common_hdr common;
595     union {
596       struct rte_ecpri_msg_iq_data type0;
597       struct rte_ecpri_msg_bit_seq type1;
598       struct rte_ecpri_msg_rtc_ctrl type2;
599       struct rte_ecpri_msg_bit_seq type3;
600       struct rte_ecpri_msg_rm_access type4;
601       struct rte_ecpri_msg_delay_measure type5;
602       struct rte_ecpri_msg_remote_reset type6;
603       struct rte_ecpri_msg_event_ind type7;
604       rte_be32_t dummy[3];
605     };
606   };
607   struct rte_ecpri_common_hdr {
608     union {
609       rte_be32_t u32;   /**< 4B common header in BE */
610       struct {
611   #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
612         uint32_t size:16; /**< Payload Size */
613         uint32_t type:8; /**< Message Type */
614         uint32_t c:1; /**< Concatenation Indicator */
615         uint32_t res:3; /**< Reserved */
616         uint32_t revision:4; /**< Protocol Revision */
617   #elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
618         uint32_t revision:4; /**< Protocol Revision */
619         uint32_t res:3; /**< Reserved */
620         uint32_t c:1;  /**< Concatenation Indicator */
621         uint32_t type:8; /**< Message Type */
622         uint32_t size:16; /**< Payload Size */
623   #endif
624       };
625     };
626   };
627   /**
628   * eCPRI Message Header of Type #0: IQ Data
629   */
630   struct rte_ecpri_msg_iq_data {
631     rte_be16_t pc_id;           /**< Physical channel ID */
632     rte_be16_t seq_id;          /**< Sequence ID */
633   };
634
635   /**
636   * eCPRI Message Header of Type #1: Bit Sequence
637   */
638   struct rte_ecpri_msg_bit_seq {
639     rte_be16_t pc_id;           /**< Physical channel ID */
640     rte_be16_t seq_id;          /**< Sequence ID */
641   };
642
643   /**
644   * eCPRI Message Header of Type #2: Real-Time Control Data
645   */
646   struct rte_ecpri_msg_rtc_ctrl {
647     rte_be16_t rtc_id;          /**< Real-Time Control Data ID */
648     rte_be16_t seq_id;          /**< Sequence ID */
649   };
650
651   /**
652   * eCPRI Message Header of Type #3: Generic Data Transfer
653   */
654   struct rte_ecpri_msg_gen_data {
655     rte_be32_t pc_id;           /**< Physical channel ID */
656     rte_be32_t seq_id;          /**< Sequence ID */
657   };
658
659   /**
660   * eCPRI Message Header of Type #4: Remote Memory Access
661   */
662   RTE_STD_C11
663   struct rte_ecpri_msg_rm_access {
664   #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
665     uint32_t ele_id:16;         /**< Element ID */
666     uint32_t rr:4;                      /**< Req/Resp */
667     uint32_t rw:4;                      /**< Read/Write */
668     uint32_t rma_id:8;          /**< Remote Memory Access ID */
669   #elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
670     uint32_t rma_id:8;          /**< Remote Memory Access ID */
671     uint32_t rw:4;                      /**< Read/Write */
672     uint32_t rr:4;                      /**< Req/Resp */
673     uint32_t ele_id:16;         /**< Element ID */
674   #endif
675     uint8_t addr[6];            /**< 48-bits address */
676     rte_be16_t length;          /**< number of bytes */
677   };
678
679   /**
680   * eCPRI Message Header of Type #5: One-Way Delay Measurement
681   */
682   struct rte_ecpri_msg_delay_measure {
683     uint8_t msr_id;                     /**< Measurement ID */
684     uint8_t act_type;           /**< Action Type */
685   };
686
687   /**
688   * eCPRI Message Header of Type #6: Remote Reset
689   */
690   struct rte_ecpri_msg_remote_reset {
691     rte_be16_t rst_id;          /**< Reset ID */
692     uint8_t rst_op;                     /**< Reset Code Op */
693   };
694
695   /**
696   * eCPRI Message Header of Type #7: Event Indication
697   */
698   struct rte_ecpri_msg_event_ind {
699     uint8_t evt_id;                     /**< Event ID */
700     uint8_t evt_type;           /**< Event Type */
701     uint8_t seq;                        /**< Sequence Number */
702     uint8_t number;                     /**< Number of Faults/Notif */
703   };
704
705
706 Matching Patterns
707 =================
708
709 A matching pattern is formed by stacking items starting from the lowest
710 protocol layer to match. Patterns are terminated by END pattern item.
711
712 Actions
713 -------
714
715 Each possible action is represented by a type. An action can have an
716 associated configuration object. Actions are terminated by the END
717 action.
718
719 Table 15. RTE FLOW Actions
720
721 +----------+----------------------------+-------------------------+
722 | Action\* | Description                | Configuration Structure |
723 +==========+============================+=========================+
724 | END      || End marker for action     | none                    |
725 |          || lists                     |                         |
726 +----------+----------------------------+-------------------------+
727 | VOID     || Used as a placeholder for | none                    |
728 |          || convenience               |                         |
729 +----------+----------------------------+-------------------------+
730 | PASSTHRU || Leaves traffic up for     | none                    |
731 |          || additional processing by  |                         |
732 |          || subsequent flow rules;    |                         |
733 |          || makes a flow rule         |                         |
734 |          || non-terminating.          |                         |
735 +----------+----------------------------+-------------------------+
736 | MARK     || Attaches an integer value | rte_flow_action_mark    |
737 |          || to packets and sets       |                         |
738 |          || PKT_RX_FDIR and           |                         |
739 |          || PKT_RX_FDIR_ID mbuf flags |                         |
740 +----------+----------------------------+-------------------------+
741 | QUEUE    || Assigns packets to a given| rte_flow_action_queue   |
742 |          || queue index               |                         |
743 +----------+----------------------------+-------------------------+
744 | DROP     || Drops packets             | none                    |
745 +----------+----------------------------+-------------------------+
746 | COUNT    || Enables Counters for this | rte_flow_action_count   |
747 |          || flow rule                 |                         |
748 +----------+----------------------------+-------------------------+
749 | RSS      || Similar to QUEUE, except  | rte_flow_action_rss     |
750 |          || RSS is additionally       |                         |
751 |          || performed on packets to   |                         |
752 |          || spread them among several |                         |
753 |          || queues according to the   |                         |
754 |          || provided parameters.      |                         |
755 +----------+----------------------------+-------------------------+
756 | VF       || Directs matching traffic  | rte_flow_action_vf      |
757 |          || to a given virtual        |                         |
758 |          || function of the current   |                         |
759 |          || device                    |                         |
760 +----------+----------------------------+-------------------------+
761
762 Route to specific Queue id based on ecpriRtcid/ecpriPcid
763 ========================================================
764
765 An RTE Flow Rule will be created to match an eCPRI packet with a
766 specific pc_id value and route it to specified queues.
767
768 .. _pattern-items-1:
769
770 Pattern Items
771 -------------
772
773 Table 16. Pattern Items to match eCPRI packet with a Specific Physical
774 Channel ID (pc_id)
775
776 +-------+----------+-----------------------+-----------------------+
777 | Index | Item     | Spec                  | Mask                  |
778 +=======+==========+=======================+=======================+
779 | 0     | Ethernet | 0                     | 0                     |
780 +-------+----------+-----------------------+-----------------------+
781 | 1     | eCPRI    || hdr.common.type =    || hdr.common.type =    |
782 |       |          || RTE_EC               || 0xff;                |
783 |       |          || PRI_MSG_TYPE_IQ_DATA;|                       |
784 |       |          |                       || hdr.type0.pc_id =    |
785 |       |          || hdr.type0.pc_id =    || 0xffff;              |
786 |       |          || pc_id;               |                       |
787 +-------+----------+-----------------------+-----------------------+
788 | 2     | END      | 0                     | 0                     |
789 +-------+----------+-----------------------+-----------------------+
790
791 The following code sets up the *RTE_FLOW_ITEM_TYPE_ETH* and
792 *RTE_FLOW_ITEM_TYPE_ECPRI* Pattern Items.
793
794 The *RTE_FLOW_ITEM_TYPE_ECPRI* Pattern is configured to match on the
795 pc_id value (in this case 8 converted to Big Endian byte order).
796
797 +--------------------------------------------------------------------------+
798 | uint8_t pc_id_be = 0x0800;                                               |
799 |                                                                          |
800 | #define MAX_PATTERN_NUM 3                                                |
801 |                                                                          |
802 | struct rte_flow_item pattern[MAX_PATTERN_NUM];                           |
803 |                                                                          |
804 | struct rte_flow_action action[MAX_ACTION_NUM];                           |
805 |                                                                          |
806 | struct rte_flow_item_ecpri ecpri_spec;                                   |
807 |                                                                          |
808 | struct rte_flow_item_ecpri ecpri_mask;                                   |
809 |                                                                          |
810 | /\* Ethernet \*/                                                         |
811 |                                                                          |
812 | patterns[0].type = RTE_FLOW_ITEM_TYPE_ETH;                               |
813 |                                                                          |
814 | patterns[0].spec = 0;                                                    |
815 |                                                                          |
816 | patterns[0].mask = 0;                                                    |
817 |                                                                          |
818 | /\* ECPRI \*/                                                            |
819 |                                                                          |
820 | ecpri_spec.hdr.common.type = RTE_ECPRI_MSG_TYPE_IQ_DATA;                 |
821 |                                                                          |
822 | ecpri_spec.hdr.type0.pc_id = pc_id_be;                                   |
823 |                                                                          |
824 | ecpri_mask.hdr.common.type = 0xff;                                       |
825 |                                                                          |
826 | ecpri_mask.hdr.type0.pc_id = 0xffff;                                     |
827 |                                                                          |
828 | ecpri_spec.hdr.common.u32 = rte_cpu_to_be_32(ecpri_spec.hdr.common.u32); |
829 |                                                                          |
830 | pattern[1].type = RTE_FLOW_ITEM_TYPE_ECPRI;                              |
831 |                                                                          |
832 | pattern[1].spec = &ecpri_spec;                                           |
833 |                                                                          |
834 | pattern[1].mask = &ecpri_mask;                                           |
835 |                                                                          |
836 | /\* END the pattern array \*/                                            |
837 |                                                                          |
838 | patterns[2].type = RTE_FLOW_ITEM_TYPE_END                                |
839 +--------------------------------------------------------------------------+
840
841 Action
842 ------
843
844 Table 17. QUEUE action for given queue id
845
846 ===== ====== ====== ==================== ====================
847 Index Action Fields Description          Value
848 ===== ====== ====== ==================== ====================
849 0     QUEUE  index  queue indices to use Must be 0,1,2,3, etc
850 1     END
851 ===== ====== ====== ==================== ====================
852
853 The following code sets up the action *RTE_FLOW_ACTION_TYPE_QUEUE* and
854 calls the *rte_flow_create* function to create the RTE Flow rule.
855
856 +----------------------------------------------------------------------+
857 | *#define MAX_ACTION_NUM 2*                                           |
858 |                                                                      |
859 | *uint16_t rx_q = 4;*                                                 |
860 |                                                                      |
861 | *struct rte_flow_action_queue queue = { .index = rx_q };*            |
862 |                                                                      |
863 | *struct rte_flow \*handle;*                                          |
864 |                                                                      |
865 | *struct rte_flow_error err;*                                         |
866 |                                                                      |
867 | *struct rte_flow_action actions[MAX_ACTION_NUM];*                    |
868 |                                                                      |
869 | *struct rte_flow_attr attributes = {.ingress = 1 };*                 |
870 |                                                                      |
871 | *action[0].type = RTE_FLOW_ACTION_TYPE_QUEUE;*                       |
872 |                                                                      |
873 | *action[0].conf = &queue;*                                           |
874 |                                                                      |
875 | *action[1].type = RTE_FLOW_ACTION_TYPE_END;*                         |
876 |                                                                      |
877 | *handle = rte_flow_create (port_id, &attributes, patterns, actions,  |
878 | &err);*                                                              |
879 +----------------------------------------------------------------------+