X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_pipeline%2Frte_swx_ctl.h;h=bab1894944761e57e55b5b61655cf536caa2148f;hb=5b38d8cd4663;hp=54b895f0ad1d60b54bb90b4a9d71c7ce457d5cf8;hpb=393b96e2aa2a578bc38a35f436a31cf42b04cc37;p=dpdk.git diff --git a/lib/librte_pipeline/rte_swx_ctl.h b/lib/librte_pipeline/rte_swx_ctl.h index 54b895f0ad..bab1894944 100644 --- a/lib/librte_pipeline/rte_swx_ctl.h +++ b/lib/librte_pipeline/rte_swx_ctl.h @@ -391,6 +391,176 @@ int rte_swx_pipeline_table_state_set(struct rte_swx_pipeline *p, struct rte_swx_table_state *table_state); +/* + * High Level Reference Table Update API. + */ + +/** Pipeline control opaque data structure. */ +struct rte_swx_ctl_pipeline; + +/** + * Pipeline control create + * + * @param[in] p + * Pipeline handle. + * @return + * Pipeline control handle, on success, or NULL, on error. + */ +__rte_experimental +struct rte_swx_ctl_pipeline * +rte_swx_ctl_pipeline_create(struct rte_swx_pipeline *p); + +/** + * Pipeline table entry add + * + * Schedule entry for addition to table or update as part of the next commit + * operation. + * + * @param[in] ctl + * Pipeline control handle. + * @param[in] table_name + * Table name. + * @param[in] entry + * Entry to be added to the table. + * @return + * 0 on success or the following error codes otherwise: + * -EINVAL: Invalid argument. + */ +__rte_experimental +int +rte_swx_ctl_pipeline_table_entry_add(struct rte_swx_ctl_pipeline *ctl, + const char *table_name, + struct rte_swx_table_entry *entry); + +/** + * Pipeline table default entry add + * + * Schedule table default entry update as part of the next commit operation. + * + * @param[in] ctl + * Pipeline control handle. + * @param[in] table_name + * Table name. + * @param[in] entry + * The new table default entry. The *key* and *key_mask* entry fields are + * ignored. + * @return + * 0 on success or the following error codes otherwise: + * -EINVAL: Invalid argument. + */ +__rte_experimental +int +rte_swx_ctl_pipeline_table_default_entry_add(struct rte_swx_ctl_pipeline *ctl, + const char *table_name, + struct rte_swx_table_entry *entry); + +/** + * Pipeline table entry delete + * + * Schedule entry for deletion from table as part of the next commit operation. + * Request is silently discarded if no such entry exists. + * + * @param[in] ctl + * Pipeline control handle. + * @param[in] table_name + * Table name. + * @param[in] entry + * Entry to be deleted from the table. The *action_id* and *action_data* entry + * fields are ignored. + * @return + * 0 on success or the following error codes otherwise: + * -EINVAL: Invalid argument. + */ +__rte_experimental +int +rte_swx_ctl_pipeline_table_entry_delete(struct rte_swx_ctl_pipeline *ctl, + const char *table_name, + struct rte_swx_table_entry *entry); + +/** + * Pipeline commit + * + * Perform all the scheduled table work. + * + * @param[in] ctl + * Pipeline control handle. + * @param[in] abort_on_fail + * When non-zero (false), all the scheduled work is discarded after a failed + * commit. Otherwise, the scheduled work is still kept pending for the next + * commit. + * @return + * 0 on success or the following error codes otherwise: + * -EINVAL: Invalid argument. + */ +__rte_experimental +int +rte_swx_ctl_pipeline_commit(struct rte_swx_ctl_pipeline *ctl, + int abort_on_fail); + +/** + * Pipeline abort + * + * Discard all the scheduled table work. + * + * @param[in] ctl + * Pipeline control handle. + */ +__rte_experimental +void +rte_swx_ctl_pipeline_abort(struct rte_swx_ctl_pipeline *ctl); + +/** + * Pipeline table entry read + * + * Read table entry from string. + * + * @param[in] ctl + * Pipeline control handle. + * @param[in] table_name + * Table name. + * @param[in] string + * String containing the table entry. + * @return + * 0 on success or the following error codes otherwise: + * -EINVAL: Invalid argument. + */ +__rte_experimental +struct rte_swx_table_entry * +rte_swx_ctl_pipeline_table_entry_read(struct rte_swx_ctl_pipeline *ctl, + const char *table_name, + const char *string); + +/** + * Pipeline table print to file + * + * Print all the table entries to file. + * + * @param[in] f + * Output file. + * @param[in] ctl + * Pipeline control handle. + * @param[in] table_name + * Table name. + * @return + * 0 on success or the following error codes otherwise: + * -EINVAL: Invalid argument. + */ +__rte_experimental +int +rte_swx_ctl_pipeline_table_fprintf(FILE *f, + struct rte_swx_ctl_pipeline *ctl, + const char *table_name); + +/** + * Pipeline control free + * + * @param[in] ctl + * Pipeline control handle. + */ +__rte_experimental +void +rte_swx_ctl_pipeline_free(struct rte_swx_ctl_pipeline *ctl); + #ifdef __cplusplus } #endif