Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
fb3dbece
Commit
fb3dbece
authored
Oct 07, 2010
by
David S. Miller
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
git://git.kernel.org/pub/scm/linux/kernel/git/padovan/bluetooth-2.6
parents
12e94471
eaa71b31
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
33 deletions
+51
-33
include/net/bluetooth/bluetooth.h
include/net/bluetooth/bluetooth.h
+18
-0
net/bluetooth/l2cap.c
net/bluetooth/l2cap.c
+29
-33
net/bluetooth/rfcomm/sock.c
net/bluetooth/rfcomm/sock.c
+4
-0
No files found.
include/net/bluetooth/bluetooth.h
View file @
fb3dbece
...
...
@@ -161,12 +161,30 @@ static inline struct sk_buff *bt_skb_send_alloc(struct sock *sk, unsigned long l
{
struct
sk_buff
*
skb
;
release_sock
(
sk
);
if
((
skb
=
sock_alloc_send_skb
(
sk
,
len
+
BT_SKB_RESERVE
,
nb
,
err
)))
{
skb_reserve
(
skb
,
BT_SKB_RESERVE
);
bt_cb
(
skb
)
->
incoming
=
0
;
}
lock_sock
(
sk
);
if
(
!
skb
&&
*
err
)
return
NULL
;
*
err
=
sock_error
(
sk
);
if
(
*
err
)
goto
out
;
if
(
sk
->
sk_shutdown
)
{
*
err
=
-
ECONNRESET
;
goto
out
;
}
return
skb
;
out:
kfree_skb
(
skb
);
return
NULL
;
}
int
bt_err
(
__u16
code
);
...
...
net/bluetooth/l2cap.c
View file @
fb3dbece
...
...
@@ -1441,33 +1441,23 @@ static inline void l2cap_do_send(struct sock *sk, struct sk_buff *skb)
static
void
l2cap_streaming_send
(
struct
sock
*
sk
)
{
struct
sk_buff
*
skb
,
*
tx_skb
;
struct
sk_buff
*
skb
;
struct
l2cap_pinfo
*
pi
=
l2cap_pi
(
sk
);
u16
control
,
fcs
;
while
((
skb
=
sk
->
sk_send_head
))
{
tx_skb
=
skb_clone
(
skb
,
GFP_ATOMIC
);
control
=
get_unaligned_le16
(
tx_skb
->
data
+
L2CAP_HDR_SIZE
);
while
((
skb
=
skb_dequeue
(
TX_QUEUE
(
sk
))))
{
control
=
get_unaligned_le16
(
skb
->
data
+
L2CAP_HDR_SIZE
);
control
|=
pi
->
next_tx_seq
<<
L2CAP_CTRL_TXSEQ_SHIFT
;
put_unaligned_le16
(
control
,
tx_
skb
->
data
+
L2CAP_HDR_SIZE
);
put_unaligned_le16
(
control
,
skb
->
data
+
L2CAP_HDR_SIZE
);
if
(
pi
->
fcs
==
L2CAP_FCS_CRC16
)
{
fcs
=
crc16
(
0
,
(
u8
*
)
tx_skb
->
data
,
tx_
skb
->
len
-
2
);
put_unaligned_le16
(
fcs
,
tx_skb
->
data
+
tx_
skb
->
len
-
2
);
fcs
=
crc16
(
0
,
(
u8
*
)
skb
->
data
,
skb
->
len
-
2
);
put_unaligned_le16
(
fcs
,
skb
->
data
+
skb
->
len
-
2
);
}
l2cap_do_send
(
sk
,
tx_
skb
);
l2cap_do_send
(
sk
,
skb
);
pi
->
next_tx_seq
=
(
pi
->
next_tx_seq
+
1
)
%
64
;
if
(
skb_queue_is_last
(
TX_QUEUE
(
sk
),
skb
))
sk
->
sk_send_head
=
NULL
;
else
sk
->
sk_send_head
=
skb_queue_next
(
TX_QUEUE
(
sk
),
skb
);
skb
=
skb_dequeue
(
TX_QUEUE
(
sk
));
kfree_skb
(
skb
);
}
}
...
...
@@ -1960,6 +1950,11 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, char __us
switch
(
optname
)
{
case
L2CAP_OPTIONS
:
if
(
sk
->
sk_state
==
BT_CONNECTED
)
{
err
=
-
EINVAL
;
break
;
}
opts
.
imtu
=
l2cap_pi
(
sk
)
->
imtu
;
opts
.
omtu
=
l2cap_pi
(
sk
)
->
omtu
;
opts
.
flush_to
=
l2cap_pi
(
sk
)
->
flush_to
;
...
...
@@ -2771,10 +2766,10 @@ static int l2cap_parse_conf_rsp(struct sock *sk, void *rsp, int len, void *data,
case
L2CAP_CONF_MTU
:
if
(
val
<
L2CAP_DEFAULT_MIN_MTU
)
{
*
result
=
L2CAP_CONF_UNACCEPT
;
pi
->
o
mtu
=
L2CAP_DEFAULT_MIN_MTU
;
pi
->
i
mtu
=
L2CAP_DEFAULT_MIN_MTU
;
}
else
pi
->
o
mtu
=
val
;
l2cap_add_conf_opt
(
&
ptr
,
L2CAP_CONF_MTU
,
2
,
pi
->
o
mtu
);
pi
->
i
mtu
=
val
;
l2cap_add_conf_opt
(
&
ptr
,
L2CAP_CONF_MTU
,
2
,
pi
->
i
mtu
);
break
;
case
L2CAP_CONF_FLUSH_TO
:
...
...
@@ -3071,6 +3066,17 @@ static inline int l2cap_connect_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hd
return
0
;
}
static
inline
void
set_default_fcs
(
struct
l2cap_pinfo
*
pi
)
{
/* FCS is enabled only in ERTM or streaming mode, if one or both
* sides request it.
*/
if
(
pi
->
mode
!=
L2CAP_MODE_ERTM
&&
pi
->
mode
!=
L2CAP_MODE_STREAMING
)
pi
->
fcs
=
L2CAP_FCS_NONE
;
else
if
(
!
(
pi
->
conf_state
&
L2CAP_CONF_NO_FCS_RECV
))
pi
->
fcs
=
L2CAP_FCS_CRC16
;
}
static
inline
int
l2cap_config_req
(
struct
l2cap_conn
*
conn
,
struct
l2cap_cmd_hdr
*
cmd
,
u16
cmd_len
,
u8
*
data
)
{
struct
l2cap_conf_req
*
req
=
(
struct
l2cap_conf_req
*
)
data
;
...
...
@@ -3088,14 +3094,8 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr
if
(
!
sk
)
return
-
ENOENT
;
if
(
sk
->
sk_state
!=
BT_CONFIG
)
{
struct
l2cap_cmd_rej
rej
;
rej
.
reason
=
cpu_to_le16
(
0x0002
);
l2cap_send_cmd
(
conn
,
cmd
->
ident
,
L2CAP_COMMAND_REJ
,
sizeof
(
rej
),
&
rej
);
if
(
sk
->
sk_state
==
BT_DISCONN
)
goto
unlock
;
}
/* Reject if config buffer is too small. */
len
=
cmd_len
-
sizeof
(
*
req
);
...
...
@@ -3135,9 +3135,7 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr
goto
unlock
;
if
(
l2cap_pi
(
sk
)
->
conf_state
&
L2CAP_CONF_INPUT_DONE
)
{
if
(
!
(
l2cap_pi
(
sk
)
->
conf_state
&
L2CAP_CONF_NO_FCS_RECV
)
||
l2cap_pi
(
sk
)
->
fcs
!=
L2CAP_FCS_NONE
)
l2cap_pi
(
sk
)
->
fcs
=
L2CAP_FCS_CRC16
;
set_default_fcs
(
l2cap_pi
(
sk
));
sk
->
sk_state
=
BT_CONNECTED
;
...
...
@@ -3225,9 +3223,7 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr
l2cap_pi
(
sk
)
->
conf_state
|=
L2CAP_CONF_INPUT_DONE
;
if
(
l2cap_pi
(
sk
)
->
conf_state
&
L2CAP_CONF_OUTPUT_DONE
)
{
if
(
!
(
l2cap_pi
(
sk
)
->
conf_state
&
L2CAP_CONF_NO_FCS_RECV
)
||
l2cap_pi
(
sk
)
->
fcs
!=
L2CAP_FCS_NONE
)
l2cap_pi
(
sk
)
->
fcs
=
L2CAP_FCS_CRC16
;
set_default_fcs
(
l2cap_pi
(
sk
));
sk
->
sk_state
=
BT_CONNECTED
;
l2cap_pi
(
sk
)
->
next_tx_seq
=
0
;
...
...
net/bluetooth/rfcomm/sock.c
View file @
fb3dbece
...
...
@@ -82,11 +82,14 @@ static void rfcomm_sk_data_ready(struct rfcomm_dlc *d, struct sk_buff *skb)
static
void
rfcomm_sk_state_change
(
struct
rfcomm_dlc
*
d
,
int
err
)
{
struct
sock
*
sk
=
d
->
owner
,
*
parent
;
unsigned
long
flags
;
if
(
!
sk
)
return
;
BT_DBG
(
"dlc %p state %ld err %d"
,
d
,
d
->
state
,
err
);
local_irq_save
(
flags
);
bh_lock_sock
(
sk
);
if
(
err
)
...
...
@@ -108,6 +111,7 @@ static void rfcomm_sk_state_change(struct rfcomm_dlc *d, int err)
}
bh_unlock_sock
(
sk
);
local_irq_restore
(
flags
);
if
(
parent
&&
sock_flag
(
sk
,
SOCK_ZAPPED
))
{
/* We have to drop DLC lock here, otherwise
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment