Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6ae777ea authored by Venkat Duvvuru's avatar Venkat Duvvuru Committed by David S. Miller
Browse files

bnxt_en: Return standard Linux error codes for hwrm flow cmds.



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: db1d36a2 ("bnxt_en: add TC flower offload flow_alloc/free FW cmds")
Signed-off-by: default avatarVenkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 832aed16
Loading
Loading
Loading
Loading
+20 −3
Original line number Diff line number Diff line
@@ -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;
}

@@ -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;
}

@@ -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;
}

@@ -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;
}

@@ -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;
}

@@ -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;
}

@@ -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;
}