diff mbox series

Bluetooth: btqca: sequential validation

Message ID 1638952007-32222-1-git-send-email-quic_saluvala@quicinc.com (mailing list archive)
State Superseded
Headers show
Series Bluetooth: btqca: sequential validation | expand

Checks

Context Check Description
tedd_an/checkpatch success Checkpatch PASS
tedd_an/gitlint success Gitlint PASS
tedd_an/buildkernel success Build Kernel PASS
tedd_an/testrunnersetup success Test Runner Setup PASS
tedd_an/testrunnerl2cap-tester success Total: 40, Passed: 40 (100.0%), Failed: 0, Not Run: 0
tedd_an/testrunnerbnep-tester success Total: 1, Passed: 1 (100.0%), Failed: 0, Not Run: 0
tedd_an/testrunnermgmt-tester success Total: 493, Passed: 493 (100.0%), Failed: 0, Not Run: 0
tedd_an/testrunnerrfcomm-tester success Total: 9, Passed: 9 (100.0%), Failed: 0, Not Run: 0
tedd_an/testrunnersco-tester success Total: 12, Passed: 12 (100.0%), Failed: 0, Not Run: 0
tedd_an/testrunnersmp-tester success Total: 8, Passed: 8 (100.0%), Failed: 0, Not Run: 0
tedd_an/testrunneruserchan-tester success Total: 4, Passed: 4 (100.0%), Failed: 0, Not Run: 0

Commit Message

Sai Teja Aluvala Dec. 8, 2021, 8:26 a.m. UTC
This change will have sequential validation support
& patch config command is added

Signed-off-by: Sai Teja Aluvala <quic_saluvala@quicinc.com>
---
 drivers/bluetooth/btqca.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/bluetooth/btqca.h |  3 +++
 2 files changed, 48 insertions(+)

Comments

kernel test robot Dec. 8, 2021, 1:27 p.m. UTC | #1
Hi Sai,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on bluetooth-next/master]
[also build test WARNING on linux/master linus/master v5.16-rc4 next-20211208]
[cannot apply to bluetooth/master]
[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]

url:    https://github.com/0day-ci/linux/commits/Sai-Teja-Aluvala/Bluetooth-btqca-sequential-validation/20211208-162834
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
config: nds32-allyesconfig (https://download.01.org/0day-ci/archive/20211208/202112082154.jFxxuDI4-lkp@intel.com/config)
compiler: nds32le-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/1d58d86c5374c4c82aa1ec8638036667c114f83e
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Sai-Teja-Aluvala/Bluetooth-btqca-sequential-validation/20211208-162834
        git checkout 1d58d86c5374c4c82aa1ec8638036667c114f83e
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=nds32 SHELL=/bin/bash drivers/bluetooth/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/bluetooth/btqca.c:144:5: warning: no previous prototype for 'qca_send_patch_config_cmd' [-Wmissing-prototypes]
     144 | int qca_send_patch_config_cmd(struct hci_dev *hdev, enum qca_btsoc_type soc_type)
         |     ^~~~~~~~~~~~~~~~~~~~~~~~~


vim +/qca_send_patch_config_cmd +144 drivers/bluetooth/btqca.c

   143	
 > 144	int qca_send_patch_config_cmd(struct hci_dev *hdev, enum qca_btsoc_type soc_type)
   145	{
   146		struct sk_buff *skb;
   147		int err = 0;
   148		u8 cmd[5] = {EDL_PATCH_CONFIG_CMD, 0x01, 0, 0, 0};
   149		u8 rlen = 0x02;
   150		struct edl_event_hdr *edl;
   151		u8 rtype = EDL_PATCH_CONFIG_CMD;
   152	
   153		bt_dev_dbg(hdev, "QCA Patch config");
   154	
   155		skb = __hci_cmd_sync_ev(hdev, EDL_PATCH_CMD_OPCODE, EDL_PATCH_CONFIG_CMD_LEN,
   156				cmd, HCI_EV_VENDOR, HCI_INIT_TIMEOUT);
   157		if (IS_ERR(skb)) {
   158			err = PTR_ERR(skb);
   159			bt_dev_err(hdev, "Sending QCA Patch config failed (%d)", err);
   160			return err;
   161		}
   162		if (skb->len != rlen) {
   163			bt_dev_err(hdev, "QCA Patch config cmd size mismatch len %d", skb->len);
   164			err = -EILSEQ;
   165			goto out;
   166		}
   167		edl = (struct edl_event_hdr *)(skb->data);
   168		if (!edl) {
   169			bt_dev_err(hdev, "QCA Patch config with no header");
   170			err = -EILSEQ;
   171			goto out;
   172		}
   173		if (edl->cresp != EDL_PATCH_CONFIG_RES_EVT || edl->rtype != rtype) {
   174			bt_dev_err(hdev, "QCA Wrong packet received %d %d", edl->cresp,
   175			 edl->rtype);
   176			err = -EIO;
   177			goto out;
   178		}
   179	out:
   180		kfree(skb);
   181		if (err)
   182			bt_dev_err(hdev, "QCA Patch config cmd failed (%d)", err);
   183	
   184		return err;
   185	}
   186	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
kernel test robot Dec. 8, 2021, 1:50 p.m. UTC | #2
Hi Sai,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on bluetooth-next/master]
[also build test WARNING on linux/master linus/master v5.16-rc4 next-20211208]
[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]

