svn commit: r305852 - in head/sys: dev/cxgbe dev/cxgbe/firmware modules/cxgbe modules/cxgbe/if_cc modules/cxgbe/if_ccv

Navdeep Parhar np at FreeBSD.org
Fri Sep 16 00:08:39 UTC 2016


Author: np
Date: Fri Sep 16 00:08:37 2016
New Revision: 305852
URL: https://svnweb.freebsd.org/changeset/base/305852

Log:
  cxgbe(4): Attach to cards with the Terminator 6 ASIC.  T6 cards will
  come up as 't6nex' nexus devices with 'cc' ports hanging off them.
  
  The T6 firmware and configuration files will be added as soon as they
  are released.  For now the driver will try to work with whatever
  firmware and configuration is on the card's flash.
  
  Sponsored by:	Chelsio Communications

Added:
  head/sys/dev/cxgbe/if_cc.c   (contents, props changed)
  head/sys/dev/cxgbe/if_ccv.c   (contents, props changed)
  head/sys/modules/cxgbe/if_cc/
  head/sys/modules/cxgbe/if_cc/Makefile   (contents, props changed)
  head/sys/modules/cxgbe/if_ccv/
  head/sys/modules/cxgbe/if_ccv/Makefile   (contents, props changed)
Modified:
  head/sys/dev/cxgbe/adapter.h
  head/sys/dev/cxgbe/firmware/t4fw_interface.h
  head/sys/dev/cxgbe/t4_iov.c
  head/sys/dev/cxgbe/t4_main.c
  head/sys/dev/cxgbe/t4_tracer.c
  head/sys/dev/cxgbe/t4_vf.c
  head/sys/modules/cxgbe/Makefile

Modified: head/sys/dev/cxgbe/adapter.h
==============================================================================
--- head/sys/dev/cxgbe/adapter.h	Thu Sep 15 22:31:49 2016	(r305851)
+++ head/sys/dev/cxgbe/adapter.h	Fri Sep 16 00:08:37 2016	(r305852)
@@ -752,10 +752,20 @@ struct sge {
 	struct hw_buf_info hw_buf_info[SGE_FLBUF_SIZES];
 };
 
