diff mbox series

[RFC,BlueZ,v14,1/5] emulator: Add support to config the accept and resolve list

Message ID 20211022204825.397952-1-hj.tedd.an@gmail.com (mailing list archive)
State Superseded
Headers show
Series [RFC,BlueZ,v14,1/5] emulator: Add support to config the accept and resolve list | expand

Checks

Context Check Description
tedd_an/checkpatch success Checkpatch PASS
tedd_an/gitlint success Gitlint PASS
tedd_an/setupell success Setup ELL PASS
tedd_an/buildprep success Build Prep PASS
tedd_an/build success Build Configuration PASS
tedd_an/makecheck success Make Check PASS
tedd_an/makedistcheck success Make Distcheck PASS
tedd_an/build_extell success Build External ELL PASS
tedd_an/build_extell_make success Build Make with External ELL PASS

Commit Message

Tedd Ho-Jeong An Oct. 22, 2021, 8:48 p.m. UTC
From: Tedd Ho-Jeong An <tedd.an@intel.com>

This patch adds interfaces to config the accept list and resolve list in
the btdev.
---
 emulator/btdev.c  | 37 +++++++++++++++++++++++++++++--------
 emulator/btdev.h  |  4 ++++
 emulator/hciemu.c | 28 ++++++++++++++++++++++++++++
 emulator/hciemu.h |  4 ++++
 4 files changed, 65 insertions(+), 8 deletions(-)

Comments

bluez.test.bot@gmail.com Oct. 22, 2021, 9:34 p.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=568805

---Test result---

Test Summary:
CheckPatch                    FAIL      9.36 seconds
GitLint                       FAIL      4.99 seconds
Prep - Setup ELL              PASS      46.47 seconds
Build - Prep                  PASS      0.50 seconds
Build - Configure             PASS      8.67 seconds
Build - Make                  PASS      199.78 seconds
Make Check                    PASS      9.67 seconds
Make Distcheck                PASS      237.61 seconds
Build w/ext ELL - Configure   PASS      8.56 seconds
Build w/ext ELL - Make        PASS      191.12 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script with rule in .checkpatch.conf
Output:
[RFC,BlueZ,v14,5/5] tools/mgmt-tester: Add LL Privacy test cases
ERROR:SPACING: space prohibited before that ',' (ctx:WxW)
#756: FILE: tools/mgmt-tester.c:10115:
+					MGMT_OP_SET_EXP_FEATURE , 0 };
 					                        ^

WARNING:SPACE_BEFORE_TAB: please, no space before tabs
#1262: FILE: tools/mgmt-tester.c:10620:
+// ^Istruct test_data *data = tester_get_data();$

WARNING:SPACE_BEFORE_TAB: please, no space before tabs
#1263: FILE: tools/mgmt-tester.c:10621:
+// ^Iunsigned char param[] = { 0x01 };$

WARNING:SPACE_BEFORE_TAB: please, no space before tabs
#1264: FILE: tools/mgmt-tester.c:10622:
+// ^Iconst uint8_t *ext_feat_param;$

WARNING:SPACE_BEFORE_TAB: please, no space before tabs
#1265: FILE: tools/mgmt-tester.c:10623:
+// ^Isize_t ext_feat_len;$

WARNING:SPACE_BEFORE_TAB: please, no space before tabs
#1266: FILE: tools/mgmt-tester.c:10624:
+// ^Iunsigned char privacy_param[] = { 0x01,$

WARNING:SPACE_BEFORE_TAB: please, no space before tabs
#1267: FILE: tools/mgmt-tester.c:10625:
+// ^I^I^I0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,$

WARNING:SPACE_BEFORE_TAB: please, no space before tabs
#1268: FILE: tools/mgmt-tester.c:10626:
+// ^I^I^I0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 };$

WARNING:SPACE_BEFORE_TAB: please, no space before tabs
#1270: FILE: tools/mgmt-tester.c:10628:
+// ^Itester_print("Enabling LL Privacy feature");$

WARNING:SPACE_BEFORE_TAB: please, no space before tabs
#1272: FILE: tools/mgmt-tester.c:10630:
+// ^Iext_feat_param = set_exp_feat_param_ll_privacy;$

WARNING:SPACE_BEFORE_TAB: please, no space before tabs
#1273: FILE: tools/mgmt-tester.c:10631:
+// ^Iext_feat_len = sizeof(set_exp_feat_param_ll_privacy);$

WARNING:SPACE_BEFORE_TAB: please, no space before tabs
#1275: FILE: tools/mgmt-tester.c:10633:
+// ^Imgmt_send(data->mgmt, MGMT_OP_SET_LE, data->mgmt_index,$

WARNING:SPACE_BEFORE_TAB: please, no space before tabs
#1276: FILE: tools/mgmt-tester.c:10634:
+// ^I^I^I^I^Isizeof(param), &param,$

