MCPcopy Create free account
hub / github.com/F-Stack/f-stack / nfp_mtr_stats_update

Function nfp_mtr_stats_update

dpdk/drivers/net/nfp/nfp_mtr.c:953–982  ·  view source on GitHub ↗

* Callback to update meter stats mask. * * @param[in] dev * Pointer to Ethernet device. * @param[in] mtr_id * Meter id. * @param[in] stats_mask * To be updated stats_mask. * @param[out] error * Pointer to rte meter error structure. * * @return * 0 on success, a negative value otherwise and rte_errno is set. */

Source from the content-addressed store, hash-verified

951 * 0 on success, a negative value otherwise and rte_errno is set.
952 */
953static int
954nfp_mtr_stats_update(struct rte_eth_dev *dev,
955 uint32_t mtr_id,
956 uint64_t stats_mask,
957 struct rte_mtr_error *error)
958{
959 int ret;
960 struct nfp_mtr *mtr;
961 struct nfp_mtr_priv *priv;
962 struct nfp_flower_representor *representor;
963
964 representor = dev->data->dev_private;
965 priv = representor->app_fw_flower->mtr_priv;
966
967 /* Check if meter id exist */
968 mtr = nfp_mtr_find_by_mtr_id(priv, mtr_id);
969 if (mtr == NULL) {
970 return -rte_mtr_error_set(error, EEXIST,
971 RTE_MTR_ERROR_TYPE_MTR_ID,
972 NULL, "Request meter id not exist");
973 }
974
975 ret = nfp_mtr_stats_mask_validate(stats_mask, error);
976 if (ret != 0)
977 return ret;
978
979 mtr->stats_mask = stats_mask;
980
981 return 0;
982}
983
984/**
985 * Callback to read meter statistics.

Callers

nothing calls this directly

Calls 3

nfp_mtr_find_by_mtr_idFunction · 0.85
rte_mtr_error_setFunction · 0.85

Tested by

no test coverage detected