| 184 | } |
| 185 | |
| 186 | struct rte_pipeline * |
| 187 | rte_pipeline_create(struct rte_pipeline_params *params) |
| 188 | { |
| 189 | struct rte_pipeline *p; |
| 190 | int status; |
| 191 | |
| 192 | /* Check input parameters */ |
| 193 | status = rte_pipeline_check_params(params); |
| 194 | if (status != 0) { |
| 195 | RTE_LOG(ERR, PIPELINE, |
| 196 | "%s: Pipeline params check failed (%d)\n", |
| 197 | __func__, status); |
| 198 | return NULL; |
| 199 | } |
| 200 | |
| 201 | /* Allocate memory for the pipeline on requested socket */ |
| 202 | p = rte_zmalloc_socket("PIPELINE", sizeof(struct rte_pipeline), |
| 203 | RTE_CACHE_LINE_SIZE, params->socket_id); |
| 204 | |
| 205 | if (p == NULL) { |
| 206 | RTE_LOG(ERR, PIPELINE, |
| 207 | "%s: Pipeline memory allocation failed\n", __func__); |
| 208 | return NULL; |
| 209 | } |
| 210 | |
| 211 | /* Save input parameters */ |
| 212 | strlcpy(p->name, params->name, RTE_PIPELINE_MAX_NAME_SZ); |
| 213 | p->socket_id = params->socket_id; |
| 214 | p->offset_port_id = params->offset_port_id; |
| 215 | |
| 216 | /* Initialize pipeline internal data structure */ |
| 217 | p->num_ports_in = 0; |
| 218 | p->num_ports_out = 0; |
| 219 | p->num_tables = 0; |
| 220 | p->enabled_port_in_mask = 0; |
| 221 | p->port_in_next = NULL; |
| 222 | p->pkts_mask = 0; |
| 223 | p->n_pkts_ah_drop = 0; |
| 224 | |
| 225 | return p; |
| 226 | } |
| 227 | |
| 228 | int |
| 229 | rte_pipeline_free(struct rte_pipeline *p) |