adding if_dev member to struct ifnet
Vincent Jardin
vjardin at wanadoo.fr
Wed Oct 1 11:38:18 PDT 2003
> > messier BD>example is in the new ATM code where interfaces are looked up
> > by name.
> >
> > Where is this?
>
> One example would be in sys/netatm/atm_if.c around line 1081.
Do you mean pif_name and pif_unit ?
This code could be updated. It uses pif_unit and pif_name that could become
pif_xname.
for (pip = atm_interface_head; pip; pip = pip->pif_next) {
if (strcmp(pip->pif_xname, n) == 0)
break;
}
instead of
for (pip = atm_interface_head; pip; pip = pip->pif_next) {
if ((pip->pif_unit == unit) && (strcmp(pip->pif_name, n) == 0))
break;
}
Moreover, a PIF (Physical IF) is not an ifnet. It is the ATM device. The ATM
PVC are the NIF (Network IF -> ifnet). They are many NIF (PVC) over a single
PIF (ATM device).
With the ATM stack, the main issue is related to AIOCS_SET_NIF. It sets the
ifp's if_name to the NIF's nif_name and the ifp's if_unit to a regular
counter.
In fact we could change the following code
strcpy ( nip->nif_name, asr->asr_nif_pref );
nip->nif_sel = count;
ifp->if_name = nip->nif_name;
ifp->if_unit = count;
to
snprintf(nip->nif_xname, sizeof(nip->nif_xname), "%s%d",
asr->asr_nif_pref, count);
nip->nif_sel = count; /* we need to keep a selector to
build the UNI ATM address */
ifp->if_xname = nip->nif_xname;
#if 0
ifp->if_unit = count; /* it is not required anymore */
#endif
Regards,
Vincent
More information about the freebsd-arch
mailing list