View | Details | Raw Unified | Return to bug 230996 | Differences between
and this patch

Collapse All | Expand All

(-)b/sys/dev/e1000/if_em.c (-49 / +51 lines)
Lines 1340-1363 em_if_init(if_ctx_t ctx) Link Here
1340
	adapter->rx_mbuf_sz = iflib_get_rx_mbuf_sz(ctx);
1340
	adapter->rx_mbuf_sz = iflib_get_rx_mbuf_sz(ctx);
1341
	em_initialize_receive_unit(ctx);
1341
	em_initialize_receive_unit(ctx);
1342
1342
1343
	/* Use real VLAN Filter support? */
1344
	if (if_getcapenable(ifp) & IFCAP_VLAN_HWTAGGING) {
1345
		if (if_getcapenable(ifp) & IFCAP_VLAN_HWFILTER)
1346
			/* Use real VLAN Filter support */
1347
			em_setup_vlan_hw_support(adapter);
1348
		else {
1349
			u32 ctrl;
1350
			ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL);
1351
			ctrl |= E1000_CTRL_VME;
1352
			E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl);
1353
		}
1354
	} else {
1355
		u32 ctrl;
1356
		ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL);
1357
		ctrl &= ~E1000_CTRL_VME;
1358
		E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl);
1359
	}
1360
1361
	/* Don't lose promiscuous settings */
1343
	/* Don't lose promiscuous settings */
1362
	em_if_set_promisc(ctx, if_getflags(ifp));
1344
	em_if_set_promisc(ctx, if_getflags(ifp));
1363
	e1000_clear_hw_cntrs_base_generic(&adapter->hw);
1345
	e1000_clear_hw_cntrs_base_generic(&adapter->hw);
Lines 3173-3178 em_initialize_receive_unit(if_ctx_t ctx) Link Here
3173
	struct em_rx_queue *que;
3155
	struct em_rx_queue *que;
3174
	int i;
3156
	int i;
3175
	u32 rctl, rxcsum, rfctl;
3157
	u32 rctl, rxcsum, rfctl;
3158
	u32 psize = scctx->isc_max_frame_size; 	/* maximum packet len */
3176
3159
3177
	INIT_DEBUGOUT("em_initialize_receive_units: begin");
3160
	INIT_DEBUGOUT("em_initialize_receive_units: begin");
3178
3161
Lines 3312-3336 em_initialize_receive_unit(if_ctx_t ctx) Link Here
3312
			E1000_WRITE_REG(hw, E1000_RXDCTL(i), rxdctl);
3295
			E1000_WRITE_REG(hw, E1000_RXDCTL(i), rxdctl);
3313
		}
3296
		}
3314
	} else if (hw->mac.type >= igb_mac_min) {
3297
	} else if (hw->mac.type >= igb_mac_min) {
3315
		u32 psize, srrctl = 0;
3298
		u32 srrctl = 0;
3316
3299
3317
		if (if_getmtu(ifp) > ETHERMTU) {
3300
		/*
3318
			/* Set maximum packet len */
3301
		 * XXX incorrect at least i350 ,i210 and 82576
3319
			if (adapter->rx_mbuf_sz <= 4096) {
3302
		 * E1000_RCTL_BSEX bit is not defined
3320
				srrctl |= 4096 >> E1000_SRRCTL_BSIZEPKT_SHIFT;
3303
		 */
3321
				rctl |= E1000_RCTL_SZ_4096 | E1000_RCTL_BSEX;
3304
		rctl &= ~0x0203000; /* Clear BSIZE bit 17:16 and BSEX bit 25 */
3322
			} else if (adapter->rx_mbuf_sz > 4096) {
3305
		if (psize <= 2048) {
3323
				srrctl |= 8192 >> E1000_SRRCTL_BSIZEPKT_SHIFT;
3306
			rctl |= E1000_RCTL_SZ_2048;
3307
		} else {
3308
			srrctl |= roundup2(psize, 1024) >> E1000_SRRCTL_BSIZEPKT_SHIFT;
3309
			if (psize <= 4096) {
3310
 				rctl |= E1000_RCTL_SZ_4096 | E1000_RCTL_BSEX;
3311
			} else if (psize <= 8192) {
3324
				rctl |= E1000_RCTL_SZ_8192 | E1000_RCTL_BSEX;
3312
				rctl |= E1000_RCTL_SZ_8192 | E1000_RCTL_BSEX;
3313
			} else {
3314
				rctl |= E1000_RCTL_SZ_16384 | E1000_RCTL_BSEX;
3325
			}
3315
			}
3326
			psize = scctx->isc_max_frame_size;
3327
			/* are we on a vlan? */
3328
			if (ifp->if_vlantrunk != NULL)
3329
				psize += VLAN_TAG_SIZE;
3330
			E1000_WRITE_REG(hw, E1000_RLPML, psize);
3331
		} else {
3332
			srrctl |= 2048 >> E1000_SRRCTL_BSIZEPKT_SHIFT;
3333
			rctl |= E1000_RCTL_SZ_2048;
3334
		}
3316
		}
3335
3317
3336
		/*
3318
		/*
Lines 3367-3373 em_initialize_receive_unit(if_ctx_t ctx) Link Here
3367
			/* Enable this Queue */
3349
			/* Enable this Queue */
3368
			rxdctl = E1000_READ_REG(hw, E1000_RXDCTL(i));
3350
			rxdctl = E1000_READ_REG(hw, E1000_RXDCTL(i));
3369
			rxdctl |= E1000_RXDCTL_QUEUE_ENABLE;
3351
			rxdctl |= E1000_RXDCTL_QUEUE_ENABLE;
3370
			rxdctl &= 0xFFF00000;
3352
			rxdctl &= 0xFFE00000; /* clear bit 20:0 */
3371
			rxdctl |= IGB_RX_PTHRESH;
3353
			rxdctl |= IGB_RX_PTHRESH;
3372
			rxdctl |= IGB_RX_HTHRESH << 8;
3354
			rxdctl |= IGB_RX_HTHRESH << 8;
3373
			rxdctl |= IGB_RX_WTHRESH << 16;
3355
			rxdctl |= IGB_RX_WTHRESH << 16;
Lines 3383-3388 em_initialize_receive_unit(if_ctx_t ctx) Link Here
3383
	/* Make sure VLAN Filters are off */
3365
	/* Make sure VLAN Filters are off */
3384
	rctl &= ~E1000_RCTL_VFE;
3366
	rctl &= ~E1000_RCTL_VFE;
3385
3367
3368
	/* Use real VLAN Filter support? */
3369
	if ( adapter->num_vlans != 0 &&
3370
	     (if_getcapenable(ifp) & IFCAP_VLAN_HWTAGGING) !=0 ) {
3371
		if (if_getcapenable(ifp) & IFCAP_VLAN_HWFILTER) {
3372
			/* Use real VLAN Filter support */
3373
			em_setup_vlan_hw_support(adapter);
3374
			/* Make sure VLAN Filters are on */
3375
			rctl &= ~E1000_RCTL_CFIEN;
3376
			rctl |= E1000_RCTL_VFE;
3377
		} else {
3378
			psize += VLAN_TAG_SIZE;	/* Adjust maximum length */
3379
		}
3380
		u32 ctrl;
3381
		ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL);
3382
		ctrl |= E1000_CTRL_VME;
3383
		E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl);
