Re: [RFC BlueZ PATCH 1/2] emulator/btdev: Update the white list and resolving list size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Tedd,

On Tue, Jun 15, 2021 at 12:31 PM Tedd Ho-Jeong An <hj.tedd.an@xxxxxxxxx> wrote:
>
> From: Tedd Ho-Jeong An <tedd.an@xxxxxxxxx>
>
> This patch updates the white list and resolving list size to small
> number.
> Also, it update the size of white list and resolving list to 1 more than
> actual size when it is read via HCI read size commands. This is used to
> simulate the case when the list is out of space.
>
> Note that the read list size may not represent the current actual list
> size depends on the device vendor.
> ---
>  emulator/btdev.c | 18 ++++++++++++++----
>  1 file changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/emulator/btdev.c b/emulator/btdev.c
> index eba9f57f9..d8d6fbc8b 100644
> --- a/emulator/btdev.c
> +++ b/emulator/btdev.c
> @@ -33,8 +33,8 @@
>  #include "monitor/bt.h"
>  #include "btdev.h"
>
> -#define WL_SIZE                        16
> -#define RL_SIZE                        16
> +#define WL_SIZE                        3
> +#define RL_SIZE                        3
>  #define CIS_SIZE               3
>
>  #define has_bredr(btdev)       (!((btdev)->features[4] & 0x20))
> @@ -3393,7 +3393,12 @@ static int cmd_read_wl_size(struct btdev *dev, const void *data, uint8_t len)
>         struct bt_hci_rsp_le_read_white_list_size rsp;
>
>         rsp.status = BT_HCI_ERR_SUCCESS;
> -       rsp.size = WL_SIZE;
> +       /* The size is not fixed and the actual list size can be different from
> +        * the returned size here.
> +        * In order to test such cases, return more than allocated size, and
> +        * HCI Add device cmd will return the Memory Capacity Exceeded(0x07)
> +        */
> +       rsp.size = WL_SIZE + 1;
>         cmd_complete(dev, BT_HCI_CMD_LE_READ_WHITE_LIST_SIZE, &rsp,
>                                                 sizeof(rsp));
>
> @@ -3678,7 +3683,12 @@ static int cmd_read_rl_size(struct btdev *dev, const void *data, uint8_t len)
>         struct bt_hci_rsp_le_read_resolv_list_size rsp;
>
>         rsp.status = BT_HCI_ERR_SUCCESS;
> -       rsp.size = RL_SIZE;
> +       /* The size is not fixed and the actual list size can be different from
> +        * the returned size here.
> +        * In order to test such cases, return more than allocated size, and
> +        * HCI Add device cmd will return the Memory Capacity Exceeded(0x07)
> +        */
> +       rsp.size = RL_SIZE + 1;
>
>         cmd_complete(dev, BT_HCI_CMD_LE_READ_RESOLV_LIST_SIZE,
>                                                         &rsp, sizeof(rsp));
> --
> 2.26.3

There must be a better way to force this since this would also prevent
possible test cases that requires the list size to report the number
of entries properly, perhaps we need to add a command which the tester
could use to emulate the change on the list size at runtime, that said
it would require us to send that HCI command (possible a meta vendor
command that we can extend using a header) without the use of the mgmt
interface.

-- 
Luiz Augusto von Dentz



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux