diff options
author | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-12-20 13:30:44 -0500 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-12-22 11:45:10 -0500 |
commit | 5436538fb5f2a12e5328dcaa2e3a1742be25c2e0 (patch) | |
tree | ebf9a7c7d5f0e626de55e0679350a4b1200945c5 /net/bluetooth/rfcomm | |
parent | c0190925dacd976a67044f4382d4effbed568dce (diff) |
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: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/rfcomm')
-rw-r--r-- | net/bluetooth/rfcomm/core.c | 44 |
1 files changed, 17 insertions, 27 deletions
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c index be6288cf854a..1524418f39e3 100644 --- a/net/bluetooth/rfcomm/core.c +++ b/net/bluetooth/rfcomm/core.c | |||
@@ -65,8 +65,7 @@ static DEFINE_MUTEX(rfcomm_mutex); | |||
65 | 65 | ||
66 | static LIST_HEAD(session_list); | 66 | static LIST_HEAD(session_list); |
67 | 67 | ||
68 | static int rfcomm_send_frame(struct rfcomm_session *s, u8 *data, int len, | 68 | static int rfcomm_send_frame(struct rfcomm_session *s, u8 *data, int len); |
69 | u32 priority); | ||
70 | static int rfcomm_send_sabm(struct rfcomm_session *s, u8 dlci); | 69 | static int rfcomm_send_sabm(struct rfcomm_session *s, u8 dlci); |
71 | static int rfcomm_send_disc(struct rfcomm_session *s, u8 dlci); | 70 | static int rfcomm_send_disc(struct rfcomm_session *s, u8 dlci); |
72 | static int rfcomm_queue_disc(struct rfcomm_dlc *d); | 71 | 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 | } | 747 | } |
749 | 748 | ||
750 | /* ---- RFCOMM frame sending ---- */ | 749 | /* ---- RFCOMM frame sending ---- */ |
751 | static int rfcomm_send_frame(struct rfcomm_session *s, u8 *data, int len, | 750 | static int rfcomm_send_frame(struct rfcomm_session *s, u8 *data, int len) |
752 | u32 priority) | ||
753 | { | 751 | { |
754 | struct socket *sock = s->sock; | ||
755 | struct sock *sk = sock->sk; | ||
756 | struct kvec iv = { data, len }; | 752 | struct kvec iv = { data, len }; |
757 | struct msghdr msg; | 753 | struct msghdr msg; |
758 | 754 | ||
759 | BT_DBG("session %p len %d priority %u", s, len, priority); | 755 | BT_DBG("session %p len %d", s, len); |
760 | |||
761 | if (sk->sk_priority != priority) { | ||
762 | lock_sock(sk); | ||
763 | sk->sk_priority = priority; | ||
764 | release_sock(sk); | ||
765 | } | ||
766 | 756 | ||
767 | memset(&msg, 0, sizeof(msg)); | 757 | memset(&msg, 0, sizeof(msg)); |
768 | 758 | ||
769 | return kernel_sendmsg(sock, &msg, &iv, 1, len); | 759 | return kernel_sendmsg(s->sock, &msg, &iv, 1, len); |
770 | } | 760 | } |
771 | 761 | ||
772 | static int rfcomm_send_cmd(struct rfcomm_session *s, struct rfcomm_cmd *cmd) | 762 | static int rfcomm_send_cmd(struct rfcomm_session *s, struct rfcomm_cmd *cmd) |
773 | { | 763 | { |
774 | BT_DBG("%p cmd %u", s, cmd->ctrl); | 764 | BT_DBG("%p cmd %u", s, cmd->ctrl); |
775 | 765 | ||
776 | return rfcomm_send_frame(s, (void *) cmd, sizeof(*cmd), HCI_PRIO_MAX); | 766 | return rfcomm_send_frame(s, (void *) cmd, sizeof(*cmd)); |
777 | } | 767 | } |
778 | 768 | ||
779 | static int rfcomm_send_sabm(struct rfcomm_session *s, u8 dlci) | 769 | 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 | if (!skb) | 819 | if (!skb) |
830 | return -ENOMEM; | 820 | return -ENOMEM; |
831 | 821 | ||
832 | skb->priority = HCI_PRIO_MAX; | ||
833 | |||
834 | cmd = (void *) __skb_put(skb, sizeof(*cmd)); | 822 | cmd = (void *) __skb_put(skb, sizeof(*cmd)); |
835 | cmd->addr = d->addr; | 823 | cmd->addr = d->addr; |
836 | cmd->ctrl = __ctrl(RFCOMM_DISC, 1); | 824 | cmd->ctrl = __ctrl(RFCOMM_DISC, 1); |
@@ -878,7 +866,7 @@ static int rfcomm_send_nsc(struct rfcomm_session *s, int cr, u8 type) | |||
878 | 866 | ||
879 | *ptr = __fcs(buf); ptr++; | 867 | *ptr = __fcs(buf); ptr++; |
880 | 868 | ||
881 | return rfcomm_send_frame(s, buf, ptr - buf, HCI_PRIO_MAX); | 869 | return rfcomm_send_frame(s, buf, ptr - buf); |
882 | } | 870 | } |
883 | 871 | ||
884 | static int rfcomm_send_pn(struct rfcomm_session *s, int cr, struct rfcomm_dlc *d) | 872 | 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 | 908 | ||
921 | *ptr = __fcs(buf); ptr++; | 909 | *ptr = __fcs(buf); ptr++; |
922 | 910 | ||
923 | return rfcomm_send_frame(s, buf, ptr - buf, HCI_PRIO_MAX); | 911 | return rfcomm_send_frame(s, buf, ptr - buf); |
924 | } | 912 | } |
925 | 913 | ||
926 | int rfcomm_send_rpn(struct rfcomm_session *s, int cr, u8 dlci, | 914 | 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 | 946 | ||
959 | *ptr = __fcs(buf); ptr++; | 947 | *ptr = __fcs(buf); ptr++; |
960 | 948 | ||
961 | return rfcomm_send_frame(s, buf, ptr - buf, HCI_PRIO_MAX); | 949 | return rfcomm_send_frame(s, buf, ptr - buf); |
962 | } | 950 | } |
963 | 951 | ||
964 | static int rfcomm_send_rls(struct rfcomm_session *s, int cr, u8 dlci, u8 status) | 952 | 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 | 973 | ||
986 | *ptr = __fcs(buf); ptr++; | 974 | *ptr = __fcs(buf); ptr++; |
987 | 975 | ||
988 | return rfcomm_send_frame(s, buf, ptr - buf, HCI_PRIO_MAX); | 976 | return rfcomm_send_frame(s, buf, ptr - buf); |
989 | } | 977 | } |
990 | 978 | ||
991 | static int rfcomm_send_msc(struct rfcomm_session *s, int cr, u8 dlci, u8 v24_sig) | 979 | 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 | 1000 | ||
1013 | *ptr = __fcs(buf); ptr++; | 1001 | *ptr = __fcs(buf); ptr++; |
1014 | 1002 | ||
1015 | return rfcomm_send_frame(s, buf, ptr - buf, HCI_PRIO_MAX); | 1003 | return rfcomm_send_frame(s, buf, ptr - buf); |
1016 | } | 1004 | } |
1017 | 1005 | ||
1018 | static int rfcomm_send_fcoff(struct rfcomm_session *s, int cr) | 1006 | 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 | 1022 | ||
1035 | *ptr = __fcs(buf); ptr++; | 1023 | *ptr = __fcs(buf); ptr++; |
1036 | 1024 | ||
1037 | return rfcomm_send_frame(s, buf, ptr - buf, HCI_PRIO_MAX); | 1025 | return rfcomm_send_frame(s, buf, ptr - buf); |
1038 | } | 1026 | } |
1039 | 1027 | ||
1040 | static int rfcomm_send_fcon(struct rfcomm_session *s, int cr) | 1028 | 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 | 1044 | ||
1057 | *ptr = __fcs(buf); ptr++; | 1045 | *ptr = __fcs(buf); ptr++; |
1058 | 1046 | ||
1059 | return rfcomm_send_frame(s, buf, ptr - buf, HCI_PRIO_MAX); | 1047 | return rfcomm_send_frame(s, buf, ptr - buf); |
1060 | } | 1048 | } |
1061 | 1049 | ||
1062 | static int rfcomm_send_test(struct rfcomm_session *s, int cr, u8 *pattern, int len) | 1050 | 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 | 1095 | ||
1108 | *ptr = __fcs(buf); ptr++; | 1096 | *ptr = __fcs(buf); ptr++; |
1109 | 1097 | ||
1110 | return rfcomm_send_frame(s, buf, ptr - buf, HCI_PRIO_MAX); | 1098 | return rfcomm_send_frame(s, buf, ptr - buf); |
1111 | } | 1099 | } |
1112 | 1100 | ||
1113 | static void rfcomm_make_uih(struct sk_buff *skb, u8 addr) | 1101 | 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 | return skb_queue_len(&d->tx_queue); | 1774 | return skb_queue_len(&d->tx_queue); |
1787 | 1775 | ||
1788 | while (d->tx_credits && (skb = skb_dequeue(&d->tx_queue))) { | 1776 | while (d->tx_credits && (skb = skb_dequeue(&d->tx_queue))) { |
1789 | err = rfcomm_send_frame(d->session, skb->data, skb->len, | 1777 | struct socket *sock = d->session->sock; |
1790 | skb->priority); | 1778 | struct sock *sk = sock->sk; |
1779 | |||
1780 | err = rfcomm_send_frame(d->session, skb->data, skb->len); | ||
1791 | if (err < 0) { | 1781 | if (err < 0) { |
1792 | skb_queue_head(&d->tx_queue, skb); | 1782 | skb_queue_head(&d->tx_queue, skb); |
1793 | break; | 1783 | break; |