netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] tulip: hardware mitigation simplify
@ 2007-12-13 17:35 Stephen Hemminger
  2008-02-11 15:33 ` Jeff Garzik
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2007-12-13 17:35 UTC (permalink / raw)
  To: David S. Miller, Jeff Garzik; +Cc: netdev, kristjan

The hardware mitigation in tulip can be simpified.
1. The budget with new NAPI will always be less than RX_RING_SIZE
   because RX_RING_SIZE is 128 and weight is 16.
2. The received counter is redundunt, just use the work_done value.
3. Only one value is used from the mit_table[]

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
---
This can wait for 2.6.25

--- a/drivers/net/tulip/interrupt.c	2007-12-13 09:26:35.000000000 -0800
+++ b/drivers/net/tulip/interrupt.c	2007-12-13 09:27:29.000000000 -0800
@@ -21,45 +21,6 @@
 int tulip_rx_copybreak;
 unsigned int tulip_max_interrupt_work;
 
-#ifdef CONFIG_TULIP_NAPI_HW_MITIGATION
-#define MIT_SIZE 15
-#define MIT_TABLE 15 /* We use 0 or max */
-
-static unsigned int mit_table[MIT_SIZE+1] =
-{
-        /*  CRS11 21143 hardware Mitigation Control Interrupt
-            We use only RX mitigation we other techniques for
-            TX intr. mitigation.
-
-           31    Cycle Size (timer control)
-           30:27 TX timer in 16 * Cycle size
-           26:24 TX No pkts before Int.
-           23:20 RX timer in Cycle size
-           19:17 RX No pkts before Int.
-           16       Continues Mode (CM)
-        */
-
-        0x0,             /* IM disabled */
-        0x80150000,      /* RX time = 1, RX pkts = 2, CM = 1 */
-        0x80150000,
-        0x80270000,
-        0x80370000,
-        0x80490000,
-        0x80590000,
-        0x80690000,
-        0x807B0000,
-        0x808B0000,
-        0x809D0000,
-        0x80AD0000,
-        0x80BD0000,
-        0x80CF0000,
-        0x80DF0000,
-//       0x80FF0000      /* RX time = 16, RX pkts = 7, CM = 1 */
-        0x80F10000      /* RX time = 16, RX pkts = 0, CM = 1 */
-};
-#endif
-
-
 int tulip_refill_rx(struct net_device *dev)
 {
 	struct tulip_private *tp = netdev_priv(dev);
@@ -113,21 +74,10 @@ int tulip_poll(struct napi_struct *napi,
 	struct net_device *dev = tp->dev;
 	int entry = tp->cur_rx % RX_RING_SIZE;
 	int work_done = 0;
-#ifdef CONFIG_TULIP_NAPI_HW_MITIGATION
-	int received = 0;
-#endif
 
 	if (!netif_running(dev))
 		goto done;
 
-#ifdef CONFIG_TULIP_NAPI_HW_MITIGATION
-
-/* that one buffer is needed for mit activation; or might be a
-   bug in the ring buffer code; check later -- JHS*/
-
-        if (budget >=RX_RING_SIZE) budget--;
-#endif
-
 	if (tulip_debug > 4)
 		printk(KERN_DEBUG " In tulip_rx(), entry %d %8.8x.\n", entry,
 			   tp->rx_ring[entry].status);
@@ -239,9 +189,6 @@ int tulip_poll(struct napi_struct *napi,
                                tp->stats.rx_packets++;
                                tp->stats.rx_bytes += pkt_len;
                        }
-#ifdef CONFIG_TULIP_NAPI_HW_MITIGATION
-		       received++;
-#endif
 
                        entry = (++tp->cur_rx) % RX_RING_SIZE;
                        if (tp->cur_rx - tp->dirty_rx > RX_RING_SIZE/4)
@@ -279,14 +226,14 @@ done:
             ON:  More then 1 pkt received (per intr.) OR we are dropping
              OFF: Only 1 pkt received
 
-             Note. We only use min and max (0, 15) settings from mit_table */
-
+             Note. We only use max or min values for mit */
 
           if( tp->flags &  HAS_INTR_MITIGATION) {
-                 if( received > 1 ) {
+                 if( work_done > 1 ) {
                          if( ! tp->mit_on ) {
                                  tp->mit_on = 1;
-                                 iowrite32(mit_table[MIT_TABLE], tp->base_addr + CSR11);
+				 /* RX time = 16, RX pkts = 0, CM = 1 */
+                                 iowrite32(0x80F10000, tp->base_addr + CSR11);
                          }
                   }
                  else {

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] tulip: hardware mitigation simplify
  2007-12-13 17:35 [PATCH 2/2] tulip: hardware mitigation simplify Stephen Hemminger
@ 2008-02-11 15:33 ` Jeff Garzik
  2008-02-11 15:43   ` Jeff Garzik
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Garzik @ 2008-02-11 15:33 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David S. Miller, Jeff Garzik, netdev, kristjan

Stephen Hemminger wrote:
> The hardware mitigation in tulip can be simpified.
> 1. The budget with new NAPI will always be less than RX_RING_SIZE
>    because RX_RING_SIZE is 128 and weight is 16.
> 2. The received counter is redundunt, just use the work_done value.
> 3. Only one value is used from the mit_table[]
> 
> Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
> ---
> This can wait for 2.6.25
> 
> --- a/drivers/net/tulip/interrupt.c	2007-12-13 09:26:35.000000000 -0800
> +++ b/drivers/net/tulip/interrupt.c	2007-12-13 09:27:29.000000000 -0800
> @@ -21,45 +21,6 @@
>  int tulip_rx_copybreak;
>  unsigned int tulip_max_interrupt_work;
>  
> -#ifdef CONFIG_TULIP_NAPI_HW_MITIGATION
> -#define MIT_SIZE 15
> -#define MIT_TABLE 15 /* We use 0 or max */
> -
> -static unsigned int mit_table[MIT_SIZE+1] =
> -{
> -        /*  CRS11 21143 hardware Mitigation Control Interrupt
> -            We use only RX mitigation we other techniques for
> -            TX intr. mitigation.
> -
> -           31    Cycle Size (timer control)
> -           30:27 TX timer in 16 * Cycle size
> -           26:24 TX No pkts before Int.
> -           23:20 RX timer in Cycle size
> -           19:17 RX No pkts before Int.
> -           16       Continues Mode (CM)
> -        */
> -
> -        0x0,             /* IM disabled */
> -        0x80150000,      /* RX time = 1, RX pkts = 2, CM = 1 */
> -        0x80150000,
> -        0x80270000,
> -        0x80370000,
> -        0x80490000,
> -        0x80590000,
> -        0x80690000,
> -        0x807B0000,
> -        0x808B0000,
> -        0x809D0000,
> -        0x80AD0000,
> -        0x80BD0000,
> -        0x80CF0000,
> -        0x80DF0000,
> -//       0x80FF0000      /* RX time = 16, RX pkts = 7, CM = 1 */
> -        0x80F10000      /* RX time = 16, RX pkts = 0, CM = 1 */
> -};
> -#endif
> -
> -
>  int tulip_refill_rx(struct net_device *dev)
>  {
>  	struct tulip_private *tp = netdev_priv(dev);
> @@ -113,21 +74,10 @@ int tulip_poll(struct napi_struct *napi,
>  	struct net_device *dev = tp->dev;
>  	int entry = tp->cur_rx % RX_RING_SIZE;
>  	int work_done = 0;
> -#ifdef CONFIG_TULIP_NAPI_HW_MITIGATION
> -	int received = 0;
> -#endif
>  
>  	if (!netif_running(dev))
>  		goto done;
>  
> -#ifdef CONFIG_TULIP_NAPI_HW_MITIGATION
> -
> -/* that one buffer is needed for mit activation; or might be a
> -   bug in the ring buffer code; check later -- JHS*/
> -
> -        if (budget >=RX_RING_SIZE) budget--;
> -#endif
> -
>  	if (tulip_debug > 4)
>  		printk(KERN_DEBUG " In tulip_rx(), entry %d %8.8x.\n", entry,
>  			   tp->rx_ring[entry].status);
> @@ -239,9 +189,6 @@ int tulip_poll(struct napi_struct *napi,
>                                 tp->stats.rx_packets++;
>                                 tp->stats.rx_bytes += pkt_len;
>                         }
> -#ifdef CONFIG_TULIP_NAPI_HW_MITIGATION
> -		       received++;
> -#endif
>  
>                         entry = (++tp->cur_rx) % RX_RING_SIZE;
>                         if (tp->cur_rx - tp->dirty_rx > RX_RING_SIZE/4)
> @@ -279,14 +226,14 @@ done:
>              ON:  More then 1 pkt received (per intr.) OR we are dropping
>               OFF: Only 1 pkt received
>  
> -             Note. We only use min and max (0, 15) settings from mit_table */
> -
> +             Note. We only use max or min values for mit */
>  
>            if( tp->flags &  HAS_INTR_MITIGATION) {
> -                 if( received > 1 ) {
> +                 if( work_done > 1 ) {
>                           if( ! tp->mit_on ) {
>                                   tp->mit_on = 1;
> -                                 iowrite32(mit_table[MIT_TABLE], tp->base_addr + CSR11);
> +				 /* RX time = 16, RX pkts = 0, CM = 1 */
> +                                 iowrite32(0x80F10000, tp->base_addr + CSR11);

I think it's disappointing to eliminate mit_table[], because that can be 
modified easily in the current setup



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] tulip: hardware mitigation simplify
  2008-02-11 15:33 ` Jeff Garzik
@ 2008-02-11 15:43   ` Jeff Garzik
  0 siblings, 0 replies; 3+ messages in thread
From: Jeff Garzik @ 2008-02-11 15:43 UTC (permalink / raw)
  To: Stephen Hemminger, David S. Miller; +Cc: netdev, kristjan

Jeff Garzik wrote:
> Stephen Hemminger wrote:
>> The hardware mitigation in tulip can be simpified.
>> 1. The budget with new NAPI will always be less than RX_RING_SIZE
>>    because RX_RING_SIZE is 128 and weight is 16.
>> 2. The received counter is redundunt, just use the work_done value.
>> 3. Only one value is used from the mit_table[]
>>
>> Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>

grrr.  Mozilla Thunderbird is annoying.

Please help me out, and --don't-- reply to jgarzik@dunveganmedia.com. 
T-bird's multi-profile stuff is fouling me up.

Sorry :(

	Jeff



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-02-11 15:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-13 17:35 [PATCH 2/2] tulip: hardware mitigation simplify Stephen Hemminger
2008-02-11 15:33 ` Jeff Garzik
2008-02-11 15:43   ` Jeff Garzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).