3384
	}
3385
3386
	if (hw->mac.type < igb_mac_min) {
3386
	if (hw->mac.type < igb_mac_min) {
3387
		if (adapter->rx_mbuf_sz == MCLBYTES)
3387
		if (adapter->rx_mbuf_sz == MCLBYTES)
3388
			rctl |= E1000_RCTL_SZ_2048;
3388
			rctl |= E1000_RCTL_SZ_2048;
Lines 3429-3435 static void Link Here
3429
em_setup_vlan_hw_support(struct adapter *adapter)
3429
em_setup_vlan_hw_support(struct adapter *adapter)
3430
{
3430
{
3431
	struct e1000_hw *hw = &adapter->hw;
3431
	struct e1000_hw *hw = &adapter->hw;
3432
	u32 reg;
3433
3432
3434
	/*
3433
	/*
3435
	 * We get here thru init_locked, meaning
3434
	 * We get here thru init_locked, meaning
Lines 3440-3463 em_setup_vlan_hw_support(struct adapter *adapter) Link Here
3440
	if (adapter->num_vlans == 0)
3439
	if (adapter->num_vlans == 0)
3441
		return;
3440
		return;
3442
3441
3442
	/* Update the frame size */
3443
	if (adapter->vf_ifp)
3444
		e1000_rlpml_set_vf(hw,
3445
		    hw->mac.max_frame_size + VLAN_TAG_SIZE);
3446
	else if (hw->mac.type >= igb_mac_min)
3447
		E1000_WRITE_REG(hw, E1000_RLPML,
3448
		    hw->mac.max_frame_size + VLAN_TAG_SIZE);
3449
3443
	/*
3450
	/*
3444
	 * A soft reset zero's out the VFTA, so
3451
	 * A soft reset zero's out the VFTA, so
3445
	 * we need to repopulate it now.
3452
	 * we need to repopulate it now.
3446
	 */
3453
	 */
3447
	for (int i = 0; i < EM_VFTA_SIZE; i++)
3454
	for (int i = 0; i < EM_VFTA_SIZE; i++)
3448
		if (adapter->shadow_vfta[i] != 0)
3455
		if (adapter->shadow_vfta[i] != 0) {
3449
			E1000_WRITE_REG_ARRAY(hw, E1000_VFTA,
3456
			if (adapter->vf_ifp)
3450
			    i, adapter->shadow_vfta[i]);
3457
				e1000_vfta_set_vf(hw,
3451
3458
				    adapter->shadow_vfta[i], TRUE);
3452
	reg = E1000_READ_REG(hw, E1000_CTRL);
3459
			else
3453
	reg |= E1000_CTRL_VME;
3460
				e1000_write_vfta(hw,
3454
	E1000_WRITE_REG(hw, E1000_CTRL, reg);
3461
				    i, adapter->shadow_vfta[i]);
3455
3462
		}
3456
	/* Enable the Filter Table */
3457
	reg = E1000_READ_REG(hw, E1000_RCTL);
3458
	reg &= ~E1000_RCTL_CFIEN;
3459
	reg |= E1000_RCTL_VFE;
3460
	E1000_WRITE_REG(hw, E1000_RCTL, reg);
3461
}
3463
}
3462
3464
3463
static void
3465
static void

Return to bug 230996