Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp1722935rwp; Thu, 13 Jul 2023 15:49:56 -0700 (PDT) X-Google-Smtp-Source: APBJJlGBX9/DP+gbiJByo/RpTL2HP9PqOK6X3omMDnGUl5QlYoDTttLlBIFcI6IvxTZwIaFOIUN8 X-Received: by 2002:a17:906:b04:b0:992:d013:1135 with SMTP id u4-20020a1709060b0400b00992d0131135mr2497827ejg.63.1689288595871; Thu, 13 Jul 2023 15:49:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689288595; cv=none; d=google.com; s=arc-20160816; b=GVVM4rpA0bbA5MKpuLABjY7vxluMHMDtZTnFVLfCJFyzyyTNDbT3prOqvbvwSV6VRm 2YEJ11BtKmaTT0tm8pI3pDlDTznawvSEioTNj1xHAri8X8t0EFqoJDkfHB9P8P71iSYX XlQ8zo3f+xJ0LZXDiZVnlRjZfcbgMoU3RAhg47TutpkkvRMG2NL8AC2aoqswImyH9/30 swr5CJbYexYjlMrUwz134TVqEdaXFg7KroFzDik0nEHEpq5ku1eyOKu+v3rLSbykuCq8 17s5cjTvsGwBNGNGUcduqF6+n+rEVyVdB9NTaqg6HAmhhcBCsyzFnShaWe3UEaFspJ8B /FbA== 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 :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=hZ5jFUxC7kcuymhEZZgkHu+5eZSL9vO8wKjtLdEKEPM=; fh=V2LL5OuZUBGeSu6TXDWykcThOoazTGUpkln19rrO2KM=; b=W9d66KkruXF7yhhFh87vwsNkARAPLXhaRzp8bImuepb72iS+FQo9ssRdcKhryXwa8G Whhpe0snE406fqciJt2hxyQYunF+3xfP3iEZrmzmDIVMwHXA2hxe8PbyenxsFl9BCitx FYq+seeOqDdwd1Q8twXGUd/RiVMXibz36s/5e4apsGH6I+qfAxhuyhOp7ZmHwPBfXRU2 aH7nm+su4E6Q2HFXW0x5bZVE6wwHv+Qd8DHd4bXBnDULKey3Ocm9XDC8UTDMKpXgk5g3 +Py3CV3VJlsEg/ePER8M3ttZHMvTTzg3VQoHKav3kbUhB38nQ90gYNNpobVrVpv7MiSc Gubw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=U5EWXewu; 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 l9-20020a170906414900b00987fe46fa5asi7892589ejk.514.2023.07.13.15.49.20; Thu, 13 Jul 2023 15:49:55 -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=20221208 header.b=U5EWXewu; 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 S230151AbjGMWmu (ORCPT + 99 others); Thu, 13 Jul 2023 18:42:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231465AbjGMWmt (ORCPT ); Thu, 13 Jul 2023 18:42:49 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B0ED271C for ; Thu, 13 Jul 2023 15:42:48 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1b8b2886364so7523355ad.0 for ; Thu, 13 Jul 2023 15:42:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689288166; x=1691880166; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=hZ5jFUxC7kcuymhEZZgkHu+5eZSL9vO8wKjtLdEKEPM=; b=U5EWXewuguIcSupUCKBQHb0bYzhphY5otIEwCVAjQS3lushS11y0+jxX1W3xCOo1zN ryMxJy3Z43ZwjFEbOcR29kqkFibgTn80mGcLveA3M8QtbNdCPPvCkh9XJQTEetvhHeV5 5aCmOw5L/qb/G3BW79C24kM6nR1PP6XXENnCkpaiok49oMqS2NqB5gRwLPiAVbct52Z4 6dPJxzj3IFEqYjpMlI80RmhjE1jlSgJ5FXprIBH/OklxbSL6GgDIaHkuA52FEJwWLaFD t7hV199c+ZzzOcLYYzVS6G/srwRrhDBa5qzH8ifbapgwlS/t4Y53ELuMOZccIPqTd0Or z4vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689288166; x=1691880166; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hZ5jFUxC7kcuymhEZZgkHu+5eZSL9vO8wKjtLdEKEPM=; b=W3hiBMAr0tjNYIWWZ4XtSOB2bchRmUB01h0abOD1bnAVXvuxWwGMIc6GFx6xymOPiU ufvInV06/o+3Dy5yWVUd4n9kjWk0ad1PE2JFlP2S0zgqTmQU/fyH5KEJUkPP73xIn/We VcuYMmKCME6HIxlqVmw0w5HQjYkVK/0czYB6YCD+HnuqKs2+M1D6DakmupfPTFs02pvj yG6oA4JpWxPOvSThSB5PuJwgxII1ylGl32T/obxkFw6c0ht/3z+ZIJHvGkB1uaSEGsj6 TA9yTA+e8hNEtfD5dWON1g1bqttheIXVH5EjxQpyHFqIu/v/Am1oBNGWel1vBHaMAVgj MZHg== X-Gm-Message-State: ABy/qLaz5ItwOcj0BXHaScfJr7XOo300sGf5ALBzoHHZpn3jRwjhvdq3 NsZmlDbbGI6hirr1X+i5bQGcSE1yCPk= X-Received: by 2002:a17:902:aa83:b0:1b8:9002:c9ee with SMTP id d3-20020a170902aa8300b001b89002c9eemr2040150plr.1.1689288166352; Thu, 13 Jul 2023 15:42:46 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-236-201-58.hsd1.or.comcast.net. [71.236.201.58]) by smtp.gmail.com with ESMTPSA id bd5-20020a170902830500b001b8b4730355sm6373762plb.287.2023.07.13.15.42.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 15:42:44 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH 2/2] Bluetooth: ISO: Add support for BT_PKT_STATUS Date: Thu, 13 Jul 2023 15:42:39 -0700 Message-Id: <20230713224239.2286549-2-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230713224239.2286549-1-luiz.dentz@gmail.com> References: <20230713224239.2286549-1-luiz.dentz@gmail.com> 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 adds support for BT_PKT_STATUS socketopt by setting BT_SK_PKT_STATUS. Then upon receiving an ISO packet the code would attempt to store the Packet_Status_Flag to hci_skb_pkt_status which is then forward to userspace in the form of BT_SCM_PKT_STATUS whenever BT_PKT_STATUS has been enabled/set. Signed-off-by: Luiz Augusto von Dentz --- net/bluetooth/iso.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/net/bluetooth/iso.c b/net/bluetooth/iso.c index efac284badbc..cbe3299b4a41 100644 --- a/net/bluetooth/iso.c +++ b/net/bluetooth/iso.c @@ -1288,6 +1288,18 @@ static int iso_sock_setsockopt(struct socket *sock, int level, int optname, clear_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags); break; + case BT_PKT_STATUS: + if (copy_from_sockptr(&opt, optval, sizeof(u32))) { + err = -EFAULT; + break; + } + + if (opt) + set_bit(BT_SK_PKT_STATUS, &bt_sk(sk)->flags); + else + clear_bit(BT_SK_PKT_STATUS, &bt_sk(sk)->flags); + break; + case BT_ISO_QOS: if (sk->sk_state != BT_OPEN && sk->sk_state != BT_BOUND && sk->sk_state != BT_CONNECT2) { @@ -1373,6 +1385,12 @@ static int iso_sock_getsockopt(struct socket *sock, int level, int optname, break; + case BT_PKT_STATUS: + if (put_user(test_bit(BT_SK_PKT_STATUS, &bt_sk(sk)->flags), + (int __user *)optval)) + err = -EFAULT; + break; + case BT_ISO_QOS: qos = iso_sock_get_qos(sk); @@ -1767,6 +1785,7 @@ void iso_recv(struct hci_conn *hcon, struct sk_buff *skb, u16 flags) if (len == skb->len) { /* Complete frame received */ + hci_skb_pkt_status(skb) = flags & 0x03; iso_recv_frame(conn, skb); return; } @@ -1788,6 +1807,7 @@ void iso_recv(struct hci_conn *hcon, struct sk_buff *skb, u16 flags) if (!conn->rx_skb) goto drop; + hci_skb_pkt_status(conn->rx_skb) = flags & 0x03; skb_copy_from_linear_data(skb, skb_put(conn->rx_skb, skb->len), skb->len); conn->rx_len = len - skb->len; -- 2.40.1