WARNING:SPACE_BEFORE_TAB: please, no space before tabs
#1277: FILE: tools/mgmt-tester.c:10635:
+// ^I^I^I^I^INULL, NULL, NULL);$

WARNING:SPACE_BEFORE_TAB: please, no space before tabs
#1279: FILE: tools/mgmt-tester.c:10637:
+// ^Imgmt_send(data->mgmt, MGMT_OP_SET_PRIVACY, data->mgmt_index,$

WARNING:SPACE_BEFORE_TAB: please, no space before tabs
#1280: FILE: tools/mgmt-tester.c:10638:
+// ^I^I^I^I^Isizeof(privacy_param), privacy_param,$

WARNING:SPACE_BEFORE_TAB: please, no space before tabs
#1281: FILE: tools/mgmt-tester.c:10639:
+// ^I^I^I^I^INULL, NULL, NULL);$

WARNING:SPACE_BEFORE_TAB: please, no space before tabs
#1283: FILE: tools/mgmt-tester.c:10641:
+// ^Imgmt_send(data->mgmt, MGMT_OP_SET_EXP_FEATURE, data->mgmt_index,$

WARNING:SPACE_BEFORE_TAB: please, no space before tabs
#1284: FILE: tools/mgmt-tester.c:10642:
+// ^I^I^I^I^Iext_feat_len, ext_feat_param,$

WARNING:SPACE_BEFORE_TAB: please, no space before tabs
#1285: FILE: tools/mgmt-tester.c:10643:
+// ^I^I^I^I^Isetup_exp_feat_callback, NULL, NULL);$

/github/workspace/src/12579045.patch total: 1 errors, 19 warnings, 2340 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/12579045.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.


##############################
Test: GitLint - FAIL
Desc: Run gitlint with rule in .gitlint
Output:
[RFC,BlueZ,v14,4/5] tools/mgmt-tester: Add support for experimental feature in setup
1: T1 Title exceeds max length (84>80): "[RFC,BlueZ,v14,4/5] tools/mgmt-tester: Add support for experimental feature in setup"




---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/emulator/btdev.c b/emulator/btdev.c
index 03003d949..1ae71765d 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -198,6 +198,10 @@  struct btdev {
 	} __attribute__ ((packed)) le_cig;
 	uint8_t  le_iso_path[2];
 
+	/* Real time length of AL array */
+	uint8_t le_al_len;
+	/* Real time length of RL array */
+	uint8_t le_rl_len;
 	struct btdev_al le_al[AL_SIZE];
 	struct btdev_rl le_rl[RL_SIZE];
 	uint8_t  le_rl_enable;
@@ -482,6 +486,18 @@  static void rl_clear(struct btdev *dev)
 		rl_reset(&dev->le_rl[i]);
 }
 