+struct devnames {
+	const char *nexus_name;
+	const char *ifnet_name;
+	const char *vi_ifnet_name;
+	const char *pf03_drv_name;
+	const char *vf_nexus_name;
+	const char *vf_ifnet_name;
+};
+
 struct adapter {
 	SLIST_ENTRY(adapter) link;
 	device_t dev;
 	struct cdev *cdev;
+	const struct devnames *names;
 
 	/* PCIe register resources */
 	int regs_rid;
@@ -1117,6 +1127,7 @@ int t4_os_pci_restore_state(struct adapt
 void t4_os_portmod_changed(const struct adapter *, int);
 void t4_os_link_changed(struct adapter *, int, int, int);
 void t4_iterate(void (*)(struct adapter *, void *), void *);
+void t4_init_devnames(struct adapter *);
 void t4_add_adapter(struct adapter *);
 int t4_detach_common(device_t);
 int t4_filter_rpl(struct sge_iq *, const struct rss_header *, struct mbuf *);

Modified: head/sys/dev/cxgbe/firmware/t4fw_interface.h
==============================================================================
--- head/sys/dev/cxgbe/firmware/t4fw_interface.h	Thu Sep 15 22:31:49 2016	(r305851)
+++ head/sys/dev/cxgbe/firmware/t4fw_interface.h	Fri Sep 16 00:08:37 2016	(r305852)
@@ -9215,6 +9215,11 @@ enum {
 	T5FW_VERSION_MINOR	= 0x05,
 	T5FW_VERSION_MICRO	= 0x25,
 	T5FW_VERSION_BUILD	= 0x00,
+
+	T6FW_VERSION_MAJOR	= 0x00,
+	T6FW_VERSION_MINOR	= 0x00,
+	T6FW_VERSION_MICRO	= 0x00,
+	T6FW_VERSION_BUILD	= 0x00,
 };
 
 enum {

Added: head/sys/dev/cxgbe/if_cc.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/cxgbe/if_cc.c	Fri Sep 16 00:08:37 2016	(r305852)
@@ -0,0 +1,44 @@
+/*-
+ * Copyright (c) 2016 Chelsio Communications, Inc.
+ * All rights reserved.
+ * Written by: Navdeep Parhar <np at FreeBSD.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+
+static int
+mod_event(module_t mod, int cmd, void *arg)
+{
+
+	return (0);
+}
+static moduledata_t if_cc_mod = {"if_cc", mod_event};
+DECLARE_MODULE(if_cc, if_cc_mod, SI_SUB_EXEC, SI_ORDER_ANY);
+MODULE_VERSION(if_cc, 1);
+MODULE_DEPEND(if_cc, cc, 1, 1, 1);

Added: head/sys/dev/cxgbe/if_ccv.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/cxgbe/if_ccv.c	Fri Sep 16 00:08:37 2016	(r305852)
@@ -0,0 +1,44 @@
+/*-
+ * Copyright (c) 2016 Chelsio Communications, Inc.
+ * All rights reserved.
+ * Written by: Navdeep Parhar <np at FreeBSD.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+
+static int
+mod_event(module_t mod, int cmd, void *arg)
+{
+
+	return (0);
+}
+static moduledata_t if_ccv_mod = {"if_ccv", mod_event};
+DECLARE_MODULE(if_ccv, if_ccv_mod, SI_SUB_EXEC, SI_ORDER_ANY);
+MODULE_VERSION(if_ccv, 1);
+MODULE_DEPEND(if_ccv, ccv, 1, 1, 1);

Modified: head/sys/dev/cxgbe/t4_iov.c
==============================================================================
--- head/sys/dev/cxgbe/t4_iov.c	Thu Sep 15 22:31:49 2016	(r305851)
+++ head/sys/dev/cxgbe/t4_iov.c	Fri Sep 16 00:08:37 2016	(r305852)
@@ -90,6 +90,12 @@ struct {
 	{0x500f,  "Chelsio Amsterdam"},
 	{0x5013,  "Chelsio T580-CHR"},
 #endif
+}, t6iov_pciids[] = {
+	{0x6001, "Chelsio T6225-CR"},		/* 2 x 10/25G */
+	{0x6002, "Chelsio T6225-SO-CR"},	/* 2 x 10/25G, nomem */
+	{0x6007, "Chelsio T62100-LP-CR"},	/* 2 x 40/50/100G */
+	{0x6008, "Chelsio T62100-SO-CR"},	/* 2 x 40/50/100G, nomem */
+	{0x600d, "Chelsio T62100-CR"},		/* 2 x 40/50/100G */
 };
 
 static int	t4iov_attach_child(device_t dev);
@@ -129,6 +135,23 @@ t5iov_probe(device_t dev)
 }
 
 static int
+t6iov_probe(device_t dev)
+{
+	uint16_t d;
+	size_t i;
+
+	d = pci_get_device(dev);
+	for (i = 0; i < nitems(t6iov_pciids); i++) {
+		if (d == t6iov_pciids[i].device) {
+			device_set_desc(dev, t6iov_pciids[i].desc);
+			device_quiet(dev);
+			return (BUS_PROBE_DEFAULT);
+		}
+	}
+	return (ENXIO);
+}
+
+static int
 t4iov_attach(device_t dev)
 {
 	struct t4iov_softc *sc;
@@ -288,10 +311,36 @@ static driver_t t5iov_driver = {
 	sizeof(struct t4iov_softc)
 };
 
-static devclass_t t4iov_devclass, t5iov_devclass;
+static device_method_t t6iov_methods[] = {
+	DEVMETHOD(device_probe,		t6iov_probe),
+	DEVMETHOD(device_attach,	t4iov_attach),
+	DEVMETHOD(device_detach,	t4iov_detach),
+
+#ifdef PCI_IOV
+	DEVMETHOD(pci_iov_init,		t4iov_iov_init),
+	DEVMETHOD(pci_iov_uninit,	t4iov_iov_uninit),
+	DEVMETHOD(pci_iov_add_vf,	t4iov_add_vf),
+#endif
+
+	DEVMETHOD(t4_attach_child,	t4iov_attach_child),
+	DEVMETHOD(t4_detach_child,	t4iov_detach_child),
+
+	DEVMETHOD_END
+};
+
+static driver_t t6iov_driver = {
+	"t6iov",
+	t6iov_methods,
+	sizeof(struct t4iov_softc)
+};
+
+static devclass_t t4iov_devclass, t5iov_devclass, t6iov_devclass;
 
 DRIVER_MODULE(t4iov, pci, t4iov_driver, t4iov_devclass, 0, 0);
 MODULE_VERSION(t4iov, 1);
 
 DRIVER_MODULE(t5iov, pci, t5iov_driver, t5iov_devclass, 0, 0);
 MODULE_VERSION(t5iov, 1);
+
+DRIVER_MODULE(t6iov, pci, t6iov_driver, t6iov_devclass, 0, 0);
+MODULE_VERSION(t6iov, 1);

Modified: head/sys/dev/cxgbe/t4_main.c
==============================================================================
--- head/sys/dev/cxgbe/t4_main.c	Thu Sep 15 22:31:49 2016	(r305851)
+++ head/sys/dev/cxgbe/t4_main.c	Fri Sep 16 00:08:37 2016	(r305852)
@@ -174,6 +174,39 @@ static driver_t vcxl_driver = {
 	sizeof(struct vi_info)
 };
 
+/* T6 bus driver interface */
+static int t6_probe(device_t);
+static device_method_t t6_methods[] = {
+	DEVMETHOD(device_probe,		t6_probe),
+	DEVMETHOD(device_attach,	t4_attach),
+	DEVMETHOD(device_detach,	t4_detach),
+
+	DEVMETHOD(t4_is_main_ready,	t4_ready),
+	DEVMETHOD(t4_read_port_device,	t4_read_port_device),
+
+	DEVMETHOD_END
+};
+static driver_t t6_driver = {
+	"t6nex",
+	t6_methods,
+	sizeof(struct adapter)
+};
+
+
+/* T6 port (cc) interface */
+static driver_t cc_driver = {
+	"cc",
+	cxgbe_methods,
+	sizeof(struct port_info)
+};
+
+/* T6 VI (vcc) interface */
+static driver_t vcc_driver = {
+	"vcc",
+	vcxgbe_methods,
+	sizeof(struct vi_info)
+};
+
 /* ifnet + media interface */
 static void cxgbe_init(void *);
 static int cxgbe_ioctl(struct ifnet *, unsigned long, caddr_t);
@@ -567,6 +600,13 @@ struct {
 	{0x540f,  "Chelsio Amsterdam"},
 	{0x5413,  "Chelsio T580-CHR"},
 #endif
+}, t6_pciids[] = {
+	{0xc006, "Chelsio Terminator 6 FPGA"},	/* T6 PE10K6 FPGA (PF0) */
+	{0x6401, "Chelsio T6225-CR"},		/* 2 x 10/25G */
+	{0x6402, "Chelsio T6225-SO-CR"},	/* 2 x 10/25G, nomem */
+	{0x6407, "Chelsio T62100-LP-CR"},	/* 2 x 40/50/100G */
+	{0x6408, "Chelsio T62100-SO-CR"},	/* 2 x 40/50/100G, nomem */
+	{0x640d, "Chelsio T62100-CR"},		/* 2 x 40/50/100G */
 };
 
 #ifdef TCP_OFFLOAD
@@ -629,6 +669,26 @@ t5_probe(device_t dev)
 	return (ENXIO);
 }
 
+static int
+t6_probe(device_t dev)
+{
+	int i;
+	uint16_t v = pci_get_vendor(dev);
+	uint16_t d = pci_get_device(dev);
+
+	if (v != PCI_VENDOR_ID_CHELSIO)
+		return (ENXIO);
+
+	for (i = 0; i < nitems(t6_pciids); i++) {
+		if (d == t6_pciids[i].device) {
+			device_set_desc(dev, t6_pciids[i].desc);
+			return (BUS_PROBE_DEFAULT);
+		}
+	}
+
+	return (ENXIO);
+}
+
 static void
 t5_attribute_workaround(device_t dev)
 {
@@ -656,6 +716,45 @@ t5_attribute_workaround(device_t dev)
 		    device_get_nameunit(root_port));
 }
 
+static const struct devnames devnames[] = {
+	{
+		.nexus_name = "t4nex",
+		.ifnet_name = "cxgbe",
+		.vi_ifnet_name = "vcxgbe",
+		.pf03_drv_name = "t4iov",
+		.vf_nexus_name = "t4vf",
+		.vf_ifnet_name = "cxgbev"
+	}, {
+		.nexus_name = "t5nex",
+		.ifnet_name = "cxl",
+		.vi_ifnet_name = "vcxl",
+		.pf03_drv_name = "t5iov",
+		.vf_nexus_name = "t5vf",
+		.vf_ifnet_name = "cxlv"
+	}, {
+		.nexus_name = "t6nex",
+		.ifnet_name = "cc",
+		.vi_ifnet_name = "vcc",
+		.pf03_drv_name = "t6iov",
+		.vf_nexus_name = "t6vf",
+		.vf_ifnet_name = "ccv"
+	}
+};
+
+void
+t4_init_devnames(struct adapter *sc)
+{
+	int id;
+
+	id = chip_id(sc);
+	if (id >= CHELSIO_T4 && id - CHELSIO_T4 < nitems(devnames))
+		sc->names = &devnames[id - CHELSIO_T4];
+	else {
+		device_printf(sc->dev, "chip id %d is not supported.\n", id);
+		sc->names = NULL;
+	}
+}
+
 static int
 t4_attach(device_t dev)
 {
@@ -733,6 +832,12 @@ t4_attach(device_t dev)
 		goto done;
 	}
 
