summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorSebastien Roy <seb@delphix.com>2016-11-17 14:48:12 -0800
committerMatthew Ahrens <mahrens@delphix.com>2016-11-17 15:15:43 -0800
commitca5345b6a28e9e9bfd0c135121d62c6b35a5390d (patch)
tree10ba4659b6e5bb3e55e2ec757da3003846a0fb9d /usr/src
parentac89d1e83d4735655102d06f099fb2d21bf120f6 (diff)
downloadillumos-joyent-ca5345b6a28e9e9bfd0c135121d62c6b35a5390d.tar.gz
7581 merge vmxnet3s changes from open-vm-tools stable-10.0.x
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com> Reviewed by: George Wilson <george.wilson@delphix.com> Reviewed by: Robert Mustacchi <rm@joyent.com> Approved by: Richard Lowe <richlowe@richlowe.net>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/uts/intel/io/vmxnet3s/README.txt25
-rw-r--r--usr/src/uts/intel/io/vmxnet3s/vmxnet3.h8
-rw-r--r--usr/src/uts/intel/io/vmxnet3s/vmxnet3_defs.h2
-rw-r--r--usr/src/uts/intel/io/vmxnet3s/vmxnet3_main.c456
-rw-r--r--usr/src/uts/intel/io/vmxnet3s/vmxnet3_rx.c135
-rw-r--r--usr/src/uts/intel/io/vmxnet3s/vmxnet3_tx.c97
-rw-r--r--usr/src/uts/intel/io/vmxnet3s/vmxnet3_utils.c36
7 files changed, 255 insertions, 504 deletions
diff --git a/usr/src/uts/intel/io/vmxnet3s/README.txt b/usr/src/uts/intel/io/vmxnet3s/README.txt
index 7539907a63..79bf666a64 100644
--- a/usr/src/uts/intel/io/vmxnet3s/README.txt
+++ b/usr/src/uts/intel/io/vmxnet3s/README.txt
@@ -1,4 +1,6 @@
#
+# CDDL HEADER START
+#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
@@ -8,24 +10,25 @@
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
-
+# CDDL HEADER END
#
-# Copyright (c) 2012 by Delphix. All rights reserved.
+# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
#
The vmxnet3s driver is a paravirtualized GLDv3 NIC driver designed to
-be used on VMware virtual machines version 7 and later.
-
-This version of the driver was initially based on the "stable-8.6.x" branch
-of the VMware open-vm-tools which can be obtained from:
+be used on VMware virtual machines version 7 and later. This version
+of the driver is based on the "stable-10.0.x" branch of the VMware
+open-vm-tools which can be obtained from:
https://github.com/vmware/open-vm-tools
-Current changes include:
+Changes from stable-10.0.x include:
-* cstyle and lint cleanup: the driver is lint clean with two categorical
+* add support for VLANs
+* enable building in the illumos gate
+* enable building with the Sun Studio compiler
+* lint cleanup: the driver is lint clean with two categorical
exceptions for which warnings are disabled in the Makefile
-* added support for dladm mtu property
-* added support for VLANs
-* LSO fix contributed by Michael Tsymbalyuk <mtzaurus@gmail.com>
+The driver remains in the original C style to facilitate potential
+future synchronization with upstream.
diff --git a/usr/src/uts/intel/io/vmxnet3s/vmxnet3.h b/usr/src/uts/intel/io/vmxnet3s/vmxnet3.h
index c6250cdf09..b49ff852f1 100644
--- a/usr/src/uts/intel/io/vmxnet3s/vmxnet3.h
+++ b/usr/src/uts/intel/io/vmxnet3s/vmxnet3.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007 VMware, Inc. All rights reserved.
+ * Copyright (C) 2007-2014 VMware, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of the Common
* Development and Distribution License (the "License") version 1.0
@@ -127,6 +127,7 @@ typedef struct vmxnet3_softc_t {
boolean_t devEnabled;
uint8_t macaddr[6];
uint32_t cur_mtu;
+ boolean_t allow_jumbo;
link_state_t linkState;
uint64_t linkSpeed;
vmxnet3_dmabuf_t sharedData;
@@ -192,13 +193,14 @@ extern ddi_device_acc_attr_t vmxnet3_dev_attr;
extern int vmxnet3s_debug;
-#define VMXNET3_MODNAME "vmxnet3s"
+#define VMXNET3_MODNAME "vmxnet3s"
+#define VMXNET3_DRIVER_VERSION_STRING "1.1.0.0"
/* Logging stuff */
#define VMXNET3_WARN(Device, ...) vmxnet3_log(CE_WARN, Device, __VA_ARGS__)
#ifdef DEBUG
-#define VMXNET3_DEBUG(Device, Level, ...) { \
+#define VMXNET3_DEBUG(Device, Level, ...) { \
if (Level <= vmxnet3s_debug) { \
vmxnet3_log(CE_CONT, Device, "?" __VA_ARGS__); \
} \
diff --git a/usr/src/uts/intel/io/vmxnet3s/vmxnet3_defs.h b/usr/src/uts/intel/io/vmxnet3s/vmxnet3_defs.h
index 8ef59990cf..4dfac84e77 100644
--- a/usr/src/uts/intel/io/vmxnet3s/vmxnet3_defs.h
+++ b/usr/src/uts/intel/io/vmxnet3s/vmxnet3_defs.h
@@ -31,7 +31,7 @@
#define VMXNET3_REG_UVRS 0x8 /* UPT Version Report Selection */
#define VMXNET3_REG_DSAL 0x10 /* Driver Shared Address Low */
#define VMXNET3_REG_DSAH 0x18 /* Driver Shared Address High */
-#define VMXNET3_REG_CMD 0x20 /* Command */
+#define VMXNET3_REG_CMD 0x20 /* Command */
#define VMXNET3_REG_MACL 0x28 /* MAC Address Low */
#define VMXNET3_REG_MACH 0x30 /* MAC Address High */
#define VMXNET3_REG_ICR 0x38 /* Interrupt Cause Register */
diff --git a/usr/src/uts/intel/io/vmxnet3s/vmxnet3_main.c b/usr/src/uts/intel/io/vmxnet3s/vmxnet3_main.c
index 2b54baf799..41536583f5 100644
--- a/usr/src/uts/intel/io/vmxnet3s/vmxnet3_main.c
+++ b/usr/src/uts/intel/io/vmxnet3s/vmxnet3_main.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007 VMware, Inc. All rights reserved.
+ * Copyright (C) 2007-2014 VMware, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of the Common
* Development and Distribution License (the "License") version 1.0
@@ -19,20 +19,19 @@
#include <vmxnet3.h>
-#define BUILD_NUMBER_NUMERIC 20160330
-#define BUILD_NUMBER_NUMERIC_STRING "20160330"
+/*
+ * This driver is based on VMware's version 3227872, and contains additional
+ * enhancements (see README.txt).
+ */
+#define BUILD_NUMBER_NUMERIC 3227872
/*
* TODO:
* - Tx data ring
* - MAC_CAPAB_POLL support
- * - JF support
* - Dynamic RX pool
*/
-/*
- * Forward declarations
- */
static int vmxnet3_getstat(void *, uint_t, uint64_t *);
static int vmxnet3_start(void *);
static void vmxnet3_stop(void *);
@@ -41,9 +40,11 @@ static void vmxnet3_ioctl(void *arg, queue_t *wq, mblk_t *mp);
static int vmxnet3_multicst(void *, boolean_t, const uint8_t *);
static int vmxnet3_unicst(void *, const uint8_t *);
static boolean_t vmxnet3_getcapab(void *, mac_capab_t, void *);
-static int vmxnet3_setmacprop(void *, const char *, mac_prop_id_t, uint_t,
+static int vmxnet3_get_prop(void *, const char *, mac_prop_id_t, uint_t,
+ void *);
+static int vmxnet3_set_prop(void *, const char *, mac_prop_id_t, uint_t,
const void *);
-static void vmxnet3_macpropinfo(void *, const char *, mac_prop_id_t,
+static void vmxnet3_prop_info(void *, const char *, mac_prop_id_t,
mac_prop_info_handle_t);
int vmxnet3s_debug = 0;
@@ -60,8 +61,9 @@ static mac_callbacks_t vmxnet3_mac_callbacks = {
.mc_tx = vmxnet3_tx,
.mc_ioctl = vmxnet3_ioctl,
.mc_getcapab = vmxnet3_getcapab,
- .mc_setprop = vmxnet3_setmacprop,
- .mc_propinfo = vmxnet3_macpropinfo
+ .mc_getprop = vmxnet3_get_prop,
+ .mc_setprop = vmxnet3_set_prop,
+ .mc_propinfo = vmxnet3_prop_info
};
/* Tx DMA engine description */
@@ -83,15 +85,10 @@ static ddi_dma_attr_t vmxnet3_dma_attrs_tx = {
/* --- */
/*
- * vmxnet3_getstat --
- *
- * Fetch the statistics of a vmxnet3 device.
- *
- * Results:
- * DDI_FAILURE.
+ * Fetch the statistics of a vmxnet3 device.
*
- * Side effects:
- * None.
+ * Returns:
+ * DDI_SUCCESS or DDI_FAILURE.
*/
static int
vmxnet3_getstat(void *data, uint_t stat, uint64_t *val)
@@ -197,16 +194,10 @@ vmxnet3_getstat(void *data, uint_t stat, uint64_t *val)
}
/*
- * vmxnet3_prepare_drivershared --
- *
- * Allocate and initialize the shared data structures
- * of a vmxnet3 device.
+ * Allocate and initialize the shared data structures of a vmxnet3 device.
*
- * Results:
- * DDI_SUCCESS or DDI_FAILURE.
- *
- * Side effects:
- * None.
+ * Returns:
+ * DDI_SUCCESS or DDI_FAILURE.
*/
static int
vmxnet3_prepare_drivershared(vmxnet3_softc_t *dp)
@@ -267,15 +258,7 @@ vmxnet3_prepare_drivershared(vmxnet3_softc_t *dp)
}
/*
- * vmxnet3_destroy_drivershared --
- *
- * Destroy the shared data structures of a vmxnet3 device.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
+ * Destroy the shared data structures of a vmxnet3 device.
*/
static void
vmxnet3_destroy_drivershared(vmxnet3_softc_t *dp)
@@ -288,15 +271,10 @@ vmxnet3_destroy_drivershared(vmxnet3_softc_t *dp)
}
/*
- * vmxnet3_alloc_cmdring --
- *
- * Allocate and initialize the command ring of a queue.
+ * Allocate and initialize the command ring of a queue.
*
- * Results:
- * DDI_SUCCESS or DDI_FAILURE.
- *
- * Side effects:
- * None.
+ * Returns:
+ * DDI_SUCCESS or DDI_FAILURE.
*/
static int
vmxnet3_alloc_cmdring(vmxnet3_softc_t *dp, vmxnet3_cmdring_t *cmdRing)
@@ -316,15 +294,10 @@ vmxnet3_alloc_cmdring(vmxnet3_softc_t *dp, vmxnet3_cmdring_t *cmdRing)
}
/*
- * vmxnet3_alloc_compring --
- *
- * Allocate and initialize the completion ring of a queue.
+ * Allocate and initialize the completion ring of a queue.
*
- * Results:
+ * Returns:
* DDI_SUCCESS or DDI_FAILURE.
- *
- * Side effects:
- * None.
*/
static int
vmxnet3_alloc_compring(vmxnet3_softc_t *dp, vmxnet3_compring_t *compRing)
@@ -343,15 +316,10 @@ vmxnet3_alloc_compring(vmxnet3_softc_t *dp, vmxnet3_compring_t *compRing)
}
/*
- * vmxnet3_prepare_txqueue --
+ * Initialize the tx queue of a vmxnet3 device.
*
- * Initialize the tx queue of a vmxnet3 device.
- *
- * Results:
- * DDI_SUCCESS or DDI_FAILURE.
- *
- * Side effects:
- * None.
+ * Returns:
+ * DDI_SUCCESS or DDI_FAILURE.
*/
static int
vmxnet3_prepare_txqueue(vmxnet3_softc_t *dp)
@@ -397,15 +365,10 @@ error:
}
/*
- * vmxnet3_prepare_rxqueue --
- *
- * Initialize the rx queue of a vmxnet3 device.
+ * Initialize the rx queue of a vmxnet3 device.
*
- * Results:
- * DDI_SUCCESS or DDI_FAILURE.
- *
- * Side effects:
- * None.
+ * Returns:
+ * DDI_SUCCESS or DDI_FAILURE.
*/
static int
vmxnet3_prepare_rxqueue(vmxnet3_softc_t *dp)
@@ -451,15 +414,7 @@ error:
}
/*
- * vmxnet3_destroy_txqueue --
- *
- * Destroy the tx queue of a vmxnet3 device.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
+ * Destroy the tx queue of a vmxnet3 device.
*/
static void
vmxnet3_destroy_txqueue(vmxnet3_softc_t *dp)
@@ -478,15 +433,7 @@ vmxnet3_destroy_txqueue(vmxnet3_softc_t *dp)
}
/*
- * vmxnet3_destroy_rxqueue --
- *
- * Destroy the rx queue of a vmxnet3 device.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
+ * Destroy the rx queue of a vmxnet3 device.
*/
static void
vmxnet3_destroy_rxqueue(vmxnet3_softc_t *dp)
@@ -505,15 +452,7 @@ vmxnet3_destroy_rxqueue(vmxnet3_softc_t *dp)
}
/*
- * vmxnet3_refresh_rxfilter --
- *
- * Apply new RX filters settings to a vmxnet3 device.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
+ * Apply new RX filters settings to a vmxnet3 device.
*/
static void
vmxnet3_refresh_rxfilter(vmxnet3_softc_t *dp)
@@ -525,15 +464,7 @@ vmxnet3_refresh_rxfilter(vmxnet3_softc_t *dp)
}
/*
- * vmxnet3_refresh_linkstate --
- *
- * Fetch the link state of a vmxnet3 device.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
+ * Fetch the link state of a vmxnet3 device.
*/
static void
vmxnet3_refresh_linkstate(vmxnet3_softc_t *dp)
@@ -552,16 +483,11 @@ vmxnet3_refresh_linkstate(vmxnet3_softc_t *dp)
}
/*
- * vmxnet3_start --
- *
- * Start a vmxnet3 device: allocate and initialize the shared data
- * structures and send a start command to the device.
+ * Start a vmxnet3 device: allocate and initialize the shared data
+ * structures and send a start command to the device.
*
- * Results:
- * DDI_SUCCESS or DDI_FAILURE.
- *
- * Side effects:
- * None.
+ * Returns:
+ * DDI_SUCCESS or DDI_FAILURE.
*/
static int
vmxnet3_start(void *data)
@@ -675,16 +601,8 @@ error:
}
/*
- * vmxnet3_stop --
- *
- * Stop a vmxnet3 device: send a stop command to the device and
- * de-allocate the shared data structures.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
+ * Stop a vmxnet3 device: send a stop command to the device and
+ * de-allocate the shared data structures.
*/
static void
vmxnet3_stop(void *data)
@@ -714,15 +632,10 @@ vmxnet3_stop(void *data)
}
/*
- * vmxnet3_setpromisc --
- *
- * Set or unset promiscuous mode on a vmxnet3 device.
+ * Set or unset promiscuous mode on a vmxnet3 device.
*
- * Results:
+ * Returns:
* DDI_SUCCESS.
- *
- * Side effects:
- * None.
*/
static int
vmxnet3_setpromisc(void *data, boolean_t promisc)
@@ -743,15 +656,10 @@ vmxnet3_setpromisc(void *data, boolean_t promisc)
}
/*
- * vmxnet3_multicst --
- *
- * Add or remove a multicast address from/to a vmxnet3 device.
+ * Add or remove a multicast address from/to a vmxnet3 device.
*
- * Results:
- * DDI_FAILURE.
- *
- * Side effects:
- * None.
+ * Returns:
+ * DDI_SUCCESS or DDI_FAILURE.
*/
static int
vmxnet3_multicst(void *data, boolean_t add, const uint8_t *macaddr)
@@ -852,15 +760,10 @@ done:
}
/*
- * vmxnet3_unicst --
- *
- * Set the mac address of a vmxnet3 device.
+ * Set the mac address of a vmxnet3 device.
*
- * Results:
- * DDI_FAILURE.
- *
- * Side effects:
- * None.
+ * Returns:
+ * DDI_SUCCESS.
*/
static int
vmxnet3_unicst(void *data, const uint8_t *macaddr)
@@ -881,22 +784,15 @@ vmxnet3_unicst(void *data, const uint8_t *macaddr)
return (DDI_SUCCESS);
}
-
/*
- * vmxnet3_change_mtu --
- *
- * Change the MTU as seen by the driver. This is only supported when
- * the mac is stopped.
- *
- * Results:
- * EBUSY if the device is enabled.
- * EINVAL for invalid MTU values.
- * 0 on success.
+ * Change the MTU as seen by the driver. This is only supported when
+ * the mac is stopped.
*
- * Side effects:
- * None.
+ * Returns:
+ * EBUSY if the device is enabled.
+ * EINVAL for invalid MTU values.
+ * 0 on success.
*/
-
static int
vmxnet3_change_mtu(vmxnet3_softc_t *dp, uint32_t new_mtu)
{
@@ -914,6 +810,10 @@ vmxnet3_change_mtu(vmxnet3_softc_t *dp, uint32_t new_mtu)
VMXNET3_WARN(dp, "New MTU not in valid range [%d, %d].\n",
VMXNET3_MIN_MTU, VMXNET3_MAX_MTU);
return (EINVAL);
+ } else if (new_mtu > ETHERMTU && !dp->allow_jumbo) {
+ VMXNET3_WARN(dp, "MTU cannot be greater than %d because "
+ "accept-jumbo is not enabled.\n", ETHERMTU);
+ return (EINVAL);
}
dp->cur_mtu = new_mtu;
@@ -925,22 +825,80 @@ vmxnet3_change_mtu(vmxnet3_softc_t *dp, uint32_t new_mtu)
return (ret);
}
+/* ARGSUSED */
+static int
+vmxnet3_get_prop(void *data, const char *prop_name, mac_prop_id_t prop_id,
+ uint_t prop_val_size, void *prop_val)
+{
+ vmxnet3_softc_t *dp = data;
+ int ret = 0;
+
+ switch (prop_id) {
+ case MAC_PROP_MTU:
+ ASSERT(prop_val_size >= sizeof (uint32_t));
+ bcopy(&dp->cur_mtu, prop_val, sizeof (uint32_t));
+ break;
+ default:
+ VMXNET3_WARN(dp, "vmxnet3_get_prop property %d not supported",
+ prop_id);
+ ret = ENOTSUP;
+ }
+ return (ret);
+}
+
+/* ARGSUSED */
+static int
+vmxnet3_set_prop(void *data, const char *prop_name, mac_prop_id_t prop_id,
+ uint_t prop_val_size, const void *prop_val)
+{
+ vmxnet3_softc_t *dp = data;
+ int ret;
+
+ switch (prop_id) {
+ case MAC_PROP_MTU: {
+ uint32_t new_mtu;
+ ASSERT(prop_val_size >= sizeof (uint32_t));
+ bcopy(prop_val, &new_mtu, sizeof (new_mtu));
+ ret = vmxnet3_change_mtu(dp, new_mtu);
+ break;
+ }
+ default:
+ VMXNET3_WARN(dp, "vmxnet3_set_prop property %d not supported",
+ prop_id);
+ ret = ENOTSUP;
+ }
+
+ return (ret);
+}
+
+/* ARGSUSED */
+static void
+vmxnet3_prop_info(void *data, const char *prop_name, mac_prop_id_t prop_id,
+ mac_prop_info_handle_t prop_handle)
+{
+ vmxnet3_softc_t *dp = data;
+
+ switch (prop_id) {
+ case MAC_PROP_MTU:
+ mac_prop_info_set_range_uint32(prop_handle, VMXNET3_MIN_MTU,
+ VMXNET3_MAX_MTU);
+ break;
+ default:
+ VMXNET3_WARN(dp, "vmxnet3_prop_info: property %d not supported",
+ prop_id);
+ }
+}
/*
- * vmxnet3_ioctl --
- *
- * DDI/DDK callback to handle IOCTL in driver. Currently it only handles
- * ND_SET ioctl. Rest all are ignored. The ND_SET is used to set/reset
- * accept-jumbo ndd parameted for the interface.
- *
- * Results:
- * Nothing is returned directly. An ACK or NACK is conveyed to the calling
- * function from the mblk which was used to call this function.
+ * DDI/DDK callback to handle IOCTL in driver. Currently it only handles
+ * ND_SET ioctl. Rest all are ignored. The ND_SET is used to set/reset
+ * accept-jumbo ndd parameted for the interface.
*
* Side effects:
- * MTU can be changed and device can be reset.
+ * MTU can be changed and device can be reset. An ACK or NACK is conveyed
+ * to the calling function from the mblk which was used to call this
+ * function.
*/
-
static void
vmxnet3_ioctl(void *arg, queue_t *wq, mblk_t *mp)
{
@@ -1011,10 +969,12 @@ vmxnet3_ioctl(void *arg, queue_t *wq, mblk_t *mp)
if (data == 1) {
VMXNET3_DEBUG(dp, 2,
"Accepting jumbo frames\n");
+ dp->allow_jumbo = B_TRUE;
ret = vmxnet3_change_mtu(dp, VMXNET3_MAX_MTU);
} else if (data == 0) {
VMXNET3_DEBUG(dp, 2,
"Rejecting jumbo frames\n");
+ dp->allow_jumbo = B_FALSE;
ret = vmxnet3_change_mtu(dp, ETHERMTU);
} else {
VMXNET3_WARN(dp, "Invalid data value to be set,"
@@ -1041,17 +1001,11 @@ vmxnet3_ioctl(void *arg, queue_t *wq, mblk_t *mp)
miocnak(wq, mp, 0, EINVAL);
}
-
/*
- * vmxnet3_getcapab --
- *
- * Get the capabilities of a vmxnet3 device.
+ * Get the capabilities of a vmxnet3 device.
*
- * Results:
- * B_TRUE or B_FALSE.
- *
- * Side effects:
- * None.
+ * Returns:
+ * B_TRUE if the capability is supported, B_FALSE otherwise.
*/
static boolean_t
vmxnet3_getcapab(void *data, mac_capab_t capab, void *arg)
@@ -1060,21 +1014,21 @@ vmxnet3_getcapab(void *data, mac_capab_t capab, void *arg)
boolean_t ret;
switch (capab) {
- case MAC_CAPAB_HCKSUM: {
- uint32_t *txflags = arg;
- *txflags = HCKSUM_INET_PARTIAL;
- ret = B_TRUE;
- break;
- }
- case MAC_CAPAB_LSO: {
- mac_capab_lso_t *lso = arg;
- lso->lso_flags = LSO_TX_BASIC_TCP_IPV4;
- lso->lso_basic_tcp_ipv4.lso_max = IP_MAXPACKET;
- ret = vmxnet3_getprop(dp, "EnableLSO", 0, 1, 1);
- break;
- }
- default:
- ret = B_FALSE;
+ case MAC_CAPAB_HCKSUM: {
+ uint32_t *txflags = arg;
+ *txflags = HCKSUM_INET_PARTIAL;
+ ret = B_TRUE;
+ break;
+ }
+ case MAC_CAPAB_LSO: {
+ mac_capab_lso_t *lso = arg;
+ lso->lso_flags = LSO_TX_BASIC_TCP_IPV4;
+ lso->lso_basic_tcp_ipv4.lso_max = IP_MAXPACKET;
+ ret = vmxnet3_getprop(dp, "EnableLSO", 0, 1, 1);
+ break;
+ }
+ default:
+ ret = B_FALSE;
}
VMXNET3_DEBUG(dp, 2, "getcapab(0x%x) -> %s\n", capab,
@@ -1084,73 +1038,10 @@ vmxnet3_getcapab(void *data, mac_capab_t capab, void *arg)
}
/*
- * vmxnet3_setmacprop --
- *
- * Set a MAC property.
- *
- * Results:
- * 0 on success, errno otherwise.
+ * Reset a vmxnet3 device. Only to be used when the device is wedged.
*
* Side effects:
- * None.
- */
-/* ARGSUSED */
-static int
-vmxnet3_setmacprop(void *data, const char *pr_name, mac_prop_id_t pr_num,
- uint_t pr_valsize, const void *pr_val)
-{
- vmxnet3_softc_t *dp = data;
- int ret = 0;
- uint32_t newmtu;
-
- switch (pr_num) {
- case MAC_PROP_MTU:
- (void) memcpy(&newmtu, pr_val, sizeof (newmtu));
- ret = vmxnet3_change_mtu(dp, newmtu);
- break;
- default:
- ret = ENOTSUP;
- }
-
- return (ret);
-}
-
-/*
- * vmxnet3_macpropinfo --
- *
- * Get MAC property information.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- */
-/* ARGSUSED */
-static void
-vmxnet3_macpropinfo(void *data, const char *pr_name, mac_prop_id_t pr_num,
- mac_prop_info_handle_t prh)
-{
- switch (pr_num) {
- case MAC_PROP_MTU:
- mac_prop_info_set_range_uint32(prh, VMXNET3_MIN_MTU,
- VMXNET3_MAX_MTU);
- break;
- default:
- break;
- }
-}
-
-/*
- * vmxnet3_reset --
- *
- * Reset a vmxnet3 device. Only to be used when the device is wedged.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The device is reset.
+ * The device is reset.
*/
static void
vmxnet3_reset(void *data)
@@ -1169,15 +1060,10 @@ vmxnet3_reset(void *data)
}
/*
- * vmxnet3_intr_events --
- *
- * Process pending events on a vmxnet3 device.
- *
- * Results:
- * B_TRUE if the link state changed, B_FALSE otherwise.
+ * Process pending events on a vmxnet3 device.
*
- * Side effects:
- * None.
+ * Returns:
+ * B_TRUE if the link state changed, B_FALSE otherwise.
*/
static boolean_t
vmxnet3_intr_events(vmxnet3_softc_t *dp)
@@ -1225,15 +1111,10 @@ vmxnet3_intr_events(vmxnet3_softc_t *dp)
}
/*
- * vmxnet3_intr --
- *
- * Interrupt handler of a vmxnet3 device.
+ * Interrupt handler of a vmxnet3 device.
*
- * Results:
- * DDI_INTR_CLAIMED or DDI_INTR_UNCLAIMED.
- *
- * Side effects:
- * None.
+ * Returns:
+ * DDI_INTR_CLAIMED or DDI_INTR_UNCLAIMED.
*/
/* ARGSUSED1 */
static uint_t
@@ -1331,15 +1212,10 @@ vmxnet3_kstat_init(vmxnet3_softc_t *dp)
}
/*
- * vmxnet3_attach --
- *
- * Probe and attach a vmxnet3 instance to the stack.
- *
- * Results:
- * DDI_SUCCESS or DDI_FAILURE.
+ * Probe and attach a vmxnet3 instance to the stack.
*
- * Side effects:
- * None.
+ * Returns:
+ * DDI_SUCCESS or DDI_FAILURE.
*/
static int
vmxnet3_attach(dev_info_t *dip, ddi_attach_cmd_t cmd)
@@ -1364,6 +1240,7 @@ vmxnet3_attach(dev_info_t *dip, ddi_attach_cmd_t cmd)
dp->dip = dip;
dp->instance = ddi_get_instance(dip);
dp->cur_mtu = ETHERMTU;
+ dp->allow_jumbo = B_TRUE;
VMXNET3_DEBUG(dp, 1, "attach()\n");
@@ -1593,15 +1470,10 @@ error:
}
/*
- * vmxnet3_detach --
- *
- * Detach a vmxnet3 instance from the stack.
+ * Detach a vmxnet3 instance from the stack.
*
- * Results:
- * DDI_SUCCESS or DDI_FAILURE.
- *
- * Side effects:
- * None.
+ * Returns:
+ * DDI_SUCCESS or DDI_FAILURE.
*/
static int
vmxnet3_detach(dev_info_t *dip, ddi_detach_cmd_t cmd)
@@ -1668,7 +1540,7 @@ vmxnet3_detach(dev_info_t *dip, ddi_detach_cmd_t cmd)
* Structures used by the module loader
*/
-#define VMXNET3_IDENT "VMware Ethernet v3 (" BUILD_NUMBER_NUMERIC_STRING ")"
+#define VMXNET3_IDENT "VMware Ethernet v3 " VMXNET3_DRIVER_VERSION_STRING
DDI_DEFINE_STREAM_OPS(
vmxnet3_dev_ops,
diff --git a/usr/src/uts/intel/io/vmxnet3s/vmxnet3_rx.c b/usr/src/uts/intel/io/vmxnet3s/vmxnet3_rx.c
index 1084be45df..66c0b9231f 100644
--- a/usr/src/uts/intel/io/vmxnet3s/vmxnet3_rx.c
+++ b/usr/src/uts/intel/io/vmxnet3s/vmxnet3_rx.c
@@ -12,26 +12,20 @@
* See the License for the specific language governing permissions
* and limitations under the License.
*/
-
/*
* Copyright (c) 2013 by Delphix. All rights reserved.
*/
#include <vmxnet3.h>
-static void vmxnet3_put_rxbuf(vmxnet3_rxbuf_t *rxBuf);
+static void vmxnet3_put_rxbuf(vmxnet3_rxbuf_t *);
/*
- * vmxnet3_alloc_rxbuf --
- *
- * Allocate a new rxBuf from memory. All its fields are set except
- * for its associated mblk which has to be allocated later.
+ * Allocate a new rxBuf from memory. All its fields are set except
+ * for its associated mblk which has to be allocated later.
*
- * Results:
- * A new rxBuf or NULL.
- *
- * Side effects:
- * None.
+ * Returns:
+ * A new rxBuf or NULL.
*/
static vmxnet3_rxbuf_t *
vmxnet3_alloc_rxbuf(vmxnet3_softc_t *dp, boolean_t canSleep)
@@ -65,17 +59,6 @@ vmxnet3_alloc_rxbuf(vmxnet3_softc_t *dp, boolean_t canSleep)
return (rxBuf);
}
-/*
- * vmxnet3_free_rxbuf --
- *
- * Free a rxBuf.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- */
static void
vmxnet3_free_rxbuf(vmxnet3_softc_t *dp, vmxnet3_rxbuf_t *rxBuf)
{
@@ -93,16 +76,11 @@ vmxnet3_free_rxbuf(vmxnet3_softc_t *dp, vmxnet3_rxbuf_t *rxBuf)
}
/*
- * vmxnet3_put_rxpool_buf --
+ * Return a rxBuf to the pool.
*
- * Return a rxBuf to the pool.
- *
- * Results:
- * B_TRUE if there was room in the pool and the rxBuf was returned,
- * B_FALSE otherwise.
- *
- * Side effects:
- * None.
+ * Returns:
+ * B_TRUE if there was room in the pool and the rxBuf was returned,
+ * B_FALSE otherwise.
*/
static boolean_t
vmxnet3_put_rxpool_buf(vmxnet3_softc_t *dp, vmxnet3_rxbuf_t *rxBuf)
@@ -125,15 +103,7 @@ vmxnet3_put_rxpool_buf(vmxnet3_softc_t *dp, vmxnet3_rxbuf_t *rxBuf)
}
/*
- * vmxnet3_put_rxbuf --
- *
- * Return a rxBuf to the pool or free it.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
+ * Return a rxBuf to the pool or free it.
*/
static void
vmxnet3_put_rxbuf(vmxnet3_rxbuf_t *rxBuf)
@@ -147,15 +117,10 @@ vmxnet3_put_rxbuf(vmxnet3_rxbuf_t *rxBuf)
}
/*
- * vmxnet3_get_rxpool_buf --
- *
- * Get an unused rxBuf from the pool.
- *
- * Results:
- * A rxBuf or NULL if there are no buffers in the pool.
+ * Get an unused rxBuf from the pool.
*
- * Side effects:
- * None.
+ * Returns:
+ * A rxBuf or NULL if there are no buffers in the pool.
*/
static vmxnet3_rxbuf_t *
vmxnet3_get_rxpool_buf(vmxnet3_softc_t *dp)
@@ -176,16 +141,11 @@ vmxnet3_get_rxpool_buf(vmxnet3_softc_t *dp)
}
/*
- * vmxnet3_get_rxbuf --
+ * Get an unused rxBuf from either the pool or from memory.
+ * The returned rxBuf has a mblk associated with it.
*
- * Get an unused rxBuf from either the pool or from memory.
- * The returned rxBuf has a mblk associated with it.
- *
- * Results:
- * A rxBuf or NULL.
- *
- * Side effects:
- * None.
+ * Returns:
+ * A rxBuf or NULL.
*/
static vmxnet3_rxbuf_t *
vmxnet3_get_rxbuf(vmxnet3_softc_t *dp, boolean_t canSleep)
@@ -212,15 +172,10 @@ vmxnet3_get_rxbuf(vmxnet3_softc_t *dp, boolean_t canSleep)
}
/*
- * vmxnet3_rx_populate --
- *
- * Populate a Rx descriptor with a new rxBuf.
- *
- * Results:
- * DDI_SUCCESS or DDI_FAILURE.
+ * Populate a Rx descriptor with a new rxBuf.
*
- * Side effects:
- * None.
+ * Returns:
+ * DDI_SUCCESS or DDI_FAILURE.
*/
static int
vmxnet3_rx_populate(vmxnet3_softc_t *dp, vmxnet3_rxqueue_t *rxq, uint16_t idx,
@@ -247,15 +202,10 @@ vmxnet3_rx_populate(vmxnet3_softc_t *dp, vmxnet3_rxqueue_t *rxq, uint16_t idx,
}
/*
- * vmxnet3_rxqueue_init --
+ * Initialize a RxQueue by populating the whole Rx ring with rxBufs.
*
- * Initialize a RxQueue by populating the whole Rx ring with rxBufs.
- *
- * Results:
- * DDI_SUCCESS or DDI_FAILURE.
- *
- * Side effects:
- * None.
+ * Returns:
+ * DDI_SUCCESS or DDI_FAILURE.
*/
int
vmxnet3_rxqueue_init(vmxnet3_softc_t *dp, vmxnet3_rxqueue_t *rxq)
@@ -285,15 +235,7 @@ error:
}
/*
- * vmxnet3_rxqueue_fini --
- *
- * Finish a RxQueue by freeing all the related rxBufs.
- *
- * Results:
- * DDI_SUCCESS.
- *
- * Side effects:
- * None.
+ * Finish a RxQueue by freeing all the related rxBufs.
*/
void
vmxnet3_rxqueue_fini(vmxnet3_softc_t *dp, vmxnet3_rxqueue_t *rxq)
@@ -322,16 +264,8 @@ vmxnet3_rxqueue_fini(vmxnet3_softc_t *dp, vmxnet3_rxqueue_t *rxq)
}
/*
- * vmxnet3_rx_hwcksum --
- *
- * Determine if a received packet was checksummed by the Vmxnet3
- * device and tag the mp appropriately.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The mp may get tagged.
+ * Determine if a received packet was checksummed by the Vmxnet3
+ * device and tag the mp appropriately.
*/
static void
vmxnet3_rx_hwcksum(vmxnet3_softc_t *dp, mblk_t *mp,
@@ -355,16 +289,11 @@ vmxnet3_rx_hwcksum(vmxnet3_softc_t *dp, mblk_t *mp,
}
/*
- * vmxnet3_rx_intr --
- *
- * Interrupt handler for Rx. Look if there are any pending Rx and
- * put them in mplist.
- *
- * Results:
- * A list of messages to pass to the MAC subystem.
+ * Interrupt handler for Rx. Look if there are any pending Rx and
+ * put them in mplist.
*
- * Side effects:
- * None.
+ * Returns:
+ * A list of messages to pass to the MAC subystem.
*/
mblk_t *
vmxnet3_rx_intr(vmxnet3_softc_t *dp, vmxnet3_rxqueue_t *rxq)
@@ -419,8 +348,8 @@ vmxnet3_rx_intr(vmxnet3_softc_t *dp, vmxnet3_rxqueue_t *rxq)
* descriptor. Grab it only if we achieve to replace
* it with a fresh buffer.
*/
- if (vmxnet3_rx_populate(dp, rxq, rxdIdx,
- B_FALSE) == DDI_SUCCESS) {
+ if (vmxnet3_rx_populate(dp, rxq, rxdIdx, B_FALSE) ==
+ DDI_SUCCESS) {
/* Success, we can chain the mblk with the mp */
mblk->b_wptr = mblk->b_rptr + compDesc->rcd.len;
*mpTail = mblk;
diff --git a/usr/src/uts/intel/io/vmxnet3s/vmxnet3_tx.c b/usr/src/uts/intel/io/vmxnet3s/vmxnet3_tx.c
index b783f4c65f..8df683d892 100644
--- a/usr/src/uts/intel/io/vmxnet3s/vmxnet3_tx.c
+++ b/usr/src/uts/intel/io/vmxnet3s/vmxnet3_tx.c
@@ -33,15 +33,7 @@ typedef struct vmxnet3_offload_t {
} vmxnet3_offload_t;
/*
- * vmxnet3_txqueue_init --
- *
- * Initialize a TxQueue. Currently nothing needs to be done.
- *
- * Results:
- * DDI_SUCCESS.
- *
- * Side effects:
- * None.
+ * Initialize a TxQueue. Currently nothing needs to be done.
*/
/* ARGSUSED */
int
@@ -51,15 +43,7 @@ vmxnet3_txqueue_init(vmxnet3_softc_t *dp, vmxnet3_txqueue_t *txq)
}
/*
- * vmxnet3_txqueue_fini --
- *
- * Finish a TxQueue by freeing all pending Tx.
- *
- * Results:
- * DDI_SUCCESS.
- *
- * Side effects:
- * None.
+ * Finish a TxQueue by freeing all pending Tx.
*/
void
vmxnet3_txqueue_fini(vmxnet3_softc_t *dp, vmxnet3_txqueue_t *txq)
@@ -77,24 +61,19 @@ vmxnet3_txqueue_fini(vmxnet3_softc_t *dp, vmxnet3_txqueue_t *txq)
}
/*
- * vmxnet3_tx_prepare_offload --
- *
- * Build the offload context of a msg.
- *
- * Results:
- * 0 if everything went well.
- * +n if n bytes need to be pulled up.
- * -1 in case of error (not used).
+ * Build the offload context of a msg.
*
- * Side effects:
- * None.
+ * Returns:
+ * 0 if everything went well.
+ * +n if n bytes need to be pulled up.
+ * -1 in case of error (not used).
*/
static int
vmxnet3_tx_prepare_offload(vmxnet3_softc_t *dp, vmxnet3_offload_t *ol,
mblk_t *mp)
{
int ret = 0;
- uint32_t start, stuff, value, flags, lsoflags, mss;
+ uint32_t start, stuff, value, flags, lso_flag, mss;
ol->om = VMXNET3_OM_NONE;
ol->hlen = 0;
@@ -102,12 +81,9 @@ vmxnet3_tx_prepare_offload(vmxnet3_softc_t *dp, vmxnet3_offload_t *ol,
hcksum_retrieve(mp, NULL, NULL, &start, &stuff, NULL, &value, &flags);
- mac_lso_get(mp, &mss, &lsoflags);
- if (lsoflags & HW_LSO) {
- flags |= HW_LSO;
- }
+ mac_lso_get(mp, &mss, &lso_flag);
- if (flags) {
+ if (flags || lso_flag) {
struct ether_vlan_header *eth = (void *) mp->b_rptr;
uint8_t ethLen;
@@ -120,12 +96,7 @@ vmxnet3_tx_prepare_offload(vmxnet3_softc_t *dp, vmxnet3_offload_t *ol,
VMXNET3_DEBUG(dp, 4, "flags=0x%x, ethLen=%u, start=%u, "
"stuff=%u, value=%u\n", flags, ethLen, start, stuff, value);
- if (flags & HCK_PARTIALCKSUM) {
- ol->om = VMXNET3_OM_CSUM;
- ol->hlen = start + ethLen;
- ol->msscof = stuff + ethLen;
- }
- if (flags & HW_LSO) {
+ if (lso_flag & HW_LSO) {
mblk_t *mblk = mp;
uint8_t *ip, *tcp;
uint8_t ipLen, tcpLen;
@@ -155,11 +126,15 @@ vmxnet3_tx_prepare_offload(vmxnet3_softc_t *dp, vmxnet3_offload_t *ol,
ol->om = VMXNET3_OM_TSO;
ol->hlen = ethLen + ipLen + tcpLen;
- ol->msscof = DB_LSOMSS(mp);
+ ol->msscof = mss;
if (mblk != mp) {
ret = ol->hlen;
}
+ } else if (flags & HCK_PARTIALCKSUM) {
+ ol->om = VMXNET3_OM_CSUM;
+ ol->hlen = start + ethLen;
+ ol->msscof = stuff + ethLen;
}
}
@@ -167,18 +142,16 @@ vmxnet3_tx_prepare_offload(vmxnet3_softc_t *dp, vmxnet3_offload_t *ol,
}
/*
- * vmxnet3_tx_one --
- *
- * Map a msg into the Tx command ring of a vmxnet3 device.
+ * Map a msg into the Tx command ring of a vmxnet3 device.
*
- * Results:
- * VMXNET3_TX_OK if everything went well.
- * VMXNET3_TX_RINGFULL if the ring is nearly full.
- * VMXNET3_TX_PULLUP if the msg is overfragmented.
- * VMXNET3_TX_FAILURE if there was a DMA or offload error.
+ * Returns:
+ * VMXNET3_TX_OK if everything went well.
+ * VMXNET3_TX_RINGFULL if the ring is nearly full.
+ * VMXNET3_TX_PULLUP if the msg is overfragmented.
+ * VMXNET3_TX_FAILURE if there was a DMA or offload error.
*
* Side effects:
- * The ring is filled if VMXNET3_TX_OK is returned.
+ * The ring is filled if VMXNET3_TX_OK is returned.
*/
static vmxnet3_txstatus
vmxnet3_tx_one(vmxnet3_softc_t *dp, vmxnet3_txqueue_t *txq,
@@ -339,16 +312,11 @@ done:
}
/*
- * vmxnet3_tx --
+ * Send packets on a vmxnet3 device.
*
- * Send packets on a vmxnet3 device.
- *
- * Results:
- * NULL in case of success or failure.
- * The mps to be retransmitted later if the ring is full.
- *
- * Side effects:
- * None.
+ * Returns:
+ * NULL in case of success or failure.
+ * The mps to be retransmitted later if the ring is full.
*/
mblk_t *
vmxnet3_tx(void *data, mblk_t *mps)
@@ -450,15 +418,10 @@ vmxnet3_tx(void *data, mblk_t *mps)
}
/*
- * vmxnet3_tx_complete --
+ * Parse a transmit queue and complete packets.
*
- * Parse a transmit queue and complete packets.
- *
- * Results:
- * B_TRUE if Tx must be updated or B_FALSE if no action is required.
- *
- * Side effects:
- * None.
+ * Returns:
+ * B_TRUE if Tx must be updated or B_FALSE if no action is required.
*/
boolean_t
vmxnet3_tx_complete(vmxnet3_softc_t *dp, vmxnet3_txqueue_t *txq)
diff --git a/usr/src/uts/intel/io/vmxnet3s/vmxnet3_utils.c b/usr/src/uts/intel/io/vmxnet3s/vmxnet3_utils.c
index 26784c3d65..8152c8f3bb 100644
--- a/usr/src/uts/intel/io/vmxnet3s/vmxnet3_utils.c
+++ b/usr/src/uts/intel/io/vmxnet3s/vmxnet3_utils.c
@@ -71,15 +71,10 @@ static ddi_dma_attr_t vmxnet3_dma_attrs_512 = {
};
/*
- * vmxnet3_alloc_dma_mem --
+ * Allocate /size/ bytes of contiguous DMA-ble memory.
*
- * Allocate /size/ bytes of contiguous DMA-ble memory.
- *
- * Results:
+ * Returns:
* DDI_SUCCESS or DDI_FAILURE.
- *
- * Side effects:
- * None.
*/
static int
vmxnet3_alloc_dma_mem(vmxnet3_softc_t *dp, vmxnet3_dmabuf_t *dma, size_t size,
@@ -161,15 +156,7 @@ vmxnet3_alloc_dma_mem_128(vmxnet3_softc_t *dp, vmxnet3_dmabuf_t *dma,
}
/*
- * vmxnet3_free_dma_mem --
- *
- * Free DMA-ble memory.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
+ * Free DMA-ble memory.
*/
void
vmxnet3_free_dma_mem(vmxnet3_dmabuf_t *dma)
@@ -184,18 +171,13 @@ vmxnet3_free_dma_mem(vmxnet3_dmabuf_t *dma)
}
/*
- * vmxnet3_getprop --
- *
- * Get the numeric value of the property "name" in vmxnet3s.conf for
- * the corresponding device instance.
- * If the property isn't found or if it doesn't satisfy the conditions,
- * "def" is returned.
- *
- * Results:
- * The value of the property or "def".
+ * Get the numeric value of the property "name" in vmxnet3s.conf for
+ * the corresponding device instance.
+ * If the property isn't found or if it doesn't satisfy the conditions,
+ * "def" is returned.
*
- * Side effects:
- * None.
+ * Returns:
+ * The value of the property or "def".
*/
int
vmxnet3_getprop(vmxnet3_softc_t *dp, char *name, int min, int max, int def)