Hi Andrei, * Emeltchenko Andrei <Andrei.Emeltchenko.news@xxxxxxxxx> [2011-09-16 14:43:17 +0300]: > Hi Gustavo, > > On Wed, Sep 14, 2011 at 12:51:04AM -0300, Gustavo Padovan wrote: > > Hi Andrei, > > > > * Emeltchenko Andrei <Andrei.Emeltchenko.news@xxxxxxxxx> [2011-09-07 17:05:14 +0300]: > > > > > From: Andrei Emeltchenko <andrei.emeltchenko@xxxxxxxxx> > > > > > > Calculate pdu length before creating I-frame. Otherwise if > > > conn->mtu - (headers) < remote_mps we get fragmented packets in > > > create_iframe_pdu function. > > > > You might check the way we set the remote_mps, it seems you are not taking > > that in account. > > You are right, I was confused by magic "rfc.max_pdu_size = > cpu_to_le16(chan->conn->mtu - 10)" > > I will send new patch with fixes like the one below: > > - rfc.max_pdu_size = cpu_to_le16(L2CAP_DEFAULT_MAX_PDU_SIZE); > - if (L2CAP_DEFAULT_MAX_PDU_SIZE > chan->conn->mtu - 10) > - rfc.max_pdu_size = cpu_to_le16(chan->conn->mtu - 10); > + > + rfc.max_pdu_size = cpu_to_le16(min_t(u16, > + L2CAP_DEFAULT_MAX_PDU_SIZE, > + chan->conn->mtu - > + L2CAP_EXTENDED_HDR_SIZE - > + L2CAP_SDULEN_SIZE - > + L2CAP_FCS_SIZE)); Then do this in two parts: size = min_t(...) rfc.max_pdu_size = cpu_to_le16(size); Gustavo -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html