Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DNM] Fix processing of power limit file #2

Draft
wants to merge 4 commits into
base: starry-10.3.8.0-20181031
Choose a base branch
from

Conversation

nhed
Copy link

@nhed nhed commented Oct 29, 2020

  • The last commit (Fix undersized) is the actual fix!
  • The first two commits (Harden parsing, & Probably should not release mutex) address potential issues.
  • The third commit (Add /sys/kernel) is nice to have but function can be performed with a bash script as well (which I have).

@nhed nhed force-pushed the nhed/txpwrlmt_cfg_issues branch 2 times, most recently from c9e96b1 to f05b23c Compare October 30, 2020 00:16
debugfs.c Outdated Show resolved Hide resolved
debugfs.c Outdated Show resolved Hide resolved
debugfs.c Outdated Show resolved Hide resolved
debugfs.c Outdated Show resolved Hide resolved
debugfs.c Outdated Show resolved Hide resolved
hif/fwcmd.c Outdated Show resolved Hide resolved
@nhed nhed force-pushed the nhed/txpwrlmt_cfg_issues branch from f05b23c to 3693ddd Compare November 2, 2020 19:30
@nhed nhed requested a review from mtp401 November 2, 2020 19:34
mtp401
mtp401 previously approved these changes Nov 3, 2020
@nhed nhed marked this pull request as ready for review November 19, 2020 22:06
@nhed nhed force-pushed the nhed/txpwrlmt_cfg_issues branch from 3693ddd to 1d7a521 Compare November 19, 2020 22:09
@StarryInternet StarryInternet locked and limited conversation to collaborators May 6, 2021
@nhed nhed marked this pull request as draft September 7, 2021 15:13
The helper function mwl_fwcmd_parse_txpwrlmt_cfg could run into
several errors reading input form essentially a text hexdump and
converting it to binary data to send to the firmware.

Adding some sanity checks to guard against:
- Only the first char of a (2 char) hex byte was tested, second char
  was wrongfully assumed to be hex.
- Unrecognized characters were silently skipped.  So human error
  leaving a `O` instead of a `0` would have dire consequences.  Prefer
  to abort the whole file processing.
- Being able to convert less than the requested number of bytes should
  be a total failure.

Added aborts in mwl_fwcmd_set_txpwrlmt_cfg_data if any of the
invocations of the helper function above failed.  Note that this
allows some (lower ID) subbands to be sent to firmware while later
subbands woul be skipped.
This presents the same data as mwlwifi/txpwrlmt but it is formatted as
hex for consumption as the firmware file mwlwifi/txpwrlmt_cfg.conf.

With this you can:
1. Save the current eeprom stored values when
   mwlwifi/txpwrlmt_cfg.conf is not present for manual editing (to
   lower values).
2. Compare (diff) against mwlwifi/txpwrlmt_cfg.conf (when it is
   present) to confirm that it is properly processed.
The message includes not only the subband data but also the subband
header so reducing the message by the header size caused some data
read from file to trashed on way to firmware.  With this mod can read
back same subband data as is present in the txpwrlmt_cfg.conf file.
@nhed nhed force-pushed the nhed/txpwrlmt_cfg_issues branch from 1d7a521 to e215a73 Compare September 24, 2022 21:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants