em(4) diff to increase TX/RX descriptors used on newer chips

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

em(4) diff to increase TX/RX descriptors used on newer chips

Brad Smith-14
Increase the number of TX/RX descriptors used on 82544 and newer                                                                                                    
chips from 256 to 4096.


Index: if_em.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_em.c,v
retrieving revision 1.85
diff -u -p -r1.85 if_em.c
--- if_em.c 13 Nov 2005 03:48:07 -0000 1.85
+++ if_em.c 13 Nov 2005 04:35:09 -0000
@@ -285,8 +285,12 @@ em_attach(struct device *parent, struct
  /* Initialize eeprom parameters */
  em_init_eeprom_params(&sc->hw);
 
- tsize = EM_ROUNDUP(sc->num_tx_desc * sizeof(struct em_tx_desc),
-    EM_MAX_TXD * sizeof(struct em_tx_desc));
+ if (sc->hw.mac_type >= em_82544)
+    tsize = EM_ROUNDUP(sc->num_tx_desc * sizeof(struct em_tx_desc),
+ EM_TXD_82544 * sizeof(struct em_tx_desc));
+ else
+    tsize = EM_ROUNDUP(sc->num_tx_desc * sizeof(struct em_tx_desc),
+ EM_TXD * sizeof(struct em_tx_desc));
  tsize = EM_ROUNDUP(tsize, PAGE_SIZE);
 
  /* Allocate Transmit Descriptor ring */
@@ -297,8 +301,12 @@ em_attach(struct device *parent, struct
  }
  sc->tx_desc_base = (struct em_tx_desc *)sc->txdma.dma_vaddr;
 
- rsize = EM_ROUNDUP(sc->num_rx_desc * sizeof(struct em_rx_desc),
-    EM_MAX_RXD * sizeof(struct em_rx_desc));
+ if (sc->hw.mac_type >= em_82544)
+    rsize = EM_ROUNDUP(sc->num_rx_desc * sizeof(struct em_rx_desc),
+ EM_RXD_82544 * sizeof(struct em_rx_desc));
+ else
+    rsize = EM_ROUNDUP(sc->num_rx_desc * sizeof(struct em_rx_desc),
+ EM_RXD * sizeof(struct em_rx_desc));
  rsize = EM_ROUNDUP(rsize, PAGE_SIZE);
 
  /* Allocate Receive Descriptor ring */
@@ -607,8 +615,13 @@ em_init(void *arg)
  em_stop(sc);
 
  if (ifp->if_flags & IFF_UP) {
- sc->num_tx_desc = EM_MAX_TXD;
- sc->num_rx_desc = EM_MAX_RXD;
+ if (sc->hw.mac_type >= em_82544) {
+    sc->num_tx_desc = EM_TXD_82544;
+    sc->num_rx_desc = EM_RXD_82544;
+ } else {
+    sc->num_tx_desc = EM_TXD_82544;
+    sc->num_tx_desc = EM_TXD_82544;
+ }
  } else {
  sc->num_tx_desc = EM_MIN_TXD;
  sc->num_rx_desc = EM_MIN_RXD;
Index: if_em.h
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_em.h,v
retrieving revision 1.18
diff -u -p -r1.18 if_em.h
--- if_em.h 13 Nov 2005 03:48:08 -0000 1.18
+++ if_em.h 13 Nov 2005 04:35:09 -0000
@@ -83,7 +83,7 @@ POSSIBILITY OF SUCH DAMAGE.
 /* Tunables */
 
 /*
- * EM_MAX_TXD: Maximum number of Transmit Descriptors
+ * EM_TXD: Maximum number of Transmit Descriptors
  * Valid Range: 80-256 for 82542 and 82543-based adapters
  *              80-4096 for others
  * Default Value: 256
@@ -92,10 +92,11 @@ POSSIBILITY OF SUCH DAMAGE.
  *   descriptor is 16 bytes.
  */
 #define EM_MIN_TXD                      12
-#define EM_MAX_TXD                      256
+#define EM_TXD                          256
+#define EM_TXD_82544                    4096
 
 /*
- * EM_MAX_RXD - Maximum number of receive Descriptors
+ * EM_RXD - Maximum number of receive Descriptors
  * Valid Range: 80-256 for 82542 and 82543-based adapters
  *              80-4096 for others
  * Default Value: 256
@@ -106,7 +107,8 @@ POSSIBILITY OF SUCH DAMAGE.
  *
  */
 #define EM_MIN_RXD                      12
-#define EM_MAX_RXD                      256
+#define EM_RXD                          256
+#define EM_RXD_82544                    4096
 
 /*
  * EM_TIDV - Transmit Interrupt Delay Value
@@ -176,7 +178,7 @@ POSSIBILITY OF SUCH DAMAGE.
  * This parameter controls when the driver calls the routine to reclaim
  * transmit descriptors.
  */
-#define EM_TX_CLEANUP_THRESHOLD         EM_MAX_TXD / 8
+#define EM_TX_CLEANUP_THRESHOLD         (sc->num_tx_desc / 8)
 
 /*
  * This parameter controls whether or not autonegotation is enabled.

Reply | Threaded
Open this post in threaded view
|

Re: em(4) diff to increase TX/RX descriptors used on newer chips

Brad Smith-14
Ignore this diff for now. It'll compile Ok but now that I'm reading
it the day after I can see I was too tired when I sent this out.


On Sun, Nov 13, 2005 at 12:02:46AM -0500, Brad wrote:

> Increase the number of TX/RX descriptors used on 82544 and newer                                                                                                    
> chips from 256 to 4096.
>
>
> Index: if_em.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/pci/if_em.c,v
> retrieving revision 1.85
> diff -u -p -r1.85 if_em.c
> --- if_em.c 13 Nov 2005 03:48:07 -0000 1.85
> +++ if_em.c 13 Nov 2005 04:35:09 -0000
> @@ -285,8 +285,12 @@ em_attach(struct device *parent, struct
>   /* Initialize eeprom parameters */
>   em_init_eeprom_params(&sc->hw);
>  
> - tsize = EM_ROUNDUP(sc->num_tx_desc * sizeof(struct em_tx_desc),
> -    EM_MAX_TXD * sizeof(struct em_tx_desc));
> + if (sc->hw.mac_type >= em_82544)
> +    tsize = EM_ROUNDUP(sc->num_tx_desc * sizeof(struct em_tx_desc),
> + EM_TXD_82544 * sizeof(struct em_tx_desc));
> + else
> +    tsize = EM_ROUNDUP(sc->num_tx_desc * sizeof(struct em_tx_desc),
> + EM_TXD * sizeof(struct em_tx_desc));
>   tsize = EM_ROUNDUP(tsize, PAGE_SIZE);
>  
>   /* Allocate Transmit Descriptor ring */
> @@ -297,8 +301,12 @@ em_attach(struct device *parent, struct
>   }
>   sc->tx_desc_base = (struct em_tx_desc *)sc->txdma.dma_vaddr;
>  
> - rsize = EM_ROUNDUP(sc->num_rx_desc * sizeof(struct em_rx_desc),
> -    EM_MAX_RXD * sizeof(struct em_rx_desc));
> + if (sc->hw.mac_type >= em_82544)
> +    rsize = EM_ROUNDUP(sc->num_rx_desc * sizeof(struct em_rx_desc),
> + EM_RXD_82544 * sizeof(struct em_rx_desc));
> + else
> +    rsize = EM_ROUNDUP(sc->num_rx_desc * sizeof(struct em_rx_desc),
> + EM_RXD * sizeof(struct em_rx_desc));
>   rsize = EM_ROUNDUP(rsize, PAGE_SIZE);
>  
>   /* Allocate Receive Descriptor ring */
> @@ -607,8 +615,13 @@ em_init(void *arg)
>   em_stop(sc);
>  
>   if (ifp->if_flags & IFF_UP) {
> - sc->num_tx_desc = EM_MAX_TXD;
> - sc->num_rx_desc = EM_MAX_RXD;
> + if (sc->hw.mac_type >= em_82544) {
> +    sc->num_tx_desc = EM_TXD_82544;
> +    sc->num_rx_desc = EM_RXD_82544;
> + } else {
> +    sc->num_tx_desc = EM_TXD_82544;
> +    sc->num_tx_desc = EM_TXD_82544;
> + }
>   } else {
>   sc->num_tx_desc = EM_MIN_TXD;
>   sc->num_rx_desc = EM_MIN_RXD;
> Index: if_em.h
> ===================================================================
> RCS file: /cvs/src/sys/dev/pci/if_em.h,v
> retrieving revision 1.18
> diff -u -p -r1.18 if_em.h
> --- if_em.h 13 Nov 2005 03:48:08 -0000 1.18
> +++ if_em.h 13 Nov 2005 04:35:09 -0000
> @@ -83,7 +83,7 @@ POSSIBILITY OF SUCH DAMAGE.
>  /* Tunables */
>  
>  /*
> - * EM_MAX_TXD: Maximum number of Transmit Descriptors
> + * EM_TXD: Maximum number of Transmit Descriptors
>   * Valid Range: 80-256 for 82542 and 82543-based adapters
>   *              80-4096 for others
>   * Default Value: 256
> @@ -92,10 +92,11 @@ POSSIBILITY OF SUCH DAMAGE.
>   *   descriptor is 16 bytes.
>   */
>  #define EM_MIN_TXD                      12
> -#define EM_MAX_TXD                      256
> +#define EM_TXD                          256
> +#define EM_TXD_82544                    4096
>  
>  /*
> - * EM_MAX_RXD - Maximum number of receive Descriptors
> + * EM_RXD - Maximum number of receive Descriptors
>   * Valid Range: 80-256 for 82542 and 82543-based adapters
>   *              80-4096 for others
>   * Default Value: 256
> @@ -106,7 +107,8 @@ POSSIBILITY OF SUCH DAMAGE.
>   *
>   */
>  #define EM_MIN_RXD                      12
> -#define EM_MAX_RXD                      256
> +#define EM_RXD                          256
> +#define EM_RXD_82544                    4096
>  
>  /*
>   * EM_TIDV - Transmit Interrupt Delay Value
> @@ -176,7 +178,7 @@ POSSIBILITY OF SUCH DAMAGE.
>   * This parameter controls when the driver calls the routine to reclaim
>   * transmit descriptors.
>   */
> -#define EM_TX_CLEANUP_THRESHOLD         EM_MAX_TXD / 8
> +#define EM_TX_CLEANUP_THRESHOLD         (sc->num_tx_desc / 8)
>  
>  /*
>   * This parameter controls whether or not autonegotation is enabled.

Reply | Threaded
Open this post in threaded view
|

Re: em(4) diff to increase TX/RX descriptors used on newer chips

Brad Smith-14
On Sun, Nov 13, 2005 at 11:14:14AM -0500, Brad wrote:
> Ignore this diff for now. It'll compile Ok but now that I'm reading
> it the day after I can see I was too tired when I sent this out.
>
>
> On Sun, Nov 13, 2005 at 12:02:46AM -0500, Brad wrote:
> > Increase the number of TX/RX descriptors used on 82544 and newer                                                                                                    
> > chips from 256 to 4096.

Please try this out. For now just the TX descriptors have been increased
from 256 to 4096 on the 82544 revisions of the chip or newer.


Index: if_em.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_em.c,v
retrieving revision 1.89
diff -u -p -r1.89 if_em.c
--- if_em.c 15 Nov 2005 01:40:43 -0000 1.89
+++ if_em.c 15 Nov 2005 01:46:40 -0000
@@ -284,8 +284,12 @@ em_attach(struct device *parent, struct
  /* Initialize eeprom parameters */
  em_init_eeprom_params(&sc->hw);
 
- tsize = EM_ROUNDUP(sc->num_tx_desc * sizeof(struct em_tx_desc),
-    EM_MAX_TXD * sizeof(struct em_tx_desc));
+ if (sc->hw.mac_type >= em_82544)
+    tsize = EM_ROUNDUP(sc->num_tx_desc * sizeof(struct em_tx_desc),
+ EM_MAX_TXD_82544 * sizeof(struct em_tx_desc));
+ else
+    tsize = EM_ROUNDUP(sc->num_tx_desc * sizeof(struct em_tx_desc),
+ EM_MAX_TXD * sizeof(struct em_tx_desc));
  tsize = EM_ROUNDUP(tsize, PAGE_SIZE);
 
  /* Allocate Transmit Descriptor ring */
@@ -605,7 +609,10 @@ em_init(void *arg)
  em_stop(sc);
 
  if (ifp->if_flags & IFF_UP) {
- sc->num_tx_desc = EM_MAX_TXD;
+ if (sc->hw.mac_type >= em_82544)
+    sc->num_tx_desc = EM_MAX_TXD_82544;
+ else
+    sc->num_tx_desc = EM_MAX_TXD;
  sc->num_rx_desc = EM_MAX_RXD;
  } else {
  sc->num_tx_desc = EM_MIN_TXD;
Index: if_em.h
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_em.h,v
retrieving revision 1.18
diff -u -p -r1.18 if_em.h
--- if_em.h 13 Nov 2005 03:48:08 -0000 1.18
+++ if_em.h 15 Nov 2005 01:46:40 -0000
@@ -83,7 +83,7 @@ POSSIBILITY OF SUCH DAMAGE.
 /* Tunables */
 
 /*
- * EM_MAX_TXD: Maximum number of Transmit Descriptors
+ * EM_(MIN/MAX)_TXD: Maximum number of Transmit Descriptors
  * Valid Range: 80-256 for 82542 and 82543-based adapters
  *              80-4096 for others
  * Default Value: 256
@@ -93,9 +93,10 @@ POSSIBILITY OF SUCH DAMAGE.
  */
 #define EM_MIN_TXD                      12
 #define EM_MAX_TXD                      256
+#define EM_MAX_TXD_82544                4096
 
 /*
- * EM_MAX_RXD - Maximum number of receive Descriptors
+ * EM_(MIN/MAX)_RXD - Maximum number of receive Descriptors
  * Valid Range: 80-256 for 82542 and 82543-based adapters
  *              80-4096 for others
  * Default Value: 256
@@ -176,7 +177,7 @@ POSSIBILITY OF SUCH DAMAGE.
  * This parameter controls when the driver calls the routine to reclaim
  * transmit descriptors.
  */
-#define EM_TX_CLEANUP_THRESHOLD         EM_MAX_TXD / 8
+#define EM_TX_CLEANUP_THRESHOLD         (sc->num_tx_desc / 8)
 
 /*
  * This parameter controls whether or not autonegotation is enabled.

Reply | Threaded
Open this post in threaded view
|

Re: em(4) diff to increase TX/RX descriptors used on newer chips

Jon Hart-5
On Tue, Nov 15, 2005 at 01:22:59PM -0500, Brad wrote:

> On Sun, Nov 13, 2005 at 11:14:14AM -0500, Brad wrote:
> > Ignore this diff for now. It'll compile Ok but now that I'm reading
> > it the day after I can see I was too tired when I sent this out.
> >
> >
> > On Sun, Nov 13, 2005 at 12:02:46AM -0500, Brad wrote:
> > > Increase the number of TX/RX descriptors used on 82544 and newer                                                                                                    
> > > chips from 256 to 4096.
>
> Please try this out. For now just the TX descriptors have been increased
> from 256 to 4096 on the 82544 revisions of the chip or newer.

What in particular do you want us to test?  I've got a number of 82546GB
cards.  Most recently purchased dual/quad port Intel pro/1000 cards will
be using this newer chipset based on what I've seen.  Is this going to
fix a particular problem, give better performance under certain
situations, etc?

Just curious.

-jon