Skip to content

Commit

Permalink
bnxt_en: Return standard Linux error codes for hwrm flow cmds.
Browse files Browse the repository at this point in the history
Currently, internal error value is returned by the driver, when
hwrm_cfa_flow_alloc() fails due lack of resources.  We should be returning
Linux errno value -ENOSPC instead.

This patch also converts other similar command errors to standard Linux errno
code (-EIO) in bnxt_tc.c

Fixes: db1d36a ("bnxt_en: add TC flower offload flow_alloc/free FW cmds")
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Venkat Duvvuru authored and David S. Miller committed Mar 12, 2018
1 parent 832aed1 commit 6ae777e
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,9 @@ static int bnxt_hwrm_cfa_flow_free(struct bnxt *bp, __le16 flow_handle)
if (rc)
netdev_info(bp->dev, "Error: %s: flow_handle=0x%x rc=%d",
__func__, flow_handle, rc);

if (rc)
rc = -EIO;
return rc;
}

Expand Down Expand Up @@ -484,13 +487,15 @@ static int bnxt_hwrm_cfa_flow_alloc(struct bnxt *bp, struct bnxt_tc_flow *flow,
req.action_flags = cpu_to_le16(action_flags);

mutex_lock(&bp->hwrm_cmd_lock);

rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
if (!rc)
*flow_handle = resp->flow_handle;

mutex_unlock(&bp->hwrm_cmd_lock);

if (rc == HWRM_ERR_CODE_RESOURCE_ALLOC_ERROR)
rc = -ENOSPC;
else if (rc)
rc = -EIO;
return rc;
}

Expand Down Expand Up @@ -561,6 +566,8 @@ static int hwrm_cfa_decap_filter_alloc(struct bnxt *bp,
netdev_info(bp->dev, "%s: Error rc=%d", __func__, rc);
mutex_unlock(&bp->hwrm_cmd_lock);

if (rc)
rc = -EIO;
return rc;
}

Expand All @@ -576,6 +583,9 @@ static int hwrm_cfa_decap_filter_free(struct bnxt *bp,
rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
if (rc)
netdev_info(bp->dev, "%s: Error rc=%d", __func__, rc);

if (rc)
rc = -EIO;
return rc;
}

Expand Down Expand Up @@ -624,6 +634,8 @@ static int hwrm_cfa_encap_record_alloc(struct bnxt *bp,
netdev_info(bp->dev, "%s: Error rc=%d", __func__, rc);
mutex_unlock(&bp->hwrm_cmd_lock);

if (rc)
rc = -EIO;
return rc;
}

Expand All @@ -639,6 +651,9 @@ static int hwrm_cfa_encap_record_free(struct bnxt *bp,
rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
if (rc)
netdev_info(bp->dev, "%s: Error rc=%d", __func__, rc);

if (rc)
rc = -EIO;
return rc;
}

Expand Down Expand Up @@ -1338,8 +1353,10 @@ bnxt_hwrm_cfa_flow_stats_get(struct bnxt *bp, int num_flows,
} else {
netdev_info(bp->dev, "error rc=%d", rc);
}

mutex_unlock(&bp->hwrm_cmd_lock);

if (rc)
rc = -EIO;
return rc;
}

Expand Down

0 comments on commit 6ae777e

Please sign in to comment.