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

Function ixgbe_hierarchy_commit

dpdk/drivers/net/ixgbe/ixgbe_tm.c:987–1053  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

985}
986
987static int
988ixgbe_hierarchy_commit(struct rte_eth_dev *dev,
989 int clear_on_fail,
990 struct rte_tm_error *error)
991{
992 struct ixgbe_tm_conf *tm_conf =
993 IXGBE_DEV_PRIVATE_TO_TM_CONF(dev->data->dev_private);
994 struct ixgbe_tm_node *tm_node;
995 uint64_t bw;
996 int ret;
997
998 if (!error)
999 return -EINVAL;
1000
1001 /* check the setting */
1002 if (!tm_conf->root)
1003 goto done;
1004
1005 /* not support port max bandwidth yet */
1006 if (tm_conf->root->shaper_profile &&
1007 tm_conf->root->shaper_profile->profile.peak.rate) {
1008 error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE;
1009 error->message = "no port max bandwidth";
1010 goto fail_clear;
1011 }
1012
1013 /* HW not support TC max bandwidth */
1014 TAILQ_FOREACH(tm_node, &tm_conf->tc_list, node) {
1015 if (tm_node->shaper_profile &&
1016 tm_node->shaper_profile->profile.peak.rate) {
1017 error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE;
1018 error->message = "no TC max bandwidth";
1019 goto fail_clear;
1020 }
1021 }
1022
1023 /* queue max bandwidth */
1024 TAILQ_FOREACH(tm_node, &tm_conf->queue_list, node) {
1025 if (tm_node->shaper_profile)
1026 bw = tm_node->shaper_profile->profile.peak.rate;
1027 else
1028 bw = 0;
1029 if (bw) {
1030 /* interpret Bps to Mbps */
1031 bw = bw * 8 / 1000 / 1000;
1032 ret = ixgbe_set_queue_rate_limit(dev, tm_node->no, bw);
1033 if (ret) {
1034 error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE;
1035 error->message =
1036 "failed to set queue max bandwidth";
1037 goto fail_clear;
1038 }
1039 }
1040 }
1041
1042done:
1043 tm_conf->committed = true;
1044 return 0;

Callers

nothing calls this directly

Calls 3

ixgbe_tm_conf_uninitFunction · 0.85
ixgbe_tm_conf_initFunction · 0.85

Tested by

no test coverage detected