* DPDK callback to start the device. * * @param dev * Pointer to Ethernet device structure. * * @return * 0 on success, negative errno value on failure. */
| 789 | * 0 on success, negative errno value on failure. |
| 790 | */ |
| 791 | static int |
| 792 | mrvl_dev_start(struct rte_eth_dev *dev) |
| 793 | { |
| 794 | struct mrvl_priv *priv = dev->data->dev_private; |
| 795 | char match[MRVL_MATCH_LEN]; |
| 796 | int ret = 0, i, def_init_size; |
| 797 | struct rte_ether_addr *mac_addr; |
| 798 | |
| 799 | if (priv->ppio) |
| 800 | return mrvl_dev_set_link_up(dev); |
| 801 | |
| 802 | snprintf(match, sizeof(match), "ppio-%d:%d", |
| 803 | priv->pp_id, priv->ppio_id); |
| 804 | priv->ppio_params.match = match; |
| 805 | priv->ppio_params.eth_start_hdr = PP2_PPIO_HDR_ETH; |
| 806 | priv->forward_bad_frames = 0; |
| 807 | priv->fill_bpool_buffs = MRVL_BURST_SIZE; |
| 808 | |
| 809 | if (mrvl_cfg) { |
| 810 | priv->ppio_params.eth_start_hdr = |
| 811 | mrvl_cfg->port[dev->data->port_id].eth_start_hdr; |
| 812 | priv->forward_bad_frames = |
| 813 | mrvl_cfg->port[dev->data->port_id].forward_bad_frames; |
| 814 | priv->fill_bpool_buffs = |
| 815 | mrvl_cfg->port[dev->data->port_id].fill_bpool_buffs; |
| 816 | } |
| 817 | |
| 818 | /* |
| 819 | * Calculate the minimum bpool size for refill feature as follows: |
| 820 | * 2 default burst sizes multiply by number of rx queues. |
| 821 | * If the bpool size will be below this value, new buffers will |
| 822 | * be added to the pool. |
| 823 | */ |
| 824 | priv->bpool_min_size = priv->nb_rx_queues * MRVL_BURST_SIZE * 2; |
| 825 | |
| 826 | /* In case initial bpool size configured in queues setup is |
| 827 | * smaller than minimum size add more buffers |
| 828 | */ |
| 829 | def_init_size = priv->bpool_min_size + MRVL_BURST_SIZE * 2; |
| 830 | if (priv->bpool_init_size < def_init_size) { |
| 831 | int buffs_to_add = def_init_size - priv->bpool_init_size; |
| 832 | |
| 833 | priv->bpool_init_size += buffs_to_add; |
| 834 | ret = mrvl_fill_bpool(dev->data->rx_queues[0], buffs_to_add); |
| 835 | if (ret) |
| 836 | MRVL_LOG(ERR, "Failed to add buffers to bpool"); |
| 837 | } |
| 838 | |
| 839 | /* |
| 840 | * Calculate the maximum bpool size for refill feature as follows: |
| 841 | * maximum number of descriptors in rx queue multiply by number |
| 842 | * of rx queues plus minimum bpool size. |
| 843 | * In case the bpool size will exceed this value, superfluous buffers |
| 844 | * will be removed |
| 845 | */ |
| 846 | priv->bpool_max_size = (priv->nb_rx_queues * MRVL_PP2_RXD_MAX) + |
| 847 | priv->bpool_min_size; |
| 848 |
nothing calls this directly
no test coverage detected