summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRajeev Kumar <quic_rajekuma@quicinc.com>2019-05-02 19:29:09 +0530
committerRajeev Kumar <quic_rajekuma@quicinc.com>2019-05-21 10:16:11 -0700
commit4a5f8beeef9c560845453f1d05d9be2508edc641 (patch)
tree096c2ad5dacf59c0be19d39b2f3cbbdd8198a9ad
parent69b09e156829df032f63bd12136ac702f4463535 (diff)
downloadqcacld-4a5f8beeef9c560845453f1d05d9be2508edc641.tar.gz
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 Bug: 130214647 Signed-off-by: Rajeev Kumar <quic_rajekuma@quicinc.com>
-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 5d5bd94aac..d8efa865cc 100644
--- a/core/hdd/src/wlan_hdd_cfg80211.c
+++ b/core/hdd/src/wlan_hdd_cfg80211.c
@@ -6647,7 +6647,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;
}
/**
@@ -6715,7 +6715,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);
@@ -6734,29 +6735,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],
@@ -6767,11 +6773,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);
@@ -6780,6 +6788,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]);
@@ -6790,6 +6799,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;
}
@@ -6824,16 +6834,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;
}
/**