OpenWrt – Diff between revs 2 and 3

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 2 Rev 3
Line 48... Line 48...
48 ath10k-4.13/core.c | 134 ++++++++++++++++++--------------- 48 ath10k-4.13/core.c | 134 ++++++++++++++++++---------------
49 1 file changed, 72 insertions(+), 62 deletions(-) 49 1 file changed, 72 insertions(+), 62 deletions(-)
Line 50... Line 50...
50   50  
51 --- a/ath10k-4.13/core.c 51 --- a/ath10k-4.13/core.c
52 +++ b/ath10k-4.13/core.c 52 +++ b/ath10k-4.13/core.c
53 @@ -1427,14 +1427,61 @@ out: 53 @@ -1419,14 +1419,61 @@ out:
54 return ret; 54 return ret;
Line 55... Line 55...
55 } 55 }
56 56
Line 113... Line 113...
113 - int ret, ie_id; 113 - int ret, ie_id;
114 + int ret; 114 + int ret;
Line 115... Line 115...
115 115
116 ar->normal_mode_fw.board = ath10k_fetch_fw_file(ar, 116 ar->normal_mode_fw.board = ath10k_fetch_fw_file(ar,
117 ar->hw_params.fw.dir, 117 ar->hw_params.fw.dir,
118 @@ -1472,73 +1519,28 @@ static int ath10k_core_fetch_board_data_ 118 @@ -1464,73 +1511,28 @@ static int ath10k_core_fetch_board_data_
119 data += magic_len; 119 data += magic_len;
Line 120... Line 120...
120 len -= magic_len; 120 len -= magic_len;
121 121
Line 196... Line 196...
196 + goto err; 196 + goto err;
197 + 197 +
198 return 0; 198 return 0;
Line 199... Line 199...
199 199
200 err: 200 err:
201 @@ -1547,12 +1549,12 @@ err: 201 @@ -1539,12 +1541,12 @@ err:
Line 202... Line 202...
202 } 202 }
203 203
204 static int ath10k_core_create_board_name(struct ath10k *ar, char *name, 204 static int ath10k_core_create_board_name(struct ath10k *ar, char *name,
Line 211... Line 211...
211 - if (ar->id.bdf_ext[0] != '\0') 211 - if (ar->id.bdf_ext[0] != '\0')
212 + if (with_variant && ar->id.bdf_ext[0] != '\0') 212 + if (with_variant && ar->id.bdf_ext[0] != '\0')
213 scnprintf(variant, sizeof(variant), ",variant=%s", 213 scnprintf(variant, sizeof(variant), ",variant=%s",
214 ar->id.bdf_ext); 214 ar->id.bdf_ext);
Line 215... Line 215...
215 215
216 @@ -1578,21 +1580,31 @@ out: -  
217 -  
218 static int ath10k_core_fetch_board_file(struct ath10k *ar) -  
219 { -  
220 - char boardname[100]; -  
221 + char boardname[100], fallback_boardname[100]; -  
222 int ret; -  
223 -  
224 - ret = ath10k_core_create_board_name(ar, boardname, sizeof(boardname)); -  
225 + ret = ath10k_core_create_board_name(ar, boardname, -  
226 + sizeof(boardname), true); -  
227 if (ret) { -  
228 ath10k_err(ar, "failed to create board name: %d", ret); -  
229 return ret; -  
230 } -  
231 -  
232 + ret = ath10k_core_create_board_name(ar, fallback_boardname, -  
233 + sizeof(boardname), false); -  
234 + if (ret) { -  
235 + ath10k_err(ar, "failed to create fallback board name: %d", ret); -  
236 + return ret; -  
237 + } -  
238 + -  
239 ar->bd_api = 2; -  
240 if (ar->fwcfg.bname[0]) -  
241 ret = ath10k_core_fetch_board_data_api_n(ar, boardname, -  
242 + fallback_boardname, -  
243 ar->fwcfg.bname); -  
244 else -  
245 ret = ath10k_core_fetch_board_data_api_n(ar, boardname, -  
246 + fallback_boardname, -  
247 ATH10K_BOARD_API2_FILE); -  
248 if (!ret) -  
249 goto success; -  
250 --- a/ath10k-4.16/core.c -  
251 +++ b/ath10k-4.16/core.c -  
252 @@ -1560,14 +1560,61 @@ out: -  
253 return ret; -  
254 } -  
255 -  
256 +static int ath10k_core_search_bd(struct ath10k *ar, -  
257 + const char *boardname, -  
258 + const u8 *data, -  
259 + size_t len) -  
260 +{ -  
261 + size_t ie_len; -  
262 + struct ath10k_fw_ie *hdr; -  
263 + int ret = -ENOENT, ie_id; -  
264 + -  
265 + while (len > sizeof(struct ath10k_fw_ie)) { -  
266 + hdr = (struct ath10k_fw_ie *)data; -  
267 + ie_id = le32_to_cpu(hdr->id); -  
268 + ie_len = le32_to_cpu(hdr->len); -  
269 + -  
270 + len -= sizeof(*hdr); -  
271 + data = hdr->data; -  
272 + -  
273 + if (len < ALIGN(ie_len, 4)) { -  
274 + ath10k_err(ar, "invalid length for board ie_id %d ie_len %zu len %zu\n", -  
275 + ie_id, ie_len, len); -  
276 + return -EINVAL; -  
277 + } -  
278 + -  
279 + switch (ie_id) { -  
280 + case ATH10K_BD_IE_BOARD: -  
281 + ret = ath10k_core_parse_bd_ie_board(ar, data, ie_len, -  
282 + boardname); -  
283 + if (ret == -ENOENT) -  
284 + /* no match found, continue */ -  
285 + break; -  
286 + -  
287 + /* either found or error, so stop searching */ -  
288 + goto out; -  
289 + } -  
290 + -  
291 + /* jump over the padding */ -  
292 + ie_len = ALIGN(ie_len, 4); -  
293 + -  
294 + len -= ie_len; -  
295 + data += ie_len; -  
296 + } -  
297 + -  
298 +out: -  
299 + /* return result of parse_bd_ie_board() or -ENOENT */ -  
300 + return ret; -  
301 +} -  
302 + -  
303 static int ath10k_core_fetch_board_data_api_n(struct ath10k *ar, -  
304 const char *boardname, -  
305 + const char *fallback_boardname, -  
306 const char *filename) -  
307 { -  
308 - size_t len, magic_len, ie_len; -  
309 - struct ath10k_fw_ie *hdr; -  
310 + size_t len, magic_len; -  
311 const u8 *data; -  
312 - int ret, ie_id; -  
313 + int ret; -  
314 -  
315 ar->normal_mode_fw.board = ath10k_fetch_fw_file(ar, -  
316 ar->hw_params.fw.dir, -  
317 @@ -1605,73 +1652,28 @@ static int ath10k_core_fetch_board_data_ -  
318 data += magic_len; -  
319 len -= magic_len; -  
320 -  
321 - while (len > sizeof(struct ath10k_fw_ie)) { -  
322 - hdr = (struct ath10k_fw_ie *)data; -  
323 - ie_id = le32_to_cpu(hdr->id); -  
324 - ie_len = le32_to_cpu(hdr->len); -  
325 - -  
326 - len -= sizeof(*hdr); -  
327 - data = hdr->data; -  
328 - -  
329 - if (len < ALIGN(ie_len, 4)) { -  
330 - ath10k_err(ar, "invalid length for board ie_id %d ie_len %zu len %zu\n", -  
331 - ie_id, ie_len, len); -  
332 - ret = -EINVAL; -  
333 - goto err; -  
334 - } -  
335 - -  
336 - switch (ie_id) { -  
337 - case ATH10K_BD_IE_BOARD: -  
338 - ret = ath10k_core_parse_bd_ie_board(ar, data, ie_len, -  
339 - boardname); -  
340 - if (ret == -ENOENT && ar->id.bdf_ext[0] != '\0') { -  
341 - /* try default bdf if variant was not found */ -  
342 - char *s, *v = ",variant="; -  
343 - char boardname2[100]; -  
344 - -  
345 - strlcpy(boardname2, boardname, -  
346 - sizeof(boardname2)); -  
347 - -  
348 - s = strstr(boardname2, v); -  
349 - if (s) -  
350 - *s = '\0'; /* strip ",variant=%s" */ -  
351 - -  
352 - ret = ath10k_core_parse_bd_ie_board(ar, data, -  
353 - ie_len, -  
354 - boardname2); -  
355 - } -  
356 - -  
357 - if (ret == -ENOENT) -  
358 - /* no match found, continue */ -  
359 - break; -  
360 - else if (ret) -  
361 - /* there was an error, bail out */ -  
362 - goto err; -  
363 - -  
364 - /* board data found */ -  
365 - goto out; -  
366 - } -  
367 + /* attempt to find boardname in the IE list */ -  
368 + ret = ath10k_core_search_bd(ar, boardname, data, len); -  
369 -  
370 - /* jump over the padding */ -  
371 - ie_len = ALIGN(ie_len, 4); -  
372 - -  
373 - len -= ie_len; -  
374 - data += ie_len; -  
375 - } -  
376 + /* if we didn't find it and have a fallback name, try that */ -  
377 + if (ret == -ENOENT && fallback_boardname) -  
378 + ret = ath10k_core_search_bd(ar, fallback_boardname, data, len); -  
379 -  
380 out: -  
381 - if (!ar->normal_mode_fw.board_data || !ar->normal_mode_fw.board_len) { -  
382 + if (ret == -ENOENT) { -  
383 ath10k_err(ar, -  
384 "failed to fetch board data for %s from %s/%s\n", -  
385 boardname, ar->hw_params.fw.dir, filename); -  
386 ret = -ENODATA; -  
387 - goto err; -  
388 } -  
389 -  
390 /* Save firmware board name so we can display it later. */ -  
391 strlcpy(ar->normal_mode_fw.fw_file.fw_board_name, filename, -  
392 sizeof(ar->normal_mode_fw.fw_file.fw_board_name)); -  
393 -  
394 + if (ret) -  
395 + goto err; -  
396 + -  
397 return 0; -  
398 -  
399 err: -  
400 @@ -1680,12 +1682,12 @@ err: -  
401 } -  
402 -  
403 static int ath10k_core_create_board_name(struct ath10k *ar, char *name, -  
404 - size_t name_len) -  
405 + size_t name_len, bool with_variant) -  
406 { -  
407 /* strlen(',variant=') + strlen(ar->id.bdf_ext) */ -  
408 char variant[9 + ATH10K_SMBIOS_BDF_EXT_STR_LENGTH] = { 0 }; -  
409 -  
410 - if (ar->id.bdf_ext[0] != '\0') -  
411 + if (with_variant && ar->id.bdf_ext[0] != '\0') -  
412 scnprintf(variant, sizeof(variant), ",variant=%s", -  
413 ar->id.bdf_ext); -  
414 -  
Line 415... Line 216...
415 @@ -1711,21 +1713,31 @@ out: 216 @@ -1570,21 +1572,31 @@ out:
416 217
417 static int ath10k_core_fetch_board_file(struct ath10k *ar) 218 static int ath10k_core_fetch_board_file(struct ath10k *ar)
418 { 219 {