Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1442143 > unrolled thread

Re: [PATCH 1/2] Bluetooth: Add LED triggers for HCI frames tx and rx

Started byMarcel Holtmann <marcel@holtmann.org>
First post2016-07-13 10:10 +0200
Last post2016-07-15 14:10 +0200
Articles 5 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 1/2] Bluetooth: Add LED triggers for HCI frames tx and rx Marcel Holtmann <marcel@holtmann.org> - 2016-07-13 10:10 +0200
    Re: [PATCH 1/2] Bluetooth: Add LED triggers for HCI frames tx and rx Guodong Xu <guodong.xu@linaro.org> - 2016-07-14 09:10 +0200
    Re: [PATCH 1/2] Bluetooth: Add LED triggers for HCI frames tx and rx Guodong Xu <guodong.xu@linaro.org> - 2016-07-14 11:40 +0200
      Re: [PATCH 1/2] Bluetooth: Add LED triggers for HCI frames tx and rx Marcel Holtmann <marcel@holtmann.org> - 2016-07-14 11:50 +0200
        Re: [PATCH 1/2] Bluetooth: Add LED triggers for HCI frames tx and rx Guodong Xu <guodong.xu@linaro.org> - 2016-07-15 14:10 +0200

#1442143 — Re: [PATCH 1/2] Bluetooth: Add LED triggers for HCI frames tx and rx

FromMarcel Holtmann <marcel@holtmann.org>
Date2016-07-13 10:10 +0200
SubjectRe: [PATCH 1/2] Bluetooth: Add LED triggers for HCI frames tx and rx
Message-ID<rUnoZ-kO-3@gated-at.bofh.it>
Hi Guodong,

> Two LED triggers are defined: tx_led and rx_led. Upon frames
> available in HCI core layer, for tx or for rx, the combined LED
> can blink.
> 
> Verified on HiKey, 96boards. It uses hi6220 SoC and TI WL1835 combo
> chip.
> 
> Signed-off-by: Guodong Xu <guodong.xu@linaro.org>
> ---
> include/net/bluetooth/hci_core.h |  1 +
> net/bluetooth/hci_core.c         |  3 +++
> net/bluetooth/leds.c             | 15 +++++++++++++++
> net/bluetooth/leds.h             |  2 ++
> 4 files changed, 21 insertions(+)
> 
> diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
> index dc71473..37b8dd9 100644
> --- a/include/net/bluetooth/hci_core.h
> +++ b/include/net/bluetooth/hci_core.h
> @@ -398,6 +398,7 @@ struct hci_dev {
> 	bdaddr_t		rpa;
> 
> 	struct led_trigger	*power_led;
> +	struct led_trigger	*tx_led, *rx_led;
> 
> 	int (*open)(struct hci_dev *hdev);
> 	int (*close)(struct hci_dev *hdev);
> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> index 45a9fc6..c6e1210 100644
> --- a/net/bluetooth/hci_core.c
> +++ b/net/bluetooth/hci_core.c
> @@ -3248,6 +3248,7 @@ int hci_recv_frame(struct hci_dev *hdev, struct sk_buff *skb)
> 	skb_queue_tail(&hdev->rx_q, skb);
> 	queue_work(hdev->workqueue, &hdev->rx_work);
> 
> +	hci_leds_blink_oneshot(hdev->rx_led);
> 	return 0;
> }
> EXPORT_SYMBOL(hci_recv_frame);
> @@ -3325,6 +3326,8 @@ static void hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
> 		BT_ERR("%s sending frame failed (%d)", hdev->name, err);
> 		kfree_skb(skb);
> 	}
> +
> +	hci_leds_blink_oneshot(hdev->tx_led);
> }

so I am not convinced that this is the right way of doing TX/RX activity leds. This would have them purely based on HCI traffic and this would include control frames. I think that we want activity leds for actual radio activity. Meaning that when we have an active connection and ACL packets are exchanged or when we are scanning.

Regards

Marcel

[toc] | [next] | [standalone]


#1443128

