From owner-svn-src-stable@freebsd.org Fri Dec 2 05:39:11 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E9029C61EFB; Fri, 2 Dec 2016 05:39:11 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A99A61BE6; Fri, 2 Dec 2016 05:39:11 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB25dA7k033316; Fri, 2 Dec 2016 05:39:10 GMT (envelope-from julian@FreeBSD.org) Received: (from julian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB25dAKQ033315; Fri, 2 Dec 2016 05:39:10 GMT (envelope-from julian@FreeBSD.org) Message-Id: <201612020539.uB25dAKQ033315@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: julian set sender to julian@FreeBSD.org using -f From: Julian Elischer Date: Fri, 2 Dec 2016 05:39:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r309388 - stable/10/share/man/man4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Dec 2016 05:39:12 -0000 Author: julian Date: Fri Dec 2 05:39:10 2016 New Revision: 309388 URL: https://svnweb.freebsd.org/changeset/base/309388 Log: MFH: r303613 Man page for the new checksum netgraph module. PR: 206186 Submitted by: Dmitry Vagin Added: stable/10/share/man/man4/ng_checksum.4 - copied unchanged from r303613, head/share/man/man4/ng_checksum.4 Modified: Directory Properties: stable/10/ (props changed) Copied: stable/10/share/man/man4/ng_checksum.4 (from r303613, head/share/man/man4/ng_checksum.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/share/man/man4/ng_checksum.4 Fri Dec 2 05:39:10 2016 (r309388, copy of r303613, head/share/man/man4/ng_checksum.4) @@ -0,0 +1,141 @@ +.\" Copyright (c) 2015 Dmitry Vagin +.\" All rights reserved. +.\" +.\" 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. +.\" +.\" $FreeBSD$ +.\" +.Dd October 29, 2015 +.Dt NG_CHECKSUM 4 +.Os +.Sh NAME +.Nm ng_checksum +.Nd IP checksum node type +.Sh SYNOPSIS +.In netgraph/ng_checksum.h +.Sh DESCRIPTION +The +.Nm checksum +node can calculate and prepare for calculation in hardware +IPv4 header, TCP, UDP checksum. +.Sh HOOKS +This node type has two hooks: +.Bl -tag -width ".Va out" +.It Va in +Packets received on this hook are processed according to settings specified +in config and then forwarded to +.Ar out +hook, if it exists and connected. Otherwise they are reflected back to the +.Ar in +hook. +.It Va out +Packets received on this hook are forwarded to +.Ar in +hook without any changes. +.El +.Sh CONTROL MESSAGES +This node type supports the generic control messages, plus the following: +.Bl -tag -width foo +.It Dv NGM_CHECKSUM_SETDLT Pq Ic setdlt +Sets data link type on the +.Va in +hook. Currently, supported types are +.Cm DLT_RAW +(raw IP datagrams) and +.Cm DLT_EN10MB +(Ethernet). DLT_ definitions can be found in +.In net/bpf.h +header. Currently used values are +.Cm DLT_EN10MB += 1 and +.Cm DLT_RAW += 12. +.It Dv NGM_CHECKSUM_GETDLT Pq Ic getdlt +This control message obtains data link type on the +.Va in +hook. +.It Dv NGM_CHECKSUM_SETCONFIG Pq Ic setconfig +Sets node configuration. The following +.Vt "struct ng_checksum_config" +must be supplied as an argument: +.Bd -literal -offset 4n +struct ng_checksum_config { + uint64_t csum_flags; + uint64_t csum_offload; +}; +.Ed +.Pp +The +.Va csum_flags +can be set to any combination of CSUM_IP, CSUM_TCP, CSUM_UDP, CSUM_TCP_IPV6 and CSUM_UDP_IPV6 +(other values are ignored) for instructing node need calculate the corresponding checksum. +.Pp +The +.Va csum_offload +can be set to any combination of CSUM_IP, CSUM_TCP, CSUM_UDP, CSUM_TCP_IPV6 and CSUM_UDP_IPV6 +(other values are ignored) for instructing node what checksum can calculate in hardware. +.Pp +Also processed any combination of CSUM_IP, CSUM_TCP, CSUM_UDP, CSUM_TCP_IPV6 and CSUM_UDP_IPV6 sets before on mbuf. +.It Dv NGM_CHECKSUM_GETCONFIG Pq Ic getconfig +This control message obtains current node configuration, +returned as +.Vt "struct ng_checksum_config" . +.It Dv NGM_CHECKSUM_GET_STATS Pq Ic getstats +Returns node statistics as a +.Vt "struct ng_checksum_stats" . +.It Dv NGM_CHECKSUM_CLR_STATS Pq Ic clrstats +Clear node statistics. +.It Dv NGM_CHECKSUM_GETCLR_STATS Pq Ic getclrstats +This command is identical to +.Dv NGM_CHECKSUM_GET_STATS , +except that the statistics are also atomically cleared. +.El +.Sh SHUTDOWN +This node shuts down upon receipt of a +.Dv NGM_SHUTDOWN +control message, or when all hooks have been disconnected. +.Sh EXAMPLES +.Xr ngctl 8 +script: +.Bd -literal -offset 4n +/usr/sbin/ngctl -f- <<-SEQ + msg checksum-1: "setdlt 1" + ngctl msg checksum-1: "setconfig { csum_flags=0 csum_offload=6 }" +.Ed +.Pp +Set data link type to +.Cm DLT_EN10MB +(Ethernet), not set additional checksum flags, set hardware +can calculate CSUM_IP_UDP|CSUM_IP_TCP. +.Sh SEE ALSO +.Xr netgraph 4 , +.Xr ng_patch 4 , +.Xr ngctl 8 +.Sh HISTORY +The +.Nm +node type was implemented in +.Fx 10.2 +and first submitted in +.Fx 12.0 . +.Sh AUTHORS +.An "Dmitry Vagin" Aq daemon.hammer@ya.ru .