From patchwork Thu May 21 17:55:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 6457981 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B710AC0020 for ; Thu, 21 May 2015 17:55:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D817B2051D for ; Thu, 21 May 2015 17:55:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BE3D320525 for ; Thu, 21 May 2015 17:55:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964798AbbEURzb (ORCPT ); Thu, 21 May 2015 13:55:31 -0400 Received: from mail-qg0-f49.google.com ([209.85.192.49]:34455 "EHLO mail-qg0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932255AbbEURzZ (ORCPT ); Thu, 21 May 2015 13:55:25 -0400 Received: by qgez61 with SMTP id z61so41356894qge.1 for ; Thu, 21 May 2015 10:55:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:user-agent :mime-version:content-type:content-transfer-encoding; bh=rlAssVzzzGUDWewBLCvg2IF8gU2tEYtPTiGrWzs7E18=; b=LatHDojwTOwla0DYmSD+rgjBd1WeFow9+xAOvPbU7IW7LiqRRLaU8JqttfykKuchVl bU6Qce0cp+TY+JrgaMAgZvYHKDhfh7z/Tcq3AsGKXjlc95muDZrspeuEVq3HxR2VfNOw r0KvJ15KfH3Yuv1/jwt428eAFJ6HNaCb5sBrXbuFU8oNBwKKNWiheSwW7KQN+ZoHTWN2 xYbt5BUmvLMQNVR+Obzw33ey3hQPH6VR5cuX9YAUUaWaQwrdl2Pv0Ju32hXzb1p4jDpY g6nMzq+oEeVJ1mLsYpnI68aEQS+VhGCderNnd40I+LfwRPOMics30VwAFJJHEM3oMhTr DXOA== X-Gm-Message-State: ALoCoQkNjVEMMtPHoRxb6b6gf0hIa8WNDLytsUs/YjF/eOapZZMwbnBljUBISXWMR+2tGU9LfQbR X-Received: by 10.55.40.160 with SMTP id o32mr8871215qko.17.1432230924924; Thu, 21 May 2015 10:55:24 -0700 (PDT) Received: from myfc17 (c-75-67-235-135.hsd1.nh.comcast.net. [75.67.235.135]) by mx.google.com with ESMTPSA id p84sm2959835qkh.10.2015.05.21.10.55.24 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 21 May 2015 10:55:24 -0700 (PDT) Date: Thu, 21 May 2015 13:55:20 -0400 From: james.smart@avagotech.com (James Smart) To: linux-scsi@vger.kernel.org Subject: [PATCH v2 05/15] lpfc: Fix ABORTs WQ selection in terminate_rport_io Message-ID: <555e1c08.M8+xR9oQitcJPPaR%james.smart@avagotech.com> User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fix ABORTs WQ selection in terminate_rport_io Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_sli.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 56f7368..41d3370 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -8792,30 +8792,40 @@ lpfc_sli_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) return 0; } +/** + * lpfc_sli_calc_ring - Calculates which ring to use + * @phba: Pointer to HBA context object. + * @ring_number: Initial ring + * @piocb: Pointer to command iocb. + * + * For SLI4, FCP IO can deferred to one fo many WQs, based on + * fcp_wqidx, thus we need to calculate the corresponding ring. + * Since ABORTS must go on the same WQ of the command they are + * aborting, we use command's fcp_wqidx. + */ int lpfc_sli_calc_ring(struct lpfc_hba *phba, uint32_t ring_number, struct lpfc_iocbq *piocb) { - uint32_t idx; - if (phba->sli_rev == LPFC_SLI_REV4) { if (piocb->iocb_flag & (LPFC_IO_FCP | LPFC_USE_FCPWQIDX)) { - /* - * fcp_wqidx should already be setup based on what - * completion queue we want to use. - */ if (!(phba->cfg_fof) || (!(piocb->iocb_flag & LPFC_IO_FOF))) { if (unlikely(!phba->sli4_hba.fcp_wq)) return LPFC_HBA_ERROR; - idx = lpfc_sli4_scmd_to_wqidx_distr(phba); - piocb->fcp_wqidx = idx; - ring_number = MAX_SLI3_CONFIGURED_RINGS + idx; + /* + * for abort iocb fcp_wqidx should already + * be setup based on what work queue we used. + */ + if (!(piocb->iocb_flag & LPFC_USE_FCPWQIDX)) + piocb->fcp_wqidx = + lpfc_sli4_scmd_to_wqidx_distr(phba); + ring_number = MAX_SLI3_CONFIGURED_RINGS + + piocb->fcp_wqidx; } else { if (unlikely(!phba->sli4_hba.oas_wq)) return LPFC_HBA_ERROR; - idx = 0; - piocb->fcp_wqidx = idx; + piocb->fcp_wqidx = 0; ring_number = LPFC_FCP_OAS_RING; } }