public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Berg <benjamin@sipsolutions.net>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: "linux-bluetooth@vger.kernel.org" <linux-bluetooth@vger.kernel.org>
Subject: Re: [PATCH 3/4] Bluetooth: hci_core: Signal TX failure if sending a frame failed
Date: Wed, 10 Nov 2021 09:46:34 +0100	[thread overview]
Message-ID: <cecf89520de89bfba231c80c5ddb6b357722d6de.camel@sipsolutions.net> (raw)
In-Reply-To: <CABBYNZJ2mXOTQygWWgHMN+pkqYoY_cudqrbW6aOHozo7soUZhA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1657 bytes --]

Hi Luiz,

On Tue, 2021-11-09 at 15:13 -0800, Luiz Augusto von Dentz wrote:
> Hi Benjamin,
> 
> On Tue, Nov 9, 2021 at 2:35 PM Benjamin Berg <benjamin@sipsolutions.net> wrote:
> > 
> > From: Benjamin Berg <bberg@redhat.com>
> > 
> > Call the hci_tx_error handler in case a frame cannot be send.
> > 
> > Signed-off-by: Benjamin Berg <bberg@redhat.com>
> > ---
> >  net/bluetooth/hci_core.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> > index bbb35188e41f..8664c2fbacdb 100644
> > --- a/net/bluetooth/hci_core.c
> > +++ b/net/bluetooth/hci_core.c
> > @@ -4200,6 +4200,8 @@ static void hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
> >         if (err < 0) {
> >                 bt_dev_err(hdev, "sending frame failed (%d)", err);
> >                 kfree_skb(skb);
> > +
> > +               hci_tx_error(hdev, -err);
> 
> Either we do this here by calling directly hci_cmd_sync_cancel like I
> suggested previously or perhaps we should have the error returned by
> hci_send_frame otherwise the current thread still has to wait to get
> the error from req_result which perhaps is not necessary if we already
> got a proper error here just return it so the thread doesn't even need
> to sleep.

Yes, returning the error is a good idea.

I think that means doing the cancellation from hci_cmd_work. As I
understand it, the frame is sent from the main workqueue so we are not
avoiding the context switches for now. But that may well change in the
future.

Benjamin

> >         }
> >  }
> > 
> > --
> > 2.31.1
> > 
> 
> 


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2021-11-10  8:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-09 16:41 [PATCH 0/4] Cancel sync commands if a TX failure occurs Benjamin Berg
2021-11-09 16:41 ` [PATCH 1/4] Bluetooth: Reset more state when cancelling a sync command Benjamin Berg
2021-12-02 23:52   ` Luiz Augusto von Dentz
2021-11-09 16:41 ` [PATCH 2/4] Bluetooth: Add new hci_tx_error function Benjamin Berg
2021-11-09 23:06   ` Luiz Augusto von Dentz
2021-11-09 16:41 ` [PATCH 3/4] Bluetooth: hci_core: Signal TX failure if sending a frame failed Benjamin Berg
2021-11-09 23:13   ` Luiz Augusto von Dentz
2021-11-10  8:46     ` Benjamin Berg [this message]
2021-11-09 16:41 ` [PATCH 4/4] Bluetooth: btusb: Signal URB errors as TX failure Benjamin Berg
2021-11-09 23:25   ` Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cecf89520de89bfba231c80c5ddb6b357722d6de.camel@sipsolutions.net \
    --to=benjamin@sipsolutions.net \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox