| 341 | } |
| 342 | |
| 343 | int |
| 344 | thread_pipeline_disable(uint32_t thread_id, |
| 345 | const char *pipeline_name) |
| 346 | { |
| 347 | struct pipeline *p = pipeline_find(pipeline_name); |
| 348 | struct thread *t; |
| 349 | struct thread_msg_req *req; |
| 350 | struct thread_msg_rsp *rsp; |
| 351 | int status; |
| 352 | |
| 353 | /* Check input params */ |
| 354 | if ((thread_id >= RTE_MAX_LCORE) || |
| 355 | (p == NULL)) |
| 356 | return -1; |
| 357 | |
| 358 | t = &thread[thread_id]; |
| 359 | if (t->enabled == 0) |
| 360 | return -1; |
| 361 | |
| 362 | if (p->enabled == 0) |
| 363 | return 0; |
| 364 | |
| 365 | if (p->thread_id != thread_id) |
| 366 | return -1; |
| 367 | |
| 368 | if (!thread_is_running(thread_id)) { |
| 369 | struct thread_data *td = &thread_data[thread_id]; |
| 370 | uint32_t i; |
| 371 | |
| 372 | for (i = 0; i < td->n_pipelines; i++) { |
| 373 | struct pipeline_data *tdp = &td->pipeline_data[i]; |
| 374 | |
| 375 | if (tdp->p != p->p) |
| 376 | continue; |
| 377 | |
| 378 | /* Data plane thread */ |
| 379 | if (i < td->n_pipelines - 1) { |
| 380 | struct rte_pipeline *pipeline_last = |
| 381 | td->p[td->n_pipelines - 1]; |
| 382 | struct pipeline_data *tdp_last = |
| 383 | &td->pipeline_data[td->n_pipelines - 1]; |
| 384 | |
| 385 | td->p[i] = pipeline_last; |
| 386 | memcpy(tdp, tdp_last, sizeof(*tdp)); |
| 387 | } |
| 388 | |
| 389 | td->n_pipelines--; |
| 390 | |
| 391 | /* Pipeline */ |
| 392 | p->enabled = 0; |
| 393 | |
| 394 | break; |
| 395 | } |
| 396 | |
| 397 | return 0; |
| 398 | } |
| 399 | |
| 400 | /* Allocate request */ |
no test coverage detected