Get generic traffic metering & policing operations structure from a port. */
| 12 | |
| 13 | /* Get generic traffic metering & policing operations structure from a port. */ |
| 14 | const struct rte_mtr_ops * |
| 15 | rte_mtr_ops_get(uint16_t port_id, struct rte_mtr_error *error) |
| 16 | { |
| 17 | struct rte_eth_dev *dev = &rte_eth_devices[port_id]; |
| 18 | const struct rte_mtr_ops *ops; |
| 19 | |
| 20 | if (!rte_eth_dev_is_valid_port(port_id)) { |
| 21 | rte_mtr_error_set(error, |
| 22 | ENODEV, |
| 23 | RTE_MTR_ERROR_TYPE_UNSPECIFIED, |
| 24 | NULL, |
| 25 | rte_strerror(ENODEV)); |
| 26 | return NULL; |
| 27 | } |
| 28 | |
| 29 | if ((dev->dev_ops->mtr_ops_get == NULL) || |
| 30 | (dev->dev_ops->mtr_ops_get(dev, &ops) != 0) || |
| 31 | (ops == NULL)) { |
| 32 | rte_mtr_error_set(error, |
| 33 | ENOSYS, |
| 34 | RTE_MTR_ERROR_TYPE_UNSPECIFIED, |
| 35 | NULL, |
| 36 | rte_strerror(ENOSYS)); |
| 37 | return NULL; |
| 38 | } |
| 39 | |
| 40 | return ops; |
| 41 | } |
| 42 | |
| 43 | #define RTE_MTR_FUNC(port_id, func) \ |
| 44 | ({ \ |
nothing calls this directly
no test coverage detected