FromGuodong Xu <guodong.xu@linaro.org>
Date2016-07-14 09:10 +0200
Message-ID<rUIWv-6o9-39@gated-at.bofh.it>
In reply to#1442143
On 13 July 2016 at 16:07, Marcel Holtmann <marcel@holtmann.org> wrote:
> Hi Guodong,
>
>> Two LED triggers are defined: tx_led and rx_led. Upon frames
>> available in HCI core layer, for tx or for rx, the combined LED
>> can blink.
>>
>> Verified on HiKey, 96boards. It uses hi6220 SoC and TI WL1835 combo
>> chip.
>>
>> Signed-off-by: Guodong Xu <guodong.xu@linaro.org>
>> ---
>> include/net/bluetooth/hci_core.h |  1 +
>> net/bluetooth/hci_core.c         |  3 +++
>> net/bluetooth/leds.c             | 15 +++++++++++++++
>> net/bluetooth/leds.h             |  2 ++
>> 4 files changed, 21 insertions(+)
>>
>> diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
>> index dc71473..37b8dd9 100644
>> --- a/include/net/bluetooth/hci_core.h
>> +++ b/include/net/bluetooth/hci_core.h
>> @@ -398,6 +398,7 @@ struct hci_dev {
>>       bdaddr_t                rpa;
>>
>>       struct led_trigger      *power_led;
>> +     struct led_trigger      *tx_led, *rx_led;
>>
>>       int (*open)(struct hci_dev *hdev);
>>       int (*close)(struct hci_dev *hdev);
>> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
>> index 45a9fc6..c6e1210 100644
>> --- a/net/bluetooth/hci_core.c
>> +++ b/net/bluetooth/hci_core.c
>> @@ -3248,6 +3248,7 @@ int hci_recv_frame(struct hci_dev *hdev, struct sk_buff *skb)
>>       skb_queue_tail(&hdev->rx_q, skb);
>>       queue_work(hdev->workqueue, &hdev->rx_work);
>>
>> +     hci_leds_blink_oneshot(hdev->rx_led);
>>       return 0;
>> }
>> EXPORT_SYMBOL(hci_recv_frame);
>> @@ -3325,6 +3326,8 @@ static void hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
>>               BT_ERR("%s sending frame failed (%d)", hdev->name, err);
>>               kfree_skb(skb);
>>       }
>> +
>> +     hci_leds_blink_oneshot(hdev->tx_led);
>> }
>
> so I am not convinced that this is the right way of doing TX/RX activity leds. This would have them purely based on HCI traffic and this would include control frames. I think that we want activity leds for actual radio activity. Meaning that when we have an active connection and ACL packets are exchanged or when we are scanning.
>

Thanks. I got your point. I will revise the code and submit again.

> Regards
>
> Marcel
>

[toc] | [prev] | [next] | [standalone]


#1443319

FromGuodong Xu <guodong.xu@linaro.org>
Date2016-07-14 11:40 +0200
Message-ID<rULhE-7Tt-15@gated-at.bofh.it>
In reply to#1442143
On 13 July 2016 at 16:07, Marcel Holtmann <marcel@holtmann.org> wrote:
> Hi Guodong,
>
>> Two LED triggers are defined: tx_led and rx_led. Upon frames
>> available in HCI core layer, for tx or for rx, the combined LED
>> can blink.
>>
>> Verified on HiKey, 96boards. It uses hi6220 SoC and TI WL1835 combo
>> chip.
>>
>> Signed-off-by: Guodong Xu <guodong.xu@linaro.org>
>> ---
>> include/net/bluetooth/hci_core.h |  1 +
>> net/bluetooth/hci_core.c         |  3 +++
>> net/bluetooth/leds.c             | 15 +++++++++++++++
>> net/bluetooth/leds.h             |  2 ++
>> 4 files changed, 21 insertions(+)
>>
>> diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
>> index dc71473..37b8dd9 100644
>> --- a/include/net/bluetooth/hci_core.h
>> +++ b/include/net/bluetooth/hci_core.h
>> @@ -398,6 +398,7 @@ struct hci_dev {
>>       bdaddr_t                rpa;
>>
>>       struct led_trigger      *power_led;
>> +     struct led_trigger      *tx_led, *rx_led;
>>
>>       int (*open)(struct hci_dev *hdev);
>>       int (*close)(struct hci_dev *hdev);
>> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
>> index 45a9fc6..c6e1210 100644
>> --- a/net/bluetooth/hci_core.c
>> +++ b/net/bluetooth/hci_core.c
>> @@ -3248,6 +3248,7 @@ int hci_recv_frame(struct hci_dev *hdev, struct sk_buff *skb)
>>       skb_queue_tail(&hdev->rx_q, skb);
>>       queue_work(hdev->workqueue, &hdev->rx_work);
>>
>> +     hci_leds_blink_oneshot(hdev->rx_led);
>>       return 0;
>> }
>> EXPORT_SYMBOL(hci_recv_frame);
>> @@ -3325,6 +3326,8 @@ static void hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
>>               BT_ERR("%s sending frame failed (%d)", hdev->name, err);
>>               kfree_skb(skb);
>>       }
>> +
>> +     hci_leds_blink_oneshot(hdev->tx_led);
>> }
>
> so I am not convinced that this is the right way of doing TX/RX activity leds. This would have them purely based on HCI traffic and this would include control frames.
>

Hi, Marcel

+       if (hci_skb_pkt_type(skb) == HCI_ACLDATA_PKT ||
+           hci_skb_pkt_type(skb) == HCI_SCODATA_PKT)
+               hci_leds_blink_oneshot(hdev->rx_led);
+

