Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ethernet device names & more #1467

Merged
merged 5 commits into from
Dec 2, 2022
Merged

Update ethernet device names & more #1467

merged 5 commits into from
Dec 2, 2022

Conversation

Mellvik
Copy link
Contributor

@Mellvik Mellvik commented Dec 1, 2022

This PR changes all Ethernet device names per discussion in #1445 - which entails minor mods to many system files and the setup.8 man page.

Also included is an updated fsck man page, an enhancement to cp which adds a -f (force) option, making the sys script more useful when used to update an existing installation. The sys script has been updated accordingly, as has the cp man page.

The wd driver has been made fully compatible with the SMC/WD 8013 NIC, including the auto-detection of 8003 vs 8013 types. More testing of the switching between interfaces on a running system is required and ongoing.

Updates to the wiki and other documentation pages will follow when this PR has been merged.

-M

@Mellvik
Copy link
Contributor Author

Mellvik commented Dec 1, 2022

With the new ethernet names, the boot screen looks like this:

Direct console, scan kbd 80x25 emulating ANSI (3 virtual consoles)
ttyS0 at 0x3f8, irq 4 is a 16550A
ttyS1 at 0x2f8, irq 3 is a 16550A
ttyS2 at 0x3e8, irq 7 is a 16550A
ttyS3 at 0x2e8, irq 10 is a 16550A
xms: A20 was off now on, using unreal mode, 1024 xms buffers, 1048576 ram
eth: ne0 at 0x380, irq 9, (ne1k) MAC 00:1f:11:02:60:2d, flags 0x80
eth: wd0 at 0x320, irq 11, ram 0xcc00, (wd8013) MAC 00:00:C0:BC:8F:4B, flags 0x80
eth: 3c0 at 0x300, irq 15, (3c509) MAC 00:a0:24:67:7f:b1 (HWconf: 330/9), flags 0x80
bioshd: hda BIOS CHS 976,128,63
bioshd: hda  IDE CHS 7818,16,63
bioshd: hdb BIOS CHS 728,2,1
/dev/hda: 7818 cylinders, 16 heads, 63 sectors = 3847.9 Mb
/dev/hdb: 728 cylinders, 2 heads, 1 sectors = 728.0 kb
/dev/fd0: 80 cylinders, 2 heads, 18 sectors = 1440.0 kb
Partitions: hda:(0,7880544)  hda1:(63,67473)  hda2:(67536,135072)  hda4:(7560000,101808) 
 hdb:(0,1456)  hdb1:(1,1455) 
device_setup: BIOS drive 0x80, root device 0x302
PC/AT class machine, syscaps 0xff, 610K base ram.
ELKS kernel 0.6.0 (59312 text, 12080 ftext, 8112 data, 42464 bss, 14958 heap)
Kernel text at d0:0000, ftext f4b:0000, data 123e:0000, top 9880:0, 473K free
MINIX-fs: mounting unchecked file system 0x302, running fsck is recommended.
VFS: Mounted root 0x0302 (minix filesystem).
Running /etc/rc.sys script
Starting networking on wd0
ktcp -b -p wd0 10.0.2.17 10.0.2.2 255.255.255.0
ktcp: ip 10.0.2.17, gateway 10.0.2.2, netmask 255.255.255.0
ktcp: /dev/wd0 mac 00.00.c0.bc.8f.4b mtu 1500
Starting daemons 'telnetd' 'ftpd -d' 
Fri Jun 18 20:34:53 1999


ELKS 0.6.0

login:

@ghaerr
Copy link
Owner

ghaerr commented Dec 1, 2022

Hello @Mellvik,

You've got quite the boot screen there, it looks fantastic! I would say it seems you are using ELKS to the fullest, very impressive! And thank you for your work on this PR.

I notice that wd.c has been modified quite a bit, are you able to test that?
Also, in wd.c, fmemcpy is too generic a symbol to remain global, especially since it uses an internal variable. Can you make that a static function?

A question on cp.c using cp -f: it seems you only do the create if unlink is successful. Shouldn't that be changed so that you always do the unlink, ignore its result, and always execute the create?

In wfd < 9 below that, what is the purpose of comparing with 9? Its a file descriptor and should only be compared with < 0, it seems to me. (Perhaps cp -f has not been fully tested?)

(On another small note, for all the "int opt_xxx = 0" in cp.c, removing the "= 0" will remove them from the disk-based data segment and make the code file smaller, and ELKS guarantees the initial values will be 0).

Thank you!

@Mellvik
Copy link
Contributor Author

Mellvik commented Dec 1, 2022 via email

@ghaerr
Copy link
Owner

ghaerr commented Dec 1, 2022

If the target cannot be unlinked, create will fail and I'd like to know which one actually failed.

I'm not sure that's guaranteed to be the case. But in any case, your version of cp -f assumes that the destination already exists: if not, unlink will fail and cp should continue, not fail.

@Mellvik
Copy link
Contributor Author

Mellvik commented Dec 2, 2022

Demo - interface switching in real time
Switching between ethernet interfaces on ELKS is now sufficiently smooth to not affect a running ping. Not necessarily all that useful in practice but a fun experiment now that we've implemented the capability.

Starting with ne1k (1-13), continuing with 3c509 (14-30), ending with wd8013. The winner is the 3c509 but I suspect the ne2k would have matched if not beaten it.

helge@raspi2b:~ $ ping -s 1200 10.0.2.17
PING 10.0.2.17 (10.0.2.17) 1200(1228) bytes of data.
1208 bytes from 10.0.2.17: icmp_seq=1 ttl=64 time=8.96 ms
1208 bytes from 10.0.2.17: icmp_seq=2 ttl=64 time=8.88 ms
1208 bytes from 10.0.2.17: icmp_seq=3 ttl=64 time=8.92 ms
1208 bytes from 10.0.2.17: icmp_seq=4 ttl=64 time=8.89 ms
1208 bytes from 10.0.2.17: icmp_seq=5 ttl=64 time=8.88 ms
1208 bytes from 10.0.2.17: icmp_seq=6 ttl=64 time=8.85 ms
1208 bytes from 10.0.2.17: icmp_seq=7 ttl=64 time=8.94 ms
1208 bytes from 10.0.2.17: icmp_seq=8 ttl=64 time=8.90 ms
1208 bytes from 10.0.2.17: icmp_seq=9 ttl=64 time=8.89 ms
1208 bytes from 10.0.2.17: icmp_seq=10 ttl=64 time=8.90 ms
1208 bytes from 10.0.2.17: icmp_seq=11 ttl=64 time=8.96 ms
1208 bytes from 10.0.2.17: icmp_seq=12 ttl=64 time=8.89 ms
1208 bytes from 10.0.2.17: icmp_seq=13 ttl=64 time=19.4 ms
1208 bytes from 10.0.2.17: icmp_seq=14 ttl=64 time=6.95 ms
1208 bytes from 10.0.2.17: icmp_seq=15 ttl=64 time=6.92 ms
1208 bytes from 10.0.2.17: icmp_seq=16 ttl=64 time=6.92 ms
1208 bytes from 10.0.2.17: icmp_seq=17 ttl=64 time=6.93 ms
1208 bytes from 10.0.2.17: icmp_seq=18 ttl=64 time=6.98 ms
1208 bytes from 10.0.2.17: icmp_seq=19 ttl=64 time=6.97 ms
1208 bytes from 10.0.2.17: icmp_seq=20 ttl=64 time=6.87 ms
1208 bytes from 10.0.2.17: icmp_seq=21 ttl=64 time=6.90 ms
1208 bytes from 10.0.2.17: icmp_seq=22 ttl=64 time=6.92 ms
1208 bytes from 10.0.2.17: icmp_seq=23 ttl=64 time=6.91 ms
1208 bytes from 10.0.2.17: icmp_seq=24 ttl=64 time=6.92 ms
1208 bytes from 10.0.2.17: icmp_seq=25 ttl=64 time=6.89 ms
1208 bytes from 10.0.2.17: icmp_seq=26 ttl=64 time=6.89 ms
1208 bytes from 10.0.2.17: icmp_seq=27 ttl=64 time=6.95 ms
1208 bytes from 10.0.2.17: icmp_seq=28 ttl=64 time=6.90 ms
1208 bytes from 10.0.2.17: icmp_seq=29 ttl=64 time=6.89 ms
1208 bytes from 10.0.2.17: icmp_seq=30 ttl=64 time=10.6 ms
1208 bytes from 10.0.2.17: icmp_seq=31 ttl=64 time=9.47 ms
1208 bytes from 10.0.2.17: icmp_seq=32 ttl=64 time=7.56 ms
1208 bytes from 10.0.2.17: icmp_seq=33 ttl=64 time=7.57 ms
1208 bytes from 10.0.2.17: icmp_seq=34 ttl=64 time=7.52 ms
1208 bytes from 10.0.2.17: icmp_seq=35 ttl=64 time=7.52 ms
1208 bytes from 10.0.2.17: icmp_seq=36 ttl=64 time=7.56 ms
1208 bytes from 10.0.2.17: icmp_seq=37 ttl=64 time=7.58 ms
1208 bytes from 10.0.2.17: icmp_seq=38 ttl=64 time=7.60 ms
1208 bytes from 10.0.2.17: icmp_seq=39 ttl=64 time=7.54 ms
1208 bytes from 10.0.2.17: icmp_seq=40 ttl=64 time=7.54 ms
1208 bytes from 10.0.2.17: icmp_seq=41 ttl=64 time=7.56 ms
1208 bytes from 10.0.2.17: icmp_seq=42 ttl=64 time=7.55 ms
1208 bytes from 10.0.2.17: icmp_seq=43 ttl=64 time=7.56 ms
1208 bytes from 10.0.2.17: icmp_seq=44 ttl=64 time=7.54 ms
1208 bytes from 10.0.2.17: icmp_seq=45 ttl=64 time=7.52 ms
^C
--- 10.0.2.17 ping statistics ---
45 packets transmitted, 45 received, 0% packet loss, time 44064ms
rtt min/avg/max/mdev = 6.873/8.067/19.457/1.953 ms
helge@raspi2b:~ $ 

