summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorService qcabuildsw <qcabuildsw@localhost>2016-09-20 17:45:10 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2016-09-20 17:45:10 -0700
commit26b45de1b13acef91054746af792cd7b012316e9 (patch)
tree0c9b6a0b593bfe81b539797dd4913aed51a677c4
parentd9be4bba043e4e28cb30d850183443a4939f17b0 (diff)
parente4f18e0c34dfe5d29c53ce856e7979f662564ee8 (diff)
Merge "qcacld-3.0: Add access policy for vendor IE" into wlan-cld3.driver.lnx.1.1-dev
-rw-r--r--core/mac/inc/sir_api.h17
-rw-r--r--core/mac/inc/wni_api.h1
-rw-r--r--core/mac/src/pe/include/lim_api.h16
-rw-r--r--core/mac/src/pe/include/lim_session.h2
-rw-r--r--core/mac/src/pe/lim/lim_process_assoc_req_frame.c16
-rw-r--r--core/mac/src/pe/lim/lim_process_message_queue.c1
-rw-r--r--core/mac/src/pe/lim/lim_process_probe_req_frame.c14
-rw-r--r--core/mac/src/pe/lim/lim_process_sme_req_messages.c55
-rw-r--r--core/mac/src/pe/lim/lim_session.c5
-rw-r--r--core/sme/inc/sme_api.h4
-rw-r--r--core/sme/src/common/sme_api.c45
11 files changed, 175 insertions, 1 deletions
diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h
index b20231a000ea..d19323584549 100644
--- a/core/mac/inc/sir_api.h
+++ b/core/mac/inc/sir_api.h
@@ -6452,4 +6452,21 @@ struct sir_mac_pwr_dbg_cmd {
uint8_t wait_for_ack;
};
+/**
+ * struct sme_update_access_policy_vendor_ie - update vendor ie and access
+ * policy
+ * @msg_type: message id
+ * @msg_len: message length
+ * @sme_session_id: sme session id
+ * @ie: vendor ie
+ * @access_policy: access policy for vendor ie
+ */
+struct sme_update_access_policy_vendor_ie {
+ uint16_t msg_type;
+ uint16_t length;
+ uint32_t sme_session_id;
+ uint8_t ie[SIR_MAC_MAX_IE_LENGTH];
+ uint8_t access_policy;
+};
+
#endif /* __SIR_API_H */
diff --git a/core/mac/inc/wni_api.h b/core/mac/inc/wni_api.h
index 0798123d3607..c46cb56a85f8 100644
--- a/core/mac/inc/wni_api.h
+++ b/core/mac/inc/wni_api.h
@@ -262,6 +262,7 @@ enum eWniMsgTypes {
eWNI_SME_NDP_END_IND,
eWNI_SME_REGISTER_P2P_ACK_CB,
eWNI_SME_SEND_DISASSOC_FRAME,
+ eWNI_SME_UPDATE_ACCESS_POLICY_VENDOR_IE,
eWNI_SME_MSG_TYPES_END
};
diff --git a/core/mac/src/pe/include/lim_api.h b/core/mac/src/pe/include/lim_api.h
index 550babf49c04..6b06b00abd3a 100644
--- a/core/mac/src/pe/include/lim_api.h
+++ b/core/mac/src/pe/include/lim_api.h
@@ -83,6 +83,22 @@
/* LIM exported function templates */
#define LIM_MIN_BCN_PR_LENGTH 12
#define LIM_BCN_PR_CAPABILITY_OFFSET 10
+#define LIM_ASSOC_REQ_IE_OFFSET 4
+
+/**
+ * enum lim_vendor_ie_access_policy - vendor ie access policy
+ * @LIM_ACCESS_POLICY_NONE: access policy not valid
+ * @LIM_ACCESS_POLICY_RESPOND_IF_IE_IS_PRESENT: respond only if vendor ie
+ * is present in probe request and assoc request frames
+ * @LIM_ACCESS_POLICY_DONOT_RESPOND_IF_IE_IS_PRESENT: do not respond if vendor
+ * ie is present in probe request or assoc request frames
+ */
+enum lim_vendor_ie_access_policy {
+ LIM_ACCESS_POLICY_NONE,
+ LIM_ACCESS_POLICY_RESPOND_IF_IE_IS_PRESENT,
+ LIM_ACCESS_POLICY_DONOT_RESPOND_IF_IE_IS_PRESENT,
+};
+
typedef enum eMgmtFrmDropReason {
eMGMT_DROP_NO_DROP,
eMGMT_DROP_NOT_LAST_IBSS_BCN,
diff --git a/core/mac/src/pe/include/lim_session.h b/core/mac/src/pe/include/lim_session.h
index 0837891de417..ea306bf695f8 100644
--- a/core/mac/src/pe/include/lim_session.h
+++ b/core/mac/src/pe/include/lim_session.h
@@ -481,7 +481,7 @@ typedef struct sPESession /* Added to Support BT-AMP */
tDot11fIEHTInfo ht_operation;
tDot11fIEVHTOperation vht_operation;
uint8_t beacon_tx_rate;
- uint8_t *vendor_ie;
+ uint8_t *access_policy_vendor_ie;
uint8_t access_policy;
} tPESession, *tpPESession;
diff --git a/core/mac/src/pe/lim/lim_process_assoc_req_frame.c b/core/mac/src/pe/lim/lim_process_assoc_req_frame.c
index 39a3c4855795..eb660e6bb0d9 100644
--- a/core/mac/src/pe/lim/lim_process_assoc_req_frame.c
+++ b/core/mac/src/pe/lim/lim_process_assoc_req_frame.c
@@ -1818,6 +1818,22 @@ void lim_process_assoc_req_frame(tpAniSirGlobal mac_ctx, uint8_t *rx_pkt_info,
if (false == lim_chk_tkip(mac_ctx, hdr, session, sub_type))
return;
+ /* check for the presence of vendor IE */
+ if ((session->access_policy_vendor_ie) &&
+ (session->access_policy ==
+ LIM_ACCESS_POLICY_RESPOND_IF_IE_IS_PRESENT)) {
+ if (!cfg_get_vendor_ie_ptr_from_oui(mac_ctx,
+ &session->access_policy_vendor_ie[2],
+ 3, frm_body + LIM_ASSOC_REQ_IE_OFFSET, frame_len)) {
+ lim_log(mac_ctx, LOGE,
+ FL("Vendor ie not present and access policy is %x, Rejected association"),
+ session->access_policy);
+ lim_send_assoc_rsp_mgmt_frame(mac_ctx,
+ eSIR_MAC_UNSPEC_FAILURE_STATUS, 1, hdr->sa,
+ sub_type, 0, session);
+ return;
+ }
+ }
/* Allocate memory for the Assoc Request frame */
assoc_req = qdf_mem_malloc(sizeof(*assoc_req));
if (NULL == assoc_req) {
diff --git a/core/mac/src/pe/lim/lim_process_message_queue.c b/core/mac/src/pe/lim/lim_process_message_queue.c
index e7820b1d89d3..2f0c3f443371 100644
--- a/core/mac/src/pe/lim/lim_process_message_queue.c
+++ b/core/mac/src/pe/lim/lim_process_message_queue.c
@@ -1361,6 +1361,7 @@ void lim_process_messages(tpAniSirGlobal mac_ctx, tpSirMsgQ msg)
case eWNI_SME_SET_HW_MODE_REQ:
case eWNI_SME_SET_DUAL_MAC_CFG_REQ:
case eWNI_SME_SET_ANTENNA_MODE_REQ:
+ case eWNI_SME_UPDATE_ACCESS_POLICY_VENDOR_IE:
/* These messages are from HDD. Need to respond to HDD */
lim_process_normal_hdd_msg(mac_ctx, msg, true);
break;
diff --git a/core/mac/src/pe/lim/lim_process_probe_req_frame.c b/core/mac/src/pe/lim/lim_process_probe_req_frame.c
index 37460e4f086d..e83ffd2f7e20 100644
--- a/core/mac/src/pe/lim/lim_process_probe_req_frame.c
+++ b/core/mac/src/pe/lim/lim_process_probe_req_frame.c
@@ -384,6 +384,20 @@ lim_process_probe_req_frame(tpAniSirGlobal mac_ctx, uint8_t *rx_pkt_info,
/* Get pointer to Probe Request frame body */
body_ptr = WMA_GET_RX_MPDU_DATA(rx_pkt_info);
+ /* check for vendor IE presence */
+ if ((session->access_policy_vendor_ie) &&
+ (session->access_policy ==
+ LIM_ACCESS_POLICY_RESPOND_IF_IE_IS_PRESENT)) {
+ if (!cfg_get_vendor_ie_ptr_from_oui(mac_ctx,
+ &session->access_policy_vendor_ie[2],
+ 3, body_ptr, frame_len)) {
+ lim_log(mac_ctx, LOG1, FL(
+ "Vendor IE is not present and access policy is %x, dropping probe request"),
+ session->access_policy);
+ return;
+ }
+ }
+
/* Parse Probe Request frame */
if (sir_convert_probe_req_frame2_struct(mac_ctx, body_ptr,
frame_len, &probe_req) == eSIR_FAILURE) {
diff --git a/core/mac/src/pe/lim/lim_process_sme_req_messages.c b/core/mac/src/pe/lim/lim_process_sme_req_messages.c
index cc4e317fa802..b976f0ab24aa 100644
--- a/core/mac/src/pe/lim/lim_process_sme_req_messages.c
+++ b/core/mac/src/pe/lim/lim_process_sme_req_messages.c
@@ -5014,6 +5014,58 @@ static void lim_process_set_pdev_IEs(tpAniSirGlobal mac_ctx, uint32_t *msg_buf)
}
/**
+ * lim_process_sme_update_access_policy_vendor_ie: function updates vendor IE
+ *
+ * access policy
+ * @mac_ctx: pointer to mac context
+ * @msg: message buffer
+ *
+ * function processes vendor IE and access policy from SME and updates PE
+ *
+ * session entry
+ *
+ * return: none
+*/
+static void lim_process_sme_update_access_policy_vendor_ie(
+ tpAniSirGlobal mac_ctx,
+ uint32_t *msg)
+{
+ struct sme_update_access_policy_vendor_ie *update_vendor_ie;
+ struct sPESession *pe_session_entry;
+ uint8_t num_bytes;
+
+ if (!msg) {
+ lim_log(mac_ctx, LOGE, FL("Buffer is Pointing to NULL"));
+ return;
+ }
+ update_vendor_ie = (struct sme_update_access_policy_vendor_ie *) msg;
+ pe_session_entry = pe_find_session_by_sme_session_id(mac_ctx,
+ update_vendor_ie->sme_session_id);
+
+ if (!pe_session_entry) {
+ lim_log(mac_ctx, LOGE,
+ FL("Session does not exist for given sme session id(%hu)"),
+ update_vendor_ie->sme_session_id);
+ return;
+ }
+ if (pe_session_entry->access_policy_vendor_ie)
+ qdf_mem_free(pe_session_entry->access_policy_vendor_ie);
+
+ num_bytes = update_vendor_ie->ie[1] + 2;
+ pe_session_entry->access_policy_vendor_ie = qdf_mem_malloc(num_bytes);
+
+ if (!pe_session_entry->access_policy_vendor_ie) {
+ lim_log(mac_ctx, LOGE,
+ FL("Failed to allocate memory for vendor ie"));
+ return;
+ }
+ qdf_mem_copy(pe_session_entry->access_policy_vendor_ie,
+ &update_vendor_ie->ie[0], num_bytes);
+
+ pe_session_entry->access_policy = update_vendor_ie->access_policy;
+}
+
+/**
* lim_process_sme_req_messages()
*
***FUNCTION:
@@ -5263,6 +5315,9 @@ bool lim_process_sme_req_messages(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
case eWNI_SME_REGISTER_P2P_ACK_CB:
lim_register_p2p_ack_ind_cb(pMac, pMsgBuf);
break;
+ case eWNI_SME_UPDATE_ACCESS_POLICY_VENDOR_IE:
+ lim_process_sme_update_access_policy_vendor_ie(pMac, pMsgBuf);
+ break;
default:
qdf_mem_free((void *)pMsg->bodyptr);
pMsg->bodyptr = NULL;
diff --git a/core/mac/src/pe/lim/lim_session.c b/core/mac/src/pe/lim/lim_session.c
index 49ee9e42b627..469f3ca3b4a1 100644
--- a/core/mac/src/pe/lim/lim_session.c
+++ b/core/mac/src/pe/lim/lim_session.c
@@ -704,6 +704,11 @@ void pe_delete_session(tpAniSirGlobal mac_ctx, tpPESession session)
#endif
session->valid = false;
+ if (session->access_policy_vendor_ie)
+ qdf_mem_free(session->access_policy_vendor_ie);
+
+ session->access_policy_vendor_ie = NULL;
+
if (LIM_IS_AP_ROLE(session))
lim_check_and_reset_protection_params(mac_ctx);
diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h
index b3539fa98e89..a07356174a9a 100644
--- a/core/sme/inc/sme_api.h
+++ b/core/sme/inc/sme_api.h
@@ -1164,4 +1164,8 @@ QDF_STATUS sme_register_p2p_ack_ind_callback(tHalHandle hal,
void sme_send_disassoc_req_frame(tHalHandle hal, uint8_t session_id, uint8_t
*peer_mac, uint16_t reason, uint8_t
wait_for_ack);
+QDF_STATUS sme_update_access_policy_vendor_ie(tHalHandle hal,
+ uint8_t session_id, uint8_t *vendor_ie,
+ int access_policy);
+
#endif /* #if !defined( __SME_API_H ) */
diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c
index 5175ad1e333b..fa40dd58406f 100644
--- a/core/sme/src/common/sme_api.c
+++ b/core/sme/src/common/sme_api.c
@@ -12057,6 +12057,51 @@ QDF_STATUS sme_send_rate_update_ind(tHalHandle hHal,
}
/**
+ * sme_update_access_policy_vendor_ie() - update vendor ie and access policy.
+ * @hal: Pointer to the mac context
+ * @session_id: sme session id
+ * @vendor_ie: vendor ie
+ * @access_policy: vendor ie access policy
+ *
+ * This function updates the vendor ie and access policy to lim.
+ *
+ * Return: success or failure.
+ */
+QDF_STATUS sme_update_access_policy_vendor_ie(tHalHandle hal,
+ uint8_t session_id, uint8_t *vendor_ie, int access_policy)
+{
+ struct sme_update_access_policy_vendor_ie *msg;
+ uint16_t msg_len;
+ QDF_STATUS status = QDF_STATUS_E_FAILURE;
+ tpAniSirGlobal mac = PMAC_STRUCT(hal);
+
+ msg_len = sizeof(*msg);
+
+ msg = qdf_mem_malloc(msg_len);
+ if (!msg) {
+ sms_log(mac, LOGE,
+ "failed to allocate memory for sme_update_access_policy_vendor_ie");
+ return QDF_STATUS_E_FAILURE;
+ }
+
+ qdf_mem_set(msg, msg_len, 0);
+ msg->msg_type = (uint16_t)eWNI_SME_UPDATE_ACCESS_POLICY_VENDOR_IE;
+ msg->length = (uint16_t)msg_len;
+
+ qdf_mem_copy(&msg->ie[0], vendor_ie, sizeof(msg->ie));
+
+ msg->sme_session_id = session_id;
+ msg->access_policy = access_policy;
+
+ sms_log(mac, LOG1, "sme_session_id %hu, access_policy %d", session_id,
+ access_policy);
+
+ status = cds_send_mb_message_to_mac(msg);
+
+ return status;
+}
+
+/**
* sme_get_reg_info() - To get registration info
* @hHal: HAL context
* @chanId: channel id