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

Function cmd_config_dcb_parsed

dpdk/app/test-pmd/cmdline.c:3111–3174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3109};
3110
3111static void
3112cmd_config_dcb_parsed(void *parsed_result,
3113 __rte_unused struct cmdline *cl,
3114 __rte_unused void *data)
3115{
3116 struct cmd_config_dcb *res = parsed_result;
3117 struct rte_eth_dcb_info dcb_info;
3118 portid_t port_id = res->port_id;
3119 struct rte_port *port;
3120 uint8_t pfc_en;
3121 int ret;
3122
3123 if (port_id_is_invalid(port_id, ENABLED_WARN))
3124 return;
3125
3126 port = &ports[port_id];
3127 /** Check if the port is not started **/
3128 if (port->port_status != RTE_PORT_STOPPED) {
3129 fprintf(stderr, "Please stop port %d first\n", port_id);
3130 return;
3131 }
3132
3133 if (res->num_tcs <= 1 || res->num_tcs > RTE_ETH_8_TCS) {
3134 fprintf(stderr,
3135 "The invalid number of traffic class, only 2~8 allowed.\n");
3136 return;
3137 }
3138
3139 if (nb_fwd_lcores < res->num_tcs) {
3140 fprintf(stderr,
3141 "nb_cores shouldn't be less than number of TCs.\n");
3142 return;
3143 }
3144
3145 /* Check whether the port supports the report of DCB info. */
3146 ret = rte_eth_dev_get_dcb_info(port_id, &dcb_info);
3147 if (ret == -ENOTSUP) {
3148 fprintf(stderr, "rte_eth_dev_get_dcb_info not supported.\n");
3149 return;
3150 }
3151
3152 if (!strncmp(res->pfc_en, "on", 2))
3153 pfc_en = 1;
3154 else
3155 pfc_en = 0;
3156
3157 /* DCB in VT mode */
3158 if (!strncmp(res->vt_en, "on", 2))
3159 ret = init_port_dcb_config(port_id, DCB_VT_ENABLED,
3160 (enum rte_eth_nb_tcs)res->num_tcs,
3161 pfc_en);
3162 else
3163 ret = init_port_dcb_config(port_id, DCB_ENABLED,
3164 (enum rte_eth_nb_tcs)res->num_tcs,
3165 pfc_en);
3166 if (ret != 0) {
3167 fprintf(stderr, "Cannot initialize network ports.\n");
3168 return;

Callers

nothing calls this directly

Calls 6

port_id_is_invalidFunction · 0.85
rte_eth_dev_get_dcb_infoFunction · 0.85
strncmpFunction · 0.85
init_port_dcb_configFunction · 0.85
fwd_config_setupFunction · 0.85

Tested by

no test coverage detected