1 /* $NetBSD: if_qn.c,v 1.34 2009/05/19 18:39:26 phx Exp $ */
4 * Copyright (c) 1995 Mika Kortelainen
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by Mika Kortelainen
18 * 4. The name of the author may not be used to endorse or promote products
19 * derived from this software without specific prior written permission
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 * Thanks for Aspecs Oy (Finland) for the data book for the NIC used
33 * in this card and also many thanks for the Resource Management Force
34 * (QuickNet card manufacturer) and especially Daniel Koch for providing
35 * me with the necessary 'inside' information to write the driver.
37 * This is partly based on other code:
38 * - if_ed.c: basic function structure for Ethernet driver and now also
39 * qn_put() is done similarly, i.e. no extra packet buffers.
41 * Device driver for National Semiconductor DS8390/WD83C690 based ethernet
44 * Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved.
46 * Copyright (C) 1993, David Greenman. This software may be used,
47 * modified, copied, distributed, and sold, in both source and binary
48 * form provided that the above copyright and these terms are retained.
49 * Under no circumstances is the author responsible for the proper
50 * functioning of this software, nor does the author assume any
51 * responsibility for damages incurred with its use.
53 * - if_es.c: used as an example of -current driver
55 * Copyright (c) 1995 Michael L. Hitch
56 * All rights reserved.
58 * - if_fe.c: some ideas for error handling for qn_rint() which might
59 * have fixed those random lock ups, too.
61 * All Rights Reserved, Copyright (C) Fujitsu Limited 1995
65 * - add multicast support
68 #include <sys/cdefs.h>
69 __KERNEL_RCSID(0, "$NetBSD: if_qn.c,v 1.34 2009/05/19 18:39:26 phx Exp $");
75 #define QN_DEBUG1_no /* hides some old tests */
76 #define QN_CHECKS_no /* adds some checks (not needed in normal situations) */
81 * Fujitsu MB86950 Ethernet Controller (as used in the QuickNet QN2000
88 #include <sys/param.h>
89 #include <sys/systm.h>
92 #include <sys/device.h>
93 #include <sys/protosw.h>
94 #include <sys/socket.h>
95 #include <sys/syslog.h>
96 #include <sys/ioctl.h>
97 #include <sys/errno.h>
100 #include <net/if_dl.h>
101 #include <net/if_ether.h>
104 #include <netinet/in.h>
105 #include <netinet/in_systm.h>
106 #include <netinet/in_var.h>
107 #include <netinet/ip.h>
108 #include <netinet/if_inarp.h>
112 #include <netns/ns.h>
113 #include <netns/ns_if.h>
116 #include <machine/cpu.h>
117 #include <amiga/amiga/device.h>
118 #include <amiga/amiga/isr.h>
119 #include <amiga/dev/zbusvar.h>
120 #include <amiga/dev/if_qnreg.h>
123 #define NIC_R_MASK (R_INT_PKT_RDY | R_INT_ALG_ERR |\
124 R_INT_CRC_ERR | R_INT_OVR_FLO)
125 #define MAX_PACKETS 30 /* max number of packets read per interrupt */
128 * Ethernet software status per interface
130 * Each interface is referenced by a network interface structure,
131 * qn_if, which the routing code uses to locate the interface.
132 * This structure contains the output queue for the interface, its address, ...
135 struct device sc_dev
;
137 struct ethercom sc_ethercom
; /* Common ethernet structures */
138 u_char
volatile *sc_base
;
139 u_char
volatile *sc_nic_base
;
140 u_short
volatile *nic_fifo
;
141 u_short
volatile *nic_r_status
;
142 u_short
volatile *nic_t_status
;
143 u_short
volatile *nic_r_mask
;
144 u_short
volatile *nic_t_mask
;
145 u_short
volatile *nic_r_mode
;
146 u_short
volatile *nic_t_mode
;
147 u_short
volatile *nic_reset
;
148 u_short
volatile *nic_len
;
149 u_char transmit_pending
;
157 #include <net/bpfdesc.h>
161 int qnmatch(struct device
*, struct cfdata
*, void *);
162 void qnattach(struct device
*, struct device
*, void *);
164 int qnioctl(struct ifnet
*, u_long
, void *);
165 void qnstart(struct ifnet
*);
166 void qnwatchdog(struct ifnet
*);
167 void qnreset(struct qn_softc
*);
168 void qninit(struct qn_softc
*);
169 void qnstop(struct qn_softc
*);
170 static u_short
qn_put(u_short
volatile *, struct mbuf
*);
171 static void qn_rint(struct qn_softc
*, u_short
);
172 static void qn_flush(struct qn_softc
*);
173 static void inline word_copy_from_card(u_short
volatile *, u_short
*, u_short
);
174 static void inline word_copy_to_card(u_short
*, u_short
volatile *,
176 static void qn_get_packet(struct qn_softc
*, u_short
);
178 static void qn_dump(struct qn_softc
*);
181 CFATTACH_DECL(qn
, sizeof(struct qn_softc
),
182 qnmatch
, qnattach
, NULL
, NULL
);
185 qnmatch(struct device
*parent
, struct cfdata
*cfp
, void *aux
)
187 struct zbus_args
*zap
;
189 zap
= (struct zbus_args
*)aux
;
191 /* RMF QuickNet QN2000 EtherNet card */
192 if (zap
->manid
== 2011 && zap
->prodid
== 2)
199 * Interface exists: make available by filling in network interface
200 * record. System will initialize the interface when it is ready
204 qnattach(struct device
*parent
, struct device
*self
, void *aux
)
206 struct zbus_args
*zap
;
207 struct qn_softc
*sc
= (struct qn_softc
*)self
;
208 struct ifnet
*ifp
= &sc
->sc_ethercom
.ec_if
;
209 u_int8_t myaddr
[ETHER_ADDR_LEN
];
211 zap
= (struct zbus_args
*)aux
;
213 sc
->sc_base
= zap
->va
;
214 sc
->sc_nic_base
= sc
->sc_base
+ QUICKNET_NIC_BASE
;
215 sc
->nic_fifo
= (u_short
volatile *)(sc
->sc_nic_base
+ NIC_BMPR0
);
216 sc
->nic_len
= (u_short
volatile *)(sc
->sc_nic_base
+ NIC_BMPR2
);
217 sc
->nic_t_status
= (u_short
volatile *)(sc
->sc_nic_base
+ NIC_DLCR0
);
218 sc
->nic_r_status
= (u_short
volatile *)(sc
->sc_nic_base
+ NIC_DLCR2
);
219 sc
->nic_t_mask
= (u_short
volatile *)(sc
->sc_nic_base
+ NIC_DLCR1
);
220 sc
->nic_r_mask
= (u_short
volatile *)(sc
->sc_nic_base
+ NIC_DLCR3
);
221 sc
->nic_t_mode
= (u_short
volatile *)(sc
->sc_nic_base
+ NIC_DLCR4
);
222 sc
->nic_r_mode
= (u_short
volatile *)(sc
->sc_nic_base
+ NIC_DLCR5
);
223 sc
->nic_reset
= (u_short
volatile *)(sc
->sc_nic_base
+ NIC_DLCR6
);
224 sc
->transmit_pending
= 0;
227 * The ethernet address of the board (1st three bytes are the vendor
228 * address, the rest is the serial number of the board).
233 myaddr
[3] = (zap
->serno
>> 16) & 0xff;
234 myaddr
[4] = (zap
->serno
>> 8) & 0xff;
235 myaddr
[5] = zap
->serno
& 0xff;
237 /* set interface to stopped condition (reset) */
240 memcpy(ifp
->if_xname
, sc
->sc_dev
.dv_xname
, IFNAMSIZ
);
242 ifp
->if_ioctl
= qnioctl
;
243 ifp
->if_watchdog
= qnwatchdog
;
244 ifp
->if_start
= qnstart
;
245 /* XXX IFF_MULTICAST */
246 ifp
->if_flags
= IFF_BROADCAST
| IFF_SIMPLEX
| IFF_NOTRAILERS
;
247 ifp
->if_mtu
= ETHERMTU
;
249 /* Attach the interface. */
251 ether_ifattach(ifp
, myaddr
);
254 printf(": hardware address %s\n", ether_sprintf(myaddr
));
257 sc
->sc_isr
.isr_intr
= qnintr
;
258 sc
->sc_isr
.isr_arg
= sc
;
259 sc
->sc_isr
.isr_ipl
= 2;
260 add_isr(&sc
->sc_isr
);
268 qninit(struct qn_softc
*sc
)
270 struct ifnet
*ifp
= &sc
->sc_ethercom
.ec_if
;
272 static int retry
= 0;
274 *sc
->nic_r_mask
= NIC_R_MASK
;
275 *sc
->nic_t_mode
= NO_LOOPBACK
;
277 if (sc
->sc_ethercom
.ec_if
.if_flags
& IFF_PROMISC
) {
278 *sc
->nic_r_mode
= PROMISCUOUS_MODE
;
279 log(LOG_INFO
, "qn: Promiscuous mode (not tested)\n");
281 *sc
->nic_r_mode
= NORMAL_MODE
;
283 /* Set physical ethernet address. */
284 for (i
= 0; i
< ETHER_ADDR_LEN
; i
++)
285 *((u_short
volatile *)(sc
->sc_nic_base
+
286 QNET_HARDWARE_ADDRESS
+2*i
)) =
287 ((((u_short
)CLLADDR(ifp
->if_sadl
)[i
]) << 8) |
288 CLLADDR(ifp
->if_sadl
)[i
]);
290 ifp
->if_flags
|= IFF_RUNNING
;
291 ifp
->if_flags
&= ~IFF_OACTIVE
;
292 sc
->transmit_pending
= 0;
296 /* QuickNet magic. Done ONLY once, otherwise a lockup occurs. */
298 *((u_short
volatile *)(sc
->sc_nic_base
+ QNET_MAGIC
)) = 0;
302 /* Enable data link controller. */
303 *sc
->nic_reset
= ENABLE_DLC
;
305 /* Attempt to start output, if any. */
310 * Device timeout/watchdog routine. Entered if the device neglects to
311 * generate an interrupt after a transmit has been started on it.
314 qnwatchdog(struct ifnet
*ifp
)
316 struct qn_softc
*sc
= ifp
->if_softc
;
318 log(LOG_INFO
, "qn: device timeout (watchdog)\n");
319 ++sc
->sc_ethercom
.ec_if
.if_oerrors
;
325 * Flush card's buffer RAM.
328 qn_flush(struct qn_softc
*sc
)
331 /* Read data until bus read error (i.e. buffer empty). */
332 while (!(*sc
->nic_r_status
& R_BUS_RD_ERR
))
333 (void)(*sc
->nic_fifo
);
335 /* Read data twice to clear some internal pipelines. */
336 (void)(*sc
->nic_fifo
);
337 (void)(*sc
->nic_fifo
);
340 /* Clear bus read error. */
341 *sc
->nic_r_status
= R_BUS_RD_ERR
;
345 * Reset the interface.
349 qnreset(struct qn_softc
*sc
)
360 * Take interface offline.
363 qnstop(struct qn_softc
*sc
)
366 /* Stop the interface. */
367 *sc
->nic_reset
= DISABLE_DLC
;
369 *sc
->nic_t_status
= CLEAR_T_ERR
;
370 *sc
->nic_t_mask
= CLEAR_T_MASK
;
371 *sc
->nic_r_status
= CLEAR_R_ERR
;
372 *sc
->nic_r_mask
= CLEAR_R_MASK
;
375 *((u_short
volatile *)(sc
->sc_nic_base
+ NIC_BMPR4
)) = 0;
377 /* Accept no packets. */
385 * Start output on interface. Get another datagram to send
386 * off the interface queue, and copy it to the
387 * interface before starting the output.
389 * This assumes that it is called inside a critical section...
393 qnstart(struct ifnet
*ifp
)
395 struct qn_softc
*sc
= ifp
->if_softc
;
401 if ((ifp
->if_flags
& (IFF_RUNNING
| IFF_OACTIVE
)) != IFF_RUNNING
)
404 IF_DEQUEUE(&ifp
->if_snd
, m
);
410 * If bpf is listening on this interface, let it
411 * see the packet before we commit it to the wire
413 * (can't give the copy in QuickNet card RAM to bpf, because
414 * that RAM is not visible to the host but is read from FIFO)
418 bpf_mtap(sc
->sc_bpf
, m
);
420 len
= qn_put(sc
->nic_fifo
, m
);
424 * Really transmit the packet.
427 /* Set packet length (byte-swapped). */
428 len
= ((len
>> 8) & 0x0007) | TRANSMIT_START
| ((len
& 0x00ff) << 8);
431 /* Wait for the packet to really leave. */
432 while (!(*sc
->nic_t_status
& T_TMT_OK
) && --timout
) {
433 if ((timout
% 10000) == 0)
434 log(LOG_INFO
, "qn: timout...\n");
438 /* Maybe we should try to recover from this one? */
439 /* But now, let's just fall thru and hope the best... */
440 log(LOG_INFO
, "qn: transmit timout (fatal?)\n");
442 sc
->transmit_pending
= 1;
443 *sc
->nic_t_mask
= INT_TMT_OK
| INT_SIXTEEN_COL
;
445 ifp
->if_flags
|= IFF_OACTIVE
;
450 * Memory copy, copies word at a time
453 word_copy_from_card(u_short
volatile *card
, u_short
*b
, u_short len
)
455 register u_short l
= len
/2;
462 word_copy_to_card(u_short
*a
, u_short
volatile *card
, register u_short len
)
464 /*register u_short l = len/2;*/
471 * Copy packet from mbuf to the board memory
475 qn_put(u_short
volatile *addr
, struct mbuf
*m
)
479 int len
, len1
, wantbyte
;
482 totlen
= wantbyte
= 0;
484 for (; m
!= NULL
; m
= m
->m_next
) {
485 data
= mtod(m
, u_short
*);
490 /* Finish the last word. */
492 savebyte
[1] = *((u_char
*)data
);
493 *addr
= *((u_short
*)savebyte
);
494 data
= (u_short
*)((u_char
*)data
+ 1);
498 /* Output contiguous words. */
501 word_copy_to_card(data
, addr
, len1
);
505 /* Save last byte, if necessary. */
507 savebyte
[0] = *((u_char
*)data
);
515 *addr
= *((u_short
*)savebyte
);
518 if(totlen
< (ETHER_MIN_LEN
- ETHER_CRC_LEN
)) {
520 * Fill the rest of the packet with zeros.
521 * N.B.: This is required! Otherwise MB86950 fails.
523 for(len
= totlen
+ 1; len
< (ETHER_MIN_LEN
- ETHER_CRC_LEN
);
525 *addr
= (u_short
)0x0000;
526 totlen
= (ETHER_MIN_LEN
- ETHER_CRC_LEN
);
533 * Copy packet from board RAM.
535 * Trailers not supported.
539 qn_get_packet(struct qn_softc
*sc
, u_short len
)
541 register u_short
volatile *nic_fifo_ptr
= sc
->nic_fifo
;
542 struct ifnet
*ifp
= &sc
->sc_ethercom
.ec_if
;
543 struct mbuf
*m
, *dst
, *head
= NULL
;
544 register u_short len1
;
547 /* Allocate header mbuf. */
548 MGETHDR(m
, M_DONTWAIT
, MT_DATA
);
553 * Round len to even value.
558 m
->m_pkthdr
.rcvif
= &sc
->sc_ethercom
.ec_if
;
559 m
->m_pkthdr
.len
= len
;
563 word_copy_from_card(nic_fifo_ptr
,
564 mtod(head
, u_short
*),
565 sizeof(struct ether_header
));
567 head
->m_len
+= sizeof(struct ether_header
);
568 len
-= sizeof(struct ether_header
);
573 amount
= M_TRAILINGSPACE(m
);
575 /* Allocate another mbuf. */
577 MGET(m
, M_DONTWAIT
, MT_DATA
);
581 if (len1
>= MINCLSIZE
)
582 MCLGET(m
, M_DONTWAIT
);
587 amount
= M_TRAILINGSPACE(m
);
593 word_copy_from_card(nic_fifo_ptr
,
594 (u_short
*)(mtod(m
, char *) + m
->m_len
),
602 bpf_mtap(sc
->sc_bpf
, head
);
605 (*ifp
->if_input
)(ifp
, head
);
611 log(LOG_INFO
, "qn_get_packet: mbuf alloc failed\n");
616 * Ethernet interface receiver interrupt.
619 qn_rint(struct qn_softc
*sc
, u_short rstat
)
624 /* Clear the status register. */
625 *sc
->nic_r_status
= CLEAR_R_ERR
;
628 * Was there some error?
629 * Some of them are senseless because they are masked off.
632 if (rstat
& R_INT_OVR_FLO
) {
634 log(LOG_INFO
, "Overflow\n");
636 ++sc
->sc_ethercom
.ec_if
.if_ierrors
;
638 if (rstat
& R_INT_CRC_ERR
) {
640 log(LOG_INFO
, "CRC Error\n");
642 ++sc
->sc_ethercom
.ec_if
.if_ierrors
;
644 if (rstat
& R_INT_ALG_ERR
) {
646 log(LOG_INFO
, "Alignment error\n");
648 ++sc
->sc_ethercom
.ec_if
.if_ierrors
;
650 if (rstat
& R_INT_SRT_PKT
) {
651 /* Short packet (these may occur and are
652 * no reason to worry about - or maybe
656 log(LOG_INFO
, "Short packet\n");
658 ++sc
->sc_ethercom
.ec_if
.if_ierrors
;
660 if (rstat
& 0x4040) {
662 log(LOG_INFO
, "Bus read error\n");
664 ++sc
->sc_ethercom
.ec_if
.if_ierrors
;
669 * Read at most MAX_PACKETS packets per interrupt
671 for (i
= 0; i
< MAX_PACKETS
; i
++) {
672 if (*sc
->nic_r_mode
& RM_BUF_EMP
)
677 * Read the first word: upper byte contains useful
680 status
= *sc
->nic_fifo
;
681 if ((status
& 0x7000) != 0x2000) {
682 log(LOG_INFO
, "qn: ERROR: status=%04x\n", status
);
687 * Read packet length (byte-swapped).
688 * CRC is stripped off by the NIC.
691 len
= ((len
<< 8) & 0xff00) | ((len
>> 8) & 0x00ff);
694 if (len
> (ETHER_MAX_LEN
- ETHER_CRC_LEN
) ||
695 len
< ETHER_HDR_LEN
) {
697 "%s: received a %s packet? (%u bytes)\n",
699 len
< ETHER_HDR_LEN
? "partial" : "big", len
);
700 ++sc
->sc_ethercom
.ec_if
.if_ierrors
;
705 if (len
< (ETHER_MIN_LEN
- ETHER_CRC_LEN
))
707 "%s: received a short packet? (%u bytes)\n",
708 sc
->sc_dev
.dv_xname
, len
);
711 /* Read the packet. */
712 qn_get_packet(sc
, len
);
714 ++sc
->sc_ethercom
.ec_if
.if_ipackets
;
718 /* This print just to see whether MAX_PACKETS is large enough. */
719 if (i
== MAX_PACKETS
)
720 log(LOG_INFO
, "used all the %d loops\n", MAX_PACKETS
);
725 * Our interrupt routine
730 struct qn_softc
*sc
= arg
;
731 u_short tint
, rint
, tintmask
;
732 char return_tintmask
= 0;
735 * If the driver has not been initialized, just return immediately.
736 * This also happens if there is no QuickNet board present.
738 if (sc
->sc_base
== NULL
)
741 /* Get interrupt statuses and masks. */
742 rint
= (*sc
->nic_r_status
) & NIC_R_MASK
;
743 tintmask
= *sc
->nic_t_mask
;
744 tint
= (*sc
->nic_t_status
) & tintmask
;
745 if (tint
== 0 && rint
== 0)
748 /* Disable interrupts so that we won't miss anything. */
749 *sc
->nic_r_mask
= CLEAR_R_MASK
;
750 *sc
->nic_t_mask
= CLEAR_T_MASK
;
753 * Handle transmitter interrupts. Some of them are not asked for
754 * but do happen, anyway.
758 /* Clear transmit interrupt status. */
759 *sc
->nic_t_status
= CLEAR_T_ERR
;
761 if (sc
->transmit_pending
&& (tint
& T_TMT_OK
)) {
762 sc
->transmit_pending
= 0;
764 * Update total number of successfully
765 * transmitted packets.
767 sc
->sc_ethercom
.ec_if
.if_opackets
++;
770 if (tint
& T_SIXTEEN_COL
) {
772 * 16 collision (i.e., packet lost).
774 log(LOG_INFO
, "qn: 16 collision - packet lost\n");
778 sc
->sc_ethercom
.ec_if
.if_oerrors
++;
779 sc
->sc_ethercom
.ec_if
.if_collisions
+= 16;
780 sc
->transmit_pending
= 0;
783 if (sc
->transmit_pending
) {
784 log(LOG_INFO
, "qn:still pending...\n");
786 /* Must return transmission interrupt mask. */
789 sc
->sc_ethercom
.ec_if
.if_flags
&= ~IFF_OACTIVE
;
791 /* Clear watchdog timer. */
792 sc
->sc_ethercom
.ec_if
.if_timer
= 0;
798 * Handle receiver interrupts.
803 if ((sc
->sc_ethercom
.ec_if
.if_flags
& IFF_OACTIVE
) == 0)
804 qnstart(&sc
->sc_ethercom
.ec_if
);
805 else if (return_tintmask
== 1)
806 *sc
->nic_t_mask
= tintmask
;
808 /* Set receive interrupt mask back. */
809 *sc
->nic_r_mask
= NIC_R_MASK
;
815 * Process an ioctl request. This code needs some work - it looks pretty ugly.
816 * I somehow think that this is quite a common excuse... ;-)
819 qnioctl(register struct ifnet
*ifp
, u_long cmd
, void *data
)
821 struct qn_softc
*sc
= ifp
->if_softc
;
822 register struct ifaddr
*ifa
= (struct ifaddr
*)data
;
824 struct ifreg
*ifr
= (struct ifreg
*)data
;
833 ifp
->if_flags
|= IFF_UP
;
835 switch (ifa
->ifa_addr
->sa_family
) {
840 arp_ifinit(ifp
, ifa
);
846 register struct ns_addr
*ina
= &(IA_SNS(ifa
)->sns_addr
);
848 if (ns_nullhost(*ina
))
850 *(union ns_host
*)LLADDR(ifp
->if_sadl
);
852 bcopy(ina
->x_host
.c_host
,
853 LLADDR(ifp
->if_sadl
), ETHER_ADDR_LEN
);
860 log(LOG_INFO
, "qn:sa_family:default (not tested)\n");
868 if ((error
= ifioctl_common(ifp
, cmd
, data
)) != 0)
870 /* XXX see the comment in ed_ioctl() about code re-use */
871 if ((ifp
->if_flags
& IFF_UP
) == 0 &&
872 (ifp
->if_flags
& IFF_RUNNING
) != 0) {
874 * If interface is marked down and it is running, then
881 ifp
->if_flags
&= ~IFF_RUNNING
;
882 } else if ((ifp
->if_flags
& IFF_UP
) != 0 &&
883 (ifp
->if_flags
& IFF_RUNNING
) == 0) {
885 * If interface is marked up and it is stopped, then
891 * Something else... we won't do anything so we won't
892 * break anything (hope so).
895 log(LOG_INFO
, "Else branch...\n");
902 log(LOG_INFO
, "qnioctl: multicast not done yet\n");
904 if ((error
= ether_ioctl(ifp
, cmd
, data
)) == ENETRESET
) {
906 * Multicast list has changed; set the hardware filter
909 log(LOG_INFO
, "qnioctl: multicast not done yet\n");
918 error
= ether_ioctl(ifp
, cmd
, data
);
926 * Dump some register information.
930 qn_dump(struct qn_softc
*sc
)
933 log(LOG_INFO
, "t_status : %04x\n", *sc
->nic_t_status
);
934 log(LOG_INFO
, "t_mask : %04x\n", *sc
->nic_t_mask
);
935 log(LOG_INFO
, "t_mode : %04x\n", *sc
->nic_t_mode
);
936 log(LOG_INFO
, "r_status : %04x\n", *sc
->nic_r_status
);
937 log(LOG_INFO
, "r_mask : %04x\n", *sc
->nic_r_mask
);
938 log(LOG_INFO
, "r_mode : %04x\n", *sc
->nic_r_mode
);
939 log(LOG_INFO
, "pending : %02x\n", sc
->transmit_pending
);
940 log(LOG_INFO
, "if_flags : %04x\n", sc
->sc_ethercom
.ec_if
.if_flags
);