Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Aug 2002 07:51:45 -0700
From:      Luigi Rizzo <rizzo@icir.org>
To:        Andre Song <song@rdsk.net>
Cc:        freebsd-net@FreeBSD.ORG
Subject:   fxp performance (was Re: m_getcl and end-to-end performance)
Message-ID:  <20020821075145.B57063@iguana.icir.org>
In-Reply-To: <3D63A3C2.26A938D4@rdsk.net>; from song@rdsk.net on Wed, Aug 21, 2002 at 10:29:22PM %2B0800
References:  <15714.27671.533860.408996@grasshopper.cs.duke.edu> <20020820093939.B48541@iguana.icir.org> <15714.39494.661931.882244@grasshopper.cs.duke.edu> <20020820132957.B49141@iguana.icir.org> <15714.43504.493596.791872@grasshopper.cs.duke.edu> <20020820135736.A50369@iguana.icir.org> <3D63A3C2.26A938D4@rdsk.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Aug 21, 2002 at 10:29:22PM +0800, Andre Song wrote:
> Hi, Luigi
> 
> Do you have any plan to publish these improvments (extended and
> simplified
> TxCB)? I'm very interesting in them.

excended TxCB are already used by the driver in -current and -stable, if
they are available on the hardware (apparently old chip revisions do
not support them).

The "simplified TxCB" is really just a trick to look good in benchmarks,
but i do not plan to commit it -- it is just ugly and in the end
it does not really help much, because the hardware seems unable to
reach line speed anyways (and no, i am not running out of cpu, an
"em" card on the same machine can push out almost 650kpps).

Anyways, the code below should do -- you can enable/disable it at
runtime with

    sysctl hw.fxp_tx_copy=1

	cheers
	luigi

> Regards,
> song
> 
> Luigi Rizzo wrote:
> > 
>  
> > which gets you close to the max throughput for the chip (not the driver!)
> > used by the "fxp" driver, which is:
> > 
> >     103kpps     with standard TxCB
> >     113kpps     with extended TxCB
> >     127kpps     if you know the above problem, so do not use buffer
> >                 descriptors and copy (small) packets into the TxCB
> > 
> > don't ask me why, i have no docs and no idea

--- if_fxp.c	Sun Aug 11 11:25:43 2002
+++ if_fxp.c.fast	Fri Aug  9 03:50:47 2002
@@ -97,6 +97,9 @@
  * (1536 bytes), if an underrun occurs.
  */
 static int tx_threshold = 64;
+static int tx_copy;
+SYSCTL_INT(_hw, OID_AUTO, fxp_tx_copy, CTLFLAG_RW,
+	&tx_copy, 0, "fxp copy small bufs");
 
 /*
  * The configuration byte map has several undefined fields which
@@ -1046,6 +1051,22 @@
 		 * the transmit buffer descriptors with the physical address
 		 * and size of the mbuf.
 		 */
+#if 1
+		/*
+		 * if it is small, use simple mode and put everything in
+		 * the TxCB
+		 */
+		if (tx_copy && mb_head->m_next == NULL && mb_head->m_len < 128) {
+			int i = sc->flags & FXP_FLAG_EXT_TXCB ? 2 : 0;
+				
+			bcopy(mtod(mb_head, char *),
+				(char *)&(txp->tbd[i]), mb_head->m_len);
+			txp->byte_count = mb_head->m_len;
+			segment = 0;
+			txp->tbd_array_addr = 0xffffffff;
+			goto got_it;
+		}
+#endif
 tbdinit:
 		for (m = mb_head, segment = 0; m != NULL; m = m->m_next) {
 			if (m->m_len != 0) {
@@ -1086,16 +1107,24 @@
 			goto tbdinit;
 		}
 
+		if (sc->flags & FXP_FLAG_EXT_TXCB)
+			txp->tbd_array_addr = vtophys(&txp->tbd[2]);
+		else
+			txp->tbd_array_addr = vtophys(&txp->tbd[0]);
+		txp->byte_count = 0;
+got_it:
 		txp->tbd_number = segment;
 		txp->mb_head = mb_head;
 		txp->cb_status = 0;
 		if (sc->tx_queued != FXP_CXINT_THRESH - 1) {
 			txp->cb_command =
-			    FXP_CB_COMMAND_XMIT | FXP_CB_COMMAND_SF |
+			    FXP_CB_COMMAND_XMIT |
+				(segment ? FXP_CB_COMMAND_SF:0) |
 			    FXP_CB_COMMAND_S;
 		} else {
 			txp->cb_command =
-			    FXP_CB_COMMAND_XMIT | FXP_CB_COMMAND_SF |
+			    FXP_CB_COMMAND_XMIT |
+				(segment ? FXP_CB_COMMAND_SF:0) |
 			    FXP_CB_COMMAND_S | FXP_CB_COMMAND_I;
 			/*
 			 * Set a 5 second timer just in case we don't hear

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020821075145.B57063>