Skip to content

Commit

Permalink
add sume(4)
Browse files Browse the repository at this point in the history
  • Loading branch information
laffer1 committed Sep 20, 2021
1 parent 7afc6ec commit 29cf808
Show file tree
Hide file tree
Showing 12 changed files with 1,994 additions and 22 deletions.
3 changes: 3 additions & 0 deletions share/man/man4/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ MAN= aac.4 \
stf.4 \
stg.4 \
stge.4 \
${_sume.4} \
sym.4 \
syncache.4 \
syncer.4 \
Expand Down Expand Up @@ -884,12 +885,14 @@ _qlxgbe.4= qlxgbe.4
_qlnxe.4= qlnxe.4
_sfxge.4= sfxge.4
_smartpqi.4= smartpqi.4
_sume.4= sume.4

MLINKS+=qlxge.4 if_qlxge.4
MLINKS+=qlxgb.4 if_qlxgb.4
MLINKS+=qlxgbe.4 if_qlxgbe.4
MLINKS+=qlnxe.4 if_qlnxe.4
MLINKS+=sfxge.4 if_sfxge.4
MLINKS+=sume.4 if_sume.4

.if ${MK_BHYVE} != "no"
_bhyve.4= bhyve.4
Expand Down
98 changes: 98 additions & 0 deletions share/man/man4/sume.4
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
.\"-
.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD
.\"
.\" Copyright (c) 2020 Denis Salopek
.\"
.\" 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
.\"
.\" $FreeBSD$
.\"
.Dd August 30, 2020
.Dt SUME 4
.Os
.Sh NAME
.Nm sume
.Nd "NetFPGA SUME 4x10Gb Ethernet driver"
.Sh SYNOPSIS
To compile this driver into the kernel, place the following lines
in your kernel configuration file:
.Bd -ragged -offset indent
.Cd "device sume"
.Ed
.Pp
Alternatively, to load the driver as a module at boot time, place
the following line in
.Xr loader.conf 5 :
.Bd -literal -offset indent
if_sume_load="YES"
.Ed
.Sh DESCRIPTION
The
.Nm
driver provides support for NetFPGA SUME Virtex-7 FPGA Development Board
with the reference NIC bitstream loaded onto it.
The HDL design for the reference NIC project uses the RIFFA based DMA
engine to communicate with the host machine over PCIe.
Every packet is transmitted to / from the board via a single DMA
transaction, taking up to two or three interrupts per one transaction
which yields low performance.
.Pp
There is no support for Jumbo frames as the hardware is capable of
dealing only with frames with maximum size of 1514 bytes.
The hardware does not support multicast filtering, provides no checksums,
and offers no other offloading.
.Sh SEE ALSO
.Xr arp 4 ,
.Xr netgraph 4 ,
.Xr netintro 4 ,
.Xr ng_ether 4 ,
.Xr vlan 4 ,
.Xr ifconfig 8
.Sh AUTHORS
The Linux
.Nm
driver was originally written by
.An -nosplit
.An Bjoern A. Zeeb .
The
.Fx version and this manual page were written by
.An Denis Salopek
as a GSoC project.
More information about the project can be found here:
.Pa https://wiki.freebsd.org/SummerOfCode2020Projects/NetFPGA_SUME_Driver
.Sh BUGS
The reference NIC hardware design provides no mechanism for quiescing
inbound traffic from interfaces configured as DOWN.
All packets from administratively disabled interfaces are transferred to
main memory, leaving the driver with the task of dropping such packets,
thus consuming PCI bandwidth, interrupts and CPU cycles in vain.
.Pp
Pre-built FPGA bitstream from the NetFPGA project may not work correctly.
At higher RX packet rates, the newly incoming packets can overwrite the
ones in an internal FIFO so the packets would arrive in main memory
corrupted, until a physical reset of the board.
.Pp
Occasionally, the driver can get stuck in a non-IDLE TX state due to
a missed interrupt.
The driver includes a watchdog function which monitors for such a
condition and resets the board automatically.
For more details, visit the NetFPGA SUME project site.
9 changes: 8 additions & 1 deletion sys/conf/config.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $FreeBSD: stable/11/sys/conf/config.mk 303314 2016-07-25 18:25:19Z bdrewery $
# $FreeBSD$
#
# Common code to marry kernel config(8) goo and module building goo.
#
Expand All @@ -19,6 +19,10 @@ opt_inet.h:
opt_inet6.h:
@echo "#define INET6 1" > ${.TARGET}
.endif
.if ${MK_IPSEC_SUPPORT} != "no"
opt_ipsec.h:
@echo "#define IPSEC_SUPPORT 1" > ${.TARGET}
.endif
.if ${MK_EISA} != "no"
opt_eisa.h:
@echo "#define DEV_EISA 1" > ${.TARGET}
Expand Down Expand Up @@ -46,6 +50,9 @@ KERN_OPTS+= INET TCP_OFFLOAD
.if ${MK_INET6_SUPPORT} != "no"
KERN_OPTS+= INET6
.endif
.if ${MK_IPSEC_SUPPORT} != "no"
KERN_OPTS+= IPSEC_SUPPORT
.endif
.if ${MK_EISA} != "no"
KERN_OPTS+= DEV_EISA
.endif
Expand Down
2 changes: 1 addition & 1 deletion sys/conf/files
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ contrib/ipfilter/netinet/ip_lookup.c optional ipfilter inet \
contrib/ipfilter/netinet/ip_pool.c optional ipfilter inet \
compile-with "${NORMAL_C} -Wno-unused -I$S/contrib/ipfilter"
contrib/ipfilter/netinet/ip_htable.c optional ipfilter inet \
compile-with "${NORMAL_C} -Wno-unused -I$S/contrib/ipfilter"
compile-with "${NORMAL_C} -Wno-unused -I$S/contrib/ipfilter ${NO_WTAUTOLOGICAL_POINTER_COMPARE}"
contrib/ipfilter/netinet/ip_sync.c optional ipfilter inet \
compile-with "${NORMAL_C} -Wno-unused -I$S/contrib/ipfilter"
contrib/ipfilter/netinet/mlfk_ipl.c optional ipfilter inet \
Expand Down
1 change: 1 addition & 0 deletions sys/conf/files.amd64
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ dev/smartpqi/smartpqi_response.c optional smartpqi
dev/smartpqi/smartpqi_sis.c optional smartpqi
dev/smartpqi/smartpqi_tag.c optional smartpqi
dev/speaker/spkr.c optional speaker
dev/sume/if_sume.c optional sume
dev/syscons/apm/apm_saver.c optional apm_saver apm
dev/syscons/scterm-teken.c optional sc
dev/syscons/scvesactl.c optional sc vga vesa
Expand Down
19 changes: 10 additions & 9 deletions sys/conf/kern.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,25 @@ CWARNFLAGS?= -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \
# kernel where fixing them is more trouble than it is worth, or where there is
# a false positive.
.if ${COMPILER_TYPE} == "clang"
NO_WCONSTANT_CONVERSION= -Wno-constant-conversion
NO_WCONSTANT_CONVERSION= -Wno-error=constant-conversion
NO_WSHIFT_COUNT_NEGATIVE= -Wno-shift-count-negative
NO_WSHIFT_COUNT_OVERFLOW= -Wno-shift-count-overflow
NO_WSELF_ASSIGN= -Wno-self-assign
NO_WUNNEEDED_INTERNAL_DECL= -Wno-unneeded-internal-declaration
NO_WSOMETIMES_UNINITIALIZED= -Wno-error-sometimes-uninitialized
NO_WCAST_QUAL= -Wno-cast-qual
NO_WUNNEEDED_INTERNAL_DECL= -Wno-error=unneeded-internal-declaration
NO_WSOMETIMES_UNINITIALIZED= -Wno-error=sometimes-uninitialized
NO_WCAST_QUAL= -Wno-error=cast-qual
NO_WTAUTOLOGICAL_POINTER_COMPARE= -Wno-tautological-pointer-compare
# Several other warnings which might be useful in some cases, but not severe
# enough to error out the whole kernel build. Display them anyway, so there is
# some incentive to fix them eventually.
CWARNEXTRA?= -Wno-error-tautological-compare -Wno-error-empty-body \
-Wno-error-parentheses-equality -Wno-error-unused-function \
-Wno-error-pointer-sign
CWARNEXTRA?= -Wno-error=tautological-compare -Wno-error=empty-body \
-Wno-error=parentheses-equality -Wno-error=unused-function \
-Wno-error=pointer-sign
.if ${COMPILER_VERSION} >= 30700
CWARNEXTRA+= -Wno-error-shift-negative-value
CWARNEXTRA+= -Wno-error=shift-negative-value
.endif
.if ${COMPILER_VERSION} >= 40000
CWARNEXTRA+= -Wno-error-address-of-packed-member
CWARNEXTRA+= -Wno-address-of-packed-member
.endif
.if ${COMPILER_VERSION} >= 100000
NO_WMISLEADING_INDENTATION= -Wno-misleading-indentation
Expand Down
11 changes: 3 additions & 8 deletions sys/conf/kmod.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# From: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91
# $FreeBSD: stable/11/sys/conf/kmod.mk 352023 2019-09-07 20:01:26Z imp $
# $FreeBSD$
#
# The include file <bsd.kmod.mk> handles building and installing loadable
# kernel modules.
Expand Down Expand Up @@ -69,12 +69,7 @@ KMODUNLOAD?= /sbin/kldunload
KMODISLOADED?= /sbin/kldstat -q -n
OBJCOPY?= objcopy

