Kaynağa Gözat

Merge remote-tracking branch 'remotes/origin/wlan-cld3.driver.lnx.1.1-dev' into wlan-cld3.driver.lnx.2.0-dev

Fast forward CLD3.0-2.0-dev branch Rel 5.1.0.22 to CLD3.0-1.1 Rel 5.1.0.29J

* remotes/origin/wlan-cld3.driver.lnx.1.1-dev: (858 commits)
  Release 5.1.0.29J
  qcacld-3.0: Allocate memory for set_offload and program at once
  Release 5.1.0.29I
  qcacld-3.0: Enable Runtime PM after first interface is up
  Release 5.1.0.29H
  qcacld-3.0: Buffer delTs if an addTs is buffered
  Release 5.1.0.29G
  qcacld-3.0: Fix wrong use of Runtime get API inplace of Runtime put
  Release 5.1.0.29F
  qcacld-3.0: Get operating channel only when connected or bss started
  qcacld-3.0: Append EC IE and Interworking IE to beacon
  qcacld-3.0: Fix IBSS peer info handling when no peers are connected
  Release 5.1.0.29E
  qcacld-3.0: Fix TDLS peer QoS capability in transport layer
  Release 5.1.0.29D
  qcacld-3.0: Cancel Remain on channel command before stop ap
  qcacld-3.0: Correct IEs in beacon filter API
  qcacld-3.0: Fix to update proper session_entry in lim_process_messages()
  qcacld-3.0: Register event in wma to track TDLS connection
  qcacld-3.0: If MCC is disabled do not roam to an AP which cause MCC
  ...
  qcacld-3.0: Fix incorrect channel list passed to firmware
  qcacld-3.0: Increase bus suspend/resume log levels
  qcacld-3.0: Convert wlan_hdd_power.c to unified logging
  qcacld-3.0: Convert wlan_hdd_ocb.c to unified logging
  qcacld-3.0: Convert wlan_hdd_hostapd.c to unified logging [7/7]
  qcacld-3.0: Convert wlan_hdd_hostapd.c to unified logging [6/7]
  qcacld-3.0: Convert wlan_hdd_hostapd.c to unified logging [5/7]
  qcacld-3.0: Convert wlan_hdd_hostapd.c to unified logging [4/7]
  qcacld-3.0: Convert wlan_hdd_hostapd.c to unified logging [3/7]
  qcacld-3.0: Convert wlan_hdd_hostapd.c to unified logging [2/7]
  qcacld-3.0: Convert wlan_hdd_hostapd.c to unified logging [1/7]
  qcacld-3.0: Correct len size of oem data request
  Release 5.1.0.22

Change-Id: Icf4596cf1a370f2139ecbd90fc6c5b8ba5be1141
CRs-Fixed: 688141 1006522 1072520 1008956 957469 964594 1007555 1010915 1065161 1030084 1020643 991993 992672 1060378 1064018 1067816 1070008 1070461 1065769 1070258 937681 936397 1070817 1064970 1072803 1072412 1071268 1072777 1071200 1016876 1072584 1072081 1009486 1039969 1050973 1054217 1065466 1072820 1072471 1064023 965244 1051019 865207 984341 1072598 1071442 903249 1072396 1070700 1064813 1072677 1071581 1067340 1044336 1069032 1069408 1071385 998048 999169 997433 1071353 1069659 1069480 1070224 1005327 1053252 1046397 1069559 1059739 1070145 1070223 1068479 1069498 945597 1070075 1069014 1069650 1062430 1067558 1053747 1068108 1067450 1068439 945302 1068914 1067454 1066946 1067411 1028085 1067720 1057714 1061837 1016886 1012420 1061698 1066986 1066022 1067951 1064213 1066770 834362 952660 978901 1010564 977101 956599 890228 1066838 1055388 1047004 1023043 1067670 997430 991417 933465 931435 1034569 1020108 1056230 1053362 1051097 958230 1002770 1009456 936179 1033328 855782 1053852 955872 776081 1037383 982329 1039104 1035077 1001441 1052716 992733 1061472 1018539 667983 985614 1025378 1037640 1006601 990208 1020078 1017943 981121 852387 1023179 1005367 1059205 1067021 1067109 1067048 1067040 1067029 1064058 1067041 1066509 1066411 1065945 1065301 1062544 1060748 1060669 1061220 1066025 1060775 1063037 1062978 1062967 1060747 1060657 1060643 1060636 1060626 1060597 1060579 1065266 1065898 1065130 1064768 1065309 1062155 1065234 1064168 1013062 1058503 962367 1065872 1063737 1045265 1063038 1060104 1052279 1064917 1003374 1063541 907635 1020247 1009922 1019664 978673 1043384 962187 1050955 956590 1010559 988686 1018482 1032185 1050454 1012547 987734 1055774 1055179 1062556 1062295 1047286 951119 994677 986165 983694 974023 967842 879527 963275 1011361 1000853 974567 975049 1053887 844097 927236 959490 1016866 977264 1058884 1008794 881429 909143 938522 939153 1037455 954888 898375 931441 988849 1064624 1029540 1000913 886644 804176 857123 991443 1023616 1017282 1001142 1028623 1045004 1000857 1017937 1000861 1064249 1063665 1062536 1061963 1064044 1063212 1060384 954222 871983 1059527 1012452 1064063 987455 1044603 1064020 1064031 1063843 1063089 955788 962252 991455 1061195 1056031 1062742 1055344 1062916 1058274 1044155 943414 1053219 1057181 1058990 1061879 1060808 1039152 937766 803527 996156 1058403 1059498 1060893 1060242 1059532 954601 1031987 973947 967553 796397 1061559 1010176 1060810 937688 1060796 1059538 1051254 1059720 1060615 971446 974415 984779 868756 1026420 1056746 977188 988240 990808 1038603 1028556 855840 855871 992082 884364 1006608 996556 995545 1030590 1018993 1059543 1058938 937691 1058338 1060937 1060356 1058267 1055648 1058745 1059065 1059077 1059088 1058342 1001733 1057742 1057261 1021382 989984 1052039 954880 1058211 1056787 1056197 1010596 1011976 1050438 1005714 1048394 748105 1056091 1056959 1056344 1032578 1057347 1057329 937663 937659 970647 1047382 1054102 1053513 955272 1046754 1050004 970527 1008872 1056036 1055071 1023663 1049254 1048651 1037816 1056442 973054 967535 1056331 1020079 958964 1055660 1047817 1047214 985226 1047259 1056957 1052652 1044060 1053626 1050754 1033224 1023457 994435 971505 1017887 1042048 1042027 975402 960456 1055033 1055093 1043939 1038593 1019037 1022454 1026370 1048793 971886 932749 1036775 1003326 1017824 945566 1051920 1046753 1045912 1047629 1053657 1051760 1029145 1025498 1053041 1013211 937649 1050791 937665 1049546 1051160 1048951 1047054 1051212 1050635 1050653 1048807 1052458 1049469 1051045 1042901 1045242 1050083 1050841 1050836 1018887 1050190 1049218 1017496 1045626 1049333 1038872 1018486 990645 1025272 1047209 985562 1042205 1048116 1042968 936342 1048395 1046882 1027738 1043090 1046458 1047642 1047052 1041911 1038668 1040612 1034734 1041960 1047332 1046519 1043164 1043085 937650 1044182 1023830 1043760 999560 1046463 1035792 1017335 1017332 1026817 1038237 1044864 1046841 1044268 1043757 1044706 1044693 1043189 1045959 1043823 1040310 1044264 1042043 1041989 1044021 1023818 1035499 1042616 1040063 1039491 951482 1039447 1042226 1013475 1027725 1027693 1033518 1039663 1039020 1041335 937685 937672 937661 1013488
Prakash Dhavali 8 yıl önce
ebeveyn
işleme
03914725c5
100 değiştirilmiş dosya ile 8459 ekleme ve 4925 silme
  1. 80 38
      Kbuild
  2. 4 0
      Kconfig
  3. 0 620
      config/WCNSS_qcom_cfg.ini
  4. 1 0
      core/bmi/src/bmi.c
  5. 1 1
      core/bmi/src/i_bmi.h
  6. 27 15
      core/bmi/src/ol_fw.c
  7. 40 0
      core/bmi/src/ol_fw_common.c
  8. 15 1
      core/cds/inc/cds_api.h
  9. 62 9
      core/cds/inc/cds_concurrency.h
  10. 151 0
      core/cds/inc/cds_config.h
  11. 28 38
      core/cds/inc/cds_mq.h
  12. 22 2
      core/cds/inc/cds_reg_service.h
  13. 4 15
      core/cds/inc/cds_regdomain.h
  14. 9 1
      core/cds/inc/cds_sched.h
  15. 23 6
      core/cds/inc/cds_utils.h
  16. 268 156
      core/cds/src/cds_api.c
  17. 506 270
      core/cds/src/cds_concurrency.c
  18. 24 0
      core/cds/src/cds_mq.c
  19. 4 3
      core/cds/src/cds_reg_service.c
  20. 11 8
      core/cds/src/cds_regdomain.c
  21. 8 7
      core/cds/src/cds_sched.c
  22. 3 3
      core/cds/src/cds_utils.c
  23. 31 5
      core/dp/htt/htt.c
  24. 106 2
      core/dp/htt/htt_h2t.c
  25. 5 0
      core/dp/htt/htt_internal.h
  26. 50 7
      core/dp/htt/htt_rx.c
  27. 4 4
      core/dp/htt/htt_t2h.c
  28. 57 25
      core/dp/htt/htt_tx.c
  29. 7 5
      core/dp/htt/htt_types.h
  30. 31 0
      core/dp/ol/inc/ol_cfg.h
  31. 1 0
      core/dp/ol/inc/ol_htt_api.h
  32. 3 0
      core/dp/ol/inc/ol_htt_rx_api.h
  33. 2 0
      core/dp/ol/inc/ol_txrx_ctrl_api.h
  34. 53 9
      core/dp/txrx/ol_rx.c
  35. 2 1
      core/dp/txrx/ol_rx_defrag.c
  36. 6 2
      core/dp/txrx/ol_rx_fwd.c
  37. 3 5
      core/dp/txrx/ol_rx_reorder.c
  38. 2 1
      core/dp/txrx/ol_rx_reorder_timeout.c
  39. 27 13
      core/dp/txrx/ol_tx.c
  40. 10 2
      core/dp/txrx/ol_tx_classify.c
  41. 3 1
      core/dp/txrx/ol_tx_desc.c
  42. 19 10
      core/dp/txrx/ol_tx_desc.h
  43. 13 7
      core/dp/txrx/ol_tx_queue.c
  44. 6 4
      core/dp/txrx/ol_tx_queue.h
  45. 2 2
      core/dp/txrx/ol_tx_send.c
  46. 73 15
      core/dp/txrx/ol_txrx.c
  47. 1 0
      core/dp/txrx/ol_txrx.h
  48. 18 1
      core/dp/txrx/ol_txrx_flow_control.c
  49. 1 1
      core/dp/txrx/ol_txrx_internal.h
  50. 113 57
      core/dp/txrx/ol_txrx_peer_find.c
  51. 10 1
      core/dp/txrx/ol_txrx_types.h
  52. 1 0
      core/dp/txrx/wdi_event.h
  53. 9 6
      core/hdd/inc/qc_sap_ioctl.h
  54. 82 1
      core/hdd/inc/wlan_hdd_assoc.h
  55. 228 123
      core/hdd/inc/wlan_hdd_cfg.h
  56. 7 1
      core/hdd/inc/wlan_hdd_driver_ops.h
  57. 2 5
      core/hdd/inc/wlan_hdd_ftm.h
  58. 23 3
      core/hdd/inc/wlan_hdd_ipa.h
  59. 2 0
      core/hdd/inc/wlan_hdd_lro.h
  60. 158 28
      core/hdd/inc/wlan_hdd_main.h
  61. 10 2
      core/hdd/inc/wlan_hdd_memdump.h
  62. 20 3
      core/hdd/inc/wlan_hdd_nan.h
  63. 25 3
      core/hdd/inc/wlan_hdd_napi.h
  64. 1 1
      core/hdd/inc/wlan_hdd_oemdata.h
  65. 4 0
      core/hdd/inc/wlan_hdd_p2p.h
  66. 7 2
      core/hdd/inc/wlan_hdd_power.h
  67. 42 1
      core/hdd/inc/wlan_hdd_tdls.h
  68. 8 4
      core/hdd/inc/wlan_hdd_trace.h
  69. 6 1
      core/hdd/inc/wlan_hdd_tsf.h
  70. 17 0
      core/hdd/inc/wlan_hdd_tx_rx.h
  71. 23 1
      core/hdd/inc/wlan_hdd_wext.h
  72. 684 82
      core/hdd/src/wlan_hdd_assoc.c
  73. 696 719
      core/hdd/src/wlan_hdd_cfg.c
  74. 651 471
      core/hdd/src/wlan_hdd_cfg80211.c
  75. 523 29
      core/hdd/src/wlan_hdd_cfg80211.h
  76. 6 6
      core/hdd/src/wlan_hdd_conc_ut.c
  77. 28 54
      core/hdd/src/wlan_hdd_debugfs.c
  78. 496 0
      core/hdd/src/wlan_hdd_disa.c
  79. 70 0
      core/hdd/src/wlan_hdd_disa.h
  80. 279 69
      core/hdd/src/wlan_hdd_driver_ops.c
  81. 185 139
      core/hdd/src/wlan_hdd_ext_scan.c
  82. 26 685
      core/hdd/src/wlan_hdd_ftm.c
  83. 87 100
      core/hdd/src/wlan_hdd_green_ap.c
  84. 72 17
      core/hdd/src/wlan_hdd_green_ap.h
  85. 315 159
      core/hdd/src/wlan_hdd_hostapd.c
  86. 1 1
      core/hdd/src/wlan_hdd_hostapd.h
  87. 109 74
      core/hdd/src/wlan_hdd_ioctl.c
  88. 179 96
      core/hdd/src/wlan_hdd_ipa.c
  89. 122 8
      core/hdd/src/wlan_hdd_lpass.c
  90. 113 18
      core/hdd/src/wlan_hdd_lpass.h
  91. 65 24
      core/hdd/src/wlan_hdd_lro.c
  92. 521 142
      core/hdd/src/wlan_hdd_main.c
  93. 45 47
      core/hdd/src/wlan_hdd_memdump.c
  94. 1 16
      core/hdd/src/wlan_hdd_nan.c
  95. 44 48
      core/hdd/src/wlan_hdd_nan_datapath.c
  96. 71 10
      core/hdd/src/wlan_hdd_napi.c
  97. 88 85
      core/hdd/src/wlan_hdd_ocb.c
  98. 96 2
      core/hdd/src/wlan_hdd_ocb.h
  99. 33 36
      core/hdd/src/wlan_hdd_oemdata.c
  100. 228 230
      core/hdd/src/wlan_hdd_p2p.c

+ 80 - 38
Kbuild

@@ -65,6 +65,7 @@ ifeq ($(KERNEL_BUILD), 0)
 	# builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
 	# config.
 	ifneq ($(TARGET_BUILD_VARIANT),user)
+		CONFIG_FEATURE_PKTLOG := y
 		ifeq ($(CONFIG_SLUB_DEBUG_ON),y)
 			CONFIG_FEATURE_DP_TRACE := y
 		else
@@ -79,9 +80,6 @@ ifeq ($(KERNEL_BUILD), 0)
 	#Flag to enable Legacy Fast Roaming3(LFR3)
 	CONFIG_QCACLD_WLAN_LFR3 := y
 
-	#JB kernel has PMKSA patches, hence enabling this flag
-	CONFIG_PRIMA_WLAN_OKC := y
-
 	# JB kernel has CPU enablement patches, so enable
 	ifeq ($(CONFIG_ROME_IF),pci)
 		CONFIG_PRIMA_WLAN_11AC_HIGH_TP := y
@@ -101,6 +99,9 @@ ifeq ($(KERNEL_BUILD), 0)
 	ifeq ($(CONFIG_MOBILE_ROUTER), y)
 	CONFIG_QCACLD_FEATURE_GREEN_AP := y
 	endif
+	ifeq ($(CONFIG_ARCH_MSMCOBALT), y)
+	CONFIG_QCACLD_FEATURE_GREEN_AP := y
+	endif
 
 	#Flag to enable Fast Transition (11r) feature
 	CONFIG_QCOM_VOWIFI_11R := y
@@ -148,11 +149,19 @@ ifeq ($(KERNEL_BUILD), 0)
 
 	#enable TSF get feature
 	CONFIG_WLAN_SYNC_TSF := y
+	#Enable DSRC feature
+
+	ifeq ($(CONFIG_QCA_WIFI_SDIO), 1)
+	CONFIG_WLAN_FEATURE_DSRC := y
+	endif
 
 ifneq ($(CONFIG_ROME_IF),sdio)
 	#Flag to enable memdump feature
 	CONFIG_WLAN_FEATURE_MEMDUMP := n
 
+	#Flag to enable DISA
+	CONFIG_WLAN_FEATURE_DISA := y
+
 	#Flag to enable Fast Path feature
 	CONFIG_WLAN_FASTPATH := y
 
@@ -168,12 +177,10 @@ ifneq ($(CONFIG_ROME_IF),sdio)
 	endif
 
 	# Flag to enable LRO (Large Receive Offload)
-	ifeq ($(CONFIG_CNSS_EOS), y)
-		ifeq ($(CONFIG_INET_LRO), y)
-			CONFIG_WLAN_LRO := y
-		else
-			CONFIG_WLAN_LRO := n
-		endif
+	ifeq ($(CONFIG_INET_LRO), y)
+		CONFIG_WLAN_LRO := y
+	else
+		CONFIG_WLAN_LRO := n
 	endif
 endif
 
@@ -236,6 +243,11 @@ ifeq ($(CONFIG_ROME_IF),pci)
 	CONFIG_HIF_PCI := 1
 endif
 
+#Enable USB specific APIS
+ifeq ($(CONFIG_ROME_IF),usb)
+	CONFIG_HIF_USB := 1
+endif
+
 #Enable pci read/write config functions
 ifeq ($(CONFIG_ROME_IF),pci)
 	CONFIG_ATH_PCI := 1
@@ -245,10 +257,6 @@ ifeq ($(CONFIG_ROME_IF),snoc)
 	CONFIG_HIF_SNOC:= 1
 endif
 
-ifeq ($(CONFIG_ROME_IF),usb)
-#CONFIG_ATH_PCI := 1
-endif
-
 ifneq ($(CONFIG_MOBILE_ROUTER), y)
 #Enable IBSS support on CLD
 CONFIG_QCA_IBSS_SUPPORT := 1
@@ -289,6 +297,13 @@ ifeq ($(CONFIG_ROME_IF),pci)
 	CONFIG_EXT_WOW := 1
 endif
 
+# Flag to enable bus auto suspend
+ifeq ($(CONFIG_ROME_IF),pci)
+ifeq ($(CONFIG_BUS_AUTO_SUSPEND), y)
+CDEFINES += -DFEATURE_RUNTIME_PM
+endif
+endif
+
 #Set this to 1 to catch erroneous Target accesses during debug.
 CONFIG_ATH_PCIE_ACCESS_DEBUG := 0
 
@@ -346,7 +361,6 @@ HDD_OBJS := 	$(HDD_SRC_DIR)/wlan_hdd_assoc.o \
 		$(HDD_SRC_DIR)/wlan_hdd_hostapd.o \
 		$(HDD_SRC_DIR)/wlan_hdd_ioctl.o \
 		$(HDD_SRC_DIR)/wlan_hdd_main.o \
-		$(HDD_SRC_DIR)/wlan_hdd_ocb.o \
 		$(HDD_SRC_DIR)/wlan_hdd_oemdata.o \
 		$(HDD_SRC_DIR)/wlan_hdd_power.o \
 		$(HDD_SRC_DIR)/wlan_hdd_regulatory.o \
@@ -358,6 +372,9 @@ HDD_OBJS := 	$(HDD_SRC_DIR)/wlan_hdd_assoc.o \
 		$(HDD_SRC_DIR)/wlan_hdd_wmm.o \
 		$(HDD_SRC_DIR)/wlan_hdd_wowl.o
 
+ifeq ($(CONFIG_WLAN_FEATURE_DSRC), y)
+HDD_OBJS+=	$(HDD_SRC_DIR)/wlan_hdd_ocb.o
+endif
 
 ifeq ($(CONFIG_WLAN_FEATURE_LPSS),y)
 HDD_OBJS +=	$(HDD_SRC_DIR)/wlan_hdd_lpass.o
@@ -406,6 +423,10 @@ ifeq ($(CONFIG_WLAN_FEATURE_MEMDUMP),y)
 HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_memdump.o
 endif
 
+ifeq ($(CONFIG_WLAN_FEATURE_DISA),y)
+HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_disa.o
+endif
+
 ifeq ($(CONFIG_LFR_SUBNET_DETECTION), y)
 HDD_OBJS +=	$(HDD_SRC_DIR)/wlan_hdd_subnet_detect.o
 endif
@@ -594,8 +615,6 @@ SME_CMN_OBJS := $(SME_SRC_DIR)/common/sme_api.o \
 		$(SME_SRC_DIR)/common/sme_power_save.o \
 		$(SME_SRC_DIR)/common/sme_trace.o
 
-SME_OEM_DATA_OBJS := $(SME_SRC_DIR)/oem_data/oem_data_api.o
-
 SME_P2P_OBJS = $(SME_SRC_DIR)/p2p/p2p_api.o
 
 SME_RRM_OBJS := $(SME_SRC_DIR)/rrm/sme_rrm.o
@@ -610,7 +629,6 @@ endif
 
 SME_OBJS :=	$(SME_CMN_OBJS) \
 		$(SME_CSR_OBJS) \
-		$(SME_OEM_DATA_OBJS) \
 		$(SME_P2P_OBJS) \
 		$(SME_QOS_OBJS) \
 		$(SME_RRM_OBJS) \
@@ -799,13 +817,12 @@ HTC_OBJS := $(WLAN_COMMON_ROOT)/$(HTC_DIR)/htc.o \
 ########### HIF ###########
 HIF_DIR := hif
 HIF_CE_DIR := $(HIF_DIR)/src/ce
-HIF_CNSS_STUB_DIR := $(HIF_DIR)/src/icnss_stub
-
 
 HIF_DISPATCHER_DIR := $(HIF_DIR)/src/dispatcher
 
 HIF_PCIE_DIR := $(HIF_DIR)/src/pcie
 HIF_SNOC_DIR := $(HIF_DIR)/src/snoc
+HIF_USB_DIR := $(HIF_DIR)/src/usb
 HIF_SDIO_DIR := $(HIF_DIR)/src/sdio
 
 HIF_SDIO_NATIVE_DIR := $(HIF_SDIO_DIR)/native_sdio
@@ -814,9 +831,7 @@ HIF_SDIO_NATIVE_SRC_DIR := $(HIF_SDIO_NATIVE_DIR)/src
 
 HIF_INC := -I$(WLAN_COMMON_INC)/$(HIF_DIR)/inc \
 	   -I$(WLAN_COMMON_INC)/$(HIF_DIR)/src \
-	   -I$(WLAN_COMMON_INC)/$(HIF_CE_DIR) \
-	   -I$(WLAN_COMMON_INC)/$(HIF_CNSS_STUB_DIR)
-
+	   -I$(WLAN_COMMON_INC)/$(HIF_CE_DIR)
 
 ifeq ($(CONFIG_HIF_PCI), 1)
 HIF_INC += -I$(WLAN_COMMON_INC)/$(HIF_DISPATCHER_DIR)
@@ -828,6 +843,11 @@ HIF_INC += -I$(WLAN_COMMON_INC)/$(HIF_DISPATCHER_DIR)
 HIF_INC += -I$(WLAN_COMMON_INC)/$(HIF_SNOC_DIR)
 endif
 
+ifeq ($(CONFIG_HIF_USB), 1)
+HIF_INC += -I$(WLAN_COMMON_INC)/$(HIF_DISPATCHER_DIR)
+HIF_INC += -I$(WLAN_COMMON_INC)/$(HIF_USB_DIR)
+endif
+
 ifeq ($(CONFIG_HIF_SDIO), 1)
 HIF_INC += -I$(WLAN_COMMON_INC)/$(HIF_DISPATCHER_DIR)
 HIF_INC += -I$(WLAN_COMMON_INC)/$(HIF_SDIO_DIR)
@@ -845,6 +865,11 @@ HIF_CE_OBJS :=  $(WLAN_COMMON_ROOT)/$(HIF_CE_DIR)/ce_bmi.o \
                 $(WLAN_COMMON_ROOT)/$(HIF_CE_DIR)/ce_tasklet.o \
                 $(WLAN_COMMON_ROOT)/$(HIF_DIR)/src/regtable.o
 
+HIF_USB_OBJS := $(WLAN_COMMON_ROOT)/$(HIF_USB_DIR)/usbdrv.o \
+                $(WLAN_COMMON_ROOT)/$(HIF_USB_DIR)/hif_usb.o \
+                $(WLAN_COMMON_ROOT)/$(HIF_USB_DIR)/if_usb.o \
+                $(WLAN_COMMON_ROOT)/$(HIF_USB_DIR)/regtable_usb.o
+
 HIF_SDIO_OBJS := $(WLAN_COMMON_ROOT)/$(HIF_SDIO_DIR)/hif_sdio_send.o \
                  $(WLAN_COMMON_ROOT)/$(HIF_SDIO_DIR)/hif_bmi_reg_access.o \
                  $(WLAN_COMMON_ROOT)/$(HIF_SDIO_DIR)/hif_diag_reg_access.o \
@@ -856,10 +881,6 @@ HIF_SDIO_OBJS := $(WLAN_COMMON_ROOT)/$(HIF_SDIO_DIR)/hif_sdio_send.o \
 HIF_SDIO_NATIVE_OBJS := $(WLAN_COMMON_ROOT)/$(HIF_SDIO_NATIVE_SRC_DIR)/hif.o \
                         $(WLAN_COMMON_ROOT)/$(HIF_SDIO_NATIVE_SRC_DIR)/hif_scatter.o
 
-ifneq ($(CONFIG_ICNSS), y)
-HIF_OBJS += $(WLAN_COMMON_ROOT)/$(HIF_CNSS_STUB_DIR)/icnss_stub.o
-endif
-
 ifeq ($(CONFIG_WLAN_NAPI), y)
 HIF_OBJS += $(WLAN_COMMON_ROOT)/$(HIF_DIR)/src/hif_napi.o
 endif
@@ -892,6 +913,12 @@ HIF_OBJS += $(HIF_COMMON_OBJS)
 HIF_OBJS += $(WLAN_COMMON_ROOT)/$(HIF_DISPATCHER_DIR)/multibus_sdio.o
 endif
 
+ifeq ($(CONFIG_HIF_USB), 1)
+HIF_OBJS += $(HIF_USB_OBJS)
+HIF_OBJS += $(HIF_COMMON_OBJS)
+HIF_OBJS += $(WLAN_COMMON_ROOT)/$(HIF_DISPATCHER_DIR)/multibus_usb.o
+endif
+
 ############ WMA ############
 WMA_DIR :=	core/wma
 
@@ -914,10 +941,12 @@ WMA_OBJS :=	$(WMA_SRC_DIR)/wma_main.o \
 		$(WMA_SRC_DIR)/wma_utils.o \
 		$(WMA_SRC_DIR)/wma_features.o \
 		$(WMA_SRC_DIR)/wma_dfs_interface.o \
-		$(WMA_SRC_DIR)/wma_ocb.o \
 		$(WMA_SRC_DIR)/wlan_qct_wma_legacy.o\
 		$(WMA_NDP_OBJS)
 
+ifeq ($(CONFIG_WLAN_FEATURE_DSRC), y)
+WMA_OBJS+=	$(WMA_DIR)/wma_ocb.o
+endif
 ifeq ($(CONFIG_MPC_UT_FRAMEWORK),y)
 WMA_OBJS +=	$(WMA_SRC_DIR)/wma_utils_ut.o
 endif
@@ -941,6 +970,9 @@ endif
 ifeq ($(CONFIG_CNSS_SDIO),y)
 PLD_OBJS +=	$(PLD_SRC_DIR)/pld_sdio.o
 endif
+ifeq ($(CONFIG_USB), y)
+PLD_OBJS +=	$(PLD_SRC_DIR)/pld_usb.o
+endif
 
 TARGET_INC :=	-I$(WLAN_ROOT)/target/inc
 
@@ -1057,12 +1089,15 @@ CDEFINES :=	-DANI_LITTLE_BYTE_ENDIAN \
 		-DWMI_INTERFACE_EVENT_LOGGING \
 		-DATH_SUPPORT_WAPI \
 		-DWLAN_FEATURE_LINK_LAYER_STATS \
-		-DWLAN_LOGGING_SOCK_SVC_ENABLE \
 		-DFEATURE_WLAN_EXTSCAN \
 		-DWLAN_FEATURE_MBSSID \
 		-DCONFIG_160MHZ_SUPPORT \
 		-DCONFIG_MCL
 
+ifneq ($(CONFIG_HIF_USB), 1)
+CDEFINES += -DWLAN_LOGGING_SOCK_SVC_ENABLE
+endif
+
 ifeq ($(CONFIG_CNSS), y)
 ifeq ($(CONFIG_CNSS_SDIO), y)
 CDEFINES += -DCONFIG_PLD_SDIO_CNSS
@@ -1090,6 +1125,10 @@ ifeq ($(CONFIG_WLAN_FASTPATH), y)
 CDEFINES +=	-DWLAN_FEATURE_FASTPATH
 endif
 
+ifeq ($(CONFIG_FEATURE_PKTLOG), y)
+CDEFINES +=     -DFEATURE_PKTLOG
+endif
+
 ifeq ($(CONFIG_FEATURE_DP_TRACE), y)
 CDEFINES +=	-DFEATURE_DP_TRACE
 endif
@@ -1165,10 +1204,6 @@ ifeq ($(CONFIG_QCACLD_WLAN_LFR2),y)
 CDEFINES += -DWLAN_FEATURE_HOST_ROAM
 endif
 
-ifeq ($(CONFIG_PRIMA_WLAN_OKC),y)
-CDEFINES += -DFEATURE_WLAN_OKC
-endif
-
 ifeq ($(BUILD_DIAG_VERSION),1)
 CDEFINES += -DFEATURE_WLAN_DIAG_SUPPORT
 CDEFINES += -DFEATURE_WLAN_DIAG_SUPPORT_CSR
@@ -1182,7 +1217,6 @@ ifeq ($(CONFIG_HIF_USB), 1)
 CDEFINES += -DCONFIG_ATH_PROCFS_DIAG_SUPPORT
 CDEFINES += -DQCA_SUPPORT_OL_RX_REORDER_TIMEOUT
 CDEFINES += -DCONFIG_ATH_PCIE_MAX_PERF=0 -DCONFIG_ATH_PCIE_AWAKE_WHILE_DRIVER_LOAD=0 -DCONFIG_DISABLE_CDC_MAX_PERF_WAR=0
-CDEFINES += -DQCA_TX_HTT2_SUPPORT
 endif
 
 ifeq ($(CONFIG_WLAN_FEATURE_11W),y)
@@ -1274,10 +1308,14 @@ CDEFINES += -DCONFIG_HL_SUPPORT \
             -DFEATURE_WLAN_FORCE_SAP_SCC
 endif
 
+ifeq ($(CONFIG_WLAN_FEATURE_DSRC), y)
+CDEFINES += -DWLAN_FEATURE_DSRC
+endif
+
 #Enable USB specific APIS
 ifeq ($(CONFIG_HIF_USB), 1)
-CDEFINES += -DHIF_USB
-CDEFINES += -DCONFIG_HL_SUPPORT
+CDEFINES += -DHIF_USB \
+	    -DCONFIG_HL_SUPPORT
 endif
 
 #Enable FW logs through ini
@@ -1369,6 +1407,9 @@ ifneq (y,$(filter y,$(CONFIG_CNSS_EOS) $(CONFIG_ICNSS)))
 CDEFINES += -DWLAN_ENABLE_CHNL_MATRIX_RESTRICTION
 endif
 
+#Enable OBSS feature
+CDEFINES += -DQCA_HT_2040_COEX
+
 #features specific to mobile router use case
 ifeq ($(CONFIG_MOBILE_ROUTER), y)
 
@@ -1390,9 +1431,6 @@ CDEFINES += -DFEATURE_WLAN_STA_4ADDR_SCHEME
 #Disable STA-AP Mode DFS support
 CDEFINES += -DFEATURE_WLAN_STA_AP_MODE_DFS_DISABLE
 
-#Enable OBSS feature
-CDEFINES += -DQCA_HT_2040_COEX
-
 else #CONFIG_MOBILE_ROUTER
 
 #Open P2P device interface only for non-Mobile router use cases
@@ -1514,6 +1552,10 @@ ifeq ($(CONFIG_WLAN_FEATURE_MEMDUMP),y)
 CDEFINES += -DWLAN_FEATURE_MEMDUMP
 endif
 
+ifeq ($(CONFIG_WLAN_FEATURE_DISA),y)
+CDEFINES += -DWLAN_FEATURE_DISA
+endif
+
 ifeq ($(CONFIG_LFR_SUBNET_DETECTION), y)
 CDEFINES += -DFEATURE_LFR_SUBNET_DETECTION
 endif

+ 4 - 0
Kconfig

@@ -132,4 +132,8 @@ config FEATURE_DP_TRACE
 	bool "Enable data path trace feature"
 	default n
 
+config WLAN_FEATURE_DISA
+	bool "Enable DISA certification feature"
+	default n
+
 endif # QCA_CLD_WLAN

+ 0 - 620
config/WCNSS_qcom_cfg.ini

@@ -1,620 +0,0 @@
-# This file allows user to override the factory
-
-# defaults for the WLAN Driver
-
-
-# Enable IMPS or not
-gEnableImps=1
-
-# Enable/Disable Idle Scan
-
-gEnableIdleScan=0
-
-
-# Increase sleep duration (seconds) during IMPS
-# 0 implies no periodic wake up from IMPS. Periodic wakeup is
-# unnecessary if Idle Scan is disabled.
-gImpsModSleepTime=0
-
-
-# Enable BMPS or not
-gEnableBmps=1
-
-# Enable suspend or not
-
-# 1: Enable standby, 2: Enable Deep sleep, 3: Enable Mcast/Bcast Filter
-
-gEnableSuspend=3
-
-
-# Phy Mode (auto, b, g, n, etc)
-# Valid values are 0-9, with 0 = Auto, 4 = 11n, 9 = 11ac
-# 1 = 11abg, 2 = 11b, 3 = 11g, 5 = 11g only, 6 = 11n only
-# 7 = 11b only 8 = 11ac only.
-gDot11Mode=0
-
-
-# CSR Roaming Enable(1) Disable(0)
-
-gRoamingTime=0
-
-
-# Assigned MAC Addresses - This will be used until NV items are in place
-
-# Each byte of MAC address is represented in Hex format as XX
-
-Intf0MacAddress=000AF58989FF
-Intf1MacAddress=000AF58989FE
-Intf2MacAddress=000AF58989FD
-
-Intf3MacAddress=000AF58989FC
-
-
-# UAPSD service interval for VO,VI, BE, BK traffic
-
-InfraUapsdVoSrvIntv=0
-
-InfraUapsdViSrvIntv=0
-
-InfraUapsdBeSrvIntv=0
-
-InfraUapsdBkSrvIntv=0
-
-# Flag to allow STA send AddTspec even when ACM is Off
-gAddTSWhenACMIsOff=1
-
-# Make 1x1 the default antenna configuration
-
-gNumRxAnt=1
-
-
-# Beacon filtering frequency (unit in beacon intervals)
-
-gNthBeaconFilter=50
-
-
-# Enable WAPI or not
-
-# WAPIIsEnabled=0
-
-
-# Flags to filter Mcast abd Bcast RX packets.
-
-# Value 0: No filtering, 1: Filter all Multicast.
-
-# 2: Filter all Broadcast. 3: Filter all Mcast abd Bcast
-
-McastBcastFilter=3
-
-
-#Flag to enable HostARPOffload feature or not
-
-hostArpOffload=1
-
-#Flag to enable HostNSOffload feature or not
-
-hostNSOffload=1
-
-# This flag enables IP, TCP and UDP checksum offload
-gEnableIpTcpUdpChecksumOffload=1
-
-#SoftAP Related Parameters
-
-# AP MAc addr
-
-gAPMacAddr=000AF589dcab
-
-
-# 802.11n Protection flag
-
-gEnableApProt=1
-
-
-#Enable OBSS protection
-
-gEnableApOBSSProt=1
-
-
-#Enable/Disable UAPSD for SoftAP
-
-gEnableApUapsd=1
-
-
-# Fixed Rate
-
-gFixedRate=0
-
-
-# Maximum Tx power
-
-# gTxPowerCap=30
-
-
-# Fragmentation Threshold
-
-# gFragmentationThreshold=2346
-
-
-# RTS threshold
-
-RTSThreshold=1048576
-
-
-# Intra-BSS forward
-
-gDisableIntraBssFwd=0
-
-
-# WMM Enable/Disable
-
-WmmIsEnabled=0
-
-
-# 802.11d support
-
-g11dSupportEnabled=0
-
-# 802.11h support
-
-g11hSupportEnabled=1
-
-# DFS Master Capability
-gEnableDFSMasterCap=1
-
-# ESE Support and fast transition
-EseEnabled=1
-ImplicitQosIsEnabled=0
-gNeighborScanTimerPeriod=200
-
-gNeighborLookupThreshold=76
-gNeighborReassocThreshold=81
-
-gNeighborScanChannelMinTime=20
-gNeighborScanChannelMaxTime=30
-gMaxNeighborReqTries=3
-
-# Legacy (non-ESE, non-802.11r) Fast Roaming Support
-# To enable, set FastRoamEnabled=1
-# To disable, set FastRoamEnabled=0
-FastRoamEnabled=1
-
-#Check if the AP to which we are roaming is better than current AP in terms of RSSI.
-#Checking is disabled if set to Zero.Otherwise it will use this value as to how better
-#the RSSI of the new/roamable AP should be for roaming
-RoamRssiDiff=3
-
-# If the RSSI of any available candidate is better than currently associated
-# AP by at least gImmediateRoamRssiDiff, then being to roam immediately (without
-# registering for reassoc threshold).
-# NOTE: Value of 0 means that we would register for reassoc threshold.
-gImmediateRoamRssiDiff=10
-
-# To enable, set gRoamIntraBand=1 (Roaming within band)
-# To disable, set gRoamIntraBand=0 (Roaming across band)
-gRoamIntraBand=0
-
-#Short Guard Interval Enable/disable
-
-gShortGI20Mhz=1
-
-gShortGI40Mhz=1
-
-
-#Auto Shutdown  Value in seconds. A value of 0 means Auto shutoff is disabled
-
-gAPAutoShutOff=0
-
-#Auto Shutdown wlan : Value in Seconds. 0 means disabled. Max 1 day = 86400 sec
-gWlanAutoShutdown = 0
-
-# Not used.
-gApAutoChannelSelection=0
-
-
-# Listen Energy Detect Mode Configuration
-
-# Valid values 0-128
-
-# 128 means disable Energy Detect feature
-
-# 0-9 are threshold code and 7 is recommended value from system if feature is to be enabled.
-
-# 10-128 are reserved.
-
-# The EDET threshold mapping is as follows in 3dB step:
-
-# 0 = -60 dBm
-
-# 1 = -63 dBm
-
-# 2 = -66 dBm
-
-# ...
-
-# 7 = -81 dBm
-
-# 8 = -84 dBm
-
-# 9 = -87 dBm
-
-# Note: Any of these settings are valid. Setting 0 would yield the highest power saving (in a noisy environment) at the cost of more range. The range impact is approximately #calculated as:
-
-#
-
-#  Range Loss  (dB)  =  EDET threshold level (dBm) + 97 dBm.
-
-#
-
-gEnablePhyAgcListenMode=128
-
-
-#Preferred band (both or 2.4 only or 5 only)
-
-BandCapability=0
-
-
-#Beacon Early Termination (1 = enable the BET feature, 0 = disable)
-
-enableBeaconEarlyTermination=0
-
-beaconEarlyTerminationWakeInterval=3
-
-
-#Channel Bonding
-gChannelBondingMode5GHz=1
-
-
-#Enable Keep alive with non-zero period value
-
-gStaKeepAlivePeriod = 30
-
-#Say gGoKeepAlivePeriod(5 seconds) and gGoLinkMonitorPeriod(10 seconds).
-#For every 10 seconds DUT send Qos Null frame(i.e., Keep Alive frame if link is idle for last 10 seconds.)
-#For both active and power save clients.
-
-#Power save clients: DUT set TIM bit from 10th second onwards and till client honors TIM bit.
-#If doesn't honor for 5 seconds then DUT remove client.
-
-#Active clients: DUT send Qos Null frame for 10th seconds onwards if it is not success still we try on
-#11th second if not tries on 12th and so on till 15th second. Hence before disconnection DUT will send 5 NULL frames.
-#Hence in any case DUT will detect client got removed in (10+5) seconds. i.e., (gGoKeepAlivePeriod + gGoLinkMonitorPeriod)..
-
-#gGoLinkMonitorPeriod/ gApLinkMonitorPeriod is period where link is idle and it is period
-#where we send NULL frame.
-
-#gApLinkMonitorPeriod = 10
-
-#gGoLinkMonitorPeriod = 10
-
-#gGoKeepAlivePeriod/gApKeepAlivePeriod is time to spend to check whether frame are succeed to send or not.
-#Hence total effective detection time is gGoLinkMonitorPeriod+ gGoKeepAlivePeriod/gApLinkMonitorPeriod+ gApKeepAlivePeriod.
-
-
-gGoKeepAlivePeriod = 20
-
-gApKeepAlivePeriod = 20
-
-
-#If set will start with active scan after driver load, otherwise will start with
-
-#passive scan to find out the domain
-
-gEnableBypass11d=1
-
-
-#If set to 0, will not scan DFS channels
-
-gEnableDFSChnlScan=1
-
-# Enable DFS channel roam
-# 0: DISABLE, 1: ENABLED_NORMAL, 2: ENABLED_ACTIVE
-gAllowDFSChannelRoam=1
-
-gVhtChannelWidth=2
-
-# Enable Automatic Tx Power control
-
-gEnableAutomaticTxPowerControl=1
-
-# 0 for OLPC 1 for CLPC and SCPC
-gEnableCloseLoop=1
-
-#Data Inactivity Timeout when in powersave (in ms)
-gDataInactivityTimeout=200
-
-# VHT Tx/Rx MCS values
-# Valid values are 0,1,2. If commented out, the default value is 0.
-# 0=MCS0-7, 1=MCS0-8, 2=MCS0-9
-gVhtRxMCS=2
-gVhtTxMCS=2
-
-# VHT Tx/Rx MCS values for 2x2
-# Valid values are 0,1,2. If commented out, the default value is 0.
-# 0=MCS0-7, 1=MCS0-8, 2=MCS0-9
-gEnable2x2=1
-gVhtRxMCS2x2=2
-gVhtTxMCS2x2=2
-
-# NSS cfg bit definition.
-# STA          BIT[0:1]
-# SAP          BIT[2:3]
-# P2P_GO       BIT[4:5]
-# P2P_CLIENT   BIT[6:7]
-# IBSS         BIT[8:9]
-# TDLS         BIT[10:11]
-# P2P_DEVICE   BIT[12:13]
-# OCB          BIT[14:15]
-# Valid values are 1 or 2 for each two bit configuration.
-# if 2-bit value is set to 1 then the corresponidng vdev comes up in 1x1 mode
-# in the band, if set to 2 then that vdev comes up in 2x2 mode in that band.
-gVdevTypeNss_2g=43690
-gVdevTypeNss_5g=43690
-
-# Set txchainmask and rxchainmask
-# These parameters are used only if gEnable2x2 is 0
-# Valid values are 1,2
-# Set gSetTxChainmask1x1=1 or gSetRxChainmask1x1=1 to select chain0.
-# Set gSetTxChainmask1x1=2 or gSetRxChainmask1x1=2 to select chain1.
-gSetTxChainmask1x1=1
-gSetRxChainmask1x1=1
-
-# Scan Timing Parameters
-# gPassiveMaxChannelTime=110
-# gPassiveMinChannelTime=60
-gActiveMaxChannelTime=40
-gActiveMinChannelTime=20
-
-#If set to 0, MCC is not allowed.
-gEnableMCCMode=1
-
-# MCC to SCC Switch mode:
-# 0-Disable
-# 1-Enable
-# 2-Force SCC if same band, with SAP restart
-# 3-Force SCC if same band, without SAP restart by sending (E)CSA
-# 4-Force SCC if same band (or) use SAP mandatory channel for DBS,
-#   without SAP restart by sending (E)CSA
-gWlanMccToSccSwitchMode = 0
-
-# 1=enable STBC; 0=disable STBC
-gEnableRXSTBC=1
-
-# 1=enable tx STBC; 0=disable
-gEnableTXSTBC=1
-
-# 1=enable rx LDPC; 0=disable
-gEnableRXLDPC=0
-
-#Enable/Disable Tx beamforming
-gTxBFEnable=1
-
-#Enable/Disable Tx beamformee in SAP mode
-gEnableTxBFeeSAP=1
-
-# Enable Tx beamforming in VHT20MHz
-# Valid values are 0,1. If commented out, the default value is 0.
-# 0=disable, 1=enable
-gEnableTxBFin20MHz=1
-
-#Enable/Disable SU Tx beamformer support.
-gEnableTxSUBeamformer=1
-
-#Enable Scan Results Aging based on timer
-#Timer value is in seconds
-#If Set to 0 it will not enable the feature
-gScanAgingTime=30
-
-#Enable Scan Results Aging based on number of scans
-gScanResultAgeCount=1
-
-#Enable Power saving mechanism Based on Android Framework
-#If set to 0 Driver internally control the Power saving mechanism
-#If set to 1 Android Framwrok control the Power saving mechanism
-isAndroidPsEn=0
-
-#Enable thermal mitigation
-gThermalMitigationEnable=0
-
-gEnableFastRoamInConcurrency=1
-
-#Maxium Channel time in msec
-gMaxMediumTime = 6000
-
-# 802.11K support
-gRrmEnable=1
-gRrmOperChanMax=8
-gRrmNonOperChanMax=8
-gRrmRandIntvl=100
-
-#Scan offload
-gEnableDirectedScanOffload=1
-
-#FlexConnect Power Factor
-#Default is set to 0 (disable)
-gFlexConnectPowerFactor=0
-
-#Disable split scan, the FW will take care of it
-gNumChanCombinedConc=60
-
-#Enable Power Save offload
-gEnablePowerSaveOffload=2
-
-#Enable firmware uart print
-gEnablefwprint=0
-
-#IPA config
-gIPAConfig=0
-gIPADescSize=800
-gIPAPreFilterEnable=1
-gIPARMEnable=1
-gIPAIPv6Enable=1
-
-IpaUcOffloadEnabled=0
-gIpaUcStaOffload=0
-
-#P2P Listen offload
-gEnableP2pListenOffload=1
-
-# Maximum Receive AMPDU size (VHT only. Valid values: 0->8k 1->16k 2->32k 3->64k 4->128k)
-gVhtAmpduLenExponent=7
-
-# Maximum MPDU length (VHT only. Valid values: 0->3895 octets, 1->7991 octets, 2->11454 octets)
-gVhtMpduLen=2
-
-# Maximum number of wow filters required
-#gMaxWoWFilters=22
-
-# WOW Enable/Disable.
-# 0 - Disable both magic pattern match and pattern byte match.
-# 1 - Enable magic pattern match on all interfaces.
-# 2 - Enable pattern byte match on all interfaces.
-# 3 - Enable both magic patter and pattern byte match on all interfaces.
-# Default value of gEnableWoW is 3.
-# gEnableWoW=0
-
-# Enable or Disable MCC Adaptive Scheduler at the FW
-# 1=Enable (default), 0=Disable
-gEnableMCCAdaptiveScheduler=1
-
-#Enable or Disable p2p device address administered
-isP2pDeviceAddrAdministrated=0
-
-#Enable Rx thread
-gEnableRxThread=1
-
-#Enable NAPI
-gEnableNAPI=1
-
-# Set Thermal Power limit
-TxPower2g=10
-TxPower5g=10
-
-# Remove Overlap channel restriction
-gEnableOverLapCh=0
-
-#Enable VHT on 2.4Ghz
-gEnableVhtFor24GHzBand=1
-
-#Enable or Disable 5G early beacon termination
-gEnable5gEBT=1
-
-#Maximum number of offload peers supported
-# gMaxOffloadPeers=2
-
-# controlling the following offload patterns
-# through ini parameter. Default value is 1
-# to disable set it to zero. ssdp = 0
-# Setup multicast pattern for mDNS 224.0.0.251,
-# SSDP 239.255.255.250 and LLMNR 224.0.0.252
-ssdp = 0
-
-#Enable Memory Deep Sleep
-gEnableMemDeepSleep=1
-
-# Bus bandwidth threshold values in terms of number of packets
-gBusBandwidthHighThreshold=2000
-gBusBandwidthMediumThreshold=500
-gBusBandwidthLowThreshold=150
-
-# Bus bandwidth compute timeout value in ms
-gBusBandwidthComputeInterval=100
-
-# Regulatory Setting; 0=STRICT; 1=CUSTOM
-gRegulatoryChangeCountry=1
-# RA filtering rate limit param, the current value would not
-# help if the lifetime in RA is less than 3*60=3min. Then
-# we need to change it, though it is uncommon.
-# gRAFilterEnable=0
-gRArateLimitInterval=600
-
-# Maximum number of concurrent connections
-gMaxConcurrentActiveSessions=3
-
-# Disable/Enable GreenAP
-# 0 to disable, 1 to enable, default: 1
-gEnableGreenAp=1
-
-# Radar PRI multiplier
-gDFSradarMappingPriMultiplier=4
-
-gPNOScanSupport=1
-
-# Enable/Disable RX full reorder offload
-gReorderOffloadSupported=1
-
-#Enable/Disable LPASS support
-# 0 to disable, 1 to enable
-gEnableLpassSupport=0
-
-# Whether userspace country code setting shld have priority
-gCountryCodePriority=1
-
-# Enable(1)/Disable(0) SIFS burst
-gEnableSifsBurst=1
-
-# Enable or Disable Multi-user MIMO
-# 1=Enable (default), 0=Disable
-gEnableMuBformee=1
-
-# Enable/Disable channel avoidance for SAP in SCC scenario
-# 0 - disable
-# 1 - enable
-gSapSccChanAvoidance=0
-
-# Inactivity time (in ms) to end TX Service Period while in IBSS power save mode
-gIbssTxSpEndInactivityTime=10
-
-# Enable support for TDLS
-#  0 - disable
-#  1 - enable
-gEnableTDLSSupport=1
-
-# Enable support for Implicit Trigger of TDLS. That is, wlan driver shall
-# initiate TDLS Discovery towards a peer whenever setup criteria (throughput
-# and RSSI) is met and then will initiate teardown when teardown criteria
-# (idle packet count and RSSI) is met.
-#  0 - disable
-#  1 - enable
-gEnableTDLSImplicitTrigger=1
-
-# Enable TDLS External Control. That is, user space application has to
-# first configure a peer MAC in wlan driver towards which TDLS is desired.
-# Device will establish TDLS only towards those configured peers whenever
-# TDLS criteria (throughput and RSSI threshold) is met and teardown TDLS
-# when teardown criteria (idle packet count and RSSI) is met. However,
-# device will accept TDLS connection if it is initiated from any other peer,
-# even if that peer is not configured.
-#  0 - disable
-#  1 - enable
-# For TDLS External Control, Implicit Trigger must also be enabled.
-gTDLSExternalControl=1
-
-# Enable support for TDLS off-channel operation
-#  0 - disable
-#  1 - enable
-# TDLS off-channel operation will be invoked when there is only one
-# TDLS connection.
-gEnableTDLSOffChannel=1
-
-# Enable or Disable Random MAC (Spoofing)
-# 1=Enable, 0=Disable (default)
-gEnableMacAddrSpoof=0
-
-# Enable(Tx) fastpath for data traffic.
-# 0 - disable
-# 1 - enable
-gEnableFastPath=1
-
-# Enable TCP Segmentation Offload
-# 0 - disable
-# 1 - enable
-TSOEnable=1
-
-# Enable Large Receive Offload
-# 0 - disable
-# 1 - enable
-LROEnable=1
-END
-
-# Note: Configuration parser would not read anything past the END marker
-

+ 1 - 0
core/bmi/src/bmi.c

@@ -200,6 +200,7 @@ bmi_get_target_info(struct bmi_target_info *targ_info,
 	switch (hif_get_bus_type(scn)) {
 	case QDF_BUS_TYPE_PCI:
 	case QDF_BUS_TYPE_SNOC:
+	case QDF_BUS_TYPE_USB:
 		status = bmi_get_target_info_message_based(targ_info, ol_ctx);
 		break;
 #ifdef HIF_SDIO

+ 1 - 1
core/bmi/src/i_bmi.h

@@ -188,7 +188,7 @@ struct ol_config_info *ol_get_ini_handle(struct ol_context *ol_ctx);
 QDF_STATUS hif_reg_based_get_target_info(struct hif_opaque_softc *hif_ctx,
 		  struct bmi_target_info *targ_info);
 #endif
-#if defined(HIF_PCI) || defined(SNOC) || defined(HIF_AHB)
+#if defined(HIF_PCI) || defined(SNOC) || defined(HIF_AHB) || defined(HIF_USB)
 static inline QDF_STATUS
 hif_reg_based_get_target_info(struct hif_opaque_softc *hif_ctx,
 		  struct bmi_target_info *targ_info)

+ 27 - 15
core/bmi/src/ol_fw.c

@@ -42,11 +42,17 @@
 #include "if_sdio.h"
 #include "regtable_sdio.h"
 #endif
+#if defined(HIF_USB)
+#include "if_usb.h"
+#include "regtable_usb.h"
+#endif
 #include "pld_common.h"
+#include "hif_main.h"
 
 #include "i_bmi.h"
 #include "qwlan_version.h"
 #include "cds_concurrency.h"
+#include "dbglog_host.h"
 
 #ifdef FEATURE_SECURE_FIRMWARE
 static struct hash_fw fw_hash;
@@ -121,7 +127,7 @@ static int ol_check_fw_hash(struct device *dev,
 		goto end;
 	}
 
-	if (qdf_mem_cmp(hash, digest, SHA256_DIGEST_SIZE) == 0) {
+	if (qdf_mem_cmp(hash, digest, SHA256_DIGEST_SIZE)) {
 		BMI_ERR("Hash Mismatch");
 		qdf_trace_hex_dump(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL,
 				   digest, SHA256_DIGEST_SIZE);
@@ -283,7 +289,7 @@ __ol_transfer_bin_file(struct ol_context *ol_ctx, ATH_BIN_FILE file,
 #endif
 
 	if (file == ATH_BOARD_DATA_FILE) {
-		uint32_t board_ext_address;
+		uint32_t board_ext_address = 0;
 		int32_t board_ext_data_size;
 
 		temp_eeprom = qdf_mem_malloc(fw_entry_size);
@@ -473,17 +479,13 @@ static inline void ol_get_ramdump_mem(struct device *dev,
 int ol_copy_ramdump(struct hif_opaque_softc *scn)
 {
 	int ret = -1;
-	struct hif_opaque_softc **ol_ctx_ptr = &scn;
-	struct ol_context *ol_ctx;
-	qdf_device_t qdf_dev;
 	struct ramdump_info *info;
+	qdf_device_t qdf_dev = cds_get_context(QDF_MODULE_ID_QDF_DEVICE);
 
-	ol_ctx = container_of(ol_ctx_ptr, struct ol_context , scn);
-	if (!ol_ctx) {
-		BMI_ERR("%s: Invalid ol_ctx\n", __func__);
+	if (!qdf_dev) {
+		BMI_ERR("%s qdf_dev is NULL", __func__);
 		return -EINVAL;
 	}
-	qdf_dev = ol_ctx->qdf_dev;
 
 	if (hif_get_bus_type(scn) == QDF_BUS_TYPE_SDIO)
 		return 0;
@@ -591,6 +593,7 @@ void ol_target_failure(void *instance, QDF_STATUS status)
 	struct hif_opaque_softc *scn = ol_ctx->scn;
 	tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA);
 	struct ol_config_info *ini_cfg = ol_get_ini_handle(ol_ctx);
+	qdf_device_t qdf_dev = ol_ctx->qdf_dev;
 	int ret;
 	enum hif_target_status target_status = hif_get_target_status(scn);
 
@@ -608,6 +611,12 @@ void ol_target_failure(void *instance, QDF_STATUS status)
 
 	hif_set_target_status(scn, TARGET_STATUS_RESET);
 
+	if (hif_get_bus_type(scn) == QDF_BUS_TYPE_USB) {
+		if (status == QDF_STATUS_E_USB_ERROR)
+			hif_ramdump_handler(scn);
+		return;
+	}
+
 	if (cds_is_driver_recovering()) {
 		BMI_ERR("%s: Recovery in progress, ignore!\n", __func__);
 		return;
@@ -632,6 +641,7 @@ void ol_target_failure(void *instance, QDF_STATUS status)
 
 	BMI_ERR("XXX TARGET ASSERTED XXX");
 
+	cds_svc_fw_shutdown_ind(qdf_dev->dev);
 	/* Collect the RAM dump through a workqueue */
 	if (ini_cfg->enable_ramdump_collection)
 		qdf_sched_work(0, &ol_ctx->ramdump_work);
@@ -1252,11 +1262,12 @@ QDF_STATUS ol_download_firmware(struct ol_context *ol_ctx)
 						__func__, address);
 	}
 
-	ret = ol_patch_pll_switch(ol_ctx);
-
-	if (ret != QDF_STATUS_SUCCESS) {
-		BMI_ERR("pll switch failed. status %d", ret);
-		return ret;
+	if (hif_get_bus_type(scn) != QDF_BUS_TYPE_USB) {
+		ret = ol_patch_pll_switch(ol_ctx);
+		if (ret != QDF_STATUS_SUCCESS) {
+			BMI_ERR("pll switch failed. status %d", ret);
+			return ret;
+		}
 	}
 
 	if (ol_ctx->cal_in_flash) {
@@ -1545,7 +1556,8 @@ void ol_dump_target_memory(struct hif_opaque_softc *scn, void *memory_block)
 	u_int32_t address = 0;
 	u_int32_t size = 0;
 
-	if (hif_get_bus_type(scn) == QDF_BUS_TYPE_SDIO)
+	if (hif_get_bus_type(scn) == QDF_BUS_TYPE_SDIO ||
+	    hif_get_bus_type(scn) == QDF_BUS_TYPE_USB)
 		return;
 
 	for (; section_count < 2; section_count++) {

+ 40 - 0
core/bmi/src/ol_fw_common.c

@@ -36,6 +36,9 @@
 #if defined(HIF_SDIO)
 #include "regtable_sdio.h"
 #endif
+#if defined(HIF_USB)
+#include "regtable_usb.h"
+#endif
 #if  defined(CONFIG_CNSS)
 #include <net/cnss.h>
 #endif
@@ -66,6 +69,33 @@ static inline void ol_sdio_disable_sleep(struct ol_context *ol_ctx)
 
 #endif
 
+/**
+ * ol_usb_extra_initialization() - USB extra initilization
+ * @ol_ctx: pointer to ol_context
+ *
+ * USB specific initialization after firmware download
+ *
+ * Return: QDF_STATUS_SUCCESS on success and error QDF status on failure
+ */
+static QDF_STATUS
+ol_usb_extra_initialization(struct ol_context *ol_ctx)
+{
+	struct hif_opaque_softc *scn = ol_ctx->scn;
+	struct hif_target_info *tgt_info =
+				hif_get_target_info_handle(scn);
+	QDF_STATUS status = !QDF_STATUS_SUCCESS;
+	u_int32_t param = 0;
+
+	param |= HI_ACS_FLAGS_ALT_DATA_CREDIT_SIZE;
+	status = bmi_write_memory(
+				hif_hia_item_address(tgt_info->target_type,
+					offsetof(struct host_interest_s,
+					hi_acs_flags)),
+				(u_int8_t *)&param, 4, ol_ctx);
+
+	return status;
+}
+
 /*Setting SDIO block size, mbox ISR yield limit for SDIO based HIF*/
 static
 QDF_STATUS ol_sdio_extra_initialization(struct ol_context *ol_ctx)
@@ -144,12 +174,22 @@ exit:
 	return status;
 }
 
+/**
+* ol_extra_initialization() - OL extra initilization
+* @ol_ctx: pointer to ol_context
+*
+* Bus specific initialization after firmware download
+*
+* Return: QDF_STATUS_SUCCESS on success and error QDF status on failure
+*/
 QDF_STATUS ol_extra_initialization(struct ol_context *ol_ctx)
 {
 	struct hif_opaque_softc *scn = ol_ctx->scn;
 
 	if (hif_get_bus_type(scn) == QDF_BUS_TYPE_SDIO)
 		return ol_sdio_extra_initialization(ol_ctx);
+	else if (hif_get_bus_type(scn) == QDF_BUS_TYPE_USB)
+		return ol_usb_extra_initialization(ol_ctx);
 
 	return QDF_STATUS_SUCCESS;
 }

+ 15 - 1
core/cds/inc/cds_api.h

@@ -206,6 +206,13 @@ QDF_STATUS cds_enable(v_CONTEXT_t cds_context);
 
 QDF_STATUS cds_disable(v_CONTEXT_t cds_context);
 
+/**
+ * cds_flush_cache_rx_queue() - flush cache rx queue frame
+ *
+ * Return: None
+ */
+void cds_flush_cache_rx_queue(void);
+
 QDF_STATUS cds_close(v_CONTEXT_t cds_context);
 
 QDF_STATUS cds_shutdown(v_CONTEXT_t cds_context);
@@ -264,7 +271,7 @@ QDF_STATUS cds_flush_logs(uint32_t is_fatal,
 		bool dump_mac_trace,
 		bool recovery_needed);
 void cds_logging_set_fw_flush_complete(void);
-
+void cds_svc_fw_shutdown_ind(struct device *dev);
 #ifdef FEATURE_WLAN_DIAG_SUPPORT
 void cds_tdls_tx_rx_mgmt_event(uint8_t event_id, uint8_t tx_rx,
 			uint8_t type, uint8_t sub_type, uint8_t *peer_mac);
@@ -279,4 +286,11 @@ void cds_tdls_tx_rx_mgmt_event(uint8_t event_id, uint8_t tx_rx,
 
 int cds_get_radio_index(void);
 QDF_STATUS cds_set_radio_index(int radio_index);
+void cds_init_ini_config(struct cds_config_info *cds_cfg);
+void cds_deinit_ini_config(void);
+struct cds_config_info *cds_get_ini_config(void);
+
+bool cds_is_5_mhz_enabled(void);
+bool cds_is_10_mhz_enabled(void);
+bool cds_is_sub_20_mhz_enabled(void);
 #endif /* if !defined __CDS_API_H */

+ 62 - 9
core/cds/inc/cds_concurrency.h

@@ -64,6 +64,48 @@
 		(WEIGHT_OF_GROUP2_PCL_CHANNELS - PCL_GROUPS_WEIGHT_DIFFERENCE)
 
 #define WEIGHT_OF_NON_PCL_CHANNELS 1
+#define WEIGHT_OF_DISALLOWED_CHANNELS 0
+
+/**
+ * enum hw_mode_ss_config - Possible spatial stream configuration
+ * @SS_0x0: Unused Tx and Rx of MAC
+ * @SS_1x1: 1 Tx SS and 1 Rx SS
+ * @SS_2x2: 2 Tx SS and 2 Rx SS
+ * @SS_3x3: 3 Tx SS and 3 Rx SS
+ * @SS_4x4: 4 Tx SS and 4 Rx SS
+ *
+ * Note: Right now only 1x1 and 2x2 are being supported. Other modes should
+ * be added when supported. Asymmetric configuration like 1x2, 2x1 are also
+ * not supported now. But, they are still valid. Right now, Tx/Rx SS support is
+ * 4 bits long. So, we can go upto 15x15
+ */
+enum hw_mode_ss_config {
+	HW_MODE_SS_0x0,
+	HW_MODE_SS_1x1,
+	HW_MODE_SS_2x2,
+	HW_MODE_SS_3x3,
+	HW_MODE_SS_4x4,
+};
+
+/**
+ * enum hw_mode_dbs_capab - DBS HW mode capability
+ * @HW_MODE_DBS_NONE: Non DBS capable
+ * @HW_MODE_DBS: DFS capable
+ */
+enum hw_mode_dbs_capab {
+	HW_MODE_DBS_NONE,
+	HW_MODE_DBS,
+};
+
+/**
+ * enum hw_mode_agile_dfs_capab - Agile DFS HW mode capability
+ * @HW_MODE_AGILE_DFS_NONE: Non Agile DFS capable
+ * @HW_MODE_AGILE_DFS: Agile DFS capable
+ */
+enum hw_mode_agile_dfs_capab {
+	HW_MODE_AGILE_DFS_NONE,
+	HW_MODE_AGILE_DFS,
+};
 
 /**
  * enum cds_pcl_group_id - Identifies the pcl groups to be used
@@ -550,6 +592,7 @@ struct cds_conc_connection_info {
 
 bool cds_is_connection_in_progress(void);
 void cds_dump_concurrency_info(void);
+bool cds_check_is_tdls_allowed(enum tQDF_ADAPTER_MODE device_mode);
 void cds_set_tdls_ct_mode(hdd_context_t *hdd_ctx);
 void cds_set_concurrency_mode(enum tQDF_ADAPTER_MODE mode);
 void cds_clear_concurrency_mode(enum tQDF_ADAPTER_MODE mode);
@@ -592,13 +635,10 @@ static inline void cds_force_sap_on_scc(eCsrRoamResult roam_result,
 #endif /* FEATURE_WLAN_FORCE_SAP_SCC */
 
 #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
-void cds_check_concurrent_intf_and_restart_sap(
-		hdd_station_ctx_t *hdd_sta_ctx,
-		hdd_adapter_t *adapter);
+void cds_check_concurrent_intf_and_restart_sap(hdd_adapter_t *adapter);
 #else
 static inline void cds_check_concurrent_intf_and_restart_sap(
-		hdd_station_ctx_t *hdd_sta_ctx,
-		hdd_adapter_t *adapter)
+						hdd_adapter_t *adapter)
 {
 
 }
@@ -650,9 +690,12 @@ void cds_decr_session_set_pcl(enum tQDF_ADAPTER_MODE mode,
 		uint8_t session_id);
 QDF_STATUS cds_init_policy_mgr(struct cds_sme_cbacks *sme_cbacks);
 QDF_STATUS cds_deinit_policy_mgr(void);
+uint8_t cds_get_channel(enum cds_con_mode mode, uint32_t *vdev_id);
 QDF_STATUS cds_get_pcl(enum cds_con_mode mode,
 			uint8_t *pcl_channels, uint32_t *len,
 			uint8_t *pcl_weight, uint32_t weight_len);
+void cds_update_with_safe_channel_list(uint8_t *pcl_channels, uint32_t *len,
+		uint8_t *weight_list, uint32_t weight_len);
 uint8_t cds_get_nondfs_preferred_channel(enum cds_con_mode mode,
 					bool for_existing_conn);
 bool cds_is_any_nondfs_chnl_present(uint8_t *channel);
@@ -752,10 +795,7 @@ QDF_STATUS qdf_wait_for_connection_update(void);
 QDF_STATUS qdf_reset_connection_update(void);
 QDF_STATUS qdf_set_connection_update(void);
 QDF_STATUS qdf_init_connection_update(void);
-QDF_STATUS cds_stop_start_opportunistic_timer(void);
-QDF_STATUS cds_handle_hw_mode_change_on_csa(uint16_t session_id,
-		uint8_t channel, uint8_t *bssid, void *dst, void *src,
-		uint32_t numbytes);
+QDF_STATUS cds_restart_opportunistic_timer(bool check_state);
 QDF_STATUS cds_modify_sap_pcl_based_on_mandatory_channel(uint8_t *pcl_list_org,
 		uint8_t *weight_list_org,
 		uint32_t *pcl_len_org);
@@ -772,7 +812,14 @@ QDF_STATUS cds_reset_sap_mandatory_channels(void);
 #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
 QDF_STATUS cds_register_sap_restart_channel_switch_cb(
 		void (*sap_restart_chan_switch_cb)(void *, uint32_t, uint32_t));
+QDF_STATUS cds_deregister_sap_restart_channel_switch_cb(void);
 #endif
+bool cds_is_any_mode_active_on_band_along_with_session(uint8_t session_id,
+						       enum cds_band band);
+QDF_STATUS cds_get_mac_id_by_session_id(uint8_t session_id, uint8_t *mac_id);
+QDF_STATUS cds_get_mcc_session_id_on_mac(uint8_t mac_id, uint8_t session_id,
+						uint8_t *mcc_session_id);
+uint8_t cds_get_mcc_operating_channel(uint8_t session_id);
 QDF_STATUS cds_get_pcl_for_existing_conn(enum cds_con_mode mode,
 			uint8_t *pcl_ch, uint32_t *len,
 			uint8_t *weight_list, uint32_t weight_len);
@@ -781,4 +828,10 @@ QDF_STATUS cds_set_hw_mode_on_channel_switch(uint8_t session_id);
 void cds_set_do_hw_mode_change_flag(bool flag);
 bool cds_is_hw_mode_change_after_vdev_up(void);
 void cds_dump_connection_status_info(void);
+uint32_t cds_mode_specific_connection_count(enum cds_con_mode mode,
+						uint32_t *list);
+void cds_hw_mode_transition_cb(uint32_t old_hw_mode_index,
+			uint32_t new_hw_mode_index,
+			uint32_t num_vdev_mac_entries,
+			 struct sir_vdev_mac_map *vdev_mac_map);
 #endif /* __CDS_CONCURRENCY_H */

+ 151 - 0
core/cds/inc/cds_config.h

@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2016 The Linux Foundation. All rights reserved.
+ *
+ * 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.
+ */
+
+/**
+ * DOC: cds_config.h
+ *
+ * Defines the configuration Information for various modules. Default values
+ * are read from the INI file and saved into cds_config_info which are passed
+ * to various modules for the initialization.
+ */
+
+#if !defined(__CDS_CONFIG_H)
+#define __CDS_CONFIG_H
+
+/**
+ * enum driver_type - Indicate the driver type to the cds, and based on this
+ * do appropriate initialization.
+ *
+ * @DRIVER_TYPE_PRODUCTION: Driver used in the production
+ * @DRIVER_TYPE_MFG: Driver used in the Factory
+ *
+ */
+enum driver_type {
+	DRIVER_TYPE_PRODUCTION = 0,
+	DRIVER_TYPE_MFG = 1,
+};
+
+/**
+ * enum cfg_sub_20_channel_width: ini values for su 20 mhz channel width
+ * @WLAN_SUB_20_CH_WIDTH_5: Use 5 mhz channel width
+ * @WLAN_SUB_20_CH_WIDTH_10: Use 10 mhz channel width
+ */
+enum cfg_sub_20_channel_width {
+	WLAN_SUB_20_CH_WIDTH_NONE = 0,
+	WLAN_SUB_20_CH_WIDTH_5 = 1,
+	WLAN_SUB_20_CH_WIDTH_10 = 2,
+};
+
+/**
+ * struct cds_config_info - Place Holder for cds configuration
+ * @max_station: Max station supported
+ * @max_bssid: Max Bssid Supported
+ * @frame_xln_reqd: frame transmission required
+ * @powersave_offload_enabled: Indicate if powersave offload is enabled
+ * @sta_maxlimod_dtim: station max listen interval
+ * @sta_mod_dtim: station mode DTIM
+ * @sta_dynamic_dtim: station dynamic DTIM
+ * @driver_type: Enumeration of Driver Type whether FTM or Mission mode
+ * @max_wow_filters: Max wow filters to be configured to fw
+ * @wow_enable: Indicate whether wow is enabled or not
+ * @ol_ini_info: Status of offload enabled from ini 1st bit for arm,2nd for NS
+ * currently rest of bits are not used
+ * @ssdp: Indicate ssdp is enabled or not
+ * @enable_mc_list : To Check if Multicast list filtering is enabled in FW
+ * @dfs_phyerr_filter_offload: DFS Phyerror Filtering offload status from ini
+ * Indicates whether support is enabled or not
+ * @ap_disable_intrabss_fwd: pass intra-bss-fwd info to txrx module
+ * @ap_maxoffload_peers: max offload peer
+ * @ap_maxoffload_reorderbuffs: max offload reorder buffs
+ * @ra_ratelimit_interval: RA rate limit value
+ * @is_ra_ratelimit_enabled: Indicate RA rate limit enabled or not
+ * @reorder_offload: is RX re-ordering offloaded to the fw
+ * @dfs_pri_multiplier: dfs radar pri multiplier
+ * @uc_offload_enabled: IPA Micro controller data path offload enable flag
+ * @uc_txbuf_count: IPA Micro controller data path offload TX buffer count
+ * @uc_txbuf_size: IPA Micro controller data path offload TX buffer size
+ * @uc_rxind_ringcount: IPA Micro controller data path offload RX indication
+ * ring count
+ * @uc_tx_partition_base: IPA Micro controller datapath offload TX partition
+ * base
+ * @enable_rxthread: Rx processing in thread from TXRX
+ * @ip_tcp_udp_checksum_offload: checksum offload enabled or not
+ * @ce_classify_enabled: CE based classification enabled
+ * @max_scan: Maximum number of parallel scans
+ * @tx_flow_stop_queue_th: Threshold to stop queue in percentage
+ * @tx_flow_start_queue_offset: Start queue offset in percentage
+ * @is_lpass_enabled: Indicate whether LPASS is enabled or not
+ * @is_nan_enabled: Indicate whether NAN is enabled or not
+ * @bool bpf_packet_filter_enable; Indicate bpf filter enabled or not
+ * @tx_chain_mask_cck: Tx chain mask enabled or not
+ * @self_gen_frm_pwr: Self gen from power
+ * @sub_20_channel_width: Sub 20 MHz ch width, ini intersected with fw cap
+ * @flow_steering_enabled: Receive flow steering.
+ * Structure for holding cds ini parameters.
+ */
+
+struct cds_config_info {
+	uint16_t max_station;
+	uint16_t max_bssid;
+	uint32_t frame_xln_reqd;
+	uint8_t powersave_offload_enabled;
+	uint8_t sta_maxlimod_dtim;
+	uint8_t sta_mod_dtim;
+	uint8_t sta_dynamic_dtim;
+	enum driver_type driver_type;
+	uint8_t max_wow_filters;
+	uint8_t wow_enable;
+	uint8_t ol_ini_info;
+	bool ssdp;
+	bool enable_mc_list;
+	uint8_t dfs_phyerr_filter_offload;
+	uint8_t ap_disable_intrabss_fwd;
+	uint8_t ap_maxoffload_peers;
+	uint8_t ap_maxoffload_reorderbuffs;
+#ifdef FEATURE_WLAN_RA_FILTERING
+	uint16_t ra_ratelimit_interval;
+	bool is_ra_ratelimit_enabled;
+#endif
+	uint8_t reorder_offload;
+	int32_t dfs_pri_multiplier;
+	uint8_t uc_offload_enabled;
+	uint32_t uc_txbuf_count;
+	uint32_t uc_txbuf_size;
+	uint32_t uc_rxind_ringcount;
+	uint32_t uc_tx_partition_base;
+	bool enable_rxthread;
+	bool ip_tcp_udp_checksum_offload;
+	bool ce_classify_enabled;
+	uint8_t max_scan;
+#ifdef QCA_LL_TX_FLOW_CONTROL_V2
+	uint32_t tx_flow_stop_queue_th;
+	uint32_t tx_flow_start_queue_offset;
+#endif
+#ifdef WLAN_FEATURE_LPSS
+	bool is_lpass_enabled;
+#endif
+#ifdef WLAN_FEATURE_NAN
+	bool is_nan_enabled;
+#endif
+	bool bpf_packet_filter_enable;
+	bool tx_chain_mask_cck;
+	uint16_t self_gen_frm_pwr;
+	enum cfg_sub_20_channel_width sub_20_channel_width;
+	bool flow_steering_enabled;
+};
+#endif /* !defined( __CDS_CONFIG_H ) */

+ 28 - 38
core/cds/inc/cds_mq.h

@@ -105,44 +105,34 @@ typedef enum {
 
 } CDS_MQ_ID;
 
-/**---------------------------------------------------------------------------
-
-   \brief cds_mq_post_message() - post a message to a message queue
-
-   This API allows messages to be posted to a specific message queue.  Messages
-   can be posted to the following message queues:
-
-   <ul>
-    <li> SME
-    <li> PE
-    <li> HAL
-    <li> TL
-   </ul>
-
-   \param msgQueueId - identifies the message queue upon which the message
-   will be posted.
-
-   \param message - a pointer to a message buffer.  Memory for this message
-   buffer is allocated by the caller and free'd by the QDF after the
-   message is posted to the message queue.  If the consumer of the
-   message needs anything in this message, it needs to copy the contents
-   before returning from the message queue handler.
-
-   \return QDF_STATUS_SUCCESS - the message has been successfully posted
-   to the message queue.
-
-   QDF_STATUS_E_INVAL - The value specified by msgQueueId does not
-   refer to a valid Message Queue Id.
-
-   QDF_STATUS_E_FAULT  - message is an invalid pointer.
-
-   QDF_STATUS_E_FAILURE - the message queue handler has reported
-   an unknown failure.
-
-   \sa
-
-   --------------------------------------------------------------------------*/
-QDF_STATUS cds_mq_post_message(CDS_MQ_ID msgQueueId, cds_msg_t *message);
+#define HIGH_PRIORITY 1
+#define LOW_PRIORITY 0
+QDF_STATUS cds_mq_post_message_by_priority(CDS_MQ_ID msg_queue_id,
+					   cds_msg_t *message,
+					   int is_high_priority);
+
+/**
+ * cds_mq_post_message() - posts a message to a message queue
+ * @msg_queue_id: Identifies the message queue upon which the message
+ *    will be posted.
+ * @message: A pointer to a message buffer. Memory for this message
+ *    buffer is allocated by the caller and free'd by the QDF after the
+ *    message is posted to the message queue.  If the consumer of the
+ *    message needs anything in this message, it needs to copy the contents
+ *    before returning from the message queue handler.
+ *
+ * Return: QDF_STATUS_SUCCESS for successful posting
+ *             QDF_STATUS_E_INVAL for invalid message queue id
+ *             QDF_STATUS_E_FAULT for invalid message pointer
+ *             QDF_STATUS_E_FAILURE for unknown failure reported by
+ *             message queue handler
+ */
+static inline QDF_STATUS cds_mq_post_message(CDS_MQ_ID msg_queue_id,
+					     cds_msg_t *message)
+{
+	return cds_mq_post_message_by_priority(msg_queue_id, message,
+						LOW_PRIORITY);
+}
 
 /**---------------------------------------------------------------------------
 

+ 22 - 2
core/cds/inc/cds_reg_service.h

@@ -343,6 +343,26 @@ struct ch_params_s {
 	uint8_t center_freq_seg1;
 };
 
+/**
+ * enum dfs_region - DFS region
+ * @DFS_UNINIT_REGION: un-initialized region
+ * @DFS_FCC_REGION: FCC region
+ * @DFS_ETSI_REGION: ETSI region
+ * @DFS_MKK_REGION: MKK region
+ * @DFS_CN_REGION: China region
+ * @DFS_KR_REGION: Korea region
+ * @DFS_UNDEF_REGION: Undefined region
+ */
+enum dfs_region {
+	DFS_UNINIT_REGION = 0,
+	DFS_FCC_REGION = 1,
+	DFS_ETSI_REGION = 2,
+	DFS_MKK_REGION = 3,
+	DFS_CN_REGION = 4,
+	DFS_KR_REGION = 5,
+	DFS_UNDEF_REGION
+};
+
 extern const struct chan_map chan_mapping[NUM_CHANNELS];
 extern struct regulatory_channel reg_channels[NUM_CHANNELS];
 
@@ -357,8 +377,8 @@ QDF_STATUS cds_get_channel_list_with_power(struct channel_power
 					   uint8_t *num_base_channels);
 
 enum channel_state cds_get_channel_state(uint32_t chan_num);
-QDF_STATUS cds_get_dfs_region(uint8_t *dfs_region);
-QDF_STATUS cds_put_dfs_region(uint8_t dfs_region);
+QDF_STATUS cds_get_dfs_region(enum dfs_region *dfs_reg);
+QDF_STATUS cds_put_dfs_region(enum dfs_region dfs_reg);
 
 bool cds_is_dsrc_channel(uint16_t center_freq);
 enum channel_state cds_get_5g_bonded_channel_state(uint16_t chan_num,

+ 4 - 15
core/cds/inc/cds_regdomain.h

@@ -77,7 +77,7 @@
 #define COUNTRY_ERD_FLAG        0x8000
 #define WORLDWIDE_ROAMING_FLAG  0x4000
 #define MIN_TX_PWR_CAP    8
-#define MAX_TX_PWR_CAP    22
+#define MAX_TX_PWR_CAP    30
 
 enum country_code {
 	CTRY_AFGHANISTAN = 4,
@@ -189,6 +189,7 @@ enum country_code {
 	CTRY_MONGOLIA = 496,
 	CTRY_MONTENEGRO = 499,
 	CTRY_MOROCCO = 504,
+	CTRY_NAMIBIA = 516,
 	CTRY_NEPAL = 524,
 	CTRY_NETHERLANDS = 528,
 	CTRY_NETHERLANDS_ANTILLES = 530,
@@ -355,6 +356,7 @@ enum reg_domain {
 	APL11_FCCA = 0x4F,
 	APL12_WORLD = 0x51,
 	APL13_WORLD = 0x5A,
+	APL14_WORLD = 0x57,
 
 	WOR0_WORLD = 0x60,
 	WOR1_WORLD = 0x61,
@@ -439,6 +441,7 @@ enum reg_domain {
 	APL11 = 0x1150,
 	APL12 = 0x1160,
 	APL13 = 0x1170,
+	APL14 = 0x1180,
 
 	NULL1 = 0x0198,
 	MKK3 = 0x0340,
@@ -469,20 +472,6 @@ enum ctl_val {
 	NO_CTL = 0xff
 };
 
-/**
- * enum dfs_region - DFS region
- * @DFS_UNINIT_REGION: un-initialized region
- * @DFS_FCC_REGION: FCC region
- * @DFS_ETSI_REGION: ETSI region
- * @DFS_MKK_REGION: MKK region
- */
-enum dfs_region {
-	DFS_UNINIT_REGION = 0,
-	DFS_FCC_REGION = 1,
-	DFS_ETSI_REGION = 2,
-	DFS_MKK_REGION = 3
-};
-
 /**
  * enum offset_t: channel offset
  * @BW20: 20 mhz channel

+ 9 - 1
core/cds/inc/cds_sched.h

@@ -49,6 +49,7 @@
 #include <qdf_types.h>
 #include "qdf_lock.h"
 #include "qdf_mc_timer.h"
+#include "cds_config.h"
 
 #define TX_POST_EVENT_MASK               0x001
 #define TX_SUSPEND_EVENT_MASK            0x002
@@ -202,7 +203,7 @@ typedef struct _cds_sched_context {
 	struct notifier_block *cpu_hot_plug_notifier;
 
 	/* affinity lock */
-	spinlock_t affinity_lock;
+	struct mutex affinity_lock;
 
 	/* rx thread affinity cpu */
 	unsigned long rx_thread_cpu;
@@ -309,6 +310,8 @@ typedef struct _cds_context_type {
 	void (*sme_get_nss_for_vdev)(void*, enum tQDF_ADAPTER_MODE,
 		uint8_t *, uint8_t *);
 
+	void (*ol_txrx_update_mac_id)(uint8_t , uint8_t);
+
 	/* This list is not sessionized. This mandatory channel list would be
 	 * as per OEMs preference as per the regulatory/other considerations.
 	 * So, this would remain same for all the interfaces.
@@ -317,6 +320,9 @@ typedef struct _cds_context_type {
 	uint32_t sap_mandatory_channels_len;
 	bool do_hw_mode_change;
 	bool enable_fatal_event;
+	struct cds_config_info *cds_cfg;
+	/* WAR: Is cds disabled */
+	bool is_cds_disabled;
 } cds_context_type, *p_cds_contextType;
 
 /*---------------------------------------------------------------------------
@@ -529,6 +535,7 @@ QDF_STATUS cds_sched_close(void *p_cds_context);
 QDF_STATUS cds_mq_init(p_cds_mq_type pMq);
 void cds_mq_deinit(p_cds_mq_type pMq);
 void cds_mq_put(p_cds_mq_type pMq, p_cds_msg_wrapper pMsgWrapper);
+void cds_mq_put_front(p_cds_mq_type mq, p_cds_msg_wrapper msg_wrapper);
 p_cds_msg_wrapper cds_mq_get(p_cds_mq_type pMq);
 bool cds_is_mq_empty(p_cds_mq_type pMq);
 p_cds_sched_context get_cds_sched_ctxt(void);
@@ -537,6 +544,7 @@ void cds_sched_deinit_mqs(p_cds_sched_context pSchedContext);
 void cds_sched_flush_mc_mqs(p_cds_sched_context pSchedContext);
 
 void qdf_timer_module_init(void);
+void qdf_timer_module_deinit(void);
 void cds_ssr_protect_init(void);
 void cds_ssr_protect(const char *caller_func);
 void cds_ssr_unprotect(const char *caller_func);

+ 23 - 6
core/cds/inc/cds_utils.h

@@ -44,6 +44,7 @@
 #include <qdf_types.h>
 #include <qdf_status.h>
 #include <qdf_event.h>
+#include <qdf_lock.h>
 #include "ani_global.h"
 
 /*--------------------------------------------------------------------------
@@ -51,8 +52,6 @@
    ------------------------------------------------------------------------*/
 #define CDS_DIGEST_SHA1_SIZE    (20)
 #define CDS_DIGEST_MD5_SIZE     (16)
-#define CDS_BAND_2GHZ          (1)
-#define CDS_BAND_5GHZ          (2)
 
 #define CDS_24_GHZ_BASE_FREQ   (2407)
 #define CDS_5_GHZ_BASE_FREQ    (5000)
@@ -82,9 +81,18 @@
 		cds_logfl(QDF_TRACE_LEVEL_INFO_HIGH, format, ## args)
 #define cds_debug(format, args...) \
 		cds_logfl(QDF_TRACE_LEVEL_DEBUG, format, ## args)
-/*--------------------------------------------------------------------------
-   Type declarations
-   ------------------------------------------------------------------------*/
+
+/**
+ * enum cds_band_type - Band type - 2g, 5g or all
+ * CDS_BAND_ALL: Both 2G and 5G are valid.
+ * CDS_BAND_2GHZ: only 2G is valid.
+ * CDS_BAND_5GHZ: only 5G is valid.
+ */
+enum cds_band_type {
+	CDS_BAND_ALL = 0,
+	CDS_BAND_2GHZ = 1,
+	CDS_BAND_5GHZ = 2
+};
 
 /*-------------------------------------------------------------------------
    Function declarations and documenation
@@ -178,7 +186,7 @@ QDF_STATUS cds_decrypt_aes(uint32_t cryptHandle,        /* Handle */
 
 uint32_t cds_chan_to_freq(uint8_t chan);
 uint8_t cds_freq_to_chan(uint32_t freq);
-uint8_t cds_chan_to_band(uint32_t chan);
+enum cds_band_type cds_chan_to_band(uint32_t chan);
 #ifdef WLAN_FEATURE_11W
 bool cds_is_mmie_valid(uint8_t *key, uint8_t *ipn,
 		       uint8_t *frm, uint8_t *efrm);
@@ -187,4 +195,13 @@ bool cds_attach_mmie(uint8_t *igtk, uint8_t *ipn, uint16_t key_id,
 uint8_t cds_get_mmie_size(void);
 #endif /* WLAN_FEATURE_11W */
 QDF_STATUS sme_send_flush_logs_cmd_to_fw(tpAniSirGlobal pMac);
+static inline void cds_host_diag_log_work(qdf_wake_lock_t *lock, uint32_t msec,
+			    uint32_t reason) {
+	if (((cds_get_ring_log_level(RING_ID_WAKELOCK) >= WLAN_LOG_LEVEL_ACTIVE)
+	     && (WIFI_POWER_EVENT_WAKELOCK_HOLD_RX == reason)) ||
+	    (WIFI_POWER_EVENT_WAKELOCK_HOLD_RX != reason)) {
+		host_diag_log_wlock(reason, qdf_wake_lock_name(lock),
+				    msec, WIFI_POWER_EVENT_WAKELOCK_TAKEN);
+	}
+}
 #endif /* #if !defined __CDS_UTILS_H */

+ 268 - 156
core/cds/src/cds_api.c

@@ -117,14 +117,13 @@ void cds_deinit(void)
 	if (gp_cds_context == NULL)
 		return;
 
+	qdf_mc_timer_manager_exit();
+	qdf_mem_exit();
+
 	gp_cds_context->qdf_ctx = NULL;
 	gp_cds_context = NULL;
 
 	qdf_mem_zero(&g_cds_context, sizeof(g_cds_context));
-
-	qdf_mc_timer_manager_exit();
-	qdf_mem_exit();
-
 	return;
 }
 
@@ -158,25 +157,6 @@ void cds_tdls_tx_rx_mgmt_event(uint8_t event_id, uint8_t tx_rx,
 }
 #endif
 
-#ifdef WLAN_FEATURE_NAN
-/**
- * cds_set_nan_enable() - set nan enable flag in mac open param
- * @wma_handle: Pointer to mac open param
- * @hdd_ctx: Pointer to hdd context
- *
- * Return: none
- */
-static void cds_set_nan_enable(tMacOpenParameters *param,
-					hdd_context_t *hdd_ctx)
-{
-	param->is_nan_enabled = hdd_ctx->config->enable_nan_support;
-}
-#else
-static void cds_set_nan_enable(tMacOpenParameters *param,
-					hdd_context_t *pHddCtx)
-{
-}
-#endif
 
 /**
  * cds_open() - open the CDS Module
@@ -197,18 +177,20 @@ QDF_STATUS cds_open(void)
 	QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
 	int iter = 0;
 	tSirRetStatus sirStatus = eSIR_SUCCESS;
-	tMacOpenParameters mac_openParms;
+	struct cds_config_info *cds_cfg;
 	qdf_device_t qdf_ctx;
 	HTC_INIT_INFO htcInfo;
 	struct ol_context *ol_ctx;
 	struct hif_opaque_softc *scn;
 	void *HTCHandle;
 	hdd_context_t *pHddCtx;
+	cds_context_type *cds_ctx;
 
 	QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_INFO_HIGH,
 		  "%s: Opening CDS", __func__);
 
-	if (NULL == gp_cds_context) {
+	cds_ctx = cds_get_context(QDF_MODULE_ID_QDF);
+	if (!cds_ctx) {
 		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL,
 			  "%s: Trying to open CDS without a PreOpen", __func__);
 		QDF_ASSERT(0);
@@ -255,25 +237,27 @@ QDF_STATUS cds_open(void)
 			   &(gp_cds_context->aMsgWrappers[iter]));
 	}
 
-	/* Now Open the CDS Scheduler */
-	qdf_status = cds_sched_open(gp_cds_context, &gp_cds_context->qdf_sched,
-				    sizeof(cds_sched_context));
-
-	if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
+	pHddCtx = (hdd_context_t *) (gp_cds_context->pHDDContext);
+	if ((NULL == pHddCtx) || (NULL == pHddCtx->config)) {
 		/* Critical Error ...  Cannot proceed further */
-		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL,
-			  "%s: Failed to open CDS Scheduler", __func__);
+		cds_err("Hdd Context is Null");
 		QDF_ASSERT(0);
 		goto err_msg_queue;
 	}
+	/* Now Open the CDS Scheduler */
 
-	pHddCtx = (hdd_context_t *) (gp_cds_context->pHDDContext);
-	if ((NULL == pHddCtx) || (NULL == pHddCtx->config)) {
-		/* Critical Error ...  Cannot proceed further */
-		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL,
-			  "%s: Hdd Context is Null", __func__);
-		QDF_ASSERT(0);
-		goto err_sched_close;
+	if (pHddCtx->driver_status == DRIVER_MODULES_UNINITIALIZED) {
+		qdf_status = cds_sched_open(gp_cds_context,
+					    &gp_cds_context->qdf_sched,
+					    sizeof(cds_sched_context));
+
+		if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
+			/* Critical Error ...  Cannot proceed further */
+			QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL,
+				  "%s: Failed to open CDS Scheduler", __func__);
+			QDF_ASSERT(0);
+			goto err_msg_queue;
+		}
 	}
 
 	scn = cds_get_context(QDF_MODULE_ID_HIF);
@@ -283,7 +267,14 @@ QDF_STATUS cds_open(void)
 		goto err_sched_close;
 	}
 
-	hdd_update_config(pHddCtx);
+	cds_cfg = cds_get_ini_config();
+	if (!cds_cfg) {
+		cds_err("Cds config is NULL");
+		QDF_ASSERT(0);
+		goto err_sched_close;
+	}
+	hdd_enable_fastpath(pHddCtx->config, scn);
+	hdd_wlan_update_target_info(pHddCtx, scn);
 
 	ol_ctx = cds_get_context(QDF_MODULE_ID_BMI);
 	/* Initialize BMI and Download firmware */
@@ -293,10 +284,10 @@ QDF_STATUS cds_open(void)
 			  "BMI FIALED status:%d", qdf_status);
 		goto err_bmi_close;
 	}
-
 	htcInfo.pContext = ol_ctx;
 	htcInfo.TargetFailure = ol_target_failure;
 	htcInfo.TargetSendSuspendComplete = wma_target_suspend_acknowledge;
+	htcInfo.target_initial_wakeup_cb = wma_handle_initial_wake_up;
 	qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE);
 
 	/* Create HTC */
@@ -314,91 +305,10 @@ QDF_STATUS cds_open(void)
 		goto err_htc_close;
 	}
 
-	/*
-	** Need to open WMA first because it calls WDI_Init, which calls wpalOpen
-	** The reason that is needed becasue cds_packet_open need to use PAL APIs
-	*/
-
 	/*Open the WMA module */
-	qdf_mem_set(&mac_openParms, sizeof(mac_openParms), 0);
-	/* UMA is supported in hardware for performing the
-	** frame translation 802.11 <-> 802.3
-	*/
-	mac_openParms.frameTransRequired = 1;
-	mac_openParms.driverType = eDRIVER_TYPE_PRODUCTION;
-	mac_openParms.powersaveOffloadEnabled =
-		pHddCtx->config->enablePowersaveOffload;
-	mac_openParms.staDynamicDtim = pHddCtx->config->enableDynamicDTIM;
-	mac_openParms.staModDtim = pHddCtx->config->enableModulatedDTIM;
-	mac_openParms.staMaxLIModDtim = pHddCtx->config->fMaxLIModulatedDTIM;
-	mac_openParms.wowEnable = pHddCtx->config->wowEnable;
-	mac_openParms.maxWoWFilters = pHddCtx->config->maxWoWFilters;
-	/* Here olIniInfo is used to store ini status of arp offload
-	 * ns offload and others. Currently 1st bit is used for arp
-	 * off load and 2nd bit for ns offload currently, rest bits are unused
-	 */
-	if (pHddCtx->config->fhostArpOffload)
-		mac_openParms.olIniInfo = mac_openParms.olIniInfo | 0x1;
-	if (pHddCtx->config->fhostNSOffload)
-		mac_openParms.olIniInfo = mac_openParms.olIniInfo | 0x2;
-	/*
-	 * Copy the DFS Phyerr Filtering Offload status.
-	 * This parameter reflects the value of the
-	 * dfsPhyerrFilterOffload flag  as set in the ini.
-	 */
-	mac_openParms.dfsPhyerrFilterOffload =
-		pHddCtx->config->fDfsPhyerrFilterOffload;
-	if (pHddCtx->config->ssdp)
-		mac_openParms.ssdp = pHddCtx->config->ssdp;
-	mac_openParms.enable_mc_list = pHddCtx->config->fEnableMCAddrList;
-#ifdef FEATURE_WLAN_RA_FILTERING
-	mac_openParms.RArateLimitInterval =
-		pHddCtx->config->RArateLimitInterval;
-	mac_openParms.IsRArateLimitEnabled =
-		pHddCtx->config->IsRArateLimitEnabled;
-#endif
-
-	mac_openParms.apMaxOffloadPeers = pHddCtx->config->apMaxOffloadPeers;
-
-	mac_openParms.apMaxOffloadReorderBuffs =
-		pHddCtx->config->apMaxOffloadReorderBuffs;
-
-	mac_openParms.apDisableIntraBssFwd =
-		pHddCtx->config->apDisableIntraBssFwd;
-
-	mac_openParms.dfsRadarPriMultiplier =
-		pHddCtx->config->dfsRadarPriMultiplier;
-	mac_openParms.reorderOffload = pHddCtx->config->reorderOffloadSupport;
-
-	/* IPA micro controller data path offload resource config item */
-	mac_openParms.ucOffloadEnabled = hdd_ipa_uc_is_enabled(pHddCtx);
-	mac_openParms.ucTxBufCount = pHddCtx->config->IpaUcTxBufCount;
-	mac_openParms.ucTxBufSize = pHddCtx->config->IpaUcTxBufSize;
-	mac_openParms.ucRxIndRingCount = pHddCtx->config->IpaUcRxIndRingCount;
-	mac_openParms.ucTxPartitionBase = pHddCtx->config->IpaUcTxPartitionBase;
-	mac_openParms.max_scan = pHddCtx->config->max_scan_count;
-
-	mac_openParms.ip_tcp_udp_checksum_offload =
-			pHddCtx->config->enable_ip_tcp_udp_checksum_offload;
-	mac_openParms.enable_rxthread = pHddCtx->config->enableRxThread;
-	mac_openParms.ce_classify_enabled =
-				pHddCtx->config->ce_classify_enabled;
-
-#ifdef QCA_LL_TX_FLOW_CONTROL_V2
-	mac_openParms.tx_flow_stop_queue_th =
-				pHddCtx->config->TxFlowStopQueueThreshold;
-	mac_openParms.tx_flow_start_queue_offset =
-				pHddCtx->config->TxFlowStartQueueOffset;
-#endif
-	cds_set_nan_enable(&mac_openParms, pHddCtx);
-
-	mac_openParms.tx_chain_mask_cck = pHddCtx->config->tx_chain_mask_cck;
-	mac_openParms.self_gen_frm_pwr = pHddCtx->config->self_gen_frm_pwr;
-	mac_openParms.maxStation = pHddCtx->config->maxNumberOfPeers;
-
 	qdf_status = wma_open(gp_cds_context,
 			      hdd_update_tgt_cfg,
-			      hdd_dfs_indicate_radar, &mac_openParms);
+			      hdd_dfs_indicate_radar, cds_cfg);
 
 	if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
 		/* Critical Error ...  Cannot proceed further */
@@ -410,10 +320,10 @@ QDF_STATUS cds_open(void)
 
 	/* Number of peers limit differs in each chip version. If peer max
 	 * limit configured in ini exceeds more than supported, WMA adjusts
-	 * and keeps correct limit in mac_openParms.maxStation. So, make sure
+	 * and keeps correct limit in cds_cfg.max_station. So, make sure
 	 * config entry pHddCtx->config->maxNumberOfPeers has adjusted value
 	 */
-	pHddCtx->config->maxNumberOfPeers = mac_openParms.maxStation;
+	pHddCtx->config->maxNumberOfPeers = cds_cfg->max_station;
 	HTCHandle = cds_get_context(QDF_MODULE_ID_HTC);
 	if (!HTCHandle) {
 		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL,
@@ -431,11 +341,11 @@ QDF_STATUS cds_open(void)
 	/* UMA is supported in hardware for performing the
 	 * frame translation 802.11 <-> 802.3
 	 */
-	mac_openParms.frameTransRequired = 1;
+	cds_cfg->frame_xln_reqd = 1;
 
 	sirStatus =
-		mac_open(&(gp_cds_context->pMACContext), gp_cds_context->pHDDContext,
-			 &mac_openParms);
+		mac_open(&(gp_cds_context->pMACContext),
+			gp_cds_context->pHDDContext, cds_cfg);
 
 	if (eSIR_SUCCESS != sirStatus) {
 		/* Critical Error ...  Cannot proceed further */
@@ -467,6 +377,8 @@ QDF_STATUS cds_open(void)
 		goto err_sme_close;
 	}
 
+	gp_cds_context->ol_txrx_update_mac_id = ol_txrx_update_mac_id;
+
 	QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_INFO_HIGH,
 		  "%s: CDS successfully Opened", __func__);
 
@@ -549,8 +461,11 @@ QDF_STATUS cds_pre_enable(v_CONTEXT_t cds_context)
 	}
 
 	/* call Packetlog connect service */
-	htt_pkt_log_init(gp_cds_context->pdev_txrx_ctx, scn);
-	pktlog_htc_attach();
+	if (QDF_GLOBAL_FTM_MODE != cds_get_conparam() &&
+	    QDF_GLOBAL_EPPING_MODE != cds_get_conparam()) {
+		htt_pkt_log_init(gp_cds_context->pdev_txrx_ctx, scn);
+		pktlog_htc_attach();
+	}
 
 	/* Reset wma wait event */
 	qdf_event_reset(&gp_cds_context->wmaCompleteEvent);
@@ -748,18 +663,12 @@ err_wma_stop:
 QDF_STATUS cds_disable(v_CONTEXT_t cds_context)
 {
 	QDF_STATUS qdf_status;
-
-	/* wma_stop is called before the SYS so that the processing of target
-	 * pending responses will not be handled during uninitialization of
-	 * WLAN driver
-	 */
-	qdf_event_reset(&(gp_cds_context->wmaCompleteEvent));
+	void *handle;
 
 	qdf_status = wma_stop(cds_context, HAL_STOP_TYPE_RF_KILL);
 
 	if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
-		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
-			  "%s: Failed to stop wma", __func__);
+		cds_err("Failed to stop wma");
 		QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status));
 		wma_setneedshutdown(cds_context);
 	}
@@ -767,15 +676,25 @@ QDF_STATUS cds_disable(v_CONTEXT_t cds_context)
 	hif_disable_isr(((cds_context_type *) cds_context)->pHIFContext);
 	hif_reset_soc(((cds_context_type *) cds_context)->pHIFContext);
 
-	/* SYS STOP will stop SME and MAC */
-	qdf_status = sys_stop(cds_context);
+	handle = cds_get_context(QDF_MODULE_ID_PE);
+	if (!handle) {
+		cds_err("Invalid PE context return!");
+		return QDF_STATUS_E_INVAL;
+	}
+	qdf_status = sme_stop(handle, HAL_STOP_TYPE_SYS_DEEP_SLEEP);
 	if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
-		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
-			  "%s: Failed to stop SYS", __func__);
+		cds_err("Failed to stop SME: %d", qdf_status);
 		QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status));
 	}
+	qdf_status = mac_stop(handle, HAL_STOP_TYPE_SYS_DEEP_SLEEP);
 
-	return QDF_STATUS_SUCCESS;
+	if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
+		cds_err("Failed to stop MAC");
+		QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status));
+	}
+
+	gp_cds_context->is_cds_disabled = 1;
+	return qdf_status;
 }
 
 /**
@@ -787,6 +706,40 @@ QDF_STATUS cds_disable(v_CONTEXT_t cds_context)
 QDF_STATUS cds_close(v_CONTEXT_t cds_context)
 {
 	QDF_STATUS qdf_status;
+	tp_wma_handle wma_handle;
+
+	wma_handle = cds_get_context(QDF_MODULE_ID_WMA);
+	if (!wma_handle) {
+		cds_err("Failed to get wma_handle!");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	/*
+	 * With new state machine changes cds_close can be invoked without
+	 * cds_disable. So, send the following clean up prerequisites to fw,
+	 * So Fw and host are in sync for cleanup indication:
+	 * - Send PDEV_SUSPEND indication to firmware
+	 * - Disable HIF Interrupts.
+	 * - Clean up CE tasklets.
+	 */
+
+	if (!gp_cds_context->is_cds_disabled) {
+		cds_info("send denint sequence to firmware");
+		if (!cds_is_driver_recovering()) {
+#ifdef HIF_USB
+			/* Suspend the target and enable interrupt */
+			if (wma_suspend_target(wma_handle, 0))
+				cds_err("Failed to suspend target");
+#else
+			/* Suspend the target and disable interrupt */
+			if (wma_suspend_target(wma_handle, 1))
+				cds_err("Failed to suspend target");
+#endif /* HIF_USB */
+		}
+		hif_disable_isr(
+			((cds_context_type *) cds_context)->pHIFContext);
+		hif_reset_soc(((cds_context_type *) cds_context)->pHIFContext);
+	}
 
 	qdf_status = wma_wmi_work_close(cds_context);
 	if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
@@ -857,12 +810,29 @@ QDF_STATUS cds_close(v_CONTEXT_t cds_context)
 	}
 
 	cds_deinit_log_completion();
+	cds_deinit_ini_config();
+	qdf_timer_module_deinit();
 
-	gp_cds_context->pHDDContext = NULL;
-
+	gp_cds_context->is_cds_disabled = 0;
 	return QDF_STATUS_SUCCESS;
 }
 
+void cds_flush_cache_rx_queue(void)
+{
+	uint8_t sta_id;
+	struct ol_txrx_peer_t *peer;
+	struct ol_txrx_pdev_t *pdev = cds_get_context(QDF_MODULE_ID_TXRX);
+
+	for (sta_id = 0; sta_id < WLAN_MAX_STA_COUNT; sta_id++) {
+		peer = ol_txrx_peer_find_by_local_id(pdev, sta_id);
+		if (!peer)
+			continue;
+		ol_txrx_flush_rx_frames(peer, 1);
+	}
+	return;
+}
+
+
 /**
  * cds_get_context() - get context data area
  *
@@ -1276,18 +1246,21 @@ QDF_STATUS cds_free_context(void *p_cds_context, QDF_MODULE_ID moduleID,
 } /* cds_free_context() */
 
 /**
- * cds_mq_post_message() - post a message to a message queue
- * @msgQueueId: identifies the message queue upon which the message
- *	will be posted.
- * @message: a pointer to a message buffer. Memory for this message
- *	buffer is allocated by the caller and free'd by the QDF after the
- *	message is posted to the message queue.  If the consumer of the
- *	message needs anything in this message, it needs to copy the contents
- *	before returning from the message queue handler.
+ * cds_mq_post_message_by_priority() - posts message using priority
+ * to message queue
+ * @msgQueueId: message queue id
+ * @pMsg: message to be posted
+ * @is_high_priority: wheather message is high priority
  *
- * Return: QDF status
+ * This function is used to post high priority message to message queue
+ *
+ * Return: QDF_STATUS_SUCCESS on success
+ *         QDF_STATUS_E_FAILURE on failure
+ *         QDF_STATUS_E_RESOURCES on resource allocation failure
  */
-QDF_STATUS cds_mq_post_message(CDS_MQ_ID msgQueueId, cds_msg_t *pMsg)
+QDF_STATUS cds_mq_post_message_by_priority(CDS_MQ_ID msgQueueId,
+					   cds_msg_t *pMsg,
+					   int is_high_priority)
 {
 	p_cds_mq_type pTargetMq = NULL;
 	p_cds_msg_wrapper pMsgWrapper = NULL;
@@ -1371,7 +1344,10 @@ QDF_STATUS cds_mq_post_message(CDS_MQ_ID msgQueueId, cds_msg_t *pMsg)
 	qdf_mem_copy((void *)pMsgWrapper->pVosMsg,
 		     (void *)pMsg, sizeof(cds_msg_t));
 
-	cds_mq_put(pTargetMq, pMsgWrapper);
+	if (is_high_priority)
+		cds_mq_put_front(pTargetMq, pMsgWrapper);
+	else
+		cds_mq_put(pTargetMq, pMsgWrapper);
 
 	set_bit(MC_POST_EVENT_MASK, &gp_cds_context->qdf_sched.mcEventFlag);
 	wake_up_interruptible(&gp_cds_context->qdf_sched.mcWaitQueue);
@@ -2237,3 +2213,139 @@ QDF_STATUS cds_set_radio_index(int radio_index)
 
 	return QDF_STATUS_SUCCESS;
 }
+
+/**
+ * cds_init_ini_config() - API to initialize CDS configuration parameters
+ * @cfg: CDS Configuration
+ *
+ * Return: void
+ */
+
+void cds_init_ini_config(struct cds_config_info *cfg)
+{
+	cds_context_type *cds_ctx;
+
+	cds_ctx = cds_get_context(QDF_MODULE_ID_QDF);
+	if (!cds_ctx) {
+		cds_err("Invalid CDS Context");
+		return;
+	}
+
+	cds_ctx->cds_cfg = cfg;
+}
+
+/**
+ * cds_deinit_ini_config() - API to free CDS configuration parameters
+ *
+ * Return: void
+ */
+void cds_deinit_ini_config(void)
+{
+	cds_context_type *cds_ctx;
+
+	cds_ctx = cds_get_context(QDF_MODULE_ID_QDF);
+	if (!cds_ctx) {
+		cds_err("Invalid CDS Context");
+		return;
+	}
+
+	if (cds_ctx->cds_cfg)
+		qdf_mem_free(cds_ctx->cds_cfg);
+
+	cds_ctx->cds_cfg = NULL;
+}
+
+/**
+ * cds_get_ini_config() - API to get CDS configuration parameters
+ *
+ * Return: cds config structure
+ */
+struct cds_config_info *cds_get_ini_config(void)
+{
+	cds_context_type *cds_ctx;
+
+	cds_ctx = cds_get_context(QDF_MODULE_ID_QDF);
+	if (!cds_ctx) {
+		cds_err("Invalid CDS Context");
+		return NULL;
+	}
+
+	return cds_ctx->cds_cfg;
+}
+
+/**
+ * cds_is_5_mhz_enabled() - API to get 5MHZ enabled
+ *
+ * Return: true if 5 mhz is enabled, false otherwise
+ */
+bool cds_is_5_mhz_enabled(void)
+{
+	p_cds_contextType p_cds_context;
+
+	p_cds_context = cds_get_context(QDF_MODULE_ID_QDF);
+	if (!p_cds_context) {
+		cds_err("%s: cds context is invalid", __func__);
+		return false;
+	}
+
+	if (p_cds_context->cds_cfg)
+		return (p_cds_context->cds_cfg->sub_20_channel_width ==
+						WLAN_SUB_20_CH_WIDTH_5);
+
+	return false;
+}
+
+/**
+ * cds_is_10_mhz_enabled() - API to get 10-MHZ enabled
+ *
+ * Return: true if 10 mhz is enabled, false otherwise
+ */
+bool cds_is_10_mhz_enabled(void)
+{
+	p_cds_contextType p_cds_context;
+
+	p_cds_context = cds_get_context(QDF_MODULE_ID_QDF);
+	if (!p_cds_context) {
+		cds_err("%s: cds context is invalid", __func__);
+		return false;
+	}
+
+	if (p_cds_context->cds_cfg)
+		return (p_cds_context->cds_cfg->sub_20_channel_width ==
+						WLAN_SUB_20_CH_WIDTH_10);
+
+	return false;
+}
+
+/**
+ * cds_is_sub_20_mhz_enabled() - API to get sub 20-MHZ enabled
+ *
+ * Return: true if 5 or 10 mhz is enabled, false otherwise
+ */
+bool cds_is_sub_20_mhz_enabled(void)
+{
+	p_cds_contextType p_cds_context;
+
+	p_cds_context = cds_get_context(QDF_MODULE_ID_QDF);
+	if (!p_cds_context) {
+		cds_err("%s: cds context is invalid", __func__);
+		return false;
+	}
+
+	if (p_cds_context->cds_cfg)
+		return p_cds_context->cds_cfg->sub_20_channel_width;
+
+	return false;
+}
+
+/**
+ * cds_svc_fw_shutdown_ind() - API to send userspace about FW crash
+ *
+ * @dev: Device Pointer
+ *
+ * Return: None
+ */
+void cds_svc_fw_shutdown_ind(struct device *dev)
+{
+	hdd_svc_fw_shutdown_ind(dev);
+}

+ 506 - 270
core/cds/src/cds_concurrency.c

@@ -1950,6 +1950,27 @@ next_action_three_connection_table[CDS_MAX_TWO_CONNECTION_MODE]
 
 };
 
+/**
+ * cds_get_connection_count() - provides the count of
+ * current connections
+ *
+ * This function provides the count of current connections
+ *
+ * Return: connection count
+ */
+uint32_t cds_get_connection_count(void)
+{
+	uint32_t conn_index, count = 0;
+
+	for (conn_index = 0; conn_index < MAX_NUMBER_OF_CONC_CONNECTIONS;
+		 conn_index++) {
+		if (conc_connection_list[conn_index].in_use)
+			count++;
+	}
+
+	return count;
+}
+
 /**
  * cds_is_sta_connection_pending() - This function will check if sta connection
  *                                   is pending or not.
@@ -2108,6 +2129,14 @@ static void cds_update_conc_list(uint32_t conn_index,
 		uint32_t vdev_id,
 		bool in_use)
 {
+	cds_context_type *cds_ctx;
+
+	cds_ctx = cds_get_context(QDF_MODULE_ID_QDF);
+	if (!cds_ctx) {
+		cds_err("Invalid CDS Context");
+		return;
+	}
+
 	if (conn_index >= MAX_NUMBER_OF_CONC_CONNECTIONS) {
 		cds_err("Number of connections exceeded conn_index: %d",
 			conn_index);
@@ -2123,6 +2152,9 @@ static void cds_update_conc_list(uint32_t conn_index,
 	conc_connection_list[conn_index].in_use = in_use;
 
 	cds_dump_connection_status_info();
+	if (cds_ctx->ol_txrx_update_mac_id)
+		cds_ctx->ol_txrx_update_mac_id(vdev_id, mac);
+
 }
 
 /**
@@ -2136,7 +2168,7 @@ static void cds_update_conc_list(uint32_t conn_index,
  *
  * Return: connection count of specific type
  */
-static uint32_t cds_mode_specific_connection_count(enum cds_con_mode mode,
+uint32_t cds_mode_specific_connection_count(enum cds_con_mode mode,
 						uint32_t *list)
 {
 	uint32_t conn_index = 0, count = 0;
@@ -2480,10 +2512,10 @@ static void cds_pdev_set_hw_mode_cb(uint32_t status,
  *
  * Return: None
  */
-static void cds_hw_mode_transition_cb(uint32_t old_hw_mode_index,
-				 uint32_t new_hw_mode_index,
-				 uint32_t num_vdev_mac_entries,
-				 struct sir_vdev_mac_map *vdev_mac_map)
+void cds_hw_mode_transition_cb(uint32_t old_hw_mode_index,
+			uint32_t new_hw_mode_index,
+			uint32_t num_vdev_mac_entries,
+			struct sir_vdev_mac_map *vdev_mac_map)
 {
 	QDF_STATUS status;
 	struct sir_hw_mode_params hw_mode;
@@ -2572,6 +2604,19 @@ QDF_STATUS cds_pdev_set_hw_mode(uint32_t session_id,
 		return QDF_STATUS_E_FAILURE;
 	}
 
+	/*
+	 * if HW is not capable of doing 2x2 or ini config disabled 2x2, don't
+	 * allow to request FW for 2x2
+	 */
+	if ((HW_MODE_SS_2x2 == mac0_ss) && (!hdd_ctx->config->enable2x2)) {
+		cds_info("2x2 is not allowed downgrading to 1x1 for mac0");
+		mac0_ss = HW_MODE_SS_1x1;
+	}
+	if ((HW_MODE_SS_2x2 == mac1_ss) && (!hdd_ctx->config->enable2x2)) {
+		cds_info("2x2 is not allowed downgrading to 1x1 for mac1");
+		mac1_ss = HW_MODE_SS_1x1;
+	}
+
 	hw_mode_index = wma_get_hw_mode_idx_from_dbs_hw_list(mac0_ss,
 			mac0_bw, mac1_ss, mac1_bw, dbs, dfs);
 	if (hw_mode_index < 0) {
@@ -3295,6 +3340,34 @@ void cds_dump_concurrency_info(void)
 	hdd_ctx->mcc_mode = !cds_current_concurrency_is_scc();
 }
 
+/*
+ * cds_check_is_tdls_allowed() - check is tdls allowed or not
+ * @adapter: pointer to adapter
+ *
+ * Function determines the whether TDLS allowed in the system
+ *
+ * Return: true or false
+ */
+bool cds_check_is_tdls_allowed(enum tQDF_ADAPTER_MODE device_mode)
+{
+	bool state = false;
+	uint32_t count;
+
+	count = cds_get_connection_count();
+
+	if (count > 1)
+		state = false;
+	else if (device_mode == QDF_STA_MODE ||
+		 device_mode == QDF_P2P_CLIENT_MODE)
+		state = true;
+
+	/* If any concurrency is detected */
+	if (!state)
+		cds_dump_concurrency_info();
+
+	return state;
+}
+
 /**
  * cds_set_tdls_ct_mode() - Set the tdls connection tracker mode
  * @hdd_ctx: hdd context
@@ -3308,17 +3381,34 @@ void cds_set_tdls_ct_mode(hdd_context_t *hdd_ctx)
 	bool state = false;
 
 	/* If any concurrency is detected, skip tdls pkt tracker */
-	if (((1 << QDF_STA_MODE) == hdd_ctx->concurrency_mode) &&
-	    (hdd_ctx->no_of_active_sessions[QDF_STA_MODE] == 1) &&
-	    (hdd_ctx->config->fEnableTDLSImplicitTrigger) &&
-	    (eTDLS_SUPPORT_DISABLED != hdd_ctx->tdls_mode)) {
-		if (hdd_ctx->config->fTDLSExternalControl) {
-			if (hdd_ctx->tdls_external_peer_count)
-				state = true;
-			goto set_state;
-		} else {
+	if (cds_get_connection_count() > 1) {
+		state = false;
+		goto set_state;
+	}
+
+	if (eTDLS_SUPPORT_DISABLED == hdd_ctx->tdls_mode ||
+	    (!hdd_ctx->config->fEnableTDLSImplicitTrigger)) {
+		state = false;
+		goto set_state;
+	} else if (cds_mode_specific_connection_count(QDF_STA_MODE,
+						      NULL) == 1) {
+		state = true;
+	} else if (cds_mode_specific_connection_count(QDF_P2P_CLIENT_MODE,
+						      NULL) == 1){
+		state = true;
+	} else {
+		state = false;
+		goto set_state;
+	}
+
+	/* In case of TDLS external control, peer should be added
+	 * by the user space to start connection tracker.
+	 */
+	if (hdd_ctx->config->fTDLSExternalControl) {
+		if (hdd_ctx->tdls_external_peer_count)
 			state = true;
-		}
+		else
+			state = false;
 	}
 
 set_state:
@@ -3518,8 +3608,6 @@ void cds_incr_active_session(enum tQDF_ADAPTER_MODE mode,
 		break;
 	}
 
-	/* set tdls connection tracker state */
-	cds_set_tdls_ct_mode(hdd_ctx);
 
 	cds_info("No.# of active sessions for mode %d = %d",
 		mode, hdd_ctx->no_of_active_sessions[mode]);
@@ -3535,6 +3623,10 @@ void cds_incr_active_session(enum tQDF_ADAPTER_MODE mode,
 		cds_info("Set PCL of STA to FW");
 	}
 	cds_incr_connection_count(session_id);
+
+	/* set tdls connection tracker state */
+	cds_set_tdls_ct_mode(hdd_ctx);
+
 	qdf_mutex_release(&cds_ctx->qdf_conc_list_lock);
 }
 
@@ -3584,7 +3676,7 @@ enum cds_conc_next_action cds_need_opportunistic_upgrade(void)
 	/* Is there any connection had an initial connection with 2x2 */
 	for (conn_index = 0; conn_index < MAX_NUMBER_OF_CONC_CONNECTIONS;
 		conn_index++) {
-		if ((conc_connection_list[conn_index].original_nss == 1) &&
+		if ((conc_connection_list[conn_index].original_nss == 2) &&
 			conc_connection_list[conn_index].in_use) {
 			upgrade = CDS_SINGLE_MAC_UPGRADE;
 			goto done;
@@ -3786,13 +3878,14 @@ void cds_decr_active_session(enum tQDF_ADAPTER_MODE mode,
 		break;
 	}
 
-	/* set tdls connection tracker state */
-	cds_set_tdls_ct_mode(hdd_ctx);
-
 	cds_info("No.# of active sessions for mode %d = %d",
 		mode, hdd_ctx->no_of_active_sessions[mode]);
 
 	cds_decr_connection_count(session_id);
+
+	/* set tdls connection tracker state */
+	cds_set_tdls_ct_mode(hdd_ctx);
+
 	qdf_mutex_release(&cds_ctx->qdf_conc_list_lock);
 }
 
@@ -3849,6 +3942,13 @@ QDF_STATUS cds_deinit_policy_mgr(void)
 		cds_err("Invalid CDS Context");
 		return QDF_STATUS_E_FAILURE;
 	}
+
+	if (!QDF_IS_STATUS_SUCCESS(qdf_event_destroy
+				  (&cds_ctx->connection_update_done_evt))) {
+		cds_err("Failed to destroy connection_update_done_evt");
+		return QDF_STATUS_E_FAILURE;
+	}
+
 	if (!QDF_IS_STATUS_SUCCESS(qdf_mutex_destroy(
 					&cds_ctx->qdf_conc_list_lock))) {
 		cds_err("Failed to destroy qdf_conc_list_lock");
@@ -3969,27 +4069,6 @@ uint32_t cds_get_connection_for_vdev_id(uint32_t vdev_id)
 	return conn_index;
 }
 
-
-/**
- * cds_get_connection_count() - provides the count of
- * current connections
- *
- *
- * This function provides the count of current connections
- *
- * Return: connection count
- */
-uint32_t cds_get_connection_count(void)
-{
-	uint32_t conn_index, count = 0;
-	for (conn_index = 0; conn_index < MAX_NUMBER_OF_CONC_CONNECTIONS;
-		 conn_index++) {
-		if (conc_connection_list[conn_index].in_use)
-			count++;
-	}
-	return count;
-}
-
 /**
  * cds_get_mode() - Get mode from type and subtype
  * @type: type
@@ -4871,6 +4950,36 @@ bool cds_map_concurrency_mode(enum tQDF_ADAPTER_MODE *old_mode,
 	return status;
 }
 
+/**
+ * cds_get_channel() - provide channel number of given mode and vdevid
+ * @mode: given CDS mode
+ * @vdev_id: pointer to vdev_id
+ *
+ * This API will provide channel number of matching mode and vdevid.
+ * If vdev_id is NULL then it will match only mode
+ * If vdev_id is not NULL the it will match both mode and vdev_id
+ *
+ * Return: channel number
+ */
+uint8_t cds_get_channel(enum cds_con_mode mode, uint32_t *vdev_id)
+{
+	uint32_t idx = 0;
+
+	if (mode >= CDS_MAX_NUM_OF_MODE) {
+		cds_err("incorrect mode");
+		return 0;
+	}
+
+	for (idx = 0; idx < MAX_NUMBER_OF_CONC_CONNECTIONS; idx++) {
+		if ((conc_connection_list[idx].mode == mode) &&
+				(!vdev_id || (*vdev_id ==
+					conc_connection_list[idx].vdev_id))
+				&& conc_connection_list[idx].in_use)
+			return conc_connection_list[idx].chan;
+	}
+	return 0;
+}
+
 /**
  * cds_get_pcl() - provides the preferred channel list for
  * new connection
@@ -5197,6 +5306,12 @@ bool cds_allow_concurrency(enum cds_con_mode mode,
 	/* find the current connection state from conc_connection_list*/
 	num_connections = cds_get_connection_count();
 
+	if (num_connections && cds_is_sub_20_mhz_enabled()) {
+		/* dont allow concurrency if Sub 20 MHz is enabled */
+		status = false;
+		goto done;
+	}
+
 	if (cds_max_concurrent_connections_reached()) {
 		cds_err("Reached max concurrent connections: %d",
 			hdd_ctx->config->gMaxConcurrentActiveSessions);
@@ -5268,10 +5383,13 @@ bool cds_allow_concurrency(enum cds_con_mode mode,
 		}
 	}
 
-	/* don't allow IBSS + STA MCC */
-	/* don't allow IBSS + STA SCC if IBSS is on DFS channel */
-	count = cds_mode_specific_connection_count(
-			CDS_STA_MODE, list);
+	/*
+	 * Check all IBSS+STA concurrencies
+	 *
+	 * don't allow IBSS + STA MCC
+	 * don't allow IBSS + STA SCC if IBSS is on DFS channel
+	 */
+	count = cds_mode_specific_connection_count(CDS_STA_MODE, list);
 	if ((CDS_IBSS_MODE == mode) &&
 		(cds_mode_specific_connection_count(
 		CDS_IBSS_MODE, list)) && count) {
@@ -5310,7 +5428,7 @@ bool cds_allow_concurrency(enum cds_con_mode mode,
 			goto done;
 		}
 	}
-	count = cds_mode_specific_connection_count(CDS_STA_MODE, list);
+
 	if ((CDS_STA_MODE == mode) &&
 		(cds_mode_specific_connection_count(
 		CDS_IBSS_MODE, list)) && count) {
@@ -5348,18 +5466,6 @@ bool cds_allow_concurrency(enum cds_con_mode mode,
 		}
 	}
 
-	/* don't allow concurrency on vht160 or vht 80+80 */
-	if (num_connections &&
-		((bw == HW_MODE_80_PLUS_80_MHZ) || (bw == HW_MODE_160_MHZ))) {
-		cds_err("No VHT160, we have one connection already");
-		goto done;
-	}
-
-	if (cds_vht160_conn_exist()) {
-		cds_err("VHT160/80+80 connection exists, no concurrency");
-		goto done;
-	}
-
 	/* don't allow two P2P GO on same band */
 	if (channel && (mode == CDS_P2P_GO_MODE) && num_connections) {
 		index = 0;
@@ -5375,6 +5481,20 @@ bool cds_allow_concurrency(enum cds_con_mode mode,
 		}
 	}
 
+	/* don't allow concurrency on vht160 or vht 80+80 */
+	if (num_connections &&
+			((bw == HW_MODE_80_PLUS_80_MHZ) ||
+				(bw == HW_MODE_160_MHZ))) {
+		cds_err("No VHT160, we have one connection already");
+		goto done;
+	}
+
+	if (cds_vht160_conn_exist()) {
+		cds_err("VHT160/80+80 connection exists, no concurrency");
+		goto done;
+	}
+
+
 	status = true;
 
 done:
@@ -5978,62 +6098,6 @@ done:
 	return status;
 }
 
-/**
- * cds_wait_for_nss_update() - finds out if we need to wait
- * for all nss update to finish before requesting for HW mode
- * update
- * @action: next action to happen at policy mgr after
- *		beacon update
- *
- * This function finds out if we need to wait
- * for all nss update to finish before requesting for HW mode
- * update
- *
- * Return: boolean. True = wait for nss update, False = go ahead
- * with HW mode update
- */
-bool cds_wait_for_nss_update(uint8_t action)
-{
-	uint32_t conn_index = 0;
-	bool wait = false;
-	if (CDS_DBS == action) {
-		for (conn_index = 0;
-			conn_index < MAX_NUMBER_OF_CONC_CONNECTIONS;
-			conn_index++) {
-			if ((conc_connection_list
-				[conn_index].original_nss == 2) &&
-				(conc_connection_list
-				[conn_index].chain_mask == CDS_TWO_TWO) &&
-				conc_connection_list[conn_index].in_use &&
-				((conc_connection_list[conn_index].mode ==
-				CDS_P2P_GO_MODE) ||
-				(conc_connection_list[conn_index].mode ==
-				CDS_SAP_MODE))) {
-				wait = true;
-				break;
-			}
-		}
-	} else if (CDS_SINGLE_MAC == action) {
-		for (conn_index = 0;
-			conn_index < MAX_NUMBER_OF_CONC_CONNECTIONS;
-			conn_index++) {
-			if ((conc_connection_list
-				[conn_index].original_nss == 2) &&
-				(conc_connection_list
-				[conn_index].chain_mask == CDS_TWO_TWO) &&
-				conc_connection_list[conn_index].in_use &&
-				((conc_connection_list[conn_index].mode ==
-				CDS_P2P_GO_MODE) ||
-				(conc_connection_list[conn_index].mode ==
-				CDS_SAP_MODE))) {
-				wait = true;
-				break;
-			}
-		}
-	}
-	return wait;
-}
-
 /**
  * cds_nss_update_cb() - callback from SME confirming nss
  * update
@@ -6056,12 +6120,9 @@ void cds_nss_update_cb(void *context, uint8_t tx_status, uint8_t vdev_id,
 {
 	cds_context_type *cds_ctx;
 	uint32_t conn_index = 0;
-	bool wait = true;
 
-	if (QDF_STATUS_E_FAILURE == tx_status) {
-		cds_err("nss update failed for vdev %d", vdev_id);
-		return;
-	}
+	if (QDF_STATUS_SUCCESS != tx_status)
+		cds_err("nss update failed(%d) for vdev %d", tx_status, vdev_id);
 
 	cds_ctx = cds_get_context(QDF_MODULE_ID_QDF);
 	if (!cds_ctx) {
@@ -6079,24 +6140,9 @@ void cds_nss_update_cb(void *context, uint8_t tx_status, uint8_t vdev_id,
 		cds_err("connection not found for vdev %d", vdev_id);
 		return;
 	}
-	switch (next_action) {
-	case CDS_DBS:
-		wait = cds_wait_for_nss_update(next_action);
-		break;
-	case CDS_SINGLE_MAC:
-		wait = cds_wait_for_nss_update(next_action);
-		break;
-	default:
-		cds_err("unexpected action %d", next_action);
-		break;
-	}
-
-	cds_debug("vdev:%d wait:%d", vdev_id, wait);
 
-	if (!wait)
-		cds_next_actions(vdev_id,
-				next_action,
-				reason);
+	cds_debug("nss update successful for vdev:%d", vdev_id);
+	cds_next_actions(vdev_id, next_action, reason);
 	qdf_mutex_release(&cds_ctx->qdf_conc_list_lock);
 	return;
 }
@@ -6154,7 +6200,7 @@ QDF_STATUS cds_complete_action(uint8_t  new_nss, uint8_t next_action,
 			continue;
 		}
 
-		if (1 == conc_connection_list[list[index]].original_nss) {
+		if (2 == conc_connection_list[list[index]].original_nss) {
 			status = sme_nss_update_request(hdd_ctx->hHal,
 					conc_connection_list
 					[list[index]].vdev_id, new_nss,
@@ -6177,7 +6223,7 @@ QDF_STATUS cds_complete_action(uint8_t  new_nss, uint8_t next_action,
 				conc_connection_list[list[index]].vdev_id);
 			continue;
 		}
-		if (1 == conc_connection_list[list[index]].original_nss) {
+		if (2 == conc_connection_list[list[index]].original_nss) {
 			status = sme_nss_update_request(hdd_ctx->hHal,
 					conc_connection_list
 					[list[index]].vdev_id, new_nss,
@@ -6229,14 +6275,11 @@ QDF_STATUS cds_next_actions(uint32_t session_id,
 		return status;
 	}
 	/**
-	 *  if already in DBS no need to request DBS or if already in
-	 *  non dbs no need request for non dbs again. Might be needed
+	 *  if already in DBS no need to request DBS. Might be needed
 	 *  to extend the logic when multiple dbs HW mode is available
 	 */
 	if ((((CDS_DBS_DOWNGRADE == action) || (CDS_DBS == action))
-		&& hw_mode.dbs_cap) ||
-		(((CDS_SINGLE_MAC_UPGRADE == action) ||
-		(CDS_SINGLE_MAC == action)) && !hw_mode.dbs_cap)) {
+		&& hw_mode.dbs_cap)) {
 		cds_err("driver is already in %s mode, no further action needed",
 				(hw_mode.dbs_cap) ? "dbs" : "non dbs");
 		return QDF_STATUS_E_ALREADY;
@@ -6262,6 +6305,16 @@ QDF_STATUS cds_next_actions(uint32_t session_id,
 						reason);
 		break;
 	case CDS_SINGLE_MAC_UPGRADE:
+		/*
+		 * change the HW mode first before the NSS upgrade
+		 */
+		status = cds_pdev_set_hw_mode(session_id,
+						HW_MODE_SS_2x2,
+						HW_MODE_80_MHZ,
+						HW_MODE_SS_0x0, HW_MODE_BW_NONE,
+						HW_MODE_DBS_NONE,
+						HW_MODE_AGILE_DFS_NONE,
+						reason);
 		/*
 		* check if we have a beaconing entity that advertised 2x2
 		* intially. If yes, update the beacon template & notify FW.
@@ -6987,17 +7040,18 @@ static void cds_check_sta_ap_concurrent_ch_intf(void *data)
 	}
 
 }
+
 /**
  * cds_check_concurrent_intf_and_restart_sap() - Check concurrent change intf
- * @hdd_sta_ctx: Pointer to HDD STA context
+ * @adapter: Pointer to HDD adapter
  *
  * Checks the concurrent change interface and restarts SAP
  * Return: None
  */
-void cds_check_concurrent_intf_and_restart_sap(hdd_station_ctx_t *hdd_sta_ctx,
-		hdd_adapter_t *adapter)
+void cds_check_concurrent_intf_and_restart_sap(hdd_adapter_t *adapter)
 {
 	hdd_context_t *hdd_ctx;
+	hdd_station_ctx_t *hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
 
 	hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
 	if (!hdd_ctx) {
@@ -7207,8 +7261,7 @@ int32_t cds_set_mcc_p2p_quota(hdd_adapter_t *hostapd_adapater,
 		uint32_t set_value)
 {
 	uint8_t first_adapter_operating_channel = 0;
-	uint8_t second_adapter_opertaing_channel = 0;
-	hdd_adapter_t *sta_adapter = NULL;
+	uint8_t second_adapter_operating_channel = 0;
 	int32_t ret = 0; /* success */
 
 	uint32_t concurrent_state = cds_get_concurrency_mode();
@@ -7247,63 +7300,32 @@ int32_t cds_set_mcc_p2p_quota(hdd_adapter_t *hostapd_adapater,
 		 */
 		set_value = set_value | first_adapter_operating_channel;
 		/* Find out the 2nd MCC adapter and its operating channel */
-		if (hostapd_adapater->device_mode == QDF_STA_MODE) {
-			/*
-			 * iwpriv cmd was issued on wlan0;
-			 * get p2p0 vdev channel
-			 */
-			if ((concurrent_state & QDF_P2P_CLIENT_MASK) != 0) {
-				/* The 2nd MCC vdev is P2P client */
-				sta_adapter = hdd_get_adapter(
-						hostapd_adapater->pHddCtx,
-						QDF_P2P_CLIENT_MODE);
-			} else {
-				/* The 2nd MCC vdev is P2P GO */
-				sta_adapter = hdd_get_adapter(
-						hostapd_adapater->pHddCtx,
-						QDF_P2P_GO_MODE);
-			}
-		} else {
-			/*
-			 * iwpriv cmd was issued on p2p0;
-			 * get wlan0 vdev channel
-			 */
-			sta_adapter = hdd_get_adapter(hostapd_adapater->pHddCtx,
-					QDF_STA_MODE);
-		}
-		if (sta_adapter != NULL) {
-			second_adapter_opertaing_channel =
-				hdd_get_operating_channel
-				(
-				 sta_adapter->pHddCtx,
-				 sta_adapter->device_mode
-				);
-			cds_info("2nd vdev channel No. is:%d",
-				second_adapter_opertaing_channel);
-
-			if (second_adapter_opertaing_channel == 0 ||
-					first_adapter_operating_channel == 0) {
-				cds_err("Invalid channel");
-				return -EINVAL;
-			}
-			/*
-			 * Now move the time quota and channel number of the
-			 * 1st adapter to bits 23-16 and bits 15-8 of the bit
-			 * vector, respectively.
-			 */
-			set_value = set_value << 8;
-			/*
-			 * Store the channel number for 2nd MCC vdev at bits
-			 * 7-0 of set_value
-			 */
-			set_value = set_value |
-				second_adapter_opertaing_channel;
-			ret = wma_cli_set_command(hostapd_adapater->sessionId,
-					WMA_VDEV_MCC_SET_TIME_QUOTA,
-					set_value, VDEV_CMD);
-		} else {
-			cds_err("NULL adapter handle. Exit");
+		second_adapter_operating_channel =
+			cds_get_mcc_operating_channel(
+					hostapd_adapater->sessionId);
+
+		cds_info("2nd vdev channel No. is:%d",
+			 second_adapter_operating_channel);
+
+		if (second_adapter_operating_channel == 0 ||
+		    first_adapter_operating_channel == 0) {
+			cds_err("Invalid channel");
+			return -EINVAL;
 		}
+		/*
+		 * Now move the time quota and channel number of the
+		 * 1st adapter to bits 23-16 and bits 15-8 of the bit
+		 * vector, respectively.
+		 */
+		set_value = set_value << 8;
+		/*
+		 * Store the channel number for 2nd MCC vdev at bits
+		 * 7-0 of set_value
+		 */
+		set_value = set_value | second_adapter_operating_channel;
+		ret = wma_cli_set_command(hostapd_adapater->sessionId,
+				WMA_VDEV_MCC_SET_TIME_QUOTA,
+				set_value, VDEV_CMD);
 	} else {
 		cds_info("MCC is not active. Exit w/o setting latency");
 	}
@@ -7357,9 +7379,8 @@ int32_t cds_go_set_mcc_p2p_quota(hdd_adapter_t *hostapd_adapter,
 		uint32_t set_value)
 {
 	uint8_t first_adapter_operating_channel = 0;
-	uint8_t second_adapter_opertaing_channel = 0;
+	uint8_t second_adapter_operating_channel = 0;
 	uint32_t concurrent_state = 0;
-	hdd_adapter_t *sta_adapter = NULL;
 	int32_t ret = 0; /* success */
 
 	/*
@@ -7398,66 +7419,36 @@ int32_t cds_go_set_mcc_p2p_quota(hdd_adapter_t *hostapd_adapter,
 		 * the lower 8-bits of bit vector.
 		 */
 		set_value = set_value | first_adapter_operating_channel;
-		if (hostapd_adapter->device_mode ==
-				QDF_STA_MODE) {
-			/* iwpriv cmd issued on wlan0; get p2p0 vdev chan */
-			if ((concurrent_state & QDF_P2P_CLIENT_MASK) != 0) {
-				/* The 2nd MCC vdev is P2P client */
-				sta_adapter = hdd_get_adapter
-					(
-					 hostapd_adapter->pHddCtx,
-					 QDF_P2P_CLIENT_MODE
-					);
-			} else {
-				/* The 2nd MCC vdev is P2P GO */
-				sta_adapter = hdd_get_adapter
-					(
-					 hostapd_adapter->pHddCtx,
-					 QDF_P2P_GO_MODE
-					);
-			}
-		} else {
-			/* iwpriv cmd issued on p2p0; get channel for wlan0 */
-			sta_adapter = hdd_get_adapter
-				(
-				 hostapd_adapter->pHddCtx,
-				 QDF_STA_MODE
-				);
-		}
-		if (sta_adapter != NULL) {
-			second_adapter_opertaing_channel =
-				hdd_get_operating_channel
-				(
-				 sta_adapter->pHddCtx,
-				 sta_adapter->device_mode
-				);
-			cds_info("2nd vdev channel No. is:%d",
-				second_adapter_opertaing_channel);
-
-			if (second_adapter_opertaing_channel == 0 ||
-					first_adapter_operating_channel == 0) {
-				cds_err("Invalid channel");
-				return -EINVAL;
-			}
 
-			/*
-			 * Move the time quota and operating channel number
-			 * for the first adapter to bits 23-16 & bits 15-8
-			 * of set_value vector, respectively.
-			 */
-			set_value = set_value << 8;
-			/*
-			 * Store the channel number for 2nd MCC vdev at bits
-			 * 7-0 of set_value vector as per the bit format above.
-			 */
-			set_value = set_value |
-				second_adapter_opertaing_channel;
-			ret = wma_cli_set_command(hostapd_adapter->sessionId,
-					WMA_VDEV_MCC_SET_TIME_QUOTA,
-					set_value, VDEV_CMD);
-		} else {
-			cds_err("NULL adapter handle. Exit");
+		/* Find out the 2nd MCC adapter and its operating channel */
+		second_adapter_operating_channel =
+			cds_get_mcc_operating_channel(
+					hostapd_adapter->sessionId);
+
+		cds_info("2nd vdev channel No. is:%d",
+			 second_adapter_operating_channel);
+
+		if (second_adapter_operating_channel == 0 ||
+		    first_adapter_operating_channel == 0) {
+			cds_err("Invalid channel");
+			return -EINVAL;
 		}
+
+		/*
+		 * Move the time quota and operating channel number
+		 * for the first adapter to bits 23-16 & bits 15-8
+		 * of set_value vector, respectively.
+		 */
+		set_value = set_value << 8;
+		/*
+		 * Store the channel number for 2nd MCC vdev at bits
+		 * 7-0 of set_value vector as per the bit format above.
+		 */
+		set_value = set_value |
+			second_adapter_operating_channel;
+		ret = wma_cli_set_command(hostapd_adapter->sessionId,
+				WMA_VDEV_MCC_SET_TIME_QUOTA,
+				set_value, VDEV_CMD);
 	} else {
 		cds_info("MCC is not active. Exit w/o setting latency");
 	}
@@ -8206,13 +8197,17 @@ enum cds_conc_next_action cds_get_current_pref_hw_mode(void)
 }
 
 /**
- * cds_stop_start_opportunistic_timer() - Start and stop the opportunistic timer
+ * cds_restart_opportunistic_timer() - Restarts opportunistic timer
+ * @check_state: check timer state if this flag is set, else restart
+ *               irrespective of state
  *
- * Stops and starts the opportunistic timer for DBS_OPPORTUNISTIC_TIME seconds
+ * Restarts opportunistic timer for DBS_OPPORTUNISTIC_TIME seconds.
+ * Check if current state is RUNNING if check_state is set, else
+ * restart the timer irrespective of state.
  *
  * Return: QDF_STATUS
  */
-QDF_STATUS cds_stop_start_opportunistic_timer(void)
+QDF_STATUS cds_restart_opportunistic_timer(bool check_state)
 {
 	QDF_STATUS status = QDF_STATUS_E_FAILURE;
 	p_cds_contextType cds_ctx;
@@ -8223,6 +8218,11 @@ QDF_STATUS cds_stop_start_opportunistic_timer(void)
 		return status;
 	}
 
+	if (check_state &&
+			QDF_TIMER_STATE_RUNNING !=
+			cds_ctx->dbs_opportunistic_timer.state)
+		return status;
+
 	qdf_mc_timer_stop(&cds_ctx->dbs_opportunistic_timer);
 
 	status = qdf_mc_timer_start(
@@ -8262,6 +8262,29 @@ QDF_STATUS cds_register_sap_restart_channel_switch_cb(
 	cds_ctx->sap_restart_chan_switch_cb = sap_restart_chan_switch_cb;
 	return QDF_STATUS_SUCCESS;
 }
+
+/**
+ * cds_deregister_sap_restart_channel_switch_cb() - De-Register callback for SAP
+ * channel switch without restart
+ *
+ * De Registers callback to perform channel switch
+ *
+ * Return: QDF_STATUS Enumeration
+ */
+QDF_STATUS cds_deregister_sap_restart_channel_switch_cb(void)
+{
+	p_cds_contextType cds_ctx;
+
+	cds_ctx = cds_get_global_context();
+	if (!cds_ctx) {
+		cds_err("Invalid CDS context");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	cds_ctx->sap_restart_chan_switch_cb = NULL;
+	return QDF_STATUS_SUCCESS;
+}
+
 #endif
 
 
@@ -8713,6 +8736,14 @@ QDF_STATUS cds_get_sap_mandatory_channel(uint32_t *chan)
 QDF_STATUS cds_get_valid_chan_weights(struct sir_pcl_chan_weights *weight)
 {
 	uint32_t i, j;
+	cds_context_type *cds_ctx;
+	struct cds_conc_connection_info info;
+
+	cds_ctx = cds_get_context(QDF_MODULE_ID_QDF);
+	if (!cds_ctx) {
+		cds_err("Invalid CDS Context");
+		return QDF_STATUS_E_FAILURE;
+	}
 
 	if (!weight->pcl_list) {
 		cds_err("Invalid pcl");
@@ -8729,8 +8760,39 @@ QDF_STATUS cds_get_valid_chan_weights(struct sir_pcl_chan_weights *weight)
 		return QDF_STATUS_E_FAILURE;
 	}
 
+	qdf_mem_set(weight->weighed_valid_list, QDF_MAX_NUM_CHAN,
+		    WEIGHT_OF_DISALLOWED_CHANNELS);
+
+	qdf_mutex_acquire(&cds_ctx->qdf_conc_list_lock);
+	if (cds_mode_specific_connection_count(CDS_STA_MODE, NULL) > 0) {
+		/*
+		 * Store the STA mode's parameter and temporarily delete it
+		 * from the concurrency table. This way the allow concurrency
+		 * check can be used as though a new connection is coming up,
+		 * allowing to detect the disallowed channels.
+		 */
+		cds_store_and_del_conn_info(CDS_STA_MODE, &info);
+		qdf_mutex_release(&cds_ctx->qdf_conc_list_lock);
+		/*
+		 * There is a small window between releasing the above lock
+		 * and acquiring the same in cds_allow_concurrency, below!
+		 */
+		for (i = 0; i < weight->saved_num_chan; i++) {
+			if (cds_allow_concurrency(CDS_STA_MODE,
+						  weight->saved_chan_list[i],
+						  HW_MODE_20_MHZ)) {
+				weight->weighed_valid_list[i] =
+					WEIGHT_OF_NON_PCL_CHANNELS;
+			}
+		}
+
+		qdf_mutex_acquire(&cds_ctx->qdf_conc_list_lock);
+		/* Restore the connection info */
+		cds_restore_deleted_conn_info(&info);
+	}
+	qdf_mutex_release(&cds_ctx->qdf_conc_list_lock);
+
 	for (i = 0; i < weight->saved_num_chan; i++) {
-		weight->weighed_valid_list[i] = WEIGHT_OF_NON_PCL_CHANNELS;
 		for (j = 0; j < weight->pcl_len; j++) {
 			if (weight->saved_chan_list[i] == weight->pcl_list[j]) {
 				weight->weighed_valid_list[i] =
@@ -8797,7 +8859,7 @@ QDF_STATUS cds_set_hw_mode_on_channel_switch(uint8_t session_id)
 	 * as well.
 	 */
 	if (action == CDS_SINGLE_MAC_UPGRADE) {
-		qdf_status = cds_stop_start_opportunistic_timer();
+		qdf_status = cds_restart_opportunistic_timer(false);
 		if (QDF_IS_STATUS_SUCCESS(qdf_status))
 			cds_info("opportunistic timer for MCC upgrade");
 		goto done;
@@ -8849,6 +8911,180 @@ void cds_dump_connection_status_info(void)
 	}
 }
 
+/**
+ * cds_is_any_mode_active_on_band_along_with_session() - Check if any connection
+ * mode is active on a band along with the given session
+ * @session_id: Session along which active sessions are looked for
+ * @band: Operating frequency band of the connection
+ * CDS_BAND_24: Looks for active connection on 2.4 GHz only
+ * CDS_BAND_5: Looks for active connection on 5 GHz only
+ *
+ * Checks if any of the connection mode is active on a given frequency band
+ *
+ * Return: True if any connection is active on a given band, false otherwise
+ */
+bool cds_is_any_mode_active_on_band_along_with_session(uint8_t session_id,
+						       enum cds_band band)
+{
+	cds_context_type *cds_ctx;
+	uint32_t i;
+	bool status = false;
+
+	cds_ctx = cds_get_context(QDF_MODULE_ID_QDF);
+	if (!cds_ctx) {
+		cds_err("Invalid CDS Context");
+		status = false;
+		goto send_status;
+	}
+
+	qdf_mutex_acquire(&cds_ctx->qdf_conc_list_lock);
+	for (i = 0; i < MAX_NUMBER_OF_CONC_CONNECTIONS; i++) {
+		switch (band) {
+		case CDS_BAND_24:
+			if ((conc_connection_list[i].vdev_id != session_id) &&
+			    (conc_connection_list[i].in_use) &&
+			    (CDS_IS_CHANNEL_24GHZ(
+			    conc_connection_list[i].chan))) {
+				status = true;
+				goto release_mutex_and_send_status;
+			}
+			break;
+		case CDS_BAND_5:
+			if ((conc_connection_list[i].vdev_id != session_id) &&
+			    (conc_connection_list[i].in_use) &&
+			    (CDS_IS_CHANNEL_5GHZ(
+			    conc_connection_list[i].chan))) {
+				status = true;
+				goto release_mutex_and_send_status;
+			}
+			break;
+		default:
+			cds_err("Invalid band option:%d", band);
+			status = false;
+			goto release_mutex_and_send_status;
+		}
+	}
+release_mutex_and_send_status:
+	qdf_mutex_release(&cds_ctx->qdf_conc_list_lock);
+send_status:
+	return status;
+}
+
+/**
+ * cds_get_mac_id_by_session_id() - Get MAC ID for a given session ID
+ * @session_id: Session ID
+ * @mac_id: Pointer to the MAC ID
+ *
+ * Gets the MAC ID for a given session ID
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS cds_get_mac_id_by_session_id(uint8_t session_id, uint8_t *mac_id)
+{
+	cds_context_type *cds_ctx;
+	uint32_t i;
+
+	cds_ctx = cds_get_context(QDF_MODULE_ID_QDF);
+	if (!cds_ctx) {
+		cds_err("Invalid CDS Context");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	qdf_mutex_acquire(&cds_ctx->qdf_conc_list_lock);
+	for (i = 0; i < MAX_NUMBER_OF_CONC_CONNECTIONS; i++) {
+		if ((conc_connection_list[i].vdev_id == session_id) &&
+		    (conc_connection_list[i].in_use)) {
+			*mac_id = conc_connection_list[i].mac;
+			qdf_mutex_release(&cds_ctx->qdf_conc_list_lock);
+			return QDF_STATUS_SUCCESS;
+		}
+	}
+	qdf_mutex_release(&cds_ctx->qdf_conc_list_lock);
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ * cds_get_mcc_session_id_on_mac() - Get MCC session's ID
+ * @mac_id: MAC ID on which MCC session needs to be found
+ * @session_id: Session with which MCC combination needs to be found
+ * @mcc_session_id: Pointer to the MCC session ID
+ *
+ * Get the session ID of the MCC interface
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS cds_get_mcc_session_id_on_mac(uint8_t mac_id, uint8_t session_id,
+					uint8_t *mcc_session_id)
+{
+	cds_context_type *cds_ctx;
+	uint32_t i;
+	uint8_t chan = conc_connection_list[session_id].chan;
+
+	cds_ctx = cds_get_context(QDF_MODULE_ID_QDF);
+	if (!cds_ctx) {
+		cds_err("Invalid CDS Context");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	qdf_mutex_acquire(&cds_ctx->qdf_conc_list_lock);
+	for (i = 0; i < MAX_NUMBER_OF_CONC_CONNECTIONS; i++) {
+		if (conc_connection_list[i].mac != mac_id)
+			continue;
+		if (conc_connection_list[i].vdev_id == session_id)
+			continue;
+		/* Inter band or intra band MCC */
+		if ((conc_connection_list[i].chan != chan) &&
+		    (conc_connection_list[i].in_use)) {
+			*mcc_session_id = conc_connection_list[i].vdev_id;
+			qdf_mutex_release(&cds_ctx->qdf_conc_list_lock);
+			return QDF_STATUS_SUCCESS;
+		}
+	}
+	qdf_mutex_release(&cds_ctx->qdf_conc_list_lock);
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ * cds_get_mcc_operating_channel() - Get the MCC channel
+ * @session_id: Session ID with which MCC is being done
+ *
+ * Gets the MCC channel for a given session ID.
+ *
+ * Return: '0' (INVALID_CHANNEL_ID) or valid channel number
+ */
+uint8_t cds_get_mcc_operating_channel(uint8_t session_id)
+{
+	uint8_t mac_id, mcc_session_id;
+	QDF_STATUS status;
+	uint8_t chan;
+	cds_context_type *cds_ctx;
+
+	cds_ctx = cds_get_context(QDF_MODULE_ID_QDF);
+	if (!cds_ctx) {
+		cds_err("Invalid CDS Context");
+		return INVALID_CHANNEL_ID;
+	}
+
+	status = cds_get_mac_id_by_session_id(session_id, &mac_id);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		hdd_err("failed to get MAC ID");
+		return INVALID_CHANNEL_ID;
+	}
+
+	status = cds_get_mcc_session_id_on_mac(mac_id, session_id,
+			&mcc_session_id);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		hdd_err("failed to get MCC session ID");
+		return INVALID_CHANNEL_ID;
+	}
+
+	qdf_mutex_acquire(&cds_ctx->qdf_conc_list_lock);
+	chan = conc_connection_list[mcc_session_id].chan;
+	qdf_mutex_release(&cds_ctx->qdf_conc_list_lock);
+
+	return chan;
+}
+
 /**
  * cds_set_do_hw_mode_change_flag() - Set flag to indicate hw mode change
  * @flag: Indicate if hw mode change is required or not

+ 24 - 0
core/cds/src/cds_mq.c

@@ -117,6 +117,30 @@ inline void cds_mq_put(p_cds_mq_type pMq, p_cds_msg_wrapper pMsgWrapper)
 
 } /* cds_mq_put() */
 
+/**
+ * cds_mq_put_front() - adds a message to the head of message queue
+ * @mq: message queue
+ * @msg_wrapper: message wrapper
+ *
+ * This function is used to add a message to the head of message queue
+ *
+ * Return: None
+ */
+void cds_mq_put_front(p_cds_mq_type mq, p_cds_msg_wrapper msg_wrapper)
+{
+	unsigned long flags;
+
+	if ((mq == NULL) || (msg_wrapper == NULL)) {
+		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
+			"%s: NULL pointer passed", __func__);
+		return;
+	}
+
+	spin_lock_irqsave(&mq->mqLock, flags);
+	list_add(&msg_wrapper->msgNode, &mq->mqList);
+	spin_unlock_irqrestore(&mq->mqLock, flags);
+}
+
 /**
  * cds_mq_get() - get a message with its wrapper from a message queue
  * @pMq: Pointer to the message queue

+ 4 - 3
core/cds/src/cds_reg_service.c

@@ -40,6 +40,7 @@
 #include "cds_reg_service.h"
 #include "cds_regdomain.h"
 
+
 const struct chan_map chan_mapping[NUM_CHANNELS] = {
 	[CHAN_ENUM_1] = {2412, 1},
 	[CHAN_ENUM_2] = {2417, 2},
@@ -152,7 +153,7 @@ static const enum phy_ch_width next_lower_bw[] = {
 
 struct regulatory_channel reg_channels[NUM_CHANNELS];
 static uint8_t default_country[CDS_COUNTRY_CODE_LEN + 1];
-static uint8_t dfs_region;
+static enum dfs_region dfs_region;
 
 /**
  * cds_get_channel_list_with_power() - retrieve channel list with power
@@ -580,7 +581,7 @@ void cds_set_channel_params(uint16_t oper_ch, uint16_t sec_ch_2g,
  *
  * Return: QDF_STATUS
  */
-QDF_STATUS cds_get_dfs_region(uint8_t *dfs_reg)
+QDF_STATUS cds_get_dfs_region(enum dfs_region *dfs_reg)
 {
 	*dfs_reg = dfs_region;
 
@@ -670,7 +671,7 @@ QDF_STATUS cds_set_reg_domain(void *client_ctxt, v_REGDOMAIN_t reg_domain)
  *
  * Return: QDF_STATUS
  */
-QDF_STATUS cds_put_dfs_region(uint8_t dfs_reg)
+QDF_STATUS cds_put_dfs_region(enum dfs_region dfs_reg)
 {
 	dfs_region = dfs_reg;
 

+ 11 - 8
core/cds/src/cds_regdomain.c

@@ -187,6 +187,7 @@ static const struct reg_dmn_pair g_reg_dmn_pairs[] = {
 	{APL1_ETSIC, APL1, ETSIC, CTRY_DEFAULT},
 	{APL6_WORLD, APL6, WORLD, CTRY_DEFAULT},
 	{APL7_FCCA, APL7, FCCA, CTRY_DEFAULT},
+	{APL8_WORLD, APL8, WORLD, CTRY_DEFAULT},
 	{APL9_WORLD, APL9, WORLD, CTRY_DEFAULT},
 	{APL10_WORLD, APL10, WORLD, CTRY_DEFAULT},
 	{APL12_WORLD, APL12, WORLD, CTRY_DEFAULT},
@@ -312,6 +313,7 @@ static const struct country_code_to_reg_dmn g_all_countries[] = {
 	{CTRY_MONGOLIA, FCC3_WORLD, "MN", "MONGOLIA"},
 	{CTRY_MONTENEGRO, ETSI1_WORLD, "ME", "MONTENEGRO"},
 	{CTRY_MOROCCO, ETSI3_WORLD, "MA", "MOROCCO"},
+	{CTRY_NAMIBIA, APL10_WORLD, "NA", "NAMIBIA"},
 	{CTRY_NEPAL, APL6_WORLD, "NP", "NEPAL"},
 	{CTRY_NETHERLANDS, ETSI1_WORLD, "NL", "NETHERLANDS"},
 	{CTRY_NETHERLANDS_ANTILLES, ETSI1_WORLD, "AN", "NETHERLANDS ANTILLES"},
@@ -321,7 +323,7 @@ static const struct country_code_to_reg_dmn g_all_countries[] = {
 	{CTRY_NICARAGUA, FCC3_FCCA, "NI", "NICARAGUA"},
 	{CTRY_NORWAY, ETSI1_WORLD, "NO", "NORWAY"},
 	{CTRY_OMAN, ETSI1_WORLD, "OM", "OMAN"},
-	{CTRY_PAKISTAN, APL1_WORLD, "PK", "PAKISTAN"},
+	{CTRY_PAKISTAN, APL1_ETSIC, "PK", "PAKISTAN"},
 	{CTRY_PALAU, FCC3_FCCA, "PW", "PALAU"},
 	{CTRY_PANAMA, FCC1_FCCA, "PA", "PANAMA"},
 	{CTRY_PAPUA_NEW_GUINEA, FCC3_WORLD, "PG", "PAPUA NEW GUINEA"},
@@ -368,7 +370,7 @@ static const struct country_code_to_reg_dmn g_all_countries[] = {
 	{CTRY_UKRAINE, ETSI9_WORLD, "UA", "UKRAINE"},
 	{CTRY_UAE, FCC3_WORLD, "AE", "UNITED ARAB EMIRATES"},
 	{CTRY_UNITED_KINGDOM, ETSI1_WORLD, "GB", "UNITED KINGDOM"},
-	{CTRY_UNITED_STATES, FCC8_FCCA, "US", "UNITED STATES"},
+	{CTRY_UNITED_STATES, FCC3_FCCA, "US", "UNITED STATES"},
 	{CTRY_UNITED_STATES_PS, FCC4_FCCA, "PS", "US PUBLIC SAFETY"},
 	{CTRY_URUGUAY, FCC2_WORLD, "UY", "URUGUAY"},
 	{CTRY_UZBEKISTAN, ETSI3_WORLD, "UZ", "UZBEKISTAN"},
@@ -418,6 +420,7 @@ static const struct reg_dmn g_reg_dmns[] = {
 	{APL11, ETSI},
 	{APL12, ETSI},
 	{APL13, ETSI},
+	{APL14, FCC},
 	{NULL1, NO_CTL},
 	{MKK3, MKK},
 	{MKK4, MKK},
@@ -816,11 +819,11 @@ uint16_t cds_reg_dmn_get_chanwidth_from_opclass(uint8_t *country,
 	const struct reg_dmn_op_class_map_t *class;
 	uint16_t i;
 
-	if (true != qdf_mem_cmp(country, "US", 2))
+	if (!qdf_mem_cmp(country, "US", 2))
 		class = us_op_class;
-	else if (true != qdf_mem_cmp(country, "EU", 2))
+	else if (!qdf_mem_cmp(country, "EU", 2))
 		class = euro_op_class;
-	else if (true != qdf_mem_cmp(country, "JP", 2))
+	else if (!qdf_mem_cmp(country, "JP", 2))
 		class = japan_op_class;
 	else
 		class = global_op_class;
@@ -856,11 +859,11 @@ uint16_t cds_reg_dmn_get_opclass_from_channel(uint8_t *country, uint8_t channel,
 	const struct reg_dmn_op_class_map_t *class = NULL;
 	uint16_t i = 0;
 
-	if (true != qdf_mem_cmp(country, "US", 2)) {
+	if (!qdf_mem_cmp(country, "US", 2)) {
 		class = us_op_class;
-	} else if (true != qdf_mem_cmp(country, "EU", 2)) {
+	} else if (!qdf_mem_cmp(country, "EU", 2)) {
 		class = euro_op_class;
-	} else if (true != qdf_mem_cmp(country, "JP", 2)) {
+	} else if (!qdf_mem_cmp(country, "JP", 2)) {
 		class = japan_op_class;
 	} else {
 		class = global_op_class;

+ 8 - 7
core/cds/src/cds_sched.c

@@ -270,15 +270,15 @@ int cds_sched_handle_cpu_hot_plug(void)
 	if (cds_is_load_or_unload_in_progress())
 		return 0;
 
-	spin_lock_bh(&pSchedContext->affinity_lock);
+	mutex_lock(&pSchedContext->affinity_lock);
 	if (cds_sched_find_attach_cpu(pSchedContext,
 		pSchedContext->high_throughput_required)) {
 		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
 			"%s: handle hot plug fail", __func__);
-		spin_unlock_bh(&pSchedContext->affinity_lock);
+		mutex_unlock(&pSchedContext->affinity_lock);
 		return 1;
 	}
-	spin_unlock_bh(&pSchedContext->affinity_lock);
+	mutex_unlock(&pSchedContext->affinity_lock);
 	return 0;
 }
 
@@ -308,15 +308,15 @@ int cds_sched_handle_throughput_req(bool high_tput_required)
 		return 0;
 	}
 
-	spin_lock_bh(&pSchedContext->affinity_lock);
+	mutex_lock(&pSchedContext->affinity_lock);
 	pSchedContext->high_throughput_required = high_tput_required;
 	if (cds_sched_find_attach_cpu(pSchedContext, high_tput_required)) {
 		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
 			"%s: handle throughput req fail", __func__);
-		spin_unlock_bh(&pSchedContext->affinity_lock);
+		mutex_unlock(&pSchedContext->affinity_lock);
 		return 1;
 	}
-	spin_unlock_bh(&pSchedContext->affinity_lock);
+	mutex_unlock(&pSchedContext->affinity_lock);
 	return 0;
 }
 
@@ -510,7 +510,7 @@ QDF_STATUS cds_sched_open(void *p_cds_context,
 	}
 	register_hotcpu_notifier(&cds_cpu_hotplug_notifier);
 	pSchedContext->cpu_hot_plug_notifier = &cds_cpu_hotplug_notifier;
-	spin_lock_init(&pSchedContext->affinity_lock);
+	mutex_init(&pSchedContext->affinity_lock);
 	pSchedContext->high_throughput_required = false;
 #endif
 	gp_cds_sched_context = pSchedContext;
@@ -1176,6 +1176,7 @@ QDF_STATUS cds_sched_close(void *p_cds_context)
 	cds_drop_rxpkt_by_staid(gp_cds_sched_context, WLAN_MAX_STA_COUNT);
 	cds_free_ol_rx_pkt_freeq(gp_cds_sched_context);
 	unregister_hotcpu_notifier(&cds_cpu_hotplug_notifier);
+	gp_cds_sched_context->cpu_hot_plug_notifier = NULL;
 #endif
 	return QDF_STATUS_SUCCESS;
 } /* cds_sched_close() */

+ 3 - 3
core/cds/src/cds_utils.c

@@ -483,7 +483,7 @@ cds_is_mmie_valid(uint8_t *igtk, uint8_t *ipn, uint8_t *frm, uint8_t *efrm)
 
 	/* Validate IPN */
 	rx_ipn = mmie->sequence_number;
-	if (OS_MEMCMP(rx_ipn, ipn, CMAC_IPN_LEN) > 0) {
+	if (OS_MEMCMP(rx_ipn, ipn, CMAC_IPN_LEN) <= 0) {
 		/* Replay error */
 		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
 			  "Replay error mmie ipn %02X %02X %02X %02X %02X %02X"
@@ -546,7 +546,7 @@ cds_is_mmie_valid(uint8_t *igtk, uint8_t *ipn, uint8_t *frm, uint8_t *efrm)
 		  mic[0], mic[1], mic[2], mic[3],
 		  mic[4], mic[5], mic[6], mic[7]);
 
-	if (OS_MEMCMP(mic, mmie->mic, CMAC_TLEN) == 0) {
+	if (OS_MEMCMP(mic, mmie->mic, CMAC_TLEN) != 0) {
 		/* MMIE MIC mismatch */
 		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
 			  "BC/MC MGMT frame MMIE MIC check Failed"
@@ -1128,7 +1128,7 @@ uint8_t cds_freq_to_chan(uint32_t freq)
 	return chan;
 }
 
-uint8_t cds_chan_to_band(uint32_t chan)
+enum cds_band_type cds_chan_to_band(uint32_t chan)
 {
 	if (chan <= CDS_24_GHZ_CHANNEL_14)
 		return CDS_BAND_2GHZ;

+ 31 - 5
core/dp/htt/htt.c

@@ -50,6 +50,7 @@
 #define HTT_HTC_PKT_POOL_INIT_SIZE 100  /* enough for a large A-MPDU */
 
 QDF_STATUS(*htt_h2t_rx_ring_cfg_msg)(struct htt_pdev_t *pdev);
+QDF_STATUS(*htt_h2t_rx_ring_rfs_cfg_msg)(struct htt_pdev_t *pdev);
 
 #ifdef IPA_OFFLOAD
 A_STATUS htt_ipa_config(htt_pdev_handle pdev, A_STATUS status)
@@ -178,7 +179,7 @@ htt_htc_tx_htt2_service_start(struct htt_pdev_t *pdev,
 	/* Enable HTC schedule mechanism for TX HTT2 service. */
 	connect_req->ConnectionFlags |= HTC_CONNECT_FLAGS_ENABLE_HTC_SCHEDULE;
 
-	connect_req->ServiceID = HTT_DATA2_MSG_SVC;
+	connect_req->service_id = HTT_DATA2_MSG_SVC;
 
 	status = htc_connect_service(pdev->htc_pdev, connect_req, connect_resp);
 
@@ -425,6 +426,7 @@ htt_attach(struct htt_pdev_t *pdev, int desc_pool_size)
 					- HTT_RX_IND_HL_BYTES);
 
 		htt_h2t_rx_ring_cfg_msg = htt_h2t_rx_ring_cfg_msg_hl;
+		htt_h2t_rx_ring_rfs_cfg_msg = htt_h2t_rx_ring_rfs_cfg_msg_hl;
 
 		/* initialize the txrx credit count */
 		ol_tx_target_credit_update(
@@ -497,6 +499,7 @@ htt_attach(struct htt_pdev_t *pdev, int desc_pool_size)
 		pdev->rx_fw_desc_offset = RX_STD_DESC_FW_MSDU_OFFSET;
 
 		htt_h2t_rx_ring_cfg_msg = htt_h2t_rx_ring_cfg_msg_ll;
+		htt_h2t_rx_ring_rfs_cfg_msg = htt_h2t_rx_ring_rfs_cfg_msg_ll;
 	}
 
 	return 0;
@@ -533,6 +536,7 @@ A_STATUS htt_attach_target(htt_pdev_handle pdev)
 	 * handshaking.
 	 */
 
+	status = htt_h2t_rx_ring_rfs_cfg_msg(pdev);
 	status = htt_h2t_rx_ring_cfg_msg(pdev);
 	status = HTT_IPA_CONFIG(pdev, status);
 
@@ -663,13 +667,15 @@ void htt_display(htt_pdev_handle pdev, int indent)
 	qdf_print("%*srx ring: space for %d elems, filled with %d buffers\n",
 		  indent + 4, " ",
 		  pdev->rx_ring.size, pdev->rx_ring.fill_level);
-	qdf_print("%*sat %p (%#x paddr)\n", indent + 8, " ",
-		  pdev->rx_ring.buf.paddrs_ring, pdev->rx_ring.base_paddr);
+	qdf_print("%*sat %p (%llx paddr)\n", indent + 8, " ",
+		  pdev->rx_ring.buf.paddrs_ring,
+		  (unsigned long long)pdev->rx_ring.base_paddr);
 	qdf_print("%*snetbuf ring @ %p\n", indent + 8, " ",
 		  pdev->rx_ring.buf.netbufs_ring);
-	qdf_print("%*sFW_IDX shadow register: vaddr = %p, paddr = %#x\n",
+	qdf_print("%*sFW_IDX shadow register: vaddr = %p, paddr = %llx\n",
 		  indent + 8, " ",
-		  pdev->rx_ring.alloc_idx.vaddr, pdev->rx_ring.alloc_idx.paddr);
+		  pdev->rx_ring.alloc_idx.vaddr,
+		  (unsigned long long)pdev->rx_ring.alloc_idx.paddr);
 	qdf_print("%*sSW enqueue idx= %d, SW dequeue idx: desc= %d, buf= %d\n",
 		  indent + 8, " ", *pdev->rx_ring.alloc_idx.vaddr,
 		  pdev->rx_ring.sw_rd_idx.msdu_desc,
@@ -813,3 +819,23 @@ htt_ipa_uc_set_doorbell_paddr(htt_pdev_handle pdev,
 	return 0;
 }
 #endif /* IPA_OFFLOAD */
+
+/**
+ * htt_mark_first_wakeup_packet() - set flag to indicate that
+ *    fw is compatible for marking first packet after wow wakeup
+ * @pdev: pointer to htt pdev
+ * @value: 1 for enabled/ 0 for disabled
+ *
+ * Return: None
+ */
+void htt_mark_first_wakeup_packet(htt_pdev_handle pdev,
+			uint8_t value)
+{
+	if (!pdev) {
+		qdf_print("%s: htt pdev is NULL", __func__);
+		return;
+	}
+
+	pdev->cfg.is_first_wakeup_packet = value;
+}
+

+ 106 - 2
core/dp/htt/htt_h2t.c

@@ -292,6 +292,85 @@ A_STATUS htt_h2t_ver_req_msg(struct htt_pdev_t *pdev)
 	return A_OK;
 }
 
+#if defined(HELIUMPLUS)
+/**
+ * htt_h2t_rx_ring_rfs_cfg_msg_ll() - Configure receive flow steering
+ * @pdev: handle to the HTT instance
+ *
+ * Return: QDF_STATUS_SUCCESS on success
+ *         A_NO_MEMORY No memory fail
+ */
+QDF_STATUS htt_h2t_rx_ring_rfs_cfg_msg_ll(struct htt_pdev_t *pdev)
+{
+	struct htt_htc_pkt *pkt;
+	qdf_nbuf_t msg;
+	uint32_t *msg_word;
+
+	qdf_print("Receive flow steering configuration, disable gEnableFlowSteering(=0) in ini if FW doesnot support it\n");
+	pkt = htt_htc_pkt_alloc(pdev);
+	if (!pkt)
+		return QDF_STATUS_E_NOMEM; /* failure */
+
+	pkt->msdu_id = HTT_TX_COMPL_INV_MSDU_ID;
+	pkt->pdev_ctxt = NULL;  /* not used during send-done callback */
+
+	/* reserve room for the HTC header */
+	msg = qdf_nbuf_alloc(pdev->osdev,
+			     HTT_MSG_BUF_SIZE(HTT_RFS_CFG_REQ_BYTES),
+			     HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4,
+			     true);
+	if (!msg) {
+		htt_htc_pkt_free(pdev, pkt);
+		return QDF_STATUS_E_NOMEM; /* failure */
+	}
+	/*
+	 * Set the length of the message.
+	 * The contribution from the HTC_HDR_ALIGNMENT_PADDING is added
+	 * separately during the below call to qdf_nbuf_push_head.
+	 * The contribution from the HTC header is added separately inside HTC.
+	 */
+	qdf_nbuf_put_tail(msg, HTT_RFS_CFG_REQ_BYTES);
+
+	/* fill in the message contents */
+	msg_word = (uint32_t *) qdf_nbuf_data(msg);
+
+	/* rewind beyond alignment pad to get to the HTC header reserved area */
+	qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING);
+
+	*msg_word = 0;
+	HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_RFS_CONFIG);
+	if (ol_cfg_is_flow_steering_enabled(pdev->ctrl_pdev)) {
+		HTT_RX_RFS_CONFIG_SET(*msg_word, 1);
+	    qdf_print("Enable Rx flow steering\n");
+	} else {
+	    qdf_print("Disable Rx flow steering\n");
+	}
+
+	SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt,
+			       htt_h2t_send_complete_free_netbuf,
+			       qdf_nbuf_data(msg), qdf_nbuf_len(msg),
+			       pdev->htc_tx_endpoint,
+			       1); /* tag - not relevant here */
+
+	SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
+	HTT_SEND_HTC_PKT(pdev, pkt);
+	return QDF_STATUS_SUCCESS;
+}
+#else
+/**
+ * htt_h2t_rx_ring_rfs_cfg_msg_ll() - Configure receive flow steering
+ * @pdev: handle to the HTT instance
+ *
+ * Return: QDF_STATUS_SUCCESS on success
+ *         A_NO_MEMORY No memory fail
+ */
+QDF_STATUS htt_h2t_rx_ring_rfs_cfg_msg_ll(struct htt_pdev_t *pdev)
+{
+	qdf_print("Doesnot support receive flow steering configuration\n");
+	return QDF_STATUS_SUCCESS;
+}
+#endif /* HELIUMPLUS */
+
 QDF_STATUS htt_h2t_rx_ring_cfg_msg_ll(struct htt_pdev_t *pdev)
 {
 	struct htt_htc_pkt *pkt;
@@ -355,8 +434,20 @@ QDF_STATUS htt_h2t_rx_ring_cfg_msg_ll(struct htt_pdev_t *pdev)
 #if HTT_PADDR64
 	HTT_RX_RING_CFG_BASE_PADDR_LO_SET(*msg_word,
 					  pdev->rx_ring.base_paddr);
-	msg_word++;
-	HTT_RX_RING_CFG_BASE_PADDR_HI_SET(*msg_word, 0);
+	{
+		uint32_t tmp;
+
+		tmp = (pdev->rx_ring.base_paddr >> 32);
+		if (tmp & 0xfffffe0) {
+			qdf_print("%s:%d paddr > 37 bits!. Trimmed.",
+				  __func__, __LINE__);
+			tmp &= 0x01f;
+		}
+
+
+		msg_word++;
+		HTT_RX_RING_CFG_BASE_PADDR_HI_SET(*msg_word, tmp);
+	}
 #else /* ! HTT_PADDR64 */
 	HTT_RX_RING_CFG_BASE_PADDR_SET(*msg_word, pdev->rx_ring.base_paddr);
 #endif /* HTT_PADDR64 */
@@ -624,6 +715,19 @@ htt_h2t_rx_ring_cfg_msg_hl(struct htt_pdev_t *pdev)
 	return QDF_STATUS_SUCCESS;
 }
 
+/**
+ * htt_h2t_rx_ring_rfs_cfg_msg_hl() - Configure receive flow steering
+ * @pdev: handle to the HTT instance
+ *
+ * Return: QDF_STATUS_SUCCESS on success
+ *         A_NO_MEMORY No memory fail
+ */
+QDF_STATUS htt_h2t_rx_ring_rfs_cfg_msg_hl(struct htt_pdev_t *pdev)
+{
+	qdf_print("Doesnot support Receive flow steering configuration\n");
+	return QDF_STATUS_SUCCESS;
+}
+
 int
 htt_h2t_dbg_stats_get(struct htt_pdev_t *pdev,
 		      uint32_t stats_type_upload_mask,

+ 5 - 0
core/dp/htt/htt_internal.h

@@ -58,6 +58,7 @@ struct htt_host_fw_desc_base {
 	} u;
 };
 
+
 /*
  * This struct defines the basic descriptor information used by host,
  * which is written either by the 11ac HW MAC into the host Rx data
@@ -479,6 +480,10 @@ htt_h2t_frag_desc_bank_cfg_msg(struct htt_pdev_t *pdev);
 
 extern QDF_STATUS htt_h2t_rx_ring_cfg_msg_ll(struct htt_pdev_t *pdev);
 
+extern QDF_STATUS htt_h2t_rx_ring_rfs_cfg_msg_ll(struct htt_pdev_t *pdev);
+
+extern QDF_STATUS htt_h2t_rx_ring_rfs_cfg_msg_hl(struct htt_pdev_t *pdev);
+
 extern QDF_STATUS htt_h2t_rx_ring_cfg_msg_hl(struct htt_pdev_t *pdev);
 
 extern QDF_STATUS (*htt_h2t_rx_ring_cfg_msg)(struct htt_pdev_t *pdev);

+ 50 - 7
core/dp/htt/htt_rx.c

@@ -127,6 +127,9 @@ void htt_rx_hash_deinit(struct htt_pdev_t *pdev)
 
 	if (NULL == pdev->rx_ring.hash_table)
 		return;
+
+	qdf_spin_lock_bh(&(pdev->rx_ring.rx_hash_lock));
+
 	for (i = 0; i < RX_NUM_HASH_BUCKETS; i++) {
 		/* Free the hash entries in hash bucket i */
 		list_iter = pdev->rx_ring.hash_table[i]->listhead.next;
@@ -157,6 +160,10 @@ void htt_rx_hash_deinit(struct htt_pdev_t *pdev)
 	}
 	qdf_mem_free(pdev->rx_ring.hash_table);
 	pdev->rx_ring.hash_table = NULL;
+
+	qdf_spin_unlock_bh(&(pdev->rx_ring.rx_hash_lock));
+	qdf_spinlock_destroy(&(pdev->rx_ring.rx_hash_lock));
+
 }
 
 /*
@@ -969,8 +976,8 @@ void htt_rx_print_rx_indication(qdf_nbuf_t rx_ind_msg, htt_pdev_handle pdev)
 
 	qdf_print
 		("------------------HTT RX IND-----------------------------\n");
-	qdf_print("alloc idx paddr %x (*vaddr) %d\n",
-		  pdev->rx_ring.alloc_idx.paddr,
+	qdf_print("alloc idx paddr %llx (*vaddr) %d\n",
+		  (unsigned long long)pdev->rx_ring.alloc_idx.paddr,
 		  *pdev->rx_ring.alloc_idx.vaddr);
 
 	qdf_print("sw_rd_idx msdu_payld %d msdu_desc %d\n",
@@ -1441,6 +1448,16 @@ htt_rx_offload_paddr_msdu_pop_ll(htt_pdev_handle pdev,
 #else
 	qdf_nbuf_unmap(pdev->osdev, buf, QDF_DMA_FROM_DEVICE);
 #endif
+
+	if (pdev->cfg.is_first_wakeup_packet) {
+		if (HTT_RX_IN_ORD_PADDR_IND_MSDU_INFO_GET(*(curr_msdu + 1)) &
+			   FW_MSDU_INFO_FIRST_WAKEUP_M) {
+			qdf_nbuf_mark_wakeup_frame(buf);
+			qdf_print("%s: First packet after WOW Wakeup rcvd\n",
+				__func__);
+		}
+	}
+
 	msdu_hdr = (uint32_t *) qdf_nbuf_data(buf);
 
 	/* First dword */
@@ -1930,6 +1947,14 @@ void htt_rx_mon_note_capture_channel(htt_pdev_handle pdev, int mon_ch)
 extern void
 dump_pkt(qdf_nbuf_t nbuf, uint32_t nbuf_paddr, int len);
 
+uint32_t htt_rx_amsdu_rx_in_order_get_pktlog(qdf_nbuf_t rx_ind_msg)
+{
+	uint32_t *msg_word;
+
+	msg_word = (uint32_t *) qdf_nbuf_data(rx_ind_msg);
+	return HTT_RX_IN_ORD_PADDR_IND_PKTLOG_GET(*msg_word);
+}
+
 /* Return values: 1 - success, 0 - failure */
 int
 htt_rx_amsdu_rx_in_order_pop_ll(htt_pdev_handle pdev,
@@ -2895,8 +2920,11 @@ htt_rx_hash_list_insert(struct htt_pdev_t *pdev, uint32_t paddr,
 			qdf_nbuf_t netbuf)
 {
 	int i;
+	int rc = 0;
 	struct htt_rx_hash_entry *hash_element = NULL;
 
+	qdf_spin_lock_bh(&(pdev->rx_ring.rx_hash_lock));
+
 	i = RX_HASH_FUNCTION(paddr);
 
 	/* Check if there are any entries in the pre-allocated free list */
@@ -2910,7 +2938,8 @@ htt_rx_hash_list_insert(struct htt_pdev_t *pdev, uint32_t paddr,
 				pdev->rx_ring.listnode_offset);
 		if (qdf_unlikely(NULL == hash_element)) {
 			HTT_ASSERT_ALWAYS(0);
-			return 1;
+			rc = 1;
+			goto hli_end;
 		}
 
 		htt_list_remove(pdev->rx_ring.hash_table[i]->freepool.next);
@@ -2918,7 +2947,8 @@ htt_rx_hash_list_insert(struct htt_pdev_t *pdev, uint32_t paddr,
 		hash_element = qdf_mem_malloc(sizeof(struct htt_rx_hash_entry));
 		if (qdf_unlikely(NULL == hash_element)) {
 			HTT_ASSERT_ALWAYS(0);
-			return 1;
+			rc = 1;
+			goto hli_end;
 		}
 		hash_element->fromlist = 0;
 	}
@@ -2936,7 +2966,9 @@ htt_rx_hash_list_insert(struct htt_pdev_t *pdev, uint32_t paddr,
 	HTT_RX_HASH_COUNT_INCR(pdev->rx_ring.hash_table[i]);
 	HTT_RX_HASH_COUNT_PRINT(pdev->rx_ring.hash_table[i]);
 
-	return 0;
+hli_end:
+	qdf_spin_unlock_bh(&(pdev->rx_ring.rx_hash_lock));
+	return rc;
 }
 
 /* Given a physical address this function will find the corresponding network
@@ -2949,6 +2981,8 @@ qdf_nbuf_t htt_rx_hash_list_lookup(struct htt_pdev_t *pdev, uint32_t paddr)
 	qdf_nbuf_t netbuf = NULL;
 	struct htt_rx_hash_entry *hash_entry;
 
+	qdf_spin_lock_bh(&(pdev->rx_ring.rx_hash_lock));
+
 	i = RX_HASH_FUNCTION(paddr);
 
 	HTT_LIST_ITER_FWD(list_iter, &pdev->rx_ring.hash_table[i]->listhead) {
@@ -2980,6 +3014,8 @@ qdf_nbuf_t htt_rx_hash_list_lookup(struct htt_pdev_t *pdev, uint32_t paddr)
 			      __func__, paddr, netbuf, (int)i));
 	HTT_RX_HASH_COUNT_PRINT(pdev->rx_ring.hash_table[i]);
 
+	qdf_spin_unlock_bh(&(pdev->rx_ring.rx_hash_lock));
+
 	if (netbuf == NULL) {
 		qdf_print("rx hash: %s: no entry found for 0x%x!!!\n",
 			  __func__, paddr);
@@ -2995,6 +3031,7 @@ qdf_nbuf_t htt_rx_hash_list_lookup(struct htt_pdev_t *pdev, uint32_t paddr)
 int htt_rx_hash_init(struct htt_pdev_t *pdev)
 {
 	int i, j;
+	int rc = 0;
 
 	HTT_ASSERT2(QDF_IS_PWR2(RX_NUM_HASH_BUCKETS));
 
@@ -3008,6 +3045,9 @@ int htt_rx_hash_init(struct htt_pdev_t *pdev)
 		return 1;
 	}
 
+	qdf_spinlock_create(&(pdev->rx_ring.rx_hash_lock));
+	qdf_spin_lock_bh(&(pdev->rx_ring.rx_hash_lock));
+
 	for (i = 0; i < RX_NUM_HASH_BUCKETS; i++) {
 
 		/* pre-allocate bucket and pool of entries for this bucket */
@@ -3038,7 +3078,8 @@ int htt_rx_hash_init(struct htt_pdev_t *pdev)
 			}
 			qdf_mem_free(pdev->rx_ring.hash_table);
 			pdev->rx_ring.hash_table = NULL;
-			return 1;
+			rc = 1;
+			goto hi_end;
 		}
 
 		/* initialize the free list with pre-allocated entries */
@@ -3052,8 +3093,10 @@ int htt_rx_hash_init(struct htt_pdev_t *pdev)
 
 	pdev->rx_ring.listnode_offset =
 		qdf_offsetof(struct htt_rx_hash_entry, listnode);
+hi_end:
+	qdf_spin_unlock_bh(&(pdev->rx_ring.rx_hash_lock));
 
-	return 0;
+	return rc;
 }
 
 void htt_rx_hash_dump_table(struct htt_pdev_t *pdev)

+ 4 - 4
core/dp/htt/htt_t2h.c

@@ -165,7 +165,7 @@ void htt_t2h_lp_msg_handler(void *context, qdf_nbuf_t htt_t2h_msg,
 	switch (msg_type) {
 	case HTT_T2H_MSG_TYPE_VERSION_CONF:
 	{
-		qdf_runtime_pm_put();
+		htc_pm_runtime_put(pdev->htc_pdev);
 		pdev->tgt_ver.major = HTT_VER_CONF_MAJOR_GET(*msg_word);
 		pdev->tgt_ver.minor = HTT_VER_CONF_MINOR_GET(*msg_word);
 		qdf_print
@@ -328,7 +328,7 @@ void htt_t2h_lp_msg_handler(void *context, qdf_nbuf_t htt_t2h_msg,
 			ol_tx_single_completion_handler(pdev->txrx_pdev,
 							compl_msg->status,
 							compl_msg->desc_id);
-			qdf_runtime_pm_put();
+			htc_pm_runtime_put(pdev->htc_pdev);
 			HTT_TX_SCHED(pdev);
 		} else {
 			qdf_print("Ignoring HTT_T2H_MSG_TYPE_MGMT_TX_COMPL_IND indication");
@@ -344,7 +344,7 @@ void htt_t2h_lp_msg_handler(void *context, qdf_nbuf_t htt_t2h_msg,
 		cookie |= ((uint64_t) (*(msg_word + 2))) << 32;
 
 		stats_info_list = (uint8_t *) (msg_word + 3);
-		qdf_runtime_pm_put();
+		htc_pm_runtime_put(pdev->htc_pdev);
 		ol_txrx_fw_stats_handler(pdev->txrx_pdev, cookie,
 					 stats_info_list);
 		break;
@@ -387,7 +387,7 @@ void htt_t2h_lp_msg_handler(void *context, qdf_nbuf_t htt_t2h_msg,
 		uint8_t *op_msg_buffer;
 		uint8_t *msg_start_ptr;
 
-		qdf_runtime_pm_put();
+		htc_pm_runtime_put(pdev->htc_pdev);
 		msg_start_ptr = (uint8_t *) msg_word;
 		op_code =
 			HTT_WDI_IPA_OP_RESPONSE_OP_CODE_GET(*msg_word);

+ 57 - 25
core/dp/htt/htt_tx.c

@@ -1100,12 +1100,12 @@ int htt_tx_ipa_uc_wdi_tx_buf_alloc(struct htt_pdev_t *pdev,
 
 		/* Frag Desc Pointer */
 		/* 64bits descriptor, Low 32bits */
-		*header_ptr = (uint32_t) (buffer_paddr +
-						IPA_UC_TX_BUF_FRAG_DESC_OFFSET);
+		*header_ptr = qdf_get_lower_32_bits(buffer_paddr +
+					IPA_UC_TX_BUF_FRAG_DESC_OFFSET);
 		header_ptr++;
 
 		/* 64bits descriptor, high 32bits */
-		*header_ptr = (buffer_paddr >> IPA_UC_TX_BUF_PADDR_HI_OFFSET) &
+		*header_ptr = qdf_get_upper_32_bits(buffer_paddr) &
 			IPA_UC_TX_BUF_PADDR_HI_MASK;
 		header_ptr++;
 
@@ -1355,6 +1355,18 @@ htt_tx_desc_fill_tso_info(htt_pdev_handle pdev, void *desc,
 		 tso_seg->seg.tso_flags;
 
 	/* First 24 bytes (6*4) contain the TSO flags */
+	TSO_DEBUG("%s seq# %u l2 len %d, ip len %d flags 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n",
+		  __func__,
+		  tso_seg->seg.tso_flags.tcp_seq_num,
+		  tso_seg->seg.tso_flags.l2_len,
+		  tso_seg->seg.tso_flags.ip_len,
+		  *word,
+		  *(word + 1),
+		  *(word + 2),
+		  *(word + 3),
+		  *(word + 4),
+		  *(word + 5));
+
 	word += 6;
 
 	for (i = 0; i < tso_seg->seg.num_frags; i++) {
@@ -1369,6 +1381,12 @@ htt_tx_desc_fill_tso_info(htt_pdev_handle pdev, void *desc,
 		/* [31:16] length of the first buffer */
 		*word = (tso_seg->seg.tso_frags[i].length << 16) | hi;
 		word++;
+		TSO_DEBUG("%s frag[%d] ptr_low 0x%x ptr_hi 0x%x len %u\n",
+			__func__, i,
+			msdu_ext_desc->frags[i].u.frag32.ptr_low,
+			msdu_ext_desc->frags[i].u.frag32.ptr_hi,
+			msdu_ext_desc->frags[i].u.frag32.len);
+
 	}
 
 	if (tso_seg->seg.num_frags < FRAG_NUM_MAX) {
@@ -1599,11 +1617,21 @@ htt_tx_desc_init(htt_pdev_handle pdev,
 	void *qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE);
 	QDF_STATUS status;
 
-	if (!qdf_ctx) {
+	if (qdf_unlikely(!qdf_ctx)) {
 		QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
 			"%s: qdf_ctx is NULL", __func__);
 		return;
 	}
+	if (qdf_unlikely(!msdu_info)) {
+		QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
+			"%s: bad arg: msdu_info is NULL", __func__);
+		return;
+	}
+	if (qdf_unlikely(!tso_info)) {
+		QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
+			"%s: bad arg: tso_info is NULL", __func__);
+		return;
+	}
 
 	word0 = (uint32_t *) htt_tx_desc;
 	word1 = word0 + 1;
@@ -1639,33 +1667,37 @@ htt_tx_desc_init(htt_pdev_handle pdev,
 	 */
 
 	local_word0 = 0;
-	if (msdu_info) {
-		HTT_H2T_MSG_TYPE_SET(local_word0, HTT_H2T_MSG_TYPE_TX_FRM);
-		HTT_TX_DESC_PKT_TYPE_SET(local_word0, pkt_type);
-		HTT_TX_DESC_PKT_SUBTYPE_SET(local_word0, pkt_subtype);
-		HTT_TX_DESC_VDEV_ID_SET(local_word0, msdu_info->info.vdev_id);
-		HTT_TX_DESC_EXT_TID_SET(local_word0, htt_get_ext_tid(type,
-						ext_header_data, msdu_info));
-		HTT_TX_DESC_EXTENSION_SET(local_word0, desc_ext_required);
-		HTT_TX_DESC_EXT_TID_SET(local_word0, msdu_info->info.ext_tid);
-		HTT_TX_DESC_CKSUM_OFFLOAD_SET(local_word0,
-					      msdu_info->action.cksum_offload);
-		if (pdev->cfg.is_high_latency)
-			HTT_TX_DESC_TX_COMP_SET(local_word0, msdu_info->action.
-								tx_comp_req);
-		HTT_TX_DESC_NO_ENCRYPT_SET(local_word0,
-					   msdu_info->action.do_encrypt ?
-					   0 : 1);
-	}
+
+	HTT_H2T_MSG_TYPE_SET(local_word0, HTT_H2T_MSG_TYPE_TX_FRM);
+	HTT_TX_DESC_PKT_TYPE_SET(local_word0, pkt_type);
+	HTT_TX_DESC_PKT_SUBTYPE_SET(local_word0, pkt_subtype);
+	HTT_TX_DESC_VDEV_ID_SET(local_word0, msdu_info->info.vdev_id);
+	HTT_TX_DESC_EXT_TID_SET(local_word0, htt_get_ext_tid(type,
+					ext_header_data, msdu_info));
+	HTT_TX_DESC_EXTENSION_SET(local_word0, desc_ext_required);
+	HTT_TX_DESC_EXT_TID_SET(local_word0, msdu_info->info.ext_tid);
+	HTT_TX_DESC_CKSUM_OFFLOAD_SET(local_word0,
+				      msdu_info->action.cksum_offload);
+	if (pdev->cfg.is_high_latency)
+		HTT_TX_DESC_TX_COMP_SET(local_word0, msdu_info->action.
+							tx_comp_req);
+	HTT_TX_DESC_NO_ENCRYPT_SET(local_word0,
+				   msdu_info->action.do_encrypt ?
+				   0 : 1);
 
 	*word0 = local_word0;
 
 	local_word1 = 0;
 
-	if (tso_info->is_tso)
-		HTT_TX_DESC_FRM_LEN_SET(local_word1, tso_info->total_len);
-	else
+	if (tso_info->is_tso) {
+		uint32_t total_len = tso_info->curr_seg->seg.total_len;
+
+		HTT_TX_DESC_FRM_LEN_SET(local_word1, total_len);
+		TSO_DEBUG("%s setting HTT TX DESC Len = curr_seg->seg.total_len %d\n",
+			  __func__, total_len);
+	} else {
 		HTT_TX_DESC_FRM_LEN_SET(local_word1, qdf_nbuf_len(msdu));
+	}
 
 	HTT_TX_DESC_FRM_ID_SET(local_word1, msdu_id);
 	*word1 = local_word1;

+ 7 - 5
core/dp/htt/htt_types.h

@@ -252,6 +252,7 @@ struct htt_pdev_t {
 		int is_full_reorder_offload;
 		int default_tx_comp_req;
 		int ce_classify_enabled;
+		uint8_t is_first_wakeup_packet;
 	} cfg;
 	struct {
 		uint8_t major;
@@ -290,9 +291,9 @@ struct htt_pdev_t {
 		 * Base address of ring, as a "physical" device address rather
 		 * than a CPU address.
 		 */
-		uint32_t base_paddr;
-		int size;       /* how many elems in the ring (power of 2) */
-		unsigned size_mask;     /* size - 1 */
+		qdf_dma_addr_t base_paddr;
+		int32_t  size;       /* how many elems in the ring (power of 2) */
+		uint32_t size_mask;  /* size - 1, at least 16 bits long */
 
 		int fill_level; /* how many rx buffers to keep in the ring */
 		int fill_cnt;   /* # of rx buffers (full+empty) in the ring */
@@ -307,7 +308,7 @@ struct htt_pdev_t {
 		 */
 		struct {
 			uint32_t *vaddr;
-			uint32_t paddr;
+			qdf_dma_addr_t paddr;
 			qdf_dma_mem_context(memctx);
 		} target_idx;
 
@@ -323,7 +324,7 @@ struct htt_pdev_t {
 		 */
 		struct {
 			uint32_t *vaddr;
-			uint32_t paddr;
+			qdf_dma_addr_t paddr;
 			qdf_dma_mem_context(memctx);
 		} alloc_idx;
 
@@ -358,6 +359,7 @@ struct htt_pdev_t {
 		int rx_reset;
 		uint8_t htt_rx_restore;
 #endif
+		qdf_spinlock_t rx_hash_lock;
 		struct htt_rx_hash_bucket **hash_table;
 		uint32_t listnode_offset;
 	} rx_ring;

+ 31 - 0
core/dp/ol/inc/ol_cfg.h

@@ -93,6 +93,7 @@ struct txrx_pdev_cfg_t {
 	uint32_t tx_flow_stop_queue_th;
 	uint32_t tx_flow_start_queue_offset;
 #endif
+	bool flow_steering_enabled;
 };
 
 /**
@@ -546,4 +547,34 @@ static inline unsigned int ol_cfg_ipa_uc_tx_partition_base(
 	return 0;
 }
 #endif /* IPA_OFFLOAD */
+
+/**
+ * ol_set_cfg_flow_steering - Set Rx flow steering config based on CFG ini
+ *			      config.
+ *
+ * @pdev - handle to the physical device
+ * @val - 0 - disable, 1 - enable
+ *
+ * Return: None
+ */
+static inline void ol_set_cfg_flow_steering(ol_pdev_handle pdev, uint8_t val)
+{
+	struct txrx_pdev_cfg_t *cfg = (struct txrx_pdev_cfg_t *)pdev;
+
+	cfg->flow_steering_enabled = val;
+}
+
+/**
+ * ol_cfg_is_flow_steering_enabled - Return Rx flow steering config.
+ *
+ * @pdev - handle to the physical device
+ *
+ * Return: value of configured flow steering value.
+ */
+static inline uint8_t ol_cfg_is_flow_steering_enabled(ol_pdev_handle pdev)
+{
+	struct txrx_pdev_cfg_t *cfg = (struct txrx_pdev_cfg_t *)pdev;
+
+	return cfg->flow_steering_enabled;
+}
 #endif /* _OL_CFG__H_ */

+ 1 - 0
core/dp/ol/inc/ol_htt_api.h

@@ -383,5 +383,6 @@ static inline void htt_clear_bundle_stats(struct htt_pdev_t *pdev)
 }
 #endif
 
+void htt_mark_first_wakeup_packet(htt_pdev_handle pdev, uint8_t value);
 
 #endif /* _OL_HTT_API__H_ */

+ 3 - 0
core/dp/ol/inc/ol_htt_rx_api.h

@@ -862,4 +862,7 @@ htt_rx_offload_paddr_msdu_pop_ll(htt_pdev_handle pdev,
 				 int *tid,
 				 uint8_t *fw_desc,
 				 qdf_nbuf_t *head_buf, qdf_nbuf_t *tail_buf);
+
+uint32_t htt_rx_amsdu_rx_in_order_get_pktlog(qdf_nbuf_t rx_ind_msg);
+
 #endif /* _OL_HTT_RX_API__H_ */

+ 2 - 0
core/dp/ol/inc/ol_txrx_ctrl_api.h

@@ -668,4 +668,6 @@ static inline int ol_tx_delete_flow_pool(struct ol_tx_flow_pool_t *pool,
 }
 #endif
 
+void ol_tx_mark_first_wakeup_packet(uint8_t value);
+
 #endif /* _OL_TXRX_CTRL_API__H_ */

+ 53 - 9
core/dp/txrx/ol_rx.c

@@ -64,6 +64,47 @@
 void ol_rx_data_process(struct ol_txrx_peer_t *peer,
 			qdf_nbuf_t rx_buf_list);
 
+/**
+ * ol_rx_send_pktlog_event() - send rx packetlog event
+ * @pdev: pdev handle
+ * @peer: peer handle
+ * @msdu: skb list
+ * @pktlog_bit: packetlog bit from firmware
+ *
+ * Return: none
+ */
+#ifdef HELIUMPLUS
+void ol_rx_send_pktlog_event(struct ol_txrx_pdev_t *pdev,
+	struct ol_txrx_peer_t *peer, qdf_nbuf_t msdu, uint8_t pktlog_bit)
+{
+	struct ol_rx_remote_data data;
+
+	if (!pktlog_bit)
+		return;
+
+	data.msdu = msdu;
+	if (peer)
+		data.mac_id = peer->vdev->mac_id;
+	else
+		data.mac_id = 0;
+
+	wdi_event_handler(WDI_EVENT_RX_DESC_REMOTE, pdev, &data);
+}
+#else
+void ol_rx_send_pktlog_event(struct ol_txrx_pdev_t *pdev,
+	struct ol_txrx_peer_t *peer, qdf_nbuf_t msdu, uint8_t pktlog_bit)
+{
+	struct ol_rx_remote_data data;
+
+	data.msdu = msdu;
+	if (peer)
+		data.mac_id = peer->vdev->mac_id;
+	else
+		data.mac_id = 0;
+
+	wdi_event_handler(WDI_EVENT_RX_DESC_REMOTE, pdev, &data);
+}
+#endif
 
 #ifdef HTT_RX_RESTORE
 
@@ -173,10 +214,8 @@ static void ol_rx_process_inv_peer(ol_txrx_pdev_handle pdev,
 	/* ignore frames for non-existent bssids */
 	qdf_mem_copy(a1, wh->i_addr1, IEEE80211_ADDR_LEN);
 	TAILQ_FOREACH(vdev, &pdev->vdev_list, vdev_list_elem) {
-		if (qdf_mem_cmp(a1, vdev->mac_addr.raw, IEEE80211_ADDR_LEN)
-		    != 0) {
+		if (qdf_mem_cmp(a1, vdev->mac_addr.raw, IEEE80211_ADDR_LEN))
 			break;
-		}
 	}
 	if (!vdev)
 		return;
@@ -508,8 +547,7 @@ ol_rx_indication_handler(ol_txrx_pdev_handle pdev,
 
 				/* Pktlog */
 #ifdef WDI_EVENT_ENABLE
-				wdi_event_handler(WDI_EVENT_RX_DESC_REMOTE,
-						  pdev, head_msdu);
+		ol_rx_send_pktlog_event(pdev, peer, head_msdu, 1);
 #endif
 
 				if (msdu_chaining) {
@@ -586,9 +624,8 @@ ol_rx_indication_handler(ol_txrx_pdev_handle pdev,
 #ifdef WDI_EVENT_ENABLE
 				if (status != htt_rx_status_ctrl_mgmt_null) {
 					/* Pktlog */
-					wdi_event_handler(
-						WDI_EVENT_RX_DESC_REMOTE, pdev,
-						msdu);
+					ol_rx_send_pktlog_event(pdev,
+						 peer, head_msdu, 1);
 				}
 #endif
 				if (status == htt_rx_status_err_inv_peer) {
@@ -1290,6 +1327,9 @@ ol_rx_in_order_indication_handler(ol_txrx_pdev_handle pdev,
 	htt_pdev_handle htt_pdev = NULL;
 	int status;
 	qdf_nbuf_t head_msdu, tail_msdu = NULL;
+#ifdef WDI_EVENT_ENABLE
+	uint8_t pktlog_bit;
+#endif
 
 	if (pdev) {
 		if (qdf_unlikely(QDF_GLOBAL_MONITOR_MODE == cds_get_conparam()))
@@ -1309,6 +1349,10 @@ ol_rx_in_order_indication_handler(ol_txrx_pdev_handle pdev,
 		  __func__, __LINE__, rx_ind_msg, peer_id, tid, is_offload);
 #endif
 
+#ifdef WDI_EVENT_ENABLE
+	pktlog_bit = (htt_rx_amsdu_rx_in_order_get_pktlog(rx_ind_msg) == 0x01);
+#endif
+
 	/*
 	 * Get a linked list of the MSDUs in the rx in order indication.
 	 * This also attaches each rx MSDU descriptor to the
@@ -1332,7 +1376,7 @@ ol_rx_in_order_indication_handler(ol_txrx_pdev_handle pdev,
 
 	/* Pktlog */
 #ifdef WDI_EVENT_ENABLE
-	wdi_event_handler(WDI_EVENT_RX_DESC_REMOTE, pdev, head_msdu);
+	ol_rx_send_pktlog_event(pdev, peer, head_msdu, pktlog_bit);
 #endif
 
 	/* if this is an offload indication, peer id is carried in the

+ 2 - 1
core/dp/txrx/ol_rx_defrag.c

@@ -70,7 +70,7 @@
 #include <qdf_time.h>           /* qdf_system_time */
 
 #define DEFRAG_IEEE80211_ADDR_EQ(a1, a2) \
-	(qdf_mem_cmp(a1, a2, IEEE80211_ADDR_LEN) != 0)
+	(!qdf_mem_cmp(a1, a2, IEEE80211_ADDR_LEN))
 
 #define DEFRAG_IEEE80211_ADDR_COPY(dst, src) \
 	qdf_mem_copy(dst, src, IEEE80211_ADDR_LEN)
@@ -1152,6 +1152,7 @@ ol_rx_defrag_decap_recombine(htt_pdev_handle htt_pdev,
 	qdf_nbuf_set_next(rx_nbuf, NULL);
 	while (msdu) {
 		htt_rx_msdu_desc_free(htt_pdev, msdu);
+		qdf_net_buf_debug_release_skb(msdu);
 		tmp = qdf_nbuf_next(msdu);
 		qdf_nbuf_set_next(msdu, NULL);
 		ol_rx_frag_pull_hdr(htt_pdev, msdu, hdrsize);

+ 6 - 2
core/dp/txrx/ol_rx_fwd.c

@@ -76,9 +76,9 @@ static inline void ol_ap_fwd_check(struct ol_txrx_vdev_t *vdev, qdf_nbuf_t msdu)
 	if (type != IEEE80211_FC0_TYPE_DATA ||
 	    subtype != 0x0 ||
 	    ((tods != 1) || (fromds != 0)) ||
-	    (qdf_mem_cmp
+	    qdf_mem_cmp
 		     (mac_header->i_addr3, vdev->mac_addr.raw,
-		     IEEE80211_ADDR_LEN) != 0)) {
+		     IEEE80211_ADDR_LEN)) {
 #ifdef DEBUG_HOST_RC
 		TXRX_PRINT(TXRX_PRINT_LEVEL_INFO1,
 			   "Exit: %s | Unnecessary to adjust mac header\n",
@@ -132,6 +132,10 @@ static inline void ol_rx_fwd_to_tx(struct ol_txrx_vdev_t *vdev, qdf_nbuf_t msdu)
 							    rx_desc));
 		}
 
+	/* Clear the msdu control block as it will be re-interpreted */
+	qdf_mem_set(msdu->cb, sizeof(msdu->cb), 0);
+	/* update any cb field expected by OL_TX_SEND */
+
 	msdu = OL_TX_SEND(vdev, msdu);
 
 	if (msdu) {

+ 3 - 5
core/dp/txrx/ol_rx_reorder.c

@@ -82,7 +82,6 @@ static char g_log2ceil[] = {
 /*---*/
 
 /* reorder array elements are known to be non-NULL */
-#define OL_RX_REORDER_PTR_CHECK(ptr)    /* no-op */
 #define OL_RX_REORDER_LIST_APPEND(head_msdu, tail_msdu, rx_reorder_array_elem) \
 	do {								\
 		if (tail_msdu) {					\
@@ -262,15 +261,14 @@ ol_rx_reorder_release(struct ol_txrx_vdev_t *vdev,
 	head_msdu = rx_reorder_array_elem->head;
 	tail_msdu = rx_reorder_array_elem->tail;
 	rx_reorder_array_elem->head = rx_reorder_array_elem->tail = NULL;
-	OL_RX_REORDER_PTR_CHECK(head_msdu) {
+	if (head_msdu)
 		OL_RX_REORDER_MPDU_CNT_DECR(&peer->tids_rx_reorder[tid], 1);
-	}
 
 	idx = (idx_start + 1);
 	OL_RX_REORDER_IDX_WRAP(idx, win_sz, win_sz_mask);
 	while (idx != idx_end) {
 		rx_reorder_array_elem = &peer->tids_rx_reorder[tid].array[idx];
-		OL_RX_REORDER_PTR_CHECK(rx_reorder_array_elem->head) {
+		if (rx_reorder_array_elem->head) {
 			OL_RX_REORDER_MPDU_CNT_DECR(&peer->tids_rx_reorder[tid],
 						    1);
 			OL_RX_REORDER_LIST_APPEND(head_msdu, tail_msdu,
@@ -282,7 +280,7 @@ ol_rx_reorder_release(struct ol_txrx_vdev_t *vdev,
 		idx++;
 		OL_RX_REORDER_IDX_WRAP(idx, win_sz, win_sz_mask);
 	}
-	OL_RX_REORDER_PTR_CHECK(head_msdu) {
+	if (head_msdu) {
 		uint16_t seq_num;
 		htt_pdev_handle htt_pdev = vdev->pdev->htt_pdev;
 

+ 2 - 1
core/dp/txrx/ol_rx_reorder_timeout.c

@@ -180,7 +180,8 @@ void ol_rx_reorder_timeout_init(struct ol_txrx_pdev_t *pdev)
 		qdf_timer_init(pdev->osdev,
 				       &rx_reorder_timeout_ac->timer,
 				       ol_rx_reorder_timeout,
-				       rx_reorder_timeout_ac);
+				       rx_reorder_timeout_ac,
+				       QDF_TIMER_TYPE_SW);
 		/* init the virtual timer list */
 		TAILQ_INIT(&rx_reorder_timeout_ac->virtual_timer_list);
 		rx_reorder_timeout_ac->pdev = pdev;

+ 27 - 13
core/dp/txrx/ol_tx.c

@@ -1215,8 +1215,10 @@ struct ol_tx_desc_t *ol_tx_hl_desc_alloc(struct ol_txrx_pdev_t *pdev,
 			TXRX_HL_TX_DESC_HI_PRIO_RESERVED) {
 		tx_desc = ol_tx_desc_hl(pdev, vdev, msdu, msdu_info);
 	} else if (qdf_nbuf_is_ipv4_pkt(msdu) == true) {
-		if ((qdf_nbuf_is_ipv4_dhcp_pkt(msdu) == true) ||
-		    (qdf_nbuf_is_ipv4_eapol_pkt(msdu) == true)) {
+		if ((QDF_NBUF_CB_GET_PACKET_TYPE(msdu) ==
+				QDF_NBUF_CB_PACKET_TYPE_DHCP) ||
+		    (QDF_NBUF_CB_GET_PACKET_TYPE(msdu) ==
+			QDF_NBUF_CB_PACKET_TYPE_EAPOL)) {
 			tx_desc = ol_tx_desc_hl(pdev, vdev, msdu, msdu_info);
 			TXRX_PRINT(TXRX_PRINT_LEVEL_ERR,
 				   "Provided tx descriptor from reserve pool for DHCP/EAPOL\n");
@@ -1705,10 +1707,11 @@ void dump_frag_desc(char *msg, struct ol_tx_desc_t *tx_desc)
 
 	qdf_print("OL TX Descriptor 0x%p msdu_id %d\n",
 		 tx_desc, tx_desc->id);
-	qdf_print("HTT TX Descriptor vaddr: 0x%p paddr: 0x%llx",
-		 tx_desc->htt_tx_desc, tx_desc->htt_tx_desc_paddr);
-	qdf_print("%s %d: Fragment Descriptor 0x%p (paddr=0x%llx)",
-		 __func__, __LINE__, tx_desc->htt_frag_desc, tx_desc->htt_frag_desc_paddr);
+	qdf_print("HTT TX Descriptor vaddr: 0x%p paddr: %pad",
+		 tx_desc->htt_tx_desc, &tx_desc->htt_tx_desc_paddr);
+	qdf_print("%s %d: Fragment Descriptor 0x%p (paddr=%pad)",
+		 __func__, __LINE__, tx_desc->htt_frag_desc,
+		 &tx_desc->htt_frag_desc_paddr);
 
 	/* it looks from htt_tx_desc_frag() that tx_desc->htt_frag_desc
 	   is already de-referrable (=> in virtual address space) */
@@ -1864,6 +1867,16 @@ void ol_tso_seg_list_init(struct ol_txrx_pdev_t *pdev, uint32_t num_seg)
 	c_element = qdf_mem_malloc(sizeof(struct qdf_tso_seg_elem_t));
 	pdev->tso_seg_pool.freelist = c_element;
 	for (i = 0; i < (num_seg - 1); i++) {
+		if (qdf_unlikely(!c_element)) {
+			TXRX_PRINT(TXRX_PRINT_LEVEL_ERR,
+				   "%s: ERROR: c_element NULL for seg %d",
+				   __func__, i);
+			QDF_BUG(0);
+			pdev->tso_seg_pool.pool_size = i;
+			qdf_spinlock_create(&pdev->tso_seg_pool.tso_mutex);
+			return;
+		}
+
 		c_element->next =
 			qdf_mem_malloc(sizeof(struct qdf_tso_seg_elem_t));
 		c_element = c_element->next;
@@ -1881,18 +1894,19 @@ void ol_tso_seg_list_deinit(struct ol_txrx_pdev_t *pdev)
 
 	qdf_spin_lock_bh(&pdev->tso_seg_pool.tso_mutex);
 	c_element = pdev->tso_seg_pool.freelist;
-	for (i = 0; i < pdev->tso_seg_pool.pool_size; i++) {
-		temp = c_element->next;
-		qdf_mem_free(c_element);
-		c_element = temp;
-		if (!c_element)
-			break;
-	}
+	i = pdev->tso_seg_pool.pool_size;
 
 	pdev->tso_seg_pool.freelist = NULL;
 	pdev->tso_seg_pool.num_free = 0;
 	pdev->tso_seg_pool.pool_size = 0;
+
 	qdf_spin_unlock_bh(&pdev->tso_seg_pool.tso_mutex);
 	qdf_spinlock_destroy(&pdev->tso_seg_pool.tso_mutex);
+
+	while (i-- > 0 && c_element) {
+		temp = c_element->next;
+		qdf_mem_free(c_element);
+		c_element = temp;
+	}
 }
 #endif /* FEATURE_TSO */

+ 10 - 2
core/dp/txrx/ol_tx_classify.c

@@ -428,7 +428,8 @@ ol_tx_classify(
 				OL_TXRX_PEER_SECURITY_MULTICAST].sec_type
 						!= htt_sec_type_wapi) &&
 				   (qdf_nbuf_is_ipv4_pkt(tx_nbuf) == true)) {
-				if (true == qdf_nbuf_is_ipv4_dhcp_pkt(
+				if (QDF_NBUF_CB_PACKET_TYPE_DHCP ==
+						QDF_NBUF_CB_GET_PACKET_TYPE(
 								tx_nbuf)) {
 					/* DHCP frame to go with
 					 * voice priority
@@ -561,7 +562,8 @@ ol_tx_classify(
 				OL_TXRX_PEER_SECURITY_UNICAST].sec_type
 					!= htt_sec_type_wapi) &&
 			   (qdf_nbuf_is_ipv4_pkt(tx_nbuf) == true)) {
-			if (true == qdf_nbuf_is_ipv4_dhcp_pkt(tx_nbuf))
+			if (QDF_NBUF_CB_PACKET_TYPE_DHCP ==
+					QDF_NBUF_CB_GET_PACKET_TYPE(tx_nbuf))
 				/* DHCP frame to go with voice priority */
 				tid = TX_DHCP_TID;
 		}
@@ -692,6 +694,12 @@ ol_tx_classify_mgmt(
 							mac_addr,
 							&peer->mac_addr) != 0) {
 					qdf_atomic_dec(&peer->ref_cnt);
+					QDF_TRACE(QDF_MODULE_ID_TXRX,
+						 QDF_TRACE_LEVEL_INFO_HIGH,
+						 "%s: peer %p peer->ref_cnt %d",
+						 __func__, peer,
+						 qdf_atomic_read
+							(&peer->ref_cnt));
 					peer = NULL;
 				}
 			}

+ 3 - 1
core/dp/txrx/ol_tx_desc.c

@@ -656,7 +656,9 @@ void ol_tx_desc_frame_list_free(struct ol_txrx_pdev_t *pdev,
 		/* restore original hdr offset */
 		OL_TX_RESTORE_HDR(tx_desc, msdu);
 #endif
-		qdf_nbuf_unmap(pdev->osdev, msdu, QDF_DMA_TO_DEVICE);
+		if (qdf_nbuf_get_users(msdu) <= 1)
+			qdf_nbuf_unmap(pdev->osdev, msdu, QDF_DMA_TO_DEVICE);
+
 		/* free the tx desc */
 		ol_tx_desc_free(pdev, tx_desc);
 		/* link the netbuf into a list to free as a batch */

+ 19 - 10
core/dp/txrx/ol_tx_desc.h

@@ -296,7 +296,7 @@ static inline
 void ol_tx_desc_dup_detect_init(struct ol_txrx_pdev_t *pdev, uint16_t pool_size)
 {
 	uint16_t size = (pool_size >> DIV_BY_8) +
-			((pool_size & MOD_BY_8) ? 1 : 0);
+		sizeof(*pdev->tx_desc.free_list_bitmap);
 	pdev->tx_desc.free_list_bitmap = qdf_mem_malloc(size);
 	if (!pdev->tx_desc.free_list_bitmap)
 		qdf_print("%s: malloc failed", __func__);
@@ -329,13 +329,19 @@ void ol_tx_desc_dup_detect_set(struct ol_txrx_pdev_t *pdev,
 				struct ol_tx_desc_t *tx_desc)
 {
 	uint16_t msdu_id = ol_tx_desc_id(pdev, tx_desc);
-	uint16_t index = msdu_id >> DIV_BY_32;
-	uint8_t pos = msdu_id & MOD_BY_32;
+	bool test;
 
 	if (!pdev->tx_desc.free_list_bitmap)
 		return;
 
-	if (qdf_unlikely(pdev->tx_desc.free_list_bitmap[index] & (1 << pos))) {
+	if (qdf_unlikely(msdu_id > pdev->tx_desc.pool_size)) {
+		qdf_print("%s: msdu_id %d > pool_size %d",
+			  __func__, msdu_id, pdev->tx_desc.pool_size);
+		QDF_BUG(0);
+	}
+
+	test = test_and_set_bit(msdu_id, pdev->tx_desc.free_list_bitmap);
+	if (qdf_unlikely(test)) {
 		uint16_t size = (pdev->tx_desc.pool_size >> DIV_BY_8) +
 			((pdev->tx_desc.pool_size & MOD_BY_8) ? 1 : 0);
 		qdf_print("duplicate msdu_id %d detected !!\n", msdu_id);
@@ -343,7 +349,6 @@ void ol_tx_desc_dup_detect_set(struct ol_txrx_pdev_t *pdev,
 		(void *)pdev->tx_desc.free_list_bitmap, size);
 		QDF_BUG(0);
 	}
-	pdev->tx_desc.free_list_bitmap[index] |= (1 << pos);
 }
 
 /**
@@ -358,14 +363,19 @@ void ol_tx_desc_dup_detect_reset(struct ol_txrx_pdev_t *pdev,
 				 struct ol_tx_desc_t *tx_desc)
 {
 	uint16_t msdu_id = ol_tx_desc_id(pdev, tx_desc);
-	uint16_t index = msdu_id >> DIV_BY_32;
-	uint8_t pos = msdu_id & MOD_BY_32;
+	bool test;
 
 	if (!pdev->tx_desc.free_list_bitmap)
 		return;
 
-	if (qdf_unlikely(!
-		(pdev->tx_desc.free_list_bitmap[index] & (1 << pos)))) {
+	if (qdf_unlikely(msdu_id > pdev->tx_desc.pool_size)) {
+		qdf_print("%s: msdu_id %d > pool_size %d",
+			  __func__, msdu_id, pdev->tx_desc.pool_size);
+		QDF_BUG(0);
+	}
+
+	test = !test_and_clear_bit(msdu_id, pdev->tx_desc.free_list_bitmap);
+	if (qdf_unlikely(test)) {
 		uint16_t size = (pdev->tx_desc.pool_size >> DIV_BY_8) +
 			((pdev->tx_desc.pool_size & MOD_BY_8) ? 1 : 0);
 		qdf_print("duplicate free msg received for msdu_id %d!!\n",
@@ -374,7 +384,6 @@ void ol_tx_desc_dup_detect_reset(struct ol_txrx_pdev_t *pdev,
 		(void *)pdev->tx_desc.free_list_bitmap, size);
 		QDF_BUG(0);
 	}
-	pdev->tx_desc.free_list_bitmap[index] &= ~(1 << pos);
 }
 #else
 static inline

+ 13 - 7
core/dp/txrx/ol_tx_queue.c

@@ -80,7 +80,7 @@ ol_tx_queue_vdev_flush(struct ol_txrx_pdev_t *pdev, struct ol_txrx_vdev_t *vdev)
 	/* flush VDEV TX queues */
 	for (i = 0; i < OL_TX_VDEV_NUM_QUEUES; i++) {
 		txq = &vdev->txqs[i];
-		ol_tx_queue_free(pdev, txq, (i + OL_TX_NUM_TIDS));
+		ol_tx_queue_free(pdev, txq, (i + OL_TX_NUM_TIDS), false);
 	}
 	/* flush PEER TX queues */
 	do {
@@ -92,6 +92,12 @@ ol_tx_queue_vdev_flush(struct ol_txrx_pdev_t *pdev, struct ol_txrx_vdev_t *vdev)
 				txq = &peer->txqs[i];
 				if (txq->frms) {
 					qdf_atomic_inc(&peer->ref_cnt);
+					QDF_TRACE(QDF_MODULE_ID_TXRX,
+						 QDF_TRACE_LEVEL_INFO_HIGH,
+						 "%s: peer %p peer->ref_cnt %d",
+						  __func__, peer,
+						  qdf_atomic_read
+							(&peer->ref_cnt));
 					peers[peer_count++] = peer;
 					break;
 				}
@@ -105,7 +111,7 @@ ol_tx_queue_vdev_flush(struct ol_txrx_pdev_t *pdev, struct ol_txrx_vdev_t *vdev)
 			for (j = 0; j < OL_TX_NUM_TIDS; j++) {
 				txq = &peers[i]->txqs[j];
 				if (txq->frms)
-					ol_tx_queue_free(pdev, txq, j);
+					ol_tx_queue_free(pdev, txq, j, true);
 			}
 			TXRX_PRINT(TXRX_PRINT_LEVEL_ERR,
 				   "%s: Delete Peer %p\n", __func__, peer);
@@ -312,7 +318,7 @@ void
 ol_tx_queue_free(
 	struct ol_txrx_pdev_t *pdev,
 	struct ol_tx_frms_queue_t *txq,
-	int tid)
+	int tid, bool is_peer_txq)
 {
 	int frms = 0, bytes = 0;
 	struct ol_tx_desc_t *tx_desc;
@@ -335,9 +341,9 @@ ol_tx_queue_free(
 		txq->frms--;
 		tx_desc = TAILQ_NEXT(tx_desc, tx_desc_list_elem);
 	}
-	ol_tx_queue_log_free(pdev, txq, tid, frms, bytes);
+	ol_tx_queue_log_free(pdev, txq, tid, frms, bytes, is_peer_txq);
 	txq->bytes -= bytes;
-	ol_tx_queue_log_free(pdev, txq, tid, frms, bytes);
+	ol_tx_queue_log_free(pdev, txq, tid, frms, bytes, is_peer_txq);
 	txq->flag = ol_tx_queue_empty;
 	/* txq->head gets reset during the TAILQ_CONCAT call */
 	TAILQ_CONCAT(&tx_tmp_list, &txq->head, tx_desc_list_elem);
@@ -1499,7 +1505,7 @@ void
 ol_tx_queue_log_free(
 	struct ol_txrx_pdev_t *pdev,
 	struct ol_tx_frms_queue_t *txq,
-	int tid, int frms, int bytes)
+	int tid, int frms, int bytes, bool is_peer_txq)
 {
 	u_int16_t peer_id;
 	struct ol_tx_log_queue_add_t *log_elem;
@@ -1512,7 +1518,7 @@ ol_tx_queue_log_free(
 		return;
 	}
 
-	if (tid < OL_TX_NUM_TIDS) {
+	if ((tid < OL_TX_NUM_TIDS) && is_peer_txq) {
 		struct ol_txrx_peer_t *peer;
 		struct ol_tx_frms_queue_t *txq_base;
 

+ 6 - 4
core/dp/txrx/ol_tx_queue.h

@@ -76,6 +76,7 @@ ol_tx_queue_log_dequeue(struct ol_txrx_pdev_t *pdev,
  * @tid: tid value
  * @frms: number of frames for which logs need to be freed
  * @bytes: number of bytes
+ * @is_peer_txq - peer queue or not
  *
  *
  * Return: None
@@ -83,7 +84,7 @@ ol_tx_queue_log_dequeue(struct ol_txrx_pdev_t *pdev,
 void
 ol_tx_queue_log_free(struct ol_txrx_pdev_t *pdev,
 		     struct ol_tx_frms_queue_t *txq,
-		     int tid, int frms, int bytes);
+		     int tid, int frms, int bytes, bool is_peer_txq);
 
 #else
 
@@ -105,7 +106,7 @@ ol_tx_queue_log_dequeue(struct ol_txrx_pdev_t *pdev,
 static inline void
 ol_tx_queue_log_free(struct ol_txrx_pdev_t *pdev,
 		     struct ol_tx_frms_queue_t *txq,
-		     int tid, int frms, int bytes)
+		     int tid, int frms, int bytes, bool is_peer_txq)
 {
 	return;
 }
@@ -171,12 +172,13 @@ ol_tx_dequeue(
  * @param pdev - the physical device object, which stores the txqs
  * @param txq - which tx queue to free frames from
  * @param tid - the extended TID that the queue belongs to
+ * @param is_peer_txq - peer queue or not
  */
 void
 ol_tx_queue_free(
 		struct ol_txrx_pdev_t *pdev,
 		struct ol_tx_frms_queue_t *txq,
-		int tid);
+		int tid, bool is_peer_txq);
 
 /**
  * @brief - discard pending tx frames from the tx queue
@@ -224,7 +226,7 @@ static inline void
 ol_tx_queue_free(
 		struct ol_txrx_pdev_t *pdev,
 		struct ol_tx_frms_queue_t *txq,
-		int tid)
+		int tid, bool is_peer_txq)
 {
 	return;
 }

+ 2 - 2
core/dp/txrx/ol_tx_send.c

@@ -551,11 +551,12 @@ ol_tx_completion_handler(ol_txrx_pdev_handle pdev,
 		tx_desc = ol_tx_desc_find(pdev, tx_desc_id);
 		tx_desc->status = status;
 		netbuf = tx_desc->netbuf;
+		QDF_NBUF_UPDATE_TX_PKT_COUNT(netbuf, QDF_NBUF_TX_PKT_FREE);
 		DPTRACE(qdf_dp_trace_ptr(netbuf,
 			QDF_DP_TRACE_FREE_PACKET_PTR_RECORD,
 			qdf_nbuf_data_addr(netbuf),
 			sizeof(qdf_nbuf_data(netbuf)), tx_desc->id, status));
-		qdf_runtime_pm_put();
+		htc_pm_runtime_put(pdev->htt_pdev->htc_pdev);
 		ol_tx_desc_update_group_credit(pdev, tx_desc_id, 1, 0, status);
 		/* Per SDU update of byte count */
 		byte_cnt += qdf_nbuf_len(netbuf);
@@ -569,7 +570,6 @@ ol_tx_completion_handler(ol_txrx_pdev_handle pdev,
 			ol_tx_msdu_complete(pdev, tx_desc, tx_descs, netbuf,
 					    lcl_freelist, tx_desc_last, status);
 		}
-		QDF_NBUF_UPDATE_TX_PKT_COUNT(netbuf, QDF_NBUF_TX_PKT_FREE);
 #ifdef QCA_SUPPORT_TXDESC_SANITY_CHECKS
 		tx_desc->pkt_type = 0xff;
 #ifdef QCA_COMPUTE_TX_DELAY

+ 73 - 15
core/dp/txrx/ol_txrx.c

@@ -95,9 +95,9 @@ void
 ol_txrx_copy_mac_addr_raw(ol_txrx_vdev_handle vdev, uint8_t *bss_addr)
 {
 	if (bss_addr && vdev->last_real_peer &&
-	    (qdf_mem_cmp((u8 *)bss_addr,
+	    !qdf_mem_cmp((u8 *)bss_addr,
 			     vdev->last_real_peer->mac_addr.raw,
-			     IEEE80211_ADDR_LEN) == 0))
+			     IEEE80211_ADDR_LEN))
 		qdf_mem_copy(vdev->hl_tdls_ap_mac_addr.raw,
 			     vdev->last_real_peer->mac_addr.raw,
 			     OL_TXRX_MAC_ADDR_LEN);
@@ -169,6 +169,26 @@ ol_txrx_update_last_real_peer(
 }
 #endif
 
+/**
+ * ol_tx_mark_first_wakeup_packet() - set flag to indicate that
+ *    fw is compatible for marking first packet after wow wakeup
+ * @value: 1 for enabled/ 0 for disabled
+ *
+ * Return: None
+ */
+void ol_tx_mark_first_wakeup_packet(uint8_t value)
+{
+	struct ol_txrx_pdev_t *pdev = cds_get_context(QDF_MODULE_ID_TXRX);
+
+	if (!pdev) {
+		TXRX_PRINT(TXRX_PRINT_LEVEL_ERR,
+			"%s: pdev is NULL\n", __func__);
+		return;
+	}
+
+	htt_mark_first_wakeup_packet(pdev->htt_pdev, value);
+}
+
 u_int16_t
 ol_tx_desc_pool_size_hl(ol_pdev_handle ctrl_pdev)
 {
@@ -258,6 +278,9 @@ ol_txrx_find_peer_by_addr_and_vdev(ol_txrx_pdev_handle pdev,
 		return NULL;
 	*peer_id = peer->local_id;
 	qdf_atomic_dec(&peer->ref_cnt);
+	QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO_HIGH,
+		 "%s: peer %p peer->ref_cnt %d", __func__, peer,
+		 qdf_atomic_read(&peer->ref_cnt));
 	return peer;
 }
 
@@ -312,6 +335,9 @@ ol_txrx_peer_handle ol_txrx_find_peer_by_addr(ol_txrx_pdev_handle pdev,
 		return NULL;
 	*peer_id = peer->local_id;
 	qdf_atomic_dec(&peer->ref_cnt);
+	QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO_HIGH,
+		 "%s: peer %p peer->ref_cnt %d", __func__, peer,
+		 qdf_atomic_read(&peer->ref_cnt));
 	return peer;
 }
 
@@ -844,7 +870,7 @@ ol_txrx_vdev_tx_queue_free(struct ol_txrx_vdev_t *vdev)
 
 	for (i = 0; i < OL_TX_VDEV_NUM_QUEUES; i++) {
 		txq = &vdev->txqs[i];
-		ol_tx_queue_free(pdev, txq, (i + OL_TX_NUM_TIDS));
+		ol_tx_queue_free(pdev, txq, (i + OL_TX_NUM_TIDS), false);
 	}
 }
 
@@ -898,7 +924,7 @@ ol_txrx_peer_tx_queue_free(struct ol_txrx_pdev_t *pdev,
 
 	for (i = 0; i < OL_TX_NUM_TIDS; i++) {
 		txq = &peer->txqs[i];
-		ol_tx_queue_free(pdev, txq, i);
+		ol_tx_queue_free(pdev, txq, i, true);
 	}
 }
 #else
@@ -1380,6 +1406,7 @@ ol_txrx_pdev_post_attach(ol_txrx_pdev_handle pdev)
 	qdf_spinlock_create(&pdev->peer_ref_mutex);
 	qdf_spinlock_create(&pdev->rx.mutex);
 	qdf_spinlock_create(&pdev->last_real_peer_mutex);
+	qdf_spinlock_create(&pdev->peer_map_unmap_lock);
 	OL_TXRX_PEER_STATS_MUTEX_INIT(pdev);
 
 	if (OL_RX_REORDER_TRACE_ATTACH(pdev) != A_OK)
@@ -1656,6 +1683,7 @@ void ol_txrx_pdev_detach(ol_txrx_pdev_handle pdev, int force)
 	qdf_spinlock_destroy(&pdev->peer_ref_mutex);
 	qdf_spinlock_destroy(&pdev->last_real_peer_mutex);
 	qdf_spinlock_destroy(&pdev->rx.mutex);
+	qdf_spinlock_destroy(&pdev->peer_map_unmap_lock);
 #ifdef QCA_SUPPORT_TX_THROTTLE
 	/* Thermal Mitigation */
 	qdf_spinlock_destroy(&pdev->tx_throttle.mutex);
@@ -2059,7 +2087,6 @@ ol_txrx_peer_attach(ol_txrx_vdev_handle vdev, uint8_t *peer_mac_addr)
 	struct ol_txrx_peer_t *peer;
 	struct ol_txrx_peer_t *temp_peer;
 	uint8_t i;
-	int differs;
 	bool wait_on_deletion = false;
 	unsigned long rc;
 	struct ol_txrx_pdev_t *pdev;
@@ -2154,18 +2181,17 @@ ol_txrx_peer_attach(ol_txrx_vdev_handle vdev, uint8_t *peer_mac_addr)
 
 	ol_txrx_peer_find_hash_add(pdev, peer);
 
-	TXRX_PRINT(TXRX_PRINT_LEVEL_INFO2,
-		   "vdev %p created peer %p (%02x:%02x:%02x:%02x:%02x:%02x)\n",
-		   vdev, peer,
+	QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO_HIGH,
+		   "vdev %p created peer %p ref_cnt %d (%02x:%02x:%02x:%02x:%02x:%02x)\n",
+		   vdev, peer, qdf_atomic_read(&peer->ref_cnt),
 		   peer->mac_addr.raw[0], peer->mac_addr.raw[1],
 		   peer->mac_addr.raw[2], peer->mac_addr.raw[3],
 		   peer->mac_addr.raw[4], peer->mac_addr.raw[5]);
 	/*
 	 * For every peer MAp message search and set if bss_peer
 	 */
-	differs = qdf_mem_cmp(peer->mac_addr.raw, vdev->mac_addr.raw,
-				OL_TXRX_MAC_ADDR_LEN);
-	if (differs)
+	if (qdf_mem_cmp(peer->mac_addr.raw, vdev->mac_addr.raw,
+				OL_TXRX_MAC_ADDR_LEN))
 		peer->bss_peer = 1;
 
 	/*
@@ -2360,6 +2386,7 @@ ol_txrx_is_rx_fwd_disabled(ol_txrx_vdev_handle vdev)
 	return cfg->rx_fwd_disabled;
 }
 
+#ifdef QCA_IBSS_SUPPORT
 /**
  * ol_txrx_update_ibss_add_peer_num_of_vdev() - update and return peer num
  * @vdev: vdev handle
@@ -2399,6 +2426,7 @@ uint16_t ol_txrx_set_ibss_vdev_heart_beat_timer(ol_txrx_vdev_handle vdev,
 
 	return old_timer_value;
 }
+#endif
 
 /**
  * ol_txrx_remove_peers_for_vdev() - remove all vdev peers with lock held
@@ -2546,6 +2574,9 @@ QDF_STATUS ol_txrx_peer_state_update(struct ol_txrx_pdev_t *pdev,
 			   __func__);
 #endif
 		qdf_atomic_dec(&peer->ref_cnt);
+		QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO_HIGH,
+			 "%s: peer %p peer->ref_cnt %d", __func__, peer,
+			 qdf_atomic_read(&peer->ref_cnt));
 		return QDF_STATUS_SUCCESS;
 	}
 
@@ -2576,7 +2607,9 @@ QDF_STATUS ol_txrx_peer_state_update(struct ol_txrx_pdev_t *pdev,
 		}
 	}
 	qdf_atomic_dec(&peer->ref_cnt);
-
+	QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO_HIGH,
+		 "%s: peer %p peer->ref_cnt %d", __func__, peer,
+		 qdf_atomic_read(&peer->ref_cnt));
 	/* Set the state after the Pause to avoid the race condiction
 	   with ADDBA check in tx path */
 	peer->state = state;
@@ -2679,6 +2712,9 @@ ol_txrx_peer_update(ol_txrx_vdev_handle vdev,
 	}
 	}
 	qdf_atomic_dec(&peer->ref_cnt);
+	QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO_HIGH,
+		 "%s: peer %p peer->ref_cnt %d", __func__, peer,
+		 qdf_atomic_read(&peer->ref_cnt));
 }
 
 uint8_t
@@ -2755,7 +2791,7 @@ void ol_txrx_peer_unref_delete(ol_txrx_peer_handle peer)
 		u_int16_t peer_id;
 
 		TXRX_PRINT(TXRX_PRINT_LEVEL_ERR,
-			   "Deleting peer %p (%02x:%02x:%02x:%02x:%02x:%02x)\n",
+			   "Deleting peer %p (%02x:%02x:%02x:%02x:%02x:%02x)",
 			   peer,
 			   peer->mac_addr.raw[0], peer->mac_addr.raw[1],
 			   peer->mac_addr.raw[2], peer->mac_addr.raw[3],
@@ -2801,10 +2837,10 @@ void ol_txrx_peer_unref_delete(ol_txrx_peer_handle peer)
 				 */
 				qdf_spin_unlock_bh(&pdev->peer_ref_mutex);
 
-				TXRX_PRINT(TXRX_PRINT_LEVEL_INFO1,
+				TXRX_PRINT(TXRX_PRINT_LEVEL_ERR,
 					   "%s: deleting vdev object %p "
 					   "(%02x:%02x:%02x:%02x:%02x:%02x)"
-					   " - its last peer is done\n",
+					   " - its last peer is done",
 					   __func__, vdev,
 					   vdev->mac_addr.raw[0],
 					   vdev->mac_addr.raw[1],
@@ -2847,6 +2883,9 @@ void ol_txrx_peer_unref_delete(ol_txrx_peer_handle peer)
 
 		qdf_mem_free(peer);
 	} else {
+		QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO_HIGH,
+			 "%s: peer %p peer->ref_cnt = %d", __func__, peer,
+			 qdf_atomic_read(&peer->ref_cnt));
 		qdf_spin_unlock_bh(&pdev->peer_ref_mutex);
 	}
 }
@@ -3767,6 +3806,25 @@ void ol_vdev_rx_set_intrabss_fwd(ol_txrx_vdev_handle vdev, bool val)
 	vdev->disable_intrabss_fwd = val;
 }
 
+/**
+ * ol_txrx_update_mac_id() - update mac_id for vdev
+ * @vdev_id: vdev id
+ * @mac_id: mac id
+ *
+ * Return: none
+ */
+void ol_txrx_update_mac_id(uint8_t vdev_id, uint8_t mac_id)
+{
+	ol_txrx_vdev_handle vdev = ol_txrx_get_vdev_from_vdev_id(vdev_id);
+
+	if (NULL == vdev) {
+		QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
+			  "%s: Invalid vdev_id %d", __func__, vdev_id);
+		return;
+	}
+	vdev->mac_id = mac_id;
+}
+
 #ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL
 
 /**

+ 1 - 0
core/dp/txrx/ol_txrx.h

@@ -133,4 +133,5 @@ ol_txrx_vdev_handle ol_txrx_get_vdev_from_vdev_id(uint8_t vdev_id);
 void htt_pkt_log_init(struct ol_txrx_pdev_t *handle, void *scn);
 QDF_STATUS ol_txrx_set_wisa_mode(ol_txrx_vdev_handle vdev,
 			bool enable);
+void ol_txrx_update_mac_id(uint8_t vdev_id, uint8_t mac_id);
 #endif /* _OL_TXRX__H_ */

+ 18 - 1
core/dp/txrx/ol_txrx_flow_control.c

@@ -157,6 +157,11 @@ void ol_tx_dump_flow_pool_info(void)
 
 
 	TXRX_PRINT(TXRX_PRINT_LEVEL_ERR, "Global Pool");
+	if (!pdev) {
+		TXRX_PRINT(TXRX_PRINT_LEVEL_ERR, "ERROR: pdev NULL");
+		QDF_ASSERT(0); /* traceback */
+		return;
+	}
 	TXRX_PRINT(TXRX_PRINT_LEVEL_ERR, "Total %d :: Available %d",
 		pdev->tx_desc.pool_size, pdev->tx_desc.num_free);
 	TXRX_PRINT(TXRX_PRINT_LEVEL_ERR, "Invalid flow_pool %d",
@@ -413,6 +418,13 @@ int ol_tx_delete_flow_pool(struct ol_tx_flow_pool_t *pool, bool force)
 	if (!pool) {
 		TXRX_PRINT(TXRX_PRINT_LEVEL_ERR,
 		   "%s: pool is NULL\n", __func__);
+		QDF_ASSERT(0);
+		return -ENOMEM;
+	}
+	if (!pdev) {
+		TXRX_PRINT(TXRX_PRINT_LEVEL_ERR,
+		   "%s: pdev is NULL\n", __func__);
+		QDF_ASSERT(0);
 		return -ENOMEM;
 	}
 
@@ -512,6 +524,12 @@ struct ol_tx_flow_pool_t *ol_tx_get_flow_pool(uint8_t flow_pool_id)
 	struct ol_tx_flow_pool_t *pool = NULL;
 	bool is_found = false;
 
+	if (!pdev) {
+		TXRX_PRINT(TXRX_PRINT_LEVEL_ERR, "ERROR: pdev NULL");
+		QDF_ASSERT(0); /* traceback */
+		return NULL;
+	}
+
 	qdf_spin_lock_bh(&pdev->tx_desc.flow_pool_list_lock);
 	TAILQ_FOREACH(pool, &pdev->tx_desc.flow_pool_list,
 					 flow_pool_list_elem) {
@@ -529,7 +547,6 @@ struct ol_tx_flow_pool_t *ol_tx_get_flow_pool(uint8_t flow_pool_id)
 		pool = NULL;
 
 	return pool;
-
 }
 
 

+ 1 - 1
core/dp/txrx/ol_txrx_internal.h

@@ -693,7 +693,7 @@ NOT_IP_TCP:
 	do { \
 		if (_p_cntrs == 1) { \
 			TXRX_STATS_ADD(_pdev, pub.tx.tso.tso_hist.pkts_1, 1); \
-		} else if (_p_cntrs > 2 && _p_cntrs <= 5) {                   \
+		} else if (_p_cntrs >= 2 && _p_cntrs <= 5) {                   \
 			TXRX_STATS_ADD(_pdev,                                 \
 				pub.tx.tso.tso_hist.pkts_2_5, 1);             \
 		} else if (_p_cntrs > 5 && _p_cntrs <= 10) {                  \

+ 113 - 57
core/dp/txrx/ol_txrx_peer_find.c

@@ -69,20 +69,6 @@ static int ol_txrx_log2_ceil(unsigned value)
 	return log2;
 }
 
-static int
-ol_txrx_peer_find_add_id_to_obj(struct ol_txrx_peer_t *peer, uint16_t peer_id)
-{
-	int i;
-
-	for (i = 0; i < MAX_NUM_PEER_ID_PER_PEER; i++) {
-		if (peer->peer_ids[i] == HTT_INVALID_PEER) {
-			peer->peer_ids[i] = peer_id;
-			return 0;       /* success */
-		}
-	}
-	return 1;               /* failure */
-}
-
 /*=== function definitions for peer MAC addr --> peer object hash table =====*/
 
 /*
@@ -195,6 +181,10 @@ struct ol_txrx_peer_t *ol_txrx_peer_vdev_find_hash(struct ol_txrx_pdev_t *pdev,
 			/* found it - increment the ref count before releasing
 			   the lock */
 			qdf_atomic_inc(&peer->ref_cnt);
+			QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO_HIGH,
+				 "%s: peer %p peer->ref_cnt %d",
+				 __func__, peer,
+				 qdf_atomic_read(&peer->ref_cnt));
 			qdf_spin_unlock_bh(&pdev->peer_ref_mutex);
 			return peer;
 		}
@@ -228,6 +218,10 @@ struct ol_txrx_peer_t *ol_txrx_peer_find_hash_find(struct ol_txrx_pdev_t *pdev,
 			   releasing the lock */
 			qdf_atomic_inc(&peer->ref_cnt);
 			qdf_spin_unlock_bh(&pdev->peer_ref_mutex);
+			QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO_HIGH,
+				 "%s: peer %p peer->ref_cnt %d",
+				 __func__, peer,
+				 qdf_atomic_read(&peer->ref_cnt));
 			return peer;
 		}
 	}
@@ -292,9 +286,11 @@ void ol_txrx_peer_find_hash_erase(struct ol_txrx_pdev_t *pdev)
 				 */
 				qdf_atomic_init(&peer->ref_cnt); /* set to 0 */
 				qdf_atomic_inc(&peer->ref_cnt); /* incr to 1 */
-				TXRX_PRINT(TXRX_PRINT_LEVEL_ERR,
-					   "%s: Delete Peer %p\n", __func__,
-					   peer);
+				QDF_TRACE(QDF_MODULE_ID_TXRX,
+					 QDF_TRACE_LEVEL_INFO_HIGH,
+					 "%s: Delete Peer %p ref_cnt %d\n",
+					 __func__, peer,
+					 qdf_atomic_read(&peer->ref_cnt));
 				ol_txrx_peer_unref_delete(peer);
 			}
 		}
@@ -336,45 +332,78 @@ ol_txrx_peer_find_add_id(struct ol_txrx_pdev_t *pdev,
 			 uint8_t *peer_mac_addr, uint16_t peer_id)
 {
 	struct ol_txrx_peer_t *peer;
+	int status;
+	int del_peer_ref = 0;
+	int i;
 
 	/* check if there's already a peer object with this MAC address */
 	peer =
 		ol_txrx_peer_find_hash_find(pdev, peer_mac_addr,
 					    1 /* is aligned */, 0);
-	TXRX_PRINT(TXRX_PRINT_LEVEL_INFO1, "%s: peer %p ID %d\n", __func__,
-		   peer, peer_id);
-	if (peer) {
-		/* peer's ref count was already incremented by
-		   peer_find_hash_find */
-		if (!pdev->peer_id_to_obj_map[peer_id].peer) {
-			pdev->peer_id_to_obj_map[peer_id].peer = peer;
-			qdf_atomic_init
-			  (&pdev->peer_id_to_obj_map[peer_id].peer_id_ref_cnt);
-		}
-		qdf_atomic_inc
-			(&pdev->peer_id_to_obj_map[peer_id].peer_id_ref_cnt);
+
+	if (!peer || peer_id == HTT_INVALID_PEER) {
 		/*
-		 * remove the reference added in ol_txrx_peer_find_hash_find.
-		 * the reference for the first peer id is already added in
-		 * ol_txrx_peer_attach.
-		 * Riva/Pronto has one peer id for each peer.
-		 * Peregrine/Rome has two peer id for each peer.
+		 * Currently peer IDs are assigned for vdevs as well as peers.
+		 * If the peer ID is for a vdev, then we will fail to find a
+		 * peer with a matching MAC address.
 		 */
-		if (peer->peer_ids[0] == HTT_INVALID_PEER) {
-			ol_txrx_peer_unref_delete(peer);
-		}
-		if (ol_txrx_peer_find_add_id_to_obj(peer, peer_id)) {
-			/* TBDXXX: assert for now */
-			qdf_assert(0);
-		}
+		TXRX_PRINT(TXRX_PRINT_LEVEL_ERR,
+			  "%s: peer not found or peer ID is %d invalid",
+			  __func__, peer_id);
 		return;
 	}
+
+	qdf_spin_lock(&pdev->peer_map_unmap_lock);
+
+	/* peer's ref count was already incremented by
+	 * peer_find_hash_find
+	 */
+	if (!pdev->peer_id_to_obj_map[peer_id].peer) {
+		pdev->peer_id_to_obj_map[peer_id].peer = peer;
+		qdf_atomic_init
+		  (&pdev->peer_id_to_obj_map[peer_id].peer_id_ref_cnt);
+	}
+	qdf_atomic_inc
+		(&pdev->peer_id_to_obj_map[peer_id].peer_id_ref_cnt);
+
+	if (peer->peer_ids[0] == HTT_INVALID_PEER)
+		del_peer_ref = 1;
+
+	status = 1;
+	for (i = 0; i < MAX_NUM_PEER_ID_PER_PEER; i++) {
+		if (peer->peer_ids[i] == HTT_INVALID_PEER) {
+			peer->peer_ids[i] = peer_id;
+			status = 0;
+			break;
+		}
+	}
+
 	/*
-	 * Currently peer IDs are assigned for vdevs as well as peers.
-	 * If the peer ID is for a vdev, then we will fail to find a peer
-	 * with a matching MAC address.
+	 * remove the reference added in ol_txrx_peer_find_hash_find.
+	 * the reference for the first peer id is already added in
+	 * ol_txrx_peer_attach.
+	 * Riva/Pronto has one peer id for each peer.
+	 * Peregrine/Rome has two peer id for each peer.
 	 */
-	/* TXRX_ASSERT2(0); */
+	if (del_peer_ref)
+		ol_txrx_peer_unref_delete(peer);
+
+	qdf_spin_unlock(&pdev->peer_map_unmap_lock);
+
+	QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO_HIGH,
+	   "%s: peer %p ID %d peer_id[%d] peer_id_ref_cnt %d peer->ref_cnt %d",
+	   __func__, peer, peer_id, i,
+	   qdf_atomic_read(&pdev->
+				peer_id_to_obj_map[peer_id].
+				peer_id_ref_cnt),
+	   qdf_atomic_read(&peer->ref_cnt));
+
+	if (status) {
+		/* TBDXXX: assert for now */
+		qdf_assert(0);
+	}
+
+	return;
 }
 
 /*=== allocation / deallocation function definitions ========================*/
@@ -481,30 +510,52 @@ void ol_txrx_peer_tx_ready_handler(ol_txrx_pdev_handle pdev, uint16_t peer_id)
 void ol_rx_peer_unmap_handler(ol_txrx_pdev_handle pdev, uint16_t peer_id)
 {
 	struct ol_txrx_peer_t *peer;
-	peer = (peer_id == HTT_INVALID_PEER) ? NULL :
-	       pdev->peer_id_to_obj_map[peer_id].peer;
-	TXRX_PRINT(TXRX_PRINT_LEVEL_INFO1,
-		   "%s: peer %p with ID %d to be unmapped.\n", __func__, peer,
-		   peer_id);
+	int i = 0;
 
-	if (qdf_atomic_dec_and_test
-		(&pdev->peer_id_to_obj_map[peer_id].peer_id_ref_cnt)) {
-		pdev->peer_id_to_obj_map[peer_id].peer = NULL;
+	if (peer_id == HTT_INVALID_PEER) {
+		TXRX_PRINT(TXRX_PRINT_LEVEL_ERR,
+		   "%s: invalid peer ID %d\n", __func__, peer_id);
+		return;
 	}
+
+	qdf_spin_lock(&pdev->peer_map_unmap_lock);
+
+	peer = pdev->peer_id_to_obj_map[peer_id].peer;
+
+	if (peer == NULL) {
 	/*
 	 * Currently peer IDs are assigned for vdevs as well as peers.
 	 * If the peer ID is for a vdev, then the peer pointer stored
 	 * in peer_id_to_obj_map will be NULL.
 	 */
-	if (!peer)
+		qdf_spin_unlock(&pdev->peer_map_unmap_lock);
 		return;
+	}
+
+	if (qdf_atomic_dec_and_test
+		(&pdev->peer_id_to_obj_map[peer_id].peer_id_ref_cnt)) {
+		pdev->peer_id_to_obj_map[peer_id].peer = NULL;
+
+		for (i = 0; i < MAX_NUM_PEER_ID_PER_PEER; i++) {
+			if (peer->peer_ids[i] == peer_id) {
+				peer->peer_ids[i] = HTT_INVALID_PEER;
+				break;
+			}
+		}
+	}
+
+	qdf_spin_unlock(&pdev->peer_map_unmap_lock);
+
+	TXRX_PRINT(TXRX_PRINT_LEVEL_ERR,
+		   "%s: Remove the ID %d reference to peer %p peer_id_ref_cnt %d",
+		   __func__, peer_id, peer,
+		   qdf_atomic_read
+			(&pdev->peer_id_to_obj_map[peer_id].peer_id_ref_cnt));
+
 	/*
 	 * Remove a reference to the peer.
 	 * If there are no more references, delete the peer object.
 	 */
-	TXRX_PRINT(TXRX_PRINT_LEVEL_ERR,
-		   "%s: Remove the ID %d reference to peer %p\n",
-		   __func__, peer_id, peer);
 	ol_txrx_peer_unref_delete(peer);
 }
 
@@ -521,6 +572,11 @@ struct ol_txrx_peer_t *ol_txrx_assoc_peer_find(struct ol_txrx_vdev_t *vdev)
 	    && vdev->last_real_peer->peer_ids[0] != HTT_INVALID_PEER_ID) {
 		qdf_atomic_inc(&vdev->last_real_peer->ref_cnt);
 		peer = vdev->last_real_peer;
+		QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO_HIGH,
+			 "%s: peer %p peer->ref_cnt %d",
+			 __func__, peer,
+			 qdf_atomic_read
+				(&peer->ref_cnt));
 	} else {
 		peer = NULL;
 	}

+ 10 - 1
core/dp/txrx/ol_txrx_types.h

@@ -669,7 +669,7 @@ struct ol_txrx_pdev_t {
 		uint32_t offset_filter;
 		struct qdf_mem_multi_page_t desc_pages;
 #ifdef DESC_DUP_DETECT_DEBUG
-		uint32_t *free_list_bitmap;
+		unsigned long *free_list_bitmap;
 #endif
 	} tx_desc;
 
@@ -712,6 +712,8 @@ struct ol_txrx_pdev_t {
 	 */
 	OL_RX_MUTEX_TYPE last_real_peer_mutex;
 
+	qdf_spinlock_t peer_map_unmap_lock;
+
 	struct {
 		struct {
 			struct {
@@ -1058,6 +1060,7 @@ struct ol_txrx_vdev_t {
 	uint64_t fwd_tx_packets;
 	uint64_t fwd_rx_packets;
 	bool is_wisa_mode_enable;
+	uint8_t mac_id;
 };
 
 struct ol_rx_reorder_array_elem_t {
@@ -1251,4 +1254,10 @@ struct ol_error_info {
 		struct ol_mic_error_info mic_err;
 	} u;
 };
+
+struct ol_rx_remote_data {
+	qdf_nbuf_t msdu;
+	uint8_t mac_id;
+};
+
 #endif /* _OL_TXRX_TYPES__H_ */

+ 1 - 0
core/dp/txrx/wdi_event.h

@@ -38,6 +38,7 @@ enum WDI_EVENT {
 	WDI_EVENT_RX_DESC_REMOTE,
 	WDI_EVENT_RATE_FIND,
 	WDI_EVENT_RATE_UPDATE,
+	WDI_EVENT_SW_EVENT,
 	WDI_EVENT_RX_PEER_INVALID,
 	/* End of new event items */
 

+ 9 - 6
core/hdd/inc/qc_sap_ioctl.h

@@ -137,14 +137,14 @@ typedef struct {
 #define QCSAP_IOCTL_SET_NONE_GET_THREE (SIOCIWFIRSTPRIV + 3)
 #define WE_GET_TSF 1
 #define QCSAP_IOCTL_GET_STAWPAIE      (SIOCIWFIRSTPRIV + 4)
-#define QCSAP_IOCTL_SETWPAIE          (SIOCIWFIRSTPRIV + 5)
 #define QCSAP_IOCTL_STOPBSS           (SIOCIWFIRSTPRIV + 6)
 #define QCSAP_IOCTL_VERSION           (SIOCIWFIRSTPRIV + 7)
 #define QCSAP_IOCTL_GET_WPS_PBC_PROBE_REQ_IES       (SIOCIWFIRSTPRIV + 8)
 #define QCSAP_IOCTL_GET_CHANNEL       (SIOCIWFIRSTPRIV + 9)
 #define QCSAP_IOCTL_ASSOC_STA_MACADDR (SIOCIWFIRSTPRIV + 10)
 #define QCSAP_IOCTL_DISASSOC_STA      (SIOCIWFIRSTPRIV + 11)
-/* (SIOCIWFIRSTPRIV+12) is unused */
+#define QCSAP_IOCTL_SET_PKTLOG        (SIOCIWFIRSTPRIV + 12)
+
 /* Private ioctls and their sub-ioctls */
 #define QCSAP_PRIV_GET_CHAR_SET_NONE   (SIOCIWFIRSTPRIV + 13)
 #define QCSAP_GET_STATS 1
@@ -242,12 +242,15 @@ enum {
 	QCSAP_START_FW_PROFILING,
 	QCSAP_CAP_TSF,
 	QCSAP_GET_TSF,
-	QCSAP_PARAM_CONC_SYSTEM_PREF
+	QCSAP_PARAM_CONC_SYSTEM_PREF,
+	QCASAP_PARAM_LDPC,
+	QCASAP_PARAM_TX_STBC,
+	QCASAP_PARAM_RX_STBC,
 };
 
-int iw_softap_get_channel_list(struct net_device *dev,
-			       struct iw_request_info *info,
-			       union iwreq_data *wrqu, char *extra);
+int iw_get_channel_list(struct net_device *dev,
+		struct iw_request_info *info,
+		union iwreq_data *wrqu, char *extra);
 
 #endif /* __linux__ */
 

+ 82 - 1
core/hdd/inc/wlan_hdd_assoc.h

@@ -39,6 +39,8 @@
 #include <wlan_defs.h>
 #include "ol_txrx_ctrl_api.h"
 #include "cdp_txrx_peer_ops.h"
+#include <net/cfg80211.h>
+#include <linux/ieee80211.h>
 
 /* Preprocessor Definitions and Constants */
 #ifdef FEATURE_WLAN_TDLS
@@ -92,6 +94,58 @@ typedef enum {
 	ePeerDisconnected
 } ePeerStatus;
 
+/**
+ * struct hdd_conn_flag - connection flags
+ * @ht_present: ht element present or not
+ * @vht_present: vht element present or not
+ * @hs20_present: hs20 element present or not
+ * @ht_op_present: ht operation present or not
+ * @vht_op_present: vht operation present or not
+ */
+struct hdd_conn_flag {
+	uint8_t ht_present:1;
+	uint8_t vht_present:1;
+	uint8_t hs20_present:1;
+	uint8_t ht_op_present:1;
+	uint8_t vht_op_present:1;
+	uint8_t reserved:3;
+};
+
+/*defines for tx_BF_cap_info */
+#define TX_BF_CAP_INFO_TX_BF			0x00000001
+#define TX_BF_CAP_INFO_RX_STAG_RED_SOUNDING	0x00000002
+#define TX_BF_CAP_INFO_TX_STAG_RED_SOUNDING	0x00000004
+#define TX_BF_CAP_INFO_RX_ZFL			0x00000008
+#define TX_BF_CAP_INFO_TX_ZFL			0x00000010
+#define TX_BF_CAP_INFO_IMP_TX_BF		0x00000020
+#define TX_BF_CAP_INFO_CALIBRATION		0x000000c0
+#define TX_BF_CAP_INFO_CALIBRATION_SHIFT	6
+#define TX_BF_CAP_INFO_EXP_CSIT_BF		0x00000100
+#define TX_BF_CAP_INFO_EXP_UNCOMP_STEER_MAT	0x00000200
+#define TX_BF_CAP_INFO_EXP_BF_CSI_FB		0x00001c00
+#define TX_BF_CAP_INFO_EXP_BF_CSI_FB_SHIFT	10
+#define TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT	0x0000e000
+#define TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT_SHIFT 13
+#define TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB	0x00070000
+#define TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB_SHIFT 16
+#define TX_BF_CAP_INFO_CSI_NUM_BF_ANT		0x00180000
+#define TX_BF_CAP_INFO_CSI_NUM_BF_ANT_SHIFT	18
+#define TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT	0x00600000
+#define TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT_SHIFT 20
+#define TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT	0x01800000
+#define TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT_SHIFT 22
+#define TX_BF_CAP_INFO_RSVD			0xfe000000
+
+/* defines for antenna selection info */
+#define ANTENNA_SEL_INFO			0x01
+#define ANTENNA_SEL_INFO_EXP_CSI_FB_TX		0x02
+#define ANTENNA_SEL_INFO_ANT_ID_FB_TX		0x04
+#define ANTENNA_SEL_INFO_EXP_CSI_FB		0x08
+#define ANTENNA_SEL_INFO_ANT_ID_FB		0x10
+#define ANTENNA_SEL_INFO_RX_AS			0x20
+#define ANTENNA_SEL_INFO_TX_SOUNDING_PPDU	0x40
+#define ANTENNA_SEL_INFO_RSVD			0x80
+
 /**
  * typedef connection_info_t - structure to store connection information
  * @connState: connection state of the NIC
@@ -115,6 +169,16 @@ typedef enum {
  * @gtk_installed: gtk installed state
  * @nss: number of spatial streams negotiated
  * @rate_flags: rate flags for current connection
+ * @freq: channel frequency
+ * @txrate: txrate structure holds nss & datarate info
+ * @noise: holds noise information
+ * @ht_caps: holds ht capabilities info
+ * @vht_caps: holds vht capabilities info
+ * @hs20vendor_ie: holds passpoint/hs20 info
+ * @conn_flag: flag conn info params is present or not
+ * @roam_count: roaming counter
+ * @signal: holds rssi info
+ * @assoc_status_code: holds assoc fail reason
  */
 typedef struct connection_info_s {
 	eConnectionState connState;
@@ -135,6 +199,18 @@ typedef struct connection_info_s {
 	bool gtk_installed;
 	uint8_t nss;
 	uint32_t rate_flags;
+	uint32_t freq;
+	struct rate_info txrate;
+	int8_t noise;
+	struct ieee80211_ht_cap ht_caps;
+	struct ieee80211_vht_cap vht_caps;
+	struct hdd_conn_flag conn_flag;
+	tDot11fIEhs20vendor_ie hs20vendor_ie;
+	struct ieee80211_ht_operation ht_operation;
+	struct ieee80211_vht_operation vht_operation;
+	uint32_t roam_count;
+	int8_t signal;
+	int32_t assoc_status_code;
 } connection_info_t;
 
 /* Forward declarations */
@@ -227,7 +303,7 @@ int hdd_set_csr_auth_type(hdd_adapter_t *pAdapter, eCsrAuthType RSNAuthType);
  */
 QDF_STATUS hdd_roam_register_tdlssta(hdd_adapter_t *pAdapter,
 				     const uint8_t *peerMac, uint16_t staId,
-				     uint8_t ucastSig);
+				     uint8_t ucastSig, uint8_t qos);
 
 /**
  * hdd_perform_roam_set_key_complete() - perform set key complete
@@ -282,4 +358,9 @@ void hdd_delete_peer(hdd_station_ctx_t *sta_ctx, uint8_t sta_id);
 int hdd_get_peer_idx(hdd_station_ctx_t *sta_ctx, struct qdf_mac_addr *addr);
 QDF_STATUS hdd_roam_deregister_sta(hdd_adapter_t *adapter, uint8_t sta_id);
 
+#ifdef WLAN_FEATURE_ROAM_OFFLOAD
+void hdd_wma_send_fastreassoc_cmd(int session_id, const tSirMacAddr bssid,
+				  int channel);
+#endif
+
 #endif

+ 228 - 123
core/hdd/inc/wlan_hdd_cfg.h

@@ -48,6 +48,10 @@
 
 #define FW_MODULE_LOG_LEVEL_STRING_LENGTH  (255)
 
+#define CFG_ENABLE_RX_THREAD		(1 << 0)
+#define CFG_ENABLE_RPS			(1 << 1)
+#define CFG_ENABLE_NAPI			(1 << 2)
+
 #ifdef DHCP_SERVER_OFFLOAD
 #define IPADDR_NUM_ENTRIES     (4)
 #define IPADDR_STRING_LENGTH   (16)
@@ -213,7 +217,7 @@ typedef enum {
 #define CFG_SCAN_RESULT_AGE_COUNT_NAME         "gScanResultAgeCount"
 #define CFG_SCAN_RESULT_AGE_COUNT_MIN          (1)
 #define CFG_SCAN_RESULT_AGE_COUNT_MAX          (100)
-#define CFG_SCAN_RESULT_AGE_COUNT_DEFAULT      (3)
+#define CFG_SCAN_RESULT_AGE_COUNT_DEFAULT      (1)
 
 /* All in seconds */
 /* Not Connect, No Power Save */
@@ -247,6 +251,16 @@ typedef enum {
 #define CFG_ROAM_PREFER_5GHZ_MAX              (1)
 #define CFG_ROAM_PREFER_5GHZ_DEFAULT          (1)
 
+/*
+ * Timer waiting for interface up from the upper layer. If
+ * this timer expires all the cds modules shall be closed.
+ * Time Units: ms
+ */
+#define CFG_INTERFACE_CHANGE_WAIT_NAME    "gInterfaceChangeWait"
+#define CFG_INTERFACE_CHANGE_WAIT_MIN     (10)
+#define CFG_INTERFACE_CHANGE_WAIT_MAX     (10000)
+#define CFG_INTERFACE_CHANGE_WAIT_DEFAULT (50)
+
 /*
     To enable, set gRoamIntraBand=1 (Roaming within band)
     To disable, set gRoamIntraBand=0 (Roaming across band)
@@ -269,22 +283,22 @@ typedef enum {
 #define CFG_INTF0_MAC_ADDR_NAME                  "Intf0MacAddress"
 #define CFG_INTF0_MAC_ADDR_MIN                   "000000000000"
 #define CFG_INTF0_MAC_ADDR_MAX                   "ffffffffffff"
-#define CFG_INTF0_MAC_ADDR_DEFAULT               "000AF5898980"
+#define CFG_INTF0_MAC_ADDR_DEFAULT               "000AF58989FF"
 
 #define CFG_INTF1_MAC_ADDR_NAME                  "Intf1MacAddress"
 #define CFG_INTF1_MAC_ADDR_MIN                   "000000000000"
 #define CFG_INTF1_MAC_ADDR_MAX                   "ffffffffffff"
-#define CFG_INTF1_MAC_ADDR_DEFAULT               "000AF5898981"
+#define CFG_INTF1_MAC_ADDR_DEFAULT               "000AF58989FE"
 
 #define CFG_INTF2_MAC_ADDR_NAME                  "Intf2MacAddress"
 #define CFG_INTF2_MAC_ADDR_MIN                   "000000000000"
 #define CFG_INTF2_MAC_ADDR_MAX                   "ffffffffffff"
-#define CFG_INTF2_MAC_ADDR_DEFAULT               "000AF5898982"
+#define CFG_INTF2_MAC_ADDR_DEFAULT               "000AF58989FD"
 
 #define CFG_INTF3_MAC_ADDR_NAME                  "Intf3MacAddress"
 #define CFG_INTF3_MAC_ADDR_MIN                   "000000000000"
 #define CFG_INTF3_MAC_ADDR_MAX                   "ffffffffffff"
-#define CFG_INTF3_MAC_ADDR_DEFAULT               "000AF5898983"
+#define CFG_INTF3_MAC_ADDR_DEFAULT               "000AF58989FC"
 
 #define CFG_AP_QOS_UAPSD_MODE_NAME             "gEnableApUapsd" /* ACs to setup U-APSD for at assoc */
 #define CFG_AP_QOS_UAPSD_MODE_MIN              (0)
@@ -324,11 +338,6 @@ typedef enum {
 #define CFG_AP_STA_SECURITY_SEPERATION_MAX     (1)
 #define CFG_AP_STA_SECURITY_SEPERATION_DEFAULT (0)
 
-#define CFG_AP_LISTEN_MODE_NAME               "gEnablePhyAgcListenMode"
-#define CFG_AP_LISTEN_MODE_MIN                (0)
-#define CFG_AP_LISTEN_MODE_MAX                (128)
-#define CFG_AP_LISTEN_MODE_DEFAULT            (128)
-
 #define CFG_AP_AUTO_SHUT_OFF                "gAPAutoShutOff"
 #define CFG_AP_AUTO_SHUT_OFF_MIN            (0)
 #define CFG_AP_AUTO_SHUT_OFF_MAX            (4294967295UL)
@@ -387,12 +396,6 @@ typedef enum {
 #define CFG_BEACON_INTERVAL_MAX                WNI_CFG_BEACON_INTERVAL_STAMAX
 #define CFG_BEACON_INTERVAL_DEFAULT            WNI_CFG_BEACON_INTERVAL_STADEF
 
-/* Additional Handoff related Parameters */
-#define CFG_ROAMING_TIME_NAME                 "gRoamingTime"
-#define CFG_ROAMING_TIME_MIN                  (0)
-#define CFG_ROAMING_TIME_MAX                  (4294967UL)
-#define CFG_ROAMING_TIME_DEFAULT              (10)
-
 #define CFG_VCC_RSSI_TRIGGER_NAME             "gVccRssiTrigger"
 #define CFG_VCC_RSSI_TRIGGER_MIN              (0)
 #define CFG_VCC_RSSI_TRIGGER_MAX              (80)
@@ -506,6 +509,12 @@ typedef enum {
 /* Not to use CFG default because if no registry setting, this is ignored by SME. */
 #define CFG_MAX_TX_POWER_DEFAULT                WNI_CFG_CURRENT_TX_POWER_LEVEL_STAMAX
 
+/* This ini controls driver to honor/dishonor power constraint from AP */
+#define CFG_TX_POWER_CTRL_NAME                 "gAllowTPCfromAP"
+#define CFG_TX_POWER_CTRL_DEFAULT              (1)
+#define CFG_TX_POWER_CTRL_MIN                  (0)
+#define CFG_TX_POWER_CTRL_MAX                  (1)
+
 #define CFG_LOW_GAIN_OVERRIDE_NAME             "gLowGainOverride"
 #define CFG_LOW_GAIN_OVERRIDE_MIN              WNI_CFG_LOW_GAIN_OVERRIDE_STAMIN
 #define CFG_LOW_GAIN_OVERRIDE_MAX              WNI_CFG_LOW_GAIN_OVERRIDE_STAMAX
@@ -529,11 +538,6 @@ typedef enum {
 #define CFG_MAX_LI_MODULATED_DTIM_MAX          (10)
 #define CFG_MAX_LI_MODULATED_DTIM_DEFAULT      (10)
 
-#define CFG_RX_ANT_CONFIGURATION_NAME          "gNumRxAnt"
-#define CFG_RX_ANT_CONFIGURATION_NAME_MIN      (1)
-#define CFG_RX_ANT_CONFIGURATION_NAME_MAX      (2)
-#define CFG_RX_ANT_CONFIGURATION_NAME_DEFAULT  (2)
-
 #define CFG_FW_HEART_BEAT_MONITORING_NAME      "gEnableFWHeartBeatMonitoring"
 #define CFG_FW_HEART_BEAT_MONITORING_MIN       (0)
 #define CFG_FW_HEART_BEAT_MONITORING_MAX       (1)
@@ -568,7 +572,7 @@ typedef enum {
 #define CFG_DATA_INACTIVITY_TIMEOUT_NAME       "gDataInactivityTimeout"
 #define CFG_DATA_INACTIVITY_TIMEOUT_MIN        (1)
 #define CFG_DATA_INACTIVITY_TIMEOUT_MAX        (255)
-#define CFG_DATA_INACTIVITY_TIMEOUT_DEFAULT    (20)
+#define CFG_DATA_INACTIVITY_TIMEOUT_DEFAULT    (200)
 
 #define CFG_RF_SETTLING_TIME_CLK_NAME          "rfSettlingTimeUs"
 #define CFG_RF_SETTLING_TIME_CLK_MIN           (0)
@@ -697,12 +701,10 @@ typedef enum {
 #define CFG_ROAM_SCAN_HOME_AWAY_TIME_DEFAULT                (CFG_ROAM_SCAN_HOME_AWAY_TIME_MIN)
 /* disabled by default */
 
-#ifdef FEATURE_WLAN_OKC
 #define CFG_OKC_FEATURE_ENABLED_NAME                       "OkcEnabled"
 #define CFG_OKC_FEATURE_ENABLED_MIN                        (0)
 #define CFG_OKC_FEATURE_ENABLED_MAX                        (1)
 #define CFG_OKC_FEATURE_ENABLED_DEFAULT                    (1)
-#endif
 
 #define CFG_ROAM_SCAN_OFFLOAD_ENABLED                       "gRoamScanOffloadEnabled"
 #define CFG_ROAM_SCAN_OFFLOAD_ENABLED_MIN                   (0)
@@ -823,16 +825,6 @@ typedef enum {
 #define CFG_RRM_ENABLE_MAX                               (1)
 #define CFG_RRM_ENABLE_DEFAULT                           (0)
 
-#define CFG_RRM_OPERATING_CHAN_MAX_DURATION_NAME         "gRrmOperChanMax"      /* section 11.10.3 IEEE std. 802.11k-2008 */
-#define CFG_RRM_OPERATING_CHAN_MAX_DURATION_MIN          (0)    /* Maxduration = 2^(maxDuration - 4) * bcnIntvl. */
-#define CFG_RRM_OPERATING_CHAN_MAX_DURATION_MAX          (8)
-#define CFG_RRM_OPERATING_CHAN_MAX_DURATION_DEFAULT      (3)    /* max duration = 2^-1 * bcnIntvl (50% of bcn intvl) */
-
-#define CFG_RRM_NON_OPERATING_CHAN_MAX_DURATION_NAME     "gRrmNonOperChanMax"   /* Same as above. */
-#define CFG_RRM_NON_OPERATING_CHAN_MAX_DURATION_MIN      (0)
-#define CFG_RRM_NON_OPERATING_CHAN_MAX_DURATION_MAX      (8)
-#define CFG_RRM_NON_OPERATING_CHAN_MAX_DURATION_DEFAULT  (3)
-
 #define CFG_RRM_MEAS_RANDOMIZATION_INTVL_NAME            "gRrmRandnIntvl"
 #define CFG_RRM_MEAS_RANDOMIZATION_INTVL_MIN             (10)
 #define CFG_RRM_MEAS_RANDOMIZATION_INTVL_MAX             (100)
@@ -844,16 +836,16 @@ typedef enum {
  * (last 4bytes are reserved). Bit details are updated as per
  * Draft version of 11mc spec. (Draft P802.11REVmc_D4.2)
  *
- * Bitwise details are defined as bit mask in rrmGlobal.h
+ * Bitwise details are defined as bit mask in rrm_global.h
  * Comma is used as a separator for each byte.
  */
 #define CFG_RM_CAPABILITY_NAME            "rm_capability"
-#define CFG_RM_CAPABILITY_DEFAULT         "73,00,6D,00,04"
+#define CFG_RM_CAPABILITY_DEFAULT         "73,10,91,00,04"
 
 #define CFG_QOS_IMPLICIT_SETUP_ENABLED_NAME                 "ImplicitQosIsEnabled"
 #define CFG_QOS_IMPLICIT_SETUP_ENABLED_MIN                  (0)
 #define CFG_QOS_IMPLICIT_SETUP_ENABLED_MAX                  (1)
-#define CFG_QOS_IMPLICIT_SETUP_ENABLED_DEFAULT              (1)
+#define CFG_QOS_IMPLICIT_SETUP_ENABLED_DEFAULT              (0)
 
 #define CFG_FT_RESOURCE_REQ_NAME                        "gFTResourceReqSupported"
 #define CFG_FT_RESOURCE_REQ_MIN                         (0)
@@ -880,11 +872,6 @@ typedef enum {
 #define CFG_TELE_BCN_MAX_LI_NUM_IDLE_BCNS_MAX        (255)
 #define CFG_TELE_BCN_MAX_LI_NUM_IDLE_BCNS_DEFAULT    (15)
 
-#define CFG_BCN_EARLY_TERM_WAKE_NAME                 "beaconEarlyTerminationWakeInterval"
-#define CFG_BCN_EARLY_TERM_WAKE_MIN                  (2)
-#define CFG_BCN_EARLY_TERM_WAKE_MAX                  (255)
-#define CFG_BCN_EARLY_TERM_WAKE_DEFAULT              (3)
-
 #define CFG_NEIGHBOR_SCAN_TIMER_PERIOD_NAME             "gNeighborScanTimerPeriod"
 #define CFG_NEIGHBOR_SCAN_TIMER_PERIOD_MIN              (3)
 #define CFG_NEIGHBOR_SCAN_TIMER_PERIOD_MAX              (300)
@@ -1017,7 +1004,7 @@ typedef enum {
 #define CFG_ENABLE_HOST_ARPOFFLOAD_NAME         "hostArpOffload"
 #define CFG_ENABLE_HOST_ARPOFFLOAD_MIN          (0)
 #define CFG_ENABLE_HOST_ARPOFFLOAD_MAX          (1)
-#define CFG_ENABLE_HOST_ARPOFFLOAD_DEFAULT      (0)
+#define CFG_ENABLE_HOST_ARPOFFLOAD_DEFAULT      (1)
 
 #define CFG_ENABLE_HOST_SSDP_NAME              "ssdp"
 #define CFG_ENABLE_HOST_SSDP_MIN               (0)
@@ -1049,23 +1036,13 @@ typedef enum {
 #define CFG_ENABLE_HOST_NSOFFLOAD_NAME         "hostNSOffload"
 #define CFG_ENABLE_HOST_NSOFFLOAD_MIN          (0)
 #define CFG_ENABLE_HOST_NSOFFLOAD_MAX          (1)
-#define CFG_ENABLE_HOST_NSOFFLOAD_DEFAULT      (0)
+#define CFG_ENABLE_HOST_NSOFFLOAD_DEFAULT      (1)
 
 #define CFG_BAND_CAPABILITY_NAME          "BandCapability"
 #define CFG_BAND_CAPABILITY_MIN           (0)
 #define CFG_BAND_CAPABILITY_MAX           (2)
 #define CFG_BAND_CAPABILITY_DEFAULT       (0)
 
-#define CFG_ENABLE_BEACON_EARLY_TERMINATION_NAME          "enableBeaconEarlyTermination"
-#define CFG_ENABLE_BEACON_EARLY_TERMINATION_MIN           (0)
-#define CFG_ENABLE_BEACON_EARLY_TERMINATION_MAX           (1)
-#define CFG_ENABLE_BEACON_EARLY_TERMINATION_DEFAULT       (0)
-
-#define CFG_ENABLE_CLOSE_LOOP_NAME                 "gEnableCloseLoop"
-#define CFG_ENABLE_CLOSE_LOOP_MIN                  WNI_CFG_FIXED_RATE_STAMIN
-#define CFG_ENABLE_CLOSE_LOOP_MAX                  WNI_CFG_FIXED_RATE_STAMAX
-#define CFG_ENABLE_CLOSE_LOOP_DEFAULT              WNI_CFG_FIXED_RATE_STADEF
-
 #define CFG_ENABLE_BYPASS_11D_NAME                 "gEnableBypass11d"
 #define CFG_ENABLE_BYPASS_11D_MIN                  (0)
 #define CFG_ENABLE_BYPASS_11D_MAX                  (1)
@@ -1249,7 +1226,7 @@ typedef enum {
 #define CFG_PPS_ENABLE_5G_EBT                 "gEnable5gEBT"
 #define CFG_PPS_ENABLE_5G_EBT_FEATURE_MIN     (0)
 #define CFG_PPS_ENABLE_5G_EBT_FEATURE_MAX     (1)
-#define CFG_PPS_ENABLE_5G_EBT_FEATURE_DEFAULT (0)
+#define CFG_PPS_ENABLE_5G_EBT_FEATURE_DEFAULT (1)
 
 #define CFG_ENABLE_MEMORY_DEEP_SLEEP          "gEnableMemDeepSleep"
 #define CFG_ENABLE_MEMORY_DEEP_SLEEP_MIN      (0)
@@ -1269,7 +1246,13 @@ typedef enum {
 #define CFG_ENABLE_PACKET_LOG            "gEnablePacketLog"
 #define CFG_ENABLE_PACKET_LOG_MIN        (0)
 #define CFG_ENABLE_PACKET_LOG_MAX        (1)
+#ifdef FEATURE_PKTLOG
 #define CFG_ENABLE_PACKET_LOG_DEFAULT    (1)
+#else
+#define CFG_ENABLE_PACKET_LOG_DEFAULT    (0)
+#endif
+
+
 
 /* gFwDebugLogType takes values from enum dbglog_process_t,
  * make default value as DBGLOG_PROCESS_NET_RAW to give the
@@ -1310,12 +1293,12 @@ typedef enum {
 
 #define CFG_ENABLE_EGAP_INACT_TIME_FEATURE         "gEGAPInactTime"
 #define CFG_ENABLE_EGAP_INACT_TIME_FEATURE_MIN     (0)
-#define CFG_ENABLE_EGAP_INACT_TIME_FEATURE_MAX     (5000)
+#define CFG_ENABLE_EGAP_INACT_TIME_FEATURE_MAX     (300000)
 #define CFG_ENABLE_EGAP_INACT_TIME_FEATURE_DEFAULT (1000)
 
 #define CFG_ENABLE_EGAP_WAIT_TIME_FEATURE          "gEGAPWaitTime"
 #define CFG_ENABLE_EGAP_WAIT_TIME_FEATURE_MIN      (0)
-#define CFG_ENABLE_EGAP_WAIT_TIME_FEATURE_MAX      (5000)
+#define CFG_ENABLE_EGAP_WAIT_TIME_FEATURE_MAX      (300000)
 #define CFG_ENABLE_EGAP_WAIT_TIME_FEATURE_DEFAULT  (100)
 
 #define CFG_ENABLE_EGAP_FLAGS_FEATURE              "gEGAPFeatures"
@@ -1385,16 +1368,6 @@ typedef enum {
 #define HDD_MULTICAST_FILTER_LIST                              0x04
 #define HDD_MULTICAST_FILTER_LIST_CLEAR                        0x05
 
-/*BMPS Logic
- * Notes:
- * 1 - Then Host driver and above layers control the PS mechanism
- * 0 - Diver/Core Stack internally control the Power saving mechanism
- */
-#define CFG_ANDRIOD_POWER_SAVE_NAME      "isAndroidPsEn"
-#define CFG_ANDRIOD_POWER_SAVE_MIN       (0)
-#define CFG_ANDRIOD_POWER_SAVE_MAX       (1)
-#define CFG_ANDRIOD_POWER_SAVE_DEFAULT   (0)
-
 /*
  * Enable Dynamic DTIM
  * Options
@@ -1463,11 +1436,6 @@ typedef enum {
 #define CFG_IGNORE_DYNAMIC_DTIM_IN_P2P_MODE_MAX        (1)
 #define CFG_IGNORE_DYNAMIC_DTIM_IN_P2P_MODE_DEFAULT    (0)
 
-#define CFG_ENABLE_AUTOMATIC_TX_POWER_CONTROL_NAME  "gEnableAutomaticTxPowerControl"
-#define CFG_ENABLE_AUTOMATIC_TX_POWER_CONTROL_MIN        (0)
-#define CFG_ENABLE_AUTOMATIC_TX_POWER_CONTROL_MAX        (1)
-#define CFG_ENABLE_AUTOMATIC_TX_POWER_CONTROL_DEFAULT    (1)
-
 #define CFG_SHORT_GI_40MHZ_NAME                "gShortGI40Mhz"
 #define CFG_SHORT_GI_40MHZ_MIN                 0
 #define CFG_SHORT_GI_40MHZ_MAX                 1
@@ -1727,12 +1695,12 @@ typedef enum {
 
 /*
  * Enable/Disable Multicast MAC Address List feature
- * Default: Disable
+ * Default: Enable
  */
 #define CFG_MC_ADDR_LIST_ENABLE_NAME          "gMCAddrListEnable"
 #define CFG_MC_ADDR_LIST_ENABLE_MIN           (0)
 #define CFG_MC_ADDR_LIST_ENABLE_MAX           (1)
-#define CFG_MC_ADDR_LIST_ENABLE_DEFAULT       (0)
+#define CFG_MC_ADDR_LIST_ENABLE_DEFAULT       (1)
 
 #define CFG_ENABLE_RX_STBC                       "gEnableRXSTBC"
 #define CFG_ENABLE_RX_STBC_MIN                   (0)
@@ -1772,14 +1740,14 @@ typedef enum {
 #define CFG_TDLS_IMPLICIT_TRIGGER_DEFAULT           (0)
 
 #define CFG_TDLS_TX_STATS_PERIOD                    "gTDLSTxStatsPeriod"
-#define CFG_TDLS_TX_STATS_PERIOD_MIN                (10)
+#define CFG_TDLS_TX_STATS_PERIOD_MIN                (1000)
 #define CFG_TDLS_TX_STATS_PERIOD_MAX                (4294967295UL)
-#define CFG_TDLS_TX_STATS_PERIOD_DEFAULT            (500)
+#define CFG_TDLS_TX_STATS_PERIOD_DEFAULT            (2000)
 
 #define CFG_TDLS_TX_PACKET_THRESHOLD                "gTDLSTxPacketThreshold"
 #define CFG_TDLS_TX_PACKET_THRESHOLD_MIN            (0)
 #define CFG_TDLS_TX_PACKET_THRESHOLD_MAX            (4294967295UL)
-#define CFG_TDLS_TX_PACKET_THRESHOLD_DEFAULT        (10)
+#define CFG_TDLS_TX_PACKET_THRESHOLD_DEFAULT        (40)
 
 #define CFG_TDLS_MAX_DISCOVERY_ATTEMPT              "gTDLSMaxDiscoveryAttempt"
 #define CFG_TDLS_MAX_DISCOVERY_ATTEMPT_MIN          (1)
@@ -1918,7 +1886,7 @@ typedef enum {
 #define CFG_SCAN_AGING_PARAM_NAME          "gScanAgingTime"
 #define CFG_SCAN_AGING_PARAM_MIN           (0)
 #define CFG_SCAN_AGING_PARAM_MAX           (200)
-#define CFG_SCAN_AGING_PARAM_DEFAULT       (60)
+#define CFG_SCAN_AGING_PARAM_DEFAULT       (30)
 
 /* Config Param to enable the txLdpc capability
  * 0 - disable
@@ -2019,15 +1987,6 @@ typedef enum {
 #define CFG_ENABLE_FAST_ROAM_IN_CONCURRENCY_MAX      (1)
 #define CFG_ENABLE_FAST_ROAM_IN_CONCURRENCY_DEFAULT  (1)
 
-/*
- * FlexConnectPowerFactor parameter
- * Default: Disable (0)
- */
-#define CFG_FLEX_CONNECT_POWER_FACTOR_NAME          "gFlexConnectPowerFactor"
-#define CFG_FLEX_CONNECT_POWER_FACTOR_MIN           (0)
-#define CFG_FLEX_CONNECT_POWER_FACTOR_MAX           (9)
-#define CFG_FLEX_CONNECT_POWER_FACTOR_DEFAULT       (0)
-
 /*
  * Enable heart beat monitoring offload to FW
  */
@@ -2308,23 +2267,17 @@ typedef enum {
 #define CFG_ENABLE_DEBUG_CONNECT_ISSUE_MAX         (0xFF)
 #define CFG_ENABLE_DEBUG_CONNECT_ISSUE_DEFAULT     (0x0F)
 
-/* This will be used only for debugging purpose, will be removed after sometime */
-#define CFG_ENABLE_RX_THREAD                       "gEnableRxThread"
-#define CFG_ENABLE_RX_THREAD_MIN                   (0)
-#define CFG_ENABLE_RX_THREAD_MAX                   (1)
-#define CFG_ENABLE_RX_THREAD_DEFAULT               (1)
-
 /* SAR Thermal limit values for 2g and 5g */
 
 #define CFG_SET_TXPOWER_LIMIT2G_NAME               "TxPower2g"
 #define CFG_SET_TXPOWER_LIMIT2G_MIN                (0)
 #define CFG_SET_TXPOWER_LIMIT2G_MAX                (30)
-#define CFG_SET_TXPOWER_LIMIT2G_DEFAULT            (15)
+#define CFG_SET_TXPOWER_LIMIT2G_DEFAULT            (30)
 
 #define CFG_SET_TXPOWER_LIMIT5G_NAME               "TxPower5g"
 #define CFG_SET_TXPOWER_LIMIT5G_MIN                (0)
 #define CFG_SET_TXPOWER_LIMIT5G_MAX                (30)
-#define CFG_SET_TXPOWER_LIMIT5G_DEFAULT            (15)
+#define CFG_SET_TXPOWER_LIMIT5G_DEFAULT            (30)
 
 #ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL
 #define CFG_LL_TX_FLOW_LWM                         "TxFlowLowWaterMark"
@@ -2488,6 +2441,12 @@ typedef enum {
 #define CFG_TCP_DELACK_THRESHOLD_LOW_MIN           (0)
 #define CFG_TCP_DELACK_THRESHOLD_LOW_MAX           (10000)
 
+#define CFG_TCP_DELACK_TIMER_COUNT                 "gTcpDelAckTimerCount"
+#define CFG_TCP_DELACK_TIMER_COUNT_DEFAULT         (30)
+#define CFG_TCP_DELACK_TIMER_COUNT_MIN             (1)
+#define CFG_TCP_DELACK_TIMER_COUNT_MAX             (1000)
+
+
 /* TCP_TX_HIGH_TPUT_THRESHOLD specifies the threshold of packets transmitted
  * over a period of 100 ms beyond which TCP can be considered to have a high
  * TX throughput requirement. The driver uses this condition to tweak TCP TX
@@ -2791,6 +2750,17 @@ typedef enum {
 #define CFG_LRO_ENABLED_MAX            (1)
 #define CFG_LRO_ENABLED_DEFAULT        (0)
 
+/*
+ * Enable Rx traffic flow steering to enable Rx interrupts on multiple CEs based
+ * on the flows. Different CEs<==>different IRQs<==>probably different CPUs.
+ * Parallel Rx paths.
+ * 1 - enable  0 - disable
+ */
+#define CFG_FLOW_STEERING_ENABLED_NAME        "gEnableFlowSteering"
+#define CFG_FLOW_STEERING_ENABLED_MIN         (0)
+#define CFG_FLOW_STEERING_ENABLED_MAX         (1)
+#define CFG_FLOW_STEERING_ENABLED_DEFAULT     (0)
+
 /*
  * In static display use case when APPS is in stand alone power save mode enable
  * active offload mode which helps FW to filter out MC/BC data packets to avoid
@@ -2820,6 +2790,15 @@ typedef enum {
 #define CFG_ACTIVE_MODE_OFFLOAD_DEFAULT    (0)
 #endif
 
+/*
+ * 0: Disable BPF packet filter
+ * 1: Enable BPF packet filter
+ */
+#define CFG_BPF_PACKET_FILTER_OFFLOAD           "gBpfFilterEnable"
+#define CFG_BPF_PACKET_FILTER_OFFLOAD_MIN       (0)
+#define CFG_BPF_PACKET_FILTER_OFFLOAD_MAX       (1)
+#define CFG_BPF_PACKET_FILTER_OFFLOAD_DEFAULT   (1)
+
 /*
  * 0: disable the cck tx chain mask (default)
  * 1: enable the cck tx chain mask
@@ -2905,12 +2884,18 @@ enum dot11p_mode {
 #define CFG_DOT11P_MODE_MIN              (WLAN_HDD_11P_DISABLED)
 #define CFG_DOT11P_MODE_MAX              (WLAN_HDD_11P_CONCURRENT)
 
-#define CFG_NAPI_NAME       "gEnableNAPI"
-#define CFG_NAPI_MIN        (0)
-#define CFG_NAPI_MAX        (1)
-#define CFG_NAPI_DEFAULT    (0)
-
 #ifdef FEATURE_WLAN_EXTSCAN
+
+/*
+ * This ini is added to control the enabling of extscan feature outside of code.
+ * By default extscan feature will be enabled, to disable extscan add
+ * gExtScanEnable=0 in ini file.
+ */
+#define CFG_EXTSCAN_ALLOWED_NAME                   "gExtScanEnable"
+#define CFG_EXTSCAN_ALLOWED_MIN                    (0)
+#define CFG_EXTSCAN_ALLOWED_MAX                    (1)
+#define CFG_EXTSCAN_ALLOWED_DEF                    (1)
+
 #define CFG_EXTSCAN_PASSIVE_MAX_CHANNEL_TIME_NAME      "gExtScanPassiveMaxChannelTime"
 #define CFG_EXTSCAN_PASSIVE_MAX_CHANNEL_TIME_MIN       (0)
 #define CFG_EXTSCAN_PASSIVE_MAX_CHANNEL_TIME_MAX       (500)
@@ -3112,12 +3097,12 @@ enum dot11p_mode {
 /*
  * Dense traffic threshold
  * traffic threshold required for dense roam scan
- * not used currently
+ * Measured in kbps
  */
 #define CFG_ROAM_DENSE_TRAFFIC_THRESHOLD         "gtraffic_threshold"
 #define CFG_ROAM_DENSE_TRAFFIC_THRESHOLD_MIN     (0)
-#define CFG_ROAM_DENSE_TRAFFIC_THRESHOLD_MAX     (100)
-#define CFG_ROAM_DENSE_TRAFFIC_THRESHOLD_DEFAULT (0)
+#define CFG_ROAM_DENSE_TRAFFIC_THRESHOLD_MAX     (0xffffffff)
+#define CFG_ROAM_DENSE_TRAFFIC_THRESHOLD_DEFAULT (400)
 
 /*
  * Dense Roam RSSI Threshold diff
@@ -3128,7 +3113,15 @@ enum dot11p_mode {
 #define CFG_ROAM_DENSE_RSSI_THRE_OFFSET         "groam_dense_rssi_thresh_offset"
 #define CFG_ROAM_DENSE_RSSI_THRE_OFFSET_MIN     (0)
 #define CFG_ROAM_DENSE_RSSI_THRE_OFFSET_MAX     (20)
-#define CFG_ROAM_DENSE_RSSI_THRE_OFFSET_DEFAULT (0)
+#define CFG_ROAM_DENSE_RSSI_THRE_OFFSET_DEFAULT (10)
+
+/*
+ * Create bug report in case of nil scan results
+ */
+#define CFG_CREATE_BUG_REPORT_FOR_SCAN       "gbug_report_for_scan_results"
+#define CFG_CREATE_BUG_REPORT_FOR_SCAN_DISABLE    (0)
+#define CFG_CREATE_BUG_REPORT_FOR_SCAN_ENABLE     (1)
+#define CFG_CREATE_BUG_REPORT_FOR_SCAN_DEFAULT    (0)
 
 /*
  * Enabling gignore_peer_ht_opmode will enable 11g
@@ -3168,7 +3161,7 @@ enum dot11p_mode {
 #define CFG_ROAM_DENSE_MIN_APS         "groam_dense_min_aps"
 #define CFG_ROAM_DENSE_MIN_APS_MIN     (1)
 #define CFG_ROAM_DENSE_MIN_APS_MAX     (5)
-#define CFG_ROAM_DENSE_MIN_APS_DEFAULT (1)
+#define CFG_ROAM_DENSE_MIN_APS_DEFAULT (3)
 
 /*
  * Enable/Disable to initiate BUG report in case of fatal event
@@ -3389,6 +3382,118 @@ enum dot11p_mode {
 #define CFG_ADAPTIVE_PNOSCAN_DWELL_MODE_MAX      (4)
 #define CFG_ADAPTIVE_PNOSCAN_DWELL_MODE_DEFAULT  (0)
 
+/*
+ * gSub20ChannelWidth=0: indicates do not use Sub 20 MHz bandwidth
+ * gSub20ChannelWidth=1: Bring up SAP/STA in 5 MHz bandwidth
+ * gSub20ChannelWidth=2: Bring up SAP/STA in 10 MHz bandwidth
+ */
+#define CFG_SUB_20_CHANNEL_WIDTH_NAME              "gSub20ChannelWidth"
+#define CFG_SUB_20_CHANNEL_WIDTH_MIN               (WLAN_SUB_20_CH_WIDTH_NONE)
+#define CFG_SUB_20_CHANNEL_WIDTH_MAX               (WLAN_SUB_20_CH_WIDTH_10)
+#define CFG_SUB_20_CHANNEL_WIDTH_DEFAULT           (WLAN_SUB_20_CH_WIDTH_NONE)
+
+#define CFG_TGT_GTX_USR_CFG_NAME    "tgt_gtx_usr_cfg"
+#define CFG_TGT_GTX_USR_CFG_MIN     (0)
+#define CFG_TGT_GTX_USR_CFG_MAX     (32)
+#define CFG_TGT_GTX_USR_CFG_DEFAULT (32)
+
+/*
+ * This parameter determines that which defered method will be use in rx path
+ * If no bits are set then rx path processing will happen in tasklet context.
+ * Bit 0: rx_thread enable
+ * Bit 1: RPS enable
+ * Bit 2: NAPI enable
+ */
+#define CFG_RX_MODE_NAME     "rx_mode"
+#define CFG_RX_MODE_MIN      (0)
+#define CFG_RX_MODE_MAX      (CFG_ENABLE_RX_THREAD | CFG_ENABLE_RPS | \
+				 CFG_ENABLE_NAPI)
+#ifdef MDM_PLATFORM
+#define CFG_RX_MODE_DEFAULT  (0)
+#elif defined(HELIUMPLUS)
+#define CFG_RX_MODE_DEFAULT  CFG_ENABLE_NAPI
+#else
+#define CFG_RX_MODE_DEFAULT  (CFG_ENABLE_RX_THREAD | CFG_ENABLE_NAPI)
+#endif
+
+/* List of RPS CPU maps for different rx queues registered by WLAN driver
+ * Ref - Kernel/Documentation/networking/scaling.txt
+ * RPS CPU map for a particular RX queue, selects CPU(s) for bottom half
+ * processing of RX packets. For example, for a system with 4 CPUs,
+ * 0xe: Use CPU1 - CPU3 and donot use CPU0.
+ * 0x0: RPS is disabled, packets are processed on the interrupting CPU.
+.*
+ * WLAN driver registers NUM_TX_QUEUES queues for tx and rx each during
+ * alloc_netdev_mq. Hence, we need to have a cpu mask for each of the rx queues.
+ *
+ * For example, if the NUM_TX_QUEUES is 4, a sample WLAN ini entry may look like
+ * rpsRxQueueCpuMapList=a b c d
+ * For a 4 CPU system (CPU0 - CPU3), this implies:
+ * 0xa - (1010) use CPU1, CPU3 for rx queue 0
+ * 0xb - (1011) use CPU0, CPU1 and CPU3 for rx queue 1
+ * 0xc - (1100) use CPU2, CPU3 for rx queue 2
+ * 0xd - (1101) use CPU0, CPU2 and CPU3 for rx queue 3
+
+ * In practice, we may want to avoid the cores which are heavily loaded.
+ */
+
+/* Name of the ini file entry to specify RPS map for different RX queus */
+#define CFG_RPS_RX_QUEUE_CPU_MAP_LIST_NAME         "rpsRxQueueCpuMapList"
+
+/* Default value of rpsRxQueueCpuMapList. Different platforms may have
+ * different configurations for NUM_TX_QUEUES and # of cpus, and will need to
+ * configure an appropriate value via ini file. Setting default value to 'e' to
+ * avoid use of CPU0 (since its heavily used by other system processes) by rx
+ * queue 0, which is currently being used for rx packet processing.
+ */
+#define CFG_RPS_RX_QUEUE_CPU_MAP_LIST_DEFAULT      "e"
+
+/* Maximum length of string used to hold a list of cpu maps for various rx
+ * queues. Considering a 16 core system with 5 rx queues, a RPS CPU map
+ * list may look like -
+ * rpsRxQueueCpuMapList = ffff ffff ffff ffff ffff
+ * (all 5 rx queues can be processed on all 16 cores)
+ * max string len = 24 + 1(for '\0'). Considering 30 to be on safe side.
+ */
+#define CFG_RPS_RX_QUEUE_CPU_MAP_LIST_LEN 30
+
+/*
+ * Support to start sap in indoor channel
+ * Customer can config this item to enable/disable sap in indoor channel
+ * Default: Disable
+ */
+#define CFG_INDOOR_CHANNEL_SUPPORT_NAME     "gindoor_channel_support"
+#define CFG_INDOOR_CHANNEL_SUPPORT_MIN      (0)
+#define CFG_INDOOR_CHANNEL_SUPPORT_MAX      (1)
+#define CFG_INDOOR_CHANNEL_SUPPORT_DEFAULT  (0)
+
+/*
+ * Enable filtering of replayed multicast packets
+ * In a typical infrastructure setup, it is quite normal to receive
+ * replayed multicast packets. These packets may cause more harm than
+ * help if not handled properly. Providing a configuration option
+ * to enable filtering of such packets
+ */
+#define CFG_FILTER_MULTICAST_REPLAY_NAME    "enable_multicast_replay_filter"
+#define CFG_FILTER_MULTICAST_REPLAY_MIN      (0)
+#define CFG_FILTER_MULTICAST_REPLAY_MAX      (1)
+#define CFG_FILTER_MULTICAST_REPLAY_DEFAULT  (1)
+
+/*
+ * This parameter will control SIFS burst duration in FW from 0 to 12 ms.
+ * Default value is set to 8ms.
+ */
+#define CFG_SIFS_BURST_DURATION_NAME     "g_sifs_burst_duration"
+#define CFG_SIFS_BURST_DURATION_MIN      (0)
+#define CFG_SIFS_BURST_DURATION_MAX      (12)
+#define CFG_SIFS_BURST_DURATION_DEFAULT  (8)
+
+/* Optimize channel avoidance indication comming from firmware */
+#define CFG_OPTIMIZE_CA_EVENT_NAME       "goptimize_chan_avoid_event"
+#define CFG_OPTIMIZE_CA_EVENT_DISABLE    (0)
+#define CFG_OPTIMIZE_CA_EVENT_ENABLE     (1)
+#define CFG_OPTIMIZE_CA_EVENT_DEFAULT    (0)
+
 /*---------------------------------------------------------------------------
    Type declarations
    -------------------------------------------------------------------------*/
@@ -3437,7 +3542,6 @@ struct hdd_config {
 	uint16_t apProtection;
 	bool apOBSSProtEnabled;
 	bool apDisableIntraBssFwd;
-	uint8_t nEnableListenMode;
 	uint32_t nAPAutoShutOff;
 	uint8_t enableLTECoex;
 	uint32_t apKeepAlivePeriod;
@@ -3446,11 +3550,10 @@ struct hdd_config {
 	uint32_t goLinkMonitorPeriod;
 	uint32_t nBeaconInterval;
 	uint8_t nTxPowerCap;    /* In dBm */
+	bool allow_tpc_from_ap;
 	bool fIsLowGainOverride;
 	uint8_t disablePacketFilter;
 	bool fRrmEnable;
-	uint8_t nInChanMeasMaxDuration;
-	uint8_t nOutChanMeasMaxDuration;
 	uint16_t nRrmRandnIntvl;
 	/* length includes separator */
 	char rm_capability[3 * DOT11F_IE_RRMENABLEDCAP_MAX_LEN];
@@ -3478,7 +3581,6 @@ struct hdd_config {
 	int32_t nhi_rssi_scan_rssi_ub;
 
 	/* Additional Handoff params */
-	uint32_t nRoamingTime;
 	uint16_t nVccRssiTrigger;
 	uint32_t nVccUlMacLossThreshold;
 
@@ -3512,7 +3614,6 @@ struct hdd_config {
 	bool fIgnoreDtim;
 	uint8_t fMaxLIModulatedDTIM;
 
-	uint8_t nRxAnt;
 	uint8_t fEnableFwHeartBeatMonitoring;
 	uint8_t fEnableFwBeaconFiltering;
 	bool fEnableFwRssiMonitoring;
@@ -3541,9 +3642,7 @@ struct hdd_config {
 	bool isFastTransitionEnabled;
 	uint8_t RoamRssiDiff;
 	bool isWESModeEnabled;
-#ifdef FEATURE_WLAN_OKC
 	bool isOkcIniFeatureEnabled;
-#endif
 	bool isRoamOffloadScanEnabled;
 	bool bImplicitQosEnabled;
 
@@ -3615,7 +3714,6 @@ struct hdd_config {
 	uint8_t nBandCapability;
 
 	uint32_t apDataAvailPollPeriodInMs;
-	bool fEnableBeaconEarlyTermination;
 	bool teleBcnWakeupEn;
 
 /* QDF Trace Control*/
@@ -3643,13 +3741,10 @@ struct hdd_config {
 	uint16_t nTeleBcnMaxListenInterval;
 	uint16_t nTeleBcnTransLiNumIdleBeacons;
 	uint16_t nTeleBcnMaxLiNumIdleBeacons;
-	uint8_t bcnEarlyTermWakeInterval;
-	uint32_t enableCloseLoop;
 	uint8_t enableBypass11d;
 	uint8_t enableDFSChnlScan;
 	uint8_t enable_dfs_pno_chnl_scan;
 	uint8_t enableDynamicDTIM;
-	uint8_t enableAutomaticTxPowerControl;
 	uint8_t ShortGI40MhzEnable;
 	eHddLinkSpeedReportType reportMaxLinkSpeed;
 	int32_t linkSpeedRssiHigh;
@@ -3759,7 +3854,6 @@ struct hdd_config {
 	bool enableTxLdpc;
 	uint8_t disableLDPCWithTxbfAP;
 	uint8_t enableMCCAdaptiveScheduler;
-	bool isAndroidPsEn;
 	bool sapAllowAllChannel;
 	uint8_t retryLimitZero;
 	uint8_t retryLimitOne;
@@ -3770,7 +3864,6 @@ struct hdd_config {
 	/* Flag indicating whether legacy fast roam during concurrency is enabled in cfg.ini or not */
 	bool bFastRoamInConIniFeatureEnabled;
 	bool fEnableAdaptRxDrain;
-	uint8_t flexConnectPowerFactor;
 	bool enableIbssHeartBeatOffload;
 	uint32_t antennaDiversity;
 	bool fEnableSNRMonitoring;
@@ -3828,7 +3921,6 @@ struct hdd_config {
 	uint32_t TxPower2g;
 	uint32_t TxPower5g;
 	uint32_t gEnableDebugLog;
-	uint8_t enableRxThread;
 	bool fDfsPhyerrFilterOffload;
 	uint8_t gSapPreferredChanLocation;
 	uint8_t gDisableDfsJapanW53;
@@ -3873,6 +3965,7 @@ struct hdd_config {
 	uint32_t tcpDelackThresholdHigh;
 	uint32_t tcpDelackThresholdLow;
 	uint32_t tcp_tx_high_tput_thres;
+	uint32_t tcp_delack_timer_count;
 #endif /* MSM_PLATFORM */
 
 	/* FW debug log parameters */
@@ -3972,17 +4065,19 @@ struct hdd_config {
 	bool sendDeauthBeforeCon;
 	bool tso_enable;
 	bool lro_enable;
+	bool flow_steering_enable;
 	bool active_mode_offload;
+	bool bpf_packet_filter_enable;
 	uint32_t fine_time_meas_cap;
 	uint8_t max_scan_count;
 #ifdef WLAN_FEATURE_FASTPATH
 	bool fastpath_enable;
 #endif
 	uint8_t dot11p_mode;
-#ifdef FEATURE_NAPI
-	bool napi_enable;
-#endif
+	uint8_t rx_mode;
+	uint8_t cpu_map_list[CFG_RPS_RX_QUEUE_CPU_MAP_LIST_LEN];
 #ifdef FEATURE_WLAN_EXTSCAN
+	bool     extscan_enabled;
 	uint32_t extscan_passive_max_chn_time;
 	uint32_t extscan_passive_min_chn_time;
 	uint32_t extscan_active_max_chn_time;
@@ -4043,10 +4138,20 @@ struct hdd_config {
 	uint8_t adapt_dwell_lpf_weight;
 	uint8_t adapt_dwell_passive_mon_intval;
 	uint8_t adapt_dwell_wifi_act_threshold;
+	bool bug_report_for_no_scan_results;
 #ifdef WLAN_FEATURE_NAN_DATAPATH
 	bool enable_nan_datapath;
 	uint8_t nan_datapath_ndi_channel;
 #endif
+	uint32_t iface_change_wait_time;
+	/* parameter to control GTX */
+	uint32_t tgt_gtx_usr_cfg;
+	enum cfg_sub_20_channel_width enable_sub_20_channel_width;
+	bool indoor_channel_support;
+	bool multicast_replay_filter;
+	/* parameter for indicating sifs burst duration to fw */
+	uint8_t sifs_burst_duration;
+	bool goptimize_chan_avoid_event;
 };
 
 #define VAR_OFFSET(_Struct, _Var) (offsetof(_Struct, _Var))
@@ -4162,7 +4267,7 @@ QDF_STATUS hdd_parse_config_ini(hdd_context_t *pHddCtx);
 QDF_STATUS hdd_update_mac_config(hdd_context_t *pHddCtx);
 QDF_STATUS hdd_set_sme_config(hdd_context_t *pHddCtx);
 QDF_STATUS hdd_set_sme_chan_list(hdd_context_t *hdd_ctx);
-bool hdd_update_config_dat(hdd_context_t *pHddCtx);
+bool hdd_update_config_cfg(hdd_context_t *pHddCtx);
 QDF_STATUS hdd_cfg_get_global_config(hdd_context_t *pHddCtx, char *pBuf,
 				     int buflen);
 

+ 7 - 1
core/hdd/inc/wlan_hdd_driver_ops.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2015-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -28,6 +28,8 @@
 #ifndef __WLAN_HDD_DRIVER_OPS_H__
 #define __WLAN_HDD_DRIVER_OPS_H__
 
+#include "hif.h"
+
 /**
  * DOC: wlan_hdd_driver_ops.h
  *
@@ -36,4 +38,8 @@
 int wlan_hdd_register_driver(void);
 void wlan_hdd_unregister_driver(void);
 int wlan_hdd_bus_suspend(pm_message_t state);
+int wlan_hdd_bus_resume(void);
+void hdd_hif_close(void *hif_ctx);
+int hdd_hif_open(struct device *dev, void *bdev, const hif_bus_id *bid,
+		 enum qdf_bus_type bus_type, bool reinit);
 #endif /* __WLAN_HDD_DRIVER_OPS_H__ */

+ 2 - 5
core/hdd/inc/wlan_hdd_ftm.h

@@ -55,14 +55,11 @@ struct wlan_hdd_ftm_status {
 	enum wlan_hdd_ftm_state ftm_state;
 };
 
-int wlan_hdd_ftm_open(hdd_context_t *hdd_ctx);
-int wlan_hdd_ftm_close(hdd_context_t *hdd_ctx);
-
+int hdd_update_cds_config_ftm(hdd_context_t *hdd_ctx);
+void hdd_ftm_mc_process_msg(void *message);
 #if  defined(QCA_WIFI_FTM)
 QDF_STATUS wlan_hdd_ftm_testmode_cmd(void *data, int len);
 int wlan_hdd_qcmbr_unified_ioctl(hdd_adapter_t *adapter, struct ifreq *ifr);
-int hdd_ftm_start(hdd_context_t *hdd_ctx);
-int hdd_ftm_stop(hdd_context_t *hdd_ctx);
 #endif
 
 #endif

+ 23 - 3
core/hdd/inc/wlan_hdd_ipa.h

@@ -35,7 +35,27 @@
  * Originally written by Qualcomm Atheros, Inc
  */
 
-#include <linux/ipa.h>
+/**
+ * enum hdd_ipa_wlan_event - HDD IPA events
+ * @HDD_IPA_CLIENT_CONNECT: Client Connects
+ * @HDD_IPA_CLIENT_DISCONNECT: Client Disconnects
+ * @HDD_IPA_AP_CONNECT: SoftAP is started
+ * @HDD_IPA_AP_DISCONNECT: SoftAP is stopped
+ * @HDD_IPA_STA_CONNECT: STA associates to AP
+ * @HDD_IPA_STA_DISCONNECT: STA dissociates from AP
+ * @HDD_IPA_CLIENT_CONNECT_EX: Peer associates/re-associates to softap
+ * @HDD_IPA_WLAN_EVENT_MAX: Max value for the enum
+ */
+enum hdd_ipa_wlan_event {
+	HDD_IPA_CLIENT_CONNECT,
+	HDD_IPA_CLIENT_DISCONNECT,
+	HDD_IPA_AP_CONNECT,
+	HDD_IPA_AP_DISCONNECT,
+	HDD_IPA_STA_CONNECT,
+	HDD_IPA_STA_DISCONNECT,
+	HDD_IPA_CLIENT_CONNECT_EX,
+	HDD_IPA_WLAN_EVENT_MAX
+};
 
 #ifdef IPA_OFFLOAD
 /* Include files */
@@ -57,7 +77,7 @@ QDF_STATUS hdd_ipa_cleanup(hdd_context_t *hdd_ctx);
 QDF_STATUS hdd_ipa_process_rxt(void *cds_context, qdf_nbuf_t rxBuf,
 	uint8_t sta_id);
 int hdd_ipa_wlan_evt(hdd_adapter_t *adapter, uint8_t sta_id,
-	enum ipa_wlan_event type, uint8_t *mac_addr);
+	enum hdd_ipa_wlan_event type, uint8_t *mac_addr);
 int hdd_ipa_set_perf_level(hdd_context_t *hdd_ctx, uint64_t tx_packets,
 	uint64_t rx_packets);
 int hdd_ipa_suspend(hdd_context_t *hdd_ctx);
@@ -92,7 +112,7 @@ static inline QDF_STATUS hdd_ipa_process_rxt(void *cds_context,
 }
 
 static inline int hdd_ipa_wlan_evt(hdd_adapter_t *adapter, uint8_t sta_id,
-	enum ipa_wlan_event type, uint8_t *mac_addr)
+	enum hdd_ipa_wlan_event type, uint8_t *mac_addr)
 {
 	return 0;
 }

+ 2 - 0
core/hdd/inc/wlan_hdd_lro.h

@@ -101,10 +101,12 @@ struct hdd_lro_desc_info {
  * hdd_lro_s - LRO information per HDD adapter
  * @lro_mgr: LRO manager
  * @lro_desc_info: LRO descriptor information
+ * @lro_mgr_arr_access_lock: Lock to access LRO manager array.
  */
 struct hdd_lro_s {
 	struct net_lro_mgr *lro_mgr;
 	struct hdd_lro_desc_info lro_desc_info;
+	qdf_spinlock_t lro_mgr_arr_access_lock;
 };
 
 int hdd_lro_init(hdd_context_t *hdd_ctx);

+ 158 - 28
core/hdd/inc/wlan_hdd_main.h

@@ -60,15 +60,14 @@
 #include "wlan_hdd_tsf.h"
 #include "wlan_hdd_cfg80211.h"
 #include <qdf_defer.h>
-#ifdef WLAN_FEATURE_MBSSID
 #include "sap_api.h"
-#endif
 #include "ol_txrx_osif_api.h"
 #include "ol_txrx_ctrl_api.h"
 #include <wlan_hdd_lro.h>
 #include "cdp_txrx_flow_ctrl_legacy.h"
 #include <cdp_txrx_peer_ops.h>
 #include "wlan_hdd_nan_datapath.h"
+#include "wlan_tgt_def_config.h"
 
 /*---------------------------------------------------------------------------
    Preprocessor definitions and constants
@@ -113,9 +112,9 @@
 
 /** Maximum time(ms)to wait for disconnect to complete **/
 #ifdef QCA_WIFI_3_0_EMU
-#define WLAN_WAIT_TIME_DISCONNECT  3000
+#define WLAN_WAIT_TIME_DISCONNECT  5000
 #else
-#define WLAN_WAIT_TIME_DISCONNECT  2000
+#define WLAN_WAIT_TIME_DISCONNECT  5000
 #endif
 #define WLAN_WAIT_TIME_STATS       800
 #define WLAN_WAIT_TIME_POWER       800
@@ -157,6 +156,9 @@
 
 #define MAX_CFG_STRING_LEN  255
 
+/* SSR Retry Count */
+#define HDD_MOD_EXIT_SSR_MAX_RETRIES 75
+
 #define MAC_ADDR_ARRAY(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
 /** Mac Address string **/
 #define MAC_ADDRESS_STR "%02x:%02x:%02x:%02x:%02x:%02x"
@@ -229,7 +231,11 @@
 #define WLAN_HDD_QOS_MAP_CONFIGURE 4
 #define HDD_SAP_WAKE_LOCK_DURATION 10000        /* in msecs */
 
+#if defined(CONFIG_HL_SUPPORT)
+#define HDD_MOD_EXIT_SSR_MAX_RETRIES 200
+#else
 #define HDD_MOD_EXIT_SSR_MAX_RETRIES 75
+#endif
 
 #ifdef WLAN_FEATURE_GTK_OFFLOAD
 #define GTK_OFFLOAD_ENABLE  0
@@ -241,6 +247,10 @@
 #define HDD_MIN_TX_POWER (-100) /* minimum tx power */
 #define HDD_MAX_TX_POWER (+100) /* maximum tx power */
 
+/* FW expects burst duration in 1020*ms */
+#define SIFS_BURST_DUR_MULTIPLIER 1020
+#define SIFS_BURST_DUR_MAX        12240
+
 /* If IPA UC data path is enabled, target should reserve extra tx descriptors
  * for IPA data path.
  * Then host data path should allow less TX packet pumping in case
@@ -259,6 +269,11 @@
 
 #define BSS_WAIT_TIMEOUT 10000
 
+#define PRE_CAC_SSID "pre_cac_ssid"
+
+/* session ID invalid */
+#define HDD_SESSION_ID_INVALID    0xFF
+
 /*
  * Generic asynchronous request/response support
  *
@@ -388,6 +403,7 @@ typedef struct hdd_stats_s {
 	tCsrGlobalClassCStatsInfo ClassC_stat;
 	tCsrGlobalClassDStatsInfo ClassD_stat;
 	tCsrPerStaStatsInfo perStaStats;
+	struct csr_per_chain_rssi_stats_info  per_chain_rssi_stats;
 	hdd_tx_rx_stats_t hddTxRxStats;
 #ifdef WLAN_FEATURE_11W
 	hdd_pmf_stats_t hddPmfStats;
@@ -618,6 +634,11 @@ typedef struct hdd_cfg80211_state_s {
 	hdd_remain_on_chan_ctx_t *remain_on_chan_ctx;
 	struct mutex remain_on_chan_ctx_lock;
 	eP2PActionFrameState actionFrmState;
+	/* is_go_neg_ack_received flag is set to 1 when
+	* the pending ack for GO negotiation req is
+	* received.
+	*/
+	bool is_go_neg_ack_received;
 } hdd_cfg80211_state_t;
 
 /**
@@ -667,7 +688,7 @@ struct hdd_station_ctx {
 	/* STA ctx debug variables */
 	int staDebugState;
 
-	uint8_t broadcast_ibss_staid;
+	uint8_t broadcast_staid;
 
 	struct hdd_mon_set_ch_info ch_info;
 #ifdef WLAN_FEATURE_NAN_DATAPATH
@@ -754,13 +775,16 @@ struct hdd_ap_ctx_s {
 	/* This will have WEP key data, if it is received before start bss */
 	tCsrRoamSetKey wepKey[CSR_MAX_NUM_KEY];
 
+	/* WEP default key index */
+	uint8_t wep_def_key_idx;
+
 	beacon_data_t *beacon;
 
 	bool bApActive;
-#ifdef WLAN_FEATURE_MBSSID
+
 	/* SAP Context */
 	void *sapContext;
-#endif
+
 	bool dfs_cac_block_tx;
 };
 
@@ -775,6 +799,8 @@ typedef struct hdd_scaninfo_s {
 	/* Additional IE for scan */
 	tSirAddie scanAddIE;
 
+	uint8_t *default_scan_ies;
+	uint8_t default_scan_ies_len;
 	/* Scan mode */
 	tSirScanType scan_mode;
 
@@ -783,7 +809,7 @@ typedef struct hdd_scaninfo_s {
 
 } hdd_scaninfo_t;
 
-#define WLAN_HDD_MAX_MC_ADDR_LIST 10
+#define WLAN_HDD_MAX_MC_ADDR_LIST CFG_TGT_MAX_MULTICAST_FILTER_ENTRIES
 
 #ifdef WLAN_FEATURE_PACKET_FILTERING
 typedef struct multicast_addr_list {
@@ -1039,8 +1065,10 @@ struct hdd_adapter_s {
 	struct sir_dcc_update_ndl_response dcc_update_ndl_resp;
 
 	/* MAC addresses used for OCB interfaces */
+#ifdef WLAN_FEATURE_DSRC
 	struct qdf_mac_addr ocb_mac_address[QDF_MAX_CONCURRENCY_PERSONA];
 	int ocb_mac_addr_count;
+#endif
 
 	/* BITMAP indicating pause reason */
 	uint32_t pause_map;
@@ -1057,6 +1085,11 @@ struct hdd_adapter_s {
 	ol_txrx_tx_fp tx_fn;
 	/* debugfs entry */
 	struct dentry *debugfs_phy;
+	/*
+	 * The pre cac channel is saved here and will be used when the SAP's
+	 * channel needs to be moved from the existing 2.4GHz channel.
+	 */
+	uint8_t pre_cac_chan;
 };
 
 #define WLAN_HDD_GET_STATION_CTX_PTR(pAdapter) (&(pAdapter)->sessionCtx.station)
@@ -1066,9 +1099,7 @@ struct hdd_adapter_s {
 #define WLAN_HDD_GET_HAL_CTX(pAdapter)  (((hdd_context_t *)(pAdapter->pHddCtx))->hHal)
 #define WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter) (&(pAdapter)->sessionCtx.ap.HostapdState)
 #define WLAN_HDD_GET_CFG_STATE_PTR(pAdapter)  (&(pAdapter)->cfg80211State)
-#ifdef WLAN_FEATURE_MBSSID
 #define WLAN_HDD_GET_SAP_CTX_PTR(pAdapter) (pAdapter->sessionCtx.ap.sapContext)
-#endif
 #ifdef FEATURE_WLAN_TDLS
 #define WLAN_HDD_IS_TDLS_SUPPORTED_ADAPTER(pAdapter) \
 	(((QDF_STA_MODE != pAdapter->device_mode) && \
@@ -1184,6 +1215,30 @@ struct hdd_bpf_context {
 	struct sir_bpf_get_offload capability_response;
 };
 
+/**
+ * enum driver_status: Driver Modules status
+ * @DRIVER_MODULES_UNINITIALIZED: Driver CDS modules uninitialized
+ * @DRIVER_MODULES_OPENED: Driver CDS modules opened
+ * @DRIVER_MODULES_ENABLED: Driver CDS modules opened
+ * @DRIVER_MODULES_CLOSED: Driver CDS modules closed
+ */
+enum driver_modules_status {
+	DRIVER_MODULES_UNINITIALIZED,
+	DRIVER_MODULES_OPENED,
+	DRIVER_MODULES_ENABLED,
+	DRIVER_MODULES_CLOSED
+};
+
+/**
+ * struct acs_dfs_policy - Define ACS policies
+ * @acs_dfs_mode: Dfs mode enabled/disabled.
+ * @acs_channel: pre defined channel to avoid ACS.
+ */
+struct acs_dfs_policy {
+	enum dfs_mode acs_dfs_mode;
+	uint8_t acs_channel;
+};
+
 /** Adapter structure definition */
 
 struct hdd_context_s {
@@ -1261,6 +1316,7 @@ struct hdd_context_s {
 
 #ifdef FEATURE_WLAN_TDLS
 	eTDLSSupportMode tdls_mode;
+	bool concurrency_marked;
 	eTDLSSupportMode tdls_mode_last;
 	tdlsConnInfo_t tdlsConnInfo[HDD_MAX_NUM_TDLS_STA];
 	/* maximum TDLS station number allowed upon runtime condition */
@@ -1277,7 +1333,10 @@ struct hdd_context_s {
 	bool enable_tdls_connection_tracker;
 	uint8_t tdls_external_peer_count;
 	bool tdls_nss_switch_in_progress;
+	bool tdls_nss_teardown_complete;
+	enum tdls_nss_transition_type tdls_nss_transition_mode;
 	int32_t tdls_teardown_peers_cnt;
+	struct tdls_set_state_info set_state_info;
 #endif
 
 	void *hdd_ipa;
@@ -1323,7 +1382,7 @@ struct hdd_context_s {
 
 	/* defining the firmware version */
 	uint32_t target_fw_version;
-	uint32_t dfs_radar_found;
+	qdf_atomic_t dfs_radar_found;
 
 	/* defining the chip/rom version */
 	uint32_t target_hw_version;
@@ -1387,10 +1446,12 @@ struct hdd_context_s {
 	qdf_spinlock_t hdd_scan_req_q_lock;
 	qdf_list_t hdd_scan_req_q;
 	uint8_t miracast_value;
+
 #ifdef WLAN_NS_OFFLOAD
 	/* IPv6 notifier callback for handling NS offload on change in IP */
 	struct notifier_block ipv6_notifier;
 #endif
+	bool ns_offload_enable;
 	/* IPv4 notifier callback for handling ARP offload on change in IP */
 	struct notifier_block ipv4_notifier;
 
@@ -1408,6 +1469,7 @@ struct hdd_context_s {
 	qdf_mc_timer_t memdump_cleanup_timer;
 	struct mutex memdump_lock;
 	bool memdump_in_progress;
+	bool memdump_init_done;
 #endif /* WLAN_FEATURE_MEMDUMP */
 
 	bool connection_in_progress;
@@ -1415,17 +1477,13 @@ struct hdd_context_s {
 
 	uint16_t hdd_txrx_hist_idx;
 	struct hdd_tx_rx_histogram *hdd_txrx_hist;
-	/*
-	 * Dfs lock used to syncronize on sap channel switch during
-	 * radar found indication and application triggered channel
-	 * switch.
-	 */
-	qdf_spinlock_t dfs_lock;
+
 	/*
 	 * place to store FTM capab of target. This allows changing of FTM capab
 	 * at runtime and intersecting it with target capab before updating.
 	 */
 	uint32_t fine_time_meas_cap_target;
+	uint32_t rx_high_ind_cnt;
 	/* completion variable to indicate set antenna mode complete*/
 	struct completion set_antenna_mode_cmpl;
 	/* Current number of TX X RX chains being used */
@@ -1434,10 +1492,26 @@ struct hdd_context_s {
 
 	/* the radio index assigned by cnss_logger */
 	int radio_index;
+	qdf_work_t sap_pre_cac_work;
 	bool hbw_requested;
+	uint32_t last_nil_scan_bug_report_timestamp;
 #ifdef WLAN_FEATURE_NAN_DATAPATH
 	bool nan_datapath_enabled;
 #endif
+	/* Present state of driver cds modules */
+	enum driver_modules_status driver_status;
+	/* MC timer interface change */
+	qdf_mc_timer_t iface_change_timer;
+	/* Interface change lock */
+	struct mutex iface_change_lock;
+	bool rps;
+	bool enableRxThread;
+	bool napi_enable;
+	bool stop_modules_in_progress;
+	bool start_modules_in_progress;
+	bool update_mac_addr_to_fw;
+	struct acs_dfs_policy acs_policy;
+	uint16_t wmi_max_len;
 };
 
 /*---------------------------------------------------------------------------
@@ -1479,6 +1553,7 @@ QDF_STATUS hdd_close_adapter(hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter,
 			     bool rtnl_held);
 QDF_STATUS hdd_close_all_adapters(hdd_context_t *pHddCtx, bool rtnl_held);
 QDF_STATUS hdd_stop_all_adapters(hdd_context_t *pHddCtx);
+void hdd_deinit_all_adapters(hdd_context_t *hdd_ctx, bool rtnl_held);
 QDF_STATUS hdd_reset_all_adapters(hdd_context_t *pHddCtx);
 QDF_STATUS hdd_start_all_adapters(hdd_context_t *pHddCtx);
 hdd_adapter_t *hdd_get_adapter_by_vdev(hdd_context_t *pHddCtx,
@@ -1523,7 +1598,6 @@ struct qdf_mac_addr *
 hdd_wlan_get_ibss_mac_addr_from_staid(hdd_adapter_t *pAdapter,
 				      uint8_t staIdx);
 void hdd_checkandupdate_phymode(hdd_context_t *pHddCtx);
-
 #ifdef MSM_PLATFORM
 void hdd_start_bus_bw_compute_timer(hdd_adapter_t *pAdapter);
 void hdd_stop_bus_bw_compute_timer(hdd_adapter_t *pAdapter);
@@ -1542,7 +1616,7 @@ static inline void hdd_stop_bus_bw_computer_timer(hdd_adapter_t *pAdapter)
 int hdd_init(void);
 void hdd_deinit(void);
 
-int hdd_wlan_startup(struct device *dev, void *hif_sc);
+int hdd_wlan_startup(struct device *dev);
 void __hdd_wlan_exit(void);
 int hdd_wlan_notify_modem_power_state(int state);
 #ifdef QCA_HT_2040_COEX
@@ -1550,7 +1624,7 @@ int hdd_wlan_set_ht2040_mode(hdd_adapter_t *pAdapter, uint16_t staId,
 			     struct qdf_mac_addr macAddrSTA, int width);
 #endif
 
-void wlan_hdd_send_svc_nlink_msg(int type, void *data, int len);
+void wlan_hdd_send_svc_nlink_msg(int radio, int type, void *data, int len);
 #ifdef FEATURE_WLAN_AUTO_SHUTDOWN
 void wlan_hdd_auto_shutdown_enable(hdd_context_t *hdd_ctx, bool enable);
 #endif
@@ -1600,13 +1674,8 @@ QDF_STATUS wlan_hdd_check_custom_con_channel_rules(hdd_adapter_t *sta_adapter,
 						  tCsrRoamProfile *roam_profile,
 						  tScanResultHandle *scan_cache,
 						  bool *concurrent_chnl_same);
-#ifdef WLAN_FEATURE_MBSSID
 void wlan_hdd_stop_sap(hdd_adapter_t *ap_adapter);
 void wlan_hdd_start_sap(hdd_adapter_t *ap_adapter);
-#else
-static inline void wlan_hdd_stop_sap(hdd_adapter_t *ap_adapter) {}
-static inline void wlan_hdd_start_sap(hdd_adapter_t *ap_adapter) {}
-#endif
 
 void wlan_hdd_soc_set_antenna_mode_cb(enum set_antenna_mode_status status);
 
@@ -1619,11 +1688,13 @@ static inline int wlan_hdd_get_cpu(void)
 }
 #endif
 
+void wlan_hdd_sap_pre_cac_failure(void *data);
+void hdd_clean_up_pre_cac_interface(hdd_context_t *hdd_ctx);
+
 void wlan_hdd_txrx_pause_cb(uint8_t vdev_id,
 	enum netif_action_type action, enum netif_reason_type reason);
 
 void hdd_wlan_dump_stats(hdd_adapter_t *adapter, int value);
-int wlan_hdd_init_tx_rx_histogram(hdd_context_t *hdd_ctx);
 void wlan_hdd_deinit_tx_rx_histogram(hdd_context_t *hdd_ctx);
 void wlan_hdd_display_tx_rx_histogram(hdd_context_t *pHddCtx);
 void wlan_hdd_clear_tx_rx_histogram(hdd_context_t *pHddCtx);
@@ -1636,12 +1707,20 @@ hdd_adapter_t *hdd_get_adapter_by_sme_session_id(hdd_context_t *hdd_ctx,
 enum phy_ch_width hdd_map_nl_chan_width(enum nl80211_chan_width ch_width);
 uint8_t wlan_hdd_find_opclass(tHalHandle hal, uint8_t channel,
 			uint8_t bw_offset);
-void hdd_update_config(hdd_context_t *hdd_ctx);
+int hdd_update_config(hdd_context_t *hdd_ctx);
 
 QDF_STATUS hdd_chan_change_notify(hdd_adapter_t *adapter,
 		struct net_device *dev,
 		struct hdd_chan_change_params chan_change);
-
+int wlan_hdd_set_channel(struct wiphy *wiphy,
+		struct net_device *dev,
+		struct cfg80211_chan_def *chandef,
+		enum nl80211_channel_type channel_type);
+int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter,
+		struct cfg80211_beacon_data *params,
+		const u8 *ssid, size_t ssid_len,
+		enum nl80211_hidden_ssid hidden_ssid,
+		bool check_for_concurrency);
 #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
 QDF_STATUS hdd_register_for_sap_restart_with_channel_switch(void);
 #else
@@ -1651,6 +1730,20 @@ static inline QDF_STATUS hdd_register_for_sap_restart_with_channel_switch(void)
 }
 #endif
 
+#if !defined(REMOVE_PKT_LOG)
+int hdd_process_pktlog_command(hdd_context_t *hdd_ctx, uint32_t set_value);
+int hdd_pktlog_enable_disable(hdd_context_t *hdd_ctx, bool enable, uint8_t);
+#else
+int hdd_pktlog_enable_disable(hdd_context_t *hdd_ctx, bool enable, uint8_t)
+{
+	return 0;
+}
+int hdd_process_pktlog_command(hdd_context_t *hdd_ctx, uint32_t set_value)
+{
+	return 0;
+}
+#endif /* REMOVE_PKT_LOG */
+
 #ifdef FEATURE_TSO
 /**
  * hdd_set_tso_flags() - enable TSO flags in the network device
@@ -1742,4 +1835,41 @@ static inline int wlan_hdd_nl_init(hdd_context_t *hdd_ctx)
 #endif
 QDF_STATUS hdd_sme_close_session_callback(void *pContext);
 
+int hdd_reassoc(hdd_adapter_t *adapter, const uint8_t *bssid,
+		const uint8_t channel, const handoff_src src);
+void hdd_svc_fw_shutdown_ind(struct device *dev);
+int hdd_register_cb(hdd_context_t *hdd_ctx);
+void hdd_deregister_cb(hdd_context_t *hdd_ctx);
+int hdd_start_station_adapter(hdd_adapter_t *adapter);
+int hdd_start_ap_adapter(hdd_adapter_t *adapter);
+int hdd_configure_cds(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter);
+int hdd_start_ftm_adapter(hdd_adapter_t *adapter);
+int hdd_set_fw_params(hdd_adapter_t *adapter);
+int hdd_wlan_start_modules(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter,
+			   bool reinit);
+int hdd_wlan_stop_modules(hdd_context_t *hdd_ctx, bool shutdown);
+int hdd_start_adapter(hdd_adapter_t *adapter);
+void hdd_connect_result(struct net_device *dev, const u8 *bssid,
+			tCsrRoamInfo *roam_info, const u8 *req_ie,
+			size_t req_ie_len, const u8 *resp_ie,
+			size_t resp_ie_len, u16 status, gfp_t gfp,
+			bool connect_timeout);
+
+#ifdef WLAN_FEATURE_FASTPATH
+void hdd_enable_fastpath(struct hdd_config *hdd_cfg,
+			 void *context);
+#else
+static inline void hdd_enable_fastpath(struct hdd_config *hdd_cfg,
+				       void *context)
+{
+}
+#endif
+void hdd_wlan_update_target_info(hdd_context_t *hdd_ctx, void *context);
+
+enum  sap_acs_dfs_mode wlan_hdd_get_dfs_mode(enum dfs_mode mode);
+
+void hdd_ch_avoid_cb(void *hdd_context, void *indi_param);
+void hdd_unsafe_channel_restart_sap(hdd_context_t *hdd_ctx);
+int hdd_enable_disable_ca_event(hdd_context_t *hddctx,
+				uint8_t set_value);
 #endif /* end #if !defined(WLAN_HDD_MAIN_H) */

+ 10 - 2
core/hdd/inc/wlan_hdd_memdump.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2015-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -64,13 +64,14 @@ enum qca_wlan_vendor_attr_memory_dump {
 #define FW_DRAM_LOCATION    0x00400000
 #define FW_MEM_DUMP_REQ_ID  1
 #define FW_MEM_DUMP_NUM_SEG 1
-#define MEMDUMP_COMPLETION_TIME_MS 5000
+#define MEMDUMP_COMPLETION_TIME_MS 800
 
 int memdump_init(void);
 void memdump_deinit(void);
 int wlan_hdd_cfg80211_get_fw_mem_dump(struct wiphy *wiphy,
 				      struct wireless_dev *wdev,
 				      const void *data, int data_len);
+void wlan_hdd_cfg80211_fw_mem_dump_cb(void *ctx, struct fw_dump_rsp *dump_rsp);
 #else
 static inline int memdump_init(void)
 {
@@ -87,6 +88,13 @@ static inline int wlan_hdd_cfg80211_get_fw_mem_dump(struct wiphy *wiphy,
 {
 	return -ENOTSUPP;
 }
+
+
+static inline void wlan_hdd_cfg80211_fw_mem_dump_cb(void *ctx,
+						    struct fw_dump_rsp
+						    *dump_rsp)
+{
+}
 #endif
 
 #endif /* if !defined(WLAN_HDD_MEMDUMP_H)*/

+ 20 - 3
core/hdd/inc/wlan_hdd_nan.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -46,13 +46,30 @@ int wlan_hdd_cfg80211_nan_request(struct wiphy *wiphy,
 				  int data_len);
 
 bool wlan_hdd_nan_is_supported(void);
-void wlan_hdd_nan_init(struct hdd_context_s *hdd_ctx);
+/**
+ * hdd_nan_populate_cds_config() - Populate NAN cds configuration
+ * @cds_cfg: CDS Configuration
+ * @hdd_ctx: Pointer to hdd context
+ *
+ * Return: none
+ */
+static inline void hdd_nan_populate_cds_config(struct cds_config_info *cds_cfg,
+			hdd_context_t *hdd_ctx)
+{
+	cds_cfg->is_nan_enabled = hdd_ctx->config->enable_nan_support;
+}
+void wlan_hdd_cfg80211_nan_callback(void *ctx, tSirNanEvent *msg);
 #else
 static inline bool wlan_hdd_nan_is_supported(void)
 {
 	return false;
 }
-static inline void wlan_hdd_nan_init(struct hdd_context_s *hdd_ctx)
+static inline void hdd_nan_populate_cds_config(struct cds_config_info *cds_cfg,
+			hdd_context_t *hdd_ctx)
+{
+}
+static inline void wlan_hdd_cfg80211_nan_callback(void *ctx,
+						  tSirNanEvent *msg)
 {
 }
 #endif /* WLAN_FEATURE_NAN */

+ 25 - 3
core/hdd/inc/wlan_hdd_napi.h

@@ -37,9 +37,12 @@
 
 /* CLD headers */
 #include "hif_napi.h"
+
 /* Linux headers */
 #include <linux/netdevice.h> /* net_device */
 
+struct hdd_context_s;
+
 #define HDD_NAPI_ANY (-1)
 
 int hdd_napi_enabled(int id);
@@ -58,6 +61,19 @@ int hdd_napi_poll(struct napi_struct *napi, int budget);
 
 struct qca_napi_data *hdd_napi_get_all(void);
 
+#ifdef HELIUMPLUS
+int hdd_napi_apply_throughput_policy(struct hdd_context_s *hddctx,
+				     uint64_t              tx_packets,
+				     uint64_t              rx_packets);
+#else /* FEATURE_NAPI and NOT HELIUM */
+static inline int hdd_napi_apply_throughput_policy(struct hdd_context_s *hddctx,
+						   uint64_t tx_packets,
+						   uint64_t rx_packets)
+{
+	return 0;
+}
+#endif /* HELIUMPLUS */
+
 #else /* ! defined(FEATURE_NAPI) */
 #include "hif_napi.h"
 /**
@@ -71,11 +87,17 @@ static inline int hdd_napi_enabled(int id) { return 0; }
 static inline int hdd_napi_create(void) { return 0; }
 static inline int hdd_napi_destroy(int force) { return 0; }
 static inline int hdd_napi_stats(char *buf, int max, char *indp,
-				 struct qca_napi_data *napid)
-{ return 0; }
+				 struct qca_napi_data *napid) { return 0; }
 static inline int hdd_napi_event(enum qca_napi_event event, void *data)
-{ return 0; }
+{
+	return 0;
+}
 static inline struct qca_napi_data *hdd_napi_get_all(void) { return NULL; }
+static inline int hdd_napi_apply_throughput_policy(void *hdd_ctx,
+				uint64_t tx_packets, uint64_t rx_packets)
+{
+	return 0;
+}
 
 #endif /* FEATURE_NAPI */
 

+ 1 - 1
core/hdd/inc/wlan_hdd_oemdata.h

@@ -186,7 +186,7 @@ int iw_get_oem_data_cap(struct net_device *dev, struct iw_request_info *info,
 
 int oem_activate_service(struct hdd_context_s *hdd_ctx);
 
-void hdd_send_oem_data_rsp_msg(int length, uint8_t *oemDataRsp);
+void hdd_send_oem_data_rsp_msg(struct oem_data_rsp *oem_rsp);
 #else
 static inline int oem_activate_service(struct hdd_context_s *hdd_ctx)
 {

+ 4 - 0
core/hdd/inc/wlan_hdd_p2p.h

@@ -70,6 +70,9 @@
 #define P2P_POWER_SAVE_TYPE_PERIODIC_NOA         (1 << 1)
 #define P2P_POWER_SAVE_TYPE_SINGLE_NOA           (1 << 2)
 
+#define ACTION_FRAME_RSP_WAIT 500
+#define ACTION_FRAME_ACK_WAIT 300
+
 #ifdef WLAN_FEATURE_P2P_DEBUG
 typedef enum { P2P_NOT_ACTIVE,
 	       P2P_GO_NEG_PROCESS,
@@ -119,6 +122,7 @@ void hdd_remain_chan_ready_handler(hdd_adapter_t *pAdapter,
 	uint32_t scan_id);
 void hdd_send_action_cnf(hdd_adapter_t *pAdapter, bool actionSendSuccess);
 int wlan_hdd_check_remain_on_channel(hdd_adapter_t *pAdapter);
+void hdd_send_action_cnf_cb(uint32_t session_id, bool status);
 void wlan_hdd_cancel_existing_remain_on_channel(hdd_adapter_t *pAdapter);
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0))

+ 7 - 2
core/hdd/inc/wlan_hdd_power.h

@@ -145,7 +145,7 @@ enum suspend_resume_state {
 
 /* SSR shutdown & re-init functions */
 QDF_STATUS hdd_wlan_shutdown(void);
-QDF_STATUS hdd_wlan_re_init(void *hif_sc);
+QDF_STATUS hdd_wlan_re_init(void);
 
 void hdd_conf_mcastbcast_filter(hdd_context_t *pHddCtx, bool setfilter);
 QDF_STATUS hdd_conf_arp_offload(hdd_adapter_t *pAdapter, bool fenable);
@@ -167,6 +167,7 @@ int wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy);
 
 void hdd_ipv4_notifier_work_queue(struct work_struct *work);
 #ifdef WLAN_NS_OFFLOAD
+void hdd_conf_ns_offload(hdd_adapter_t *adapter, bool fenable);
 void hdd_ipv6_notifier_work_queue(struct work_struct *work);
 #endif
 
@@ -178,7 +179,8 @@ int wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy,
 				  enum nl80211_tx_power_setting type,
 				  int dbm);
 int wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy,
-				     struct net_device *dev, bool mode,
+				     struct net_device *dev,
+				     bool allow_power_save,
 				     int timeout);
 
 int wlan_hdd_ipv4_changed(struct notifier_block *nb,
@@ -187,6 +189,9 @@ int wlan_hdd_ipv4_changed(struct notifier_block *nb,
 int wlan_hdd_ipv6_changed(struct notifier_block *nb,
 				unsigned long data, void *arg);
 
+int hdd_set_qpower_config(hdd_context_t *hddctx, hdd_adapter_t *adapter,
+			  uint8_t qpower);
+
 #ifdef FEATURE_WLAN_DIAG_SUPPORT
 void hdd_wlan_suspend_resume_event(uint8_t state);
 #else

+ 42 - 1
core/hdd/inc/wlan_hdd_tdls.h

@@ -144,6 +144,18 @@ enum tdls_spatial_streams {
 	TDLS_NSS_2x2_MODE = 0xff,
 };
 
+/**
+ * enum tdls_nss_transition_type - TDLS NSS transition states
+ * @TDLS_NSS_TRANSITION_UNKNOWN: default state
+ * @TDLS_NSS_TRANSITION_2x2_to_1x1: transition from 2x2 to 1x1 stream
+ * @TDLS_NSS_TRANSITION_1x1_to_2x2: transition from 1x1 to 2x2 stream
+ */
+enum tdls_nss_transition_type {
+	TDLS_NSS_TRANSITION_UNKNOWN = 0,
+	TDLS_NSS_TRANSITION_2x2_to_1x1,
+	TDLS_NSS_TRANSITION_1x1_to_2x2,
+};
+
 /**
  * enum tTDLSCapType - tdls capability type
  *
@@ -314,6 +326,17 @@ struct tdls_ct_mac_table {
 	uint32_t rx_packet_cnt;
 	uint32_t peer_timestamp_ms;
 };
+
+/**
+ * struct tdls_set_state_db - set state command data base
+ * @set_state_cnt: tdls set state count
+ * @vdev_id: vdev id of last set state command
+ */
+struct tdls_set_state_info {
+	uint8_t set_state_cnt;
+	uint8_t vdev_id;
+};
+
 /**
  * struct tdlsCtx_t - tdls context
  *
@@ -382,6 +405,7 @@ typedef struct {
  * @spatial_streams: Number of TX/RX spatial streams for TDLS
  * @reason: reason
  * @state_change_notification: state change notification
+ * @qos: QOS capability of TDLS link
  */
 typedef struct _hddTdlsPeer_t {
 	struct list_head node;
@@ -414,6 +438,7 @@ typedef struct _hddTdlsPeer_t {
 	uint8_t spatial_streams;
 	tTDLSLinkReason reason;
 	cfg80211_exttdls_callback state_change_notification;
+	uint8_t qos;
 } hddTdlsPeer_t;
 
 /**
@@ -513,7 +538,8 @@ int wlan_hdd_tdls_recv_discovery_resp(hdd_adapter_t *pAdapter,
 int wlan_hdd_tdls_set_peer_caps(hdd_adapter_t *pAdapter,
 				const uint8_t *mac,
 				tCsrStaParams *StaParams,
-				bool isBufSta, bool isOffChannelSupported);
+				bool isBufSta, bool isOffChannelSupported,
+				bool is_qos_wmm_sta);
 
 int wlan_hdd_tdls_set_rssi(hdd_adapter_t *pAdapter, const uint8_t *mac,
 			   int8_t rxRssi);
@@ -684,6 +710,8 @@ void hdd_tdls_context_destroy(hdd_context_t *hdd_ctx);
 int wlan_hdd_tdls_antenna_switch(hdd_context_t *hdd_ctx,
 				 hdd_adapter_t *adapter,
 				 uint32_t mode);
+hdd_adapter_t *wlan_hdd_tdls_check_and_enable(hdd_context_t *hdd_ctx);
+
 
 #else
 static inline void hdd_tdls_notify_mode_change(hdd_adapter_t *adapter,
@@ -714,6 +742,19 @@ static inline int wlan_hdd_tdls_antenna_switch(hdd_context_t *hdd_ctx,
 {
 	return 0;
 }
+
+static inline hdd_adapter_t *wlan_hdd_tdls_check_and_enable(
+						hdd_context_t *hdd_ctx)
+{
+	return NULL;
+}
+
+static inline void wlan_hdd_update_tdls_info(hdd_adapter_t *adapter,
+						bool tdls_prohibited,
+						bool tdls_chan_swit_prohibited)
+{
+}
+
 #endif /* End of FEATURE_WLAN_TDLS */
 
 #ifdef FEATURE_WLAN_DIAG_SUPPORT

+ 8 - 4
core/hdd/inc/wlan_hdd_trace.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -81,8 +81,6 @@
 	ENUM(TRACE_CODE_HDD_CHANGE_STATION) \
 	ENUM(TRACE_CODE_HDD_CFG80211_UPDATE_BSS) \
 	ENUM(TRACE_CODE_HDD_CFG80211_SCAN) \
-	ENUM(TRACE_CODE_HDD_CFG80211_SCHED_SCAN_START) \
-	ENUM(TRACE_CODE_HDD_CFG80211_SCHED_SCAN_STOP) \
 	ENUM(TRACE_CODE_HDD_REMAIN_ON_CHANNEL) \
 	ENUM(TRACE_CODE_HDD_REMAINCHANREADYHANDLER) \
 	ENUM(TRACE_CODE_HDD_CFG80211_CANCEL_REMAIN_ON_CHANNEL) \
@@ -93,7 +91,6 @@
 	ENUM(TRACE_CODE_HDD_CFG80211_DEL_STA) \
 	ENUM(TRACE_CODE_HDD_CFG80211_ADD_STA) \
 	ENUM(TRACE_CODE_HDD_CFG80211_SET_PMKSA) \
-	ENUM(TRACE_CODE_HDD_CFG80211_DEL_PMKSA) \
 	ENUM(TRACE_CODE_HDD_CFG80211_UPDATE_FT_IES) \
 	ENUM(TRACE_CODE_HDD_CFG80211_TDLS_MGMT) \
 	ENUM(TRACE_CODE_HDD_CFG80211_TDLS_OPER) \
@@ -109,6 +106,13 @@
 	ENUM(TRACE_CODE_HDD_CFG80211_SET_MAC_ACL) \
 	ENUM(TRACE_CODE_HDD_CFG80211_TESTMODE) \
 	ENUM(TRACE_CODE_HDD_CFG80211_DUMP_SURVEY) \
+	ENUM(TRACE_CODE_HDD_CFG80211_SCHED_SCAN_START) \
+	ENUM(TRACE_CODE_HDD_CFG80211_SCHED_SCAN_STOP) \
+	ENUM(TRACE_CODE_HDD_CFG80211_DEL_PMKSA) \
+	/*
+	 * New CFG80211 enums to be added before this comment.
+	 * TRACE_CODE_HDD_RX_SME_MSG is used as code for MTRACE commands.
+	 */ \
 	ENUM(TRACE_CODE_HDD_RX_SME_MSG)
 
 enum {

+ 6 - 1
core/hdd/inc/wlan_hdd_tsf.h

@@ -61,13 +61,13 @@ enum hdd_tsf_capture_state {
 };
 
 #ifdef WLAN_FEATURE_TSF
-void wlan_hdd_tsf_init(struct hdd_context_s *hdd_ctx);
 int hdd_capture_tsf(struct hdd_adapter_s *adapter, uint32_t *buf, int len);
 int hdd_indicate_tsf(struct hdd_adapter_s *adapter, uint32_t *buf, int len);
 int wlan_hdd_cfg80211_handle_tsf_cmd(struct wiphy *wiphy,
 					struct wireless_dev *wdev,
 					const void *data,
 					int data_len);
+int hdd_get_tsf_cb(void *pcb_cxt, struct stsf *ptsf);
 #else
 static inline void wlan_hdd_tsf_init(struct hdd_context_s *hdd_ctx)
 {
@@ -93,6 +93,11 @@ static inline int wlan_hdd_cfg80211_handle_tsf_cmd(struct wiphy *wiphy,
 {
 	return -ENOTSUPP;
 }
+static inline int hdd_get_tsf_cb(void *pcb_cxt, struct stsf *ptsf)
+{
+	return -ENOTSUPP;
+}
+
 #endif
 
 #endif

+ 17 - 0
core/hdd/inc/wlan_hdd_tx_rx.h

@@ -113,4 +113,21 @@ const char *hdd_action_type_to_string(enum netif_action_type action);
 void wlan_hdd_netif_queue_control(hdd_adapter_t *adapter,
 		enum netif_action_type action, enum netif_reason_type reason);
 int hdd_set_mon_rx_cb(struct net_device *dev);
+void hdd_send_rps_ind(hdd_adapter_t *adapter);
+void wlan_hdd_classify_pkt(struct sk_buff *skb);
+
+#ifdef MSM_PLATFORM
+void hdd_reset_tcp_delack(hdd_context_t *hdd_ctx);
+#else
+static inline void hdd_reset_tcp_delack(hdd_context_t *hdd_ctx) {}
+#endif
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+void hdd_event_eapol_log(struct sk_buff *skb, enum qdf_proto_dir dir);
+#else
+static inline
+void hdd_event_eapol_log(struct sk_buff *skb, enum qdf_proto_dir dir)
+{}
+#endif
+
 #endif /* end #if !defined(WLAN_HDD_TX_RX_H) */

+ 23 - 1
core/hdd/inc/wlan_hdd_wext.h

@@ -215,6 +215,9 @@ typedef enum {
 #define WFD_OUI_TYPE_SIZE  4
 #endif
 
+#define MBO_OUI_TYPE   "\x50\x6f\x9a\x16"
+#define MBO_OUI_TYPE_SIZE  4
+
 typedef enum {
 	eWEXT_WPS_OFF = 0,
 	eWEXT_WPS_ON = 1,
@@ -288,6 +291,18 @@ typedef struct ccp_freq_chan_map_s {
 	wlan_hdd_get_vendor_oui_ie_ptr(WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE, ie, ie_len)
 #endif
 
+#define wlan_hdd_get_mbo_ie_ptr(ie, ie_len) \
+	wlan_hdd_get_vendor_oui_ie_ptr(MBO_OUI_TYPE, MBO_OUI_TYPE_SIZE, ie, ie_len)
+/*
+ * Defines for fw_test command
+ */
+#define HDD_FWTEST_PARAMS 3
+#define HDD_FWTEST_SU_PARAM_ID 53
+#define HDD_FWTEST_MU_PARAM_ID 2
+#define HDD_FWTEST_SU_DEFAULT_VALUE 100
+#define HDD_FWTEST_MU_DEFAULT_VALUE 40
+#define HDD_FWTEST_MAX_VALUE 500
+
 extern int hdd_unregister_wext(struct net_device *dev);
 extern int hdd_register_wext(struct net_device *dev);
 extern int hdd_wlan_get_freq(uint32_t chan, uint32_t *freq);
@@ -295,7 +310,7 @@ extern int hdd_wlan_get_rts_threshold(hdd_adapter_t *pAdapter,
 				      union iwreq_data *wrqu);
 extern int hdd_wlan_get_frag_threshold(hdd_adapter_t *pAdapter,
 				       union iwreq_data *wrqu);
-extern void hdd_wlan_get_version(hdd_adapter_t *pAdapter,
+extern void hdd_wlan_get_version(hdd_context_t *hdd_ctx,
 				 union iwreq_data *wrqu, char *extra);
 
 extern void hdd_wlan_get_stats(hdd_adapter_t *pAdapter, uint16_t *length,
@@ -353,6 +368,13 @@ QDF_STATUS wlan_hdd_get_rssi(hdd_adapter_t *pAdapter, int8_t *rssi_value);
 
 QDF_STATUS wlan_hdd_get_snr(hdd_adapter_t *pAdapter, int8_t *snr);
 
+int hdd_get_ldpc(hdd_adapter_t *adapter, int *value);
+int hdd_set_ldpc(hdd_adapter_t *adapter, int value);
+int hdd_get_tx_stbc(hdd_adapter_t *adapter, int *value);
+int hdd_set_tx_stbc(hdd_adapter_t *adapter, int value);
+int hdd_get_rx_stbc(hdd_adapter_t *adapter, int *value);
+int hdd_set_rx_stbc(hdd_adapter_t *adapter, int value);
+
 #ifdef FEATURE_WLAN_TDLS
 QDF_STATUS iw_set_tdls_params(struct net_device *dev,
 			      struct iw_request_info *info,

Dosya farkı çok büyük olduğundan ihmal edildi
+ 684 - 82
core/hdd/src/wlan_hdd_assoc.c


Dosya farkı çok büyük olduğundan ihmal edildi
+ 696 - 719
core/hdd/src/wlan_hdd_cfg.c


Dosya farkı çok büyük olduğundan ihmal edildi
+ 651 - 471
core/hdd/src/wlan_hdd_cfg80211.c


+ 523 - 29
core/hdd/src/wlan_hdd_cfg80211.h

@@ -89,27 +89,6 @@
 #define QCOM_VENDOR_IE_AGE_TYPE  0x100
 #define QCOM_VENDOR_IE_AGE_LEN   (sizeof(qcom_ie_age) - 2)
 
-#ifdef FEATURE_WLAN_TDLS
-#define WLAN_IS_TDLS_SETUP_ACTION(action) \
-	((SIR_MAC_TDLS_SETUP_REQ <= action) && \
-	(SIR_MAC_TDLS_SETUP_CNF >= action))
-#if !defined (TDLS_MGMT_VERSION2)
-#define TDLS_MGMT_VERSION2 0
-#endif
-#endif
-
-#define MAX_CHANNEL (NUM_24GHZ_CHANNELS + NUM_5GHZ_CHANNELS)
-#define MAX_SCAN_SSID 10
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0)) \
-	|| defined(BACKPORTED_CHANNEL_SWITCH_PRESENT)
-#define CHANNEL_SWITCH_SUPPORTED
-#endif
-
-#if defined(CFG80211_DEL_STA_V2) || (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)) || defined(WITH_BACKPORTS)
-#define USE_CFG80211_DEL_STA_V2
-#endif
-
 /**
  * typedef struct qcom_ie_age - age ie
  *
@@ -122,6 +101,7 @@
  * @age: Age
  * @tsf_delta: tsf delta from FW
  * @beacon_tsf: original beacon TSF
+ * @seq_ctrl: sequence control field
  */
 typedef struct {
 	u8 element_id;
@@ -133,9 +113,31 @@ typedef struct {
 	u32 age;
 	u32 tsf_delta;
 	u64 beacon_tsf;
+	u16 seq_ctrl;
 } __attribute__ ((packed)) qcom_ie_age;
 #endif
 
+#ifdef FEATURE_WLAN_TDLS
+#define WLAN_IS_TDLS_SETUP_ACTION(action) \
+	((SIR_MAC_TDLS_SETUP_REQ <= action) && \
+	(SIR_MAC_TDLS_SETUP_CNF >= action))
+#if !defined (TDLS_MGMT_VERSION2)
+#define TDLS_MGMT_VERSION2 0
+#endif
+#endif
+
+#define MAX_CHANNEL (NUM_24GHZ_CHANNELS + NUM_5GHZ_CHANNELS)
+#define MAX_SCAN_SSID 10
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0)) \
+	|| defined(BACKPORTED_CHANNEL_SWITCH_PRESENT)
+#define CHANNEL_SWITCH_SUPPORTED
+#endif
+
+#if defined(CFG80211_DEL_STA_V2) || (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)) || defined(WITH_BACKPORTS)
+#define USE_CFG80211_DEL_STA_V2
+#endif
+
 /**
  * enum eDFS_CAC_STATUS: CAC status
  *
@@ -165,8 +167,9 @@ typedef enum {
  *
  * @QCA_NL80211_VENDOR_SUBCMD_UNSPEC: Unspecified
  * @QCA_NL80211_VENDOR_SUBCMD_TEST: Test
+ *	Sub commands 2 to 8 are not used
+ * @QCA_NL80211_VENDOR_SUBCMD_ROAMING: Roaming
  * @QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY: Avoid frequency.
- *	Sub commands 2 to 9 are not used
  * @QCA_NL80211_VENDOR_SUBCMD_DFS_CAPABILITY: DFS capability
  * @QCA_NL80211_VENDOR_SUBCMD_NAN: Nan
  * @QCA_NL80211_VENDOR_SUBCMD_STATS_EXT: Ext stats
@@ -252,10 +255,14 @@ typedef enum {
  * @QCA_NL80211_VENDOR_SUBCMD_GET_WIFI_CONFIGURATION: get wifi config
  * @QCA_NL80211_VENDOR_SUBCMD_GET_LOGGER_FEATURE_SET: get logging features
  * @QCA_NL80211_VENDOR_SUBCMD_LINK_PROPERTIES: get link properties
+ * @QCA_NL80211_VENDOR_SUBCMD_GW_PARAM_CONFIG: set gateway parameters
+ * @QCA_NL80211_VENDOR_SUBCMD_GET_PREFERRED_FREQ_LIST: get preferred channel
+	list
+ * @QCA_NL80211_VENDOR_SUBCMD_SET_PROBABLE_OPER_CHANNEL: channel hint
+ * @QCA_NL80211_VENDOR_SUBCMD_SETBAND: vendor setband command
  * @QCA_NL80211_VENDOR_SUBCMD_TRIGGER_SCAN: venodr scan command
  * @QCA_NL80211_VENDOR_SUBCMD_SCAN_DONE: vendor scan complete
  * @QCA_NL80211_VENDOR_SUBCMD_OTA_TEST: enable OTA test
- * @QCA_NL80211_VENDOR_SUBCMD_GW_PARAM_CONFIG: set gateway parameters
  * @QCA_NL80211_VENDOR_SUBCMD_SET_TXPOWER_SCALE: set tx power by percentage
  * @QCA_NL80211_VENDOR_SUBCMD_SET_TXPOWER_SCALE_DECR_DB: reduce tx power by DB
  * @QCA_NL80211_VENDOR_SUBCMD_SET_SAP_CONFIG: SAP configuration
@@ -269,11 +276,25 @@ typedef enum {
  *	indicate stop request/response of the P2P Listen Offload function in
  *	device. As an event, it indicates either the feature stopped after it
  *	was already running or feature has actually failed to start.
+ * @QCA_NL80211_VENDOR_SUBCMD_GET_STATION: send BSS Information
+ * @QCA_NL80211_VENDOR_SUBCMD_SAP_CONDITIONAL_CHAN_SWITCH: After SAP starts
+ *     beaconing, this sub command provides the driver, the frequencies on the
+ *     5 GHz to check for any radar activity. Driver selects one channel from
+ *     this priority list provided through
+ *     @QCA_WLAN_VENDOR_ATTR_SAP_CONDITIONAL_CHAN_SWITCH_FREQ_LIST and starts
+ *     to check for radar activity on it. If no radar activity is detected
+ *     during the channel availability check period, driver internally switches
+ *     to the selected frequency of operation. If the frequency is zero, driver
+ *     internally selects a channel. The status of this conditional switch is
+ *     indicated through an event using the same sub command through
+ *     @QCA_WLAN_VENDOR_ATTR_SAP_CONDITIONAL_CHAN_SWITCH_STATUS. Attributes are
+ *     listed in qca_wlan_vendor_attr_sap_conditional_chan_switch
  */
 
 enum qca_nl80211_vendor_subcmds {
 	QCA_NL80211_VENDOR_SUBCMD_UNSPEC = 0,
 	QCA_NL80211_VENDOR_SUBCMD_TEST = 1,
+	QCA_NL80211_VENDOR_SUBCMD_ROAMING = 9,
 	QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY = 10,
 	QCA_NL80211_VENDOR_SUBCMD_DFS_CAPABILITY = 11,
 	QCA_NL80211_VENDOR_SUBCMD_NAN = 12,
@@ -358,7 +379,14 @@ enum qca_nl80211_vendor_subcmds {
 	QCA_NL80211_VENDOR_SUBCMD_MONITOR_RSSI = 80,
 	QCA_NL80211_VENDOR_SUBCMD_NDP = 81,
 
+	/* NS Offload enable/disable cmd */
+	QCA_NL80211_VENDOR_SUBCMD_ND_OFFLOAD = 82,
+
 	QCA_NL80211_VENDOR_SUBCMD_PACKET_FILTER = 83,
+	QCA_NL80211_VENDOR_SUBCMD_GET_BUS_SIZE = 84,
+
+	QCA_NL80211_VENDOR_SUBCMD_GET_WAKE_REASON_STATS = 85,
+
 	/* OCB commands */
 	QCA_NL80211_VENDOR_SUBCMD_OCB_SET_CONFIG = 92,
 	QCA_NL80211_VENDOR_SUBCMD_OCB_SET_UTC_TIME = 93,
@@ -379,6 +407,9 @@ enum qca_nl80211_vendor_subcmds {
 	QCA_NL80211_VENDOR_SUBCMD_GET_PREFERRED_FREQ_LIST = 103,
 	QCA_NL80211_VENDOR_SUBCMD_SET_PROBABLE_OPER_CHANNEL = 104,
 
+	/* Vendor setband command */
+	QCA_NL80211_VENDOR_SUBCMD_SETBAND = 105,
+
 	/* Vendor scan commands */
 	QCA_NL80211_VENDOR_SUBCMD_TRIGGER_SCAN = 106,
 	QCA_NL80211_VENDOR_SUBCMD_SCAN_DONE = 107,
@@ -389,13 +420,167 @@ enum qca_nl80211_vendor_subcmds {
 	QCA_NL80211_VENDOR_SUBCMD_SET_TXPOWER_SCALE = 109,
 	/* Tx power scaling in db subcommands */
 	QCA_NL80211_VENDOR_SUBCMD_SET_TXPOWER_SCALE_DECR_DB = 115,
+	QCA_NL80211_VENDOR_SUBCMD_ACS_POLICY = 116,
+	QCA_NL80211_VENDOR_SUBCMD_STA_CONNECT_ROAM_POLICY = 117,
 	QCA_NL80211_VENDOR_SUBCMD_SET_SAP_CONFIG  = 118,
 	QCA_NL80211_VENDOR_SUBCMD_TSF = 119,
 	QCA_NL80211_VENDOR_SUBCMD_WISA = 120,
+	QCA_NL80211_VENDOR_SUBCMD_GET_STATION = 121,
 	QCA_NL80211_VENDOR_SUBCMD_P2P_LISTEN_OFFLOAD_START = 122,
 	QCA_NL80211_VENDOR_SUBCMD_P2P_LISTEN_OFFLOAD_STOP = 123,
+	QCA_NL80211_VENDOR_SUBCMD_SAP_CONDITIONAL_CHAN_SWITCH = 124,
+
+	/* Encrypt/Decrypt command */
+	QCA_NL80211_VENDOR_SUBCMD_ENCRYPTION_TEST = 137,
+};
+
+/**
+ * enum qca_wlan_vendor_attr_get_station - Sub commands used by
+ * QCA_NL80211_VENDOR_SUBCMD_GET_STATION to get the corresponding
+ * station information. The information obtained through these
+ * commands signify the current info in connected state and
+ * latest cached information during the connected state , if queried
+ * when in disconnected state.
+ *
+ * @QCA_WLAN_VENDOR_ATTR_GET_STATION_INVALID: Invalid attribute
+ * @QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO: bss info
+ * @QCA_WLAN_VENDOR_ATTR_GET_STATION_ASSOC_FAIL_REASON: assoc fail reason
+ * @QCA_WLAN_VENDOR_ATTR_GET_STATION_AFTER_LAST: After last
+ */
+enum qca_wlan_vendor_attr_get_station {
+	QCA_WLAN_VENDOR_ATTR_GET_STATION_INVALID = 0,
+	QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO,
+	QCA_WLAN_VENDOR_ATTR_GET_STATION_ASSOC_FAIL_REASON,
+
+	/* keep last */
+	QCA_WLAN_VENDOR_ATTR_GET_STATION_AFTER_LAST,
+	QCA_WLAN_VENDOR_ATTR_GET_STATION_MAX =
+		QCA_WLAN_VENDOR_ATTR_GET_STATION_AFTER_LAST - 1,
+};
+
+/**
+ * enum qca_wlan_802_11_mode - dot11 mode
+ * @QCA_WLAN_802_11_MODE_INVALID: Invalid dot11 mode
+ * @QCA_WLAN_802_11_MODE_11A: mode A
+ * @QCA_WLAN_802_11_MODE_11B: mode B
+ * @QCA_WLAN_802_11_MODE_11G: mode G
+ * @QCA_WLAN_802_11_MODE_11N: mode N
+ * @QCA_WLAN_802_11_MODE_11AC: mode AC
+ */
+enum qca_wlan_802_11_mode {
+	QCA_WLAN_802_11_MODE_INVALID,
+	QCA_WLAN_802_11_MODE_11A,
+	QCA_WLAN_802_11_MODE_11B,
+	QCA_WLAN_802_11_MODE_11G,
+	QCA_WLAN_802_11_MODE_11N,
+	QCA_WLAN_802_11_MODE_11AC,
+};
+
+/**
+ * enum qca_wlan_auth_type - Authentication key management type
+ * @QCA_WLAN_AUTH_TYPE_INVALID: Invalid key management type
+ * @QCA_WLAN_AUTH_TYPE_OPEN: Open key
+ * @QCA_WLAN_AUTH_TYPE_SHARED: shared key
+ * @QCA_WLAN_AUTH_TYPE_WPA: wpa key
+ * @QCA_WLAN_AUTH_TYPE_WPA_PSK: wpa psk key
+ * @QCA_WLAN_AUTH_TYPE_WPA_NONE: wpa none key
+ * @QCA_WLAN_AUTH_TYPE_RSN: rsn key
+ * @QCA_WLAN_AUTH_TYPE_RSN_PSK: rsn psk key
+ * @QCA_WLAN_AUTH_TYPE_FT: ft key
+ * @QCA_WLAN_AUTH_TYPE_FT_PSK: ft psk key
+ * @QCA_WLAN_AUTH_TYPE_SHA256: shared 256 key
+ * @QCA_WLAN_AUTH_TYPE_SHA256_PSK: shared 256 psk
+ * @QCA_WLAN_AUTH_TYPE_WAI: wai key
+ * @QCA_WLAN_AUTH_TYPE_WAI_PSK wai psk key
+ * @QCA_WLAN_AUTH_TYPE_CCKM_WPA: cckm wpa key
+ * @QCA_WLAN_AUTH_TYPE_CCKM_RSN: cckm rsn key
+ */
+enum qca_wlan_auth_type {
+	QCA_WLAN_AUTH_TYPE_INVALID,
+	QCA_WLAN_AUTH_TYPE_OPEN,
+	QCA_WLAN_AUTH_TYPE_SHARED,
+	QCA_WLAN_AUTH_TYPE_WPA,
+	QCA_WLAN_AUTH_TYPE_WPA_PSK,
+	QCA_WLAN_AUTH_TYPE_WPA_NONE,
+	QCA_WLAN_AUTH_TYPE_RSN,
+	QCA_WLAN_AUTH_TYPE_RSN_PSK,
+	QCA_WLAN_AUTH_TYPE_FT,
+	QCA_WLAN_AUTH_TYPE_FT_PSK,
+	QCA_WLAN_AUTH_TYPE_SHA256,
+	QCA_WLAN_AUTH_TYPE_SHA256_PSK,
+	QCA_WLAN_AUTH_TYPE_WAI,
+	QCA_WLAN_AUTH_TYPE_WAI_PSK,
+	QCA_WLAN_AUTH_TYPE_CCKM_WPA,
+	QCA_WLAN_AUTH_TYPE_CCKM_RSN,
+	QCA_WLAN_AUTH_TYPE_AUTOSWITCH,
+};
+
+/**
+ * enum qca_wlan_vendor_attr_get_station_info - Station Info queried
+ * through QCA_NL80211_VENDOR_SUBCMD_GET_STATION.
+ *
+ * @QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_INVALID: Invalid Attribute
+ * @QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_LINK_STANDARD_NL80211_ATTR:
+ *  Get the standard NL attributes Nested with this attribute.
+ *  Ex : Query BW , BITRATE32 , NSS , Signal , Noise of the Link -
+ *  NL80211_ATTR_SSID / NL80211_ATTR_SURVEY_INFO (Connected Channel) /
+ *  NL80211_ATTR_STA_INFO
+ * @QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_AP_STANDARD_NL80211_ATTR:
+ *  Get the standard NL attributes Nested with this attribute.
+ *  Ex : Query HT/VHT Capability advertized by the AP.
+ *  NL80211_ATTR_VHT_CAPABILITY / NL80211_ATTR_HT_CAPABILITY
+ * @QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_ROAM_COUNT:
+ *  Number of successful Roam attempts before a
+ *  disconnect, Unsigned 32 bit value
+ * @QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_AKM:
+ *  Authentication Key Management Type used for the connected session.
+ *  Signified by enum qca_wlan_auth_type
+ * @QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_802_11_MODE: 802.11 Mode of the
+ *  connected Session, signified by enum qca_wlan_802_11_mode
+ * @QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_AP_HS20_INDICATION:
+ *  HS20 Indication Element
+ * @QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_ASSOC_FAIL_REASON:
+ *  Status Code Corresponding to the Association Failure.
+ *  Unsigned 32 bit value.
+ * @QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_AFTER_LAST: After last
+ */
+enum qca_wlan_vendor_attr_get_station_info {
+	QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_INVALID = 0,
+	QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_LINK_STANDARD_NL80211_ATTR,
+	QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_AP_STANDARD_NL80211_ATTR,
+	QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_ROAM_COUNT,
+	QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_AKM,
+	QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_802_11_MODE,
+	QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_AP_HS20_INDICATION,
+	QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_HT_OPERATION,
+	QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_VHT_OPERATION,
+	QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_ASSOC_FAIL_REASON,
+	/* keep last */
+	QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_AFTER_LAST,
+	QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_MAX =
+		QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_AFTER_LAST - 1,
 };
 
+/* define short names for get station info attributes */
+#define LINK_INFO_STANDARD_NL80211_ATTR \
+	QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_LINK_STANDARD_NL80211_ATTR
+#define AP_INFO_STANDARD_NL80211_ATTR \
+	QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_AP_STANDARD_NL80211_ATTR
+#define INFO_ROAM_COUNT \
+	QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_ROAM_COUNT
+#define INFO_AKM \
+	QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_AKM
+#define WLAN802_11_MODE \
+	QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_802_11_MODE
+#define AP_INFO_HS20_INDICATION \
+	QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_AP_HS20_INDICATION
+#define HT_OPERATION \
+	QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_HT_OPERATION
+#define VHT_OPERATION \
+	QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_VHT_OPERATION
+#define INFO_ASSOC_FAIL_REASON \
+	QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_ASSOC_FAIL_REASON
+
 /**
  * enum qca_nl80211_vendor_subcmds_index - vendor sub commands index
  *
@@ -457,6 +642,8 @@ enum qca_nl80211_vendor_subcmds {
  * @QCA_NL80211_VENDOR_SUBCMD_TSF_INDEX: TSF response events index
  * @QCA_NL80211_VENDOR_SUBCMD_P2P_LO_EVENT_INDEX:
  *      P2P listen offload index
+ * @QCA_NL80211_VENDOR_SUBCMD_SAP_CONDITIONAL_CHAN_SWITCH_INDEX: SAP
+ *      conditional channel switch index
  */
 
 enum qca_nl80211_vendor_subcmds_index {
@@ -533,6 +720,7 @@ enum qca_nl80211_vendor_subcmds_index {
 	QCA_NL80211_VENDOR_SUBCMD_NDP_INDEX,
 #endif /* WLAN_FEATURE_NAN_DATAPATH */
 	QCA_NL80211_VENDOR_SUBCMD_P2P_LO_EVENT_INDEX,
+	QCA_NL80211_VENDOR_SUBCMD_SAP_CONDITIONAL_CHAN_SWITCH_INDEX,
 };
 
 /**
@@ -658,9 +846,13 @@ enum qca_wlan_vendor_attr_get_tdls_capabilities {
  * @QCA_WLAN_VENDOR_ATTR_STATS_EXT: Ext stats attribute which is used by
  *	QCA_NL80211_VENDOR_SUBCMD_STATS_EXT
  * @QCA_WLAN_VENDOR_ATTR_IFINDEX: After IFINDEX
+ * @QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY: Roaming policy which is used by
+ *	QCA_NL80211_VENDOR_SUBCMD_ROAMING
  * @QCA_WLAN_VENDOR_ATTR_MAC_ADDR: MAC Address attribute which is used by
  *	QCA_NL80211_VENDOR_SUBCMD_LINK_PROPERTIES
  * @QCA_WLAN_VENDOR_ATTR_FEATURE_FLAGS: Supported Features
+ *@QCA_WLAN_VENDOR_ATTR_SETBAND_VALUE: setband attribute which is used by
+ *	QCA_NL80211_VENDOR_SUBCMD_SETBAND
  * @QCA_WLAN_VENDOR_ATTR_AFTER_LAST: After last
  * @QCA_WLAN_VENDOR_ATTR_MAX: Max value
  */
@@ -670,11 +862,14 @@ enum qca_wlan_vendor_attr {
 	QCA_WLAN_VENDOR_ATTR_NAN = 2,
 	QCA_WLAN_VENDOR_ATTR_STATS_EXT = 3,
 	QCA_WLAN_VENDOR_ATTR_IFINDEX = 4,
+	QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY = 5,
 	QCA_WLAN_VENDOR_ATTR_MAC_ADDR = 6,
 	QCA_WLAN_VENDOR_ATTR_FEATURE_FLAGS = 7,
 	QCA_WLAN_VENDOR_ATTR_CONCURRENCY_CAPA = 9,
 	QCA_WLAN_VENDOR_ATTR_MAX_CONCURRENT_CHANNELS_2_4_BAND = 10,
 	QCA_WLAN_VENDOR_ATTR_MAX_CONCURRENT_CHANNELS_5_0_BAND = 11,
+	QCA_WLAN_VENDOR_ATTR_SETBAND_VALUE = 12,
+
 	/* keep last */
 	QCA_WLAN_VENDOR_ATTR_AFTER_LAST,
 		QCA_WLAN_VENDOR_ATTR_MAX = QCA_WLAN_VENDOR_ATTR_AFTER_LAST - 1
@@ -766,10 +961,9 @@ enum qca_wlan_vendor_attr {
  * @QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_MAX_PERIOD:
  *	Unsigned 32-bit value. If max_period is non zero or different than
  *	period, then this bucket is an exponential backoff bucket.
- * @QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_EXPONENT:
+ * @QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BASE:
  *	Unsigned 32-bit value. For exponential back off bucket,
- *	number of scans performed at a given period and until the
- *	exponent is applied.
+ *	number of scans to performed for a given period.
  * @QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_STEP_COUNT:
  *	Unsigned 8-bit value; in number of scans, wake up AP after these
  *	many scans.
@@ -845,7 +1039,7 @@ enum qca_wlan_vendor_attr_extscan_config_params {
 	QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_LOST_AP_SAMPLE_SIZE,
 
 	QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_MAX_PERIOD,
-	QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_EXPONENT,
+	QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BASE,
 	QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_STEP_COUNT,
 	QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD_NUM_SCANS,
 
@@ -965,6 +1159,10 @@ enum qca_wlan_vendor_attr_extscan_config_params {
  *	Unsigned 32bit value; Max number of epno networks by ssid
  * @QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_NUM_WHITELISTED_SSID:
  *	Unsigned 32bit value; Max number of whitelisted ssids
+ * @QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_BUCKETS_SCANNED:
+ *	Unsigned 32bit value, Bit mask of all buckets scanned in the
+ *	current EXTSCAN CYCLE. For e.g. If fw scan is going to scan
+ *	following buckets 0, 1, 2 in current cycle then it will be (0x111)
  * @QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_AFTER_LAST: After last
  * @QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_MAX: Max value
  */
@@ -1085,6 +1283,7 @@ enum qca_wlan_vendor_attr_extscan_results {
 	/* Use attr QCA_WLAN_VENDOR_ATTR_EXTSCAN_NUM_RESULTS_AVAILABLE
 	 * to indicate number of results.
 	 */
+	QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_BUCKETS_SCANNED,
 
 	/* keep last */
 	QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_AFTER_LAST,
@@ -1905,6 +2104,27 @@ enum qca_wlan_vendor_attr_link_properties {
 		QCA_WLAN_VENDOR_ATTR_LINK_PROPERTIES_AFTER_LAST - 1,
 };
 
+/**
+ * enum qca_wlan_vendor_attr_nd_offload - vendor NS offload support
+ *
+ * @QCA_WLAN_VENDOR_ATTR_ND_OFFLOAD_INVALID - Invalid
+ * @QCA_WLAN_VENDOR_ATTR_ND_OFFLOAD_FLAG - Flag to set NS offload
+ * @QCA_WLAN_VENDOR_ATTR_ND_OFFLOAD_AFTER_LAST - To keep track of the last enum
+ * @QCA_WLAN_VENDOR_ATTR_ND_OFFLOAD_MAX - max value possible for this type
+ *
+ * enum values are used for NL attributes for data used by
+ * QCA_NL80211_VENDOR_SUBCMD_ND_OFFLOAD sub command.
+ */
+enum qca_wlan_vendor_attr_nd_offload {
+	QCA_WLAN_VENDOR_ATTR_ND_OFFLOAD_INVALID = 0,
+	QCA_WLAN_VENDOR_ATTR_ND_OFFLOAD_FLAG,
+
+	/* Keep last */
+	QCA_WLAN_VENDOR_ATTR_ND_OFFLOAD_AFTER_LAST,
+	QCA_WLAN_VENDOR_ATTR_ND_OFFLOAD_MAX =
+		QCA_WLAN_VENDOR_ATTR_ND_OFFLOAD_AFTER_LAST - 1,
+};
+
 /**
  * enum qca_wlan_vendor_features - vendor device/driver features
  * @QCA_WLAN_VENDOR_FEATURE_KEY_MGMT_OFFLOAD: Device supports key
@@ -1930,6 +2150,29 @@ enum qca_wlan_vendor_features {
 	NUM_QCA_WLAN_VENDOR_FEATURES
 };
 
+/**
+ * enum qca_wlan_vendor_attr_sap_conditional_chan_switch - Parameters for SAP
+ *     conditional channel switch
+ * @QCA_WLAN_VENDOR_ATTR_SAP_CONDITIONAL_CHAN_SWITCH_INVALID: Invalid initial
+ *     value
+ * @QCA_WLAN_VENDOR_ATTR_SAP_CONDITIONAL_CHAN_SWITCH_FREQ_LIST: Priority based
+ * frequency list (an array of u32 values in host byte order)
+ * @QCA_WLAN_VENDOR_ATTR_SAP_CONDITIONAL_CHAN_SWITCH_STATUS: Status of the
+ *     conditional switch (u32)- 0: Success, Non-zero: Failure
+ * @QCA_WLAN_VENDOR_ATTR_SAP_CONDITIONAL_CHAN_SWITCH_AFTER_LAST: After last
+ * @QCA_WLAN_VENDOR_ATTR_SAP_CONDITIONAL_CHAN_SWITCH_MAX: Subcommand max
+ */
+enum qca_wlan_vendor_attr_sap_conditional_chan_switch {
+	QCA_WLAN_VENDOR_ATTR_SAP_CONDITIONAL_CHAN_SWITCH_INVALID = 0,
+	QCA_WLAN_VENDOR_ATTR_SAP_CONDITIONAL_CHAN_SWITCH_FREQ_LIST = 1,
+	QCA_WLAN_VENDOR_ATTR_SAP_CONDITIONAL_CHAN_SWITCH_STATUS = 2,
+
+	/* Keep Last */
+	QCA_WLAN_VENDOR_ATTR_SAP_CONDITIONAL_CHAN_SWITCH_AFTER_LAST,
+	QCA_WLAN_VENDOR_ATTR_SAP_CONDITIONAL_CHAN_SWITCH_MAX =
+	QCA_WLAN_VENDOR_ATTR_SAP_CONDITIONAL_CHAN_SWITCH_AFTER_LAST - 1,
+};
+
 /* Feature defines */
 #define WIFI_FEATURE_INFRA              0x0001  /* Basic infrastructure mode */
 #define WIFI_FEATURE_INFRA_5G           0x0002  /* Support for 5 GHz Band */
@@ -2049,6 +2292,25 @@ enum qca_wlan_vendor_acs_hw_mode {
 	QCA_ACS_MODE_IEEE80211ANY,
 };
 
+/**
+ * enum qca_access_policy - access control policy
+ *
+ * Access control policy is applied on the configured IE
+ * (QCA_WLAN_VENDOR_ATTR_CONFIG_ACCESS_POLICY_IE).
+ * To be set with QCA_WLAN_VENDOR_ATTR_CONFIG_ACCESS_POLICY.
+ *
+ * @QCA_ACCESS_POLICY_ACCEPT_UNLESS_LISTED: Deny Wi-Fi Connections which match
+ *»       with the specific configuration (IE) set, i.e. allow all the
+ *»       connections which do not match the configuration.
+ * @QCA_ACCESS_POLICY_DENY_UNLESS_LISTED: Accept Wi-Fi Connections which match
+ *»       with the specific configuration (IE) set, i.e. deny all the
+ *»       connections which do not match the configuration.
+ */
+enum qca_access_policy {
+	QCA_ACCESS_POLICY_ACCEPT_UNLESS_LISTED,
+	QCA_ACCESS_POLICY_DENY_UNLESS_LISTED,
+};
+
 /**
  * enum qca_wlan_vendor_config: wifi config attr
  *
@@ -2057,6 +2319,25 @@ enum qca_wlan_vendor_acs_hw_mode {
  * @QCA_WLAN_VENDOR_ATTR_CONFIG_STATS_AVG_FACTOR: stats avg. factor
  * @QCA_WLAN_VENDOR_ATTR_CONFIG_GUARD_TIME: guard time
  * @QCA_WLAN_VENDOR_ATTR_CONFIG_FINE_TIME_MEASUREMENT: fine time measurement
+ * @QCA_WLAN_VENDOR_ATTR_CONFIG_SCAN_DEFAULT_IES: Update the default scan IEs
+ * @QCA_WLAN_VENDOR_ATTR_CONFIG_GENERIC_COMMAND:
+ *                         Unsigned 32-bit value attribute for generic commands
+ * @QCA_WLAN_VENDOR_ATTR_CONFIG_GENERIC_VALUE:
+ *                  Unsigned 32-bit data attribute for generic command response
+ * @QCA_WLAN_VENDOR_ATTR_CONFIG_GENERIC_DATA:
+ *                  Unsigned 32-bit data attribute for generic command response
+ * @QCA_WLAN_VENDOR_ATTR_CONFIG_GENERIC_LENGTH:
+ *                                     Unsigned 32-bit length attribute for
+ *                                     QCA_WLAN_VENDOR_ATTR_CONFIG_GENERIC_DATA
+ * @QCA_WLAN_VENDOR_ATTR_CONFIG_GENERIC_FLAGS:
+ * Unsigned 32-bit flags attribute for QCA_WLAN_VENDOR_ATTR_CONFIG_GENERIC_DATA
+ * @QCA_WLAN_VENDOR_ATTR_CONFIG_ACCESS_POLICY: Vendor IE access policy
+ * @QCA_WLAN_VENDOR_ATTR_CONFIG_ACCESS_POLICY_IE_LIST: Vendor IE to be used
+ *                                                     with access policy
+ * @QCA_WLAN_VENDOR_ATTR_CONFIG_IFINDEX: interface index for vdev specific
+ *                                       parameters
+ * @QCA_WLAN_VENDOR_ATTR_CONFIG_QPOWER: Unsigned 8bit length attribute to update
+ *                                      power save config to turn off/on qpower
  * @QCA_WLAN_VENDOR_ATTR_CONFIG_LAST: last config
  * @QCA_WLAN_VENDOR_ATTR_CONFIG_MAX: max config
  */
@@ -2066,6 +2347,47 @@ enum qca_wlan_vendor_config {
 	QCA_WLAN_VENDOR_ATTR_CONFIG_STATS_AVG_FACTOR,
 	QCA_WLAN_VENDOR_ATTR_CONFIG_GUARD_TIME,
 	QCA_WLAN_VENDOR_ATTR_CONFIG_FINE_TIME_MEASUREMENT,
+	QCA_WLAN_VENDOR_ATTR_CONFIG_PENALIZE_AFTER_NCONS_BEACON_MISS,
+	QCA_WLAN_VENDOR_ATTR_CONFIG_CHANNEL_AVOIDANCE_IND,
+	/* Attribute used to set scan default IEs to the driver.
+	*
+	* These IEs can be used by scan operations that will be initiated by
+	* the driver/firmware.
+	*
+	* For further scan requests coming to the driver, these IEs should be
+	* merged with the IEs received along with scan request coming to the
+	* driver. If a particular IE is present in the scan default IEs but not
+	* present in the scan request, then that IE should be added to the IEs
+	* sent in the Probe Request frames for that scan request. */
+	QCA_WLAN_VENDOR_ATTR_CONFIG_SCAN_DEFAULT_IES,
+	/* Unsigned 32-bit attribute for generic commands */
+	QCA_WLAN_VENDOR_ATTR_CONFIG_GENERIC_COMMAND,
+	/* Unsigned 32-bit value attribute for generic commands */
+	QCA_WLAN_VENDOR_ATTR_CONFIG_GENERIC_VALUE,
+	/* Unsigned 32-bit data attribute for generic command response */
+	QCA_WLAN_VENDOR_ATTR_CONFIG_GENERIC_DATA,
+	/* Unsigned 32-bit length attribute for
+	* QCA_WLAN_VENDOR_ATTR_CONFIG_GENERIC_DATA */
+	QCA_WLAN_VENDOR_ATTR_CONFIG_GENERIC_LENGTH,
+	/* Unsigned 32-bit flags attribute for
+	* QCA_WLAN_VENDOR_ATTR_CONFIG_GENERIC_DATA */
+	QCA_WLAN_VENDOR_ATTR_CONFIG_GENERIC_FLAGS,
+	/* Unsigned 32-bit, defining the access policy.
+	* See enum qca_access_policy. Used with
+	* QCA_WLAN_VENDOR_ATTR_CONFIG_ACCESS_POLICY_IE_LIST. */
+	QCA_WLAN_VENDOR_ATTR_CONFIG_ACCESS_POLICY,
+	/* Sets the list of full set of IEs for which a specific access policy
+	* has to be applied. Used along with
+	* QCA_WLAN_VENDOR_ATTR_CONFIG_ACCESS_POLICY to control the access.
+	* Zero length payload can be used to clear this access constraint. */
+	QCA_WLAN_VENDOR_ATTR_CONFIG_ACCESS_POLICY_IE_LIST,
+	/* Unsigned 32-bit, specifies the interface index (netdev) for which the
+	* corresponding configurations are applied. If the interface index is
+	* not specified, the configurations are attributed to the respective
+	* wiphy. */
+	QCA_WLAN_VENDOR_ATTR_CONFIG_IFINDEX,
+	/* Unsigned 8-bit, for setting qpower dynamically */
+	QCA_WLAN_VENDOR_ATTR_CONFIG_QPOWER = 25,
 	/* keep last */
 	QCA_WLAN_VENDOR_ATTR_CONFIG_LAST,
 	QCA_WLAN_VENDOR_ATTR_CONFIG_MAX =
@@ -2226,6 +2548,66 @@ enum qca_wlan_vendor_attr_packet_filter {
 	QCA_WLAN_VENDOR_ATTR_PACKET_FILTER_AFTER_LAST - 1,
 };
 
+/**
+ * enum qca_wlan_vendor_attr_wake_stats - wake lock stats
+ * @QCA_WLAN_VENDOR_ATTR_GET_WAKE_STATS_INVALID: invalid
+ * @QCA_WLAN_VENDOR_ATTR_TOTAL_CMD_EVENT_WAKE:
+ * @QCA_WLAN_VENDOR_ATTR_CMD_EVENT_WAKE_CNT_PTR:
+ * @QCA_WLAN_VENDOR_ATTR_CMD_EVENT_WAKE_CNT_SZ:
+ * @QCA_WLAN_VENDOR_ATTR_TOTAL_DRIVER_FW_LOCAL_WAKE:
+ * @QCA_WLAN_VENDOR_ATTR_DRIVER_FW_LOCAL_WAKE_CNT_PTR:
+ * @QCA_WLAN_VENDOR_ATTR_DRIVER_FW_LOCAL_WAKE_CNT_SZ:
+ * @QCA_WLAN_VENDOR_ATTR_TOTAL_RX_DATA_WAKE:
+ * total rx wakeup count
+ * @QCA_WLAN_VENDOR_ATTR_RX_UNICAST_CNT:
+ * Total rx unicast packet which woke up host
+ * @QCA_WLAN_VENDOR_ATTR_RX_MULTICAST_CNT:
+ * Total rx multicast packet which woke up host
+ * @QCA_WLAN_VENDOR_ATTR_RX_BROADCAST_CNT:
+ * Total rx broadcast packet which woke up host
+ * @QCA_WLAN_VENDOR_ATTR_ICMP_PKT:
+ * wake icmp packet count
+ * @QCA_WLAN_VENDOR_ATTR_ICMP6_PKT:
+ * wake icmp6 packet count
+ * @QCA_WLAN_VENDOR_ATTR_ICMP6_RA:
+ * wake icmp6 RA packet count
+ * @QCA_WLAN_VENDOR_ATTR_ICMP6_NA:
+ * wake icmp6 NA packet count
+ * @QCA_WLAN_VENDOR_ATTR_ICMP6_NS:
+ * wake icmp6 NS packet count
+ * @QCA_WLAN_VENDOR_ATTR_ICMP4_RX_MULTICAST_CNT:
+ * Rx wake packet count due to ipv4 multicast
+ * @QCA_WLAN_VENDOR_ATTR_ICMP6_RX_MULTICAST_CNT:
+ * Rx wake packet count due to ipv6 multicast
+ * @QCA_WLAN_VENDOR_ATTR_OTHER_RX_MULTICAST_CNT:
+ * Rx wake packet count due to non-ipv4 and non-ipv6 packets
+ */
+enum qca_wlan_vendor_attr_wake_stats {
+	QCA_WLAN_VENDOR_ATTR_GET_WAKE_STATS_INVALID = 0,
+	QCA_WLAN_VENDOR_ATTR_TOTAL_CMD_EVENT_WAKE,
+	QCA_WLAN_VENDOR_ATTR_CMD_EVENT_WAKE_CNT_PTR,
+	QCA_WLAN_VENDOR_ATTR_CMD_EVENT_WAKE_CNT_SZ,
+	QCA_WLAN_VENDOR_ATTR_TOTAL_DRIVER_FW_LOCAL_WAKE,
+	QCA_WLAN_VENDOR_ATTR_DRIVER_FW_LOCAL_WAKE_CNT_PTR,
+	QCA_WLAN_VENDOR_ATTR_DRIVER_FW_LOCAL_WAKE_CNT_SZ,
+	QCA_WLAN_VENDOR_ATTR_TOTAL_RX_DATA_WAKE,
+	QCA_WLAN_VENDOR_ATTR_RX_UNICAST_CNT,
+	QCA_WLAN_VENDOR_ATTR_RX_MULTICAST_CNT,
+	QCA_WLAN_VENDOR_ATTR_RX_BROADCAST_CNT,
+	QCA_WLAN_VENDOR_ATTR_ICMP_PKT,
+	QCA_WLAN_VENDOR_ATTR_ICMP6_PKT,
+	QCA_WLAN_VENDOR_ATTR_ICMP6_RA,
+	QCA_WLAN_VENDOR_ATTR_ICMP6_NA,
+	QCA_WLAN_VENDOR_ATTR_ICMP6_NS,
+	QCA_WLAN_VENDOR_ATTR_ICMP4_RX_MULTICAST_CNT,
+	QCA_WLAN_VENDOR_ATTR_ICMP6_RX_MULTICAST_CNT,
+	QCA_WLAN_VENDOR_ATTR_OTHER_RX_MULTICAST_CNT,
+	/* keep last */
+	QCA_WLAN_VENDOR_GET_WAKE_STATS_AFTER_LAST,
+	QCA_WLAN_VENDOR_GET_WAKE_STATS_MAX =
+		QCA_WLAN_VENDOR_GET_WAKE_STATS_AFTER_LAST - 1,
+};
+
 /**
  * enum qca_vendor_attr_get_tsf: Vendor attributes for TSF capture
  * @QCA_WLAN_VENDOR_ATTR_TSF_INVALID: Invalid attribute value
@@ -2384,6 +2766,60 @@ enum qca_vendor_attr_txpower_scale_decr_db {
 		QCA_WLAN_VENDOR_ATTR_TXPOWER_SCALE_DECR_DB_AFTER_LAST - 1
 };
 
+/**
+ * enum dfs_mode - state of DFS mode
+ * @DFS_MODE_NONE: DFS mode attribute is none
+ * @DFS_MODE_ENABLE:  DFS mode is enabled
+ * @DFS_MODE_DISABLE: DFS mode is disabled
+ * @DFS_MODE_DEPRIORITIZE: Deprioritize DFS channels in scanning
+ */
+enum dfs_mode {
+	DFS_MODE_NONE,
+	DFS_MODE_ENABLE,
+	DFS_MODE_DISABLE,
+	DFS_MODE_DEPRIORITIZE
+};
+
+/**
+ * enum qca_wlan_vendor_attr_acs_config - Config params for ACS
+ * @QCA_WLAN_VENDOR_ATTR_ACS_MODE_INVALID: Invalid
+ * @QCA_WLAN_VENDOR_ATTR_ACS_DFS_MODE: Dfs mode for ACS
+ * QCA_WLAN_VENDOR_ATTR_ACS_CHANNEL_HINT: channel_hint for ACS
+ * QCA_WLAN_VENDOR_ATTR_ACS_DFS_AFTER_LAST: after_last
+ * QCA_WLAN_VENDOR_ATTR_ACS_DFS_MAX: max attribute
+ */
+enum qca_wlan_vendor_attr_acs_config {
+	QCA_WLAN_VENDOR_ATTR_ACS_MODE_INVALID = 0,
+	QCA_WLAN_VENDOR_ATTR_ACS_DFS_MODE,
+	QCA_WLAN_VENDOR_ATTR_ACS_CHANNEL_HINT,
+
+	QCA_WLAN_VENDOR_ATTR_ACS_DFS_AFTER_LAST,
+	QCA_WLAN_VENDOR_ATTR_ACS_DFS_MAX =
+		QCA_WLAN_VENDOR_ATTR_ACS_DFS_AFTER_LAST - 1,
+
+};
+
+/**
+ * enum qca_wlan_vendor_attr_sta_connect_roam_policy_config -
+ *                        config params for sta roam policy
+ * @QCA_WLAN_VENDOR_ATTR_STA_CONNECT_ROAM_POLICY_INVALID: Invalid
+ * @QCA_WLAN_VENDOR_ATTR_STA_DFS_MODE: If sta should skip Dfs channels
+ * @QCA_WLAN_VENDOR_ATTR_STA_SKIP_UNSAFE_CHANNEL:
+ * If sta should skip unsafe channels or not in scanning
+ * @QCA_WLAN_VENDOR_ATTR_STA_CONNECT_ROAM_POLICY_LAST:
+ * @QCA_WLAN_VENDOR_ATTR_STA_CONNECT_ROAM_POLICY_MAX: max attribute
+ */
+enum qca_wlan_vendor_attr_sta_connect_roam_policy_config {
+	QCA_WLAN_VENDOR_ATTR_STA_CONNECT_ROAM_POLICY_INVALID = 0,
+	QCA_WLAN_VENDOR_ATTR_STA_DFS_MODE,
+	QCA_WLAN_VENDOR_ATTR_STA_SKIP_UNSAFE_CHANNEL,
+
+	QCA_WLAN_VENDOR_ATTR_STA_CONNECT_ROAM_POLICY_AFTER_LAST,
+	QCA_WLAN_VENDOR_ATTR_STA_CONNECT_ROAM_POLICY_MAX =
+	QCA_WLAN_VENDOR_ATTR_STA_CONNECT_ROAM_POLICY_AFTER_LAST - 1,
+};
+
+
 /**
  * enum qca_wlan_vendor_attr_sap_config - config params for sap configuration
  * @QCA_WLAN_VENDOR_ATTR_SAP_CONFIG_INVALID: invalid
@@ -2447,6 +2883,60 @@ enum qca_wlan_vendor_attr_p2p_listen_offload {
 	QCA_WLAN_VENDOR_ATTR_P2P_LISTEN_OFFLOAD_AFTER_LAST - 1
 };
 
+/**
+ * enum qca_wlan_vendor_drv_info - WLAN driver info
+ * @QCA_WLAN_VENDOR_ATTR_DRV_INFO_INVALID: Invalid
+ * @QCA_WLAN_VENDOR_ATTR_DRV_INFO_BUS_SIZE: Maximum Message size info
+ * between Firmware & Host.
+ */
+enum qca_wlan_vendor_drv_info {
+	QCA_WLAN_VENDOR_ATTR_DRV_INFO_INVALID = 0,
+	QCA_WLAN_VENDOR_ATTR_DRV_INFO_BUS_SIZE,
+
+	/* keep last */
+	QCA_WLAN_VENDOR_ATTR_DRV_INFO_AFTER_LAST,
+	QCA_WLAN_VENDOR_ATTR_DRV_INFO_MAX =
+		QCA_WLAN_VENDOR_ATTR_DRV_INFO_AFTER_LAST - 1,
+};
+
+/**
+ * enum qca_wlan_vendor_attr_encryption_test - Attributes to
+ * validate encryption engine
+ *
+ * @QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_NEEDS_DECRYPTION: Flag attribute.
+ *    This will be included if the request is for decryption; if not included,
+ *    the request is treated as a request for encryption by default.
+ * @QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_CIPHER: Unsigned 32-bit value
+ *    indicating the key cipher suite. Takes same values as
+ *    NL80211_ATTR_KEY_CIPHER.
+ * @QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_KEYID: Unsigned 8-bit value
+ *    Key Id to be used for encryption
+ * @QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_TK: Array of 8-bit values.
+ *    Key (TK) to be used for encryption/decryption
+ * @QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_PN: Array of 8-bit values.
+ *    Packet number to be specified for encryption/decryption
+ *    6 bytes for TKIP/CCMP/GCMP.
+ * @QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_DATA: Array of 8-bit values
+ *    representing the 802.11 packet (header + payload + FCS) that
+ *    needs to be encrypted/decrypted.
+ *    Encrypted/decrypted response from the driver will also be sent
+ *    to userspace with the same attribute.
+ */
+enum qca_wlan_vendor_attr_encryption_test {
+	QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_INVALID = 0,
+	QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_NEEDS_DECRYPTION,
+	QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_CIPHER,
+	QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_KEYID,
+	QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_TK,
+	QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_PN,
+	QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_DATA,
+
+	/* keep last */
+	QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_AFTER_LAST,
+	QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_MAX =
+		QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_AFTER_LAST - 1
+};
+
 struct cfg80211_bss *wlan_hdd_cfg80211_update_bss_db(hdd_adapter_t *pAdapter,
 						tCsrRoamInfo *pRoamInfo);
 
@@ -2508,7 +2998,8 @@ extern void wlan_hdd_cfg80211_update_replay_counter_callback(void
 							     pGtkOffloadGetInfoRsp);
 #endif
 void *wlan_hdd_change_country_code_cb(void *pAdapter);
-void hdd_select_cbmode(hdd_adapter_t *pAdapter, uint8_t operationChannel);
+void hdd_select_cbmode(hdd_adapter_t *pAdapter, uint8_t operationChannel,
+		       struct ch_params_s *ch_params);
 
 uint8_t *wlan_hdd_cfg80211_get_ie_ptr(const uint8_t *ies_ptr, int length,
 				      uint8_t eid);
@@ -2550,7 +3041,7 @@ void hdd_rssi_threshold_breached(void *hddctx,
 				 struct rssi_breach_event *data);
 
 struct cfg80211_bss *wlan_hdd_cfg80211_update_bss_list(hdd_adapter_t *pAdapter,
-						       tCsrRoamInfo *pRoamInfo);
+						tSirMacAddr bssid);
 
 int wlan_hdd_cfg80211_update_bss(struct wiphy *wiphy,
 						hdd_adapter_t *pAdapter,
@@ -2609,6 +3100,7 @@ nla_fail:
 }
 #define cfg80211_vendor_event_alloc backported_cfg80211_vendor_event_alloc
 #endif
+int wlan_hdd_request_pre_cac(uint8_t channel);
 int wlan_hdd_sap_cfg_dfs_override(hdd_adapter_t *adapter);
 
 enum cds_con_mode wlan_hdd_convert_nl_iftype_to_hdd_type(
@@ -2642,4 +3134,6 @@ static inline void wlan_hdd_cfg80211_indicate_disconnect(struct net_device *dev,
 				GFP_KERNEL);
 }
 #endif
+struct cfg80211_bss *wlan_hdd_cfg80211_inform_bss_frame(hdd_adapter_t *pAdapter,
+						tSirBssDescription *bss_desc);
 #endif

+ 6 - 6
core/hdd/src/wlan_hdd_conc_ut.c

@@ -189,7 +189,7 @@ void fill_report(hdd_context_t *hdd_ctx, char *title,
 		title, pcl_type_to_string(pcl_type));
 	if (chnl_1st_conn == 0)
 		snprintf(report[report_idx].first_persona,
-			MAX_ALLOWED_CHAR_IN_REPORT,
+			MAX_ALLOWED_CHAR_IN_REPORT, "%s",
 			device_mode_to_string(first_persona));
 	else
 		snprintf(report[report_idx].first_persona,
@@ -198,7 +198,7 @@ void fill_report(hdd_context_t *hdd_ctx, char *title,
 			device_mode_to_string(first_persona), chnl_1st_conn);
 	if (chnl_2nd_conn == 0)
 		snprintf(report[report_idx].second_persona,
-			MAX_ALLOWED_CHAR_IN_REPORT,
+			MAX_ALLOWED_CHAR_IN_REPORT, "%s",
 			device_mode_to_string(second_persona));
 	else
 		snprintf(report[report_idx].second_persona,
@@ -207,7 +207,7 @@ void fill_report(hdd_context_t *hdd_ctx, char *title,
 			device_mode_to_string(second_persona), chnl_2nd_conn);
 	if (chnl_3rd_conn == 0)
 		snprintf(report[report_idx].third_persona,
-			MAX_ALLOWED_CHAR_IN_REPORT,
+			MAX_ALLOWED_CHAR_IN_REPORT, "%s",
 			device_mode_to_string(third_persona));
 	else
 		snprintf(report[report_idx].third_persona,
@@ -217,13 +217,13 @@ void fill_report(hdd_context_t *hdd_ctx, char *title,
 
 	report[report_idx].status = status;
 	snprintf(report[report_idx].dbs_value,
-		MAX_ALLOWED_CHAR_IN_REPORT,
+		MAX_ALLOWED_CHAR_IN_REPORT, "%s",
 		wma_is_hw_dbs_capable() ? "enable" : "disable");
 	snprintf(report[report_idx].system_conf,
-		MAX_ALLOWED_CHAR_IN_REPORT,
+		MAX_ALLOWED_CHAR_IN_REPORT, "%s",
 		system_config_to_string(hdd_ctx->config->conc_system_pref));
 	snprintf(report[report_idx].result_code,
-		MAX_ALLOWED_CHAR_IN_REPORT,
+		MAX_ALLOWED_CHAR_IN_REPORT, "%s",
 		status ? "PASS" : "FAIL");
 	snprintf(report[report_idx].reason,
 		MAX_ALLOWED_CHAR_IN_REPORT,

+ 28 - 54
core/hdd/src/wlan_hdd_debugfs.c

@@ -35,6 +35,9 @@
  */
 
 #ifdef WLAN_OPEN_SOURCE
+/* denote that this file does not allow legacy hddLog */
+#define HDD_DISALLOW_LEGACY_HDDLOG 1
+
 #include <wlan_hdd_includes.h>
 #include <wlan_hdd_wowl.h>
 #include <cds_sched.h>
@@ -69,9 +72,7 @@ static ssize_t __wcnss_wowenable_write(struct file *file,
 
 	pAdapter = (hdd_adapter_t *)file->private_data;
 	if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) {
-		QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_FATAL,
-			  "%s: Invalid adapter or adapter has invalid magic.",
-			  __func__);
+		hdd_alert("Invalid adapter or adapter has invalid magic.");
 
 		return -EINVAL;
 	}
@@ -83,17 +84,14 @@ static ssize_t __wcnss_wowenable_write(struct file *file,
 
 
 	if (!sme_is_feature_supported_by_fw(WOW)) {
-		QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
-			  "%s: Wake-on-Wireless feature is not supported in firmware!",
-			  __func__);
+		hdd_err("Wake-on-Wireless feature is not supported in firmware!");
 
 		return -EINVAL;
 	}
 
 	if (count > MAX_USER_COMMAND_SIZE_WOWL_ENABLE) {
-		QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
-			  "%s: Command length is larger than %d bytes.",
-			  __func__, MAX_USER_COMMAND_SIZE_WOWL_ENABLE);
+		hdd_err("Command length is larger than %d bytes.",
+			MAX_USER_COMMAND_SIZE_WOWL_ENABLE);
 
 		return -EINVAL;
 	}
@@ -114,8 +112,7 @@ static ssize_t __wcnss_wowenable_write(struct file *file,
 	/* Disable wow */
 	if (!wow_enable) {
 		if (!hdd_exit_wowl(pAdapter)) {
-			QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
-				  "%s: hdd_exit_wowl failed!", __func__);
+			hdd_err("hdd_exit_wowl failed!");
 
 			return -EFAULT;
 		}
@@ -142,8 +139,7 @@ static ssize_t __wcnss_wowenable_write(struct file *file,
 		wow_pbm = 1;
 
 	if (!hdd_enter_wowl(pAdapter, wow_mp, wow_pbm)) {
-		QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
-			  "%s: hdd_enter_wowl failed!", __func__);
+		hdd_err("hdd_enter_wowl failed!");
 
 		return -EFAULT;
 	}
@@ -199,9 +195,7 @@ static ssize_t __wcnss_wowpattern_write(struct file *file,
 	ENTER();
 
 	if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) {
-		QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_FATAL,
-			  "%s: Invalid adapter or adapter has invalid magic.",
-			  __func__);
+		hdd_alert("Invalid adapter or adapter has invalid magic.");
 
 		return -EINVAL;
 	}
@@ -212,17 +206,14 @@ static ssize_t __wcnss_wowpattern_write(struct file *file,
 		return ret;
 
 	if (!sme_is_feature_supported_by_fw(WOW)) {
-		QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
-			  "%s: Wake-on-Wireless feature is not supported in firmware!",
-			  __func__);
+		hdd_err("Wake-on-Wireless feature is not supported in firmware!");
 
 		return -EINVAL;
 	}
 
 	if (count > MAX_USER_COMMAND_SIZE_WOWL_PATTERN) {
-		QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
-			  "%s: Command length is larger than %d bytes.",
-			  __func__, MAX_USER_COMMAND_SIZE_WOWL_PATTERN);
+		hdd_err("Command length is larger than %d bytes.",
+			MAX_USER_COMMAND_SIZE_WOWL_PATTERN);
 
 		return -EINVAL;
 	}
@@ -328,9 +319,7 @@ static ssize_t __wcnss_patterngen_write(struct file *file,
 
 	pAdapter = (hdd_adapter_t *)file->private_data;
 	if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) {
-		QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_FATAL,
-			  "%s: Invalid adapter or adapter has invalid magic.",
-			  __func__);
+		hdd_alert("Invalid adapter or adapter has invalid magic.");
 
 		return -EINVAL;
 	}
@@ -341,9 +330,7 @@ static ssize_t __wcnss_patterngen_write(struct file *file,
 		return ret;
 
 	if (!sme_is_feature_supported_by_fw(WLAN_PERIODIC_TX_PTRN)) {
-		QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
-			  "%s: Periodic Tx Pattern Offload feature is not supported in firmware!",
-			  __func__);
+		hdd_err("Periodic Tx Pattern Offload feature is not supported in firmware!");
 		return -EINVAL;
 	}
 
@@ -351,16 +338,14 @@ static ssize_t __wcnss_patterngen_write(struct file *file,
 	if (count <= MAX_USER_COMMAND_SIZE_FRAME)
 		cmd = qdf_mem_malloc(count + 1);
 	else {
-		QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
-			  "%s: Command length is larger than %d bytes.",
-			  __func__, MAX_USER_COMMAND_SIZE_FRAME);
+		hdd_err("Command length is larger than %d bytes.",
+			MAX_USER_COMMAND_SIZE_FRAME);
 
 		return -EINVAL;
 	}
 
 	if (!cmd) {
-		QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
-			  FL("Memory allocation for cmd failed!"));
+		hdd_err("Memory allocation for cmd failed!");
 		return -ENOMEM;
 	}
 
@@ -379,9 +364,8 @@ static ssize_t __wcnss_patterngen_write(struct file *file,
 		goto failure;
 
 	if (pattern_idx > (MAXNUM_PERIODIC_TX_PTRNS - 1)) {
-		QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
-			  "%s: Pattern index %d is not in the range (0 ~ %d).",
-			  __func__, pattern_idx, MAXNUM_PERIODIC_TX_PTRNS - 1);
+		hdd_err("Pattern index %d is not in the range (0 ~ %d).",
+			pattern_idx, MAXNUM_PERIODIC_TX_PTRNS - 1);
 
 		goto failure;
 	}
@@ -398,8 +382,7 @@ static ssize_t __wcnss_patterngen_write(struct file *file,
 		delPeriodicTxPtrnParams =
 			qdf_mem_malloc(sizeof(tSirDelPeriodicTxPtrn));
 		if (!delPeriodicTxPtrnParams) {
-			QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
-				  FL("Memory allocation failed!"));
+			hdd_err("Memory allocation failed!");
 			qdf_mem_free(cmd);
 			return -ENOMEM;
 		}
@@ -412,9 +395,7 @@ static ssize_t __wcnss_patterngen_write(struct file *file,
 		status = sme_del_periodic_tx_ptrn(pHddCtx->hHal,
 						  delPeriodicTxPtrnParams);
 		if (QDF_STATUS_SUCCESS != status) {
-			QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
-				  "%s: sme_del_periodic_tx_ptrn() failed!",
-				  __func__);
+			hdd_err("sme_del_periodic_tx_ptrn() failed!");
 
 			qdf_mem_free(delPeriodicTxPtrnParams);
 			goto failure;
@@ -432,8 +413,7 @@ static ssize_t __wcnss_patterngen_write(struct file *file,
 	hdd_info("device mode %d", pAdapter->device_mode);
 	if ((QDF_STA_MODE == pAdapter->device_mode) &&
 	    (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter)))) {
-			QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
-				"%s: Not in Connected state!", __func__);
+			hdd_err("Not in Connected state!");
 			goto failure;
 	}
 
@@ -448,24 +428,21 @@ static ssize_t __wcnss_patterngen_write(struct file *file,
 
 	/* Since the pattern is a hex string, 2 characters represent 1 byte. */
 	if (pattern_len % 2) {
-		QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
-			  "%s: Malformed pattern!", __func__);
+		hdd_err("Malformed pattern!");
 
 		goto failure;
 	} else
 		pattern_len >>= 1;
 
 	if (pattern_len < 14 || pattern_len > PERIODIC_TX_PTRN_MAX_SIZE) {
-		QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
-			  "%s: Not an 802.3 frame!", __func__);
+		hdd_err("Not an 802.3 frame!");
 
 		goto failure;
 	}
 
 	addPeriodicTxPtrnParams = qdf_mem_malloc(sizeof(tSirAddPeriodicTxPtrn));
 	if (!addPeriodicTxPtrnParams) {
-		QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
-			  FL("Memory allocation failed!"));
+		hdd_err("Memory allocation failed!");
 		qdf_mem_free(cmd);
 		return -ENOMEM;
 	}
@@ -490,8 +467,7 @@ static ssize_t __wcnss_patterngen_write(struct file *file,
 	status = sme_add_periodic_tx_ptrn(pHddCtx->hHal,
 					  addPeriodicTxPtrnParams);
 	if (QDF_STATUS_SUCCESS != status) {
-		QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
-			  "%s: sme_add_periodic_tx_ptrn() failed!", __func__);
+		hdd_err("sme_add_periodic_tx_ptrn() failed!");
 
 		qdf_mem_free(addPeriodicTxPtrnParams);
 		goto failure;
@@ -549,9 +525,7 @@ static int __wcnss_debugfs_open(struct inode *inode, struct file *file)
 
 	adapter = (hdd_adapter_t *)file->private_data;
 	if ((NULL == adapter) || (WLAN_HDD_ADAPTER_MAGIC != adapter->magic)) {
-		QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_FATAL,
-			  "%s: Invalid adapter or adapter has invalid magic.",
-			  __func__);
+		hdd_alert("Invalid adapter or adapter has invalid magic.");
 		return -EINVAL;
 	}
 

+ 496 - 0
core/hdd/src/wlan_hdd_disa.c

@@ -0,0 +1,496 @@
+/*
+ * Copyright (c) 2016 The Linux Foundation. All rights reserved.
+ *
+ * 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.
+ */
+
+/**
+ * DOC : wlan_hdd_disa.c
+ *
+ * WLAN Host Device Driver file for DISA certification
+ *
+ */
+
+#include "wlan_hdd_disa.h"
+#include "sme_api.h"
+
+#define ENCRYPT_DECRYPT_CONTEXT_MAGIC 0x4475354
+#define WLAN_WAIT_TIME_ENCRYPT_DECRYPT 1000
+
+
+/**
+ * hdd_encrypt_decrypt_msg_context - hdd encrypt/decrypt message context
+ *
+ * @magic: magic number
+ * @completion: Completion variable for encrypt/decrypt message
+ * @response_event: encrypt/decrypt message request wait event
+ */
+struct hdd_encrypt_decrypt_msg_context {
+	unsigned int magic;
+	struct completion completion;
+	struct sir_encrypt_decrypt_rsp_params response;
+};
+static struct hdd_encrypt_decrypt_msg_context encrypt_decrypt_msg_context;
+
+/**
+ * hdd_encrypt_decrypt_msg_cb () - sends encrypt/decrypt data to user space
+ * @encrypt_decrypt_rsp_params: encrypt/decrypt response parameters
+ *
+ * Return: none
+ */
+static void hdd_encrypt_decrypt_msg_cb(void *hdd_context,
+	struct sir_encrypt_decrypt_rsp_params *encrypt_decrypt_rsp_params)
+{
+	hdd_context_t *hdd_ctx = hdd_context;
+	int ret;
+	struct hdd_encrypt_decrypt_msg_context *context;
+
+	ENTER();
+
+	ret = wlan_hdd_validate_context(hdd_ctx);
+	if (ret)
+		return;
+
+	if (!encrypt_decrypt_rsp_params) {
+		hdd_err("rsp params is NULL");
+		return;
+	}
+
+	print_hex_dump(KERN_INFO, "Data in hdd_encrypt_decrypt_msg_cb: ",
+		DUMP_PREFIX_NONE, 16, 1,
+		encrypt_decrypt_rsp_params->data,
+		encrypt_decrypt_rsp_params->data_length, 0);
+
+	hdd_err("vdev_id %d,status %d data_length %d",
+		encrypt_decrypt_rsp_params->vdev_id,
+		encrypt_decrypt_rsp_params->status,
+		encrypt_decrypt_rsp_params->data_length);
+
+	spin_lock(&hdd_context_lock);
+
+	context = &encrypt_decrypt_msg_context;
+	/* The caller presumably timed out so there is nothing we can do */
+	if (context->magic != ENCRYPT_DECRYPT_CONTEXT_MAGIC) {
+		spin_unlock(&hdd_context_lock);
+		return;
+	}
+
+	/* context is valid so caller is still waiting */
+	context->response = *encrypt_decrypt_rsp_params;
+
+	if (encrypt_decrypt_rsp_params->data_length) {
+		context->response.data =
+			qdf_mem_malloc(sizeof(uint8_t) *
+				encrypt_decrypt_rsp_params->data_length);
+		if (context->response.data == NULL) {
+			hdd_err("cdf_mem_alloc failed for data");
+			spin_unlock(&hdd_context_lock);
+			return;
+		}
+		qdf_mem_copy(context->response.data,
+			encrypt_decrypt_rsp_params->data,
+			encrypt_decrypt_rsp_params->data_length);
+	}
+
+	/*
+	 * Indicate to calling thread that
+	 * response data is available
+	 */
+	context->magic = 0;
+
+	complete(&context->completion);
+
+	spin_unlock(&hdd_context_lock);
+
+
+	EXIT();
+}
+
+
+/**
+ * hdd_encrypt_decrypt_msg_cb () - sends encrypt/decrypt data to user space
+ * @encrypt_decrypt_rsp_params: encrypt/decrypt response parameters
+ *
+ * Return: none
+ */
+static int hdd_post_encrypt_decrypt_msg_rsp(hdd_context_t *hdd_ctx,
+	struct sir_encrypt_decrypt_rsp_params *encrypt_decrypt_rsp_params)
+{
+	struct sk_buff *skb;
+	uint32_t nl_buf_len;
+
+	ENTER();
+
+	nl_buf_len = encrypt_decrypt_rsp_params->data_length + NLA_HDRLEN;
+
+	skb = cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy, nl_buf_len);
+	if (!skb) {
+		hdd_err(FL("cfg80211_vendor_cmd_alloc_reply_skb failed"));
+		return -ENOMEM;
+	}
+
+	if (encrypt_decrypt_rsp_params->data_length) {
+		if (nla_put(skb, QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_DATA,
+				encrypt_decrypt_rsp_params->data_length,
+				encrypt_decrypt_rsp_params->data)) {
+			hdd_err(FL("put fail"));
+			goto nla_put_failure;
+		}
+	}
+
+	cfg80211_vendor_cmd_reply(skb);
+	EXIT();
+	return 0;
+
+nla_put_failure:
+	kfree_skb(skb);
+	return -EINVAL;
+}
+
+/**
+ * hdd_fill_encrypt_decrypt_params () - parses data from user space
+ * and fills encrypt/decrypt parameters
+ * @encrypt_decrypt_params: encrypt/decrypt request parameters
+ * @adapter : adapter context
+ * @data: Pointer to data
+ * @data_len: Data length
+ *
+ Return: 0 on success, negative errno on failure
+ */
+static int hdd_fill_encrypt_decrypt_params(struct encrypt_decrypt_req_params
+						*encrypt_decrypt_params,
+						hdd_adapter_t *adapter,
+						const void *data,
+						int data_len)
+{
+	struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_MAX + 1];
+	uint8_t len, mac_hdr_len;
+	uint8_t *tmp;
+	uint8_t fc[2];
+
+	if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_MAX,
+		      data, data_len, NULL)) {
+		hdd_err("Invalid ATTR");
+		return -EINVAL;
+	}
+
+	encrypt_decrypt_params->vdev_id = adapter->sessionId;
+	hdd_err("vdev_id : %d", encrypt_decrypt_params->vdev_id);
+
+	if (!tb[QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_NEEDS_DECRYPTION]) {
+		hdd_err("attr flag NEEDS_DECRYPTION not present");
+		encrypt_decrypt_params->key_flag = WMI_ENCRYPT;
+	} else {
+		hdd_err("attr flag NEEDS_DECRYPTION present");
+		encrypt_decrypt_params->key_flag = WMI_DECRYPT;
+	}
+	hdd_err("Key flag : %d", encrypt_decrypt_params->key_flag);
+
+	if (!tb[QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_KEYID]) {
+		hdd_err("attr key id failed");
+		return -EINVAL;
+	}
+	encrypt_decrypt_params->key_idx = nla_get_u8(tb
+		    [QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_KEYID]);
+	hdd_err("Key Idx : %d", encrypt_decrypt_params->key_idx);
+
+	if (!tb[QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_CIPHER]) {
+		hdd_err("attr Cipher failed");
+		return -EINVAL;
+	}
+	encrypt_decrypt_params->key_cipher = nla_get_u32(tb
+		    [QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_CIPHER]);
+	hdd_err("key_cipher : %d", encrypt_decrypt_params->key_cipher);
+
+	if (!tb[QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_TK]) {
+		hdd_err("attr TK failed");
+		return -EINVAL;
+	}
+	encrypt_decrypt_params->key_len =
+		nla_len(tb[QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_TK]);
+	if (!encrypt_decrypt_params->key_len) {
+		hdd_err("Invalid TK length");
+		return -EINVAL;
+	}
+	hdd_err("Key len : %d", encrypt_decrypt_params->key_len);
+
+	if (encrypt_decrypt_params->key_len > SIR_MAC_MAX_KEY_LENGTH)
+		encrypt_decrypt_params->key_len = SIR_MAC_MAX_KEY_LENGTH;
+
+	tmp = nla_data(tb[QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_TK]);
+
+	qdf_mem_copy(encrypt_decrypt_params->key_data, tmp,
+			encrypt_decrypt_params->key_len);
+
+	print_hex_dump(KERN_INFO, "Key : ", DUMP_PREFIX_NONE, 16, 1,
+			&encrypt_decrypt_params->key_data,
+			encrypt_decrypt_params->key_len, 0);
+
+	if (!tb[QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_PN]) {
+		hdd_err("attr PN failed");
+		return -EINVAL;
+	}
+	len = nla_len(tb[QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_PN]);
+	if (!len) {
+		hdd_err("Invalid PN length");
+		return -EINVAL;
+	}
+
+	tmp = nla_data(tb[QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_PN]);
+
+	qdf_mem_copy(encrypt_decrypt_params->pn, tmp, len);
+
+	print_hex_dump(KERN_INFO, "PN received : ", DUMP_PREFIX_NONE, 16, 1,
+			&encrypt_decrypt_params->pn, len, 0);
+
+	if (!tb[QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_DATA]) {
+		hdd_err("attr header failed");
+		return -EINVAL;
+	}
+	len = nla_len(tb[QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_DATA]);
+	if (!len) {
+		hdd_err("Invalid header and payload length");
+		return -EINVAL;
+	}
+
+	hdd_err("Header and Payload length %d ", len);
+
+	tmp = nla_data(tb[QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_DATA]);
+
+	print_hex_dump(KERN_INFO, "Header and Payload received: ",
+			DUMP_PREFIX_NONE, 16, 1,
+			tmp, len, 0);
+
+	mac_hdr_len = MIN_MAC_HEADER_LEN;
+
+	/*
+	 * Check to find out address 4. Address 4 is present if ToDS and FromDS
+	 * are 1 and data representation is little endian.
+	 */
+	fc[1] = *tmp;
+	fc[0] = *(tmp + 1);
+	if ((fc[0] & 0x03) == 0x03) {
+		hdd_err("Address 4 is present");
+		mac_hdr_len += IEEE80211_ADDR_LEN;
+	}
+
+	/*
+	 * Check to find out Qos control field. Qos control field is present
+	 * if msb of subtype field is 1 and data representation is
+	 * little endian.
+	 */
+	if (fc[1] & 0x80) {
+		hdd_err("Qos control is present");
+		mac_hdr_len += QOS_CONTROL_LEN;
+	}
+
+	hdd_err("mac_hdr_len %d", mac_hdr_len);
+
+	qdf_mem_copy(encrypt_decrypt_params->mac_header,
+			tmp, mac_hdr_len);
+
+	print_hex_dump(KERN_INFO, "Header received in request: ",
+			DUMP_PREFIX_NONE, 16, 1,
+			encrypt_decrypt_params->mac_header,
+			mac_hdr_len, 0);
+
+	encrypt_decrypt_params->data_len =
+			len - mac_hdr_len;
+
+	hdd_err("Payload length : %d", encrypt_decrypt_params->data_len);
+
+	if (encrypt_decrypt_params->data_len) {
+		encrypt_decrypt_params->data =
+			qdf_mem_malloc(sizeof(uint8_t) *
+				encrypt_decrypt_params->data_len);
+
+		if (encrypt_decrypt_params->data == NULL) {
+			hdd_err("cdf_mem_alloc failed for data");
+			return -ENOMEM;
+		}
+
+		qdf_mem_copy(encrypt_decrypt_params->data,
+			tmp + mac_hdr_len,
+			encrypt_decrypt_params->data_len);
+
+		print_hex_dump(KERN_INFO, "Data received in request: ",
+			DUMP_PREFIX_NONE, 16, 1,
+			encrypt_decrypt_params->data,
+			encrypt_decrypt_params->data_len, 0);
+	}
+
+	return 0;
+}
+
+/**
+ * hdd_encrypt_decrypt_msg () - process encrypt/decrypt message
+ * @adapter : adapter context
+ * @hdd_ctx: hdd context
+ * @data: Pointer to data
+ * @data_len: Data length
+ *
+ Return: 0 on success, negative errno on failure
+ */
+static int hdd_encrypt_decrypt_msg(hdd_adapter_t *adapter,
+						hdd_context_t *hdd_ctx,
+						const void *data,
+						int data_len)
+{
+	struct encrypt_decrypt_req_params encrypt_decrypt_params = {0};
+	QDF_STATUS qdf_status;
+	int ret;
+	struct hdd_encrypt_decrypt_msg_context *context;
+	unsigned long rc;
+
+	ret = hdd_fill_encrypt_decrypt_params(&encrypt_decrypt_params,
+				adapter, data, data_len);
+	if (ret)
+		return ret;
+
+	spin_lock(&hdd_context_lock);
+	context = &encrypt_decrypt_msg_context;
+	context->magic = ENCRYPT_DECRYPT_CONTEXT_MAGIC;
+	INIT_COMPLETION(context->completion);
+	spin_unlock(&hdd_context_lock);
+
+	qdf_status = sme_encrypt_decrypt_msg(hdd_ctx->hHal,
+					&encrypt_decrypt_params);
+
+	qdf_mem_free(encrypt_decrypt_params.data);
+
+	if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
+		hdd_err("Unable to post encrypt/decrypt message");
+		return -EINVAL;
+	}
+
+	rc = wait_for_completion_timeout(&context->completion,
+			msecs_to_jiffies(WLAN_WAIT_TIME_ENCRYPT_DECRYPT));
+
+	spin_lock(&hdd_context_lock);
+	if (!rc && (context->magic ==
+			ENCRYPT_DECRYPT_CONTEXT_MAGIC)) {
+		hdd_err("Target response timed out");
+		context->magic = 0;
+		spin_unlock(&hdd_context_lock);
+		return -ETIMEDOUT;
+	}
+
+	spin_unlock(&hdd_context_lock);
+	ret = hdd_post_encrypt_decrypt_msg_rsp(hdd_ctx,
+				&encrypt_decrypt_msg_context.response);
+	if (ret)
+		hdd_err("Failed to post encrypt/decrypt message response");
+
+	qdf_mem_free(encrypt_decrypt_msg_context.response.data);
+
+	EXIT();
+	return ret;
+}
+
+/**
+ * hdd_encrypt_decrypt_init () - exposes encrypt/decrypt initialization
+ * functionality
+ * @hdd_ctx: hdd context
+ *
+ Return: 0 on success, negative errno on failure
+ */
+int hdd_encrypt_decrypt_init(hdd_context_t *hdd_ctx)
+{
+	QDF_STATUS status;
+
+	init_completion(&encrypt_decrypt_msg_context.completion);
+
+	status = sme_encrypt_decrypt_msg_register_callback(hdd_ctx->hHal,
+					hdd_encrypt_decrypt_msg_cb);
+	if (!QDF_IS_STATUS_SUCCESS(status)) {
+		hdd_err("encrypt/decrypt callback failed %d", status);
+		return -EINVAL;
+	}
+	return 0;
+}
+
+/**
+ * hdd_encrypt_decrypt_deinit () - exposes encrypt/decrypt deinitialization
+ * functionality
+ * @hdd_ctx: hdd context
+ *
+ Return: 0 on success, negative errno on failure
+ */
+int hdd_encrypt_decrypt_deinit(hdd_context_t *hdd_ctx)
+{
+	QDF_STATUS status;
+
+	status = sme_encrypt_decrypt_msg_deregister_callback(hdd_ctx->hHal);
+	if (!QDF_IS_STATUS_SUCCESS(status))
+		hdd_err("De-register encrypt/decrypt callback failed: %d",
+			status);
+	return 0;
+}
+
+/**
+ * __wlan_hdd_cfg80211_encrypt_decrypt_msg () - Encrypt/Decrypt msg
+ * @wiphy: Pointer to wireless phy
+ * @wdev: Pointer to wireless device
+ * @data: Pointer to data
+ * @data_len: Data length
+ *
+ * Return: 0 on success, negative errno on failure
+ */
+static int __wlan_hdd_cfg80211_encrypt_decrypt_msg(struct wiphy *wiphy,
+						struct wireless_dev *wdev,
+						const void *data,
+						int data_len)
+{
+	hdd_context_t *hdd_ctx = wiphy_priv(wiphy);
+	struct net_device *dev = wdev->netdev;
+	hdd_adapter_t *adapter = NULL;
+	int ret;
+
+	ENTER_DEV(dev);
+
+	ret = wlan_hdd_validate_context(hdd_ctx);
+	if (ret)
+		return ret;
+
+	adapter = WLAN_HDD_GET_PRIV_PTR(dev);
+
+	ret = hdd_encrypt_decrypt_msg(adapter, hdd_ctx, data, data_len);
+
+	return ret;
+}
+
+/**
+ * wlan_hdd_cfg80211_encrypt_decrypt_msg () - Encrypt/Decrypt msg
+ * @wiphy: Pointer to wireless phy
+ * @wdev: Pointer to wireless device
+ * @data: Pointer to data
+ * @data_len: Data length
+ *
+ * Return: 0 on success, negative errno on failure
+ */
+int wlan_hdd_cfg80211_encrypt_decrypt_msg(struct wiphy *wiphy,
+						struct wireless_dev *wdev,
+						const void *data,
+						int data_len)
+{
+	int ret;
+
+	cds_ssr_protect(__func__);
+	ret = __wlan_hdd_cfg80211_encrypt_decrypt_msg(wiphy, wdev,
+						data, data_len);
+	cds_ssr_unprotect(__func__);
+
+	return ret;
+}

+ 70 - 0
core/hdd/src/wlan_hdd_disa.h

@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2016 The Linux Foundation. All rights reserved.
+ *
+ * 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 _WLAN_HDD_DISA_H
+#define _WLAN_HDD_DISA_H
+
+#include "wlan_hdd_main.h"
+#include "sir_api.h"
+
+#ifdef WLAN_FEATURE_DISA
+/**
+ * hdd_encrypt_decrypt_init () - exposes encrypt/decrypt initialization
+ * functionality
+ * @hdd_ctx: hdd context
+ *
+ Return: 0 on success, negative errno on failure
+ */
+int hdd_encrypt_decrypt_init(hdd_context_t *hdd_ctx);
+
+/**
+ * hdd_encrypt_decrypt_deinit () - exposes encrypt/decrypt deinitialization
+ * functionality
+ * @hdd_ctx: hdd context
+ *
+ Return: 0 on success, negative errno on failure
+ */
+int hdd_encrypt_decrypt_deinit(hdd_context_t *hdd_ctx);
+#else
+static inline int hdd_encrypt_decrypt_init(hdd_context_t *hdd_ctx)
+{
+	return -ENOTSUPP;
+}
+static inline int hdd_encrypt_decrypt_deinit(hdd_context_t *hdd_ctx)
+{
+	return -ENOTSUPP;
+}
+#endif
+
+#ifdef WLAN_FEATURE_DISA
+/**
+ * wlan_hdd_cfg80211_encrypt_decrypt_msg () - Encrypt/Decrypt msg
+ * @wiphy: Pointer to wireless phy
+ * @wdev: Pointer to wireless device
+ * @data: Pointer to data
+ * @data_len: Data length
+ *
+ * Return: 0 on success, negative errno on failure
+ */
+int wlan_hdd_cfg80211_encrypt_decrypt_msg(struct wiphy *wiphy,
+			struct wireless_dev *wdev,
+			const void *data,
+			int data_len);
+#endif
+
+#endif

+ 279 - 69
core/hdd/src/wlan_hdd_driver_ops.c

@@ -193,6 +193,8 @@ static enum qdf_bus_type to_bus_type(enum pld_bus_type bus_type)
 		return QDF_BUS_TYPE_SNOC;
 	case PLD_BUS_TYPE_SDIO:
 		return QDF_BUS_TYPE_SDIO;
+	case PLD_BUS_TYPE_USB:
+		return QDF_BUS_TYPE_USB;
 	default:
 		return QDF_BUS_TYPE_NONE;
 	}
@@ -210,7 +212,7 @@ static enum qdf_bus_type to_bus_type(enum pld_bus_type bus_type)
  *
  * Return: 0 on success and errno on failure.
  */
-static int hdd_hif_open(struct device *dev, void *bdev, const hif_bus_id *bid,
+int hdd_hif_open(struct device *dev, void *bdev, const hif_bus_id *bid,
 			enum qdf_bus_type bus_type, bool reinit)
 {
 	QDF_STATUS status;
@@ -219,6 +221,12 @@ static int hdd_hif_open(struct device *dev, void *bdev, const hif_bus_id *bid,
 	qdf_device_t qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE);
 	struct hif_driver_state_callbacks cbk;
 	uint32_t mode = cds_get_conparam();
+	hdd_context_t *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
+
+	if (!hdd_ctx) {
+		hdd_err("hdd_ctx error");
+		return -EFAULT;
+	}
 
 	hdd_hif_init_driver_state_callbacks(dev, &cbk);
 
@@ -252,6 +260,9 @@ static int hdd_hif_open(struct device *dev, void *bdev, const hif_bus_id *bid,
 				ret, reinit);
 			ret = -EFAULT;
 			goto err_hif_close;
+		} else {
+			hdd_napi_event(NAPI_EVT_INI_FILE,
+				(void *)hdd_ctx->napi_enable);
 		}
 	}
 
@@ -269,7 +280,7 @@ err_hif_close:
  *
  * Helper function to close HIF
  */
-static void hdd_hif_close(void *hif_ctx)
+void hdd_hif_close(void *hif_ctx)
 {
 	if (hif_ctx == NULL)
 		return;
@@ -286,17 +297,25 @@ static void hdd_hif_close(void *hif_ctx)
  * hdd_init_qdf_ctx() - API to initialize global QDF Device structure
  * @dev: Device Pointer
  * @bdev: Bus Device pointer
+ * @bus_type: Underlying bus type
+ * @bid: Bus id passed by platform driver
  *
  * Return: void
  */
 void hdd_init_qdf_ctx(struct device *dev, void *bdev,
-		 enum qdf_bus_type bus_type)
+		      enum qdf_bus_type bus_type, const struct hif_bus_id *bid)
 {
 	qdf_device_t qdf_dev = cds_get_context(QDF_MODULE_ID_QDF_DEVICE);
 
+	if (!qdf_dev) {
+		hdd_err("Invalid QDF device");
+		return;
+	}
+
 	qdf_dev->dev = dev;
 	qdf_dev->drv_hdl = bdev;
 	qdf_dev->bus_type = bus_type;
+	qdf_dev->bid = bid;
 }
 
 /**
@@ -315,11 +334,7 @@ void hdd_init_qdf_ctx(struct device *dev, void *bdev,
 static int wlan_hdd_probe(struct device *dev, void *bdev, const hif_bus_id *bid,
 	enum qdf_bus_type bus_type, bool reinit)
 {
-	void *hif_ctx;
-	QDF_STATUS status;
 	int ret = 0;
-	qdf_device_t qdf_dev;
-	uint32_t mode = cds_get_conparam();
 
 	pr_info("%s: %sprobing driver v%s\n", WLAN_MODULE_NAME,
 		reinit ? "re-" : "", QWLAN_VERSIONSTR);
@@ -344,38 +359,16 @@ static int wlan_hdd_probe(struct device *dev, void *bdev, const hif_bus_id *bid,
 		cds_set_load_in_progress(true);
 	}
 
-	if (QDF_IS_EPPING_ENABLED(mode)) {
-		status = epping_open();
-		if (status != QDF_STATUS_SUCCESS)
-			goto err_hdd_deinit;
-	}
-
-	hdd_init_qdf_ctx(dev, bdev, bus_type);
-
-	ret = hdd_hif_open(dev, bdev, bid, bus_type, reinit);
-
-	if (ret)
-		goto err_epping_close;
-
-	hif_ctx = cds_get_context(QDF_MODULE_ID_HIF);
-	qdf_dev = cds_get_context(QDF_MODULE_ID_QDF_DEVICE);
-
-	status = ol_cds_init(qdf_dev, hif_ctx);
-
-	if (status != QDF_STATUS_SUCCESS) {
-		pr_err("%s No Memory to Create BMI Context\n", __func__);
-		goto err_hif_close;
-	}
+	hdd_init_qdf_ctx(dev, bdev, bus_type, (const struct hif_bus_id *)bid);
 
 	if (reinit)
-		ret = hdd_wlan_re_init(hif_ctx);
+		ret = hdd_wlan_re_init();
 	else
-		ret = hdd_wlan_startup(dev, hif_ctx);
+		ret = hdd_wlan_startup(dev);
 
 	if (ret)
-		goto err_bmi_close;
+		goto err_hdd_deinit;
 
-	hif_enable_power_management(hif_ctx, cds_is_packet_log_enabled());
 
 	if (reinit) {
 		cds_set_recovery_in_progress(false);
@@ -389,15 +382,12 @@ static int wlan_hdd_probe(struct device *dev, void *bdev, const hif_bus_id *bid,
 
 	return 0;
 
-err_bmi_close:
-	ol_cds_free();
-err_hif_close:
-	hdd_hif_close(hif_ctx);
-err_epping_close:
-	if (QDF_IS_EPPING_ENABLED(mode))
-		epping_close();
+
 err_hdd_deinit:
-	cds_set_load_in_progress(false);
+	if (reinit)
+		cds_set_recovery_in_progress(false);
+	else
+		cds_set_load_in_progress(false);
 	hdd_deinit();
 out:
 	hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_INIT);
@@ -420,16 +410,9 @@ static inline void hdd_pld_driver_unloading(struct device *dev)
  */
 static void wlan_hdd_remove(struct device *dev)
 {
-	void *hif_ctx;
-
 	pr_info("%s: Removing driver v%s\n", WLAN_MODULE_NAME,
 		QWLAN_VERSIONSTR);
 
-	/* Wait for recovery to complete */
-	while (cds_is_driver_recovering()) {
-		hdd_alert("Recovery in progress; wait here!!!");
-		msleep(1000);
-	}
 
 	cds_set_driver_loaded(false);
 	cds_set_unload_in_progress(true);
@@ -439,10 +422,6 @@ static void wlan_hdd_remove(struct device *dev)
 
 	hdd_pld_driver_unloading(dev);
 
-	hif_ctx = cds_get_context(QDF_MODULE_ID_HIF);
-
-	hif_disable_power_management(hif_ctx);
-
 	if (QDF_IS_EPPING_ENABLED(cds_get_conparam())) {
 		epping_disable();
 		epping_close();
@@ -450,11 +429,9 @@ static void wlan_hdd_remove(struct device *dev)
 		__hdd_wlan_exit();
 	}
 
-	ol_cds_free();
-	hdd_hif_close(hif_ctx);
 	hdd_deinit();
 
-	pr_info("%s: Driver Removed\n", WLAN_MODULE_NAME);
+	pr_info("%s: Driver De-initialized\n", WLAN_MODULE_NAME);
 }
 
 /**
@@ -483,9 +460,6 @@ static void wlan_hdd_shutdown(void)
 		hif_disable_isr(hif_ctx);
 		hdd_wlan_shutdown();
 	}
-
-	ol_cds_free();
-	hdd_hif_close(hif_ctx);
 }
 
 /**
@@ -537,8 +511,8 @@ void wlan_hdd_notify_handler(int state)
  */
 static int __wlan_hdd_bus_suspend(pm_message_t state)
 {
-	void *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
-	void *hif_ctx = cds_get_context(QDF_MODULE_ID_HIF);
+	hdd_context_t *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
+	void *hif_ctx;
 	int err = wlan_hdd_validate_context(hdd_ctx);
 	int status;
 
@@ -547,8 +521,18 @@ static int __wlan_hdd_bus_suspend(pm_message_t state)
 	if (err)
 		goto done;
 
-	err = qdf_status_to_os_return(
-			ol_txrx_bus_suspend());
+	if (hdd_ctx->driver_status != DRIVER_MODULES_ENABLED) {
+		hdd_info("Driver Module closed return success");
+		return 0;
+	}
+
+	hif_ctx = cds_get_context(QDF_MODULE_ID_HIF);
+	if (NULL == hif_ctx) {
+		err = -EINVAL;
+		goto done;
+	}
+
+	err = qdf_status_to_os_return(ol_txrx_bus_suspend());
 	if (err)
 		goto done;
 
@@ -560,8 +544,8 @@ static int __wlan_hdd_bus_suspend(pm_message_t state)
 	if (err)
 		goto resume_wma;
 
-	hdd_info("suspend done, status = %d", err);
-	return err;
+	hdd_info("suspend done");
+	return 0;
 
 resume_wma:
 	status = wma_bus_resume();
@@ -570,7 +554,7 @@ resume_oltxrx:
 	status = ol_txrx_bus_resume();
 	QDF_BUG(!status);
 done:
-	hdd_err("suspend done, status = %d", err);
+	hdd_err("suspend failed, status = %d", err);
 	return err;
 }
 
@@ -595,6 +579,83 @@ int wlan_hdd_bus_suspend(pm_message_t state)
 	return ret;
 }
 
+/**
+ * __wlan_hdd_bus_suspend_noirq() - handle .suspend_noirq callback
+ *
+ * This function is called by the platform driver to complete the
+ * bus suspend callback when device interrupts are disabled by kernel.
+ * Call HIF and WMA suspend_noirq callbacks to make sure there is no
+ * wake up pending from FW before allowing suspend.
+ *
+ * Return: 0 for success and -EBUSY if FW is requesting wake up
+ */
+int __wlan_hdd_bus_suspend_noirq(void)
+{
+	hdd_context_t *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
+	void *hif_ctx;
+	int err;
+	int status;
+
+	err = wlan_hdd_validate_context(hdd_ctx);
+	if (err) {
+		hdd_err("Invalid HDD context: %d", err);
+		return err;
+	}
+
+	if (hdd_ctx->driver_status != DRIVER_MODULES_ENABLED) {
+		hdd_info("Driver Module closed return success");
+		return 0;
+	}
+
+	hif_ctx = cds_get_context(QDF_MODULE_ID_HIF);
+	if (NULL == hif_ctx) {
+		err = -EINVAL;
+		goto done;
+	}
+
+	err = hif_bus_suspend_noirq(hif_ctx);
+	if (err)
+		goto done;
+
+	err = wma_is_target_wake_up_received();
+	if (err)
+		goto resume_hif_noirq;
+
+	hdd_info("suspend_noirq done");
+	return 0;
+
+resume_hif_noirq:
+	status = hif_bus_resume_noirq(hif_ctx);
+	QDF_BUG(!status);
+done:
+	if (err == -EAGAIN)
+		hdd_err("Firmware attempting wakeup, try again");
+	else
+		hdd_err("suspend_noirq failed, status = %d", err);
+	return err;
+}
+
+/**
+ * wlan_hdd_bus_suspend_noirq() - handle .suspend_noirq callback
+ *
+ * This function is called by the platform driver to complete the
+ * bus suspend callback when device interrupts are disabled by kernel.
+ * Call HIF and WMA suspend_noirq callbacks to make sure there is no
+ * wake up pending from FW before allowing suspend.
+ *
+ * Return: 0 for success and -EBUSY if FW is requesting wake up
+ */
+int wlan_hdd_bus_suspend_noirq(void)
+{
+	int ret;
+
+	cds_ssr_protect(__func__);
+	ret = __wlan_hdd_bus_suspend_noirq();
+	cds_ssr_unprotect(__func__);
+
+	return ret;
+}
+
 /**
  * __wlan_hdd_bus_resume() - handles platform resume
  *
@@ -610,13 +671,22 @@ int wlan_hdd_bus_suspend(pm_message_t state)
  */
 static int __wlan_hdd_bus_resume(void)
 {
-	void *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
-	void *hif_ctx = cds_get_context(QDF_MODULE_ID_HIF);
+	hdd_context_t *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
+	void *hif_ctx;
 	int status = wlan_hdd_validate_context(hdd_ctx);
 
 	if (status)
 		return status;
 
+	if (hdd_ctx->driver_status != DRIVER_MODULES_ENABLED) {
+		hdd_info("Driver Module closed return success");
+		return 0;
+	}
+
+	hif_ctx = cds_get_context(QDF_MODULE_ID_HIF);
+	if (NULL == hif_ctx)
+		return -EINVAL;
+
 	status = hif_bus_resume(hif_ctx);
 	QDF_BUG(!status);
 
@@ -638,7 +708,7 @@ static int __wlan_hdd_bus_resume(void)
  *
  * Return: void
  */
-static int wlan_hdd_bus_resume(void)
+int wlan_hdd_bus_resume(void)
 {
 	int ret;
 
@@ -649,6 +719,91 @@ static int wlan_hdd_bus_resume(void)
 	return ret;
 }
 
+/**
+ * __wlan_hdd_bus_resume_noirq(): handle bus resume no irq
+ *
+ * This function is called by the platform driver to do bus
+ * resume no IRQ before calling resume callback. Call WMA and HIF
+ * layers to complete the resume_noirq.
+ *
+ * Return: 0 for success and negative error code for failure
+ */
+int __wlan_hdd_bus_resume_noirq(void)
+{
+	hdd_context_t *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
+	void *hif_ctx;
+	int status = wlan_hdd_validate_context(hdd_ctx);
+
+	if (status) {
+		hdd_err("Invalid HDD context: %d", status);
+		return status;
+	}
+
+	if (hdd_ctx->driver_status != DRIVER_MODULES_ENABLED) {
+		hdd_info("Driver Module closed return success");
+		return 0;
+	}
+
+	hif_ctx = cds_get_context(QDF_MODULE_ID_HIF);
+	if (NULL == hif_ctx)
+		return -EINVAL;
+
+	status = wma_clear_target_wake_up();
+	QDF_BUG(!status);
+
+	status = hif_bus_resume_noirq(hif_ctx);
+	QDF_BUG(!status);
+
+	hdd_info("resume_noirq done");
+	return status;
+}
+
+/**
+ * wlan_hdd_bus_resume_noirq(): handle bus resume no irq
+ *
+ * This function is called by the platform driver to do bus
+ * resume no IRQ before calling resume callback. Call WMA and HIF
+ * layers to complete the resume_noirq.
+ *
+ * Return: 0 for success and negative error code for failure
+ */
+int wlan_hdd_bus_resume_noirq(void)
+{
+	int ret;
+
+	cds_ssr_protect(__func__);
+	ret = __wlan_hdd_bus_resume_noirq();
+	cds_ssr_unprotect(__func__);
+
+	return ret;
+}
+
+/**
+ * wlan_hdd_bus_reset_resume() - resume wlan bus after reset
+ *
+ * This function is called to tell the driver that the device has been resumed
+ * and it has also been reset. The driver should redo any necessary
+ * initialization. It is mainly used by the USB bus
+ *
+ * Return: int 0 for success, non zero for failure
+ */
+static int wlan_hdd_bus_reset_resume(void)
+{
+	int ret;
+	struct hif_opaque_softc *scn = NULL;
+
+	scn = cds_get_context(QDF_MODULE_ID_HIF);
+	if (!scn) {
+		hdd_err("Failed to get HIF context");
+		return -EFAULT;
+	}
+
+	cds_ssr_protect(__func__);
+	ret = hif_bus_reset_resume(scn);
+	cds_ssr_unprotect(__func__);
+	return ret;
+}
+
 #ifdef FEATURE_RUNTIME_PM
 /**
  * __wlan_hdd_runtime_suspend() - suspend the wlan bus without apps suspend
@@ -661,7 +816,7 @@ static int wlan_hdd_bus_resume(void)
  */
 static int __wlan_hdd_runtime_suspend(struct device *dev)
 {
-	void *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
+	hdd_context_t *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
 	void *hif_ctx = cds_get_context(QDF_MODULE_ID_HIF);
 	void *txrx_pdev = cds_get_context(QDF_MODULE_ID_TXRX);
 	void *htc_ctx = cds_get_context(QDF_MODULE_ID_HTC);
@@ -892,6 +1047,58 @@ static int wlan_hdd_pld_resume(struct device *dev,
 	return wlan_hdd_bus_resume();
 }
 
+
+/**
+ * wlan_hdd_pld_suspend_noirq() - handle suspend no irq
+ * @dev: device
+ * @pld_bus_type: PLD bus type
+ *
+ * Complete the actions started by suspend().  Carry out any
+ * additional operations required for suspending the device that might be
+ * racing with its driver's interrupt handler, which is guaranteed not to
+ * run while suspend_noirq() is being executed. Make sure to resume device
+ * if FW has sent initial wake up message and expecting APPS to wake up.
+ *
+ * Return: 0 on success
+ */
+static int wlan_hdd_pld_suspend_noirq(struct device *dev,
+		     enum pld_bus_type bus_type)
+{
+	return wlan_hdd_bus_suspend_noirq();
+}
+
+/**
+ * wlan_hdd_pld_resume_noirq() - handle resume no irq
+ * @dev: device
+ * @pld_bus_type: PLD bus type
+ *
+ * Prepare for the execution of resume() by carrying out any
+ * operations required for resuming the device that might be racing with
+ * its driver's interrupt handler, which is guaranteed not to run while
+ * resume_noirq() is being executed. Make sure to clear target initial
+ * wake up request such that next suspend can happen cleanly.
+ *
+ * Return: 0 on success
+ */
+static int wlan_hdd_pld_resume_noirq(struct device *dev,
+		    enum pld_bus_type bus_type)
+{
+	return wlan_hdd_bus_resume_noirq();
+}
+
+/**
+ * wlan_hdd_pld_reset_resume() - reset resume function registered to PLD
+ * @dev: device
+ * @pld_bus_type: PLD bus type
+ *
+ * Return: 0 on success
+ */
+static int wlan_hdd_pld_reset_resume(struct device *dev,
+		    enum pld_bus_type bus_type)
+{
+	return wlan_hdd_bus_reset_resume();
+}
+
 /**
  * wlan_hdd_pld_notify_handler() - notify_handler function registered to PLD
  * @dev: device
@@ -943,6 +1150,9 @@ struct pld_driver_ops wlan_drv_ops = {
 	.crash_shutdown = wlan_hdd_pld_crash_shutdown,
 	.suspend    = wlan_hdd_pld_suspend,
 	.resume     = wlan_hdd_pld_resume,
+	.suspend_noirq = wlan_hdd_pld_suspend_noirq,
+	.resume_noirq  = wlan_hdd_pld_resume_noirq,
+	.reset_resume = wlan_hdd_pld_reset_resume,
 	.modem_status = wlan_hdd_pld_notify_handler,
 #ifdef FEATURE_RUNTIME_PM
 	.runtime_suspend = wlan_hdd_pld_runtime_suspend,

Dosya farkı çok büyük olduğundan ihmal edildi
+ 185 - 139
core/hdd/src/wlan_hdd_ext_scan.c


+ 26 - 685
core/hdd/src/wlan_hdd_ftm.c

@@ -31,6 +31,9 @@
  * This file contains the WLAN factory test mode implementation
  */
 
+/* denote that this file does not allow legacy hddLog */
+#define HDD_DISALLOW_LEGACY_HDDLOG 1
+
 #include <cds_mq.h>
 #include "cds_sched.h"
 #include <cds_api.h>
@@ -45,6 +48,7 @@
 #include "i_cds_packet.h"
 #include "cds_reg_service.h"
 #include "wlan_hdd_main.h"
+#include "wlan_hdd_lpass.h"
 #include "qwlan_version.h"
 #include "wma_types.h"
 #include "cfg_api.h"
@@ -53,7 +57,6 @@
 #include "bmi.h"
 #include "ol_fw.h"
 #include "wlan_hdd_cfg80211.h"
-#include "wlan_hdd_main.h"
 #include "hif.h"
 #endif
 
@@ -76,6 +79,7 @@ typedef struct qcmbr_queue_s {
 } qcmbr_queue_t;
 LIST_HEAD(qcmbr_queue_head);
 DEFINE_SPINLOCK(qcmbr_queue_lock);
+static void wlanqcmbr_mc_process_msg(void *message);
 #endif
 #endif
 
@@ -101,8 +105,7 @@ static uint32_t wlan_ftm_postmsg(uint8_t *cmd_ptr, uint16_t cmd_len)
 
 	if (QDF_STATUS_SUCCESS != cds_mq_post_message(QDF_MODULE_ID_WMA,
 						      &ftmMsg)) {
-		hddLog(QDF_TRACE_LEVEL_ERROR, "%s: : Failed to post Msg to HAL",
-		       __func__);
+		hdd_err("Failed to post Msg to HAL");
 
 		return QDF_STATUS_E_FAILURE;
 	}
@@ -112,596 +115,37 @@ static uint32_t wlan_ftm_postmsg(uint8_t *cmd_ptr, uint16_t cmd_len)
 }
 
 /**
- * wlan_hdd_ftm_update_tgt_cfg() - Update target configuration
- * @context: context registered with WMA
- * @param: target configuration
+ * hdd_update_cds_config_ftm() - API to update cds configuration parameters
+ * for FTM mode.
+ * @hdd_ctx: HDD Context
  *
- * This function is registered with WMA via wma_open(), and is
- * invoked via callback when target parameters are received
- * from firmware.
- *
- * Return: None
+ * Return: 0 on success; errno on failure
  */
-static void wlan_hdd_ftm_update_tgt_cfg(void *context, void *param)
-{
-	hdd_context_t *hdd_ctx = (hdd_context_t *) context;
-	struct wma_tgt_cfg *cfg = (struct wma_tgt_cfg *)param;
-
-	if (!qdf_is_macaddr_zero(&cfg->hw_macaddr)) {
-		hdd_update_macaddr(hdd_ctx->config, cfg->hw_macaddr);
-	} else {
-		hddLog(QDF_TRACE_LEVEL_ERROR,
-		       "%s: Invalid MAC passed from target, using MAC from ini file"
-		       MAC_ADDRESS_STR, __func__,
-		       MAC_ADDR_ARRAY(hdd_ctx->config->intfMacAddr[0].bytes));
-	}
-}
 
-#ifdef WLAN_FEATURE_LPSS
-static inline void hdd_is_lpass_supported(tMacOpenParameters *mac_openParms,
-						hdd_context_t *hdd_ctx)
+int hdd_update_cds_config_ftm(hdd_context_t *hdd_ctx)
 {
-	mac_openParms->is_lpass_enabled = hdd_ctx->config->enable_lpass_support;
-}
-#else
-static inline void hdd_is_lpass_supported(tMacOpenParameters *mac_openParms,
-						hdd_context_t *hdd_ctx)
-{ }
-#endif
-
-/**
- * wlan_ftm_cds_open() - Open the CDS Module in FTM mode
- * @p_cds_context: pointer to the global CDS context
- * @hddContextSize: Size of the HDD context to allocate.
- *
- * The wlan_ftm_cds_open() function opens the QDF Scheduler
- * Upon successful initialization:
- * - All CDS submodules should have been initialized
- * - The CDS scheduler should have opened
- * - All the WLAN SW components should have been opened. This includes MAC.
- *
- * Returns:
- *	QDF_STATUS_SUCCESS - Scheduler was successfully initialized and
- *	is ready to be used.
- *	QDF_STATUS_E_RESOURCES - System resources (other than memory)
- *	are unavailable to initialize the scheduler
- *	QDF_STATUS_E_FAILURE - Failure to initialize the scheduler
- */
-static QDF_STATUS wlan_ftm_cds_open(v_CONTEXT_t p_cds_context,
-				    uint32_t hddContextSize)
-{
-	QDF_STATUS vStatus = QDF_STATUS_SUCCESS;
-	int iter = 0;
-	tSirRetStatus sirStatus = eSIR_SUCCESS;
-	tMacOpenParameters mac_openParms;
-	p_cds_contextType gp_cds_context = (p_cds_contextType) p_cds_context;
-#if  defined(QCA_WIFI_FTM)
-	qdf_device_t qdf_ctx;
-	HTC_INIT_INFO htcInfo;
-	void *pHifContext = NULL;
-	void *pHtcContext = NULL;
-	struct ol_context *ol_ctx;
-#endif
-	hdd_context_t *hdd_ctx;
-
-	QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_INFO_HIGH,
-		  "%s: Opening CDS", __func__);
-
-	if (NULL == gp_cds_context) {
-		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
-			  "%s: Trying to open CDS without a PreOpen", __func__);
-		QDF_ASSERT(0);
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	/* Initialize the probe event */
-	if (qdf_event_create(&gp_cds_context->ProbeEvent) != QDF_STATUS_SUCCESS) {
-		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
-			  "%s: Unable to init probeEvent", __func__);
-		QDF_ASSERT(0);
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	if (qdf_event_create(&(gp_cds_context->wmaCompleteEvent)) !=
-	    QDF_STATUS_SUCCESS) {
-		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
-			  "%s: Unable to init wmaCompleteEvent", __func__);
-		QDF_ASSERT(0);
-
-		goto err_probe_event;
-	}
-
-	/* Initialize the free message queue */
-	vStatus = cds_mq_init(&gp_cds_context->freeVosMq);
-	if (!QDF_IS_STATUS_SUCCESS(vStatus)) {
+	struct cds_config_info *cds_cfg;
 
-		/* Critical Error ...  Cannot proceed further */
-		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
-			  "%s: Failed to initialize CDS free message queue %d",
-			  __func__, vStatus);
-		QDF_ASSERT(0);
-		goto err_wma_complete_event;
-	}
-
-	for (iter = 0; iter < CDS_CORE_MAX_MESSAGES; iter++) {
-		(gp_cds_context->aMsgWrappers[iter]).pVosMsg =
-			&(gp_cds_context->aMsgBuffers[iter]);
-		INIT_LIST_HEAD(&gp_cds_context->aMsgWrappers[iter].msgNode);
-		cds_mq_put(&gp_cds_context->freeVosMq,
-			   &(gp_cds_context->aMsgWrappers[iter]));
-	}
-
-	/* Now Open the CDS Scheduler */
-	vStatus = cds_sched_open(gp_cds_context, &gp_cds_context->qdf_sched,
-				 sizeof(cds_sched_context));
-
-	if (!QDF_IS_STATUS_SUCCESS(vStatus)) {
-		/* Critical Error ...  Cannot proceed further */
-		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
-			  "%s: Failed to open CDS Scheduler %d", __func__,
-			  vStatus);
-		QDF_ASSERT(0);
-		goto err_msg_queue;
-	}
-#if  defined(QCA_WIFI_FTM)
-	/* Initialize BMI and Download firmware */
-	pHifContext = cds_get_context(QDF_MODULE_ID_HIF);
-	if (!pHifContext) {
-		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL,
-			  "%s: failed to get HIF context", __func__);
-		goto err_sched_close;
-	}
-
-	ol_ctx = cds_get_context(QDF_MODULE_ID_BMI);
-	if (bmi_download_firmware(ol_ctx)) {
-		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL,
-			  "%s: BMI failed to download target", __func__);
-		goto err_bmi_close;
-	}
-
-	htcInfo.pContext = ol_ctx;
-	htcInfo.TargetFailure = ol_target_failure;
-	htcInfo.TargetSendSuspendComplete = wma_target_suspend_acknowledge;
-	qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE);
-
-	/* Create HTC */
-	gp_cds_context->htc_ctx =
-		htc_create(pHifContext, &htcInfo, qdf_ctx, hdd_get_conparam());
-	if (!gp_cds_context->htc_ctx) {
-		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL,
-			  "%s: Failed to Create HTC", __func__);
-		goto err_bmi_close;
-	}
-
-	if (bmi_done(ol_ctx)) {
-		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL,
-			  "%s: Failed to complete BMI phase", __func__);
-		goto err_htc_close;
-	}
-#endif /* QCA_WIFI_FTM */
-
-	/*Open the WMA module */
-	qdf_mem_set(&mac_openParms, sizeof(mac_openParms), 0);
-	mac_openParms.driverType = eDRIVER_TYPE_MFG;
-
-	hdd_ctx = (hdd_context_t *) (gp_cds_context->pHDDContext);
-	if ((NULL == hdd_ctx) || (NULL == hdd_ctx->config)) {
-		/* Critical Error ...  Cannot proceed further */
-		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
-			  "%s: Hdd Context is Null", __func__);
-		QDF_ASSERT(0);
-		goto err_htc_close;
-	}
-
-	mac_openParms.powersaveOffloadEnabled =
-		hdd_ctx->config->enablePowersaveOffload;
-
-	hdd_is_lpass_supported(&mac_openParms, hdd_ctx);
-
-	vStatus = wma_open(gp_cds_context,
-			   wlan_hdd_ftm_update_tgt_cfg, NULL, &mac_openParms);
-	if (!QDF_IS_STATUS_SUCCESS(vStatus)) {
-		/* Critical Error ...  Cannot proceed further */
-		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
-			  "%s: Failed to open WMA module %d", __func__,
-			  vStatus);
-		QDF_ASSERT(0);
-		goto err_htc_close;
-	}
-#if  defined(QCA_WIFI_FTM)
-	hdd_update_config(hdd_ctx);
-
-	pHtcContext = cds_get_context(QDF_MODULE_ID_HTC);
-	if (!pHtcContext) {
-		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL,
-			  "%s: failed to get HTC context", __func__);
-		goto err_wma_close;
-	}
-	if (htc_wait_target(pHtcContext)) {
-		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL,
-			  "%s: Failed to complete BMI phase", __func__);
-		goto err_wma_close;
+	cds_cfg = qdf_mem_malloc(sizeof(*cds_cfg));
+	if (!cds_cfg) {
+		hdd_err("failed to allocate cds config");
+		return -ENOMEM;
 	}
-#endif
-
-	/* Now proceed to open the MAC */
 
+	cds_cfg->driver_type = eDRIVER_TYPE_MFG;
+	cds_cfg->powersave_offload_enabled =
+			hdd_ctx->config->enablePowersaveOffload;
+	hdd_lpass_populate_cds_config(cds_cfg, hdd_ctx);
 	/* UMA is supported in hardware for performing the
 	 * frame translation 802.11 <-> 802.3
 	 */
-	mac_openParms.frameTransRequired = 1;
-
-	sirStatus =
-		mac_open(&(gp_cds_context->pMACContext),
-			 gp_cds_context->pHDDContext,
-			 &mac_openParms);
-
-	if (eSIR_SUCCESS != sirStatus) {
-		/* Critical Error ...  Cannot proceed further */
-		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
-			  "%s: Failed to open MAC %d", __func__, sirStatus);
-		QDF_ASSERT(0);
-		goto err_wma_close;
-	}
-#ifndef QCA_WIFI_FTM
-	/* Now proceed to open the SME */
-	vStatus = sme_open(gp_cds_context->pMACContext);
-	if (!QDF_IS_STATUS_SUCCESS(vStatus)) {
-		/* Critical Error ...  Cannot proceed further */
-		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
-			  "%s: Failed to open SME %d", __func__, vStatus);
-		goto err_mac_close;
-	}
-
-	vStatus = sme_init_chan_list(gp_cds_context->pMACContext,
-				     hdd_ctx->reg.alpha2, hdd_ctx->reg.cc_src);
-	if (!QDF_IS_STATUS_SUCCESS(vStatus)) {
-		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
-			  "%s: Failed to init sme channel list", __func__);
-	} else {
-		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_INFO_HIGH,
-			  "%s: CDS successfully Opened", __func__);
-		return QDF_STATUS_SUCCESS;
-	}
-#else
-	return QDF_STATUS_SUCCESS;
-#endif
-
-#ifndef QCA_WIFI_FTM
-err_mac_close:
-#endif
-	mac_close(gp_cds_context->pMACContext);
-
-err_wma_close:
-	wma_close(gp_cds_context);
-
-err_htc_close:
-#if  defined(QCA_WIFI_FTM)
-	if (gp_cds_context->htc_ctx) {
-		htc_destroy(gp_cds_context->htc_ctx);
-		gp_cds_context->htc_ctx = NULL;
-	}
-
-err_bmi_close:
-	bmi_cleanup(ol_ctx);
-#endif /* QCA_WIFI_FTM */
-
-err_sched_close:
-	cds_sched_close(gp_cds_context);
-err_msg_queue:
-	cds_mq_deinit(&gp_cds_context->freeVosMq);
-
-err_wma_complete_event:
-	qdf_event_destroy(&gp_cds_context->wmaCompleteEvent);
-
-err_probe_event:
-	qdf_event_destroy(&gp_cds_context->ProbeEvent);
-
-	return QDF_STATUS_E_FAILURE;
-
-} /* wlan_ftm_cds_open() */
-
-/**
- * wlan_ftm_cds_close() - Close the QDF Module in FTM mode
- * @cds_context:  context of cds
- *
- * The wlan_ftm_cds_close() function closes the QDF Module
- *
- * Return: QDF_STATUS_SUCCESS - successfully closed
- */
-static QDF_STATUS wlan_ftm_cds_close(v_CONTEXT_t cds_context)
-{
-	QDF_STATUS qdf_status;
-	p_cds_contextType gp_cds_context = (p_cds_contextType) cds_context;
-
-#ifndef QCA_WIFI_FTM
-	qdf_status = sme_close(((p_cds_contextType) cds_context)->pMACContext);
-	if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
-		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
-			  "%s: Failed to close SME %d", __func__, qdf_status);
-		QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status));
-	}
-#endif
-
-	qdf_status = mac_close(((p_cds_contextType) cds_context)->pMACContext);
-	if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
-		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
-			  "%s: Failed to close MAC %d", __func__, qdf_status);
-		QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status));
-	}
-
-	((p_cds_contextType) cds_context)->pMACContext = NULL;
-
-
-	qdf_status = wma_close(cds_context);
-	if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
-		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
-			  "%s: Failed to close WMA %d", __func__, qdf_status);
-		QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status));
-	}
-#if  defined(QCA_WIFI_FTM)
-	if (gp_cds_context->htc_ctx) {
-		htc_stop(gp_cds_context->htc_ctx);
-		htc_destroy(gp_cds_context->htc_ctx);
-		gp_cds_context->htc_ctx = NULL;
-	}
-	qdf_status = wma_wmi_service_close(cds_context);
-	if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
-		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
-			  "%s: Failed to close wma_wmi_service", __func__);
-		QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status));
-	}
-
-	hif_disable_isr(gp_cds_context->pHIFContext);
-#endif
-
-	cds_mq_deinit(&((p_cds_contextType) cds_context)->freeVosMq);
-
-	qdf_status = qdf_event_destroy(&gp_cds_context->ProbeEvent);
-	if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
-		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
-			  "%s: Failed to destroy ProbeEvent %d", __func__,
-			  qdf_status);
-		QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status));
-	}
-
-	qdf_status = qdf_event_destroy(&gp_cds_context->wmaCompleteEvent);
-	if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
-		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
-			  "%s: Failed to destroy wmaCompleteEvent %d", __func__,
-			  qdf_status);
-		QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status));
-	}
-
-	return QDF_STATUS_SUCCESS;
-}
-
-/**
- * cds_ftm_pre_start() - Pre-start CDS Module in FTM Mode
- * @cds_context: The CDS context
- *
- * The cds_ftm_pre_start() function performs all pre-start activities
- * in FTM mode.
- *
- * Return: QDF_STATUS_SUCCESS if pre-start was successful, an
- *	   appropriate QDF_STATUS_E_** error code otherwise
- */
-static QDF_STATUS cds_ftm_pre_start(v_CONTEXT_t cds_context)
-{
-	QDF_STATUS vStatus = QDF_STATUS_SUCCESS;
-	QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
-	p_cds_contextType p_cds_context = (p_cds_contextType) cds_context;
-#if  defined(QCA_WIFI_FTM)
-	p_cds_contextType gp_cds_context =
-		cds_get_global_context();
-#endif
-
-	QDF_TRACE(QDF_MODULE_ID_SYS, QDF_TRACE_LEVEL_INFO, "cds prestart");
-	if (NULL == p_cds_context->pWMAContext) {
-		QDF_ASSERT(0);
-		QDF_TRACE(QDF_MODULE_ID_SYS, QDF_TRACE_LEVEL_ERROR,
-			  "%s: WMA NULL context", __func__);
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	/* Reset WMA wait event */
-	qdf_event_reset(&p_cds_context->wmaCompleteEvent);
-
-	/*call WMA pre start */
-	vStatus = wma_pre_start(p_cds_context);
-	if (!QDF_IS_STATUS_SUCCESS(vStatus)) {
-		QDF_TRACE(QDF_MODULE_ID_SYS, QDF_TRACE_LEVEL_ERROR,
-			  "Failed to WMA prestart ");
-		QDF_ASSERT(0);
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	/* Need to update time out of complete */
-	qdf_status = qdf_wait_single_event(&p_cds_context->wmaCompleteEvent,
-					HDD_FTM_WMA_PRE_START_TIMEOUT);
-	if (qdf_status != QDF_STATUS_SUCCESS) {
-		if (qdf_status == QDF_STATUS_E_TIMEOUT) {
-			QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
-				  "%s: Timeout occurred before WMA complete",
-				  __func__);
-		} else {
-			QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
-				  "%s: wma_pre_start reporting  other error",
-				  __func__);
-		}
-		QDF_ASSERT(0);
-		return QDF_STATUS_E_FAILURE;
-	}
-#if  defined(QCA_WIFI_FTM)
-	vStatus = htc_start(gp_cds_context->htc_ctx);
-	if (!QDF_IS_STATUS_SUCCESS(vStatus)) {
-		QDF_TRACE(QDF_MODULE_ID_SYS, QDF_TRACE_LEVEL_FATAL,
-			  "Failed to Start HTC");
-		QDF_ASSERT(0);
-		return QDF_STATUS_E_FAILURE;
-	}
-	wma_wait_for_ready_event(gp_cds_context->pWMAContext);
-#endif /* QCA_WIFI_FTM */
-
-	return QDF_STATUS_SUCCESS;
-}
-
-/**
- * wlan_hdd_ftm_open() - Open HDD in FTM Mode
- * @hdd_ctx: global HDD context
- *
- * The function hdd_wlan_startup calls this function to initialize the
- * FTM specific modules.
- *
- * Return: 0 on success, non-zero on error
- */
-int wlan_hdd_ftm_open(hdd_context_t *hdd_ctx)
-{
-	QDF_STATUS vStatus = QDF_STATUS_SUCCESS;
-	p_cds_contextType p_cds_context = NULL;
-
-	QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_INFO_HIGH,
-		  "%s: Opening CDS", __func__);
-
-	p_cds_context = cds_get_global_context();
-
-	if (NULL == p_cds_context) {
-		QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
-			  "%s: Trying to open CDS without a PreOpen", __func__);
-		QDF_ASSERT(0);
-		goto err_qdf_status_failure;
-	}
-
-	vStatus = wlan_ftm_cds_open(p_cds_context, 0);
-
-	if (!QDF_IS_STATUS_SUCCESS(vStatus)) {
-		hddLog(QDF_TRACE_LEVEL_FATAL, "%s: cds_open failed", __func__);
-		goto err_qdf_status_failure;
-	}
-
-	/*
-	 * only needed to start WMA, which happens in wlan_hdd_ftm_start()
-	 */
-
-	/* Save the hal context in Adapter */
-	hdd_ctx->hHal =
-		(tHalHandle) cds_get_context(QDF_MODULE_ID_SME);
-
-	if (NULL == hdd_ctx->hHal) {
-		hddLog(QDF_TRACE_LEVEL_ERROR, "%s: HAL context is null",
-		       __func__);
-		goto err_ftm_close;
-	}
-
-	return 0;
-
-err_ftm_close:
-	wlan_ftm_cds_close(p_cds_context);
-
-err_qdf_status_failure:
-	return -EPERM;
-}
-
-/**
- * hdd_ftm_service_registration() - Register FTM service
- * @hdd_ctx: global HDD context
- *
- * Return: 0 on success, non-zero on failure
- */
-static int hdd_ftm_service_registration(hdd_context_t *hdd_ctx)
-{
-	hdd_adapter_t *adapter;
-	adapter = hdd_open_adapter(hdd_ctx, QDF_FTM_MODE, "wlan%d",
-				    wlan_hdd_get_intf_addr(hdd_ctx),
-					NET_NAME_UNKNOWN, false);
-	if (NULL == adapter) {
-		hddLog(QDF_TRACE_LEVEL_ERROR, "%s: hdd_open_adapter failed",
-		       __func__);
-		goto err_adapter_open_failure;
-	}
-
-	hdd_ctx->ftm.ftm_state = WLAN_FTM_INITIALIZED;
+	cds_cfg->frame_xln_reqd = 1;
+	cds_cfg->sub_20_channel_width = WLAN_SUB_20_CH_WIDTH_NONE;
+	cds_init_ini_config(cds_cfg);
 
 	return 0;
-
-err_adapter_open_failure:
-
-	return -EPERM;
 }
 
-/**
- * wlan_ftm_stop() - Stop HDD in FTM mode
- * @hdd_ctx: pointer to HDD context
- *
- * This function stops the following modules
- * WMA
- *
- * Return: 0 on success, non-zero on failure
- */
-static int wlan_ftm_stop(hdd_context_t *hdd_ctx)
-{
-	if (hdd_ctx->ftm.ftm_state != WLAN_FTM_STARTED) {
-		hddLog(LOGP, FL("FTM has not started. No need to stop"));
-		return -EPERM;
-	}
-	wma_stop(hdd_ctx->pcds_context, HAL_STOP_TYPE_RF_KILL);
-	return 0;
-}
-
-/**
- * wlan_hdd_ftm_close() - Close HDD in FTM mode
- * @hdd_ctx: pointer to HDD context
- *
- * Return: 0 on success, non-zero on failure
- */
-int wlan_hdd_ftm_close(hdd_context_t *hdd_ctx)
-{
-	QDF_STATUS qdf_status;
-	v_CONTEXT_t cds_context = hdd_ctx->pcds_context;
-
-	hdd_adapter_t *adapter = hdd_get_adapter(hdd_ctx, QDF_FTM_MODE);
-	ENTER();
-	if (adapter == NULL) {
-		QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_FATAL,
-			  "%s:adapter is NULL", __func__);
-		return -ENXIO;
-	}
-
-	if (WLAN_FTM_STARTED == hdd_ctx->ftm.ftm_state) {
-		QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_FATAL,
-			  "%s: Ftm has been started. stopping ftm", __func__);
-		wlan_ftm_stop(hdd_ctx);
-	}
-
-	hdd_close_all_adapters(hdd_ctx, false);
-
-	qdf_status = cds_sched_close(cds_context);
-	if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
-		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
-			  "%s: Failed to close CDS Scheduler", __func__);
-		QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status));
-	}
-	/* Close CDS */
-	wlan_ftm_cds_close(cds_context);
-
-#if defined(QCA_WIFI_FTM) && defined(LINUX_QCMBR)
-	spin_lock_bh(&qcmbr_queue_lock);
-	if (!list_empty(&qcmbr_queue_head)) {
-		qcmbr_queue_t *msg_buf, *tmp_buf;
-		list_for_each_entry_safe(msg_buf, tmp_buf, &qcmbr_queue_head,
-					 list) {
-			list_del(&msg_buf->list);
-			kfree(msg_buf);
-		}
-	}
-	spin_unlock_bh(&qcmbr_queue_lock);
-#endif
-
-	return 0;
-
-}
-
-
 /**
  * hdd_ftm_mc_process_msg() - Process FTM mailbox message
  * @message: FTM response message
@@ -710,7 +154,7 @@ int wlan_hdd_ftm_close(hdd_context_t *hdd_ctx)
  *
  * Return: void
  */
-static void hdd_ftm_mc_process_msg(void *message)
+void hdd_ftm_mc_process_msg(void *message)
 {
 	void *data;
 	uint32_t data_len;
@@ -733,107 +177,6 @@ static void hdd_ftm_mc_process_msg(void *message)
 	return;
 }
 
-/**
- * wlan_hdd_ftm_start() - Start HDD in FTM mode
- * @hdd_ctx: Global HDD context
- *
- * This function  starts the following modules.
- * 1) WMA Start.
- * 2) HTC Start.
- * 3) MAC Start to download the firmware.
- *
- * Return: 0 for success, non zero for failure
- */
-static int wlan_hdd_ftm_start(hdd_context_t *hdd_ctx)
-{
-	QDF_STATUS vStatus = QDF_STATUS_SUCCESS;
-	p_cds_contextType p_cds_context =
-		(p_cds_contextType) (hdd_ctx->pcds_context);
-
-	if (WLAN_FTM_STARTED == hdd_ctx->ftm.ftm_state) {
-		return 0;
-	}
-
-	QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_INFO,
-		  "%s: Starting CLD SW", __func__);
-
-	/* We support only one instance for now ... */
-	if (p_cds_context == NULL) {
-		QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
-			  "%s: mismatch in context", __func__);
-		goto err_status_failure;
-	}
-
-	if (p_cds_context->pMACContext == NULL) {
-		QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
-			  "%s: MAC NULL context", __func__);
-		goto err_status_failure;
-	}
-
-	/* Vos preStart is calling */
-	if (!QDF_IS_STATUS_SUCCESS(cds_ftm_pre_start(hdd_ctx->pcds_context))) {
-		hddLog(QDF_TRACE_LEVEL_FATAL, "%s: cds_pre_enable failed",
-		       __func__);
-		goto err_status_failure;
-	}
-
-	sme_register_ftm_msg_processor(hdd_ctx->hHal, hdd_ftm_mc_process_msg);
-
-	vStatus = wma_start(p_cds_context);
-	if (vStatus != QDF_STATUS_SUCCESS) {
-		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
-			  "%s: Failed to start WMA", __func__);
-		goto err_status_failure;
-	}
-
-	QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_INFO,
-		  "%s: MAC correctly started", __func__);
-
-	if (hdd_ftm_service_registration(hdd_ctx)) {
-		QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
-			  "%s: failed", __func__);
-		goto err_ftm_service_reg;
-	}
-
-	hdd_ctx->ftm.ftm_state = WLAN_FTM_STARTED;
-
-	return 0;
-
-err_ftm_service_reg:
-	wlan_hdd_ftm_close(hdd_ctx);
-
-err_status_failure:
-
-	return -EPERM;
-
-}
-
-#if  defined(QCA_WIFI_FTM)
-/**
- * hdd_ftm_start() - Start HDD in FTM mode
- * @hdd_ctx: Global HDD context
- *
- * Return: 0 for success, non zero for failure
- */
-int hdd_ftm_start(hdd_context_t *hdd_ctx)
-{
-	return wlan_hdd_ftm_start(hdd_ctx);
-}
-#endif
-
-#if  defined(QCA_WIFI_FTM)
-/**
- * hdd_ftm_stop() - Stop HDD in FTM mode
- * @hdd_ctx: Global HDD context
- *
- * Return: 0 for success, non zero for failure
- */
-int hdd_ftm_stop(hdd_context_t *hdd_ctx)
-{
-	return wlan_ftm_stop(hdd_ctx);
-}
-#endif
-
 #if  defined(QCA_WIFI_FTM)
 #if defined(LINUX_QCMBR)
 /**
@@ -1023,16 +366,14 @@ QDF_STATUS wlan_hdd_ftm_testmode_cmd(void *data, int len)
 		   qdf_mem_malloc(sizeof(*cmd_data));
 
 	if (!cmd_data) {
-		QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
-			  ("Failed to allocate FTM command data"));
+		hdd_err("Failed to allocate FTM command data");
 		return QDF_STATUS_E_NOMEM;
 	}
 
 	cmd_data->data = qdf_mem_malloc(len);
 
 	if (!cmd_data->data) {
-		QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
-			  ("Failed to allocate FTM command data buffer"));
+		hdd_err("Failed to allocate FTM command data buffer");
 		qdf_mem_free(cmd_data);
 		return QDF_STATUS_E_NOMEM;
 	}

+ 87 - 100
core/hdd/src/wlan_hdd_green_ap.c

@@ -97,16 +97,16 @@ struct hdd_green_ap_ctx {
 };
 
 /**
- * hdd_wlan_green_ap_update() - update the current State and Event
+ * hdd_green_ap_update() - update the current State and Event
  * @hdd_ctx: Global HDD context
  * @state: New state
  * @event: New event
  *
  * Return: none
  */
-static void hdd_wlan_green_ap_update(struct hdd_context_s *hdd_ctx,
-				     enum hdd_green_ap_ps_state state,
-				     enum hdd_green_ap_event event)
+static void hdd_green_ap_update(struct hdd_context_s *hdd_ctx,
+				enum hdd_green_ap_ps_state state,
+				enum hdd_green_ap_event event)
 {
 	struct hdd_green_ap_ctx *green_ap = hdd_ctx->green_ap_ctx;
 
@@ -115,14 +115,13 @@ static void hdd_wlan_green_ap_update(struct hdd_context_s *hdd_ctx,
 }
 
 /**
- * hdd_wlan_green_ap_enable() - Send Green AP configuration to firmware
+ * hdd_green_ap_enable() - Send Green AP configuration to firmware
  * @adapter: Adapter upon which Green AP is being configured
  * @enable: Flag which indicates if Green AP is being enabled or disabled
  *
  * Return: 0 upon success, non-zero upon failure
  */
-static int hdd_wlan_green_ap_enable(hdd_adapter_t *adapter,
-				    uint8_t enable)
+static int hdd_green_ap_enable(hdd_adapter_t *adapter, uint8_t enable)
 {
 	int ret;
 
@@ -136,14 +135,14 @@ static int hdd_wlan_green_ap_enable(hdd_adapter_t *adapter,
 }
 
 /**
- * hdd_wlan_green_ap_mc() - Green AP state machine
+ * hdd_green_ap_mc() - Green AP state machine
  * @hdd_ctx: HDD global context
  * @event: New event being processed
  *
  * Return: none
  */
-static void hdd_wlan_green_ap_mc(struct hdd_context_s *hdd_ctx,
-				 enum hdd_green_ap_event event)
+static void hdd_green_ap_mc(struct hdd_context_s *hdd_ctx,
+			    enum hdd_green_ap_event event)
 {
 	struct hdd_green_ap_ctx *green_ap;
 	hdd_adapter_t *adapter;
@@ -187,9 +186,9 @@ static void hdd_wlan_green_ap_mc(struct hdd_context_s *hdd_ctx,
 	/* Confirm that power save is enabled before doing state transitions */
 	if (!green_ap->ps_enable) {
 		hdd_notice("Green-AP is disabled");
-		hdd_wlan_green_ap_update(hdd_ctx,
-					 GREEN_AP_PS_IDLE_STATE,
-					 GREEN_AP_PS_WAIT_EVENT);
+		hdd_green_ap_update(hdd_ctx,
+				    GREEN_AP_PS_IDLE_STATE,
+				    GREEN_AP_PS_WAIT_EVENT);
 		goto done;
 	}
 
@@ -202,16 +201,16 @@ static void hdd_wlan_green_ap_mc(struct hdd_context_s *hdd_ctx,
 	/* handle the green ap ps state */
 	switch (green_ap->ps_state) {
 	case GREEN_AP_PS_IDLE_STATE:
-		hdd_wlan_green_ap_update(hdd_ctx,
-					 GREEN_AP_PS_OFF_STATE,
-					 GREEN_AP_PS_WAIT_EVENT);
+		hdd_green_ap_update(hdd_ctx,
+				    GREEN_AP_PS_OFF_STATE,
+				    GREEN_AP_PS_WAIT_EVENT);
 		break;
 
 	case GREEN_AP_PS_OFF_STATE:
 		if (!green_ap->num_nodes) {
-			hdd_wlan_green_ap_update(hdd_ctx,
-						 GREEN_AP_PS_WAIT_STATE,
-						 GREEN_AP_PS_WAIT_EVENT);
+			hdd_green_ap_update(hdd_ctx,
+					    GREEN_AP_PS_WAIT_STATE,
+					    GREEN_AP_PS_WAIT_EVENT);
 			qdf_mc_timer_start(&green_ap->ps_timer,
 					   green_ap->ps_delay_time);
 		}
@@ -219,44 +218,44 @@ static void hdd_wlan_green_ap_mc(struct hdd_context_s *hdd_ctx,
 
 	case GREEN_AP_PS_WAIT_STATE:
 		if (!green_ap->num_nodes) {
-			hdd_wlan_green_ap_update(hdd_ctx,
-						 GREEN_AP_PS_ON_STATE,
-						 GREEN_AP_PS_WAIT_EVENT);
+			hdd_green_ap_update(hdd_ctx,
+					    GREEN_AP_PS_ON_STATE,
+					    GREEN_AP_PS_WAIT_EVENT);
 
-			hdd_wlan_green_ap_enable(adapter, 1);
+			hdd_green_ap_enable(adapter, 1);
 
 			if (green_ap->ps_on_time) {
-				hdd_wlan_green_ap_update(hdd_ctx,
-							 0,
-							 GREEN_AP_PS_WAIT_EVENT);
+				hdd_green_ap_update(hdd_ctx,
+						    0,
+						    GREEN_AP_PS_WAIT_EVENT);
 				qdf_mc_timer_start(&green_ap->ps_timer,
 						   green_ap->ps_on_time);
 			}
 		} else {
-			hdd_wlan_green_ap_update(hdd_ctx,
-						 GREEN_AP_PS_OFF_STATE,
-						 GREEN_AP_PS_WAIT_EVENT);
+			hdd_green_ap_update(hdd_ctx,
+					    GREEN_AP_PS_OFF_STATE,
+					    GREEN_AP_PS_WAIT_EVENT);
 		}
 		break;
 
 	case GREEN_AP_PS_ON_STATE:
 		if (green_ap->num_nodes) {
-			if (hdd_wlan_green_ap_enable(adapter, 0)) {
+			if (hdd_green_ap_enable(adapter, 0)) {
 				hdd_err("FAILED TO SET GREEN-AP mode");
 				goto done;
 			}
-			hdd_wlan_green_ap_update(hdd_ctx,
-						 GREEN_AP_PS_OFF_STATE,
-						 GREEN_AP_PS_WAIT_EVENT);
+			hdd_green_ap_update(hdd_ctx,
+					    GREEN_AP_PS_OFF_STATE,
+					    GREEN_AP_PS_WAIT_EVENT);
 		} else if ((green_ap->ps_event == GREEN_AP_PS_WAIT_EVENT)
 			   && (green_ap->ps_on_time)) {
 
 			/* ps_on_time timeout, switch to ps off */
-			hdd_wlan_green_ap_update(hdd_ctx,
-						 GREEN_AP_PS_WAIT_STATE,
-						 GREEN_AP_PS_ON_EVENT);
+			hdd_green_ap_update(hdd_ctx,
+					    GREEN_AP_PS_WAIT_STATE,
+					    GREEN_AP_PS_ON_EVENT);
 
-			if (hdd_wlan_green_ap_enable(adapter, 0)) {
+			if (hdd_green_ap_enable(adapter, 0)) {
 				hdd_err("FAILED TO SET GREEN-AP mode");
 				goto done;
 			}
@@ -268,8 +267,8 @@ static void hdd_wlan_green_ap_mc(struct hdd_context_s *hdd_ctx,
 
 	default:
 		hdd_err("invalid state %d", green_ap->ps_state);
-		hdd_wlan_green_ap_update(hdd_ctx, GREEN_AP_PS_OFF_STATE,
-					 GREEN_AP_PS_WAIT_EVENT);
+		hdd_green_ap_update(hdd_ctx, GREEN_AP_PS_OFF_STATE,
+				    GREEN_AP_PS_WAIT_EVENT);
 		break;
 	}
 
@@ -278,12 +277,12 @@ done:
 }
 
 /**
- * hdd_wlan_green_ap_timer_fn() - Green AP Timer handler
+ * hdd_green_ap_timer_fn() - Green AP Timer handler
  * @ctx: Global HDD context
  *
  * Return: none
  */
-static void hdd_wlan_green_ap_timer_fn(void *ctx)
+static void hdd_green_ap_timer_fn(void *ctx)
 {
 	struct hdd_context_s *hdd_ctx = ctx;
 	struct hdd_green_ap_ctx *green_ap;
@@ -293,16 +292,16 @@ static void hdd_wlan_green_ap_timer_fn(void *ctx)
 
 	green_ap = hdd_ctx->green_ap_ctx;
 	if (green_ap)
-		hdd_wlan_green_ap_mc(hdd_ctx, green_ap->ps_event);
+		hdd_green_ap_mc(hdd_ctx, green_ap->ps_event);
 }
 
 /**
- * hdd_wlan_green_ap_attach() - Attach Green AP context to HDD context
+ * hdd_green_ap_attach() - Attach Green AP context to HDD context
  * @hdd_ctx: Global HDD contect
  *
  * Return: QDF_STATUS_SUCCESS on success, otherwise QDF_STATUS_E_** error
  */
-static QDF_STATUS hdd_wlan_green_ap_attach(struct hdd_context_s *hdd_ctx)
+static QDF_STATUS hdd_green_ap_attach(struct hdd_context_s *hdd_ctx)
 {
 	struct hdd_green_ap_ctx *green_ap;
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
@@ -325,7 +324,7 @@ static QDF_STATUS hdd_wlan_green_ap_attach(struct hdd_context_s *hdd_ctx)
 
 	qdf_mc_timer_init(&green_ap->ps_timer,
 			  QDF_TIMER_TYPE_SW,
-			  hdd_wlan_green_ap_timer_fn, hdd_ctx);
+			  hdd_green_ap_timer_fn, hdd_ctx);
 
 error:
 	hdd_ctx->green_ap_ctx = green_ap;
@@ -335,12 +334,12 @@ error:
 }
 
 /**
- * hdd_wlan_green_ap_deattach() - Detach Green AP context from HDD context
+ * hdd_green_ap_deattach() - Detach Green AP context from HDD context
  * @hdd_ctx: Global HDD contect
  *
  * Return: QDF_STATUS_SUCCESS on success, otherwise QDF_STATUS_E_** error
  */
-static QDF_STATUS hdd_wlan_green_ap_deattach(struct hdd_context_s *hdd_ctx)
+static QDF_STATUS hdd_green_ap_deattach(struct hdd_context_s *hdd_ctx)
 {
 	struct hdd_green_ap_ctx *green_ap = hdd_ctx->green_ap_ctx;
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
@@ -373,37 +372,31 @@ done:
 	return status;
 }
 
-/**
- * hdd_wlan_green_ap_init() - Initialize Green AP feature
- * @hdd_ctx: HDD global context
- *
- * Return: none
+/*
+ * hdd_green_ap_init() - Initialize Green AP feature
+ * (public function documented in wlan_hdd_green_ap.h)
  */
-void hdd_wlan_green_ap_init(struct hdd_context_s *hdd_ctx)
+void hdd_green_ap_init(struct hdd_context_s *hdd_ctx)
 {
-	if (!QDF_IS_STATUS_SUCCESS(hdd_wlan_green_ap_attach(hdd_ctx)))
+	if (!QDF_IS_STATUS_SUCCESS(hdd_green_ap_attach(hdd_ctx)))
 		hdd_err("Failed to allocate Green-AP resource");
 }
 
-/**
- * hdd_wlan_green_ap_deinit() - De-initialize Green AP feature
- * @hdd_ctx: HDD global context
- *
- * Return: none
+/*
+ * hdd_green_ap_deinit() - De-initialize Green AP feature
+ * (public function documented in wlan_hdd_green_ap.h)
  */
-void hdd_wlan_green_ap_deinit(struct hdd_context_s *hdd_ctx)
+void hdd_green_ap_deinit(struct hdd_context_s *hdd_ctx)
 {
-	if (!QDF_IS_STATUS_SUCCESS(hdd_wlan_green_ap_deattach(hdd_ctx)))
+	if (!QDF_IS_STATUS_SUCCESS(hdd_green_ap_deattach(hdd_ctx)))
 		hdd_err("Cannot deallocate Green-AP resource");
 }
 
-/**
- * hdd_wlan_green_ap_start_bss() - Notify Green AP of Start BSS event
- * @hdd_ctx: HDD global context
- *
- * Return: none
+/*
+ * hdd_green_ap_start_bss() - Notify Green AP of Start BSS event
+ * (public function documented in wlan_hdd_green_ap.h)
  */
-void hdd_wlan_green_ap_start_bss(struct hdd_context_s *hdd_ctx)
+void hdd_green_ap_start_bss(struct hdd_context_s *hdd_ctx)
 {
 	struct hdd_config *cfg = hdd_ctx->config;
 
@@ -420,7 +413,7 @@ void hdd_wlan_green_ap_start_bss(struct hdd_context_s *hdd_ctx)
 					       cfg->egap_wait_time,
 					       cfg->egap_feature_flag)) {
 			/* EGAP is enabled, disable host GAP */
-			hdd_wlan_green_ap_mc(hdd_ctx, GREEN_AP_PS_STOP_EVENT);
+			hdd_green_ap_mc(hdd_ctx, GREEN_AP_PS_STOP_EVENT);
 			goto exit;
 		}
 		/* fall through, if send_egap_conf_params() failed,
@@ -430,9 +423,9 @@ void hdd_wlan_green_ap_start_bss(struct hdd_context_s *hdd_ctx)
 
 	if (!(QDF_STA_MASK & hdd_ctx->concurrency_mode) &&
 	    cfg->enable2x2 && cfg->enableGreenAP) {
-		hdd_wlan_green_ap_mc(hdd_ctx, GREEN_AP_PS_START_EVENT);
+		hdd_green_ap_mc(hdd_ctx, GREEN_AP_PS_START_EVENT);
 	} else {
-		hdd_wlan_green_ap_mc(hdd_ctx, GREEN_AP_PS_STOP_EVENT);
+		hdd_green_ap_mc(hdd_ctx, GREEN_AP_PS_STOP_EVENT);
 		hdd_notice("Green-AP: is disabled, due to sta_concurrency: %d, enable2x2: %d, enableGreenAP: %d",
 			   QDF_STA_MASK & hdd_ctx->concurrency_mode,
 			   cfg->enable2x2, cfg->enableGreenAP);
@@ -441,50 +434,44 @@ exit:
 	return;
 }
 
-/**
- * hdd_wlan_green_ap_stop_bss() - Notify Green AP of Stop BSS event
- * @hdd_ctx: HDD global context
- *
- * Return: none
+/*
+ * hdd_green_ap_stop_bss() - Notify Green AP of Stop BSS event
+ * (public function documented in wlan_hdd_green_ap.h)
  */
-void hdd_wlan_green_ap_stop_bss(struct hdd_context_s *hdd_ctx)
+void hdd_green_ap_stop_bss(struct hdd_context_s *hdd_ctx)
 {
-	hdd_wlan_green_ap_mc(hdd_ctx, GREEN_AP_PS_STOP_EVENT);
+	hdd_green_ap_mc(hdd_ctx, GREEN_AP_PS_STOP_EVENT);
 }
 
-/**
- * hdd_wlan_green_ap_add_sta() - Notify Green AP of Add Station  event
- * @hdd_ctx: HDD global context
- *
- * Return: none
+/*
+ * hdd_green_ap_add_sta() - Notify Green AP of Add Station event
+ * (public function documented in wlan_hdd_green_ap.h)
  */
-void hdd_wlan_green_ap_add_sta(struct hdd_context_s *hdd_ctx)
+void hdd_green_ap_add_sta(struct hdd_context_s *hdd_ctx)
 {
-	hdd_wlan_green_ap_mc(hdd_ctx, GREEN_AP_ADD_STA_EVENT);
+	hdd_green_ap_mc(hdd_ctx, GREEN_AP_ADD_STA_EVENT);
 }
 
-/**
- * hdd_wlan_green_ap_del_sta() - Notify Green AP of Delete Station event
- * @hdd_ctx: HDD global context
- *
- * Return: none
+/*
+ * hdd_green_ap_del_sta() - Notify Green AP of Delete Station event
+ * (public function documented in wlan_hdd_green_ap.h)
  */
-void hdd_wlan_green_ap_del_sta(struct hdd_context_s *hdd_ctx)
+void hdd_green_ap_del_sta(struct hdd_context_s *hdd_ctx)
 {
-	hdd_wlan_green_ap_mc(hdd_ctx, GREEN_AP_DEL_STA_EVENT);
+	hdd_green_ap_mc(hdd_ctx, GREEN_AP_DEL_STA_EVENT);
 }
 
-/**
- * hdd_wlan_set_egap_support() - helper function to set egap support flag
- * @hdd_ctx:   pointer to hdd context
- * @param:     pointer to target configuration
+/*
+ * hdd_green_ap_target_config() - Handle Green AP target configuration
+ * (public function documented in wlan_hdd_green_ap.h)
  *
- * Return:     None
+ * Implementation notes:
+ * Target indicates whether or not Enhanced Green AP (EGAP) is supported
  */
-void hdd_wlan_set_egap_support(hdd_context_t *hdd_ctx, void *param)
+void hdd_green_ap_target_config(struct hdd_context_s *hdd_ctx,
+				struct wma_tgt_cfg *target_config)
 {
-	struct wma_tgt_cfg *cfg = (struct wma_tgt_cfg *) param;
+	struct hdd_green_ap_ctx *green_ap = hdd_ctx->green_ap_ctx;
 
-	if (hdd_ctx && cfg)
-		hdd_ctx->green_ap_ctx->egap_support = cfg->egap_support;
+	green_ap->egap_support = target_config->egap_support;
 }

+ 72 - 17
core/hdd/src/wlan_hdd_green_ap.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -35,24 +35,79 @@
  */
 
 struct hdd_context_s;
+struct wma_tgt_cfg;
 
 #ifdef FEATURE_GREEN_AP
-void hdd_wlan_green_ap_init(struct hdd_context_s *hdd_ctx);
-void hdd_wlan_green_ap_deinit(struct hdd_context_s *hdd_ctx);
-void hdd_wlan_green_ap_start_bss(struct hdd_context_s *hdd_ctx);
-void hdd_wlan_green_ap_stop_bss(struct hdd_context_s *hdd_ctx);
-void hdd_wlan_green_ap_add_sta(struct hdd_context_s *hdd_ctx);
-void hdd_wlan_green_ap_del_sta(struct hdd_context_s *hdd_ctx);
-void hdd_wlan_set_egap_support(struct hdd_context_s *hdd_ctx, void *param);
-#else
-static inline void hdd_wlan_green_ap_init(struct hdd_context_s *hdd_ctx) {}
-static inline void hdd_wlan_green_ap_deinit(struct hdd_context_s *hdd_ctx) {}
-static inline void hdd_wlan_green_ap_start_bss(struct hdd_context_s *hdd_ctx) {}
-static inline void hdd_wlan_green_ap_stop_bss(struct hdd_context_s *hdd_ctx) {}
-static inline void hdd_wlan_green_ap_add_sta(struct hdd_context_s *hdd_ctx) {}
-static inline void hdd_wlan_green_ap_del_sta(struct hdd_context_s *hdd_ctx) {}
-static inline void hdd_wlan_set_egap_support(struct hdd_context_s *hdd_ctx,
-					     void *param) {}
+/**
+ * hdd_green_ap_init() - Initialize Green AP feature
+ * @hdd_ctx: HDD global context
+ *
+ * Return: none
+ */
+void hdd_green_ap_init(struct hdd_context_s *hdd_ctx);
+
+/**
+ * hdd_green_ap_deinit() - De-initialize Green AP feature
+ * @hdd_ctx: HDD global context
+ *
+ * Return: none
+ */
+void hdd_green_ap_deinit(struct hdd_context_s *hdd_ctx);
 
+/**
+ * hdd_green_ap_start_bss() - Notify Green AP of Start BSS event
+ * @hdd_ctx: HDD global context
+ *
+ * Return: none
+ */
+void hdd_green_ap_start_bss(struct hdd_context_s *hdd_ctx);
+
+/**
+ * hdd_green_ap_stop_bss() - Notify Green AP of Stop BSS event
+ * @hdd_ctx: HDD global context
+ *
+ * Return: none
+ */
+void hdd_green_ap_stop_bss(struct hdd_context_s *hdd_ctx);
+
+/**
+ * hdd_green_ap_add_sta() - Notify Green AP of Add Station event
+ * @hdd_ctx: HDD global context
+ *
+ * Return: none
+ */
+void hdd_green_ap_add_sta(struct hdd_context_s *hdd_ctx);
+
+/**
+ * hdd_green_ap_del_sta() - Notify Green AP of Delete Station event
+ * @hdd_ctx: HDD global context
+ *
+ * Return: none
+ */
+void hdd_green_ap_del_sta(struct hdd_context_s *hdd_ctx);
+
+/**
+ * hdd_green_ap_target_config() - Handle Green AP target configuration
+ * @hdd_ctx: HDD global context where Green AP information is stored
+ * @target_config: Target configuration containing Green AP info
+ *
+ * This function updates the HDD context with Green AP-specific
+ * information provided by the target.
+ *
+ * Return: none
+ */
+void hdd_green_ap_target_config(struct hdd_context_s *hdd_ctx,
+				struct wma_tgt_cfg *target_config);
+#else
+static inline void hdd_green_ap_init(struct hdd_context_s *hdd_ctx) {}
+static inline void hdd_green_ap_deinit(struct hdd_context_s *hdd_ctx) {}
+static inline void hdd_green_ap_start_bss(struct hdd_context_s *hdd_ctx) {}
+static inline void hdd_green_ap_stop_bss(struct hdd_context_s *hdd_ctx) {}
+static inline void hdd_green_ap_add_sta(struct hdd_context_s *hdd_ctx) {}
+static inline void hdd_green_ap_del_sta(struct hdd_context_s *hdd_ctx) {}
+static inline void hdd_green_ap_target_config(struct hdd_context_s *hdd_ctx,
+					      struct wma_tgt_cfg *target_config)
+{
+}
 #endif /* FEATURE_GREEN_AP */
 #endif /* __WLAN_HDD_GREEN_AP_H */

Dosya farkı çok büyük olduğundan ihmal edildi
+ 315 - 159
core/hdd/src/wlan_hdd_hostapd.c


+ 1 - 1
core/hdd/src/wlan_hdd_hostapd.h

@@ -83,7 +83,7 @@ hdd_translate_wpa_to_csr_encryption_type(uint8_t cipher_suite[4]);
 
 QDF_STATUS hdd_softap_sta_deauth(hdd_adapter_t *,
 		struct tagCsrDelStaParams *);
-void hdd_softap_sta_disassoc(hdd_adapter_t *, uint8_t *);
+void hdd_softap_sta_disassoc(hdd_adapter_t *, struct tagCsrDelStaParams *);
 void hdd_softap_tkip_mic_fail_counter_measure(hdd_adapter_t *, bool);
 int hdd_softap_unpack_ie(tHalHandle halHandle,
 			 eCsrEncryptionType *pEncryptType,

+ 109 - 74
core/hdd/src/wlan_hdd_ioctl.c

@@ -446,21 +446,24 @@ hdd_get_ibss_peer_info_cb(void *pUserData,
 	pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
 	if (NULL != pPeerInfo && QDF_STATUS_SUCCESS == pPeerInfo->status) {
 		/* validate number of peers */
-		if (pPeerInfo->numPeers < SIR_MAX_NUM_STA_IN_IBSS) {
-			pStaCtx->ibss_peer_info.status = pPeerInfo->status;
-			pStaCtx->ibss_peer_info.numPeers = pPeerInfo->numPeers;
-
-			for (i = 0; i < pPeerInfo->numPeers; i++) {
-				pStaCtx->ibss_peer_info.peerInfoParams[i] =
-					pPeerInfo->peerInfoParams[i];
-			}
-			hdd_info("Peer Info copied in HDD");
-		} else {
-			hdd_info("Number of peers %d returned is more than limit %d",
+		if (pPeerInfo->numPeers > SIR_MAX_NUM_STA_IN_IBSS) {
+			hdd_warn("Limiting num_peers %u to %u",
 				pPeerInfo->numPeers, SIR_MAX_NUM_STA_IN_IBSS);
+			pPeerInfo->numPeers = SIR_MAX_NUM_STA_IN_IBSS;
 		}
+		pStaCtx->ibss_peer_info.status = pPeerInfo->status;
+		pStaCtx->ibss_peer_info.numPeers = pPeerInfo->numPeers;
+
+		for (i = 0; i < pPeerInfo->numPeers; i++)
+			pStaCtx->ibss_peer_info.peerInfoParams[i] =
+				pPeerInfo->peerInfoParams[i];
 	} else {
-		hdd_info("peerInfo returned is NULL");
+		hdd_err("peerInfo %s: status %u, numPeers %u",
+			pPeerInfo ? "valid" : "null",
+			pPeerInfo ? pPeerInfo->status : QDF_STATUS_E_FAILURE,
+			pPeerInfo ? pPeerInfo->numPeers : 0);
+		pStaCtx->ibss_peer_info.numPeers = 0;
+		pStaCtx->ibss_peer_info.status = QDF_STATUS_E_FAILURE;
 	}
 
 	complete(&adapter->ibss_peer_info_comp);
@@ -837,23 +840,67 @@ static int hdd_parse_reassoc_command_v1_data(const uint8_t *pValue,
 	return 0;
 }
 
+#ifdef WLAN_FEATURE_ROAM_OFFLOAD
+void hdd_wma_send_fastreassoc_cmd(int sessionId, const tSirMacAddr bssid,
+				  int channel)
+{
+	struct wma_roam_invoke_cmd *fastreassoc;
+	cds_msg_t msg = {0};
+
+	fastreassoc = qdf_mem_malloc(sizeof(*fastreassoc));
+	if (NULL == fastreassoc) {
+		hdd_err("qdf_mem_malloc failed for fastreassoc");
+		return;
+	}
+	fastreassoc->vdev_id = sessionId;
+	fastreassoc->channel = channel;
+	fastreassoc->bssid[0] = bssid[0];
+	fastreassoc->bssid[1] = bssid[1];
+	fastreassoc->bssid[2] = bssid[2];
+	fastreassoc->bssid[3] = bssid[3];
+	fastreassoc->bssid[4] = bssid[4];
+	fastreassoc->bssid[5] = bssid[5];
+
+	msg.type = SIR_HAL_ROAM_INVOKE;
+	msg.reserved = 0;
+	msg.bodyptr = fastreassoc;
+	if (QDF_STATUS_SUCCESS != cds_mq_post_message(QDF_MODULE_ID_WMA,
+								&msg)) {
+		qdf_mem_free(fastreassoc);
+		hdd_err("Not able to post ROAM_INVOKE_CMD message to WMA");
+	}
+}
+#else
+void hdd_wma_send_fastreassoc_cmd(int sessionId, const tSirMacAddr bssid,
+				  int channel)
+{
+}
+
+#endif
+
 /**
  * hdd_reassoc() - perform a userspace-directed reassoc
  * @adapter:	Adapter upon which the command was received
  * @bssid:	BSSID with which to reassociate
  * @channel:	channel upon which to reassociate
+ * @src:        The source for the trigger of this action
  *
  * This function performs a userspace-directed reassoc operation
  *
  * Return: 0 for success non-zero for failure
  */
-static int
-hdd_reassoc(hdd_adapter_t *adapter, const uint8_t *bssid,
-	    const uint8_t channel)
+int hdd_reassoc(hdd_adapter_t *adapter, const uint8_t *bssid,
+		const uint8_t channel, const handoff_src src)
 {
 	hdd_station_ctx_t *pHddStaCtx;
+	hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 	int ret = 0;
 
+	if (hdd_ctx == NULL) {
+		hdd_err("Invalid hdd ctx");
+		return -EINVAL;
+	}
+
 	if (QDF_STA_MODE != adapter->device_mode) {
 		hdd_warn("Unsupported in mode %s(%d)",
 			 hdd_device_mode_to_string(adapter->device_mode),
@@ -890,12 +937,14 @@ hdd_reassoc(hdd_adapter_t *adapter, const uint8_t *bssid,
 	}
 
 	/* Proceed with reassoc */
-	{
+	if (roaming_offload_enabled(hdd_ctx)) {
+		hdd_wma_send_fastreassoc_cmd((int)adapter->sessionId,
+					bssid, (int)channel);
+	} else {
 		tCsrHandoffRequest handoffInfo;
-		hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 
 		handoffInfo.channel = channel;
-		handoffInfo.src = REASSOC;
+		handoffInfo.src = src;
 		qdf_mem_copy(handoffInfo.bssid.bytes, bssid, QDF_MAC_ADDR_SIZE);
 		sme_handoff_request(hdd_ctx->hHal, adapter->sessionId,
 				    &handoffInfo);
@@ -931,7 +980,7 @@ static int hdd_parse_reassoc_v1(hdd_adapter_t *adapter, const char *command)
 	if (ret) {
 		hdd_err("Failed to parse reassoc command data");
 	} else {
-		ret = hdd_reassoc(adapter, bssid, channel);
+		ret = hdd_reassoc(adapter, bssid, channel, REASSOC);
 	}
 	return ret;
 }
@@ -961,7 +1010,7 @@ static int hdd_parse_reassoc_v2(hdd_adapter_t *adapter, const char *command)
 		hdd_err("MAC address parsing failed");
 		ret = -EINVAL;
 	} else {
-		ret = hdd_reassoc(adapter, bssid, params.channel);
+		ret = hdd_reassoc(adapter, bssid, params.channel, REASSOC);
 	}
 	return ret;
 }
@@ -4344,41 +4393,6 @@ exit:
 	return ret;
 }
 
-#ifdef WLAN_FEATURE_ROAM_OFFLOAD
-static void hdd_wma_send_fastreassoc_cmd(int sessionId, tSirMacAddr bssid,
-							int channel)
-{
-	struct wma_roam_invoke_cmd *fastreassoc;
-	cds_msg_t msg = {0};
-
-	fastreassoc = qdf_mem_malloc(sizeof(*fastreassoc));
-	if (NULL == fastreassoc) {
-		hdd_err("qdf_mem_malloc failed for fastreassoc");
-		return;
-	}
-	fastreassoc->vdev_id = sessionId;
-	fastreassoc->channel = channel;
-	fastreassoc->bssid[0] = bssid[0];
-	fastreassoc->bssid[1] = bssid[1];
-	fastreassoc->bssid[2] = bssid[2];
-	fastreassoc->bssid[3] = bssid[3];
-	fastreassoc->bssid[4] = bssid[4];
-	fastreassoc->bssid[5] = bssid[5];
-
-	msg.type = SIR_HAL_ROAM_INVOKE;
-	msg.reserved = 0;
-	msg.bodyptr = fastreassoc;
-	if (QDF_STATUS_SUCCESS != cds_mq_post_message(QDF_MODULE_ID_WMA,
-								&msg)) {
-		qdf_mem_free(fastreassoc);
-		hdd_err("Not able to post ROAM_INVOKE_CMD message to WMA");
-	}
-}
-#else
-static inline void hdd_wma_send_fastreassoc_cmd(int sessionId,
-		tSirMacAddr bssid, int channel)
-{}
-#endif
 static int drv_cmd_fast_reassoc(hdd_adapter_t *adapter,
 				hdd_context_t *hdd_ctx,
 				uint8_t *command,
@@ -4417,33 +4431,34 @@ static int drv_cmd_fast_reassoc(hdd_adapter_t *adapter,
 		goto exit;
 	}
 
+	/* Check channel number is a valid channel number */
+	if (QDF_STATUS_SUCCESS !=
+		wlan_hdd_validate_operation_channel(adapter, channel)) {
+		hdd_err("Invalid Channel [%d]", channel);
+		return -EINVAL;
+	}
+
 	/*
 	 * if the target bssid is same as currently associated AP,
 	 * issue reassoc to same AP
 	 */
-	if (true != qdf_mem_cmp(targetApBssid,
+	if (!qdf_mem_cmp(targetApBssid,
 				    pHddStaCtx->conn_info.bssId.bytes,
 				    QDF_MAC_ADDR_SIZE)) {
-		/* Reassoc to same AP, only supported for Open Security*/
-		if ((pHddStaCtx->conn_info.ucEncryptionType ||
-			  pHddStaCtx->conn_info.mcEncryptionType)) {
-			hdd_err("Reassoc to same AP, only supported for Open Security");
-			return -ENOTSUPP;
-		}
 		hdd_info("Reassoc BSSID is same as currently associated AP bssid");
-		sme_get_modify_profile_fields(hdd_ctx->hHal, adapter->sessionId,
+		if (roaming_offload_enabled(hdd_ctx)) {
+			hdd_wma_send_fastreassoc_cmd((int)adapter->sessionId,
+				targetApBssid, (int)channel);
+		} else {
+			sme_get_modify_profile_fields(hdd_ctx->hHal,
+				adapter->sessionId,
 				&modProfileFields);
-		sme_roam_reassoc(hdd_ctx->hHal, adapter->sessionId,
-			NULL, modProfileFields, &roamId, 1);
+			sme_roam_reassoc(hdd_ctx->hHal, adapter->sessionId,
+				NULL, modProfileFields, &roamId, 1);
+		}
 		return 0;
 	}
 
-	/* Check channel number is a valid channel number */
-	if (QDF_STATUS_SUCCESS !=
-		wlan_hdd_validate_operation_channel(adapter, channel)) {
-		hdd_err("Invalid Channel [%d]", channel);
-		return -EINVAL;
-	}
 	if (roaming_offload_enabled(hdd_ctx)) {
 		hdd_wma_send_fastreassoc_cmd((int)adapter->sessionId,
 					targetApBssid, (int)channel);
@@ -5046,6 +5061,11 @@ static int drv_cmd_get_ibss_peer_info_all(hdd_adapter_t *adapter,
 			tx_rate =
 				pHddStaCtx->ibss_peer_info.peerInfoParams[idx].
 									txRate;
+			/*
+			 * Only lower 3 bytes are rate info. Mask of the MSByte
+			 */
+			tx_rate &= 0x00FFFFFF;
+
 			rssi = pHddStaCtx->ibss_peer_info.peerInfoParams[idx].
 									rssi;
 
@@ -5163,6 +5183,8 @@ static int drv_cmd_get_ibss_peer_info(hdd_adapter_t *adapter,
 	if (QDF_STATUS_SUCCESS == status) {
 		uint32_t txRate =
 			pHddStaCtx->ibss_peer_info.peerInfoParams[0].txRate;
+		/* Only lower 3 bytes are rate info. Mask of the MSByte */
+		txRate &= 0x00FFFFFF;
 
 		length = scnprintf(extra, sizeof(extra), "%d %d",
 				(int)txRate,
@@ -5724,7 +5746,11 @@ static int drv_cmd_enable_ext_wow(hdd_adapter_t *adapter,
 	/* Move pointer to ahead of ENABLEEXTWOW */
 	value = value + command_len;
 
-	sscanf(value, "%d", &set_value);
+	if (!(sscanf(value, "%d", &set_value))) {
+		QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_INFO,
+			  ("No input identified"));
+		return -EINVAL;
+	}
 
 	return hdd_enable_ext_wow_parser(adapter,
 					 adapter->sessionId,
@@ -6679,6 +6705,17 @@ static int drv_cmd_set_antenna_mode(hdd_adapter_t *adapter,
 		 hdd_ctx->current_antenna_mode);
 	ret = 0;
 exit:
+#ifdef FEATURE_WLAN_TDLS
+	/* Reset tdls NSS flags */
+	if (hdd_ctx->tdls_nss_switch_in_progress &&
+	    hdd_ctx->tdls_nss_teardown_complete) {
+		hdd_ctx->tdls_nss_switch_in_progress = false;
+		hdd_ctx->tdls_nss_teardown_complete = false;
+	}
+	hdd_info("tdls_nss_switch_in_progress: %d tdls_nss_teardown_complete: %d",
+		  hdd_ctx->tdls_nss_switch_in_progress,
+		  hdd_ctx->tdls_nss_teardown_complete);
+#endif
 	hdd_info("Set antenna status: %d current mode: %d",
 		 ret, hdd_ctx->current_antenna_mode);
 	return ret;
@@ -6981,9 +7018,7 @@ static const hdd_drv_cmd_t hdd_drv_cmds[] = {
 	{"SETFASTTRANSITION",         drv_cmd_set_fast_transition},
 	{"FASTREASSOC",               drv_cmd_fast_reassoc},
 	{"SETROAMSCANCONTROL",        drv_cmd_set_roam_scan_control},
-#ifdef FEATURE_WLAN_OKC
 	{"SETOKCMODE",                drv_cmd_set_okc_mode},
-#endif /* FEATURE_WLAN_OKC */
 	{"GETROAMSCANCONTROL",        drv_cmd_get_roam_scan_control},
 	{"BTCOEXMODE",                drv_cmd_bt_coex_mode},
 	{"SCAN-ACTIVE",               drv_cmd_scan_active},

+ 179 - 96
core/hdd/src/wlan_hdd_ipa.c

@@ -35,6 +35,7 @@
 #ifdef IPA_OFFLOAD
 
 /* Include Files */
+#include <linux/ipa.h>
 #include <wlan_hdd_includes.h>
 #include <wlan_hdd_ipa.h>
 
@@ -492,6 +493,10 @@ uint32_t wlan_hdd_stub_addr_to_priv(void *ptr)
 	QDF_TRACE(QDF_MODULE_ID_HDD, LVL, \
 		  "%s:%d: "fmt, __func__, __LINE__, ## args)
 
+#define HDD_IPA_DP_LOG(LVL, fmt, args...) \
+	QDF_TRACE(QDF_MODULE_ID_HDD_DATA, LVL, \
+		  "%s:%d: "fmt, __func__, __LINE__, ## args)
+
 #define HDD_IPA_DBG_DUMP(_lvl, _prefix, _buf, _len) \
 	do { \
 		QDF_TRACE(QDF_MODULE_ID_HDD, _lvl, "%s:", _prefix); \
@@ -593,6 +598,7 @@ static void hdd_ipa_w2i_cb(void *priv, enum ipa_dp_evt_type evt,
 			   unsigned long data);
 
 static void hdd_ipa_cleanup_iface(struct hdd_ipa_iface_context *iface_context);
+static void hdd_ipa_uc_proc_pending_event (struct hdd_ipa_priv *hdd_ipa);
 
 /**
  * hdd_ipa_is_enabled() - Is IPA enabled?
@@ -1289,40 +1295,6 @@ static void hdd_ipa_uc_rm_notify_defer(struct work_struct *work)
 	return;
 }
 
-/**
- * hdd_ipa_uc_proc_pending_event() - Process IPA uC pending events
- * @hdd_ipa: Global HDD IPA context
- *
- * Return: None
- */
-static void hdd_ipa_uc_proc_pending_event(struct hdd_ipa_priv *hdd_ipa)
-{
-	unsigned int pending_event_count;
-	struct ipa_uc_pending_event *pending_event = NULL;
-
-	pending_event_count = qdf_list_size(&hdd_ipa->pending_event);
-	HDD_IPA_LOG(QDF_TRACE_LEVEL_INFO,
-		"%s, Pending Event Count %d", __func__, pending_event_count);
-	if (!pending_event_count) {
-		HDD_IPA_LOG(QDF_TRACE_LEVEL_INFO,
-			"%s, No Pending Event", __func__);
-		return;
-	}
-
-	qdf_list_remove_front(&hdd_ipa->pending_event,
-			(qdf_list_node_t **)&pending_event);
-	while (pending_event != NULL) {
-		hdd_ipa_wlan_evt(pending_event->adapter,
-			pending_event->type,
-			pending_event->sta_id,
-			pending_event->mac_addr);
-		qdf_mem_free(pending_event);
-		pending_event = NULL;
-		qdf_list_remove_front(&hdd_ipa->pending_event,
-			(qdf_list_node_t **)&pending_event);
-	}
-}
-
 /**
  * hdd_ipa_uc_op_cb() - IPA uC operation callback
  * @op_msg: operation message received from firmware
@@ -1364,7 +1336,7 @@ static void hdd_ipa_uc_op_cb(struct op_msg_type *op_msg, void *usr_ctxt)
 
 	hdd_ipa = (struct hdd_ipa_priv *)hdd_ctx->hdd_ipa;
 
-	HDD_IPA_LOG(QDF_TRACE_LEVEL_DEBUG,
+	HDD_IPA_DP_LOG(QDF_TRACE_LEVEL_DEBUG,
 		    "%s, OPCODE %s", __func__, op_string[msg->op_code]);
 
 	if ((HDD_IPA_UC_OPCODE_TX_RESUME == msg->op_code) ||
@@ -1620,20 +1592,15 @@ static void hdd_ipa_uc_offload_enable_disable(hdd_adapter_t *adapter,
 {
 	struct sir_ipa_offload_enable_disable ipa_offload_enable_disable;
 
-	/* Lower layer may send multiple START_BSS_EVENT in DFS mode or during
-	 * channel change indication. Since these indications are sent by lower
-	 * layer as SAP updates and IPA doesn't have to do anything for these
-	 * updates so ignoring!
-	 */
-	if (QDF_SAP_MODE == adapter->device_mode && adapter->ipa_context)
+	if (!adapter)
 		return;
 
 	/* Lower layer may send multiple START_BSS_EVENT in DFS mode or during
 	 * channel change indication. Since these indications are sent by lower
 	 * layer as SAP updates and IPA doesn't have to do anything for these
 	 * updates so ignoring!
-	*/
-	if (adapter->ipa_context)
+	 */
+	if (QDF_SAP_MODE == adapter->device_mode && adapter->ipa_context)
 		return;
 
 	qdf_mem_zero(&ipa_offload_enable_disable,
@@ -1801,6 +1768,10 @@ static QDF_STATUS hdd_ipa_uc_ol_init(hdd_context_t *hdd_ctx)
 	/* Connect WDI IPA PIPE */
 	ipa_connect_wdi_pipe(&pipe_in, &pipe_out);
 	/* Micro Controller Doorbell register */
+	HDD_IPA_LOG(QDF_TRACE_LEVEL_INFO_HIGH,
+		"%s CONS DB pipe out 0x%x TX PIPE Handle 0x%x",
+		__func__, (unsigned int)pipe_out.uc_door_bell_pa,
+		ipa_ctxt->tx_pipe_handle);
 	ipa_ctxt->tx_comp_doorbell_paddr = pipe_out.uc_door_bell_pa;
 	/* WLAN TX PIPE Handle */
 	ipa_ctxt->tx_pipe_handle = pipe_out.clnt_hdl;
@@ -2555,7 +2526,7 @@ static void hdd_ipa_w2i_cb(void *priv, enum ipa_dp_evt_type evt,
 		if (hdd_ipa_uc_is_enabled(hdd_ipa->hdd_ctx)) {
 			session_id = (uint8_t)skb->cb[0];
 			iface_id = vdev_to_iface[session_id];
-			HDD_IPA_LOG(QDF_TRACE_LEVEL_INFO_HIGH,
+			HDD_IPA_DP_LOG(QDF_TRACE_LEVEL_INFO_HIGH,
 				"IPA_RECEIVE: session_id=%u, iface_id=%u",
 				session_id, iface_id);
 		} else {
@@ -2590,7 +2561,7 @@ static void hdd_ipa_w2i_cb(void *priv, enum ipa_dp_evt_type evt,
 		/* Disable to forward Intra-BSS Rx packets when
 		 * ap_isolate=1 in hostapd.conf
 		 */
-		if (adapter->sessionCtx.ap.apDisableIntraBssFwd) {
+		if (!adapter->sessionCtx.ap.apDisableIntraBssFwd) {
 			/*
 			 * When INTRA_BSS_FWD_OFFLOAD is enabled, FW will send
 			 * all Rx packets to IPA uC, which need to be forwarded
@@ -2604,7 +2575,7 @@ static void hdd_ipa_w2i_cb(void *priv, enum ipa_dp_evt_type evt,
 			fw_desc = (uint8_t)skb->cb[1];
 
 			if (fw_desc & HDD_IPA_FW_RX_DESC_FORWARD_M) {
-				HDD_IPA_LOG(
+				HDD_IPA_DP_LOG(
 					QDF_TRACE_LEVEL_DEBUG,
 					"Forward packet to Tx (fw_desc=%d)",
 					fw_desc);
@@ -2658,7 +2629,7 @@ void hdd_ipa_nbuf_cb(qdf_nbuf_t skb)
 {
 	struct hdd_ipa_priv *hdd_ipa = ghdd_ipa;
 
-	HDD_IPA_LOG(QDF_TRACE_LEVEL_DEBUG, "%p",
+	HDD_IPA_DP_LOG(QDF_TRACE_LEVEL_DEBUG, "%p",
 		wlan_hdd_stub_priv_to_addr(QDF_NBUF_CB_TX_IPA_PRIV(skb)));
 	/* FIXME: This is broken; PRIV_DATA is now 31 bits */
 	ipa_free_skb((struct ipa_rx_data *)
@@ -3582,15 +3553,59 @@ static inline char *hdd_ipa_wlan_event_to_str(enum ipa_wlan_event event)
 }
 
 /**
- * hdd_ipa_wlan_evt() - IPA event handler
+ * hdd_to_ipa_wlan_event() - convert hdd_ipa_wlan_event to ipa_wlan_event
+ * @hdd_ipa_event_type: HDD IPA WLAN event to be converted to an ipa_wlan_event
+ *
+ * Return: ipa_wlan_event representing the hdd_ipa_wlan_event
+ */
+static enum ipa_wlan_event
+hdd_to_ipa_wlan_event(enum hdd_ipa_wlan_event hdd_ipa_event_type)
+{
+	enum ipa_wlan_event ipa_event;
+
+	switch (hdd_ipa_event_type) {
+	case HDD_IPA_CLIENT_CONNECT:
+		ipa_event = WLAN_CLIENT_CONNECT;
+		break;
+	case HDD_IPA_CLIENT_DISCONNECT:
+		ipa_event = WLAN_CLIENT_DISCONNECT;
+		break;
+	case HDD_IPA_AP_CONNECT:
+		ipa_event = WLAN_AP_CONNECT;
+		break;
+	case HDD_IPA_AP_DISCONNECT:
+		ipa_event = WLAN_AP_DISCONNECT;
+		break;
+	case HDD_IPA_STA_CONNECT:
+		ipa_event = WLAN_STA_CONNECT;
+		break;
+	case HDD_IPA_STA_DISCONNECT:
+		ipa_event = WLAN_STA_DISCONNECT;
+		break;
+	case HDD_IPA_CLIENT_CONNECT_EX:
+		ipa_event = WLAN_CLIENT_CONNECT_EX;
+		break;
+	case HDD_IPA_WLAN_EVENT_MAX:
+	default:
+		ipa_event = IPA_WLAN_EVENT_MAX;
+		break;
+	}
+	return ipa_event;
+
+}
+
+/**
+ * __hdd_ipa_wlan_evt() - IPA event handler
  * @adapter: adapter upon which the event was received
  * @sta_id: station id for the event
- * @type: the event type
+ * @type: event enum of type ipa_wlan_event
  * @mac_address: MAC address associated with the event
  *
+ * This function is meant to be called from within wlan_hdd_ipa.c
+ *
  * Return: 0 on success, negative errno value on error
  */
-int hdd_ipa_wlan_evt(hdd_adapter_t *adapter, uint8_t sta_id,
+static int __hdd_ipa_wlan_evt(hdd_adapter_t *adapter, uint8_t sta_id,
 		     enum ipa_wlan_event type, uint8_t *mac_addr)
 {
 	struct hdd_ipa_priv *hdd_ipa = ghdd_ipa;
@@ -3676,43 +3691,28 @@ int hdd_ipa_wlan_evt(hdd_adapter_t *adapter, uint8_t sta_id,
 		if (hdd_ipa->sta_connected)
 			hdd_ipa_cleanup_iface(adapter->ipa_context);
 
-		if ((hdd_ipa_uc_sta_is_enabled(hdd_ipa->hdd_ctx)) &&
-			(!hdd_ipa->sta_connected))
+		if (hdd_ipa_uc_sta_is_enabled(hdd_ipa->hdd_ctx) &&
+		    (hdd_ipa->sap_num_connected_sta > 0) &&
+		    !hdd_ipa->sta_connected)
 			hdd_ipa_uc_offload_enable_disable(adapter,
 				SIR_STA_RX_DATA_OFFLOAD, 1);
 
 		qdf_mutex_acquire(&hdd_ipa->event_lock);
 
-		if (!hdd_ipa_uc_is_enabled(hdd_ipa->hdd_ctx)) {
-			HDD_IPA_LOG(QDF_TRACE_LEVEL_INFO,
-				"%s: Evt: %d, IPA UC OFFLOAD NOT ENABLED",
-				msg_ex->name, meta.msg_type);
-		} else if ((!hdd_ipa->sap_num_connected_sta) &&
-			(!hdd_ipa->sta_connected)) {
-			/* Enable IPA UC TX PIPE when STA connected */
-			ret = hdd_ipa_uc_handle_first_con(hdd_ipa);
-			if (ret) {
-				qdf_mutex_release(&hdd_ipa->event_lock);
-				HDD_IPA_LOG(QDF_TRACE_LEVEL_ERROR,
-					"handle 1st con ret %d", ret);
-				hdd_ipa_uc_offload_enable_disable(adapter,
-					SIR_STA_RX_DATA_OFFLOAD, 0);
-				goto end;
-			}
-		}
 		ret = hdd_ipa_setup_iface(hdd_ipa, adapter, sta_id);
 		if (ret) {
 			qdf_mutex_release(&hdd_ipa->event_lock);
-			hdd_ipa_uc_offload_enable_disable(adapter,
-				SIR_STA_RX_DATA_OFFLOAD, 0);
+			if (hdd_ipa_uc_sta_is_enabled(hdd_ipa->hdd_ctx) &&
+			    (hdd_ipa->sap_num_connected_sta > 0) &&
+			    !hdd_ipa->sta_connected)
+				hdd_ipa_uc_offload_enable_disable(adapter,
+					SIR_STA_RX_DATA_OFFLOAD, 0);
 			goto end;
+		}
 
-#ifdef IPA_UC_OFFLOAD
 		vdev_to_iface[adapter->sessionId] =
 			((struct hdd_ipa_iface_context *)
-				(adapter->ipa_context))->iface_id;
-#endif /* IPA_UC_OFFLOAD */
-		}
+			(adapter->ipa_context))->iface_id;
 
 		qdf_mutex_release(&hdd_ipa->event_lock);
 
@@ -3729,10 +3729,10 @@ int hdd_ipa_wlan_evt(hdd_adapter_t *adapter, uint8_t sta_id,
 		if (adapter->ipa_context)
 			return 0;
 
-		if (hdd_ipa_uc_is_enabled(hdd_ipa->hdd_ctx)) {
+		if (hdd_ipa_uc_is_enabled(hdd_ipa->hdd_ctx))
 			hdd_ipa_uc_offload_enable_disable(adapter,
 				SIR_AP_RX_DATA_OFFLOAD, 1);
-		}
+
 		qdf_mutex_acquire(&hdd_ipa->event_lock);
 		ret = hdd_ipa_setup_iface(hdd_ipa, adapter, sta_id);
 		if (ret) {
@@ -3741,13 +3741,12 @@ int hdd_ipa_wlan_evt(hdd_adapter_t *adapter, uint8_t sta_id,
 				msg_ex->name, meta.msg_type);
 			qdf_mutex_release(&hdd_ipa->event_lock);
 			goto end;
+		}
 
-#ifdef IPA_UC_OFFLOAD
 		vdev_to_iface[adapter->sessionId] =
 			((struct hdd_ipa_iface_context *)
-				(adapter->ipa_context))->iface_id;
-#endif /* IPA_UC_OFFLOAD */
-		}
+			(adapter->ipa_context))->iface_id;
+
 		qdf_mutex_release(&hdd_ipa->event_lock);
 		break;
 
@@ -3762,22 +3761,23 @@ int hdd_ipa_wlan_evt(hdd_adapter_t *adapter, uint8_t sta_id,
 			qdf_mutex_release(&hdd_ipa->event_lock);
 			return -EINVAL;
 		}
+
 		hdd_ipa->sta_connected = 0;
+
 		if (!hdd_ipa_uc_is_enabled(hdd_ipa->hdd_ctx)) {
 			HDD_IPA_LOG(QDF_TRACE_LEVEL_INFO,
 				"%s: IPA UC OFFLOAD NOT ENABLED",
 				msg_ex->name);
 		} else {
 			/* Disable IPA UC TX PIPE when STA disconnected */
-			if ((!hdd_ipa->sap_num_connected_sta) ||
-				((!hdd_ipa->num_iface) &&
-					(HDD_IPA_UC_NUM_WDI_PIPE ==
-					hdd_ipa->activated_fw_pipe))) {
+			if (!hdd_ipa->num_iface &&
+			    (HDD_IPA_UC_NUM_WDI_PIPE ==
+			    hdd_ipa->activated_fw_pipe))
 				hdd_ipa_uc_handle_last_discon(hdd_ipa);
-			}
 		}
 
-		if (hdd_ipa_uc_sta_is_enabled(hdd_ipa->hdd_ctx)) {
+		if (hdd_ipa_uc_sta_is_enabled(hdd_ipa->hdd_ctx) &&
+		    (hdd_ipa->sap_num_connected_sta > 0)) {
 			hdd_ipa_uc_offload_enable_disable(adapter,
 				SIR_STA_RX_DATA_OFFLOAD, 0);
 			vdev_to_iface[adapter->sessionId] = HDD_IPA_MAX_IFACE;
@@ -3819,6 +3819,7 @@ int hdd_ipa_wlan_evt(hdd_adapter_t *adapter, uint8_t sta_id,
 				SIR_AP_RX_DATA_OFFLOAD, 0);
 			vdev_to_iface[adapter->sessionId] = HDD_IPA_MAX_IFACE;
 		}
+
 		qdf_mutex_release(&hdd_ipa->event_lock);
 		break;
 
@@ -3844,15 +3845,30 @@ int hdd_ipa_wlan_evt(hdd_adapter_t *adapter, uint8_t sta_id,
 		}
 
 		/* Enable IPA UC Data PIPEs when first STA connected */
-		if ((0 == hdd_ipa->sap_num_connected_sta) &&
-		   (!hdd_ipa_uc_sta_is_enabled(hdd_ipa->hdd_ctx) ||
-		   !hdd_ipa->sta_connected)) {
+		if (0 == hdd_ipa->sap_num_connected_sta) {
+			if (hdd_ipa_uc_sta_is_enabled(hdd_ipa->hdd_ctx) &&
+			    hdd_ipa->sta_connected)
+				hdd_ipa_uc_offload_enable_disable(
+					hdd_get_adapter(hdd_ipa->hdd_ctx,
+							QDF_STA_MODE),
+					SIR_STA_RX_DATA_OFFLOAD, 1);
+
 			ret = hdd_ipa_uc_handle_first_con(hdd_ipa);
 			if (ret) {
 				qdf_mutex_release(&hdd_ipa->event_lock);
 				HDD_IPA_LOG(QDF_TRACE_LEVEL_ERROR,
 					    "%s: handle 1st con ret %d",
 					    adapter->dev->name, ret);
+
+				if (hdd_ipa_uc_sta_is_enabled(
+					hdd_ipa->hdd_ctx) &&
+				    hdd_ipa->sta_connected)
+					hdd_ipa_uc_offload_enable_disable(
+						hdd_get_adapter(
+							hdd_ipa->hdd_ctx,
+							QDF_STA_MODE),
+						SIR_STA_RX_DATA_OFFLOAD, 0);
+
 				return ret;
 			}
 		}
@@ -3915,12 +3931,18 @@ int hdd_ipa_wlan_evt(hdd_adapter_t *adapter, uint8_t sta_id,
 		hdd_ipa->sap_num_connected_sta--;
 		/* Disable IPA UC TX PIPE when last STA disconnected */
 		if (!hdd_ipa->sap_num_connected_sta
-			&& (!hdd_ipa_uc_sta_is_enabled(hdd_ipa->hdd_ctx) ||
-			!hdd_ipa->sta_connected)
 			&& (false == hdd_ipa->resource_unloading)
 			&& (HDD_IPA_UC_NUM_WDI_PIPE ==
 				hdd_ipa->activated_fw_pipe))
 			hdd_ipa_uc_handle_last_discon(hdd_ipa);
+
+		if (hdd_ipa_uc_sta_is_enabled(hdd_ipa->hdd_ctx) &&
+		    hdd_ipa->sta_connected)
+			hdd_ipa_uc_offload_enable_disable(
+				hdd_get_adapter(hdd_ipa->hdd_ctx,
+						QDF_STA_MODE),
+						SIR_STA_RX_DATA_OFFLOAD, 0);
+
 		qdf_mutex_release(&hdd_ipa->event_lock);
 		break;
 
@@ -3957,6 +3979,60 @@ end:
 	return ret;
 }
 
+/**
+ * hdd_ipa_wlan_evt() - IPA event handler
+ * @adapter: adapter upon which the event was received
+ * @sta_id: station id for the event
+ * @hdd_event_type: event enum of type hdd_ipa_wlan_event
+ * @mac_address: MAC address associated with the event
+ *
+ * This function is meant to be called from outside of wlan_hdd_ipa.c.
+ *
+ * Return: 0 on success, negative errno value on error
+ */
+int hdd_ipa_wlan_evt(hdd_adapter_t *adapter, uint8_t sta_id,
+	enum hdd_ipa_wlan_event hdd_event_type, uint8_t *mac_addr)
+{
+	enum ipa_wlan_event type = hdd_to_ipa_wlan_event(hdd_event_type);
+
+	return __hdd_ipa_wlan_evt(adapter, sta_id, type, mac_addr);
+}
+
+/**
+ * hdd_ipa_uc_proc_pending_event() - Process IPA uC pending events
+ * @hdd_ipa: Global HDD IPA context
+ *
+ * Return: None
+ */
+static void
+hdd_ipa_uc_proc_pending_event(struct hdd_ipa_priv *hdd_ipa)
+{
+	unsigned int pending_event_count;
+	struct ipa_uc_pending_event *pending_event = NULL;
+
+	pending_event_count = qdf_list_size(&hdd_ipa->pending_event);
+	HDD_IPA_LOG(QDF_TRACE_LEVEL_INFO,
+		"%s, Pending Event Count %d", __func__, pending_event_count);
+	if (!pending_event_count) {
+		HDD_IPA_LOG(QDF_TRACE_LEVEL_INFO,
+			"%s, No Pending Event", __func__);
+		return;
+	}
+
+	qdf_list_remove_front(&hdd_ipa->pending_event,
+			(qdf_list_node_t **)&pending_event);
+	while (pending_event != NULL) {
+		__hdd_ipa_wlan_evt(pending_event->adapter,
+			pending_event->type,
+			pending_event->sta_id,
+			pending_event->mac_addr);
+		qdf_mem_free(pending_event);
+		pending_event = NULL;
+		qdf_list_remove_front(&hdd_ipa->pending_event,
+			(qdf_list_node_t **)&pending_event);
+	}
+}
+
 /**
  * hdd_ipa_rm_state_to_str() - Convert IPA RM state to string
  * @state: IPA RM state value
@@ -3991,10 +4067,16 @@ QDF_STATUS hdd_ipa_init(hdd_context_t *hdd_ctx)
 	struct hdd_ipa_priv *hdd_ipa = NULL;
 	int ret, i;
 	struct hdd_ipa_iface_context *iface_context = NULL;
+	struct ol_txrx_pdev_t *pdev = cds_get_context(QDF_MODULE_ID_TXRX);
 
 	if (!hdd_ipa_is_enabled(hdd_ctx))
 		return QDF_STATUS_SUCCESS;
 
+	if (!pdev) {
+		HDD_IPA_LOG(QDF_TRACE_LEVEL_FATAL, "pdev is NULL");
+		goto fail_return;
+	}
+
 	hdd_ipa = qdf_mem_malloc(sizeof(*hdd_ipa));
 	if (!hdd_ipa) {
 		HDD_IPA_LOG(QDF_TRACE_LEVEL_FATAL, "hdd_ipa allocation failed");
@@ -4005,8 +4087,7 @@ QDF_STATUS hdd_ipa_init(hdd_context_t *hdd_ctx)
 	ghdd_ipa = hdd_ipa;
 	hdd_ipa->hdd_ctx = hdd_ctx;
 	hdd_ipa->num_iface = 0;
-	ol_txrx_ipa_uc_get_resource(cds_get_context(QDF_MODULE_ID_TXRX),
-				&hdd_ipa->ipa_resource);
+	ol_txrx_ipa_uc_get_resource(pdev, &hdd_ipa->ipa_resource);
 	if ((0 == hdd_ipa->ipa_resource.ce_sr_base_paddr) ||
 	    (0 == hdd_ipa->ipa_resource.tx_comp_ring_base_paddr) ||
 	    (0 == hdd_ipa->ipa_resource.rx_rdy_ring_base_paddr) ||
@@ -4168,10 +4249,12 @@ QDF_STATUS hdd_ipa_cleanup(hdd_context_t *hdd_ctx)
 	if (hdd_ipa_uc_is_enabled(hdd_ctx)) {
 		hdd_ipa_uc_rt_debug_deinit(hdd_ctx);
 		HDD_IPA_LOG(QDF_TRACE_LEVEL_INFO,
-			    "%s: Disconnect TX PIPE", __func__);
+			    "%s: Disconnect TX PIPE tx_pipe_handle=0x%x",
+			    __func__, hdd_ipa->tx_pipe_handle);
 		ipa_disconnect_wdi_pipe(hdd_ipa->tx_pipe_handle);
 		HDD_IPA_LOG(QDF_TRACE_LEVEL_INFO,
-			    "%s: Disconnect RX PIPE", __func__);
+			    "%s: Disconnect RX PIPE rx_pipe_handle=0x%x",
+			    __func__, hdd_ipa->rx_pipe_handle);
 		ipa_disconnect_wdi_pipe(hdd_ipa->rx_pipe_handle);
 		qdf_mutex_destroy(&hdd_ipa->event_lock);
 		qdf_mutex_destroy(&hdd_ipa->ipa_lock);

+ 122 - 8
core/hdd/src/wlan_hdd_lpass.c

@@ -77,6 +77,9 @@ static int wlan_hdd_gen_wlan_status_pack(struct wlan_status_data *data,
 		return -EINVAL;
 	}
 
+	if (adapter->sessionId == HDD_SESSION_ID_INVALID)
+		return -EINVAL;
+
 	hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 	if (hdd_ctx->lpss_support && hdd_ctx->config->enable_lpass_support)
 		data->lpss_support = 1;
@@ -157,12 +160,16 @@ static int wlan_hdd_gen_wlan_version_pack(struct wlan_version_data *data,
  *
  * Return: none
  */
-void wlan_hdd_send_status_pkg(hdd_adapter_t *adapter,
-			      hdd_station_ctx_t *sta_ctx,
-			      uint8_t is_on, uint8_t is_connected)
+static void wlan_hdd_send_status_pkg(struct hdd_adapter_s *adapter,
+				     struct hdd_station_ctx *sta_ctx,
+				     uint8_t is_on, uint8_t is_connected)
 {
 	int ret = 0;
 	struct wlan_status_data data;
+	hdd_context_t *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
+
+	if (!hdd_ctx)
+		return;
 
 	if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam())
 		return;
@@ -171,8 +178,10 @@ void wlan_hdd_send_status_pkg(hdd_adapter_t *adapter,
 	if (is_on)
 		ret = wlan_hdd_gen_wlan_status_pack(&data, adapter, sta_ctx,
 						    is_on, is_connected);
+
 	if (!ret)
-		wlan_hdd_send_svc_nlink_msg(WLAN_SVC_WLAN_STATUS_IND,
+		wlan_hdd_send_svc_nlink_msg(hdd_ctx->radio_index,
+					WLAN_SVC_WLAN_STATUS_IND,
 					    &data, sizeof(data));
 }
 
@@ -187,11 +196,16 @@ void wlan_hdd_send_status_pkg(hdd_adapter_t *adapter,
  *
  * Return: none
  */
-void wlan_hdd_send_version_pkg(uint32_t fw_version,
-			       uint32_t chip_id, const char *chip_name)
+static void wlan_hdd_send_version_pkg(uint32_t fw_version,
+				      uint32_t chip_id,
+				      const char *chip_name)
 {
 	int ret = 0;
 	struct wlan_version_data data;
+	hdd_context_t *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
+
+	if (!hdd_ctx)
+		return;
 
 	if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam())
 		return;
@@ -200,7 +214,8 @@ void wlan_hdd_send_version_pkg(uint32_t fw_version,
 	ret = wlan_hdd_gen_wlan_version_pack(&data, fw_version, chip_id,
 					     chip_name);
 	if (!ret)
-		wlan_hdd_send_svc_nlink_msg(WLAN_SVC_WLAN_VERSION_IND,
+		wlan_hdd_send_svc_nlink_msg(hdd_ctx->radio_index,
+					WLAN_SVC_WLAN_VERSION_IND,
 					    &data, sizeof(data));
 }
 
@@ -214,7 +229,7 @@ void wlan_hdd_send_version_pkg(uint32_t fw_version,
  *
  * Return: none
  */
-void wlan_hdd_send_all_scan_intf_info(hdd_context_t *hdd_ctx)
+static void wlan_hdd_send_all_scan_intf_info(struct hdd_context_s *hdd_ctx)
 {
 	hdd_adapter_t *adapter = NULL;
 	hdd_adapter_list_node_t *node = NULL, *next = NULL;
@@ -245,3 +260,102 @@ void wlan_hdd_send_all_scan_intf_info(hdd_context_t *hdd_ctx)
 	if (!scan_intf_found)
 		wlan_hdd_send_status_pkg(adapter, NULL, 1, 0);
 }
+
+/*
+ * hdd_lpass_target_config() - Handle LPASS target configuration
+ * (public function documented in wlan_hdd_lpass.h)
+ */
+void hdd_lpass_target_config(struct hdd_context_s *hdd_ctx,
+			     struct wma_tgt_cfg *target_config)
+{
+	hdd_ctx->lpss_support = target_config->lpss_support;
+}
+
+/*
+ * hdd_lpass_populate_cds_config() - Populate LPASS configuration
+ * (public function documented in wlan_hdd_lpass.h)
+ */
+void hdd_lpass_populate_cds_config(struct cds_config_info *cds_config,
+				   struct hdd_context_s *hdd_ctx)
+{
+	cds_config->is_lpass_enabled = hdd_ctx->config->enable_lpass_support;
+}
+
+/*
+ * hdd_lpass_notify_connect() - Notify LPASS of interface connect
+ * (public function documented in wlan_hdd_lpass.h)
+ */
+void hdd_lpass_notify_connect(struct hdd_adapter_s *adapter)
+{
+	struct hdd_station_ctx *sta_ctx;
+
+	/* only send once per connection */
+	if (adapter->rssi_send)
+		return;
+
+	/* don't send if driver is unloading */
+	if (cds_is_driver_unloading())
+		return;
+
+	adapter->rssi_send = true;
+	sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
+	wlan_hdd_send_status_pkg(adapter, sta_ctx, 1, 1);
+}
+
+/*
+ * hdd_lpass_notify_disconnect() - Notify LPASS of interface disconnect
+ * (public function documented in wlan_hdd_lpass.h)
+ */
+void hdd_lpass_notify_disconnect(struct hdd_adapter_s *adapter)
+{
+	struct hdd_station_ctx *sta_ctx;
+
+	adapter->rssi_send = false;
+	sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
+	wlan_hdd_send_status_pkg(adapter, sta_ctx, 1, 0);
+}
+
+/*
+ * hdd_lpass_notify_mode_change() - Notify LPASS of interface mode change
+ * (public function documented in wlan_hdd_lpass.h)
+ *
+ * implementation note: when one interfaces changes we notify the
+ * state of all of the interfaces.
+ */
+void hdd_lpass_notify_mode_change(struct hdd_adapter_s *adapter)
+{
+	struct hdd_context_s *hdd_ctx;
+
+	hdd_ctx = WLAN_HDD_GET_CTX(adapter);
+	wlan_hdd_send_all_scan_intf_info(hdd_ctx);
+}
+
+/*
+ * hdd_lpass_notify_start() - Notify LPASS of driver start
+ * (public function documented in wlan_hdd_lpass.h)
+ */
+void hdd_lpass_notify_start(struct hdd_context_s *hdd_ctx)
+{
+	wlan_hdd_send_all_scan_intf_info(hdd_ctx);
+	wlan_hdd_send_version_pkg(hdd_ctx->target_fw_version,
+				  hdd_ctx->target_hw_version,
+				  hdd_ctx->target_hw_name);
+}
+
+/*
+ * hdd_lpass_notify_stop() - Notify LPASS of driver stop
+ * (public function documented in wlan_hdd_lpass.h)
+ */
+void hdd_lpass_notify_stop(struct hdd_context_s *hdd_ctx)
+{
+	wlan_hdd_send_status_pkg(NULL, NULL, 0, 0);
+}
+
+/*
+ * hdd_lpass_is_supported() - Is lpass feature supported?
+ * (public function documented in wlan_hdd_lpass.h)
+ */
+bool hdd_lpass_is_supported(struct hdd_context_s *hdd_ctx)
+{
+	return hdd_ctx->config->enable_lpass_support;
+}

+ 113 - 18
core/hdd/src/wlan_hdd_lpass.h

@@ -28,31 +28,126 @@
 #if !defined(WLAN_HDD_LPASS_H)
 #define WLAN_HDD_LPASS_H
 
+struct cds_config_info;
+struct wma_tgt_cfg;
+struct hdd_context_s;
+struct hdd_adapter_s;
+
 #ifdef WLAN_FEATURE_LPSS
-void wlan_hdd_send_status_pkg(hdd_adapter_t *adapter,
-			      hdd_station_ctx_t *sta_ctx,
-			      uint8_t is_on, uint8_t is_connected);
-void wlan_hdd_send_version_pkg(uint32_t fw_version,
-			       uint32_t chip_id, const char *chip_name);
-void wlan_hdd_send_all_scan_intf_info(hdd_context_t *hdd_ctx);
+/**
+ * hdd_lpass_target_config() - Handle LPASS target configuration
+ * @hdd_ctx: HDD global context where lpass information is stored
+ * @target_config: Target configuration containing lpass info
+ *
+ * This function updates the HDD context with lpass-specific
+ * information provided by the target.
+ *
+ * Return: none
+ */
+void hdd_lpass_target_config(struct hdd_context_s *hdd_ctx,
+			     struct wma_tgt_cfg *target_config);
+
+/**
+ * hdd_lpass_populate_cds_config() - Populate LPASS configuration
+ * @cds_config: CDS configuration to populate with lpass info
+ * @hdd_ctx: HDD global context which contains lpass information
+ *
+ * This function seeds the CDS configuration structure with
+ * lpass-specific information gleaned from the HDD context.
+ *
+ * Return: none
+ */
+void hdd_lpass_populate_cds_config(struct cds_config_info *cds_config,
+				   struct hdd_context_s *hdd_ctx);
+
+/**
+ * hdd_lpass_notify_connect() - Notify LPASS of interface connect
+ * @adapter: The adapter that connected
+ *
+ * This function is used to notify the LPASS feature that an adapter
+ * has connected.
+ *
+ * Return: none
+ */
+void hdd_lpass_notify_connect(struct hdd_adapter_s *adapter);
+
+/**
+ * hdd_lpass_notify_disconnect() - Notify LPASS of interface disconnect
+ * @adapter: The adapter that connected
+ *
+ * This function is used to notify the LPASS feature that an adapter
+ * has disconnected.
+ *
+ * Return: none
+ */
+void hdd_lpass_notify_disconnect(struct hdd_adapter_s *adapter);
+
+/**
+ * hdd_lpass_notify_mode_change() - Notify LPASS of interface mode change
+ * @adapter: The adapter whose mode was changed
+ *
+ * This function is used to notify the LPASS feature that an adapter
+ * had its mode changed.
+ *
+ * Return: none
+ */
+void hdd_lpass_notify_mode_change(struct hdd_adapter_s *adapter);
+
+/**
+ * hdd_lpass_notify_start() - Notify LPASS of driver start
+ * @hdd_ctx: The global HDD context
+ *
+ * This function is used to notify the LPASS feature that the wlan
+ * driver has (re-)started.
+ *
+ * Return: none
+ */
+void hdd_lpass_notify_start(struct hdd_context_s *hdd_ctx);
+
+/**
+ * hdd_lpass_notify_stop() - Notify LPASS of driver stop
+ * @hdd_ctx: The global HDD context
+ *
+ * This function is used to notify the LPASS feature that the wlan
+ * driver has stopped.
+ *
+ * Return: none
+ */
+void hdd_lpass_notify_stop(struct hdd_context_s *hdd_ctx);
+
+/**
+ * hdd_lpass_is_supported() - Is lpass feature supported?
+ * @hdd_ctx: The global HDD context
+ *
+ * Return: true if feature is enabled and supported by firmware, false
+ * if the feature is not enabled or not supported by firmware.
+ */
+bool hdd_lpass_is_supported(struct hdd_context_s *hdd_ctx);
+
 #else
-static inline void wlan_hdd_send_status_pkg(hdd_adapter_t *adapter,
-					    hdd_station_ctx_t *sta_ctx,
-					    uint8_t is_on, uint8_t is_connected)
+static inline void hdd_lpass_target_config(struct hdd_context_s *hdd_ctx,
+					   struct wma_tgt_cfg *target_config)
 {
-	return;
 }
-
-static inline void wlan_hdd_send_version_pkg(uint32_t fw_version,
-					     uint32_t chip_id,
-					     const char *chip_name)
+static inline
+void hdd_lpass_populate_cds_config(struct cds_config_info *cds_config,
+				   struct hdd_context_s *hdd_ctx)
 {
-	return;
 }
-
-static inline void wlan_hdd_send_all_scan_intf_info(hdd_context_t *hdd_ctx)
+static inline void hdd_lpass_notify_connect(struct hdd_adapter_s *adapter)
+{
+}
+static inline void hdd_lpass_notify_disconnect(struct hdd_adapter_s *adapter)
+{
+}
+static inline void hdd_lpass_notify_mode_change(struct hdd_adapter_s *adapter)
+{
+}
+static inline void hdd_lpass_notify_start(struct hdd_context_s *hdd_ctx) { }
+static inline void hdd_lpass_notify_stop(struct hdd_context_s *hdd_ctx) { }
+static inline bool hdd_lpass_is_supported(struct hdd_context_s *hdd_ctx)
 {
-	return;
+	return false;
 }
 #endif
 

+ 65 - 24
core/hdd/src/wlan_hdd_lro.c

@@ -130,6 +130,7 @@ static void hdd_lro_desc_info_init(struct hdd_lro_s *hdd_info)
 	}
 
 	qdf_spinlock_create(&hdd_info->lro_desc_info.lro_hash_lock);
+	qdf_spinlock_create(&hdd_info->lro_mgr_arr_access_lock);
 }
 
 /**
@@ -162,6 +163,7 @@ static void hdd_lro_desc_info_deinit(struct hdd_lro_s *hdd_info)
 
 	hdd_lro_desc_pool_deinit(&desc_info->lro_desc_pool);
 	qdf_spinlock_destroy(&desc_info->lro_hash_lock);
+	qdf_spinlock_destroy(&hdd_info->lro_mgr_arr_access_lock);
 }
 
 /**
@@ -212,7 +214,7 @@ static int hdd_lro_desc_find(hdd_adapter_t *adapter,
 	struct hdd_lro_desc_table *lro_hash_table;
 	struct list_head *ptr;
 	struct hdd_lro_desc_entry *entry;
-	struct hdd_lro_desc_pool free_pool;
+	struct hdd_lro_desc_pool *free_pool;
 	struct hdd_lro_desc_info *desc_info = &adapter->lro_info.lro_desc_info;
 
 	*lro_desc = NULL;
@@ -243,19 +245,19 @@ static int hdd_lro_desc_find(hdd_adapter_t *adapter,
 	qdf_spin_unlock_bh(&desc_info->lro_hash_lock);
 
 	/* no existing flow found, a new LRO desc needs to be allocated */
-	free_pool = adapter->lro_info.lro_desc_info.lro_desc_pool;
-	qdf_spin_lock_bh(&free_pool.lro_pool_lock);
+	free_pool = &adapter->lro_info.lro_desc_info.lro_desc_pool;
+	qdf_spin_lock_bh(&free_pool->lro_pool_lock);
 	entry = list_first_entry_or_null(
-		 &free_pool.lro_free_list_head,
+		 &free_pool->lro_free_list_head,
 		 struct hdd_lro_desc_entry, lro_node);
 	if (NULL == entry) {
 		hdd_err("Could not allocate LRO desc!");
-		qdf_spin_unlock_bh(&free_pool.lro_pool_lock);
+		qdf_spin_unlock_bh(&free_pool->lro_pool_lock);
 		return -ENOMEM;
 	}
 
 	list_del_init(&entry->lro_node);
-	qdf_spin_unlock_bh(&free_pool.lro_pool_lock);
+	qdf_spin_unlock_bh(&free_pool->lro_pool_lock);
 
 	if (NULL == entry->lro_desc) {
 		hdd_err("entry->lro_desc is NULL!\n");
@@ -417,11 +419,10 @@ void hdd_lro_flush_pkt(struct net_lro_mgr *lro_mgr,
 
 	lro_desc = hdd_lro_get_desc(lro_mgr, lro_mgr->lro_arr, iph, tcph);
 
-	if (!lro_desc)
-		return;
-
-	hdd_lro_desc_free(lro_desc, adapter);
-	lro_flush_desc(lro_mgr, lro_desc);
+	if (lro_desc) {
+		hdd_lro_desc_free(lro_desc, adapter);
+		lro_flush_desc(lro_mgr, lro_desc);
+	}
 }
 
 /**
@@ -436,16 +437,46 @@ void hdd_lro_flush_pkt(struct net_lro_mgr *lro_mgr,
 void hdd_lro_flush(void *data)
 {
 	hdd_adapter_t *adapter = (hdd_adapter_t *)data;
+	struct hdd_lro_s *hdd_lro;
+	struct hdd_context_s *ctx;
+	QDF_STATUS status;
+	hdd_adapter_list_node_t *adapter_node = NULL, *next = NULL;
 	int i;
 
-	for (i = 0; i < adapter->lro_info.lro_mgr->max_desc; i++) {
-		if (adapter->lro_info.lro_mgr->lro_arr[i].active) {
-			hdd_lro_desc_free(
-				 &adapter->lro_info.lro_mgr->lro_arr[i],
-				 (void *)adapter);
-			lro_flush_desc(adapter->lro_info.lro_mgr,
-				 &adapter->lro_info.lro_mgr->lro_arr[i]);
+	/*
+	 * There is a more comprehensive solution that refactors
+	 * lro_mgr in the adapter into multiple instances, that
+	 * will replace this solution. The following is an interim
+	 * fix.
+	 */
+
+	/* Loop over all adapters and flush them all */
+	ctx = (struct hdd_context_s *)cds_get_context(QDF_MODULE_ID_HDD);
+	if (unlikely(ctx == NULL)) {
+		hdd_err("%s: cannot get hdd_ctx. Flushing failed", __func__);
+		return;
+	}
+
+	status = hdd_get_front_adapter(ctx, &adapter_node);
+	while (NULL != adapter_node && QDF_STATUS_SUCCESS == status) {
+		adapter = adapter_node->pAdapter;
+		hdd_lro = &adapter->lro_info;
+		if (adapter->dev->features & NETIF_F_LRO) {
+			qdf_spin_lock_bh(&hdd_lro->lro_mgr_arr_access_lock);
+			for (i = 0; i < hdd_lro->lro_mgr->max_desc; i++) {
+				if (hdd_lro->lro_mgr->lro_arr[i].active) {
+					hdd_lro_desc_free(
+						&hdd_lro->lro_mgr->lro_arr[i],
+						(void *)adapter);
+					lro_flush_desc(
+						hdd_lro->lro_mgr,
+						&hdd_lro->lro_mgr->lro_arr[i]);
+				}
+			}
+			qdf_spin_unlock_bh(&hdd_lro->lro_mgr_arr_access_lock);
 		}
+		status = hdd_get_next_adapter(ctx, adapter_node, &next);
+		adapter_node = next;
 	}
 }
 
@@ -455,6 +486,8 @@ void hdd_lro_flush(void *data)
  *
  * This function sends the LRO configuration to the firmware
  * via WMA
+ * Make sure that this function gets called after NAPI
+ * instances have been created.
  *
  * Return: 0 - success, < 0 - failure
  */
@@ -462,8 +495,10 @@ int hdd_lro_init(hdd_context_t *hdd_ctx)
 {
 	struct wma_lro_config_cmd_t lro_config;
 
-	if (!hdd_ctx->config->lro_enable) {
-		hdd_err("LRO Disabled");
+	if ((!hdd_ctx->config->lro_enable) &&
+	    (hdd_napi_enabled(HDD_NAPI_ANY) == 0))
+	{
+		hdd_err("LRO and NAPI are both disabled.");
 		return 0;
 	}
 
@@ -509,7 +544,7 @@ int hdd_lro_enable(hdd_context_t *hdd_ctx,
 	uint8_t *lro_mem_ptr;
 
 	if (!hdd_ctx->config->lro_enable ||
-		 NL80211_IFTYPE_STATION != adapter->wdev.iftype) {
+		 QDF_STA_MODE != adapter->device_mode) {
 		hdd_info("LRO Disabled");
 		return 0;
 	}
@@ -557,7 +592,7 @@ int hdd_lro_enable(hdd_context_t *hdd_ctx,
 	 hdd_lro_desc_info_init(hdd_lro);
 
 	hdd_lro->lro_mgr->dev = adapter->dev;
-	if (hdd_ctx->config->enableRxThread)
+	if (hdd_ctx->enableRxThread)
 		hdd_lro->lro_mgr->features = LRO_F_NI;
 
 	if (hdd_napi_enabled(HDD_NAPI_ANY))
@@ -590,7 +625,7 @@ int hdd_lro_enable(hdd_context_t *hdd_ctx,
 void hdd_lro_disable(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter)
 {
 	if (!hdd_ctx->config->lro_enable ||
-		 NL80211_IFTYPE_STATION != adapter->wdev.iftype)
+		 QDF_STA_MODE != adapter->device_mode)
 		return;
 
 	/* Deregister the flush callback */
@@ -629,8 +664,11 @@ enum hdd_lro_rx_status hdd_lro_rx(hdd_context_t *hdd_ctx,
 		struct iphdr *iph;
 		struct tcphdr *tcph;
 		struct net_lro_desc *lro_desc = NULL;
+		struct hdd_lro_s *hdd_lro = &adapter->lro_info;
 		iph = (struct iphdr *)skb->data;
 		tcph = (struct tcphdr *)(skb->data + QDF_NBUF_CB_RX_TCP_OFFSET(skb));
+		qdf_spin_lock_bh(
+			&hdd_lro->lro_mgr_arr_access_lock);
 		if (hdd_lro_eligible(adapter, skb, iph, tcph, &lro_desc)) {
 			struct net_lro_info hdd_lro_info;
 
@@ -647,14 +685,17 @@ enum hdd_lro_rx_status hdd_lro_rx(hdd_context_t *hdd_ctx,
 			lro_receive_skb_ext(adapter->lro_info.lro_mgr, skb,
 				 (void *)adapter, &hdd_lro_info);
 
-			if (!hdd_lro_info.lro_desc->active)
+			if (!hdd_lro_info.lro_desc->active) {
 				hdd_lro_desc_free(lro_desc, adapter);
+			}
 
 			status = HDD_LRO_RX;
 		} else {
 			hdd_lro_flush_pkt(adapter->lro_info.lro_mgr,
 				 iph, tcph, adapter);
 		}
+		qdf_spin_unlock_bh(
+			&hdd_lro->lro_mgr_arr_access_lock);
 	}
 	return status;
 }

Dosya farkı çok büyük olduğundan ihmal edildi
+ 521 - 142
core/hdd/src/wlan_hdd_main.c


+ 45 - 47
core/hdd/src/wlan_hdd_memdump.c

@@ -32,6 +32,9 @@
  *
  */
 
+/* denote that this file does not allow legacy hddLog */
+#define HDD_DISALLOW_LEGACY_HDDLOG 1
+
 #include <sme_api.h>
 #include <wlan_hdd_includes.h>
 #include "wlan_hdd_memdump.h"
@@ -77,13 +80,13 @@ static void memdump_cleanup_timer_cb(void *data)
 
 
 	if (!hdd_ctx->fw_dump_loc) {
-		hddLog(LOG1, FL("Memory dump already freed"));
+		hdd_notice("Memory dump already freed");
 		return;
 	}
 
 	qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE);
 	if (!qdf_ctx) {
-		hddLog(LOGE, FL("QDF context is NULL"));
+		hdd_err("QDF context is NULL");
 		return;
 	}
 
@@ -100,14 +103,14 @@ static void memdump_cleanup_timer_cb(void *data)
 /**
  * wlan_hdd_cfg80211_fw_mem_dump_cb() -  Callback to receive FW memory dump
  * @ctx: pointer to HDD context.
- * @rsp: pointer to fw dump copy complete response
+ * @dump_rsp: pointer to fw dump copy complete response
  *
  * This is a callback function used to indicate user space about the
  * availability for firmware memory dump via vendor event.
  *
  * Return: None
  */
-static void wlan_hdd_cfg80211_fw_mem_dump_cb(void *ctx,
+void wlan_hdd_cfg80211_fw_mem_dump_cb(void *ctx,
 					     struct fw_dump_rsp *dump_rsp)
 {
 	hdd_context_t *hdd_ctx = ctx;
@@ -125,8 +128,7 @@ static void wlan_hdd_cfg80211_fw_mem_dump_cb(void *ctx,
 	if (!dump_rsp->dump_complete ||
 	    context->request_id != dump_rsp->request_id) {
 		spin_unlock(&hdd_context_lock);
-		hddLog(LOGE,
-		       FL("Error @ request_id: %d response_id: %d status: %d"),
+		hdd_err("Error @ request_id: %d response_id: %d status: %d",
 		       context->request_id, dump_rsp->request_id,
 		       dump_rsp->dump_complete);
 		return;
@@ -158,18 +160,18 @@ static int wlan_hdd_send_memdump_rsp(hdd_context_t *hdd_ctx)
 			NLMSG_HDRLEN + NLA_HDRLEN + sizeof(uint32_t));
 
 	if (!skb) {
-		hddLog(LOGE, FL("cfg80211_vendor_cmd_alloc_reply_skb failed"));
+		hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
 		return -ENOMEM;
 	}
 
 	if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_MEMDUMP_SIZE,
 			     FW_MEM_DUMP_SIZE)) {
-		hddLog(LOGE, FL("nla put fail"));
+		hdd_err("nla put fail");
 		goto nla_put_failure;
 	}
 
 	cfg80211_vendor_cmd_reply(skb);
-	hddLog(LOG1, FL("Memdump event sent successfully to user space"));
+	hdd_notice("Memdump event sent successfully to user space");
 	return 0;
 
 nla_put_failure:
@@ -214,12 +216,12 @@ static int __wlan_hdd_cfg80211_get_fw_mem_dump(struct wiphy *wiphy,
 
 	qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE);
 	if (!qdf_ctx) {
-		hddLog(LOGE, FL("QDF context is NULL"));
+		hdd_err("QDF context is NULL");
 		return -EINVAL;
 	}
 
 	if (hdd_ctx->memdump_in_progress) {
-		hddLog(LOGE, FL("Already a memdump req in progress."));
+		hdd_err("Already a memdump req in progress.");
 		return -EBUSY;
 	}
 
@@ -236,7 +238,7 @@ static int __wlan_hdd_cfg80211_get_fw_mem_dump(struct wiphy *wiphy,
 			qdf_ctx, qdf_ctx->dev, FW_MEM_DUMP_SIZE, &paddr);
 		if (!hdd_ctx->fw_dump_loc) {
 			mutex_unlock(&hdd_ctx->memdump_lock);
-			hddLog(LOGE, FL("qdf_mem_alloc_consistent failed"));
+			hdd_err("qdf_mem_alloc_consistent failed");
 			return -ENOMEM;
 		}
 		hdd_ctx->dump_loc_paddr = paddr;
@@ -252,7 +254,7 @@ static int __wlan_hdd_cfg80211_get_fw_mem_dump(struct wiphy *wiphy,
 	fw_mem_dump_req.request_id = FW_MEM_DUMP_REQ_ID;
 	fw_mem_dump_req.num_seg = FW_MEM_DUMP_NUM_SEG;
 
-	hddLog(LOG1, FL("request_id:%d num_seg:%d"),
+	hdd_notice("request_id:%d num_seg:%d",
 		fw_mem_dump_req.request_id, fw_mem_dump_req.num_seg);
 	seg_req = (struct fw_dump_seg_req *) fw_mem_dump_req.segment;
 	for (loop = 0; loop < fw_mem_dump_req.num_seg; loop++) {
@@ -262,13 +264,11 @@ static int __wlan_hdd_cfg80211_get_fw_mem_dump(struct wiphy *wiphy,
 		seg_req->seg_length = FW_MEM_DUMP_SIZE;
 		seg_req->dst_addr_lo = hdd_ctx->dump_loc_paddr;
 		seg_req->dst_addr_hi = 0;
-		hddLog(LOG1, FL("seg_number:%d"), loop);
-		hddLog(LOG1,
-		    FL("seg_id:%d start_addr_lo:0x%x start_addr_hi:0x%x"),
+		hdd_notice("seg_number:%d", loop);
+		hdd_notice("seg_id:%d start_addr_lo:0x%x start_addr_hi:0x%x",
 		    seg_req->seg_id, seg_req->seg_start_addr_lo,
 		    seg_req->seg_start_addr_hi);
-		hddLog(LOG1,
-		    FL("seg_length:%d dst_addr_lo:0x%x dst_addr_hi:0x%x"),
+		hdd_notice("seg_length:%d dst_addr_lo:0x%x dst_addr_hi:0x%x",
 		    seg_req->seg_length, seg_req->dst_addr_lo,
 		    seg_req->dst_addr_hi);
 		seg_req++;
@@ -295,7 +295,7 @@ static int __wlan_hdd_cfg80211_get_fw_mem_dump(struct wiphy *wiphy,
 
 	sme_status = sme_fw_mem_dump(hdd_ctx->hHal, &fw_mem_dump_req);
 	if (QDF_STATUS_SUCCESS != sme_status) {
-		hddLog(LOGE, FL("sme_fw_mem_dump Failed"));
+		hdd_err("sme_fw_mem_dump Failed");
 		mutex_lock(&hdd_ctx->memdump_lock);
 		qdf_mem_free_consistent(qdf_ctx, qdf_ctx->dev,
 			FW_MEM_DUMP_SIZE, hdd_ctx->fw_dump_loc, paddr, dma_ctx);
@@ -313,15 +313,14 @@ static int __wlan_hdd_cfg80211_get_fw_mem_dump(struct wiphy *wiphy,
 	rc = wait_for_completion_timeout(&context->response_event,
 		msecs_to_jiffies(MEMDUMP_COMPLETION_TIME_MS));
 	if (!rc) {
-		hddLog(LOGE, FL("Target response timed out for request_id: %d"),
+		hdd_err("Target response timed out for request_id: %d",
 		       context->request_id);
 		return -ETIMEDOUT;
 	}
 
 	status = wlan_hdd_send_memdump_rsp(hdd_ctx);
 	if (status)
-		hddLog(LOGE,
-			FL("Failed to send FW memory dump rsp to user space"));
+		hdd_err("Failed to send FW memory dump rsp to user space");
 
 	return status;
 }
@@ -397,39 +396,39 @@ static ssize_t memdump_read(struct file *file, char __user *buf,
 
 	hdd_ctx = memdump_get_file_data(file);
 
-	hddLog(LOG1, FL("Read req for size:%zu pos:%llu"), count, *pos);
+	hdd_notice("Read req for size:%zu pos:%llu", count, *pos);
 	status = wlan_hdd_validate_context(hdd_ctx);
 	if (status)
 		return status;
 
 	qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE);
 	if (!qdf_ctx) {
-		hddLog(LOGE, FL("QDF context is NULL"));
+		hdd_err("QDF context is NULL");
 		return -EINVAL;
 	}
 
 	if (!hdd_ctx->memdump_in_progress) {
-		hddLog(LOGE, FL("Current mem dump request timed out/failed"));
+		hdd_err("Current mem dump request timed out/failed");
 		return -EINVAL;
 	}
 
 	if (*pos < 0) {
-		hddLog(LOGE, FL("Invalid start offset for memdump read"));
+		hdd_err("Invalid start offset for memdump read");
 		return -EINVAL;
 	} else if (*pos >= FW_MEM_DUMP_SIZE || !count) {
-		hddLog(LOGE, FL("No more data to copy"));
+		hdd_err("No more data to copy");
 		return 0;
 	} else if (count > FW_MEM_DUMP_SIZE - *pos) {
 		count = FW_MEM_DUMP_SIZE - *pos;
 	}
 
 	if (!hdd_ctx->fw_dump_loc) {
-		hddLog(LOGE, FL("Invalid fw mem dump location"));
+		hdd_err("Invalid fw mem dump location");
 		return -EINVAL;
 	}
 
 	if (copy_to_user(buf, hdd_ctx->fw_dump_loc + *pos, count)) {
-		hddLog(LOGE, FL("copy to user space failed"));
+		hdd_err("copy to user space failed");
 		return -EFAULT;
 	}
 
@@ -480,7 +479,7 @@ static int memdump_procfs_init(void)
 
 	hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
 	if (!hdd_ctx) {
-		hddLog(LOGE , FL("Invalid HDD context"));
+		hdd_err("Invalid HDD context");
 		return -EINVAL;
 	}
 
@@ -536,30 +535,22 @@ int memdump_init(void)
 {
 	hdd_context_t *hdd_ctx;
 	int status = 0;
-	QDF_STATUS cb_status;
 	QDF_STATUS qdf_status;
 
 	hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
 	if (!hdd_ctx) {
-		hddLog(LOGE , FL("Invalid HDD context"));
+		hdd_err("Invalid HDD context");
 		return -EINVAL;
 	}
 
 	if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
-		hddLog(LOGE, FL("Not initializing memdump in FTM mode"));
-		return -EINVAL;
-	}
-
-	cb_status = sme_fw_mem_dump_register_cb(hdd_ctx->hHal,
-				wlan_hdd_cfg80211_fw_mem_dump_cb);
-	if (QDF_STATUS_SUCCESS != cb_status) {
-		hddLog(LOGE , FL("Failed to register the callback"));
+		hdd_err("Not initializing memdump in FTM mode");
 		return -EINVAL;
 	}
 
 	status = memdump_procfs_init();
 	if (status) {
-		hddLog(LOGE , FL("Failed to create proc file"));
+		hdd_err("Failed to create proc file");
 		return status;
 	}
 
@@ -569,11 +560,12 @@ int memdump_init(void)
 				    QDF_TIMER_TYPE_SW, memdump_cleanup_timer_cb,
 				    (void *)hdd_ctx);
 	if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
-		hddLog(LOGE, FL("Failed to init memdump cleanup timer"));
+		hdd_err("Failed to init memdump cleanup timer");
 		return -EINVAL;
 	}
 
 	mutex_init(&hdd_ctx->memdump_lock);
+	hdd_ctx->memdump_init_done = true;
 
 	return 0;
 }
@@ -595,23 +587,28 @@ void memdump_deinit(void)
 
 	hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
 	if (!hdd_ctx) {
-		hddLog(LOGE , FL("Invalid HDD context"));
+		hdd_err("Invalid HDD context");
 		return;
 	}
 
 	if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
-		hddLog(LOGE, FL("Not deinitializing memdump in FTM mode"));
+		hdd_err("Not deinitializing memdump in FTM mode");
+		return;
+	}
+
+	if (!hdd_ctx->memdump_init_done) {
+		hdd_err("MemDump not initialized");
 		return;
 	}
+	hdd_ctx->memdump_init_done = false;
 
 	qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE);
 	if (!qdf_ctx) {
-		hddLog(LOGE, FL("QDF context is NULL"));
+		hdd_err("QDF context is NULL");
 		return;
 	}
 
 	memdump_procfs_remove();
-	sme_fw_mem_dump_unregister_cb(hdd_ctx->hHal);
 
 	mutex_lock(&hdd_ctx->memdump_lock);
 	if (hdd_ctx->fw_dump_loc) {
@@ -622,6 +619,7 @@ void memdump_deinit(void)
 		hdd_ctx->memdump_in_progress = false;
 	}
 	mutex_unlock(&hdd_ctx->memdump_lock);
+	mutex_destroy(&hdd_ctx->memdump_lock);
 
 	if (QDF_TIMER_STATE_RUNNING ==
 	  qdf_mc_timer_get_current_state(&hdd_ctx->memdump_cleanup_timer)) {
@@ -630,5 +628,5 @@ void memdump_deinit(void)
 
 	qdf_status = qdf_mc_timer_destroy(&hdd_ctx->memdump_cleanup_timer);
 	if (!QDF_IS_STATUS_SUCCESS(qdf_status))
-		hddLog(LOGE, FL("Failed to deallocate timer"));
+		hdd_err("Failed to deallocate timer");
 }

+ 1 - 16
core/hdd/src/wlan_hdd_nan.c

@@ -127,7 +127,7 @@ int wlan_hdd_cfg80211_nan_request(struct wiphy *wiphy,
  *
  * Return: nothing
  */
-static void wlan_hdd_cfg80211_nan_callback(void *ctx, tSirNanEvent *msg)
+void wlan_hdd_cfg80211_nan_callback(void *ctx, tSirNanEvent *msg)
 {
 	hdd_context_t *hdd_ctx = ctx;
 	struct sk_buff *vendor_event;
@@ -174,18 +174,3 @@ bool wlan_hdd_nan_is_supported(void)
 {
 	return sme_is_feature_supported_by_fw(NAN);
 }
-
-/**
- * wlan_hdd_nan_init() - HDD NAN initialization function
- * @hdd_ctx: Global HDD context
- *
- * This function is called to initialize the HDD NAN feature.  Currently
- * the only operation required is to register a callback with SME.
- *
- * Return: void
- */
-void wlan_hdd_nan_init(hdd_context_t *hdd_ctx)
-{
-	sme_nan_register_callback(hdd_ctx->hHal,
-				  wlan_hdd_cfg80211_nan_callback);
-}

+ 44 - 48
core/hdd/src/wlan_hdd_nan_datapath.c

@@ -41,7 +41,7 @@ qca_wlan_vendor_ndp_policy[QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_MAX + 1] = {
 	[QCA_WLAN_VENDOR_ATTR_NDP_TRANSACTION_ID] = { .type = NLA_U16 },
 	[QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR] = { .type = NLA_STRING,
 					.len = IFNAMSIZ },
-	[QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_INSTANCE_ID] = { .type = NLA_U16 },
+	[QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_INSTANCE_ID] = { .type = NLA_U32 },
 	[QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL] = { .type = NLA_U32 },
 	[QCA_WLAN_VENDOR_ATTR_NDP_PEER_DISCOVERY_MAC_ADDR] = {
 					.type = NLA_BINARY,
@@ -237,7 +237,6 @@ static int hdd_ndi_start_bss(hdd_adapter_t *adapter,
 		roam_profile->ChannelInfo.ChannelList[0] =
 			NAN_SOCIAL_CHANNEL_2_4GHZ;
 	}
-	hdd_select_cbmode(adapter, operating_channel);
 
 	roam_profile->SSIDs.numOfSSIDs = 1;
 	roam_profile->SSIDs.SSIDList->SSID.length = 0;
@@ -370,6 +369,7 @@ static int hdd_ndi_delete_req_handler(hdd_context_t *hdd_ctx,
 	uint16_t transaction_id;
 	struct nan_datapath_ctx *ndp_ctx;
 	int ret;
+	hdd_station_ctx_t *sta_ctx;
 
 	ENTER();
 
@@ -407,6 +407,12 @@ static int hdd_ndi_delete_req_handler(hdd_context_t *hdd_ctx,
 		return -EINVAL;
 	}
 
+	sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
+	if (!sta_ctx) {
+		hdd_err("sta_ctx is NULL");
+		return -EINVAL;
+	}
+
 	/* check if there are active peers on the adapter */
 	if (ndp_ctx->active_ndp_peers > 0) {
 		hdd_err("NDP peers active: %d, cannot delete NDI",
@@ -414,6 +420,13 @@ static int hdd_ndi_delete_req_handler(hdd_context_t *hdd_ctx,
 		return -EINVAL;
 	}
 
+	/*
+	 * Since, the interface is being deleted, remove the
+	 * broadcast id.
+	 */
+	hdd_ctx->sta_to_adapter[sta_ctx->broadcast_staid] = 0;
+	sta_ctx->broadcast_staid = HDD_WLAN_INVALID_STA_ID;
+
 	ndp_ctx->ndp_delete_transaction_id = transaction_id;
 	ndp_ctx->state = NAN_DATA_NDI_DELETING_STATE;
 
@@ -497,7 +510,7 @@ static int hdd_ndp_initiator_req_handler(hdd_context_t *hdd_ctx,
 		return -EINVAL;
 	}
 	req.service_instance_id =
-		nla_get_u16(tb[QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_INSTANCE_ID]);
+		nla_get_u32(tb[QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_INSTANCE_ID]);
 
 	qdf_mem_copy(req.self_ndi_mac_addr.bytes,
 		     adapter->macAddressCurrent.bytes, QDF_MAC_ADDR_SIZE);
@@ -735,6 +748,10 @@ static void hdd_ndp_iface_create_rsp_handler(hdd_adapter_t *adapter,
 	uint8_t create_transaction_id = 0;
 	uint32_t create_status = NDP_RSP_STATUS_ERROR;
 	uint32_t create_reason = NDP_NAN_DATA_IFACE_CREATE_FAILED;
+	hdd_station_ctx_t *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
+	struct qdf_mac_addr bc_mac_addr = QDF_MAC_ADDR_BROADCAST_INITIALIZER;
+	tCsrRoamInfo roam_info = {0};
+	tSirBssDescription tmp_bss_descp = {0};
 
 	ENTER();
 
@@ -757,6 +774,11 @@ static void hdd_ndp_iface_create_rsp_handler(hdd_adapter_t *adapter,
 		create_fail = true;
 	}
 
+	if (!sta_ctx) {
+		hdd_err("sta_ctx is NULL");
+		create_fail = true;
+	}
+
 	/* notify response to the upper layer */
 	vendor_event = cfg80211_vendor_event_alloc(hdd_ctx->wiphy,
 				NULL,
@@ -827,6 +849,14 @@ static void hdd_ndp_iface_create_rsp_handler(hdd_adapter_t *adapter,
 	if (create_fail)
 		goto close_ndi;
 
+	sta_ctx->broadcast_staid = ndi_rsp->sta_id;
+	hdd_save_peer(sta_ctx, sta_ctx->broadcast_staid, &bc_mac_addr);
+	hdd_roam_register_sta(adapter, &roam_info,
+				sta_ctx->broadcast_staid,
+				&bc_mac_addr, &tmp_bss_descp);
+	hdd_ctx->sta_to_adapter[sta_ctx->broadcast_staid] = adapter;
+
+
 	EXIT();
 	return;
 
@@ -901,12 +931,6 @@ void hdd_ndp_session_end_handler(hdd_adapter_t *adapter)
 	if (wlan_hdd_validate_context(hdd_ctx))
 		return;
 
-	/* Handle only if adapter is in NDI mode */
-	if (QDF_NDI_MODE != adapter->device_mode) {
-		hdd_err("Adapter is not in NDI mode");
-		return;
-	}
-
 	ndp_ctx = WLAN_HDD_GET_NDP_CTX_PTR(adapter);
 	if (!ndp_ctx) {
 		hdd_err("ndp context is NULL");
@@ -1081,7 +1105,6 @@ static void hdd_ndp_new_peer_ind_handler(hdd_adapter_t *adapter,
 	tCsrRoamInfo roam_info = {0};
 	struct nan_datapath_ctx *ndp_ctx = WLAN_HDD_GET_NDP_CTX_PTR(adapter);
 	hdd_station_ctx_t *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
-	struct qdf_mac_addr bc_mac_addr = QDF_MAC_ADDR_BROADCAST_INITIALIZER;
 
 	ENTER();
 
@@ -1110,10 +1133,6 @@ static void hdd_ndp_new_peer_ind_handler(hdd_adapter_t *adapter,
 	hdd_ctx->sta_to_adapter[new_peer_ind->sta_id] = adapter;
 	/* perform following steps for first new peer ind */
 	if (ndp_ctx->active_ndp_peers == 1) {
-		hdd_ctx->sta_to_adapter[NDP_BROADCAST_STAID] = adapter;
-		hdd_save_peer(sta_ctx, NDP_BROADCAST_STAID, &bc_mac_addr);
-		hdd_roam_register_sta(adapter, &roam_info, NDP_BROADCAST_STAID,
-				    &bc_mac_addr, &tmp_bss_descp);
 		hdd_info("Set ctx connection state to connected");
 		sta_ctx->conn_info.connState = eConnectionState_NdiConnected;
 		hdd_wmm_connect(adapter, &roam_info, eCSR_BSS_TYPE_NDI);
@@ -1274,7 +1293,7 @@ ndp_confirm_nla_failed:
  * QCA_WLAN_VENDOR_ATTR_NDP_SUBCMD =
  *         QCA_WLAN_VENDOR_ATTR_NDP_REQUEST_IND (4 bytes)
  * QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR (IFNAMSIZ)
- * QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_INSTANCE_ID (2 bytes)
+ * QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_INSTANCE_ID (4 bytes)
  * QCA_WLAN_VENDOR_ATTR_NDP_NDI_MAC_ADDR (6 bytes)
  * QCA_WLAN_VENDOR_ATTR_NDP_PEER_DISCOVERY_MAC_ADDR (6 bytes)
  * QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID (4 bytes)
@@ -1333,9 +1352,8 @@ static void hdd_ndp_indication_handler(hdd_adapter_t *adapter,
 		return;
 	}
 
-	data_len = 3 * sizeof(uint32_t) + sizeof(uint16_t) +
-		2 * QDF_MAC_ADDR_SIZE + IFNAMSIZ +
-		event->ndp_info.ndp_app_info_len + 8 * NLA_HDRLEN +
+	data_len = (4 * sizeof(uint32_t)) + (2 * QDF_MAC_ADDR_SIZE) + IFNAMSIZ +
+		event->ndp_info.ndp_app_info_len + (8 * NLA_HDRLEN) +
 		NLMSG_HDRLEN;
 
 	/* notify response to the upper layer */
@@ -1356,7 +1374,7 @@ static void hdd_ndp_indication_handler(hdd_adapter_t *adapter,
 	   IFNAMSIZ, adapter->dev->name))
 		goto ndp_indication_nla_failed;
 
-	if (nla_put_u16(vendor_event,
+	if (nla_put_u32(vendor_event,
 	   QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_INSTANCE_ID,
 	   event->service_instance_id))
 		goto ndp_indication_nla_failed;
@@ -1491,10 +1509,7 @@ static void hdd_ndp_end_rsp_handler(hdd_adapter_t *adapter, void *rsp_params)
 	struct sk_buff *vendor_event;
 	hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 	struct ndp_end_rsp_event *rsp = rsp_params;
-	struct nan_datapath_ctx *ndp_ctx;
-	uint32_t data_len, i;
-	int idx;
-	hdd_station_ctx_t *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
+	uint32_t data_len;
 
 	ENTER();
 
@@ -1506,30 +1521,6 @@ static void hdd_ndp_end_rsp_handler(hdd_adapter_t *adapter, void *rsp_params)
 	if (0 != wlan_hdd_validate_context(hdd_ctx))
 		return;
 
-	/* adjust active ndp instances per peer */
-	if (rsp->status == NDP_CMD_RSP_STATUS_SUCCESS) {
-		for (i = 0; i < rsp->num_peers; i++) {
-			adapter = hdd_get_adapter_by_vdev(hdd_ctx,
-						rsp->ndp_map[i].vdev_id);
-			if (NULL == adapter) {
-				hdd_err("adapter for vdev_id: %d not found",
-					rsp->ndp_map[i].vdev_id);
-				continue;
-			}
-			sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
-			ndp_ctx = WLAN_HDD_GET_NDP_CTX_PTR(adapter);
-			idx = hdd_get_peer_idx(sta_ctx,
-					&rsp->ndp_map[i].peer_ndi_mac_addr);
-			if (idx == INVALID_PEER_IDX)
-				hdd_err("can't find addr: %pM in vdev_id: %d, peer table.",
-					&rsp->ndp_map[i].peer_ndi_mac_addr,
-					rsp->ndp_map[i].vdev_id);
-			else
-				ndp_ctx->active_ndp_sessions[idx] =
-					rsp->ndp_map[i].num_active_ndp_sessions;
-		}
-	}
-
 	data_len = NLMSG_HDRLEN + (4 * NLA_HDRLEN) + (3 * sizeof(uint32_t)) +
 		   sizeof(uint16_t);
 
@@ -1621,6 +1612,11 @@ static void hdd_ndp_end_ind_handler(hdd_adapter_t *adapter,
 			continue;
 		}
 		ndp_ctx = WLAN_HDD_GET_NDP_CTX_PTR(ndi_adapter);
+		if (!ndp_ctx) {
+			hdd_err("ndp_ctx is NULL for vdev id: %d",
+				end_ind->ndp_map[i].vdev_id);
+			continue;
+		}
 		idx = hdd_get_peer_idx(sta_ctx,
 				&end_ind->ndp_map[i].peer_ndi_mac_addr);
 		if (idx == INVALID_PEER_IDX) {
@@ -1872,7 +1868,7 @@ int hdd_init_nan_data_mode(struct hdd_adapter_s *adapter)
 	status = sme_open_session(hdd_ctx->hHal, hdd_sme_roam_callback,
 			adapter, (uint8_t *)&adapter->macAddressCurrent,
 			&adapter->sessionId, type, sub_type);
-	if (QDF_STATUS_SUCCESS == status) {
+	if (QDF_STATUS_SUCCESS != status) {
 		hdd_err("sme_open_session() failed with status code %d",
 			status);
 		ret_val = -EAGAIN;

+ 71 - 10
core/hdd/src/wlan_hdd_napi.c

@@ -105,6 +105,7 @@ int hdd_napi_create(void)
 {
 	struct  hif_opaque_softc *hif_ctx;
 	int     rc = 0;
+	hdd_context_t *hdd_ctx;
 
 	NAPI_DEBUG("-->");
 
@@ -116,11 +117,20 @@ int hdd_napi_create(void)
 		rc = hif_napi_create(hif_ctx, hdd_napi_poll,
 				     QCA_NAPI_BUDGET,
 				     QCA_NAPI_DEF_SCALE);
-		if (rc < 0)
+		if (rc < 0) {
 			hdd_err("ERR(%d) creating NAPI instances",
 				rc);
-		else
+		} else {
 			hdd_info("napi instances were created. Map=0x%x", rc);
+			hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
+			if (unlikely(NULL == hdd_ctx)) {
+				QDF_ASSERT( 0 );
+				rc = -EFAULT;
+			} else {
+				rc = hdd_napi_event(NAPI_EVT_INI_FILE,
+					(void *)hdd_ctx->napi_enable);
+			}
+		}
 
 	}
 	NAPI_DEBUG("<-- [rc=%d]", rc);
@@ -204,20 +214,16 @@ int hdd_napi_enabled(int id)
 }
 
 /**
- * hdd_napi_event() - relay the event detected by HDD to HIF NAPI decision maker
+ * hdd_napi_event() - relay the event detected by HDD to HIF NAPI event handler
  * @event: event code
  * @data : event-specific auxiliary data
  *
- * Return code does not indicate a change, but whether or not NAPI is
- * enabled at the time of the return of the function. That is, if NAPI
- * was disabled before the call, and the event does not cause NAPI to be
- * enabled, a value of 0 will be returned indicating that it is (still)
- * disabled.
+ * See function documentation in hif_napi.c::hif_napi_event for list of events
+ * and how each of them is handled.
  *
  * Return:
  *  < 0: error code
- *  = 0: NAPI state = disabled (after processing the event)
- *  = 1: NAPI state = enabled  (after processing the event)
+ *  = 0: event handled successfully
  */
 int hdd_napi_event(enum qca_napi_event event, void *data)
 {
@@ -236,6 +242,61 @@ int hdd_napi_event(enum qca_napi_event event, void *data)
 	return rc;
 }
 
+#ifdef HELIUMPLUS
+/**
+ * hdd_napi_apply_throughput_policy() - implement the throughput action policy
+ * @hddctx:     HDD context
+ * @tx_packets: number of tx packets in the last interval
+ * @rx_packets: number of rx packets in the last interval
+ *
+ * Called by hdd_bus_bw_compute_cb, checks the number of packets in the last
+ * interval, and determines the desired napi throughput state (HI/LO). If
+ * the desired state is different from the current, then it invokes the
+ * event handler to switch to the desired state.
+ *
+ * The policy implementation is limited to this function and
+ * The current policy is: determine the NAPI mode based on the condition:
+ *      (total number of packets > medium threshold)
+ * - tx packets are included because:
+ *   a- tx-completions arrive at one of the rx CEs
+ *   b- in TCP, a lof of TX implies ~(tx/2) rx (ACKs)
+ *   c- so that we can use the same normalized criteria in ini file
+ * - medium-threshold (default: 500 packets / 10 ms), because
+ *   we would like to be more reactive.
+ *
+ * Return: 0 : no action taken, or action return code
+ *         !0: error, or action error code
+ */
+int hdd_napi_apply_throughput_policy(struct hdd_context_s *hddctx,
+				     uint64_t              tx_packets,
+				     uint64_t              rx_packets)
+{
+	int rc = 0;
+	uint64_t packets = tx_packets + rx_packets;
+	enum qca_napi_tput_state req_state;
+	struct qca_napi_data *napid = hdd_napi_get_all();
+	int    enabled;
+
+	NAPI_DEBUG("-->%s(tx=%lld, rx=%lld)", __func__, tx_packets, rx_packets);
+
+	if ((napid != NULL) &&
+	    (enabled = hdd_napi_enabled(HDD_NAPI_ANY))) {
+		if (packets > hddctx->config->busBandwidthHighThreshold)
+			req_state = QCA_NAPI_TPUT_HI;
+		else
+			req_state = QCA_NAPI_TPUT_LO;
+
+		if (req_state != napid->napi_mode)
+			rc = hdd_napi_event(NAPI_EVT_TPUT_STATE,
+					    (void *)req_state);
+	} else {
+		hdd_err("ERR: napid (%p) NULL or napi_enabled (%d) FALSE",
+			napid, enabled);
+	}
+	return rc;
+}
+#endif
+
 /**
  * hdd_napi_poll() - NAPI poll function
  * @napi  : pointer to NAPI struct

+ 88 - 85
core/hdd/src/wlan_hdd_ocb.c

@@ -31,6 +31,9 @@
  * WLAN Host Device Driver 802.11p OCB implementation
  */
 
+/* denote that this file does not allow legacy hddLog */
+#define HDD_DISALLOW_LEGACY_HDDLOG 1
+
 #include "cds_sched.h"
 #include "wlan_hdd_assoc.h"
 #include "wlan_hdd_main.h"
@@ -98,7 +101,7 @@ static int dot11p_validate_qos_params(struct sir_qos_params qos_params[])
 		/* Validate AIFSN */
 		if ((qos_params[i].aifsn < AIFSN_MIN)
 				|| (qos_params[i].aifsn > AIFSN_MAX)) {
-			hddLog(LOGE, FL("Invalid QoS parameter aifsn %d"),
+			hdd_err("Invalid QoS parameter aifsn %d",
 				qos_params[i].aifsn);
 			return -EINVAL;
 		}
@@ -106,7 +109,7 @@ static int dot11p_validate_qos_params(struct sir_qos_params qos_params[])
 		/* Validate CWMin */
 		if ((qos_params[i].cwmin < CW_MIN)
 				|| (qos_params[i].cwmin > CW_MAX)) {
-			hddLog(LOGE, FL("Invalid QoS parameter cwmin %d"),
+			hdd_err("Invalid QoS parameter cwmin %d",
 				qos_params[i].cwmin);
 			return -EINVAL;
 		}
@@ -114,7 +117,7 @@ static int dot11p_validate_qos_params(struct sir_qos_params qos_params[])
 		/* Validate CWMax */
 		if ((qos_params[i].cwmax < CW_MIN)
 				|| (qos_params[i].cwmax > CW_MAX)) {
-			hddLog(LOGE, FL("Invalid QoS parameter cwmax %d"),
+			hdd_err("Invalid QoS parameter cwmax %d",
 				qos_params[i].cwmax);
 			return -EINVAL;
 		}
@@ -221,7 +224,7 @@ static int hdd_ocb_validate_config(hdd_adapter_t *adapter,
 					    config->channels[i].max_pwr,
 					    &config->channels[i].reg_pwr,
 					    &config->channels[i].antenna_max)) {
-			hddLog(LOGE, FL("Invalid channel frequency %d"),
+			hdd_err("Invalid channel frequency %d",
 				config->channels[i].chan_freq);
 			return -EINVAL;
 		}
@@ -254,7 +257,7 @@ static int hdd_ocb_register_sta(hdd_adapter_t *adapter)
 					       adapter->macAddressCurrent.bytes,
 					       &peer_id);
 	if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
-		hddLog(LOGE, FL("Error registering OCB Self Peer!"));
+		hdd_err("Error registering OCB Self Peer!");
 		return -EINVAL;
 	}
 
@@ -273,14 +276,14 @@ static int hdd_ocb_register_sta(hdd_adapter_t *adapter)
 
 	qdf_status = ol_txrx_register_peer(&sta_desc);
 	if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
-		hddLog(LOGE, FL("Failed to register. Status= %d [0x%08X]"),
+		hdd_err("Failed to register. Status= %d [0x%08X]",
 		       qdf_status, qdf_status);
 		return -EINVAL;
 	}
 
 	if (pHddStaCtx->conn_info.staId[0] != 0 &&
 	     pHddStaCtx->conn_info.staId[0] != peer_id) {
-		hddLog(LOGE, FL("The ID for the OCB station has changed."));
+		hdd_err("The ID for the OCB station has changed.");
 	}
 
 	pHddStaCtx->conn_info.staId[0] = peer_id;
@@ -364,7 +367,7 @@ static void hdd_ocb_set_config_callback(void *context_ptr, void *response_ptr)
 		return;
 
 	if (resp && resp->status)
-		hddLog(LOGE, FL("Operation failed: %d"), resp->status);
+		hdd_err("Operation failed: %d", resp->status);
 
 	spin_lock(&hdd_context_lock);
 	if (context->magic == HDD_OCB_MAGIC) {
@@ -414,7 +417,7 @@ static int hdd_ocb_set_config_req(hdd_adapter_t *adapter,
 	struct hdd_ocb_ctxt context = {0};
 
 	if (hdd_ocb_validate_config(adapter, config)) {
-		hddLog(LOGE, FL("The configuration is invalid"));
+		hdd_err("The configuration is invalid");
 		return -EINVAL;
 	}
 
@@ -422,7 +425,7 @@ static int hdd_ocb_set_config_req(hdd_adapter_t *adapter,
 	context.adapter = adapter;
 	context.magic = HDD_OCB_MAGIC;
 
-	hddLog(LOG1, FL("Disabling queues"));
+	hdd_notice("Disabling queues");
 	wlan_hdd_netif_queue_control(adapter, WLAN_NETIF_TX_DISABLE_N_CARRIER,
 		WLAN_CONTROL_PATH);
 
@@ -431,7 +434,7 @@ static int hdd_ocb_set_config_req(hdd_adapter_t *adapter,
 		((hdd_context_t *)adapter->pHddCtx)->hHal, &context,
 		hdd_ocb_set_config_callback, config);
 	if (qdf_status != QDF_STATUS_SUCCESS) {
-		hddLog(LOGE, FL("Error calling SME function."));
+		hdd_err("Error calling SME function.");
 		/* Convert from qdf_status to errno */
 		return -EINVAL;
 	}
@@ -461,7 +464,7 @@ end:
 	context.magic = 0;
 	spin_unlock(&hdd_context_lock);
 	if (rc)
-		hddLog(LOGE, FL("Operation failed: %d"), rc);
+		hdd_err("Operation failed: %d", rc);
 	return rc;
 }
 
@@ -493,7 +496,7 @@ static int __iw_set_dot11p_channel_sched(struct net_device *dev,
 		return -EINVAL;
 
 	if (adapter->device_mode != QDF_OCB_MODE) {
-		hddLog(LOGE, FL("Device not in OCB mode!"));
+		hdd_err("Device not in OCB mode!");
 		return -EINVAL;
 	}
 
@@ -503,7 +506,7 @@ static int __iw_set_dot11p_channel_sched(struct net_device *dev,
 	config = hdd_ocb_config_new(sched->num_channels, sched->num_channels,
 				    0, 0);
 	if (config == NULL) {
-		hddLog(LOGE, FL("Failed to allocate memory!"));
+		hdd_err("Failed to allocate memory!");
 		return -ENOMEM;
 	}
 
@@ -546,7 +549,7 @@ static int __iw_set_dot11p_channel_sched(struct net_device *dev,
 		} else {
 			mac_addr = wlan_hdd_get_intf_addr(adapter->pHddCtx);
 			if (mac_addr == NULL) {
-				hddLog(LOGE, FL("Cannot obtain mac address"));
+				hdd_err("Cannot obtain mac address");
 				rc = -EINVAL;
 				goto fail;
 			}
@@ -586,7 +589,7 @@ static int __iw_set_dot11p_channel_sched(struct net_device *dev,
 
 	rc = hdd_ocb_set_config_req(adapter, config);
 	if (rc) {
-		hddLog(LOGE, FL("Error while setting OCB config"));
+		hdd_err("Error while setting OCB config");
 		goto fail;
 	}
 
@@ -800,7 +803,7 @@ static int __wlan_hdd_cfg80211_ocb_set_config(struct wiphy *wiphy,
 		return -EINVAL;
 
 	if (adapter->device_mode != QDF_OCB_MODE) {
-		hddLog(LOGE, FL("Device not in OCB mode!"));
+		hdd_err("Device not in OCB mode!");
 		return -EINVAL;
 	}
 
@@ -808,13 +811,13 @@ static int __wlan_hdd_cfg80211_ocb_set_config(struct wiphy *wiphy,
 	if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_MAX,
 			data,
 			data_len, qca_wlan_vendor_ocb_set_config_policy)) {
-		hddLog(LOGE, FL("Invalid ATTR"));
+		hdd_err("Invalid ATTR");
 		return -EINVAL;
 	}
 
 	/* Get the number of channels in the schedule */
 	if (!tb[QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_CHANNEL_COUNT]) {
-		hddLog(LOGE, FL("CHANNEL_COUNT is not present"));
+		hdd_err("CHANNEL_COUNT is not present");
 		return -EINVAL;
 	}
 	channel_count = nla_get_u32(
@@ -822,7 +825,7 @@ static int __wlan_hdd_cfg80211_ocb_set_config(struct wiphy *wiphy,
 
 	/* Get the size of the channel schedule */
 	if (!tb[QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_SCHEDULE_SIZE]) {
-		hddLog(LOGE, FL("SCHEDULE_SIZE is not present"));
+		hdd_err("SCHEDULE_SIZE is not present");
 		return -EINVAL;
 	}
 	schedule_size = nla_get_u32(
@@ -847,7 +850,7 @@ static int __wlan_hdd_cfg80211_ocb_set_config(struct wiphy *wiphy,
 				    ndl_chan_list_len,
 				    ndl_active_state_list_len);
 	if (config == NULL) {
-		hddLog(LOGE, FL("Failed to allocate memory!"));
+		hdd_err("Failed to allocate memory!");
 		return -ENOMEM;
 	}
 
@@ -858,12 +861,12 @@ static int __wlan_hdd_cfg80211_ocb_set_config(struct wiphy *wiphy,
 	/* Read the channel array */
 	channel_array = tb[QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_CHANNEL_ARRAY];
 	if (!channel_array) {
-		hddLog(LOGE, FL("No channel present"));
+		hdd_err("No channel present");
 		goto fail;
 	}
 	if (nla_len(channel_array) != channel_count *
 	    sizeof(struct wlan_hdd_ocb_config_channel)) {
-		hddLog(LOGE, FL("CHANNEL_ARRAY is not the correct size"));
+		hdd_err("CHANNEL_ARRAY is not the correct size");
 		goto fail;
 	}
 	wlan_hdd_ocb_config_channel_to_sir_ocb_config_channel(
@@ -890,7 +893,7 @@ static int __wlan_hdd_cfg80211_ocb_set_config(struct wiphy *wiphy,
 		} else {
 			mac_addr = wlan_hdd_get_intf_addr(adapter->pHddCtx);
 			if (mac_addr == NULL) {
-				hddLog(LOGE, FL("Cannot obtain mac address"));
+				hdd_err("Cannot obtain mac address");
 				goto fail;
 			}
 			qdf_mem_copy(config->channels[i].mac_address.bytes,
@@ -906,11 +909,11 @@ static int __wlan_hdd_cfg80211_ocb_set_config(struct wiphy *wiphy,
 	/* Read the schedule array */
 	sched_array = tb[QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_SCHEDULE_ARRAY];
 	if (!sched_array) {
-		hddLog(LOGE, FL("No channel present"));
+		hdd_err("No channel present");
 		goto fail;
 	}
 	if (nla_len(sched_array) != schedule_size * sizeof(*config->schedule)) {
-		hddLog(LOGE, FL("SCHEDULE_ARRAY is not the correct size"));
+		hdd_err("SCHEDULE_ARRAY is not the correct size");
 		goto fail;
 	}
 	qdf_mem_copy(config->schedule, nla_data(sched_array),
@@ -934,7 +937,7 @@ static int __wlan_hdd_cfg80211_ocb_set_config(struct wiphy *wiphy,
 
 	rc = hdd_ocb_set_config_req(adapter, config);
 	if (rc)
-		hddLog(LOGE, FL("Error while setting OCB config: %d"), rc);
+		hdd_err("Error while setting OCB config: %d", rc);
 
 fail:
 	qdf_mem_free(config);
@@ -993,12 +996,12 @@ static int __wlan_hdd_cfg80211_ocb_set_utc_time(struct wiphy *wiphy,
 		return -EINVAL;
 
 	if (adapter->device_mode != QDF_OCB_MODE) {
-		hddLog(LOGE, FL("Device not in OCB mode!"));
+		hdd_err("Device not in OCB mode!");
 		return -EINVAL;
 	}
 
 	if (!wma_is_vdev_up(adapter->sessionId)) {
-		hddLog(LOGE, FL("The device has not been started"));
+		hdd_err("The device has not been started");
 		return -EINVAL;
 	}
 
@@ -1006,35 +1009,35 @@ static int __wlan_hdd_cfg80211_ocb_set_utc_time(struct wiphy *wiphy,
 	if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_OCB_SET_UTC_TIME_MAX,
 		      data,
 		      data_len, qca_wlan_vendor_ocb_set_utc_time_policy)) {
-		hddLog(LOGE, FL("Invalid ATTR"));
+		hdd_err("Invalid ATTR");
 		return -EINVAL;
 	}
 
 	/* Read the UTC time */
 	utc_attr = tb[QCA_WLAN_VENDOR_ATTR_OCB_SET_UTC_TIME_VALUE];
 	if (!utc_attr) {
-		hddLog(LOGE, FL("UTC_TIME is not present"));
+		hdd_err("UTC_TIME is not present");
 		return -EINVAL;
 	}
 	if (nla_len(utc_attr) != SIZE_UTC_TIME) {
-		hddLog(LOGE, FL("UTC_TIME is not the correct size"));
+		hdd_err("UTC_TIME is not the correct size");
 		return -EINVAL;
 	}
 
 	/* Read the time error */
 	time_error_attr = tb[QCA_WLAN_VENDOR_ATTR_OCB_SET_UTC_TIME_ERROR];
 	if (!time_error_attr) {
-		hddLog(LOGE, FL("UTC_TIME is not present"));
+		hdd_err("UTC_TIME is not present");
 		return -EINVAL;
 	}
 	if (nla_len(time_error_attr) != SIZE_UTC_TIME_ERROR) {
-		hddLog(LOGE, FL("UTC_TIME is not the correct size"));
+		hdd_err("UTC_TIME is not the correct size");
 		return -EINVAL;
 	}
 
 	utc = qdf_mem_malloc(sizeof(*utc));
 	if (!utc) {
-		hddLog(LOGE, FL("qdf_mem_malloc failed"));
+		hdd_err("qdf_mem_malloc failed");
 		return -ENOMEM;
 	}
 	utc->vdev_id = adapter->sessionId;
@@ -1043,7 +1046,7 @@ static int __wlan_hdd_cfg80211_ocb_set_utc_time(struct wiphy *wiphy,
 		SIZE_UTC_TIME_ERROR);
 
 	if (sme_ocb_set_utc_time(hdd_ctx->hHal, utc) != QDF_STATUS_SUCCESS) {
-		hddLog(LOGE, FL("Error while setting UTC time"));
+		hdd_err("Error while setting UTC time");
 		rc = -EINVAL;
 	} else {
 		rc = 0;
@@ -1104,18 +1107,18 @@ __wlan_hdd_cfg80211_ocb_start_timing_advert(struct wiphy *wiphy,
 		return -EINVAL;
 
 	if (adapter->device_mode != QDF_OCB_MODE) {
-		hddLog(LOGE, FL("Device not in OCB mode!"));
+		hdd_err("Device not in OCB mode!");
 		return -EINVAL;
 	}
 
 	if (!wma_is_vdev_up(adapter->sessionId)) {
-		hddLog(LOGE, FL("The device has not been started"));
+		hdd_err("The device has not been started");
 		return -EINVAL;
 	}
 
 	timing_advert = qdf_mem_malloc(sizeof(*timing_advert));
 	if (!timing_advert) {
-		hddLog(LOGE, FL("qdf_mem_malloc failed"));
+		hdd_err("qdf_mem_malloc failed");
 		return -ENOMEM;
 	}
 	qdf_mem_zero(timing_advert, sizeof(*timing_advert));
@@ -1126,19 +1129,19 @@ __wlan_hdd_cfg80211_ocb_start_timing_advert(struct wiphy *wiphy,
 		      data,
 		      data_len,
 		      qca_wlan_vendor_ocb_start_timing_advert_policy)) {
-		hddLog(LOGE, FL("Invalid ATTR"));
+		hdd_err("Invalid ATTR");
 		goto fail;
 	}
 
 	if (!tb[QCA_WLAN_VENDOR_ATTR_OCB_START_TIMING_ADVERT_CHANNEL_FREQ]) {
-		hddLog(LOGE, FL("CHANNEL_FREQ is not present"));
+		hdd_err("CHANNEL_FREQ is not present");
 		goto fail;
 	}
 	timing_advert->chan_freq = nla_get_u32(
 		tb[QCA_WLAN_VENDOR_ATTR_OCB_START_TIMING_ADVERT_CHANNEL_FREQ]);
 
 	if (!tb[QCA_WLAN_VENDOR_ATTR_OCB_START_TIMING_ADVERT_REPEAT_RATE]) {
-		hddLog(LOGE, FL("REPEAT_RATE is not present"));
+		hdd_err("REPEAT_RATE is not present");
 		goto fail;
 	}
 	timing_advert->repeat_rate = nla_get_u32(
@@ -1151,13 +1154,13 @@ __wlan_hdd_cfg80211_ocb_start_timing_advert(struct wiphy *wiphy,
 			&timing_advert->timestamp_offset,
 			&timing_advert->time_value_offset);
 	if (timing_advert->template_length <= 0) {
-		hddLog(LOGE, FL("Error while generating the TA frame"));
+		hdd_err("Error while generating the TA frame");
 		goto fail;
 	}
 
 	if (sme_ocb_start_timing_advert(hdd_ctx->hHal, timing_advert) !=
 			QDF_STATUS_SUCCESS) {
-		hddLog(LOGE, FL("Error while starting timing advert"));
+		hdd_err("Error while starting timing advert");
 		rc = -EINVAL;
 	} else {
 		rc = 0;
@@ -1222,18 +1225,18 @@ __wlan_hdd_cfg80211_ocb_stop_timing_advert(struct wiphy *wiphy,
 		return -EINVAL;
 
 	if (adapter->device_mode != QDF_OCB_MODE) {
-		hddLog(LOGE, FL("Device not in OCB mode!"));
+		hdd_err("Device not in OCB mode!");
 		return -EINVAL;
 	}
 
 	if (!wma_is_vdev_up(adapter->sessionId)) {
-		hddLog(LOGE, FL("The device has not been started"));
+		hdd_err("The device has not been started");
 		return -EINVAL;
 	}
 
 	timing_advert = qdf_mem_malloc(sizeof(*timing_advert));
 	if (!timing_advert) {
-		hddLog(LOGE, FL("qdf_mem_malloc failed"));
+		hdd_err("qdf_mem_malloc failed");
 		return -ENOMEM;
 	}
 	qdf_mem_zero(timing_advert, sizeof(sizeof(*timing_advert)));
@@ -1244,12 +1247,12 @@ __wlan_hdd_cfg80211_ocb_stop_timing_advert(struct wiphy *wiphy,
 		      data,
 		      data_len,
 		      qca_wlan_vendor_ocb_stop_timing_advert_policy)) {
-		hddLog(LOGE, FL("Invalid ATTR"));
+		hdd_err("Invalid ATTR");
 		goto fail;
 	}
 
 	if (!tb[QCA_WLAN_VENDOR_ATTR_OCB_STOP_TIMING_ADVERT_CHANNEL_FREQ]) {
-		hddLog(LOGE, FL("CHANNEL_FREQ is not present"));
+		hdd_err("CHANNEL_FREQ is not present");
 		goto fail;
 	}
 	timing_advert->chan_freq = nla_get_u32(
@@ -1257,7 +1260,7 @@ __wlan_hdd_cfg80211_ocb_stop_timing_advert(struct wiphy *wiphy,
 
 	if (sme_ocb_stop_timing_advert(hdd_ctx->hHal, timing_advert) !=
 			QDF_STATUS_SUCCESS) {
-		hddLog(LOGE, FL("Error while stopping timing advert"));
+		hdd_err("Error while stopping timing advert");
 		rc = -EINVAL;
 	} else {
 		rc = 0;
@@ -1348,12 +1351,12 @@ __wlan_hdd_cfg80211_ocb_get_tsf_timer(struct wiphy *wiphy,
 		return -EINVAL;
 
 	if (adapter->device_mode != QDF_OCB_MODE) {
-		hddLog(LOGE, FL("Device not in OCB mode!"));
+		hdd_err("Device not in OCB mode!");
 		return -EINVAL;
 	}
 
 	if (!wma_is_vdev_up(adapter->sessionId)) {
-		hddLog(LOGE, FL("The device has not been started"));
+		hdd_err("The device has not been started");
 		return -EINVAL;
 	}
 
@@ -1368,7 +1371,7 @@ __wlan_hdd_cfg80211_ocb_get_tsf_timer(struct wiphy *wiphy,
 				   hdd_ocb_get_tsf_timer_callback,
 				   &request);
 	if (rc) {
-		hddLog(LOGE, FL("Error calling SME function"));
+		hdd_err("Error calling SME function");
 		/* Need to convert from qdf_status to errno. */
 		return -EINVAL;
 	}
@@ -1376,14 +1379,14 @@ __wlan_hdd_cfg80211_ocb_get_tsf_timer(struct wiphy *wiphy,
 	rc = wait_for_completion_timeout(&context.completion_evt,
 		msecs_to_jiffies(WLAN_WAIT_TIME_OCB_CMD));
 	if (rc == 0) {
-		hddLog(LOGE, FL("Operation timed out"));
+		hdd_err("Operation timed out");
 		rc = -ETIMEDOUT;
 		goto end;
 	}
 	rc = 0;
 
 	if (context.status) {
-		hddLog(LOGE, FL("Operation failed: %d"), context.status);
+		hdd_err("Operation failed: %d", context.status);
 		rc = context.status;
 		goto end;
 	}
@@ -1393,12 +1396,12 @@ __wlan_hdd_cfg80211_ocb_get_tsf_timer(struct wiphy *wiphy,
 		2 * sizeof(uint32_t) + NLMSG_HDRLEN);
 
 	if (!nl_resp) {
-		hddLog(LOGE, FL("cfg80211_vendor_cmd_alloc_reply_skb failed"));
+		hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
 		rc = -ENOMEM;
 		goto end;
 	}
 
-	hddLog(LOGE, FL("Got TSF timer response, high=%d, low=%d"),
+	hdd_err("Got TSF timer response, high=%d, low=%d",
 	       adapter->ocb_get_tsf_timer_resp.timer_high,
 	       adapter->ocb_get_tsf_timer_resp.timer_low);
 
@@ -1418,7 +1421,7 @@ __wlan_hdd_cfg80211_ocb_get_tsf_timer(struct wiphy *wiphy,
 	rc = cfg80211_vendor_cmd_reply(nl_resp);
 	nl_resp = NULL;
 	if (rc) {
-		hddLog(LOGE, FL("cfg80211_vendor_cmd_reply failed: %d"), rc);
+		hdd_err("cfg80211_vendor_cmd_reply failed: %d", rc);
 		goto end;
 	}
 
@@ -1536,12 +1539,12 @@ static int __wlan_hdd_cfg80211_dcc_get_stats(struct wiphy *wiphy,
 		return -EINVAL;
 
 	if (adapter->device_mode != QDF_OCB_MODE) {
-		hddLog(LOGE, FL("Device not in OCB mode!"));
+		hdd_err("Device not in OCB mode!");
 		return -EINVAL;
 	}
 
 	if (!wma_is_vdev_up(adapter->sessionId)) {
-		hddLog(LOGE, FL("The device has not been started"));
+		hdd_err("The device has not been started");
 		return -EINVAL;
 	}
 
@@ -1550,14 +1553,14 @@ static int __wlan_hdd_cfg80211_dcc_get_stats(struct wiphy *wiphy,
 		      data,
 		      data_len,
 		      qca_wlan_vendor_dcc_get_stats)) {
-		hddLog(LOGE, FL("Invalid ATTR"));
+		hdd_err("Invalid ATTR");
 		return -EINVAL;
 	}
 
 	/* Validate all the parameters are present */
 	if (!tb[QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_CHANNEL_COUNT] ||
 	    !tb[QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_REQUEST_ARRAY]) {
-		hddLog(LOGE, FL("Parameters are not present."));
+		hdd_err("Parameters are not present.");
 		return -EINVAL;
 	}
 
@@ -1583,7 +1586,7 @@ static int __wlan_hdd_cfg80211_dcc_get_stats(struct wiphy *wiphy,
 			       hdd_dcc_get_stats_callback,
 			       &request);
 	if (rc) {
-		hddLog(LOGE, FL("Error calling SME function"));
+		hdd_err("Error calling SME function");
 		/* Need to convert from qdf_status to errno. */
 		return -EINVAL;
 	}
@@ -1592,19 +1595,19 @@ static int __wlan_hdd_cfg80211_dcc_get_stats(struct wiphy *wiphy,
 	rc = wait_for_completion_timeout(&context.completion_evt,
 				msecs_to_jiffies(WLAN_WAIT_TIME_OCB_CMD));
 	if (rc == 0) {
-		hddLog(LOGE, FL("Operation failed: %d"), rc);
+		hdd_err("Operation failed: %d", rc);
 		rc = -ETIMEDOUT;
 		goto end;
 	}
 
 	if (context.status) {
-		hddLog(LOGE, FL("There was error: %d"), context.status);
+		hdd_err("There was error: %d", context.status);
 		rc = context.status;
 		goto end;
 	}
 
 	if (!adapter->dcc_get_stats_resp) {
-		hddLog(LOGE, FL("The response was NULL"));
+		hdd_err("The response was NULL");
 		rc = -EINVAL;
 		goto end;
 	}
@@ -1614,7 +1617,7 @@ static int __wlan_hdd_cfg80211_dcc_get_stats(struct wiphy *wiphy,
 		adapter->dcc_get_stats_resp->channel_stats_array_len +
 		NLMSG_HDRLEN);
 	if (!nl_resp) {
-		hddLog(LOGE, FL("cfg80211_vendor_cmd_alloc_reply_skb failed"));
+		hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
 		rc = -ENOMEM;
 		goto end;
 	}
@@ -1636,7 +1639,7 @@ static int __wlan_hdd_cfg80211_dcc_get_stats(struct wiphy *wiphy,
 	rc = cfg80211_vendor_cmd_reply(nl_resp);
 	nl_resp = NULL;
 	if (rc) {
-		hddLog(LOGE, FL("cfg80211_vendor_cmd_reply failed: %d"), rc);
+		hdd_err("cfg80211_vendor_cmd_reply failed: %d", rc);
 		goto end;
 	}
 
@@ -1701,12 +1704,12 @@ static int __wlan_hdd_cfg80211_dcc_clear_stats(struct wiphy *wiphy,
 		return -EINVAL;
 
 	if (adapter->device_mode != QDF_OCB_MODE) {
-		hddLog(LOGE, FL("Device not in OCB mode!"));
+		hdd_err("Device not in OCB mode!");
 		return -EINVAL;
 	}
 
 	if (!wma_is_vdev_up(adapter->sessionId)) {
-		hddLog(LOGE, FL("The device has not been started"));
+		hdd_err("The device has not been started");
 		return -EINVAL;
 	}
 
@@ -1715,13 +1718,13 @@ static int __wlan_hdd_cfg80211_dcc_clear_stats(struct wiphy *wiphy,
 		      data,
 		      data_len,
 		      qca_wlan_vendor_dcc_clear_stats)) {
-		hddLog(LOGE, FL("Invalid ATTR"));
+		hdd_err("Invalid ATTR");
 		return -EINVAL;
 	}
 
 	/* Verify that the parameter is present */
 	if (!tb[QCA_WLAN_VENDOR_ATTR_DCC_CLEAR_STATS_BITMAP]) {
-		hddLog(LOGE, FL("Parameters are not present."));
+		hdd_err("Parameters are not present.");
 		return -EINVAL;
 	}
 
@@ -1730,7 +1733,7 @@ static int __wlan_hdd_cfg80211_dcc_clear_stats(struct wiphy *wiphy,
 		nla_get_u32(
 			tb[QCA_WLAN_VENDOR_ATTR_DCC_CLEAR_STATS_BITMAP])) !=
 			QDF_STATUS_SUCCESS) {
-		hddLog(LOGE, FL("Error calling SME function."));
+		hdd_err("Error calling SME function.");
 		return -EINVAL;
 	}
 
@@ -1820,12 +1823,12 @@ static int __wlan_hdd_cfg80211_dcc_update_ndl(struct wiphy *wiphy,
 		goto end;
 
 	if (adapter->device_mode != QDF_OCB_MODE) {
-		hddLog(LOGE, FL("Device not in OCB mode!"));
+		hdd_err("Device not in OCB mode!");
 		goto end;
 	}
 
 	if (!wma_is_vdev_up(adapter->sessionId)) {
-		hddLog(LOGE, FL("The device has not been started"));
+		hdd_err("The device has not been started");
 		return -EINVAL;
 	}
 
@@ -1834,7 +1837,7 @@ static int __wlan_hdd_cfg80211_dcc_update_ndl(struct wiphy *wiphy,
 		      data,
 		      data_len,
 		      qca_wlan_vendor_dcc_update_ndl)) {
-		hddLog(LOGE, FL("Invalid ATTR"));
+		hdd_err("Invalid ATTR");
 		goto end;
 	}
 
@@ -1842,7 +1845,7 @@ static int __wlan_hdd_cfg80211_dcc_update_ndl(struct wiphy *wiphy,
 	if (!tb[QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_CHANNEL_COUNT] ||
 	    !tb[QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_CHANNEL_ARRAY] ||
 	    !tb[QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_ACTIVE_STATE_ARRAY]) {
-		hddLog(LOGE, FL("Parameters are not present."));
+		hdd_err("Parameters are not present.");
 		return -EINVAL;
 	}
 
@@ -1875,7 +1878,7 @@ static int __wlan_hdd_cfg80211_dcc_update_ndl(struct wiphy *wiphy,
 				hdd_dcc_update_ndl_callback,
 				&request);
 	if (rc) {
-		hddLog(LOGE, FL("Error calling SME function."));
+		hdd_err("Error calling SME function.");
 		/* Convert from qdf_status to errno */
 		return -EINVAL;
 	}
@@ -1884,20 +1887,20 @@ static int __wlan_hdd_cfg80211_dcc_update_ndl(struct wiphy *wiphy,
 	rc = wait_for_completion_timeout(&context.completion_evt,
 		msecs_to_jiffies(WLAN_WAIT_TIME_OCB_CMD));
 	if (rc == 0) {
-		hddLog(LOGE, FL("Operation timed out"));
+		hdd_err("Operation timed out");
 		rc = -ETIMEDOUT;
 		goto end;
 	}
 	rc = 0;
 
 	if (context.status) {
-		hddLog(LOGE, FL("Operation failed: %d"), context.status);
+		hdd_err("Operation failed: %d", context.status);
 		rc = context.status;
 		goto end;
 	}
 
 	if (adapter->dcc_update_ndl_resp.status) {
-		hddLog(LOGE, FL("Operation returned: %d"),
+		hdd_err("Operation returned: %d",
 		       adapter->dcc_update_ndl_resp.status);
 		rc = -EINVAL;
 		goto end;
@@ -1957,7 +1960,7 @@ static void wlan_hdd_dcc_stats_event_callback(void *context_ptr,
 			GFP_KERNEL);
 
 	if (!vendor_event) {
-		hddLog(LOGE, FL("cfg80211_vendor_event_alloc failed"));
+		hdd_err("cfg80211_vendor_event_alloc failed");
 		return;
 	}
 
@@ -1968,7 +1971,7 @@ static void wlan_hdd_dcc_stats_event_callback(void *context_ptr,
 			QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_RESP_STATS_ARRAY,
 			resp->channel_stats_array_len,
 			resp->channel_stats_array)) {
-		hddLog(LOGE, FL("nla put failed"));
+		hdd_err("nla put failed");
 		kfree_skb(vendor_event);
 		return;
 	}
@@ -1985,7 +1988,7 @@ void wlan_hdd_dcc_register_for_dcc_stats_event(hdd_context_t *hdd_ctx)
 	int rc;
 
 	rc = sme_register_for_dcc_stats_event(hdd_ctx->hHal, hdd_ctx,
-		wlan_hdd_dcc_stats_event_callback);
+				      wlan_hdd_dcc_stats_event_callback);
 	if (rc)
-		hddLog(LOGE, FL("Register callback failed: %d"), rc);
+		hdd_err("Register callback failed: %d", rc);
 }

+ 96 - 2
core/hdd/src/wlan_hdd_ocb.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -238,7 +238,7 @@ enum qca_wlan_vendor_attr_dcc_update_ndl {
 	QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_MAX =
 		QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_AFTER_LAST - 1,
 };
-
+#ifdef WLAN_FEATURE_DSRC
 void hdd_set_dot11p_config(hdd_context_t *hdd_ctx);
 
 void hdd_remove_ocb_tx_header(struct sk_buff *skb);
@@ -289,4 +289,98 @@ int wlan_hdd_cfg80211_dcc_update_ndl(struct wiphy *wiphy,
 
 void wlan_hdd_dcc_register_for_dcc_stats_event(hdd_context_t *hdd_ctx);
 
+void wlan_hdd_dcc_stats_event(void *context_ptr, void *response_ptr);
+#else
+static inline void hdd_set_dot11p_config(hdd_context_t *hdd_ctx)
+{
+	return;
+}
+
+static inline void hdd_remove_ocb_tx_header(struct sk_buff *skb)
+{
+	return;
+}
+static inline int iw_set_dot11p_channel_sched(struct net_device *dev,
+		struct iw_request_info *info,
+		union iwreq_data *wrqu, char *extra)
+{
+	return 0;
+}
+
+static inline int wlan_hdd_cfg80211_ocb_set_config(struct wiphy *wiphy,
+		struct wireless_dev *wdev,
+		const void *data,
+		int data_len)
+{
+	return 0;
+}
+
+static inline int wlan_hdd_cfg80211_ocb_set_utc_time(struct wiphy *wiphy,
+		struct wireless_dev *wdev,
+		const void *data,
+		int data_len)
+{
+	return 0;
+}
+
+static inline int wlan_hdd_cfg80211_ocb_start_timing_advert(struct wiphy *wiphy,
+		struct wireless_dev *wdev,
+		const void *data,
+		int data_len)
+{
+	return 0;
+}
+
+static inline int wlan_hdd_cfg80211_ocb_stop_timing_advert(struct wiphy *wiphy,
+		struct wireless_dev *wdev,
+		const void *data,
+		int data_len)
+{
+	return 0;
+}
+
+static inline int wlan_hdd_cfg80211_ocb_get_tsf_timer(struct wiphy *wiphy,
+		struct wireless_dev *wdev,
+		const void *data,
+		int data_len)
+{
+	return 0;
+}
+
+static inline int wlan_hdd_cfg80211_dcc_get_stats(struct wiphy *wiphy,
+		struct wireless_dev *wdev,
+		const void *data,
+		int data_len)
+{
+	return 0;
+}
+
+static inline int wlan_hdd_cfg80211_dcc_clear_stats(struct wiphy *wiphy,
+		struct wireless_dev *wdev,
+		const void *data,
+		int data_len)
+{
+	return 0;
+}
+
+static inline int wlan_hdd_cfg80211_dcc_update_ndl(struct wiphy *wiphy,
+		struct wireless_dev *wdev,
+		const void *data,
+		int data_len)
+{
+	return 0;
+}
+
+static inline void wlan_hdd_dcc_register_for_dcc_stats_event(
+		hdd_context_t *hdd_ctx)
+{
+	return;
+}
+static inline void wlan_hdd_dcc_stats_event(void *context_ptr,
+		void *response_ptr)
+{
+	return;
+}
+#endif
+
 #endif /* __WLAN_HDD_OCB_H */

+ 33 - 36
core/hdd/src/wlan_hdd_oemdata.c

@@ -295,28 +295,29 @@ static void send_oem_err_rsp_nlink_msg(int32_t app_pid, uint8_t error_code)
 
 /**
  * hdd_send_oem_data_rsp_msg() - send oem data response
- * @length: length of the OEM Data Response message
- * @oemDataRsp: the actual OEM Data Response message
+ * @oem_data_rsp: the actual OEM Data Response message
  *
  * This function sends an OEM Data Response message to a registered
  * application process over the netlink socket.
  *
  * Return: 0 for success, non zero for failure
  */
-void hdd_send_oem_data_rsp_msg(int length, uint8_t *oemDataRsp)
+void hdd_send_oem_data_rsp_msg(struct oem_data_rsp *oem_data_rsp)
 {
 	struct sk_buff *skb;
 	struct nlmsghdr *nlh;
-	tAniMsgHdr *aniHdr;
-	uint8_t *oemData;
+	tAniMsgHdr *ani_hdr;
+	uint8_t *oem_data;
 
-	/* OEM message is always to a specific process and cannot be a broadcast */
+	/*
+	 * OEM message is always to a specific process and cannot be a broadcast
+	 */
 	if (p_hdd_ctx->oem_pid == 0) {
 		hdd_err("invalid dest pid");
 		return;
 	}
 
-	if (length > OEM_DATA_RSP_SIZE) {
+	if (oem_data_rsp->rsp_len > OEM_DATA_RSP_SIZE) {
 		hdd_err("invalid length of Oem Data response");
 		return;
 	}
@@ -333,18 +334,18 @@ void hdd_send_oem_data_rsp_msg(int length, uint8_t *oemDataRsp)
 	nlh->nlmsg_flags = 0;
 	nlh->nlmsg_seq = 0;
 	nlh->nlmsg_type = WLAN_NL_MSG_OEM;
-	aniHdr = NLMSG_DATA(nlh);
-	aniHdr->type = ANI_MSG_OEM_DATA_RSP;
+	ani_hdr = NLMSG_DATA(nlh);
+	ani_hdr->type = ANI_MSG_OEM_DATA_RSP;
 
-	aniHdr->length = length;
-	nlh->nlmsg_len = NLMSG_LENGTH((sizeof(tAniMsgHdr) + aniHdr->length));
-	oemData = (uint8_t *) ((char *)aniHdr + sizeof(tAniMsgHdr));
-	qdf_mem_copy(oemData, oemDataRsp, length);
+	ani_hdr->length = oem_data_rsp->rsp_len;
+	nlh->nlmsg_len = NLMSG_LENGTH((sizeof(tAniMsgHdr) + ani_hdr->length));
+	oem_data = (uint8_t *) ((char *)ani_hdr + sizeof(tAniMsgHdr));
+	qdf_mem_copy(oem_data, oem_data_rsp->data, oem_data_rsp->rsp_len);
 
-	skb_put(skb, NLMSG_SPACE((sizeof(tAniMsgHdr) + aniHdr->length)));
+	skb_put(skb, NLMSG_SPACE((sizeof(tAniMsgHdr) + ani_hdr->length)));
 
 	hdd_notice("sending Oem Data Response of len (%d) to process pid (%d)",
-		   length, p_hdd_ctx->oem_pid);
+		   oem_data_rsp->rsp_len, p_hdd_ctx->oem_pid);
 
 	(void)nl_srv_ucast(skb, p_hdd_ctx->oem_pid, MSG_DONTWAIT);
 
@@ -353,52 +354,48 @@ void hdd_send_oem_data_rsp_msg(int length, uint8_t *oemDataRsp)
 
 /**
  * oem_process_data_req_msg() - process oem data request
- * @oemDataLen: Length to OEM Data buffer
- * @oemData: Pointer to OEM Data buffer
+ * @oem_data_len: Length to OEM Data buffer
+ * @oem_data: Pointer to OEM Data buffer
  *
  * This function sends oem message to SME
  *
  * Return: QDF_STATUS enumeration
  */
-static QDF_STATUS oem_process_data_req_msg(int oemDataLen, char *oemData)
+static QDF_STATUS oem_process_data_req_msg(int oem_data_len, char *oem_data)
 {
-	hdd_adapter_t *pAdapter = NULL;
-	tOemDataReqConfig oemDataReqConfig;
-	uint32_t oemDataReqID = 0;
+	hdd_adapter_t *adapter = NULL;
+	struct oem_data_req oem_data_req;
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
 
 	/* for now, STA interface only */
-	pAdapter = hdd_get_adapter(p_hdd_ctx, QDF_STA_MODE);
-	if (!pAdapter) {
+	adapter = hdd_get_adapter(p_hdd_ctx, QDF_STA_MODE);
+	if (!adapter) {
 		hdd_err("No adapter for STA mode");
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	if (!oemData) {
-		hdd_err("oemData is null");
+	if (!oem_data) {
+		hdd_err("oem_data is null");
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	qdf_mem_zero(&oemDataReqConfig, sizeof(tOemDataReqConfig));
+	qdf_mem_zero(&oem_data_req, sizeof(oem_data_req));
 
-	oemDataReqConfig.data = qdf_mem_malloc(oemDataLen);
-	if (!oemDataReqConfig.data) {
+	oem_data_req.data = qdf_mem_malloc(oem_data_len);
+	if (!oem_data_req.data) {
 		hdd_err("malloc failed for data req buffer");
 		return QDF_STATUS_E_NOMEM;
 	}
 
-	oemDataReqConfig.data_len = oemDataLen;
-	qdf_mem_copy(oemDataReqConfig.data, oemData, oemDataLen);
+	oem_data_req.data_len = oem_data_len;
+	qdf_mem_copy(oem_data_req.data, oem_data, oem_data_len);
 
 	hdd_notice("calling sme_oem_data_req");
 
-	status = sme_oem_data_req(p_hdd_ctx->hHal,
-				  pAdapter->sessionId,
-				  &oemDataReqConfig,
-				  &oemDataReqID);
+	status = sme_oem_data_req(p_hdd_ctx->hHal, &oem_data_req);
 
-	qdf_mem_free(oemDataReqConfig.data);
-	oemDataReqConfig.data = NULL;
+	qdf_mem_free(oem_data_req.data);
+	oem_data_req.data = NULL;
 
 	return status;
 }

Dosya farkı çok büyük olduğundan ihmal edildi
+ 228 - 230
core/hdd/src/wlan_hdd_p2p.c


Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor