* Callback to get MTR capabilities. * * @param[in] dev * Pointer to the device (unused). * @param[out] cap * Pointer to the meter object capabilities. * @param[out] error * Pointer to the error (unused). * * @returns * 0 on success, a negative value otherwise and rte_errno is set. */
| 36 | * 0 on success, a negative value otherwise and rte_errno is set. |
| 37 | */ |
| 38 | static int |
| 39 | nfp_mtr_cap_get(struct rte_eth_dev *dev __rte_unused, |
| 40 | struct rte_mtr_capabilities *cap, |
| 41 | struct rte_mtr_error *error) |
| 42 | { |
| 43 | if (cap == NULL) { |
| 44 | return -rte_mtr_error_set(error, EINVAL, |
| 45 | RTE_MTR_ERROR_TYPE_UNSPECIFIED, |
| 46 | NULL, "NULL pointer for capabilitie argument"); |
| 47 | } |
| 48 | |
| 49 | memset(cap, 0, sizeof(struct rte_mtr_capabilities)); |
| 50 | |
| 51 | cap->n_max = NFP_MAX_MTR_CNT; |
| 52 | cap->n_shared_max = NFP_MAX_MTR_CNT; |
| 53 | cap->identical = 1; |
| 54 | cap->shared_identical = 1; |
| 55 | cap->chaining_n_mtrs_per_flow_max = 1; |
| 56 | cap->meter_srtcm_rfc2697_n_max = NFP_MAX_MTR_CNT; |
| 57 | cap->meter_trtcm_rfc2698_n_max = NFP_MAX_MTR_CNT; |
| 58 | cap->meter_rate_max = UINT64_MAX; |
| 59 | cap->meter_policy_n_max = NFP_MAX_POLICY_CNT; |
| 60 | cap->srtcm_rfc2697_byte_mode_supported = 1; |
| 61 | cap->srtcm_rfc2697_packet_mode_supported = 1; |
| 62 | cap->trtcm_rfc2698_byte_mode_supported = 1; |
| 63 | cap->trtcm_rfc2698_packet_mode_supported = 1; |
| 64 | cap->stats_mask = RTE_MTR_STATS_N_PKTS_GREEN | |
| 65 | RTE_MTR_STATS_N_PKTS_DROPPED | |
| 66 | RTE_MTR_STATS_N_BYTES_GREEN | |
| 67 | RTE_MTR_STATS_N_BYTES_DROPPED; |
| 68 | |
| 69 | return 0; |
| 70 | } |
| 71 | |
| 72 | static int |
| 73 | nfp_mtr_profile_validate(uint32_t mtr_profile_id, |
nothing calls this directly
no test coverage detected