1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2020 Intel Corporation
4 #ifndef __INCLUDE_RTE_SWX_PIPELINE_H__
5 #define __INCLUDE_RTE_SWX_PIPELINE_H__
19 #include <rte_compat.h>
21 #include "rte_swx_port.h"
22 #include "rte_swx_table.h"
23 #include "rte_swx_extern.h"
26 #ifndef RTE_SWX_NAME_SIZE
27 #define RTE_SWX_NAME_SIZE 64
30 /** Instruction size. */
31 #ifndef RTE_SWX_INSTRUCTION_SIZE
32 #define RTE_SWX_INSTRUCTION_SIZE 256
35 /** Instruction tokens. */
36 #ifndef RTE_SWX_INSTRUCTION_TOKENS_MAX
37 #define RTE_SWX_INSTRUCTION_TOKENS_MAX 16
41 * Pipeline setup and operation
44 /** Pipeline opaque data structure. */
45 struct rte_swx_pipeline;
51 * Pipeline handle. Must point to valid memory. Contains valid pipeline handle
52 * when the function returns successfully.
53 * @param[in] numa_node
54 * Non-Uniform Memory Access (NUMA) node.
56 * 0 on success or the following error codes otherwise:
57 * -EINVAL: Invalid argument;
58 * -ENOMEM: Not enough space/cannot allocate memory.
62 rte_swx_pipeline_config(struct rte_swx_pipeline **p,
66 * Pipeline input ports
70 * Pipeline input port type register
75 * Input port type name.
77 * Input port type operations.
79 * 0 on success or the following error codes otherwise:
80 * -EINVAL: Invalid argument;
81 * -ENOMEM: Not enough space/cannot allocate memory;
82 * -EEXIST: Input port type with this name already exists.
86 rte_swx_pipeline_port_in_type_register(struct rte_swx_pipeline *p,
88 struct rte_swx_port_in_ops *ops);
91 * Pipeline input port configure
97 * @param[in] port_type_name
98 * Existing input port type name.
100 * Input port creation arguments.
102 * 0 on success or the following error codes otherwise:
103 * -EINVAL: Invalid argument;
104 * -ENOMEM: Not enough space/cannot allocate memory;
105 * -ENODEV: Input port object creation error.
109 rte_swx_pipeline_port_in_config(struct rte_swx_pipeline *p,
111 const char *port_type_name,
115 * Pipeline output ports
119 * Pipeline output port type register
124 * Output port type name.
126 * Output port type operations.
128 * 0 on success or the following error codes otherwise:
129 * -EINVAL: Invalid argument;
130 * -ENOMEM: Not enough space/cannot allocate memory;
131 * -EEXIST: Output port type with this name already exists.
135 rte_swx_pipeline_port_out_type_register(struct rte_swx_pipeline *p,
137 struct rte_swx_port_out_ops *ops);
140 * Pipeline output port configure
146 * @param[in] port_type_name
147 * Existing output port type name.
149 * Output port creation arguments.
151 * 0 on success or the following error codes otherwise:
152 * -EINVAL: Invalid argument;
153 * -ENOMEM: Not enough space/cannot allocate memory;
154 * -ENODEV: Output port object creation error.
158 rte_swx_pipeline_port_out_config(struct rte_swx_pipeline *p,
160 const char *port_type_name,
164 * Extern objects and functions
168 * Pipeline extern type register
174 * @param[in] mailbox_struct_type_name
175 * Name of existing struct type used to define the mailbox size and layout for
176 * the extern objects that are instances of this type. Each extern object gets
177 * its own mailbox, which is used to pass the input arguments to the member
178 * functions and retrieve the output results.
179 * @param[in] constructor
180 * Function used to create the extern objects that are instances of this type.
181 * @param[in] destructor
182 * Function used to free the extern objects that are instances of this type.
184 * 0 on success or the following error codes otherwise:
185 * -EINVAL: Invalid argument;
186 * -ENOMEM: Not enough space/cannot allocate memory;
187 * -EEXIST: Extern type with this name already exists.
191 rte_swx_pipeline_extern_type_register(struct rte_swx_pipeline *p,
193 const char *mailbox_struct_type_name,
194 rte_swx_extern_type_constructor_t constructor,
195 rte_swx_extern_type_destructor_t destructor);
198 * Pipeline extern type member function register
202 * @param[in] extern_type_name
203 * Existing extern type name.
205 * Name for the new member function to be added to the extern type.
206 * @param[in] member_func
207 * The new member function.
209 * 0 on success or the following error codes otherwise:
210 * -EINVAL: Invalid argument;
211 * -ENOMEM: Not enough space/cannot allocate memory;
212 * -EEXIST: Member function with this name already exists for this type;
213 * -ENOSPC: Maximum number of member functions reached for this type.
217 rte_swx_pipeline_extern_type_member_func_register(struct rte_swx_pipeline *p,
218 const char *extern_type_name,
220 rte_swx_extern_type_member_func_t member_func);
223 * Pipeline extern object configure
225 * Instantiate a given extern type to create new extern object.
229 * @param[in] extern_type_name
230 * Existing extern type name.
232 * Name for the new object instantiating the extern type.
234 * Extern object constructor arguments.
236 * 0 on success or the following error codes otherwise:
237 * -EINVAL: Invalid argument;
238 * -ENOMEM: Not enough space/cannot allocate memory;
239 * -EEXIST: Extern object with this name already exists;
240 * -ENODEV: Extern object constructor error.
244 rte_swx_pipeline_extern_object_config(struct rte_swx_pipeline *p,
245 const char *extern_type_name,
250 * Pipeline extern function register
255 * Extern function name.
256 * @param[in] mailbox_struct_type_name
257 * Name of existing struct type used to define the mailbox size and layout for
258 * this extern function. The mailbox is used to pass the input arguments to
259 * the extern function and retrieve the output results.
261 * The extern function.
263 * 0 on success or the following error codes otherwise:
264 * -EINVAL: Invalid argument;
265 * -ENOMEM: Not enough space/cannot allocate memory;
266 * -EEXIST: Extern function with this name already exists.
270 rte_swx_pipeline_extern_func_register(struct rte_swx_pipeline *p,
272 const char *mailbox_struct_type_name,
273 rte_swx_extern_func_t func);
276 * Packet headers and meta-data
279 /** Structure (struct) field. */
280 struct rte_swx_field_params {
281 /** Struct field name. */
284 /** Struct field size (in bits).
285 * Restriction: All struct fields must be a multiple of 8 bits.
286 * Restriction: All struct fields must be no greater than 64 bits.
292 * Pipeline struct type register
294 * Structs are used extensively in many part of the pipeline to define the size
295 * and layout of a specific memory piece such as: headers, meta-data, action
296 * data stored in a table entry, mailboxes for extern objects and functions.
297 * Similar to C language structs, they are a well defined sequence of fields,
298 * with each field having a unique name and a constant size.
300 * In order to use structs to express variable size packet headers such as IPv4
301 * with options, it is allowed for the last field of the struct type to have a
302 * variable size between 0 and *n_bits* bits, with the actual size of this field
303 * determined at run-time for each packet. This struct feature is restricted to
304 * just a few selected instructions that deal with packet headers, so a typical
305 * struct generally has a constant size that is fully known when its struct type
313 * The sequence of struct fields.
314 * @param[in] n_fields
315 * The number of struct fields.
316 * @param[in] last_field_has_variable_size
317 * If non-zero (true), then the last field has a variable size between 0 and
318 * *n_bits* bits, with its actual size determined at run-time for each packet.
319 * If zero (false), then the last field has a constant size of *n_bits* bits.
321 * 0 on success or the following error codes otherwise:
322 * -EINVAL: Invalid argument;
323 * -ENOMEM: Not enough space/cannot allocate memory;
324 * -EEXIST: Struct type with this name already exists.
328 rte_swx_pipeline_struct_type_register(struct rte_swx_pipeline *p,
330 struct rte_swx_field_params *fields,
332 int last_field_has_variable_size);
335 * Pipeline packet header register
341 * @param[in] struct_type_name
342 * The struct type instantiated by this packet header.
344 * 0 on success or the following error codes otherwise:
345 * -EINVAL: Invalid argument;
346 * -ENOMEM: Not enough space/cannot allocate memory;
347 * -EEXIST: Header with this name already exists;
348 * -ENOSPC: Maximum number of headers reached for the pipeline.
352 rte_swx_pipeline_packet_header_register(struct rte_swx_pipeline *p,
354 const char *struct_type_name);
357 * Pipeline packet meta-data register
361 * @param[in] struct_type_name
362 * The struct type instantiated by the packet meta-data.
364 * 0 on success or the following error codes otherwise:
365 * -EINVAL: Invalid argument.
369 rte_swx_pipeline_packet_metadata_register(struct rte_swx_pipeline *p,
370 const char *struct_type_name);
377 * Instruction operands:
379 *<pre>+-----+---------------------------+------------------+-----+-----+</pre>
380 *<pre>| | Description | Format | DST | SRC |</pre>
381 *<pre>+-----+---------------------------+------------------+-----+-----+</pre>
382 *<pre>| hdr | Header | h.header | | |</pre>
383 *<pre>+-----+---------------------------+------------------+-----+-----+</pre>
384 *<pre>| act | Action | ACTION | | |</pre>
385 *<pre>+-----+---------------------------+------------------+-----+-----+</pre>
386 *<pre>| tbl | Table | TABLE | | |</pre>
387 *<pre>+-----+---------------------------+------------------+-----+-----+</pre>
388 *<pre>| H | Header field | h.header.field | YES | YES |</pre>
389 *<pre>+-----+---------------------------+------------------+-----+-----+</pre>
390 *<pre>| M | Meta-data field | m.field | YES | YES |</pre>
391 *<pre>+-----+---------------------------+------------------+-----+-----+</pre>
392 *<pre>| E | Extern obj mailbox field | e.ext_obj.field | YES | YES |</pre>
393 *<pre>+-----+---------------------------+------------------+-----+-----+</pre>
394 *<pre>| F | Extern func mailbox field | f.ext_func.field | YES | YES |</pre>
395 *<pre>+-----+---------------------------+------------------+-----+-----+</pre>
396 *<pre>| T | Table action data field | t.header.field | NO | YES |</pre>
397 *<pre>+-----+---------------------------+------------------+-----+-----+</pre>
398 *<pre>| I | Immediate value (64-bit) | h.header.field | NO | YES |</pre>
399 *<pre>+-----+---------------------------+------------------+-----+-----+</pre>
403 *<pre>+------------+----------------------+-------------------+------+--------+</pre>
404 *<pre>| Instr. | Instruction | Instruction | 1st | 2nd |</pre>
405 *<pre>| Name | Description | Format | opnd.| opnd. |</pre>
406 *<pre>+------------+----------------------+-------------------+------+--------+</pre>
407 *<pre>| rx | Receive one pkt | rx m.port_in | M | |</pre>
408 *<pre>+------------+----------------------+-------------------+------+--------+</pre>
409 *<pre>| tx | Transmit one pkt | tx m.port_out | M | |</pre>
410 *<pre>+------------+----------------------+-------------------+------+--------+</pre>
411 *<pre>| extract | Extract one hdr | extract h.hdr | hdr | |</pre>
412 *<pre>+------------+----------------------+-------------------+------+--------+</pre>
413 *<pre>| emit | Emit one hdr | emit h.hdr | hdr | |</pre>
414 *<pre>+------------+----------------------+-------------------+------+--------+</pre>
415 *<pre>| validate | Validate one hdr | validate h.hdr | hdr | |</pre>
416 *<pre>+------------+----------------------+-------------------+------+--------+</pre>
417 *<pre>| invalidate | Invalidate one hdr | invalidate h.hdr | hdr | |</pre>
418 *<pre>+------------+----------------------+-------------------+------+--------+</pre>
419 *<pre>| mov | dst = src | mov dst src | HMEF | HMEFTI |</pre>
420 *<pre>+------------+----------------------+-------------------+------+--------+</pre>
421 *<pre>| add | dst += src | add dst src | HMEF | HMEFTI |</pre>
422 *<pre>+------------+----------------------+-------------------+------+--------+</pre>
423 *<pre>| sub | dst -= src | add dst src | HMEF | HMEFTI |</pre>
424 *<pre>+------------+----------------------+-------------------+------+--------+</pre>
425 *<pre>| ckadd | Checksum add: dst = | add dst src | HMEF | HMEFTI |</pre>
426 *<pre>| | dst '+ src[0:1] '+ | | | or hdr |</pre>
427 *<pre>| | src[2:3] '+ ... | | | |</pre>
428 *<pre>+------------+----------------------+-------------------+------+--------+</pre>
429 *<pre>| cksub | Checksum subtract: | add dst src | HMEF | HMEFTI |</pre>
430 *<pre>| | dst = dst '- src | | | |</pre>
431 *<pre>+------------+----------------------+-------------------+------+--------+</pre>
432 *<pre>| and | dst &= src | and dst src | HMEF | HMEFTI |</pre>
433 *<pre>+------------+----------------------+-------------------+------+--------+</pre>
434 *<pre>| or | dst |= src | or dst src | HMEF | HMEFTI |</pre>
435 *<pre>+------------+----------------------+-------------------+------+--------+</pre>
436 *<pre>| xor | dst ^= src | xor dst src | HMEF | HMEFTI |</pre>
437 *<pre>+------------+----------------------+-------------------+------+--------+</pre>
438 *<pre>| shl | dst <<= src | shl dst src | HMEF | HMEFTI |</pre>
439 *<pre>+------------+----------------------+-------------------+------+--------+</pre>
440 *<pre>| shr | dst >>= src | shr dst src | HMEF | HMEFTI |</pre>
441 *<pre>+------------+----------------------+-------------------+------+--------+</pre>
442 *<pre>| table | Table lookup | table TABLE | tbl | |</pre>
443 *<pre>+------------+----------------------+-------------------+------+--------+</pre>
444 *<pre>| extern | Ext obj member func | extern e.obj.mfunc| ext | |</pre>
445 *<pre>| | call or ext func call| extern f.func | | |</pre>
446 *<pre>+------------+----------------------+-------------------+------+--------+</pre>
447 *<pre>| jmp | Unconditional jump | jmp LABEL | | |</pre>
448 *<pre>+------------+----------------------+-------------------+------+--------+</pre>
449 *<pre>| jmpv | Jump if hdr is valid | jmpv LABEL h.hdr | hdr | |</pre>
450 *<pre>+------------+----------------------+-------------------+------+--------+</pre>
451 *<pre>| jmpnv | Jump if hdr is inval | jmpnv LABEL h.hdr | hdr | |</pre>
452 *<pre>+------------+----------------------+-------------------+------+--------+</pre>
453 *<pre>| jmph | Jump if tbl lkp hit | jmph LABEL | | |</pre>
454 *<pre>+------------+----------------------+-------------------+------+--------+</pre>
455 *<pre>| jmpnh | Jump if tbl lkp miss | jmpnh LABEL | | |</pre>
456 *<pre>+------------+----------------------+-------------------+------+--------+</pre>
457 *<pre>| jmpa | Jump if action run | jmpa LABEL ACTION | act | |</pre>
458 *<pre>+------------+----------------------+-------------------+------+--------+</pre>
459 *<pre>| jmpna | Jump if act not run | jmpna LABEL ACTION| act | |</pre>
460 *<pre>+------------+----------------------+-------------------+------+--------+</pre>
461 *<pre>| jmpeq | Jump if (a == b) | jmpeq LABEL a b | HMEFT| HMEFTI |</pre>
462 *<pre>+------------+----------------------+-------------------+------+--------+</pre>
463 *<pre>| jmpneq | Jump if (a != b) | jmpneq LABEL a b | HMEFT| HMEFTI |</pre>
464 *<pre>+------------+----------------------+-------------------+------+--------+</pre>
465 *<pre>| jmplt | Jump if (a < b) | jmplt LABEL a b | HMEFT| HMEFTI |</pre>
466 *<pre>+------------+----------------------+-------------------+------+--------+</pre>
467 *<pre>| jmpgt | Jump if (a > b) | jmpgt LABEL a b | HMEFT| HMEFTI |</pre>
468 *<pre>+------------+----------------------+-------------------+------+--------+</pre>
469 *<pre>| return | Return from action | return | | |</pre>
470 *<pre>+------------+----------------------+-------------------+------+--------+</pre>
472 * At initialization time, the pipeline and action instructions (including the
473 * symbolic name operands) are translated to internal data structures that are
482 * Pipeline action configure
488 * @param[in] args_struct_type_name
489 * The struct type instantiated by the action data. The action data represent
490 * the action arguments that are stored in the table entry together with the
491 * action ID. Set to NULL when the action does not have any arguments.
492 * @param[in] instructions
493 * Action instructions.
494 * @param[in] n_instructions
495 * Number of action instructions.
497 * 0 on success or the following error codes otherwise:
498 * -EINVAL: Invalid argument;
499 * -ENOMEM: Not enough space/cannot allocate memory;
500 * -EEXIST: Action with this name already exists.
504 rte_swx_pipeline_action_config(struct rte_swx_pipeline *p,
506 const char *args_struct_type_name,
507 const char **instructions,
508 uint32_t n_instructions);
515 * Pipeline table type register
521 * @param[in] match_type
522 * Match type implemented by the new table type.
524 * Table type operations.
526 * 0 on success or the following error codes otherwise:
527 * -EINVAL: Invalid argument;
528 * -ENOMEM: Not enough space/cannot allocate memory;
529 * -EEXIST: Table type with this name already exists.
533 rte_swx_pipeline_table_type_register(struct rte_swx_pipeline *p,
535 enum rte_swx_table_match_type match_type,
536 struct rte_swx_table_ops *ops);
538 /** Match field parameters. */
539 struct rte_swx_match_field_params {
540 /** Match field name. Must be either a field of one of the registered
541 * packet headers ("h.header.field") or a field of the registered
542 * meta-data ("m.field").
546 /** Match type of the field. */
547 enum rte_swx_table_match_type match_type;
550 /** Pipeline table parameters. */
551 struct rte_swx_pipeline_table_params {
552 /** The set of match fields for the current table.
553 * Restriction: All the match fields of the current table need to be
554 * part of the same struct, i.e. either all the match fields are part of
555 * the same header or all the match fields are part of the meta-data.
557 struct rte_swx_match_field_params *fields;
559 /** The number of match fields for the current table. If set to zero, no
560 * "regular" entries (i.e. entries other than the default entry) can be
561 * added to the current table and the match process always results in
566 /** The set of actions for the current table. */
567 const char **action_names;
569 /** Array of *n_actions* flags. For each action, the associated flag
570 * indicates whether the action can be assigned to regular table entries
571 * (when non-zero, i.e. true) or not (when zero, i.e. false). When set
572 * to NULL, it defaults to true for all actions.
574 int *action_is_for_table_entries;
576 /** Array of *n_actions* flags. For each action, the associated flag
577 * indicates whether the action can be assigned to the default table
578 * entry (when non-zero, i.e. true) or not (when zero, i.e. false).
579 * When set to NULL, it defaults to true for all actions.
581 int *action_is_for_default_entry;
583 /** The number of actions for the current table. Must be at least one.
587 /** The default table action that gets executed on lookup miss. Must be
588 * one of the table actions included in the *action_names*.
590 const char *default_action_name;
592 /** Default action data. The size of this array is the action data size
593 * of the default action. Must be NULL if the default action data size
596 uint8_t *default_action_data;
598 /** If non-zero (true), then the default action of the current table
599 * cannot be changed. If zero (false), then the default action can be
600 * changed in the future with another action from the *action_names*
603 int default_action_is_const;
607 * Pipeline table configure
615 * @param[in] recommended_table_type_name
616 * Recommended table type. Typically set to NULL. Useful as guidance when
617 * there are multiple table types registered for the match type of the table,
618 * as determined from the table match fields specification. Silently ignored
619 * if the recommended table type does not exist or it serves a different match
622 * Table creation arguments.
624 * Guideline on maximum number of table entries.
626 * 0 on success or the following error codes otherwise:
627 * -EINVAL: Invalid argument;
628 * -ENOMEM: Not enough space/cannot allocate memory;
629 * -EEXIST: Table with this name already exists;
630 * -ENODEV: Table creation error.
634 rte_swx_pipeline_table_config(struct rte_swx_pipeline *p,
636 struct rte_swx_pipeline_table_params *params,
637 const char *recommended_table_type_name,
641 /** Pipeline selector table parameters. */
642 struct rte_swx_pipeline_selector_params {
643 /** The group ID field. Input into the selection operation.
644 * Restriction: This field must be a meta-data field.
646 const char *group_id_field_name;
648 /** The set of fields used to select (through a hashing scheme) the
649 * member within the current group. Inputs into the selection operation.
650 * Restriction: All the selector fields must be part of the same struct,
651 * i.e. part of the same header or part of the meta-data structure.
653 const char **selector_field_names;
655 /** The number of selector fields. Must be non-zero. */
656 uint32_t n_selector_fields;
658 /** The member ID field. Output from the selection operation.
659 * Restriction: This field must be a meta-data field.
661 const char *member_id_field_name;
663 /** Maximum number of groups. Must be non-zero. */
664 uint32_t n_groups_max;
666 /** Maximum number of members per group. Must be non-zero. */
667 uint32_t n_members_per_group_max;
671 * Pipeline selector table configure
676 * Selector table name.
678 * Selector table parameters.
680 * 0 on success or the following error codes otherwise:
681 * -EINVAL: Invalid argument;
682 * -ENOMEM: Not enough space/cannot allocate memory;
683 * -EEXIST: Selector table with this name already exists;
684 * -ENODEV: Selector table creation error.
688 rte_swx_pipeline_selector_config(struct rte_swx_pipeline *p,
690 struct rte_swx_pipeline_selector_params *params);
692 /** Pipeline learner table parameters. */
693 struct rte_swx_pipeline_learner_params {
694 /** The set of match fields for the current table.
695 * Restriction: All the match fields of the current table need to be
696 * part of the same struct, i.e. either all the match fields are part of
697 * the same header or all the match fields are part of the meta-data.
699 const char **field_names;
701 /** The number of match fields for the current table. Must be non-zero.
705 /** The set of actions for the current table. */
706 const char **action_names;
708 /** Array of *n_actions* flags. For each action, the associated flag
709 * indicates whether the action can be assigned to regular table entries
710 * (when non-zero, i.e. true) or not (when zero, i.e. false). When set
711 * to NULL, it defaults to true for all actions.
713 int *action_is_for_table_entries;
715 /** Array of *n_actions* flags. For each action, the associated flag
716 * indicates whether the action can be assigned to the default table
717 * entry (when non-zero, i.e. true) or not (when zero, i.e. false).
718 * When set to NULL, it defaults to true for all actions.
720 int *action_is_for_default_entry;
722 /** The number of actions for the current table. Must be at least one.
726 /** The default table action that gets executed on lookup miss. Must be
727 * one of the table actions included in the *action_names*.
729 const char *default_action_name;
731 /** Default action data. The size of this array is the action data size
732 * of the default action. Must be NULL if the default action data size
735 uint8_t *default_action_data;
737 /** If non-zero (true), then the default action of the current table
738 * cannot be changed. If zero (false), then the default action can be
739 * changed in the future with another action from the *action_names*
742 int default_action_is_const;
746 * Pipeline learner table configure
751 * Learner table name.
753 * Learner table parameters.
755 * The maximum number of table entries. Must be non-zero.
757 * Table entry timeout in seconds. Must be non-zero.
759 * 0 on success or the following error codes otherwise:
760 * -EINVAL: Invalid argument;
761 * -ENOMEM: Not enough space/cannot allocate memory;
762 * -EEXIST: Learner table with this name already exists;
763 * -ENODEV: Learner table creation error.
767 rte_swx_pipeline_learner_config(struct rte_swx_pipeline *p,
769 struct rte_swx_pipeline_learner_params *params,
774 * Pipeline register array configure
779 * Register array name.
781 * Number of registers in the array. Each register is 64-bit in size.
782 * @param[in] init_val
783 * Initial value for every register in the array. The recommended value is 0.
785 * 0 on success or the following error codes otherwise:
786 * -EINVAL: Invalid argument;
787 * -ENOMEM: Not enough space/cannot allocate memory;
788 * -EEXIST: Register array with this name already exists.
792 rte_swx_pipeline_regarray_config(struct rte_swx_pipeline *p,
798 * Pipeline meter array configure
805 * Number of meters in the array. Each meter in the array implements the Two
806 * Rate Three Color Marker (trTCM) algorithm, as specified by RFC 2698.
808 * 0 on success or the following error codes otherwise:
809 * -EINVAL: Invalid argument;
810 * -ENOMEM: Not enough space/cannot allocate memory;
811 * -EEXIST: Meter array with this name already exists.
815 rte_swx_pipeline_metarray_config(struct rte_swx_pipeline *p,
820 * Pipeline instructions configure
824 * @param[in] instructions
825 * Pipeline instructions.
826 * @param[in] n_instructions
827 * Number of pipeline instructions.
829 * 0 on success or the following error codes otherwise:
830 * -EINVAL: Invalid argument;
831 * -ENOMEM: Not enough space/cannot allocate memory.
835 rte_swx_pipeline_instructions_config(struct rte_swx_pipeline *p,
836 const char **instructions,
837 uint32_t n_instructions);
842 * Once called, the pipeline build operation marks the end of pipeline
843 * configuration. At this point, all the internal data structures needed to run
844 * the pipeline are built.
849 * 0 on success or the following error codes otherwise:
850 * -EINVAL: Invalid argument;
851 * -ENOMEM: Not enough space/cannot allocate memory;
852 * -EEXIST: Pipeline was already built successfully.
856 rte_swx_pipeline_build(struct rte_swx_pipeline *p);
859 * Pipeline build from specification file
864 * Pipeline specification file.
865 * @param[out] err_line
866 * In case of error and non-NULL, the line number within the *spec* file where
867 * the error occurred. The first line number in the file is 1.
868 * @param[out] err_msg
869 * In case of error and non-NULL, the error message.
871 * 0 on success or the following error codes otherwise:
872 * -EINVAL: Invalid argument;
873 * -ENOMEM: Not enough space/cannot allocate memory;
874 * -EEXIST: Resource with the same name already exists;
875 * -ENODEV: Extern object or table creation error.
879 rte_swx_pipeline_build_from_spec(struct rte_swx_pipeline *p,
882 const char **err_msg);
889 * @param[in] n_instructions
890 * Number of instructions to execute.
894 rte_swx_pipeline_run(struct rte_swx_pipeline *p,
895 uint32_t n_instructions);
900 * Flush all output ports of the pipeline.
907 rte_swx_pipeline_flush(struct rte_swx_pipeline *p);
917 rte_swx_pipeline_free(struct rte_swx_pipeline *p);