1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /******************************************************************************
4 * (C)Copyright 1998,1999 SysKonnect,
5 * a business unit of Schneider & Koch & Co. Datensysteme GmbH.
7 * See the file "skfddi.c" for further information.
9 * The information in this file is provided "AS IS" without warranty.
11 ******************************************************************************/
14 static char const ID_sccs
[] = "@(#)hwmtm.c 1.40 99/05/31 (C) SK" ;
26 #include "h/supern_2.h"
27 #include "h/skfbiinc.h"
30 -------------------------------------------------------------
32 -------------------------------------------------------------
33 BEGIN_MANUAL_ENTRY(DOCUMENTATION)
40 -------------------------------------------------------------
42 -------------------------------------------------------------
45 static SMbuf
*mb_start
= 0 ;
46 static SMbuf
*mb_free
= 0 ;
47 static int mb_init
= FALSE
;
48 static int call_count
= 0 ;
52 -------------------------------------------------------------
54 -------------------------------------------------------------
59 extern struct smt_debug debug
;
64 extern u_char offDepth
;
65 extern u_char force_irq_pending
;
69 -------------------------------------------------------------
71 -------------------------------------------------------------
74 static void queue_llc_rx(struct s_smc
*smc
, SMbuf
*mb
);
75 static void smt_to_llc(struct s_smc
*smc
, SMbuf
*mb
);
76 static void init_txd_ring(struct s_smc
*smc
);
77 static void init_rxd_ring(struct s_smc
*smc
);
78 static void queue_txd_mb(struct s_smc
*smc
, SMbuf
*mb
);
79 static u_long
init_descr_ring(struct s_smc
*smc
, union s_fp_descr
volatile *start
,
81 static u_long
repair_txd_ring(struct s_smc
*smc
, struct s_smt_tx_queue
*queue
);
82 static u_long
repair_rxd_ring(struct s_smc
*smc
, struct s_smt_rx_queue
*queue
);
83 static SMbuf
* get_llc_rx(struct s_smc
*smc
);
84 static SMbuf
* get_txd_mb(struct s_smc
*smc
);
85 static void mac_drv_clear_txd(struct s_smc
*smc
);
88 -------------------------------------------------------------
90 -------------------------------------------------------------
92 /* The external SMT functions are listed in cmtdef.h */
94 extern void* mac_drv_get_space(struct s_smc
*smc
, unsigned int size
);
95 extern void* mac_drv_get_desc_mem(struct s_smc
*smc
, unsigned int size
);
96 extern void mac_drv_fill_rxd(struct s_smc
*smc
);
97 extern void mac_drv_tx_complete(struct s_smc
*smc
,
98 volatile struct s_smt_fp_txd
*txd
);
99 extern void mac_drv_rx_complete(struct s_smc
*smc
,
100 volatile struct s_smt_fp_rxd
*rxd
,
101 int frag_count
, int len
);
102 extern void mac_drv_requeue_rxd(struct s_smc
*smc
,
103 volatile struct s_smt_fp_rxd
*rxd
,
105 extern void mac_drv_clear_rxd(struct s_smc
*smc
,
106 volatile struct s_smt_fp_rxd
*rxd
, int frag_count
);
109 extern void hwm_cpy_rxd2mb(void);
110 extern void hwm_cpy_txd2mb(void);
113 #ifdef ALL_RX_COMPLETE
114 extern void mac_drv_all_receives_complete(void);
117 extern u_long
mac_drv_virt2phys(struct s_smc
*smc
, void *virt
);
118 extern u_long
dma_master(struct s_smc
*smc
, void *virt
, int len
, int flag
);
121 extern void post_proc(void);
123 extern void dma_complete(struct s_smc
*smc
, volatile union s_fp_descr
*descr
,
127 extern int mac_drv_rx_init(struct s_smc
*smc
, int len
, int fc
, char *look_ahead
,
131 -------------------------------------------------------------
133 -------------------------------------------------------------
135 void process_receive(struct s_smc
*smc
);
136 void fddi_isr(struct s_smc
*smc
);
137 void smt_free_mbuf(struct s_smc
*smc
, SMbuf
*mb
);
138 void init_driver_fplus(struct s_smc
*smc
);
139 void mac_drv_rx_mode(struct s_smc
*smc
, int mode
);
140 void init_fddi_driver(struct s_smc
*smc
, u_char
*mac_addr
);
141 void mac_drv_clear_tx_queue(struct s_smc
*smc
);
142 void mac_drv_clear_rx_queue(struct s_smc
*smc
);
143 void hwm_tx_frag(struct s_smc
*smc
, char far
*virt
, u_long phys
, int len
,
145 void hwm_rx_frag(struct s_smc
*smc
, char far
*virt
, u_long phys
, int len
,
148 int mac_drv_init(struct s_smc
*smc
);
149 int hwm_tx_init(struct s_smc
*smc
, u_char fc
, int frag_count
, int frame_len
,
152 u_int
mac_drv_check_space(void);
154 SMbuf
* smt_get_mbuf(struct s_smc
*smc
);
157 void mac_drv_debug_lev(struct s_smc
*smc
, int flag
, int lev
);
161 -------------------------------------------------------------
163 -------------------------------------------------------------
167 #define UNUSED(x) (x) = (x)
174 #define MA smc->hw.fddi_canon_addr.a
175 #define GROUP_ADDR_BIT 0x01
177 #define MA smc->hw.fddi_home_addr.a
178 #define GROUP_ADDR_BIT 0x80
181 #define RXD_TXD_COUNT (HWM_ASYNC_TXD_COUNT+HWM_SYNC_TXD_COUNT+\
182 SMT_R1_RXD_COUNT+SMT_R2_RXD_COUNT)
184 #ifdef MB_OUTSIDE_SMC
185 #define EXT_VIRT_MEM ((RXD_TXD_COUNT+1)*sizeof(struct s_smt_fp_txd) +\
186 MAX_MBUF*sizeof(SMbuf))
187 #define EXT_VIRT_MEM_2 ((RXD_TXD_COUNT+1)*sizeof(struct s_smt_fp_txd))
189 #define EXT_VIRT_MEM ((RXD_TXD_COUNT+1)*sizeof(struct s_smt_fp_txd))
193 * define critical read for 16 Bit drivers
195 #if defined(NDIS_OS2) || defined(ODI2)
196 #define CR_READ(var) ((var) & 0xffff0000 | ((var) & 0xffff))
198 #define CR_READ(var) (__le32)(var)
201 #define IMASK_SLOW (IS_PLINT1 | IS_PLINT2 | IS_TIMINT | IS_TOKEN | \
202 IS_MINTR1 | IS_MINTR2 | IS_MINTR3 | IS_R1_P | \
203 IS_R1_C | IS_XA_C | IS_XS_C)
206 -------------------------------------------------------------
207 INIT- AND SMT FUNCTIONS:
208 -------------------------------------------------------------
213 * BEGIN_MANUAL_ENTRY(mac_drv_check_space)
214 * u_int mac_drv_check_space()
216 * function DOWNCALL (drvsr.c)
217 * This function calculates the needed non virtual
218 * memory for MBufs, RxD and TxD descriptors etc.
219 * needed by the driver.
221 * return u_int memory in bytes
225 u_int
mac_drv_check_space(void)
227 #ifdef MB_OUTSIDE_SMC
228 #ifdef COMMON_MB_POOL
230 if (call_count
== 1) {
234 return EXT_VIRT_MEM_2
;
245 * BEGIN_MANUAL_ENTRY(mac_drv_init)
246 * void mac_drv_init(smc)
248 * function DOWNCALL (drvsr.c)
249 * In this function the hardware module allocates it's
251 * The operating system dependent module should call
252 * mac_drv_init once, after the adatper is detected.
255 int mac_drv_init(struct s_smc
*smc
)
257 if (sizeof(struct s_smt_fp_rxd
) % 16) {
258 SMT_PANIC(smc
,HWM_E0001
,HWM_E0001_MSG
) ;
260 if (sizeof(struct s_smt_fp_txd
) % 16) {
261 SMT_PANIC(smc
,HWM_E0002
,HWM_E0002_MSG
) ;
265 * get the required memory for the RxDs and TxDs
267 if (!(smc
->os
.hwm
.descr_p
= (union s_fp_descr
volatile *)
268 mac_drv_get_desc_mem(smc
,(u_int
)
269 (RXD_TXD_COUNT
+1)*sizeof(struct s_smt_fp_txd
)))) {
270 return 1; /* no space the hwm modul can't work */
274 * get the memory for the SMT MBufs
276 #ifndef MB_OUTSIDE_SMC
277 smc
->os
.hwm
.mbuf_pool
.mb_start
=(SMbuf
*)(&smc
->os
.hwm
.mbuf_pool
.mb
[0]) ;
279 #ifndef COMMON_MB_POOL
280 if (!(smc
->os
.hwm
.mbuf_pool
.mb_start
= (SMbuf
*) mac_drv_get_space(smc
,
281 MAX_MBUF
*sizeof(SMbuf
)))) {
282 return 1; /* no space the hwm modul can't work */
286 if (!(mb_start
= (SMbuf
*) mac_drv_get_space(smc
,
287 MAX_MBUF
*sizeof(SMbuf
)))) {
288 return 1; /* no space the hwm modul can't work */
297 * BEGIN_MANUAL_ENTRY(init_driver_fplus)
298 * init_driver_fplus(smc)
300 * Sets hardware modul specific values for the mode register 2
301 * (e.g. the byte alignment for the received frames, the position of the
302 * least significant byte etc.)
305 void init_driver_fplus(struct s_smc
*smc
)
307 smc
->hw
.fp
.mdr2init
= FM_LSB
| FM_BMMODE
| FM_ENNPRQ
| FM_ENHSRQ
| 3 ;
310 smc
->hw
.fp
.mdr2init
|= FM_CHKPAR
| FM_PARITY
;
312 smc
->hw
.fp
.mdr3init
= FM_MENRQAUNLCK
| FM_MENRS
;
315 /* enable address bit swapping */
316 smc
->hw
.fp
.frselreg_init
= FM_ENXMTADSWAP
| FM_ENRCVADSWAP
;
320 static u_long
init_descr_ring(struct s_smc
*smc
,
321 union s_fp_descr
volatile *start
,
325 union s_fp_descr
volatile *d1
;
326 union s_fp_descr
volatile *d2
;
329 DB_GEN(3, "descr ring starts at = %p", start
);
330 for (i
=count
-1, d1
=start
; i
; i
--) {
332 d1
++ ; /* descr is owned by the host */
333 d2
->r
.rxd_rbctrl
= cpu_to_le32(BMU_CHECK
) ;
334 d2
->r
.rxd_next
= &d1
->r
;
335 phys
= mac_drv_virt2phys(smc
,(void *)d1
) ;
336 d2
->r
.rxd_nrdadr
= cpu_to_le32(phys
) ;
338 DB_GEN(3, "descr ring ends at = %p", d1
);
339 d1
->r
.rxd_rbctrl
= cpu_to_le32(BMU_CHECK
) ;
340 d1
->r
.rxd_next
= &start
->r
;
341 phys
= mac_drv_virt2phys(smc
,(void *)start
) ;
342 d1
->r
.rxd_nrdadr
= cpu_to_le32(phys
) ;
344 for (i
=count
, d1
=start
; i
; i
--) {
345 DRV_BUF_FLUSH(&d1
->r
,DDI_DMA_SYNC_FORDEV
) ;
351 static void init_txd_ring(struct s_smc
*smc
)
353 struct s_smt_fp_txd
volatile *ds
;
354 struct s_smt_tx_queue
*queue
;
358 * initialize the transmit descriptors
360 ds
= (struct s_smt_fp_txd
volatile *) ((char *)smc
->os
.hwm
.descr_p
+
361 SMT_R1_RXD_COUNT
*sizeof(struct s_smt_fp_rxd
)) ;
362 queue
= smc
->hw
.fp
.tx
[QUEUE_A0
] ;
363 DB_GEN(3, "Init async TxD ring, %d TxDs", HWM_ASYNC_TXD_COUNT
);
364 (void)init_descr_ring(smc
,(union s_fp_descr
volatile *)ds
,
365 HWM_ASYNC_TXD_COUNT
) ;
366 phys
= le32_to_cpu(ds
->txd_ntdadr
) ;
368 queue
->tx_curr_put
= queue
->tx_curr_get
= ds
;
370 queue
->tx_free
= HWM_ASYNC_TXD_COUNT
;
372 outpd(ADDR(B5_XA_DA
),phys
) ;
374 ds
= (struct s_smt_fp_txd
volatile *) ((char *)ds
+
375 HWM_ASYNC_TXD_COUNT
*sizeof(struct s_smt_fp_txd
)) ;
376 queue
= smc
->hw
.fp
.tx
[QUEUE_S
] ;
377 DB_GEN(3, "Init sync TxD ring, %d TxDs", HWM_SYNC_TXD_COUNT
);
378 (void)init_descr_ring(smc
,(union s_fp_descr
volatile *)ds
,
379 HWM_SYNC_TXD_COUNT
) ;
380 phys
= le32_to_cpu(ds
->txd_ntdadr
) ;
382 queue
->tx_curr_put
= queue
->tx_curr_get
= ds
;
383 queue
->tx_free
= HWM_SYNC_TXD_COUNT
;
385 outpd(ADDR(B5_XS_DA
),phys
) ;
388 static void init_rxd_ring(struct s_smc
*smc
)
390 struct s_smt_fp_rxd
volatile *ds
;
391 struct s_smt_rx_queue
*queue
;
395 * initialize the receive descriptors
397 ds
= (struct s_smt_fp_rxd
volatile *) smc
->os
.hwm
.descr_p
;
398 queue
= smc
->hw
.fp
.rx
[QUEUE_R1
] ;
399 DB_GEN(3, "Init RxD ring, %d RxDs", SMT_R1_RXD_COUNT
);
400 (void)init_descr_ring(smc
,(union s_fp_descr
volatile *)ds
,
402 phys
= le32_to_cpu(ds
->rxd_nrdadr
) ;
404 queue
->rx_curr_put
= queue
->rx_curr_get
= ds
;
405 queue
->rx_free
= SMT_R1_RXD_COUNT
;
407 outpd(ADDR(B4_R1_DA
),phys
) ;
411 * BEGIN_MANUAL_ENTRY(init_fddi_driver)
412 * void init_fddi_driver(smc,mac_addr)
414 * initializes the driver and it's variables
418 void init_fddi_driver(struct s_smc
*smc
, u_char
*mac_addr
)
423 init_board(smc
,mac_addr
) ;
424 (void)init_fplus(smc
) ;
427 * initialize the SMbufs for the SMT
429 #ifndef COMMON_MB_POOL
430 mb
= smc
->os
.hwm
.mbuf_pool
.mb_start
;
431 smc
->os
.hwm
.mbuf_pool
.mb_free
= (SMbuf
*)NULL
;
432 for (i
= 0; i
< MAX_MBUF
; i
++) {
433 mb
->sm_use_count
= 1 ;
434 smt_free_mbuf(smc
,mb
) ;
441 for (i
= 0; i
< MAX_MBUF
; i
++) {
442 mb
->sm_use_count
= 1 ;
443 smt_free_mbuf(smc
,mb
) ;
451 * initialize the other variables
453 smc
->os
.hwm
.llc_rx_pipe
= smc
->os
.hwm
.llc_rx_tail
= (SMbuf
*)NULL
;
454 smc
->os
.hwm
.txd_tx_pipe
= smc
->os
.hwm
.txd_tx_tail
= NULL
;
455 smc
->os
.hwm
.pass_SMT
= smc
->os
.hwm
.pass_NSA
= smc
->os
.hwm
.pass_DB
= 0 ;
456 smc
->os
.hwm
.pass_llc_promisc
= TRUE
;
457 smc
->os
.hwm
.queued_rx_frames
= smc
->os
.hwm
.queued_txd_mb
= 0 ;
458 smc
->os
.hwm
.detec_count
= 0 ;
459 smc
->os
.hwm
.rx_break
= 0 ;
460 smc
->os
.hwm
.rx_len_error
= 0 ;
461 smc
->os
.hwm
.isr_flag
= FALSE
;
464 * make sure that the start pointer is 16 byte aligned
466 i
= 16 - ((long)smc
->os
.hwm
.descr_p
& 0xf) ;
468 DB_GEN(3, "i = %d", i
);
469 smc
->os
.hwm
.descr_p
= (union s_fp_descr
volatile *)
470 ((char *)smc
->os
.hwm
.descr_p
+i
) ;
472 DB_GEN(3, "pt to descr area = %p", smc
->os
.hwm
.descr_p
);
476 mac_drv_fill_rxd(smc
) ;
482 SMbuf
*smt_get_mbuf(struct s_smc
*smc
)
486 #ifndef COMMON_MB_POOL
487 mb
= smc
->os
.hwm
.mbuf_pool
.mb_free
;
492 #ifndef COMMON_MB_POOL
493 smc
->os
.hwm
.mbuf_pool
.mb_free
= mb
->sm_next
;
495 mb_free
= mb
->sm_next
;
498 mb
->sm_use_count
= 1 ;
500 DB_GEN(3, "get SMbuf: mb = %p", mb
);
501 return mb
; /* May be NULL */
504 void smt_free_mbuf(struct s_smc
*smc
, SMbuf
*mb
)
509 DB_GEN(3, "free_mbuf: sm_use_count = %d", mb
->sm_use_count
);
511 * If the use_count is != zero the MBuf is queued
512 * more than once and must not queued into the
515 if (!mb
->sm_use_count
) {
516 DB_GEN(3, "free SMbuf: mb = %p", mb
);
517 #ifndef COMMON_MB_POOL
518 mb
->sm_next
= smc
->os
.hwm
.mbuf_pool
.mb_free
;
519 smc
->os
.hwm
.mbuf_pool
.mb_free
= mb
;
521 mb
->sm_next
= mb_free
;
527 SMT_PANIC(smc
,HWM_E0003
,HWM_E0003_MSG
) ;
532 * BEGIN_MANUAL_ENTRY(mac_drv_repair_descr)
533 * void mac_drv_repair_descr(smc)
535 * function called from SMT (HWM / hwmtm.c)
536 * The BMU is idle when this function is called.
537 * Mac_drv_repair_descr sets up the physical address
538 * for all receive and transmit queues where the BMU
540 * It may be that the BMU was reseted during a fragmented
541 * transfer. In this case there are some fragments which will
542 * never completed by the BMU. The OWN bit of this fragments
543 * must be switched to be owned by the host.
545 * Give a start command to the receive BMU.
546 * Start the transmit BMUs if transmit frames pending.
550 void mac_drv_repair_descr(struct s_smc
*smc
)
554 if (smc
->hw
.hw_state
!= STOPPED
) {
556 SMT_PANIC(smc
,HWM_E0013
,HWM_E0013_MSG
) ;
561 * repair tx queues: don't start
563 phys
= repair_txd_ring(smc
,smc
->hw
.fp
.tx
[QUEUE_A0
]) ;
564 outpd(ADDR(B5_XA_DA
),phys
) ;
565 if (smc
->hw
.fp
.tx_q
[QUEUE_A0
].tx_used
) {
566 outpd(ADDR(B0_XA_CSR
),CSR_START
) ;
568 phys
= repair_txd_ring(smc
,smc
->hw
.fp
.tx
[QUEUE_S
]) ;
569 outpd(ADDR(B5_XS_DA
),phys
) ;
570 if (smc
->hw
.fp
.tx_q
[QUEUE_S
].tx_used
) {
571 outpd(ADDR(B0_XS_CSR
),CSR_START
) ;
577 phys
= repair_rxd_ring(smc
,smc
->hw
.fp
.rx
[QUEUE_R1
]) ;
578 outpd(ADDR(B4_R1_DA
),phys
) ;
579 outpd(ADDR(B0_R1_CSR
),CSR_START
) ;
582 static u_long
repair_txd_ring(struct s_smc
*smc
, struct s_smt_tx_queue
*queue
)
588 struct s_smt_fp_txd
volatile *t
;
592 t
= queue
->tx_curr_get
;
593 tx_used
= queue
->tx_used
;
594 for (i
= tx_used
+queue
->tx_free
-1 ; i
; i
-- ) {
597 phys
= le32_to_cpu(t
->txd_ntdadr
) ;
599 t
= queue
->tx_curr_get
;
601 DRV_BUF_FLUSH(t
,DDI_DMA_SYNC_FORCPU
) ;
602 tbctrl
= le32_to_cpu(t
->txd_tbctrl
) ;
604 if (tbctrl
& BMU_OWN
) {
605 if (tbctrl
& BMU_STF
) {
606 break ; /* exit the loop */
610 * repair the descriptor
612 t
->txd_tbctrl
&= ~cpu_to_le32(BMU_OWN
) ;
615 phys
= le32_to_cpu(t
->txd_ntdadr
) ;
616 DRV_BUF_FLUSH(t
,DDI_DMA_SYNC_FORDEV
) ;
624 * Repairs the receive descriptor ring and returns the physical address
625 * where the BMU should continue working.
627 * o The physical address where the BMU was stopped has to be
628 * determined. This is the next RxD after rx_curr_get with an OWN
630 * o The BMU should start working at beginning of the next frame.
631 * RxDs with an OWN bit set but with a reset STF bit should be
632 * skipped and owned by the driver (OWN = 0).
634 static u_long
repair_rxd_ring(struct s_smc
*smc
, struct s_smt_rx_queue
*queue
)
640 struct s_smt_fp_rxd
volatile *r
;
644 r
= queue
->rx_curr_get
;
645 rx_used
= queue
->rx_used
;
646 for (i
= SMT_R1_RXD_COUNT
-1 ; i
; i
-- ) {
649 phys
= le32_to_cpu(r
->rxd_nrdadr
) ;
651 r
= queue
->rx_curr_get
;
653 DRV_BUF_FLUSH(r
,DDI_DMA_SYNC_FORCPU
) ;
654 rbctrl
= le32_to_cpu(r
->rxd_rbctrl
) ;
656 if (rbctrl
& BMU_OWN
) {
657 if (rbctrl
& BMU_STF
) {
658 break ; /* exit the loop */
662 * repair the descriptor
664 r
->rxd_rbctrl
&= ~cpu_to_le32(BMU_OWN
) ;
667 phys
= le32_to_cpu(r
->rxd_nrdadr
) ;
668 DRV_BUF_FLUSH(r
,DDI_DMA_SYNC_FORDEV
) ;
677 -------------------------------------------------------------
678 INTERRUPT SERVICE ROUTINE:
679 -------------------------------------------------------------
683 * BEGIN_MANUAL_ENTRY(fddi_isr)
686 * function DOWNCALL (drvsr.c)
687 * interrupt service routine, handles the interrupt requests
688 * generated by the FDDI adapter.
690 * NOTE: The operating system dependent module must guarantee that the
691 * interrupts of the adapter are disabled when it calls fddi_isr.
693 * About the USE_BREAK_ISR mechanismn:
695 * The main requirement of this mechanismn is to force an timer IRQ when
696 * leaving process_receive() with leave_isr set. process_receive() may
697 * be called at any time from anywhere!
698 * To be sure we don't miss such event we set 'force_irq' per default.
699 * We have to force and Timer IRQ if 'smc->os.hwm.leave_isr' AND
700 * 'force_irq' are set. 'force_irq' may be reset if a receive complete
705 void fddi_isr(struct s_smc
*smc
)
707 u_long is
; /* ISR source */
716 if (smc
->os
.hwm
.rx_break
) {
717 mac_drv_fill_rxd(smc
) ;
718 if (smc
->hw
.fp
.rx_q
[QUEUE_R1
].rx_used
> 0) {
719 smc
->os
.hwm
.rx_break
= 0 ;
720 process_receive(smc
) ;
723 smc
->os
.hwm
.detec_count
= 0 ;
728 smc
->os
.hwm
.isr_flag
= TRUE
;
732 if (smc
->os
.hwm
.leave_isr
) {
733 smc
->os
.hwm
.leave_isr
= FALSE
;
734 process_receive(smc
) ;
738 while ((is
= GET_ISR() & ISR_MASK
)) {
739 NDD_TRACE("CH0B",is
,0,0) ;
740 DB_GEN(7, "ISA = 0x%lx", is
);
742 if (is
& IMASK_SLOW
) {
743 NDD_TRACE("CH1b",is
,0,0) ;
744 if (is
& IS_PLINT1
) { /* PLC1 */
747 if (is
& IS_PLINT2
) { /* PLC2 */
750 if (is
& IS_MINTR1
) { /* FORMAC+ STU1(U/L) */
751 stu
= inpw(FM_A(FM_ST1U
)) ;
752 stl
= inpw(FM_A(FM_ST1L
)) ;
753 DB_GEN(6, "Slow transmit complete");
754 mac1_irq(smc
,stu
,stl
) ;
756 if (is
& IS_MINTR2
) { /* FORMAC+ STU2(U/L) */
757 stu
= inpw(FM_A(FM_ST2U
)) ;
758 stl
= inpw(FM_A(FM_ST2L
)) ;
759 DB_GEN(6, "Slow receive complete");
760 DB_GEN(7, "stl = %x : stu = %x", stl
, stu
);
761 mac2_irq(smc
,stu
,stl
) ;
763 if (is
& IS_MINTR3
) { /* FORMAC+ STU3(U/L) */
764 stu
= inpw(FM_A(FM_ST3U
)) ;
765 stl
= inpw(FM_A(FM_ST3L
)) ;
766 DB_GEN(6, "FORMAC Mode Register 3");
767 mac3_irq(smc
,stu
,stl
) ;
769 if (is
& IS_TIMINT
) { /* Timer 82C54-2 */
772 force_irq_pending
= 0 ;
775 * out of RxD detection
777 if (++smc
->os
.hwm
.detec_count
> 4) {
779 * check out of RxD condition
781 process_receive(smc
) ;
784 if (is
& IS_TOKEN
) { /* Restricted Token Monitor */
787 if (is
& IS_R1_P
) { /* Parity error rx queue 1 */
789 outpd(ADDR(B4_R1_CSR
),CSR_IRQ_CL_P
) ;
790 SMT_PANIC(smc
,HWM_E0004
,HWM_E0004_MSG
) ;
792 if (is
& IS_R1_C
) { /* Encoding error rx queue 1 */
794 outpd(ADDR(B4_R1_CSR
),CSR_IRQ_CL_C
) ;
795 SMT_PANIC(smc
,HWM_E0005
,HWM_E0005_MSG
) ;
797 if (is
& IS_XA_C
) { /* Encoding error async tx q */
799 outpd(ADDR(B5_XA_CSR
),CSR_IRQ_CL_C
) ;
800 SMT_PANIC(smc
,HWM_E0006
,HWM_E0006_MSG
) ;
802 if (is
& IS_XS_C
) { /* Encoding error sync tx q */
804 outpd(ADDR(B5_XS_CSR
),CSR_IRQ_CL_C
) ;
805 SMT_PANIC(smc
,HWM_E0007
,HWM_E0007_MSG
) ;
810 * Fast Tx complete Async/Sync Queue (BMU service)
812 if (is
& (IS_XS_F
|IS_XA_F
)) {
813 DB_GEN(6, "Fast tx complete queue");
815 * clear IRQ, Note: no IRQ is lost, because
816 * we always service both queues
818 outpd(ADDR(B5_XS_CSR
),CSR_IRQ_CL_F
) ;
819 outpd(ADDR(B5_XA_CSR
),CSR_IRQ_CL_F
) ;
820 mac_drv_clear_txd(smc
) ;
821 llc_restart_tx(smc
) ;
825 * Fast Rx Complete (BMU service)
828 DB_GEN(6, "Fast receive complete");
830 #ifndef USE_BREAK_ISR
831 outpd(ADDR(B4_R1_CSR
),CSR_IRQ_CL_F
) ;
832 process_receive(smc
) ;
834 process_receive(smc
) ;
835 if (smc
->os
.hwm
.leave_isr
) {
838 outpd(ADDR(B4_R1_CSR
),CSR_IRQ_CL_F
) ;
839 process_receive(smc
) ;
845 while ((mb
= get_llc_rx(smc
))) {
852 while (!offDepth
&& (mb
= get_llc_rx(smc
))) {
856 if (!offDepth
&& smc
->os
.hwm
.rx_break
) {
857 process_receive(smc
) ;
860 if (smc
->q
.ev_get
!= smc
->q
.ev_put
) {
861 NDD_TRACE("CH2a",0,0,0) ;
866 if (offDepth
) { /* leave fddi_isr because */
867 break ; /* indications not allowed */
871 if (smc
->os
.hwm
.leave_isr
) {
872 break ; /* leave fddi_isr */
876 /* NOTE: when the isr is left, no rx is pending */
877 } /* end of interrupt source polling loop */
880 if (smc
->os
.hwm
.leave_isr
&& force_irq
) {
884 smc
->os
.hwm
.isr_flag
= FALSE
;
885 NDD_TRACE("CH0E",0,0,0) ;
890 -------------------------------------------------------------
892 -------------------------------------------------------------
897 * BEGIN_MANUAL_ENTRY(mac_drv_rx_mode)
898 * void mac_drv_rx_mode(smc,mode)
900 * function DOWNCALL (fplus.c)
901 * Corresponding to the parameter mode, the operating system
902 * dependent module can activate several receive modes.
904 * para mode = 1: RX_ENABLE_ALLMULTI enable all multicasts
905 * = 2: RX_DISABLE_ALLMULTI disable "enable all multicasts"
906 * = 3: RX_ENABLE_PROMISC enable promiscuous
907 * = 4: RX_DISABLE_PROMISC disable promiscuous
908 * = 5: RX_ENABLE_NSA enable rec. of all NSA frames
909 * (disabled after 'driver reset' & 'set station address')
910 * = 6: RX_DISABLE_NSA disable rec. of all NSA frames
912 * = 21: RX_ENABLE_PASS_SMT ( see description )
913 * = 22: RX_DISABLE_PASS_SMT ( " " )
914 * = 23: RX_ENABLE_PASS_NSA ( " " )
915 * = 24: RX_DISABLE_PASS_NSA ( " " )
916 * = 25: RX_ENABLE_PASS_DB ( " " )
917 * = 26: RX_DISABLE_PASS_DB ( " " )
918 * = 27: RX_DISABLE_PASS_ALL ( " " )
919 * = 28: RX_DISABLE_LLC_PROMISC ( " " )
920 * = 29: RX_ENABLE_LLC_PROMISC ( " " )
923 * RX_ENABLE_PASS_SMT / RX_DISABLE_PASS_SMT
925 * If the operating system dependent module activates the
926 * mode RX_ENABLE_PASS_SMT, the hardware module
927 * duplicates all SMT frames with the frame control
928 * FC_SMT_INFO and passes them to the LLC receive channel
929 * by calling mac_drv_rx_init.
930 * The SMT Frames which are sent by the local SMT and the NSA
931 * frames whose A- and C-Indicator is not set are also duplicated
933 * The receive mode RX_DISABLE_PASS_SMT disables the passing
936 * RX_ENABLE_PASS_NSA / RX_DISABLE_PASS_NSA
938 * If the operating system dependent module activates the
939 * mode RX_ENABLE_PASS_NSA, the hardware module
940 * duplicates all NSA frames with frame control FC_SMT_NSA
941 * and a set A-Indicator and passed them to the LLC
942 * receive channel by calling mac_drv_rx_init.
943 * All NSA Frames which are sent by the local SMT
944 * are also duplicated and passed.
945 * The receive mode RX_DISABLE_PASS_NSA disables the passing
946 * of NSA frames with the A- or C-Indicator set.
948 * NOTE: For fear that the hardware module receives NSA frames with
949 * a reset A-Indicator, the operating system dependent module
950 * has to call mac_drv_rx_mode with the mode RX_ENABLE_NSA
951 * before activate the RX_ENABLE_PASS_NSA mode and after every
952 * 'driver reset' and 'set station address'.
954 * RX_ENABLE_PASS_DB / RX_DISABLE_PASS_DB
956 * If the operating system dependent module activates the
957 * mode RX_ENABLE_PASS_DB, direct BEACON frames
958 * (FC_BEACON frame control) are passed to the LLC receive
959 * channel by mac_drv_rx_init.
960 * The receive mode RX_DISABLE_PASS_DB disables the passing
961 * of direct BEACON frames.
963 * RX_DISABLE_PASS_ALL
965 * Disables all special receives modes. It is equal to
966 * call mac_drv_set_rx_mode successively with the
967 * parameters RX_DISABLE_NSA, RX_DISABLE_PASS_SMT,
968 * RX_DISABLE_PASS_NSA and RX_DISABLE_PASS_DB.
970 * RX_ENABLE_LLC_PROMISC
972 * (default) all received LLC frames and all SMT/NSA/DBEACON
973 * frames depending on the attitude of the flags
974 * PASS_SMT/PASS_NSA/PASS_DBEACON will be delivered to the
977 * RX_DISABLE_LLC_PROMISC
979 * all received SMT/NSA/DBEACON frames depending on the
980 * attitude of the flags PASS_SMT/PASS_NSA/PASS_DBEACON
981 * will be delivered to the LLC layer.
982 * all received LLC frames with a directed address, Multicast
983 * or Broadcast address will be delivered to the LLC
988 void mac_drv_rx_mode(struct s_smc
*smc
, int mode
)
991 case RX_ENABLE_PASS_SMT
:
992 smc
->os
.hwm
.pass_SMT
= TRUE
;
994 case RX_DISABLE_PASS_SMT
:
995 smc
->os
.hwm
.pass_SMT
= FALSE
;
997 case RX_ENABLE_PASS_NSA
:
998 smc
->os
.hwm
.pass_NSA
= TRUE
;
1000 case RX_DISABLE_PASS_NSA
:
1001 smc
->os
.hwm
.pass_NSA
= FALSE
;
1003 case RX_ENABLE_PASS_DB
:
1004 smc
->os
.hwm
.pass_DB
= TRUE
;
1006 case RX_DISABLE_PASS_DB
:
1007 smc
->os
.hwm
.pass_DB
= FALSE
;
1009 case RX_DISABLE_PASS_ALL
:
1010 smc
->os
.hwm
.pass_SMT
= smc
->os
.hwm
.pass_NSA
= FALSE
;
1011 smc
->os
.hwm
.pass_DB
= FALSE
;
1012 smc
->os
.hwm
.pass_llc_promisc
= TRUE
;
1013 mac_set_rx_mode(smc
,RX_DISABLE_NSA
) ;
1015 case RX_DISABLE_LLC_PROMISC
:
1016 smc
->os
.hwm
.pass_llc_promisc
= FALSE
;
1018 case RX_ENABLE_LLC_PROMISC
:
1019 smc
->os
.hwm
.pass_llc_promisc
= TRUE
;
1021 case RX_ENABLE_ALLMULTI
:
1022 case RX_DISABLE_ALLMULTI
:
1023 case RX_ENABLE_PROMISC
:
1024 case RX_DISABLE_PROMISC
:
1026 case RX_DISABLE_NSA
:
1028 mac_set_rx_mode(smc
,mode
) ;
1032 #endif /* ifndef NDIS_OS2 */
1035 * process receive queue
1037 void process_receive(struct s_smc
*smc
)
1041 int frag_count
; /* number of RxDs of the curr rx buf */
1042 int used_frags
; /* number of RxDs of the curr frame */
1043 struct s_smt_rx_queue
*queue
; /* points to the queue ctl struct */
1044 struct s_smt_fp_rxd
volatile *r
; /* rxd pointer */
1045 struct s_smt_fp_rxd
volatile *rxd
; /* first rxd of rx frame */
1046 u_long rbctrl
; /* receive buffer control word */
1047 u_long rfsw
; /* receive frame status word */
1052 u_char fc
; /* Frame control */
1053 int len
; /* Frame length */
1055 smc
->os
.hwm
.detec_count
= 0 ;
1056 queue
= smc
->hw
.fp
.rx
[QUEUE_R1
] ;
1057 NDD_TRACE("RHxB",0,0,0) ;
1059 r
= queue
->rx_curr_get
;
1060 rx_used
= queue
->rx_used
;
1063 #ifdef USE_BREAK_ISR
1064 if (smc
->os
.hwm
.leave_isr
) {
1070 smc
->os
.hwm
.rx_break
= 1 ;
1073 smc
->os
.hwm
.rx_break
= 0 ;
1076 if (smc
->os
.hwm
.rx_break
) {
1082 DB_RX(5, "Check RxD %p for OWN and EOF", r
);
1083 DRV_BUF_FLUSH(r
,DDI_DMA_SYNC_FORCPU
) ;
1084 rbctrl
= le32_to_cpu(CR_READ(r
->rxd_rbctrl
));
1086 if (rbctrl
& BMU_OWN
) {
1087 NDD_TRACE("RHxE",r
,rfsw
,rbctrl
) ;
1088 DB_RX(4, "End of RxDs");
1092 * out of RxD detection
1096 SMT_PANIC(smc
,HWM_E0009
,HWM_E0009_MSG
) ;
1097 /* Either we don't have an RxD or all
1098 * RxDs are filled. Therefore it's allowed
1099 * for to set the STOPPED flag */
1100 smc
->hw
.hw_state
= STOPPED
;
1101 mac_drv_clear_rx_queue(smc
) ;
1102 smc
->hw
.hw_state
= STARTED
;
1103 mac_drv_fill_rxd(smc
) ;
1104 smc
->os
.hwm
.detec_count
= 0 ;
1107 rfsw
= le32_to_cpu(r
->rxd_rfsw
) ;
1108 if ((rbctrl
& BMU_STF
) != ((rbctrl
& BMU_ST_BUF
) <<5)) {
1110 * The BMU_STF bit is deleted, 1 frame is
1111 * placed into more than 1 rx buffer
1113 * skip frame by setting the rx len to 0
1115 * if fragment count == 0
1116 * The missing STF bit belongs to the
1117 * current frame, search for the
1118 * EOF bit to complete the frame
1120 * the fragment belongs to the next frame,
1121 * exit the loop and process the frame
1129 n
+= rbctrl
& 0xffff ;
1133 } while (!(rbctrl
& BMU_EOF
)) ;
1134 used_frags
= frag_count
;
1135 DB_RX(5, "EOF set in RxD, used_frags = %d", used_frags
);
1137 /* may be next 2 DRV_BUF_FLUSH() can be skipped, because */
1138 /* BMU_ST_BUF will not be changed by the ASIC */
1139 DRV_BUF_FLUSH(r
,DDI_DMA_SYNC_FORCPU
) ;
1140 while (rx_used
&& !(r
->rxd_rbctrl
& cpu_to_le32(BMU_ST_BUF
))) {
1141 DB_RX(5, "Check STF bit in %p", r
);
1143 DRV_BUF_FLUSH(r
,DDI_DMA_SYNC_FORCPU
) ;
1147 DB_RX(5, "STF bit found");
1150 * The received frame is finished for the process receive
1152 rxd
= queue
->rx_curr_get
;
1153 queue
->rx_curr_get
= r
;
1154 queue
->rx_free
+= frag_count
;
1155 queue
->rx_used
= rx_used
;
1158 * ASIC Errata no. 7 (STF - Bit Bug)
1160 rxd
->rxd_rbctrl
&= cpu_to_le32(~BMU_STF
) ;
1162 for (r
=rxd
, i
=frag_count
; i
; r
=r
->rxd_next
, i
--){
1163 DB_RX(5, "dma_complete for RxD %p", r
);
1164 dma_complete(smc
,(union s_fp_descr
volatile *)r
,DMA_WR
);
1166 smc
->hw
.fp
.err_stats
.err_valid
++ ;
1167 smc
->mib
.m
[MAC0
].fddiMACCopied_Ct
++ ;
1169 /* the length of the data including the FC */
1170 len
= (rfsw
& RD_LENGTH
) - 4 ;
1172 DB_RX(4, "frame length = %d", len
);
1174 * check the frame_length and all error flags
1176 if (rfsw
& (RX_MSRABT
|RX_FS_E
|RX_FS_CRC
|RX_FS_IMPL
)){
1177 if (rfsw
& RD_S_MSRABT
) {
1178 DB_RX(2, "Frame aborted by the FORMAC");
1179 smc
->hw
.fp
.err_stats
.err_abort
++ ;
1182 * check frame status
1184 if (rfsw
& RD_S_SEAC2
) {
1185 DB_RX(2, "E-Indicator set");
1186 smc
->hw
.fp
.err_stats
.err_e_indicator
++ ;
1188 if (rfsw
& RD_S_SFRMERR
) {
1189 DB_RX(2, "CRC error");
1190 smc
->hw
.fp
.err_stats
.err_crc
++ ;
1192 if (rfsw
& RX_FS_IMPL
) {
1193 DB_RX(2, "Implementer frame");
1194 smc
->hw
.fp
.err_stats
.err_imp_frame
++ ;
1198 if (len
> FDDI_RAW_MTU
-4) {
1199 DB_RX(2, "Frame too long error");
1200 smc
->hw
.fp
.err_stats
.err_too_long
++ ;
1204 * SUPERNET 3 Bug: FORMAC delivers status words
1205 * of aborted frames to the BMU
1208 DB_RX(2, "Frame length = 0");
1213 DB_RX(4, "BMU: rx len differs: [%d:%d]", len
, n
);
1214 smc
->os
.hwm
.rx_len_error
++ ;
1221 virt
= (u_char far
*) rxd
->rxd_virt
;
1222 DB_RX(2, "FC = %x", *virt
);
1223 if (virt
[12] == MA
[5] &&
1224 virt
[11] == MA
[4] &&
1225 virt
[10] == MA
[3] &&
1228 (virt
[7] & ~GROUP_ADDR_BIT
) == MA
[0]) {
1235 if (rfsw
& RX_FS_LLC
) {
1237 * if pass_llc_promisc is disable
1238 * if DA != Multicast or Broadcast or DA!=MA
1241 if (!smc
->os
.hwm
.pass_llc_promisc
) {
1242 if(!(virt
[1] & GROUP_ADDR_BIT
)) {
1243 if (virt
[6] != MA
[5] ||
1249 DB_RX(2, "DA != MA and not multi- or broadcast");
1256 * LLC frame received
1258 DB_RX(4, "LLC - receive");
1259 mac_drv_rx_complete(smc
,rxd
,frag_count
,len
) ;
1262 if (!(mb
= smt_get_mbuf(smc
))) {
1263 smc
->hw
.fp
.err_stats
.err_no_buf
++ ;
1264 DB_RX(4, "No SMbuf; receive terminated");
1267 data
= smtod(mb
,char *) - 1 ;
1270 * copy the frame into a SMT_MBuf
1273 hwm_cpy_rxd2mb(rxd
,data
,len
) ;
1275 for (r
=rxd
, i
=used_frags
; i
; r
=r
->rxd_next
, i
--){
1276 n
= le32_to_cpu(r
->rxd_rbctrl
) & RD_LENGTH
;
1277 DB_RX(6, "cp SMT frame to mb: len = %d", n
);
1278 memcpy(data
,r
->rxd_virt
,n
) ;
1281 data
= smtod(mb
,char *) - 1 ;
1283 fc
= *(char *)mb
->sm_data
= *data
;
1284 mb
->sm_len
= len
- 1 ; /* len - fc */
1288 * SMT frame received
1292 smc
->hw
.fp
.err_stats
.err_smt_frame
++ ;
1293 DB_RX(5, "SMT frame received");
1295 if (smc
->os
.hwm
.pass_SMT
) {
1296 DB_RX(5, "pass SMT frame");
1297 mac_drv_rx_complete(smc
, rxd
,
1301 DB_RX(5, "requeue RxD");
1302 mac_drv_requeue_rxd(smc
,rxd
,frag_count
);
1305 smt_received_pack(smc
,mb
,(int)(rfsw
>>25)) ;
1308 smc
->hw
.fp
.err_stats
.err_smt_frame
++ ;
1309 DB_RX(5, "SMT frame received");
1311 /* if pass_NSA set pass the NSA frame or */
1312 /* pass_SMT set and the A-Indicator */
1313 /* is not set, pass the NSA frame */
1314 if (smc
->os
.hwm
.pass_NSA
||
1315 (smc
->os
.hwm
.pass_SMT
&&
1316 !(rfsw
& A_INDIC
))) {
1317 DB_RX(5, "pass SMT frame");
1318 mac_drv_rx_complete(smc
, rxd
,
1322 DB_RX(5, "requeue RxD");
1323 mac_drv_requeue_rxd(smc
,rxd
,frag_count
);
1326 smt_received_pack(smc
,mb
,(int)(rfsw
>>25)) ;
1329 if (smc
->os
.hwm
.pass_DB
) {
1330 DB_RX(5, "pass DB frame");
1331 mac_drv_rx_complete(smc
, rxd
,
1335 DB_RX(5, "requeue RxD");
1336 mac_drv_requeue_rxd(smc
,rxd
,frag_count
);
1338 smt_free_mbuf(smc
,mb
) ;
1342 * unknown FC abort the frame
1344 DB_RX(2, "unknown FC error");
1345 smt_free_mbuf(smc
,mb
) ;
1346 DB_RX(5, "requeue RxD");
1347 mac_drv_requeue_rxd(smc
,rxd
,frag_count
) ;
1348 if ((fc
& 0xf0) == FC_MAC
)
1349 smc
->hw
.fp
.err_stats
.err_mac_frame
++ ;
1351 smc
->hw
.fp
.err_stats
.err_imp_frame
++ ;
1357 DB_RX(3, "next RxD is %p", queue
->rx_curr_get
);
1358 NDD_TRACE("RHx1",queue
->rx_curr_get
,0,0) ;
1361 /*--------------------------------------------------------------------*/
1363 DB_RX(5, "requeue RxD");
1364 mac_drv_requeue_rxd(smc
,rxd
,frag_count
) ;
1366 DB_RX(3, "next RxD is %p", queue
->rx_curr_get
);
1367 NDD_TRACE("RHx2",queue
->rx_curr_get
,0,0) ;
1370 #ifdef ALL_RX_COMPLETE
1371 mac_drv_all_receives_complete(smc
) ;
1373 return ; /* lint bug: needs return detect end of function */
1376 static void smt_to_llc(struct s_smc
*smc
, SMbuf
*mb
)
1380 DB_RX(4, "send a queued frame to the llc layer");
1381 smc
->os
.hwm
.r
.len
= mb
->sm_len
;
1382 smc
->os
.hwm
.r
.mb_pos
= smtod(mb
,char *) ;
1383 fc
= *smc
->os
.hwm
.r
.mb_pos
;
1384 (void)mac_drv_rx_init(smc
,(int)mb
->sm_len
,(int)fc
,
1385 smc
->os
.hwm
.r
.mb_pos
,(int)mb
->sm_len
) ;
1386 smt_free_mbuf(smc
,mb
) ;
1390 * BEGIN_MANUAL_ENTRY(hwm_rx_frag)
1391 * void hwm_rx_frag(smc,virt,phys,len,frame_status)
1393 * function MACRO (hardware module, hwmtm.h)
1394 * This function calls dma_master for preparing the
1395 * system hardware for the DMA transfer and initializes
1396 * the current RxD with the length and the physical and
1397 * virtual address of the fragment. Furthermore, it sets the
1398 * STF and EOF bits depending on the frame status byte,
1399 * switches the OWN flag of the RxD, so that it is owned by the
1400 * adapter and issues an rx_start.
1402 * para virt virtual pointer to the fragment
1403 * len the length of the fragment
1404 * frame_status status of the frame, see design description
1406 * NOTE: It is possible to call this function with a fragment length
1411 void hwm_rx_frag(struct s_smc
*smc
, char far
*virt
, u_long phys
, int len
,
1414 struct s_smt_fp_rxd
volatile *r
;
1417 NDD_TRACE("RHfB",virt
,len
,frame_status
) ;
1418 DB_RX(2, "hwm_rx_frag: len = %d, frame_status = %x", len
, frame_status
);
1419 r
= smc
->hw
.fp
.rx_q
[QUEUE_R1
].rx_curr_put
;
1420 r
->rxd_virt
= virt
;
1421 r
->rxd_rbadr
= cpu_to_le32(phys
) ;
1422 rbctrl
= cpu_to_le32( (((__u32
)frame_status
&
1423 (FIRST_FRAG
|LAST_FRAG
))<<26) |
1424 (((u_long
) frame_status
& FIRST_FRAG
) << 21) |
1425 BMU_OWN
| BMU_CHECK
| BMU_EN_IRQ_EOF
| len
) ;
1426 r
->rxd_rbctrl
= rbctrl
;
1428 DRV_BUF_FLUSH(r
,DDI_DMA_SYNC_FORDEV
) ;
1429 outpd(ADDR(B0_R1_CSR
),CSR_START
) ;
1430 smc
->hw
.fp
.rx_q
[QUEUE_R1
].rx_free
-- ;
1431 smc
->hw
.fp
.rx_q
[QUEUE_R1
].rx_used
++ ;
1432 smc
->hw
.fp
.rx_q
[QUEUE_R1
].rx_curr_put
= r
->rxd_next
;
1433 NDD_TRACE("RHfE",r
,le32_to_cpu(r
->rxd_rbadr
),0) ;
1437 * BEGINN_MANUAL_ENTRY(mac_drv_clear_rx_queue)
1439 * void mac_drv_clear_rx_queue(smc)
1440 * struct s_smc *smc ;
1442 * function DOWNCALL (hardware module, hwmtm.c)
1443 * mac_drv_clear_rx_queue is called by the OS-specific module
1444 * after it has issued a card_stop.
1445 * In this case, the frames in the receive queue are obsolete and
1446 * should be removed. For removing mac_drv_clear_rx_queue
1447 * calls dma_master for each RxD and mac_drv_clear_rxd for each
1450 * NOTE: calling sequence card_stop:
1451 * CLI_FBI(), card_stop(),
1452 * mac_drv_clear_tx_queue(), mac_drv_clear_rx_queue(),
1454 * NOTE: The caller is responsible that the BMUs are idle
1455 * when this function is called.
1459 void mac_drv_clear_rx_queue(struct s_smc
*smc
)
1461 struct s_smt_fp_rxd
volatile *r
;
1462 struct s_smt_fp_rxd
volatile *next_rxd
;
1463 struct s_smt_rx_queue
*queue
;
1467 if (smc
->hw
.hw_state
!= STOPPED
) {
1469 SMT_PANIC(smc
,HWM_E0012
,HWM_E0012_MSG
) ;
1473 queue
= smc
->hw
.fp
.rx
[QUEUE_R1
] ;
1474 DB_RX(5, "clear_rx_queue");
1477 * dma_complete and mac_drv_clear_rxd for all RxDs / receive buffers
1479 r
= queue
->rx_curr_get
;
1480 while (queue
->rx_used
) {
1481 DRV_BUF_FLUSH(r
,DDI_DMA_SYNC_FORCPU
) ;
1482 DB_RX(5, "switch OWN bit of RxD 0x%p", r
);
1483 r
->rxd_rbctrl
&= ~cpu_to_le32(BMU_OWN
) ;
1485 DRV_BUF_FLUSH(r
,DDI_DMA_SYNC_FORDEV
) ;
1487 DRV_BUF_FLUSH(r
,DDI_DMA_SYNC_FORCPU
) ;
1488 while (r
!= queue
->rx_curr_put
&&
1489 !(r
->rxd_rbctrl
& cpu_to_le32(BMU_ST_BUF
))) {
1490 DB_RX(5, "Check STF bit in %p", r
);
1491 r
->rxd_rbctrl
&= ~cpu_to_le32(BMU_OWN
) ;
1492 DRV_BUF_FLUSH(r
,DDI_DMA_SYNC_FORDEV
) ;
1494 DRV_BUF_FLUSH(r
,DDI_DMA_SYNC_FORCPU
) ;
1497 DB_RX(5, "STF bit found");
1500 for (r
=queue
->rx_curr_get
,i
=frag_count
; i
; r
=r
->rxd_next
,i
--){
1501 DB_RX(5, "dma_complete for RxD %p", r
);
1502 dma_complete(smc
,(union s_fp_descr
volatile *)r
,DMA_WR
);
1505 DB_RX(5, "mac_drv_clear_rxd: RxD %p frag_count %d",
1506 queue
->rx_curr_get
, frag_count
);
1507 mac_drv_clear_rxd(smc
,queue
->rx_curr_get
,frag_count
) ;
1509 queue
->rx_curr_get
= next_rxd
;
1510 queue
->rx_used
-= frag_count
;
1511 queue
->rx_free
+= frag_count
;
1517 -------------------------------------------------------------
1519 -------------------------------------------------------------
1523 * BEGIN_MANUAL_ENTRY(hwm_tx_init)
1524 * int hwm_tx_init(smc,fc,frag_count,frame_len,frame_status)
1526 * function DOWN_CALL (hardware module, hwmtm.c)
1527 * hwm_tx_init checks if the frame can be sent through the
1528 * corresponding send queue.
1530 * para fc the frame control. To determine through which
1531 * send queue the frame should be transmitted.
1532 * 0x50 - 0x57: asynchronous LLC frame
1533 * 0xD0 - 0xD7: synchronous LLC frame
1534 * 0x41, 0x4F: SMT frame to the network
1535 * 0x42: SMT frame to the network and to the local SMT
1536 * 0x43: SMT frame to the local SMT
1537 * frag_count count of the fragments for this frame
1538 * frame_len length of the frame
1539 * frame_status status of the frame, the send queue bit is already
1542 * return frame_status
1546 int hwm_tx_init(struct s_smc
*smc
, u_char fc
, int frag_count
, int frame_len
,
1549 NDD_TRACE("THiB",fc
,frag_count
,frame_len
) ;
1550 smc
->os
.hwm
.tx_p
= smc
->hw
.fp
.tx
[frame_status
& QUEUE_A0
] ;
1551 smc
->os
.hwm
.tx_descr
= TX_DESCRIPTOR
| (((u_long
)(frame_len
-1)&3)<<27) ;
1552 smc
->os
.hwm
.tx_len
= frame_len
;
1553 DB_TX(3, "hwm_tx_init: fc = %x, len = %d", fc
, frame_len
);
1554 if ((fc
& ~(FC_SYNC_BIT
|FC_LLC_PRIOR
)) == FC_ASYNC_LLC
) {
1555 frame_status
|= LAN_TX
;
1561 frame_status
|= LAN_TX
;
1564 frame_status
|= LOC_TX
;
1566 case FC_SMT_LAN_LOC
:
1567 frame_status
|= LAN_TX
| LOC_TX
;
1570 SMT_PANIC(smc
,HWM_E0010
,HWM_E0010_MSG
) ;
1573 if (!smc
->hw
.mac_ring_is_up
) {
1574 frame_status
&= ~LAN_TX
;
1575 frame_status
|= RING_DOWN
;
1576 DB_TX(2, "Ring is down: terminate LAN_TX");
1578 if (frag_count
> smc
->os
.hwm
.tx_p
->tx_free
) {
1580 mac_drv_clear_txd(smc
) ;
1581 if (frag_count
> smc
->os
.hwm
.tx_p
->tx_free
) {
1582 DB_TX(2, "Out of TxDs, terminate LAN_TX");
1583 frame_status
&= ~LAN_TX
;
1584 frame_status
|= OUT_OF_TXD
;
1587 DB_TX(2, "Out of TxDs, terminate LAN_TX");
1588 frame_status
&= ~LAN_TX
;
1589 frame_status
|= OUT_OF_TXD
;
1592 DB_TX(3, "frame_status = %x", frame_status
);
1593 NDD_TRACE("THiE",frame_status
,smc
->os
.hwm
.tx_p
->tx_free
,0) ;
1594 return frame_status
;
1598 * BEGIN_MANUAL_ENTRY(hwm_tx_frag)
1599 * void hwm_tx_frag(smc,virt,phys,len,frame_status)
1601 * function DOWNCALL (hardware module, hwmtm.c)
1602 * If the frame should be sent to the LAN, this function calls
1603 * dma_master, fills the current TxD with the virtual and the
1604 * physical address, sets the STF and EOF bits dependent on
1605 * the frame status, and requests the BMU to start the
1607 * If the frame should be sent to the local SMT, an SMT_MBuf
1608 * is allocated if the FIRST_FRAG bit is set in the frame_status.
1609 * The fragment of the frame is copied into the SMT MBuf.
1610 * The function smt_received_pack is called if the LAST_FRAG
1611 * bit is set in the frame_status word.
1613 * para virt virtual pointer to the fragment
1614 * len the length of the fragment
1615 * frame_status status of the frame, see design description
1617 * return nothing returned, no parameter is modified
1619 * NOTE: It is possible to invoke this macro with a fragment length
1624 void hwm_tx_frag(struct s_smc
*smc
, char far
*virt
, u_long phys
, int len
,
1627 struct s_smt_fp_txd
volatile *t
;
1628 struct s_smt_tx_queue
*queue
;
1631 queue
= smc
->os
.hwm
.tx_p
;
1633 NDD_TRACE("THfB",virt
,len
,frame_status
) ;
1634 /* Bug fix: AF / May 31 1999 (#missing)
1635 * snmpinfo problem reported by IBM is caused by invalid
1636 * t-pointer (txd) if LAN_TX is not set but LOC_TX only.
1637 * Set: t = queue->tx_curr_put here !
1639 t
= queue
->tx_curr_put
;
1641 DB_TX(2, "hwm_tx_frag: len = %d, frame_status = %x", len
, frame_status
);
1642 if (frame_status
& LAN_TX
) {
1643 /* '*t' is already defined */
1644 DB_TX(3, "LAN_TX: TxD = %p, virt = %p", t
, virt
);
1645 t
->txd_virt
= virt
;
1646 t
->txd_txdscr
= cpu_to_le32(smc
->os
.hwm
.tx_descr
) ;
1647 t
->txd_tbadr
= cpu_to_le32(phys
) ;
1648 tbctrl
= cpu_to_le32((((__u32
)frame_status
&
1649 (FIRST_FRAG
|LAST_FRAG
|EN_IRQ_EOF
))<< 26) |
1650 BMU_OWN
|BMU_CHECK
|len
) ;
1651 t
->txd_tbctrl
= tbctrl
;
1654 DRV_BUF_FLUSH(t
,DDI_DMA_SYNC_FORDEV
) ;
1655 outpd(queue
->tx_bmu_ctl
,CSR_START
) ;
1656 #else /* ifndef AIX */
1657 DRV_BUF_FLUSH(t
,DDI_DMA_SYNC_FORDEV
) ;
1658 if (frame_status
& QUEUE_A0
) {
1659 outpd(ADDR(B0_XA_CSR
),CSR_START
) ;
1662 outpd(ADDR(B0_XS_CSR
),CSR_START
) ;
1667 queue
->tx_curr_put
= t
->txd_next
;
1668 if (frame_status
& LAST_FRAG
) {
1669 smc
->mib
.m
[MAC0
].fddiMACTransmit_Ct
++ ;
1672 if (frame_status
& LOC_TX
) {
1673 DB_TX(3, "LOC_TX:");
1674 if (frame_status
& FIRST_FRAG
) {
1675 if(!(smc
->os
.hwm
.tx_mb
= smt_get_mbuf(smc
))) {
1676 smc
->hw
.fp
.err_stats
.err_no_buf
++ ;
1677 DB_TX(4, "No SMbuf; transmit terminated");
1680 smc
->os
.hwm
.tx_data
=
1681 smtod(smc
->os
.hwm
.tx_mb
,char *) - 1 ;
1683 #ifdef PASS_1ST_TXD_2_TX_COMP
1684 hwm_cpy_txd2mb(t
,smc
->os
.hwm
.tx_data
,
1685 smc
->os
.hwm
.tx_len
) ;
1690 if (smc
->os
.hwm
.tx_mb
) {
1692 DB_TX(3, "copy fragment into MBuf");
1693 memcpy(smc
->os
.hwm
.tx_data
,virt
,len
) ;
1694 smc
->os
.hwm
.tx_data
+= len
;
1696 if (frame_status
& LAST_FRAG
) {
1698 #ifndef PASS_1ST_TXD_2_TX_COMP
1700 * hwm_cpy_txd2mb(txd,data,len) copies 'len'
1701 * bytes from the virtual pointer in 'rxd'
1702 * to 'data'. The virtual pointer of the
1703 * os-specific tx-buffer should be written
1706 hwm_cpy_txd2mb(t
,smc
->os
.hwm
.tx_data
,
1707 smc
->os
.hwm
.tx_len
) ;
1708 #endif /* nPASS_1ST_TXD_2_TX_COMP */
1709 #endif /* USE_OS_CPY */
1710 smc
->os
.hwm
.tx_data
=
1711 smtod(smc
->os
.hwm
.tx_mb
,char *) - 1 ;
1712 *(char *)smc
->os
.hwm
.tx_mb
->sm_data
=
1713 *smc
->os
.hwm
.tx_data
;
1714 smc
->os
.hwm
.tx_data
++ ;
1715 smc
->os
.hwm
.tx_mb
->sm_len
=
1716 smc
->os
.hwm
.tx_len
- 1 ;
1717 DB_TX(3, "pass LLC frame to SMT");
1718 smt_received_pack(smc
,smc
->os
.hwm
.tx_mb
,
1723 NDD_TRACE("THfE",t
,queue
->tx_free
,0) ;
1728 * queues a receive for later send
1730 static void queue_llc_rx(struct s_smc
*smc
, SMbuf
*mb
)
1732 DB_GEN(4, "queue_llc_rx: mb = %p", mb
);
1733 smc
->os
.hwm
.queued_rx_frames
++ ;
1734 mb
->sm_next
= (SMbuf
*)NULL
;
1735 if (smc
->os
.hwm
.llc_rx_pipe
== NULL
) {
1736 smc
->os
.hwm
.llc_rx_pipe
= mb
;
1739 smc
->os
.hwm
.llc_rx_tail
->sm_next
= mb
;
1741 smc
->os
.hwm
.llc_rx_tail
= mb
;
1744 * force an timer IRQ to receive the data
1746 if (!smc
->os
.hwm
.isr_flag
) {
1747 smt_force_irq(smc
) ;
1752 * get a SMbuf from the llc_rx_queue
1754 static SMbuf
*get_llc_rx(struct s_smc
*smc
)
1758 if ((mb
= smc
->os
.hwm
.llc_rx_pipe
)) {
1759 smc
->os
.hwm
.queued_rx_frames
-- ;
1760 smc
->os
.hwm
.llc_rx_pipe
= mb
->sm_next
;
1762 DB_GEN(4, "get_llc_rx: mb = 0x%p", mb
);
1767 * queues a transmit SMT MBuf during the time were the MBuf is
1768 * queued the TxD ring
1770 static void queue_txd_mb(struct s_smc
*smc
, SMbuf
*mb
)
1772 DB_GEN(4, "_rx: queue_txd_mb = %p", mb
);
1773 smc
->os
.hwm
.queued_txd_mb
++ ;
1774 mb
->sm_next
= (SMbuf
*)NULL
;
1775 if (smc
->os
.hwm
.txd_tx_pipe
== NULL
) {
1776 smc
->os
.hwm
.txd_tx_pipe
= mb
;
1779 smc
->os
.hwm
.txd_tx_tail
->sm_next
= mb
;
1781 smc
->os
.hwm
.txd_tx_tail
= mb
;
1785 * get a SMbuf from the txd_tx_queue
1787 static SMbuf
*get_txd_mb(struct s_smc
*smc
)
1791 if ((mb
= smc
->os
.hwm
.txd_tx_pipe
)) {
1792 smc
->os
.hwm
.queued_txd_mb
-- ;
1793 smc
->os
.hwm
.txd_tx_pipe
= mb
->sm_next
;
1795 DB_GEN(4, "get_txd_mb: mb = 0x%p", mb
);
1802 void smt_send_mbuf(struct s_smc
*smc
, SMbuf
*mb
, int fc
)
1810 SK_LOC_DECL(char far
,*virt
[3]) ;
1812 struct s_smt_tx_queue
*queue
;
1813 struct s_smt_fp_txd
volatile *t
;
1817 NDD_TRACE("THSB",mb
,fc
,0) ;
1818 DB_TX(4, "smt_send_mbuf: mb = 0x%p, fc = 0x%x", mb
, fc
);
1820 mb
->sm_off
-- ; /* set to fc */
1821 mb
->sm_len
++ ; /* + fc */
1822 data
= smtod(mb
,char *) ;
1824 if (fc
== FC_SMT_LOC
)
1825 *data
= FC_SMT_INFO
;
1828 * determine the frag count and the virt addresses of the frags
1833 n
= SMT_PAGESIZE
- ((long)data
& (SMT_PAGESIZE
-1)) ;
1837 DB_TX(5, "frag: virt/len = 0x%p/%d", data
, n
);
1838 virt
[frag_count
] = data
;
1839 frag_len
[frag_count
] = n
;
1846 * determine the frame status
1848 queue
= smc
->hw
.fp
.tx
[QUEUE_A0
] ;
1849 if (fc
== FC_BEACON
|| fc
== FC_SMT_LOC
) {
1850 frame_status
= LOC_TX
;
1853 frame_status
= LAN_TX
;
1854 if ((smc
->os
.hwm
.pass_NSA
&&(fc
== FC_SMT_NSA
)) ||
1855 (smc
->os
.hwm
.pass_SMT
&&(fc
== FC_SMT_INFO
)))
1856 frame_status
|= LOC_TX
;
1859 if (!smc
->hw
.mac_ring_is_up
|| frag_count
> queue
->tx_free
) {
1860 frame_status
&= ~LAN_TX
;
1862 DB_TX(2, "Ring is down: terminate LAN_TX");
1865 DB_TX(2, "Ring is down: terminate transmission");
1866 smt_free_mbuf(smc
,mb
) ;
1870 DB_TX(5, "frame_status = 0x%x", frame_status
);
1872 if ((frame_status
& LAN_TX
) && (frame_status
& LOC_TX
)) {
1873 mb
->sm_use_count
= 2 ;
1876 if (frame_status
& LAN_TX
) {
1877 t
= queue
->tx_curr_put
;
1878 frame_status
|= FIRST_FRAG
;
1879 for (i
= 0; i
< frag_count
; i
++) {
1880 DB_TX(5, "init TxD = 0x%p", t
);
1881 if (i
== frag_count
-1) {
1882 frame_status
|= LAST_FRAG
;
1883 t
->txd_txdscr
= cpu_to_le32(TX_DESCRIPTOR
|
1884 (((__u32
)(mb
->sm_len
-1)&3) << 27)) ;
1886 t
->txd_virt
= virt
[i
] ;
1887 phys
= dma_master(smc
, (void far
*)virt
[i
],
1888 frag_len
[i
], DMA_RD
|SMT_BUF
) ;
1889 t
->txd_tbadr
= cpu_to_le32(phys
) ;
1890 tbctrl
= cpu_to_le32((((__u32
)frame_status
&
1891 (FIRST_FRAG
|LAST_FRAG
)) << 26) |
1892 BMU_OWN
| BMU_CHECK
| BMU_SMT_TX
|frag_len
[i
]) ;
1893 t
->txd_tbctrl
= tbctrl
;
1895 DRV_BUF_FLUSH(t
,DDI_DMA_SYNC_FORDEV
) ;
1896 outpd(queue
->tx_bmu_ctl
,CSR_START
) ;
1898 DRV_BUF_FLUSH(t
,DDI_DMA_SYNC_FORDEV
) ;
1899 outpd(ADDR(B0_XA_CSR
),CSR_START
) ;
1901 frame_status
&= ~FIRST_FRAG
;
1902 queue
->tx_curr_put
= t
= t
->txd_next
;
1906 smc
->mib
.m
[MAC0
].fddiMACTransmit_Ct
++ ;
1907 queue_txd_mb(smc
,mb
) ;
1910 if (frame_status
& LOC_TX
) {
1911 DB_TX(5, "pass Mbuf to LLC queue");
1912 queue_llc_rx(smc
,mb
) ;
1916 * We need to unqueue the free SMT_MBUFs here, because it may
1917 * be that the SMT want's to send more than 1 frame for one down call
1919 mac_drv_clear_txd(smc
) ;
1920 NDD_TRACE("THSE",t
,queue
->tx_free
,frag_count
) ;
1923 /* BEGIN_MANUAL_ENTRY(mac_drv_clear_txd)
1924 * void mac_drv_clear_txd(smc)
1926 * function DOWNCALL (hardware module, hwmtm.c)
1927 * mac_drv_clear_txd searches in both send queues for TxD's
1928 * which were finished by the adapter. It calls dma_complete
1929 * for each TxD. If the last fragment of an LLC frame is
1930 * reached, it calls mac_drv_tx_complete to release the
1937 static void mac_drv_clear_txd(struct s_smc
*smc
)
1939 struct s_smt_tx_queue
*queue
;
1940 struct s_smt_fp_txd
volatile *t1
;
1941 struct s_smt_fp_txd
volatile *t2
= NULL
;
1948 NDD_TRACE("THcB",0,0,0) ;
1949 for (i
= QUEUE_S
; i
<= QUEUE_A0
; i
++) {
1950 queue
= smc
->hw
.fp
.tx
[i
] ;
1951 t1
= queue
->tx_curr_get
;
1952 DB_TX(5, "clear_txd: QUEUE = %d (0=sync/1=async)", i
);
1958 DRV_BUF_FLUSH(t1
,DDI_DMA_SYNC_FORCPU
) ;
1959 DB_TX(5, "check OWN/EOF bit of TxD 0x%p", t1
);
1960 tbctrl
= le32_to_cpu(CR_READ(t1
->txd_tbctrl
));
1962 if (tbctrl
& BMU_OWN
|| !queue
->tx_used
){
1963 DB_TX(4, "End of TxDs queue %d", i
);
1964 goto free_next_queue
; /* next queue */
1968 } while (!(tbctrl
& BMU_EOF
)) ;
1970 t1
= queue
->tx_curr_get
;
1971 for (n
= frag_count
; n
; n
--) {
1972 tbctrl
= le32_to_cpu(t1
->txd_tbctrl
) ;
1974 (union s_fp_descr
volatile *) t1
,
1976 ((tbctrl
& BMU_SMT_TX
) >> 18))) ;
1981 if (tbctrl
& BMU_SMT_TX
) {
1982 mb
= get_txd_mb(smc
) ;
1983 smt_free_mbuf(smc
,mb
) ;
1986 #ifndef PASS_1ST_TXD_2_TX_COMP
1987 DB_TX(4, "mac_drv_tx_comp for TxD 0x%p", t2
);
1988 mac_drv_tx_complete(smc
,t2
) ;
1990 DB_TX(4, "mac_drv_tx_comp for TxD 0x%x",
1991 queue
->tx_curr_get
);
1992 mac_drv_tx_complete(smc
,queue
->tx_curr_get
) ;
1995 queue
->tx_curr_get
= t1
;
1996 queue
->tx_free
+= frag_count
;
1997 queue
->tx_used
-= frag_count
;
2001 NDD_TRACE("THcE",0,0,0) ;
2005 * BEGINN_MANUAL_ENTRY(mac_drv_clear_tx_queue)
2007 * void mac_drv_clear_tx_queue(smc)
2008 * struct s_smc *smc ;
2010 * function DOWNCALL (hardware module, hwmtm.c)
2011 * mac_drv_clear_tx_queue is called from the SMT when
2012 * the RMT state machine has entered the ISOLATE state.
2013 * This function is also called by the os-specific module
2014 * after it has called the function card_stop().
2015 * In this case, the frames in the send queues are obsolete and
2016 * should be removed.
2018 * note calling sequence:
2019 * CLI_FBI(), card_stop(),
2020 * mac_drv_clear_tx_queue(), mac_drv_clear_rx_queue(),
2022 * NOTE: The caller is responsible that the BMUs are idle
2023 * when this function is called.
2027 void mac_drv_clear_tx_queue(struct s_smc
*smc
)
2029 struct s_smt_fp_txd
volatile *t
;
2030 struct s_smt_tx_queue
*queue
;
2034 if (smc
->hw
.hw_state
!= STOPPED
) {
2036 SMT_PANIC(smc
,HWM_E0011
,HWM_E0011_MSG
) ;
2040 for (i
= QUEUE_S
; i
<= QUEUE_A0
; i
++) {
2041 queue
= smc
->hw
.fp
.tx
[i
] ;
2042 DB_TX(5, "clear_tx_queue: QUEUE = %d (0=sync/1=async)", i
);
2045 * switch the OWN bit of all pending frames to the host
2047 t
= queue
->tx_curr_get
;
2048 tx_used
= queue
->tx_used
;
2050 DRV_BUF_FLUSH(t
,DDI_DMA_SYNC_FORCPU
) ;
2051 DB_TX(5, "switch OWN bit of TxD 0x%p", t
);
2052 t
->txd_tbctrl
&= ~cpu_to_le32(BMU_OWN
) ;
2053 DRV_BUF_FLUSH(t
,DDI_DMA_SYNC_FORDEV
) ;
2060 * release all TxD's for both send queues
2062 mac_drv_clear_txd(smc
) ;
2064 for (i
= QUEUE_S
; i
<= QUEUE_A0
; i
++) {
2065 queue
= smc
->hw
.fp
.tx
[i
] ;
2066 t
= queue
->tx_curr_get
;
2069 * write the phys pointer of the NEXT descriptor into the
2070 * BMU's current address descriptor pointer and set
2071 * tx_curr_get and tx_curr_put to this position
2074 outpd(ADDR(B5_XS_DA
),le32_to_cpu(t
->txd_ntdadr
)) ;
2077 outpd(ADDR(B5_XA_DA
),le32_to_cpu(t
->txd_ntdadr
)) ;
2080 queue
->tx_curr_put
= queue
->tx_curr_get
->txd_next
;
2081 queue
->tx_curr_get
= queue
->tx_curr_put
;
2087 -------------------------------------------------------------
2089 -------------------------------------------------------------
2094 * BEGIN_MANUAL_ENTRY(mac_drv_debug_lev)
2095 * void mac_drv_debug_lev(smc,flag,lev)
2097 * function DOWNCALL (drvsr.c)
2098 * To get a special debug info the user can assign a debug level
2099 * to any debug flag.
2101 * para flag debug flag, possible values are:
2102 * = 0: reset all debug flags (the defined level is
2111 * = 10: debug.d_os.hwm_rx (hardware module receive path)
2112 * = 11: debug.d_os.hwm_tx(hardware module transmit path)
2113 * = 12: debug.d_os.hwm_gen(hardware module general flag)
2119 void mac_drv_debug_lev(struct s_smc
*smc
, int flag
, int lev
)
2123 DB_P
.d_smtf
= DB_P
.d_smt
= DB_P
.d_ecm
= DB_P
.d_rmt
= 0 ;
2125 DB_P
.d_os
.hwm_rx
= DB_P
.d_os
.hwm_tx
= DB_P
.d_os
.hwm_gen
= 0 ;
2162 DB_P
.d_os
.hwm_rx
= lev
;
2165 DB_P
.d_os
.hwm_tx
= lev
;
2168 DB_P
.d_os
.hwm_gen
= lev
;