MCPcopy Index your code
hub / github.com/F-Stack/f-stack / rte_eth_dev_configure

Function rte_eth_dev_configure

dpdk/lib/ethdev/rte_ethdev.c:1287–1618  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1285}
1286
1287int
1288rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
1289 const struct rte_eth_conf *dev_conf)
1290{
1291 enum rte_eth_hash_function algorithm;
1292 struct rte_eth_dev *dev;
1293 struct rte_eth_dev_info dev_info;
1294 struct rte_eth_conf orig_conf;
1295 int diag;
1296 int ret;
1297 uint16_t old_mtu;
1298
1299 RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
1300 dev = &rte_eth_devices[port_id];
1301
1302 if (dev_conf == NULL) {
1303 RTE_ETHDEV_LOG(ERR,
1304 "Cannot configure ethdev port %u from NULL config\n",
1305 port_id);
1306 return -EINVAL;
1307 }
1308
1309 if (*dev->dev_ops->dev_configure == NULL)
1310 return -ENOTSUP;
1311
1312 if (dev->data->dev_started) {
1313 RTE_ETHDEV_LOG(ERR,
1314 "Port %u must be stopped to allow configuration\n",
1315 port_id);
1316 return -EBUSY;
1317 }
1318
1319 /*
1320 * Ensure that "dev_configured" is always 0 each time prepare to do
1321 * dev_configure() to avoid any non-anticipated behaviour.
1322 * And set to 1 when dev_configure() is executed successfully.
1323 */
1324 dev->data->dev_configured = 0;
1325
1326 /* Store original config, as rollback required on failure */
1327 memcpy(&orig_conf, &dev->data->dev_conf, sizeof(dev->data->dev_conf));
1328
1329 /*
1330 * Copy the dev_conf parameter into the dev structure.
1331 * rte_eth_dev_info_get() requires dev_conf, copy it before dev_info get
1332 */
1333 if (dev_conf != &dev->data->dev_conf)
1334 memcpy(&dev->data->dev_conf, dev_conf,
1335 sizeof(dev->data->dev_conf));
1336
1337 /* Backup mtu for rollback */
1338 old_mtu = dev->data->mtu;
1339
1340 /* fields must be zero to reserve them for future ABI changes */
1341 if (dev_conf->rxmode.reserved_64s[0] != 0 ||
1342 dev_conf->rxmode.reserved_64s[1] != 0 ||
1343 dev_conf->rxmode.reserved_ptrs[0] != NULL ||
1344 dev_conf->rxmode.reserved_ptrs[1] != NULL) {

Callers 15

init_port_startFunction · 0.85
member_configureFunction · 0.85
fs_dev_configureFunction · 0.85
hn_vf_configureFunction · 0.85
init_portFunction · 0.85
configure_vdevFunction · 0.85
test_pmd_perfFunction · 0.85

Calls 13

rte_eth_dev_info_getFunction · 0.85
eth_dev_offload_namesFunction · 0.85
rte_eth_rss_hf_refineFunction · 0.85
eth_dev_rx_queue_configFunction · 0.85
eth_dev_tx_queue_configFunction · 0.85
eth_errFunction · 0.85
eth_dev_validate_mtuFunction · 0.70
eth_dev_get_overhead_lenFunction · 0.70

Tested by 15

test_pmd_perfFunction · 0.68
configure_ethdevFunction · 0.68
port_init_commonFunction · 0.68
configure_ethdevFunction · 0.68
ethdev_api_queue_statusFunction · 0.68
test_dev_startFunction · 0.68