cvs commit: src/sys/dev/fxp if_fxp.c

Maxime Henrion mux at freebsd.org
Tue Apr 8 08:55:44 PDT 2003


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




More information about the cvs-src mailing list