From patchwork Thu Nov 9 09:10:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Devesh Sharma X-Patchwork-Id: 10050617 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 86053603FF for ; Thu, 9 Nov 2017 09:18:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C5392AC02 for ; Thu, 9 Nov 2017 09:18:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 714852AC0A; Thu, 9 Nov 2017 09:18:09 +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 1EBED2AC07 for ; Thu, 9 Nov 2017 09:18:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753886AbdKIJRo (ORCPT ); Thu, 9 Nov 2017 04:17:44 -0500 Received: from mail-qt0-f195.google.com ([209.85.216.195]:43354 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753928AbdKIJLQ (ORCPT ); Thu, 9 Nov 2017 04:11:16 -0500 Received: by mail-qt0-f195.google.com with SMTP id j58so6777753qtj.0 for ; Thu, 09 Nov 2017 01:11:16 -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=vV3gpuxX67mmWyTxhU4YYrSFE2GhWL9hiXg8Dl8mEgM=; b=TurwY2RTVzkyFUy5Vs+wkKyTwROxNT8Tgls/wGMFE9BHDp465174OV8L+holSJFgDY 35PaaR2mK7HPQNmJ9gpI1nBUrYiaffvZFw8P8pyt0vCd0u3bUIi02a4DhVaaeuWiHz7S IQ0ei0ohSSCZ9lCkg2G3+QKoop1+Xaxnr1Nqs= 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=vV3gpuxX67mmWyTxhU4YYrSFE2GhWL9hiXg8Dl8mEgM=; b=URhHf6aOPh/mk/8/+zZYmvzYlRETlfoAXzmWlvtv6Qsd/usMYXHsR8UhNLsF5X4EqA 23M3n7QhMHUxqN3uOU4Uw0NTkqD2FzjNSBj5bunXMj071gy/byzBQfmOwhX7/qKaX9ki FBoxtpxHRNw6qOcTYFNQo4vvcwwY9MD3peMiwrIpWsKOckeXuFBpYNdIVQKHx5x5Xrp4 uQro3MdzUB32sJg6CfHbtd+MtwPA6kboLiFtnFTqF6GcodmkPQRWpGrOBqw9WvmUcdkV FndsPJPGX7HQ63Tr33hDU6RgDKvUbUgGN4VsLOqrfk94rYZBpMvif4XmU0hAJFvLCa50 JICA== X-Gm-Message-State: AJaThX4GZQwbF/VODlldEI+zZpO7wMP953+EKgexxW4gysSsNG730ATN 7b75LqQc/mxP9Oy+K25a+2NPtyPW X-Google-Smtp-Source: ABhQp+SWdFLSJks1jcGqt05AlPcmK0LVWFypfqRT5nIABrQSt3r5LZJNxyH2nbHqOa3IMIic1scB6w== X-Received: by 10.200.38.225 with SMTP id 30mr5701364qtp.334.1510218675613; Thu, 09 Nov 2017 01:11:15 -0800 (PST) Received: from neo00-el73.iig.avagotech.net ([192.19.239.250]) by smtp.gmail.com with ESMTPSA id f38sm4307052qtf.17.2017.11.09.01.11.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Nov 2017 01:11:14 -0800 (PST) From: Devesh Sharma To: linux-rdma@vger.kernel.org Cc: dledford@redhat.com, leon@kernel.org, Devesh Sharma Subject: [PATCH rdma-core 1/2] bnxt_re/lib: fix the memory barrier call during poll-cq Date: Thu, 9 Nov 2017 04:10:57 -0500 Message-Id: <1510218658-16710-2-git-send-email-devesh.sharma@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1510218658-16710-1-git-send-email-devesh.sharma@broadcom.com> References: <1510218658-16710-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 operaion 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)