if_cp.c (147862) | if_cp.c (148887) |
---|---|
1/*- 2 * Cronyx-Tau-PCI adapter driver for FreeBSD. 3 * Supports PPP/HDLC, Cisco/HDLC and FrameRelay protocol in synchronous mode, 4 * and asyncronous channels with full modem control. 5 * Keepalive protocol implemented in both Cisco and PPP modes. 6 * 7 * Copyright (C) 1999-2004 Cronyx Engineering. 8 * Author: Kurakin Roman, <rik@cronyx.ru> --- 8 unchanged lines hidden (view full) --- 17 * modify and redistribute this software in source and binary forms, 18 * as long as this message is kept with the software, all derivative 19 * works or modified versions. 20 * 21 * Cronyx Id: if_cp.c,v 1.1.2.41 2004/06/23 17:09:13 rik Exp $ 22 */ 23 24#include <sys/cdefs.h> | 1/*- 2 * Cronyx-Tau-PCI adapter driver for FreeBSD. 3 * Supports PPP/HDLC, Cisco/HDLC and FrameRelay protocol in synchronous mode, 4 * and asyncronous channels with full modem control. 5 * Keepalive protocol implemented in both Cisco and PPP modes. 6 * 7 * Copyright (C) 1999-2004 Cronyx Engineering. 8 * Author: Kurakin Roman, <rik@cronyx.ru> --- 8 unchanged lines hidden (view full) --- 17 * modify and redistribute this software in source and binary forms, 18 * as long as this message is kept with the software, all derivative 19 * works or modified versions. 20 * 21 * Cronyx Id: if_cp.c,v 1.1.2.41 2004/06/23 17:09:13 rik Exp $ 22 */ 23 24#include <sys/cdefs.h> |
25__FBSDID("$FreeBSD: head/sys/dev/cp/if_cp.c 147862 2005-07-09 16:14:05Z rik $"); | 25__FBSDID("$FreeBSD: head/sys/dev/cp/if_cp.c 148887 2005-08-09 10:20:02Z rwatson $"); |
26 27#include <sys/param.h> 28#include <sys/ucred.h> 29#include <sys/proc.h> 30#include <sys/systm.h> 31#include <sys/mbuf.h> 32#include <sys/kernel.h> 33#include <sys/module.h> --- 675 unchanged lines hidden (view full) --- 709 * Process an ioctl request. 710 */ 711static int cp_sioctl (struct ifnet *ifp, u_long cmd, caddr_t data) 712{ 713 drv_t *d = ifp->if_softc; 714 bdrv_t *bd = d->board->sys; 715 int error, s, was_up, should_be_up; 716 | 26 27#include <sys/param.h> 28#include <sys/ucred.h> 29#include <sys/proc.h> 30#include <sys/systm.h> 31#include <sys/mbuf.h> 32#include <sys/kernel.h> 33#include <sys/module.h> --- 675 unchanged lines hidden (view full) --- 709 * Process an ioctl request. 710 */ 711static int cp_sioctl (struct ifnet *ifp, u_long cmd, caddr_t data) 712{ 713 drv_t *d = ifp->if_softc; 714 bdrv_t *bd = d->board->sys; 715 int error, s, was_up, should_be_up; 716 |
717 was_up = (ifp->if_flags & IFF_RUNNING) != 0; | 717 was_up = (ifp->if_drv_flags & IFF_DRV_RUNNING) != 0; |
718 error = sppp_ioctl (ifp, cmd, data); 719 720 if (error) 721 return error; 722 723 if (! (ifp->if_flags & IFF_DEBUG)) 724 d->chan->debug = 0; 725 else if (! d->chan->debug) --- 5 unchanged lines hidden (view full) --- 731 case SIOCDELMULTI: CP_DEBUG2 (d, ("ioctl SIOCDELMULTI\n")); return 0; 732 case SIOCSIFFLAGS: CP_DEBUG2 (d, ("ioctl SIOCSIFFLAGS\n")); break; 733 case SIOCSIFADDR: CP_DEBUG2 (d, ("ioctl SIOCSIFADDR\n")); break; 734 } 735 736 /* We get here only in case of SIFFLAGS or SIFADDR. */ 737 s = splimp (); 738 CP_LOCK (bd); | 718 error = sppp_ioctl (ifp, cmd, data); 719 720 if (error) 721 return error; 722 723 if (! (ifp->if_flags & IFF_DEBUG)) 724 d->chan->debug = 0; 725 else if (! d->chan->debug) --- 5 unchanged lines hidden (view full) --- 731 case SIOCDELMULTI: CP_DEBUG2 (d, ("ioctl SIOCDELMULTI\n")); return 0; 732 case SIOCSIFFLAGS: CP_DEBUG2 (d, ("ioctl SIOCSIFFLAGS\n")); break; 733 case SIOCSIFADDR: CP_DEBUG2 (d, ("ioctl SIOCSIFADDR\n")); break; 734 } 735 736 /* We get here only in case of SIFFLAGS or SIFADDR. */ 737 s = splimp (); 738 CP_LOCK (bd); |
739 should_be_up = (ifp->if_flags & IFF_RUNNING) != 0; | 739 should_be_up = (ifp->if_drv_flags & IFF_DRV_RUNNING) != 0; |
740 if (! was_up && should_be_up) { 741 /* Interface goes up -- start it. */ 742 cp_up (d); 743 cp_start (d); 744 } else if (was_up && ! should_be_up) { 745 /* Interface is going down -- stop it. */ 746/* if ((IFP2SP(ifp)->pp_flags & PP_FR) || (ifp->if_flags & PP_CISCO))*/ 747 cp_down (d); --- 91 unchanged lines hidden (view full) --- 839 /* Set up transmit timeout, if the transmit ring is not empty.*/ 840#ifdef NETGRAPH 841 d->timeout = 10; 842#else 843 d->ifp->if_timer = 10; 844#endif 845 } 846#ifndef NETGRAPH | 740 if (! was_up && should_be_up) { 741 /* Interface goes up -- start it. */ 742 cp_up (d); 743 cp_start (d); 744 } else if (was_up && ! should_be_up) { 745 /* Interface is going down -- stop it. */ 746/* if ((IFP2SP(ifp)->pp_flags & PP_FR) || (ifp->if_flags & PP_CISCO))*/ 747 cp_down (d); --- 91 unchanged lines hidden (view full) --- 839 /* Set up transmit timeout, if the transmit ring is not empty.*/ 840#ifdef NETGRAPH 841 d->timeout = 10; 842#else 843 d->ifp->if_timer = 10; 844#endif 845 } 846#ifndef NETGRAPH |
847 d->ifp->if_flags |= IFF_OACTIVE; | 847 d->ifp->if_drv_flags |= IFF_DRV_OACTIVE; |
848#endif 849} 850 851/* 852 * Start output on the interface. 853 * Always called on splimp(). 854 */ 855static void cp_start (drv_t *d) --- 35 unchanged lines hidden (view full) --- 891static void cp_transmit (cp_chan_t *c, void *attachment, int len) 892{ 893 drv_t *d = c->sys; 894 895#ifdef NETGRAPH 896 d->timeout = 0; 897#else 898 ++d->ifp->if_opackets; | 848#endif 849} 850 851/* 852 * Start output on the interface. 853 * Always called on splimp(). 854 */ 855static void cp_start (drv_t *d) --- 35 unchanged lines hidden (view full) --- 891static void cp_transmit (cp_chan_t *c, void *attachment, int len) 892{ 893 drv_t *d = c->sys; 894 895#ifdef NETGRAPH 896 d->timeout = 0; 897#else 898 ++d->ifp->if_opackets; |
899 d->ifp->if_flags &= ~IFF_OACTIVE; | 899 d->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; |
900 d->ifp->if_timer = 0; 901#endif 902 cp_start (d); 903} 904 905static void cp_receive (cp_chan_t *c, unsigned char *data, int len) 906{ 907 drv_t *d = c->sys; --- 60 unchanged lines hidden (view full) --- 968#endif 969 break; 970 case CP_UNDERRUN: 971 CP_DEBUG (d, ("underrun error\n")); 972#ifdef NETGRAPH 973 d->timeout = 0; 974#else 975 ++d->ifp->if_oerrors; | 900 d->ifp->if_timer = 0; 901#endif 902 cp_start (d); 903} 904 905static void cp_receive (cp_chan_t *c, unsigned char *data, int len) 906{ 907 drv_t *d = c->sys; --- 60 unchanged lines hidden (view full) --- 968#endif 969 break; 970 case CP_UNDERRUN: 971 CP_DEBUG (d, ("underrun error\n")); 972#ifdef NETGRAPH 973 d->timeout = 0; 974#else 975 ++d->ifp->if_oerrors; |
976 d->ifp->if_flags &= ~IFF_OACTIVE; | 976 d->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; |
977 d->ifp->if_timer = 0; 978#endif 979 cp_start (d); 980 break; 981 default: 982 CP_DEBUG (d, ("error #%d\n", data)); 983 break; 984 } --- 73 unchanged lines hidden (view full) --- 1058 return 0; 1059 1060 case SERIAL_SETPROTO: 1061 CP_DEBUG2 (d, ("ioctl: setproto\n")); 1062 /* Only for superuser! */ 1063 error = suser (td); 1064 if (error) 1065 return error; | 977 d->ifp->if_timer = 0; 978#endif 979 cp_start (d); 980 break; 981 default: 982 CP_DEBUG (d, ("error #%d\n", data)); 983 break; 984 } --- 73 unchanged lines hidden (view full) --- 1058 return 0; 1059 1060 case SERIAL_SETPROTO: 1061 CP_DEBUG2 (d, ("ioctl: setproto\n")); 1062 /* Only for superuser! */ 1063 error = suser (td); 1064 if (error) 1065 return error; |
1066 if (d->ifp->if_flags & IFF_RUNNING) | 1066 if (d->ifp->if_drv_flags & IFF_DRV_RUNNING) |
1067 return EBUSY; 1068 if (! strcmp ("cisco", (char*)data)) { 1069 IFP2SP(d->ifp)->pp_flags &= ~(PP_FR); 1070 IFP2SP(d->ifp)->pp_flags |= PP_KEEPALIVE; 1071 d->ifp->if_flags |= PP_CISCO; 1072 } else if (! strcmp ("fr", (char*)data) && PP_FR) { 1073 d->ifp->if_flags &= ~(PP_CISCO); 1074 IFP2SP(d->ifp)->pp_flags |= PP_FR | PP_KEEPALIVE; --- 1253 unchanged lines hidden --- | 1067 return EBUSY; 1068 if (! strcmp ("cisco", (char*)data)) { 1069 IFP2SP(d->ifp)->pp_flags &= ~(PP_FR); 1070 IFP2SP(d->ifp)->pp_flags |= PP_KEEPALIVE; 1071 d->ifp->if_flags |= PP_CISCO; 1072 } else if (! strcmp ("fr", (char*)data) && PP_FR) { 1073 d->ifp->if_flags &= ~(PP_CISCO); 1074 IFP2SP(d->ifp)->pp_flags |= PP_FR | PP_KEEPALIVE; --- 1253 unchanged lines hidden --- |