net/bnxt: refactor async event handling
[dpdk.git] / drivers / net / ionic / ionic_ethdev.c
index 67f38cd..e620793 100644 (file)
@@ -70,12 +70,12 @@ static const struct rte_eth_desc_lim rx_desc_lim = {
        .nb_align = 1,
 };
 
-static const struct rte_eth_desc_lim tx_desc_lim = {
+static const struct rte_eth_desc_lim tx_desc_lim_v1 = {
        .nb_max = IONIC_MAX_RING_DESC,
        .nb_min = IONIC_MIN_RING_DESC,
        .nb_align = 1,
-       .nb_seg_max = IONIC_TX_MAX_SG_ELEMS,
-       .nb_mtu_seg_max = IONIC_TX_MAX_SG_ELEMS,
+       .nb_seg_max = IONIC_TX_MAX_SG_ELEMS_V1 + 1,
+       .nb_mtu_seg_max = IONIC_TX_MAX_SG_ELEMS_V1 + 1,
 };
 
 static const struct eth_dev_ops ionic_eth_dev_ops = {
@@ -215,15 +215,18 @@ ionic_dev_fw_version_get(struct rte_eth_dev *eth_dev,
 {
        struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
        struct ionic_adapter *adapter = lif->adapter;
+       int ret;
 
-       if (fw_version == NULL || fw_size <= 0)
-               return -EINVAL;
-
-       snprintf(fw_version, fw_size, "%s",
+       ret = snprintf(fw_version, fw_size, "%s",
                 adapter->fw_version);
-       fw_version[fw_size - 1] = '\0';
+       if (ret < 0)
+               return -EINVAL;
 
-       return 0;
+       ret += 1; /* add the size of '\0' */
+       if (fw_size < (size_t)ret)
+               return ret;
+       else
+               return 0;
 }
 
 /*
@@ -440,7 +443,7 @@ ionic_dev_info_get(struct rte_eth_dev *eth_dev,
                0;
 
        dev_info->rx_desc_lim = rx_desc_lim;
-       dev_info->tx_desc_lim = tx_desc_lim;
+       dev_info->tx_desc_lim = tx_desc_lim_v1;
 
        /* Driver-preferred Rx/Tx parameters */
        dev_info->default_rxportconf.burst_size = 32;
@@ -1293,4 +1296,4 @@ static struct rte_pci_driver rte_ionic_pmd = {
 RTE_PMD_REGISTER_PCI(net_ionic, rte_ionic_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_ionic, pci_id_ionic_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_ionic, "* igb_uio | uio_pci_generic | vfio-pci");
-RTE_LOG_REGISTER(ionic_logtype, pmd.net.ionic, NOTICE);
+RTE_LOG_REGISTER_DEFAULT(ionic_logtype, NOTICE);