Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1152730pxa; Thu, 13 Aug 2020 01:46:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIRLsnlF5OFZAMUgo+LwnhEJbtfOGxATovsVTeswirmwYZVVmhIj24ArTlWfxR/KJUU+/k X-Received: by 2002:a17:906:a413:: with SMTP id l19mr3788500ejz.15.1597308374736; Thu, 13 Aug 2020 01:46:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597308374; cv=none; d=google.com; s=arc-20160816; b=1FpSLpHrWu15PHtVvbzRjLy9DIgsZFdjA2LkI/VITVisq8Ut9P1PWp0/gCa0VvskfE rBXK53DidIXvWAQyfmt2kJSS3W+y3BSZQtVQGPd1GhpdfqwlTi8zpwW9ZzLhsVrkugLj jrOT8qaVFNY1d5kcBiyUf46VJ+5qEHfoVccOBp+c4/e/RsYSoiRg1ejOF04Frn6Ggtm4 MYujgk0/FU66ZE9aQYAPk888F5+JvYsc4zCW4GpEtLD+sGF78qDht6heqJHpIiJeqq6s 9yZPoN0tbNP15kUhwE32PMj80EMZIdy578bkX9aqTuiuifq0NcvPabN69XX74vTff2PY IOrA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+S61hbBUWnnIr1pACyWESONaaBAFPVTE7r0Hpph1Gy8=; b=gMKJU8pichiwCyOT6aDICHzUFozk/yxFM/c4SEH5tZBZDpfJ4UGCy6TskZ+DVZ7Frz /XHsQP77Es5hvJYWZqtHL0hZm4mFOctEL03I3zi4QM9CF21YeSSZItIA/pqG3Ic204um 8tFWMpkRMli2a5psEavx0VYd7vustuUX3nXzj9/wh0mtq9qHcyb5gkRqnBe+pLA4kMZq 4qYRFeAQQ/37nQ85gulWc3Gjwud6NRQOY6zW2PULf+d6cjIfB69SKhE7svnYLEvWQUhr soelUew+r0m+dv5IJ7PsGlbvkXxog7WmFf1ixTUAWSTYbzSfn4qCSXa4NawhNBaoS+4q JyWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=DjVFX12u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b25si2827067edy.296.2020.08.13.01.45.51; Thu, 13 Aug 2020 01:46:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=DjVFX12u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726635AbgHMImW (ORCPT + 99 others); Thu, 13 Aug 2020 04:42:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726192AbgHMImV (ORCPT ); Thu, 13 Aug 2020 04:42:21 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF580C061757 for ; Thu, 13 Aug 2020 01:42:20 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id v15so2469309pgh.6 for ; Thu, 13 Aug 2020 01:42:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+S61hbBUWnnIr1pACyWESONaaBAFPVTE7r0Hpph1Gy8=; b=DjVFX12upbN/1MoEtx0DJ4hrWuRWIvGCnoULuK4GMDwGU5lTCJphBanBCrloKdbF0B xwrai9Q1rPNKyUwaTAPvPsrLrBioD4hu6g3BKexmyMxpNATBLeP4sVA56ReqhznRbpo8 vhAO9Qp6Cp4G3x3DMSmlMt8HqMrkVO2JY5fzY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+S61hbBUWnnIr1pACyWESONaaBAFPVTE7r0Hpph1Gy8=; b=WwWXNy0KjYZbmUucLNDsVC2uDOLiD6GfwUyGQ1NjwlwmM3PBFeEUACPm5f6EmofVH9 MTiaDLgp/Uq10JEIdy31AsgDgoatouNqjZuwA4SdBEyurTbuHn7fepqVpugkcBtuPF8v I0Di5IRUbOJg9rRvO4vp2eYft0rlKDJnSBv0Abtv32MCNqBB5BwY1U/e25Onx8eLWp/g Vcsx8WObbqe2aVAIjUQMiwn2lAEJiF2GrfjZGQNDINJPdfe+3oFA3ERPEtfy9MOjZ64V rmlknsnjoaIlCwHyN1H7XJ8sVpyVL+MrkbUGC3ltXlhTvEhwOHp16uNcMyfpbUw22bBN d0mg== X-Gm-Message-State: AOAM533GFr+gejLvS2tSKEGTw2yfySw179IC3oKylu0vNeBS1DhvA1Rt D1rV3ig7yIx6WDh8+1JQ05sVe2M0384= X-Received: by 2002:a63:dc4a:: with SMTP id f10mr2646729pgj.394.1597308140322; Thu, 13 Aug 2020 01:42:20 -0700 (PDT) Received: from josephsih-z840.tpe.corp.google.com ([2401:fa00:1:10:de4a:3eff:fe7d:ff5f]) by smtp.gmail.com with ESMTPSA id y29sm5032035pfr.11.2020.08.13.01.42.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Aug 2020 01:42:19 -0700 (PDT) From: Joseph Hwang To: linux-bluetooth@vger.kernel.org, marcel@holtmann.org, luiz.dentz@gmail.com Cc: josephsih@google.com, chromeos-bluetooth-upstreaming@chromium.org, Joseph Hwang , Alain Michaud , Abhishek Pandit-Subedi , "David S. Miller" , Jakub Kicinski , Johan Hedberg , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v1 2/2] Bluetooth: sco: expose WBS packet length in socket option Date: Thu, 13 Aug 2020 16:41:29 +0800 Message-Id: <20200813164059.v1.2.I03247d3813c6dcbcdbeab26d068f9fd765edb1f5@changeid> X-Mailer: git-send-email 2.28.0.236.gb10cc79966-goog In-Reply-To: <20200813084129.332730-1-josephsih@chromium.org> References: <20200813084129.332730-1-josephsih@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It is desirable to expose the wideband speech packet length via a socket option to the user space so that the user space can set the value correctly in configuring the sco connection. Reviewed-by: Alain Michaud Reviewed-by: Abhishek Pandit-Subedi Signed-off-by: Joseph Hwang --- include/net/bluetooth/bluetooth.h | 2 ++ net/bluetooth/sco.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index 9125effbf4483d..922cc03143def4 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h @@ -153,6 +153,8 @@ struct bt_voice { #define BT_SCM_PKT_STATUS 0x03 +#define BT_SCO_PKT_LEN 17 + __printf(1, 2) void bt_info(const char *fmt, ...); __printf(1, 2) diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index dcf7f96ff417e6..97e4e7c7b8cf62 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c @@ -67,6 +67,7 @@ struct sco_pinfo { __u32 flags; __u16 setting; __u8 cmsg_mask; + __u32 pkt_len; struct sco_conn *conn; }; @@ -267,6 +268,8 @@ static int sco_connect(struct sock *sk) sco_sock_set_timer(sk, sk->sk_sndtimeo); } + sco_pi(sk)->pkt_len = hdev->sco_pkt_len; + done: hci_dev_unlock(hdev); hci_dev_put(hdev); @@ -1001,6 +1004,11 @@ static int sco_sock_getsockopt(struct socket *sock, int level, int optname, err = -EFAULT; break; + case BT_SCO_PKT_LEN: + if (put_user(sco_pi(sk)->pkt_len, (u32 __user *)optval)) + err = -EFAULT; + break; + default: err = -ENOPROTOOPT; break; -- 2.28.0.236.gb10cc79966-goog