Add port meter policy */
| 2205 | |
| 2206 | /** Add port meter policy */ |
| 2207 | int |
| 2208 | port_meter_policy_add(portid_t port_id, uint32_t policy_id, |
| 2209 | const struct rte_flow_action *actions) |
| 2210 | { |
| 2211 | struct rte_mtr_error error; |
| 2212 | const struct rte_flow_action *act = actions; |
| 2213 | const struct rte_flow_action *start; |
| 2214 | struct rte_mtr_meter_policy_params policy; |
| 2215 | uint32_t i = 0, act_n; |
| 2216 | int ret; |
| 2217 | |
| 2218 | for (i = 0; i < RTE_COLORS; i++) { |
| 2219 | for (act_n = 0, start = act; |
| 2220 | act->type != RTE_FLOW_ACTION_TYPE_END; act++) |
| 2221 | act_n++; |
| 2222 | if (act_n > 0) |
| 2223 | policy.actions[i] = start; |
| 2224 | else |
| 2225 | policy.actions[i] = NULL; |
| 2226 | act++; |
| 2227 | } |
| 2228 | ret = rte_mtr_meter_policy_add(port_id, |
| 2229 | policy_id, |
| 2230 | &policy, &error); |
| 2231 | if (ret) |
| 2232 | print_mtr_err_msg(&error); |
| 2233 | return ret; |
| 2234 | } |
| 2235 | |
| 2236 | struct rte_flow_meter_profile * |
| 2237 | port_meter_profile_get_by_id(portid_t port_id, uint32_t id) |
no test coverage detected