.include <bsd.init.mk>
# Grab all the options for a kernel build. For backwards compat, we need to
# do this after bsd.own.mk.
.include "kern.opts.mk"
.include <bsd.compiler.mk>
.include "config.mk"
.include "kmod.opts.mk"

# Search for kernel source tree in standard places.
.for _dir in ${.CURDIR}/../.. ${.CURDIR}/../../.. /sys /usr/src/sys
Expand Down Expand Up @@ -228,7 +223,7 @@ ${PROG}.debug: ${FULLPROG}

.if ${__KLD_SHARED} == yes
${FULLPROG}: ${KMOD}.kld
${LD} -m ${LD_EMULATION} -Bshareable -znotext ${_LDFLAGS} \
${LD} -m ${LD_EMULATION} -Bshareable -znotext -znorelro ${_LDFLAGS} \
-o ${.TARGET} ${KMOD}.kld
.if !defined(DEBUG_FLAGS)
${OBJCOPY} --strip-debug ${.TARGET}
Expand Down
14 changes: 14 additions & 0 deletions sys/conf/kmod.opts.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Handle options (KERN_OPTS) for kernel module options. This can be included earlier in a kmod Makefile
# to allow KERN_OPTS to control SRCS, etc.

.if !target(__<kmod.opts.mk>__)
__<kmod.opts.mk>__:

.include <bsd.init.mk>
# Grab all the options for a kernel build. For backwards compat, we need to
# do this after bsd.own.mk.
.include "kern.opts.mk"
.include <bsd.compiler.mk>
.include "config.mk"

.endif # !target(__<kmod.opts.mk>__)
Loading

0 comments on commit 29cf808

Please sign in to comment.