Re: bge bug w/ out of bounds return receiver, staying in rxeof all the time, patch

2002-11-21 Thread Sam Leffler
> I would recommend a committer look this over and 
> commit it. If you wish, I can make the patch *just*
> be the change (changing the 16-bit to 32-bit writes,
> without the VPD stuff), but the other changes seemed
> generally useful.

Please whittle the patch down to just the bug fix; 5.0 is in code freeze.

Sam


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-net" in the body of the message



Re: bge bug w/ out of bounds return receiver, staying in rxeof all the time, patch

2002-11-21 Thread John Polstra
In article <184f01c291c9$147e7100$[EMAIL PROTECTED]>,
Sam Leffler <[EMAIL PROTECTED]> wrote:
> > I would recommend a committer look this over and 
> > commit it. If you wish, I can make the patch *just*
> > be the change (changing the 16-bit to 32-bit writes,
> > without the VPD stuff), but the other changes seemed
> > generally useful.
> 
> Please whittle the patch down to just the bug fix; 5.0 is in code freeze.

Don't worry, Sam.  I'm planning to shepherd this stuff into the
tree, but I don't see it happening for 5.0.

John
-- 
  John Polstra
  John D. Polstra & Co., Inc.Seattle, Washington USA
  "Disappointment is a good sign of basic intelligence."  -- Chögyam Trungpa


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-net" in the body of the message



RE: bge bug w/ out of bounds return receiver, staying in rxeof all the time, patch

2002-11-21 Thread Don Bowman
> From: Sam Leffler [mailto:[EMAIL PROTECTED]]
> > I would recommend a committer look this over and 
> > commit it. If you wish, I can make the patch *just*
> > be the change (changing the 16-bit to 32-bit writes,
> > without the VPD stuff), but the other changes seemed
> > generally useful.
> 
> Please whittle the patch down to just the bug fix; 5.0 is in 
> code freeze.
> 
> Sam
> 

Sigh, I was afraid someone would say that. Will do.
The patch is against RELENG_4, but is fairly trivial. It is below,
just the bug fix is there (changing the writing to the 
receiver control block to be 32-bits all the time).

Patch follows:

