Lines Matching defs:instance

520 /* For a single instance:
521 * - force == true: The instance will be removed even when its remaining
523 * - force == false: the instance will be deactivated but kept stored unless
526 * For instance == 0x00:
532 u8 instance, bool force)
538 /* Cancel any timeout concerning the removed instance(s). */
539 if (!instance || hdev->cur_adv_instance == instance)
542 /* Get the next instance to advertise BEFORE we remove
543 * the current one. This can be the same instance again
544 * if there is only one instance.
546 if (instance && hdev->cur_adv_instance == instance)
547 next_instance = hci_get_next_instance(hdev, instance);
549 if (instance == 0x00) {
555 rem_inst = adv_instance->instance;
561 adv_instance = hci_find_adv_instance(hdev, instance);
565 /* Don't advertise a removed instance. */
567 next_instance->instance == instance)
570 err = hci_remove_adv_instance(hdev, instance);
572 mgmt_advertising_removed(sk, hdev, instance);
581 next_instance->instance,
589 u8 instance = *(u8 *)data;
593 hci_clear_adv_instance_sync(hdev, NULL, instance, false);
990 static int hci_disable_ext_adv_instance_sync(struct hci_dev *hdev, u8 instance)
997 /* If request specifies an instance that doesn't exist, fail */
998 if (instance > 0) {
1001 adv = hci_find_adv_instance(hdev, instance);
1016 cp->num_of_sets = !!instance;
1019 set->handle = instance;
1027 static int hci_set_adv_set_random_addr_sync(struct hci_dev *hdev, u8 instance,
1033 if (!instance) {
1046 cp.handle = instance;
1053 int hci_setup_ext_adv_instance_sync(struct hci_dev *hdev, u8 instance)
1064 if (instance > 0) {
1065 adv = hci_find_adv_instance(hdev, instance);
1072 /* Updating parameters of an active instance will return a
1074 * instance if it is active.
1077 err = hci_disable_ext_adv_instance_sync(hdev, instance);
1082 flags = hci_adv_instance_flags(hdev, instance);
1084 /* If the "connectable" instance flag was not set, then choose between
1122 } else if (hci_adv_instance_is_scannable(hdev, instance) ||
1148 cp.handle = instance;
1179 return hci_set_adv_set_random_addr_sync(hdev, instance,
1186 static int hci_set_ext_scan_rsp_data_sync(struct hci_dev *hdev, u8 instance)
1198 if (instance) {
1199 adv = hci_find_adv_instance(hdev, instance);
1204 len = eir_create_scan_rsp(hdev, instance, pdu.data);
1206 pdu.cp.handle = instance;
1227 static int __hci_set_scan_rsp_data_sync(struct hci_dev *hdev, u8 instance)
1234 len = eir_create_scan_rsp(hdev, instance, cp.data);
1249 int hci_update_scan_rsp_data_sync(struct hci_dev *hdev, u8 instance)
1255 return hci_set_ext_scan_rsp_data_sync(hdev, instance);
1257 return __hci_set_scan_rsp_data_sync(hdev, instance);
1260 int hci_enable_ext_advertising_sync(struct hci_dev *hdev, u8 instance)
1267 if (instance > 0) {
1268 adv = hci_find_adv_instance(hdev, instance);
1288 set->handle = instance;
1290 /* Set duration per instance since controller is responsible for
1306 int hci_start_ext_adv_sync(struct hci_dev *hdev, u8 instance)
1310 err = hci_setup_ext_adv_instance_sync(hdev, instance);
1314 err = hci_set_ext_scan_rsp_data_sync(hdev, instance);
1318 return hci_enable_ext_advertising_sync(hdev, instance);
1321 static int hci_disable_per_advertising_sync(struct hci_dev *hdev, u8 instance)
1327 adv = hci_find_adv_instance(hdev, instance);
1334 cp.handle = instance;
1340 static int hci_set_per_adv_params_sync(struct hci_dev *hdev, u8 instance,
1353 cp.handle = instance;
1362 static int hci_set_per_adv_data_sync(struct hci_dev *hdev, u8 instance)
1372 if (instance) {
1373 struct adv_info *adv = hci_find_adv_instance(hdev, instance);
1379 len = eir_create_per_adv_data(hdev, instance, pdu.data);
1382 pdu.cp.handle = instance;
1390 static int hci_enable_per_advertising_sync(struct hci_dev *hdev, u8 instance)
1396 adv = hci_find_adv_instance(hdev, instance);
1403 cp.handle = instance;
1417 /* Skip if NULL adv as instance 0x00 is used for general purpose
1442 hci_set_adv_instance_data(hdev, adv->instance, sizeof(ad), ad, 0, NULL);
1444 return hci_update_adv_data_sync(hdev, adv->instance);
1447 int hci_start_per_adv_sync(struct hci_dev *hdev, u8 instance, u8 data_len,
1455 hci_disable_per_advertising_sync(hdev, instance);
1457 if (instance) {
1458 adv = hci_find_adv_instance(hdev, instance);
1459 /* Create an instance if that could not be found */
1461 adv = hci_add_per_instance(hdev, instance, flags,
1473 err = hci_start_ext_adv_sync(hdev, instance);
1481 err = hci_set_per_adv_params_sync(hdev, instance, min_interval,
1486 err = hci_set_per_adv_data_sync(hdev, instance);
1490 err = hci_enable_per_advertising_sync(hdev, instance);
1498 hci_remove_adv_instance(hdev, instance);
1503 static int hci_start_adv_sync(struct hci_dev *hdev, u8 instance)
1508 return hci_start_ext_adv_sync(hdev, instance);
1510 err = hci_update_adv_data_sync(hdev, instance);
1514 err = hci_update_scan_rsp_data_sync(hdev, instance);
1538 /* If the "connectable" instance flag was not set, then choose between
1621 int hci_remove_ext_adv_instance_sync(struct hci_dev *hdev, u8 instance,
1629 err = hci_disable_ext_adv_instance_sync(hdev, instance);
1633 /* If request specifies an instance that doesn't exist, fail */
1634 if (instance > 0 && !hci_find_adv_instance(hdev, instance))
1638 sizeof(instance), &instance, 0,
1645 u8 instance = 0;
1648 instance = adv->instance;
1650 return hci_remove_ext_adv_instance_sync(hdev, instance, NULL);
1653 int hci_remove_ext_adv_instance(struct hci_dev *hdev, u8 instance)
1657 if (instance) {
1658 adv = hci_find_adv_instance(hdev, instance);
1678 static int hci_set_ext_adv_data_sync(struct hci_dev *hdev, u8 instance)
1690 if (instance) {
1691 adv = hci_find_adv_instance(hdev, instance);
1696 len = eir_create_adv_data(hdev, instance, pdu.data);
1699 pdu.cp.handle = instance;
1720 static int hci_set_adv_data_sync(struct hci_dev *hdev, u8 instance)
1727 len = eir_create_adv_data(hdev, instance, cp.data);
1743 int hci_update_adv_data_sync(struct hci_dev *hdev, u8 instance)
1749 return hci_set_ext_adv_data_sync(hdev, instance);
1751 return hci_set_adv_data_sync(hdev, instance);
1754 int hci_schedule_adv_instance_sync(struct hci_dev *hdev, u8 instance,
1766 adv = hci_find_adv_instance(hdev, instance);
1771 * only one instance, duration should be ignored. We still set a timeout
1774 * If the remaining lifetime of the instance is more than the duration
1776 * reduced to the remaining instance lifetime.
1783 /* The remaining time is being reduced unless the instance is being
1797 /* If we're just re-scheduling the same instance again then do not
1798 * execute any HCI commands. This happens when a single instance is
1801 if (!force && hdev->cur_adv_instance == instance &&
1805 hdev->cur_adv_instance = instance;
1807 return hci_start_adv_sync(hdev, instance);
1817 /* Disable instance 0x00 to disable all instances */
1844 u8 instance = adv->instance;
1850 err = hci_remove_adv_instance(hdev, instance);
1852 mgmt_advertising_removed(sk, hdev, instance);
1860 static int hci_remove_adv_sync(struct hci_dev *hdev, u8 instance,
1865 /* If we use extended advertising, instance has to be removed first. */
1867 err = hci_remove_ext_adv_instance_sync(hdev, instance, sk);
1876 err = hci_remove_adv_instance(hdev, instance);
1878 mgmt_advertising_removed(sk, hdev, instance);
1885 /* For a single instance:
1886 * - force == true: The instance will be removed even when its remaining
1888 * - force == false: the instance will be deactivated but kept stored unless
1891 * For instance == 0x00:
1897 u8 instance, bool force)
1902 /* Cancel any timeout concerning the removed instance(s). */
1903 if (!instance || hdev->cur_adv_instance == instance)
1906 /* Get the next instance to advertise BEFORE we remove
1907 * the current one. This can be the same instance again
1908 * if there is only one instance.
1910 if (hdev->cur_adv_instance == instance)
1911 next = hci_get_next_instance(hdev, instance);
1913 if (!instance) {
1918 struct adv_info *adv = hci_find_adv_instance(hdev, instance);
1921 /* Don't advertise a removed instance. */
1922 if (next && next->instance == instance)
1925 err = hci_remove_adv_sync(hdev, instance, sk);
1935 hci_schedule_adv_instance_sync(hdev, next->instance, false);
2403 /* Call for each tracked instance to be re-enabled */
2406 adv->instance);
2410 /* If the instance cannot be resumed remove it */
2411 hci_remove_ext_adv_instance_sync(hdev, adv->instance,
2415 /* Schedule for most recent instance to be restarted and begin
3065 /* Call for each tracked instance to be scheduled */
3067 hci_schedule_adv_instance_sync(hdev, adv->instance, true);
6115 cp.handle = 0x00; /* Use instance 0 for directed adv */
6126 * instance 0 for directed adv.
6580 u8 instance = PTR_UINT(data);
6582 return hci_update_adv_data_sync(hdev, instance);
6585 int hci_update_adv_data(struct hci_dev *hdev, u8 instance)
6588 UINT_PTR(instance), NULL);