By adding pkt_type checks, we can limit LED blinks only at ACL/SCO
DATA_PKT. Similar checks can be added for tx_led too.

Does this look good to you? If you agree, I can send v2 to include this change.

> I think that we want activity leds for actual radio activity. Meaning that when we have an active connection and ACL packets are exchanged or when we are scanning.
>

Radio is controlled in Bluetooth module side, not Host. So I'm afraid
actual radio activity cannot be captured in its exact form in Host
side. The purpose of this patch is not for radio, it is for
incoming/outgoing data. For example, it can give user a blinking
indicator on RX frames after a Bluetooth mouse is connected. Another
example, it can blink at bluetooth streamed audio (TX).

Would that make sense?

-Guodong

>
> Regards
>
> Marcel
>

[toc] | [prev] | [next] | [standalone]


#1443323

FromMarcel Holtmann <marcel@holtmann.org>
Date2016-07-14 11:50 +0200
Message-ID<rULrj-7WZ-11@gated-at.bofh.it>
In reply to#1443319
Hi Guodong,

>>> Two LED triggers are defined: tx_led and rx_led. Upon frames
>>> available in HCI core layer, for tx or for rx, the combined LED
>>> can blink.
>>> 
>>> Verified on HiKey, 96boards. It uses hi6220 SoC and TI WL1835 combo
>>> chip.
>>> 
>>> Signed-off-by: Guodong Xu <guodong.xu@linaro.org>
>>> ---
>>> include/net/bluetooth/hci_core.h |  1 +
>>> net/bluetooth/hci_core.c         |  3 +++
>>> net/bluetooth/leds.c             | 15 +++++++++++++++
>>> net/bluetooth/leds.h             |  2 ++
>>> 4 files changed, 21 insertions(+)
>>> 
>>> diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
>>> index dc71473..37b8dd9 100644
>>> --- a/include/net/bluetooth/hci_core.h
>>> +++ b/include/net/bluetooth/hci_core.h
>>> @@ -398,6 +398,7 @@ struct hci_dev {
>>>      bdaddr_t                rpa;
>>> 
>>>      struct led_trigger      *power_led;
>>> +     struct led_trigger      *tx_led, *rx_led;
>>> 
>>>      int (*open)(struct hci_dev *hdev);
>>>      int (*close)(struct hci_dev *hdev);
>>> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
>>> index 45a9fc6..c6e1210 100644
>>> --- a/net/bluetooth/hci_core.c
>>> +++ b/net/bluetooth/hci_core.c
>>> @@ -3248,6 +3248,7 @@ int hci_recv_frame(struct hci_dev *hdev, struct sk_buff *skb)
>>>      skb_queue_tail(&hdev->rx_q, skb);
>>>      queue_work(hdev->workqueue, &hdev->rx_work);
>>> 
>>> +     hci_leds_blink_oneshot(hdev->rx_led);
>>>      return 0;
>>> }
>>> EXPORT_SYMBOL(hci_recv_frame);
>>> @@ -3325,6 +3326,8 @@ static void hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
>>>              BT_ERR("%s sending frame failed (%d)", hdev->name, err);
>>>              kfree_skb(skb);
>>>      }
>>> +
>>> +     hci_leds_blink_oneshot(hdev->tx_led);
>>> }
>> 
>> so I am not convinced that this is the right way of doing TX/RX activity leds. This would have them purely based on HCI traffic and this would include control frames.
>> 
> 
> Hi, Marcel
> 
> +       if (hci_skb_pkt_type(skb) == HCI_ACLDATA_PKT ||
> +           hci_skb_pkt_type(skb) == HCI_SCODATA_PKT)
> +               hci_leds_blink_oneshot(hdev->rx_led);
> +
> 
> By adding pkt_type checks, we can limit LED blinks only at ACL/SCO
> DATA_PKT. Similar checks can be added for tx_led too.
> 
> Does this look good to you? If you agree, I can send v2 to include this change.

we are not going to keep comparing packet types over and over again. The code is already doing that. So functions like hci_sched_acl and hci_acldata_packet are already present in the code.

>> I think that we want activity leds for actual radio activity. Meaning that when we have an active connection and ACL packets are exchanged or when we are scanning.
>> 
> 
> Radio is controlled in Bluetooth module side, not Host. So I'm afraid
> actual radio activity cannot be captured in its exact form in Host
> side. The purpose of this patch is not for radio, it is for
> incoming/outgoing data. For example, it can give user a blinking
> indicator on RX frames after a Bluetooth mouse is connected. Another
> example, it can blink at bluetooth streamed audio (TX).

So radio activity is caused by RX/TX meaning ACL/SCO packets for sure. There is also other radio activity caused by scanning, inquiry, create connection etc. And the question is if this should be there as well.

