From e56aa7b89aa68f24487a04e462117cf3d6585597 Mon Sep 17 00:00:00 2001 From: Yun Park Date: Wed, 16 Aug 2017 11:45:56 -0700 Subject: [PATCH 1/2] qcacmn: Markings updated Markings updated Change-Id: I8f031513a2adf5005be26965f73d2e9e1f52a15f CRs-Fixed: 2093948 --- dp/wifi3.0/dp_ipa.c | 19 +++++++++++-------- dp/wifi3.0/dp_ipa.h | 21 ++++++++++++--------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/dp/wifi3.0/dp_ipa.c b/dp/wifi3.0/dp_ipa.c index b8ff525c5037..bb6374d1f59d 100644 --- a/dp/wifi3.0/dp_ipa.c +++ b/dp/wifi3.0/dp_ipa.c @@ -1,15 +1,18 @@ /* * Copyright (c) 2017, The Linux Foundation. All rights reserved. * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 and - * only version 2 as published by the Free Software Foundation. + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. -*/ + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ #ifdef IPA_OFFLOAD diff --git a/dp/wifi3.0/dp_ipa.h b/dp/wifi3.0/dp_ipa.h index 82de687da0f6..b0b606e933f4 100644 --- a/dp/wifi3.0/dp_ipa.h +++ b/dp/wifi3.0/dp_ipa.h @@ -1,14 +1,17 @@ /* * Copyright (c) 2017, The Linux Foundation. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 and - * only version 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef _DP_IPA_H_ From 3f4e1c48cc6f4f178574368a38f80ec6ed33ff43 Mon Sep 17 00:00:00 2001 From: Venkateswara Swamy Bandaru Date: Mon, 10 Jul 2017 19:47:09 +0530 Subject: [PATCH 2/2] qcacmn: Fix Key derivation for mesh rx stats Fixed key derivation for mesh rx stats for received packet. Added cdp api to get the key by passing key index and peer mac address. Change-Id: I6a4c342b614ae85a5ad2fb047f2d8686aa068196 CRs-fixed: 2094335 --- dp/inc/cdp_txrx_cmn_struct.h | 14 ++++++++++++++ dp/wifi3.0/dp_main.c | 2 ++ dp/wifi3.0/dp_rx.c | 15 +++++++++++---- dp/wifi3.0/dp_types.h | 1 + 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/dp/inc/cdp_txrx_cmn_struct.h b/dp/inc/cdp_txrx_cmn_struct.h index 19843eab1662..dd399c65b73b 100644 --- a/dp/inc/cdp_txrx_cmn_struct.h +++ b/dp/inc/cdp_txrx_cmn_struct.h @@ -319,6 +319,16 @@ typedef void (*ol_txrx_tx_flow_control_fp)(void *osif_dev, */ typedef QDF_STATUS(*ol_txrx_rx_fp)(void *osif_dev, qdf_nbuf_t msdu_list); +/** + * ol_txrx_get_key_fp - function to gey key based on keyix and peer + * mac address + * @osif_dev - the virtual device's OS shim object + * @key_buf - pointer to store key + * @mac_addr - pointer to mac address + * @keyix - key id + */ +typedef QDF_STATUS(*ol_txrx_get_key_fp)(void *osif_dev, uint8_t *key_buf, uint8_t *mac_addr, uint8_t keyix); + /** * ol_txrx_rsim_rx_decap_fp - raw mode simulation function to decap the * packets in receive path. @@ -418,6 +428,8 @@ typedef void (*ol_txrx_stats_callback)(void *ctxt, * header added before the MPDU contents. * @proxy_arp - proxy arp function pointer - specified by * OS shim, stored by txrx + * @get_key - function pointer to get key of the peer with + * specific key index */ struct ol_txrx_ops { /* tx function pointers - specified by txrx, stored by OS shim */ @@ -437,6 +449,8 @@ struct ol_txrx_ops { /* proxy arp function pointer - specified by OS shim, stored by txrx */ ol_txrx_proxy_arp_fp proxy_arp; ol_txrx_mcast_me_fp me_convert; + + ol_txrx_get_key_fp get_key; }; /** diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index 8d2350f8e255..2395a56044ca 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -2649,6 +2649,7 @@ static struct cdp_vdev *dp_vdev_attach_wifi3(struct cdp_pdev *txrx_pdev, vdev->osif_rx = NULL; vdev->osif_rsim_rx_decap = NULL; + vdev->osif_get_key = NULL; vdev->osif_rx_mon = NULL; vdev->osif_tx_free_ext = NULL; vdev->osif_vdev = NULL; @@ -2731,6 +2732,7 @@ static void dp_vdev_register_wifi3(struct cdp_vdev *vdev_handle, vdev->osif_vdev = osif_vdev; vdev->osif_rx = txrx_ops->rx.rx; vdev->osif_rsim_rx_decap = txrx_ops->rx.rsim_rx_decap; + vdev->osif_get_key = txrx_ops->get_key; vdev->osif_rx_mon = txrx_ops->rx.mon; vdev->osif_tx_free_ext = txrx_ops->tx.tx_free_ext; #ifdef notyet diff --git a/dp/wifi3.0/dp_rx.c b/dp/wifi3.0/dp_rx.c index b91b86d85cc7..819b3293bdfb 100644 --- a/dp/wifi3.0/dp_rx.c +++ b/dp/wifi3.0/dp_rx.c @@ -413,6 +413,7 @@ dp_rx_intrabss_fwd(struct dp_soc *soc, * @vdev: DP Virtual device handle * @nbuf: Buffer pointer * @rx_tlv_hdr: start of rx tlv header + * @peer: pointer to peer * * This function allocated memory for mesh receive stats and fill the * required stats. Stores the memory address in skb cb. @@ -421,7 +422,7 @@ dp_rx_intrabss_fwd(struct dp_soc *soc, */ static void dp_rx_fill_mesh_stats(struct dp_vdev *vdev, qdf_nbuf_t nbuf, - uint8_t *rx_tlv_hdr) + uint8_t *rx_tlv_hdr, struct dp_peer *peer) { struct mesh_recv_hdr_s *rx_info = NULL; uint32_t pkt_type; @@ -451,6 +452,11 @@ void dp_rx_fill_mesh_stats(struct dp_vdev *vdev, qdf_nbuf_t nbuf, if (hal_rx_attn_msdu_get_is_decrypted(rx_tlv_hdr)) { rx_info->rs_flags |= MESH_RX_DECRYPTED; rx_info->rs_keyix = hal_rx_msdu_get_keyid(rx_tlv_hdr); + if (vdev->osif_get_key) + vdev->osif_get_key(vdev->osif_vdev, + &rx_info->rs_decryptkey[0], + &peer->mac_addr.raw[0], + rx_info->rs_keyix); } rx_info->rs_rssi = hal_rx_msdu_start_get_rssi(rx_tlv_hdr); @@ -475,7 +481,7 @@ void dp_rx_fill_mesh_stats(struct dp_vdev *vdev, qdf_nbuf_t nbuf, } /** - * dp_rx_fill_mesh_stats() - Filters mesh unwanted packets + * dp_rx_filter_mesh_packets() - Filters mesh unwanted packets * * @vdev: DP Virtual device handle * @nbuf: Buffer pointer @@ -536,7 +542,7 @@ QDF_STATUS dp_rx_filter_mesh_packets(struct dp_vdev *vdev, qdf_nbuf_t nbuf, #else static void dp_rx_fill_mesh_stats(struct dp_vdev *vdev, qdf_nbuf_t nbuf, - uint8_t *rx_tlv_hdr) + uint8_t *rx_tlv_hdr, struct dp_peer *peer) { } @@ -1258,7 +1264,8 @@ done: qdf_nbuf_free(nbuf); continue; } - dp_rx_fill_mesh_stats(vdev, nbuf, rx_tlv_hdr); + dp_rx_fill_mesh_stats(vdev, nbuf, + rx_tlv_hdr, peer); } #ifdef QCA_WIFI_NAPIER_EMULATION_DBG /* Debug code, remove later */ diff --git a/dp/wifi3.0/dp_types.h b/dp/wifi3.0/dp_types.h index 40c381926fa7..427fb84f728e 100644 --- a/dp/wifi3.0/dp_types.h +++ b/dp/wifi3.0/dp_types.h @@ -1051,6 +1051,7 @@ struct dp_vdev { /* callback to hand rx frames to the OS shim */ ol_txrx_rx_fp osif_rx; ol_txrx_rsim_rx_decap_fp osif_rsim_rx_decap; + ol_txrx_get_key_fp osif_get_key; ol_txrx_tx_free_ext_fp osif_tx_free_ext; #ifdef notyet