* [RFC PATCH] Bluetooth: vhci: Add new packet type for VHCI
@ 2021-10-29 6:13 Tedd Ho-Jeong An
2021-10-29 8:31 ` Marcel Holtmann
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Tedd Ho-Jeong An @ 2021-10-29 6:13 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Tedd Ho-Jeong An
From: Tedd Ho-Jeong An <tedd.an@intel.com>
Current implementation uses the Vendor packet type (0xff) with opcode
parameter. But there is no way to expand the opcode and no available bits
to use. Also it cannot be changed due to the backward compatibility
with older kernel.
So, this patch adds new packet type dedicated for VHCI(0xfe) to support
configuring the VHCI device with quarks and flags while creating the
VHCI driver.
Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>
---
drivers/bluetooth/hci_vhci.c | 161 ++++++++++++++++++++++++++++++-----
include/net/bluetooth/hci.h | 1 +
2 files changed, 140 insertions(+), 22 deletions(-)
diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c
index 49ac884d996e..4ae1e861b3a8 100644
--- a/drivers/bluetooth/hci_vhci.c
+++ b/drivers/bluetooth/hci_vhci.c
@@ -30,6 +30,20 @@
static bool amp;
+struct vhci_ext_create_device_req {
+ __u8 dev_type;
+ __u32 flags;
+} __packed;
+
+#define VHCI_FLAG_QUIRK_RAW_DEVICE 0x01
+#define VHCI_FLAG_QUIRK_EXTERNAL_CONFIG 0x02
+#define VHCI_FLAG_QUIRKS_INVALID_BDADDR 0x04
+
+struct vhci_ext_create_device_resp {
+ __u8 dev_type;
+ __u16 index;
+} __packed;
+
struct vhci_data {
struct hci_dev *hdev;
@@ -278,6 +292,38 @@ static int vhci_setup(struct hci_dev *hdev)
return 0;
}
+static void vhci_create_debugfs(struct hci_dev *hdev)
+{
+ struct vhci_data *data = hci_get_drvdata(hdev);
+
+ debugfs_create_file("force_suspend", 0644, hdev->debugfs, data,
+ &force_suspend_fops);
+
+ debugfs_create_file("force_wakeup", 0644, hdev->debugfs, data,
+ &force_wakeup_fops);
+
+ if (IS_ENABLED(CONFIG_BT_MSFTEXT))
+ debugfs_create_file("msft_opcode", 0644, hdev->debugfs, data,
+ &msft_opcode_fops);
+
+ if (IS_ENABLED(CONFIG_BT_AOSPEXT))
+ debugfs_create_file("aosp_capable", 0644, hdev->debugfs, data,
+ &aosp_capable_fops);
+}
+
+static void vhci_setup_hdev(struct hci_dev *hdev)
+{
+ hdev->open = vhci_open_dev;
+ hdev->close = vhci_close_dev;
+ hdev->flush = vhci_flush;
+ hdev->send = vhci_send_frame;
+ hdev->get_data_path_id = vhci_get_data_path_id;
+ hdev->get_codec_config_data = vhci_get_codec_config_data;
+ hdev->wakeup = vhci_wakeup;
+ hdev->setup = vhci_setup;
+ set_bit(HCI_QUIRK_NON_PERSISTENT_SETUP, &hdev->quirks);
+}
+
static int __vhci_create_device(struct vhci_data *data, __u8 opcode)
{
struct hci_dev *hdev;
@@ -313,15 +359,7 @@ static int __vhci_create_device(struct vhci_data *data, __u8 opcode)
hdev->dev_type = dev_type;
hci_set_drvdata(hdev, data);
- hdev->open = vhci_open_dev;
- hdev->close = vhci_close_dev;
- hdev->flush = vhci_flush;
- hdev->send = vhci_send_frame;
- hdev->get_data_path_id = vhci_get_data_path_id;
- hdev->get_codec_config_data = vhci_get_codec_config_data;
- hdev->wakeup = vhci_wakeup;
- hdev->setup = vhci_setup;
- set_bit(HCI_QUIRK_NON_PERSISTENT_SETUP, &hdev->quirks);
+ vhci_setup_hdev(hdev);
/* bit 6 is for external configuration */
if (opcode & 0x40)
@@ -339,19 +377,7 @@ static int __vhci_create_device(struct vhci_data *data, __u8 opcode)
return -EBUSY;
}
- debugfs_create_file("force_suspend", 0644, hdev->debugfs, data,
- &force_suspend_fops);
-
- debugfs_create_file("force_wakeup", 0644, hdev->debugfs, data,
- &force_wakeup_fops);
-
- if (IS_ENABLED(CONFIG_BT_MSFTEXT))
- debugfs_create_file("msft_opcode", 0644, hdev->debugfs, data,
- &msft_opcode_fops);
-
- if (IS_ENABLED(CONFIG_BT_AOSPEXT))
- debugfs_create_file("aosp_capable", 0644, hdev->debugfs, data,
- &aosp_capable_fops);
+ vhci_create_debugfs(hdev);
hci_skb_pkt_type(skb) = HCI_VENDOR_PKT;
@@ -364,6 +390,67 @@ static int __vhci_create_device(struct vhci_data *data, __u8 opcode)
return 0;
}
+static int __vhci_ext_create_device(struct vhci_data *data, __u8 dev_type,
+ __u32 flags)
+{
+ struct hci_dev *hdev;
+ struct sk_buff *skb;
+ struct vhci_ext_create_device_resp *resp;
+
+ if (data->hdev)
+ return -EBADFD;
+
+ if (dev_type != HCI_PRIMARY && dev_type != HCI_AMP)
+ return -EINVAL;
+
+ skb = bt_skb_alloc(sizeof(*resp) + 1, GFP_KERNEL);
+ if (!skb)
+ return -ENOMEM;
+
+ hdev = hci_alloc_dev();
+ if (!hdev) {
+ kfree_skb(skb);
+ return -ENOMEM;
+ }
+
+ data->hdev = hdev;
+
+ hdev->bus = HCI_VIRTUAL;
+ hdev->dev_type = dev_type;
+ hci_set_drvdata(hdev, data);
+
+ vhci_setup_hdev(hdev);
+
+ /* Check quirks and set it for hdev */
+ if (flags & VHCI_FLAG_QUIRK_EXTERNAL_CONFIG)
+ set_bit(HCI_QUIRK_EXTERNAL_CONFIG, &hdev->quirks);
+
+ if (flags & VHCI_FLAG_QUIRK_RAW_DEVICE)
+ set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks);
+
+ if (flags & VHCI_FLAG_QUIRKS_INVALID_BDADDR)
+ set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks);
+
+ if (hci_register_dev(hdev) < 0) {
+ BT_ERR("Can't register HCI device");
+ hci_free_dev(hdev);
+ data->hdev = NULL;
+ kfree_skb(skb);
+ return -EBUSY;
+ }
+
+ vhci_create_debugfs(hdev);
+
+ hci_skb_pkt_type(skb) = HCI_VHCI_PKT;
+ skb_put_u8(skb, HCI_VHCI_PKT);
+ skb_put_u8(skb, dev_type);
+ put_unaligned_le16(hdev->id, skb_put(skb, 2));
+ skb_queue_tail(&data->readq, skb);
+
+ wake_up_interruptible(&data->read_wait);
+ return 0;
+}
+
static int vhci_create_device(struct vhci_data *data, __u8 opcode)
{
int err;
@@ -375,6 +462,18 @@ static int vhci_create_device(struct vhci_data *data, __u8 opcode)
return err;
}
+static int vhci_ext_create_device(struct vhci_data *data, __u8 dev_type,
+ __u32 flags)
+{
+ int err;
+
+ mutex_lock(&data->open_mutex);
+ err = __vhci_ext_create_device(data, dev_type, flags);
+ mutex_unlock(&data->open_mutex);
+
+ return err;
+}
+
static inline ssize_t vhci_get_user(struct vhci_data *data,
struct iov_iter *from)
{
@@ -429,6 +528,24 @@ static inline ssize_t vhci_get_user(struct vhci_data *data,
ret = vhci_create_device(data, opcode);
break;
+ /* This packet type is for VHCI specific command */
+ case HCI_VHCI_PKT:
+ cancel_delayed_work_sync(&data->open_timeout);
+ struct vhci_ext_create_device_req *req;
+
+ if (skb->len != sizeof(*req)) {
+ kfree_skb(skb);
+ return -EINVAL;
+ }
+
+ req = (void *)skb->data;
+ skb_pull(skb, sizeof(*req));
+
+ ret = vhci_ext_create_device(data, req->dev_type, req->flags);
+
+ kfree_skb(skb);
+ break;
+
default:
kfree_skb(skb);
return -EINVAL;
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 63065bc01b76..35d720f9e17a 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -355,6 +355,7 @@ enum {
#define HCI_EVENT_PKT 0x04
#define HCI_ISODATA_PKT 0x05
#define HCI_DIAG_PKT 0xf0
+#define HCI_VHCI_PKT 0xfe
#define HCI_VENDOR_PKT 0xff
/* HCI packet types */
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [RFC PATCH] Bluetooth: vhci: Add new packet type for VHCI
2021-10-29 6:13 [RFC PATCH] Bluetooth: vhci: Add new packet type for VHCI Tedd Ho-Jeong An
@ 2021-10-29 8:31 ` Marcel Holtmann
2021-10-29 9:15 ` kernel test robot
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Marcel Holtmann @ 2021-10-29 8:31 UTC (permalink / raw)
To: Tedd Ho-Jeong An; +Cc: linux-bluetooth, Tedd Ho-Jeong An
Hi Tedd,
> Current implementation uses the Vendor packet type (0xff) with opcode
> parameter. But there is no way to expand the opcode and no available bits
> to use. Also it cannot be changed due to the backward compatibility
> with older kernel.
>
> So, this patch adds new packet type dedicated for VHCI(0xfe) to support
> configuring the VHCI device with quarks and flags while creating the
> VHCI driver.
>
> Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>
> ---
> drivers/bluetooth/hci_vhci.c | 161 ++++++++++++++++++++++++++++++-----
> include/net/bluetooth/hci.h | 1 +
> 2 files changed, 140 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c
> index 49ac884d996e..4ae1e861b3a8 100644
> --- a/drivers/bluetooth/hci_vhci.c
> +++ b/drivers/bluetooth/hci_vhci.c
> @@ -30,6 +30,20 @@
>
> static bool amp;
>
> +struct vhci_ext_create_device_req {
> + __u8 dev_type;
> + __u32 flags;
> +} __packed;
> +
> +#define VHCI_FLAG_QUIRK_RAW_DEVICE 0x01
> +#define VHCI_FLAG_QUIRK_EXTERNAL_CONFIG 0x02
> +#define VHCI_FLAG_QUIRKS_INVALID_BDADDR 0x04
> +
> +struct vhci_ext_create_device_resp {
> + __u8 dev_type;
> + __u16 index;
> +} __packed;
> +
> struct vhci_data {
> struct hci_dev *hdev;
>
> @@ -278,6 +292,38 @@ static int vhci_setup(struct hci_dev *hdev)
> return 0;
> }
>
> +static void vhci_create_debugfs(struct hci_dev *hdev)
> +{
> + struct vhci_data *data = hci_get_drvdata(hdev);
> +
> + debugfs_create_file("force_suspend", 0644, hdev->debugfs, data,
> + &force_suspend_fops);
> +
> + debugfs_create_file("force_wakeup", 0644, hdev->debugfs, data,
> + &force_wakeup_fops);
> +
> + if (IS_ENABLED(CONFIG_BT_MSFTEXT))
> + debugfs_create_file("msft_opcode", 0644, hdev->debugfs, data,
> + &msft_opcode_fops);
> +
> + if (IS_ENABLED(CONFIG_BT_AOSPEXT))
> + debugfs_create_file("aosp_capable", 0644, hdev->debugfs, data,
> + &aosp_capable_fops);
> +}
> +
> +static void vhci_setup_hdev(struct hci_dev *hdev)
> +{
> + hdev->open = vhci_open_dev;
> + hdev->close = vhci_close_dev;
> + hdev->flush = vhci_flush;
> + hdev->send = vhci_send_frame;
> + hdev->get_data_path_id = vhci_get_data_path_id;
> + hdev->get_codec_config_data = vhci_get_codec_config_data;
> + hdev->wakeup = vhci_wakeup;
> + hdev->setup = vhci_setup;
> + set_bit(HCI_QUIRK_NON_PERSISTENT_SETUP, &hdev->quirks);
> +}
> +
> static int __vhci_create_device(struct vhci_data *data, __u8 opcode)
> {
> struct hci_dev *hdev;
> @@ -313,15 +359,7 @@ static int __vhci_create_device(struct vhci_data *data, __u8 opcode)
> hdev->dev_type = dev_type;
> hci_set_drvdata(hdev, data);
>
> - hdev->open = vhci_open_dev;
> - hdev->close = vhci_close_dev;
> - hdev->flush = vhci_flush;
> - hdev->send = vhci_send_frame;
> - hdev->get_data_path_id = vhci_get_data_path_id;
> - hdev->get_codec_config_data = vhci_get_codec_config_data;
> - hdev->wakeup = vhci_wakeup;
> - hdev->setup = vhci_setup;
> - set_bit(HCI_QUIRK_NON_PERSISTENT_SETUP, &hdev->quirks);
> + vhci_setup_hdev(hdev);
>
> /* bit 6 is for external configuration */
> if (opcode & 0x40)
> @@ -339,19 +377,7 @@ static int __vhci_create_device(struct vhci_data *data, __u8 opcode)
> return -EBUSY;
> }
>
> - debugfs_create_file("force_suspend", 0644, hdev->debugfs, data,
> - &force_suspend_fops);
> -
> - debugfs_create_file("force_wakeup", 0644, hdev->debugfs, data,
> - &force_wakeup_fops);
> -
> - if (IS_ENABLED(CONFIG_BT_MSFTEXT))
> - debugfs_create_file("msft_opcode", 0644, hdev->debugfs, data,
> - &msft_opcode_fops);
> -
> - if (IS_ENABLED(CONFIG_BT_AOSPEXT))
> - debugfs_create_file("aosp_capable", 0644, hdev->debugfs, data,
> - &aosp_capable_fops);
> + vhci_create_debugfs(hdev);
>
> hci_skb_pkt_type(skb) = HCI_VENDOR_PKT;
>
> @@ -364,6 +390,67 @@ static int __vhci_create_device(struct vhci_data *data, __u8 opcode)
> return 0;
> }
>
> +static int __vhci_ext_create_device(struct vhci_data *data, __u8 dev_type,
> + __u32 flags)
> +{
> + struct hci_dev *hdev;
> + struct sk_buff *skb;
> + struct vhci_ext_create_device_resp *resp;
> +
> + if (data->hdev)
> + return -EBADFD;
> +
> + if (dev_type != HCI_PRIMARY && dev_type != HCI_AMP)
> + return -EINVAL;
> +
> + skb = bt_skb_alloc(sizeof(*resp) + 1, GFP_KERNEL);
> + if (!skb)
> + return -ENOMEM;
> +
> + hdev = hci_alloc_dev();
> + if (!hdev) {
> + kfree_skb(skb);
> + return -ENOMEM;
> + }
> +
> + data->hdev = hdev;
> +
> + hdev->bus = HCI_VIRTUAL;
> + hdev->dev_type = dev_type;
> + hci_set_drvdata(hdev, data);
> +
> + vhci_setup_hdev(hdev);
> +
> + /* Check quirks and set it for hdev */
> + if (flags & VHCI_FLAG_QUIRK_EXTERNAL_CONFIG)
> + set_bit(HCI_QUIRK_EXTERNAL_CONFIG, &hdev->quirks);
> +
> + if (flags & VHCI_FLAG_QUIRK_RAW_DEVICE)
> + set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks);
> +
> + if (flags & VHCI_FLAG_QUIRKS_INVALID_BDADDR)
> + set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks);
> +
> + if (hci_register_dev(hdev) < 0) {
> + BT_ERR("Can't register HCI device");
> + hci_free_dev(hdev);
> + data->hdev = NULL;
> + kfree_skb(skb);
> + return -EBUSY;
> + }
> +
> + vhci_create_debugfs(hdev);
> +
> + hci_skb_pkt_type(skb) = HCI_VHCI_PKT;
> + skb_put_u8(skb, HCI_VHCI_PKT);
> + skb_put_u8(skb, dev_type);
> + put_unaligned_le16(hdev->id, skb_put(skb, 2));
> + skb_queue_tail(&data->readq, skb);
> +
> + wake_up_interruptible(&data->read_wait);
> + return 0;
> +}
> +
> static int vhci_create_device(struct vhci_data *data, __u8 opcode)
> {
> int err;
> @@ -375,6 +462,18 @@ static int vhci_create_device(struct vhci_data *data, __u8 opcode)
> return err;
> }
>
> +static int vhci_ext_create_device(struct vhci_data *data, __u8 dev_type,
> + __u32 flags)
> +{
> + int err;
> +
> + mutex_lock(&data->open_mutex);
> + err = __vhci_ext_create_device(data, dev_type, flags);
> + mutex_unlock(&data->open_mutex);
> +
> + return err;
> +}
> +
> static inline ssize_t vhci_get_user(struct vhci_data *data,
> struct iov_iter *from)
> {
> @@ -429,6 +528,24 @@ static inline ssize_t vhci_get_user(struct vhci_data *data,
> ret = vhci_create_device(data, opcode);
> break;
>
> + /* This packet type is for VHCI specific command */
> + case HCI_VHCI_PKT:
> + cancel_delayed_work_sync(&data->open_timeout);
> + struct vhci_ext_create_device_req *req;
> +
> + if (skb->len != sizeof(*req)) {
> + kfree_skb(skb);
> + return -EINVAL;
> + }
> +
> + req = (void *)skb->data;
> + skb_pull(skb, sizeof(*req));
> +
> + ret = vhci_ext_create_device(data, req->dev_type, req->flags);
> +
> + kfree_skb(skb);
> + break;
> +
> default:
> kfree_skb(skb);
> return -EINVAL;
> diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
> index 63065bc01b76..35d720f9e17a 100644
> --- a/include/net/bluetooth/hci.h
> +++ b/include/net/bluetooth/hci.h
> @@ -355,6 +355,7 @@ enum {
> #define HCI_EVENT_PKT 0x04
> #define HCI_ISODATA_PKT 0x05
> #define HCI_DIAG_PKT 0xf0
> +#define HCI_VHCI_PKT 0xfe
> #define HCI_VENDOR_PKT 0xff
that is the part that I don’t want to do in vhci. So in normal operation, only standard commands are supported. That is why there also is timeout when no 0xff is send in the beginning, then we fallback to a previous default device.
The 0xff is only briefly supported after opening the /dev/vhci and you can tell vhci what to create. I would like to keep it that way. And we should actually stay with that idea.
Now our problem is that we don’t have a “discover” / “read features” exchange so that we know what we can tell vhci to create. That would be generally useful and I totally ignored that portion when adding this extension.
My idea is not fully backed, but here goes what I have so far.
We use dev_type == 0x03 for request features. On current kernels it will return -EINVAL and we need to handle that in btvirt. Or we use bits 2-3 for ext_opcode. And then I would actually move over to providing the data via the same or similar structure used in virtio_bt.c.
As I said, this needs a bit of creative thinking to make this nice and easy and we don’t lock ourselves in again in the future.
Regards
Marcel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC PATCH] Bluetooth: vhci: Add new packet type for VHCI
2021-10-29 6:13 [RFC PATCH] Bluetooth: vhci: Add new packet type for VHCI Tedd Ho-Jeong An
2021-10-29 8:31 ` Marcel Holtmann
@ 2021-10-29 9:15 ` kernel test robot
2021-10-29 18:23 ` kernel test robot
2021-10-29 18:39 ` kernel test robot
3 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2021-10-29 9:15 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 4158 bytes --]
Hi Tedd,
[FYI, it's a private test report for your RFC patch.]
[auto build test ERROR on bluetooth-next/master]
[also build test ERROR on next-20211028]
[cannot apply to bluetooth/master v5.15-rc7]
[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/Tedd-Ho-Jeong-An/Bluetooth-vhci-Add-new-packet-type-for-VHCI/20211029-141735
base: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
config: powerpc-allyesconfig (attached as .config)
compiler: powerpc-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/66ce881eb09833714ee56dc1f26ed8c251629957
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Tedd-Ho-Jeong-An/Bluetooth-vhci-Add-new-packet-type-for-VHCI/20211029-141735
git checkout 66ce881eb09833714ee56dc1f26ed8c251629957
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=powerpc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
drivers/bluetooth/hci_vhci.c: In function 'vhci_get_user':
>> drivers/bluetooth/hci_vhci.c:534:17: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
534 | struct vhci_ext_create_device_req *req;
| ^~~~~~
cc1: all warnings being treated as errors
vim +534 drivers/bluetooth/hci_vhci.c
476
477 static inline ssize_t vhci_get_user(struct vhci_data *data,
478 struct iov_iter *from)
479 {
480 size_t len = iov_iter_count(from);
481 struct sk_buff *skb;
482 __u8 pkt_type, opcode;
483 int ret;
484
485 if (len < 2 || len > HCI_MAX_FRAME_SIZE)
486 return -EINVAL;
487
488 skb = bt_skb_alloc(len, GFP_KERNEL);
489 if (!skb)
490 return -ENOMEM;
491
492 if (!copy_from_iter_full(skb_put(skb, len), len, from)) {
493 kfree_skb(skb);
494 return -EFAULT;
495 }
496
497 pkt_type = *((__u8 *) skb->data);
498 skb_pull(skb, 1);
499
500 switch (pkt_type) {
501 case HCI_EVENT_PKT:
502 case HCI_ACLDATA_PKT:
503 case HCI_SCODATA_PKT:
504 case HCI_ISODATA_PKT:
505 if (!data->hdev) {
506 kfree_skb(skb);
507 return -ENODEV;
508 }
509
510 hci_skb_pkt_type(skb) = pkt_type;
511
512 ret = hci_recv_frame(data->hdev, skb);
513 break;
514
515 case HCI_VENDOR_PKT:
516 cancel_delayed_work_sync(&data->open_timeout);
517
518 opcode = *((__u8 *) skb->data);
519 skb_pull(skb, 1);
520
521 if (skb->len > 0) {
522 kfree_skb(skb);
523 return -EINVAL;
524 }
525
526 kfree_skb(skb);
527
528 ret = vhci_create_device(data, opcode);
529 break;
530
531 /* This packet type is for VHCI specific command */
532 case HCI_VHCI_PKT:
533 cancel_delayed_work_sync(&data->open_timeout);
> 534 struct vhci_ext_create_device_req *req;
535
536 if (skb->len != sizeof(*req)) {
537 kfree_skb(skb);
538 return -EINVAL;
539 }
540
541 req = (void *)skb->data;
542 skb_pull(skb, sizeof(*req));
543
544 ret = vhci_ext_create_device(data, req->dev_type, req->flags);
545
546 kfree_skb(skb);
547 break;
548
549 default:
550 kfree_skb(skb);
551 return -EINVAL;
552 }
553
554 return (ret < 0) ? ret : len;
555 }
556
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 72113 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC PATCH] Bluetooth: vhci: Add new packet type for VHCI
2021-10-29 6:13 [RFC PATCH] Bluetooth: vhci: Add new packet type for VHCI Tedd Ho-Jeong An
@ 2021-10-29 18:23 ` kernel test robot
2021-10-29 9:15 ` kernel test robot
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2021-10-29 18:23 UTC (permalink / raw)
To: Tedd Ho-Jeong An; +Cc: llvm, kbuild-all
[-- Attachment #1: Type: text/plain, Size: 4154 bytes --]
Hi Tedd,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on bluetooth-next/master]
[also build test WARNING on next-20211029]
[cannot apply to bluetooth/master v5.15-rc7]
[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/Tedd-Ho-Jeong-An/Bluetooth-vhci-Add-new-packet-type-for-VHCI/20211029-141735
base: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
config: arm-randconfig-r012-20211029 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5db7568a6a1fcb408eb8988abdaff2a225a8eb72)
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
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/0day-ci/linux/commit/66ce881eb09833714ee56dc1f26ed8c251629957
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Tedd-Ho-Jeong-An/Bluetooth-vhci-Add-new-packet-type-for-VHCI/20211029-141735
git checkout 66ce881eb09833714ee56dc1f26ed8c251629957
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=arm
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/hci_vhci.c:534:38: warning: ISO C90 forbids mixing declarations and code [-Wdeclaration-after-statement]
struct vhci_ext_create_device_req *req;
^
1 warning generated.
vim +534 drivers/bluetooth/hci_vhci.c
476
477 static inline ssize_t vhci_get_user(struct vhci_data *data,
478 struct iov_iter *from)
479 {
480 size_t len = iov_iter_count(from);
481 struct sk_buff *skb;
482 __u8 pkt_type, opcode;
483 int ret;
484
485 if (len < 2 || len > HCI_MAX_FRAME_SIZE)
486 return -EINVAL;
487
488 skb = bt_skb_alloc(len, GFP_KERNEL);
489 if (!skb)
490 return -ENOMEM;
491
492 if (!copy_from_iter_full(skb_put(skb, len), len, from)) {
493 kfree_skb(skb);
494 return -EFAULT;
495 }
496
497 pkt_type = *((__u8 *) skb->data);
498 skb_pull(skb, 1);
499
500 switch (pkt_type) {
501 case HCI_EVENT_PKT:
502 case HCI_ACLDATA_PKT:
503 case HCI_SCODATA_PKT:
504 case HCI_ISODATA_PKT:
505 if (!data->hdev) {
506 kfree_skb(skb);
507 return -ENODEV;
508 }
509
510 hci_skb_pkt_type(skb) = pkt_type;
511
512 ret = hci_recv_frame(data->hdev, skb);
513 break;
514
515 case HCI_VENDOR_PKT:
516 cancel_delayed_work_sync(&data->open_timeout);
517
518 opcode = *((__u8 *) skb->data);
519 skb_pull(skb, 1);
520
521 if (skb->len > 0) {
522 kfree_skb(skb);
523 return -EINVAL;
524 }
525
526 kfree_skb(skb);
527
528 ret = vhci_create_device(data, opcode);
529 break;
530
531 /* This packet type is for VHCI specific command */
532 case HCI_VHCI_PKT:
533 cancel_delayed_work_sync(&data->open_timeout);
> 534 struct vhci_ext_create_device_req *req;
535
536 if (skb->len != sizeof(*req)) {
537 kfree_skb(skb);
538 return -EINVAL;
539 }
540
541 req = (void *)skb->data;
542 skb_pull(skb, sizeof(*req));
543
544 ret = vhci_ext_create_device(data, req->dev_type, req->flags);
545
546 kfree_skb(skb);
547 break;
548
549 default:
550 kfree_skb(skb);
551 return -EINVAL;
552 }
553
554 return (ret < 0) ? ret : len;
555 }
556
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 37647 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC PATCH] Bluetooth: vhci: Add new packet type for VHCI
@ 2021-10-29 18:23 ` kernel test robot
0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2021-10-29 18:23 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 4278 bytes --]
Hi Tedd,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on bluetooth-next/master]
[also build test WARNING on next-20211029]
[cannot apply to bluetooth/master v5.15-rc7]
[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/Tedd-Ho-Jeong-An/Bluetooth-vhci-Add-new-packet-type-for-VHCI/20211029-141735
base: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
config: arm-randconfig-r012-20211029 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5db7568a6a1fcb408eb8988abdaff2a225a8eb72)
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
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/0day-ci/linux/commit/66ce881eb09833714ee56dc1f26ed8c251629957
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Tedd-Ho-Jeong-An/Bluetooth-vhci-Add-new-packet-type-for-VHCI/20211029-141735
git checkout 66ce881eb09833714ee56dc1f26ed8c251629957
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=arm
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/hci_vhci.c:534:38: warning: ISO C90 forbids mixing declarations and code [-Wdeclaration-after-statement]
struct vhci_ext_create_device_req *req;
^
1 warning generated.
vim +534 drivers/bluetooth/hci_vhci.c
476
477 static inline ssize_t vhci_get_user(struct vhci_data *data,
478 struct iov_iter *from)
479 {
480 size_t len = iov_iter_count(from);
481 struct sk_buff *skb;
482 __u8 pkt_type, opcode;
483 int ret;
484
485 if (len < 2 || len > HCI_MAX_FRAME_SIZE)
486 return -EINVAL;
487
488 skb = bt_skb_alloc(len, GFP_KERNEL);
489 if (!skb)
490 return -ENOMEM;
491
492 if (!copy_from_iter_full(skb_put(skb, len), len, from)) {
493 kfree_skb(skb);
494 return -EFAULT;
495 }
496
497 pkt_type = *((__u8 *) skb->data);
498 skb_pull(skb, 1);
499
500 switch (pkt_type) {
501 case HCI_EVENT_PKT:
502 case HCI_ACLDATA_PKT:
503 case HCI_SCODATA_PKT:
504 case HCI_ISODATA_PKT:
505 if (!data->hdev) {
506 kfree_skb(skb);
507 return -ENODEV;
508 }
509
510 hci_skb_pkt_type(skb) = pkt_type;
511
512 ret = hci_recv_frame(data->hdev, skb);
513 break;
514
515 case HCI_VENDOR_PKT:
516 cancel_delayed_work_sync(&data->open_timeout);
517
518 opcode = *((__u8 *) skb->data);
519 skb_pull(skb, 1);
520
521 if (skb->len > 0) {
522 kfree_skb(skb);
523 return -EINVAL;
524 }
525
526 kfree_skb(skb);
527
528 ret = vhci_create_device(data, opcode);
529 break;
530
531 /* This packet type is for VHCI specific command */
532 case HCI_VHCI_PKT:
533 cancel_delayed_work_sync(&data->open_timeout);
> 534 struct vhci_ext_create_device_req *req;
535
536 if (skb->len != sizeof(*req)) {
537 kfree_skb(skb);
538 return -EINVAL;
539 }
540
541 req = (void *)skb->data;
542 skb_pull(skb, sizeof(*req));
543
544 ret = vhci_ext_create_device(data, req->dev_type, req->flags);
545
546 kfree_skb(skb);
547 break;
548
549 default:
550 kfree_skb(skb);
551 return -EINVAL;
552 }
553
554 return (ret < 0) ? ret : len;
555 }
556
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 37647 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC PATCH] Bluetooth: vhci: Add new packet type for VHCI
2021-10-29 6:13 [RFC PATCH] Bluetooth: vhci: Add new packet type for VHCI Tedd Ho-Jeong An
` (2 preceding siblings ...)
2021-10-29 18:23 ` kernel test robot
@ 2021-10-29 18:39 ` kernel test robot
3 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2021-10-29 18:39 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 4126 bytes --]
Hi Tedd,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on bluetooth-next/master]
[also build test WARNING on next-20211029]
[cannot apply to bluetooth/master v5.15-rc7]
[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/Tedd-Ho-Jeong-An/Bluetooth-vhci-Add-new-packet-type-for-VHCI/20211029-141735
base: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
config: powerpc-randconfig-r002-20211028 (attached as .config)
compiler: powerpc-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/66ce881eb09833714ee56dc1f26ed8c251629957
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Tedd-Ho-Jeong-An/Bluetooth-vhci-Add-new-packet-type-for-VHCI/20211029-141735
git checkout 66ce881eb09833714ee56dc1f26ed8c251629957
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=powerpc
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/hci_vhci.c: In function 'vhci_get_user':
>> drivers/bluetooth/hci_vhci.c:534:17: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
534 | struct vhci_ext_create_device_req *req;
| ^~~~~~
vim +534 drivers/bluetooth/hci_vhci.c
476
477 static inline ssize_t vhci_get_user(struct vhci_data *data,
478 struct iov_iter *from)
479 {
480 size_t len = iov_iter_count(from);
481 struct sk_buff *skb;
482 __u8 pkt_type, opcode;
483 int ret;
484
485 if (len < 2 || len > HCI_MAX_FRAME_SIZE)
486 return -EINVAL;
487
488 skb = bt_skb_alloc(len, GFP_KERNEL);
489 if (!skb)
490 return -ENOMEM;
491
492 if (!copy_from_iter_full(skb_put(skb, len), len, from)) {
493 kfree_skb(skb);
494 return -EFAULT;
495 }
496
497 pkt_type = *((__u8 *) skb->data);
498 skb_pull(skb, 1);
499
500 switch (pkt_type) {
501 case HCI_EVENT_PKT:
502 case HCI_ACLDATA_PKT:
503 case HCI_SCODATA_PKT:
504 case HCI_ISODATA_PKT:
505 if (!data->hdev) {
506 kfree_skb(skb);
507 return -ENODEV;
508 }
509
510 hci_skb_pkt_type(skb) = pkt_type;
511
512 ret = hci_recv_frame(data->hdev, skb);
513 break;
514
515 case HCI_VENDOR_PKT:
516 cancel_delayed_work_sync(&data->open_timeout);
517
518 opcode = *((__u8 *) skb->data);
519 skb_pull(skb, 1);
520
521 if (skb->len > 0) {
522 kfree_skb(skb);
523 return -EINVAL;
524 }
525
526 kfree_skb(skb);
527
528 ret = vhci_create_device(data, opcode);
529 break;
530
531 /* This packet type is for VHCI specific command */
532 case HCI_VHCI_PKT:
533 cancel_delayed_work_sync(&data->open_timeout);
> 534 struct vhci_ext_create_device_req *req;
535
536 if (skb->len != sizeof(*req)) {
537 kfree_skb(skb);
538 return -EINVAL;
539 }
540
541 req = (void *)skb->data;
542 skb_pull(skb, sizeof(*req));
543
544 ret = vhci_ext_create_device(data, req->dev_type, req->flags);
545
546 kfree_skb(skb);
547 break;
548
549 default:
550 kfree_skb(skb);
551 return -EINVAL;
552 }
553
554 return (ret < 0) ? ret : len;
555 }
556
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 39997 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-10-29 18:39 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-29 6:13 [RFC PATCH] Bluetooth: vhci: Add new packet type for VHCI Tedd Ho-Jeong An
2021-10-29 8:31 ` Marcel Holtmann
2021-10-29 9:15 ` kernel test robot
2021-10-29 18:23 ` kernel test robot
2021-10-29 18:23 ` kernel test robot
2021-10-29 18:39 ` kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.