Index: if_bge.c
===
RCS file: /cvs/src/sys/dev/bge/if_bge.c,v
retrieving revision 1.3.2.18
diff -U3 -r1.3.2.18 if_bge.c
--- if_bge.c2 Nov 2002 18:22:23 -   1.3.2.18
+++ if_bge.c22 Nov 2002 02:01:48 -
@@ -913,7 +913,7 @@
 {
int i;
struct bge_rcb *rcb;
-   struct bge_rcb_opaque *rcbo;
+   bge_max_len_flags len_flags;
 
for (i = 0; i < BGE_JUMBO_RX_RING_CNT; i++) {
if (bge_newbuf_jumbo(sc, i, NULL) == ENOBUFS)
@@ -923,9 +923,9 @@
sc->bge_jumbo = i - 1;
 
rcb = &sc->bge_rdata->bge_info.bge_jumbo_rx_rcb;
-   rcbo = (struct bge_rcb_opaque *)rcb;
-   rcb->bge_flags = 0;
-   CSR_WRITE_4(sc, BGE_RX_JUMBO_RCB_MAXLEN_FLAGS, rcbo->bge_reg2);
+   len_flags.bge_len_flags = rcb->bge_len_flags.bge_len_flags;
+   len_flags.s.bge_flags = 0;
+   CSR_WRITE_4(sc, BGE_RX_JUMBO_RCB_MAXLEN_FLAGS,
len_flags.bge_len_flags);
 
CSR_WRITE_4(sc, BGE_MBX_RX_JUMBO_PROD_LO, sc->bge_jumbo);
 
@@ -1133,6 +1133,7 @@
struct bge_rcb *rcb;
struct bge_rcb_opaque *rcbo;
int i;
+   bge_max_len_flags len_flags;
 
/*
 * Initialize the memory window pointer register so that
@@ -1202,12 +1203,13 @@
rcb = &sc->bge_rdata->bge_info.bge_std_rx_rcb;
BGE_HOSTADDR(rcb->bge_hostaddr) =
vtophys(&sc->bge_rdata->bge_rx_std_ring);
-   rcb->bge_max_len = BGE_MAX_FRAMELEN;
+   len_flags.s.bge_max_len = BGE_MAX_FRAMELEN;
+   len_flags.s.bge_flags = 0;
+   rcb->bge_len_flags.bge_len_flags = len_flags.bge_len_flags;
if (sc->bge_extram)
rcb->bge_nicaddr = BGE_EXT_STD_RX_RINGS;
else
rcb->bge_nicaddr = BGE_STD_RX_RINGS;
-   rcb->bge_flags = 0;
rcbo = (struct bge_rcb_opaque *)rcb;
CSR_WRITE_4(sc, BGE_RX_STD_RCB_HADDR_HI, rcbo->bge_reg0);
CSR_WRITE_4(sc, BGE_RX_STD_RCB_HADDR_LO, rcbo->bge_reg1);
@@ -1224,12 +1226,13 @@
rcb = &sc->bge_rdata->bge_info.bge_jumbo_rx_rcb;
BGE_HOSTADDR(rcb->bge_hostaddr) =
vtophys(&sc->bge_rdata->bge_rx_jumbo_ring);
-   rcb->bge_max_len = BGE_MAX_FRAMELEN;
+   len_flags.s.bge_max_len = BGE_MAX_FRAMELEN;
+   len_flags.s.bge_flags = BGE_RCB_FLAG_RING_DISABLED;
+   rcb->bge_len_flags.bge_len_flags = len_flags.bge_len_flags;
if (sc->bge_extram)
rcb->bge_nicaddr = BGE_EXT_JUMBO_RX_RINGS;
else
rcb->bge_nicaddr = BGE_JUMBO_RX_RINGS;
-   rcb->bge_flags = BGE_RCB_FLAG_RING_DISABLED;
 
rcbo = (struct bge_rcb_opaque *)rcb;
CSR_WRITE_4(sc, BGE_RX_JUMBO_RCB_HADDR_HI, rcbo->bge_reg0);
@@ -1239,7 +1242,9 @@
 
/* Set up dummy disabled mini ring RCB */
rcb = &sc->bge_rdata->bge_info.bge_mini_rx_rcb;
-   rcb->bge_flags = BGE_RCB_FLAG_RING_DISABLED;
+   len_flags.s.bge_max_len = 0;
+   len_flags.s.bge_flags = BGE_RCB_FLAG_RING_DISABLED;
+   rcb->bge_len_flags.bge_len_flags = len_flags.bge_len_flags;
rcbo = (struct bge_rcb_opaque *)rcb;
CSR_WRITE_4(sc, BGE_RX_MINI_RCB_MAXLEN_FLAGS, rcbo->bge_reg2);
 
@@ -1259,8 +1264,9 @@
rcb = (struct bge_rcb *)(sc->bge_vhandle + BGE_MEMWIN_START +
BGE_SEND_RING_RCB);
for (i = 0; i < BGE_TX_RINGS_EXTSSRAM_MAX; i++) {
-   rcb->bge_flags = BGE_RCB_FLAG_RING_DISABLED;
-   rcb->bge_max_len = 0;
+   len_flags.s.bge_max_len = 0;
+   len_flags.s.bge_flags = BGE_RCB_FLAG_RING_DISABLED;
+   rcb->bge_len_flags.bge_len_flags = len_flags.bge_len_flags;
rcb->bge_nicaddr = 0;
rcb++;
}
@@ -1272,17 +1278,20 @@
BGE_HOSTADDR(rcb->bge_hostaddr) =
vtophys(&sc->bge_rdata->bge_tx_ring);
rcb->bge_nicaddr = BGE_NIC_TXRING_ADDR(0, BGE_TX_RING_CNT);
-   rcb->bge_max_len = BGE_TX_RING_CNT;
-   rcb->bge_flags = 0;
+   len_flags.s.bge_max_len = BGE_TX_RING_CNT;
+   len_flags.s.bge_flags = 0;
+   rcb->bge_len_flags.bge_len_flags = len_flags.bge_len_flags;
 
/* Disable all unused RX return rings */
rcb = (struct bge_rcb *)(sc->bge_vhandle + BGE_MEMWIN_START +
BGE_RX_RETURN_RING_RCB);
-   for (i = 0; i < BGE_RX_RINGS_MAX; i++) {
+   rcb

RE: bge bug w/ out of bounds return receiver, staying in rxeof all the time, patch

2002-11-22 Thread Don Bowman
> From: John Polstra [mailto:[EMAIL PROTECTED]]
> In article <184f01c291c9$147e7100$[EMAIL PROTECTED]>,
> Sam Leffler <[EMAIL PROTECTED]> wrote:
> > > I would recommend a committer look this over and 
> > > commit it. If you wish, I can make the patch *just*
> > > be the change (changing the 16-bit to 32-bit writes,
> > > without the VPD stuff), but the other changes seemed
> > > generally useful.
> > 
> > Please whittle the patch down to just the bug fix; 5.0 is 
> in code freeze.
> 
> Don't worry, Sam.  I'm planning to shepherd this stuff into the
> tree, but I don't see it happening for 5.0.
> 

Be aware that the bge driver is not too useful (and quite dangerous)
without this change.

Personally I'd like to see it go in 4.8.

--don ([EMAIL PROTECTED] www.sandvine.com)



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-net" in the body of the message