--- /dev/null	Thu Dec 10 09:27:29 2015
+++ new/usr/src/uts/common/io/i40e/i40e_stats.c	Thu Dec 10 09:27:29 2015
@@ -0,0 +1,179 @@
+/*
+ * 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
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source.  A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright 2015 OmniTI Computer Consulting, Inc. All rights reserved.
+ */
+
+#include "i40e_sw.h"
+
+/*
+ * Functions for keeping track of an i40e_t's statistics.
+ */
+boolean_t
+i40e_init_stats(i40e_t *i40e)
+{
+	kstat_t *ks;
+	i40e_kstat_t *i40e_kstats;
+
+	ks = kstat_create(MODULE_NAME, ddi_get_instance(i40e->i40e_dip),
+	    "statistics", "net", KSTAT_TYPE_NAMED,
+	    sizeof (i40e_kstat_t) / sizeof (kstat_named_t), 0);
+	if (ks == NULL) {
+		i40e_error(i40e, "Could not create kernel statistics.");
+		return (B_FALSE);
+	}
+
+	i40e->i40e_kstats = ks;
+
+	i40e_kstats = (i40e_kstat_t *)ks->ks_data;
+
+	/*
+	 * Initialize all of the statistics now.
+	 */
+	kstat_named_init(&i40e_kstats->link_speed, "link_speed",
+	    KSTAT_DATA_UINT64);
+	/* XXX KEBE SAYS MORE MORE MORE! */
+
+	return (B_TRUE);
+}
+
+/*
+ * For Nemo/GLDv3.
+ */
+int
+i40e_m_stat(void *arg, uint_t stat, uint64_t *val)
+{
+	i40e_t *i40e = (i40e_t *)arg;
+	/* struct i40e_hw *hw = &i40e->i40e_hw_space;
+	   i40e_kstat_t *i40e_kstats; */
+
+	mutex_enter(&i40e->i40e_general_lock);
+
+	if (i40e->i40e_state & I40E_SUSPENDED) {
+		mutex_exit(&i40e->i40e_general_lock);
+		return (ECANCELED);
+	}
+
+	switch (stat) {
+	case MAC_STAT_IFSPEED:
+		*val = i40e->i40e_link_speed * 1000000ull;
+		break;
+
+	/* XXX KEBE SAYS LOTS TO DO HERE... */
+	case MAC_STAT_MULTIRCV:
+	case MAC_STAT_BRDCSTRCV:
+	case MAC_STAT_MULTIXMT:
+	case MAC_STAT_BRDCSTXMT:
+	case MAC_STAT_NORCVBUF:
+	case MAC_STAT_IERRORS:
+	case MAC_STAT_RBYTES:
+	case MAC_STAT_OBYTES:
+	case MAC_STAT_IPACKETS:
+	case MAC_STAT_OPACKETS:
+	/* RFC 1643 stats */
+	case ETHER_STAT_FCS_ERRORS:
+	case ETHER_STAT_TOOLONG_ERRORS:
+	case ETHER_STAT_MACRCV_ERRORS:
+	/* MII/GMII stats */
+	case ETHER_STAT_XCVR_ADDR:
+	case ETHER_STAT_XCVR_ID:
+	case ETHER_STAT_XCVR_INUSE:
+	case ETHER_STAT_CAP_10GFDX:
+	case ETHER_STAT_CAP_1000FDX:
+	case ETHER_STAT_CAP_100FDX:
+	case ETHER_STAT_CAP_ASMPAUSE:
+	case ETHER_STAT_CAP_PAUSE:
+	case ETHER_STAT_CAP_AUTONEG:
+	case ETHER_STAT_ADV_CAP_10GFDX:
+	case ETHER_STAT_ADV_CAP_1000FDX:
+	case ETHER_STAT_ADV_CAP_100FDX:
+	case ETHER_STAT_ADV_CAP_ASMPAUSE:
+	case ETHER_STAT_ADV_CAP_PAUSE:
+	case ETHER_STAT_ADV_CAP_AUTONEG:
+	case ETHER_STAT_LP_CAP_10GFDX:
+	case ETHER_STAT_LP_CAP_1000FDX:
+	case ETHER_STAT_LP_CAP_100FDX:
+	case ETHER_STAT_LP_CAP_ASMPAUSE:
+	case ETHER_STAT_LP_CAP_PAUSE:
+	case ETHER_STAT_LP_CAP_AUTONEG:
+	case ETHER_STAT_LINK_ASMPAUSE:
+	case ETHER_STAT_LINK_PAUSE:
+	case ETHER_STAT_LINK_AUTONEG:
+	case ETHER_STAT_LINK_DUPLEX:
+	case ETHER_STAT_TOOSHORT_ERRORS:
+	case ETHER_STAT_CAP_REMFAULT:
+	case ETHER_STAT_ADV_REMFAULT:
+	case ETHER_STAT_LP_REMFAULT:
+	case ETHER_STAT_JABBER_ERRORS:
+	default:
+		mutex_exit(&i40e->i40e_general_lock);
+		return (ENOTSUP);
+	}
+
+	mutex_exit(&i40e->i40e_general_lock);
+
+	if (i40e_check_acc_handle(i40e->i40e_osdep_space.reg_handle) !=
+	    DDI_FM_OK) {
+		ddi_fm_service_impact(i40e->i40e_dip, DDI_SERVICE_DEGRADED);
+		return (EIO);
+	}
+
+	return (0);
+}
+
+int
+i40e_rx_ring_stat(mac_ring_driver_t rh, uint_t stat, uint64_t *val)
+{
+	i40e_trqpair_t	*itrq = (i40e_trqpair_t *)rh;
+	i40e_t *i40e = itrq->itrq_i40e;
+	int rc = 0;
+
+	if (i40e->i40e_state & I40E_SUSPENDED) {
+		return (ECANCELED);
+	}
+
+	switch (stat) {
+	/* XXX KEBE SAYS FILL ME IN! */
+	case MAC_STAT_RBYTES:
+	case MAC_STAT_IPACKETS:
+	default:
+		*val = 0;
+		rc = ENOTSUP;
+		break;
+	}
+
+	return (rc);
+}
+
+int
+i40e_tx_ring_stat(mac_ring_driver_t rh, uint_t stat, uint64_t *val)
+{
+	i40e_trqpair_t	*itrq = (i40e_trqpair_t *)rh;
+	i40e_t *i40e = itrq->itrq_i40e;
+	int rc = 0;
+
+	if (i40e->i40e_state & I40E_SUSPENDED) {
+		return (ECANCELED);
+	}
+
+	switch (stat) {
+	/* XXX KEBE SAYS FILL ME IN! */
+	case MAC_STAT_OBYTES:
+	case MAC_STAT_OPACKETS:
+	default:
+		*val = 0;
+		rc = ENOTSUP;
+		break;
+	}
+
+	return (rc);
+}
