Message ID | 20221107212358.272070-4-gilad.itzkovitch@morsemicro.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Johannes Berg |
Headers | show |
Series | [1/4] wifi: cfg80211: Add long_beacon_interval and short_beacon_tail | expand |
Hi Gilad, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on wireless-next/main] [also build test WARNING on next-20221108] [cannot apply to wireless/main linus/master v6.1-rc4] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Gilad-Itzkovitch/wifi-cfg80211-Add-long_beacon_interval-and-short_beacon_tail/20221108-052643 base: https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main patch link: https://lore.kernel.org/r/20221107212358.272070-4-gilad.itzkovitch%40morsemicro.com patch subject: [PATCH 4/4] wifi: mac80211: support setting S1G short beacon period and tail config: x86_64-rhel-8.3-kvm compiler: gcc-11 (Debian 11.3.0-8) 11.3.0 reproduce (this is a W=1 build): # https://github.com/intel-lab-lkp/linux/commit/37bed728d5f225d3728bddc7bea70156db88f5e8 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Gilad-Itzkovitch/wifi-cfg80211-Add-long_beacon_interval-and-short_beacon_tail/20221108-052643 git checkout 37bed728d5f225d3728bddc7bea70156db88f5e8 # save the config file mkdir build_dir && cp config build_dir/.config make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash kernel/bpf/ net/mac80211/ net/mptcp/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): net/mac80211/cfg.c: In function 'ieee80211_assign_beacon': >> net/mac80211/cfg.c:1095:19: warning: unused variable 'size_short' [-Wunused-variable] 1095 | int size, size_short, err; | ^~~~~~~~~~ vim +/size_short +1095 net/mac80211/cfg.c 1085 1086 static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata, 1087 struct ieee80211_link_data *link, 1088 struct cfg80211_beacon_data *params, 1089 const struct ieee80211_csa_settings *csa, 1090 const struct ieee80211_color_change_settings *cca) 1091 { 1092 struct cfg80211_mbssid_elems *mbssid = NULL; 1093 struct beacon_data *new, *old; 1094 int new_head_len, new_tail_len, new_short_tail_len; > 1095 int size, size_short, err; 1096 u32 changed = BSS_CHANGED_BEACON; 1097 struct ieee80211_bss_conf *link_conf = link->conf; 1098 1099 old = sdata_dereference(link->u.ap.beacon, sdata); 1100 1101 /* Need to have a beacon head if we don't have one yet */ 1102 if (!params->head && !old) 1103 return -EINVAL; 1104 1105 /* new or old head? */ 1106 if (params->head) 1107 new_head_len = params->head_len; 1108 else 1109 new_head_len = old->head_len; 1110 1111 /* new or old tail? */ 1112 if (params->tail || !old) 1113 /* params->tail_len will be zero for !params->tail */ 1114 new_tail_len = params->tail_len; 1115 else 1116 new_tail_len = old->tail_len; 1117 1118 if (params->short_tail || !old) 1119 /* params->tail_len will be zero for !params->tail */ 1120 new_short_tail_len = params->short_tail_len; 1121 else 1122 new_short_tail_len = old->short_tail_len; 1123 1124 size = sizeof(*new) + new_head_len + new_tail_len + new_short_tail_len; 1125 1126 /* new or old multiple BSSID elements? */ 1127 if (params->mbssid_ies) { 1128 mbssid = params->mbssid_ies; 1129 size += struct_size(new->mbssid_ies, elem, mbssid->cnt); 1130 size += ieee80211_get_mbssid_beacon_len(mbssid); 1131 } else if (old && old->mbssid_ies) { 1132 mbssid = old->mbssid_ies; 1133 size += struct_size(new->mbssid_ies, elem, mbssid->cnt); 1134 size += ieee80211_get_mbssid_beacon_len(mbssid); 1135 } 1136 1137 new = kzalloc(size, GFP_KERNEL); 1138 if (!new) 1139 return -ENOMEM; 1140 1141 /* start filling the new info now */ 1142 1143 /* 1144 * pointers go into the block we allocated, 1145 * memory is | beacon_data | head | tail | mbssid_ies 1146 */ 1147 new->head = ((u8 *) new) + sizeof(*new); 1148 new->tail = new->head + new_head_len; 1149 new->head_len = new_head_len; 1150 new->tail_len = new_tail_len; 1151 new->short_tail = new->tail + new->tail_len; 1152 new->short_tail_len = new_short_tail_len; 1153 1154 /* copy in optional mbssid_ies */ 1155 if (mbssid) { 1156 u8 *pos = new->short_tail + new->short_tail_len; 1157 1158 new->mbssid_ies = (void *)pos; 1159 pos += struct_size(new->mbssid_ies, elem, mbssid->cnt); 1160 ieee80211_copy_mbssid_beacon(pos, new->mbssid_ies, mbssid); 1161 /* update bssid_indicator */ 1162 link_conf->bssid_indicator = 1163 ilog2(__roundup_pow_of_two(mbssid->cnt + 1)); 1164 } 1165 1166 if (csa) { 1167 new->cntdwn_current_counter = csa->count; 1168 memcpy(new->cntdwn_counter_offsets, csa->counter_offsets_beacon, 1169 csa->n_counter_offsets_beacon * 1170 sizeof(new->cntdwn_counter_offsets[0])); 1171 } else if (cca) { 1172 new->cntdwn_current_counter = cca->count; 1173 new->cntdwn_counter_offsets[0] = cca->counter_offset_beacon; 1174 } 1175 1176 /* copy in head */ 1177 if (params->head) 1178 memcpy(new->head, params->head, new_head_len); 1179 else 1180 memcpy(new->head, old->head, new_head_len); 1181 1182 /* copy in optional tail */ 1183 if (params->tail) 1184 memcpy(new->tail, params->tail, new_tail_len); 1185 else 1186 if (old) 1187 memcpy(new->tail, old->tail, new_tail_len); 1188 1189 /* copy in optional short tail */ 1190 if (params->short_tail) 1191 memcpy(new->short_tail, params->short_tail, new_short_tail_len); 1192 else 1193 if (old) 1194 memcpy(new->short_tail, old->short_tail, new_short_tail_len); 1195 1196 err = ieee80211_set_probe_resp(sdata, params->probe_resp, 1197 params->probe_resp_len, csa, cca, link); 1198 if (err < 0) { 1199 kfree(new); 1200 return err; 1201 } 1202 if (err == 0) 1203 changed |= BSS_CHANGED_AP_PROBE_RESP; 1204 1205 if (params->ftm_responder != -1) { 1206 link_conf->ftm_responder = params->ftm_responder; 1207 err = ieee80211_set_ftm_responder_params(sdata, 1208 params->lci, 1209 params->lci_len, 1210 params->civicloc, 1211 params->civicloc_len, 1212 link_conf); 1213 1214 if (err < 0) { 1215 kfree(new); 1216 return err; 1217 } 1218 1219 changed |= BSS_CHANGED_FTM_RESPONDER; 1220 } 1221 1222 rcu_assign_pointer(link->u.ap.beacon, new); 1223 sdata->u.ap.active = true; 1224 1225 if (old) 1226 kfree_rcu(old, rcu_head); 1227 1228 return changed; 1229 } 1230
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index a42abaa25273..acc8c881bd7b 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -1091,8 +1091,8 @@ static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata, { struct cfg80211_mbssid_elems *mbssid = NULL; struct beacon_data *new, *old; - int new_head_len, new_tail_len; - int size, err; + int new_head_len, new_tail_len, new_short_tail_len; + int size, size_short, err; u32 changed = BSS_CHANGED_BEACON; struct ieee80211_bss_conf *link_conf = link->conf; @@ -1115,7 +1115,13 @@ static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata, else new_tail_len = old->tail_len; - size = sizeof(*new) + new_head_len + new_tail_len; + if (params->short_tail || !old) + /* params->tail_len will be zero for !params->tail */ + new_short_tail_len = params->short_tail_len; + else + new_short_tail_len = old->short_tail_len; + + size = sizeof(*new) + new_head_len + new_tail_len + new_short_tail_len; /* new or old multiple BSSID elements? */ if (params->mbssid_ies) { @@ -1142,9 +1148,12 @@ static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata, new->tail = new->head + new_head_len; new->head_len = new_head_len; new->tail_len = new_tail_len; + new->short_tail = new->tail + new->tail_len; + new->short_tail_len = new_short_tail_len; + /* copy in optional mbssid_ies */ if (mbssid) { - u8 *pos = new->tail + new->tail_len; + u8 *pos = new->short_tail + new->short_tail_len; new->mbssid_ies = (void *)pos; pos += struct_size(new->mbssid_ies, elem, mbssid->cnt); @@ -1177,6 +1186,13 @@ static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata, if (old) memcpy(new->tail, old->tail, new_tail_len); + /* copy in optional short tail */ + if (params->short_tail) + memcpy(new->short_tail, params->short_tail, new_short_tail_len); + else + if (old) + memcpy(new->short_tail, old->short_tail, new_short_tail_len); + err = ieee80211_set_probe_resp(sdata, params->probe_resp, params->probe_resp_len, csa, cca, link); if (err < 0) { diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 2e1d829c548a..ef58e6f74b52 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -263,8 +263,8 @@ struct ieee80211_color_change_settings { }; struct beacon_data { - u8 *head, *tail; - int head_len, tail_len; + u8 *head, *tail, *short_tail; + int head_len, tail_len, short_tail_len; struct ieee80211_meshconf_ie *meshconf; u16 cntdwn_counter_offsets[IEEE80211_MAX_CNTDWN_COUNTERS_NUM]; u8 cntdwn_current_counter; diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index ff5ea7ab271b..f33e62d24151 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -5170,7 +5170,9 @@ ieee80211_beacon_get_ap(struct ieee80211_hw *hw, csa_off_base = skb->len; } - if (beacon->tail && !is_short) + if (beacon->short_tail && is_short) + skb_put_data(skb, beacon->short_tail, beacon->short_tail_len); + else if (beacon->tail && !is_short) skb_put_data(skb, beacon->tail, beacon->tail_len); if (ieee80211_beacon_protect(skb, local, sdata, link) < 0)