diff --git a/sys/netnatm/natm.c b/sys/netnatm/natm.c index 2a5d54798367..29ff2b2ef5c5 100644 --- a/sys/netnatm/natm.c +++ b/sys/netnatm/natm.c @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -79,10 +80,10 @@ static int natm_usr_connect(struct socket *, struct sockaddr *, d_thread_t *); static int natm_usr_disconnect(struct socket *); static int natm_usr_shutdown(struct socket *); static int natm_usr_send(struct socket *, int, struct mbuf *, - struct sockaddr *, struct mbuf *, d_thread_t *); + struct sockaddr *, struct mbuf *, d_thread_t *); static int natm_usr_peeraddr(struct socket *, struct sockaddr **); static int natm_usr_control(struct socket *, u_long, caddr_t, - struct ifnet *, d_thread_t *); + struct ifnet *, d_thread_t *); static int natm_usr_abort(struct socket *); static int natm_usr_bind(struct socket *, struct sockaddr *, d_thread_t *); static int natm_usr_sockaddr(struct socket *, struct sockaddr **); @@ -94,7 +95,7 @@ natm_usr_attach(struct socket *so, int proto, d_thread_t *p) int error = 0; int s = SPLSOFTNET(); - npcb = (struct natmpcb *) so->so_pcb; + npcb = (struct natmpcb *)so->so_pcb; if (npcb) { error = EISCONN; @@ -124,7 +125,7 @@ natm_usr_detach(struct socket *so) int error = 0; int s = SPLSOFTNET(); - npcb = (struct natmpcb *) so->so_pcb; + npcb = (struct natmpcb *)so->so_pcb; if (npcb == NULL) { error = EINVAL; goto out; @@ -152,7 +153,7 @@ natm_usr_connect(struct socket *so, struct sockaddr *nam, d_thread_t *p) int s2, s = SPLSOFTNET(); int proto = so->so_proto->pr_protocol; - npcb = (struct natmpcb *) so->so_pcb; + npcb = (struct natmpcb *)so->so_pcb; if (npcb == NULL) { error = EINVAL; goto out; @@ -161,7 +162,6 @@ natm_usr_connect(struct socket *so, struct sockaddr *nam, d_thread_t *p) /* * validate nam and npcb */ - snatm = (struct sockaddr_natm *)nam; if (snatm->snatm_len != sizeof(*snatm) || (npcb->npcb_flags & NPCB_FREE) == 0) { @@ -173,13 +173,12 @@ natm_usr_connect(struct socket *so, struct sockaddr *nam, d_thread_t *p) goto out; } - snatm->snatm_if[IFNAMSIZ-1] = '\0'; /* XXX ensure null termination - since ifunit() uses strcmp */ + snatm->snatm_if[IFNAMSIZ - 1] = '\0'; /* XXX ensure null termination + since ifunit() uses strcmp */ /* * convert interface string to ifp, validate. */ - ifp = ifunit(snatm->snatm_if); if (ifp == NULL || (ifp->if_flags & IFF_RUNNING) == 0) { error = ENXIO; @@ -193,7 +192,6 @@ natm_usr_connect(struct socket *so, struct sockaddr *nam, d_thread_t *p) /* * register us with the NATM PCB layer */ - if (npcb_add(npcb, ifp, snatm->snatm_vci, snatm->snatm_vpi) != npcb) { error = EADDRINUSE; goto out; @@ -202,7 +200,6 @@ natm_usr_connect(struct socket *so, struct sockaddr *nam, d_thread_t *p) /* * enable rx */ - ATM_PH_FLAGS(&api.aph) = (proto == PROTO_NATMAAL5) ? ATM_PH_AAL5 : 0; ATM_PH_VPI(&api.aph) = npcb->npcb_vpi; ATM_PH_SETVCI(&api.aph, npcb->npcb_vci); @@ -233,7 +230,7 @@ natm_usr_disconnect(struct socket *so) int error = 0; int s2, s = SPLSOFTNET(); - npcb = (struct natmpcb *) so->so_pcb; + npcb = (struct natmpcb *)so->so_pcb; if (npcb == NULL) { error = EINVAL; goto out; @@ -249,7 +246,6 @@ natm_usr_disconnect(struct socket *so) /* * disable rx */ - ATM_PH_FLAGS(&api.aph) = ATM_PH_AAL5; ATM_PH_VPI(&api.aph) = npcb->npcb_vpi; ATM_PH_SETVCI(&api.aph, npcb->npcb_vci); @@ -271,12 +267,12 @@ static int natm_usr_shutdown(struct socket *so) { socantsendmore(so); - return 0; + return (0); } static int natm_usr_send(struct socket *so, int flags, struct mbuf *m, - struct sockaddr *nam, struct mbuf *control, d_thread_t *p) + struct sockaddr *nam, struct mbuf *control, d_thread_t *p) { struct natmpcb *npcb; struct atm_pseudohdr *aph; @@ -284,7 +280,7 @@ natm_usr_send(struct socket *so, int flags, struct mbuf *m, int s = SPLSOFTNET(); int proto = so->so_proto->pr_protocol; - npcb = (struct natmpcb *) so->so_pcb; + npcb = (struct natmpcb *)so->so_pcb; if (npcb == NULL) { error = EINVAL; goto out; @@ -300,7 +296,6 @@ natm_usr_send(struct socket *so, int flags, struct mbuf *m, /* * send the data. we must put an atm_pseudohdr on first */ - M_PREPEND(m, sizeof(*aph), M_TRYWAIT); if (m == NULL) { error = ENOBUFS; @@ -326,7 +321,7 @@ natm_usr_peeraddr(struct socket *so, struct sockaddr **nam) int error = 0; int s = SPLSOFTNET(); - npcb = (struct natmpcb *) so->so_pcb; + npcb = (struct natmpcb *)so->so_pcb; if (npcb == NULL) { error = EINVAL; goto out; @@ -349,14 +344,14 @@ natm_usr_peeraddr(struct socket *so, struct sockaddr **nam) static int natm_usr_control(struct socket *so, u_long cmd, caddr_t arg, - struct ifnet *ifp, d_thread_t *p) + struct ifnet *ifp, d_thread_t *p) { struct natmpcb *npcb; struct atm_rawioctl ario; int error = 0; int s = SPLSOFTNET(); - npcb = (struct natmpcb *) so->so_pcb; + npcb = (struct natmpcb *)so->so_pcb; if (npcb == NULL) { error = EINVAL; goto out; @@ -374,7 +369,7 @@ natm_usr_control(struct socket *so, u_long cmd, caddr_t arg, ario.npcb = npcb; ario.rawvalue = *((int *)arg); error = npcb->npcb_ifp->if_ioctl(npcb->npcb_ifp, - SIOCXRAWATM, (caddr_t) &ario); + SIOCXRAWATM, (caddr_t) &ario); if (!error) { if (ario.rawvalue) npcb->npcb_flags |= NPCB_RAW; @@ -396,19 +391,19 @@ natm_usr_control(struct socket *so, u_long cmd, caddr_t arg, static int natm_usr_abort(struct socket *so) { - return natm_usr_shutdown(so); + return (natm_usr_shutdown(so)); } static int natm_usr_bind(struct socket *so, struct sockaddr *nam, d_thread_t *p) { - return EOPNOTSUPP; + return (EOPNOTSUPP); } static int natm_usr_sockaddr(struct socket *so, struct sockaddr **nam) { - return EOPNOTSUPP; + return (EOPNOTSUPP); } /* xxx - should be const */ @@ -700,100 +695,80 @@ struct proc *p; * pointer. we can get the interface pointer from the so's PCB if * we really need it. */ - void natmintr(struct mbuf *m) { - int s; - struct socket *so; - struct natmpcb *npcb; + int s; + struct socket *so; + struct natmpcb *npcb; #ifdef DIAGNOSTIC - M_ASSERTPKTHDR(m); + M_ASSERTPKTHDR(m); #endif - npcb = (struct natmpcb *) m->m_pkthdr.rcvif; /* XXX: overloaded */ - so = npcb->npcb_socket; + npcb = (struct natmpcb *)m->m_pkthdr.rcvif; /* XXX: overloaded */ + so = npcb->npcb_socket; - s = splimp(); /* could have atm devs @ different levels */ - npcb->npcb_inq--; - splx(s); + s = splimp(); /* could have atm devs @ different levels */ + npcb->npcb_inq--; + splx(s); - if (npcb->npcb_flags & NPCB_DRAIN) { - m_freem(m); - if (npcb->npcb_inq == 0) - FREE(npcb, M_PCB); /* done! */ - return; - } + if (npcb->npcb_flags & NPCB_DRAIN) { + m_freem(m); + if (npcb->npcb_inq == 0) + FREE(npcb, M_PCB); /* done! */ + return; + } - if (npcb->npcb_flags & NPCB_FREE) { - m_freem(m); /* drop */ - return; - } + if (npcb->npcb_flags & NPCB_FREE) { + m_freem(m); /* drop */ + return; + } #ifdef NEED_TO_RESTORE_IFP - m->m_pkthdr.rcvif = npcb->npcb_ifp; + m->m_pkthdr.rcvif = npcb->npcb_ifp; #else #ifdef DIAGNOSTIC -m->m_pkthdr.rcvif = NULL; /* null it out to be safe */ + m->m_pkthdr.rcvif = NULL; /* null it out to be safe */ #endif #endif - if (sbspace(&so->so_rcv) > m->m_pkthdr.len || - ((npcb->npcb_flags & NPCB_RAW) != 0 && so->so_rcv.sb_cc < NPCB_RAWCC) ) { + if (sbspace(&so->so_rcv) > m->m_pkthdr.len || + ((npcb->npcb_flags & NPCB_RAW) != 0 && + so->so_rcv.sb_cc < NPCB_RAWCC)) { #ifdef NATM_STAT - natm_sookcnt++; - natm_sookbytes += m->m_pkthdr.len; + natm_sookcnt++; + natm_sookbytes += m->m_pkthdr.len; #endif - sbappendrecord(&so->so_rcv, m); - sorwakeup(so); - } else { + sbappendrecord(&so->so_rcv, m); + sorwakeup(so); + } else { #ifdef NATM_STAT - natm_sodropcnt++; - natm_sodropbytes += m->m_pkthdr.len; + natm_sodropcnt++; + natm_sodropbytes += m->m_pkthdr.len; #endif - m_freem(m); - } + m_freem(m); + } } /* * natm0_sysctl: not used, but here in case we want to add something * later... */ - -int natm0_sysctl(name, namelen, oldp, oldlenp, newp, newlen) - -int *name; -u_int namelen; -void *oldp; -size_t *oldlenp; -void *newp; -size_t newlen; - +int +natm0_sysctl(SYSCTL_HANDLER_ARGS) { - /* All sysctl names at this level are terminal. */ - if (namelen != 1) - return (ENOTDIR); - return (ENOPROTOOPT); + /* All sysctl names at this level are terminal. */ + return (ENOENT); } /* * natm5_sysctl: not used, but here in case we want to add something * later... */ - -int natm5_sysctl(name, namelen, oldp, oldlenp, newp, newlen) - -int *name; -u_int namelen; -void *oldp; -size_t *oldlenp; -void *newp; -size_t newlen; - +int +natm5_sysctl(SYSCTL_HANDLER_ARGS) { - /* All sysctl names at this level are terminal. */ - if (namelen != 1) - return (ENOTDIR); - return (ENOPROTOOPT); + /* All sysctl names at this level are terminal. */ + return (ENOENT); } diff --git a/sys/netnatm/natm.h b/sys/netnatm/natm.h index aa4cf3c3f092..d0469df09251 100644 --- a/sys/netnatm/natm.h +++ b/sys/netnatm/natm.h @@ -37,34 +37,31 @@ * natm.h: native mode atm */ - /* * supported protocols */ - -#define PROTO_NATMAAL0 1 -#define PROTO_NATMAAL5 2 +#define PROTO_NATMAAL0 1 +#define PROTO_NATMAAL5 2 /* * sockaddr_natm */ struct sockaddr_natm { - u_int8_t snatm_len; /* length */ - u_int8_t snatm_family; /* AF_NATM */ - char snatm_if[IFNAMSIZ]; /* interface name */ - u_int16_t snatm_vci; /* vci */ - u_int8_t snatm_vpi; /* vpi */ + unsigned char snatm_len; /* length */ + sa_family_t snatm_family; /* AF_NATM */ + char snatm_if[IFNAMSIZ]; /* interface name */ + u_int16_t snatm_vci; /* vci */ + u_int8_t snatm_vpi; /* vpi */ }; - #if defined(__FreeBSD__) && defined(_KERNEL) -#define SPLSOFTNET() splnet() +#define SPLSOFTNET() splnet() #elif defined(__NetBSD__) || defined(__OpenBSD__) -#define SPLSOFTNET() splsoftnet() +#define SPLSOFTNET() splsoftnet() #endif @@ -73,28 +70,27 @@ struct sockaddr_natm { /* * natm protocol control block */ - struct natmpcb { - LIST_ENTRY(natmpcb) pcblist; /* list pointers */ - u_int npcb_inq; /* # of our pkts in proto q */ - struct socket *npcb_socket; /* backpointer to socket */ - struct ifnet *npcb_ifp; /* pointer to hardware */ - struct in_addr ipaddr; /* remote IP address, if APCB_IP */ - u_int16_t npcb_vci; /* VCI */ - u_int8_t npcb_vpi; /* VPI */ - u_int8_t npcb_flags; /* flags */ + LIST_ENTRY(natmpcb) pcblist; /* list pointers */ + u_int npcb_inq; /* # of our pkts in proto q */ + struct socket *npcb_socket; /* backpointer to socket */ + struct ifnet *npcb_ifp; /* pointer to hardware */ + struct in_addr ipaddr; /* remote IP address, if APCB_IP */ + u_int16_t npcb_vci; /* VCI */ + u_int8_t npcb_vpi; /* VPI */ + u_int8_t npcb_flags; /* flags */ }; /* flags */ -#define NPCB_FREE 0x01 /* free (not on any list) */ -#define NPCB_CONNECTED 0x02 /* connected */ -#define NPCB_IP 0x04 /* used by IP */ -#define NPCB_DRAIN 0x08 /* destory as soon as inq == 0 */ -#define NPCB_RAW 0x10 /* in 'raw' mode? */ +#define NPCB_FREE 0x01 /* free (not on any list) */ +#define NPCB_CONNECTED 0x02 /* connected */ +#define NPCB_IP 0x04 /* used by IP */ +#define NPCB_DRAIN 0x08 /* destory as soon as inq == 0 */ +#define NPCB_RAW 0x10 /* in 'raw' mode? */ /* flag arg to npcb_free */ -#define NPCB_REMOVE 0 /* remove from global list */ -#define NPCB_DESTROY 1 /* destroy and be free */ +#define NPCB_REMOVE 0 /* remove from global list */ +#define NPCB_DESTROY 1 /* destroy and be free */ /* * NPCB_RAWCC is a hack which applies to connections in 'raw' mode. it @@ -103,8 +99,7 @@ struct natmpcb { * * XXX: socket buffering needs to be looked at. */ - -#define NPCB_RAWCC (1024*1024) /* 1MB */ +#define NPCB_RAWCC (1024*1024) /* 1MB */ LIST_HEAD(npcblist, natmpcb); @@ -113,10 +108,10 @@ LIST_HEAD(npcblist, natmpcb); extern struct npcblist natm_pcbs; /* global list of pcbs */ #define NATM_STAT #ifdef NATM_STAT -extern u_int natm_sodropcnt, - natm_sodropbytes; /* account of droppage */ -extern u_int natm_sookcnt, - natm_sookbytes; /* account of ok */ +extern u_int natm_sodropcnt; +extern u_int natm_sodropbytes; /* account of droppage */ +extern u_int natm_sookcnt; +extern u_int natm_sookbytes; /* account of ok */ #endif /* atm_rawioctl: kernel's version of SIOCRAWATM [for internal use only!] */ @@ -124,34 +119,38 @@ struct atm_rawioctl { struct natmpcb *npcb; int rawvalue; }; -#define SIOCXRAWATM _IOWR('a', 125, struct atm_rawioctl) +#define SIOCXRAWATM _IOWR('a', 125, struct atm_rawioctl) /* external functions */ /* natm_pcb.c */ struct natmpcb *npcb_alloc(int); void npcb_free(struct natmpcb *, int); -struct natmpcb *npcb_add(struct natmpcb *, struct ifnet *, int, int); +struct natmpcb *npcb_add(struct natmpcb *, struct ifnet *, uint16_t, uint8_t); /* natm.c */ #if defined(__NetBSD__) || defined(__OpenBSD__) int natm_usrreq(struct socket *, int, struct mbuf *, - struct mbuf *, struct mbuf *, struct proc *); + struct mbuf *, struct mbuf *, struct proc *); #elif defined(__FreeBSD__) #if __FreeBSD__ > 2 /* * FreeBSD new usrreqs style appeared since 2.2. compatibility to old style * has gone since 3.0. */ -#define FREEBSD_USRREQS +#define FREEBSD_USRREQS extern struct pr_usrreqs natm_usrreqs; #else /* !( __FreeBSD__ > 2) */ int natm_usrreq(struct socket *, int, struct mbuf *, - struct mbuf *, struct mbuf *); + struct mbuf *, struct mbuf *); #endif /* !( __FreeBSD__ > 2) */ #endif -int natm0_sysctl(int *, u_int, void *, size_t *, void *, size_t); -int natm5_sysctl(int *, u_int, void *, size_t *, void *, size_t); + +#ifdef SYSCTL_HANDLER_ARGS +int natm0_sysctl(SYSCTL_HANDLER_ARGS); +int natm5_sysctl(SYSCTL_HANDLER_ARGS); +#endif + void natmintr(struct mbuf *); #endif diff --git a/sys/netnatm/natm_pcb.c b/sys/netnatm/natm_pcb.c index 3d74b115461c..01455276be9d 100644 --- a/sys/netnatm/natm_pcb.c +++ b/sys/netnatm/natm_pcb.c @@ -56,52 +56,46 @@ struct npcblist natm_pcbs; /* * npcb_alloc: allocate a npcb [in the free state] */ - -struct natmpcb *npcb_alloc(wait) - -int wait; +struct natmpcb * +npcb_alloc(int wait) { - struct natmpcb *npcb; + struct natmpcb *npcb; - MALLOC(npcb, struct natmpcb *, sizeof(*npcb), M_PCB, wait | M_ZERO); + npcb = malloc(sizeof(*npcb), M_PCB, wait | M_ZERO); #ifdef DIAGNOSTIC - if (wait == M_WAITOK && npcb == NULL) panic("npcb_alloc: malloc didn't wait"); + if (wait == M_WAITOK && npcb == NULL) + panic("npcb_alloc: malloc didn't wait"); #endif - if (npcb) - npcb->npcb_flags = NPCB_FREE; - - return(npcb); + if (npcb != NULL) + npcb->npcb_flags = NPCB_FREE; + return (npcb); } /* * npcb_free: free a npcb */ - -void npcb_free(npcb, op) - -struct natmpcb *npcb; -int op; - +void +npcb_free(struct natmpcb *npcb, int op) { - int s = splimp(); + int s = splimp(); - if ((npcb->npcb_flags & NPCB_FREE) == 0) { - LIST_REMOVE(npcb, pcblist); - npcb->npcb_flags = NPCB_FREE; - } - if (op == NPCB_DESTROY) { - if (npcb->npcb_inq) { - npcb->npcb_flags = NPCB_DRAIN; /* flag for distruction */ - } else { - FREE(npcb, M_PCB); /* kill it! */ - } - } + if ((npcb->npcb_flags & NPCB_FREE) == 0) { + LIST_REMOVE(npcb, pcblist); + npcb->npcb_flags = NPCB_FREE; + } + if (op == NPCB_DESTROY) { + if (npcb->npcb_inq) { + npcb->npcb_flags = NPCB_DRAIN; /* flag for distruct. */ + } else { + FREE(npcb, M_PCB); /* kill it! */ + } + } - splx(s); + splx(s); } @@ -109,84 +103,69 @@ int op; * npcb_add: add or remove npcb from main list * returns npcb if ok */ - -struct natmpcb *npcb_add(npcb, ifp, vci, vpi) - -struct natmpcb *npcb; -struct ifnet *ifp; -u_int16_t vci; -u_int8_t vpi; - +struct natmpcb * +npcb_add(struct natmpcb *npcb, struct ifnet *ifp, u_int16_t vci, u_int8_t vpi) { - struct natmpcb *cpcb = NULL; /* current pcb */ - int s = splimp(); + struct natmpcb *cpcb = NULL; /* current pcb */ + int s = splimp(); - /* - * lookup required - */ + /* + * lookup required + */ + LIST_FOREACH(cpcb, &natm_pcbs, pcblist) + if (ifp == cpcb->npcb_ifp && vci == cpcb->npcb_vci && + vpi == cpcb->npcb_vpi) + break; - for (cpcb = LIST_FIRST(&natm_pcbs) ; cpcb != NULL ; - cpcb = LIST_NEXT(cpcb, pcblist)) { - if (ifp == cpcb->npcb_ifp && vci == cpcb->npcb_vci && vpi == cpcb->npcb_vpi) - break; - } - - /* - * add & something already there? - */ - - if (cpcb) { - cpcb = NULL; - goto done; /* fail */ - } + /* + * add & something already there? + */ + if (cpcb) { + cpcb = NULL; + goto done; /* fail */ + } - /* - * need to allocate a pcb? - */ + /* + * need to allocate a pcb? + */ + if (npcb == NULL) { + /* could be called from lower half */ + cpcb = npcb_alloc(M_NOWAIT); + if (cpcb == NULL) + goto done; /* fail */ + } else { + cpcb = npcb; + } - if (npcb == NULL) { - cpcb = npcb_alloc(M_NOWAIT); /* could be called from lower half */ - if (cpcb == NULL) - goto done; /* fail */ - } else { - cpcb = npcb; - } + cpcb->npcb_ifp = ifp; + cpcb->ipaddr.s_addr = 0; + cpcb->npcb_vci = vci; + cpcb->npcb_vpi = vpi; + cpcb->npcb_flags = NPCB_CONNECTED; - cpcb->npcb_ifp = ifp; - cpcb->ipaddr.s_addr = 0; - cpcb->npcb_vci = vci; - cpcb->npcb_vpi = vpi; - cpcb->npcb_flags = NPCB_CONNECTED; - - LIST_INSERT_HEAD(&natm_pcbs, cpcb, pcblist); + LIST_INSERT_HEAD(&natm_pcbs, cpcb, pcblist); done: - splx(s); - return(cpcb); + splx(s); + return (cpcb); } - - #ifdef DDB -int npcb_dump(void); - -int npcb_dump() - +int +npcb_dump(void) { - struct natmpcb *cpcb; + struct natmpcb *cpcb; - printf("npcb dump:\n"); - for (cpcb = LIST_FIRST(&natm_pcbs) ; cpcb != NULL ; - cpcb = LIST_NEXT(cpcb, pcblist)) { - printf("if=%s, vci=%d, vpi=%d, IP=0x%x, sock=%p, flags=0x%x, inq=%d\n", - cpcb->npcb_ifp->if_xname, cpcb->npcb_vci, cpcb->npcb_vpi, - cpcb->ipaddr.s_addr, cpcb->npcb_socket, - cpcb->npcb_flags, cpcb->npcb_inq); - } - printf("done\n"); - return(0); + printf("npcb dump:\n"); + LIST_FOREACH(cpcb, &natm_pcbs, pcblist) { + printf("if=%s, vci=%d, vpi=%d, IP=0x%x, sock=%p, flags=0x%x, " + "inq=%d\n", cpcb->npcb_ifp->if_xname, cpcb->npcb_vci, + cpcb->npcb_vpi, cpcb->ipaddr.s_addr, cpcb->npcb_socket, + cpcb->npcb_flags, cpcb->npcb_inq); + } + printf("done\n"); + return (0); } - #endif diff --git a/sys/netnatm/natm_proto.c b/sys/netnatm/natm_proto.c index 71ef01ca0554..5848cc89cc26 100644 --- a/sys/netnatm/natm_proto.c +++ b/sys/netnatm/natm_proto.c @@ -106,24 +106,23 @@ static struct domain natmdomain = natmsw, &natmsw[sizeof(natmsw)/sizeof(natmsw[0])], 0, 0, 0, 0}; -static int natmqmaxlen = IFQ_MAXLEN; /* max # of packets on queue */ +static int natmqmaxlen = 1000 /* IFQ_MAXLEN */; /* max # of packets on queue */ static struct ifqueue natmintrq; #ifdef NATM_STAT -u_int natm_sodropcnt = 0; /* # mbufs dropped due to full sb */ -u_int natm_sodropbytes = 0; /* # of bytes dropped */ -u_int natm_sookcnt = 0; /* # mbufs ok */ -u_int natm_sookbytes = 0; /* # of bytes ok */ +u_int natm_sodropcnt; /* # mbufs dropped due to full sb */ +u_int natm_sodropbytes; /* # of bytes dropped */ +u_int natm_sookcnt; /* # mbufs ok */ +u_int natm_sookbytes; /* # of bytes ok */ #endif - -static void natm_init() - +static void +natm_init(void) { - LIST_INIT(&natm_pcbs); - bzero(&natmintrq, sizeof(natmintrq)); - natmintrq.ifq_maxlen = natmqmaxlen; - mtx_init(&natmintrq.ifq_mtx, "natm_inq", NULL, MTX_DEF); - netisr_register(NETISR_NATM, natmintr, &natmintrq); + LIST_INIT(&natm_pcbs); + bzero(&natmintrq, sizeof(natmintrq)); + natmintrq.ifq_maxlen = natmqmaxlen; + mtx_init(&natmintrq.ifq_mtx, "natm_inq", NULL, MTX_DEF); + netisr_register(NETISR_NATM, natmintr, &natmintrq); } #if defined(__FreeBSD__)