| 766 | } |
| 767 | |
| 768 | int |
| 769 | pipeline_port_in_stats_read(const char *pipeline_name, |
| 770 | uint32_t port_id, |
| 771 | struct rte_pipeline_port_in_stats *stats, |
| 772 | int clear) |
| 773 | { |
| 774 | struct pipeline *p; |
| 775 | struct pipeline_msg_req *req; |
| 776 | struct pipeline_msg_rsp *rsp; |
| 777 | int status; |
| 778 | |
| 779 | /* Check input params */ |
| 780 | if ((pipeline_name == NULL) || |
| 781 | (stats == NULL)) |
| 782 | return -1; |
| 783 | |
| 784 | p = pipeline_find(pipeline_name); |
| 785 | if ((p == NULL) || |
| 786 | (port_id >= p->n_ports_in)) |
| 787 | return -1; |
| 788 | |
| 789 | if (!pipeline_is_running(p)) { |
| 790 | status = rte_pipeline_port_in_stats_read(p->p, |
| 791 | port_id, |
| 792 | stats, |
| 793 | clear); |
| 794 | |
| 795 | return status; |
| 796 | } |
| 797 | |
| 798 | /* Allocate request */ |
| 799 | req = pipeline_msg_alloc(); |
| 800 | if (req == NULL) |
| 801 | return -1; |
| 802 | |
| 803 | /* Write request */ |
| 804 | req->type = PIPELINE_REQ_PORT_IN_STATS_READ; |
| 805 | req->id = port_id; |
| 806 | req->port_in_stats_read.clear = clear; |
| 807 | |
| 808 | /* Send request and wait for response */ |
| 809 | rsp = pipeline_msg_send_recv(p, req); |
| 810 | |
| 811 | /* Read response */ |
| 812 | status = rsp->status; |
| 813 | if (status == 0) |
| 814 | memcpy(stats, &rsp->port_in_stats_read.stats, sizeof(*stats)); |
| 815 | |
| 816 | /* Free response */ |
| 817 | pipeline_msg_free(rsp); |
| 818 | |
| 819 | return status; |
| 820 | } |
| 821 | |
| 822 | int |
| 823 | pipeline_port_in_enable(const char *pipeline_name, |
no test coverage detected