Stefano Cordio wrote:
> I'm glad to work with you!
Ciao Stefano,
I believe this LOOOOONG mail will give you quite a big hand.
> I would like to configure a machine with two network cards on Minix
> 3.1.7 r6844. Based on what I read in the group, do it on VMware is not
> possible because the lance driver does not support two devices,
AFAIK the lance driver is one of the few which DOES enable two devices.
The one which is not that clear is the (gigabit) e1000, where I do not
know is having two ports is a supported configuration; hints are, this
was not tested (Niek, fell free to correct me.)
The real problem, and you'll have it with physical adapters as well, is
that the PCI setup stuff in MINIX 3 (and netconf.sh) is targetted toward
only one NIC, so the second adapter needs manual set up.
The only way I succeeded was setting up the parameters of each card
separately, using the DRIVER0 and DRIVER1 environment variables (set up
with edparams) with something like DRIVERn=pci:1:2:3, where 1.2.3 is the
PCI address of each adapter. A real nuisance here is that I cannot say
to you which are the correct values to put instead of 1.2.3; to add the
insult to the injury, there are variations among version in the way
VMWare distribute the NIC cards among the PCI buses; and unfortunately,
while Minix' PCI driver knows the values (since it is able to enumerate
the bus), I do not know any way to print them; lspci is a useful tool
here in the sense that it was worse before, but it only get the VID:PID
pair from the PCI device, not the address... A second nuisance is that
while this scheme is implemented for several driver like dp8390 with
RTL8029 or rtl8139 (where I succeeded starting it, to be then stopped
because the driver does not handle several port simultaneously, more
details below), it is lacking for both lance and e1000...
Now, while I played quite a bit with that, I also believe the future
here is to change a bit the ways NIC drivers are handled (which is one
reason why I did not write all this in a wiki, if they should become
obsolete the day I finish the article, as it already occured.)
Nowadays, when you have two different NICs, say nicfoo and nicbar,
inet.conf will look like
eth0 nicfoo 0 { default;};
eth1 nicbar 0;
inet is talking with nicfoo and nicbar, which are two different drivers,
and can work at the same time without interference.
On the other hand, if you have two NIC but of the same kind nicbaz,
inet.conf will now look like
eth0 nicbaz 0 { default;};
eth1 nicbaz 1;
there will be only ONE driver (nicbaz), and inet will send requests with
an additional parameter (DL_PORT) being 0 or 1. HOWEVER, since the
driver is blocked while sending or receiving, while you send one packet
on nicbaz:0 you cannot send to nicbaz:1 :-(
We had this discussion some month ago (end Dec and again February) with
David van Moolenbroek, at the bare minimum, please have a look at
<
msgid:9d1d88a6-89f9-4e06...@l26g2000yqd.googlegroups.com>
http://groups.google.com/group/minix3/msg/8f5127e61804c366).
My proposal is to do the same as done with at_wini, ie to drop the
nicbaz above and to setup the two cards as two independant drivers, and
inet will deal independantly with each card. This brings several advantages:
- drivers are easier to program, since we do not have to deal with
multiple ports, with race conditions etc; they are also lighter since
many index retrieving become unnecessary; merging two drivers codebase
or changing the name of a driver does not break anything any more;
- should one card become dead, that driver is stopped while another one
continue working undisturbed; similarly one can restart one interface
from scratch (restarting the driver) while the other stands quiet (note
that this would need substancial changes to inet though)
- we can easily select the driver at start up time based on PCI
enumeration, just passing it the current PCI address as discovered,
without having to worry about multiple port of the same driver, which is
the very problem you are facing in the first place; this minimizes the
changes needed, since the basic PCI framework does not change, just the
way the xx_pcibus, xx_pcidev, xx_pcifunc is set up, ie from command line
arguments rather than from environment variables parsing.
However I did not see updates from Jaswinder Singh who is reported to
work on this issue officially (while I am just a hacker.)
> My question is: how can I figure out which drivers support more
> devices of the same type without looking at their source code?
This is a sidenote and is in no way specific to networking code, but
documentation is a real problem with Minix these days: it regularly
lacks behind, so there is a number of features whcih either are
completely absent from both the manual and the wiki, while there are
several others (mainly carried over from Minix 2 days) where the
documentation is not in phase; I even know cases where the comments at
the top of the source files is misleading. The bottom line is, you
probably should learn to look into the source code ASAP...
> Alternatively, I found two different network adapters that are
> supported by Minix (RTL 8169 and RTL 8139) but I have some
> configuration problem.
With both a 8139 and a 8169, then I think it should work; I myself have
similar hardware and had some success; but I had to unmount since it was
a temporary experiment, and the officially published Minix driver code
and model changed in a way I cannot match with my hacks.
However, I do not believe two 8139 or two 8169 in the same machine will
work out of the box, I guess the drivers did not expect such a case and
mix states; in fact, it was while I was hacking my driver I found all
the stuff about multiple ports...
> If I enable only a device at a time through netconf, the driver is
> loaded and the device is working properly (i.e. it gets the address
> from the DHCP server on the local network and the traffic comes out).
>
> But if I change /etc/inet.conf in this way
>
> eth0 rtl8169 0 (default);
> eth1 rtl8139 0;
>
> drivers seem to be running (I see it through ps ax) and the device
> files are created but no network device obtains the address from the
> DHCP server.
OK, I believe I got this one...
First thing first, you have to understand all the stuff above above
configuration (sorry, I insist ;-) ). As I explained above, to set up
two NICs the automatic way does not work and you have at least to make
clear (in the system environement, that is at boot monitor or edparams)
the PCI address of each device.
In your case, assuming the rtl8169 is at 1.6.9 etc., it means
<envvar_rtl8169>0 = pci:1.6.9
<envvar_rtl8139>0 = pci:1.3.9
That is all good and fine; BUT the fact is, the name of the rtl8139
environment variable (end of rtl8139.h) is "RTLETH"##n; while the name
of the rtl8169 environment variable (in rtl8169.c, before the actual
code) is "RTLETH"##n; of course, this cannot work flawlessly! Change one
of them, recompile, enter the right values and I guess you will be done.
Antoine