Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src Pull up following revision(s) (requested by jmcneill in t...



details:   https://anonhg.NetBSD.org/src/rev/7bbd4259aff4
branches:  netbsd-9
changeset: 454621:7bbd4259aff4
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Sep 23 07:04:40 2019 +0000

description:
Pull up following revision(s) (requested by jmcneill in ticket #230):

        sys/dev/pci/files.pci: revision 1.415
        distrib/sets/lists/man/mi: revision 1.1655
        sys/dev/pci/if_mcx.c: revision 1.1
        share/man/man4/Makefile: revision 1.683
        share/man/man4/mcx.4: revision 1.1
        sys/arch/evbarm/conf/GENERIC64: revision 1.107
        sys/dev/pci/files.pci: revision 1.414

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.

add mcx attachment.

Correct mcx comment, drop mii dependency

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/files.pci          |     7 +-
 sys/dev/pci/if_mcx.c           |  6808 ++++++++++++++++++++++++++++++++++++++++
 6 files changed, 6891 insertions(+), 5 deletions(-)

diffs (truncated from 6975 to 300 lines):

diff -r ca76358503f3 -r 7bbd4259aff4 distrib/sets/lists/man/mi
--- a/distrib/sets/lists/man/mi Mon Sep 23 07:00:35 2019 +0000
+++ b/distrib/sets/lists/man/mi Mon Sep 23 07:04:40 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1649 2019/07/25 00:02:56 rmind Exp $
+# $NetBSD: mi,v 1.1649.2.1 2019/09/23 07:04:40 martin 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
@@ -4570,6 +4571,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
@@ -7550,6 +7552,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 ca76358503f3 -r 7bbd4259aff4 share/man/man4/Makefile
--- a/share/man/man4/Makefile   Mon Sep 23 07:00:35 2019 +0000
+++ b/share/man/man4/Makefile   Mon Sep 23 07:04:40 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.680 2019/03/26 12:21:28 pgoyette Exp $
+#      $NetBSD: Makefile,v 1.680.2.1 2019/09/23 07:04:40 martin 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 ca76358503f3 -r 7bbd4259aff4 share/man/man4/mcx.4
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/man/man4/mcx.4      Mon Sep 23 07:04:40 2019 +0000
@@ -0,0 +1,69 @@
+.\" $NetBSD: mcx.4,v 1.1.2.2 2019/09/23 07:04:40 martin 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 ca76358503f3 -r 7bbd4259aff4 sys/arch/evbarm/conf/GENERIC64
--- a/sys/arch/evbarm/conf/GENERIC64    Mon Sep 23 07:00:35 2019 +0000
+++ b/sys/arch/evbarm/conf/GENERIC64    Mon Sep 23 07:04:40 2019 +0000
@@ -1,5 +1,5 @@
 #
-#      $NetBSD: GENERIC64,v 1.103 2019/07/25 00:30:45 jmcneill Exp $
+#      $NetBSD: GENERIC64,v 1.103.2.1 2019/09/23 07:04:40 martin Exp $
 #
 #      GENERIC ARM (aarch64) kernel
 #
@@ -287,6 +287,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 ca76358503f3 -r 7bbd4259aff4 sys/dev/pci/files.pci
--- a/sys/dev/pci/files.pci     Mon Sep 23 07:00:35 2019 +0000
+++ b/sys/dev/pci/files.pci     Mon Sep 23 07:04:40 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.pci,v 1.413 2019/05/08 13:40:18 isaki Exp $
+#      $NetBSD: files.pci,v 1.413.2.1 2019/09/23 07:04:40 martin Exp $
 #
 # Config file and device description for machine-independent PCI code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -701,6 +701,11 @@
                        WM_DISABLE_MSI
                        WM_DISABLE_MSIX
 
+# Mellanox 5th generation Ethernet devices
+device mcx: ether, ifnet, arp
+attach mcx at pci
+file   dev/pci/if_mcx.c                mcx
+
 # Broadcom 570x Gigabit Ethernet
 device bge: ether, ifnet, arp, mii, mii_bitbang
 attach bge at pci
diff -r ca76358503f3 -r 7bbd4259aff4 sys/dev/pci/if_mcx.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/pci/if_mcx.c      Mon Sep 23 07:04:40 2019 +0000
@@ -0,0 +1,6808 @@
+/*     $NetBSD: if_mcx.c,v 1.1.2.2 2019/09/23 07:04:40 martin 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)



Home | Main Index | Thread Index | Old Index