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

Collapse All | Expand All

(-)sys/dev/e1000/if_igb.c (-12 / +55 lines)
Lines 1231-1236 Link Here
1231
			ifp->if_capenable ^= IFCAP_LRO;
1231
			ifp->if_capenable ^= IFCAP_LRO;
1232
			reinit = 1;
1232
			reinit = 1;
1233
		}
1233
		}
1234
		if (mask & IFCAP_WOL) {
1235
			if (mask & IFCAP_WOL_MCAST)
1236
				ifp->if_capenable ^= IFCAP_WOL_MCAST;
1237
			if (mask & IFCAP_WOL_UCAST)
1238
				ifp->if_capenable ^= IFCAP_WOL_UCAST;
1239
			if (mask & IFCAP_WOL_MAGIC)
1240
				ifp->if_capenable ^= IFCAP_WOL_MAGIC;
1241
		}
1234
		if (reinit && (ifp->if_drv_flags & IFF_DRV_RUNNING))
1242
		if (reinit && (ifp->if_drv_flags & IFF_DRV_RUNNING))
1235
			igb_init(adapter);
1243
			igb_init(adapter);
1236
		VLAN_CAPABILITIES(ifp);
1244
		VLAN_CAPABILITIES(ifp);
Lines 3196-3201 Link Here
3196
#endif
3204
#endif
3197
	ifp->if_capabilities |= IFCAP_TSO;
3205
	ifp->if_capabilities |= IFCAP_TSO;
3198
	ifp->if_capabilities |= IFCAP_JUMBO_MTU;
3206
	ifp->if_capabilities |= IFCAP_JUMBO_MTU;
3207
	ifp->if_capabilities |= IFCAP_WOL;
3199
	ifp->if_capenable = ifp->if_capabilities;
3208
	ifp->if_capenable = ifp->if_capabilities;
3200
3209
3201
	/* Don't enable LRO by default */
3210
	/* Don't enable LRO by default */
Lines 3206-3211 Link Here
3206
#endif
3215
#endif
3207
3216
3208
	/*
3217
	/*
3218
	 * Enable only WOL MAGIC by default
3219
	 * if WOL is enabled by EEPROM.
3220
	 */
3221
	if( adapter->wol ) {
3222
		ifp->if_capenable |= IFCAP_WOL_MAGIC;
3223
	}
3224
3225
	/*
3209
	 * Tell the upper layer(s) we
3226
	 * Tell the upper layer(s) we
3210
	 * support full VLAN capability.
3227
	 * support full VLAN capability.
3211
	 */
3228
	 */
Lines 5498-5518 Link Here
5498
static void
5515
static void
5499
igb_enable_wakeup(device_t dev)
5516
igb_enable_wakeup(device_t dev)
5500
{
5517
{
5518
	struct	adapter *adapter = device_get_softc(dev);
5519
	struct	ifnet  *ifp = adapter->ifp;
5520
	u32	wuc;
5501
	u16     cap, status;
5521
	u16     cap, status;
5502
	u8      id;
5522
	u8      id;
5503
5523
5504
	/* First find the capabilities pointer*/
5524
	adapter->wol = E1000_READ_REG(&adapter->hw, E1000_WUFC);
5505
	cap = pci_read_config(dev, PCIR_CAP_PTR, 2);
5525
	if (ifp->if_capenable & IFCAP_WOL_MAGIC) {
5506
	/* Read the PM Capabilities */
5526
		adapter->wol |=  E1000_WUFC_MAG; 
5507
	id = pci_read_config(dev, cap, 1);
5527
	} else {
5508
	if (id != PCIY_PMG)     /* Something wrong */
5528
		adapter->wol &= ~E1000_WUFC_MAG; 
5509
		return;
5529
	}
5510
	/* OK, we have the power capabilities, so
5530
	if (ifp->if_capenable & IFCAP_WOL_MCAST) {
5511
	   now get the status register */
5531
		adapter->wol |=  E1000_WUFC_MC; 
5512
	cap += PCIR_POWER_STATUS;
5532
	} else {
5513
	status = pci_read_config(dev, cap, 2);
5533
		adapter->wol &= ~E1000_WUFC_MC; 
5514
	status |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE;
5534
	}
5515
	pci_write_config(dev, cap, status, 2);
5535
	if (ifp->if_capenable & IFCAP_WOL_UCAST) {
5536
		adapter->wol |=  E1000_WUFC_EX; 
5537
	} else {
5538
		adapter->wol &= ~E1000_WUFC_EX; 
5539
	}
5540
	if(adapter->wol &
5541
	   ( E1000_WUFC_EX | E1000_WUFC_MC | E1000_WUFC_MAG) ) {
5542
		wuc = E1000_READ_REG(&adapter->hw, E1000_WUC);
5543
		wuc |= (E1000_WUC_PME_EN | E1000_WUC_APME) ;
5544
		E1000_WRITE_REG(&adapter->hw, E1000_WUC, wuc);
5545
		E1000_WRITE_REG(&adapter->hw, E1000_WUFC, adapter->wol);
5546
		/* First find the capabilities pointer*/
5547
		cap = pci_read_config(dev, PCIR_CAP_PTR, 2);
5548
		/* Read the PM Capabilities */
5549
		id = pci_read_config(dev, cap, 1);
5550
		if (id != PCIY_PMG)     /* Something wrong */
5551
			return;
5552
		/* OK, we have the power capabilities, so
5553
	   	now get the status register */
5554
		cap += PCIR_POWER_STATUS;
5555
		status = pci_read_config(dev, cap, 2);
5556
		status |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE;
5557
		pci_write_config(dev, cap, status, 2);
5558
	}
5516
	return;
5559
	return;
5517
}
5560
}
5518
5561

Return to bug 208343