Re: Driver for via-velocity gigabit NIC

Marty Connor <[email protected]> Wed, 8 Mar 2006 10:10:22 -0500
Newsgroups gmane.network.etherboot.devel
Message-ID <[email protected]>
On Mar 8, 2006, at 9:12 AM, Timothy Legge wrote:
>> From: Marty Connor [mailto:[email protected]]
>>
>> Show the code.  Justify your choices.
>> Until you understand and can explain this code clearly,
>> please do not commit it.
>
> I can clearly explain how the code I committed works.  It is very
> similar to the following from r8168.c:
>
> 	/* Rx Desscriptor needs 256 bytes alignment; */
> 	RxPhyAddr = virt_to_bus(tpc->RxDescArrays);
> 	diff = 256 - (RxPhyAddr - ((RxPhyAddr >> 8) << 8));
> 	RxPhyAddr += diff;
> 	tpc->RxDescArray = (struct RxDesc *) (tpc->RxDescArrays + diff);
>
> It essentially create a temporary pointer to the ring in this case and
> calculates the difference between the addres of that pointe and the  
> next
> highest address that is aligned on a 256 byte (via-velocity  
> requires 64
> byte).  It then add the difference to the temporary pointer to  
> align the
> ring and finally the aligned ring is assigned to the pointer kept  
> in the
> drivers structure for use later.  I essentially do that 4 times, once
> for each ring and buffer.

Good.  It's clear, and assuming that there is enough extra space  
allocated in the buffer, you won't overwrite anything when you  
allocate and the NIC writes to the last buffer before wrapping around.

> I cannot explain at present why the code that I *did not* commit  
> did not
> work.  I can post it and embarrass myself if you would like but I  
> cannot
> get it till later today.
> Tim

I have no desire to embarrass you, and I think we all need to lighten  
up and be willing to be embarrassed a lot more often here.

Please post the code you did not commit so we can see it.  Not to  
embarrass you, but to create knowledge (and let other people share  
what they know).

Effort matters greatly because even if you fail, you learn.  If you  
let us help, you may learn even more.  I have been spectacularly  
right and spectacularly wrong on these lists over the last 6 or 7  
years.  Often when wrong I learned more.

Not knowing stuff is nothing to be ashamed of.  We're doing something  
that is obscure and difficult, and at a level that most people have  
abandoned for object-oriented higher-level languages with graphically  
dazzling IDEs and vast libraries of pre-debugged objects that they  
can use.

We choose to be close to the metal, and write code that touches the  
hardware directly.  It's an unforgiving place, and there's no safety  
net of Java Virtual Machines or some LISP interpreter to save us from  
ourselves.  But that is both its challenge and its charm, and to  
build something robust in this environment, and to understand why it  
works -- that rocks (IMHO).

Working on the Tulip driver brought me to screaming, tears, and  
sleepless nights.  When I finally met Don Becker (who wrote the Linux  
driver I was working from) he told me that driver cost him two  
girlfriends :)

I've come to conclusion that what we need as much as code is to build  
competence.  Right now, Michael Brown and Klaus Espenlaub are the  
only people who are active in this project that understand large  
parts of it.  We need to spread that knowledge to more people so that  
more people can help, and can enjoy the thrill of getting things right.

I refuse to pretend that I know when I don't, and if we are to  
succeed, I believe we have to be rigorous and honest with each  
other.  It's Open Source, and the process of development is open as  
well, though there is structure.

The simple fact is that Etherboot is a big hairy piece of code that  
has grown so big and complicated that almost nobody understands it  
deeply anymore.

I don't yet fully understand the build system since it was converted  
to objcopy and ld.  I also don't understand the PXE code very well.   
These are the things I'm working on understanding, and will not be  
satisfied until I do.

We have to change that before we're just caretakers of a museum of  
wonderful inventions, none of which we understand too well.  When the  
inventors wander in the museum to see how their inventions are doing  
we are polite, but don't press them on helping us understand them.

Alright, I've wanted to say that for a long time.  Maybe by saying it  
more people will be comfortable joining the discussion.  Maybe people  
will run for the hills.

Let's find out.

Marty

-- 
     Try: http://rom-o-matic.net/ to make Etherboot images instantly.

    Name: Marty Connor
US Mail: Entity Cyber, Inc.; P.O. Box 391827;
          Cambridge, MA 02139; USA
   Voice: (617) 491-6935; Fax: (617) 491-7046
   Email: [email protected]
     Web: http://www.etherboot.org/




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642