Subject: scsi ethernet support in current kernel
To: None <port-pc532@NetBSD.ORG>
From: Ian Dall <Ian.Dall@dsto.defence.gov.au>
List: port-pc532
Date: 03/22/1997 17:08:53
There is now in-kernel support for the EA412/4/9 scsi ethernet adaptors.

Unfortunately, a small bug was introduced when Jason "sanitized" my code
(removed a reliance on a gcc extension), resulting in the stack being
corrupted.

You can apply the small patch attached if you want to give it a try.

The in kernel support has some advantages. There is a noticable
performance improvement, and the bpf code works, which gives you rarp
and tcpdump, for example. The driver supports /dev/se as well as a
network interface.  That means you can use the old etherd program with
se0 instead of uk0.  Don't use it both ways simultaneously though! The
idea of this is to facilitate printing statistics and downloading code
--- functions which are not supported via the ifconfig interface.

Here are some performance figures. Performance may have been limited
by the other end, a sun3 not known as a speed deamon!

Running on pc532:

  spray sun3

    10% dropped packets, 145 pps tx, 130 pps rx 10.9 kB/s

    I presume the dropped packets are the fault of the sun.


  spray -l 1500 sun3

    254.8 kB/sec no dropped packets


  ftp: get /usr/share/misc/termcap /dev/null

    203.2 kB/sec

  ftp: put /usr/share/misc/termcap /dev/null

    227.3 kB/sec


Running on sun3:

  spray pc532

    27.5 kB/s no dropped packets

  spray -l 1500 pc532

    243.0 kB/s no dropped packets


  ftp: get /usr/share/misc/termcap /dev/null

    256.4 kB/s

  ftp: put /usr/share/misc/termcap /dev/null

    184.0 kB/s


Enjoy!

Ian




diff -ru ../../src/sys/scsi/if_se.c ./scsi/if_se.c
--- ../../src/sys/scsi/if_se.c	Tue Mar 18 22:22:01 1997
+++ ./scsi/if_se.c	Sat Mar 22 15:53:00 1997
@@ -132,20 +132,26 @@
 int se_poll0 = 0;
 
 #define	PROTOCMD(p, d) \
-	bcopy(&(p), &(d), sizeof(struct scsi_ctron_ether_generic))
+	((d) = (p))
 
 #define	PROTOCMD_DECL(name, val) \
 	static const struct scsi_ctron_ether_generic name = val
 
+#define	PROTOCMD_DECL_SPECIAL(name, val) \
+	static const struct __CONCAT(scsi_,name) name = val
+
+/* Command initializers for commands using scsi_ctron_ether_generic */
 PROTOCMD_DECL(ctron_ether_send, {CTRON_ETHER_SEND});
-PROTOCMD_DECL(ctron_ether_recv, {CTRON_ETHER_RECV});
 PROTOCMD_DECL(ctron_ether_add_proto, {CTRON_ETHER_ADD_PROTO});
 PROTOCMD_DECL(ctron_ether_get_addr, {CTRON_ETHER_GET_ADDR});
 PROTOCMD_DECL(ctron_ether_set_media, {CTRON_ETHER_SET_MEDIA});
-PROTOCMD_DECL(ctron_ether_set_mode, {CTRON_ETHER_SET_MODE});
 PROTOCMD_DECL(ctron_ether_set_addr, {CTRON_ETHER_SET_ADDR});
 PROTOCMD_DECL(ctron_ether_set_multi, {CTRON_ETHER_SET_MULTI});
 PROTOCMD_DECL(ctron_ether_remove_multi, {CTRON_ETHER_REMOVE_MULTI});
+
+/* Command initializers for commands using their own structures */
+PROTOCMD_DECL_SPECIAL(ctron_ether_recv, {CTRON_ETHER_RECV});
+PROTOCMD_DECL_SPECIAL(ctron_ether_set_mode, {CTRON_ETHER_SET_MODE});
 
 struct se_softc {
 	struct device sc_dev;
diff -ru ../../src/sys/scsi/scsi_ctron_ether.h ./scsi/scsi_ctron_ether.h
--- ../../src/sys/scsi/scsi_ctron_ether.h	Tue Mar 18 22:22:01 1997
+++ ./scsi/scsi_ctron_ether.h	Sat Mar 22 15:53:43 1997
@@ -14,7 +14,7 @@
 
 #define CTRON_ETHERCMD2(OP, SUB) {OP, SUB}
 #define CTRON_ETHER_SEND CTRON_ETHERCMD2(0xc, 0x1)
-#define CTRON_ETHER_RECV {0xe1, 0}
+#define CTRON_ETHER_RECV 0xe1
 #define CTRON_ETHER_GET_ADDR CTRON_ETHERCMD2(0xc, 0x4)
 #define CTRON_ETHER_ADD_PROTO CTRON_ETHERCMD2(0xd, 0x1)
 #define CTRON_ETHER_REM_PROTO CTRON_ETHERCMD2(0xd, 0x2)