url:    https://github.com/0day-ci/linux/commits/Sai-Teja-Aluvala/Bluetooth-btqca-sequential-validation/20211208-162834
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
config: x86_64-randconfig-a015-20211207 (https://download.01.org/0day-ci/archive/20211208/202112082116.coCA1rOT-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 097a1cb1d5ebb3a0ec4bcaed8ba3ff6a8e33c00a)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/1d58d86c5374c4c82aa1ec8638036667c114f83e
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Sai-Teja-Aluvala/Bluetooth-btqca-sequential-validation/20211208-162834
        git checkout 1d58d86c5374c4c82aa1ec8638036667c114f83e
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/bluetooth/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/bluetooth/btqca.c:144:5: warning: no previous prototype for function 'qca_send_patch_config_cmd' [-Wmissing-prototypes]
   int qca_send_patch_config_cmd(struct hci_dev *hdev, enum qca_btsoc_type soc_type)
       ^
   drivers/bluetooth/btqca.c:144:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int qca_send_patch_config_cmd(struct hci_dev *hdev, enum qca_btsoc_type soc_type)
   ^
   static 
   1 warning generated.


vim +/qca_send_patch_config_cmd +144 drivers/bluetooth/btqca.c

   143	
 > 144	int qca_send_patch_config_cmd(struct hci_dev *hdev, enum qca_btsoc_type soc_type)
   145	{
   146		struct sk_buff *skb;
   147		int err = 0;
   148		u8 cmd[5] = {EDL_PATCH_CONFIG_CMD, 0x01, 0, 0, 0};
   149		u8 rlen = 0x02;
   150		struct edl_event_hdr *edl;
   151		u8 rtype = EDL_PATCH_CONFIG_CMD;
   152	
   153		bt_dev_dbg(hdev, "QCA Patch config");
   154	
   155		skb = __hci_cmd_sync_ev(hdev, EDL_PATCH_CMD_OPCODE, EDL_PATCH_CONFIG_CMD_LEN,
   156				cmd, HCI_EV_VENDOR, HCI_INIT_TIMEOUT);
   157		if (IS_ERR(skb)) {
   158			err = PTR_ERR(skb);
   159			bt_dev_err(hdev, "Sending QCA Patch config failed (%d)", err);
   160			return err;
   161		}
   162		if (skb->len != rlen) {
   163			bt_dev_err(hdev, "QCA Patch config cmd size mismatch len %d", skb->len);
   164			err = -EILSEQ;
   165			goto out;
   166		}
   167		edl = (struct edl_event_hdr *)(skb->data);
   168		if (!edl) {
   169			bt_dev_err(hdev, "QCA Patch config with no header");
   170			err = -EILSEQ;
   171			goto out;
   172		}
   173		if (edl->cresp != EDL_PATCH_CONFIG_RES_EVT || edl->rtype != rtype) {
   174			bt_dev_err(hdev, "QCA Wrong packet received %d %d", edl->cresp,
   175			 edl->rtype);
   176			err = -EIO;
   177			goto out;
   178		}
   179	out:
   180		kfree(skb);
   181		if (err)
   182			bt_dev_err(hdev, "QCA Patch config cmd failed (%d)", err);
   183	
   184		return err;
   185	}
   186	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Marcel Holtmann Dec. 8, 2021, 2:48 p.m. UTC | #3
Hi Sai,

> This change will have sequential validation support
> & patch config command is added
> 
> Signed-off-by: Sai Teja Aluvala <quic_saluvala@quicinc.com>
> ---
> drivers/bluetooth/btqca.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
> drivers/bluetooth/btqca.h |  3 +++
> 2 files changed, 48 insertions(+)
> 
> diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
> index be04d74..9a2fd17 100644
> --- a/drivers/bluetooth/btqca.c
> +++ b/drivers/bluetooth/btqca.c
> @@ -141,6 +141,49 @@ static int qca_read_fw_build_info(struct hci_dev *hdev)
> 	return err;
> }
> 
> +int qca_send_patch_config_cmd(struct hci_dev *hdev, enum qca_btsoc_type soc_type)
> +{

look, I have limited understanding for people ignoring warnings. The missing static declaration is obvious and when you compile the code it will actually tell you about it.

> +	struct sk_buff *skb;
> +	int err = 0;
> +	u8 cmd[5] = {EDL_PATCH_CONFIG_CMD, 0x01, 0, 0, 0};

const u8 cmd[] = { EDL.., .., 0 };

> +	u8 rlen = 0x02;
> +	struct edl_event_hdr *edl;
> +	u8 rtype = EDL_PATCH_CONFIG_CMD;
> +
> +	bt_dev_dbg(hdev, "QCA Patch config");
> +
> +	skb = __hci_cmd_sync_ev(hdev, EDL_PATCH_CMD_OPCODE, EDL_PATCH_CONFIG_CMD_LEN,

sizeof(cmd)

> +			cmd, HCI_EV_VENDOR, HCI_INIT_TIMEOUT);

Indentation is wrong.

> +	if (IS_ERR(skb)) {
> +		err = PTR_ERR(skb);
> +		bt_dev_err(hdev, "Sending QCA Patch config failed (%d)", err);
> +		return err;
> +	}
> +	if (skb->len != rlen) {
> +		bt_dev_err(hdev, "QCA Patch config cmd size mismatch len %d", skb->len);
> +		err = -EILSEQ;
> +		goto out;
> +	}

Extra empty line,

> +	edl = (struct edl_event_hdr *)(skb->data);
> +	if (!edl) {
> +		bt_dev_err(hdev, "QCA Patch config with no header");
> +		err = -EILSEQ;
> +		goto out;
> +	}

Here as well.

> +	if (edl->cresp != EDL_PATCH_CONFIG_RES_EVT || edl->rtype != rtype) {
> +		bt_dev_err(hdev, "QCA Wrong packet received %d %d", edl->cresp,
> +		 edl->rtype);

Wrong indentation.

> +		err = -EIO;
> +		goto out;
> +	}
> +out:
> +	kfree(skb);
> +	if (err)
> +		bt_dev_err(hdev, "QCA Patch config cmd failed (%d)", err);
> +
> +	return err;
> +}
> +
> static int qca_send_reset(struct hci_dev *hdev)
> {
> 	struct sk_buff *skb;
> @@ -551,6 +594,8 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
> 	 */
> 	rom_ver = ((soc_ver & 0x00000f00) >> 0x04) | (soc_ver & 0x0000000f);
> 
> +	if (soc_type == QCA_WCN6750)
> +		qca_send_patch_config_cmd(hdev, soc_type);

Extra empty line.

If you are not using the soc_type, then don’t add it as parameter.


> 	/* Download rampatch file */
> 	config.type = TLV_TYPE_PATCH;
> 	if (qca_is_wcn399x(soc_type)) {
> diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h
> index 30afa77..8fbb4c7 100644
> --- a/drivers/bluetooth/btqca.h
> +++ b/drivers/bluetooth/btqca.h
> @@ -13,6 +13,8 @@
> #define EDL_PATCH_TLV_REQ_CMD		(0x1E)
> #define EDL_GET_BUILD_INFO_CMD		(0x20)
> #define EDL_NVM_ACCESS_SET_REQ_CMD	(0x01)
> +#define EDL_PATCH_CONFIG_CMD_LEN	(0x05)

Not needed.

> +#define EDL_PATCH_CONFIG_CMD		(0x28)
> #define MAX_SIZE_PER_TLV_SEGMENT	(243)
> #define QCA_PRE_SHUTDOWN_CMD		(0xFC08)
> #define QCA_DISABLE_LOGGING		(0xFC17)
> @@ -24,6 +26,7 @@
> #define EDL_CMD_EXE_STATUS_EVT		(0x00)
> #define EDL_SET_BAUDRATE_RSP_EVT	(0x92)
> #define EDL_NVM_ACCESS_CODE_EVT		(0x0B)
> +#define EDL_PATCH_CONFIG_RES_EVT	(0x00)
> #define QCA_DISABLE_LOGGING_SUB_OP	(0x14)
> 
> #define EDL_TAG_ID_HCI			(17)

Regards

Marcel
Sai Teja Aluvala Dec. 9, 2021, 5:23 a.m. UTC | #4
-----Original Message-----
From: Marcel Holtmann <marcel@holtmann.org> 
Sent: Wednesday, December 8, 2021 8:18 PM
To: Sai Teja Aluvala (Temp) (QUIC) <quic_saluvala@quicinc.com>
Cc: Johan Hedberg <johan.hedberg@gmail.com>; Matthias Kaehlcke <mka@chromium.org>; Linux Kernel Mailing List <linux-kernel@vger.kernel.org>; linux-bluetooth <linux-bluetooth@vger.kernel.org>; Hemant Gupta (QUIC) <quic_hemantg@quicinc.com>; MSM <linux-arm-msm@vger.kernel.org>; quic_bgodavar <quic_bgodavar@quicinc.com>; Rocky Liao <rjliao@codeaurora.org>; hbandi@codeaurora.org; Abhishek Pandit-Subedi <abhishekpandit@chromium.org>; Miao-chen Chou <mcchou@chromium.org>; PANICKER HARISH (Temp) (QUIC) <quic_pharish@quicinc.com>
Subject: Re: [PATCH] Bluetooth: btqca: sequential validation

Hi Sai,

> This change will have sequential validation support & patch config 
> command is added
> 
> Signed-off-by: Sai Teja Aluvala <quic_saluvala@quicinc.com>
> ---
> drivers/bluetooth/btqca.c | 45 
> +++++++++++++++++++++++++++++++++++++++++++++
> drivers/bluetooth/btqca.h |  3 +++
> 2 files changed, 48 insertions(+)
> 
> diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c 
> index be04d74..9a2fd17 100644
> --- a/drivers/bluetooth/btqca.c
> +++ b/drivers/bluetooth/btqca.c
> @@ -141,6 +141,49 @@ static int qca_read_fw_build_info(struct hci_dev *hdev)
> 	return err;
> }
> 
> +int qca_send_patch_config_cmd(struct hci_dev *hdev, enum 
> +qca_btsoc_type soc_type) {

look, I have limited understanding for people ignoring warnings. The missing static declaration is obvious and when you compile the code it will actually tell you about it.
[Sai] : will update in next patch

> +	struct sk_buff *skb;
> +	int err = 0;
> +	u8 cmd[5] = {EDL_PATCH_CONFIG_CMD, 0x01, 0, 0, 0};

const u8 cmd[] = { EDL.., .., 0 };
[sai]: will update in next patch

> +	u8 rlen = 0x02;
> +	struct edl_event_hdr *edl;
> +	u8 rtype = EDL_PATCH_CONFIG_CMD;
> +
> +	bt_dev_dbg(hdev, "QCA Patch config");
> +
> +	skb = __hci_cmd_sync_ev(hdev, EDL_PATCH_CMD_OPCODE, 
> +EDL_PATCH_CONFIG_CMD_LEN,

sizeof(cmd)
[sai]: will update in next patch

> +			cmd, HCI_EV_VENDOR, HCI_INIT_TIMEOUT);

Indentation is wrong.
[sai] : will update in next patch
> +	if (IS_ERR(skb)) {
> +		err = PTR_ERR(skb);
> +		bt_dev_err(hdev, "Sending QCA Patch config failed (%d)", err);
> +		return err;
> +	}
> +	if (skb->len != rlen) {
> +		bt_dev_err(hdev, "QCA Patch config cmd size mismatch len %d", skb->len);
> +		err = -EILSEQ;
> +		goto out;
> +	}

Extra empty line,
[Sai]: will remove extra line in next patch
> +	edl = (struct edl_event_hdr *)(skb->data);
> +	if (!edl) {
> +		bt_dev_err(hdev, "QCA Patch config with no header");
> +		err = -EILSEQ;
> +		goto out;
> +	}

Here as well.
[Sai]: will remove in next patch
> +	if (edl->cresp != EDL_PATCH_CONFIG_RES_EVT || edl->rtype != rtype) {
> +		bt_dev_err(hdev, "QCA Wrong packet received %d %d", edl->cresp,
> +		 edl->rtype);

Wrong indentation.
[Sai] : will update in next patch.
> +		err = -EIO;
> +		goto out;
> +	}
> +out:
> +	kfree(skb);
> +	if (err)
> +		bt_dev_err(hdev, "QCA Patch config cmd failed (%d)", err);
> +
> +	return err;
> +}
> +
> static int qca_send_reset(struct hci_dev *hdev) {
> 	struct sk_buff *skb;
> @@ -551,6 +594,8 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
> 	 */
> 	rom_ver = ((soc_ver & 0x00000f00) >> 0x04) | (soc_ver & 0x0000000f);
> 
> +	if (soc_type == QCA_WCN6750)
> +		qca_send_patch_config_cmd(hdev, soc_type);

Extra empty line.
If you are not using the soc_type, then don’t add it as parameter.
[Sai] : will remove in next patch.

> 	/* Download rampatch file */
> 	config.type = TLV_TYPE_PATCH;
> 	if (qca_is_wcn399x(soc_type)) {
> diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h 
> index 30afa77..8fbb4c7 100644
> --- a/drivers/bluetooth/btqca.h
> +++ b/drivers/bluetooth/btqca.h
> @@ -13,6 +13,8 @@
> #define EDL_PATCH_TLV_REQ_CMD		(0x1E)
> #define EDL_GET_BUILD_INFO_CMD		(0x20)
> #define EDL_NVM_ACCESS_SET_REQ_CMD	(0x01)
> +#define EDL_PATCH_CONFIG_CMD_LEN	(0x05)

Not needed.
[Sai] : will remove in next patch.

> +#define EDL_PATCH_CONFIG_CMD		(0x28)
> #define MAX_SIZE_PER_TLV_SEGMENT	(243)
> #define QCA_PRE_SHUTDOWN_CMD		(0xFC08)
> #define QCA_DISABLE_LOGGING		(0xFC17)
> @@ -24,6 +26,7 @@
> #define EDL_CMD_EXE_STATUS_EVT		(0x00)
> #define EDL_SET_BAUDRATE_RSP_EVT	(0x92)
> #define EDL_NVM_ACCESS_CODE_EVT		(0x0B)
> +#define EDL_PATCH_CONFIG_RES_EVT	(0x00)
> #define QCA_DISABLE_LOGGING_SUB_OP	(0x14)
> 
> #define EDL_TAG_ID_HCI			(17)

Regards

Marcel
Dan Carpenter Dec. 9, 2021, 1:30 p.m. UTC | #5
Hi Sai,

url:    https://github.com/0day-ci/linux/commits/Sai-Teja-Aluvala/Bluetooth-btqca-sequential-validation/20211208-162834 
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git  master
config: arc-randconfig-m031-20211207 (https://download.01.org/0day-ci/archive/20211209/202112090340.ohuHwTLx-lkp@intel.com/config )
compiler: arceb-elf-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
drivers/bluetooth/btqca.c:180 qca_send_patch_config_cmd() error: use kfree_skb() here instead of kfree(skb)

vim +180 drivers/bluetooth/btqca.c

1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  144  int qca_send_patch_config_cmd(struct hci_dev *hdev, enum qca_btsoc_type soc_type)
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  145  {
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  146  	struct sk_buff *skb;
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  147  	int err = 0;
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  148  	u8 cmd[5] = {EDL_PATCH_CONFIG_CMD, 0x01, 0, 0, 0};
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  149  	u8 rlen = 0x02;
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  150  	struct edl_event_hdr *edl;
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  151  	u8 rtype = EDL_PATCH_CONFIG_CMD;
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  152  
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  153  	bt_dev_dbg(hdev, "QCA Patch config");
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  154  
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  155  	skb = __hci_cmd_sync_ev(hdev, EDL_PATCH_CMD_OPCODE, EDL_PATCH_CONFIG_CMD_LEN,
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  156  			cmd, HCI_EV_VENDOR, HCI_INIT_TIMEOUT);
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  157  	if (IS_ERR(skb)) {
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  158  		err = PTR_ERR(skb);
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  159  		bt_dev_err(hdev, "Sending QCA Patch config failed (%d)", err);
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  160  		return err;
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  161  	}
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  162  	if (skb->len != rlen) {
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  163  		bt_dev_err(hdev, "QCA Patch config cmd size mismatch len %d", skb->len);
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  164  		err = -EILSEQ;
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  165  		goto out;
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  166  	}
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  167  	edl = (struct edl_event_hdr *)(skb->data);
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  168  	if (!edl) {
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  169  		bt_dev_err(hdev, "QCA Patch config with no header");
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  170  		err = -EILSEQ;
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  171  		goto out;
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  172  	}
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  173  	if (edl->cresp != EDL_PATCH_CONFIG_RES_EVT || edl->rtype != rtype) {
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  174  		bt_dev_err(hdev, "QCA Wrong packet received %d %d", edl->cresp,
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  175  		 edl->rtype);
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  176  		err = -EIO;
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  177  		goto out;
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  178  	}
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  179  out:
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08 @180  	kfree(skb);
                                                                ^^^^^^^^^^
kfree_skb(skb);

1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  181  	if (err)
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  182  		bt_dev_err(hdev, "QCA Patch config cmd failed (%d)", err);
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  183  
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  184  	return err;
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  185  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
index be04d74..9a2fd17 100644
--- a/drivers/bluetooth/btqca.c
+++ b/drivers/bluetooth/btqca.c
@@ -141,6 +141,49 @@  static int qca_read_fw_build_info(struct hci_dev *hdev)
 	return err;
 }
 
+int qca_send_patch_config_cmd(struct hci_dev *hdev, enum qca_btsoc_type soc_type)
+{
+	struct sk_buff *skb;
+	int err = 0;
+	u8 cmd[5] = {EDL_PATCH_CONFIG_CMD, 0x01, 0, 0, 0};
+	u8 rlen = 0x02;
+	struct edl_event_hdr *edl;
+	u8 rtype = EDL_PATCH_CONFIG_CMD;
+
+	bt_dev_dbg(hdev, "QCA Patch config");
+
+	skb = __hci_cmd_sync_ev(hdev, EDL_PATCH_CMD_OPCODE, EDL_PATCH_CONFIG_CMD_LEN,
+			cmd, HCI_EV_VENDOR, HCI_INIT_TIMEOUT);
+	if (IS_ERR(skb)) {
+		err = PTR_ERR(skb);
+		bt_dev_err(hdev, "Sending QCA Patch config failed (%d)", err);
+		return err;
+	}
+	if (skb->len != rlen) {
+		bt_dev_err(hdev, "QCA Patch config cmd size mismatch len %d", skb->len);
+		err = -EILSEQ;
+		goto out;
+	}
+	edl = (struct edl_event_hdr *)(skb->data);
+	if (!edl) {
+		bt_dev_err(hdev, "QCA Patch config with no header");
+		err = -EILSEQ;
+		goto out;
+	}
+	if (edl->cresp != EDL_PATCH_CONFIG_RES_EVT || edl->rtype != rtype) {
+		bt_dev_err(hdev, "QCA Wrong packet received %d %d", edl->cresp,
+		 edl->rtype);
+		err = -EIO;
+		goto out;
+	}
+out:
+	kfree(skb);
+	if (err)
+		bt_dev_err(hdev, "QCA Patch config cmd failed (%d)", err);
+
+	return err;
+}
+
 static int qca_send_reset(struct hci_dev *hdev)
 {
 	struct sk_buff *skb;
@@ -551,6 +594,8 @@  int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
 	 */
 	rom_ver = ((soc_ver & 0x00000f00) >> 0x04) | (soc_ver & 0x0000000f);
 
+	if (soc_type == QCA_WCN6750)
+		qca_send_patch_config_cmd(hdev, soc_type);
 	/* Download rampatch file */
 	config.type = TLV_TYPE_PATCH;
 	if (qca_is_wcn399x(soc_type)) {
diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h
index 30afa77..8fbb4c7 100644
--- a/drivers/bluetooth/btqca.h
+++ b/drivers/bluetooth/btqca.h
@@ -13,6 +13,8 @@ 
 #define EDL_PATCH_TLV_REQ_CMD		(0x1E)
 #define EDL_GET_BUILD_INFO_CMD		(0x20)
 #define EDL_NVM_ACCESS_SET_REQ_CMD	(0x01)
+#define EDL_PATCH_CONFIG_CMD_LEN	(0x05)
+#define EDL_PATCH_CONFIG_CMD		(0x28)
 #define MAX_SIZE_PER_TLV_SEGMENT	(243)
 #define QCA_PRE_SHUTDOWN_CMD		(0xFC08)
 #define QCA_DISABLE_LOGGING		(0xFC17)
@@ -24,6 +26,7 @@ 
 #define EDL_CMD_EXE_STATUS_EVT		(0x00)
 #define EDL_SET_BAUDRATE_RSP_EVT	(0x92)
 #define EDL_NVM_ACCESS_CODE_EVT		(0x0B)
+#define EDL_PATCH_CONFIG_RES_EVT	(0x00)
 #define QCA_DISABLE_LOGGING_SUB_OP	(0x14)
 
 #define EDL_TAG_ID_HCI			(17)