Browse Source

qcacmn: Rectify 20 MHz opclass check

When the CLI command wifitool athX disable_opclass_chans is executed
with a valid 20 MHz operating class, the command throws an error,
"Opclass should only be 20 MHz opclass" on the console.

The opclass passed as an argument to reg_enable_disable_opclass_chans,
which is greater than 20 MHz in value, makes the API reg_is_20mhz_opclass,
always return false.

To fix the issue, pass channel spacing (in MHz units) as an argument to
the 'reg_is_20mhz_opclass'. Also rename 'reg_is_20mhz_opclass' to
'reg_is_chanspacing_20mhz' as we are verifying if the channel spacing
of an opclass is close to 20 MHz; not verifying the opclass itself.

Change-Id: I198b4d90c68613210377b96f6836c5b8c810dc7f
CRs-Fixed: 3410934
Hariharan Basuthkar 2 năm trước cách đây
mục cha
commit
aecdfaa78a
1 tập tin đã thay đổi với 3 bổ sung3 xóa
  1. 3 3
      umac/regulatory/core/src/reg_opclass.c

+ 3 - 3
umac/regulatory/core/src/reg_opclass.c

@@ -2176,9 +2176,9 @@ reg_is_inlst_subset_of_opchanlst(const uint8_t *opclass_chan_list,
 	return false;
 }
 
-static bool reg_is_opclass_20mhz(uint8_t opclass)
+static bool reg_is_chanspacing_20mhz(uint16_t ch_spacing)
 {
-	return (opclass >= BW_20_MHZ) && (opclass <= BW_25_MHZ);
+	return (ch_spacing >= BW_20_MHZ) && (ch_spacing <= BW_25_MHZ);
 }
 
 QDF_STATUS reg_enable_disable_opclass_chans(struct wlan_objmgr_pdev *pdev,
@@ -2213,7 +2213,7 @@ QDF_STATUS reg_enable_disable_opclass_chans(struct wlan_objmgr_pdev *pdev,
 
 	while (op_class_tbl->op_class) {
 		if (opclass == op_class_tbl->op_class) {
-			if (!reg_is_opclass_20mhz(opclass)) {
+			if (!reg_is_chanspacing_20mhz(op_class_tbl->chan_spacing)) {
 				reg_err("Opclass should only be 20 MHz opclass");
 				return QDF_STATUS_E_INVAL;
 			}