Skip to content

Commit

Permalink
rtw89: Fix build for kernels older that 5.4
Browse files Browse the repository at this point in the history
These kernels do not define NL80211_BAND_6GHZ.

Signed-off-by: Larry Finger <[email protected]>
  • Loading branch information
lwfinger committed Apr 20, 2022
1 parent e369940 commit c7ceb31
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -3393,8 +3393,10 @@ rtw89_mac_c2h_scanofld_rsp(struct rtw89_dev *rtwdev, struct sk_buff *c2h,
reason = RTW89_GET_MAC_C2H_SCANOFLD_RSP(c2h->data);
band = RTW89_GET_MAC_C2H_SCANOFLD_BAND(c2h->data);

#if LINUX_VERSION_CODE >= KERNEL_VERSION(5. 4, 0)
if (!(rtwdev->chip->support_bands & BIT(NL80211_BAND_6GHZ)))
band = chan > 14 ? RTW89_BAND_5G : RTW89_BAND_2G;
#endif

rtw89_debug(rtwdev, RTW89_DBG_HW_SCAN,
"band: %d, chan: %d, reason: %d, status: %d, tx_fail: %d\n",
Expand Down
4 changes: 4 additions & 0 deletions phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,13 @@ static u64 rtw89_phy_ra_mask_cfg(struct rtw89_dev *rtwdev, struct rtw89_sta *rtw
cfg_mask = u64_encode_bits(mask->control[NL80211_BAND_5GHZ].legacy,
RA_MASK_OFDM_RATES);
break;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5. 4, 0)
case RTW89_BAND_6G:
band = NL80211_BAND_6GHZ;
cfg_mask = u64_encode_bits(mask->control[NL80211_BAND_6GHZ].legacy,
RA_MASK_OFDM_RATES);
break;
#endif
default:
rtw89_warn(rtwdev, "unhandled band type %d\n", hal->current_band_type);
return -1;
Expand Down Expand Up @@ -274,10 +276,12 @@ static void rtw89_phy_ra_sta_update(struct rtw89_dev *rtwdev,
ra_mask |= (u64)sta->supp_rates[NL80211_BAND_5GHZ] << 4;
mode |= RTW89_RA_MODE_OFDM;
break;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5. 4, 0)
case RTW89_BAND_6G:
ra_mask |= (u64)sta->supp_rates[NL80211_BAND_6GHZ] << 4;
mode |= RTW89_RA_MODE_OFDM;
break;
#endif
default:
rtw89_err(rtwdev, "Unknown band type\n");
break;
Expand Down

0 comments on commit c7ceb31

Please sign in to comment.