3 * ===================================
4 * HARP | Host ATM Research Platform
5 * ===================================
8 * This Host ATM Research Platform ("HARP") file (the "Software") is
9 * made available by Network Computing Services, Inc. ("NetworkCS")
10 * "AS IS". NetworkCS does not provide maintenance, improvements or
11 * support of any kind.
13 * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
14 * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
15 * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
16 * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
17 * In no event shall NetworkCS be responsible for any damages, including
18 * but not limited to consequential damages, arising from or relating to
19 * any use of the Software or related support.
21 * Copyright 1994-1998 Network Computing Services, Inc.
23 * Copies of this Software may be made, however, the above copyright
24 * notice must be reproduced on all copies.
26 * @(#) $FreeBSD: src/sys/netatm/ipatm/ipatm_input.c,v 1.4 2000/01/17 20:49:43 mks Exp $
34 * Process stack and data input
38 #include <netatm/kern_include.h>
40 #include <netatm/ipatm/ipatm_var.h>
43 __RCSID("@(#) $FreeBSD: src/sys/netatm/ipatm/ipatm_input.c,v 1.4 2000/01/17 20:49:43 mks Exp $");
48 * Process VCC Input Data
51 * tok ipatm connection token (pointer to ipvcc)
52 * m pointer to input packet buffer chain
59 ipatm_cpcs_data(tok, m)
63 struct ipvcc *ivp = tok;
67 atm_pdu_print(m, "ipatm_input");
74 if (ivp->iv_state != IPVCC_ACTIVE) {
76 ipatm_stat.ias_rcvstate++;
81 * IP packet - reset idle timer
88 (void) ipatm_ipinput(ivp->iv_ipnif, m);
93 * IP Input Packet Handler
95 * All IP packets received from various ATM sources will be sent here
96 * for final queuing to the IP layer.
99 * inp pointer to packet's receiving IP network interface
100 * m pointer to packet buffer chain
103 * 0 packet successfully queued to IP layer
104 * else error queuing packet, buffer chain freed
108 ipatm_ipinput(inp, m)
119 atm_pdu_print(m, "ipatm_ipinput");
128 panic("ipatm_ipinput: no packet header");
138 if (m->m_pkthdr.len != cnt) {
139 panic("ipatm_ipinput: packet length incorrect");
144 * Save the input ifnet pointer in the packet header
146 m->m_pkthdr.rcvif = (struct ifnet *)inp->inf_nif;
148 #else /* ! BSD >= 199103 */
150 * Stick ifnet pointer onto front of packet - hopefully
151 * there'll be room in the first buffer.
153 KB_HEADROOM(m, space);
154 if (space < sizeof(struct ifnet *)) {
158 * We have to allocate another buffer and tack it
159 * onto the front of the packet
161 KB_ALLOCPKT(n, sizeof(struct ifnet *),
162 KB_F_NOWAIT, KB_T_HEADER);
165 ipatm_stat.ias_rcvnobuf++;
168 KB_LEN(n) = sizeof(struct ifnet *);
173 * Header fits, just adjust buffer controls
175 KB_HEADADJ(m, sizeof(struct ifnet *));
180 KB_DATASTART(m, p, struct ifnet **);
181 *p = (struct ifnet *)inp->inf_nif;
183 #endif /* ! BSD >= 199103 */
186 * Finally, hand packet off to IP.
188 * NB: Since we're already in the softint kernel state, we
189 * just call IP directly to avoid the extra unnecessary
193 if (IF_QFULL(&ipintrq)) {
200 IF_ENQUEUE(&ipintrq, m);
205 schednetisr ( NETISR_IP );
206 #endif /* BSD >= 199506 */
207 #endif /* defined(BSD) */