[PATCH 2/2] staging: wfx: remove support for legacy PDS format
From: Jérôme Pouiller We don't want to support legacy PDS format. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/main.c | 55 +++--- 1 file changed, 4 insertions(+), 51 deletions(-) diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c index a0f5e09c3c3f..0ddc67b56589 100644 --- a/drivers/staging/wfx/main.c +++ b/drivers/staging/wfx/main.c @@ -163,55 +163,6 @@ bool wfx_api_older_than(struct wfx_dev *wdev, int major, int minor) return false; } -/* In legacy format, the PDS file is often bigger than Rx buffers of the chip, so it has to be sent - * in multiple parts. - * - * In add, the PDS data cannot be split anywhere. The PDS files contains tree structures. Braces are - * used to enter/leave a level of the tree (in a JSON fashion). PDS files can only been split - * between root nodes. - */ -int wfx_send_pds_legacy(struct wfx_dev *wdev, u8 *buf, size_t len) -{ - int ret; - int start = 0, brace_level = 0, i; - - for (i = 1; i < len - 1; i++) { - if (buf[i] == '{') - brace_level++; - if (buf[i] == '}') - brace_level--; - if (buf[i] == '}' && !brace_level) { - i++; - if (i - start + 1 > WFX_PDS_MAX_CHUNK_SIZE) - return -EFBIG; - buf[start] = '{'; - buf[i] = 0; - dev_dbg(wdev->dev, "send PDS '%s}'\n", buf + start); - buf[i] = '}'; - ret = wfx_hif_configuration(wdev, buf + start, - i - start + 1); - if (ret > 0) { - dev_err(wdev->dev, "PDS bytes %d to %d: invalid data (unsupported options?)\n", - start, i); - return -EINVAL; - } - if (ret == -ETIMEDOUT) { - dev_err(wdev->dev, "PDS bytes %d to %d: chip didn't reply (corrupted file?)\n", - start, i); - return ret; - } - if (ret) { - dev_err(wdev->dev, "PDS bytes %d to %d: chip returned an unknown error\n", - start, i); - return -EIO; - } - buf[i] = ','; - start = i; - } - } - return 0; -} - /* The device needs data about the antenna configuration. This information in provided by PDS * (Platform Data Set, this is the wording used in WF200 documentation) files. For hardware * integrators, the full process to create PDS files is described here: @@ -223,8 +174,10 @@ int wfx_send_pds_legacy(struct wfx_dev *wdev, u8 *buf, size_t len) { int ret, chunk_type, chunk_len, chunk_num = 0; - if (*buf == '{') - return wfx_send_pds_legacy(wdev, buf, len); + if (*buf == '{') { + dev_err(wdev->dev, "PDS: malformed file (legacy format?)\n"); + return -EINVAL; + } while (len > 0) { chunk_type = get_unaligned_le16(buf + 0); chunk_len = get_unaligned_le16(buf + 2); -- 2.34.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/2] staging/wfx: change config files format
From: Jérôme Pouiller I have changed the format of the antenna configuration files, as discussed here: https://lore.kernel.org/netdev/4055223.VTxhiZFAix@pc-42/ Jérôme Pouiller (2): staging: wfx: allow new PDS format staging: wfx: remove support for legacy PDS format drivers/staging/wfx/main.c | 87 ++ 1 file changed, 40 insertions(+), 47 deletions(-) -- 2.34.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/2] staging: wfx: allow new PDS format
From: Jérôme Pouiller The device needs data about the antenna configuration. This information in provided by PDS (Platform Data Set, this is the wording used in WF200 documentation) files. Until now, the driver had to parse the PDS file before to send it. This solution was not acceptable for the vanilla kernel. We have slightly changed the PDS format so it is now an array of Type-Length-Value. This patch allows to support new format and keep compatibility with legacy format. probe: allow new PDS format Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/main.c | 74 +- 1 file changed, 57 insertions(+), 17 deletions(-) diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c index 8be9100847a7..a0f5e09c3c3f 100644 --- a/drivers/staging/wfx/main.c +++ b/drivers/staging/wfx/main.c @@ -33,7 +33,8 @@ #include "hif_tx_mib.h" #include "hif_api_cmd.h" -#define WFX_PDS_MAX_SIZE 1500 +#define WFX_PDS_TLV_TYPE 0x4450 // "PD" (Platform Data) in ascii little-endian +#define WFX_PDS_MAX_CHUNK_SIZE 1500 MODULE_DESCRIPTION("Silicon Labs 802.11 Wireless LAN driver for WF200"); MODULE_AUTHOR("Jérôme Pouiller "); @@ -162,29 +163,18 @@ bool wfx_api_older_than(struct wfx_dev *wdev, int major, int minor) return false; } -/* The device needs data about the antenna configuration. This information in provided by PDS - * (Platform Data Set, this is the wording used in WF200 documentation) files. For hardware - * integrators, the full process to create PDS files is described here: - * https:github.com/SiliconLabs/wfx-firmware/blob/master/PDS/README.md - * - * So this function aims to send PDS to the device. However, the PDS file is often bigger than Rx - * buffers of the chip, so it has to be sent in multiple parts. +/* In legacy format, the PDS file is often bigger than Rx buffers of the chip, so it has to be sent + * in multiple parts. * * In add, the PDS data cannot be split anywhere. The PDS files contains tree structures. Braces are * used to enter/leave a level of the tree (in a JSON fashion). PDS files can only been split * between root nodes. */ -int wfx_send_pds(struct wfx_dev *wdev, u8 *buf, size_t len) +int wfx_send_pds_legacy(struct wfx_dev *wdev, u8 *buf, size_t len) { int ret; - int start, brace_level, i; + int start = 0, brace_level = 0, i; - start = 0; - brace_level = 0; - if (buf[0] != '{') { - dev_err(wdev->dev, "valid PDS start with '{'. Did you forget to compress it?\n"); - return -EINVAL; - } for (i = 1; i < len - 1; i++) { if (buf[i] == '{') brace_level++; @@ -192,7 +182,7 @@ int wfx_send_pds(struct wfx_dev *wdev, u8 *buf, size_t len) brace_level--; if (buf[i] == '}' && !brace_level) { i++; - if (i - start + 1 > WFX_PDS_MAX_SIZE) + if (i - start + 1 > WFX_PDS_MAX_CHUNK_SIZE) return -EFBIG; buf[start] = '{'; buf[i] = 0; @@ -222,6 +212,56 @@ int wfx_send_pds(struct wfx_dev *wdev, u8 *buf, size_t len) return 0; } +/* The device needs data about the antenna configuration. This information in provided by PDS + * (Platform Data Set, this is the wording used in WF200 documentation) files. For hardware + * integrators, the full process to create PDS files is described here: + * https://github.com/SiliconLabs/wfx-firmware/blob/master/PDS/README.md + * + * The PDS file is an array of Time-Length-Value structs. + */ + int wfx_send_pds(struct wfx_dev *wdev, u8 *buf, size_t len) +{ + int ret, chunk_type, chunk_len, chunk_num = 0; + + if (*buf == '{') + return wfx_send_pds_legacy(wdev, buf, len); + while (len > 0) { + chunk_type = get_unaligned_le16(buf + 0); + chunk_len = get_unaligned_le16(buf + 2); + if (chunk_len > len) { + dev_err(wdev->dev, "PDS:%d: corrupted file\n", chunk_num); + return -EINVAL; + } + if (chunk_type != WFX_PDS_TLV_TYPE) { + dev_info(wdev->dev, "PDS:%d: skip unknown data\n", chunk_num); + goto next; + } + if (chunk_len > WFX_PDS_MAX_CHUNK_SIZE) + dev_warn(wdev->dev, "PDS:%d: unexpectly large chunk\n", chunk_num); + if (buf[4] != '{' || buf[chunk_len - 1] != '}') + dev_warn(wdev->dev, "PDS:%d: unexpected content\n", chunk_num); + + ret = wfx_hif_configuration(wdev, buf + 4, chunk_len - 4); + if (ret > 0) { + dev_err(wdev->dev, "PDS:%d: invalid data (unsupported options?)\n", chunk_num); + return -EINVAL; + } + if
Private & Confidential
Dear Friend This is to thank you for your effort. I understand that your hands were tied. Not to worry. I have succeeded, the money has been transferred into the account provided by a newly found friend of mine in Russia to compensate for your past assistance and commitments, I have dropped an international certified bank draft of $1.2M for your investments in life-settlement. I am in Russia with my family presently. I do intend to establish some business concerns here, and possibly buy some properties. Now Contact my secretary Mr Will Clark on his email willclark...@gmail.com phone 7052187354 Forward your mailing address/phone fax number to him, then ask him to send the cheque to you. Take good care of your self. Regards and respect, Pascal Simon ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Lieber Freund (Assalamu Alaikum),?
-- Lieber Freund (Assalamu Alaikum), Ich bin vor einer privaten Suche auf Ihren E-Mail-Kontakt gestoßen Ihre Hilfe. Mein Name ist Aisha Al-Qaddafi, eine alleinerziehende Mutter und eine Witwe mit drei Kindern. Ich bin die einzige leibliche Tochter des Spätlibyschen Präsident (verstorbener Oberst Muammar Gaddafi). Ich habe Investmentfonds im Wert von siebenundzwanzig Millionen fünfhunderttausend United State Dollar ($ 27.500.000.00) und ich brauche eine vertrauenswürdige Investition Manager / Partner aufgrund meines aktuellen Flüchtlingsstatus bin ich jedoch Möglicherweise interessieren Sie sich für die Unterstützung von Investitionsprojekten in Ihrem Land Von dort aus können wir in naher Zukunft Geschäftsbeziehungen aufbauen. Ich bin bereit, mit Ihnen über das Verhältnis zwischen Investition und Unternehmensgewinn zu verhandeln Basis für die zukünftige Investition Gewinne zu erzielen. Wenn Sie bereit sind, dieses Projekt in meinem Namen zu bearbeiten, antworten Sie bitte dringend Damit ich Ihnen mehr Informationen über die Investmentfonds geben kann. meine E-Mail-Adresse unten: ayishagdd...@mail.ru Freundliche Grüße Frau Aisha Al-Qaddafi ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel