From mboxrd@z Thu Jan 1 00:00:00 1970 From: hdf3@comcast.net (don fisher) Date: Wed, 26 Sep 2018 21:38:27 -0700 Subject: Problem with netconsole and eth0 timing In-Reply-To: <105446.1537997610@turing-police.cc.vt.edu> References: <0f831765-c3f1-17e9-b029-1a7e52d8a38d@comcast.net> <103031.1537928796@turing-police.cc.vt.edu> <04ea042b-8e6d-2699-2dab-986a62d4d3cb@comcast.net> <105446.1537997610@turing-police.cc.vt.edu> Message-ID: To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org On 9/26/18 2:33 PM, valdis.kletnieks at vt.edu wrote: > On Wed, 26 Sep 2018 13:25:35 -0700, don fisher said: >> Would you tell me how to tell the driver that it is to be eth0, ip >> address etc. Maybe on linux command line, but I do not know the format. > > To quote some guy named Don Fisher: > >> my kernel and including the proper command (as shown below) in the linux boot string: >> netconsole=64001 at 192.168.7.60/eth0,64001 at 192.168.7.55/34:e6:d7:01:2a:dd > > That's how. The netconsole command gets the info it needs from there, and tells > the network layer how to configure the ethernet device and the network layer - > although mostly the network layer. And the devices will auto-name themselves > during boot, so all you need to do is know *which* name the kernel gives to the > port you want to use, and then use that name. > > So grovel around in dmesg, and look for lines like (2 examples I have handy here) > > grep eth /var/log/dmesg > [ 7.278395] igb 0000:07:00.0: added PHC on eth0 > [ 7.278398] igb 0000:07:00.0: eth0: (PCIe:5.0Gb/s:Width x2) 24:6e:96:10:db:64 > [ 7.278916] igb 0000:07:00.0: eth0: PBA No: G61346-000 > [ 7.368911] igb 0000:07:00.1: added PHC on eth1 > [ 7.368913] igb 0000:07:00.1: eth1: (PCIe:5.0Gb/s:Width x2) 24:6e:96:10:db:65 > [ 7.369372] igb 0000:07:00.1: eth1: PBA No: G61346-000 > > dmesg | grep eth > [ 2.642006] e1000e 0000:00:19.0 eth0: (PCI Express:2.5GT/s:Width x1) f0:1f:af:0c:8a:da > [ 2.642076] e1000e 0000:00:19.0 eth0: Intel(R) PRO/1000 Network Connection > [ 2.642118] e1000e 0000:00:19.0 eth0: MAC: 10, PHY: 11, PBA No: 7011FF-0FF > [ 5.071095] e1000e 0000:00:19.0 eno1: renamed from eth0 > [ 44.516004] e1000e 0000:00:19.0 eth0: renamed from eno1 > > And find the one that has the MAC address of the port you want to use. Note > that you want the kernel-assigned device name, not the one that udev/systemd > finally assign to the device. So for the second example (my laptop), you'd want > either the eth0 or eno1 name (depending which one was in effect when the > netconsole module initializes. The initial eth0 is from pci enumeration, the > rename to eno1 is courtesy of the kernel, and then the rename back to eth0 by > systemd. Some experimentation may be needed (I've got a few servers that have > 4 1G ports on the motherboard and multiple 10G/40G dual-port cards, so > sometimes the port wired to our management network ends up at eth6 or eth7...) > > So if the port you want to use gets named eth4 by the kernel, you use > netconsole=64001 at 192.168.7.60/eth4,64001 at 192.168.7.55/34:e6:d7:01:2a:dd > > (Gory ethernet details follow :) > > Remember that strictly speaking, the ethernet device itself doesn't *need* to > know what its IP address is - it only needs to know its own MAC address so it > knows which packets on the wire to accept to hand to the network stack, and > *maybe* a list of other MAC addresses it should accept. > > And the hardware already knows its own MAC address.. :) > > You can get ethernet devices working with a *very* small set of functions: > > 0) Tell the kernel your hardware state (link/no link, MAC address, a few other things) > 1) Receive packets for your own MAC address > 2) Receive broadcast packets > 3) Receive packets for another specified MAC address (semi-optional) > 4) Receive packets in promiscuous mode (semi-optional) > 5) Transmit packet to the MAC address provided > > Pretty much everything else can be done in kernelspace (though modern > cards often provide offload of some IP and even TCP handling, interrupt > coalescing, and all sorts of other stuff) > > (I learned far too much about minimalist Ethernet when the Clarkson Packet > Drivers were getting created in the cubicle next to mine. :) Thanks. I tried building with the driver embedded in the kernel, but the compile failed with a halt. No crash is apparent, just a halt. It turned out that this was repeated until I removed the netconsole command during boot. System appears stable now. I will try tomorrow to embed the driver, then add netconsole option in the command line. Don