diff --git a/sys/dev/cxgbe/t4_tracer.c b/sys/dev/cxgbe/t4_tracer.c --- a/sys/dev/cxgbe/t4_tracer.c +++ b/sys/dev/cxgbe/t4_tracer.c @@ -122,7 +122,7 @@ } static int -t4_cloner_match(struct if_clone *ifc, const char *name) +t4_clone_match(struct if_clone *ifc, const char *name) { if (strncmp(name, "t4nex", 5) != 0 && @@ -135,12 +135,13 @@ } static int -t4_cloner_create(struct if_clone *ifc, char *name, size_t len, caddr_t params) +t4_clone_create(struct if_clone *ifc, char *name, size_t len, + struct ifc_data *ifd, struct ifnet **ifpp) { struct match_rr mrr; struct adapter *sc; if_t ifp; - int rc, unit; + int rc = 0; const uint8_t lla[ETHER_ADDR_LEN] = {0, 0, 0, 0, 0, 0}; mrr.name = name; @@ -168,21 +169,14 @@ goto done; } - - unit = -1; - rc = ifc_alloc_unit(ifc, &unit); - if (rc != 0) - goto done; - ifp = if_alloc(IFT_ETHER); if (ifp == NULL) { - ifc_free_unit(ifc, unit); rc = ENOMEM; goto done; } /* Note that if_xname is not . */ - if_initname(ifp, name, unit); + if_initname(ifp, name, ifd->unit); if_setdname(ifp, t4_cloner_name); if_setinitfn(ifp, tracer_init); if_setflags(ifp, IFF_SIMPLEX | IFF_DRV_RUNNING); @@ -200,6 +194,7 @@ if_setsoftc(ifp, sc); sc->ifp = ifp; mtx_unlock(&sc->ifp_lock); + *ifpp = ifp; done: sx_xunlock(&t4_trace_lock); end_synchronized_op(sc, 0); @@ -207,7 +202,7 @@ } static int -t4_cloner_destroy(struct if_clone *ifc, if_t ifp) +t4_clone_destroy(struct if_clone *ifc, if_t ifp, uint32_t flags) { struct adapter *sc; int unit = if_getdunit(ifp); @@ -234,8 +229,13 @@ { sx_init(&t4_trace_lock, "T4/T5 tracer lock"); - t4_cloner = if_clone_advanced(t4_cloner_name, 0, t4_cloner_match, - t4_cloner_create, t4_cloner_destroy); + struct if_clone_addreq req = { + .match_f = t4_clone_match, + .create_f = t4_clone_create, + .destroy_f = t4_clone_destroy, + .flags = IFC_F_AUTOUNIT, + }; + t4_cloner = ifc_attach_cloner(t4_cloner_name, &req); } void