MCPcopy Create free account
hub / github.com/F-Stack/f-stack / firewire_input

Function firewire_input

freebsd/net/if_fwsubr.c:499–638  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

497}
498
499void
500firewire_input(struct ifnet *ifp, struct mbuf *m, uint16_t src)
501{
502 struct fw_com *fc = IFP2FWC(ifp);
503 union fw_encap *enc;
504 int type, isr;
505
506 /*
507 * The caller has already stripped off the packet header
508 * (stream or wreqb) and marked the mbuf's M_BCAST flag
509 * appropriately. We de-encapsulate the IP packet and pass it
510 * up the line after handling link-level fragmentation.
511 */
512 if (m->m_pkthdr.len < sizeof(uint32_t)) {
513 if_printf(ifp, "discarding frame without "
514 "encapsulation header (len %u pkt len %u)\n",
515 m->m_len, m->m_pkthdr.len);
516 }
517
518 m = m_pullup(m, sizeof(uint32_t));
519 if (m == NULL)
520 return;
521 enc = mtod(m, union fw_encap *);
522
523 /*
524 * Byte swap the encapsulation header manually.
525 */
526 enc->ul[0] = ntohl(enc->ul[0]);
527
528 if (enc->unfrag.lf != 0) {
529 m = m_pullup(m, 2*sizeof(uint32_t));
530 if (!m)
531 return;
532 enc = mtod(m, union fw_encap *);
533 enc->ul[1] = ntohl(enc->ul[1]);
534 m = firewire_input_fragment(fc, m, src);
535 if (!m)
536 return;
537 enc = mtod(m, union fw_encap *);
538 type = enc->firstfrag.ether_type;
539 m_adj(m, 2*sizeof(uint32_t));
540 } else {
541 type = enc->unfrag.ether_type;
542 m_adj(m, sizeof(uint32_t));
543 }
544
545 if (m->m_pkthdr.rcvif == NULL) {
546 if_printf(ifp, "discard frame w/o interface pointer\n");
547 if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
548 m_freem(m);
549 return;
550 }
551#ifdef DIAGNOSTIC
552 if (m->m_pkthdr.rcvif != ifp) {
553 if_printf(ifp, "Warning, frame marked as received on %s\n",
554 m->m_pkthdr.rcvif->if_xname);
555 }
556#endif

Callers

nothing calls this directly

Calls 11

if_printfFunction · 0.85
m_pullupFunction · 0.85
firewire_input_fragmentFunction · 0.85
m_adjFunction · 0.85
if_inc_counterFunction · 0.85
mac_ifnet_create_mbufFunction · 0.85
m_tag_locateFunction · 0.85
bpf_mtap2Function · 0.85
netisr_dispatchFunction · 0.85
bpf_peers_presentFunction · 0.70
m_freemFunction · 0.50

Tested by

no test coverage detected