+	t4_init_devnames(sc);
+	if (sc->names == NULL) {
+		rc = ENOTSUP;
+		goto done; /* error message displayed already */
+	}
+
 	/*
 	 * Do this really early, with the memory windows set up even before the
 	 * character device.  The userland tool's register i/o and mem read
@@ -872,7 +977,7 @@ t4_attach(device_t dev)
 
 		pi->linkdnrc = -1;
 
-		pi->dev = device_add_child(dev, is_t4(sc) ? "cxgbe" : "cxl", -1);
+		pi->dev = device_add_child(dev, sc->names->ifnet_name, -1);
 		if (pi->dev == NULL) {
 			device_printf(dev,
 			    "failed to add device for port %d.\n", i);
@@ -1355,6 +1460,7 @@ static int
 cxgbe_attach(device_t dev)
 {
 	struct port_info *pi = device_get_softc(dev);
+	struct adapter *sc = pi->adapter;
 	struct vi_info *vi;
 	int i, rc;
 
@@ -1367,8 +1473,7 @@ cxgbe_attach(device_t dev)
 	for_each_vi(pi, i, vi) {
 		if (i == 0)
 			continue;
-		vi->dev = device_add_child(dev, is_t4(pi->adapter) ?
-		    "vcxgbe" : "vcxl", -1);
+		vi->dev = device_add_child(dev, sc->names->vi_ifnet_name, -1);
 		if (vi->dev == NULL) {
 			device_printf(dev, "failed to add VI %d\n", i);
 			continue;
@@ -2686,6 +2791,22 @@ struct fw_info {
 			.intfver_fcoepdu = FW_INTFVER(T5, FCOEPDU),
 			.intfver_fcoe = FW_INTFVER(T5, FCOE),
 		},
+	}, {
+		.chip = CHELSIO_T6,
+		.kld_name = "t6fw_cfg",
+		.fw_mod_name = "t6fw",
+		.fw_hdr = {
+			.chip = FW_HDR_CHIP_T6,
+			.fw_ver = htobe32_const(FW_VERSION(T6)),
+			.intfver_nic = FW_INTFVER(T6, NIC),
+			.intfver_vnic = FW_INTFVER(T6, VNIC),
+			.intfver_ofld = FW_INTFVER(T6, OFLD),
+			.intfver_ri = FW_INTFVER(T6, RI),
+			.intfver_iscsipdu = FW_INTFVER(T6, ISCSIPDU),
+			.intfver_iscsi = FW_INTFVER(T6, ISCSI),
+			.intfver_fcoepdu = FW_INTFVER(T6, FCOEPDU),
+			.intfver_fcoe = FW_INTFVER(T6, FCOE),
+		},
 	}
 };
 
@@ -9646,9 +9767,9 @@ done_unload:
 	return (rc);
 }
 
-static devclass_t t4_devclass, t5_devclass;
-static devclass_t cxgbe_devclass, cxl_devclass;
-static devclass_t vcxgbe_devclass, vcxl_devclass;
+static devclass_t t4_devclass, t5_devclass, t6_devclass;
+static devclass_t cxgbe_devclass, cxl_devclass, cc_devclass;
+static devclass_t vcxgbe_devclass, vcxl_devclass, vcc_devclass;
 
 DRIVER_MODULE(t4nex, pci, t4_driver, t4_devclass, mod_event, 0);
 MODULE_VERSION(t4nex, 1);
@@ -9657,7 +9778,6 @@ MODULE_DEPEND(t4nex, firmware, 1, 1, 1);
 MODULE_DEPEND(t4nex, netmap, 1, 1, 1);
 #endif /* DEV_NETMAP */
 
