2022-01-21 16:58:11

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 3/4] rtw88: Move enum rtw_tx_queue_type mapping code to tx.{c,h}

Pkshih <[email protected]> writes:

>> -----Original Message-----
>> From: Martin Blumenstingl <[email protected]>
>> Sent: Saturday, January 15, 2022 7:48 AM
>> To: [email protected]
>> Cc: [email protected]; [email protected];
>> [email protected]; [email protected];
>> Neo Jou <[email protected]>; Jernej Skrabec
>> <[email protected]>; Pkshih <[email protected]>; Martin
>> Blumenstingl <[email protected]>
>> Subject: [PATCH 3/4] rtw88: Move enum rtw_tx_queue_type mapping code to tx.{c,h}
>>
>> This code is not specific to the PCIe bus type but can be re-used by USB
>> and SDIO bus types. Move it to tx.{c,h} to avoid code-duplication in the
>> future.
>>
>> Signed-off-by: Martin Blumenstingl <[email protected]>
>
> [...]
>
>> diff --git a/drivers/net/wireless/realtek/rtw88/tx.c b/drivers/net/wireless/realtek/rtw88/tx.c
>> index efcc1b0371a8..ec6a3683c3f8 100644
>> --- a/drivers/net/wireless/realtek/rtw88/tx.c
>> +++ b/drivers/net/wireless/realtek/rtw88/tx.c
>> @@ -665,3 +665,38 @@ void rtw_txq_cleanup(struct rtw_dev *rtwdev, struct ieee80211_txq *txq)
>> list_del_init(&rtwtxq->list);
>> spin_unlock_bh(&rtwdev->txq_lock);
>> }
>> +
>> +static enum rtw_tx_queue_type ac_to_hwq[] = {
>> + [IEEE80211_AC_VO] = RTW_TX_QUEUE_VO,
>> + [IEEE80211_AC_VI] = RTW_TX_QUEUE_VI,
>> + [IEEE80211_AC_BE] = RTW_TX_QUEUE_BE,
>> + [IEEE80211_AC_BK] = RTW_TX_QUEUE_BK,
>> +};
>> +
>> +static_assert(ARRAY_SIZE(ac_to_hwq) == IEEE80211_NUM_ACS);
>> +
>> +enum rtw_tx_queue_type rtw_tx_ac_to_hwq(enum ieee80211_ac_numbers ac)
>> +{
>> + return ac_to_hwq[ac];
>> +}
>> +EXPORT_SYMBOL(rtw_tx_ac_to_hwq);
>> +
>
> Could I know why we can't just export the array ac_to_hwq[]?
> Is there a strict rule?

I was about to answer that with a helper function it's easier to catch
out of bands access, but then noticed the helper doesn't have a check
for that. Should it have one?

--
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches