| 497 | } |
| 498 | |
| 499 | void |
| 500 | firewire_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 |
nothing calls this directly
no test coverage detected