Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4908074rwb; Tue, 6 Sep 2022 15:01:30 -0700 (PDT) X-Google-Smtp-Source: AA6agR7BN3rh2IQWvEiyMRlfkp5WhZjrclSWQRSipJa0rIjWaHnVrgw+s9ulfQwD8bHsvNK+1nHG X-Received: by 2002:a17:907:7e92:b0:741:5f7e:f1ac with SMTP id qb18-20020a1709077e9200b007415f7ef1acmr370705ejc.176.1662501690463; Tue, 06 Sep 2022 15:01:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662501690; cv=none; d=google.com; s=arc-20160816; b=g6lDPSKBTYK2yto5KlwsNHdIpVUF0jxP4ALKzs6uwpkyJcbL3/1WGWtNRPuubXrq9+ f31ZRNbXLxklJTZ80kEAXhEvK53ONQ0l/QV+ANFnqk8qB3hNuALOR+FRBQiROMF76zOZ O/5s7I9m73eaDe29aMbEOJyt6/+zNLWIfkuUOxavqpgw/Otl2nTyNEkdKvrofa6cgFqa 10ZMhYfXHWSfL75osTA8gOScRaSIJU/lagZThyjt1HX3SNStMKwai4r6KLsHsHDzpyzx 5/2bb0QI5aEnRZo1ZrpbUsefegmgcXPn0c0/J19GGIzVn7hDrpRAGYFTmjEA23TbuKhu +sUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from:dkim-signature; bh=b9MIfHEFtPY9WH2QYfb4K6O5Stgr/WQc36FsgB4nUYY=; b=pJ9QDZ+QnWQFBzGg4FqcStMGqvG7ifeS4qcRK3rck1wCsSWhBJGAcqTiO9ZrPL5/e7 clqRciF6N+sRNP7s7oVtxBYKobuzwpamaUW1jbm2krNE0GuR1QPkTS1LVorII7p08gmZ 6HkQl0plTdqpcV8mr+ZCLBVm7PScLvJ0k8N9rO7wAIeu22FmKgx3JgL+YIHnmnH5Mm30 X+OcaJILq6E0DHJbiIwilVXU5qXXsmd0rP8VYnljCZodtXWBw7Uguo4m/rC+TT4WOmPx gjAjP4VIVJpIm1RZmO/zkq9FVvQ3YDK/v3gePlf1UWoaeiFq/9iv1eERvCdo4BK8mlKA kRuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=S8KziIDi; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q11-20020a056402518b00b004483940b2b5si1238812edd.234.2022.09.06.15.00.48; Tue, 06 Sep 2022 15:01:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=S8KziIDi; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229793AbiIFVx6 (ORCPT + 99 others); Tue, 6 Sep 2022 17:53:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229771AbiIFVx5 (ORCPT ); Tue, 6 Sep 2022 17:53:57 -0400 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CFE8857CD for ; Tue, 6 Sep 2022 14:53:56 -0700 (PDT) Received: by mail-pj1-x102d.google.com with SMTP id z9-20020a17090a468900b001ffff693b27so11408441pjf.2 for ; Tue, 06 Sep 2022 14:53:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date; bh=b9MIfHEFtPY9WH2QYfb4K6O5Stgr/WQc36FsgB4nUYY=; b=S8KziIDi14HULOlKfK/rqik3n6iYEh3ZHG5RfKDKH7k1d9WZMG2qtH2qJA/vUkV4tb YIOjaHcCxsGLi7QKbF13kjddZzCcQIxX4dcf0bVjxXikD5N50+BIA0jSYYpdB2iLmiqa Yu5b2otS381gLAVRhN2lESD96eiCxhbAcao81FOqk9f01+8gH1Ld1wTg/dkTK1eyR85Q XquBZv9BlGkq9n6NsSLkXi8AXJIoFq47Ag4Ca5t9qcP+J0wsK7UsoH4KFIs2AC4RCLd7 JYLWoPHjygmxV+siKtPHajxkzsm+qTuqdVfUKaIe0VQqV/JC5qA9XpuQ4z4HNuUI6MX5 rlJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date; bh=b9MIfHEFtPY9WH2QYfb4K6O5Stgr/WQc36FsgB4nUYY=; b=X5m2M85xRwDBC0KKZ6+20lu4tLWWiZ84Lctu5w2yPUeXwDQcLFwFWyna5Q3UsJRKHt HmSCZsOBvyecGIb3mXrCKwzCP3+IDZBPQJN23ZLubRRHex5ncxiKFE2qmnA5lNoYOcwb +cGM+IGc9aIAkqDNJvcXX2NQNXlgUclOrTzvC5rnllp1ICwaYkmbLPnhLlJnsnd/9vki EsnBYNydk+/+p2gpLDI9PJVJSx1S//5MjjMurQMtIMbbn6wGN81ETPQfrPKrgJRUQq2h RO2DImvyIqz5mimq1LnwRJIUKG9E1IifY2BbRmLHDviGyfa+2pQW4R6c1OoOpdVjmDzi fqyQ== X-Gm-Message-State: ACgBeo1CUBgD7KhLTjpClcK0w/ywK2R7KNpZFCdn7vL1nz+hrJz+/qtQ IrgREqcLklUh/2G+NoyGpoyBrptMa0k= X-Received: by 2002:a17:903:2406:b0:172:a576:51c1 with SMTP id e6-20020a170903240600b00172a57651c1mr563000plo.106.1662501235107; Tue, 06 Sep 2022 14:53:55 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id t20-20020aa79474000000b00535da15a252sm10811333pfq.165.2022.09.06.14.53.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Sep 2022 14:53:54 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH] Bluetooth: Enable LE 2M PHY by default Date: Tue, 6 Sep 2022 14:53:53 -0700 Message-Id: <20220906215353.2820044-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This enables 2M PHY by default and in case the controller doesn't support HCI_OP_LE_SET_DEFAULT_PHY then default to just 1M PHY. Signed-off-by: Luiz Augusto von Dentz --- net/bluetooth/hci_core.c | 4 ++-- net/bluetooth/hci_sync.c | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 3803e54f23c0..d2d017621c08 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -2469,8 +2469,8 @@ struct hci_dev *hci_alloc_dev_priv(int sizeof_priv) hdev->le_max_rx_time = 0x0148; hdev->le_max_key_size = SMP_MAX_ENC_KEY_SIZE; hdev->le_min_key_size = SMP_MIN_ENC_KEY_SIZE; - hdev->le_tx_def_phys = HCI_LE_SET_PHY_1M; - hdev->le_rx_def_phys = HCI_LE_SET_PHY_1M; + hdev->le_tx_def_phys = HCI_LE_SET_PHY_1M | HCI_LE_SET_PHY_2M; + hdev->le_rx_def_phys = HCI_LE_SET_PHY_1M | HCI_LE_SET_PHY_2M; hdev->le_num_of_adv_sets = HCI_MAX_ADV_INSTANCES; hdev->def_multi_adv_rotation_duration = HCI_DEFAULT_ADV_DURATION; hdev->def_le_autoconnect_timeout = HCI_LE_AUTOCONN_TIMEOUT; diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c index 41b6d19c70b0..4eab893cb10e 100644 --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c @@ -4348,13 +4348,18 @@ static int hci_le_set_write_def_data_len_sync(struct hci_dev *hdev) sizeof(cp), &cp, HCI_CMD_TIMEOUT); } -/* Set Default PHY parameters if command is supported */ +/* Set Default PHY parameters if command is supported, if not supported default + * to 1M. + */ static int hci_le_set_default_phy_sync(struct hci_dev *hdev) { struct hci_cp_le_set_default_phy cp; - if (!(hdev->commands[35] & 0x20)) + if (!(hdev->commands[35] & 0x20)) { + hdev->le_tx_def_phys = HCI_LE_SET_PHY_1M; + hdev->le_rx_def_phys = HCI_LE_SET_PHY_1M; return 0; + } memset(&cp, 0, sizeof(cp)); cp.all_phys = 0x00; -- 2.37.2