-
 DRIVER_MODULE(t5nex, pci, t5_driver, t5_devclass, mod_event, 0);
 MODULE_VERSION(t5nex, 1);
 MODULE_DEPEND(t5nex, firmware, 1, 1, 1);
@@ -9665,14 +9785,27 @@ MODULE_DEPEND(t5nex, firmware, 1, 1, 1);
 MODULE_DEPEND(t5nex, netmap, 1, 1, 1);
 #endif /* DEV_NETMAP */
 
+DRIVER_MODULE(t6nex, pci, t6_driver, t6_devclass, mod_event, 0);
+MODULE_VERSION(t6nex, 1);
+MODULE_DEPEND(t6nex, firmware, 1, 1, 1);
+#ifdef DEV_NETMAP
+MODULE_DEPEND(t6nex, netmap, 1, 1, 1);
+#endif /* DEV_NETMAP */
+
 DRIVER_MODULE(cxgbe, t4nex, cxgbe_driver, cxgbe_devclass, 0, 0);
 MODULE_VERSION(cxgbe, 1);
 
 DRIVER_MODULE(cxl, t5nex, cxl_driver, cxl_devclass, 0, 0);
 MODULE_VERSION(cxl, 1);
 
+DRIVER_MODULE(cc, t6nex, cc_driver, cc_devclass, 0, 0);
+MODULE_VERSION(cc, 1);
+
 DRIVER_MODULE(vcxgbe, cxgbe, vcxgbe_driver, vcxgbe_devclass, 0, 0);
 MODULE_VERSION(vcxgbe, 1);
 
 DRIVER_MODULE(vcxl, cxl, vcxl_driver, vcxl_devclass, 0, 0);
 MODULE_VERSION(vcxl, 1);