Commands:

elks17# ps
  PID   GRP  TTY USER STAT CPU  HEAP  FREE   SIZE COMMAND
    1     0      root    S   0  3072  2010  13072 /bin/init 3 
   13    13    1 root    S   0     0  1980   8608 /bin/getty /dev/tty1 
   14    14   S0 root    S   0  1188 13186  68960 -/bin/sh 
   15    15   S2 root    S   0  1188 13114  68960 -/bin/sh 
   81    14   S0 root    R   0  1024  1182  11776 ps 
   76    76      root    S   0  3072 32690  75696 ktcp -b -p ne0 10.0.2.17 10.0.2.2 255.255.255.0 
   78    78      root    S   0     0  1998   9728 telnetd 
   80    80      root    S   0     0  7308  28624 ftpd -d 
elks17# net stop; net start 3c0
Stopping network
Starting networking on 3c0
ktcp -b -p 3c0 10.0.2.17 10.0.2.2 255.255.255.0
ktcp: ip 10.0.2.17, gateway 10.0.2.2, netmask 255.255.255.0
ktcp: /dev/3c0 mac 00.a0.24.67.7f.b1 mtu 1500
Starting daemons 'telnetd' 'ftpd -d' 
elks17# net stop; net start wd0
Stopping network
Starting networking on wd0
ktcp -b -p wd0 10.0.2.17 10.0.2.2 255.255.255.0
ktcp: ip 10.0.2.17, gateway 10.0.2.2, netmask 255.255.255.0
ktcp: /dev/wd0 mac 00.00.c0.bc.8f.4b mtu 1500
Starting daemons 'telnetd' 'ftpd -d' 
elks17# 

@ghaerr
Copy link
Owner

ghaerr commented Dec 2, 2022

This looks OK now, thanks for the requested changes. I hadn't seen the extra creat so I was incorrect in my previous statement about -f operation.

BTW, the ifdef APPLE allows for this code to be compiled and run on macOS (or Linux) for testing using cc cp.c. I've found that useful for better test cases and it was used in development of the recursive option, as well as for more portable code.

@Mellvik
Copy link
Contributor Author

Mellvik commented Dec 2, 2022 via email

@ghaerr
Copy link
Owner

ghaerr commented Dec 2, 2022

Thanks for the revert and timing information. Interesting showing the timing information in real time, as well as seeing is believing with the speed differences between the cards!

@ghaerr ghaerr merged commit 8d3ffe8 into ghaerr:master Dec 2, 2022
@Mellvik Mellvik deleted the ethnames branch December 2, 2022 17:44
@Mellvik
Copy link
Contributor Author

Mellvik commented Dec 6, 2022

Thank you @ghaerr,
I actually wanted to demonstrate the smoothness of switching between interfaces 'in flight' so to speak. Changing the interface is barely noticeable in the ping stats. If it weren't for the fact that we're also switching devices, we could switch interfaces in the middle of a file transfer w/o noticeable delay. Not that it would be useful but a cool demo no doubt.

As to speeds, yes - it's interesting to see the real numbers. Talking about which, here are some actual file transfer numbers, this is incoming FTP to ELKS (destination /dev/null) on the 40MHz AMI 386SX:

[wd0, 16bit] 1474560 bytes sent in 14.85 secs (97.0014 kB/s)
[3c0, 16bit] 1474560 bytes sent in 14.12 secs (102.0008 kB/s)
[ne0,  8bit] 1474560 bytes sent in 17.17 secs (83.8759 kB/s)

... the latter running with 16k buffer and reporting (ca.) 8 occurrences of NIC BAD checksum (buffer screwup which requires NIC reset and packet discards). Very decent for all 3. And PIO beats shared memory but just barely. Outbound numbers are about 1/3 of this, primarily because of the smaller packet size.

ktcp gets easily confused though, there is quite a bit to do reach the final level of robustness. Such as: If the first packet ktcp sees after startup is a FIN from an earlier (improperly terminated) session, it locks up. I have that on my list now that I'm heading back into ktcp improvements.

I've also found cases (outbound file transfers) in which the ne0 driver will hang hard when the 8 bit ne1k runs with the 16k buffer. Which doesn't make much sense since outbound should be easy on the buffer, but then there are the ACKs. In any case, it's also on my list.

-M

@Mellvik Mellvik mentioned this pull request Dec 6, 2022
@ghaerr
Copy link
Owner

ghaerr commented Dec 8, 2022

Hello @Mellvik,

If the first packet ktcp sees after startup is a FIN from an earlier (improperly terminated) session, it locks up.

I haven't looked at any code for this yet, but thinking that perhaps ktcp isn't checking the sequence number before processing the FIN. There a number of "optimizations" ktcp takes that might contribute to problems like this. The "optimizations" aren't technically legal and may have be a result of trying to keep ktcp quite small. This might help you as you're looking at tcpdump logs! Other possibilities include changing the count-down timers back to more normal levels.

Thank you!

@Mellvik
Copy link
Contributor Author

Mellvik commented Dec 8, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants