FreeBSD/sys/dev/ixl/ixl_pf_main.c
/*
 * Allocate interrupt resources from bus and associate an interrupt handler
 * to those for the VSI's queues.
 */
Allocate interrupt resources from bus and associate an interrupt handler
to those for the VSI's queues.
Allocate interrupt resources from bus and associate an interrupt handler to those for the VSI ' s queues .
int
ixl_setup_queue_msix(struct ixl_vsi *vsi)
{
	device_t	dev = vsi->dev;
	struct 		ixl_queue *que = vsi->queues;
	struct		tx_ring	 *txr;
	int 		error, rid, vector = 1;
	for (int i = 0; i < vsi->num_queues; i++, vector++, que++) {
		int cpu_id = i;
		rid = vector + 1;
		txr = &que->txr;
		que->res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
		    RF_SHAREABLE | RF_ACTIVE);
		if (!que->res) {
			device_printf(dev, "bus_alloc_resource_any() for"
			    " Queue %d interrupt failed [rid=%d]\n",
			    que->me, rid);
			return (ENXIO);
		}
		error = bus_setup_intr(dev, que->res,
		    INTR_TYPE_NET | INTR_MPSAFE, NULL,
		    ixl_msix_que, que, &que->tag);
		if (error) {
			device_printf(dev, "bus_setup_intr() for Queue %d"
			    " interrupt handler failed, error %d\n",
			    que->me, error);
			return (error);
		}
		error = bus_describe_intr(dev, que->res, que->tag, "q%d", i);
		if (error) {
			device_printf(dev, "bus_describe_intr() for Queue %d"
			    " interrupt name failed, error %d\n",
			    que->me, error);
		}
#ifdef RSS
		cpu_id = rss_getcpu(i % rss_getnumbuckets());
#endif
		error = bus_bind_intr(dev, que->res, cpu_id);
		if (error) {
			device_printf(dev, "bus_bind_intr() for Queue %d"
			    " to CPU %d failed, error %d\n",
			    que->me, cpu_id, error);
		}
		que->msix = vector;
	}
	return (0);
}
int ixl_setup_queue_msix ( struct ixl_vsi * vsi ) { device_t dev = vsi -> dev ; struct ixl_queue * que = vsi -> queues ; struct tx_ring * txr ; int error , rid , vector = 1 ; for ( int i = 0 ; i < vsi -> num_queues ; i ++ , vector ++ , que ++ ) { int cpu_id = i ; rid = vector + 1 ; txr = & que -> txr ; que -> res = bus_alloc_resource_any ( dev , SYS_RES_IRQ , & rid , RF_SHAREABLE | RF_ACTIVE ) ; if ( ! que -> res ) { device_printf ( dev , " " " \n " , que -> me , rid ) ; return ( ENXIO ) ; } error = bus_setup_intr ( dev , que -> res , INTR_TYPE_NET | INTR_MPSAFE , NULL , ixl_msix_que , que , & que -> tag ) ; if ( error ) { device_printf ( dev , " " " \n " , que -> me , error ) ; return ( error ) ; } error = bus_describe_intr ( dev , que -> res , que -> tag , " " , i ) ; if ( error ) { device_printf ( dev , " " " \n " , que -> me , error ) ; } #ifdef RSS cpu_id = rss_getcpu ( i % rss_getnumbuckets ( ) ) ; #endif error = bus_bind_intr ( dev , que -> res , cpu_id ) ; if ( error ) { device_printf ( dev , " " " \n " , que -> me , cpu_id , error ) ; } que -> msix = vector ; } return ( 0 ) ; }
Allocate interrupt resources from bus and associate an interrupt handler
 to those for the VSI's queues.
Allocate interrupt resources from bus and associate an interrupt handler to those for the VSI ' s queues .
/* Queue interrupt vector numbers start at 1 (adminq intr is 0) */ /* Set the handler function */ /* Bind the vector to a CPU */