return l2_filter;
}
-static int bnxt_vnic_prep(struct bnxt *bp, struct bnxt_vnic_info *vnic)
+static int bnxt_vnic_prep(struct bnxt *bp, struct bnxt_vnic_info *vnic,
+ const struct rte_flow_action *act,
+ struct rte_flow_error *error)
{
struct rte_eth_conf *dev_conf = &bp->eth_dev->data->dev_conf;
uint64_t rx_offloads = dev_conf->rxmode.offloads;
int rc;
if (bp->nr_vnics > bp->max_vnics - 1)
- return -ENOMEM;
+ return rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ATTR_GROUP,
+ NULL,
+ "Group id is invalid");
rc = bnxt_vnic_grp_alloc(bp, vnic);
if (rc)
- goto ret;
+ return rte_flow_error_set(error, -rc,
+ RTE_FLOW_ERROR_TYPE_ACTION,
+ act,
+ "Failed to alloc VNIC group");
rc = bnxt_hwrm_vnic_alloc(bp, vnic);
if (rc) {
- PMD_DRV_LOG(ERR, "HWRM vnic alloc failure rc: %x\n", rc);
+ rte_flow_error_set(error, -rc,
+ RTE_FLOW_ERROR_TYPE_ACTION,
+ act,
+ "Failed to alloc VNIC");
goto ret;
}
+
bp->nr_vnics++;
/* RSS context is required only when there is more than one RSS ring */
if (vnic->rx_queue_cnt > 1) {
rc = bnxt_hwrm_vnic_ctx_alloc(bp, vnic, 0 /* ctx_idx 0 */);
if (rc) {
- PMD_DRV_LOG(ERR,
- "HWRM vnic ctx alloc failure: %x\n", rc);
+ rte_flow_error_set(error, -rc,
+ RTE_FLOW_ERROR_TYPE_ACTION,
+ act,
+ "Failed to alloc VNIC context");
goto ret;
}
} else {
vnic->vlan_strip = false;
rc = bnxt_hwrm_vnic_cfg(bp, vnic);
- if (rc)
+ if (rc) {
+ rte_flow_error_set(error, -rc,
+ RTE_FLOW_ERROR_TYPE_ACTION,
+ act,
+ "Failed to configure VNIC");
goto ret;
+ }
- bnxt_hwrm_vnic_plcmode_cfg(bp, vnic);
+ rc = bnxt_hwrm_vnic_plcmode_cfg(bp, vnic);
+ if (rc) {
+ rte_flow_error_set(error, -rc,
+ RTE_FLOW_ERROR_TYPE_ACTION,
+ act,
+ "Failed to configure VNIC plcmode");
+ goto ret;
+ }
+
+ return 0;
ret:
return rc;
PMD_DRV_LOG(DEBUG, "VNIC found\n");
- rc = bnxt_vnic_prep(bp, vnic);
- if (rc) {
- rte_flow_error_set(error,
- EINVAL,
- RTE_FLOW_ERROR_TYPE_ACTION,
- act,
- "VNIC prep fail");
- rc = -rte_errno;
+ rc = bnxt_vnic_prep(bp, vnic, act, error);
+ if (rc)
goto ret;
- }
PMD_DRV_LOG(DEBUG,
"vnic[%d] = %p vnic->fw_grp_ids = %p\n",
vnic->end_grp_id = rss->queue[rss->queue_num - 1];
vnic->func_default = 0; //This is not a default VNIC.
- rc = bnxt_vnic_prep(bp, vnic);
- if (rc) {
- rte_flow_error_set(error,
- EINVAL,
- RTE_FLOW_ERROR_TYPE_ACTION,
- act,
- "VNIC prep fail");
- rc = -rte_errno;
+ rc = bnxt_vnic_prep(bp, vnic, act, error);
+ if (rc)
goto ret;
- }
PMD_DRV_LOG(DEBUG,
"vnic[%d] = %p vnic->fw_grp_ids = %p\n",