Date: Fri, 10 Jun 2016 13:15:09 GMT From: vincenzo@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r305045 - soc2016/vincenzo/head/sys/dev/netmap Message-ID: <201606101315.u5ADF9iU011229@socsvn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: vincenzo Date: Fri Jun 10 13:15:09 2016 New Revision: 305045 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305045 Log: freebsd: ptnet_irqs_init: check for MSI-X capability Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c ============================================================================== --- soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Fri Jun 10 13:14:57 2016 (r305044) +++ soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Fri Jun 10 13:15:09 2016 (r305045) @@ -475,6 +475,11 @@ num_tx_rings = bus_read_4(sc->iomem, PTNET_IO_NUM_TX_RINGS); + if (pci_find_cap(dev, PCIY_MSIX, NULL) != 0) { + device_printf(dev, "Could not find MSI-X capability\n"); + return (ENXIO); + } + sc->msix_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); if (sc->msix_mem == NULL) { @@ -495,12 +500,8 @@ for (i = 0; i < nvecs; i++) { struct ptnet_queue *pq = sc->queues + i; - void (*handler)(void *) = ptnet_tx_intr; - int rid = i + i; - if (i > num_tx_rings) { - handler = ptnet_rx_intr; - } + rid = i + i; pq->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE); if (pq->irq == NULL) { @@ -509,7 +510,15 @@ err = ENOSPC; goto err_path; } + } + for (i = 0; i < nvecs; i++) { + struct ptnet_queue *pq = sc->queues + i; + void (*handler)(void *) = ptnet_tx_intr; + + if (i > num_tx_rings) { + handler = ptnet_rx_intr; + } err = bus_setup_intr(dev, pq->irq, INTR_TYPE_NET | INTR_MPSAFE, NULL /* intr_filter */, handler, pq, &pq->cookie);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201606101315.u5ADF9iU011229>