Merge remote-tracking branch 'lightnvm/for-next'
[deliverable/linux.git] / drivers / net / ethernet / qlogic / qed / qed_dev.c
index 0e4f4a9306b55ac64173a7a1ce73ad0626e5a143..13d8b4075b01253b9caf3bedc0895666582f9581 100644 (file)
@@ -35,8 +35,7 @@
 #include "qed_sriov.h"
 #include "qed_vf.h"
 
-static spinlock_t qm_lock;
-static bool qm_lock_init = false;
+static DEFINE_SPINLOCK(qm_lock);
 
 /* API common to all protocols */
 enum BAR_ID {
@@ -44,8 +43,7 @@ enum BAR_ID {
        BAR_ID_1        /* Used for doorbells */
 };
 
-static u32 qed_hw_bar_size(struct qed_hwfn     *p_hwfn,
-                          enum BAR_ID          bar_id)
+static u32 qed_hw_bar_size(struct qed_hwfn *p_hwfn, enum BAR_ID bar_id)
 {
        u32 bar_reg = (bar_id == BAR_ID_0 ?
                       PGLUE_B_REG_PF_BAR0_SIZE : PGLUE_B_REG_PF_BAR1_SIZE);
@@ -70,8 +68,7 @@ static u32 qed_hw_bar_size(struct qed_hwfn    *p_hwfn,
        }
 }
 
-void qed_init_dp(struct qed_dev *cdev,
-                u32 dp_module, u8 dp_level)
+void qed_init_dp(struct qed_dev *cdev, u32 dp_module, u8 dp_level)
 {
        u32 i;
 
@@ -343,7 +340,6 @@ static int qed_init_qm_info(struct qed_hwfn *p_hwfn, bool b_sleepable)
        return 0;
 
 alloc_err:
-       DP_NOTICE(p_hwfn, "Failed to allocate memory for QM params\n");
        qed_qm_info_free(p_hwfn);
        return -ENOMEM;
 }
@@ -427,18 +423,12 @@ int qed_resc_alloc(struct qed_dev *cdev)
                                     RESC_NUM(p_hwfn, QED_L2_QUEUE);
 
                p_hwfn->p_tx_cids = kzalloc(tx_size, GFP_KERNEL);
-               if (!p_hwfn->p_tx_cids) {
-                       DP_NOTICE(p_hwfn,
-                                 "Failed to allocate memory for Tx Cids\n");
+               if (!p_hwfn->p_tx_cids)
                        goto alloc_no_mem;
-               }
 
                p_hwfn->p_rx_cids = kzalloc(rx_size, GFP_KERNEL);
-               if (!p_hwfn->p_rx_cids) {
-                       DP_NOTICE(p_hwfn,
-                                 "Failed to allocate memory for Rx Cids\n");
+               if (!p_hwfn->p_rx_cids)
                        goto alloc_no_mem;
-               }
        }
 
        for_each_hwfn(cdev, i) {
@@ -525,27 +515,18 @@ int qed_resc_alloc(struct qed_dev *cdev)
 
                /* DMA info initialization */
                rc = qed_dmae_info_alloc(p_hwfn);
-               if (rc) {
-                       DP_NOTICE(p_hwfn,
-                                 "Failed to allocate memory for dmae_info structure\n");
+               if (rc)
                        goto alloc_err;
-               }
 
                /* DCBX initialization */
                rc = qed_dcbx_info_alloc(p_hwfn);
-               if (rc) {
-                       DP_NOTICE(p_hwfn,
-                                 "Failed to allocate memory for dcbx structure\n");
+               if (rc)
                        goto alloc_err;
-               }
        }
 
        cdev->reset_stats = kzalloc(sizeof(*cdev->reset_stats), GFP_KERNEL);
-       if (!cdev->reset_stats) {
-               DP_NOTICE(cdev, "Failed to allocate reset statistics\n");
-               rc = -ENOMEM;
-               goto alloc_err;
-       }
+       if (!cdev->reset_stats)
+               goto alloc_no_mem;
 
        return 0;
 
