* DPDK callback to start the device. * * @param dev * Pointer to Ethernet device structure. * * @return * 0 on success, negative errno value on failure. */
| 329 | * 0 on success, negative errno value on failure. |
| 330 | */ |
| 331 | static int |
| 332 | mvneta_dev_start(struct rte_eth_dev *dev) |
| 333 | { |
| 334 | struct mvneta_priv *priv = dev->data->dev_private; |
| 335 | char match[MVNETA_MATCH_LEN]; |
| 336 | int ret = 0, i; |
| 337 | |
| 338 | if (priv->ppio) |
| 339 | return mvneta_dev_set_link_up(dev); |
| 340 | |
| 341 | strlcpy(match, dev->data->name, sizeof(match)); |
| 342 | priv->ppio_params.match = match; |
| 343 | priv->ppio_params.inqs_params.mtu = dev->data->mtu; |
| 344 | |
| 345 | ret = neta_ppio_init(&priv->ppio_params, &priv->ppio); |
| 346 | if (ret) { |
| 347 | MVNETA_LOG(ERR, "Failed to init ppio"); |
| 348 | return ret; |
| 349 | } |
| 350 | priv->ppio_id = priv->ppio->port_id; |
| 351 | |
| 352 | mvneta_stats_reset(dev); |
| 353 | |
| 354 | /* |
| 355 | * In case there are some stale uc/mc mac addresses flush them |
| 356 | * here. It cannot be done during mvneta_dev_close() as port information |
| 357 | * is already gone at that point (due to neta_ppio_deinit() in |
| 358 | * mvneta_dev_stop()). |
| 359 | */ |
| 360 | if (!priv->uc_mc_flushed) { |
| 361 | ret = neta_ppio_flush_mac_addrs(priv->ppio, 0, 1); |
| 362 | if (ret) { |
| 363 | MVNETA_LOG(ERR, |
| 364 | "Failed to flush uc/mc filter list"); |
| 365 | goto out; |
| 366 | } |
| 367 | priv->uc_mc_flushed = 1; |
| 368 | } |
| 369 | |
| 370 | ret = mvneta_alloc_rx_bufs(dev); |
| 371 | if (ret) |
| 372 | goto out; |
| 373 | |
| 374 | ret = mvneta_mtu_set(dev, dev->data->mtu); |
| 375 | if (ret) { |
| 376 | MVNETA_LOG(ERR, "Failed to set MTU %d", dev->data->mtu); |
| 377 | goto out; |
| 378 | } |
| 379 | |
| 380 | ret = mvneta_dev_set_link_up(dev); |
| 381 | if (ret) { |
| 382 | MVNETA_LOG(ERR, "Failed to set link up"); |
| 383 | goto out; |
| 384 | } |
| 385 | |
| 386 | /* start rx queues */ |
| 387 | for (i = 0; i < dev->data->nb_rx_queues; i++) |
| 388 | dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; |
nothing calls this directly
no test coverage detected