RE: [PATCH 15/50] wifi: ath12k: add dp_rx.c

Sriram R (QUIC)
2022-10-12T23:27:26Z

>> +static int ath12k_get_ppdu_user_index(struct htt_ppdu_stats
>*ppdu_stats,
>> + u16 peer_id) {
>> + int i;
>> +
>> + for (i = 0; i < HTT_PPDU_STATS_MAX_USERS - 1; i++) {
>> + if (ppdu_stats->user_stats[i].is_valid_peer_id) {
>> + if (peer_id == ppdu_stats->user_stats[i].peer_id)
>> + return i;
>> + } else {
>> + return i;
>> + }
>
>is the user_stats[] array maintained in a manner where the
>"is_valid_peer_id" records are always at the beginning of the array?
>
>if not, then don't you have an issue if entry 0 has is_valid_peer_id = false
>and entry 1 has is_valid_peer_id = true and peer_id is matching since in that
>case you'd return 0 instead of 1?
That’s right. We use this function to get new ids starting from 0. So if an id is already
used (indicated by is_valid_peer_id) we move to the next id and return it and the
caller would set the is_valid_peer_id for that id and mark it.