Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/vmware/vmxnet3/if_vmx.c
Show First 20 Lines • Show All 392 Lines • ▼ Show 20 Lines | vmxnet3_attach_pre(if_ctx_t ctx) | ||||
* the parameter ethernet<N>.intrMode. | * the parameter ethernet<N>.intrMode. | ||||
*/ | */ | ||||
intr_config = vmxnet3_read_cmd(sc, VMXNET3_CMD_GET_INTRCFG); | intr_config = vmxnet3_read_cmd(sc, VMXNET3_CMD_GET_INTRCFG); | ||||
sc->vmx_intr_mask_mode = (intr_config >> 2) & 0x03; | sc->vmx_intr_mask_mode = (intr_config >> 2) & 0x03; | ||||
/* | /* | ||||
* Configure the softc context to attempt to configure the interrupt | * Configure the softc context to attempt to configure the interrupt | ||||
* mode now indicated by intr_config. iflib will follow the usual | * mode now indicated by intr_config. iflib will follow the usual | ||||
* fallback path MSIX -> MSI -> LEGACY, starting at the configured | * fallback path MSI-X -> MSI -> LEGACY, starting at the configured | ||||
* starting mode. | * starting mode. | ||||
*/ | */ | ||||
switch (intr_config & 0x03) { | switch (intr_config & 0x03) { | ||||
case VMXNET3_IT_AUTO: | case VMXNET3_IT_AUTO: | ||||
case VMXNET3_IT_MSIX: | case VMXNET3_IT_MSIX: | ||||
scctx->isc_msix_bar = pci_msix_table_bar(dev); | scctx->isc_msix_bar = pci_msix_table_bar(dev); | ||||
break; | break; | ||||
case VMXNET3_IT_MSI: | case VMXNET3_IT_MSI: | ||||
▲ Show 20 Lines • Show All 205 Lines • ▼ Show 20 Lines | vmxnet3_alloc_resources(struct vmxnet3_softc *sc) | ||||
return (0); | return (0); | ||||
} | } | ||||
static void | static void | ||||
vmxnet3_free_resources(struct vmxnet3_softc *sc) | vmxnet3_free_resources(struct vmxnet3_softc *sc) | ||||
{ | { | ||||
device_t dev; | device_t dev; | ||||
int rid; | |||||
dev = sc->vmx_dev; | dev = sc->vmx_dev; | ||||
if (sc->vmx_res0 != NULL) { | if (sc->vmx_res0 != NULL) { | ||||
rid = PCIR_BAR(0); | bus_release_resource(dev, SYS_RES_MEMORY, | ||||
bus_release_resource(dev, SYS_RES_MEMORY, rid, sc->vmx_res0); | rman_get_rid(sc->vmx_res0), sc->vmx_res0); | ||||
sc->vmx_res0 = NULL; | sc->vmx_res0 = NULL; | ||||
} | } | ||||
if (sc->vmx_res1 != NULL) { | if (sc->vmx_res1 != NULL) { | ||||
rid = PCIR_BAR(1); | bus_release_resource(dev, SYS_RES_MEMORY, | ||||
bus_release_resource(dev, SYS_RES_MEMORY, rid, sc->vmx_res1); | rman_get_rid(sc->vmx_res1), sc->vmx_res1); | ||||
sc->vmx_res1 = NULL; | sc->vmx_res1 = NULL; | ||||
} | } | ||||
} | } | ||||
static int | static int | ||||
vmxnet3_check_version(struct vmxnet3_softc *sc) | vmxnet3_check_version(struct vmxnet3_softc *sc) | ||||
{ | { | ||||
device_t dev; | device_t dev; | ||||
▲ Show 20 Lines • Show All 425 Lines • ▼ Show 20 Lines | if (sc->vmx_flags & VMXNET3_FLAG_RSS) { | ||||
ds->rss.paddr = sc->vmx_rss_dma.idi_paddr; | ds->rss.paddr = sc->vmx_rss_dma.idi_paddr; | ||||
ds->rss.len = sc->vmx_rss_dma.idi_size; | ds->rss.len = sc->vmx_rss_dma.idi_size; | ||||
} | } | ||||
/* Interrupt control. */ | /* Interrupt control. */ | ||||
ds->automask = sc->vmx_intr_mask_mode == VMXNET3_IMM_AUTO; | ds->automask = sc->vmx_intr_mask_mode == VMXNET3_IMM_AUTO; | ||||
/* | /* | ||||
* Total number of interrupt indexes we are using in the shared | * Total number of interrupt indexes we are using in the shared | ||||
* config data, even though we don't actually allocate MSIX | * config data, even though we don't actually allocate MSI-X | ||||
* resources for the tx queues. Some versions of the device will | * resources for the tx queues. Some versions of the device will | ||||
* fail to initialize successfully if interrupt indexes are used in | * fail to initialize successfully if interrupt indexes are used in | ||||
* the shared config that exceed the number of interrupts configured | * the shared config that exceed the number of interrupts configured | ||||
* here. | * here. | ||||
*/ | */ | ||||
ds->nintr = (scctx->isc_vectors == 1) ? | ds->nintr = (scctx->isc_vectors == 1) ? | ||||
1 : (scctx->isc_nrxqsets + scctx->isc_ntxqsets + 1); | 1 : (scctx->isc_nrxqsets + scctx->isc_ntxqsets + 1); | ||||
ds->evintr = sc->vmx_event_intr_idx; | ds->evintr = sc->vmx_event_intr_idx; | ||||
▲ Show 20 Lines • Show All 1,333 Lines • Show Last 20 Lines |