- Store pointer to the link-level address right in "struct ifnet"

rather than in ifindex_table[]; all (except one) accesses are
  through ifp anyway.  IF_LLADDR() works faster, and all (except
  one) ifaddr_byindex() users were converted to use ifp->if_addr.

- Stop storing a (pointer to) Ethernet address in "struct arpcom",
  and drop the IFP2ENADDR() macro; all users have been converted
  to use IF_LLADDR() instead.
This commit is contained in:
Ruslan Ermilov 2005-11-11 16:04:59 +00:00
parent b71ec5beb4
commit 4a0d6638b3
81 changed files with 220 additions and 242 deletions

View File

@ -1407,15 +1407,15 @@ NdisReadNetworkAddress(status, addr, addrlen, adapter)
block = (ndis_miniport_block *)adapter;
sc = device_get_softc(block->nmb_physdeviceobj->do_devext);
#ifdef IFP2ENADDR
if (bcmp(IFP2ENADDR(sc->ifp), empty, ETHER_ADDR_LEN) == 0)
#ifdef IF_LLADDR
if (bcmp(IF_LLADDR(sc->ifp), empty, ETHER_ADDR_LEN) == 0)
#else
if (bcmp(sc->arpcom.ac_enaddr, empty, ETHER_ADDR_LEN) == 0)
#endif
*status = NDIS_STATUS_FAILURE;
else {
#ifdef IFP2ENADDR
*addr = IFP2ENADDR(sc->ifp);
#ifdef IF_LLADDR
*addr = IF_LLADDR(sc->ifp);
#else
*addr = sc->arpcom.ac_enaddr;
#endif

View File

@ -41,7 +41,7 @@
#include <sys/socket.h>
#include <net/if.h>
#include <net/if_arp.h>
#include <net/if_dl.h>
#include <net/iso88025.h>
#include <net/if_media.h>
#include <net/if_types.h>
@ -489,7 +489,7 @@ oltr_init(void * xsc)
/*
* Open the adapter
*/
rc = TRlldOpen(sc->TRlldAdapter, IFP2ENADDR(sc->ifp), sc->GroupAddress,
rc = TRlldOpen(sc->TRlldAdapter, IF_LLADDR(sc->ifp), sc->GroupAddress,
sc->FunctionalAddress, 1552, sc->AdapterMode);
switch(rc) {
case TRLLD_OPEN_OK:

View File

@ -112,6 +112,7 @@ __FBSDID("$FreeBSD$");
#include <net/if.h>
#include <net/if_arp.h>
#include <net/if_dl.h>
#include <net/ethernet.h>
#include <net/if_types.h>
#include <net/if_media.h>
@ -1737,7 +1738,7 @@ an_setdef(struct an_softc *sc, struct an_req *areq)
case AN_RID_GENCONFIG:
cfg = (struct an_ltv_genconfig *)areq;
bcopy((char *)&cfg->an_macaddr, IFP2ENADDR(sc->an_ifp),
bcopy((char *)&cfg->an_macaddr, IF_LLADDR(sc->an_ifp),
ETHER_ADDR_LEN);
bcopy((char *)cfg, (char *)&sc->an_config,
@ -2494,7 +2495,7 @@ an_init(void *xsc)
}
/* Set our MAC address. */
bcopy((char *)IFP2ENADDR(sc->an_ifp),
bcopy((char *)IF_LLADDR(sc->an_ifp),
(char *)&sc->an_config.an_macaddr, ETHER_ADDR_LEN);
if (ifp->if_flags & IFF_BROADCAST)

View File

@ -54,7 +54,7 @@ __FBSDID("$FreeBSD$");
#include <sys/rman.h>
#include <net/if.h>
#include <net/if_arp.h>
#include <net/if_dl.h>
#include <net/if_media.h>
#include <net/if_types.h>
#include <net/ethernet.h>
@ -989,7 +989,7 @@ arl_read(sc, buf, len)
* This test does not support multicasts.
*/
if ((ifp->if_flags & IFF_PROMISC)
&& bcmp(eh->ether_dhost, IFP2ENADDR(sc->arl_ifp),
&& bcmp(eh->ether_dhost, IF_LLADDR(sc->arl_ifp),
sizeof(eh->ether_dhost)) != 0
&& bcmp(eh->ether_dhost, BROADCASTADDR,
sizeof(eh->ether_dhost)) != 0)

View File

@ -1646,7 +1646,7 @@ ath_mode_init(struct ath_softc *sc)
*
* XXX should get from lladdr instead of arpcom but that's more work
*/
IEEE80211_ADDR_COPY(ic->ic_myaddr, IFP2ENADDR(ifp));
IEEE80211_ADDR_COPY(ic->ic_myaddr, IF_LLADDR(ifp));
ath_hal_setmac(ah, ic->ic_myaddr);
/* calculate and install multicast filter */

View File

@ -873,7 +873,7 @@ bfe_set_rx_mode(struct bfe_softc *sc)
CSR_WRITE_4(sc, BFE_CAM_CTRL, 0);
bfe_cam_write(sc, IFP2ENADDR(sc->bfe_ifp), i++);
bfe_cam_write(sc, IF_LLADDR(sc->bfe_ifp), i++);
if (ifp->if_flags & IFF_ALLMULTI)
val |= BFE_RXCONF_ALLMULTI;

View File

@ -1562,9 +1562,9 @@ bge_blockinit(sc)
/* Set random backoff seed for TX */
CSR_WRITE_4(sc, BGE_TX_RANDOM_BACKOFF,
IFP2ENADDR(sc->bge_ifp)[0] + IFP2ENADDR(sc->bge_ifp)[1] +
IFP2ENADDR(sc->bge_ifp)[2] + IFP2ENADDR(sc->bge_ifp)[3] +
IFP2ENADDR(sc->bge_ifp)[4] + IFP2ENADDR(sc->bge_ifp)[5] +
IF_LLADDR(sc->bge_ifp)[0] + IF_LLADDR(sc->bge_ifp)[1] +
IF_LLADDR(sc->bge_ifp)[2] + IF_LLADDR(sc->bge_ifp)[3] +
IF_LLADDR(sc->bge_ifp)[4] + IF_LLADDR(sc->bge_ifp)[5] +
BGE_TX_BACKOFF_SEED_MASK);
/* Set inter-packet gap */
@ -3430,7 +3430,7 @@ bge_init_locked(sc)
ETHER_HDR_LEN + ETHER_CRC_LEN + ETHER_VLAN_ENCAP_LEN);
/* Load our MAC address. */
m = (u_int16_t *)&IFP2ENADDR(sc->bge_ifp)[0];
m = (u_int16_t *)IF_LLADDR(sc->bge_ifp);
CSR_WRITE_4(sc, BGE_MAC_ADDR1_LO, htons(m[0]));
CSR_WRITE_4(sc, BGE_MAC_ADDR1_HI, (htons(m[1]) << 16) | htons(m[2]));

View File

@ -1126,9 +1126,9 @@ dc_setfilt_21143(struct dc_softc *sc)
}
/* Set our MAC address */
sp[39] = DC_SP_MAC(((u_int16_t *)IFP2ENADDR(sc->dc_ifp))[0]);
sp[40] = DC_SP_MAC(((u_int16_t *)IFP2ENADDR(sc->dc_ifp))[1]);
sp[41] = DC_SP_MAC(((u_int16_t *)IFP2ENADDR(sc->dc_ifp))[2]);
sp[39] = DC_SP_MAC(((u_int16_t *)IF_LLADDR(sc->dc_ifp))[0]);
sp[40] = DC_SP_MAC(((u_int16_t *)IF_LLADDR(sc->dc_ifp))[1]);
sp[41] = DC_SP_MAC(((u_int16_t *)IF_LLADDR(sc->dc_ifp))[2]);
sframe->dc_status = htole32(DC_TXSTAT_OWN);
CSR_WRITE_4(sc, DC_TXSTART, 0xFFFFFFFF);
@ -1155,8 +1155,8 @@ dc_setfilt_admtek(struct dc_softc *sc)
ifp = sc->dc_ifp;
/* Init our MAC address. */
CSR_WRITE_4(sc, DC_AL_PAR0, *(u_int32_t *)(&IFP2ENADDR(sc->dc_ifp)[0]));
CSR_WRITE_4(sc, DC_AL_PAR1, *(u_int32_t *)(&IFP2ENADDR(sc->dc_ifp)[4]));
CSR_WRITE_4(sc, DC_AL_PAR0, *(u_int32_t *)(&IF_LLADDR(sc->dc_ifp)[0]));
CSR_WRITE_4(sc, DC_AL_PAR1, *(u_int32_t *)(&IF_LLADDR(sc->dc_ifp)[4]));
/* If we want promiscuous mode, set the allframes bit. */
if (ifp->if_flags & IFF_PROMISC)
@ -1215,10 +1215,10 @@ dc_setfilt_asix(struct dc_softc *sc)
/* Init our MAC address */
CSR_WRITE_4(sc, DC_AX_FILTIDX, DC_AX_FILTIDX_PAR0);
CSR_WRITE_4(sc, DC_AX_FILTDATA,
*(u_int32_t *)(&IFP2ENADDR(sc->dc_ifp)[0]));
*(u_int32_t *)(&IF_LLADDR(sc->dc_ifp)[0]));
CSR_WRITE_4(sc, DC_AX_FILTIDX, DC_AX_FILTIDX_PAR1);
CSR_WRITE_4(sc, DC_AX_FILTDATA,
*(u_int32_t *)(&IFP2ENADDR(sc->dc_ifp)[4]));
*(u_int32_t *)(&IF_LLADDR(sc->dc_ifp)[4]));
/* If we want promiscuous mode, set the allframes bit. */
if (ifp->if_flags & IFF_PROMISC)
@ -1324,9 +1324,9 @@ dc_setfilt_xircom(struct dc_softc *sc)
}
/* Set our MAC address */
sp[0] = DC_SP_MAC(((u_int16_t *)IFP2ENADDR(sc->dc_ifp))[0]);
sp[1] = DC_SP_MAC(((u_int16_t *)IFP2ENADDR(sc->dc_ifp))[1]);
sp[2] = DC_SP_MAC(((u_int16_t *)IFP2ENADDR(sc->dc_ifp))[2]);
sp[0] = DC_SP_MAC(((u_int16_t *)IF_LLADDR(sc->dc_ifp))[0]);
sp[1] = DC_SP_MAC(((u_int16_t *)IF_LLADDR(sc->dc_ifp))[1]);
sp[2] = DC_SP_MAC(((u_int16_t *)IF_LLADDR(sc->dc_ifp))[2]);
DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_TX_ON);
DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_RX_ON);

View File

