Browse Source

Merge "qcacmn: Fix Key derivation for mesh rx stats"

Linux Build Service Account 7 years ago
parent
commit
afcbbb23b3
6 changed files with 51 additions and 21 deletions
  1. 14 0
      dp/inc/cdp_txrx_cmn_struct.h
  2. 11 8
      dp/wifi3.0/dp_ipa.c
  3. 12 9
      dp/wifi3.0/dp_ipa.h
  4. 2 0
      dp/wifi3.0/dp_main.c
  5. 11 4
      dp/wifi3.0/dp_rx.c
  6. 1 0
      dp/wifi3.0/dp_types.h

+ 14 - 0
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;
 };
 
 /**

+ 11 - 8
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
 

+ 12 - 9
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_

+ 2 - 0
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

+ 11 - 4
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 */

+ 1 - 0
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