From patchwork Mon Oct 31 11:45:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 13234 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2263250wru; Mon, 31 Oct 2022 04:48:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ykn/JjTV6jR6Yhz4uokxrvAXT92C4NtlVjvTlOQBluKA4b4XDqqWz3NKB6MxNaOjacIQb X-Received: by 2002:a17:906:7c52:b0:7ad:c9e5:3ecc with SMTP id g18-20020a1709067c5200b007adc9e53eccmr6204046ejp.73.1667216929390; Mon, 31 Oct 2022 04:48:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667216929; cv=none; d=google.com; s=arc-20160816; b=H8vrTOFdj7JEOpU1wN5KFcz2pZZ3DTz4yiCVPRz9cI3l+xgTwNxheutDS7qI5nQbO0 z2mKMiKG0tWc5DPc9uJoDPnqcuUtcvEV10qZJ/zxOtlONpu5LE3XI3Ty8QUN/dBDCBBW IN8jbcSsPUJJ/AcEZ/MTeAgRHkz1I+qYREgPcnYOA7JZ2wbMvbIjA5epqHephziP056w 0JuucFXG+XXRmV9ffDayJ2Yu+hy5FHUzQ+CwGmEuGbKMpKCqh1xYWQvfBMwmrq2Ckpko JLZBUtqMfowH4pzqXLlsT7BPR5DAVHd4J2inXphkqRxb/zWLhdQ9JPbki+GS04l1maQn 6JaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=wCMEyqef5jMYec2+WFXHwKa/fLvNc8ElUKFsh/LhUQc=; b=suomPGVNIpn+13CEg/D/SC38GZxzH9Eh7lLFEWxC5m0qt7ct6ngnY6lqepqs9h9NoV WxcMLru2vfr3+z0clyEUR86USy2vYgaaGm/ptT7ird3dhhIWcyPmxT+OKQlPkYhcgehE e/BoqNwPWasww3tyuIw1bivrQZ6DdRGaVns7pi9C63NQbywl1Z4mRewZJVGA3yeNsWE3 qcAQAv7ThPLCgSgIfXkqn9Fjy/dcX3pBPVWKrto76s2RtziY+jlB1UKls/xT2IPg5BDU qZ9rjgpPKMjO7ibXqhQiD4p7+VslQKaPvC0pcuoPwOfDFNdE5RpNjPtVdQ6h6XY5Os8V 6HWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Gg7cTrAg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qa33-20020a17090786a100b007820aa60dc3si8372323ejc.74.2022.10.31.04.48.25; Mon, 31 Oct 2022 04:48:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Gg7cTrAg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231156AbiJaLpw (ORCPT + 99 others); Mon, 31 Oct 2022 07:45:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231267AbiJaLpN (ORCPT ); Mon, 31 Oct 2022 07:45:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C7B9EE1A; Mon, 31 Oct 2022 04:45:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BC40B60FD3; Mon, 31 Oct 2022 11:45:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DB92C433C1; Mon, 31 Oct 2022 11:45:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667216710; bh=Z7a3Uy401OHjnzkVuyZzMaPtXD6RGqSJ3Gr9uE6GveA=; h=From:To:Cc:Subject:Date:From; b=Gg7cTrAgdQPxH+Hico6RhSNMP2l7ogese3Ca7q2zb9PlEtxD0PMtkIPLRpgYXZCNF QJhjvqgY5BMI7W9R4GAif77YQgKEPb9nZQI7I3Wjx0TbWKLBaicHkwMe4fjRgvwXlp 9On2PRzeW+ryhnI3UFp5ZNFguRev0jN8GIFe5zUSvuI3AiYB7HMaaRc+RoT4E2EORf ntrMWTeDiswV+NFXOMYQ+nqCYpYeIcu0o7ut0JO9tKMdH2IFGIbsW6uSi+ot42FGI6 W3M3IvcfWvNQNxqxudipEsyAesC4V6q/V8oe+gsL6Em5S3rn96x7pPaoFrzoNxGN0b aKdWdH1oFbB0g== From: "Jiri Slaby (SUSE)" To: bvanassche@acm.org Cc: linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , Martin Liska , Jason Gunthorpe , Leon Romanovsky , linux-rdma@vger.kernel.org Subject: [PATCH] RDMA/srp (gcc13): force int types for max_send_sge and can_queue Date: Mon, 31 Oct 2022 12:45:06 +0100 Message-Id: <20221031114506.10501-1-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748203659188772841?= X-GMAIL-MSGID: =?utf-8?q?1748203659188772841?= Since gcc13, each member of an enum has the same type as the enum [1]. And that is inherited from its members. Provided "SRP_TAG_TSK_MGMT = 1U << 31", SRP_MAX_SGE and SRP_TSK_MGMT_SQ_SIZE are unsigned ints. This results in the following warnings: include/linux/minmax.h:20:35: error: comparison of distinct pointer types lacks a cast drivers/infiniband/ulp/srp/ib_srp.c:563:42: note: in expansion of macro 'min' include/linux/minmax.h:20:35: error: comparison of distinct pointer types lacks a cast drivers/infiniband/ulp/srp/ib_srp.c:2369:27: note: in expansion of macro 'min' Force the use of min_t() instead of min() to use int for all those, as this is what both targets target->scsi_host->can_queue and init_attr->cap.max_send_sge are. [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36113 Cc: Martin Liska Cc: Bart Van Assche Cc: Jason Gunthorpe Cc: Leon Romanovsky Cc: linux-rdma@vger.kernel.org Signed-off-by: Jiri Slaby (SUSE) --- drivers/infiniband/ulp/srp/ib_srp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 1075c2ac8fe2..7db487da8293 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -560,7 +560,8 @@ static int srp_create_ch_ib(struct srp_rdma_ch *ch) init_attr->cap.max_send_wr = m * target->queue_size; init_attr->cap.max_recv_wr = target->queue_size + 1; init_attr->cap.max_recv_sge = 1; - init_attr->cap.max_send_sge = min(SRP_MAX_SGE, attr->max_send_sge); + init_attr->cap.max_send_sge = min_t(int, SRP_MAX_SGE, + attr->max_send_sge); init_attr->sq_sig_type = IB_SIGNAL_REQ_WR; init_attr->qp_type = IB_QPT_RC; init_attr->send_cq = send_cq; @@ -2366,7 +2367,7 @@ static void srp_cm_rep_handler(struct ib_cm_id *cm_id, * bounce requests back to the SCSI mid-layer. */ target->scsi_host->can_queue - = min(ch->req_lim - SRP_TSK_MGMT_SQ_SIZE, + = min_t(int, ch->req_lim - SRP_TSK_MGMT_SQ_SIZE, target->scsi_host->can_queue); target->scsi_host->cmd_per_lun = min_t(int, target->scsi_host->can_queue,