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

Inconsistent Use of Base for Rate Indices #65

Open
prashiddhath opened this issue Jun 4, 2024 · 0 comments
Open

Inconsistent Use of Base for Rate Indices #65

prashiddhath opened this issue Jun 4, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@prashiddhath
Copy link
Collaborator

The current rateman uses a mix of decimal and hexadecimal indices, which can be quite confusing.

Use of Integer in STA-supported rates

def parse_sta(ap, fields: list):
supported_rates = []
radio = fields[0]
timestamp = int(fields[1], 16)
mac = fields[4]
iface = fields[5]
rc_mode = fields[6]
tpc_mode = fields[7]
overhead_mcs = int(fields[8], 16)
overhead_legacy = int(fields[9], 16)
update_freq = int(fields[10], 16)
sample_freq = int(fields[11], 16)
mcs_groups = fields[12:]
for i, grp_idx in enumerate(ap.all_rate_info):
mask = int(mcs_groups[i], 16)
for ofs in range(10):
if mask & (1 << ofs):
supported_rates.append(i * 16 + ofs)

Use of Hexademical for header rates

def parse_group_info(fields):
"""
Obtain maximum offset for a given MCS rate group available for an AP.
Parameters
----------
fields : list
Fields obtained by spliting a data line received from the AP
over the Rate Control API.
Returns
-------
group_idx : str
Index of MCS rate group.
max_offset : str
Maximum allowable offset - determines which rates are available
in the group for the AP.
"""
fields = list(filter(None, fields))
group_ind = fields[3]
airtimes_hex = fields[9:]
rate_offsets = [str(ii) for ii in range(len(airtimes_hex))]
rate_inds = list(map(lambda jj: group_ind + jj, rate_offsets))
airtimes_ns = [int(ii, 16) for ii in airtimes_hex]
bandwidth = f"{AVAILABLE_PARAMS['bandwidth'][int(fields[7])]}MHz"
guard_interval = f"{list(AVAILABLE_PARAMS['guard_interval'])[int(fields[8])]}"
guard_interval_microsec = f"{AVAILABLE_PARAMS['guard_interval'][guard_interval]}"
group_info = {
"rate_inds": rate_inds,
"airtimes_ns": airtimes_ns,
"type": fields[5],
"mcs": AVAILABLE_PARAMS["mcs"][: len(rate_inds)],
"nss": int(fields[6]),
"bandwidth": bandwidth,
"guard_interval": guard_interval,
"guard_interval_microsec": guard_interval_microsec,
}
return group_ind, group_info

It would be better to stick to a single base such as decimals.

@prashiddhath prashiddhath added the enhancement New feature or request label Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants