From owner-svn-src-all@FreeBSD.ORG Wed Mar 25 10:59:25 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9C0F8BD1; Wed, 25 Mar 2015 10:59:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 6D646C94; Wed, 25 Mar 2015 10:59:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t2PAxPK2000590; Wed, 25 Mar 2015 10:59:25 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t2PAxOaj000587; Wed, 25 Mar 2015 10:59:24 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201503251059.t2PAxOaj000587@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 25 Mar 2015 10:59:24 +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: r280557 - stable/10/sys/dev/sfxge X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Mar 2015 10:59:25 -0000 Author: arybchik Date: Wed Mar 25 10:59:24 2015 New Revision: 280557 URL: https://svnweb.freebsd.org/changeset/base/280557 Log: MFC: 279094 sfxge: more accurate calculation of maximum number of TSO segments Sponsored by: Solarflare Communications, Inc. Approved by: gnn (mentor) Modified: stable/10/sys/dev/sfxge/sfxge_tx.c stable/10/sys/dev/sfxge/sfxge_tx.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sfxge/sfxge_tx.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge_tx.c Wed Mar 25 10:58:21 2015 (r280556) +++ stable/10/sys/dev/sfxge/sfxge_tx.c Wed Mar 25 10:59:24 2015 (r280557) @@ -72,10 +72,10 @@ __FBSDID("$FreeBSD$"); * maximum mbuf length we might need more than a ring-ful of * descriptors, but this should not happen in practice except * due to deliberate attack. In that case we will truncate - * the output at a packet boundary. Allow for a reasonable - * minimum MSS of 512. + * the output at a packet boundary. */ -#define SFXGE_TSO_MAX_DESC ((65535 / 512) * 2 + SFXGE_TX_MAPPING_MAX_SEG - 1) +#define SFXGE_TSO_MAX_DESC \ + (SFXGE_TSO_MAX_SEGS * 2 + SFXGE_TX_MAPPING_MAX_SEG - 1) #define SFXGE_TXQ_BLOCK_LEVEL(_entries) ((_entries) - SFXGE_TSO_MAX_DESC) #ifdef SFXGE_HAVE_MQ Modified: stable/10/sys/dev/sfxge/sfxge_tx.h ============================================================================== --- stable/10/sys/dev/sfxge/sfxge_tx.h Wed Mar 25 10:58:21 2015 (r280556) +++ stable/10/sys/dev/sfxge/sfxge_tx.h Wed Mar 25 10:59:24 2015 (r280557) @@ -36,12 +36,22 @@ #include #include +/* Maximum size of TSO packet */ +#define SFXGE_TSO_MAX_SIZE (65535) + +/* + * Maximum number of segments to be created for a TSO packet. + * Allow for a reasonable minimum MSS of 512. + */ +#define SFXGE_TSO_MAX_SEGS howmany(SFXGE_TSO_MAX_SIZE, 512) + /* Maximum number of DMA segments needed to map an mbuf chain. With * TSO, the mbuf length may be just over 64K, divided into 2K mbuf * clusters. (The chain could be longer than this initially, but can * be shortened with m_collapse().) */ -#define SFXGE_TX_MAPPING_MAX_SEG (64 / 2 + 1) +#define SFXGE_TX_MAPPING_MAX_SEG \ + (1 + howmany(SFXGE_TSO_MAX_SIZE, MCLBYTES)) /* * Buffer mapping flags.