| 4379 | } |
| 4380 | |
| 4381 | int |
| 4382 | init_port_dcb_config(portid_t pid, |
| 4383 | enum dcb_mode_enable dcb_mode, |
| 4384 | enum rte_eth_nb_tcs num_tcs, |
| 4385 | uint8_t pfc_en) |
| 4386 | { |
| 4387 | struct rte_eth_conf port_conf; |
| 4388 | struct rte_port *rte_port; |
| 4389 | int retval; |
| 4390 | uint16_t i; |
| 4391 | |
| 4392 | if (num_procs > 1) { |
| 4393 | printf("The multi-process feature doesn't support dcb.\n"); |
| 4394 | return -ENOTSUP; |
| 4395 | } |
| 4396 | rte_port = &ports[pid]; |
| 4397 | |
| 4398 | /* retain the original device configuration. */ |
| 4399 | memcpy(&port_conf, &rte_port->dev_conf, sizeof(struct rte_eth_conf)); |
| 4400 | |
| 4401 | /*set configuration of DCB in vt mode and DCB in non-vt mode*/ |
| 4402 | retval = get_eth_dcb_conf(pid, &port_conf, dcb_mode, num_tcs, pfc_en); |
| 4403 | if (retval < 0) |
| 4404 | return retval; |
| 4405 | port_conf.rxmode.offloads |= RTE_ETH_RX_OFFLOAD_VLAN_FILTER; |
| 4406 | /* remove RSS HASH offload for DCB in vt mode */ |
| 4407 | if (port_conf.rxmode.mq_mode == RTE_ETH_MQ_RX_VMDQ_DCB) { |
| 4408 | port_conf.rxmode.offloads &= ~RTE_ETH_RX_OFFLOAD_RSS_HASH; |
| 4409 | for (i = 0; i < nb_rxq; i++) |
| 4410 | rte_port->rxq[i].conf.offloads &= |
| 4411 | ~RTE_ETH_RX_OFFLOAD_RSS_HASH; |
| 4412 | } |
| 4413 | |
| 4414 | /* re-configure the device . */ |
| 4415 | retval = rte_eth_dev_configure(pid, nb_rxq, nb_rxq, &port_conf); |
| 4416 | if (retval < 0) |
| 4417 | return retval; |
| 4418 | |
| 4419 | retval = eth_dev_info_get_print_err(pid, &rte_port->dev_info); |
| 4420 | if (retval != 0) |
| 4421 | return retval; |
| 4422 | |
| 4423 | /* If dev_info.vmdq_pool_base is greater than 0, |
| 4424 | * the queue id of vmdq pools is started after pf queues. |
| 4425 | */ |
| 4426 | if (dcb_mode == DCB_VT_ENABLED && |
| 4427 | rte_port->dev_info.vmdq_pool_base > 0) { |
| 4428 | fprintf(stderr, |
| 4429 | "VMDQ_DCB multi-queue mode is nonsensical for port %d.\n", |
| 4430 | pid); |
| 4431 | return -1; |
| 4432 | } |
| 4433 | |
| 4434 | /* Assume the ports in testpmd have the same dcb capability |
| 4435 | * and has the same number of rxq and txq in dcb mode |
| 4436 | */ |
| 4437 | if (dcb_mode == DCB_VT_ENABLED) { |
| 4438 | if (rte_port->dev_info.max_vfs > 0) { |
no test coverage detected