Search Linux Wireless

Re: [RFC PATCH 11/14] wifi: rtl8xxxu: Put the macid in txdesc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 22/03/2023 19:19, Martin Kaistra wrote:
> Add a parameter macid to fill_txdesc(), implement setting it for the
> gen2 version.
> This is used to tell the HW who the recipient of the packet is, so that
> the appropriate data rate can be selected.
> 
> Signed-off-by: Martin Kaistra <martin.kaistra@xxxxxxxxxxxxx>
> ---
>  drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h |  8 ++++----
>  .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c    | 16 ++++++++++++----
>  2 files changed, 16 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
> index e78e0bbd23354..20304b0bd68a3 100644
> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
> @@ -1917,7 +1917,7 @@ struct rtl8xxxu_fileops {
>  			     struct ieee80211_tx_info *tx_info,
>  			     struct rtl8xxxu_txdesc32 *tx_desc, bool sgi,
>  			     bool short_preamble, bool ampdu_enable,
> -			     u32 rts_rate);
> +			     u32 rts_rate, u8 macid);
>  	void (*set_crystal_cap) (struct rtl8xxxu_priv *priv, u8 crystal_cap);
>  	s8 (*cck_rssi) (struct rtl8xxxu_priv *priv, struct rtl8723au_phy_stats *phy_stats);
>  	int (*led_classdev_brightness_set) (struct led_classdev *led_cdev,
> @@ -2046,17 +2046,17 @@ void rtl8xxxu_fill_txdesc_v1(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
>  			     struct ieee80211_tx_info *tx_info,
>  			     struct rtl8xxxu_txdesc32 *tx_desc, bool sgi,
>  			     bool short_preamble, bool ampdu_enable,
> -			     u32 rts_rate);
> +			     u32 rts_rate, u8 macid);
>  void rtl8xxxu_fill_txdesc_v2(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
>  			     struct ieee80211_tx_info *tx_info,
>  			     struct rtl8xxxu_txdesc32 *tx_desc32, bool sgi,
>  			     bool short_preamble, bool ampdu_enable,
> -			     u32 rts_rate);
> +			     u32 rts_rate, u8 macid);
>  void rtl8xxxu_fill_txdesc_v3(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
>  			     struct ieee80211_tx_info *tx_info,
>  			     struct rtl8xxxu_txdesc32 *tx_desc32, bool sgi,
>  			     bool short_preamble, bool ampdu_enable,
> -			     u32 rts_rate);
> +			     u32 rts_rate, u8 macid);
>  void rtl8723bu_set_ps_tdma(struct rtl8xxxu_priv *priv,
>  			   u8 arg1, u8 arg2, u8 arg3, u8 arg4, u8 arg5);
>  void rtl8723bu_phy_init_antenna_selection(struct rtl8xxxu_priv *priv);
> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> index d74a3c6452507..c232de1d47173 100644
> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> @@ -5152,7 +5152,8 @@ void
>  rtl8xxxu_fill_txdesc_v1(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
>  			struct ieee80211_tx_info *tx_info,
>  			struct rtl8xxxu_txdesc32 *tx_desc, bool sgi,
> -			bool short_preamble, bool ampdu_enable, u32 rts_rate)
> +			bool short_preamble, bool ampdu_enable, u32 rts_rate,
> +			u8 macid)
>  {
>  	struct ieee80211_rate *tx_rate = ieee80211_get_tx_rate(hw, tx_info);
>  	struct rtl8xxxu_priv *priv = hw->priv;
> @@ -5224,7 +5225,8 @@ void
>  rtl8xxxu_fill_txdesc_v2(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
>  			struct ieee80211_tx_info *tx_info,
>  			struct rtl8xxxu_txdesc32 *tx_desc32, bool sgi,
> -			bool short_preamble, bool ampdu_enable, u32 rts_rate)
> +			bool short_preamble, bool ampdu_enable, u32 rts_rate,
> +			u8 macid)
>  {
>  	struct ieee80211_rate *tx_rate = ieee80211_get_tx_rate(hw, tx_info);
>  	struct rtl8xxxu_priv *priv = hw->priv;
> @@ -5248,6 +5250,8 @@ rtl8xxxu_fill_txdesc_v2(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
>  		dev_info(dev, "%s: TX rate: %d, pkt size %u\n",
>  			 __func__, rate, le16_to_cpu(tx_desc40->pkt_size));
>  
> +	tx_desc40->txdw1 |= cpu_to_le32(macid << TXDESC40_MACID_SHIFT);
> +
>  	seq_number = IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl));
>  
>  	tx_desc40->txdw4 = cpu_to_le32(rate);
> @@ -5299,7 +5303,8 @@ void
>  rtl8xxxu_fill_txdesc_v3(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
>  			struct ieee80211_tx_info *tx_info,
>  			struct rtl8xxxu_txdesc32 *tx_desc, bool sgi,
> -			bool short_preamble, bool ampdu_enable, u32 rts_rate)
> +			bool short_preamble, bool ampdu_enable, u32 rts_rate,
> +			u8 macid)
>  {
>  	struct ieee80211_rate *tx_rate = ieee80211_get_tx_rate(hw, tx_info);
>  	struct rtl8xxxu_priv *priv = hw->priv;
> @@ -5398,6 +5403,7 @@ static void rtl8xxxu_tx(struct ieee80211_hw *hw,
>  	u16 pktlen = skb->len;
>  	u16 rate_flag = tx_info->control.rates[0].flags;
>  	int tx_desc_size = priv->fops->tx_desc_size;
> +	u8 macid = 0;
>  	int ret;
>  	bool ampdu_enable, sgi = false, short_preamble = false;
>  
> @@ -5497,9 +5503,11 @@ static void rtl8xxxu_tx(struct ieee80211_hw *hw,
>  	else
>  		rts_rate = 0;
>  
> +	if (vif->type == NL80211_IFTYPE_AP && sta)
> +		macid = sta->aid + 1;
>  
You should have a function which calculates the macid instead of copying
the calculation everywhere.

>  	priv->fops->fill_txdesc(hw, hdr, tx_info, tx_desc, sgi, short_preamble,
> -				ampdu_enable, rts_rate);
> +				ampdu_enable, rts_rate, macid);
>  
>  	rtl8xxxu_calc_tx_desc_csum(tx_desc);
>  




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux