FreeBSD/sys/dev/ixgbe/if_ixv.c
/*
 * Setup MSIX resources, note that the VF
 * device MUST use MSIX, there is no fallback.
 */
Setup MSIX resources, note that the VF
device MUST use MSIX, there is no fallback.
Setup MSIX resources note that the VF device MUST use MSIX there is no fallback .
static int
ixv_setup_msix(struct adapter *adapter)
{
	device_t dev = adapter->dev;
	int rid, want, msgs;
	msgs = pci_msix_count(dev);
	if (msgs < 2)
		goto out;
	rid = PCIR_BAR(3);
	adapter->msix_mem = bus_alloc_resource_any(dev,
	    SYS_RES_MEMORY, &rid, RF_ACTIVE);
       	if (adapter->msix_mem == NULL) {
		device_printf(adapter->dev,
		    "Unable to map MSIX table \n");
		goto out;
	}
	want = adapter->num_queues + 1;
	if (want > msgs) {
		want = msgs;
		adapter->num_queues = msgs - 1;
	} else
		msgs = want;
	if ((pci_alloc_msix(dev, &msgs) == 0) && (msgs == want)) {
               	device_printf(adapter->dev,
		    "Using MSIX interrupts with %d vectors\n", want);
		return (want);
	}
	pci_release_msi(dev);
out:
       	if (adapter->msix_mem != NULL) {
		bus_release_resource(dev, SYS_RES_MEMORY,
		    rid, adapter->msix_mem);
		adapter->msix_mem = NULL;
	}
	device_printf(adapter->dev,"MSIX config error\n");
	return (ENXIO);
}
static int ixv_setup_msix ( struct adapter * adapter ) { device_t dev = adapter -> dev ; int rid , want , msgs ; msgs = pci_msix_count ( dev ) ; if ( msgs < 2 ) goto out ; rid = PCIR_BAR ( 3 ) ; adapter -> msix_mem = bus_alloc_resource_any ( dev , SYS_RES_MEMORY , & rid , RF_ACTIVE ) ; if ( adapter -> msix_mem == NULL ) { device_printf ( adapter -> dev , " \n " ) ; goto out ; } want = adapter -> num_queues + 1 ; if ( want > msgs ) { want = msgs ; adapter -> num_queues = msgs - 1 ; } else msgs = want ; if ( ( pci_alloc_msix ( dev , & msgs ) == 0 ) && ( msgs == want ) ) { device_printf ( adapter -> dev , " \n " , want ) ; return ( want ) ; } pci_release_msi ( dev ) ; out : if ( adapter -> msix_mem != NULL ) { bus_release_resource ( dev , SYS_RES_MEMORY , rid , adapter -> msix_mem ) ; adapter -> msix_mem = NULL ; } device_printf ( adapter -> dev , " \n " ) ; return ( ENXIO ) ; }
Setup MSIX resources, note that the VF
 device MUST use MSIX, there is no fallback.
Setup MSIX resources note that the VF device MUST use MSIX there is no fallback .
/* Must have at least 2 MSIX vectors */ /*
	** Want vectors for the queues,
	** plus an additional for mailbox.
	*/ /* Release in case alloc was insufficient */