X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fdpaa2%2Fdpaa2_ethdev.c;h=48e0997299b87ab89246d95824415258cb7c1c0c;hb=599017a21574dede1e93f126155567a6b7b9c124;hp=efd6064b2cded3d032463eaa0e33b49fe02729ad;hpb=e16408499412e67a6afab8eca3d7496b770ac0e9;p=dpdk.git diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index efd6064b2c..48e0997299 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -50,7 +50,7 @@ #include #include #include - +#include #include "dpaa2_ethdev.h" static struct rte_dpaa2_driver rte_dpaa2_pmd; @@ -161,6 +161,39 @@ dpaa2_vlan_offload_set(struct rte_eth_dev *dev, int mask) } } +static int +dpaa2_fw_version_get(struct rte_eth_dev *dev, + char *fw_version, + size_t fw_size) +{ + int ret; + struct dpaa2_dev_priv *priv = dev->data->dev_private; + struct fsl_mc_io *dpni = priv->hw; + struct mc_soc_version mc_plat_info = {0}; + struct mc_version mc_ver_info = {0}; + + PMD_INIT_FUNC_TRACE(); + + if (mc_get_soc_version(dpni, CMD_PRI_LOW, &mc_plat_info)) + RTE_LOG(WARNING, PMD, "\tmc_get_soc_version failed\n"); + + if (mc_get_version(dpni, CMD_PRI_LOW, &mc_ver_info)) + RTE_LOG(WARNING, PMD, "\tmc_get_version failed\n"); + + ret = snprintf(fw_version, fw_size, + "%x-%d.%d.%d", + mc_plat_info.svr, + mc_ver_info.major, + mc_ver_info.minor, + mc_ver_info.revision); + + ret += 1; /* add the size of '\0' */ + if (fw_size < (uint32_t)ret) + return ret; + else + return 0; +} + static void dpaa2_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { @@ -240,8 +273,7 @@ dpaa2_alloc_rx_tx_queues(struct rte_eth_dev *dev) } vq_id = 0; - for (dist_idx = 0; dist_idx < priv->num_dist_per_tc[DPAA2_DEF_TC]; - dist_idx++) { + for (dist_idx = 0; dist_idx < priv->nb_rx_queues; dist_idx++) { mcq = (struct dpaa2_queue *)priv->rx_vq[vq_id]; mcq->tc_index = DPAA2_DEF_TC; mcq->flow_id = dist_idx; @@ -351,8 +383,8 @@ dpaa2_dev_rx_queue_setup(struct rte_eth_dev *dev, dpaa2_q = (struct dpaa2_queue *)priv->rx_vq[rx_queue_id]; dpaa2_q->mb_pool = mb_pool; /**< mbuf pool to populate RX ring. */ - /*Get the tc id and flow id from given VQ id*/ - flow_id = rx_queue_id % priv->num_dist_per_tc[dpaa2_q->tc_index]; + /*Get the flow id from given VQ id*/ + flow_id = rx_queue_id % priv->nb_rx_queues; memset(&cfg, 0, sizeof(struct dpni_queue)); options = options | DPNI_QUEUE_OPT_USER_CTX; @@ -425,13 +457,8 @@ dpaa2_dev_tx_queue_setup(struct rte_eth_dev *dev, memset(&tx_conf_cfg, 0, sizeof(struct dpni_queue)); memset(&tx_flow_cfg, 0, sizeof(struct dpni_queue)); - if (priv->num_tc == 1) { - tc_id = 0; - flow_id = tx_queue_id % priv->num_dist_per_tc[tc_id]; - } else { - tc_id = tx_queue_id; - flow_id = 0; - } + tc_id = tx_queue_id; + flow_id = 0; ret = dpni_set_queue(dpni, CMD_PRI_LOW, priv->token, DPNI_QUEUE_TX, tc_id, flow_id, options, &tx_flow_cfg); @@ -1279,6 +1306,7 @@ static struct eth_dev_ops dpaa2_ethdev_ops = { .link_update = dpaa2_dev_link_update, .stats_get = dpaa2_dev_stats_get, .stats_reset = dpaa2_dev_stats_reset, + .fw_version_get = dpaa2_fw_version_get, .dev_infos_get = dpaa2_dev_info_get, .dev_supported_ptypes_get = dpaa2_supported_ptypes_get, .mtu_set = dpaa2_dev_mtu_set, @@ -1304,7 +1332,7 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev) struct dpni_attr attr; struct dpaa2_dev_priv *priv = eth_dev->data->dev_private; struct dpni_buffer_layout layout; - int i, ret, hw_id; + int ret, hw_id; PMD_INIT_FUNC_TRACE(); @@ -1350,22 +1378,20 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev) } priv->num_tc = attr.num_tcs; - for (i = 0; i < attr.num_tcs; i++) { - priv->num_dist_per_tc[i] = attr.num_queues; - break; - } - /* Distribution is per Tc only, - * so choosing RX queues from default TC only + /* Resetting the "num_rx_vqueues" to equal number of queues in first TC + * as only one TC is supported on Rx Side. Once Multiple TCs will be + * in use for Rx processing then this will be changed or removed. */ - priv->nb_rx_queues = priv->num_dist_per_tc[DPAA2_DEF_TC]; + priv->nb_rx_queues = attr.num_queues; - if (attr.num_tcs == 1) - priv->nb_tx_queues = attr.num_queues; - else - priv->nb_tx_queues = attr.num_tcs; + /* TODO:Using hard coded value for number of TX queues due to dependency + * in MC. + */ + priv->nb_tx_queues = 8; - PMD_INIT_LOG(DEBUG, "num_tc %d", priv->num_tc); + PMD_INIT_LOG(DEBUG, "num TC - RX %d", priv->num_tc); + PMD_INIT_LOG(DEBUG, "nb_tx_queues %d", priv->nb_tx_queues); PMD_INIT_LOG(DEBUG, "nb_rx_queues %d", priv->nb_rx_queues); priv->hw = dpni_dev; @@ -1430,7 +1456,6 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev) } eth_dev->dev_ops = &dpaa2_ethdev_ops; - eth_dev->data->drv_name = rte_dpaa2_pmd.driver.name; eth_dev->rx_pkt_burst = dpaa2_dev_prefetch_rx; eth_dev->tx_pkt_burst = dpaa2_dev_tx; @@ -1500,7 +1525,7 @@ dpaa2_dev_uninit(struct rte_eth_dev *eth_dev) } static int -rte_dpaa2_probe(struct rte_dpaa2_driver *dpaa2_drv __rte_unused, +rte_dpaa2_probe(struct rte_dpaa2_driver *dpaa2_drv, struct rte_dpaa2_device *dpaa2_dev) { struct rte_eth_dev *eth_dev; @@ -1527,6 +1552,8 @@ rte_dpaa2_probe(struct rte_dpaa2_driver *dpaa2_drv __rte_unused, } } eth_dev->device = &dpaa2_dev->device; + eth_dev->device->driver = &dpaa2_drv->driver; + dpaa2_dev->eth_dev = eth_dev; eth_dev->data->rx_mbuf_alloc_failed = 0;