From patchwork Fri May 12 10:24:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Devesh Sharma X-Patchwork-Id: 9723875 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 C18DB600CB for ; Fri, 12 May 2017 10:24:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B613C287F3 for ; Fri, 12 May 2017 10:24:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AAEE428801; Fri, 12 May 2017 10:24:48 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,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 9DC40287FB for ; Fri, 12 May 2017 10:24:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756901AbdELKYq (ORCPT ); Fri, 12 May 2017 06:24:46 -0400 Received: from mail-pf0-f178.google.com ([209.85.192.178]:33913 "EHLO mail-pf0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756911AbdELKYp (ORCPT ); Fri, 12 May 2017 06:24:45 -0400 Received: by mail-pf0-f178.google.com with SMTP id e64so28168528pfd.1 for ; Fri, 12 May 2017 03:24:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=9sqOjUqy+R+zzpgOGpnW6B6cB5am7XSloBhYvfshjAY=; b=R8Gj1EfAso98ygx3oQdGX+9A5Ds8Muv4rZe8i75lkkB+AgRbpFqSr78tESOhxC1CQp 9WWe3vleqck2Uw5KuuPJIcf2xudoVFVyLgpTJxH8NmXse14gWPyakrBecb4+dlcsalFK ltTJTCPZzYCfjFj998iud00mbw7bu6gu9649w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=9sqOjUqy+R+zzpgOGpnW6B6cB5am7XSloBhYvfshjAY=; b=bP5CxgUTQZ0Nl+Y48pEOj2+FF1Fz//cNYNurCgpqeKKk+zTVbRrPWsgLfQdhguKvYq TKzrVwmsmlkfHCUDL2LBtMNoOuTHJmd+Q40hL+HTcFxWj24hlhYwXOCdlXy4HBokwwy9 WFBmYuuHGYtcgNG4OIZlsEH7qPth8U0Io1y2+IXAR4iMcGUyndnRCeFAb004w5S/rFJA EKu7JPDZFXe5rG+rfwQsxTqOyYG+mkTKpvgZwmfFUTyUMuEW1K/sLKuVEJU+yrUEDuKN qA8TzS97XaUnbGTKh/K0Jj1kkbOsqKaOgum1+7MWJSl8zH0O9hILcXbLJGinM+TPWC24 z/TQ== X-Gm-Message-State: AODbwcAQx2Jh0UVv65HEO/rRPK1vY0KFif7bPD9OJWHSSPgfU8uKADnU IuF60k64iZpCtKLz7ZqO8w== X-Received: by 10.99.103.4 with SMTP id b4mr3531614pgc.84.1494584684583; Fri, 12 May 2017 03:24:44 -0700 (PDT) Received: from neo00-el73.iig.avagotech.net ([192.19.239.250]) by smtp.gmail.com with ESMTPSA id c12sm4901872pfl.79.2017.05.12.03.24.42 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 May 2017 03:24:43 -0700 (PDT) From: Devesh Sharma To: linux-rdma@vger.kernel.org Subject: [PATCH 5/5] libbnxt_re: reset head and tail when moving to RST Date: Fri, 12 May 2017 06:24:26 -0400 Message-Id: <1494584666-11064-6-git-send-email-devesh.sharma@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1494584666-11064-1-git-send-email-devesh.sharma@broadcom.com> References: <1494584666-11064-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 When the QP is moving to RESET state from any state the head and tail of SQ and RQ(if present) should move to initial state (which is 0). This patch adds the code to handle reseting head and tail. Signed-off-by: Devesh Sharma --- providers/bnxt_re/verbs.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/providers/bnxt_re/verbs.c b/providers/bnxt_re/verbs.c index d337514..1fe7967 100644 --- a/providers/bnxt_re/verbs.c +++ b/providers/bnxt_re/verbs.c @@ -419,6 +419,11 @@ static void bnxt_re_poll_success_rcqe(struct bnxt_re_qp *qp, ibvwc->wc_flags = 0; if (is_imm) { ibvwc->wc_flags |= IBV_WC_WITH_IMM; + /* Completion reports the raw-data in LE format, While + * user expects it in BE format. Thus, swapping on outgoing + * data is needed. On a BE platform le32toh will do the swap + * while on LE platform htobe32 will do the job. + */ ibvwc->imm_data = htobe32(le32toh(rcqe->imm_key)); if (is_rdma) ibvwc->opcode = IBV_WC_RECV_RDMA_WITH_IMM; @@ -917,9 +922,18 @@ int bnxt_re_modify_qp(struct ibv_qp *ibvqp, struct ibv_qp_attr *attr, rc = ibv_cmd_modify_qp(ibvqp, attr, attr_mask, &cmd, sizeof(cmd)); if (!rc) { - if (attr_mask & IBV_QP_STATE) + if (attr_mask & IBV_QP_STATE) { qp->qpst = attr->qp_state; - + /* transition to reset */ + if (qp->qpst == IBV_QPS_RESET) { + qp->sqq->head = 0; + qp->sqq->tail = 0; + if (qp->rqq) { + qp->rqq->head = 0; + qp->rqq->tail = 0; + } + } + } if (attr_mask & IBV_QP_SQ_PSN) qp->sq_psn = attr->sq_psn; if (attr_mask & IBV_QP_PATH_MTU) @@ -1200,6 +1214,11 @@ int bnxt_re_post_send(struct ibv_qp *ibvqp, struct ibv_send_wr *wr, qp->cap.sqsig); switch (wr->opcode) { case IBV_WR_SEND_WITH_IMM: + /* Since our h/w is LE and user supplies raw-data in + * BE format. Swapping on incoming data is needed. + * On a BE platform htole32 will do the swap while on + * LE platform be32toh will do the job. + */ hdr->key_immd = htole32(be32toh(wr->imm_data)); case IBV_WR_SEND: if (qp->qptyp == IBV_QPT_UD)