Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/e1000/if_em.c
Show First 20 Lines • Show All 324 Lines • ▼ Show 20 Lines | |||||
static void em_sbuf_fw_version(struct e1000_fw_version *, struct sbuf *); | static void em_sbuf_fw_version(struct e1000_fw_version *, struct sbuf *); | ||||
static void em_print_fw_version(struct e1000_softc *); | static void em_print_fw_version(struct e1000_softc *); | ||||
static int em_sysctl_print_fw_version(SYSCTL_HANDLER_ARGS); | static int em_sysctl_print_fw_version(SYSCTL_HANDLER_ARGS); | ||||
static int em_sysctl_debug_info(SYSCTL_HANDLER_ARGS); | static int em_sysctl_debug_info(SYSCTL_HANDLER_ARGS); | ||||
static int em_get_rs(SYSCTL_HANDLER_ARGS); | static int em_get_rs(SYSCTL_HANDLER_ARGS); | ||||
static void em_print_debug_info(struct e1000_softc *); | static void em_print_debug_info(struct e1000_softc *); | ||||
static int em_is_valid_ether_addr(u8 *); | static int em_is_valid_ether_addr(u8 *); | ||||
static bool em_automask_tso(if_ctx_t); | static bool em_automask_tso(if_ctx_t); | ||||
static int em_sysctl_tso_tcp_flags_mask(SYSCTL_HANDLER_ARGS); | |||||
static int em_sysctl_int_delay(SYSCTL_HANDLER_ARGS); | static int em_sysctl_int_delay(SYSCTL_HANDLER_ARGS); | ||||
static void em_add_int_delay_sysctl(struct e1000_softc *, const char *, | static void em_add_int_delay_sysctl(struct e1000_softc *, const char *, | ||||
const char *, struct em_int_delay_info *, int, int); | const char *, struct em_int_delay_info *, int, int); | ||||
/* Management and WOL Support */ | /* Management and WOL Support */ | ||||
static void em_init_manageability(struct e1000_softc *); | static void em_init_manageability(struct e1000_softc *); | ||||
static void em_release_manageability(struct e1000_softc *); | static void em_release_manageability(struct e1000_softc *); | ||||
static void em_get_hw_control(struct e1000_softc *); | static void em_get_hw_control(struct e1000_softc *); | ||||
static void em_release_hw_control(struct e1000_softc *); | static void em_release_hw_control(struct e1000_softc *); | ||||
▲ Show 20 Lines • Show All 509 Lines • ▼ Show 20 Lines | em_if_attach_pre(if_ctx_t ctx) | ||||
SYSCTL_ADD_PROC(ctx_list, child, OID_AUTO, "reg_dump", | SYSCTL_ADD_PROC(ctx_list, child, OID_AUTO, "reg_dump", | ||||
CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, sc, 0, | CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, sc, 0, | ||||
em_get_regs, "A", "Dump Registers"); | em_get_regs, "A", "Dump Registers"); | ||||
SYSCTL_ADD_PROC(ctx_list, child, OID_AUTO, "rs_dump", | SYSCTL_ADD_PROC(ctx_list, child, OID_AUTO, "rs_dump", | ||||
CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, sc, 0, | CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, sc, 0, | ||||
em_get_rs, "I", "Dump RS indexes"); | em_get_rs, "I", "Dump RS indexes"); | ||||
SYSCTL_ADD_PROC(ctx_list, child, OID_AUTO, | |||||
"tso_tcp_flags_mask_first_segment", | |||||
CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, | |||||
sc, 0, em_sysctl_tso_tcp_flags_mask, "IU", | |||||
"TSO TCP flags mask for first segment"); | |||||
SYSCTL_ADD_PROC(ctx_list, child, OID_AUTO, | |||||
"tso_tcp_flags_mask_middle_segment", | |||||
CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, | |||||
sc, 1, em_sysctl_tso_tcp_flags_mask, "IU", | |||||
"TSO TCP flags mask for middle segment"); | |||||
SYSCTL_ADD_PROC(ctx_list, child, OID_AUTO, | |||||
"tso_tcp_flags_mask_last_segment", | |||||
CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, | |||||
sc, 2, em_sysctl_tso_tcp_flags_mask, "IU", | |||||
"TSO TCP flags mask for last segment"); | |||||
scctx->isc_tx_nsegments = EM_MAX_SCATTER; | scctx->isc_tx_nsegments = EM_MAX_SCATTER; | ||||
scctx->isc_nrxqsets_max = scctx->isc_ntxqsets_max = em_set_num_queues(ctx); | scctx->isc_nrxqsets_max = scctx->isc_ntxqsets_max = em_set_num_queues(ctx); | ||||
if (bootverbose) | if (bootverbose) | ||||
device_printf(dev, "attach_pre capping queues at %d\n", | device_printf(dev, "attach_pre capping queues at %d\n", | ||||
scctx->isc_ntxqsets_max); | scctx->isc_ntxqsets_max); | ||||
if (hw->mac.type >= igb_mac_min) { | if (hw->mac.type >= igb_mac_min) { | ||||
scctx->isc_txqsizes[0] = roundup2(scctx->isc_ntxd[0] * sizeof(union e1000_adv_tx_desc), EM_DBA_ALIGN); | scctx->isc_txqsizes[0] = roundup2(scctx->isc_ntxd[0] * sizeof(union e1000_adv_tx_desc), EM_DBA_ALIGN); | ||||
▲ Show 20 Lines • Show All 4,022 Lines • ▼ Show 20 Lines | if (ticks == 0) { | ||||
sc->txd_cmd &= ~E1000_TXD_CMD_IDE; | sc->txd_cmd &= ~E1000_TXD_CMD_IDE; | ||||
/* Don't write 0 into the TIDV register. */ | /* Don't write 0 into the TIDV register. */ | ||||
regval++; | regval++; | ||||
} else | } else | ||||
sc->txd_cmd |= E1000_TXD_CMD_IDE; | sc->txd_cmd |= E1000_TXD_CMD_IDE; | ||||
break; | break; | ||||
} | } | ||||
E1000_WRITE_OFFSET(&sc->hw, info->offset, regval); | E1000_WRITE_OFFSET(&sc->hw, info->offset, regval); | ||||
return (0); | |||||
} | |||||
static int | |||||
em_sysctl_tso_tcp_flags_mask(SYSCTL_HANDLER_ARGS) | |||||
{ | |||||
struct e1000_softc *sc; | |||||
u32 reg, val, shift; | |||||
int error, mask; | |||||
sc = oidp->oid_arg1; | |||||
switch (oidp->oid_arg2) { | |||||
case 0: | |||||
reg = E1000_DTXTCPFLGL; | |||||
shift = 0; | |||||
break; | |||||
case 1: | |||||
reg = E1000_DTXTCPFLGL; | |||||
shift = 16; | |||||
break; | |||||
case 2: | |||||
reg = E1000_DTXTCPFLGH; | |||||
shift = 0; | |||||
break; | |||||
default: | |||||
return (EINVAL); | |||||
break; | |||||
} | |||||
val = E1000_READ_REG(&sc->hw, reg); | |||||
mask = (val >> shift) & 0xfff; | |||||
error = sysctl_handle_int(oidp, &mask, 0, req); | |||||
if (error != 0 || req->newptr == NULL) | |||||
return (error); | |||||
if (mask < 0 || mask > 0xfff) | |||||
return (EINVAL); | |||||
val = (val & ~(0xfff << shift)) | (mask << shift); | |||||
E1000_WRITE_REG(&sc->hw, reg, val); | |||||
return (0); | return (0); | ||||
} | } | ||||
static void | static void | ||||
em_add_int_delay_sysctl(struct e1000_softc *sc, const char *name, | em_add_int_delay_sysctl(struct e1000_softc *sc, const char *name, | ||||
const char *description, struct em_int_delay_info *info, | const char *description, struct em_int_delay_info *info, | ||||
int offset, int value) | int offset, int value) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 178 Lines • Show Last 20 Lines |