return rc;
}
+static int
+bnxt_get_dflt_vnic_svif(struct bnxt *bp, struct bnxt_vf_representor *vf_rep_bp)
+{
+ struct bnxt_rep_info *rep_info;
+ int rc;
+
+ rc = bnxt_hwrm_get_dflt_vnic_svif(bp, vf_rep_bp->fw_fid,
+ &vf_rep_bp->dflt_vnic_id,
+ &vf_rep_bp->svif);
+ if (rc) {
+ PMD_DRV_LOG(ERR, "Failed to get default vnic id of VF\n");
+ vf_rep_bp->dflt_vnic_id = BNXT_DFLT_VNIC_ID_INVALID;
+ vf_rep_bp->svif = BNXT_SVIF_INVALID;
+ } else {
+ PMD_DRV_LOG(INFO, "vf_rep->dflt_vnic_id = %d\n",
+ vf_rep_bp->dflt_vnic_id);
+ }
+ if (vf_rep_bp->dflt_vnic_id != BNXT_DFLT_VNIC_ID_INVALID &&
+ vf_rep_bp->svif != BNXT_SVIF_INVALID) {
+ rep_info = &bp->rep_info[vf_rep_bp->vf_id];
+ rep_info->conduit_valid = true;
+ }
+
+ return rc;
+}
+
int bnxt_vf_representor_init(struct rte_eth_dev *eth_dev, void *params)
{
struct bnxt_vf_representor *vf_rep_bp = eth_dev->data->dev_private;
(struct bnxt_vf_representor *)params;
struct rte_eth_link *link;
struct bnxt *parent_bp;
- int rc = 0;
vf_rep_bp->vf_id = rep_params->vf_id;
vf_rep_bp->switch_domain_id = rep_params->switch_domain_id;
eth_dev->data->dev_link.link_status = link->link_status;
eth_dev->data->dev_link.link_autoneg = link->link_autoneg;
- vf_rep_bp->fw_fid = rep_params->vf_id + parent_bp->first_vf_id;
- PMD_DRV_LOG(INFO, "vf_rep->fw_fid = %d\n", vf_rep_bp->fw_fid);
- rc = bnxt_hwrm_get_dflt_vnic_svif(parent_bp, vf_rep_bp->fw_fid,
- &vf_rep_bp->dflt_vnic_id,
- &vf_rep_bp->svif);
- if (rc)
- PMD_DRV_LOG(ERR, "Failed to get default vnic id of VF\n");
- else
- PMD_DRV_LOG(INFO, "vf_rep->dflt_vnic_id = %d\n",
- vf_rep_bp->dflt_vnic_id);
-
PMD_DRV_LOG(INFO, "calling bnxt_print_link_info\n");
bnxt_print_link_info(eth_dev);
"Switch domain id %d: Representor Device %d init done\n",
vf_rep_bp->switch_domain_id, vf_rep_bp->vf_id);
+ vf_rep_bp->fw_fid = rep_params->vf_id + parent_bp->first_vf_id;
+ PMD_DRV_LOG(INFO, "vf_rep->fw_fid = %d\n", vf_rep_bp->fw_fid);
+
return 0;
}
int rc;
parent_bp = rep->parent_dev->data->dev_private;
+ if (!parent_bp)
+ return 0;
+
rc = bnxt_link_update_op(parent_bp->eth_dev, wait_to_compl);
/* Link state. Inherited from PF or trusted VF */
if (rc) {
BNXT_TF_DBG(DEBUG,
"Default flow rule creation for VFR->VF failed!\n");
- return -EIO;
+ goto err;
}
BNXT_TF_DBG(DEBUG, "*** Default flow rule created for VFR->VF! ***\n");
if (rc) {
BNXT_TF_DBG(DEBUG,
"Failed to get action_ptr for VFR->VF dflt rule\n");
- return -EIO;
+ goto rep2vf_free;
}
BNXT_TF_DBG(DEBUG, "tx_cfa_action = %d\n", vfr->vfr_tx_cfa_action);
rc = ulp_default_flow_create(parent_dev, param_list,
if (rc) {
BNXT_TF_DBG(DEBUG,
"Default flow rule creation for VF->VFR failed!\n");
- return -EIO;
+ goto rep2vf_free;
}
BNXT_TF_DBG(DEBUG, "*** Default flow rule created for VF->VFR! ***\n");
BNXT_TF_DBG(DEBUG, "vfr2rep_flow_id = %d\n", vfr->vf2rep_flow_id);
+ rc = bnxt_hwrm_cfa_vfr_alloc(parent_bp, vfr->vf_id);
+ if (rc)
+ goto vf2rep_free;
+
return 0;
+
+vf2rep_free:
+ ulp_default_flow_destroy(vfr->parent_dev, vfr->vf2rep_flow_id);
+rep2vf_free:
+ ulp_default_flow_destroy(vfr->parent_dev, vfr->rep2vf_flow_id);
+err:
+ return -EIO;
}
static int bnxt_vfr_alloc(struct rte_eth_dev *vfr_ethdev)
{
int rc = 0;
struct bnxt_vf_representor *vfr = vfr_ethdev->data->dev_private;
+ struct bnxt *parent_bp;
if (!vfr || !vfr->parent_dev) {
PMD_DRV_LOG(ERR,
return -ENOMEM;
}
+ parent_bp = vfr->parent_dev->data->dev_private;
+ if (parent_bp && !parent_bp->ulp_ctx) {
+ PMD_DRV_LOG(ERR,
+ "ulp context not allocated for parent\n");
+ return -EIO;
+ }
+
/* Check if representor has been already allocated in FW */
- if (vfr->vfr_tx_cfa_action && vfr->rx_cfa_code)
+ if (vfr->vfr_tx_cfa_action)
return 0;
/*
int bnxt_vf_rep_dev_start_op(struct rte_eth_dev *eth_dev)
{
struct bnxt_vf_representor *rep_bp = eth_dev->data->dev_private;
+ struct bnxt_rep_info *rep_info;
+ struct bnxt *parent_bp;
int rc;
- rc = bnxt_vfr_alloc(eth_dev);
+ parent_bp = rep_bp->parent_dev->data->dev_private;
+ rep_info = &parent_bp->rep_info[rep_bp->vf_id];
- if (!rc) {
- eth_dev->rx_pkt_burst = &bnxt_vf_rep_rx_burst;
- eth_dev->tx_pkt_burst = &bnxt_vf_rep_tx_burst;
+ pthread_mutex_lock(&rep_info->vfr_start_lock);
+ if (rep_info->conduit_valid) {
+ pthread_mutex_unlock(&rep_info->vfr_start_lock);
+ return 0;
+ }
+ rc = bnxt_get_dflt_vnic_svif(parent_bp, rep_bp);
+ if (rc || !rep_info->conduit_valid) {
+ pthread_mutex_unlock(&rep_info->vfr_start_lock);
+ return rc;
+ }
+ pthread_mutex_unlock(&rep_info->vfr_start_lock);
- bnxt_vf_rep_link_update_op(eth_dev, 1);
- } else {
+ rc = bnxt_vfr_alloc(eth_dev);
+ if (rc) {
eth_dev->data->dev_link.link_status = 0;
bnxt_vf_rep_free_rx_mbufs(rep_bp);
+ return rc;
}
+ eth_dev->rx_pkt_burst = &bnxt_vf_rep_rx_burst;
+ eth_dev->tx_pkt_burst = &bnxt_vf_rep_tx_burst;
+ bnxt_vf_rep_link_update_op(eth_dev, 1);
- return rc;
+ return 0;
}
static int bnxt_tf_vfr_free(struct bnxt_vf_representor *vfr)
}
parent_bp = vfr->parent_dev->data->dev_private;
+ if (!parent_bp)
+ return 0;
/* Check if representor has been already freed in FW */
- if (!vfr->vfr_tx_cfa_action && !vfr->rx_cfa_code)
+ if (!vfr->vfr_tx_cfa_action)
return 0;
rc = bnxt_tf_vfr_free(vfr);
return rc;
}
- parent_bp->cfa_code_map[vfr->rx_cfa_code] = BNXT_VF_IDX_INVALID;
PMD_DRV_LOG(DEBUG, "freed representor %d in FW\n",
vfr->vf_id);
vfr->vfr_tx_cfa_action = 0;
- vfr->rx_cfa_code = 0;
+
+ rc = bnxt_hwrm_cfa_vfr_free(parent_bp, vfr->vf_id);
return rc;
}
{
struct bnxt_vf_representor *rep_bp = eth_dev->data->dev_private;
struct bnxt *parent_bp;
- uint16_t max_vnics, i, j, vpool, vrxq;
unsigned int max_rx_rings;
int rc = 0;
dev_info->max_tx_queues = max_rx_rings;
dev_info->reta_size = bnxt_rss_hash_tbl_size(parent_bp);
dev_info->hash_key_size = 40;
- max_vnics = parent_bp->max_vnics;
/* MTU specifics */
dev_info->min_mtu = RTE_ETHER_MIN_MTU;
dev_info->tx_offload_capa = BNXT_DEV_TX_OFFLOAD_SUPPORT;
dev_info->flow_type_rss_offloads = BNXT_ETH_RSS_SUPPORT;
- /* *INDENT-OFF* */
- dev_info->default_rxconf = (struct rte_eth_rxconf) {
- .rx_thresh = {
- .pthresh = 8,
- .hthresh = 8,
- .wthresh = 0,
- },
- .rx_free_thresh = 32,
- /* If no descriptors available, pkts are dropped by default */
- .rx_drop_en = 1,
- };
-
- dev_info->default_txconf = (struct rte_eth_txconf) {
- .tx_thresh = {
- .pthresh = 32,
- .hthresh = 0,
- .wthresh = 0,
- },
- .tx_free_thresh = 32,
- .tx_rs_thresh = 32,
- };
- eth_dev->data->dev_conf.intr_conf.lsc = 1;
-
- eth_dev->data->dev_conf.intr_conf.rxq = 1;
- dev_info->rx_desc_lim.nb_min = BNXT_MIN_RING_DESC;
- dev_info->rx_desc_lim.nb_max = BNXT_MAX_RX_RING_DESC;
- dev_info->tx_desc_lim.nb_min = BNXT_MIN_RING_DESC;
- dev_info->tx_desc_lim.nb_max = BNXT_MAX_TX_RING_DESC;
-
- /* *INDENT-ON* */
-
- /*
- * TODO: default_rxconf, default_txconf, rx_desc_lim, and tx_desc_lim
- * need further investigation.
- */
-
- /* VMDq resources */
- vpool = 64; /* ETH_64_POOLS */
- vrxq = 128; /* ETH_VMDQ_DCB_NUM_QUEUES */
- for (i = 0; i < 4; vpool >>= 1, i++) {
- if (max_vnics > vpool) {
- for (j = 0; j < 5; vrxq >>= 1, j++) {
- if (dev_info->max_rx_queues > vrxq) {
- if (vpool > vrxq)
- vpool = vrxq;
- goto found;
- }
- }
- /* Not enough resources to support VMDq */
- break;
- }
- }
- /* Not enough resources to support VMDq */
- vpool = 0;
- vrxq = 0;
-found:
- dev_info->max_vmdq_pools = vpool;
- dev_info->vmdq_queue_num = vrxq;
-
- dev_info->vmdq_pool_base = 0;
- dev_info->vmdq_queue_base = 0;
-
return 0;
}
return -EINVAL;
}
+ if (!parent_bp->rx_queues) {
+ PMD_DRV_LOG(ERR, "Parent Rx qs not configured yet\n");
+ return -EINVAL;
+ }
+
parent_rxq = parent_bp->rx_queues[queue_idx];
if (!parent_rxq) {
PMD_DRV_LOG(ERR, "Parent RxQ has not been configured yet\n");
return -EINVAL;
}
+ if (!parent_bp->tx_queues) {
+ PMD_DRV_LOG(ERR, "Parent Tx qs not configured yet\n");
+ return -EINVAL;
+ }
+
parent_txq = parent_bp->tx_queues[queue_idx];
if (!parent_txq) {
PMD_DRV_LOG(ERR, "Parent TxQ has not been configured yet\n");