Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/e1000/if_em.c
Show First 20 Lines • Show All 996 Lines • ▼ Show 20 Lines | em_if_attach_pre(if_ctx_t ctx) | ||||
/* | /* | ||||
* This controls when hardware reports transmit completion | * This controls when hardware reports transmit completion | ||||
* status. | * status. | ||||
*/ | */ | ||||
hw->mac.report_tx_early = 1; | hw->mac.report_tx_early = 1; | ||||
/* Allocate multicast array memory. */ | /* Allocate multicast array memory. */ | ||||
adapter->mta = malloc(sizeof(u8) * ETH_ADDR_LEN * | adapter->mta = malloc(sizeof(u8) * ETHER_ADDR_LEN * | ||||
MAX_NUM_MULTICAST_ADDRESSES, M_DEVBUF, M_NOWAIT); | MAX_NUM_MULTICAST_ADDRESSES, M_DEVBUF, M_NOWAIT); | ||||
if (adapter->mta == NULL) { | if (adapter->mta == NULL) { | ||||
device_printf(dev, "Can not allocate multicast setup array\n"); | device_printf(dev, "Can not allocate multicast setup array\n"); | ||||
error = ENOMEM; | error = ENOMEM; | ||||
goto err_late; | goto err_late; | ||||
} | } | ||||
/* Check SOL/IDER usage */ | /* Check SOL/IDER usage */ | ||||
▲ Show 20 Lines • Show All 653 Lines • ▼ Show 20 Lines | |||||
static u_int | static u_int | ||||
em_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) | em_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) | ||||
{ | { | ||||
u8 *mta = arg; | u8 *mta = arg; | ||||
if (cnt == MAX_NUM_MULTICAST_ADDRESSES) | if (cnt == MAX_NUM_MULTICAST_ADDRESSES) | ||||
return (1); | return (1); | ||||
bcopy(LLADDR(sdl), &mta[cnt * ETH_ADDR_LEN], ETH_ADDR_LEN); | bcopy(LLADDR(sdl), &mta[cnt * ETHER_ADDR_LEN], ETHER_ADDR_LEN); | ||||
return (1); | return (1); | ||||
} | } | ||||
/********************************************************************* | /********************************************************************* | ||||
* Multicast Update | * Multicast Update | ||||
* | * | ||||
* This routine is called whenever multicast address list is updated. | * This routine is called whenever multicast address list is updated. | ||||
* | * | ||||
**********************************************************************/ | **********************************************************************/ | ||||
static void | static void | ||||
em_if_multi_set(if_ctx_t ctx) | em_if_multi_set(if_ctx_t ctx) | ||||
{ | { | ||||
struct adapter *adapter = iflib_get_softc(ctx); | struct adapter *adapter = iflib_get_softc(ctx); | ||||
struct ifnet *ifp = iflib_get_ifp(ctx); | struct ifnet *ifp = iflib_get_ifp(ctx); | ||||
u32 reg_rctl = 0; | u32 reg_rctl = 0; | ||||
u8 *mta; /* Multicast array memory */ | u8 *mta; /* Multicast array memory */ | ||||
int mcnt = 0; | int mcnt = 0; | ||||
IOCTL_DEBUGOUT("em_set_multi: begin"); | IOCTL_DEBUGOUT("em_set_multi: begin"); | ||||
mta = adapter->mta; | mta = adapter->mta; | ||||
bzero(mta, sizeof(u8) * ETH_ADDR_LEN * MAX_NUM_MULTICAST_ADDRESSES); | bzero(mta, sizeof(u8) * ETHER_ADDR_LEN * MAX_NUM_MULTICAST_ADDRESSES); | ||||
if (adapter->hw.mac.type == e1000_82542 && | if (adapter->hw.mac.type == e1000_82542 && | ||||
adapter->hw.revision_id == E1000_REVISION_2) { | adapter->hw.revision_id == E1000_REVISION_2) { | ||||
reg_rctl = E1000_READ_REG(&adapter->hw, E1000_RCTL); | reg_rctl = E1000_READ_REG(&adapter->hw, E1000_RCTL); | ||||
if (adapter->hw.bus.pci_cmd_word & CMD_MEM_WRT_INVALIDATE) | if (adapter->hw.bus.pci_cmd_word & CMD_MEM_WRT_INVALIDATE) | ||||
e1000_pci_clear_mwi(&adapter->hw); | e1000_pci_clear_mwi(&adapter->hw); | ||||
reg_rctl |= E1000_RCTL_RST; | reg_rctl |= E1000_RCTL_RST; | ||||
E1000_WRITE_REG(&adapter->hw, E1000_RCTL, reg_rctl); | E1000_WRITE_REG(&adapter->hw, E1000_RCTL, reg_rctl); | ||||
▲ Show 20 Lines • Show All 2,902 Lines • Show Last 20 Lines |