net/dpaa2: fix prefetch Rx to honor number of packets
[dpdk.git] / drivers / net / qede / qede_main.c
index 71b3a39..2885e5d 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2016 QLogic Corporation.
+ * Copyright (c) 2016 - 2018 Cavium Inc.
  * All rights reserved.
- * www.qlogic.com
+ * www.cavium.com
  *
  * See LICENSE.qede_pmd for copyright and licensing details.
  */
@@ -9,6 +9,7 @@
 #include <limits.h>
 #include <time.h>
 #include <rte_alarm.h>
+#include <rte_string_fns.h>
 
 #include "qede_ethdev.h"
 
@@ -19,7 +20,7 @@
 char fw_file[PATH_MAX];
 
 const char *QEDE_DEFAULT_FIRMWARE =
-       "/lib/firmware/qed/qed_init_values-8.20.0.0.bin";
+       "/lib/firmware/qed/qed_init_values-8.33.12.0.bin";
 
 static void
 qed_update_pf_params(struct ecore_dev *edev, struct ecore_pf_params *params)
@@ -36,6 +37,7 @@ static void qed_init_pci(struct ecore_dev *edev, struct rte_pci_device *pci_dev)
 {
        edev->regview = pci_dev->mem_resource[0].addr;
        edev->doorbells = pci_dev->mem_resource[2].addr;
+       edev->db_size = pci_dev->mem_resource[2].len;
 }
 
 static int
@@ -61,6 +63,7 @@ qed_probe(struct ecore_dev *edev, struct rte_pci_device *pci_dev,
        hw_prepare_params.chk_reg_fifo = false;
        hw_prepare_params.initiate_pf_flr = true;
        hw_prepare_params.allow_mdump = false;
+       hw_prepare_params.b_en_pacing = false;
        hw_prepare_params.epoch = (u32)time(NULL);
        rc = ecore_hw_prepare(edev, &hw_prepare_params);
        if (rc) {
@@ -178,7 +181,7 @@ static void qed_handle_bulletin_change(struct ecore_hwfn *hwfn)
                rte_memcpy(hwfn->hw_info.hw_mac_addr, mac, ETH_ALEN);
 
        /* Always update link configuration according to bulletin */
-       qed_link_update(hwfn, NULL);
+       qed_link_update(hwfn);
 }
 
 static void qede_vf_task(void *arg)
@@ -278,7 +281,7 @@ static int qed_slowpath_start(struct ecore_dev *edev,
        /* Start the slowpath */
        memset(&hw_init_params, 0, sizeof(hw_init_params));
        hw_init_params.b_hw_start = true;
-       hw_init_params.int_mode = ECORE_INT_MODE_MSIX;
+       hw_init_params.int_mode = params->int_mode;
        hw_init_params.allow_npar_tx_switch = true;
        hw_init_params.bin_fw_data = data;
 
@@ -301,9 +304,8 @@ static int qed_slowpath_start(struct ecore_dev *edev,
                drv_version.version = (params->drv_major << 24) |
                    (params->drv_minor << 16) |
                    (params->drv_rev << 8) | (params->drv_eng);
-               /* TBD: strlcpy() */
-               strncpy((char *)drv_version.name, (const char *)params->name,
-                       MCP_DRV_VER_STR_SIZE - 4);
+               strlcpy((char *)drv_version.name, (const char *)params->name,
+                       sizeof(drv_version.name));
                rc = ecore_mcp_send_drv_version(hwfn, hwfn->p_main_ptt,
                                                &drv_version);
                if (rc) {
@@ -375,7 +377,10 @@ qed_fill_dev_info(struct ecore_dev *edev, struct qed_dev_info *dev_info)
        dev_info->fw_eng = FW_ENGINEERING_VERSION;
 
        if (IS_PF(edev)) {
-               dev_info->mf_mode = edev->mf_mode;
+               dev_info->b_inter_pf_switch =
+                       OSAL_TEST_BIT(ECORE_MF_INTER_PF_SWITCH, &edev->mf_bits);
+               if (!OSAL_TEST_BIT(ECORE_MF_DISABLE_ARFS, &edev->mf_bits))
+                       dev_info->b_arfs_capable = true;
                dev_info->tx_switching = false;
 
                dev_info->smart_an = ecore_mcp_is_smart_an_supported(p_hwfn);
@@ -422,7 +427,7 @@ qed_fill_eth_dev_info(struct ecore_dev *edev, struct qed_dev_eth_info *info)
                        info->num_queues +=
                        FEAT_NUM(&edev->hwfns[i], ECORE_PF_L2_QUE);
 
-               if (edev->p_iov_info)
+               if (IS_ECORE_SRIOV(edev))
                        max_vf_vlan_filters = edev->p_iov_info->total_vfs *
                                              ECORE_ETH_VF_NUM_VLAN_FILTERS;
                info->num_vlan_filters = RESC_NUM(&edev->hwfns[0], ECORE_VLAN) -
@@ -433,7 +438,7 @@ qed_fill_eth_dev_info(struct ecore_dev *edev, struct qed_dev_eth_info *info)
        } else {
                ecore_vf_get_num_rxqs(ECORE_LEADING_HWFN(edev),
                                      &info->num_queues);
-               if (edev->num_hwfns > 1) {
+               if (ECORE_IS_CMT(edev)) {
                        ecore_vf_get_num_rxqs(&edev->hwfns[1], &queues);
                        info->num_queues += queues;
                }
@@ -625,11 +630,15 @@ static int qed_set_link(struct ecore_dev *edev, struct qed_link_params *params)
        return rc;
 }
 
-void qed_link_update(struct ecore_hwfn *hwfn, struct ecore_ptt *ptt)
+void qed_link_update(struct ecore_hwfn *hwfn)
 {
-       struct qed_link_output if_link;
+       struct ecore_dev *edev = hwfn->p_dev;
+       struct qede_dev *qdev = (struct qede_dev *)edev;
+       struct rte_eth_dev *dev = (struct rte_eth_dev *)qdev->ethdev;
 
-       qed_fill_link(hwfn, ptt, &if_link);
+       if (!qede_link_update(dev, 0))
+               _rte_eth_dev_callback_process(dev,
+                                             RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 static int qed_drain(struct ecore_dev *edev)