diff --git a/dp/inc/cdp_txrx_cmn_struct.h b/dp/inc/cdp_txrx_cmn_struct.h index 2453d823ad..1f3ebaa3d0 100644 --- a/dp/inc/cdp_txrx_cmn_struct.h +++ b/dp/inc/cdp_txrx_cmn_struct.h @@ -484,6 +484,21 @@ struct cdp_rx_mic_err_info { uint16_t vdev_id; }; +/** + * struct cdp_mscs_params - MSCS parameters obtained + * from handshake + * @user_pri_bitmap - User priority bitmap + * @user_pri_limit - User priority limit + * @classifier_type - TCLAS Classifier type + * @classifier_mask - TCLAS Classifier mask + */ +struct cdp_mscs_params { + uint8_t user_pri_bitmap; + uint8_t user_pri_limit; + uint8_t classifier_type; + uint8_t classifier_mask; +}; + /** * struct cdp_sec_type - security type information */ diff --git a/dp/inc/cdp_txrx_ctrl.h b/dp/inc/cdp_txrx_ctrl.h index 2316e54e12..46f4ccc9cf 100644 --- a/dp/inc/cdp_txrx_ctrl.h +++ b/dp/inc/cdp_txrx_ctrl.h @@ -99,6 +99,39 @@ cdp_update_filter_neighbour_peers(ol_txrx_soc_handle soc, } #endif /* ATH_SUPPORT_NAC || ATH_SUPPORT_NAC_RSSI*/ +/** + * @brief record the MSCS data and send it to the Data path + * @details + * This defines interface function to record the MSCS procedure + * based data parameters so that the data path layer can access it + * + * @param soc - the pointer to soc object + * @param vdev_id - id of the pointer to vdev + * @param macaddr - the address of neighbour peer + * @param mscs_params - Structure having MSCS params + * obtained from handshake + * @return - QDF_STATUS + */ +static inline QDF_STATUS +cdp_record_vdev_mscs_params(ol_txrx_soc_handle soc, uint8_t + *macaddr, uint8_t vdev_id, struct cdp_mscs_params *mscs_params, + bool active) +{ + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance:", + __func__); + QDF_BUG(0); + return QDF_STATUS_E_FAILURE; + } + + if (!soc->ops->ctrl_ops || + !soc->ops->ctrl_ops->txrx_record_mscs_params) + return QDF_STATUS_E_FAILURE; + return soc->ops->ctrl_ops->txrx_record_mscs_params + (soc, macaddr, vdev_id, mscs_params, active); +} + /** * @brief set the Reo Destination ring for the pdev * @details diff --git a/dp/inc/cdp_txrx_ops.h b/dp/inc/cdp_txrx_ops.h index 2c661db61a..f3a57944f3 100644 --- a/dp/inc/cdp_txrx_ops.h +++ b/dp/inc/cdp_txrx_ops.h @@ -680,6 +680,14 @@ struct cdp_ctrl_ops { char *macaddr, uint8_t *rssi); #endif + + QDF_STATUS + (*txrx_record_mscs_params) ( + struct cdp_soc_t *soc, uint8_t *macaddr, + uint8_t vdev_id, + struct cdp_mscs_params *mscs_params, + bool active); + QDF_STATUS (*set_key)(struct cdp_soc_t *soc, uint8_t vdev_id, uint8_t *mac, bool is_unicast, uint32_t *key); diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index aab5b027fb..39c077fdf7 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -6044,6 +6044,75 @@ fail0: } #endif /* ATH_SUPPORT_NAC_RSSI || ATH_SUPPORT_NAC */ +/* + * dp_record_mscs_params - MSCS parameters sent by the STA in + * the MSCS Request to the AP. The AP makes a note of these + * parameters while comparing the MSDUs sent by the STA, to + * send the downlink traffic with correct User priority. + * @soc - Datapath soc handle + * @peer_mac - STA Mac address + * @vdev_id - ID of the vdev handle + * @mscs_params - Structure having MSCS parameters obtained + * from handshake + * @active - Flag to set MSCS active/inactive + * return type - QDF_STATUS - Success/Invalid + */ +static QDF_STATUS +dp_record_mscs_params(struct cdp_soc_t *soc_hdl, uint8_t *peer_mac, + uint8_t vdev_id, struct cdp_mscs_params *mscs_params, + bool active) +{ + struct dp_peer *peer; + QDF_STATUS status = QDF_STATUS_E_INVAL; + struct dp_soc *soc = (struct dp_soc *)soc_hdl; + + peer = dp_peer_find_hash_find(soc, peer_mac, 0, vdev_id, + DP_MOD_ID_CDP); + + if (!peer) { + dp_err("%s: Peer is NULL!\n", __func__); + goto fail; + } + if (!active) { + dp_info("MSCS Procedure is terminated"); + peer->mscs_active = active; + goto fail; + } + + if (mscs_params->classifier_type == IEEE80211_TCLAS_MASK_CLA_TYPE_4) { + /* Populate entries inside IPV4 database first */ + peer->mscs_ipv4_parameter.user_priority_bitmap = + mscs_params->user_pri_bitmap; + peer->mscs_ipv4_parameter.user_priority_limit = + mscs_params->user_pri_limit; + peer->mscs_ipv4_parameter.classifier_mask = + mscs_params->classifier_mask; + + /* Populate entries inside IPV6 database */ + peer->mscs_ipv6_parameter.user_priority_bitmap = + mscs_params->user_pri_bitmap; + peer->mscs_ipv6_parameter.user_priority_limit = + mscs_params->user_pri_limit; + peer->mscs_ipv6_parameter.classifier_mask = + mscs_params->classifier_mask; + peer->mscs_active = 1; + dp_info("\n\tMSCS Procedure request based parameters for %pM\n" + "\tClassifier_type = %d\tUser priority bitmap = %x\n" + "\tUser priority limit = %x\tClassifier mask = %x", + peer_mac, + mscs_params->classifier_type, + peer->mscs_ipv4_parameter.user_priority_bitmap, + peer->mscs_ipv4_parameter.user_priority_limit, + peer->mscs_ipv4_parameter.classifier_mask); + } + + status = QDF_STATUS_SUCCESS; +fail: + if (peer) + dp_peer_unref_delete(peer, DP_MOD_ID_CDP); + return status; +} + /* * dp_get_sec_type() - Get the security type * @soc: soc handle @@ -10106,6 +10175,7 @@ static struct cdp_ctrl_ops dp_ops_ctrl = { .txrx_vdev_config_for_nac_rssi = dp_config_for_nac_rssi, .txrx_vdev_get_neighbour_rssi = dp_vdev_get_neighbour_rssi, #endif + .txrx_record_mscs_params = dp_record_mscs_params, .set_key = dp_set_michael_key, .txrx_get_vdev_param = dp_get_vdev_param, .enable_peer_based_pktlog = dp_enable_peer_based_pktlog, diff --git a/dp/wifi3.0/dp_types.h b/dp/wifi3.0/dp_types.h index fdcb0e56e9..e50db67c63 100644 --- a/dp/wifi3.0/dp_types.h +++ b/dp/wifi3.0/dp_types.h @@ -2393,6 +2393,25 @@ struct dp_peer_ast_params { uint8_t flowQ; }; +#define IEEE80211_MSCS_MAX_ELEM_SIZE 5 +#define IEEE80211_TCLAS_MASK_CLA_TYPE_4 4 +/* + * struct dp_peer_mscs_node_stats - MSCS database obtained from + * MSCS Request and Response in the control path. This data is used + * by the AP to find out what priority to set based on the tuple + * classification during packet processing. + * @user_priority_bitmap - User priority bitmap obtained during + * handshake + * @user_priority_limit - User priority limit obtained during + * handshake + * @classifier_mask - params to be compared during processing + */ +struct dp_peer_mscs_parameter { + uint8_t user_priority_bitmap; + uint8_t user_priority_limit; + uint8_t classifier_mask; +}; + /* Peer structure for data path state */ struct dp_peer { /* VDEV to which this peer is associated */ @@ -2509,6 +2528,8 @@ struct dp_peer { qdf_atomic_t mod_refs[DP_MOD_ID_MAX]; uint8_t peer_state; + struct dp_peer_mscs_parameter mscs_ipv4_parameter, mscs_ipv6_parameter; + bool mscs_active; }; /*