/* $NetBSD: if_sn.c,v 1.7 1997/03/20 17:47:51 scottr Exp $ */
-/* $OpenBSD: if_sn.c,v 1.21 1997/04/18 11:58:34 briggs Exp $ */
+/* $OpenBSD: if_sn.c,v 1.22 1997/04/25 03:29:15 briggs Exp $ */
/*
* National Semiconductor SONIC Driver
p = (unsigned char *)SOALIGN(sc, p);
- for (i = 0; i < NRDA; i++) {
- sc->p_rda[i] = (void *) p;
- sc->v_rda[i] = kvtop(p);
- p += RXPKT_SIZE(sc);
- }
-
- p = (unsigned char *)SOALIGN(sc, p);
-
for (i = 0; i < NTDA; i++) {
struct mtd *mtdp = &sc->mtda[i];
mtdp->mtd_txp = (void *)p;
if ((p - pp) > NBPG) {
printf ("%s: sizeof RRA (%ld) + CDA (%ld) +"
- "RDA (%ld) + TDA (%ld) > NBPG (%d). Punt!\n",
+ "TDA (%ld) > NBPG (%d). Punt!\n",
sc->sc_dev.dv_xname,
(ulong)sc->p_cda - (ulong)sc->p_rra[0],
- (ulong)sc->p_rda[0] - (ulong)sc->p_cda,
- (ulong)sc->mtda[0].mtd_txp - (ulong)sc->p_rda[0],
+ (ulong)sc->mtda[0].mtd_txp - (ulong)sc->p_cda,
(ulong)p - (ulong)sc->mtda[0].mtd_txp,
NBPG);
return(1);
}
+ p = pp + NBPG;
+ pp = p;
+
+ if ((NRDA * RXPKT_SIZE(sc)) > NBPG) {
+ printf ("%s: sizeof NRDA (%d) > NBPG (%d). Punt!\n",
+ sc->sc_dev.dv_xname,
+ NRDA * RXPKT_SIZE(sc), NBPG);
+ return (1);
+ }
+
+ for (i = 0; i < NRDA; i++) {
+ sc->p_rda[i] = (void *) p;
+ sc->v_rda[i] = kvtop(p);
+ p += RXPKT_SIZE(sc);
+ }
+
+ p = (unsigned char *)SOALIGN(sc, p);
+
p = pp + NBPG;
for (i = 0; i < NRBA; i++) {
-/* $OpenBSD: if_snvar.h,v 1.6 1997/04/23 00:28:22 gene Exp $ */
+/* $OpenBSD: if_snvar.h,v 1.7 1997/04/25 03:29:14 briggs Exp $ */
/*
* Copyright (c) 1991 Algorithmics Ltd (http://www.algor.co.uk)
/*
* buffer sizes in 32 bit mode
- * 1 TXpkt is 4 hdr words + (3 * FRAGMAX) + 1 link word
- * FRAGMAX == 16 => 54 words == 216 bytes
+ * 1 TXpkt is 4 hdr words + (3 * FRAGMAX) + 1 link word == 23 words == 92 bytes
*
* 1 RxPkt is 7 words == 28 bytes
* 1 Rda is 4 words == 16 bytes
+ *
+ * The CDA is 17 words == 68 bytes
+ *
+ * total space in page 0 = NTDA * 92 + NRRA * 16 + NRDA * 28 + 68
*/
#define NRBA 8 /* # receive buffers < NRRA */
#define RBAMASK (NRBA-1)
-#define NRDA NRBA*4
-#define NTDA 4 /* # transmit descriptors */
-#define NRRA 32 /* # receive resource descriptors */
-#define RRAMASK (NRRA-1) /* the reason why it must be power of two */
+#define NRDA 146
+#define NTDA 8 /* # transmit descriptors */
+#define NRRA 16 /* # receive resource descriptors */
+#define RRAMASK (NRRA-1) /* the reason why NRRA must be power of two */
#define FCSSIZE 4 /* size of FCS appended to packets */
/*
* transmit buffer area
*/
-#define NTXB 10 /* Number of xmit buffers */
+#define NTXB NTDA /* Number of xmit buffers */
#define TXBSIZE 1536 /* 6*2^8 -- the same size as the 8390 TXBUF */
-#define SN_NPAGES 1 + 8 + 5
+#define SN_NPAGES 2 + 8 + 4
/*
* Statistics collected over time