svn commit: r207083 - in user/jmallett/octeon/sys/mips/cavium: .
octe
Juli Mallett
jmallett at FreeBSD.org
Thu Apr 22 23:58:08 UTC 2010
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
*/
More information about the svn-src-user
mailing list