net/tap: fix to populate FDs in secondary process
[dpdk.git] / drivers / net / bnxt / bnxt_hwrm.c
index b8c0cf5..b4aeec5 100644 (file)
@@ -902,15 +902,7 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
        bp->max_l2_ctx = rte_le_to_cpu_16(resp->max_l2_ctxs);
        if (!BNXT_CHIP_P5(bp) && !bp->pdev->max_vfs)
                bp->max_l2_ctx += bp->max_rx_em_flows;
-       /* TODO: For now, do not support VMDq/RFS on VFs. */
-       if (BNXT_PF(bp)) {
-               if (bp->pf->max_vfs)
-                       bp->max_vnics = 1;
-               else
-                       bp->max_vnics = rte_le_to_cpu_16(resp->max_vnics);
-       } else {
-               bp->max_vnics = 1;
-       }
+       bp->max_vnics = rte_le_to_cpu_16(resp->max_vnics);
        PMD_DRV_LOG(DEBUG, "Max l2_cntxts is %d vnics is %d\n",
                    bp->max_l2_ctx, bp->max_vnics);
        bp->max_stat_ctx = rte_le_to_cpu_16(resp->max_stat_ctx);
@@ -1436,16 +1428,17 @@ static int bnxt_hwrm_port_phy_cfg(struct bnxt *bp, struct bnxt_link_info *conf)
                    !(conf->phy_flags & HWRM_PORT_PHY_CFG_INPUT_FLAGS_FORCE)) {
                        req.auto_mode =
                                HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_SPEED_MASK;
-                       req.auto_link_speed_mask =
-                               conf->auto_link_speed_mask;
-                       if (conf->auto_pam4_link_speeds) {
+                       if (conf->auto_pam4_link_speed_mask &&
+                           bp->link_info->link_signal_mode) {
                                enables |=
                                HWRM_PORT_PHY_CFG_IN_EN_AUTO_PAM4_LINK_SPD_MASK;
                                req.auto_link_pam4_speed_mask =
-                                       conf->auto_pam4_link_speeds;
+                               rte_cpu_to_le_16(conf->auto_pam4_link_speed_mask);
                        } else {
                                enables |=
                                HWRM_PORT_PHY_CFG_IN_EN_AUTO_LINK_SPEED_MASK;
+                               req.auto_link_speed_mask =
+                               rte_cpu_to_le_16(conf->auto_link_speed_mask);
                        }
                }
                if (conf->auto_link_speed &&
@@ -1518,7 +1511,7 @@ static int bnxt_hwrm_port_phy_qcfg(struct bnxt *bp,
                        rte_le_to_cpu_16(resp->force_pam4_link_speed);
        link_info->support_pam4_speeds =
                        rte_le_to_cpu_16(resp->support_pam4_speeds);
-       link_info->auto_pam4_link_speeds =
+       link_info->auto_pam4_link_speed_mask =
                        rte_le_to_cpu_16(resp->auto_pam4_link_speed_mask);
        link_info->module_status = resp->module_status;
        HWRM_UNLOCK();
@@ -1529,7 +1522,7 @@ static int bnxt_hwrm_port_phy_qcfg(struct bnxt *bp,
                    link_info->support_speeds, link_info->force_link_speed);
        PMD_DRV_LOG(DEBUG, "Link Signal:%d,PAM::Auto:%x,Support:%x,Force:%x\n",
                    link_info->link_signal_mode,
-                   link_info->auto_pam4_link_speeds,
+                   link_info->auto_pam4_link_speed_mask,
                    link_info->support_pam4_speeds,
                    link_info->force_pam4_link_speed);
        return rc;
@@ -3245,21 +3238,22 @@ int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up)
        /* No auto speeds and no auto_pam4_link. Disable autoneg */
        if (bp->link_info->auto_link_speed == 0 &&
            bp->link_info->link_signal_mode &&
-           bp->link_info->auto_pam4_link_speeds == 0)
+           bp->link_info->auto_pam4_link_speed_mask == 0)
                autoneg = 0;
 
        speed = bnxt_parse_eth_link_speed(dev_conf->link_speeds,
                                          bp->link_info->link_signal_mode);
        link_req.phy_flags = HWRM_PORT_PHY_CFG_INPUT_FLAGS_RESET_PHY;
        /* Autoneg can be done only when the FW allows. */
-       if (autoneg == 1 && bp->link_info->support_auto_speeds) {
+       if (autoneg == 1 &&
+           (bp->link_info->support_auto_speeds || bp->link_info->support_pam4_auto_speeds)) {
                link_req.phy_flags |=
                                HWRM_PORT_PHY_CFG_INPUT_FLAGS_RESTART_AUTONEG;
                link_req.auto_link_speed_mask =
                        bnxt_parse_eth_link_speed_mask(bp,
                                                       dev_conf->link_speeds);
-               link_req.auto_pam4_link_speeds =
-                       bp->link_info->auto_pam4_link_speeds;
+               link_req.auto_pam4_link_speed_mask =
+                       bp->link_info->auto_pam4_link_speed_mask;
        } else {
                if (bp->link_info->phy_type ==
                    HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASET ||
@@ -3278,9 +3272,9 @@ int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up)
                else if (bp->link_info->force_pam4_link_speed)
                        link_req.link_speed =
                                bp->link_info->force_pam4_link_speed;
-               else if (bp->link_info->auto_pam4_link_speeds)
+               else if (bp->link_info->auto_pam4_link_speed_mask)
                        link_req.link_speed =
-                               bp->link_info->auto_pam4_link_speeds;
+                               bp->link_info->auto_pam4_link_speed_mask;
                else if (bp->link_info->support_pam4_speeds)
                        link_req.link_speed =
                                bp->link_info->support_pam4_speeds;
@@ -3292,7 +3286,7 @@ int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up)
                 * zero. Use the auto_link_speed.
                 */
                if (bp->link_info->auto_link_speed != 0 &&
-                   bp->link_info->auto_pam4_link_speeds == 0)
+                   bp->link_info->auto_pam4_link_speed_mask == 0)
                        link_req.link_speed = bp->link_info->auto_link_speed;
        }
        link_req.duplex = bnxt_parse_eth_link_duplex(dev_conf->link_speeds);
