Why not BRCM Bluedroid use 1012 as the max frame size of OBEX packets instead of 3*330?

101 views
Skip to first unread message

Alex Yuan

unread,
May 23, 2014, 4:51:09 AM5/23/14
to android-...@googlegroups.com
Hey Guys,

As we know the max user payload size of 3-DH5 packets is 1021. As for the use case of OBEX over RFCOMM(mp3 files, picture, phonebooks ...),
the max frame size of OBEX packets should be 1012.
1012 = 1021 - L2CAP Header(PDU length: 2 bytes,  Channel ID: 2 bytes) - RFCOMM Header(Address: 1byte,  Frame Type: 1 byte,  Length: 2 bytes) and FCS (1 byte)
1012 = 1021 - (2 + 2) - (1 + 1 + 2) - 1
1012 = 1021 - 9




























Whereas, in the source code of Bluedroid stack, 3*330 is specified as the max frame size.
in file: bta_jv_api.h
++++++++++++++++++++++
#ifndef BTA_JV_DEF_RFC_MTU
#define BTA_JV_DEF_RFC_MTU      (3*330)
#endif
++++++++++++++++++++++

In addition, you can refer to the comment in file: port_utils.c, func: port_select_mtu(

/* We try to negotiate MTU that each packet can be split into whole 
number of max packets. For example if link is 1.2 max packet size is 339 bytes. 
At first calculate how many whole packets it is. MAX L2CAP is 1691 + 4 overhead. 
1695, that will be 5 Dh5 packets. Now maximum RFCOMM packet is 
5 * 339 = 1695. Minus 4 bytes L2CAP header 1691. Minus RFCOMM 6 bytes header overhead 1685 

For EDR 2.0 packet size is 1027. So we better send RFCOMM packet as 1 3DH5 packet 
1 * 1027 = 1027. Minus 4 bytes L2CAP header 1023. Minus RFCOMM 6 bytes header overhead 1017 */


The comment is not correct for the 3DH5 packet length. 
Whereas, can anybody explain why 990 is used instead of bigger size?




Appreciate your comments,
Alex

Reply all
Reply to author
Forward
0 new messages