From patchwork Thu Nov 9 11:10:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Devesh Sharma X-Patchwork-Id: 10050791 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 01C9F60381 for ; Thu, 9 Nov 2017 11:11:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E78582AA53 for ; Thu, 9 Nov 2017 11:11:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC9EA2AA56; Thu, 9 Nov 2017 11:11:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64C072AA53 for ; Thu, 9 Nov 2017 11:11:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753955AbdKILLD (ORCPT ); Thu, 9 Nov 2017 06:11:03 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:52172 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752541AbdKILLC (ORCPT ); Thu, 9 Nov 2017 06:11:02 -0500 Received: by mail-wm0-f65.google.com with SMTP id b9so16863039wmh.0 for ; Thu, 09 Nov 2017 03:11:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=hvJ38FAuSfNBP8rhSPTaGiVDaPh0LKe0D887ibQS9Nw=; b=Nksi00+tOomvOAJYbfpykKwoSHRRk96a+Ua6w8dKMzQBDTcCnuvpNxO5BY8B8KVAOE pWP05Cmzw+BeCqdJee0gyEoLWlfrsZCN6T7tL1tH30x/2rqi9JXJpbu8YtC7H7eThuOw adY9fdm7t/Cb0zGuUl9RmlRkVVKqZIBCN/lrI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=hvJ38FAuSfNBP8rhSPTaGiVDaPh0LKe0D887ibQS9Nw=; b=MCIj7ZvIn1dxiozY6VubnWktdKWTPjXTggibpva63pqjXiBYL0eVO4evF76CL5PIon fO4YLnkPB5r+WP15baLxz3GNvBsZc+9IEtY52XFFsh8B/vM7Dc8+r8kitKwaW2/CtzLt 58iJjpEZxmdp47kdpOk2DN1mRudtm6QEvZxUEh1ICIOUMC6vTuf5WOXcoVduUOVxla0q EEgFuQbKTQQ8aH96F6UE9/PiC7MDdSVs87NASFb6eAK22ZvOCJqSvVXsD3PYSadIm3Ju JCbSY3Iq0LZQASzCTwztgfg/4RlksYkcKeSuiOsXMLr/ZrnRlVRIQyBtKr6N88xUufkm L1cg== X-Gm-Message-State: AJaThX6QjrzIz4KxCg5p0JZ8SV8belfbYR+11Ps+8N121XE3/OZfkMlE aU7JhYEAlYcGJ01nQA6myO6RFejU X-Google-Smtp-Source: AGs4zMZuiewmB+Xr7RPwstRDTEjVuZD14gtmmmmiW63xF064HUXK4NgszsuCSRKX2mswTum5b/4APQ== X-Received: by 10.28.173.199 with SMTP id w190mr34877wme.69.1510225861407; Thu, 09 Nov 2017 03:11:01 -0800 (PST) Received: from neo00-el73.iig.avagotech.net ([192.19.239.250]) by smtp.gmail.com with ESMTPSA id t14sm5841718wmc.46.2017.11.09.03.10.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Nov 2017 03:11:00 -0800 (PST) From: Devesh Sharma To: linux-rdma@vger.kernel.org Cc: dledford@redhat.com, leon@kernel.org, Devesh Sharma Subject: [PATCH v1 rdma-core 1/2] bnxt_re/lib: fix the memory barrier call during poll-cq Date: Thu, 9 Nov 2017 06:10:39 -0500 Message-Id: <1510225840-20034-2-git-send-email-devesh.sharma@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1510225840-20034-1-git-send-email-devesh.sharma@broadcom.com> References: <1510225840-20034-1-git-send-email-devesh.sharma@broadcom.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Putting a read barrier before issuing a read on valid bit is incorrect. When checking for the validity of CQE in the CQ buffer the code must wait for the read-barrier to finish after issuing a read operation on CQE valid bit. Signed-off-by: Devesh Sharma --- providers/bnxt_re/main.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/providers/bnxt_re/main.h b/providers/bnxt_re/main.h index 9688fec..82c8948 100644 --- a/providers/bnxt_re/main.h +++ b/providers/bnxt_re/main.h @@ -366,9 +366,13 @@ static inline uint8_t bnxt_re_to_ibv_wc_status(uint8_t bnxt_wcst, static inline uint8_t bnxt_re_is_cqe_valid(struct bnxt_re_cq *cq, struct bnxt_re_bcqe *hdr) { + uint8_t valid = 0; + + valid = ((le32toh(hdr->flg_st_typ_ph) & + BNXT_RE_BCQE_PH_MASK) == cq->phase); udma_from_device_barrier(); - return ((le32toh(hdr->flg_st_typ_ph) & - BNXT_RE_BCQE_PH_MASK) == cq->phase); + + return valid; } static inline void bnxt_re_change_cq_phase(struct bnxt_re_cq *cq)