Martin Decky wrote:
I agree with you on the principal level. But still I believe that it is not very wise to introduce new duplicated boilerplate code in the drivers where the previous implementation tried to eliminate it.
In general yes, but there is always a balance between the amount of duplicity 
removed, the effort/complexity of removing it and the genericity of the 
solution.

One solution to this might be to have, besides the independent DDF framework and NIC framework, a special DDF/NIC combined framework which would be used to implement NIC drivers using DDF ..
It would be possible with some very careful design. If you want to be generic 
enough to support things like Mellanox ConnectX which has two ports each of 
which can be either Ethernet or InfiniBand depending on what you plug into it, 
or to support USB-Ethernet, you need to be very careful about the assumptions 
you make. Often the measures taken in NIC and USB frameworks I've seen, in name 
of removing perceived 'duplicity' introduce elements (like specialized main() 
functions) which prevent you from doing things like USB-NIC, USB device whose 
set of endpoints change in time (ZyDAS WiFi), etc.

A lot of thought went into the design of DDF API and while it may seem a little 
oververbose, it has its reason. It seems to me that the attempts to encapsulate 
calls to DDF function control are often driven more by misunderstanding. There 
is not so much difference on this level between a generic driver and a generic 
network driver. If you encapsulate the generic interface into a simpler and 
more rigid interface, you will likely encounter a network device which escapes 
the simplified model.

If you consider a typical network adapter driver, the amount of boilerplate 
code that could be potentially eliminated by hiding DDF (only as far as child 
creation goess) from the driver is small enough for it to be debatable. I might 
go back to it and re-introduce something similar later, if that proves useful. 
At this point I'd like to narrow the scope of libnic to handling a simple 
service, to get something completely generic and work from there.

Cheers,
Jiri

P.S. Mosquito camelisation alert!

_______________________________________________
HelenOS-devel mailing list
[email protected]
http://lists.modry.cz/cgi-bin/listinfo/helenos-devel

Reply via email to