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

Function toe_l2_resolve

freebsd/netinet/toecore.c:462–498  ·  view source on GitHub ↗

* Returns 0 or EWOULDBLOCK on success (any other value is an error). 0 means * lladdr and vtag are valid on return, EWOULDBLOCK means the TOE driver's * tod_l2_update will be called later, when the entry is resolved or times out. */

Source from the content-addressed store, hash-verified

460 * tod_l2_update will be called later, when the entry is resolved or times out.
461 */
462int
463toe_l2_resolve(struct toedev *tod, struct ifnet *ifp, struct sockaddr *sa,
464 uint8_t *lladdr, uint16_t *vtag)
465{
466 int rc;
467 uint16_t vid, pcp;
468
469 switch (sa->sa_family) {
470#ifdef INET
471 case AF_INET:
472 rc = arpresolve(ifp, 0, NULL, sa, lladdr, NULL, NULL);
473 break;
474#endif
475#ifdef INET6
476 case AF_INET6:
477 rc = nd6_resolve(ifp, 0, NULL, sa, lladdr, NULL, NULL);
478 break;
479#endif
480 default:
481 return (EPROTONOSUPPORT);
482 }
483
484 if (rc == 0) {
485 vid = 0xfff;
486 pcp = 0;
487 if (ifp->if_type == IFT_L2VLAN) {
488 VLAN_TAG(ifp, &vid);
489 VLAN_PCP(ifp, &pcp);
490 } else if (ifp->if_pcp != IFNET_PCP_NONE) {
491 vid = 0;
492 pcp = ifp->if_pcp;
493 }
494 *vtag = EVL_MAKETAG(vid, pcp, 0);
495 }
496
497 return (rc);
498}
499
500void
501toe_connect_failed(struct toedev *tod, struct inpcb *inp, int err)

Callers

nothing calls this directly

Calls 2

arpresolveFunction · 0.85
nd6_resolveFunction · 0.85

Tested by

no test coverage detected