Search Linux Wireless

Re: [PATCH v2 2/3] mt76: mt7915: rework .set_bitrate_mask() to support more options

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

 



On 2021-08-13 04:32, Ryder Lee wrote:
> With this patch, driver can support single rate, (HE)GI and HE_LTF
> configuration through .set_bitrate_mask().
> 
> Tested-by: MeiChia Chiu <meichia.chiu@xxxxxxxxxxxx>
> Signed-off-by: Ryder Lee <ryder.lee@xxxxxxxxxxxx>
> ---
> v2: fix an enum warning
> ---
>  .../net/wireless/mediatek/mt76/mt7915/mac.c   |   2 +-
>  .../net/wireless/mediatek/mt76/mt7915/main.c  |  32 ++--
>  .../net/wireless/mediatek/mt76/mt7915/mcu.c   | 148 +++++++++++++++++-
>  .../net/wireless/mediatek/mt76/mt7915/mcu.h   |  16 +-
>  .../wireless/mediatek/mt76/mt7915/mt7915.h    |   5 +
>  5 files changed, 175 insertions(+), 28 deletions(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
> index 028ee5bb0532..74f08e1c2f55 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
> @@ -2042,6 +2042,128 @@ mt7915_mcu_add_txbf(struct mt7915_dev *dev, struct ieee80211_vif *vif,
>  	return 0;
>  }
>  
> +int mt7915_mcu_set_fixed_rate_ctrl(struct mt7915_dev *dev,
> +				   struct ieee80211_vif *vif,
> +				   struct ieee80211_sta *sta,
> +				   void *data, u32 field)
> +{
> +	struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
> +	struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv;
> +	struct sta_phy *phy = data;
> +	struct sta_rec_ra_fixed *ra;
> +	struct sk_buff *skb;
> +	struct tlv *tlv;
> +	int len = sizeof(struct sta_req_hdr) + sizeof(*ra);
> +
> +	skb = mt7915_mcu_alloc_sta_req(dev, mvif, msta, len);
> +	if (IS_ERR(skb))
> +		return PTR_ERR(skb);
> +
> +	tlv = mt7915_mcu_add_tlv(skb, STA_REC_RA_UPDATE, sizeof(*ra));
> +	ra = (struct sta_rec_ra_fixed *)tlv;
> +
> +	switch (field) {
> +	case RATE_PARAM_AUTO:
> +		break;
> +	case RATE_PARAM_FIXED_MCS:
> +	case RATE_PARAM_FIXED_GI:
> +	case RATE_PARAM_FIXED_HE_LTF:
> +		ra->phy = *phy;
> +		break;
> +	default:
> +		break;
> +	}
> +	ra->field = cpu_to_le32(field);
> +
> +	return mt76_mcu_skb_send_msg(&dev->mt76, skb,
> +				     MCU_EXT_CMD(STA_REC_UPDATE), true);
> +}
> +
> +static int
> +mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev,
> +			       struct ieee80211_vif *vif,
> +			       struct ieee80211_sta *sta)
> +{
> +	struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
> +	struct cfg80211_chan_def *chandef = &mvif->phy->mt76->chandef;
> +	struct cfg80211_bitrate_mask *mask = &mvif->bitrate_mask;
> +	enum nl80211_band band = chandef->chan->band;
> +	struct sta_phy phy = {};
> +	int ret, nrates;
> +
> +#define __sta_phy_bitrate_mask_set(_mcs, _gi, _he)				\
> +	do {									\
> +		u8 i, gi = mask->control[band]._gi;				\
> +		gi = (_he) ? gi : gi == NL80211_TXRATE_FORCE_SGI;		\
> +		for (i = 0; i <= sta->bandwidth; i++) {				\
> +			phy.sgi |= gi << (i << (_he));				\
> +			phy.he_ltf |= mask->control[band].he_ltf << (i << (_he));\
> +		}								\
> +		for (i = 0; i < ARRAY_SIZE(mask->control[band]._mcs); i++) 	\
> +			nrates += hweight16(mask->control[band]._mcs[i]);  	\
> +		phy.mcs = ffs(mask->control[band]._mcs[0]) - 1;			\
> +	} while (0)
> +
> +	if (sta->he_cap.has_he) {
> +		__sta_phy_bitrate_mask_check(he_mcs, he_gi, 1);
This does not compile because of a wrong macro name (_set vs _check).

- Felix



[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