Re: [PATCH 2.6] ibmveth bug fixes 4/4

From: Santiago Leon
Date: Tue Aug 10 2004 - 19:41:45 EST


Andrew...

I had discussion over email with Dave Hansen about this patch and after I explained the bug and the fix, he recommended that I include a comment in the patch. So here's an updated patch. Please apply.

--
Santiago A. Leon
Power Linux Development
IBM Linux Technology Center
===== drivers/net/ibmveth.c 1.14 vs edited =====
--- 1.14/drivers/net/ibmveth.c Tue Aug 10 19:09:45 2004
+++ edited/drivers/net/ibmveth.c Tue Aug 10 19:30:10 2004
@@ -271,7 +271,6 @@
adapter->rx_no_buffer = *(u64*)(((char*)adapter->buffer_list_addr) + 4096 - 8);

atomic_inc(&adapter->not_replenishing);
- ibmveth_assert(atomic_read(&adapter->not_replenishing) == 1);
}

/* kick the replenish tasklet if we need replenishing and it isn't already running */
@@ -733,6 +732,14 @@

if(ibmveth_rxq_pending_buffer(adapter)) {
struct sk_buff *skb;
+
+ /* This barrier is necessary because we might be
+ reading a control dword and then reading an old
+ cached correlator dword. Also, the hypervisor
+ guarantees that the control field will be globally
+ visible after all the other fields are visible,
+ */
+ rmb();

if(!ibmveth_rxq_buffer_valid(adapter)) {
wmb(); /* suggested by larson1 */