@ -260,8 +260,8 @@ tulip_txprobe(tulip_softc_t * const sc)
/*
* Construct a LLC TEST message which will point to ourselves.
*/
bcopy(IFP2ENADDR(sc->tulip_ifp), mtod(m, struct ether_header *)->ether_dhost, 6);
bcopy(IFP2ENADDR(sc->tulip_ifp), mtod(m, struct ether_header *)->ether_shost, 6);
bcopy(IF_LLADDR(sc->tulip_ifp), mtod(m, struct ether_header *)->ether_dhost, 6);
bcopy(IF_LLADDR(sc->tulip_ifp), mtod(m, struct ether_header *)->ether_shost, 6);
mtod(m, struct ether_header *)->ether_type = htons(3);
mtod(m, unsigned char *)[14] = 0;
mtod(m, unsigned char *)[15] = 0;
@ -3081,12 +3081,12 @@ tulip_addr_filter(tulip_softc_t * const sc)
hash = tulip_mchash(ifp->if_broadcastaddr);
sp[hash >> 4] |= htole32(1 << (hash & 0xF));
if (sc->tulip_flags & TULIP_WANTHASHONLY) {
hash = tulip_mchash(IFP2ENADDR(ifp));
hash = tulip_mchash(IF_LLADDR(ifp));
sp[hash >> 4] |= htole32(1 << (hash & 0xF));
} else {
sp[39] = TULIP_SP_MAC(((u_int16_t *)IFP2ENADDR(ifp))[0]);
sp[40] = TULIP_SP_MAC(((u_int16_t *)IFP2ENADDR(ifp))[1]);
sp[41] = TULIP_SP_MAC(((u_int16_t *)IFP2ENADDR(ifp))[2]);
sp[39] = TULIP_SP_MAC(((u_int16_t *)IF_LLADDR(ifp))[0]);
sp[40] = TULIP_SP_MAC(((u_int16_t *)IF_LLADDR(ifp))[1]);
sp[41] = TULIP_SP_MAC(((u_int16_t *)IF_LLADDR(ifp))[2]);
}
}
}
@ -3118,9 +3118,9 @@ tulip_addr_filter(tulip_softc_t * const sc)
* Pad the rest with our hardware address
*/
for (; idx < 16; idx++) {
*sp++ = TULIP_SP_MAC(((u_int16_t *)IFP2ENADDR(ifp))[0]);
*sp++ = TULIP_SP_MAC(((u_int16_t *)IFP2ENADDR(ifp))[1]);
*sp++ = TULIP_SP_MAC(((u_int16_t *)IFP2ENADDR(ifp))[2]);
*sp++ = TULIP_SP_MAC(((u_int16_t *)IF_LLADDR(ifp))[0]);
*sp++ = TULIP_SP_MAC(((u_int16_t *)IF_LLADDR(ifp))[1]);
*sp++ = TULIP_SP_MAC(((u_int16_t *)IF_LLADDR(ifp))[2]);
}
}
IF_ADDR_UNLOCK(ifp);

View File

@ -551,7 +551,7 @@ ed_init_locked(struct ed_softc *sc)
* Copy out our station address
*/
for (i = 0; i < ETHER_ADDR_LEN; ++i)
ed_nic_outb(sc, ED_P1_PAR(i), IFP2ENADDR(sc->ifp)[i]);
ed_nic_outb(sc, ED_P1_PAR(i), IF_LLADDR(sc->ifp)[i]);
/*
* Set Current Page pointer to next_packet (initialized above)

View File

@ -863,7 +863,7 @@ em_init_locked(struct adapter * adapter)
E1000_WRITE_REG(&adapter->hw, PBA, pba);
/* Get the latest mac address, User can use a LAA */
bcopy(IFP2ENADDR(adapter->ifp), adapter->hw.mac_addr,
bcopy(IF_LLADDR(adapter->ifp), adapter->hw.mac_addr,
ETHER_ADDR_LEN);
/* Initialize the hardware */

View File

@ -72,7 +72,7 @@ __FBSDID("$FreeBSD$");
#include <sys/rman.h>
#include <net/if.h>
#include <net/if_arp.h>
#include <net/if_dl.h>
#include <net/if_media.h>
#include <net/if_types.h>
#include <net/ethernet.h>
@ -406,7 +406,7 @@ epinit_locked(struct ep_softc *sc)
GO_WINDOW(sc, 2);
/* Reload the ether_addr. */
ep_setup_station(sc, IFP2ENADDR(sc->ifp));
ep_setup_station(sc, IF_LLADDR(sc->ifp));
CSR_WRITE_2(sc, EP_COMMAND, RX_RESET);
CSR_WRITE_2(sc, EP_COMMAND, TX_RESET);

View File

@ -308,7 +308,7 @@ ex_init(void *xsc)
CSR_WRITE_1(sc, EEPROM_REG, temp_reg & ~Trnoff_Enable);
}
for (i = 0; i < ETHER_ADDR_LEN; i++) {
CSR_WRITE_1(sc, I_ADDR_REG0 + i, IFP2ENADDR(sc->ifp)[i]);
CSR_WRITE_1(sc, I_ADDR_REG0 + i, IF_LLADDR(sc->ifp)[i]);
}
/*
* - Setup transmit chaining and discard bad received frames.
@ -892,7 +892,7 @@ ex_setmulti(struct ex_softc *sc)
/* Program our MAC address as well */
/* XXX: Is this necessary? The Linux driver does this
* but the NetBSD driver does not */
addr = (uint16_t*)(IFP2ENADDR(sc->ifp));
addr = (uint16_t*)IF_LLADDR(sc->ifp);
CSR_WRITE_2(sc, IO_PORT_REG, *addr++);
CSR_WRITE_2(sc, IO_PORT_REG, *addr++);
CSR_WRITE_2(sc, IO_PORT_REG, *addr++);

View File

@ -1043,7 +1043,7 @@ fe_init (void * xsc)
DELAY(200);
/* Feed the station address. */
fe_outblk(sc, FE_DLCR8, IFP2ENADDR(sc->ifp), ETHER_ADDR_LEN);
fe_outblk(sc, FE_DLCR8, IF_LLADDR(sc->ifp), ETHER_ADDR_LEN);
/* Clear multicast address filter to receive nothing. */
fe_outb(sc, FE_DLCR7,

View File

@ -2087,7 +2087,7 @@ fxp_init_body(struct fxp_softc *sc)
cb_ias->cb_status = 0;
cb_ias->cb_command = htole16(FXP_CB_COMMAND_IAS | FXP_CB_COMMAND_EL);
cb_ias->link_addr = 0xffffffff;
bcopy(IFP2ENADDR(sc->ifp), cb_ias->macaddr, ETHER_ADDR_LEN);
bcopy(IF_LLADDR(sc->ifp), cb_ias->macaddr, ETHER_ADDR_LEN);
/*
* Start the IAS (Individual Address Setup) command/DMA.

View File

@ -1046,7 +1046,7 @@ gem_init_regs(sc)
{
bus_space_tag_t t = sc->sc_bustag;
bus_space_handle_t h = sc->sc_h;
const u_char *laddr = IFP2ENADDR(sc->sc_ifp);
const u_char *laddr = IF_LLADDR(sc->sc_ifp);
u_int32_t v;
/* These regs are not cleared on reset */

View File

@ -729,7 +729,7 @@ hme_init_locked(struct hme_softc *sc)
HME_MAC_WRITE_4(sc, HME_MACI_TXSIZE, HME_MAX_FRAMESIZE);
/* Load station MAC address */
ea = IFP2ENADDR(sc->sc_ifp);
ea = IF_LLADDR(sc->sc_ifp);
HME_MAC_WRITE_4(sc, HME_MACI_MACADDR0, (ea[0] << 8) | ea[1]);
HME_MAC_WRITE_4(sc, HME_MACI_MACADDR1, (ea[2] << 8) | ea[3]);
HME_MAC_WRITE_4(sc, HME_MACI_MACADDR2, (ea[4] << 8) | ea[5]);

View File

@ -599,7 +599,7 @@ check_eh(struct ie_softc *sc, struct ether_header *eh)
return (1);
/* Always accept packets directed at us */
if (ether_equal(eh->ether_dhost, IFP2ENADDR(sc->ifp)))
if (ether_equal(eh->ether_dhost, IF_LLADDR(sc->ifp)))
return (1);
/* Must have IFF_ALLMULTI but not IFF_PROMISC set. The chip is
@ -1530,7 +1530,7 @@ ieinit(xsc)
cmd->com.ie_cmd_cmd = IE_CMD_IASETUP | IE_CMD_LAST;
cmd->com.ie_cmd_link = 0xffff;
bcopy((volatile char *)IFP2ENADDR(sc->ifp),
bcopy((volatile char *)IF_LLADDR(sc->ifp),
(volatile char *)&cmd->ie_address, sizeof cmd->ie_address);
scb->ie_command_list = MK_16(MEM(sc), cmd);
if (command_and_wait(sc, IE_CU_START, cmd, IE_STAT_COMPL)

View File

@ -665,7 +665,7 @@ ixgb_init_locked(struct adapter *adapter)
ixgb_stop(adapter);
/* Get the latest mac address, User can use a LAA */
bcopy(IFP2ENADDR(adapter->ifp), adapter->hw.curr_mac_addr,
bcopy(IF_LLADDR(adapter->ifp), adapter->hw.curr_mac_addr,
IXGB_ETH_LENGTH_OF_ADDRESS);
/* Initialize the hardware */

View File

@ -1245,8 +1245,8 @@ lge_init(xsc)
mii = device_get_softc(sc->lge_miibus);
/* Set MAC address */
CSR_WRITE_4(sc, LGE_PAR0, *(u_int32_t *)(&IFP2ENADDR(sc->lge_ifp)[0]));
CSR_WRITE_4(sc, LGE_PAR1, *(u_int32_t *)(&IFP2ENADDR(sc->lge_ifp)[4]));
CSR_WRITE_4(sc, LGE_PAR0, *(u_int32_t *)(&IF_LLADDR(sc->lge_ifp)[0]));
CSR_WRITE_4(sc, LGE_PAR1, *(u_int32_t *)(&IF_LLADDR(sc->lge_ifp)[4]));
/* Init circular RX list. */
if (lge_list_rx_init(sc) == ENOBUFS) {

View File

@ -583,7 +583,7 @@ lnc_rint(struct lnc_softc *sc)
* drop it if it is from myself.
*/
if (bcmp(eh->ether_shost,
IFP2ENADDR(sc->ifp), ETHER_ADDR_LEN) == 0) {
IF_LLADDR(sc->ifp), ETHER_ADDR_LEN) == 0) {
m_freem(head);
} else {
(*ifp->if_input)(ifp, head);
@ -1008,7 +1008,7 @@ lnc_init(xsc)
sc->init_block->mode = sc->nic.mode;
for (i = 0; i < ETHER_ADDR_LEN; i++)
sc->init_block->padr[i] = IFP2ENADDR(sc->ifp)[i];
sc->init_block->padr[i] = IF_LLADDR(sc->ifp)[i];
lnc_setladrf(sc);

View File

@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$");
#include <net/ethernet.h>
#include <net/if.h>
#include <net/if_arp.h>
#include <net/if_dl.h>
#include <isa/isavar.h>
@ -261,9 +261,9 @@ lnc_isa_attach(device_t dev)
*
* Contec uses 00 80 4c ?? ?? ??
*/
if (IFP2ENADDR(sc->ifp)[0] == (u_char)0x00 &&
IFP2ENADDR(sc->ifp)[1] == (u_char)0x80 &&
IFP2ENADDR(sc->ifp)[2] == (u_char)0x4c) {
if (IF_LLADDR(sc->ifp)[0] == (u_char)0x00 &&
IF_LLADDR(sc->ifp)[1] == (u_char)0x80 &&
IF_LLADDR(sc->ifp)[2] == (u_char)0x4c) {
lnc_outw(sc->rap, MSRDA);
lnc_outw(CNET98S_IDP, 0x0006);
lnc_outw(sc->rap, MSWRA);

View File

@ -1154,7 +1154,7 @@ my_rxeof(struct my_softc * sc)
if (ifp->if_bpf) {
BPF_MTAP(ifp, m);
if (ifp->if_flags & IFF_PROMISC &&
(bcmp(eh->ether_dhost, IFP2ENADDR(sc->my_ifp),
(bcmp(eh->ether_dhost, IF_LLADDR(sc->my_ifp),
ETHER_ADDR_LEN) &&
(eh->ether_dhost[0] & 1) == 0)) {
m_freem(m);

View File

@ -1668,13 +1668,13 @@ nge_init_locked(sc)
/* Set MAC address */
CSR_WRITE_4(sc, NGE_RXFILT_CTL, NGE_FILTADDR_PAR0);
CSR_WRITE_4(sc, NGE_RXFILT_DATA,
((u_int16_t *)IFP2ENADDR(sc->nge_ifp))[0]);
((u_int16_t *)IF_LLADDR(sc->nge_ifp))[0]);
CSR_WRITE_4(sc, NGE_RXFILT_CTL, NGE_FILTADDR_PAR1);
CSR_WRITE_4(sc, NGE_RXFILT_DATA,
((u_int16_t *)IFP2ENADDR(sc->nge_ifp))[1]);
((u_int16_t *)IF_LLADDR(sc->nge_ifp))[1]);
CSR_WRITE_4(sc, NGE_RXFILT_CTL, NGE_FILTADDR_PAR2);
CSR_WRITE_4(sc, NGE_RXFILT_DATA,
((u_int16_t *)IFP2ENADDR(sc->nge_ifp))[2]);
((u_int16_t *)IF_LLADDR(sc->nge_ifp))[2]);
/* Init circular RX list. */
if (nge_list_rx_init(sc) == ENOBUFS) {

View File

@ -643,7 +643,7 @@ nve_init(void *xsc)
goto fail;
}
/* Set the MAC address */
sc->hwapi->pfnSetNodeAddress(sc->hwapi->pADCX, IFP2ENADDR(sc->ifp));
sc->hwapi->pfnSetNodeAddress(sc->hwapi->pADCX, IF_LLADDR(sc->ifp));
sc->hwapi->pfnEnableInterrupts(sc->hwapi->pADCX);
sc->hwapi->pfnStart(sc->hwapi->pADCX);

View File

@ -1245,7 +1245,7 @@ wi_setdef(sc, wreq)
switch(wreq->wi_type) {
case WI_RID_MAC_NODE:
bcopy((char *)&wreq->wi_val, (char *)IFP2ENADDR(sc->ifp),
bcopy(&wreq->wi_val, IF_LLADDR(sc->ifp),
ETHER_ADDR_LEN);
break;
case WI_RID_PORTTYPE:
@ -1749,8 +1749,8 @@ wi_init(xsc)
/* Set our MAC address. */
mac.wi_len = 4;
mac.wi_type = WI_RID_MAC_NODE;
bcopy((char *)IFP2ENADDR(sc->ifp),
(char *)&mac.wi_mac_addr, ETHER_ADDR_LEN);
bcopy(IF_LLADDR(sc->ifp),
&mac.wi_mac_addr, ETHER_ADDR_LEN);
wi_write_record(sc, (struct wi_ltv_gen *)&mac);
/*

View File

@ -1230,7 +1230,7 @@ ray_init_auth_send(struct ray_softc *sc, u_int8_t *dst, int sequence)
IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_AUTH,
IEEE80211_FC1_DIR_NODS,
dst,
IFP2ENADDR(sc->ifp),
IF_LLADDR(sc->ifp),
sc->sc_c.np_bss_id);
/* Add algorithm number */

View File

@ -2120,9 +2120,9 @@ re_init_locked(sc)
*/
CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_WRITECFG);
CSR_WRITE_STREAM_4(sc, RL_IDR0,
*(u_int32_t *)(&IFP2ENADDR(sc->rl_ifp)[0]));
*(u_int32_t *)(&IF_LLADDR(sc->rl_ifp)[0]));
CSR_WRITE_STREAM_4(sc, RL_IDR4,
*(u_int32_t *)(&IFP2ENADDR(sc->rl_ifp)[4]));
*(u_int32_t *)(&IF_LLADDR(sc->rl_ifp)[4]));
CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF);
/*

View File

@ -77,8 +77,8 @@ __FBSDID("$FreeBSD$");
#include <machine/resource.h>
#include <net/if.h>
#include <net/if_dl.h>
#include <net/ethernet.h>
#include <net/if_arp.h>
#include <net/bpf.h>
#include <net/if_types.h>
@ -1094,7 +1094,7 @@ sbni_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
* SBNI specific ioctl
*/
case SIOCGHWFLAGS: /* get flags */
bcopy((caddr_t)IFP2ENADDR(sc->ifp)+3, (caddr_t) &flags, 3);
bcopy((caddr_t)IF_LLADDR(sc->ifp)+3, (caddr_t) &flags, 3);
flags.rxl = sc->cur_rxl_index;
flags.rate = sc->csr1.rate;
flags.fixed_rxl = (sc->delta_rxl == 0);
@ -1125,7 +1125,7 @@ sbni_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
sc->csr1.rate = flags.fixed_rate ? flags.rate : DEFAULT_RATE;
if (flags.mac_addr)
bcopy((caddr_t) &flags,
(caddr_t) IFP2ENADDR(sc->ifp)+3, 3);
(caddr_t) IF_LLADDR(sc->ifp)+3, 3);
/* Don't be afraid... */
sbni_outb(sc, CSR1, *(char*)(&sc->csr1) | PR_RES);

View File

@ -1239,9 +1239,9 @@ sf_init_locked(sc)
(i + sizeof(u_int32_t)), 0);
/* Init our MAC address */
csr_write_4(sc, SF_PAR0, *(u_int32_t *)(&IFP2ENADDR(sc->sf_ifp)[0]));
csr_write_4(sc, SF_PAR1, *(u_int32_t *)(&IFP2ENADDR(sc->sf_ifp)[4]));
sf_setperf(sc, 0, (caddr_t)&IFP2ENADDR(sc->sf_ifp));
csr_write_4(sc, SF_PAR0, *(u_int32_t *)(&IF_LLADDR(sc->sf_ifp)[0]));
csr_write_4(sc, SF_PAR1, *(u_int32_t *)(&IF_LLADDR(sc->sf_ifp)[4]));
sf_setperf(sc, 0, IF_LLADDR(sc->sf_ifp));
if (sf_init_rx_ring(sc) == ENOBUFS) {
if_printf(sc->sf_ifp,

View File

@ -2580,11 +2580,11 @@ sk_init_xmac(sc_if)
/* Set station address */
SK_XM_WRITE_2(sc_if, XM_PAR0,
*(u_int16_t *)(&IFP2ENADDR(sc_if->sk_ifp)[0]));
*(u_int16_t *)(&IF_LLADDR(sc_if->sk_ifp)[0]));
SK_XM_WRITE_2(sc_if, XM_PAR1,
*(u_int16_t *)(&IFP2ENADDR(sc_if->sk_ifp)[2]));
*(u_int16_t *)(&IF_LLADDR(sc_if->sk_ifp)[2]));
SK_XM_WRITE_2(sc_if, XM_PAR2,
*(u_int16_t *)(&IFP2ENADDR(sc_if->sk_ifp)[4]));
*(u_int16_t *)(&IF_LLADDR(sc_if->sk_ifp)[4]));
SK_XM_SETBIT_4(sc_if, XM_MODE, XM_MODE_RX_USE_STATION);
if (ifp->if_flags & IFF_BROADCAST) {
@ -2755,8 +2755,8 @@ sk_init_yukon(sc_if)
for (i = 0; i < 3; i++) {
/* Write Source Address 1 (unicast filter) */
SK_YU_WRITE_2(sc_if, YUKON_SAL1 + i * 4,
IFP2ENADDR(sc_if->sk_ifp)[i * 2] |
IFP2ENADDR(sc_if->sk_ifp)[i * 2 + 1] << 8);
IF_LLADDR(sc_if->sk_ifp)[i * 2] |
IF_LLADDR(sc_if->sk_ifp)[i * 2 + 1] << 8);
}
for (i = 0; i < 3; i++) {

View File

@ -670,7 +670,7 @@ camprogram(sc)
ifp = sc->sc_ifp;
/* Always load our own address first. */
camentry (sc, mcount, IFP2ENADDR(sc->sc_ifp));
camentry (sc, mcount, IF_LLADDR(sc->sc_ifp));
mcount++;
/* Assume we won't need allmulti bit. */

View File

@ -2862,7 +2862,7 @@ static void ti_init2(sc)
TI_DO_CMD(TI_CMD_UPDATE_GENCOM, 0, 0);
/* Load our MAC address. */
m = (u_int16_t *)&IFP2ENADDR(sc->ti_ifp)[0];
m = (u_int16_t *)IF_LLADDR(sc->ti_ifp);
CSR_WRITE_4(sc, TI_GCR_PAR0, htons(m[0]));
CSR_WRITE_4(sc, TI_GCR_PAR1, (htons(m[1]) << 16) | htons(m[2]));
TI_DO_CMD(TI_CMD_SET_MAC_ADDR, 0, 0);

View File

@ -1293,9 +1293,9 @@ epic_init(xsc)
CSR_WRITE_4(sc, PTCDAR, sc->tx_addr);
/* Put node address to EPIC. */
CSR_WRITE_4(sc, LAN0, ((u_int16_t *)IFP2ENADDR(sc->ifp))[0]);
CSR_WRITE_4(sc, LAN1, ((u_int16_t *)IFP2ENADDR(sc->ifp))[1]);
CSR_WRITE_4(sc, LAN2, ((u_int16_t *)IFP2ENADDR(sc->ifp))[2]);
CSR_WRITE_4(sc, LAN0, ((u_int16_t *)IF_LLADDR(sc->ifp))[0]);
CSR_WRITE_4(sc, LAN1, ((u_int16_t *)IF_LLADDR(sc->ifp))[1]);
CSR_WRITE_4(sc, LAN2, ((u_int16_t *)IF_LLADDR(sc->ifp))[2]);
/* Set tx mode, includeing transmit threshold. */
epic_set_tx_mode(sc);

View File

@ -1179,12 +1179,12 @@ txp_init_locked(sc)
NULL, NULL, NULL, 1);
/* Set station address. */
((u_int8_t *)&p1)[1] = IFP2ENADDR(sc->sc_ifp)[0];
((u_int8_t *)&p1)[0] = IFP2ENADDR(sc->sc_ifp)[1];
((u_int8_t *)&p2)[3] = IFP2ENADDR(sc->sc_ifp)[2];
((u_int8_t *)&p2)[2] = IFP2ENADDR(sc->sc_ifp)[3];
((u_int8_t *)&p2)[1] = IFP2ENADDR(sc->sc_ifp)[4];
((u_int8_t *)&p2)[0] = IFP2ENADDR(sc->sc_ifp)[5];
((u_int8_t *)&p1)[1] = IF_LLADDR(sc->sc_ifp)[0];
((u_int8_t *)&p1)[0] = IF_LLADDR(sc->sc_ifp)[1];
((u_int8_t *)&p2)[3] = IF_LLADDR(sc->sc_ifp)[2];
((u_int8_t *)&p2)[2] = IF_LLADDR(sc->sc_ifp)[3];
((u_int8_t *)&p2)[1] = IF_LLADDR(sc->sc_ifp)[4];
((u_int8_t *)&p2)[0] = IF_LLADDR(sc->sc_ifp)[5];
txp_command(sc, TXP_CMD_STATION_ADDRESS_WRITE, p1, p2, 0,
NULL, NULL, NULL, 1);

View File

@ -1159,7 +1159,7 @@ aue_init(void *xsc)
/* Set MAC address */
for (i = 0; i < ETHER_ADDR_LEN; i++)
aue_csr_write_1(sc, AUE_PAR0 + i, IFP2ENADDR(sc->aue_ifp)[i]);
aue_csr_write_1(sc, AUE_PAR0 + i, IF_LLADDR(sc->aue_ifp)[i]);
/* If we want promiscuous mode, set the allframes bit. */
if (ifp->if_flags & IFF_PROMISC)

View File

@ -854,7 +854,7 @@ axe_init(void *xsc)
#ifdef notdef
/* Set MAC address */
axe_mac(sc, IFP2ENADDR(sc->axe_ifp), 1);
axe_mac(sc, IF_LLADDR(sc->axe_ifp), 1);
#endif
/* Enable RX logic. */

View File

@ -860,7 +860,7 @@ cue_init(void *xsc)
/* Set MAC address */
for (i = 0; i < ETHER_ADDR_LEN; i++)
cue_csr_write_1(sc, CUE_PAR0 - i, IFP2ENADDR(sc->cue_ifp)[i]);
cue_csr_write_1(sc, CUE_PAR0 - i, IF_LLADDR(sc->cue_ifp)[i]);
/* Enable RX logic. */
cue_csr_write_1(sc, CUE_ETHCTL, CUE_ETHCTL_RX_ON|CUE_ETHCTL_MCAST_ON);

View File

@ -809,7 +809,7 @@ kue_init(void *xsc)
/* Set MAC address */
kue_ctl(sc, KUE_CTL_WRITE, KUE_CMD_SET_MAC,
0, IFP2ENADDR(sc->kue_ifp), ETHER_ADDR_LEN);
0, IF_LLADDR(sc->kue_ifp), ETHER_ADDR_LEN);
sc->kue_rxfilt = KUE_RXFILT_UNICAST|KUE_RXFILT_BROADCAST;

View File

@ -1092,7 +1092,7 @@ rue_init(void *xsc)
rue_reset(sc);
/* Set MAC address */
rue_write_mem(sc, RUE_IDR0, IFP2ENADDR(sc->rue_ifp),
rue_write_mem(sc, RUE_IDR0, IF_LLADDR(sc->rue_ifp),
ETHER_ADDR_LEN);
/* Init TX ring. */

View File

@ -852,7 +852,7 @@ udav_init(void *xsc)
#if defined(__NetBSD__)
eaddr = LLADDR(ifp->if_sadl);
#elif defined(__FreeBSD__)
eaddr = IFP2ENADDR(ifp);
eaddr = IF_LLADDR(ifp);
#endif
udav_csr_write(sc, UDAV_PAR, eaddr, ETHER_ADDR_LEN);

View File

@ -1969,7 +1969,7 @@ vge_init(xsc)
/* Set our station address */
for (i = 0; i < ETHER_ADDR_LEN; i++)
CSR_WRITE_1(sc, VGE_PAR0 + i, IFP2ENADDR(sc->vge_ifp)[i]);
CSR_WRITE_1(sc, VGE_PAR0 + i, IF_LLADDR(sc->vge_ifp)[i]);
/*
* Set receive FIFO threshold. Also allow transmission and

View File

@ -1446,7 +1446,7 @@ vr_init_locked(struct vr_softc *sc)
/* Set our station address. */
for (i = 0; i < ETHER_ADDR_LEN; i++)
CSR_WRITE_1(sc, VR_PAR0 + i, IFP2ENADDR(sc->vr_ifp)[i]);
CSR_WRITE_1(sc, VR_PAR0 + i, IF_LLADDR(sc->vr_ifp)[i]);
/* Set DMA size. */
VR_CLRBIT(sc, VR_BCR0, VR_BCR0_DMA_LENGTH);

View File

@ -68,7 +68,7 @@ __FBSDID("$FreeBSD$");
#include <net/if.h>
#include <net/ethernet.h>
#include <net/if_arp.h>
#include <net/if_dl.h>
#include <net/if_types.h>
#include <machine/bus.h>
@ -232,7 +232,7 @@ vx_init_locked(struct vx_softc *sc)
GO_WINDOW(2);
for (i = 0; i < 6; i++) /* Reload the ether_addr. */
CSR_WRITE_1(sc, VX_W2_ADDR_0 + i, IFP2ENADDR(sc->vx_ifp)[i]);
CSR_WRITE_1(sc, VX_W2_ADDR_0 + i, IF_LLADDR(sc->vx_ifp)[i]);
CSR_WRITE_2(sc, VX_COMMAND, RX_RESET);
VX_BUSY_WAIT;
@ -756,7 +756,7 @@ vx_read(struct vx_softc *sc)
if (!(ifp->if_flags & IFF_PROMISC)
&& (eh->ether_dhost[0] & 1) == 0 /* !mcast and !bcast */
&& bcmp(eh->ether_dhost, IFP2ENADDR(sc->vx_ifp),
&& bcmp(eh->ether_dhost, IF_LLADDR(sc->vx_ifp),
ETHER_ADDR_LEN) != 0) {
m_freem(m);
return;

View File

@ -656,8 +656,6 @@ wi_init(void *arg)
struct wi_joinreq join;
int i;
int error = 0, wasenabled;
struct ifaddr *ifa;
struct sockaddr_dl *sdl;
WI_LOCK_DECL();
WI_LOCK(sc);
@ -717,9 +715,7 @@ wi_init(void *arg)
ieee80211_chan2ieee(ic, ic->ic_ibss_chan));
wi_write_ssid(sc, WI_RID_OWN_SSID, ic->ic_des_essid, ic->ic_des_esslen);
ifa = ifaddr_byindex(ifp->if_index);
sdl = (struct sockaddr_dl *) ifa->ifa_addr;
IEEE80211_ADDR_COPY(ic->ic_myaddr, LLADDR(sdl));
IEEE80211_ADDR_COPY(ic->ic_myaddr, IF_LLADDR(ifp));
wi_write_rid(sc, WI_RID_MAC_NODE, ic->ic_myaddr, IEEE80211_ADDR_LEN);
if (ic->ic_caps & IEEE80211_C_PMGT)

View File

@ -1192,7 +1192,7 @@ wlread(struct wl_softc *sc, u_short fd_p)
#endif
&&
(eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */
bcmp(eh->ether_dhost, IFP2ENADDR(sc->ifp),
bcmp(eh->ether_dhost, IF_LLADDR(sc->ifp),
sizeof(eh->ether_dhost)) != 0 ) {
m_freem(m);
return 1;
@ -2142,7 +2142,7 @@ wlconfig(struct wl_softc *sc)
outw(PIOP1(base), 0); /* ac_status */
outw(PIOP1(base), AC_IASETUP|AC_CW_EL); /* ac_command */
outw(PIOR1(base), OFFSET_CU + 6);
outsw(PIOP1(base), IFP2ENADDR(sc->ifp), WAVELAN_ADDR_SIZE/2);
outsw(PIOP1(base), IF_LLADDR(sc->ifp), WAVELAN_ADDR_SIZE/2);
if (wlcmd(sc, "config()-address") == 0)
return(0);

View File

@ -373,7 +373,7 @@ xe_init(void *xscp) {
/* Put MAC address in first 'individual address' register */
XE_SELECT_PAGE(0x50);
for (i = 0; i < 6; i++)
XE_OUTB(0x08 + i, IFP2ENADDR(scp->ifp)[scp->mohawk ? 5 - i : i]);
XE_OUTB(0x08 + i, IF_LLADDR(scp->ifp)[scp->mohawk ? 5 - i : i]);
/* Set up multicast addresses */
xe_set_multicast(scp);
@ -1309,7 +1309,7 @@ xe_set_multicast(struct xe_softc *scp) {
else if (count < 10) {
/* Full in any unused Individual Addresses with our MAC address */
for (i = count + 1; i < 10; i++)
xe_set_addr(scp, (u_int8_t *)(IFP2ENADDR(scp->ifp)), i);
xe_set_addr(scp, IF_LLADDR(scp->ifp), i);
/* Enable Individual Address matching only */
XE_SELECT_PAGE(0x42);
XE_OUTB(XE_SWC1, (XE_INB(XE_SWC1) & ~XE_SWC1_ALLMULTI) | XE_SWC1_IA_ENABLE);

View File

@ -479,7 +479,7 @@ if_attach(struct ifnet *ifp)
sdl->sdl_nlen = namelen;
sdl->sdl_index = ifp->if_index;
sdl->sdl_type = ifp->if_type;
ifaddr_byindex(ifp->if_index) = ifa;
ifp->if_addr = ifa;
ifa->ifa_ifp = ifp;
ifa->ifa_rtrequest = link_rtrequest;
ifa->ifa_addr = (struct sockaddr *)sdl;
@ -598,7 +598,7 @@ if_purgeaddrs(struct ifnet *ifp)
/*
* Detach an interface, removing it from the
* list of "active" interfaces and freeing the struct ifnet.
* list of "active" interfaces.
*
* XXXRW: There are some significant questions about event ordering, and
* how to prevent things from starting to use the interface during detach.
@ -653,10 +653,10 @@ if_detach(struct ifnet *ifp)
in6_ifdetach(ifp);
#endif
/*
* Remove address from ifindex_table[] and maybe decrement if_index.
* Remove link ifaddr pointer and maybe decrement if_index.
* Clean up all addresses.
*/
ifaddr_byindex(ifp->if_index) = NULL;
ifp->if_addr = NULL;
destroy_dev(ifdev_byindex(ifp->if_index));
ifdev_byindex(ifp->if_index) = NULL;
@ -1326,7 +1326,7 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td)
ifp->if_xname, new_name);
strlcpy(ifp->if_xname, new_name, sizeof(ifp->if_xname));
ifa = ifaddr_byindex(ifp->if_index);
ifa = ifp->if_addr;
IFA_LOCK(ifa);
sdl = (struct sockaddr_dl *)ifa->ifa_addr;
namelen = strlen(new_name);
@ -2091,7 +2091,7 @@ if_setlladdr(struct ifnet *ifp, const u_char *lladdr, int len)
struct ifaddr *ifa;
struct ifreq ifr;
ifa = ifaddr_byindex(ifp->if_index);
ifa = ifp->if_addr;
if (ifa == NULL)
return (EINVAL);
sdl = (struct sockaddr_dl *)ifa->ifa_addr;

View File

@ -649,7 +649,7 @@ arc_ifattach(ifp, lla)
#if __FreeBSD_version < 500000
ifa = ifnet_addrs[ifp->if_index - 1];
#else
ifa = ifaddr_byindex(ifp->if_index);
ifa = ifp->if_addr;
#endif
KASSERT(ifa != NULL, ("%s: no lladdr!\n", __func__));
sdl = (struct sockaddr_dl *)ifa->ifa_addr;

View File

@ -103,11 +103,9 @@ struct arpreq {
*/
struct arpcom {
struct ifnet *ac_ifp; /* network-visible interface */
u_char *_ac_enaddr; /* ethernet hardware address */
void *ac_netgraph; /* ng_ether(4) netgraph node info */
};
#define IFP2AC(ifp) ((struct arpcom *)(ifp->if_l2com))
#define IFP2ENADDR(ifp) (IFP2AC(ifp)->_ac_enaddr)
#define AC2IFP(ac) ((ac)->ac_ifp)
#endif

View File

@ -1673,7 +1673,7 @@ bridge_input(struct ifnet *ifp, struct mbuf *m)
eh = mtod(m, struct ether_header *);
if (memcmp(eh->ether_dhost, IFP2ENADDR(bifp),
if (memcmp(eh->ether_dhost, IF_LLADDR(bifp),
ETHER_ADDR_LEN) == 0) {
/*
* If the packet is for us, set the packets source as the

View File

@ -126,8 +126,6 @@ static int
ef_attach(struct efnet *sc)
{
struct ifnet *ifp = sc->ef_ifp;
struct ifaddr *ifa2;
struct sockaddr_dl *sdl2;
ifp->if_start = ef_start;
ifp->if_watchdog = NULL;
@ -137,9 +135,7 @@ ef_attach(struct efnet *sc)
/*
* Attach the interface
*/
ifa2 = ifaddr_byindex(sc->ef_pifp->if_index);
sdl2 = (struct sockaddr_dl *)ifa2->ifa_addr;
ether_ifattach(ifp, LLADDR(sdl2));
ether_ifattach(ifp, IF_LLADDR(sc->ef_pifp));
ifp->if_resolvemulti = 0;
ifp->if_type = IFT_XETHER;

View File

@ -282,7 +282,7 @@ ether_output(struct ifnet *ifp, struct mbuf *m,
(void)memcpy(eh->ether_shost, esrc,
sizeof(eh->ether_shost));
else
(void)memcpy(eh->ether_shost, IFP2ENADDR(ifp),
(void)memcpy(eh->ether_shost, IF_LLADDR(ifp),
sizeof(eh->ether_shost));
/*
@ -629,7 +629,7 @@ ether_demux(struct ifnet *ifp, struct mbuf *m)
/*
* XXX: Okay, we need to call carp_forus() and - if it is for
* us jump over code that does the normal check
* "IFP2ENADDR(ifp) == ether_dhost". The check sequence is a bit
* "IF_LLADDR(ifp) == ether_dhost". The check sequence is a bit
* different from OpenBSD, so we jump over as few code as
* possible, to catch _all_ sanity checks. This needs
* evaluation, to see if the carp ether_dhost values break any
@ -653,7 +653,7 @@ ether_demux(struct ifnet *ifp, struct mbuf *m)
if ((ifp->if_flags & IFF_PROMISC) != 0
&& !ETHER_IS_MULTICAST(eh->ether_dhost)
&& bcmp(eh->ether_dhost,
IFP2ENADDR(ifp), ETHER_ADDR_LEN) != 0
IF_LLADDR(ifp), ETHER_ADDR_LEN) != 0
&& (ifp->if_flags & IFF_PPROMISC) == 0) {
m_freem(m);
return;
@ -863,13 +863,12 @@ ether_ifattach(struct ifnet *ifp, const u_int8_t *lla)
ifp->if_baudrate = IF_Mbps(10); /* just a default */
ifp->if_broadcastaddr = etherbroadcastaddr;
ifa = ifaddr_byindex(ifp->if_index);
ifa = ifp->if_addr;
KASSERT(ifa != NULL, ("%s: no lladdr!\n", __func__));
sdl = (struct sockaddr_dl *)ifa->ifa_addr;
sdl->sdl_type = IFT_ETHER;
sdl->sdl_alen = ifp->if_addrlen;
bcopy(lla, LLADDR(sdl), ifp->if_addrlen);
IFP2ENADDR(ifp) = LLADDR(sdl);
bpfattach(ifp, DLT_EN10MB, ETHER_HDR_LEN);
if (ng_ether_attach_p != NULL)
@ -1016,10 +1015,10 @@ ether_ioctl(struct ifnet *ifp, int command, caddr_t data)
if (ipx_nullhost(*ina))
ina->x_host =
*(union ipx_host *)
IFP2ENADDR(ifp);
IF_LLADDR(ifp);
else {
bcopy((caddr_t) ina->x_host.c_host,
(caddr_t) IFP2ENADDR(ifp),
(caddr_t) IF_LLADDR(ifp),
ETHER_ADDR_LEN);
}
@ -1041,7 +1040,7 @@ ether_ioctl(struct ifnet *ifp, int command, caddr_t data)
struct sockaddr *sa;
sa = (struct sockaddr *) & ifr->ifr_data;
bcopy(IFP2ENADDR(ifp),
bcopy(IF_LLADDR(ifp),
(caddr_t) sa->sa_data, ETHER_ADDR_LEN);
}
break;

View File

@ -309,7 +309,7 @@ fddi_output(ifp, m, dst, rt0)
if (hdrcmplt)
bcopy((caddr_t)esrc, (caddr_t)fh->fddi_shost, FDDI_ADDR_LEN);
else
bcopy(IFP2ENADDR(ifp), (caddr_t)fh->fddi_shost,
bcopy(IF_LLADDR(ifp), (caddr_t)fh->fddi_shost,
FDDI_ADDR_LEN);
/*
@ -420,7 +420,7 @@ fddi_input(ifp, m)
* is in promiscuous mode.
*/
if ((ifp->if_flags & IFF_PROMISC) && ((fh->fddi_dhost[0] & 1) == 0) &&
(bcmp(IFP2ENADDR(ifp), (caddr_t)fh->fddi_dhost,
(bcmp(IF_LLADDR(ifp), (caddr_t)fh->fddi_dhost,
FDDI_ADDR_LEN) != 0))
goto dropanyway;
@ -579,17 +579,13 @@ fddi_ifattach(ifp, lla, bpf)
#ifdef IFF_NOTRAILERS
ifp->if_flags |= IFF_NOTRAILERS;
#endif
ifa = ifaddr_byindex(ifp->if_index);
if (ifa == NULL) {
if_printf(ifp, "%s() no lladdr!\n", __func__);
return;
}
ifa = ifp->if_addr;
KASSERT(ifa != NULL, ("%s: no lladdr!\n", __func__));
sdl = (struct sockaddr_dl *)ifa->ifa_addr;
sdl->sdl_type = IFT_FDDI;
sdl->sdl_alen = ifp->if_addrlen;
bcopy(lla, LLADDR(sdl), ifp->if_addrlen);
IFP2ENADDR(ifp) = LLADDR(sdl);
if (bpf)
bpfattach(ifp, DLT_FDDI, FDDI_HDR_LEN);
@ -647,10 +643,10 @@ fddi_ioctl (ifp, command, data)
if (ipx_nullhost(*ina)) {
ina->x_host = *(union ipx_host *)
IFP2ENADDR(ifp);
IF_LLADDR(ifp);
} else {
bcopy((caddr_t) ina->x_host.c_host,
(caddr_t) IFP2ENADDR(ifp),
(caddr_t) IF_LLADDR(ifp),
ETHER_ADDR_LEN);
}
@ -670,7 +666,7 @@ fddi_ioctl (ifp, command, data)
struct sockaddr *sa;
sa = (struct sockaddr *) & ifr->ifr_data;
bcopy(IFP2ENADDR(ifp),
bcopy(IF_LLADDR(ifp),
(caddr_t) sa->sa_data, FDDI_ADDR_LEN);
}

View File

@ -766,7 +766,7 @@ firewire_ifattach(struct ifnet *ifp, struct fw_hwaddr *llc)
ifp->if_resolvemulti = firewire_resolvemulti;
ifp->if_broadcastaddr = (u_char *) &firewire_broadcastaddr;
ifa = ifaddr_byindex(ifp->if_index);
ifa = ifp->if_addr;
KASSERT(ifa != NULL, ("%s: no lladdr!\n", __func__));
sdl = (struct sockaddr_dl *)ifa->ifa_addr;
sdl->sdl_type = IFT_IEEE1394;

View File

@ -114,17 +114,13 @@ iso88025_ifattach(struct ifnet *ifp, const u_int8_t *lla, int bpf)
if (ifp->if_mtu == 0)
ifp->if_mtu = ISO88025_DEFAULT_MTU;
ifa = ifaddr_byindex(ifp->if_index);
if (ifa == 0) {
if_printf(ifp, "%s() no lladdr!\n", __func__);
return;
}
ifa = ifp->if_addr;
KASSERT(ifa != NULL, ("%s: no lladdr!\n", __func__));
sdl = (struct sockaddr_dl *)ifa->ifa_addr;
sdl->sdl_type = IFT_ISO88025;
sdl->sdl_alen = ifp->if_addrlen;
bcopy(lla, LLADDR(sdl), ifp->if_addrlen);
IFP2ENADDR(ifp) = LLADDR(sdl);
if (bpf)
bpfattach(ifp, DLT_IEEE802, ISO88025_HDR_LEN);
@ -182,10 +178,10 @@ iso88025_ioctl(struct ifnet *ifp, int command, caddr_t data)
if (ipx_nullhost(*ina))
ina->x_host = *(union ipx_host *)
IFP2ENADDR(ifp);
IF_LLADDR(ifp);
else
bcopy((caddr_t) ina->x_host.c_host,
(caddr_t) IFP2ENADDR(ifp),
(caddr_t) IF_LLADDR(ifp),
ISO88025_ADDR_LEN);
/*
@ -205,7 +201,7 @@ iso88025_ioctl(struct ifnet *ifp, int command, caddr_t data)
struct sockaddr *sa;
sa = (struct sockaddr *) & ifr->ifr_data;
bcopy(IFP2ENADDR(ifp),
bcopy(IF_LLADDR(ifp),
(caddr_t) sa->sa_data, ISO88025_ADDR_LEN);
}
break;
@ -275,7 +271,7 @@ iso88025_output(ifp, m, dst, rt0)
/* Generate a generic 802.5 header for the packet */
gen_th.ac = TR_AC;
gen_th.fc = TR_LLC_FRAME;
(void)memcpy((caddr_t)gen_th.iso88025_shost, IFP2ENADDR(ifp),
(void)memcpy((caddr_t)gen_th.iso88025_shost, IF_LLADDR(ifp),
ISO88025_ADDR_LEN);
if (rif_len) {
gen_th.iso88025_shost[0] |= TR_RII;
@ -521,7 +517,7 @@ iso88025_input(ifp, m)
*/
if ((ifp->if_flags & IFF_PROMISC) &&
((th->iso88025_dhost[0] & 1) == 0) &&
(bcmp(IFP2ENADDR(ifp), (caddr_t) th->iso88025_dhost,
(bcmp(IF_LLADDR(ifp), (caddr_t) th->iso88025_dhost,
ISO88025_ADDR_LEN) != 0))
goto dropanyway;
@ -651,7 +647,7 @@ iso88025_input(ifp, m)
l->llc_dsap = l->llc_ssap;
l->llc_ssap = c;
if (m->m_flags & (M_BCAST | M_MCAST))
bcopy((caddr_t)IFP2ENADDR(ifp),
bcopy((caddr_t)IF_LLADDR(ifp),
(caddr_t)th->iso88025_dhost,
ISO88025_ADDR_LEN);
sa.sa_family = AF_UNSPEC;

View File

@ -60,7 +60,7 @@
#include <net/bpf.h>
#include <net/ethernet.h>
#include <net/if.h>
#include <net/if_arp.h>
#include <net/if_dl.h>
#include <net/route.h>
#include <net/if_types.h>
@ -386,7 +386,7 @@ tapopen(dev, flag, mode, td)
return (EBUSY);
}
bcopy(IFP2ENADDR(tp->tap_ifp), tp->ether_addr, sizeof(tp->ether_addr));
bcopy(IF_LLADDR(tp->tap_ifp), tp->ether_addr, sizeof(tp->ether_addr));
tp->tap_pid = td->td_proc->p_pid;
tp->tap_flags |= TAP_OPEN;
ifp = tp->tap_ifp;

View File

@ -125,7 +125,7 @@ struct ifnet {
* addresses which store the link-level address and the name
* of the interface.
* However, access to the AF_LINK address through this
* field is deprecated. Use ifaddr_byindex() instead.
* field is deprecated. Use if_addr or ifaddr_byindex() instead.
*/
struct knlist if_klist; /* events attached to this if */
int if_pcount; /* number of promiscuous listeners */
@ -158,7 +158,7 @@ struct ifnet {
(void *);
int (*if_resolvemulti) /* validate/resolve multicast */
(struct ifnet *, struct sockaddr **, struct sockaddr *);
void *if_spare1; /* spare pointer 1 */
struct ifaddr *if_addr; /* pointer to link-level address */
void *if_spare2; /* spare pointer 2 */
void *if_spare3; /* spare pointer 3 */
int if_drv_flags; /* driver-managed status flags */
@ -605,7 +605,6 @@ extern struct mtx ifnet_lock;
struct ifindex_entry {
struct ifnet *ife_ifnet;
struct ifaddr *ife_ifnet_addr;
struct cdev *ife_dev;
};
@ -615,7 +614,7 @@ struct ifindex_entry {
* link-level ifaddr for the interface. You are not supposed to use
* it to traverse the list of addresses associated to the interface.
*/
#define ifaddr_byindex(idx) ifindex_table[(idx)].ife_ifnet_addr
#define ifaddr_byindex(idx) ifnet_byindex(idx)->if_addr
#define ifdev_byindex(idx) ifindex_table[(idx)].ife_dev
extern struct ifnethead ifnet;
@ -658,7 +657,7 @@ void if_register_com_alloc(u_char type, if_com_alloc_t *a, if_com_free_t *f);
void if_deregister_com_alloc(u_char type);
#define IF_LLADDR(ifp) \
LLADDR((struct sockaddr_dl *) ifaddr_byindex((ifp)->if_index)->ifa_addr)
LLADDR((struct sockaddr_dl *)((ifp)->if_addr->ifa_addr))
#ifdef DEVICE_POLLING
enum poll_cmd { POLL_ONLY, POLL_AND_CHECK_STATUS };

View File

@ -907,7 +907,7 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
struct sockaddr *sa;
sa = (struct sockaddr *) &ifr->ifr_data;
bcopy(IFP2ENADDR(ifp), (caddr_t)sa->sa_data,
bcopy(IF_LLADDR(ifp), (caddr_t)sa->sa_data,
ETHER_ADDR_LEN);
}
break;

View File

@ -188,7 +188,7 @@ rtalloc1(struct sockaddr *dst, int report, u_long ignflags)
info.rti_info[RTAX_GATEWAY] = newrt->rt_gateway;
if (newrt->rt_ifp != NULL) {
info.rti_info[RTAX_IFP] =
ifaddr_byindex(newrt->rt_ifp->if_index)->ifa_addr;
newrt->rt_ifp->if_addr->ifa_addr;
info.rti_info[RTAX_IFA] = newrt->rt_ifa->ifa_addr;
}
rt_missmsg(RTM_ADD, &info, newrt->rt_flags, 0);

View File

@ -444,7 +444,7 @@ route_output(struct mbuf *m, struct socket *so)
ifp = rt->rt_ifp;
if (ifp) {
info.rti_info[RTAX_IFP] =
ifaddr_byindex(ifp->if_index)->ifa_addr;
ifp->if_addr->ifa_addr;
if (jailed(so->so_cred)) {
bzero(&jail, sizeof(jail));
jail.sin_family = PF_INET;
@ -873,8 +873,7 @@ rt_newaddrmsg(int cmd, struct ifaddr *ifa, int error, struct rtentry *rt)
int ncmd = cmd == RTM_ADD ? RTM_NEWADDR : RTM_DELADDR;
info.rti_info[RTAX_IFA] = sa = ifa->ifa_addr;
info.rti_info[RTAX_IFP] =
ifaddr_byindex(ifp->if_index)->ifa_addr;
info.rti_info[RTAX_IFP] = ifp->if_addr->ifa_addr;
info.rti_info[RTAX_NETMASK] = ifa->ifa_netmask;
info.rti_info[RTAX_BRD] = ifa->ifa_dstaddr;
if ((m = rt_msg1(ncmd, &info)) == NULL)
@ -924,8 +923,7 @@ rt_newmaddrmsg(int cmd, struct ifmultiaddr *ifma)
bzero((caddr_t)&info, sizeof(info));
info.rti_info[RTAX_IFA] = ifma->ifma_addr;
info.rti_info[RTAX_IFP] =
ifp ? ifaddr_byindex(ifp->if_index)->ifa_addr : NULL;
info.rti_info[RTAX_IFP] = ifp ? ifp->if_addr->ifa_addr : NULL;
/*
* If a link-layer address is present, present it as a ``gateway''
* (similarly to how ARP entries, e.g., are presented).
@ -1058,8 +1056,7 @@ sysctl_dumpentry(struct radix_node *rn, void *vw)
info.rti_info[RTAX_NETMASK] = rt_mask(rt);
info.rti_info[RTAX_GENMASK] = rt->rt_genmask;
if (rt->rt_ifp) {
info.rti_info[RTAX_IFP] =
ifaddr_byindex(rt->rt_ifp->if_index)->ifa_addr;
info.rti_info[RTAX_IFP] = rt->rt_ifp->if_addr->ifa_addr;
info.rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr;
if (rt->rt_ifp->if_flags & IFF_POINTOPOINT)
info.rti_info[RTAX_BRD] = rt->rt_ifa->ifa_dstaddr;
@ -1093,7 +1090,7 @@ sysctl_iflist(int af, struct walkarg *w)
TAILQ_FOREACH(ifp, &ifnet, if_link) {
if (w->w_arg && w->w_arg != ifp->if_index)
continue;
ifa = ifaddr_byindex(ifp->if_index);
ifa = ifp->if_addr;
info.rti_info[RTAX_IFP] = ifa->ifa_addr;
len = rt_msg2(RTM_IFINFO, &info, NULL, w);
info.rti_info[RTAX_IFP] = NULL;
@ -1154,7 +1151,7 @@ sysctl_ifmalist(int af, struct walkarg *w)
TAILQ_FOREACH(ifp, &ifnet, if_link) {
if (w->w_arg && w->w_arg != ifp->if_index)
continue;
ifa = ifaddr_byindex(ifp->if_index);
ifa = ifp->if_addr;
info.rti_info[RTAX_IFP] = ifa ? ifa->ifa_addr : NULL;
IF_ADDR_LOCK(ifp);
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {

View File

@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <net/if.h>
#include <net/if_arp.h>
#include <net/if_dl.h>
#include <net/if_media.h>
#include <net/ethernet.h>
@ -2463,10 +2463,10 @@ ieee80211_ioctl(struct ieee80211com *ic, u_long cmd, caddr_t data)
if (ipx_nullhost(*ina))
ina->x_host = *(union ipx_host *)
IFP2ENADDR(ifp);
IF_LLADDR(ifp);
else
bcopy((caddr_t) ina->x_host.c_host,
(caddr_t) IFP2ENADDR(ifp),
(caddr_t) IF_LLADDR(ifp),
ETHER_ADDR_LEN);
/* fall thru... */
}

View File

@ -63,6 +63,7 @@
#include <sys/syslog.h>
#include <net/if.h>
#include <net/if_dl.h>
#include <netinet/in.h>
#undef s_net
@ -196,7 +197,7 @@ aarpwhohas(struct ifnet *ifp, struct sockaddr_at *sat)
ea->aarp_hln = sizeof(ea->aarp_sha);
ea->aarp_pln = sizeof(ea->aarp_spu);
ea->aarp_op = htons(AARPOP_REQUEST);
bcopy(IFP2ENADDR(ifp), (caddr_t)ea->aarp_sha,
bcopy(IF_LLADDR(ifp), (caddr_t)ea->aarp_sha,
sizeof(ea->aarp_sha));
/*
@ -360,7 +361,7 @@ at_aarpinput(struct ifnet *ifp, struct mbuf *m)
ea = mtod(m, struct ether_aarp *);
/* Check to see if from my hardware address */
if (!bcmp((caddr_t)ea->aarp_sha, IFP2ENADDR(ifp), ETHER_ADDR_LEN)) {
if (!bcmp((caddr_t)ea->aarp_sha, IF_LLADDR(ifp), ETHER_ADDR_LEN)) {
m_freem(m);
return;
}
@ -483,7 +484,7 @@ at_aarpinput(struct ifnet *ifp, struct mbuf *m)
bcopy((caddr_t)ea->aarp_sha, (caddr_t)ea->aarp_tha,
sizeof(ea->aarp_sha));
bcopy(IFP2ENADDR(ifp), (caddr_t)ea->aarp_sha,
bcopy(IF_LLADDR(ifp), (caddr_t)ea->aarp_sha,
sizeof(ea->aarp_sha));
/* XXX */
@ -629,7 +630,7 @@ aarpprobe(void *arg)
ea->aarp_hln = sizeof(ea->aarp_sha);
ea->aarp_pln = sizeof(ea->aarp_spu);
ea->aarp_op = htons(AARPOP_PROBE);
bcopy(IFP2ENADDR(ifp), (caddr_t)ea->aarp_sha,
bcopy(IF_LLADDR(ifp), (caddr_t)ea->aarp_sha,
sizeof(ea->aarp_sha));
eh = (struct ether_header *)sa.sa_data;

View File

@ -561,7 +561,7 @@ atm_physif_ioctl(code, data, arg)
* Set macaddr in <Link> address
*/
ifp->if_addrlen = 6;
ifa = ifaddr_byindex(ifp->if_index);
ifa = ifp->if_addr;
if ( ifa ) {
sdl = (struct sockaddr_dl *)
ifa->ifa_addr;

View File

@ -461,7 +461,7 @@ ng_ether_rcvmsg(node_p node, item_p item, hook_p lasthook)
error = ENOMEM;
break;
}
bcopy(IFP2ENADDR(priv->ifp),
bcopy(IF_LLADDR(priv->ifp),
resp->data, ETHER_ADDR_LEN);
break;
case NGM_ETHER_SET_ENADDR:
@ -624,7 +624,7 @@ ng_ether_rcv_lower(node_p node, struct mbuf *m)
return (ENOBUFS);
/* Overwrite source MAC address */
bcopy(IFP2ENADDR(ifp),
bcopy(IF_LLADDR(ifp),
mtod(m, struct ether_header *)->ether_shost,
ETHER_ADDR_LEN);
}

View File

@ -102,8 +102,8 @@
#include <sys/queue.h>
#include <net/if.h>
#include <net/if_dl.h>
#include <net/if_types.h>
#include <net/if_arp.h>
#include <net/if_media.h>
#include <net/bpf.h>
#include <net/ethernet.h>
@ -411,18 +411,18 @@ ng_fec_addport(struct ng_fec_private *priv, char *iface)
* by extension, all the other ports in the bundle).
*/
if (b->fec_ifcnt == 0)
if_setlladdr(ifp, IFP2ENADDR(bifp), ETHER_ADDR_LEN);
if_setlladdr(ifp, IF_LLADDR(bifp), ETHER_ADDR_LEN);
b->fec_btype = FEC_BTYPE_MAC;
new->fec_idx = b->fec_ifcnt;
b->fec_ifcnt++;
/* Save the real MAC address. */
bcopy(IFP2ENADDR(bifp),
bcopy(IF_LLADDR(bifp),
(char *)&new->fec_mac, ETHER_ADDR_LEN);
/* Set up phony MAC address. */
if_setlladdr(bifp, IFP2ENADDR(ifp), ETHER_ADDR_LEN);
if_setlladdr(bifp, IF_LLADDR(ifp), ETHER_ADDR_LEN);
/* Save original input vector */
new->fec_if_input = bifp->if_input;
@ -1143,7 +1143,7 @@ ng_fec_constructor(node_p node)
log(LOG_WARNING, "%s: can't acquire netgraph name\n", ifname);
/* Attach the interface */
ether_ifattach(ifp, IFP2ENADDR(priv->ifp));
ether_ifattach(ifp, IF_LLADDR(priv->ifp));
callout_handle_init(&priv->fec_ch);
/* Override output method with our own */

View File

@ -1049,8 +1049,8 @@ carp_send_arp(struct carp_softc *sc)
if (ifa->ifa_addr->sa_family != AF_INET)
continue;
/* arprequest(sc->sc_carpdev, &in, &in, IFP2ENADDR(sc->sc_ifp)); */
arp_ifinit2(sc->sc_carpdev, ifa, IFP2ENADDR(sc->sc_ifp));
/* arprequest(sc->sc_carpdev, &in, &in, IF_LLADDR(sc->sc_ifp)); */
arp_ifinit2(sc->sc_carpdev, ifa, IF_LLADDR(sc->sc_ifp));
DELAY(1000); /* XXX */
}
@ -1145,7 +1145,7 @@ carp_iamatch(void *v, struct in_ifaddr *ia,
if (count == index) {
if (vh->sc_state ==
MASTER) {
*enaddr = IFP2ENADDR(vh->sc_ifp);
*enaddr = IF_LLADDR(vh->sc_ifp);
CARP_UNLOCK(cif);
return (1);
} else {
@ -1163,7 +1163,7 @@ carp_iamatch(void *v, struct in_ifaddr *ia,
if ((SC2IFP(vh)->if_flags & IFF_UP) &&
(SC2IFP(vh)->if_drv_flags & IFF_DRV_RUNNING) &&
ia->ia_ifp == SC2IFP(vh)) {
*enaddr = IFP2ENADDR(vh->sc_ifp);
*enaddr = IF_LLADDR(vh->sc_ifp);
CARP_UNLOCK(cif);
return (1);
}
@ -1219,14 +1219,14 @@ carp_macmatch6(void *v, struct mbuf *m, const struct in6_addr *taddr)
if (mtag == NULL) {
/* better a bit than nothing */
CARP_UNLOCK(cif);
return (IFP2ENADDR(sc->sc_ifp));
return (IF_LLADDR(sc->sc_ifp));
}
bcopy(&ifp, (caddr_t)(mtag + 1),
sizeof(struct ifnet *));
m_tag_prepend(m, mtag);
CARP_UNLOCK(cif);
return (IFP2ENADDR(sc->sc_ifp));
return (IF_LLADDR(sc->sc_ifp));
}
}
}
@ -1251,7 +1251,7 @@ carp_forus(void *v, void *dhost)
if ((SC2IFP(vh)->if_flags & IFF_UP) &&
(SC2IFP(vh)->if_drv_flags & IFF_DRV_RUNNING) &&
vh->sc_state == MASTER &&
!bcmp(dhost, IFP2ENADDR(vh->sc_ifp), ETHER_ADDR_LEN)) {
!bcmp(dhost, IF_LLADDR(vh->sc_ifp), ETHER_ADDR_LEN)) {
CARP_UNLOCK(cif);
return (SC2IFP(vh));
}
@ -1863,12 +1863,12 @@ carp_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr)
return EEXIST;
}
sc->sc_vhid = carpr.carpr_vhid;
IFP2ENADDR(sc->sc_ifp)[0] = 0;
IFP2ENADDR(sc->sc_ifp)[1] = 0;
IFP2ENADDR(sc->sc_ifp)[2] = 0x5e;
IFP2ENADDR(sc->sc_ifp)[3] = 0;
IFP2ENADDR(sc->sc_ifp)[4] = 1;
IFP2ENADDR(sc->sc_ifp)[5] = sc->sc_vhid;
IF_LLADDR(sc->sc_ifp)[0] = 0;
IF_LLADDR(sc->sc_ifp)[1] = 0;
IF_LLADDR(sc->sc_ifp)[2] = 0x5e;
IF_LLADDR(sc->sc_ifp)[3] = 0;
IF_LLADDR(sc->sc_ifp)[4] = 1;
IF_LLADDR(sc->sc_ifp)[5] = sc->sc_vhid;
error--;
}
if (carpr.carpr_advbase > 0 || carpr.carpr_advskew > 0) {

View File

@ -2037,8 +2037,7 @@ ip_savecontrol(inp, mp, ip, m)
if (((ifp = m->m_pkthdr.rcvif))
&& ( ifp->if_index && (ifp->if_index <= if_index))) {
sdp = (struct sockaddr_dl *)
(ifaddr_byindex(ifp->if_index)->ifa_addr);
sdp = (struct sockaddr_dl *)ifp->if_addr->ifa_addr;
/*
* Change our mind and don't try copy.
*/

View File

@ -260,8 +260,8 @@ tulip_txprobe(tulip_softc_t * const sc)
/*
* Construct a LLC TEST message which will point to ourselves.
*/
bcopy(IFP2ENADDR(sc->tulip_ifp), mtod(m, struct ether_header *)->ether_dhost, 6);
bcopy(IFP2ENADDR(sc->tulip_ifp), mtod(m, struct ether_header *)->ether_shost, 6);
bcopy(IF_LLADDR(sc->tulip_ifp), mtod(m, struct ether_header *)->ether_dhost, 6);
bcopy(IF_LLADDR(sc->tulip_ifp), mtod(m, struct ether_header *)->ether_shost, 6);
mtod(m, struct ether_header *)->ether_type = htons(3);
mtod(m, unsigned char *)[14] = 0;
mtod(m, unsigned char *)[15] = 0;
@ -3081,12 +3081,12 @@ tulip_addr_filter(tulip_softc_t * const sc)
hash = tulip_mchash(ifp->if_broadcastaddr);
sp[hash >> 4] |= htole32(1 << (hash & 0xF));
if (sc->tulip_flags & TULIP_WANTHASHONLY) {
hash = tulip_mchash(IFP2ENADDR(ifp));
hash = tulip_mchash(IF_LLADDR(ifp));
sp[hash >> 4] |= htole32(1 << (hash & 0xF));
} else {
sp[39] = TULIP_SP_MAC(((u_int16_t *)IFP2ENADDR(ifp))[0]);
sp[40] = TULIP_SP_MAC(((u_int16_t *)IFP2ENADDR(ifp))[1]);
sp[41] = TULIP_SP_MAC(((u_int16_t *)IFP2ENADDR(ifp))[2]);
sp[39] = TULIP_SP_MAC(((u_int16_t *)IF_LLADDR(ifp))[0]);
sp[40] = TULIP_SP_MAC(((u_int16_t *)IF_LLADDR(ifp))[1]);
sp[41] = TULIP_SP_MAC(((u_int16_t *)IF_LLADDR(ifp))[2]);
}
}
}
@ -3118,9 +3118,9 @@ tulip_addr_filter(tulip_softc_t * const sc)
* Pad the rest with our hardware address
*/
for (; idx < 16; idx++) {
*sp++ = TULIP_SP_MAC(((u_int16_t *)IFP2ENADDR(ifp))[0]);
*sp++ = TULIP_SP_MAC(((u_int16_t *)IFP2ENADDR(ifp))[1]);
*sp++ = TULIP_SP_MAC(((u_int16_t *)IFP2ENADDR(ifp))[2]);
*sp++ = TULIP_SP_MAC(((u_int16_t *)IF_LLADDR(ifp))[0]);
*sp++ = TULIP_SP_MAC(((u_int16_t *)IF_LLADDR(ifp))[1]);
*sp++ = TULIP_SP_MAC(((u_int16_t *)IF_LLADDR(ifp))[2]);
}
}
IF_ADDR_UNLOCK(ifp);

View File

@ -1171,11 +1171,11 @@ pcn_init_locked(sc)
/* Set MAC address */
pcn_csr_write(sc, PCN_CSR_PAR0,
((u_int16_t *)IFP2ENADDR(sc->pcn_ifp))[0]);
((u_int16_t *)IF_LLADDR(sc->pcn_ifp))[0]);
pcn_csr_write(sc, PCN_CSR_PAR1,
((u_int16_t *)IFP2ENADDR(sc->pcn_ifp))[1]);
((u_int16_t *)IF_LLADDR(sc->pcn_ifp))[1]);
pcn_csr_write(sc, PCN_CSR_PAR2,
((u_int16_t *)IFP2ENADDR(sc->pcn_ifp))[2]);
((u_int16_t *)IF_LLADDR(sc->pcn_ifp))[2]);
/* Init circular RX list. */
if (pcn_list_rx_init(sc) == ENOBUFS) {

View File

@ -1511,9 +1511,9 @@ rl_init_locked(struct rl_softc *sc)
*/
CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_WRITECFG);
CSR_WRITE_STREAM_4(sc, RL_IDR0,
*(uint32_t *)(&IFP2ENADDR(sc->rl_ifp)[0]));
*(uint32_t *)(&IF_LLADDR(sc->rl_ifp)[0]));
CSR_WRITE_STREAM_4(sc, RL_IDR4,
*(uint32_t *)(&IFP2ENADDR(sc->rl_ifp)[4]));
*(uint32_t *)(&IF_LLADDR(sc->rl_ifp)[4]));
CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF);
/* Init the RX buffer pointer register. */

View File

@ -1239,9 +1239,9 @@ sf_init_locked(sc)
(i + sizeof(u_int32_t)), 0);
/* Init our MAC address */
csr_write_4(sc, SF_PAR0, *(u_int32_t *)(&IFP2ENADDR(sc->sf_ifp)[0]));
csr_write_4(sc, SF_PAR1, *(u_int32_t *)(&IFP2ENADDR(sc->sf_ifp)[4]));
sf_setperf(sc, 0, (caddr_t)&IFP2ENADDR(sc->sf_ifp));
csr_write_4(sc, SF_PAR0, *(u_int32_t *)(&IF_LLADDR(sc->sf_ifp)[0]));
csr_write_4(sc, SF_PAR1, *(u_int32_t *)(&IF_LLADDR(sc->sf_ifp)[4]));
sf_setperf(sc, 0, IF_LLADDR(sc->sf_ifp));
if (sf_init_rx_ring(sc) == ENOBUFS) {
if_printf(sc->sf_ifp,

View File

@ -1869,23 +1869,23 @@ sis_initl(struct sis_softc *sc)
if (sc->sis_type == SIS_TYPE_83815) {
CSR_WRITE_4(sc, SIS_RXFILT_CTL, NS_FILTADDR_PAR0);
CSR_WRITE_4(sc, SIS_RXFILT_DATA,
((u_int16_t *)IFP2ENADDR(sc->sis_ifp))[0]);
((u_int16_t *)IF_LLADDR(sc->sis_ifp))[0]);
CSR_WRITE_4(sc, SIS_RXFILT_CTL, NS_FILTADDR_PAR1);
CSR_WRITE_4(sc, SIS_RXFILT_DATA,
((u_int16_t *)IFP2ENADDR(sc->sis_ifp))[1]);
((u_int16_t *)IF_LLADDR(sc->sis_ifp))[1]);
CSR_WRITE_4(sc, SIS_RXFILT_CTL, NS_FILTADDR_PAR2);
CSR_WRITE_4(sc, SIS_RXFILT_DATA,
((u_int16_t *)IFP2ENADDR(sc->sis_ifp))[2]);
((u_int16_t *)IF_LLADDR(sc->sis_ifp))[2]);
} else {
CSR_WRITE_4(sc, SIS_RXFILT_CTL, SIS_FILTADDR_PAR0);
CSR_WRITE_4(sc, SIS_RXFILT_DATA,
((u_int16_t *)IFP2ENADDR(sc->sis_ifp))[0]);
((u_int16_t *)IF_LLADDR(sc->sis_ifp))[0]);
CSR_WRITE_4(sc, SIS_RXFILT_CTL, SIS_FILTADDR_PAR1);
CSR_WRITE_4(sc, SIS_RXFILT_DATA,
((u_int16_t *)IFP2ENADDR(sc->sis_ifp))[1]);
((u_int16_t *)IF_LLADDR(sc->sis_ifp))[1]);
CSR_WRITE_4(sc, SIS_RXFILT_CTL, SIS_FILTADDR_PAR2);
CSR_WRITE_4(sc, SIS_RXFILT_DATA,
((u_int16_t *)IFP2ENADDR(sc->sis_ifp))[2]);
((u_int16_t *)IF_LLADDR(sc->sis_ifp))[2]);
}
/* Init circular TX/RX lists. */

View File

@ -2580,11 +2580,11 @@ sk_init_xmac(sc_if)
/* Set station address */
SK_XM_WRITE_2(sc_if, XM_PAR0,
*(u_int16_t *)(&IFP2ENADDR(sc_if->sk_ifp)[0]));
*(u_int16_t *)(&IF_LLADDR(sc_if->sk_ifp)[0]));
SK_XM_WRITE_2(sc_if, XM_PAR1,
*(u_int16_t *)(&IFP2ENADDR(sc_if->sk_ifp)[2]));
*(u_int16_t *)(&IF_LLADDR(sc_if->sk_ifp)[2]));
SK_XM_WRITE_2(sc_if, XM_PAR2,
*(u_int16_t *)(&IFP2ENADDR(sc_if->sk_ifp)[4]));
*(u_int16_t *)(&IF_LLADDR(sc_if->sk_ifp)[4]));
SK_XM_SETBIT_4(sc_if, XM_MODE, XM_MODE_RX_USE_STATION);
if (ifp->if_flags & IFF_BROADCAST) {
@ -2755,8 +2755,8 @@ sk_init_yukon(sc_if)
for (i = 0; i < 3; i++) {
/* Write Source Address 1 (unicast filter) */
SK_YU_WRITE_2(sc_if, YUKON_SAL1 + i * 4,
IFP2ENADDR(sc_if->sk_ifp)[i * 2] |
IFP2ENADDR(sc_if->sk_ifp)[i * 2 + 1] << 8);
IF_LLADDR(sc_if->sk_ifp)[i * 2] |
IF_LLADDR(sc_if->sk_ifp)[i * 2 + 1] << 8);
}
for (i = 0; i < 3; i++) {

View File

@ -1305,7 +1305,7 @@ ste_init_locked(sc)
/* Init our MAC address */
for (i = 0; i < ETHER_ADDR_LEN; i++) {
CSR_WRITE_1(sc, STE_PAR0 + i, IFP2ENADDR(sc->ste_ifp)[i]);
CSR_WRITE_1(sc, STE_PAR0 + i, IF_LLADDR(sc->ste_ifp)[i]);
}
/* Init RX list */

View File

@ -2862,7 +2862,7 @@ static void ti_init2(sc)
TI_DO_CMD(TI_CMD_UPDATE_GENCOM, 0, 0);
/* Load our MAC address. */
m = (u_int16_t *)&IFP2ENADDR(sc->ti_ifp)[0];
m = (u_int16_t *)IF_LLADDR(sc->ti_ifp);
CSR_WRITE_4(sc, TI_GCR_PAR0, htons(m[0]));
CSR_WRITE_4(sc, TI_GCR_PAR1, (htons(m[1]) << 16) | htons(m[2]));
TI_DO_CMD(TI_CMD_SET_MAC_ADDR, 0, 0);

View File

@ -1525,7 +1525,7 @@ tl_intvec_rxeof(xsc, type)
*/
eh = mtod(m, struct ether_header *);
/*if (ifp->if_flags & IFF_PROMISC && */
if (!bcmp(eh->ether_shost, IFP2ENADDR(sc->tl_ifp),
if (!bcmp(eh->ether_shost, IF_LLADDR(sc->tl_ifp),
ETHER_ADDR_LEN)) {
m_freem(m);
continue;
@ -2091,7 +2091,7 @@ tl_init_locked(sc)
tl_dio_write16(sc, TL_MAXRX, MCLBYTES);
/* Init our MAC address */
tl_setfilt(sc, (caddr_t)IFP2ENADDR(sc->tl_ifp), 0);
tl_setfilt(sc, IF_LLADDR(sc->tl_ifp), 0);
/* Init multicast filter, if needed. */
tl_setmulti(sc);

View File

@ -1446,7 +1446,7 @@ vr_init_locked(struct vr_softc *sc)
/* Set our station address. */
for (i = 0; i < ETHER_ADDR_LEN; i++)
CSR_WRITE_1(sc, VR_PAR0 + i, IFP2ENADDR(sc->vr_ifp)[i]);
CSR_WRITE_1(sc, VR_PAR0 + i, IF_LLADDR(sc->vr_ifp)[i]);
/* Set DMA size. */
VR_CLRBIT(sc, VR_BCR0, VR_BCR0_DMA_LENGTH);

View File

@ -1598,7 +1598,7 @@ wb_init_locked(sc)
/* Init our MAC address */
for (i = 0; i < ETHER_ADDR_LEN; i++) {
CSR_WRITE_1(sc, WB_NODE0 + i, IFP2ENADDR(sc->wb_ifp)[i]);
CSR_WRITE_1(sc, WB_NODE0 + i, IF_LLADDR(sc->wb_ifp)[i]);
}
/* Init circular RX list. */

View File

@ -857,9 +857,9 @@ xl_testpacket(struct xl_softc *sc)
if (m == NULL)
return;
bcopy(IFP2ENADDR(sc->xl_ifp),
bcopy(IF_LLADDR(sc->xl_ifp),
mtod(m, struct ether_header *)->ether_dhost, ETHER_ADDR_LEN);
bcopy(IFP2ENADDR(sc->xl_ifp),
bcopy(IF_LLADDR(sc->xl_ifp),
mtod(m, struct ether_header *)->ether_shost, ETHER_ADDR_LEN);
mtod(m, struct ether_header *)->ether_type = htons(3);
mtod(m, unsigned char *)[14] = 0;
@ -2807,7 +2807,7 @@ xl_init_locked(struct xl_softc *sc)
XL_SEL_WIN(2);
for (i = 0; i < ETHER_ADDR_LEN; i++) {
CSR_WRITE_1(sc, XL_W2_STATION_ADDR_LO + i,
IFP2ENADDR(sc->xl_ifp)[i]);
IF_LLADDR(sc->xl_ifp)[i]);
}
/* Clear the station mask. */

View File

@ -57,7 +57,7 @@
* is created, otherwise 1.
*/
#undef __FreeBSD_version
#define __FreeBSD_version 700005 /* Master, propagated to newvers */
#define __FreeBSD_version 700006 /* Master, propagated to newvers */
#ifndef LOCORE
#include <sys/types.h>