Skip to content

Commit 3576b01

Browse files
Ensure set_bitrate_mask compatibility across kernel versions
Resolve type mismatch error in vwifi_set_bitrate_mask for kernels < 5.19.2, where cfg80211_ops. set_bitrate_mask lacks the link_id parameter, causing a build failure. Add conditional compilation using LINUX_VERSION_CODE to define vwifi_set_bitrate_mask with or without link_id, ensuring compatibility with kernels >= 5.19.2 and older. Preserve all MCS and GI functionality. Changes: - Define vwifi_set_bitrate_mask with link_id for kernels >= 5.19.2 and without for older kernels. - Update logging to include link_id only for newer kernels. - Retain vwifi_vif fields (manual_mcs, manual_mcs_set, spatial_streams) and MCS logic (log all enabled MCSs, select highest, default to MCS 0). Fixes: Type mismatch error for set_bitrate_mask on kernels < 5.19.2
1 parent f3b53fd commit 3576b01

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

scripts/verify.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ if [ $final_ret -eq 0 ]; then
4848
vw3_phy=$(get_wiphy_name vw3)
4949
vw4_phy=$(get_wiphy_name vw4)
5050
vw5_phy=$(get_wiphy_name vw5)
51-
51+
5252
# create network namespaces for each phy (interface)
5353
sudo ip netns add ns0
5454
sudo ip netns add ns1
@@ -290,7 +290,7 @@ if [ $final_ret -eq 0 ]; then
290290
echo "================================================================================"
291291
sudo ip netns exec ns3 ping -c 1 10.0.0.6
292292

293-
# ping test: IBSS vw3 <--> IBSS vw4, should success
293+
# ping test: IBSS vw3 <--> IBSS vw4, should succeed
294294
echo
295295
echo "================================================================================"
296296
echo "Ping Test: IBSS vw3 (10.0.0.4) (in ibss1) <--> IBSS vw4 (10.0.0.5) (in ibss1)"

vwifi.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2397,7 +2397,9 @@ static int vwifi_leave_ibss(struct wiphy *wiphy, struct net_device *ndev)
23972397
*/
23982398
static int vwifi_set_bitrate_mask(struct wiphy *wiphy,
23992399
struct net_device *dev,
2400+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2)
24002401
unsigned int link_id,
2402+
#endif
24012403
const u8 *peer,
24022404
const struct cfg80211_bitrate_mask *mask)
24032405
{
@@ -2414,8 +2416,13 @@ static int vwifi_set_bitrate_mask(struct wiphy *wiphy,
24142416
return -EINVAL;
24152417
}
24162418

2419+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2)
24172420
pr_info("vwifi: set_bitrate_mask called for dev %s, link_id %u, peer %pM\n",
24182421
dev->name, link_id, peer ? peer : vif->bssid);
2422+
#else
2423+
pr_info("vwifi: set_bitrate_mask called for dev %s, peer %pM\n", dev->name,
2424+
peer ? peer : vif->bssid);
2425+
#endif
24192426
pr_info("vwifi: 2.4GHz MCS mask: %02x %02x %02x %02x\n",
24202427
mask->control[NL80211_BAND_2GHZ].ht_mcs[0],
24212428
mask->control[NL80211_BAND_2GHZ].ht_mcs[1],

0 commit comments

Comments
 (0)