[ofa-general] Re: [PATCH] mlx4_ib: fix for bugzilla 1383 (LSO packet processing)

Roland Dreier rdreier at cisco.com
Fri Jan 16 12:10:30 PST 2009


 > > Also is your code missing a memory barrier between the set_data_seg()
 > > loop and the lso_wqe assignment?  It seems that an out-of-order CPU
 > > could make the lso_wqe visible before all the data segments are visible,
 > > so the bug could show up there anyway.

 > The memory barrier is unnecessary -- since the lso segment (without stamping)
 > is written first, then all the data segments are written (wmb() called for each segment),
 > then finally the lso stamping dword.  Thus, this will always follow a wmb().
 > (no one would send an LSO without any data).

By the way, I think this is not quite right... set_data_seg() has a
wmb() but before it writes the byte_count field.  As I see it, a CPU
could make lso_hdr_sz visible before byte_count if we just do

		for (i = wr->num_sge - 1; i >= 0; --i, --dseg)
			set_data_seg(dseg, wr->sg_list + i);

		*lso_wqe = lso_hdr_sz;

and if lso_hdr_sz overwrites the stamping in the cacheline that the
byte_count field is in, then the HCA could prefetch that cacheline with
the wrong byte_count value in it and mess things up.

So I'll merge the patch with the wmb() there, and you can convince me to
get rid of it later if my reasoning is wrong.

 - R.



More information about the general mailing list