qtnfmac: decode error codes from firmware replies
Introduce a function that will map an error code reported in reply to a firmware command, into one of standard errno codes. Use additional error codes to improve error reporting for MAC address changes. Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
parent
d62b622ca4
commit
36e8c538b3
@ -55,6 +55,28 @@ static int qtnf_cmd_check_reply_header(const struct qlink_resp *resp,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int qtnf_cmd_resp_result_decode(enum qlink_cmd_result qcode)
|
||||||
|
{
|
||||||
|
switch (qcode) {
|
||||||
|
case QLINK_CMD_RESULT_OK:
|
||||||
|
return 0;
|
||||||
|
case QLINK_CMD_RESULT_INVALID:
|
||||||
|
return -EINVAL;
|
||||||
|
case QLINK_CMD_RESULT_ENOTSUPP:
|
||||||
|
return -ENOTSUPP;
|
||||||
|
case QLINK_CMD_RESULT_ENOTFOUND:
|
||||||
|
return -ENOENT;
|
||||||
|
case QLINK_CMD_RESULT_EALREADY:
|
||||||
|
return -EALREADY;
|
||||||
|
case QLINK_CMD_RESULT_EADDRINUSE:
|
||||||
|
return -EADDRINUSE;
|
||||||
|
case QLINK_CMD_RESULT_EADDRNOTAVAIL:
|
||||||
|
return -EADDRNOTAVAIL;
|
||||||
|
default:
|
||||||
|
return -EFAULT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int qtnf_cmd_send_with_reply(struct qtnf_bus *bus,
|
static int qtnf_cmd_send_with_reply(struct qtnf_bus *bus,
|
||||||
struct sk_buff *cmd_skb,
|
struct sk_buff *cmd_skb,
|
||||||
struct sk_buff **response_skb,
|
struct sk_buff **response_skb,
|
||||||
@ -810,10 +832,10 @@ static int qtnf_cmd_send_add_change_intf(struct qtnf_vif *vif,
|
|||||||
if (unlikely(ret))
|
if (unlikely(ret))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (unlikely(res_code != QLINK_CMD_RESULT_OK)) {
|
ret = qtnf_cmd_resp_result_decode(res_code);
|
||||||
|
if (ret) {
|
||||||
pr_err("VIF%u.%u: CMD %d failed: %u\n", vif->mac->macid,
|
pr_err("VIF%u.%u: CMD %d failed: %u\n", vif->mac->macid,
|
||||||
vif->vifid, cmd_type, res_code);
|
vif->vifid, cmd_type, res_code);
|
||||||
ret = -EFAULT;
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -674,6 +674,8 @@ enum qlink_cmd_result {
|
|||||||
QLINK_CMD_RESULT_ENOTSUPP,
|
QLINK_CMD_RESULT_ENOTSUPP,
|
||||||
QLINK_CMD_RESULT_ENOTFOUND,
|
QLINK_CMD_RESULT_ENOTFOUND,
|
||||||
QLINK_CMD_RESULT_EALREADY,
|
QLINK_CMD_RESULT_EALREADY,
|
||||||
|
QLINK_CMD_RESULT_EADDRINUSE,
|
||||||
|
QLINK_CMD_RESULT_EADDRNOTAVAIL,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user