@@ -3493,7 +3487,7 @@ static int bnxt_hwrm_pf_func_cfg(struct bnxt *bp,
                        rte_cpu_to_le_16(pf_resc->num_hw_ring_grps);
        } else if (BNXT_HAS_NQ(bp)) {
                enables |= HWRM_FUNC_CFG_INPUT_ENABLES_NUM_MSIX;
-               req.num_msix = rte_cpu_to_le_16(bp->max_nq_rings);
+               req.num_msix = rte_cpu_to_le_16(pf_resc->num_nq_rings);
        }
 
        req.flags = rte_cpu_to_le_32(bp->pf->func_cfg_flags);
@@ -3506,7 +3500,7 @@ static int bnxt_hwrm_pf_func_cfg(struct bnxt *bp,
        req.num_tx_rings = rte_cpu_to_le_16(pf_resc->num_tx_rings);
        req.num_rx_rings = rte_cpu_to_le_16(pf_resc->num_rx_rings);
        req.num_l2_ctxs = rte_cpu_to_le_16(pf_resc->num_l2_ctxs);
-       req.num_vnics = rte_cpu_to_le_16(bp->max_vnics);
+       req.num_vnics = rte_cpu_to_le_16(pf_resc->num_vnics);
        req.fid = rte_cpu_to_le_16(0xffff);
        req.enables = rte_cpu_to_le_32(enables);
 
@@ -3543,14 +3537,12 @@ bnxt_fill_vf_func_cfg_req_new(struct bnxt *bp,
        req->min_rx_rings = req->max_rx_rings;
        req->max_l2_ctxs = rte_cpu_to_le_16(bp->max_l2_ctx / (num_vfs + 1));
        req->min_l2_ctxs = req->max_l2_ctxs;
-       /* TODO: For now, do not support VMDq/RFS on VFs. */
-       req->max_vnics = rte_cpu_to_le_16(1);
+       req->max_vnics = rte_cpu_to_le_16(bp->max_vnics / (num_vfs + 1));
        req->min_vnics = req->max_vnics;
        req->max_hw_ring_grps = rte_cpu_to_le_16(bp->max_ring_grps /
                                                 (num_vfs + 1));
        req->min_hw_ring_grps = req->max_hw_ring_grps;
-       req->flags =
-        rte_cpu_to_le_16(HWRM_FUNC_VF_RESOURCE_CFG_INPUT_FLAGS_MIN_GUARANTEED);
+       req->max_msix = rte_cpu_to_le_16(bp->max_nq_rings / (num_vfs + 1));
 }
 
 static void
@@ -3610,6 +3602,8 @@ static int bnxt_update_max_resources(struct bnxt *bp,
        bp->max_rx_rings -= rte_le_to_cpu_16(resp->alloc_rx_rings);
        bp->max_l2_ctx -= rte_le_to_cpu_16(resp->alloc_l2_ctx);
        bp->max_ring_grps -= rte_le_to_cpu_16(resp->alloc_hw_ring_grps);
+       bp->max_nq_rings -= rte_le_to_cpu_16(resp->alloc_msix);
+       bp->max_vnics -= rte_le_to_cpu_16(resp->alloc_vnics);
 
        HWRM_UNLOCK();
 
@@ -3683,6 +3677,8 @@ static int bnxt_query_pf_resources(struct bnxt *bp,
        pf_resc->num_rx_rings = rte_le_to_cpu_16(resp->alloc_rx_rings);
        pf_resc->num_l2_ctxs = rte_le_to_cpu_16(resp->alloc_l2_ctx);
        pf_resc->num_hw_ring_grps = rte_le_to_cpu_32(resp->alloc_hw_ring_grps);
+       pf_resc->num_nq_rings = rte_le_to_cpu_32(resp->alloc_msix);
+       pf_resc->num_vnics = rte_le_to_cpu_16(resp->alloc_vnics);
        bp->pf->evb_mode = resp->evb_mode;
 
        HWRM_UNLOCK();
@@ -3703,6 +3699,8 @@ bnxt_calculate_pf_resources(struct bnxt *bp,
                pf_resc->num_rx_rings = bp->max_rx_rings;
                pf_resc->num_l2_ctxs = bp->max_l2_ctx;
                pf_resc->num_hw_ring_grps = bp->max_ring_grps;
+               pf_resc->num_nq_rings = bp->max_nq_rings;
+               pf_resc->num_vnics = bp->max_vnics;
 
                return;
        }
@@ -3721,6 +3719,10 @@ bnxt_calculate_pf_resources(struct bnxt *bp,
                               bp->max_l2_ctx % (num_vfs + 1);
        pf_resc->num_hw_ring_grps = bp->max_ring_grps / (num_vfs + 1) +
                                    bp->max_ring_grps % (num_vfs + 1);
+       pf_resc->num_nq_rings = bp->max_nq_rings / (num_vfs + 1) +
+                               bp->max_nq_rings % (num_vfs + 1);
+       pf_resc->num_vnics = bp->max_vnics / (num_vfs + 1) +
+                               bp->max_vnics % (num_vfs + 1);
 }
 
 int bnxt_hwrm_allocate_pf_only(struct bnxt *bp)
@@ -3896,6 +3898,8 @@ bnxt_update_pf_resources(struct bnxt *bp,
        bp->max_tx_rings = pf_resc->num_tx_rings;
        bp->max_rx_rings = pf_resc->num_rx_rings;
        bp->max_ring_grps = pf_resc->num_hw_ring_grps;
+       bp->max_nq_rings = pf_resc->num_nq_rings;
+       bp->max_vnics = pf_resc->num_vnics;
 }
 
 static int32_t