+
+DRIVER_MODULE(vcc, cc, vcc_driver, vcc_devclass, 0, 0);
+MODULE_VERSION(vcc, 1);

Modified: head/sys/dev/cxgbe/t4_tracer.c
==============================================================================
--- head/sys/dev/cxgbe/t4_tracer.c	Thu Sep 15 22:31:49 2016	(r305851)
+++ head/sys/dev/cxgbe/t4_tracer.c	Fri Sep 16 00:08:37 2016	(r305852)
@@ -124,7 +124,8 @@ t4_cloner_match(struct if_clone *ifc, co
 {
 
 	if (strncmp(name, "t4nex", 5) != 0 &&
-	    strncmp(name, "t5nex", 5) != 0)
+	    strncmp(name, "t5nex", 5) != 0 &&
+	    strncmp(name, "t6nex", 5) != 0)
 		return (0);
 	if (name[5] < '0' || name[5] > '9')
 		return (0);

Modified: head/sys/dev/cxgbe/t4_vf.c
==============================================================================
--- head/sys/dev/cxgbe/t4_vf.c	Thu Sep 15 22:31:49 2016	(r305851)
+++ head/sys/dev/cxgbe/t4_vf.c	Fri Sep 16 00:08:37 2016	(r305852)
@@ -111,6 +111,12 @@ struct {
 	{0x580f,  "Chelsio Amsterdam VF"},
 	{0x5813,  "Chelsio T580-CHR VF"},
 #endif
+}, t6vf_pciids[] = {
+	{0x6801, "Chelsio T6225-CR VF"},	/* 2 x 10/25G */
+	{0x6802, "Chelsio T6225-SO-CR VF"},	/* 2 x 10/25G, nomem */
+	{0x6807, "Chelsio T62100-LP-CR VF"},	/* 2 x 40/50/100G */
+	{0x6808, "Chelsio T62100-SO-CR VF"},	/* 2 x 40/50/100G, nomem */
+	{0x680d, "Chelsio T62100-CR VF"},	/* 2 x 40/50/100G */
 };
 
 static d_ioctl_t t4vf_ioctl;
@@ -153,6 +159,22 @@ t5vf_probe(device_t dev)
 	return (ENXIO);
 }
 
