Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/vmware/vmxnet3/if_vmx.c
Show First 20 Lines • Show All 375 Lines • ▼ Show 20 Lines | vmxnet3_attach_pre(if_ctx_t ctx) | ||||
scctx->isc_nrxd[0] = scctx->isc_nrxd[1] + scctx->isc_nrxd[2]; | scctx->isc_nrxd[0] = scctx->isc_nrxd[1] + scctx->isc_nrxd[2]; | ||||
scctx->isc_rxqsizes[0] = | scctx->isc_rxqsizes[0] = | ||||
sizeof(struct vmxnet3_rxcompdesc) * scctx->isc_nrxd[0]; | sizeof(struct vmxnet3_rxcompdesc) * scctx->isc_nrxd[0]; | ||||
scctx->isc_rxqsizes[1] = | scctx->isc_rxqsizes[1] = | ||||
sizeof(struct vmxnet3_rxdesc) * scctx->isc_nrxd[1]; | sizeof(struct vmxnet3_rxdesc) * scctx->isc_nrxd[1]; | ||||
scctx->isc_rxqsizes[2] = | scctx->isc_rxqsizes[2] = | ||||
sizeof(struct vmxnet3_rxdesc) * scctx->isc_nrxd[2]; | sizeof(struct vmxnet3_rxdesc) * scctx->isc_nrxd[2]; | ||||
/* | |||||
* Initialize the max frame size and descriptor queue buffer | |||||
* sizes. | |||||
*/ | |||||
vmxnet3_mtu_set(ctx, if_getmtu(sc->vmx_ifp)); | |||||
scctx->isc_rss_table_size = UPT1_RSS_MAX_IND_TABLE_SIZE; | scctx->isc_rss_table_size = UPT1_RSS_MAX_IND_TABLE_SIZE; | ||||
/* Map PCI BARs */ | /* Map PCI BARs */ | ||||
error = vmxnet3_alloc_resources(sc); | error = vmxnet3_alloc_resources(sc); | ||||
if (error) | if (error) | ||||
goto fail; | goto fail; | ||||
/* Check device versions */ | /* Check device versions */ | ||||
▲ Show 20 Lines • Show All 1,546 Lines • ▼ Show 20 Lines | bzero(sc->vmx_ds->vlan_filter, | ||||
sizeof(sc->vmx_ds->vlan_filter)); | sizeof(sc->vmx_ds->vlan_filter)); | ||||
vmxnet3_write_cmd(sc, VMXNET3_CMD_VLAN_FILTER); | vmxnet3_write_cmd(sc, VMXNET3_CMD_VLAN_FILTER); | ||||
} | } | ||||
static void | static void | ||||
vmxnet3_init(if_ctx_t ctx) | vmxnet3_init(if_ctx_t ctx) | ||||
{ | { | ||||
struct vmxnet3_softc *sc; | struct vmxnet3_softc *sc; | ||||
if_softc_ctx_t scctx; | |||||
sc = iflib_get_softc(ctx); | sc = iflib_get_softc(ctx); | ||||
scctx = sc->vmx_scctx; | |||||
scctx->isc_max_frame_size = if_getmtu(iflib_get_ifp(ctx)) + | |||||
ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + ETHER_CRC_LEN; | |||||
/* Use the current MAC address. */ | /* Use the current MAC address. */ | ||||
bcopy(IF_LLADDR(sc->vmx_ifp), sc->vmx_lladdr, ETHER_ADDR_LEN); | bcopy(IF_LLADDR(sc->vmx_ifp), sc->vmx_lladdr, ETHER_ADDR_LEN); | ||||
vmxnet3_set_lladdr(sc); | vmxnet3_set_lladdr(sc); | ||||
vmxnet3_reinit_shared_data(sc); | vmxnet3_reinit_shared_data(sc); | ||||
vmxnet3_reinit_queues(sc); | vmxnet3_reinit_queues(sc); | ||||
vmxnet3_enable_device(sc); | vmxnet3_enable_device(sc); | ||||
vmxnet3_reinit_rxfilters(sc); | vmxnet3_reinit_rxfilters(sc); | ||||
vmxnet3_link_status(sc); | vmxnet3_link_status(sc); | ||||
} | } | ||||
static void | static void | ||||
vmxnet3_multi_set(if_ctx_t ctx) | vmxnet3_multi_set(if_ctx_t ctx) | ||||
{ | { | ||||
vmxnet3_set_rxfilter(iflib_get_softc(ctx), | vmxnet3_set_rxfilter(iflib_get_softc(ctx), | ||||
if_getflags(iflib_get_ifp(ctx))); | if_getflags(iflib_get_ifp(ctx))); | ||||
} | } | ||||
static int | static int | ||||
vmxnet3_mtu_set(if_ctx_t ctx, uint32_t mtu) | vmxnet3_mtu_set(if_ctx_t ctx, uint32_t mtu) | ||||
{ | { | ||||
struct vmxnet3_softc *sc; | |||||
if_softc_ctx_t scctx; | |||||
sc = iflib_get_softc(ctx); | |||||
scctx = sc->vmx_scctx; | |||||
if (mtu > VMXNET3_TX_MAXSIZE - (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + | if (mtu > VMXNET3_TX_MAXSIZE - (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + | ||||
ETHER_CRC_LEN)) | ETHER_CRC_LEN)) | ||||
return (EINVAL); | return (EINVAL); | ||||
/* | |||||
* Update the max frame size so that the rx mbuf size is | |||||
* chosen based on the new mtu during the interface init that | |||||
* will occur after this routine returns. | |||||
*/ | |||||
scctx->isc_max_frame_size = mtu + | |||||
ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + ETHER_CRC_LEN; | |||||
/* RX completion queue - n/a */ | |||||
scctx->isc_rxd_buf_size[0] = 0; | |||||
/* | |||||
* For header-type descriptors (used for first segment of | |||||
* packet), let iflib determine the buffer size based on the | |||||
* max frame size. | |||||
*/ | |||||
scctx->isc_rxd_buf_size[1] = 0; | |||||
/* | |||||
* For body-type descriptors (used for jumbo frames and LRO), | |||||
* always use page-sized buffers. | |||||
*/ | |||||
scctx->isc_rxd_buf_size[2] = MJUMPAGESIZE; | |||||
return (0); | return (0); | ||||
} | } | ||||
static void | static void | ||||
vmxnet3_media_status(if_ctx_t ctx, struct ifmediareq * ifmr) | vmxnet3_media_status(if_ctx_t ctx, struct ifmediareq * ifmr) | ||||
{ | { | ||||
struct vmxnet3_softc *sc; | struct vmxnet3_softc *sc; | ||||
▲ Show 20 Lines • Show All 520 Lines • Show Last 20 Lines |