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@xxxxxxxxxxxxxxxx> wrote: > > > > From: Benjamin Berg <bberg@xxxxxxxxxx> > > > > Call the hci_tx_error handler in case a frame cannot be send. > > > > Signed-off-by: Benjamin Berg <bberg@xxxxxxxxxx> > > --- > > 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:
signature.asc
Description: This is a digitally signed message part