#define BNXT_REP_Q_F2R_VALID BIT(2)
#define BNXT_REP_FC_R2F_VALID BIT(3)
#define BNXT_REP_FC_F2R_VALID BIT(4)
+#define BNXT_REP_BASED_PF_VALID BIT(5)
uint32_t flags;
uint16_t fw_fid;
#define BNXT_DFLT_VNIC_ID_INVALID 0xFFFF
uint16_t dflt_vnic_id;
uint16_t svif;
uint16_t vfr_tx_cfa_action;
+ uint8_t parent_pf_idx; /* Logical PF index */
uint32_t dpdk_port_id;
uint32_t rep_based_pf;
uint8_t rep_q_r2f;
uint64_t rx_drop_bytes[BNXT_MAX_VF_REP_RINGS];
};
-#define BNXT_REP_PF(vfr_bp) ((vfr_bp)->flags & BNXT_REP_IS_PF)
+#define BNXT_REP_PF(vfr_bp) ((vfr_bp)->flags & BNXT_REP_IS_PF)
+#define BNXT_REP_BASED_PF(vfr_bp) \
+ ((vfr_bp)->flags & BNXT_REP_BASED_PF_VALID)
struct bnxt_vf_rep_tx_queue {
struct bnxt_tx_queue *txq;
return 0;
}
-int bnxt_hwrm_cfa_vfr_alloc(struct bnxt *bp, uint16_t vf_idx)
-{
- struct hwrm_cfa_vfr_alloc_output *resp = bp->hwrm_cmd_resp_addr;
- struct hwrm_cfa_vfr_alloc_input req = {0};
- int rc;
-
- if (!(BNXT_PF(bp) || BNXT_VF_IS_TRUSTED(bp))) {
- PMD_DRV_LOG(DEBUG,
- "Not a PF or trusted VF. Command not supported\n");
- return 0;
- }
-
- HWRM_PREP(&req, HWRM_CFA_VFR_ALLOC, BNXT_USE_CHIMP_MB);
- req.vf_id = rte_cpu_to_le_16(vf_idx);
- snprintf(req.vfr_name, sizeof(req.vfr_name), "%svfr%d",
- bp->eth_dev->data->name, vf_idx);
-
- rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
- HWRM_CHECK_RESULT();
-
- HWRM_UNLOCK();
- PMD_DRV_LOG(DEBUG, "VFR %d allocated\n", vf_idx);
- return rc;
-}
-
-int bnxt_hwrm_cfa_vfr_free(struct bnxt *bp, uint16_t vf_idx)
-{
- struct hwrm_cfa_vfr_free_output *resp = bp->hwrm_cmd_resp_addr;
- struct hwrm_cfa_vfr_free_input req = {0};
- int rc;
-
- if (!(BNXT_PF(bp) || BNXT_VF_IS_TRUSTED(bp))) {
- PMD_DRV_LOG(DEBUG,
- "Not a PF or trusted VF. Command not supported\n");
- return 0;
- }
-
- HWRM_PREP(&req, HWRM_CFA_VFR_FREE, BNXT_USE_CHIMP_MB);
- req.vf_id = rte_cpu_to_le_16(vf_idx);
- snprintf(req.vfr_name, sizeof(req.vfr_name), "%svfr%d",
- bp->eth_dev->data->name, vf_idx);
-
- rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
- HWRM_CHECK_RESULT();
- HWRM_UNLOCK();
- PMD_DRV_LOG(DEBUG, "VFR %d freed\n", vf_idx);
- return rc;
-}
-
int bnxt_hwrm_first_vf_id_query(struct bnxt *bp, uint16_t fid,
uint16_t *first_vf_id)
{
snprintf(req.pair_name, sizeof(req.pair_name), "%svfr%d",
bp->eth_dev->data->name, rep_bp->vf_id);
- req.pf_b_id = rte_cpu_to_le_32(rep_bp->rep_based_pf);
- req.vf_b_id = rte_cpu_to_le_16(rep_bp->vf_id);
+ req.pf_b_id = rep_bp->parent_pf_idx;
+ req.vf_b_id = BNXT_REP_PF(rep_bp) ? rte_cpu_to_le_16(((uint16_t)-1)) :
+ rte_cpu_to_le_16(rep_bp->vf_id);
req.vf_a_id = rte_cpu_to_le_16(bp->fw_fid);
req.host_b_id = 1; /* TBD - Confirm if this is OK */
HWRM_PREP(&req, HWRM_CFA_PAIR_FREE, BNXT_USE_CHIMP_MB);
snprintf(req.pair_name, sizeof(req.pair_name), "%svfr%d",
bp->eth_dev->data->name, rep_bp->vf_id);
- req.pf_b_id = rte_cpu_to_le_32(rep_bp->rep_based_pf);
- req.vf_id = rte_cpu_to_le_16(rep_bp->vf_id);
+ req.pf_b_id = rep_bp->parent_pf_idx;
req.pair_mode = HWRM_CFA_PAIR_FREE_INPUT_PAIR_MODE_REP2FN_TRUFLOW;
-
+ req.vf_id = BNXT_REP_PF(rep_bp) ? rte_cpu_to_le_16(((uint16_t)-1)) :
+ rte_cpu_to_le_16(rep_bp->vf_id);
rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
HWRM_CHECK_RESULT();
HWRM_UNLOCK();
"Switch domain id %d: Representor Device %d init done\n",
vf_rep_bp->switch_domain_id, vf_rep_bp->vf_id);
- if (vf_rep_bp->rep_based_pf) {
+ if (BNXT_REP_BASED_PF(vf_rep_bp)) {
vf_rep_bp->fw_fid = vf_rep_bp->rep_based_pf + 1;
+ vf_rep_bp->parent_pf_idx = vf_rep_bp->rep_based_pf;
if (!(BNXT_REP_PF(vf_rep_bp))) {
/* VF representor for the remote PF,get first_vf_id */
rc = bnxt_hwrm_first_vf_id_query(parent_bp,
}
} else {
vf_rep_bp->fw_fid = rep_params->vf_id + parent_bp->first_vf_id;
+ if (BNXT_VF_IS_TRUSTED(parent_bp))
+ vf_rep_bp->parent_pf_idx = parent_bp->parent->fid - 1;
+ else
+ vf_rep_bp->parent_pf_idx = parent_bp->fw_fid - 1;
}
PMD_DRV_LOG(INFO, "vf_rep->fw_fid = %d\n", vf_rep_bp->fw_fid);
/* update the port id so you can backtrack to ethdev */
vfr->dpdk_port_id = vfr_ethdev->data->port_id;
- if (BNXT_STINGRAY(parent_bp)) {
- rc = bnxt_hwrm_cfa_pair_alloc(parent_bp, vfr);
- } else {
- rc = bnxt_hwrm_cfa_vfr_alloc(parent_bp, vfr->vf_id);
- }
+ rc = bnxt_hwrm_cfa_pair_alloc(parent_bp, vfr);
if (rc) {
BNXT_TF_DBG(ERR, "Failed in hwrm vfr alloc vfr:%u rc=%d\n",
vfr->vf_id, rc);
vfr->vf_id);
vfr->vfr_tx_cfa_action = 0;
- if (BNXT_STINGRAY(parent_bp))
- rc = bnxt_hwrm_cfa_pair_free(parent_bp, vfr);
- else
- rc = bnxt_hwrm_cfa_vfr_free(parent_bp, vfr->vf_id);
+ rc = bnxt_hwrm_cfa_pair_free(parent_bp, vfr);
return rc;
}