From patchwork Tue Sep 19 14:41:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Gu X-Patchwork-Id: 141974 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp3482950vqi; Tue, 19 Sep 2023 08:40:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGd73Sb7jVvzBqKnM2oeDWYCSksSLPRX2aFvseMqpzvJw3CCq5ydfKWIgYUInsmehjvOklF X-Received: by 2002:a17:90a:410e:b0:276:7907:ecf with SMTP id u14-20020a17090a410e00b0027679070ecfmr56474pjf.36.1695138008477; Tue, 19 Sep 2023 08:40:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695138008; cv=none; d=google.com; s=arc-20160816; b=Jtt5mhy5MnoAhD6VzjyYkP/XXkRcmtflfCik8qU67+P8hDBKeZFO7ys0+FweksZsBY HRN9PomswkSIn5p6UL4GK/F8/d2/fti3DG/649PNC3UQ0G+okLCy6YlkGntw/lacBExp OpZ77Kh3+gbktymc3JWtWpcpxmIyHQtjjtcr6nq3TGslvcwpxJc0T/+t4gz4Go3TmXVv Vzhfx1wLawyWZCAEoSdZ88SV/tvUxg9QjoGy8c28bet/u6Rihf5bgimt47QnKvgdUcki Qizf78ZMZSWjU4ih18plx0ykQVCO7Q5eA2XCiBndsmFGZXr0lamq7x5PzdJZz9ooVI/B 3yLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=QM5jWKqujrJ6N/9s0YdsuBov0QHoba6spTSFi4QNLGk=; fh=2Ks5OhTjwS8gZt4F+VGxBODwUEQ0u2wJBF3lQY5ZqAM=; b=keMyorcAlRodWVvW89NIbdQiBgt14OT17VzSC53FTsMa7qhCDELV4XuBJQC9gE+MuV ERzwqxtc5gkEsGfo0Ru60foaeb0a19BpCXuvi+sU0n0FkCJoT1dLzPvHAA9SOWQKsZOh N/JritBSzzHyH7fMjCtp173bIEg3ooYexKX5aXC4GzG/UGY3i3174siNzMn2V3KNNwYx qhDJzDZDf8JVNkdkaapKJdUx1NroC8JImDWAWzVc+9Dy7yUlQEuisIRBWVmXtrnBf49q DQzBylZiIPZgHxMoQDaiH0WlLnCMMZFPBKsiKNzBr7kyDitIZvoChU8R4r2/FtIW1hce TymA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id pj2-20020a17090b4f4200b00276b35bc424si688854pjb.26.2023.09.19.08.40.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 08:40:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id B644480FA86C; Tue, 19 Sep 2023 07:43:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233011AbjISOnP (ORCPT + 26 others); Tue, 19 Sep 2023 10:43:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232943AbjISOnG (ORCPT ); Tue, 19 Sep 2023 10:43:06 -0400 Received: from out30-124.freemail.mail.aliyun.com (out30-124.freemail.mail.aliyun.com [115.124.30.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFAB5BF; Tue, 19 Sep 2023 07:42:52 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R201e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046051;MF=guwen@linux.alibaba.com;NM=1;PH=DS;RN=13;SR=0;TI=SMTPD_---0VsRsRuO_1695134567; Received: from localhost(mailfrom:guwen@linux.alibaba.com fp:SMTPD_---0VsRsRuO_1695134567) by smtp.aliyun-inc.com; Tue, 19 Sep 2023 22:42:49 +0800 From: Wen Gu To: kgraul@linux.ibm.com, wenjia@linux.ibm.com, jaka@linux.ibm.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: alibuda@linux.alibaba.com, tonylu@linux.alibaba.com, guwen@linux.alibaba.com, linux-s390@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 07/18] net/smc: disable SEID on non-s390 architecture Date: Tue, 19 Sep 2023 22:41:51 +0800 Message-Id: <1695134522-126655-8-git-send-email-guwen@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1695134522-126655-1-git-send-email-guwen@linux.alibaba.com> References: <1695134522-126655-1-git-send-email-guwen@linux.alibaba.com> X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 19 Sep 2023 07:43:25 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777481031988267661 X-GMAIL-MSGID: 1777481031988267661 On s390 architecture SMC-Dv2 SEID is generated by ISMv2 device with partial cpuid. It is predefined and unique to represents the physical machine (CPC), the maximum communication space of SMC-D. On non-s390 archs like x86/64 or ARM, there is no similar information to identify physical machine, especially in virtualization scenarios like KVM, etc. In such cases, SEID is forcibly disabled and the user- defined UEID will be used to represent the communicable space. Signed-off-by: Wen Gu --- net/smc/smc_clc.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/net/smc/smc_clc.c b/net/smc/smc_clc.c index c08e138..be56a7d 100644 --- a/net/smc/smc_clc.c +++ b/net/smc/smc_clc.c @@ -155,10 +155,12 @@ static int smc_clc_ueid_remove(char *ueid) rc = 0; } } +#if IS_ENABLED(CONFIG_S390) if (!rc && !smc_clc_eid_table.ueid_cnt) { smc_clc_eid_table.seid_enabled = 1; rc = -EAGAIN; /* indicate success and enabling of seid */ } +#endif write_unlock(&smc_clc_eid_table.lock); return rc; } @@ -273,22 +275,30 @@ int smc_nl_dump_seid(struct sk_buff *skb, struct netlink_callback *cb) int smc_nl_enable_seid(struct sk_buff *skb, struct genl_info *info) { +#if IS_ENABLED(CONFIG_S390) write_lock(&smc_clc_eid_table.lock); smc_clc_eid_table.seid_enabled = 1; write_unlock(&smc_clc_eid_table.lock); return 0; +#else + return -EOPNOTSUPP; +#endif } int smc_nl_disable_seid(struct sk_buff *skb, struct genl_info *info) { int rc = 0; +#if IS_ENABLED(CONFIG_S390) write_lock(&smc_clc_eid_table.lock); if (!smc_clc_eid_table.ueid_cnt) rc = -ENOENT; else smc_clc_eid_table.seid_enabled = 0; write_unlock(&smc_clc_eid_table.lock); +#else + rc = -EOPNOTSUPP; +#endif return rc; } @@ -1290,7 +1300,11 @@ void __init smc_clc_init(void) INIT_LIST_HEAD(&smc_clc_eid_table.list); rwlock_init(&smc_clc_eid_table.lock); smc_clc_eid_table.ueid_cnt = 0; +#if IS_ENABLED(CONFIG_S390) smc_clc_eid_table.seid_enabled = 1; +#else + smc_clc_eid_table.seid_enabled = 0; +#endif } void smc_clc_exit(void)