r193336 moved ifq_detach to if_free which broke if_alloc followed

by if_free (w/o doing if_attach); move ifq_attach to if_alloc and
rename ifq_attach/detach to ifq_init/ifq_delete to better identify
their purpose

Reviewed by:	jhb, kmacy
This commit is contained in:
Sam Leffler 2009-06-15 19:50:03 +00:00
parent 43273e33a3
commit d659538f72
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=194259
3 changed files with 8 additions and 9 deletions

View File

@ -1719,7 +1719,7 @@ t3_free_qset(adapter_t *sc, struct sge_qset *q)
if (q->txq[i].txq_mr != NULL)
buf_ring_free(q->txq[i].txq_mr, M_DEVBUF);
if (q->txq[i].txq_ifq != NULL) {
ifq_detach(q->txq[i].txq_ifq);
ifq_delete(q->txq[i].txq_ifq);
free(q->txq[i].txq_ifq, M_DEVBUF);
}
}
@ -2289,7 +2289,7 @@ t3_sge_alloc_qset(adapter_t *sc, u_int id, int nports, int irq_vec_idx,
device_printf(sc->dev, "failed to allocate ifq\n");
goto err;
}
ifq_attach(q->txq[i].txq_ifq, pi->ifp);
ifq_init(q->txq[i].txq_ifq, pi->ifp);
}
init_qset_cntxt(q, id);
q->idx = id;

View File

@ -554,6 +554,7 @@ if_alloc(u_char type)
#ifdef MAC
mac_ifnet_init(ifp);
#endif
ifq_init(&ifp->if_snd, ifp);
refcount_init(&ifp->if_refcount, 1); /* Index reference. */
IFNET_WLOCK();
@ -596,7 +597,7 @@ if_free_internal(struct ifnet *ifp)
knlist_destroy(&ifp->if_klist);
IF_AFDATA_DESTROY(ifp);
IF_ADDR_LOCK_DESTROY(ifp);
ifq_detach(&ifp->if_snd);
ifq_delete(&ifp->if_snd);
free(ifp, M_IFNET);
}
@ -655,7 +656,7 @@ if_rele(struct ifnet *ifp)
}
void
ifq_attach(struct ifaltq *ifq, struct ifnet *ifp)
ifq_init(struct ifaltq *ifq, struct ifnet *ifp)
{
mtx_init(&ifq->ifq_mtx, ifp->if_xname, "if send queue", MTX_DEF);
@ -671,7 +672,7 @@ ifq_attach(struct ifaltq *ifq, struct ifnet *ifp)
}
void
ifq_detach(struct ifaltq *ifq)
ifq_delete(struct ifaltq *ifq)
{
mtx_destroy(&ifq->ifq_mtx);
}
@ -742,8 +743,6 @@ if_attach_internal(struct ifnet *ifp, int vmove)
net_cdevsw.d_name, ifp->if_index);
}
ifq_attach(&ifp->if_snd, ifp);
/*
* Create a Link Level name for this device.
*/

View File

@ -817,8 +817,8 @@ int ifpromisc(struct ifnet *, int);
struct ifnet *ifunit(const char *);
struct ifnet *ifunit_ref(const char *);
void ifq_attach(struct ifaltq *, struct ifnet *ifp);
void ifq_detach(struct ifaltq *);
void ifq_init(struct ifaltq *, struct ifnet *ifp);
void ifq_delete(struct ifaltq *);
struct ifaddr *ifa_ifwithaddr(struct sockaddr *);
struct ifaddr *ifa_ifwithbroadaddr(struct sockaddr *);