Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Apr 2003 17:55:44 +0200
From:      Maxime Henrion <mux@freebsd.org>
To:        Guido van Rooij <guido@gvr.org>
Cc:        cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/dev/fxp if_fxp.c
Message-ID:  <20030408155544.GE1750@elvis.mu.org>
In-Reply-To: <20030408153625.GA78927@gvr.gvr.org>
References:  <200304081305.h38D5CGH038749@repoman.freebsd.org> <20030408153625.GA78927@gvr.gvr.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Guido van Rooij wrote:
> On Tue, Apr 08, 2003 at 06:05:12AM -0700, Maxime Henrion wrote:
> > mux         2003/04/08 06:05:12 PDT
> > 
> >   FreeBSD src repository
> > 
> >   Modified files:
> >     sys/dev/fxp          if_fxp.c 
> >   Log:
> >   Fix the hangs people have been seeing.  For some reason, the
> >   atomic operation change caused this, so backout it until I
> >   can figure out what's wrong with it.
> 
> FRom the look of it, it seems you have an error in your patch.
> Shouldn't:
> atomic_clear_32((u_int32_t *)&last->tx_cb->cb_status,
> 	    htobe32(bswap16(FXP_CB_COMMAND_S)));
> 
> be:
> 
> atomic_clear_32((u_int32_t *)&last->tx_cb->cb_command,
> 	    htobe32(bswap16(FXP_CB_COMMAND_S)));

No, that would cause an unaligned access.  I'm really modifying
cd_command, which is a 16-bit integer.  However, for this to be
portable, I need to use a 32-bit atomic operation.

I can't do this trick on cb_command's adress because it's 16-bit
aligned, so I'm doing the atomic operation on the 32-bit integer at
cb_status's address which is a 16-bit integer too.

Moreover, if I was doing this on cb_command, which I can't, the
htobe32(bswap16(FXP_CB_COMMAND_S)) wouldn't be good anymore.

Cheers,
Maxime




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