Commit 4e6e99e9 authored by Jaganath Kanakkassery's avatar Jaganath Kanakkassery Committed by Marcel Holtmann

Bluetooth: Use selected PHYs in extended connect

Use the selected PHYs by Set PHY Configuration management command
in extended create connection.
Signed-off-by: default avatarJaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent b2cc9761
...@@ -748,6 +748,26 @@ static bool conn_use_rpa(struct hci_conn *conn) ...@@ -748,6 +748,26 @@ static bool conn_use_rpa(struct hci_conn *conn)
return hci_dev_test_flag(hdev, HCI_PRIVACY); return hci_dev_test_flag(hdev, HCI_PRIVACY);
} }
static void set_ext_conn_params(struct hci_conn *conn,
struct hci_cp_le_ext_conn_param *p)
{
struct hci_dev *hdev = conn->hdev;
memset(p, 0, sizeof(*p));
/* Set window to be the same value as the interval to
* enable continuous scanning.
*/
p->scan_interval = cpu_to_le16(hdev->le_scan_interval);
p->scan_window = p->scan_interval;
p->conn_interval_min = cpu_to_le16(conn->le_conn_min_interval);
p->conn_interval_max = cpu_to_le16(conn->le_conn_max_interval);
p->conn_latency = cpu_to_le16(conn->le_conn_latency);
p->supervision_timeout = cpu_to_le16(conn->le_supv_timeout);
p->min_ce_len = cpu_to_le16(0x0000);
p->max_ce_len = cpu_to_le16(0x0000);
}
static void hci_req_add_le_create_conn(struct hci_request *req, static void hci_req_add_le_create_conn(struct hci_request *req,
struct hci_conn *conn, struct hci_conn *conn,
bdaddr_t *direct_rpa) bdaddr_t *direct_rpa)
...@@ -777,8 +797,8 @@ static void hci_req_add_le_create_conn(struct hci_request *req, ...@@ -777,8 +797,8 @@ static void hci_req_add_le_create_conn(struct hci_request *req,
if (use_ext_conn(hdev)) { if (use_ext_conn(hdev)) {
struct hci_cp_le_ext_create_conn *cp; struct hci_cp_le_ext_create_conn *cp;
struct hci_cp_le_ext_conn_param *p; struct hci_cp_le_ext_conn_param *p;
/* As of now only LE 1M is supported */ u8 data[sizeof(*cp) + sizeof(*p) * 3];
u8 data[sizeof(*cp) + sizeof(*p) * 1]; u32 plen;
cp = (void *) data; cp = (void *) data;
p = (void *) cp->data; p = (void *) cp->data;
...@@ -788,24 +808,33 @@ static void hci_req_add_le_create_conn(struct hci_request *req, ...@@ -788,24 +808,33 @@ static void hci_req_add_le_create_conn(struct hci_request *req,
bacpy(&cp->peer_addr, &conn->dst); bacpy(&cp->peer_addr, &conn->dst);
cp->peer_addr_type = conn->dst_type; cp->peer_addr_type = conn->dst_type;
cp->own_addr_type = own_addr_type; cp->own_addr_type = own_addr_type;
cp->phys = LE_SCAN_PHY_1M;
memset(p, 0, sizeof(*p)); plen = sizeof(*cp);
/* Set window to be the same value as the interval to enable if (scan_1m(hdev)) {
* continuous scanning. cp->phys |= LE_SCAN_PHY_1M;
*/ set_ext_conn_params(conn, p);
p++;
plen += sizeof(*p);
}
if (scan_2m(hdev)) {
cp->phys |= LE_SCAN_PHY_2M;
set_ext_conn_params(conn, p);
p->scan_interval = cpu_to_le16(hdev->le_scan_interval); p++;
p->scan_window = p->scan_interval; plen += sizeof(*p);
p->conn_interval_min = cpu_to_le16(conn->le_conn_min_interval); }
p->conn_interval_max = cpu_to_le16(conn->le_conn_max_interval);
p->conn_latency = cpu_to_le16(conn->le_conn_latency); if (scan_coded(hdev)) {
p->supervision_timeout = cpu_to_le16(conn->le_supv_timeout); cp->phys |= LE_SCAN_PHY_CODED;
p->min_ce_len = cpu_to_le16(0x0000); set_ext_conn_params(conn, p);
p->max_ce_len = cpu_to_le16(0x0000);
plen += sizeof(*p);
}
hci_req_add(req, HCI_OP_LE_EXT_CREATE_CONN, sizeof(data), data); hci_req_add(req, HCI_OP_LE_EXT_CREATE_CONN, plen, data);
} else { } else {
struct hci_cp_le_create_conn cp; struct hci_cp_le_create_conn cp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment