Deleted Added
sdiff udiff text old ( 111790 ) new ( 111888 )
full compact
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 $
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)
245{
246 switch(ether_type) {
247#ifdef IPX
248 case ETHERTYPE_IPX:
249 schednetisr(NETISR_IPX);
250 *inq = &ipxintrq;
251 break;
252#endif
253#ifdef INET
254 case ETHERTYPE_IP:
255 if (ipflow_fastforward(m))
256 return 1;
257 schednetisr(NETISR_IP);
258 *inq = &ipintrq;
259 break;
260
261 case ETHERTYPE_ARP:
262 schednetisr(NETISR_ARP);
263 *inq = &arpintrq;
264 break;
265#endif
266 default:
267 return EPROTONOSUPPORT;
268 }
269 return 0;
270}
271
272static int __inline
273ef_inputSNAP(struct mbuf *m, struct ether_header *eh, struct llc* l,
274 u_short ether_type, struct ifqueue **inq)
275{
276 switch(ether_type) {
277#ifdef IPX
278 case ETHERTYPE_IPX:
279 m_adj(m, 8);
280 schednetisr(NETISR_IPX);
281 *inq = &ipxintrq;
282 break;
283#endif
284 default:
285 return EPROTONOSUPPORT;
286 }
287 return 0;
288}
289
290static int __inline
291ef_input8022(struct mbuf *m, struct ether_header *eh, struct llc* l,
292 u_short ether_type, struct ifqueue **inq)
293{
294 switch(ether_type) {
295#ifdef IPX
296 case 0xe0:
297 m_adj(m, 3);
298 schednetisr(NETISR_IPX);
299 *inq = &ipxintrq;
300 break;
301#endif
302 default:
303 return EPROTONOSUPPORT;
304 }
305 return 0;
306}
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;
315 struct ifqueue *inq;
316 struct efnet *efp;
317 struct ifnet *eifp;
318 struct llc *l;
319 struct ef_link *efl;
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 */
380 inq = NULL;
381 switch(ft) {
382 case ETHER_FT_EII:
383 if (ef_inputEII(m, eh, ether_type, &inq) != 0)
384 return EPROTONOSUPPORT;
385 break;
386#ifdef IPX
387 case ETHER_FT_8023: /* only IPX can be here */
388 schednetisr(NETISR_IPX);
389 inq = &ipxintrq;
390 break;
391#endif
392 case ETHER_FT_SNAP:
393 if (ef_inputSNAP(m, eh, l, ether_type, &inq) != 0)
394 return EPROTONOSUPPORT;
395 break;
396 case ETHER_FT_8022:
397 if (ef_input8022(m, eh, l, ether_type, &inq) != 0)
398 return EPROTONOSUPPORT;
399 break;
400 }
401
402 if (inq == NULL) {
403 EFDEBUG("No support for frame %d and proto %04x\n",
404 ft, ether_type);
405 return EPROTONOSUPPORT;
406 }
407 (void) IF_HANDOFF(inq, m, NULL);
408 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 ---