+/* Set the real time length of AL array */
+void btdev_set_al_len(struct btdev *btdev, uint8_t len)
+{
+	btdev->le_al_len = len;
+}
+
+/* Set the real time length of RL array */
+void btdev_set_rl_len(struct btdev *btdev, uint8_t len)
+{
+	btdev->le_rl_len = len;
+}
+
 static void btdev_reset(struct btdev *btdev)
 {
 	/* FIXME: include here clearing of all states that should be
@@ -493,6 +509,9 @@  static void btdev_reset(struct btdev *btdev)
 
 	al_clear(btdev);
 	rl_clear(btdev);
+
+	btdev->le_al_len = AL_SIZE;
+	btdev->le_rl_len = RL_SIZE;
 }
 
 static int cmd_reset(struct btdev *dev, const void *data, uint8_t len)
@@ -3578,7 +3597,7 @@  static int cmd_read_al_size(struct btdev *dev, const void *data, uint8_t len)
 	struct bt_hci_rsp_le_read_accept_list_size rsp;
 
 	rsp.status = BT_HCI_ERR_SUCCESS;
-	rsp.size = AL_SIZE;
+	rsp.size = dev->le_al_len;
 	cmd_complete(dev, BT_HCI_CMD_LE_READ_ACCEPT_LIST_SIZE, &rsp,
 						sizeof(rsp));
 
@@ -3665,7 +3684,7 @@  static int cmd_add_al(struct btdev *dev, const void *data, uint8_t len)
 	if (cmd->addr_type > 0x01)
 		return -EINVAL;
 
-	for (i = 0; i < AL_SIZE; i++) {
+	for (i = 0; i < dev->le_al_len; i++) {
 		struct btdev_al *al = &dev->le_al[i];
 
 		if (AL_ADDR_EQUAL(al, cmd->addr_type, &cmd->addr)) {
@@ -3716,7 +3735,7 @@  static int cmd_remove_al(struct btdev *dev, const void *data, uint8_t len)
 	if (cmd->addr_type > 0x01)
 		return -EINVAL;
 
-	for (i = 0; i < AL_SIZE; i++) {
+	for (i = 0; i < dev->le_al_len; i++) {
 		struct btdev_al *al = &dev->le_al[i];
 
 		ba2str(&al->addr, addr);
@@ -3731,7 +3750,7 @@  static int cmd_remove_al(struct btdev *dev, const void *data, uint8_t len)
 		}
 	}
 
-	if (i == AL_SIZE)
+	if (i == dev->le_al_len)
 		return -EINVAL;
 
 	status = BT_HCI_ERR_SUCCESS;
@@ -3762,7 +3781,7 @@  static int cmd_add_rl(struct btdev *dev, const void *data, uint8_t len)
 	if (cmd->addr_type > 0x01)
 		return -EINVAL;
 
-	for (i = 0; i < RL_SIZE; i++) {
+	for (i = 0; i < dev->le_rl_len; i++) {
 		struct btdev_rl *rl = &dev->le_rl[i];
 
 		if (RL_ADDR_EQUAL(rl, cmd->addr_type, &cmd->addr)) {
@@ -3813,7 +3832,7 @@  static int cmd_remove_rl(struct btdev *dev, const void *data, uint8_t len)
 	if (cmd->addr_type > 0x01)
 		return -EINVAL;
 
-	for (i = 0; i < RL_SIZE; i++) {
+	for (i = 0; i < dev->le_rl_len; i++) {
 		struct btdev_rl *rl = &dev->le_rl[i];
 
 		if (RL_ADDR_EQUAL(rl, cmd->addr_type, &cmd->addr)) {
@@ -3822,7 +3841,7 @@  static int cmd_remove_rl(struct btdev *dev, const void *data, uint8_t len)
 		}
 	}
 
-	if (i == RL_SIZE)
+	if (i == dev->le_rl_len)
 		return -EINVAL;
 
 	status = BT_HCI_ERR_SUCCESS;
@@ -3860,7 +3879,7 @@  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;
+	rsp.size = dev->le_rl_len;
 
 	cmd_complete(dev, BT_HCI_CMD_LE_READ_RESOLV_LIST_SIZE,
 							&rsp, sizeof(rsp));
@@ -6310,6 +6329,8 @@  struct btdev *btdev_create(enum btdev_type type, uint16_t id)
 	btdev->conns = queue_new();
 	btdev->le_ext_adv = queue_new();
 
+	btdev->le_al_len = AL_SIZE;
+	btdev->le_rl_len = RL_SIZE;
 	return btdev;
 }
 
diff --git a/emulator/btdev.h b/emulator/btdev.h
index 412bfd158..b5f9979a8 100644
--- a/emulator/btdev.h
+++ b/emulator/btdev.h
@@ -80,6 +80,10 @@  uint8_t btdev_get_le_scan_enable(struct btdev *btdev);
 
 void btdev_set_le_states(struct btdev *btdev, const uint8_t *le_states);
 
+void btdev_set_al_len(struct btdev *btdev, uint8_t len);
+
+void btdev_set_rl_len(struct btdev *btdev, uint8_t len);
+
 void btdev_set_command_handler(struct btdev *btdev, btdev_command_func handler,
 							void *user_data);
 
diff --git a/emulator/hciemu.c b/emulator/hciemu.c
index 4752c8a4d..1f7af3b93 100644
--- a/emulator/hciemu.c
+++ b/emulator/hciemu.c
@@ -601,6 +601,34 @@  void hciemu_set_central_le_states(struct hciemu *hciemu,
 	btdev_set_le_states(dev, le_states);
 }
 
+void hciemu_set_central_le_al_len(struct hciemu *hciemu, uint8_t len)
+{
+	struct btdev *dev;
+
+	if (!hciemu || !hciemu->vhci)
+		return;
+
+	dev = vhci_get_btdev(hciemu->vhci);
+	if (!dev)
+		return;
+
+	btdev_set_al_len(dev, len);
+}
+
+void hciemu_set_central_le_rl_len(struct hciemu *hciemu, uint8_t len)
+{
+	struct btdev *dev;
+
+	if (!hciemu || !hciemu->vhci)
+		return;
+
+	dev = vhci_get_btdev(hciemu->vhci);
+	if (!dev)
+		return;
+
+	btdev_set_rl_len(dev, len);
+}
+
 bool hciemu_add_central_post_command_hook(struct hciemu *hciemu,
 			hciemu_command_func_t function, void *user_data)
 {
diff --git a/emulator/hciemu.h b/emulator/hciemu.h
index 338fa844d..2a49d8bad 100644
--- a/emulator/hciemu.h
+++ b/emulator/hciemu.h
@@ -61,6 +61,10 @@  uint8_t hciemu_get_central_le_scan_enable(struct hciemu *hciemu);
 void hciemu_set_central_le_states(struct hciemu *hciemu,
 						const uint8_t *le_states);
 
+void hciemu_set_central_le_al_len(struct hciemu *hciemu, uint8_t len);
+
+void hciemu_set_central_le_rl_len(struct hciemu *hciemu, uint8_t len);
+
 typedef void (*hciemu_command_func_t)(uint16_t opcode, const void *data,
 						uint8_t len, void *user_data);