Lines 297-308
static void em_if_debug(if_ctx_t);
Link Here
|
297 |
static void em_update_stats_counters(struct e1000_softc *); |
297 |
static void em_update_stats_counters(struct e1000_softc *); |
298 |
static void em_add_hw_stats(struct e1000_softc *); |
298 |
static void em_add_hw_stats(struct e1000_softc *); |
299 |
static int em_if_set_promisc(if_ctx_t, int); |
299 |
static int em_if_set_promisc(if_ctx_t, int); |
300 |
static bool em_if_vlan_filter_capable(struct e1000_softc *); |
300 |
static bool em_if_vlan_filter_capable(if_ctx_t); |
301 |
static bool em_if_vlan_filter_used(struct e1000_softc *); |
301 |
static bool em_if_vlan_filter_used(if_ctx_t); |
302 |
static void em_if_vlan_filter_enable(struct e1000_softc *); |
302 |
static void em_if_vlan_filter_enable(struct e1000_softc *); |
303 |
static void em_if_vlan_filter_disable(struct e1000_softc *); |
303 |
static void em_if_vlan_filter_disable(struct e1000_softc *); |
304 |
static void em_if_vlan_filter_write(struct e1000_softc *); |
304 |
static void em_if_vlan_filter_write(struct e1000_softc *); |
305 |
static void em_setup_vlan_hw_support(struct e1000_softc *); |
305 |
static void em_setup_vlan_hw_support(if_ctx_t ctx); |
306 |
static int em_sysctl_nvm_info(SYSCTL_HANDLER_ARGS); |
306 |
static int em_sysctl_nvm_info(SYSCTL_HANDLER_ARGS); |
307 |
static void em_print_nvm_info(struct e1000_softc *); |
307 |
static void em_print_nvm_info(struct e1000_softc *); |
308 |
static void em_fw_version_locked(if_ctx_t); |
308 |
static void em_fw_version_locked(if_ctx_t); |
Lines 915-930
em_if_attach_pre(if_ctx_t ctx)
Link Here
|
915 |
scctx->isc_rxd_size[0] = sizeof(struct e1000_rx_desc); |
915 |
scctx->isc_rxd_size[0] = sizeof(struct e1000_rx_desc); |
916 |
scctx->isc_tx_csum_flags = CSUM_TCP | CSUM_UDP; |
916 |
scctx->isc_tx_csum_flags = CSUM_TCP | CSUM_UDP; |
917 |
scctx->isc_txrx = &lem_txrx; |
917 |
scctx->isc_txrx = &lem_txrx; |
918 |
scctx->isc_capabilities = scctx->isc_capenable = LEM_CAPS; |
918 |
scctx->isc_capabilities = LEM_CAPS; |
919 |
if (hw->mac.type < e1000_82543) |
919 |
if (hw->mac.type < e1000_82543) |
920 |
scctx->isc_capenable &= ~(IFCAP_HWCSUM|IFCAP_VLAN_HWCSUM); |
920 |
scctx->isc_capabilities &= ~(IFCAP_HWCSUM|IFCAP_VLAN_HWCSUM); |
921 |
/* 82541ER doesn't do HW tagging */ |
921 |
/* 82541ER doesn't do HW tagging */ |
922 |
if (hw->device_id == E1000_DEV_ID_82541ER || hw->device_id == E1000_DEV_ID_82541ER_LOM) |
922 |
if (hw->device_id == E1000_DEV_ID_82541ER || hw->device_id == E1000_DEV_ID_82541ER_LOM) |
923 |
scctx->isc_capenable &= ~IFCAP_VLAN_HWTAGGING; |
923 |
scctx->isc_capabilities &= ~IFCAP_VLAN_HWTAGGING; |
924 |
/* INTx only */ |
924 |
/* INTx only */ |
925 |
scctx->isc_msix_bar = 0; |
925 |
scctx->isc_msix_bar = 0; |
|
|
926 |
scctx->isc_capenable = scctx->isc_capabilities; |
926 |
} |
927 |
} |
927 |
|
928 |
|
|
|
929 |
|
928 |
/* Setup PCI resources */ |
930 |
/* Setup PCI resources */ |
929 |
if (em_allocate_pci_resources(ctx)) { |
931 |
if (em_allocate_pci_resources(ctx)) { |
930 |
device_printf(dev, "Allocation of PCI resources failed\n"); |
932 |
device_printf(dev, "Allocation of PCI resources failed\n"); |
Lines 1356-1362
em_if_init(if_ctx_t ctx)
Link Here
|
1356 |
em_initialize_receive_unit(ctx); |
1358 |
em_initialize_receive_unit(ctx); |
1357 |
|
1359 |
|
1358 |
/* Set up VLAN support and filter */ |
1360 |
/* Set up VLAN support and filter */ |
1359 |
em_setup_vlan_hw_support(sc); |
1361 |
em_setup_vlan_hw_support(ctx); |
1360 |
|
1362 |
|
1361 |
/* Don't lose promiscuous settings */ |
1363 |
/* Don't lose promiscuous settings */ |
1362 |
em_if_set_promisc(ctx, if_getflags(ifp)); |
1364 |
em_if_set_promisc(ctx, if_getflags(ifp)); |
Lines 1683-1689
em_if_set_promisc(if_ctx_t ctx, int flags)
Link Here
|
1683 |
reg_rctl &= ~E1000_RCTL_UPE; |
1685 |
reg_rctl &= ~E1000_RCTL_UPE; |
1684 |
E1000_WRITE_REG(&sc->hw, E1000_RCTL, reg_rctl); |
1686 |
E1000_WRITE_REG(&sc->hw, E1000_RCTL, reg_rctl); |
1685 |
} |
1687 |
} |
1686 |
if (em_if_vlan_filter_used(sc)) |
1688 |
if (em_if_vlan_filter_used(ctx)) |
1687 |
em_if_vlan_filter_enable(sc); |
1689 |
em_if_vlan_filter_enable(sc); |
1688 |
} |
1690 |
} |
1689 |
return (0); |
1691 |
return (0); |
Lines 3242-3253
em_initialize_receive_unit(if_ctx_t ctx)
Link Here
|
3242 |
|
3244 |
|
3243 |
/* Set up L3 and L4 csum Rx descriptor offloads */ |
3245 |
/* Set up L3 and L4 csum Rx descriptor offloads */ |
3244 |
rxcsum = E1000_READ_REG(hw, E1000_RXCSUM); |
3246 |
rxcsum = E1000_READ_REG(hw, E1000_RXCSUM); |
3245 |
if (scctx->isc_capenable & IFCAP_RXCSUM) { |
3247 |
if (if_getcapenable(ifp) & IFCAP_RXCSUM) { |
3246 |
rxcsum |= E1000_RXCSUM_TUOFL | E1000_RXCSUM_IPOFL; |
3248 |
rxcsum |= E1000_RXCSUM_TUOFL | E1000_RXCSUM_IPOFL; |
3247 |
if (hw->mac.type > e1000_82575) |
3249 |
if (hw->mac.type > e1000_82575) |
3248 |
rxcsum |= E1000_RXCSUM_CRCOFL; |
3250 |
rxcsum |= E1000_RXCSUM_CRCOFL; |
3249 |
else if (hw->mac.type < em_mac_min && |
3251 |
else if (hw->mac.type < em_mac_min && |
3250 |
scctx->isc_capenable & IFCAP_HWCSUM_IPV6) |
3252 |
if_getcapenable(ifp) & IFCAP_HWCSUM_IPV6) |
3251 |
rxcsum |= E1000_RXCSUM_IPV6OFL; |
3253 |
rxcsum |= E1000_RXCSUM_IPV6OFL; |
3252 |
} else { |
3254 |
} else { |
3253 |
rxcsum &= ~(E1000_RXCSUM_IPOFL | E1000_RXCSUM_TUOFL); |
3255 |
rxcsum &= ~(E1000_RXCSUM_IPOFL | E1000_RXCSUM_TUOFL); |
Lines 3441-3451
em_if_vlan_unregister(if_ctx_t ctx, u16 vtag)
Link Here
|
3441 |
} |
3443 |
} |
3442 |
|
3444 |
|
3443 |
static bool |
3445 |
static bool |
3444 |
em_if_vlan_filter_capable(struct e1000_softc *sc) |
3446 |
em_if_vlan_filter_capable(if_ctx_t ctx) |
3445 |
{ |
3447 |
{ |
3446 |
if_softc_ctx_t scctx = sc->shared; |
3448 |
if_t ifp = iflib_get_ifp(ctx); |
3447 |
|
3449 |
|
3448 |
if ((scctx->isc_capenable & IFCAP_VLAN_HWFILTER) && |
3450 |
if ((if_getcapenable(ifp) & IFCAP_VLAN_HWFILTER) && |
3449 |
!em_disable_crc_stripping) |
3451 |
!em_disable_crc_stripping) |
3450 |
return (true); |
3452 |
return (true); |
3451 |
|
3453 |
|
Lines 3453-3461
em_if_vlan_filter_capable(struct e1000_softc *sc)
Link Here
|
3453 |
} |
3455 |
} |
3454 |
|
3456 |
|
3455 |
static bool |
3457 |
static bool |
3456 |
em_if_vlan_filter_used(struct e1000_softc *sc) |
3458 |
em_if_vlan_filter_used(if_ctx_t ctx) |
3457 |
{ |
3459 |
{ |
3458 |
if (!em_if_vlan_filter_capable(sc)) |
3460 |
struct e1000_softc *sc = iflib_get_softc(ctx); |
|
|
3461 |
|
3462 |
if (!em_if_vlan_filter_capable(ctx)) |
3459 |
return (false); |
3463 |
return (false); |
3460 |
|
3464 |
|
3461 |
for (int i = 0; i < EM_VFTA_SIZE; i++) |
3465 |
for (int i = 0; i < EM_VFTA_SIZE; i++) |
Lines 3515-3524
em_if_vlan_filter_write(struct e1000_softc *sc)
Link Here
|
3515 |
} |
3519 |
} |
3516 |
|
3520 |
|
3517 |
static void |
3521 |
static void |
3518 |
em_setup_vlan_hw_support(struct e1000_softc *sc) |
3522 |
em_setup_vlan_hw_support(if_ctx_t ctx) |
3519 |
{ |
3523 |
{ |
3520 |
if_softc_ctx_t scctx = sc->shared; |
3524 |
struct e1000_softc *sc = iflib_get_softc(ctx); |
3521 |
struct e1000_hw *hw = &sc->hw; |
3525 |
struct e1000_hw *hw = &sc->hw; |
|
|
3526 |
struct ifnet *ifp = iflib_get_ifp(ctx); |
3522 |
u32 reg; |
3527 |
u32 reg; |
3523 |
|
3528 |
|
3524 |
/* XXXKB: Return early if we are a VF until VF decap and filter management |
3529 |
/* XXXKB: Return early if we are a VF until VF decap and filter management |
Lines 3527-3533
em_setup_vlan_hw_support(struct e1000_softc *sc)
Link Here
|
3527 |
if (sc->vf_ifp) |
3532 |
if (sc->vf_ifp) |
3528 |
return; |
3533 |
return; |
3529 |
|
3534 |
|
3530 |
if (scctx->isc_capenable & IFCAP_VLAN_HWTAGGING && |
3535 |
if (if_getcapenable(ifp) & IFCAP_VLAN_HWTAGGING && |
3531 |
!em_disable_crc_stripping) { |
3536 |
!em_disable_crc_stripping) { |
3532 |
reg = E1000_READ_REG(hw, E1000_CTRL); |
3537 |
reg = E1000_READ_REG(hw, E1000_CTRL); |
3533 |
reg |= E1000_CTRL_VME; |
3538 |
reg |= E1000_CTRL_VME; |
Lines 3539-3545
em_setup_vlan_hw_support(struct e1000_softc *sc)
Link Here
|
3539 |
} |
3544 |
} |
3540 |
|
3545 |
|
3541 |
/* If we aren't doing HW filtering, we're done */ |
3546 |
/* If we aren't doing HW filtering, we're done */ |
3542 |
if (!em_if_vlan_filter_capable(sc)) { |
3547 |
if (!em_if_vlan_filter_capable(ctx)) { |
3543 |
em_if_vlan_filter_disable(sc); |
3548 |
em_if_vlan_filter_disable(sc); |
3544 |
return; |
3549 |
return; |
3545 |
} |
3550 |
} |