Return-Path: Date: Mon, 19 Sep 2011 18:36:25 -0300 From: Gustavo Padovan To: Luiz Augusto von Dentz Cc: linux-bluetooth@vger.kernel.org Subject: Re: [RFC 1/5 v3] Bluetooth: set skbuffer priority based on L2CAP socket priority Message-ID: <20110919213625.GL2643@joana> References: <1315846853-27442-1-git-send-email-luiz.dentz@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <1315846853-27442-1-git-send-email-luiz.dentz@gmail.com> Sender: linux-bluetooth-owner@vger.kernel.org List-ID: Hi Luiz, * Luiz Augusto von Dentz [2011-09-12 20:00:49 +0300]: > From: Luiz Augusto von Dentz > > This uses SO_PRIORITY to set the skbuffer priority field > > Signed-off-by: Luiz Augusto von Dentz > --- > include/net/bluetooth/hci_core.h | 3 +++ > include/net/bluetooth/l2cap.h | 3 ++- > net/bluetooth/l2cap_core.c | 27 ++++++++++++++++++++------- > net/bluetooth/l2cap_sock.c | 2 +- > 4 files changed, 26 insertions(+), 9 deletions(-) > > diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h > index e2ba4d6..0742828 100644 > --- a/include/net/bluetooth/hci_core.h > +++ b/include/net/bluetooth/hci_core.h > @@ -32,6 +32,9 @@ > #define HCI_PROTO_L2CAP 0 > #define HCI_PROTO_SCO 1 > > +/* HCI priority */ > +#define HCI_PRIO_MAX 7 > + > /* HCI Core structures */ > struct inquiry_data { > bdaddr_t bdaddr; > diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h > index 4f34ad2..f018e5d 100644 > --- a/include/net/bluetooth/l2cap.h > +++ b/include/net/bluetooth/l2cap.h > @@ -511,7 +511,8 @@ struct l2cap_chan *l2cap_chan_create(struct sock *sk); > void l2cap_chan_close(struct l2cap_chan *chan, int reason); > void l2cap_chan_destroy(struct l2cap_chan *chan); > int l2cap_chan_connect(struct l2cap_chan *chan); > -int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len); > +int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len, > + u32 priority); > void l2cap_chan_busy(struct l2cap_chan *chan, int busy); > > #endif /* __L2CAP_H */ > diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c > index b3bdb48..0b6e1ae 100644 > --- a/net/bluetooth/l2cap_core.c > +++ b/net/bluetooth/l2cap_core.c > @@ -556,6 +556,7 @@ static void l2cap_send_cmd(struct l2cap_conn *conn, u8 ident, u8 code, u16 len, > flags = ACL_START; > > bt_cb(skb)->force_active = BT_POWER_FORCE_ACTIVE_ON; > + skb->priority = HCI_PRIO_MAX; As Mat pointed out we can't prioritize commands over data, this could to misbehaviours and loss of data. However, if the command is not related to any cid, like the information request/reponse we can put HCI_PRIO_MAX on it. Gustavo