Start the device. * It returns 0 on success. */
| 354 | * It returns 0 on success. |
| 355 | */ |
| 356 | int cxgbe_dev_start(struct rte_eth_dev *eth_dev) |
| 357 | { |
| 358 | struct port_info *pi = eth_dev->data->dev_private; |
| 359 | struct rte_eth_rxmode *rx_conf = ð_dev->data->dev_conf.rxmode; |
| 360 | struct adapter *adapter = pi->adapter; |
| 361 | int err = 0, i; |
| 362 | |
| 363 | CXGBE_FUNC_TRACE(); |
| 364 | |
| 365 | /* |
| 366 | * If we don't have a connection to the firmware there's nothing we |
| 367 | * can do. |
| 368 | */ |
| 369 | if (!(adapter->flags & FW_OK)) { |
| 370 | err = -ENXIO; |
| 371 | goto out; |
| 372 | } |
| 373 | |
| 374 | if (!(adapter->flags & FULL_INIT_DONE)) { |
| 375 | err = cxgbe_up(adapter); |
| 376 | if (err < 0) |
| 377 | goto out; |
| 378 | } |
| 379 | |
| 380 | if (rx_conf->offloads & RTE_ETH_RX_OFFLOAD_SCATTER) |
| 381 | eth_dev->data->scattered_rx = 1; |
| 382 | else |
| 383 | eth_dev->data->scattered_rx = 0; |
| 384 | |
| 385 | cxgbe_enable_rx_queues(pi); |
| 386 | |
| 387 | err = cxgbe_setup_rss(pi); |
| 388 | if (err) |
| 389 | goto out; |
| 390 | |
| 391 | for (i = 0; i < pi->n_tx_qsets; i++) { |
| 392 | err = cxgbe_dev_tx_queue_start(eth_dev, i); |
| 393 | if (err) |
| 394 | goto out; |
| 395 | } |
| 396 | |
| 397 | for (i = 0; i < pi->n_rx_qsets; i++) { |
| 398 | err = cxgbe_dev_rx_queue_start(eth_dev, i); |
| 399 | if (err) |
| 400 | goto out; |
| 401 | } |
| 402 | |
| 403 | err = cxgbe_link_start(pi); |
| 404 | if (err) |
| 405 | goto out; |
| 406 | |
| 407 | out: |
| 408 | return err; |
| 409 | } |
| 410 | |
| 411 | /* |
| 412 | * Stop device: disable rx and tx functions to allow for reconfiguring. |
nothing calls this directly
no test coverage detected