Hi,
I am thinking to add a function
int mac_open_by_linkid(dladm_linkid_t linkid, mac_handle_t *mhp);
This function takes linkid as the input argument because:
1. As part of vanity naming project, one will be able to specify the vanity
link name when creating an aggregation.
2. As we already discussed in our design, that even the link name changes,
the aggregation created over it will not be affected. In that case, the
linkid will be the only long-live identifier of a link.
3. As I talked to the LDOM person (the discussion is still going on), I
believe that LDOM manager specifies a link name too, and I expect other MAC
consumers like VNIC will also take the link name. So that I think
mac_open_by_linkid() could be convenient for others to use.
I'd like to hear your opinion.
My another question is whether we need to keep the old mac_open() function.
The only place left in ON that is calling mac_open() and cannot be changed
to call the new form of function is in strplumb.c, when it tries to get a
mac address of a GLDv3 device. (see below). I don't know whether I could
just simply remove it, as the logic below that (which is for legacy devices)
can do the right thing.
Thanks
- Cathy
---------------------------------------------------
static uchar_t *
getmacaddr_gldv3(char *drv, int inst, int *maclenp)
{
char ifname[16];
mac_handle_t mh;
uchar_t *macaddr;
(void) snprintf(ifname, sizeof (ifname), "%s%d", drv, inst);
if (mac_open(ifname, inst, &mh) < 0) {
return (NULL);
}
*maclenp = sizeof (struct ether_addr);
macaddr = kmem_alloc(*maclenp, KM_SLEEP);
mac_unicst_get(mh, macaddr);
mac_close(mh);
return (macaddr);
}