Commit f4869e2a authored by Johan Hedberg's avatar Johan Hedberg Committed by Marcel Holtmann
Browse files

Bluetooth: Pass store hint to mgmt_new_conn_param



The calling functions of mgmt_new_conn_param have more information about
the parameters, such as whether the kernel is tracking them or not. It
makes therefore sense to have them pass an initial store_hint value to
the mgmt_new_conn_param function.

Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 7d6ca693
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -1335,8 +1335,8 @@ void mgmt_new_irk(struct hci_dev *hdev, struct smp_irk *irk);
void mgmt_new_csrk(struct hci_dev *hdev, struct smp_csrk *csrk,
void mgmt_new_csrk(struct hci_dev *hdev, struct smp_csrk *csrk,
		   bool persistent);
		   bool persistent);
void mgmt_new_conn_param(struct hci_dev *hdev, bdaddr_t *bdaddr,
void mgmt_new_conn_param(struct hci_dev *hdev, bdaddr_t *bdaddr,
			 u8 bdaddr_type, u16 min_interval, u16 max_interval,
			 u8 bdaddr_type, u8 store_hint, u16 min_interval,
			 u16 latency, u16 timeout);
			 u16 max_interval, u16 latency, u16 timeout);
void mgmt_reenable_advertising(struct hci_dev *hdev);
void mgmt_reenable_advertising(struct hci_dev *hdev);
void mgmt_smp_complete(struct hci_conn *conn, bool complete);
void mgmt_smp_complete(struct hci_conn *conn, bool complete);


+6 −2
Original line number Original line Diff line number Diff line
@@ -4431,6 +4431,7 @@ static void hci_le_remote_conn_param_req_evt(struct hci_dev *hdev,


	if (test_bit(HCI_CONN_MASTER, &hcon->flags)) {
	if (test_bit(HCI_CONN_MASTER, &hcon->flags)) {
		struct hci_conn_params *params;
		struct hci_conn_params *params;
		u8 store_hint;


		hci_dev_lock(hdev);
		hci_dev_lock(hdev);


@@ -4441,12 +4442,15 @@ static void hci_le_remote_conn_param_req_evt(struct hci_dev *hdev,
			params->conn_max_interval = max;
			params->conn_max_interval = max;
			params->conn_latency = latency;
			params->conn_latency = latency;
			params->supervision_timeout = timeout;
			params->supervision_timeout = timeout;
			store_hint = 0x01;
		} else{
			store_hint = 0x00;
		}
		}


		hci_dev_unlock(hdev);
		hci_dev_unlock(hdev);


		mgmt_new_conn_param(hdev, &hcon->dst, hcon->dst_type, min, max,
		mgmt_new_conn_param(hdev, &hcon->dst, hcon->dst_type,
				    latency, timeout);
				    store_hint, min, max, latency, timeout);
	}
	}


	cp.handle = ev->handle;
	cp.handle = ev->handle;
+6 −2
Original line number Original line Diff line number Diff line
@@ -5250,10 +5250,14 @@ static inline int l2cap_conn_param_update_req(struct l2cap_conn *conn,
		       sizeof(rsp), &rsp);
		       sizeof(rsp), &rsp);


	if (!err) {
	if (!err) {
		u8 store_hint;

		store_hint = hci_le_conn_update(hcon, min, max, latency,
						to_multiplier);
		mgmt_new_conn_param(hcon->hdev, &hcon->dst, hcon->dst_type,
		mgmt_new_conn_param(hcon->hdev, &hcon->dst, hcon->dst_type,
				    min, max, latency, to_multiplier);
				    store_hint, min, max, latency,
				    to_multiplier);


		hci_le_conn_update(hcon, min, max, latency, to_multiplier);
	}
	}


	return 0;
	return 0;
+3 −3
Original line number Original line Diff line number Diff line
@@ -5790,15 +5790,15 @@ void mgmt_new_csrk(struct hci_dev *hdev, struct smp_csrk *csrk,
}
}


void mgmt_new_conn_param(struct hci_dev *hdev, bdaddr_t *bdaddr,
void mgmt_new_conn_param(struct hci_dev *hdev, bdaddr_t *bdaddr,
			 u8 bdaddr_type, u16 min_interval, u16 max_interval,
			 u8 bdaddr_type, u8 store_hint, u16 min_interval,
			 u16 latency, u16 timeout)
			 u16 max_interval, u16 latency, u16 timeout)
{
{
	struct mgmt_ev_new_conn_param ev;
	struct mgmt_ev_new_conn_param ev;


	memset(&ev, 0, sizeof(ev));
	memset(&ev, 0, sizeof(ev));
	bacpy(&ev.addr.bdaddr, bdaddr);
	bacpy(&ev.addr.bdaddr, bdaddr);
	ev.addr.type = link_to_bdaddr(LE_LINK, bdaddr_type);
	ev.addr.type = link_to_bdaddr(LE_LINK, bdaddr_type);
	ev.store_hint = 0x00;
	ev.store_hint = store_hint;
	ev.min_interval = cpu_to_le16(min_interval);
	ev.min_interval = cpu_to_le16(min_interval);
	ev.max_interval = cpu_to_le16(max_interval);
	ev.max_interval = cpu_to_le16(max_interval);
	ev.latency = cpu_to_le16(latency);
	ev.latency = cpu_to_le16(latency);