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