@@ -605,9 +586,8 @@ int qed_final_cleanup(struct qed_hwfn *p_hwfn,
 
        /* Make sure notification is not set before initiating final cleanup */
        if (REG_RD(p_hwfn, addr)) {
-               DP_NOTICE(
-                       p_hwfn,
-                       "Unexpected; Found final cleanup notification before initiating final cleanup\n");
+               DP_NOTICE(p_hwfn,
+                         "Unexpected; Found final cleanup notification before initiating final cleanup\n");
                REG_WR(p_hwfn, addr, 0);
        }
 
@@ -701,17 +681,14 @@ static void qed_init_cau_rt_data(struct qed_dev *cdev)
                                continue;
 
                        qed_init_cau_sb_entry(p_hwfn, &sb_entry,
-                                             p_block->function_id,
-                                             0, 0);
-                       STORE_RT_REG_AGG(p_hwfn, offset + sb_id * 2,
-                                        sb_entry);
+                                             p_block->function_id, 0, 0);
+                       STORE_RT_REG_AGG(p_hwfn, offset + sb_id * 2, sb_entry);
                }
        }
 }
 
 static int qed_hw_init_common(struct qed_hwfn *p_hwfn,
-                             struct qed_ptt *p_ptt,
-                             int hw_mode)
+                             struct qed_ptt *p_ptt, int hw_mode)
 {
        struct qed_qm_info *qm_info = &p_hwfn->qm_info;
        struct qed_qm_common_rt_init_params params;
@@ -759,7 +736,7 @@ static int qed_hw_init_common(struct qed_hwfn *p_hwfn,
        qed_port_unpretend(p_hwfn, p_ptt);
 
        rc = qed_init_run(p_hwfn, p_ptt, PHASE_ENGINE, ANY_PHASE_ID, hw_mode);
-       if (rc != 0)
+       if (rc)
                return rc;
 
        qed_wr(p_hwfn, p_ptt, PSWRQ2_REG_L2P_VALIDATE_VFID, 0);
@@ -780,6 +757,9 @@ static int qed_hw_init_common(struct qed_hwfn *p_hwfn,
                concrete_fid = qed_vfid_to_concrete(p_hwfn, vf_id);
                qed_fid_pretend(p_hwfn, p_ptt, (u16) concrete_fid);
                qed_wr(p_hwfn, p_ptt, CCFC_REG_STRONG_ENABLE_VF, 0x1);
+               qed_wr(p_hwfn, p_ptt, CCFC_REG_WEAK_ENABLE_VF, 0x0);
+               qed_wr(p_hwfn, p_ptt, TCFC_REG_STRONG_ENABLE_VF, 0x1);
+               qed_wr(p_hwfn, p_ptt, TCFC_REG_WEAK_ENABLE_VF, 0x0);
        }
        /* pretend to original PF */
        qed_fid_pretend(p_hwfn, p_ptt, p_hwfn->rel_pf_id);
@@ -788,37 +768,10 @@ static int qed_hw_init_common(struct qed_hwfn *p_hwfn,
 }
 
 static int qed_hw_init_port(struct qed_hwfn *p_hwfn,
-                           struct qed_ptt *p_ptt,
-                           int hw_mode)
+                           struct qed_ptt *p_ptt, int hw_mode)
 {
-       int rc = 0;
-
-       rc = qed_init_run(p_hwfn, p_ptt, PHASE_PORT, p_hwfn->port_id, hw_mode);
-       if (rc != 0)
-               return rc;
-
-       if (hw_mode & (1 << MODE_MF_SI)) {
-               u8 pf_id = 0;
-
-               if (!qed_hw_init_first_eth(p_hwfn, p_ptt, &pf_id)) {
-                       DP_VERBOSE(p_hwfn, NETIF_MSG_IFUP,
-                                  "PF[%08x] is first eth on engine\n", pf_id);
-
-                       /* We should have configured BIT for ppfid, i.e., the
-                        * relative function number in the port. But there's a
-                        * bug in LLH in BB where the ppfid is actually engine
-                        * based, so we need to take this into account.
-                        */
-                       qed_wr(p_hwfn, p_ptt,
-                              NIG_REG_LLH_TAGMAC_DEF_PF_VECTOR, 1 << pf_id);
-               }
-
-               /* Take the protocol-based hit vector if there is a hit,
-                * otherwise take the other vector.
-                */
-               qed_wr(p_hwfn, p_ptt, NIG_REG_LLH_CLS_TYPE_DUALMODE, 0x2);
-       }
-       return rc;
+       return qed_init_run(p_hwfn, p_ptt, PHASE_PORT,
+                           p_hwfn->port_id, hw_mode);
 }
 
 static int qed_hw_init_pf(struct qed_hwfn *p_hwfn,
@@ -848,7 +801,7 @@ static int qed_hw_init_pf(struct qed_hwfn *p_hwfn,
        qed_int_igu_init_rt(p_hwfn);
 
        /* Set VLAN in NIG if needed */
-       if (hw_mode & (1 << MODE_MF_SD)) {
+       if (hw_mode & BIT(MODE_MF_SD)) {
                DP_VERBOSE(p_hwfn, NETIF_MSG_HW, "Configuring LLH_FUNC_TAG\n");
                STORE_RT_REG(p_hwfn, NIG_REG_LLH_FUNC_TAG_EN_RT_OFFSET, 1);
                STORE_RT_REG(p_hwfn, NIG_REG_LLH_FUNC_TAG_VALUE_RT_OFFSET,
@@ -856,7 +809,7 @@ static int qed_hw_init_pf(struct qed_hwfn *p_hwfn,
        }
 
        /* Enable classification by MAC if needed */
-       if (hw_mode & (1 << MODE_MF_SI)) {
+       if (hw_mode & BIT(MODE_MF_SI)) {
                DP_VERBOSE(p_hwfn, NETIF_MSG_HW,
                           "Configuring TAGMAC_CLS_TYPE\n");
                STORE_RT_REG(p_hwfn,
@@ -871,7 +824,7 @@ static int qed_hw_init_pf(struct qed_hwfn *p_hwfn,
 
        /* Cleanup chip from previous driver if such remains exist */
        rc = qed_final_cleanup(p_hwfn, p_ptt, rel_pf_id, false);
-       if (rc != 0)
+       if (rc)
                return rc;
 
        /* PF Init sequence */
@@ -887,21 +840,6 @@ static int qed_hw_init_pf(struct qed_hwfn *p_hwfn,
        /* Pure runtime initializations - directly to the HW  */
        qed_int_igu_init_pure_rt(p_hwfn, p_ptt, true, true);
 
-       if (hw_mode & (1 << MODE_MF_SI)) {
-               u8 pf_id = 0;
-               u32 val = 0;
-
-               if (!qed_hw_init_first_eth(p_hwfn, p_ptt, &pf_id)) {
-                       if (p_hwfn->rel_pf_id == pf_id) {
-                               DP_VERBOSE(p_hwfn, NETIF_MSG_IFUP,
-                                          "PF[%d] is first ETH on engine\n",
-                                          pf_id);
-                               val = 1;
-                       }
-                       qed_wr(p_hwfn, p_ptt, PRS_REG_MSG_INFO, val);
-               }
-       }
-
        if (b_hw_start) {
                /* enable interrupts */
                qed_int_igu_enable(p_hwfn, p_ptt, int_mode);
@@ -950,8 +888,7 @@ static void qed_reset_mb_shadow(struct qed_hwfn *p_hwfn,
        /* Read shadow of current MFW mailbox */
        qed_mcp_read_mb(p_hwfn, p_main_ptt);
        memcpy(p_hwfn->mcp_info->mfw_mb_shadow,
-              p_hwfn->mcp_info->mfw_mb_cur,
-              p_hwfn->mcp_info->mfw_mb_length);
+              p_hwfn->mcp_info->mfw_mb_cur, p_hwfn->mcp_info->mfw_mb_length);
 }
 
 int qed_hw_init(struct qed_dev *cdev,
@@ -971,7 +908,7 @@ int qed_hw_init(struct qed_dev *cdev,
 
        if (IS_PF(cdev)) {
                rc = qed_init_fw_data(cdev, bin_fw_data);
-               if (rc != 0)
+               if (rc)
                        return rc;
        }
 
@@ -988,8 +925,7 @@ int qed_hw_init(struct qed_dev *cdev,
 
                qed_calc_hw_mode(p_hwfn);
 
-               rc = qed_mcp_load_req(p_hwfn, p_hwfn->p_main_ptt,
-                                     &load_code);
+               rc = qed_mcp_load_req(p_hwfn, p_hwfn->p_main_ptt, &load_code);
                if (rc) {
                        DP_NOTICE(p_hwfn, "Failed sending LOAD_REQ command\n");
                        return rc;
@@ -1004,11 +940,6 @@ int qed_hw_init(struct qed_dev *cdev,
                p_hwfn->first_on_engine = (load_code ==
                                           FW_MSG_CODE_DRV_LOAD_ENGINE);
 
-               if (!qm_lock_init) {
-                       spin_lock_init(&qm_lock);
-                       qm_lock_init = true;
-               }
-
                switch (load_code) {
                case FW_MSG_CODE_DRV_LOAD_ENGINE:
                        rc = qed_hw_init_common(p_hwfn, p_hwfn->p_main_ptt,
@@ -1071,9 +1002,8 @@ int qed_hw_init(struct qed_dev *cdev,
 }
 
 #define QED_HW_STOP_RETRY_LIMIT (10)
-static inline void qed_hw_timers_stop(struct qed_dev *cdev,
-                                     struct qed_hwfn *p_hwfn,
-                                     struct qed_ptt *p_ptt)
+static void qed_hw_timers_stop(struct qed_dev *cdev,
+                              struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
 {
        int i;
 
@@ -1084,8 +1014,7 @@ static inline void qed_hw_timers_stop(struct qed_dev *cdev,
        for (i = 0; i < QED_HW_STOP_RETRY_LIMIT; i++) {
                if ((!qed_rd(p_hwfn, p_ptt,
                             TM_REG_PF_SCAN_ACTIVE_CONN)) &&
-                   (!qed_rd(p_hwfn, p_ptt,
-                            TM_REG_PF_SCAN_ACTIVE_TASK)))
+                   (!qed_rd(p_hwfn, p_ptt, TM_REG_PF_SCAN_ACTIVE_TASK)))
                        break;
 
                /* Dependent on number of connection/tasks, possibly
@@ -1190,8 +1119,7 @@ void qed_hw_stop_fastpath(struct qed_dev *cdev)
                }
 
                DP_VERBOSE(p_hwfn,
-                          NETIF_MSG_IFDOWN,
-                          "Shutting down the fastpath\n");
+                          NETIF_MSG_IFDOWN, "Shutting down the fastpath\n");
 
                qed_wr(p_hwfn, p_ptt,
                       NIG_REG_RX_LLH_BRB_GATE_DNTFWD_PERPF, 0x1);
@@ -1219,14 +1147,13 @@ void qed_hw_start_fastpath(struct qed_hwfn *p_hwfn)
               NIG_REG_RX_LLH_BRB_GATE_DNTFWD_PERPF, 0x0);
 }
 
-static int qed_reg_assert(struct qed_hwfn *hwfn,
-                         struct qed_ptt *ptt, u32 reg,
-                         bool expected)
+static int qed_reg_assert(struct qed_hwfn *p_hwfn,
+                         struct qed_ptt *p_ptt, u32 reg, bool expected)
 {
-       u32 assert_val = qed_rd(hwfn, ptt, reg);
+       u32 assert_val = qed_rd(p_hwfn, p_ptt, reg);
 
        if (assert_val != expected) {
-               DP_NOTICE(hwfn, "Value at address 0x%x != 0x%08x\n",
+               DP_NOTICE(p_hwfn, "Value at address 0x%08x != 0x%08x\n",
                          reg, expected);
                return -EINVAL;
        }
@@ -1306,8 +1233,7 @@ static void qed_hw_hwfn_prepare(struct qed_hwfn *p_hwfn)
 
        /* Clean Previous errors if such exist */
        qed_wr(p_hwfn, p_hwfn->p_main_ptt,
-              PGLUE_B_REG_WAS_ERROR_PF_31_0_CLR,
-              1 << p_hwfn->abs_pf_id);
+              PGLUE_B_REG_WAS_ERROR_PF_31_0_CLR, 1 << p_hwfn->abs_pf_id);
 
        /* enable internal target-read */
        qed_wr(p_hwfn, p_hwfn->p_main_ptt,
@@ -1317,7 +1243,8 @@ static void qed_hw_hwfn_prepare(struct qed_hwfn *p_hwfn)
 static void get_function_id(struct qed_hwfn *p_hwfn)
 {
        /* ME Register */
-       p_hwfn->hw_info.opaque_fid = (u16)REG_RD(p_hwfn, PXP_PF_ME_OPAQUE_ADDR);
+       p_hwfn->hw_info.opaque_fid = (u16) REG_RD(p_hwfn,
+                                                 PXP_PF_ME_OPAQUE_ADDR);
 
        p_hwfn->hw_info.concrete_fid = REG_RD(p_hwfn, PXP_PF_ME_CONCRETE_ADDR);
 
@@ -1326,6 +1253,10 @@ static void get_function_id(struct qed_hwfn *p_hwfn)
                                      PXP_CONCRETE_FID_PFID);
        p_hwfn->port_id = GET_FIELD(p_hwfn->hw_info.concrete_fid,
                                    PXP_CONCRETE_FID_PORT);
+
+       DP_VERBOSE(p_hwfn, NETIF_MSG_PROBE,
+                  "Read ME register: Concrete 0x%08x Opaque 0x%04x\n",
+                  p_hwfn->hw_info.concrete_fid, p_hwfn->hw_info.opaque_fid);
 }
 
 static void qed_hw_set_feat(struct qed_hwfn *p_hwfn)
@@ -1417,8 +1348,7 @@ static int qed_hw_get_resc(struct qed_hwfn *p_hwfn)
        return 0;
 }
 
-static int qed_hw_get_nvm_info(struct qed_hwfn *p_hwfn,
-                              struct qed_ptt *p_ptt)
+static int qed_hw_get_nvm_info(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
 {
        u32 nvm_cfg1_offset, mf_mode, addr, generic_cont0, core_cfg;
        u32 port_cfg_addr, link_temp, nvm_cfg_addr, device_capabilities;
@@ -1472,8 +1402,7 @@ static int qed_hw_get_nvm_info(struct qed_hwfn *p_hwfn,
                p_hwfn->hw_info.port_mode = QED_PORT_MODE_DE_1X25G;
                break;
        default:
-               DP_NOTICE(p_hwfn, "Unknown port mode in 0x%08x\n",
-                         core_cfg);
+               DP_NOTICE(p_hwfn, "Unknown port mode in 0x%08x\n", core_cfg);
                break;
        }
 
@@ -1484,11 +1413,11 @@ static int qed_hw_get_nvm_info(struct qed_hwfn *p_hwfn,
        link_temp = qed_rd(p_hwfn, p_ptt,
                           port_cfg_addr +
                           offsetof(struct nvm_cfg1_port, speed_cap_mask));
-       link->speed.advertised_speeds =
-               link_temp & NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_MASK;
+       link_temp &= NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_MASK;
+       link->speed.advertised_speeds = link_temp;
 
-       p_hwfn->mcp_info->link_capabilities.speed_capabilities =
-                                               link->speed.advertised_speeds;
+       link_temp = link->speed.advertised_speeds;
+       p_hwfn->mcp_info->link_capabilities.speed_capabilities = link_temp;
 
        link_temp = qed_rd(p_hwfn, p_ptt,
                           port_cfg_addr +
@@ -1517,8 +1446,7 @@ static int qed_hw_get_nvm_info(struct qed_hwfn *p_hwfn,
                link->speed.forced_speed = 100000;
                break;
        default:
-               DP_NOTICE(p_hwfn, "Unknown Speed in 0x%08x\n",
-                         link_temp);
+               DP_NOTICE(p_hwfn, "Unknown Speed in 0x%08x\n", link_temp);
        }
 
        link_temp &= NVM_CFG1_PORT_DRV_FLOW_CONTROL_MASK;
@@ -1628,10 +1556,10 @@ static void qed_get_num_funcs(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
 
        DP_VERBOSE(p_hwfn,
                   NETIF_MSG_PROBE,
-                  "PF [rel_id %d, abs_id %d] within the %d enabled functions on the engine\n",
+                  "PF [rel_id %d, abs_id %d] occupies index %d within the %d enabled functions on the engine\n",
                   p_hwfn->rel_pf_id,
                   p_hwfn->abs_pf_id,
-                  p_hwfn->num_funcs_on_engine);
+                  p_hwfn->enabled_func_idx, p_hwfn->num_funcs_on_engine);
 }
 
 static int
@@ -1703,10 +1631,9 @@ static int qed_get_dev_info(struct qed_dev *cdev)
        u32 tmp;
 
        /* Read Vendor Id / Device Id */
-       pci_read_config_word(cdev->pdev, PCI_VENDOR_ID,
-                            &cdev->vendor_id);
-       pci_read_config_word(cdev->pdev, PCI_DEVICE_ID,
-                            &cdev->device_id);
+       pci_read_config_word(cdev->pdev, PCI_VENDOR_ID, &cdev->vendor_id);
+       pci_read_config_word(cdev->pdev, PCI_DEVICE_ID, &cdev->device_id);
+
        cdev->chip_num = (u16)qed_rd(p_hwfn, p_hwfn->p_main_ptt,
                                     MISCS_REG_CHIP_NUM);
        cdev->chip_rev = (u16)qed_rd(p_hwfn, p_hwfn->p_main_ptt,
@@ -1771,10 +1698,8 @@ static int qed_hw_prepare_single(struct qed_hwfn *p_hwfn,
 
        /* Allocate PTT pool */
        rc = qed_ptt_pool_alloc(p_hwfn);
-       if (rc) {
-               DP_NOTICE(p_hwfn, "Failed to prepare hwfn's hw\n");
+       if (rc)
                goto err0;
-       }
 
        /* Allocate the main PTT */
        p_hwfn->p_main_ptt = qed_get_reserved_ptt(p_hwfn, RESERVED_PTT_MAIN);
@@ -1782,7 +1707,7 @@ static int qed_hw_prepare_single(struct qed_hwfn *p_hwfn,
        /* First hwfn learns basic information, e.g., number of hwfns */
        if (!p_hwfn->my_id) {
                rc = qed_get_dev_info(p_hwfn->cdev);
-               if (rc != 0)
+               if (rc)
                        goto err1;
        }
 
@@ -1804,10 +1729,8 @@ static int qed_hw_prepare_single(struct qed_hwfn *p_hwfn,
 
        /* Allocate the init RT array and initialize the init-ops engine */
        rc = qed_init_alloc(p_hwfn);
-       if (rc) {
-               DP_NOTICE(p_hwfn, "Failed to allocate the init array\n");
+       if (rc)
                goto err2;
-       }
 
        return rc;
 err2:
@@ -2015,10 +1938,8 @@ qed_chain_alloc_next_ptr(struct qed_dev *cdev, struct qed_chain *p_chain)
                p_virt = dma_alloc_coherent(&cdev->pdev->dev,
                                            QED_CHAIN_PAGE_SIZE,
                                            &p_phys, GFP_KERNEL);
-               if (!p_virt) {
-                       DP_NOTICE(cdev, "Failed to allocate chain memory\n");
+               if (!p_virt)
                        return -ENOMEM;
-               }
 
                if (i == 0) {
                        qed_chain_init_mem(p_chain, p_virt, p_phys);
@@ -2048,10 +1969,8 @@ qed_chain_alloc_single(struct qed_dev *cdev, struct qed_chain *p_chain)
 
        p_virt = dma_alloc_coherent(&cdev->pdev->dev,
                                    QED_CHAIN_PAGE_SIZE, &p_phys, GFP_KERNEL);
-       if (!p_virt) {
-               DP_NOTICE(cdev, "Failed to allocate chain memory\n");
+       if (!p_virt)
                return -ENOMEM;
-       }
 
        qed_chain_init_mem(p_chain, p_virt, p_phys);
        qed_chain_reset(p_chain);
@@ -2068,13 +1987,9 @@ static int qed_chain_alloc_pbl(struct qed_dev *cdev, struct qed_chain *p_chain)
        void *p_virt = NULL;
 
        size = page_cnt * sizeof(*pp_virt_addr_tbl);
-       pp_virt_addr_tbl = vmalloc(size);
-       if (!pp_virt_addr_tbl) {
-               DP_NOTICE(cdev,
-                         "Failed to allocate memory for the chain virtual addresses table\n");
+       pp_virt_addr_tbl = vzalloc(size);
+       if (!pp_virt_addr_tbl)
                return -ENOMEM;
-       }
-       memset(pp_virt_addr_tbl, 0, size);
 
        /* The allocation of the PBL table is done with its full size, since it
         * is expected to be successive.
@@ -2087,19 +2002,15 @@ static int qed_chain_alloc_pbl(struct qed_dev *cdev, struct qed_chain *p_chain)
                                        size, &p_pbl_phys, GFP_KERNEL);
        qed_chain_init_pbl_mem(p_chain, p_pbl_virt, p_pbl_phys,
                               pp_virt_addr_tbl);
-       if (!p_pbl_virt) {
-               DP_NOTICE(cdev, "Failed to allocate chain pbl memory\n");
+       if (!p_pbl_virt)
                return -ENOMEM;
-       }
 
        for (i = 0; i < page_cnt; i++) {
                p_virt = dma_alloc_coherent(&cdev->pdev->dev,
                                            QED_CHAIN_PAGE_SIZE,
                                            &p_phys, GFP_KERNEL);
-               if (!p_virt) {
-                       DP_NOTICE(cdev, "Failed to allocate chain memory\n");
+               if (!p_virt)
                        return -ENOMEM;
-               }
 
                if (i == 0) {
                        qed_chain_init_mem(p_chain, p_virt, p_phys);
@@ -2134,7 +2045,8 @@ int qed_chain_alloc(struct qed_dev *cdev,
        rc = qed_chain_alloc_sanity_check(cdev, cnt_type, elem_size, page_cnt);
        if (rc) {
                DP_NOTICE(cdev,
-                         "Cannot allocate a chain with the given arguments:\n"
+                         "Cannot allocate a chain with the given arguments:\n");
+               DP_NOTICE(cdev,
                          "[use_mode %d, mode %d, cnt_type %d, num_elems %d, elem_size %zu]\n",
                          intended_use, mode, cnt_type, num_elems, elem_size);
                return rc;
@@ -2183,8 +2095,7 @@ int qed_fw_l2_queue(struct qed_hwfn *p_hwfn, u16 src_id, u16 *dst_id)
        return 0;
 }
 
-int qed_fw_vport(struct qed_hwfn *p_hwfn,
-                u8 src_id, u8 *dst_id)
+int qed_fw_vport(struct qed_hwfn *p_hwfn, u8 src_id, u8 *dst_id)
 {
        if (src_id >= RESC_NUM(p_hwfn, QED_VPORT)) {
                u8 min, max;
@@ -2203,8 +2114,7 @@ int qed_fw_vport(struct qed_hwfn *p_hwfn,
        return 0;
 }
 
-int qed_fw_rss_eng(struct qed_hwfn *p_hwfn,
-                  u8 src_id, u8 *dst_id)
+int qed_fw_rss_eng(struct qed_hwfn *p_hwfn, u8 src_id, u8 *dst_id)
 {
        if (src_id >= RESC_NUM(p_hwfn, QED_RSS_ENG)) {
                u8 min, max;
@@ -2386,8 +2296,7 @@ static void qed_disable_wfq_for_all_vports(struct qed_hwfn *p_hwfn,
  * 3. total_req_min_rate [all vports min rate sum] shouldn't exceed min_pf_rate.
  */
 static int qed_init_wfq_param(struct qed_hwfn *p_hwfn,
-                             u16 vport_id, u32 req_rate,
-                             u32 min_pf_rate)
+                             u16 vport_id, u32 req_rate, u32 min_pf_rate)
 {
        u32 total_req_min_rate = 0, total_left_rate = 0, left_rate_per_vp = 0;
        int non_requested_count = 0, req_count = 0, i, num_vports;
@@ -2471,7 +2380,7 @@ static int __qed_configure_vport_wfq(struct qed_hwfn *p_hwfn,
 
        rc = qed_init_wfq_param(p_hwfn, vp_id, rate, p_link->min_pf_rate);
 
-       if (rc == 0)
+       if (!rc)
                qed_configure_wfq_for_all_vports(p_hwfn, p_ptt,
                                                 p_link->min_pf_rate);
        else
This page took 0.048683 seconds and 5 git commands to generate.