Re: Token Ring Patch

Steven N. Hirsch (shirsch@ibm.net)
Thu, 22 Aug 1996 07:17:00 -0400


This is a multi-part message in MIME format.

--------------2514E10149D54018101C9E17
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Regis DUCHESNE wrote:
>
> Here we have about 250 TR adapters :
> - IBM 4/16
> don't work under linux here (but we found the driver for
> windows 3.11 :)
>
> - IBM (i don't know the model, but this is a 4Mbit/s, very long adapter)
> We noticed that the "Arrrg 50 ms donald reset..." message appears only
> under heavy load of the adapter : big ftp transfer or x+www...
>
> What a pity because these cards works well under dos and nt.
>
> - IBM 16/4 Adapter II
> Works on dos, nt, linux but only if your card is old enough (chips
> manufacturated in 1989 for example...)
>
> Anyway, three remarks :
> 1 - There is perhaps a race condition due to cpu speed, because
> it's more and more difficult for us to make very recent computers
> work w/ TR.
> 2 - We never manage to use a TR card w/ an asustech motherboard
> 3 - When the DEC Alpha TR driver was in development here, a guy here
> patched the Intel driver to increase the wait : 300ms instead of 50ms.
> He told me that all the "Arrg" disapeared.

Regis,

I was seeing the same problems here with 3Com 3C619 and 619B TR cards. These
are true, 100%, IBM clones using the IBM "Tropic" chipset, BTW. Similarly, I
had come to the same conclusion about a race condition. In my case, the boards
worked fine in a DX2-66 while failing in a DX4-100. The other day, a patch was
posted to this list that seems to have corrected all problems. In case you
missed it, I've attached it here. Good luck, and let us (and the author) know
if it corrects the problem.

- Steve

--

--------------2514E10149D54018101C9E17 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="tokenring.patch"

Date: Tue, 20 Aug 1996 11:28:29 -0700 From: "Paul P. Norton" <pnorton@grumpy.biomed.com> Message-Id: <199608201828.LAA02267@grumpy.biomed.com> To: linux-kernel@vger.rutgers.edu Subject: Token Ring Patch Reply-to: pnorton@cts.com Sender: owner-linux-kernel@vger.rutgers.edu Precedence: bulk X-Mozilla-Status: 0001

This patch fixes:

1. Most (maybe all) token-ring lockups due to the Arrg problem.

2. "Unknown command in asb 08" errors.

3. Incorrect open error code handling.

Thanks to Michael Madore, Christopher A. Smith, James Walter Martin III, Joe Hindsley and Harald Becker for their assistance in debugging this problem.

Please email me at pnorton@cts.com with any problems, questions or comments regarding this patch.

Paul

---- cut here ----

--- v2.0.12/linux/drivers/net/ibmtr.c Mon May 6 02:26:08 1996 +++ linux/drivers/net/ibmtr.c Thu Aug 15 10:58:13 1996 @@ -50,6 +50,11 @@ - detecting PCMCIA Card Removal in interrupt handler. if ISRP is FF, then a PCMCIA card has been removed + Changes by Paul Norton (pnorton@cts.com) : + - restructured the READ.LOG logic to prevent the transmit SRB + from being rudely overwritten before the transmit cycle is + complete. (August 15 1996) + Warnings !!!!!!!!!!!!!! This driver is only partially sanitized for support of multiple adapters. It will almost definitely fail if more than one @@ -168,6 +173,7 @@ static int tok_close(struct device *dev); static int tok_send_packet(struct sk_buff *skb, struct device *dev); static struct enet_statistics * tok_get_stats(struct device *dev); +void tr_readlog(struct device *dev); static struct timer_list tr_timer={NULL,NULL,0,0L,tok_open_adapter}; @@ -331,6 +337,7 @@ memset(ti, 0, sizeof(struct tok_info)); ti->mmio= t_mmio; + ti->readlog_pending = 0; dev->priv = ti; /* this seems like the logical use of the field ... let's try some empirical tests @@ -730,6 +737,7 @@ ti->current_skb=NULL; } dev->tbusy=0; + if (ti->readlog_pending) tr_readlog(dev); } } break; @@ -746,6 +754,7 @@ ti->current_skb=NULL; } dev->tbusy=0; + if (ti->readlog_pending) tr_readlog(dev); } } break; @@ -761,7 +770,7 @@ ti->current_skb=NULL; open_ret_code = readb(ti->init_srb +offsetof(struct srb_open_response, ret_code)); - open_error_code = readw(ti->init_srb +offsetof(struct srb_open_response, error_code)); + open_error_code = ntohs(readw(ti->init_srb +offsetof(struct srb_open_response, error_code))); if (open_ret_code==7) { @@ -774,7 +783,7 @@ DPRINTK("retrying open to adjust to ring speed\n"); else if ((open_error_code==0x2d) && ti->auto_ringspeedsave) DPRINTK("No signal detected for Auto Speed Detection\n"); - else DPRINTK("Unrecoverable error: error code = %02X\n", + else DPRINTK("Unrecoverable error: error code = %04x\n", open_error_code); } else if (!open_ret_code) { @@ -887,10 +896,6 @@ case REC_DATA: case XMIT_UI_FRAME: case XMIT_DIR_FRAME: - if (readb(ti->asb+2)!=0xff) /* checks ret_code */ - DPRINTK("ASB error %02X in cmd %02X\n", - (int)readb(ti->asb+2), - (int)readb(ti->asb)); break; default: @@ -899,6 +904,9 @@ } /* ASB command check */ + if (readb(ti->asb+2)!=0xff) /* checks ret_code */ + DPRINTK("ASB error %02X in cmd %02X\n", + (int)readb(ti->asb+2),(int)readb(ti->asb)); writeb(~ASB_FREE_INT, ti->mmio + ACA_OFFSET + ACA_RESET + ISRP_ODD); } /* ASB response */ @@ -938,14 +946,10 @@ DPRINTK("New ring status: %02X\n", ring_status); if (ring_status & LOG_OVERFLOW) { - - writeb(DIR_READ_LOG, ti->srb); - writeb(INT_ENABLE, - ti->mmio + ACA_OFFSET + ACA_SET + ISRP_EVEN); - writeb(CMD_IN_SRB, - ti->mmio + ACA_OFFSET + ACA_SET + ISRA_ODD); - dev->tbusy=1; /* really srb busy... */ - + if (dev->tbusy) + ti->readlog_pending = 1; + else + tr_readlog(dev); } } break; @@ -1269,6 +1273,7 @@ dev_kfree_skb(ti->current_skb,FREE_WRITE); ti->current_skb=NULL; mark_bh(NET_BH); + if (ti->readlog_pending) tr_readlog(dev); } static void tr_rx(struct device *dev) @@ -1468,7 +1473,18 @@ } return 0; -} +} + +void tr_readlog(struct device *dev) { + struct tok_info *ti; + ti=(struct tok_info *) dev->priv; + + ti->readlog_pending = 0; + writeb(DIR_READ_LOG, ti->srb); + writeb(INT_ENABLE, ti->mmio + ACA_OFFSET + ACA_SET + ISRP_EVEN); + writeb(CMD_IN_SRB, ti->mmio + ACA_OFFSET + ACA_SET + ISRA_ODD); + dev->tbusy=1; /* really srb busy... */ +} /* tok_get_stats(): Basically a scaffold routine which will return the address of the tr_statistics structure associated with --- v2.0.12/linux/drivers/net/ibmtr.h Thu Apr 11 23:49:38 1996 +++ linux/drivers/net/ibmtr.h Thu Aug 15 10:06:06 1996 @@ -206,6 +206,7 @@ struct tr_statistics tr_stats; unsigned char auto_ringspeedsave; open_state open_status; + unsigned char readlog_pending; }; /* token ring adapter commands */

--------------2514E10149D54018101C9E17--