@@ -55,6 +55,28 @@ static int qtnf_cmd_check_reply_header(const struct qlink_resp *resp,
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,
struct sk_buff *cmd_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))
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,
vif->vifid, cmd_type, res_code);
- ret = -EFAULT;
goto out;
}
@@ -674,6 +674,8 @@ enum qlink_cmd_result {
QLINK_CMD_RESULT_ENOTSUPP,
QLINK_CMD_RESULT_ENOTFOUND,
QLINK_CMD_RESULT_EALREADY,
+ QLINK_CMD_RESULT_EADDRINUSE,
+ QLINK_CMD_RESULT_EADDRNOTAVAIL,
};
/**