Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1146577ybt; Tue, 7 Jul 2020 08:46:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPpaTYo0lT1Ue4SQLCFJRjABNhVJUzHmaQdKMRGl0lRrdkyFKztNZIJcq8kEzFwd49wmLp X-Received: by 2002:a17:906:950c:: with SMTP id u12mr47246443ejx.37.1594136809842; Tue, 07 Jul 2020 08:46:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594136809; cv=none; d=google.com; s=arc-20160816; b=NfksY+uH1C5f/AweRqwjreTAhkETsAymRnMc2zkVq3xZlkzEUXdJ0mgQM51yeaoGmf EGMc3dUQ2f49DGTkhRHrsoe1/j1hxejd9AaXjWjUtzgy6oYwLCwyxNRNjwPbeHZzA9Ok EfTSHOiysVJRgRKu1sdG31AA642kwIY5Zxc8vmeIcEe/g8+oZKQnrBq/jpKGbnZ2lgfk SNa/7Sy9WOLeR26lbU28GhhmR5Tcea3NjvViHgYfx4mh8Evhh9I6Tb6qU7NStsDx5ZKw alYSSHP5iqhDNNAauGFQV5BKktUll0r9s3q2ZSQEE/YfjQop6Njy6NtAR+fzJKuJRc5M mEvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:to:from; bh=xCuZG5/TnsUpivo+OG82d1r7pnVdhC1hlWB9y7Al3VY=; b=hGNni6M8NJyBf5DMu/8aHe2jGZcAGZ78dsip8F7erswotlzTce5p9U6NuHMWvNik/t +/WN5OZ1xbXrXHuAJOs8iJRHSZhoKiCdG2zfSB3HoZ5uqb6mAmsdOO+HUhzknpJ8MNLU jvLjnRVpmqlqUNpv/NmeStIcI26Aicia1tl5iKMYYP26NtNK4c36wr9JrzUgAPDc8UW2 lL6N2IcSg71L3zsxexTzuttOij31lIBG4rfg5ks7C6/fk4IhKG4OfdEljc9UtzoMP4mu h8rF03drtgpJ6qto5pgzZraa7sU/GuTEaj5Pphf5vcduG7QhtKiEGdd/1VW7+KKV3eMw yFPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i23si15648905edx.261.2020.07.07.08.46.24; Tue, 07 Jul 2020 08:46:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728330AbgGGPqN (ORCPT + 99 others); Tue, 7 Jul 2020 11:46:13 -0400 Received: from coyote.holtmann.net ([212.227.132.17]:43377 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727791AbgGGPqM (ORCPT ); Tue, 7 Jul 2020 11:46:12 -0400 Received: from localhost.localdomain (p5b3d2638.dip0.t-ipconnect.de [91.61.38.56]) by mail.holtmann.org (Postfix) with ESMTPSA id 20F71CECED for ; Tue, 7 Jul 2020 17:56:07 +0200 (CEST) From: Marcel Holtmann To: linux-bluetooth@vger.kernel.org Subject: [PATCH v5] Bluetooth: le_simult_central_peripheral experimental feature Date: Tue, 7 Jul 2020 17:46:06 +0200 Message-Id: <20200707154606.52947-1-marcel@holtmann.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Alain Michaud This patch adds an le_simult_central_peripheral features which allows a clients to determine if the controller is able to support peripheral and central connections separately and at the same time. Signed-off-by: Alain Michaud Signed-off-by: Marcel Holtmann --- net/bluetooth/mgmt.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 5e9b9728eeac..d29da80e38fe 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -3753,12 +3753,19 @@ static const u8 debug_uuid[16] = { }; #endif +/* 671b10b5-42c0-4696-9227-eb28d1b049d6 */ +static const u8 simult_central_periph_uuid[16] = { + 0xd6, 0x49, 0xb0, 0xd1, 0x28, 0xeb, 0x27, 0x92, + 0x96, 0x46, 0xc0, 0x42, 0xb5, 0x10, 0x1b, 0x67, +}; + static int read_exp_features_info(struct sock *sk, struct hci_dev *hdev, void *data, u16 data_len) { - char buf[42]; + char buf[44]; struct mgmt_rp_read_exp_features_info *rp = (void *)buf; u16 idx = 0; + u32 flags; bt_dev_dbg(hdev, "sock %p", sk); @@ -3766,7 +3773,7 @@ static int read_exp_features_info(struct sock *sk, struct hci_dev *hdev, #ifdef CONFIG_BT_FEATURE_DEBUG if (!hdev) { - u32 flags = bt_dbg_get() ? BIT(0) : 0; + flags = bt_dbg_get() ? BIT(0) : 0; memcpy(rp->features[idx].uuid, debug_uuid, 16); rp->features[idx].flags = cpu_to_le32(flags); @@ -3774,6 +3781,20 @@ static int read_exp_features_info(struct sock *sk, struct hci_dev *hdev, } #endif + if (hdev) { + if (test_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks) && + (hdev->le_states[4] & 0x08) && /* Central */ + (hdev->le_states[4] & 0x40) && /* Peripheral */ + (hdev->le_states[3] & 0x10)) /* Simultaneous */ + flags = BIT(0); + else + flags = 0; + + memcpy(rp->features[idx].uuid, simult_central_periph_uuid, 16); + rp->features[idx].flags = cpu_to_le32(flags); + idx++; + } + rp->feature_count = cpu_to_le16(idx); /* After reading the experimental features information, enable -- 2.26.2