0001-Use-MSI-if-device-supports-it.-RT8168E-supports-MSI.patch

Anonymous, 03/18/2012 10:02 PM

Download (2.54 KB)

View differences:

sys/dev/netif/re/if_re.c
383 383

  
384 384
static int	re_rx_desc_count = RE_RX_DESC_CNT_DEF;
385 385
static int	re_tx_desc_count = RE_TX_DESC_CNT_DEF;
386
static int	re_msi_enable = 1;
386 387

  
387 388
TUNABLE_INT("hw.re.rx_desc_count", &re_rx_desc_count);
388 389
TUNABLE_INT("hw.re.tx_desc_count", &re_tx_desc_count);
390
TUNABLE_INT("hw.re.msi.enable", &re_msi_enable);
389 391

  
390 392
#define EE_SET(x)	\
391 393
	CSR_WRITE_1(sc, RE_EECMD, CSR_READ_1(sc, RE_EECMD) | (x))
......
1302 1304
	struct ifnet *ifp;
1303 1305
	uint8_t eaddr[ETHER_ADDR_LEN];
1304 1306
	int error = 0, rid, qlen;
1307
	u_int irq_flags;
1305 1308

  
1306 1309
	callout_init(&sc->re_timer);
1307 1310
	sc->re_dev = dev;
......
1432 1435
	sc->re_bhandle = rman_get_bushandle(sc->re_res);
1433 1436

  
1434 1437
	/* Allocate interrupt */
1435
	rid = 0;
1436
	sc->re_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
1437
					    RF_SHAREABLE | RF_ACTIVE);
1438

  
1438
	sc->re_irq_type = pci_alloc_1intr(dev, re_msi_enable,
1439
					   &sc->re_irq_rid, &irq_flags);
1440
	
1441
	sc->re_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->re_irq_rid,
1442
					    irq_flags);
1439 1443
	if (sc->re_irq == NULL) {
1440 1444
		device_printf(dev, "couldn't map interrupt\n");
1441 1445
		error = ENXIO;
......
1655 1659
		sysctl_ctx_free(&sc->re_sysctl_ctx);
1656 1660

  
1657 1661
	if (sc->re_irq)
1658
		bus_release_resource(dev, SYS_RES_IRQ, 0, sc->re_irq);
1662
		bus_release_resource(dev, SYS_RES_IRQ, sc->re_irq_rid,
1663
				     sc->re_irq);
1664

  
1665
	if (sc->re_irq_type == PCI_INTR_TYPE_MSI)
1666
		pci_release_msi(dev);
1667

  
1659 1668
	if (sc->re_res) {
1660 1669
		bus_release_resource(dev, SYS_RES_IOPORT, RE_PCI_LOIO,
1661 1670
				     sc->re_res);
sys/dev/netif/re/if_revar.h
184 184
	int			rxcycles;
185 185
	int			re_rxbuf_size;
186 186
	int			(*re_newbuf)(struct re_softc *, int, int);
187
	int			re_irq_type;      	
188
	int			re_irq_rid;      	
187 189

  
188 190
	uint32_t		re_flags;	/* see RE_F_ */
189 191
	int			re_if_flags;	/* saved ifnet.if_flags */
190
-