From owner-svn-src-user@FreeBSD.ORG Thu Apr 22 23:58:08 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F81E1065672; Thu, 22 Apr 2010 23:58:08 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3E0288FC18; Thu, 22 Apr 2010 23:58:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3MNw8DB030666; Thu, 22 Apr 2010 23:58:08 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3MNw836030662; Thu, 22 Apr 2010 23:58:08 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201004222358.o3MNw836030662@svn.freebsd.org> From: Juli Mallett Date: Thu, 22 Apr 2010 23:58:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207083 - in user/jmallett/octeon/sys/mips/cavium: . octe X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 22 Apr 2010 23:58:08 -0000 Author: jmallett Date: Thu Apr 22 23:58:07 2010 New Revision: 207083 URL: http://svn.freebsd.org/changeset/base/207083 Log: o) Reduce the size of packet pool items so that we can use a single mbuf cluster to satisfy it. o) Code to fill the FPA with mbufs. Modified: user/jmallett/octeon/sys/mips/cavium/cvmx_config.h user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mem.c user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c Modified: user/jmallett/octeon/sys/mips/cavium/cvmx_config.h ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/cvmx_config.h Thu Apr 22 23:51:01 2010 (r207082) +++ user/jmallett/octeon/sys/mips/cavium/cvmx_config.h Thu Apr 22 23:58:07 2010 (r207083) @@ -166,7 +166,7 @@ /************************* FPA allocation *********************************/ /* Pool sizes in bytes, must be multiple of a cache line */ -#define CVMX_FPA_POOL_0_SIZE (16 * CVMX_CACHE_LINE_SIZE) +#define CVMX_FPA_POOL_0_SIZE (15 * CVMX_CACHE_LINE_SIZE) #define CVMX_FPA_POOL_1_SIZE (1 * CVMX_CACHE_LINE_SIZE) #define CVMX_FPA_POOL_2_SIZE (8 * CVMX_CACHE_LINE_SIZE) #define CVMX_FPA_POOL_3_SIZE (0 * CVMX_CACHE_LINE_SIZE) Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mem.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mem.c Thu Apr 22 23:51:01 2010 (r207082) +++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mem.c Thu Apr 22 23:58:07 2010 (r207083) @@ -52,20 +52,17 @@ static int cvm_oct_fill_hw_mbuf(int pool { int freed = elements; while (freed) { + KASSERT(size <= MCLBYTES - 128, ("mbuf clusters are too small")); -#if 0 - struct mbuf *m = dev_alloc_m(size + 128); + struct mbuf *m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); if (__predict_false(m == NULL)) { - printf("Failed to allocate m for hardware pool %d\n", pool); + printf("Failed to allocate mbuf for hardware pool %d\n", pool); break; } - m_reserve(m, 128 - (((unsigned long)m->data) & 0x7f)); - *(struct mbuf **)(m->data - sizeof(void *)) = m; - cvmx_fpa_free(m->data, pool, DONT_WRITEBACK(size/128)); -#else - panic("%s: need to implement mbuf allocation.", __func__); -#endif + m->m_data += 128 - (((uintptr_t)m->m_data) & 0x7f); + *(struct mbuf **)(m->m_data - sizeof(void *)) = m; + cvmx_fpa_free(m->m_data, pool, DONT_WRITEBACK(size/128)); freed--; } return (elements - freed); Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c Thu Apr 22 23:51:01 2010 (r207082) +++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c Thu Apr 22 23:58:07 2010 (r207083) @@ -565,7 +565,7 @@ int cvm_oct_transmit_qos(struct ifnet *i /** - * This function frees all m that are currenty queued for TX. + * This function frees all mbufs that are currenty queued for TX. * * @param dev Device being shutdown */