Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Modify to make Intel Intel 10G Ethernet (ixg(4)) virtual...
details: https://anonhg.NetBSD.org/src/rev/13ec752083eb
branches: trunk
changeset: 336680:13ec752083eb
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Tue Mar 10 09:26:49 2015 +0000
description:
Modify to make Intel Intel 10G Ethernet (ixg(4)) virtual function ixv(4)
compilable. Not completed yet. It's required to use MSI-X.
diffstat:
sys/arch/amd64/conf/GENERIC | 5 +-
sys/dev/pci/files.pci | 7 +-
sys/dev/pci/ixgbe/ixgbe_vf.h | 7 +-
sys/dev/pci/ixgbe/ixv.c | 1510 ++++++++++++++++++++++++-----------------
sys/dev/pci/ixgbe/ixv.h | 105 +-
5 files changed, 941 insertions(+), 693 deletions(-)
diffs (truncated from 3315 to 300 lines):
diff -r 4a5c537f959d -r 13ec752083eb sys/arch/amd64/conf/GENERIC
--- a/sys/arch/amd64/conf/GENERIC Tue Mar 10 08:54:17 2015 +0000
+++ b/sys/arch/amd64/conf/GENERIC Tue Mar 10 09:26:49 2015 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.410 2015/03/06 15:09:50 riastradh Exp $
+# $NetBSD: GENERIC,v 1.411 2015/03/10 09:26:50 msaitoh Exp $
#
# GENERIC machine description file
#
@@ -22,7 +22,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.410 $"
+#ident "GENERIC-$Revision: 1.411 $"
maxusers 64 # estimated number of users
@@ -736,6 +736,7 @@
iwn* at pci? dev ? function ? # Intel PRO/Wireless 4965AGN
iwm* at pci? dev ? function ? # Intel Centrino 7260
ixg* at pci? dev ? function ? # Intel 8259x 10 gigabit
+#ixv* at pci? dev ? function ? # Intel 8259x 10G virtual function
jme* at pci? dev ? function ? # JMicron JMC2[56]0 ethernet
hme* at pci? dev ? function ? # Sun Microelectronics STP2002-STQ
le* at pci? dev ? function ? # PCnet-PCI Ethernet
diff -r 4a5c537f959d -r 13ec752083eb sys/dev/pci/files.pci
--- a/sys/dev/pci/files.pci Tue Mar 10 08:54:17 2015 +0000
+++ b/sys/dev/pci/files.pci Tue Mar 10 09:26:49 2015 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.pci,v 1.373 2015/02/07 13:20:00 pooka Exp $
+# $NetBSD: files.pci,v 1.374 2015/03/10 09:26:49 msaitoh Exp $
#
# Config file and device description for machine-independent PCI code.
# Included by ports that need it. Requires that the SCSI files be
@@ -676,8 +676,11 @@
file dev/pci/ixgbe/ixgbe_mbx.c ixg
file dev/pci/ixgbe/ixgbe_phy.c ixg
file dev/pci/ixgbe/ixgbe_vf.c ixg
+
# This appears to be the driver for virtual instances of i82599.
-#file dev/pci/ixgbe/ixv.c ixg
+device ixv: ether, ifnet, arp
+attach ixv at pci
+file dev/pci/ixgbe/ixv.c ixv
# Intel i8254x Gigabit Ethernet
device wm: ether, ifnet, arp, mii, mii_bitbang
diff -r 4a5c537f959d -r 13ec752083eb sys/dev/pci/ixgbe/ixgbe_vf.h
--- a/sys/dev/pci/ixgbe/ixgbe_vf.h Tue Mar 10 08:54:17 2015 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_vf.h Tue Mar 10 09:26:49 2015 +0000
@@ -31,7 +31,7 @@
******************************************************************************/
/*$FreeBSD: src/sys/dev/ixgbe/ixgbe_vf.h,v 1.1 2010/11/26 22:46:32 jfv Exp $*/
-/*$NetBSD: ixgbe_vf.h,v 1.1 2011/08/12 21:55:29 dyoung Exp $*/
+/*$NetBSD: ixgbe_vf.h,v 1.2 2015/03/10 09:26:49 msaitoh Exp $*/
#ifndef __IXGBE_VF_H__
#define __IXGBE_VF_H__
@@ -108,6 +108,11 @@
u64 saved_reset_vfgorc;
u64 saved_reset_vfgotc;
u64 saved_reset_vfmprc;
+
+ struct evcnt ipcs;
+ struct evcnt ipcs_bad;
+ struct evcnt l4cs;
+ struct evcnt l4cs_bad;
};
#endif /* __IXGBE_VF_H__ */
diff -r 4a5c537f959d -r 13ec752083eb sys/dev/pci/ixgbe/ixv.c
--- a/sys/dev/pci/ixgbe/ixv.c Tue Mar 10 08:54:17 2015 +0000
+++ b/sys/dev/pci/ixgbe/ixv.c Tue Mar 10 09:26:49 2015 +0000
@@ -31,7 +31,7 @@
******************************************************************************/
/*$FreeBSD: src/sys/dev/ixgbe/ixv.c,v 1.2 2011/03/23 13:10:15 jhb Exp $*/
-/*$NetBSD: ixv.c,v 1.2 2014/03/25 16:19:14 christos Exp $*/
+/*$NetBSD: ixv.c,v 1.3 2015/03/10 09:26:49 msaitoh Exp $*/
#include "opt_inet.h"
@@ -63,17 +63,19 @@
* Table of branding strings
*********************************************************************/
-static char *ixv_strings[] = {
+static const char *ixv_strings[] = {
"Intel(R) PRO/10GbE Virtual Function Network Driver"
};
/*********************************************************************
* Function prototypes
*********************************************************************/
-static int ixv_probe(device_t);
-static int ixv_attach(device_t);
-static int ixv_detach(device_t);
+static int ixv_probe(device_t, cfdata_t, void *);
+static void ixv_attach(device_t, device_t, void *);
+static int ixv_detach(device_t, int);
+#if 0
static int ixv_shutdown(device_t);
+#endif
#if __FreeBSD_version < 800000
static void ixv_start(struct ifnet *);
static void ixv_start_locked(struct tx_ring *, struct ifnet *);
@@ -83,14 +85,15 @@
struct tx_ring *, struct mbuf *);
static void ixv_qflush(struct ifnet *);
#endif
-static int ixv_ioctl(struct ifnet *, u_long, caddr_t);
-static void ixv_init(void *);
+static int ixv_ioctl(struct ifnet *, u_long, void *);
+static int ixv_init(struct ifnet *);
static void ixv_init_locked(struct adapter *);
static void ixv_stop(void *);
static void ixv_media_status(struct ifnet *, struct ifmediareq *);
static int ixv_media_change(struct ifnet *);
static void ixv_identify_hardware(struct adapter *);
-static int ixv_allocate_pci_resources(struct adapter *);
+static int ixv_allocate_pci_resources(struct adapter *,
+ const struct pci_attach_args *);
static int ixv_allocate_msix(struct adapter *);
static int ixv_allocate_queues(struct adapter *);
static int ixv_setup_msix(struct adapter *);
@@ -117,28 +120,31 @@
static void ixv_disable_intr(struct adapter *);
static bool ixv_txeof(struct tx_ring *);
static bool ixv_rxeof(struct ix_queue *, int);
-static void ixv_rx_checksum(u32, struct mbuf *, u32);
+static void ixv_rx_checksum(u32, struct mbuf *, u32,
+ struct ixgbevf_hw_stats *);
static void ixv_set_multi(struct adapter *);
static void ixv_update_link_status(struct adapter *);
static void ixv_refresh_mbufs(struct rx_ring *, int);
-static int ixv_xmit(struct tx_ring *, struct mbuf **);
-static int ixv_sysctl_stats(SYSCTL_HANDLER_ARGS);
-static int ixv_sysctl_debug(SYSCTL_HANDLER_ARGS);
-static int ixv_set_flowcntl(SYSCTL_HANDLER_ARGS);
+static int ixv_xmit(struct tx_ring *, struct mbuf *);
+static int ixv_sysctl_stats(SYSCTLFN_PROTO);
+static int ixv_sysctl_debug(SYSCTLFN_PROTO);
+static int ixv_set_flowcntl(SYSCTLFN_PROTO);
static int ixv_dma_malloc(struct adapter *, bus_size_t,
struct ixv_dma_alloc *, int);
static void ixv_dma_free(struct adapter *, struct ixv_dma_alloc *);
static void ixv_add_rx_process_limit(struct adapter *, const char *,
const char *, int *, int);
-static bool ixv_tx_ctx_setup(struct tx_ring *, struct mbuf *);
+static u32 ixv_tx_ctx_setup(struct tx_ring *, struct mbuf *);
static bool ixv_tso_setup(struct tx_ring *, struct mbuf *, u32 *);
static void ixv_set_ivar(struct adapter *, u8, u8, s8);
static void ixv_configure_ivars(struct adapter *);
static u8 * ixv_mc_array_itr(struct ixgbe_hw *, u8 **, u32 *);
static void ixv_setup_vlan_support(struct adapter *);
+#if 0
static void ixv_register_vlan(void *, struct ifnet *, u16);
static void ixv_unregister_vlan(void *, struct ifnet *, u16);
+#endif
static void ixv_save_stats(struct adapter *);
static void ixv_init_stats(struct adapter *);
@@ -153,13 +159,21 @@
static void ixv_msix_mbx(void *);
/* Deferred interrupt tasklets */
-static void ixv_handle_que(void *, int);
-static void ixv_handle_mbx(void *, int);
+static void ixv_handle_que(void *);
+static void ixv_handle_mbx(void *);
+
+const struct sysctlnode *ixv_sysctl_instance(struct adapter *);
+static ixv_vendor_info_t *ixv_lookup(const struct pci_attach_args *);
/*********************************************************************
* FreeBSD Device Interface Entry Points
*********************************************************************/
+CFATTACH_DECL3_NEW(ixv, sizeof(struct adapter),
+ ixv_probe, ixv_attach, ixv_detach, NULL, NULL, NULL,
+ DVF_DETACH_SHUTDOWN);
+
+# if 0
static device_method_t ixv_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, ixv_probe),
@@ -168,6 +182,7 @@
DEVMETHOD(device_shutdown, ixv_shutdown),
{0, 0}
};
+#endif
#if 0
static driver_t ixv_driver = {
@@ -230,6 +245,9 @@
*/
static u32 ixv_shadow_vfta[VFTA_SIZE];
+/* Keep running tab on them for sanity check */
+static int ixv_total_ports;
+
/*********************************************************************
* Device identification routine
*
@@ -240,44 +258,84 @@
*********************************************************************/
static int
-ixv_probe(device_t dev)
+ixv_probe(device_t dev, cfdata_t cf, void *aux)
{
+ const struct pci_attach_args *pa = aux;
+
+ return (ixv_lookup(pa) != NULL) ? 1 : 0;
+}
+
+static ixv_vendor_info_t *
+ixv_lookup(const struct pci_attach_args *pa)
+{
+ pcireg_t subid;
ixv_vendor_info_t *ent;
- u16 pci_vendor_id = 0;
- u16 pci_device_id = 0;
- u16 pci_subvendor_id = 0;
- u16 pci_subdevice_id = 0;
- char adapter_name[256];
-
-
- pci_vendor_id = pci_get_vendor(dev);
- if (pci_vendor_id != IXGBE_INTEL_VENDOR_ID)
- return (ENXIO);
-
- pci_device_id = pci_get_device(dev);
- pci_subvendor_id = pci_get_subvendor(dev);
- pci_subdevice_id = pci_get_subdevice(dev);
-
- ent = ixv_vendor_info_array;
- while (ent->vendor_id != 0) {
- if ((pci_vendor_id == ent->vendor_id) &&
- (pci_device_id == ent->device_id) &&
-
- ((pci_subvendor_id == ent->subvendor_id) ||
+ INIT_DEBUGOUT("ixv_probe: begin");
+
+ if (PCI_VENDOR(pa->pa_id) != IXGBE_INTEL_VENDOR_ID)
+ return NULL;
+
+ subid = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_SUBSYS_ID_REG);
+
+ for (ent = ixv_vendor_info_array; ent->vendor_id != 0; ent++) {
+ if ((PCI_VENDOR(pa->pa_id) == ent->vendor_id) &&
+ (PCI_PRODUCT(pa->pa_id) == ent->device_id) &&
+
+ ((PCI_SUBSYS_VENDOR(subid) == ent->subvendor_id) ||
(ent->subvendor_id == 0)) &&
- ((pci_subdevice_id == ent->subdevice_id) ||
+ ((PCI_SUBSYS_ID(subid) == ent->subdevice_id) ||
(ent->subdevice_id == 0))) {
- snprintf(adapter_name, sizeof(adapter_name),
- "%s, Version - %s", ixv_strings[ent->index],
- ixv_driver_version);
- device_set_desc_copy(dev, adapter_name);
- return (0);
+ ++ixv_total_ports;
+ return ent;
}
- ent++;
+ }
+ return NULL;
+}
+
+
+static void
+ixv_sysctl_attach(struct adapter *adapter)
+{
+ struct sysctllog **log;
+ const struct sysctlnode *rnode, *cnode;
+ device_t dev;
+
+ dev = adapter->dev;
+ log = &adapter->sysctllog;
+
+ if ((rnode = ixv_sysctl_instance(adapter)) == NULL) {
+ aprint_error_dev(dev, "could not create sysctl root\n");
+ return;
}
- return (ENXIO);
+
+ if (sysctl_createv(log, 0, &rnode, &cnode,
+ CTLFLAG_READWRITE, CTLTYPE_INT,
+ "stats", SYSCTL_DESCR("Statistics"),
+ ixv_sysctl_stats, 0, (void *)adapter, 0, CTL_CREATE, CTL_EOL) != 0)
+ aprint_error_dev(dev, "could not create sysctl\n");
+
+ if (sysctl_createv(log, 0, &rnode, &cnode,
Home |
Main Index |
Thread Index |
Old Index