MCPcopy Create free account
hub / github.com/F-Stack/f-stack / mrvl_dev_start

Function mrvl_dev_start

dpdk/drivers/net/mvpp2/mrvl_ethdev.c:791–966  ·  view source on GitHub ↗

* DPDK callback to start the device. * * @param dev * Pointer to Ethernet device structure. * * @return * 0 on success, negative errno value on failure. */

Source from the content-addressed store, hash-verified

789 * 0 on success, negative errno value on failure.
790 */
791static int
792mrvl_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

Callers

nothing calls this directly

Calls 15

mrvl_dev_set_link_upFunction · 0.85
snprintfFunction · 0.85
mrvl_fill_bpoolFunction · 0.85
mrvl_mtu_setFunction · 0.85
rte_is_zero_ether_addrFunction · 0.85
mrvl_mac_addr_setFunction · 0.85
mrvl_mac_addr_addFunction · 0.85
mrvl_allmulticast_enableFunction · 0.85
mrvl_populate_vlan_tableFunction · 0.85
mrvl_start_qos_mappingFunction · 0.85
mrvl_promiscuous_enableFunction · 0.85
mrvl_flow_ctrl_setFunction · 0.85

Tested by

no test coverage detected