+static int
+t6vf_probe(device_t dev)
+{
+	uint16_t d;
+	size_t i;
+
+	d = pci_get_device(dev);
+	for (i = 0; i < nitems(t6vf_pciids); i++) {
+		if (d == t6vf_pciids[i].device) {
+			device_set_desc(dev, t6vf_pciids[i].desc);
+			return (BUS_PROBE_DEFAULT);
+		}
+	}
+	return (ENXIO);
+}
+
 #define FW_PARAM_DEV(param) \
 	(V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | \
 	 V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_##param))
@@ -498,6 +520,12 @@ t4vf_attach(device_t dev)
 	if (rc != 0)
 		goto done;
 
+	t4_init_devnames(sc);
+	if (sc->names == NULL) {
+		rc = ENOTSUP;
+		goto done; /* error message displayed already */
+	}
+
 	/*
 	 * Leave the 'pf' and 'mbox' values as zero.  This ensures
 	 * that various firmware messages do not set the fields which
@@ -642,8 +670,7 @@ t4vf_attach(device_t dev)
 
 		pi->linkdnrc = -1;
 
-		pi->dev = device_add_child(dev, is_t4(sc) ? "cxgbev" : "cxlv",
-		    -1);
+		pi->dev = device_add_child(dev, sc->names->vf_ifnet_name, -1);
 		if (pi->dev == NULL) {
 			device_printf(dev,
 			    "failed to add device for port %d.\n", i);
@@ -920,6 +947,20 @@ static driver_t t5vf_driver = {
 	sizeof(struct adapter)
 };
 
+static device_method_t t6vf_methods[] = {
+	DEVMETHOD(device_probe,		t6vf_probe),
+	DEVMETHOD(device_attach,	t4vf_attach),
+	DEVMETHOD(device_detach,	t4_detach_common),
+
+	DEVMETHOD_END
+};
+
+static driver_t t6vf_driver = {
+	"t6vf",
+	t6vf_methods,
+	sizeof(struct adapter)
+};
+
 static driver_t cxgbev_driver = {
 	"cxgbev",
 	cxgbe_methods,
@@ -932,8 +973,14 @@ static driver_t cxlv_driver = {
 	sizeof(struct port_info)
 };
 
-static devclass_t t4vf_devclass, t5vf_devclass;
-static devclass_t cxgbev_devclass, cxlv_devclass;
+static driver_t ccv_driver = {
+	"ccv",
+	cxgbe_methods,
+	sizeof(struct port_info)
+};
+
+static devclass_t t4vf_devclass, t5vf_devclass, t6vf_devclass;
+static devclass_t cxgbev_devclass, cxlv_devclass, ccv_devclass;
 
 DRIVER_MODULE(t4vf, pci, t4vf_driver, t4vf_devclass, 0, 0);
 MODULE_VERSION(t4vf, 1);
@@ -943,8 +990,15 @@ DRIVER_MODULE(t5vf, pci, t5vf_driver, t5
 MODULE_VERSION(t5vf, 1);
 MODULE_DEPEND(t5vf, t5nex, 1, 1, 1);
 
+DRIVER_MODULE(t6vf, pci, t6vf_driver, t6vf_devclass, 0, 0);
+MODULE_VERSION(t6vf, 1);
+MODULE_DEPEND(t6vf, t6nex, 1, 1, 1);
+
 DRIVER_MODULE(cxgbev, t4vf, cxgbev_driver, cxgbev_devclass, 0, 0);
 MODULE_VERSION(cxgbev, 1);
 
 DRIVER_MODULE(cxlv, t5vf, cxlv_driver, cxlv_devclass, 0, 0);
 MODULE_VERSION(cxlv, 1);
+
+DRIVER_MODULE(ccv, t6vf, ccv_driver, ccv_devclass, 0, 0);
+MODULE_VERSION(ccv, 1);

Modified: head/sys/modules/cxgbe/Makefile
==============================================================================
--- head/sys/modules/cxgbe/Makefile	Thu Sep 15 22:31:49 2016	(r305851)
+++ head/sys/modules/cxgbe/Makefile	Fri Sep 16 00:08:37 2016	(r305852)
@@ -7,8 +7,10 @@ SYSDIR?=${.CURDIR}/../..
 
 SUBDIR=	if_cxgbe
 SUBDIR+=	if_cxl
+SUBDIR+=	if_cc
 SUBDIR+=	if_cxgbev
 SUBDIR+=	if_cxlv
+SUBDIR+=	if_ccv
 SUBDIR+=	t4_firmware
 SUBDIR+=	t5_firmware
 SUBDIR+=	${_tom}

Added: head/sys/modules/cxgbe/if_cc/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/modules/cxgbe/if_cc/Makefile	Fri Sep 16 00:08:37 2016	(r305852)
@@ -0,0 +1,11 @@
+#
+# $FreeBSD$
+#
+
+CXGBE=	${.CURDIR}/../../../dev/cxgbe
+.PATH: ${CXGBE}
+
+KMOD=	if_cc
+SRCS=	if_cc.c
+
+.include <bsd.kmod.mk>

Added: head/sys/modules/cxgbe/if_ccv/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/modules/cxgbe/if_ccv/Makefile	Fri Sep 16 00:08:37 2016	(r305852)
@@ -0,0 +1,11 @@
+#
+# $FreeBSD$
+#
+
+CXGBE=	${.CURDIR}/../../../dev/cxgbe
+.PATH: ${CXGBE}
+
+KMOD=	if_ccv
+SRCS=	if_ccv.c
+
+.include <bsd.kmod.mk>


More information about the svn-src-head mailing list