From patchwork Fri May 22 14:42:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 6465141 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 67661C0020 for ; Fri, 22 May 2015 14:42:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 86A7020160 for ; Fri, 22 May 2015 14:42:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 645AC20172 for ; Fri, 22 May 2015 14:42:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756636AbbEVOmn (ORCPT ); Fri, 22 May 2015 10:42:43 -0400 Received: from mail-qk0-f173.google.com ([209.85.220.173]:34150 "EHLO mail-qk0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756536AbbEVOmm (ORCPT ); Fri, 22 May 2015 10:42:42 -0400 Received: by qkgx75 with SMTP id x75so12677307qkg.1 for ; Fri, 22 May 2015 07:42:42 -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=0tgpXoTHTsjPKCj4V5ySSVxQihduuBO+KlntgvMYkx4=; b=Go3OOZuXkWRq8qM4O0H8P0kjlxXfegtoVfGXka6OKJLMC2Bmx2/wUZbOHUN500TXpo gTZMtW5QQtL3yNcw5ZqWu7LEnysws8PIG7TDdeJ0Yk9HOye6/4Zkcw/gNukmPY0LcdWE oXeCDeQTXGWCsp+CYX4eeJUp6MajI6E8xuj6KN/va6a9x6EprJ3rSrefKSexeHQM8L+5 ClbJJQ3Qz5lNtQ+r6glUrDMtZUJm4ighAw/sPdg1LrOxwt2RhkyBOZtNjPVjhCZ0Wda9 KSm2eCgDDkaH2fA04r0ufFCG92USXHvCYAhPRkKWsL5D54KiB52zBx5iJDOJQpepGK39 g0Bw== X-Gm-Message-State: ALoCoQm+NXRyXakk9FZhXGlJXk9Sdr7yBFUDUQucZEx8TEOilPTYkpcH4L3kQ8KkoZ7vn5sMfH52 X-Received: by 10.140.108.201 with SMTP id j67mr11049651qgf.79.1432305761838; Fri, 22 May 2015 07:42:41 -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 o65sm1405747qge.34.2015.05.22.07.42.41 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 22 May 2015 07:42:41 -0700 (PDT) Date: Fri, 22 May 2015 10:42:35 -0400 From: james.smart@avagotech.com (James Smart) To: linux-scsi@vger.kernel.org Subject: [PATCH 1/9] lpfc: Check for active portpeerbeacon. Message-ID: <555f405b.edV1AAZPf7ciBGhe%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 Check for active portpeerbeacon. LCB requests to set Beacon would fail if the beacon was already enabled internally as the mailbox command used to query the state failes with an already-set status. Correct by enhancing the check so we don't fail if if the already set status comes back. Signed-off-by: Dick Kennedy Signed-off-by: James Smart Reviewed-by: Hannes Reinecke --- drivers/scsi/lpfc/lpfc_els.c | 19 +++++++++++++++---- drivers/scsi/lpfc/lpfc_hw4.h | 6 ++++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 011c8d8..3aad09f 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -5044,25 +5044,36 @@ lpfc_els_lcb_rsp(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) struct lpfc_iocbq *elsiocb; struct lpfc_nodelist *ndlp; struct ls_rjt *stat; + union lpfc_sli4_cfg_shdr *shdr; struct lpfc_lcb_context *lcb_context; struct fc_lcb_res_frame *lcb_res; - uint32_t cmdsize; + uint32_t cmdsize, shdr_status, shdr_add_status; int rc; mb = &pmb->u.mb; - lcb_context = (struct lpfc_lcb_context *)pmb->context1; ndlp = lcb_context->ndlp; pmb->context1 = NULL; pmb->context2 = NULL; - if (mb->mbxStatus) { + shdr = (union lpfc_sli4_cfg_shdr *) + &pmb->u.mqe.un.beacon_config.header.cfg_shdr; + shdr_status = bf_get(lpfc_mbox_hdr_status, &shdr->response); + shdr_add_status = bf_get(lpfc_mbox_hdr_add_status, &shdr->response); + + lpfc_printf_log(phba, KERN_INFO, LOG_MBOX, + "0194 SET_BEACON_CONFIG mailbox " + "completed with status x%x add_status x%x," + " mbx status x%x\n", + shdr_status, shdr_add_status, mb->mbxStatus); + + if (mb->mbxStatus && !(shdr_status && + shdr_add_status == ADD_STATUS_OPERATION_ALREADY_ACTIVE)) { mempool_free(pmb, phba->mbox_mem_pool); goto error; } mempool_free(pmb, phba->mbox_mem_pool); - cmdsize = sizeof(struct fc_lcb_res_frame); elsiocb = lpfc_prep_els_iocb(phba->pport, 0, cmdsize, lpfc_max_els_tries, ndlp, diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h index 7cc7bec..b94fa46 100644 --- a/drivers/scsi/lpfc/lpfc_hw4.h +++ b/drivers/scsi/lpfc/lpfc_hw4.h @@ -1943,6 +1943,12 @@ struct lpfc_mbx_redisc_fcf_tbl { #define STATUS_FCF_IN_USE 0x3a #define STATUS_FCF_TABLE_EMPTY 0x43 +/* + * Additional status field for embedded SLI_CONFIG mailbox + * command. + */ +#define ADD_STATUS_OPERATION_ALREADY_ACTIVE 0x67 + struct lpfc_mbx_sli4_config { struct mbox_header header; };