From: Lan Zhu <zhu.lan.cn@gmail.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: can we increase the send buffer size of rfcomm socket?
Date: Thu, 27 Aug 2009 23:33:47 +0800 [thread overview]
Message-ID: <113d36d80908270833q4eb7b4eg8d512fdd34e6ca83@mail.gmail.com> (raw)
In-Reply-To: <1251309847.2950.96.camel@localhost.localdomain>
Hi Marcel,
2009/8/27 Marcel Holtmann <marcel@holtmann.org>:
> Hi Zhu,
>
>> We tried to write a 64k data to rfcomm socket, but it will break
>> before sending all of the data out. The problem is in function
>> rfcomm_sock_sendmsg() in net/bluetooth/rfcomm/sock.c, it breaks after
>> calling sock_alloc_send_skb().
>>
>> static int rfcomm_sock_sendmsg(...)
>> {
>> =A0 =A0...
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 skb =3D sock_alloc_send_skb(sk, size + RFCOM=
M_SKB_RESERVE,
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 msg->msg_fla=
gs & MSG_DONTWAIT, &err);
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!skb)
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break;
>> =A0 =A0...
>> }
>>
>> Looks the send buffer is not adequate. Then I increased the send
>> buffer size in function rfcomm_sock_alloc(), =A0build kernel and try
>> again, this time the sendmsg can complete sending all the data.
>>
>> Can we use the setsockopt() method to change the socket's send/receive
>> buffer size, just like the usual =A0tcp/ip socket?
>
> yes we can. Send a patch for it and I am going to review it.
>
> Regards
>
> Marcel
>
>
>
Today I changed the send buffer size but found kernel become very
unstable. It usually crash during sending rfcomm data. Do you know
what's the reason?
Below is what I changed in net/bluetooth/rfcomm/sock.c.
in function rfcomm_sock_alloc(),
change sk->sndbuf
from
sk->sk_sndbuf =3D RFCOMM_MAX_CREDITS * RFCOMM_DEFAULT_MTU * 10
to
sk->sk_sndbuf =3D RFCOMM_MAX_CREDITS * RFCOMM_DEFAULT_MTU * 20
Thanks,
Zhu Lan
next prev parent reply other threads:[~2009-08-27 15:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-26 10:07 can we increase the send buffer size of rfcomm socket? Lan Zhu
2009-08-26 18:04 ` Marcel Holtmann
2009-08-27 15:33 ` Lan Zhu [this message]
2009-08-27 19:30 ` Marcel Holtmann
2009-08-28 9:34 ` Lan Zhu
2009-08-28 16:58 ` Marcel Holtmann
2009-08-28 17:54 ` Iain Hibbert
2009-08-29 11:19 ` Lan Zhu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=113d36d80908270833q4eb7b4eg8d512fdd34e6ca83@mail.gmail.com \
--to=zhu.lan.cn@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=marcel@holtmann.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox