View | Details | Raw Unified | Return to bug 260068
Collapse All | Expand All

(-)b/sys/dev/e1000/em_txrx.c (-1 / +3 lines)
Lines 665-670 em_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) Link Here
665
	if_softc_ctx_t scctx = sc->shared;
665
	if_softc_ctx_t scctx = sc->shared;
666
	struct em_rx_queue *que = &sc->rx_queues[ri->iri_qsidx];
666
	struct em_rx_queue *que = &sc->rx_queues[ri->iri_qsidx];
667
	struct rx_ring *rxr = &que->rxr;
667
	struct rx_ring *rxr = &que->rxr;
668
	struct ifnet *ifp = iflib_get_ifp(sc->ctx);
668
	union e1000_rx_desc_extended *rxd;
669
	union e1000_rx_desc_extended *rxd;
669
670
670
	u16 len;
671
	u16 len;
Lines 706-712 em_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) Link Here
706
		i++;
707
		i++;
707
	} while (!eop);
708
	} while (!eop);
708
709
709
	em_receive_checksum(staterr, staterr >> 24, ri);
710
	if (if_getcapenable(ifp) & IFCAP_RXCSUM)
711
		em_receive_checksum(staterr, staterr >> 24, ri);
710
712
711
	if (staterr & E1000_RXD_STAT_VP) {
713
	if (staterr & E1000_RXD_STAT_VP) {
712
		vtag = le16toh(rxd->wb.upper.vlan);
714
		vtag = le16toh(rxd->wb.upper.vlan);
(-)b/sys/dev/e1000/if_em.c (-19 / +24 lines)
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
	}
(-)b/sys/dev/e1000/if_em.h (-1 lines)
Lines 439-445 struct em_rx_queue { Link Here
439
439
440
/* Our softc structure */
440
/* Our softc structure */
441
struct e1000_softc {
441
struct e1000_softc {
442
	struct ifnet 		*ifp;
443
	struct e1000_hw		hw;
442
	struct e1000_hw		hw;
444
443
445
	if_softc_ctx_t		shared;
444
	if_softc_ctx_t		shared;
(-)b/sys/dev/e1000/igb_txrx.c (-11 / +12 lines)
Lines 434-439 igb_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) Link Here
434
	if_softc_ctx_t scctx = sc->shared;
434
	if_softc_ctx_t scctx = sc->shared;
435
	struct em_rx_queue *que = &sc->rx_queues[ri->iri_qsidx];
435
	struct em_rx_queue *que = &sc->rx_queues[ri->iri_qsidx];
436
	struct rx_ring *rxr = &que->rxr;
436
	struct rx_ring *rxr = &que->rxr;
437
	struct ifnet *ifp = iflib_get_ifp(sc->ctx);
437
	union e1000_adv_rx_desc *rxd;
438
	union e1000_adv_rx_desc *rxd;
438
439
439
	uint16_t pkt_info, len, vtag;
440
	uint16_t pkt_info, len, vtag;
Lines 460-471 igb_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) Link Here
460
		rxd->wb.upper.status_error = 0;
461
		rxd->wb.upper.status_error = 0;
461
		eop = ((staterr & E1000_RXD_STAT_EOP) == E1000_RXD_STAT_EOP);
462
		eop = ((staterr & E1000_RXD_STAT_EOP) == E1000_RXD_STAT_EOP);
462
463
463
		if (((sc->hw.mac.type == e1000_i350) ||
464
		if ((staterr & E1000_RXD_STAT_VP) != 0) {
464
		    (sc->hw.mac.type == e1000_i354)) &&
465
			if (((sc->hw.mac.type == e1000_i350) ||
465
		    (staterr & E1000_RXDEXT_STATERR_LB))
466
			    (sc->hw.mac.type == e1000_i354)) &&
466
			vtag = be16toh(rxd->wb.upper.vlan);
467
			    (staterr & E1000_RXDEXT_STATERR_LB))
467
		else
468
				vtag = be16toh(rxd->wb.upper.vlan);
468
			vtag = le16toh(rxd->wb.upper.vlan);
469
			else
470
				vtag = le16toh(rxd->wb.upper.vlan);
471
		}
469
472
470
		/* Make sure bad packets are discarded */
473
		/* Make sure bad packets are discarded */
471
		if (eop && ((staterr & E1000_RXDEXT_ERR_FRAME_ERR_MASK) != 0)) {
474
		if (eop && ((staterr & E1000_RXDEXT_ERR_FRAME_ERR_MASK) != 0)) {
Lines 492-505 igb_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) Link Here
492
495
493
	rxr->rx_packets++;
496
	rxr->rx_packets++;
494
497
495
	if ((scctx->isc_capenable & IFCAP_RXCSUM) != 0)
498
	if ((if_getcapenable(ifp) & IFCAP_RXCSUM) != 0)
496
		igb_rx_checksum(staterr, ri, ptype);
499
		igb_rx_checksum(staterr, ri, ptype);
497
500
498
	if ((scctx->isc_capenable & IFCAP_VLAN_HWTAGGING) != 0 &&
501
	ri->iri_vtag = vtag;
499
	    (staterr & E1000_RXD_STAT_VP) != 0) {
502
	if (vtag)
500
		ri->iri_vtag = vtag;
501
		ri->iri_flags |= M_VLANTAG;
503
		ri->iri_flags |= M_VLANTAG;
502
	}
503
504
504
	ri->iri_flowid =
505
	ri->iri_flowid =
505
		le32toh(rxd->wb.lower.hi_dword.rss);
506
		le32toh(rxd->wb.lower.hi_dword.rss);

Return to bug 260068