Bluetooth: Add data structure for advertising instance
authorArman Uguray <armansito@chromium.org>
Mon, 23 Mar 2015 22:57:11 +0000 (15:57 -0700)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 24 Mar 2015 00:53:46 +0000 (01:53 +0100)
This patch introduces a new data structure to represent advertising
instances that were added using the "Add Advertising" mgmt command.
Initially an hci_dev structure will support only one of these instances
at a time, so the current instance is simply stored as a direct member
of hci_dev.

Signed-off-by: Arman Uguray <armansito@chromium.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
include/net/bluetooth/hci_core.h
net/bluetooth/hci_core.c

index b65c53de6a69d7c773957d75f43bb9d093d1c042..3a6d4e3d68fe60665e9144e204402206d9308370 100644 (file)
@@ -155,6 +155,15 @@ struct oob_data {
        u8 rand256[16];
 };
 
+struct adv_info {
+       __u8    instance;
+       __u32   flags;
+       __u16   adv_data_len;
+       __u8    adv_data[HCI_MAX_AD_LENGTH];
+       __u16   scan_rsp_len;
+       __u8    scan_rsp_data[HCI_MAX_AD_LENGTH];
+};
+
 #define HCI_MAX_SHORT_NAME_LENGTH      10
 
 /* Default LE RPA expiry time, 15 minutes */
@@ -364,6 +373,8 @@ struct hci_dev {
        __u8                    scan_rsp_data[HCI_MAX_AD_LENGTH];
        __u8                    scan_rsp_data_len;
 
+       struct adv_info         adv_instance;
+
        __u8                    irk[16];
        __u32                   rpa_timeout;
        struct delayed_work     rpa_expired;
@@ -550,6 +561,11 @@ static inline void hci_discovery_filter_clear(struct hci_dev *hdev)
        hdev->discovery.scan_duration = 0;
 }
 
+static inline void adv_info_init(struct hci_dev *hdev)
+{
+       memset(&hdev->adv_instance, 0, sizeof(struct adv_info));
+}
+
 bool hci_discovery_active(struct hci_dev *hdev);
 
 void hci_discovery_set_state(struct hci_dev *hdev, int state);
index 17f52a195ba8555c3d745c5ec8768118f0a0a899..e6bfeb7b4415c485d928c7675ea6765d41dabdf2 100644 (file)
@@ -3126,6 +3126,7 @@ struct hci_dev *hci_alloc_dev(void)
 
        hci_init_sysfs(hdev);
        discovery_init(hdev);
+       adv_info_init(hdev);
 
        return hdev;
 }