How ERTM will work on BlueZ

I spent the last days studying how Enhanced Retransmission Mode(ERTM) should be implemented on L2CAP. Marcel recommended me to look at TCP[0] code. ERTM on L2CAP is very similar to TCP. Both have retransmission support, recovery error,  acknowledgment of packets and timers.

That means that ERTM implementation will look like TCP implementation[1] on Linux. So, there is no need to write ERTM from scratch, I’ve already started to code and I’m basing my code on  TCP code to get started with ERTM.

[0] http://en.wikipedia.org/wiki/Transmission_Control_Protocol
[1] http://vger.kernel.org/~davem/tcp_output.html

BlueZ: First patch was merged

The first patch, that add support to L2CAP Enhanced Retransmission, was merged into bluetooth-testing yesterday. The patch adds support to  configure L2CAP connections in Enhanced Retransmission(ERTM) and Streaming Modes besides the Basic Mode.  Streaming Mode will not be implemented now, but it’s better make all configuration code for the 3 modes instead only ERTM and Basic Mode. This way we don’t need to touch twice into configuration code.  The commit is here and that is the commit message:

Bluetooth: Add configuration support for ERTM and Streaming mode

Add support to config_req and config_rsp to configure ERTM and Streaming
mode. If the remote device specifies ERTM or Streaming mode, then the
same mode is proposed. Otherwise ERTM or Basic mode is used. And in case
of a state 2 device, the remote device should propose the same mode. If
not, then the channel gets disconnected.

Signed-off-by: Gustavo F. Padovan <gustavo@las.ic.unicamp.br>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>

Now I’m going to implement support to send and receive I-frames and S-frames. Some part of the code for that . First I’m going to add support to transmissions with txWindow = 1 (i.e., only one packet can be sent per time without acknowledgment from the other side) and no retransmission support and I intend to finish it during this week.

Here is a quick roadmap for my work:

  1. Implement ERTM with txWindow=1 and retransmission disabled.
    1. send I-frames
    2. receive I-frames
    3. support RR S-frames to acknowledge I-frames received
    4. acknowledge I-frames
  2. Support txWindow up to 63
  3. Support segmentation and reassembly of L2CAP SDUs
  4. Enable retransmission
    1. support REJ S-Frame
    2. support SREJ S-Frame
    3. support RNR S-Frame to indicate busy condition
    4. use RR S-frame to show that is ready to receive I-frames
  5. Enable Retransmission Timer
  6. Enable Monitor Timer
  7. Test BlueZ against others stack that implement ERTM

I expect that until end of August finish all this topics. So, let’s hack. =)

GSoC 2009: Starting code.

I already started to work on my project. Now, I’m studying how to do the configuration negotiation.  Today, only L2CAP  Basic mode is supported, so the configuration process is too easy, if  a the device try to use another mode, BlueZ stack will response that only supports Basic mode. Now with L2CAP Enhanced Retransmission mode(ERTM) the devices will need negotiate if they will use ERTM or Basic Mode. This week I’ll start to implement this.

That is the first part of my project, after  I’ll really implement ERTM.  The project will add support for two new frames types, I-frames and S-frames.  I-frames transmit all the data and S-frame are used to transmit specific protocol information – like ask to other device to resend some packet.

BlueZ:
If you wanna see all the projects accepted by BlueZ go to Vudentz’s blog, among them is my friend João Paulo Rechi Vita, also from Unicamp, with A2DP sink role.

That’s all, folks.

UPDATE: I said in the first version of this post that the first part of the project is to add ERTM to features mask. I was wrong. I can do that only when I finish all  ERTM implementation. To test ERTM Marcel has created a module parameter to enable ERTM.

ps: if you find errors in my English, please tell me, I’m learning yet. =)

Let’s hack! Google Summer of Code 2009 has come.

I’m proud to announce I was accepted on Google Summer of Code 2009. Google announced on Monday the students accepted on GSoC 2009. I’m going to hack BlueZ.
My project is named “L2CAP Enhanced Retransmission mode support” . My mentors are Luiz Augusto “Vudentz” von Dentz and Marcel Holtmann.
The work is on L2CAP layer, which passes the packets from the Link Manager to the higher layer protocols or vice versa.(If you don’t know what I’m talking read the links in the end of the post). BlueZ L2CAP layer implementation only supports basic mode of transmission of packets, but corrupted or lost packets can’t be resent.
The new implementation with the L2CAP Enhanced Retransmission mode will permit retransmission of corrupted or lost L2CAP packets improving the bluetooth experience on Linux. L2CAP Enhanced Retransmission has a mechanism to notify the sender of the packet that it need to be retransmitted.
If you wanna see what a I’m doing you can subscribe this blog and get my kernel tree with the L2CAP Enhanced Retransmission mode implementation. Vudentz is going to a page for my project into BlueZ wiki, so when done I’ll post the link here.

About GSoC 2009 in Brazil:
Leslie Hawthorn has posted yesterday on Google Open Source Blog some statistics about GSoC 2009, and Brazil is the top 5 country for accepted student applicants , with 43 students. I’m too happy to hear that, but I’m also waiting for the statistic about students accepted per University. Last year my university (Unicamp – University of Campinas) was the 2nd in the whole world.

And I wanna congratulate my friends of University of Campinas that were accepted on GSoC 2009 too. They are João Paulo Rechi Vita, working on BlueZ with me and Vudentz is his mentor too; Bruno Cardoso working on LLVM for the third time. Helder Ribeiro on ReviewBoard; João “lvwr” Correa on NMAP and Thiago “bolaum” Abdnur.  We will hack togheter for next four months to accomplish our Google Summer of Code project.

Getting deeper on Bluetooth:
For a first read you can read [1] e [2] , if wanna more you can go to [3] e and look thought the spec.

[1] http://en.wikipedia.org/wiki/Bluetooth

[2] http://bluetooth.com/Bluetooth/Technology/Works/Overview_of_Operation.htm

[3] http://bluetooth.com/Bluetooth/Technology/Building/Specifications/

ps: if you find errors in my English, please tell me, I’m learning yet. =)