summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnkita Bajaj <bankita@codeaurora.org>2019-05-02 19:29:09 +0530
committernshrivas <nshrivas@codeaurora.org>2019-05-23 20:12:10 -0700
commit20e6a7e94e9e13dac01a55bb12d03ce2e993fa7e (patch)
treeb5f6f097b0e79908bb2506816fc3dafa5a7d8577
parentd44be92c596babfdabd5a853ca64079adf9b19b6 (diff)
qcacld-3.0: Return proper error on request id mapping failure
When sending keepalive packets if there is failure in mapping request id to pattern id in function - hdd_map_req_id_to_pattern_id(), error code EINVAL is returned. This error code is misleading and not sufficient to inform the userspace that all available buffers are utilized and it should stop sending keepalive packets. Return proper error code if all available buffers are utilized and no buffers are available to address any new request to send keepalive packets. Change-Id: Ie54299a0a7ff43a7044316d641d19ce12ac047c8 CRs-Fixed: 2445981
-rw-r--r--core/hdd/src/wlan_hdd_cfg80211.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c
index 712f84ba8076..44e6d3f24c1b 100644
--- a/core/hdd/src/wlan_hdd_cfg80211.c
+++ b/core/hdd/src/wlan_hdd_cfg80211.c
@@ -6761,7 +6761,7 @@ static int hdd_map_req_id_to_pattern_id(hdd_context_t *hdd_ctx,
}
}
mutex_unlock(&hdd_ctx->op_ctx.op_lock);
- return -EINVAL;
+ return -ENOBUFS;
}
/**
@@ -6829,7 +6829,8 @@ wlan_hdd_add_tx_ptrn(hdd_adapter_t *adapter, hdd_context_t *hdd_ctx,
{
struct sSirAddPeriodicTxPtrn *add_req;
QDF_STATUS status;
- uint32_t request_id, ret, len;
+ uint32_t request_id, len;
+ int32_t ret;
uint8_t pattern_id = 0;
struct qdf_mac_addr dst_addr;
uint16_t eth_type = htons(ETH_P_IP);
@@ -6848,29 +6849,34 @@ wlan_hdd_add_tx_ptrn(hdd_adapter_t *adapter, hdd_context_t *hdd_ctx,
/* Parse and fetch request Id */
if (!tb[PARAM_REQUEST_ID]) {
hdd_err("attr request id failed");
+ ret = -EINVAL;
goto fail;
}
request_id = nla_get_u32(tb[PARAM_REQUEST_ID]);
if (request_id == MAX_REQUEST_ID) {
hdd_err("request_id cannot be MAX");
+ ret = -EINVAL;
goto fail;
}
hdd_debug("Request Id: %u", request_id);
if (!tb[PARAM_PERIOD]) {
hdd_err("attr period failed");
+ ret = -EINVAL;
goto fail;
}
add_req->usPtrnIntervalMs = nla_get_u32(tb[PARAM_PERIOD]);
hdd_debug("Period: %u ms", add_req->usPtrnIntervalMs);
if (add_req->usPtrnIntervalMs == 0) {
hdd_err("Invalid interval zero, return failure");
+ ret = -EINVAL;
goto fail;
}
if (!tb[PARAM_SRC_MAC_ADDR]) {
hdd_err("attr source mac address failed");
+ ret = -EINVAL;
goto fail;
}
nla_memcpy(add_req->mac_address.bytes, tb[PARAM_SRC_MAC_ADDR],
@@ -6881,11 +6887,13 @@ wlan_hdd_add_tx_ptrn(hdd_adapter_t *adapter, hdd_context_t *hdd_ctx,
if (!qdf_is_macaddr_equal(&add_req->mac_address,
&adapter->macAddressCurrent)) {
hdd_err("input src mac address and connected ap bssid are different");
+ ret = -EINVAL;
goto fail;
}
if (!tb[PARAM_DST_MAC_ADDR]) {
hdd_err("attr dst mac address failed");
+ ret = -EINVAL;
goto fail;
}
nla_memcpy(dst_addr.bytes, tb[PARAM_DST_MAC_ADDR], QDF_MAC_ADDR_SIZE);
@@ -6894,6 +6902,7 @@ wlan_hdd_add_tx_ptrn(hdd_adapter_t *adapter, hdd_context_t *hdd_ctx,
if (!tb[PARAM_IP_PACKET]) {
hdd_err("attr ip packet failed");
+ ret = -EINVAL;
goto fail;
}
add_req->ucPtrnSize = nla_len(tb[PARAM_IP_PACKET]);
@@ -6904,6 +6913,7 @@ wlan_hdd_add_tx_ptrn(hdd_adapter_t *adapter, hdd_context_t *hdd_ctx,
ETH_HLEN)) {
hdd_err("Invalid IP packet len: %d",
add_req->ucPtrnSize);
+ ret = -EINVAL;
goto fail;
}
@@ -6938,16 +6948,15 @@ wlan_hdd_add_tx_ptrn(hdd_adapter_t *adapter, hdd_context_t *hdd_ctx,
status = sme_add_periodic_tx_ptrn(hdd_ctx->hHal, add_req);
if (!QDF_IS_STATUS_SUCCESS(status)) {
hdd_err("sme_add_periodic_tx_ptrn failed (err=%d)", status);
+ ret = qdf_status_to_os_return(status);
goto fail;
}
EXIT();
- qdf_mem_free(add_req);
- return 0;
fail:
qdf_mem_free(add_req);
- return -EINVAL;
+ return ret;
}
/**