Received: by 2002:a05:7412:d024:b0:f9:90c9:de9f with SMTP id bd36csp149382rdb; Wed, 20 Dec 2023 08:29:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IHEOgdyS9cM50sM8ALeZ0squkT//CuamxM9WgbJxmkrYpYv0bp1EwNs1pCY649tTXAoPxnK X-Received: by 2002:a05:620a:24c5:b0:77f:3bb8:baa5 with SMTP id m5-20020a05620a24c500b0077f3bb8baa5mr24304921qkn.87.1703089769460; Wed, 20 Dec 2023 08:29:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703089769; cv=none; d=google.com; s=arc-20160816; b=eFsD7KBDs4ulZclYotsLk6jZi3dcGZbb7eH2a2gjWsPt59jxIzmUbYNqaD/e6vxmJA DHcJoLqk4fdDk67wvD/yPBF15TrrGo1j8t2hrWhf2XyNoZmijhmqCMjWfbImWmypnRnR hOcrYpZr9KJ5YnPA592x82kwQjHRF9hd0QZKp13HlCcBWYSu5SILEMjXbRqq+iIv8/B0 xBWaiFNiMRotC14tQTy/NbLpJoE7YlK49GIJ6rG/TELM7toyq94hnz16yjpK6+RxrEJ9 ZYVmIAJ+4Ih+XPFZiJL3uqS/fTNBArfH5cvad3vhOk8hZriyuS6jPnd/HGUJK3gkcR/O V0Zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature:dkim-signature:dkim-signature:dkim-signature; bh=y2eckF2GvGRbTAHhCW+/pFw7URKM5YHFGCnBdzSb3MA=; fh=EVXQGWq5Bfs5svH5aRcpIe5YNbUgdOZPXz8wHFtyjBQ=; b=zxcKwA0H3TtZPIGyFE6ZlLKPSxlCaubhppl4sMoQCQxlGdhiAGNFDTTXGsh1LlKcv3 KJ8Spt80vB2lzSpt5ucXD1v1V9BItQAz0Dk8PHO6curfWlQv8VKHpsP7jc+0fygPOr5p wFxMBjNb3KDXa0iT0+pYaMmV106YVYlu/fBvC+og3NU8mPvHI1Zg1g1FVsZTlIhori5S I9QEwl7LhXa+d3OYMyGAF/RRzSATbTO6lTWAw9NTPy3/eRdyI5npqESpjcpesjHUJzcc A2ZqnPUVjhQjr+1si67RHZUaApQOMobxY5YRAaVrPYo9goqsjzPTPl5RbkW9Jks+wo7n kgCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=YPkATW9T; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=YPkATW9T; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=y4RhpXvs; spf=pass (google.com: domain of linux-kernel+bounces-7296-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7296-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id x5-20020a05620a448500b0078110b0a184si86887qkp.526.2023.12.20.08.29.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 08:29:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-7296-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=YPkATW9T; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=YPkATW9T; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=y4RhpXvs; spf=pass (google.com: domain of linux-kernel+bounces-7296-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7296-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 294111C2083E for ; Wed, 20 Dec 2023 16:29:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8586741C96; Wed, 20 Dec 2023 16:29:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="YPkATW9T"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="y4RhpXvs"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="YPkATW9T"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="y4RhpXvs" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 26BD53F8E1; Wed, 20 Dec 2023 16:29:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E978721F97; Wed, 20 Dec 2023 16:29:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1703089756; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=y2eckF2GvGRbTAHhCW+/pFw7URKM5YHFGCnBdzSb3MA=; b=YPkATW9Tj1CKZyPlrVTBs1SgCkLDfjf2EMPgHewc7PBvlYbwZaYwlcBtZbhX2PGfANfSS0 lvChPdW8UNpgQWpgo3zSAN7ruR1ah8ISGd3Q7Ebw+i91O9lq6zDvkkBB0tlMDhw0Ryzr2z mG0rsZswh6fOnIQ21obpuLBwqWqmQ74= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1703089756; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=y2eckF2GvGRbTAHhCW+/pFw7URKM5YHFGCnBdzSb3MA=; b=y4RhpXvsY1CB1tNdFCnZgry4TMkPqto6MbzwN1vrCtQaqNarQVUOAWLwNTWAsVNIucrVNM czOggjiMXPc/kOAQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1703089756; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=y2eckF2GvGRbTAHhCW+/pFw7URKM5YHFGCnBdzSb3MA=; b=YPkATW9Tj1CKZyPlrVTBs1SgCkLDfjf2EMPgHewc7PBvlYbwZaYwlcBtZbhX2PGfANfSS0 lvChPdW8UNpgQWpgo3zSAN7ruR1ah8ISGd3Q7Ebw+i91O9lq6zDvkkBB0tlMDhw0Ryzr2z mG0rsZswh6fOnIQ21obpuLBwqWqmQ74= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1703089756; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=y2eckF2GvGRbTAHhCW+/pFw7URKM5YHFGCnBdzSb3MA=; b=y4RhpXvsY1CB1tNdFCnZgry4TMkPqto6MbzwN1vrCtQaqNarQVUOAWLwNTWAsVNIucrVNM czOggjiMXPc/kOAQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id C67F013722; Wed, 20 Dec 2023 16:29:15 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id IxBKLlsWg2XhQgAAD6G6ig (envelope-from ); Wed, 20 Dec 2023 16:29:15 +0000 From: Daniel Wagner To: linux-scsi@vger.kernel.org Cc: linux-kernel@vger.kernel.org, James Smart , Dick Kennedy , Hannes Reinecke , Daniel Wagner Subject: [PATCH] scsi: lpfc: use unsigned type for num_sge Date: Wed, 20 Dec 2023 17:26:58 +0100 Message-ID: <20231220162658.12392-1-dwagner@suse.de> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Level: X-Spam-Level: Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=YPkATW9T; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=y4RhpXvs X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-5.51 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DWL_DNSWL_MED(-2.00)[suse.de:dkim]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.de:+]; MX_GOOD(-0.01)[]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; NEURAL_HAM_SHORT(-0.20)[-0.997]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] X-Spam-Score: -5.51 X-Rspamd-Queue-Id: E978721F97 X-Spam-Flag: NO From: Hannes Reinecke LUNs going into “failed ready running” state observed on >1T and on even numbers of size (2T, 4T, 6T, 8T and 10T). The issue occurs when DIF is enabled at the host. The kernel logs: Cannot setup S/G List for HBAIO segs 1/1 SGL 512 SCSI 256: 3 0 The host lpfc driver is failing to setup scatter/gather list (protection data) for the IO's. The return type lpfc_bg_setup_sgl()/lpfc_bg_setup_sgl_prot() causes the compiler to remove the most significant bit. Use an unsigned type instead. Signed-off-by: Hannes Reinecke [dwagner: added commit message] Signed-off-by: Daniel Wagner --- drivers/scsi/lpfc/lpfc_scsi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index d26941b131fd..bf879d81846b 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c @@ -1918,7 +1918,7 @@ lpfc_bg_setup_bpl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc, * * Returns the number of SGEs added to the SGL. **/ -static int +static uint32_t lpfc_bg_setup_sgl(struct lpfc_hba *phba, struct scsi_cmnd *sc, struct sli4_sge *sgl, int datasegcnt, struct lpfc_io_buf *lpfc_cmd) @@ -1926,8 +1926,8 @@ lpfc_bg_setup_sgl(struct lpfc_hba *phba, struct scsi_cmnd *sc, struct scatterlist *sgde = NULL; /* s/g data entry */ struct sli4_sge_diseed *diseed = NULL; dma_addr_t physaddr; - int i = 0, num_sge = 0, status; - uint32_t reftag; + int i = 0, status; + uint32_t reftag, num_sge = 0; uint8_t txop, rxop; #ifdef CONFIG_SCSI_LPFC_DEBUG_FS uint32_t rc; @@ -2099,7 +2099,7 @@ lpfc_bg_setup_sgl(struct lpfc_hba *phba, struct scsi_cmnd *sc, * * Returns the number of SGEs added to the SGL. **/ -static int +static uint32_t lpfc_bg_setup_sgl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc, struct sli4_sge *sgl, int datacnt, int protcnt, struct lpfc_io_buf *lpfc_cmd) @@ -2123,8 +2123,8 @@ lpfc_bg_setup_sgl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc, uint32_t rc; #endif uint32_t checking = 1; - uint32_t dma_offset = 0; - int num_sge = 0, j = 2; + uint32_t dma_offset = 0, num_sge = 0; + int j = 2; struct sli4_hybrid_sgl *sgl_xtra = NULL; sgpe = scsi_prot_sglist(sc); -- 2.43.0