net/hns3: support SVE Rx
[dpdk.git] / drivers / net / ionic / ionic_ethdev.c
index 1ba307d..ef7d06e 100644 (file)
@@ -25,7 +25,7 @@ static int  ionic_dev_configure(struct rte_eth_dev *dev);
 static int  ionic_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
 static int  ionic_dev_start(struct rte_eth_dev *dev);
 static void ionic_dev_stop(struct rte_eth_dev *dev);
-static void ionic_dev_close(struct rte_eth_dev *dev);
+static int  ionic_dev_close(struct rte_eth_dev *dev);
 static int  ionic_dev_set_link_up(struct rte_eth_dev *dev);
 static int  ionic_dev_set_link_down(struct rte_eth_dev *dev);
 static int  ionic_dev_link_update(struct rte_eth_dev *eth_dev,
@@ -56,8 +56,8 @@ static int  ionic_dev_xstats_get_names(struct rte_eth_dev *dev,
 static int  ionic_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
        struct rte_eth_xstat_name *xstats_names, const uint64_t *ids,
        unsigned int limit);
-
-int ionic_logtype;
+static int  ionic_dev_fw_version_get(struct rte_eth_dev *eth_dev,
+       char *fw_version, size_t fw_size);
 
 static const struct rte_pci_id pci_id_ionic_map[] = {
        { RTE_PCI_DEVICE(IONIC_PENSANDO_VENDOR_ID, IONIC_DEV_ID_ETH_PF) },
@@ -122,6 +122,7 @@ static const struct eth_dev_ops ionic_eth_dev_ops = {
        .xstats_reset           = ionic_dev_xstats_reset,
        .xstats_get_names       = ionic_dev_xstats_get_names,
        .xstats_get_names_by_id = ionic_dev_xstats_get_names_by_id,
+       .fw_version_get         = ionic_dev_fw_version_get,
 };
 
 struct rte_ionic_xstats_name_off {
@@ -211,6 +212,23 @@ static const struct rte_ionic_xstats_name_off rte_ionic_xstats_strings[] = {
 #define IONIC_NB_HW_STATS (sizeof(rte_ionic_xstats_strings) / \
                sizeof(rte_ionic_xstats_strings[0]))
 
+static int
+ionic_dev_fw_version_get(struct rte_eth_dev *eth_dev,
+               char *fw_version, size_t fw_size)
+{
+       struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
+       struct ionic_adapter *adapter = lif->adapter;
+
+       if (fw_version == NULL || fw_size <= 0)
+               return -EINVAL;
+
+       snprintf(fw_version, fw_size, "%s",
+                adapter->fw_version);
+       fw_version[fw_size - 1] = '\0';
+
+       return 0;
+}
+
 /*
  * Set device link up, enable tx.
  */
@@ -406,7 +424,12 @@ ionic_dev_info_get(struct rte_eth_dev *eth_dev,
                0;
 
        dev_info->tx_queue_offload_capa =
+               DEV_TX_OFFLOAD_IPV4_CKSUM |
+               DEV_TX_OFFLOAD_UDP_CKSUM |
+               DEV_TX_OFFLOAD_TCP_CKSUM |
                DEV_TX_OFFLOAD_VLAN_INSERT |
+               DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM |
+               DEV_TX_OFFLOAD_OUTER_UDP_CKSUM |
                0;
 
        /*
@@ -933,25 +956,29 @@ ionic_dev_stop(struct rte_eth_dev *eth_dev)
 /*
  * Reset and stop device.
  */
-static void
+static int
 ionic_dev_close(struct rte_eth_dev *eth_dev)
 {
        struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
        int err;
 
        IONIC_PRINT_CALL();
+       if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+               return 0;
 
        err = ionic_lif_stop(lif);
        if (err) {
                IONIC_PRINT(ERR, "Cannot stop LIF: %d", err);
-               return;
+               return -1;
        }
 
        err = eth_ionic_dev_uninit(eth_dev);
        if (err) {
                IONIC_PRINT(ERR, "Cannot destroy LIF: %d", err);
-               return;
+               return -1;
        }
+
+       return 0;
 }
 
 static int
@@ -1293,10 +1320,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_INIT(ionic_init_log)
-{
-       ionic_logtype = rte_log_register("pmd.net.ionic");
-       if (ionic_logtype >= 0)
-               rte_log_set_level(ionic_logtype, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(ionic_logtype, pmd.net.ionic, NOTICE);