Deleted Added
full compact
if_ef.c (111790) if_ef.c (111888)
1/*-
2 * Copyright (c) 1999, 2000 Boris Popov
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 1999, 2000 Boris Popov
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/net/if_ef.c 111790 2003-03-03 05:04:57Z mdodd $
26 * $FreeBSD: head/sys/net/if_ef.c 111888 2003-03-04 23:19:55Z jlemon $
27 */
28
29#include "opt_inet.h"
30#include "opt_ipx.h"
31#include "opt_ef.h"
32
33#include <sys/param.h>
34#include <sys/systm.h>

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

235 return;
236}
237
238/*
239 * Inline functions do not put additional overhead to procedure call or
240 * parameter passing but simplify the code
241 */
242static int __inline
27 */
28
29#include "opt_inet.h"
30#include "opt_ipx.h"
31#include "opt_ef.h"
32
33#include <sys/param.h>
34#include <sys/systm.h>

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

235 return;
236}
237
238/*
239 * Inline functions do not put additional overhead to procedure call or
240 * parameter passing but simplify the code
241 */
242static int __inline
243ef_inputEII(struct mbuf *m, struct ether_header *eh,
244 u_short ether_type, struct ifqueue **inq)
243ef_inputEII(struct mbuf *m, struct ether_header *eh, u_short ether_type)
245{
244{
245 int isr;
246
246 switch(ether_type) {
247#ifdef IPX
247 switch(ether_type) {
248#ifdef IPX
248 case ETHERTYPE_IPX:
249 schednetisr(NETISR_IPX);
250 *inq = &ipxintrq;
249 case ETHERTYPE_IPX:
250 isr = NETISR_IPX;
251 break;
252#endif
253#ifdef INET
251 break;
252#endif
253#ifdef INET
254 case ETHERTYPE_IP:
254 case ETHERTYPE_IP:
255 if (ipflow_fastforward(m))
255 if (ipflow_fastforward(m))
256 return 1;
257 schednetisr(NETISR_IP);
258 *inq = &ipintrq;
256 return (0);
257 isr = NETISR_IP;
259 break;
260
258 break;
259
261 case ETHERTYPE_ARP:
262 schednetisr(NETISR_ARP);
263 *inq = &arpintrq;
260 case ETHERTYPE_ARP:
261 isr = NETISR_ARP;
264 break;
265#endif
262 break;
263#endif
266 default:
267 return EPROTONOSUPPORT;
264 default:
265 return (EPROTONOSUPPORT);
268 }
266 }
269 return 0;
267 netisr_dispatch(isr, m);
268 return (0);
270}
271
272static int __inline
273ef_inputSNAP(struct mbuf *m, struct ether_header *eh, struct llc* l,
269}
270
271static int __inline
272ef_inputSNAP(struct mbuf *m, struct ether_header *eh, struct llc* l,
274 u_short ether_type, struct ifqueue **inq)
273 u_short ether_type)
275{
274{
275 int isr;
276
276 switch(ether_type) {
277#ifdef IPX
277 switch(ether_type) {
278#ifdef IPX
278 case ETHERTYPE_IPX:
279 case ETHERTYPE_IPX:
279 m_adj(m, 8);
280 m_adj(m, 8);
280 schednetisr(NETISR_IPX);
281 *inq = &ipxintrq;
281 isr = NETISR_IPX;
282 break;
283#endif
282 break;
283#endif
284 default:
285 return EPROTONOSUPPORT;
284 default:
285 return (EPROTONOSUPPORT);
286 }
286 }
287 return 0;
287 netisr_dispatch(isr, m);
288 return (0);
288}
289
290static int __inline
291ef_input8022(struct mbuf *m, struct ether_header *eh, struct llc* l,
289}
290
291static int __inline
292ef_input8022(struct mbuf *m, struct ether_header *eh, struct llc* l,
292 u_short ether_type, struct ifqueue **inq)
293 u_short ether_type)
293{
294{
295 int isr;
296
294 switch(ether_type) {
295#ifdef IPX
297 switch(ether_type) {
298#ifdef IPX
296 case 0xe0:
299 case 0xe0:
297 m_adj(m, 3);
300 m_adj(m, 3);
298 schednetisr(NETISR_IPX);
299 *inq = &ipxintrq;
301 isr = NETISR_IPX;
300 break;
301#endif
302 break;
303#endif
302 default:
303 return EPROTONOSUPPORT;
304 default:
305 return (EPROTONOSUPPORT);
304 }
306 }
305 return 0;
307 netisr_dispatch(isr, m);
308 return (0);
306}
309}
310
307/*
308 * Called from ether_input()
309 */
310static int
311ef_input(struct ifnet *ifp, struct ether_header *eh, struct mbuf *m)
312{
313 u_short ether_type;
314 int ft = -1;
311/*
312 * Called from ether_input()
313 */
314static int
315ef_input(struct ifnet *ifp, struct ether_header *eh, struct mbuf *m)
316{
317 u_short ether_type;
318 int ft = -1;
315 struct ifqueue *inq;
316 struct efnet *efp;
317 struct ifnet *eifp;
318 struct llc *l;
319 struct ef_link *efl;
319 struct efnet *efp;
320 struct ifnet *eifp;
321 struct llc *l;
322 struct ef_link *efl;
323 int isr;
320
321 ether_type = ntohs(eh->ether_type);
322 if (ether_type < ETHERMTU) {
323 l = mtod(m, struct llc*);
324 if (l->llc_dsap == 0xff && l->llc_ssap == 0xff) {
325 /*
326 * Novell's "802.3" frame
327 */

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

372 m0.m_next = m;
373 m0.m_len = ETHER_HDR_LEN;
374 m0.m_data = (char *)eh;
375 BPF_MTAP(eifp, &m0);
376 }
377 /*
378 * Now we ready to adjust mbufs and pass them to protocol intr's
379 */
324
325 ether_type = ntohs(eh->ether_type);
326 if (ether_type < ETHERMTU) {
327 l = mtod(m, struct llc*);
328 if (l->llc_dsap == 0xff && l->llc_ssap == 0xff) {
329 /*
330 * Novell's "802.3" frame
331 */

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

376 m0.m_next = m;
377 m0.m_len = ETHER_HDR_LEN;
378 m0.m_data = (char *)eh;
379 BPF_MTAP(eifp, &m0);
380 }
381 /*
382 * Now we ready to adjust mbufs and pass them to protocol intr's
383 */
380 inq = NULL;
381 switch(ft) {
384 switch(ft) {
382 case ETHER_FT_EII:
383 if (ef_inputEII(m, eh, ether_type, &inq) != 0)
384 return EPROTONOSUPPORT;
385 case ETHER_FT_EII:
386 return (ef_inputEII(m, eh, ether_type));
385 break;
386#ifdef IPX
387 break;
388#ifdef IPX
387 case ETHER_FT_8023: /* only IPX can be here */
388 schednetisr(NETISR_IPX);
389 inq = &ipxintrq;
389 case ETHER_FT_8023: /* only IPX can be here */
390 isr = NETISR_IPX;
390 break;
391#endif
391 break;
392#endif
392 case ETHER_FT_SNAP:
393 if (ef_inputSNAP(m, eh, l, ether_type, &inq) != 0)
394 return EPROTONOSUPPORT;
393 case ETHER_FT_SNAP:
394 return (ef_inputSNAP(m, eh, l, ether_type));
395 break;
395 break;
396 case ETHER_FT_8022:
397 if (ef_input8022(m, eh, l, ether_type, &inq) != 0)
398 return EPROTONOSUPPORT;
396 case ETHER_FT_8022:
397 return (ef_input8022(m, eh, l, ether_type));
399 break;
398 break;
400 }
401
402 if (inq == NULL) {
399 default:
403 EFDEBUG("No support for frame %d and proto %04x\n",
404 ft, ether_type);
400 EFDEBUG("No support for frame %d and proto %04x\n",
401 ft, ether_type);
405 return EPROTONOSUPPORT;
402 return (EPROTONOSUPPORT);
406 }
403 }
407 (void) IF_HANDOFF(inq, m, NULL);
408 return 0;
404 netisr_dispatch(isr, m);
405 return (0);
409}
410
411static int
412ef_output(struct ifnet *ifp, struct mbuf **mp, struct sockaddr *dst, short *tp,
413 int *hlen)
414{
415 struct mbuf *m = *mp;
416 u_char *cp;

--- 191 unchanged lines hidden ---
406}
407
408static int
409ef_output(struct ifnet *ifp, struct mbuf **mp, struct sockaddr *dst, short *tp,
410 int *hlen)
411{
412 struct mbuf *m = *mp;
413 u_char *cp;

--- 191 unchanged lines hidden ---