Message ID | 1386899678-18591-8-git-send-email-rmody@brocade.com |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
From: Rasesh Mody <rmody@brocade.com> Date: Thu, 12 Dec 2013 17:54:33 -0800 > Valid bit check for completion needs read fence, so that it does not get > reordered with other loads. > > Signed-off-by: Rasesh Mody <rmody@brocade.com> All memory barriers added to code should have a big, verbose, comment above it explaining exactly what the requirements are that will be satisfied by the memory barrier. Ie. what memory operation must be visible before or after what other memory operation, and why? -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
>From: David Miller [mailto:davem@davemloft.net] >Sent: Friday, December 13, 2013 10:56 PM > >From: Rasesh Mody <rmody@brocade.com> >Date: Thu, 12 Dec 2013 17:54:33 -0800 > >> Valid bit check for completion needs read fence, so that it does not >> get reordered with other loads. >> >> Signed-off-by: Rasesh Mody <rmody@brocade.com> > >All memory barriers added to code should have a big, verbose, comment >above it explaining exactly what the requirements are that will be satisfied by >the memory barrier. > >Ie. what memory operation must be visible before or after what other >memory operation, and why? Resending the patch set with comment included. Thanks, --Rasesh -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index 57f43cc..14b5a9e 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c @@ -601,7 +601,11 @@ bnad_cq_process(struct bnad *bnad, struct bna_ccb *ccb, int budget) cq = ccb->sw_q; cmpl = &cq[ccb->producer_index]; - while (cmpl->valid && (packets < budget)) { + while (packets < budget) { + if (!cmpl->valid) + break; + rmb(); + BNA_UPDATE_PKT_CNT(pkt_rt, ntohs(cmpl->length)); if (bna_is_small_rxq(cmpl->rxq_id)) @@ -641,6 +645,7 @@ bnad_cq_process(struct bnad *bnad, struct bna_ccb *ccb, int budget) if (!next_cmpl->valid) break; + mb(); len = ntohs(next_cmpl->length); flags = ntohl(next_cmpl->flags);
Valid bit check for completion needs read fence, so that it does not get reordered with other loads. Signed-off-by: Rasesh Mody <rmody@brocade.com> --- drivers/net/ethernet/brocade/bna/bnad.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)