Regards

Marcel

[toc] | [prev] | [next] | [standalone]


#1444228

FromGuodong Xu <guodong.xu@linaro.org>
Date2016-07-15 14:10 +0200
Message-ID<rVa6m-6K7-25@gated-at.bofh.it>
In reply to#1443323
On 14 July 2016 at 17:42, Marcel Holtmann <marcel@holtmann.org> wrote:
> Hi Guodong,
>
>>>> Two LED triggers are defined: tx_led and rx_led. Upon frames
>>>> available in HCI core layer, for tx or for rx, the combined LED
>>>> can blink.
>>>>
>>>> Verified on HiKey, 96boards. It uses hi6220 SoC and TI WL1835 combo
>>>> chip.
>>>>
>>>> Signed-off-by: Guodong Xu <guodong.xu@linaro.org>
>>>> ---
>>>> include/net/bluetooth/hci_core.h |  1 +
>>>> net/bluetooth/hci_core.c         |  3 +++
>>>> net/bluetooth/leds.c             | 15 +++++++++++++++
>>>> net/bluetooth/leds.h             |  2 ++
>>>> 4 files changed, 21 insertions(+)
>>>>
>>>> diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
>>>> index dc71473..37b8dd9 100644
>>>> --- a/include/net/bluetooth/hci_core.h
>>>> +++ b/include/net/bluetooth/hci_core.h
>>>> @@ -398,6 +398,7 @@ struct hci_dev {
>>>>      bdaddr_t                rpa;
>>>>
>>>>      struct led_trigger      *power_led;
>>>> +     struct led_trigger      *tx_led, *rx_led;
>>>>
>>>>      int (*open)(struct hci_dev *hdev);
>>>>      int (*close)(struct hci_dev *hdev);
>>>> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
>>>> index 45a9fc6..c6e1210 100644
>>>> --- a/net/bluetooth/hci_core.c
>>>> +++ b/net/bluetooth/hci_core.c
>>>> @@ -3248,6 +3248,7 @@ int hci_recv_frame(struct hci_dev *hdev, struct sk_buff *skb)
>>>>      skb_queue_tail(&hdev->rx_q, skb);
>>>>      queue_work(hdev->workqueue, &hdev->rx_work);
>>>>
>>>> +     hci_leds_blink_oneshot(hdev->rx_led);
>>>>      return 0;
>>>> }
>>>> EXPORT_SYMBOL(hci_recv_frame);
>>>> @@ -3325,6 +3326,8 @@ static void hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
>>>>              BT_ERR("%s sending frame failed (%d)", hdev->name, err);
>>>>              kfree_skb(skb);
>>>>      }
>>>> +
>>>> +     hci_leds_blink_oneshot(hdev->tx_led);
>>>> }
>>>
>>> so I am not convinced that this is the right way of doing TX/RX activity leds. This would have them purely based on HCI traffic and this would include control frames.
>>>
>>
>> Hi, Marcel
>>
>> +       if (hci_skb_pkt_type(skb) == HCI_ACLDATA_PKT ||
>> +           hci_skb_pkt_type(skb) == HCI_SCODATA_PKT)
>> +               hci_leds_blink_oneshot(hdev->rx_led);
>> +
>>
>> By adding pkt_type checks, we can limit LED blinks only at ACL/SCO
>> DATA_PKT. Similar checks can be added for tx_led too.
>>
>> Does this look good to you? If you agree, I can send v2 to include this change.
>
> we are not going to keep comparing packet types over and over again. The code is already doing that. So functions like hci_sched_acl and hci_acldata_packet are already present in the code.
>
>>> I think that we want activity leds for actual radio activity. Meaning that when we have an active connection and ACL packets are exchanged or when we are scanning.
>>>
>>
>> Radio is controlled in Bluetooth module side, not Host. So I'm afraid
>> actual radio activity cannot be captured in its exact form in Host
>> side. The purpose of this patch is not for radio, it is for
>> incoming/outgoing data. For example, it can give user a blinking
>> indicator on RX frames after a Bluetooth mouse is connected. Another
>> example, it can blink at bluetooth streamed audio (TX).
>
> So radio activity is caused by RX/TX meaning ACL/SCO packets for sure. There is also other radio activity caused by scanning, inquiry, create connection etc. And the question is if this should be there as well.
>

I wouldn't suggest to cover scanning, inquiry, etc. Scanning, for
example, Host sends a scan command to Bluetooth module (in an
asynchronous way). After a given interval, Host receives inquiry
results. Over this period, at host side, we don't know what kind of
radio activity is happening in BT module side.

Let's say this patch provide LED indicators to only data packets
activity (ACL and SCO). Can we?

-Guodong

> Regards
>
> Marcel
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web