smc90cx6.c (147256) | smc90cx6.c (148887) |
---|---|
1/* $NetBSD: smc90cx6.c,v 1.38 2001/07/07 15:57:53 thorpej Exp $ */ 2 3#include <sys/cdefs.h> | 1/* $NetBSD: smc90cx6.c,v 1.38 2001/07/07 15:57:53 thorpej Exp $ */ 2 3#include <sys/cdefs.h> |
4__FBSDID("$FreeBSD: head/sys/dev/cm/smc90cx6.c 147256 2005-06-10 16:49:24Z brooks $"); | 4__FBSDID("$FreeBSD: head/sys/dev/cm/smc90cx6.c 148887 2005-08-09 10:20:02Z rwatson $"); |
5 6/*- 7 * Copyright (c) 1994, 1995, 1998 The NetBSD Foundation, Inc. 8 * All rights reserved. 9 * 10 * This code is derived from software contributed to The NetBSD Foundation 11 * by Ignatios Souvatzis. 12 * --- 113 unchanged lines hidden (view full) --- 126 * Transmit direction: 127 * 128 * cm_start checks tx_fillcount 129 * case 2: return 130 * 131 * else fill tx_act ^ 1 && inc tx_fillcount 132 * 133 * check tx_fillcount again. | 5 6/*- 7 * Copyright (c) 1994, 1995, 1998 The NetBSD Foundation, Inc. 8 * All rights reserved. 9 * 10 * This code is derived from software contributed to The NetBSD Foundation 11 * by Ignatios Souvatzis. 12 * --- 113 unchanged lines hidden (view full) --- 126 * Transmit direction: 127 * 128 * cm_start checks tx_fillcount 129 * case 2: return 130 * 131 * else fill tx_act ^ 1 && inc tx_fillcount 132 * 133 * check tx_fillcount again. |
134 * case 2: set IFF_OACTIVE to stop arc_output from filling us. | 134 * case 2: set IFF_DRV_OACTIVE to stop arc_output from filling us. |
135 * case 1: start tx 136 * 137 * tint clears IFF_OCATIVE, decrements and checks tx_fillcount 138 * case 1: start tx on tx_act ^ 1, softcall cm_start 139 * case 0: softcall cm_start 140 * 141 * #define fill(i) get mbuf && copy mbuf to chip(i) 142 */ --- 212 unchanged lines hidden (view full) --- 355 void *xsc; 356{ 357 struct cm_softc *sc = (struct cm_softc *)xsc; 358 struct ifnet *ifp; 359 int s; 360 361 ifp = sc->sc_ifp; 362 | 135 * case 1: start tx 136 * 137 * tint clears IFF_OCATIVE, decrements and checks tx_fillcount 138 * case 1: start tx on tx_act ^ 1, softcall cm_start 139 * case 0: softcall cm_start 140 * 141 * #define fill(i) get mbuf && copy mbuf to chip(i) 142 */ --- 212 unchanged lines hidden (view full) --- 355 void *xsc; 356{ 357 struct cm_softc *sc = (struct cm_softc *)xsc; 358 struct ifnet *ifp; 359 int s; 360 361 ifp = sc->sc_ifp; 362 |
363 if ((ifp->if_flags & IFF_RUNNING) == 0) { | 363 if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { |
364 s = splimp(); | 364 s = splimp(); |
365 ifp->if_flags |= IFF_RUNNING; | 365 ifp->if_drv_flags |= IFF_DRV_RUNNING; |
366 cm_reset(sc); 367 cm_start(ifp); 368 splx(s); 369 } 370} 371 372/* 373 * Reset the interface... --- 62 unchanged lines hidden (view full) --- 436 if_printf(ifp, "reset: started receiver, status=0x%02x\n", 437 GETREG(CMSTAT)); 438#endif 439 440 /* and init transmitter status */ 441 sc->sc_tx_act = 0; 442 sc->sc_tx_fillcount = 0; 443 | 366 cm_reset(sc); 367 cm_start(ifp); 368 splx(s); 369 } 370} 371 372/* 373 * Reset the interface... --- 62 unchanged lines hidden (view full) --- 436 if_printf(ifp, "reset: started receiver, status=0x%02x\n", 437 GETREG(CMSTAT)); 438#endif 439 440 /* and init transmitter status */ 441 sc->sc_tx_act = 0; 442 sc->sc_tx_fillcount = 0; 443 |
444 ifp->if_flags |= IFF_RUNNING; 445 ifp->if_flags &= ~IFF_OACTIVE; | 444 ifp->if_drv_flags |= IFF_DRV_RUNNING; 445 ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; |
446 447 cm_start(ifp); 448} 449 450/* 451 * Take interface offline 452 */ 453void --- 31 unchanged lines hidden (view full) --- 485#ifdef CMTIMINGS 486 u_long copystart, lencopy, perbyte; 487#endif 488 489#if defined(CM_DEBUG) && (CM_DEBUG > 3) 490 if_printf(ifp, "start(%p)\n", ifp); 491#endif 492 | 446 447 cm_start(ifp); 448} 449 450/* 451 * Take interface offline 452 */ 453void --- 31 unchanged lines hidden (view full) --- 485#ifdef CMTIMINGS 486 u_long copystart, lencopy, perbyte; 487#endif 488 489#if defined(CM_DEBUG) && (CM_DEBUG > 3) 490 if_printf(ifp, "start(%p)\n", ifp); 491#endif 492 |
493 if ((ifp->if_flags & IFF_RUNNING) == 0) | 493 if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) |
494 return; 495 496 s = splimp(); 497 498 if (sc->sc_tx_fillcount >= 2) { 499 splx(s); 500 return; 501 } --- 70 unchanged lines hidden (view full) --- 572 /* actually transmit the packet */ 573 s = splimp(); 574 575 if (++sc->sc_tx_fillcount > 1) { 576 /* 577 * We are filled up to the rim. No more bufs for the moment, 578 * please. 579 */ | 494 return; 495 496 s = splimp(); 497 498 if (sc->sc_tx_fillcount >= 2) { 499 splx(s); 500 return; 501 } --- 70 unchanged lines hidden (view full) --- 572 /* actually transmit the packet */ 573 s = splimp(); 574 575 if (++sc->sc_tx_fillcount > 1) { 576 /* 577 * We are filled up to the rim. No more bufs for the moment, 578 * please. 579 */ |
580 ifp->if_flags |= IFF_OACTIVE; | 580 ifp->if_drv_flags |= IFF_DRV_OACTIVE; |
581 } else { 582#ifdef CM_DEBUG 583 if_printf(ifp, "start: starting transmitter on buffer %d\n", 584 buffer); 585#endif 586 /* Transmitter was off, start it */ 587 sc->sc_tx_act = buffer; 588 589 /* 590 * We still can accept another buf, so don't: | 581 } else { 582#ifdef CM_DEBUG 583 if_printf(ifp, "start: starting transmitter on buffer %d\n", 584 buffer); 585#endif 586 /* Transmitter was off, start it */ 587 sc->sc_tx_act = buffer; 588 589 /* 590 * We still can accept another buf, so don't: |
591 * ifp->if_flags |= IFF_OACTIVE; | 591 * ifp->if_drv_flags |= IFF_DRV_OACTIVE; |
592 */ 593 sc->sc_intmask |= CM_TA; 594 PUTREG(CMCMD, CM_TX(buffer)); 595 PUTREG(CMSTAT, sc->sc_intmask); 596 597 ifp->if_timer = ARCTIMEOUT; 598 } 599 splx(s); --- 158 unchanged lines hidden (view full) --- 758 return; 759 } 760#endif 761 else 762 ifp->if_oerrors++; 763 764 765 /* We know we can accept another buffer at this point. */ | 592 */ 593 sc->sc_intmask |= CM_TA; 594 PUTREG(CMCMD, CM_TX(buffer)); 595 PUTREG(CMSTAT, sc->sc_intmask); 596 597 ifp->if_timer = ARCTIMEOUT; 598 } 599 splx(s); --- 158 unchanged lines hidden (view full) --- 758 return; 759 } 760#endif 761 else 762 ifp->if_oerrors++; 763 764 765 /* We know we can accept another buffer at this point. */ |
766 ifp->if_flags &= ~IFF_OACTIVE; | 766 ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; |
767 768 if (--sc->sc_tx_fillcount > 0) { 769 770 /* 771 * start tx on other buffer. 772 * This also clears the int flag 773 */ 774 buffer ^= 1; --- 224 unchanged lines hidden (view full) --- 999 case SIOCADDMULTI: 1000 case SIOCDELMULTI: 1001 case SIOCSIFMTU: 1002 error = arc_ioctl(ifp, command, data); 1003 break; 1004 1005 case SIOCSIFFLAGS: 1006 if ((ifp->if_flags & IFF_UP) == 0 && | 767 768 if (--sc->sc_tx_fillcount > 0) { 769 770 /* 771 * start tx on other buffer. 772 * This also clears the int flag 773 */ 774 buffer ^= 1; --- 224 unchanged lines hidden (view full) --- 999 case SIOCADDMULTI: 1000 case SIOCDELMULTI: 1001 case SIOCSIFMTU: 1002 error = arc_ioctl(ifp, command, data); 1003 break; 1004 1005 case SIOCSIFFLAGS: 1006 if ((ifp->if_flags & IFF_UP) == 0 && |
1007 (ifp->if_flags & IFF_RUNNING) != 0) { | 1007 (ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) { |
1008 /* 1009 * If interface is marked down and it is running, 1010 * then stop it. 1011 */ 1012 cm_stop(sc); | 1008 /* 1009 * If interface is marked down and it is running, 1010 * then stop it. 1011 */ 1012 cm_stop(sc); |
1013 ifp->if_flags &= ~IFF_RUNNING; | 1013 ifp->if_drv_flags &= ~IFF_DRV_RUNNING; |
1014 } else if ((ifp->if_flags & IFF_UP) != 0 && | 1014 } else if ((ifp->if_flags & IFF_UP) != 0 && |
1015 (ifp->if_flags & IFF_RUNNING) == 0) { | 1015 (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { |
1016 /* 1017 * If interface is marked up and it is stopped, then 1018 * start it. 1019 */ 1020 cm_init(sc); 1021 } 1022 break; 1023 --- 32 unchanged lines hidden --- | 1016 /* 1017 * If interface is marked up and it is stopped, then 1018 * start it. 1019 */ 1020 cm_init(sc); 1021 } 1022 break; 1023 --- 32 unchanged lines hidden --- |