net/mlx5: fix creation of drop flows
[dpdk.git] / drivers / net / dpaa2 / dpaa2_ethdev.c
index edff04a..da309ac 100644 (file)
 #include <dpaa2_hw_pvt.h>
 #include <dpaa2_hw_mempool.h>
 #include <dpaa2_hw_dpio.h>
-
+#include <mc/fsl_dpmng.h>
 #include "dpaa2_ethdev.h"
 
 static struct rte_dpaa2_driver rte_dpaa2_pmd;
 static int dpaa2_dev_uninit(struct rte_eth_dev *eth_dev);
 static int dpaa2_dev_set_link_up(struct rte_eth_dev *dev);
 static int dpaa2_dev_set_link_down(struct rte_eth_dev *dev);
+static int dpaa2_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
 
 /**
  * Atomically reads the link status information from global
@@ -160,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)
 {
@@ -278,6 +312,20 @@ dpaa2_eth_dev_configure(struct rte_eth_dev *dev)
 
        PMD_INIT_FUNC_TRACE();
 
+       if (eth_conf->rxmode.jumbo_frame == 1) {
+               if (eth_conf->rxmode.max_rx_pkt_len <= DPAA2_MAX_RX_PKT_LEN) {
+                       ret = dpaa2_dev_mtu_set(dev,
+                                       eth_conf->rxmode.max_rx_pkt_len);
+                       if (ret) {
+                               PMD_INIT_LOG(ERR,
+                                            "unable to set mtu. check config\n");
+                               return ret;
+                       }
+               } else {
+                       return -1;
+               }
+       }
+
        /* Check for correct configuration */
        if (eth_conf->rxmode.mq_mode != ETH_MQ_RX_RSS &&
            data->nb_rx_queues > 1) {
@@ -778,6 +826,11 @@ dpaa2_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
        if ((mtu < ETHER_MIN_MTU) || (frame_size > DPAA2_MAX_RX_PKT_LEN))
                return -EINVAL;
 
+       if (frame_size > ETHER_MAX_LEN)
+               dev->data->dev_conf.rxmode.jumbo_frame = 1;
+       else
+               dev->data->dev_conf.rxmode.jumbo_frame = 0;
+
        /* Set the Max Rx frame length as 'mtu' +
         * Maximum Ethernet header length
         */
@@ -1259,6 +1312,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,
@@ -1410,7 +1464,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;