* Process a received Infiniband packet. */
| 402 | * Process a received Infiniband packet. |
| 403 | */ |
| 404 | static void |
| 405 | infiniband_input(struct ifnet *ifp, struct mbuf *m) |
| 406 | { |
| 407 | struct infiniband_header *ibh; |
| 408 | struct epoch_tracker et; |
| 409 | int isr; |
| 410 | |
| 411 | CURVNET_SET_QUIET(ifp->if_vnet); |
| 412 | |
| 413 | if ((ifp->if_flags & IFF_UP) == 0) { |
| 414 | if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); |
| 415 | m_freem(m); |
| 416 | goto done; |
| 417 | } |
| 418 | |
| 419 | ibh = mtod(m, struct infiniband_header *); |
| 420 | |
| 421 | /* |
| 422 | * Reset layer specific mbuf flags to avoid confusing upper |
| 423 | * layers: |
| 424 | */ |
| 425 | m->m_flags &= ~M_VLANTAG; |
| 426 | m_clrprotoflags(m); |
| 427 | |
| 428 | if (INFINIBAND_IS_MULTICAST(ibh->ib_hwaddr)) { |
| 429 | if (memcmp(ibh->ib_hwaddr, ifp->if_broadcastaddr, |
| 430 | ifp->if_addrlen) == 0) |
| 431 | m->m_flags |= M_BCAST; |
| 432 | else |
| 433 | m->m_flags |= M_MCAST; |
| 434 | if_inc_counter(ifp, IFCOUNTER_IMCASTS, 1); |
| 435 | } |
| 436 | |
| 437 | /* Let BPF have it before we strip the header. */ |
| 438 | INFINIBAND_BPF_MTAP(ifp, m); |
| 439 | |
| 440 | /* Allow monitor mode to claim this frame, after stats are updated. */ |
| 441 | if (ifp->if_flags & IFF_MONITOR) { |
| 442 | m_freem(m); |
| 443 | goto done; |
| 444 | } |
| 445 | |
| 446 | /* Direct packet to correct FIB based on interface config. */ |
| 447 | M_SETFIB(m, ifp->if_fib); |
| 448 | |
| 449 | /* Handle input from a lagg<N> port */ |
| 450 | if (ifp->if_type == IFT_INFINIBANDLAG) { |
| 451 | KASSERT(lagg_input_infiniband_p != NULL, |
| 452 | ("%s: if_lagg not loaded!", __func__)); |
| 453 | m = (*lagg_input_infiniband_p)(ifp, m); |
| 454 | if (__predict_false(m == NULL)) |
| 455 | goto done; |
| 456 | ifp = m->m_pkthdr.rcvif; |
| 457 | } |
| 458 | |
| 459 | /* |
| 460 | * Dispatch frame to upper layer. |
| 461 | */ |
nothing calls this directly
no test coverage detected