wifi: iwlwifi: mvm: implement link grading
authorMiri Korenblit <miriam.rachel.korenblit@intel.com>
Tue, 16 Apr 2024 10:53:58 +0000 (13:53 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 19 Apr 2024 08:16:32 +0000 (10:16 +0200)
commit2887af4d22f90bcddd3ff9a6eb93ecdaab3acd94
tree4e7140d9cd33bffcf75a1568c67f7c54dfa7ef03
parentbde2f9b420f69297455df7fb68792e486c04a9b4
wifi: iwlwifi: mvm: implement link grading

For selecting what link(s) out of the usable ones
to activate, calculate a grade for a given link.

Calculation of a link grade is done as follows:
1. get the estimated throughput according to the RSSI of the link, this
   will be the base grade
2. get the channel load from the BSS Load Element, subtracting the load
   caused by us. Apply the factor on the grade.
3. puncturing factor: calculate the percentage of the punctured
   subchannels (out of the total subchannels). Apply this on the grade.

The link grading will be used by the link selection mechanism in a later
patch.

Also add KUnit tests for it.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Link: https://msgid.link/20240416134215.a6799dbd5643.If137ca6dc443606c7d8c99ec1fc38b325003a7c1@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/Makefile
drivers/net/wireless/intel/iwlwifi/mvm/link.c
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
drivers/net/wireless/intel/iwlwifi/mvm/tests/Makefile [new file with mode: 0644]
drivers/net/wireless/intel/iwlwifi/mvm/tests/links.c [new file with mode: 0644]
drivers/net/wireless/intel/iwlwifi/mvm/tests/module.c [new file with mode: 0644]
include/linux/ieee80211.h