Deleted Added
full compact
natm.c (111119) natm.c (111888)
1/* $NetBSD: natm.c,v 1.5 1996/11/09 03:26:26 chuck Exp $ */
1/* $NetBSD: natm.c,v 1.5 1996/11/09 03:26:26 chuck Exp $ */
2/* $FreeBSD: head/sys/netnatm/natm.c 111119 2003-02-19 05:47:46Z imp $ */
2/* $FreeBSD: head/sys/netnatm/natm.c 111888 2003-03-04 23:19:55Z jlemon $ */
3
4/*
5 *
6 * Copyright (c) 1996 Charles D. Cranor and Washington University.
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions

--- 682 unchanged lines hidden (view full) ---

693 * natmintr: splsoftnet interrupt
694 *
695 * note: we expect a socket pointer in rcvif rather than an interface
696 * pointer. we can get the interface pointer from the so's PCB if
697 * we really need it.
698 */
699
700void
3
4/*
5 *
6 * Copyright (c) 1996 Charles D. Cranor and Washington University.
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions

--- 682 unchanged lines hidden (view full) ---

693 * natmintr: splsoftnet interrupt
694 *
695 * note: we expect a socket pointer in rcvif rather than an interface
696 * pointer. we can get the interface pointer from the so's PCB if
697 * we really need it.
698 */
699
700void
701natmintr()
702
701natmintr(struct mbuf *m)
703{
704 int s;
702{
703 int s;
705 struct mbuf *m;
706 struct socket *so;
707 struct natmpcb *npcb;
708
704 struct socket *so;
705 struct natmpcb *npcb;
706
709next:
710 s = splimp();
711 IF_DEQUEUE(&natmintrq, m);
712 splx(s);
713 if (m == NULL)
714 return;
715
716#ifdef DIAGNOSTIC
717 if ((m->m_flags & M_PKTHDR) == 0)
718 panic("natmintr no HDR");
719#endif
720
721 npcb = (struct natmpcb *) m->m_pkthdr.rcvif; /* XXX: overloaded */
722 so = npcb->npcb_socket;
723
724 s = splimp(); /* could have atm devs @ different levels */
725 npcb->npcb_inq--;
726 splx(s);
727
728 if (npcb->npcb_flags & NPCB_DRAIN) {
729 m_freem(m);
730 if (npcb->npcb_inq == 0)
731 FREE(npcb, M_PCB); /* done! */
707#ifdef DIAGNOSTIC
708 if ((m->m_flags & M_PKTHDR) == 0)
709 panic("natmintr no HDR");
710#endif
711
712 npcb = (struct natmpcb *) m->m_pkthdr.rcvif; /* XXX: overloaded */
713 so = npcb->npcb_socket;
714
715 s = splimp(); /* could have atm devs @ different levels */
716 npcb->npcb_inq--;
717 splx(s);
718
719 if (npcb->npcb_flags & NPCB_DRAIN) {
720 m_freem(m);
721 if (npcb->npcb_inq == 0)
722 FREE(npcb, M_PCB); /* done! */
732 goto next;
723 return;
733 }
734
735 if (npcb->npcb_flags & NPCB_FREE) {
736 m_freem(m); /* drop */
724 }
725
726 if (npcb->npcb_flags & NPCB_FREE) {
727 m_freem(m); /* drop */
737 goto next;
728 return;
738 }
739
740#ifdef NEED_TO_RESTORE_IFP
741 m->m_pkthdr.rcvif = npcb->npcb_ifp;
742#else
743#ifdef DIAGNOSTIC
744m->m_pkthdr.rcvif = NULL; /* null it out to be safe */
745#endif

--- 9 unchanged lines hidden (view full) ---

755 sorwakeup(so);
756 } else {
757#ifdef NATM_STAT
758 natm_sodropcnt++;
759 natm_sodropbytes += m->m_pkthdr.len;
760#endif
761 m_freem(m);
762 }
729 }
730
731#ifdef NEED_TO_RESTORE_IFP
732 m->m_pkthdr.rcvif = npcb->npcb_ifp;
733#else
734#ifdef DIAGNOSTIC
735m->m_pkthdr.rcvif = NULL; /* null it out to be safe */
736#endif

--- 9 unchanged lines hidden (view full) ---

746 sorwakeup(so);
747 } else {
748#ifdef NATM_STAT
749 natm_sodropcnt++;
750 natm_sodropbytes += m->m_pkthdr.len;
751#endif
752 m_freem(m);
753 }
763
764 goto next;
765}
766
754}
755
767#if defined(__FreeBSD__)
768static void
769netisr_natm_setup(void *dummy __unused)
770{
771
772 register_netisr(NETISR_NATM, natmintr);
773}
774SYSINIT(natm_setup, SI_SUB_CPU, SI_ORDER_ANY, netisr_natm_setup, NULL);
775#endif
776
777
778/*
779 * natm0_sysctl: not used, but here in case we want to add something
780 * later...
781 */
782
783int natm0_sysctl(name, namelen, oldp, oldlenp, newp, newlen)
784
785int *name;

--- 33 unchanged lines hidden ---
756/*
757 * natm0_sysctl: not used, but here in case we want to add something
758 * later...
759 */
760
761int natm0_sysctl(name, namelen, oldp, oldlenp, newp, newlen)
762
763int *name;

--- 33 unchanged lines hidden ---