From owner-svn-src-user@FreeBSD.ORG Sun Nov 18 12:57:59 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4DC96D9E; Sun, 18 Nov 2012 12:57:59 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 19FC38FC13; Sun, 18 Nov 2012 12:57:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAICvwtW028398; Sun, 18 Nov 2012 12:57:58 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAICvwTD028397; Sun, 18 Nov 2012 12:57:58 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201211181257.qAICvwTD028397@svn.freebsd.org> From: Andre Oppermann Date: Sun, 18 Nov 2012 12:57:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r243225 - user/andre/tcp_workqueue/sys/sys X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Nov 2012 12:57:59 -0000 Author: andre Date: Sun Nov 18 12:57:58 2012 New Revision: 243225 URL: http://svnweb.freebsd.org/changeset/base/243225 Log: Extend the checksum offload fields in the mbuf packet header with layer 2-4 header length indicators for the current packet. It is only valid on the down/outbound path with the corresponding csum flags specified. The header length indicators are 8-bit wide and can specify a length of at most 256 bytes per header which is deemed sufficient. The header length indicators are unionized with the csum_data field. This simplifies setup of the offload DMA desriptors in the drivers considerably as they don't have to parse the packet anymore. Adjustments to Ethernet/IP/IPv6/UDP/TCP/SCTP to correctly set and update the header length indicators to follow. Modified: user/andre/tcp_workqueue/sys/sys/mbuf.h Modified: user/andre/tcp_workqueue/sys/sys/mbuf.h ============================================================================== --- user/andre/tcp_workqueue/sys/sys/mbuf.h Sun Nov 18 12:57:32 2012 (r243224) +++ user/andre/tcp_workqueue/sys/sys/mbuf.h Sun Nov 18 12:57:58 2012 (r243225) @@ -120,9 +120,17 @@ struct pkthdr { uint32_t flowid; /* packet's 4-tuple system * flow identifier */ - /* variables for hardware checksum */ - int csum_flags; /* flags regarding checksum */ - int csum_data; /* data field used by csum routines */ + /* Variables for various hardware offload features. */ + int csum_flags; /* flags regarding checksum */ + union { + int cd_data; /* data field for csum routines */ + struct { + uint8_t l2hlen; /* layer 2 header length */ + uint8_t l3hlen; /* layer 3 header length */ + uint8_t l4hlen; /* layer 4 header length */ + uint8_t unused; /* unused */ + } PHCD_hdr; + } PH_cd; u_int16_t tso_segsz; /* TSO segment size */ union { u_int16_t vt_vtag; /* Ethernet 802.1p+q vlan tag */ @@ -130,6 +138,10 @@ struct pkthdr { } PH_vt; SLIST_HEAD(packet_tags, m_tag) tags; /* list of packet tags */ }; +#define csum_data PH_cd.cd_data +#define csum_l2hlen PH_cd.PHCD_hdr.l2hlen +#define csum_l3hlen PH_cd.PHCD_hdr.l3hlen +#define csum_l4hlen PH_cd.PHCD_hdr.l4hlen #define ether_vtag PH_vt.vt_vtag /*