77 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
		
		
			
		
	
	
			77 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
|   | diff --git a/forcedeth.c b/forcedeth.c | ||
|  | index 9c0b1ba..b081d6b 100644 | ||
|  | --- a/forcedeth.c | ||
|  | +++ b/forcedeth.c | ||
|  | @@ -1865,12 +1865,25 @@ static void nv_init_tx(struct net_device *dev) | ||
|  |  	} | ||
|  |  } | ||
|  |   | ||
|  | +#if defined(CONFIG_NETMAP) || defined(CONFIG_NETMAP_MODULE) | ||
|  | +/* we need a few forward declarations */ | ||
|  | +static void nv_drain_rxtx(struct net_device *dev); | ||
|  | +static int nv_init_ring(struct net_device *dev); | ||
|  | +#include <forcedeth_netmap.h> | ||
|  | +#endif | ||
|  | + | ||
|  |  static int nv_init_ring(struct net_device *dev) | ||
|  |  { | ||
|  |  	struct fe_priv *np = netdev_priv(dev); | ||
|  |   | ||
|  |  	nv_init_tx(dev); | ||
|  |  	nv_init_rx(dev); | ||
|  | +#ifdef DEV_NETMAP | ||
|  | +	forcedeth_netmap_tx_init(np); | ||
|  | +	if (forcedeth_netmap_rx_init(np)) | ||
|  | +		return 0; /* success */ | ||
|  | +#endif /* DEV_NETMAP */ | ||
|  | + | ||
|  |   | ||
|  |  	if (!nv_optimized(np)) | ||
|  |  		return nv_alloc_rx(dev); | ||
|  | @@ -3386,6 +3399,11 @@ static irqreturn_t nv_nic_irq_tx(int foo, void *data) | ||
|  |  	int i; | ||
|  |  	unsigned long flags; | ||
|  |   | ||
|  | +#ifdef DEV_NETMAP | ||
|  | +	if (netmap_tx_irq(dev, 0)) | ||
|  | +		return IRQ_HANDLED; | ||
|  | +#endif /* DEV_NETMAP */ | ||
|  | + | ||
|  |  	for (i = 0;; i++) { | ||
|  |  		events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQ_TX_ALL; | ||
|  |  		writel(NVREG_IRQ_TX_ALL, base + NvRegMSIXIrqStatus); | ||
|  | @@ -3497,6 +3515,11 @@ static irqreturn_t nv_nic_irq_rx(int foo, void *data) | ||
|  |  	int i; | ||
|  |  	unsigned long flags; | ||
|  |   | ||
|  | +#ifdef DEV_NETMAP | ||
|  | +	if (netmap_rx_irq(dev, 0, &i)) | ||
|  | +		return IRQ_HANDLED; | ||
|  | +#endif /* DEV_NETMAP */ | ||
|  | + | ||
|  |  	for (i = 0;; i++) { | ||
|  |  		events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQ_RX_ALL; | ||
|  |  		writel(NVREG_IRQ_RX_ALL, base + NvRegMSIXIrqStatus); | ||
|  | @@ -5645,6 +5668,10 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | ||
|  |  		goto out_error; | ||
|  |  	} | ||
|  |   | ||
|  | +#ifdef DEV_NETMAP | ||
|  | +	forcedeth_netmap_attach(np); | ||
|  | +#endif /* DEV_NETMAP */ | ||
|  | + | ||
|  |  	netif_carrier_off(dev); | ||
|  |   | ||
|  |  	dev_info(&pci_dev->dev, "ifname %s, PHY OUI 0x%x @ %d, addr %pM\n", | ||
|  | @@ -5728,6 +5755,10 @@ static void __devexit nv_remove(struct pci_dev *pci_dev) | ||
|  |   | ||
|  |  	unregister_netdev(dev); | ||
|  |   | ||
|  | +#ifdef DEV_NETMAP | ||
|  | +	netmap_detach(dev); | ||
|  | +#endif /* DEV_NETMAP */ | ||
|  | + | ||
|  |  	nv_restore_mac_addr(pci_dev); | ||
|  |   | ||
|  |  	/* restore any phy related changes */ |