While researching the race in rx configuration, I came across the following code in e1000.h

#define E1000_DESC_UNUSED(R)                                            \
({                                                                      \
        unsigned int clean = smp_load_acquire(&(R)->next_to_clean);     \
        unsigned int use = READ_ONCE((R)->next_to_use);                 \
        (clean > use ? 0 : (R)->count) + clean - use - 1;               \
})

This looks rather odd in the context of a ring-buffer, in that if next_to_use has wrapped around, the macro will return zero until next_to_clean also wraps around. The latter will presumably occur eventually, so nothing breaks, but it seems to me the macro is miscalculating the number of unused buffers for part of the time, with whatever consequence that has.

Sylvia.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel® Ethernet, visit 
http://communities.intel.com/community/wired

Reply via email to