Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Add support for Mellanox 5th generation ethernet devices. Th...
details: https://anonhg.NetBSD.org/src/rev/46ea8d5bc1d4
branches: trunk
changeset: 459687:46ea8d5bc1d4
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sat Sep 21 14:04:12 2019 +0000
description:
Add support for Mellanox 5th generation ethernet devices. This driver
supports the ConnectX-4 Lx EN, ConnectX-4 EN, ConnectX-5 EN, and
ConnectX-6 EN adapters.
Driver ported from OpenBSD.
diffstat:
distrib/sets/lists/man/mi | 5 +-
share/man/man4/Makefile | 4 +-
share/man/man4/mcx.4 | 69 +
sys/arch/evbarm/conf/GENERIC64 | 3 +-
sys/dev/pci/if_mcx.c | 6808 ++++++++++++++++++++++++++++++++++++++++
5 files changed, 6885 insertions(+), 4 deletions(-)
diffs (truncated from 6954 to 300 lines):
diff -r 283857d6f3e4 -r 46ea8d5bc1d4 distrib/sets/lists/man/mi
--- a/distrib/sets/lists/man/mi Sat Sep 21 12:57:25 2019 +0000
+++ b/distrib/sets/lists/man/mi Sat Sep 21 14:04:12 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1654 2019/09/20 10:34:54 mrg Exp $
+# $NetBSD: mi,v 1.1655 2019/09/21 14:04:12 jmcneill Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -1440,6 +1440,7 @@
./usr/share/man/cat4/mcp3kadc.0 man-sys-catman .cat
./usr/share/man/cat4/mcp48x1dac.0 man-sys-catman .cat
./usr/share/man/cat4/mcp980x.0 man-sys-catman .cat
+./usr/share/man/cat4/mcx.0 man-sys-catman .cat
./usr/share/man/cat4/md.0 man-sys-catman .cat
./usr/share/man/cat4/mfb.0 man-sys-catman .cat
./usr/share/man/cat4/mfi.0 man-sys-catman .cat
@@ -4573,6 +4574,7 @@
./usr/share/man/html4/mcp3kadc.html man-sys-htmlman html
./usr/share/man/html4/mcp48x1dac.html man-sys-htmlman html
./usr/share/man/html4/mcp980x.html man-sys-htmlman html
+./usr/share/man/html4/mcx.html man-sys-htmlman html
./usr/share/man/html4/md.html man-sys-htmlman html
./usr/share/man/html4/mfb.html man-sys-htmlman html
./usr/share/man/html4/mfi.html man-sys-htmlman html
@@ -7556,6 +7558,7 @@
./usr/share/man/man4/mcp3kadc.4 man-sys-man .man
./usr/share/man/man4/mcp48x1dac.4 man-sys-man .man
./usr/share/man/man4/mcp980x.4 man-sys-man .man
+./usr/share/man/man4/mcx.4 man-sys-man .man
./usr/share/man/man4/md.4 man-sys-man .man
./usr/share/man/man4/mfb.4 man-sys-man .man
./usr/share/man/man4/mfi.4 man-sys-man .man
diff -r 283857d6f3e4 -r 46ea8d5bc1d4 share/man/man4/Makefile
--- a/share/man/man4/Makefile Sat Sep 21 12:57:25 2019 +0000
+++ b/share/man/man4/Makefile Sat Sep 21 14:04:12 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.682 2019/09/20 10:34:54 mrg Exp $
+# $NetBSD: Makefile,v 1.683 2019/09/21 14:04:12 jmcneill Exp $
# @(#)Makefile 8.1 (Berkeley) 6/18/93
MAN= aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \
@@ -38,7 +38,7 @@
jme.4 jmide.4 joy.4 \
kcov.4 kloader.4 kse.4 ksyms.4 kttcp.4 \
l2tp.4 lc.4 ld.4 lii.4 lo.4 lua.4 lxtphy.4 \
- mainbus.4 makphy.4 malo.4 mbe.4 mca.4 mcclock.4 md.4 mfb.4 \
+ mainbus.4 makphy.4 malo.4 mbe.4 mca.4 mcclock.4 mcx.4 md.4 mfb.4 \
mfi.4 mfii.4 mhzc.4 \
micphy.4 midi.4 mii.4 mk48txx.4 mlx.4 mly.4 mpls.4 mpii.4 mpt.4 \
mpu.4 mtd.4 mtio.4 msm6242b.4 multicast.4 mvsata.4 \
diff -r 283857d6f3e4 -r 46ea8d5bc1d4 share/man/man4/mcx.4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/share/man/man4/mcx.4 Sat Sep 21 14:04:12 2019 +0000
@@ -0,0 +1,69 @@
+.\" $NetBSD: mcx.4,v 1.1 2019/09/21 14:04:12 jmcneill Exp $
+.\"
+.\" Copyright (c) 2019 David Gwynne <dlg%openbsd.org@localhost>
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.Dd September 21, 2019
+.Dt MCX 4
+.Os
+.Sh NAME
+.Nm mcx
+.Nd Mellanox 5th generation Ethernet device
+.Sh SYNOPSIS
+.Cd "mcx* at pci? dev ? function ?"
+.Sh DESCRIPTION
+The
+.Nm
+driver supports Mellanox 5th generation Ethernet devices.
+Chipsets and cards in this group include:
+.Pp
+.Bl -bullet -offset indent -compact
+.It
+ConnectX-4 Lx EN
+.It
+ConnectX-4 EN
+.It
+ConnectX-5 EN
+.It
+ConnectX-6 EN
+.El
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr ifmedia 4 ,
+.Xr netintro 4 ,
+.Xr pci 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Ox 6.6
+and in
+.Nx 10.0 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Jonathan Matthew
+.Aq Mt jmatthew%openbsd.org@localhost
+and
+.An David Gwynne
+.Aq Mt dlg%openbsd.org@localhost
+for
+.Ox
+and ported to
+.Nx
+by
+.An Jared McNeill
+.Aq Mt jmcneill%NetBSD.org@localhost .
diff -r 283857d6f3e4 -r 46ea8d5bc1d4 sys/arch/evbarm/conf/GENERIC64
--- a/sys/arch/evbarm/conf/GENERIC64 Sat Sep 21 12:57:25 2019 +0000
+++ b/sys/arch/evbarm/conf/GENERIC64 Sat Sep 21 14:04:12 2019 +0000
@@ -1,5 +1,5 @@
#
-# $NetBSD: GENERIC64,v 1.106 2019/09/02 06:08:04 skrll Exp $
+# $NetBSD: GENERIC64,v 1.107 2019/09/21 14:04:12 jmcneill Exp $
#
# GENERIC ARM (aarch64) kernel
#
@@ -290,6 +290,7 @@
awge* at fdt? # DesignWare Gigabit Ethernet
emac* at fdt? # Allwinner Gigabit Ethernet (EMAC)
ena* at pci? dev ? function ? # Amazon.com Elastic Network Adapter
+mcx* at pci? dev ? function ? # Mellanox 5th generation Ethernet
mskc* at pci? dev ? function ? # Marvell Yukon 2 Gigabit Ethernet
msk* at mskc?
re* at pci? dev ? function ? # Realtek RTL8111GS
diff -r 283857d6f3e4 -r 46ea8d5bc1d4 sys/dev/pci/if_mcx.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/pci/if_mcx.c Sat Sep 21 14:04:12 2019 +0000
@@ -0,0 +1,6808 @@
+/* $NetBSD: if_mcx.c,v 1.1 2019/09/21 14:04:12 jmcneill Exp $ */
+/* $OpenBSD: if_mcx.c,v 1.33 2019/09/12 04:23:59 jmatthew Exp $ */
+
+/*
+ * Copyright (c) 2017 David Gwynne <dlg%openbsd.org@localhost>
+ * Copyright (c) 2019 Jonathan Matthew <jmatthew%openbsd.org@localhost>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef _KERNEL_OPT
+#include "opt_net_mpsafe.h"
+#endif
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/sockio.h>
+#include <sys/mbuf.h>
+#include <sys/kernel.h>
+#include <sys/socket.h>
+#include <sys/device.h>
+#include <sys/pool.h>
+#include <sys/queue.h>
+#include <sys/callout.h>
+#include <sys/workqueue.h>
+#include <sys/atomic.h>
+#include <sys/kmem.h>
+#include <sys/bus.h>
+
+#include <machine/intr.h>
+
+#include <net/if.h>
+#include <net/if_dl.h>
+#include <net/if_ether.h>
+#include <net/if_media.h>
+
+#include <net/bpf.h>
+
+#include <netinet/in.h>
+
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pcidevs.h>
+
+#ifdef NET_MPSAFE
+#define MCX_MPSAFE 1
+#define CALLOUT_FLAGS CALLOUT_MPSAFE
+#else
+#define CALLOUT_FLAGS 0
+#endif
+
+#define MCX_MAX_NINTR 1
+
+#define BUS_DMASYNC_PRERW (BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE)
+#define BUS_DMASYNC_POSTRW (BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE)
+
+#define MCX_HCA_BAR PCI_MAPREG_START /* BAR 0 */
+
+#define MCX_FW_VER 0x0000
+#define MCX_FW_VER_MAJOR(_v) ((_v) & 0xffff)
+#define MCX_FW_VER_MINOR(_v) ((_v) >> 16)
+#define MCX_CMDIF_FW_SUBVER 0x0004
+#define MCX_FW_VER_SUBMINOR(_v) ((_v) & 0xffff)
+#define MCX_CMDIF(_v) ((_v) >> 16)
+
+#define MCX_ISSI 1 /* as per the PRM */
+#define MCX_CMD_IF_SUPPORTED 5
+
+#define MCX_HARDMTU 9500
+
+#define MCX_MAX_CQS 2 /* rq, sq */
+
+/* queue sizes */
+#define MCX_LOG_EQ_SIZE 6 /* one page */
+#define MCX_LOG_CQ_SIZE 11
+#define MCX_LOG_RQ_SIZE 10
+#define MCX_LOG_SQ_SIZE 11
+
+/* completion event moderation - about 10khz, or 90% of the cq */
+#define MCX_CQ_MOD_PERIOD 50
+#define MCX_CQ_MOD_COUNTER (((1 << (MCX_LOG_CQ_SIZE - 1)) * 9) / 10)
+
+#define MCX_LOG_SQ_ENTRY_SIZE 6
+#define MCX_SQ_ENTRY_MAX_SLOTS 4
+#define MCX_SQ_SEGS_PER_SLOT \
+ (sizeof(struct mcx_sq_entry) / sizeof(struct mcx_sq_entry_seg))
+#define MCX_SQ_MAX_SEGMENTS \
+ 1 + ((MCX_SQ_ENTRY_MAX_SLOTS-1) * MCX_SQ_SEGS_PER_SLOT)
+
+#define MCX_LOG_FLOW_TABLE_SIZE 5
+#define MCX_NUM_STATIC_FLOWS 4 /* promisc, allmulti, ucast, bcast */
+#define MCX_NUM_MCAST_FLOWS \
+ ((1 << MCX_LOG_FLOW_TABLE_SIZE) - MCX_NUM_STATIC_FLOWS)
+
+#define MCX_SQ_INLINE_SIZE 18
+
+/* doorbell offsets */
+#define MCX_CQ_DOORBELL_OFFSET 0
+#define MCX_CQ_DOORBELL_SIZE 16
+#define MCX_RQ_DOORBELL_OFFSET 64
+#define MCX_SQ_DOORBELL_OFFSET 64
+
+#define MCX_WQ_DOORBELL_MASK 0xffff
+
+/* uar registers */
+#define MCX_UAR_CQ_DOORBELL 0x20
+#define MCX_UAR_EQ_DOORBELL_ARM 0x40
+#define MCX_UAR_EQ_DOORBELL 0x48
+#define MCX_UAR_BF 0x800
+
+#define MCX_CMDQ_ADDR_HI 0x0010
+#define MCX_CMDQ_ADDR_LO 0x0014
+#define MCX_CMDQ_ADDR_NMASK 0xfff
+#define MCX_CMDQ_LOG_SIZE(_v) ((_v) >> 4 & 0xf)
+#define MCX_CMDQ_LOG_STRIDE(_v) ((_v) >> 0 & 0xf)
+#define MCX_CMDQ_INTERFACE_MASK (0x3 << 8)
+#define MCX_CMDQ_INTERFACE_FULL_DRIVER (0x0 << 8)
+#define MCX_CMDQ_INTERFACE_DISABLED (0x1 << 8)
+
+#define MCX_CMDQ_DOORBELL 0x0018
+
+#define MCX_STATE 0x01fc
+#define MCX_STATE_MASK (1 << 31)
+#define MCX_STATE_INITIALIZING (1 << 31)
+#define MCX_STATE_READY (0 << 31)
+#define MCX_STATE_INTERFACE_MASK (0x3 << 24)
+#define MCX_STATE_INTERFACE_FULL_DRIVER (0x0 << 24)
+#define MCX_STATE_INTERFACE_DISABLED (0x1 << 24)
+
+#define MCX_INTERNAL_TIMER 0x1000
+#define MCX_INTERNAL_TIMER_H 0x1000
+#define MCX_INTERNAL_TIMER_L 0x1004
+
+#define MCX_CLEAR_INT 0x100c
+
+#define MCX_REG_OP_WRITE 0
+#define MCX_REG_OP_READ 1
+
+#define MCX_REG_PMLP 0x5002
+#define MCX_REG_PMTU 0x5003
+#define MCX_REG_PTYS 0x5004
+#define MCX_REG_PAOS 0x5006
+#define MCX_REG_PFCC 0x5007
+#define MCX_REG_PPCNT 0x5008
Home |
Main Index |
Thread Index |
Old Index