Commit 5436538f authored by Gustavo F. Padovan's avatar Gustavo F. Padovan

Bluetooth: Remove l2cap priority from inside RFCOMM.

RFCOMM needs a proper priority mechanism inside itself and not try to use
l2cap priority to fix its own problem.
Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarGustavo F. Padovan <padovan@profusion.mobi>
parent c0190925
...@@ -65,8 +65,7 @@ static DEFINE_MUTEX(rfcomm_mutex); ...@@ -65,8 +65,7 @@ static DEFINE_MUTEX(rfcomm_mutex);
static LIST_HEAD(session_list); static LIST_HEAD(session_list);
static int rfcomm_send_frame(struct rfcomm_session *s, u8 *data, int len, static int rfcomm_send_frame(struct rfcomm_session *s, u8 *data, int len);
u32 priority);
static int rfcomm_send_sabm(struct rfcomm_session *s, u8 dlci); static int rfcomm_send_sabm(struct rfcomm_session *s, u8 dlci);
static int rfcomm_send_disc(struct rfcomm_session *s, u8 dlci); static int rfcomm_send_disc(struct rfcomm_session *s, u8 dlci);
static int rfcomm_queue_disc(struct rfcomm_dlc *d); static int rfcomm_queue_disc(struct rfcomm_dlc *d);
...@@ -748,32 +747,23 @@ void rfcomm_session_getaddr(struct rfcomm_session *s, bdaddr_t *src, bdaddr_t *d ...@@ -748,32 +747,23 @@ void rfcomm_session_getaddr(struct rfcomm_session *s, bdaddr_t *src, bdaddr_t *d
} }
/* ---- RFCOMM frame sending ---- */ /* ---- RFCOMM frame sending ---- */
static int rfcomm_send_frame(struct rfcomm_session *s, u8 *data, int len, static int rfcomm_send_frame(struct rfcomm_session *s, u8 *data, int len)
u32 priority)
{ {
struct socket *sock = s->sock;
struct sock *sk = sock->sk;
struct kvec iv = { data, len }; struct kvec iv = { data, len };
struct msghdr msg; struct msghdr msg;
BT_DBG("session %p len %d priority %u", s, len, priority); BT_DBG("session %p len %d", s, len);
if (sk->sk_priority != priority) {
lock_sock(sk);
sk->sk_priority = priority;
release_sock(sk);
}
memset(&msg, 0, sizeof(msg)); memset(&msg, 0, sizeof(msg));
return kernel_sendmsg(sock, &msg, &iv, 1, len); return kernel_sendmsg(s->sock, &msg, &iv, 1, len);
} }
static int rfcomm_send_cmd(struct rfcomm_session *s, struct rfcomm_cmd *cmd) static int rfcomm_send_cmd(struct rfcomm_session *s, struct rfcomm_cmd *cmd)
{ {
BT_DBG("%p cmd %u", s, cmd->ctrl); BT_DBG("%p cmd %u", s, cmd->ctrl);
return rfcomm_send_frame(s, (void *) cmd, sizeof(*cmd), HCI_PRIO_MAX); return rfcomm_send_frame(s, (void *) cmd, sizeof(*cmd));
} }
static int rfcomm_send_sabm(struct rfcomm_session *s, u8 dlci) static int rfcomm_send_sabm(struct rfcomm_session *s, u8 dlci)
...@@ -829,8 +819,6 @@ static int rfcomm_queue_disc(struct rfcomm_dlc *d) ...@@ -829,8 +819,6 @@ static int rfcomm_queue_disc(struct rfcomm_dlc *d)
if (!skb) if (!skb)
return -ENOMEM; return -ENOMEM;
skb->priority = HCI_PRIO_MAX;
cmd = (void *) __skb_put(skb, sizeof(*cmd)); cmd = (void *) __skb_put(skb, sizeof(*cmd));
cmd->addr = d->addr; cmd->addr = d->addr;
cmd->ctrl = __ctrl(RFCOMM_DISC, 1); cmd->ctrl = __ctrl(RFCOMM_DISC, 1);
...@@ -878,7 +866,7 @@ static int rfcomm_send_nsc(struct rfcomm_session *s, int cr, u8 type) ...@@ -878,7 +866,7 @@ static int rfcomm_send_nsc(struct rfcomm_session *s, int cr, u8 type)
*ptr = __fcs(buf); ptr++; *ptr = __fcs(buf); ptr++;
return rfcomm_send_frame(s, buf, ptr - buf, HCI_PRIO_MAX); return rfcomm_send_frame(s, buf, ptr - buf);
} }
static int rfcomm_send_pn(struct rfcomm_session *s, int cr, struct rfcomm_dlc *d) static int rfcomm_send_pn(struct rfcomm_session *s, int cr, struct rfcomm_dlc *d)
...@@ -920,7 +908,7 @@ static int rfcomm_send_pn(struct rfcomm_session *s, int cr, struct rfcomm_dlc *d ...@@ -920,7 +908,7 @@ static int rfcomm_send_pn(struct rfcomm_session *s, int cr, struct rfcomm_dlc *d
*ptr = __fcs(buf); ptr++; *ptr = __fcs(buf); ptr++;
return rfcomm_send_frame(s, buf, ptr - buf, HCI_PRIO_MAX); return rfcomm_send_frame(s, buf, ptr - buf);
} }
int rfcomm_send_rpn(struct rfcomm_session *s, int cr, u8 dlci, int rfcomm_send_rpn(struct rfcomm_session *s, int cr, u8 dlci,
...@@ -958,7 +946,7 @@ int rfcomm_send_rpn(struct rfcomm_session *s, int cr, u8 dlci, ...@@ -958,7 +946,7 @@ int rfcomm_send_rpn(struct rfcomm_session *s, int cr, u8 dlci,
*ptr = __fcs(buf); ptr++; *ptr = __fcs(buf); ptr++;
return rfcomm_send_frame(s, buf, ptr - buf, HCI_PRIO_MAX); return rfcomm_send_frame(s, buf, ptr - buf);
} }
static int rfcomm_send_rls(struct rfcomm_session *s, int cr, u8 dlci, u8 status) static int rfcomm_send_rls(struct rfcomm_session *s, int cr, u8 dlci, u8 status)
...@@ -985,7 +973,7 @@ static int rfcomm_send_rls(struct rfcomm_session *s, int cr, u8 dlci, u8 status) ...@@ -985,7 +973,7 @@ static int rfcomm_send_rls(struct rfcomm_session *s, int cr, u8 dlci, u8 status)
*ptr = __fcs(buf); ptr++; *ptr = __fcs(buf); ptr++;
return rfcomm_send_frame(s, buf, ptr - buf, HCI_PRIO_MAX); return rfcomm_send_frame(s, buf, ptr - buf);
} }
static int rfcomm_send_msc(struct rfcomm_session *s, int cr, u8 dlci, u8 v24_sig) static int rfcomm_send_msc(struct rfcomm_session *s, int cr, u8 dlci, u8 v24_sig)
...@@ -1012,7 +1000,7 @@ static int rfcomm_send_msc(struct rfcomm_session *s, int cr, u8 dlci, u8 v24_sig ...@@ -1012,7 +1000,7 @@ static int rfcomm_send_msc(struct rfcomm_session *s, int cr, u8 dlci, u8 v24_sig
*ptr = __fcs(buf); ptr++; *ptr = __fcs(buf); ptr++;
return rfcomm_send_frame(s, buf, ptr - buf, HCI_PRIO_MAX); return rfcomm_send_frame(s, buf, ptr - buf);
} }
static int rfcomm_send_fcoff(struct rfcomm_session *s, int cr) static int rfcomm_send_fcoff(struct rfcomm_session *s, int cr)
...@@ -1034,7 +1022,7 @@ static int rfcomm_send_fcoff(struct rfcomm_session *s, int cr) ...@@ -1034,7 +1022,7 @@ static int rfcomm_send_fcoff(struct rfcomm_session *s, int cr)
*ptr = __fcs(buf); ptr++; *ptr = __fcs(buf); ptr++;
return rfcomm_send_frame(s, buf, ptr - buf, HCI_PRIO_MAX); return rfcomm_send_frame(s, buf, ptr - buf);
} }
static int rfcomm_send_fcon(struct rfcomm_session *s, int cr) static int rfcomm_send_fcon(struct rfcomm_session *s, int cr)
...@@ -1056,7 +1044,7 @@ static int rfcomm_send_fcon(struct rfcomm_session *s, int cr) ...@@ -1056,7 +1044,7 @@ static int rfcomm_send_fcon(struct rfcomm_session *s, int cr)
*ptr = __fcs(buf); ptr++; *ptr = __fcs(buf); ptr++;
return rfcomm_send_frame(s, buf, ptr - buf, HCI_PRIO_MAX); return rfcomm_send_frame(s, buf, ptr - buf);
} }
static int rfcomm_send_test(struct rfcomm_session *s, int cr, u8 *pattern, int len) static int rfcomm_send_test(struct rfcomm_session *s, int cr, u8 *pattern, int len)
...@@ -1107,7 +1095,7 @@ static int rfcomm_send_credits(struct rfcomm_session *s, u8 addr, u8 credits) ...@@ -1107,7 +1095,7 @@ static int rfcomm_send_credits(struct rfcomm_session *s, u8 addr, u8 credits)
*ptr = __fcs(buf); ptr++; *ptr = __fcs(buf); ptr++;
return rfcomm_send_frame(s, buf, ptr - buf, HCI_PRIO_MAX); return rfcomm_send_frame(s, buf, ptr - buf);
} }
static void rfcomm_make_uih(struct sk_buff *skb, u8 addr) static void rfcomm_make_uih(struct sk_buff *skb, u8 addr)
...@@ -1786,8 +1774,10 @@ static inline int rfcomm_process_tx(struct rfcomm_dlc *d) ...@@ -1786,8 +1774,10 @@ static inline int rfcomm_process_tx(struct rfcomm_dlc *d)
return skb_queue_len(&d->tx_queue); return skb_queue_len(&d->tx_queue);
while (d->tx_credits && (skb = skb_dequeue(&d->tx_queue))) { while (d->tx_credits && (skb = skb_dequeue(&d->tx_queue))) {
err = rfcomm_send_frame(d->session, skb->data, skb->len, struct socket *sock = d->session->sock;
skb->priority); struct sock *sk = sock->sk;
err = rfcomm_send_frame(d->session, skb->data, skb->len);
if (err < 0) { if (err < 0) {
skb_queue_head(&d->tx_queue, skb); skb_queue_head(&d->tx_queue, skb);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment