Week 9 [ Mon 19 Jul 2010 - Sun 25 Jul 2010 ]

Day 1 [ Mon 19 Jul 2010 ]

I started learning about multiboot and Xen. More info on this in following days.

Day 2 [ Tue 20 Jul 2010 ]

I took a step back today and worked on the forcedeth driver again. Stefan suggested that we drop the newer descriptor formats in favor of the old ones, to reduce code size and clean up the code. There were a lot of areas in the code that would take the form of an if/else construct dependent on the descriptor version. The main problem is that we don't know for sure whether all NICs support the legacy descriptor format.

Since the old driver only used the legacy descriptor format we have the guarantee (in case nothing else is wrong) that the new driver will work with those NICs as well. Breaking stuff that previously worked is not an option.

Unfortunately, the Linux driver also uses the desc_ver field (which indicates what descriptor version is used for the NIC) in several other places:

  • NV_TX[2]_LASTPACKET. This flag is supposedly set to indicate to the NIC that this is the last packet in a series of fragments. Since we don't offload packet fragmentation, my guess is that this flag is ignored by the NIC. Using both the *TX* and *TX2* versions of the flag work on my NIC. Also, since the flaglen field has a different format in both descriptor versions, it makes sense that *TX* would be used in the legacy format and *TX2* would be used in the newer format.
  • Backoff implementation. Based on the descriptor version, the Linux driver employs a different backoff implementation. I found the Linux patch that added this implementation and noticed that it didn't add any new PCI_ROMs. I concluded that the driver had to work on previous NICs without this new implementation, so I left it out.

Stefan made the following comparisons between the resulting driver (the one that only used the legacy descriptor format) and the previous one:

text data bss dec hex filename
6995 516 0 7511 1d57 bin/forcedeth.o ( legacy-only)
9140 516 0 9656 25b8 bin/forcedeth.o ( linux-like)

There is an uncompressed difference of ~2KB between the two, so the legacy-only version might actually be the one that makes it into the mainline branch.

I've never faced such a problem before, and it is quite interesting. Do you use a version that you know will work with all the NICs but is slightly bloated or do you go for the minimal driver that _might not_ work with every NIC. I would go for the minimal driver and wait until someone reports a problem. If the bug isn't obvious, I would do the following:

  • Try the driver supporting all descriptor formats.
    • If it works then the problem is (in the order of probability):
      • The NIC only handles the newer descriptor format, therefore bring all the code back
      • The NIC really needs the NV_TX2_LASTPACKET flag set
      • The NIC needs the newer backoff algorithm
    • If that one doesn't work, stop! Debugging time!

Day 3 [ Wed 21 Jul 2010 ]

me.away()

Day 4 [ Thu 22 Jul 2010 ]

Posted the updated forcedeth patch today. It contains all of the previously mentioned modifications.

Day 5 [ Fri 23 Jul 2010 ]

Git commit: f97d937cab21c01d810274393abfd3aecb2e68cd

Back to multiboot today, more specifically to the decompression part. These days I am going to work on extracting and black-boxing the decompression code from the gzip utility. For starters, I won't try to integrate the code with gPXE, I'll just try and get it to work separately using an input .gz file. By the end of the week I hope to have a working gunzip util.

Day 6 [ Sat 24 Jul 2010 ]

No coding today, but a lot of documentation. I am currently trying to understand the DEFLATE algorithm. I played around all day with a decompression implementation from the zlib library and I think with a little bit more time I'll comprehend it all.

Day 7 [ Sun 25 Jul 2010 ]

me.away()


QR Code
QR Code soc:2010:andreif:journal:week9 (generated for current page)