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

Function infiniband_input

freebsd/net/if_infiniband.c:404–504  ·  view source on GitHub ↗

* Process a received Infiniband packet. */

Source from the content-addressed store, hash-verified

402 * Process a received Infiniband packet.
403 */
404static void
405infiniband_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 */

Callers

nothing calls this directly

Calls 6

if_inc_counterFunction · 0.85
m_adjFunction · 0.85
mac_ifnet_create_mbufFunction · 0.85
netisr_dispatchFunction · 0.85
m_freemFunction · 0.50
m_clrprotoflagsFunction · 0.50

Tested by

no test coverage detected