From patchwork Sat Nov 7 12:59:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karsten Graul X-Patchwork-Id: 322167 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0FDCCC388F9 for ; Sat, 7 Nov 2020 13:01:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BE509206ED for ; Sat, 7 Nov 2020 13:01:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="jHkVEw5b" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728269AbgKGNB3 (ORCPT ); Sat, 7 Nov 2020 08:01:29 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:44802 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727320AbgKGNAR (ORCPT ); Sat, 7 Nov 2020 08:00:17 -0500 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0A7CWFTX037748; Sat, 7 Nov 2020 08:00:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=pp1; bh=Y0Si9ld4jINnabZQldllY7S5e+r9HyrnF/BM5Yj7/7A=; b=jHkVEw5b57oTgiQvPvtY/9z7xWXETceBq50CX3Oq2FnAcZTNhfZaRT4qSrnqrBK40wQ1 CH5KUIARmgxejlIOkSu16V6skeFrr0R7N0KNfm+6JNlrSEMjvhzWsOqU7xYvYM0yyKbs 6ER+2Lmb1nZ/0GPuws4Pkl/EfSG2w8TbIQPoq+MY7AUa1mnd1bObd3c6dBpw3kpwAxny qm0ysyZ9s8lTtBc+BdU8lb2g68zvTDW4zsACGiUyEfeVjTyMZPw/KGJ6YlvK55k8EknL PmPt36qJsazuKonFkv1HxvbqQuSz1ZnvxjrOu0NN0PyybzctpZ15RSfvRQlSbC/kysoz KA== Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0b-001b2d01.pphosted.com with ESMTP id 34npkyq63j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 07 Nov 2020 08:00:14 -0500 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0A7D00ag025865; Sat, 7 Nov 2020 13:00:13 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma03fra.de.ibm.com with ESMTP id 34nk7885gv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 07 Nov 2020 13:00:12 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0A7D09Dt28311880 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 7 Nov 2020 13:00:10 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5438FA408C; Sat, 7 Nov 2020 13:00:08 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2DD84A4087; Sat, 7 Nov 2020 13:00:08 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sat, 7 Nov 2020 13:00:08 +0000 (GMT) From: Karsten Graul To: davem@davemloft.net Cc: netdev@vger.kernel.org, linux-s390@vger.kernel.org, hca@linux.ibm.com, raspl@linux.ibm.com Subject: [PATCH net-next v3 02/15] net/smc: Use active link of the connection Date: Sat, 7 Nov 2020 13:59:45 +0100 Message-Id: <20201107125958.16384-3-kgraul@linux.ibm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201107125958.16384-1-kgraul@linux.ibm.com> References: <20201107125958.16384-1-kgraul@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312, 18.0.737 definitions=2020-11-07_07:2020-11-05,2020-11-07 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_spam_definite policy=outbound score=100 phishscore=0 clxscore=1015 mlxscore=100 spamscore=100 lowpriorityscore=0 adultscore=0 malwarescore=0 impostorscore=0 suspectscore=0 mlxlogscore=-1000 bulkscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011070081 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Guvenc Gulce Use active link of the connection directly and not via linkgroup array structure when obtaining link data of the connection. Signed-off-by: Guvenc Gulce Signed-off-by: Karsten Graul --- net/smc/smc_diag.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/net/smc/smc_diag.c b/net/smc/smc_diag.c index f15fca59b4b2..c2225231f679 100644 --- a/net/smc/smc_diag.c +++ b/net/smc/smc_diag.c @@ -160,17 +160,17 @@ static int __smc_diag_dump(struct sock *sk, struct sk_buff *skb, !list_empty(&smc->conn.lgr->list)) { struct smc_diag_lgrinfo linfo = { .role = smc->conn.lgr->role, - .lnk[0].ibport = smc->conn.lgr->lnk[0].ibport, - .lnk[0].link_id = smc->conn.lgr->lnk[0].link_id, + .lnk[0].ibport = smc->conn.lnk->ibport, + .lnk[0].link_id = smc->conn.lnk->link_id, }; memcpy(linfo.lnk[0].ibname, smc->conn.lgr->lnk[0].smcibdev->ibdev->name, - sizeof(smc->conn.lgr->lnk[0].smcibdev->ibdev->name)); + sizeof(smc->conn.lnk->smcibdev->ibdev->name)); smc_gid_be16_convert(linfo.lnk[0].gid, - smc->conn.lgr->lnk[0].gid); + smc->conn.lnk->gid); smc_gid_be16_convert(linfo.lnk[0].peer_gid, - smc->conn.lgr->lnk[0].peer_gid); + smc->conn.lnk->peer_gid); if (nla_put(skb, SMC_DIAG_LGRINFO, sizeof(linfo), &linfo) < 0) goto errout; From patchwork Sat Nov 7 12:59:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karsten Graul X-Patchwork-Id: 322171 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CED9C388F7 for ; Sat, 7 Nov 2020 13:00:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 57673206F4 for ; Sat, 7 Nov 2020 13:00:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="G8btCAn5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728191AbgKGNAy (ORCPT ); Sat, 7 Nov 2020 08:00:54 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:52664 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727264AbgKGNAR (ORCPT ); Sat, 7 Nov 2020 08:00:17 -0500 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0A7CWDie037642; Sat, 7 Nov 2020 08:00:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=pp1; bh=4S9S7STXzo4ONPx1Hegv+zajRMe+93GR1pw1fSyStj0=; b=G8btCAn5TU/jNes977pbgjLGeCRLbJoKyZJgcHSAYcchX4ZxJ28uTAkbqk1oEmzDUKws +SrQsEazEOFA9g8zNSXhfYfywYGVdZT14W4f68S9mowxCgGXU/BgCUQ4cfVCnqX2wCTk hQ+zrPO9UOUE8/wPRIgGBFNEAaZjTajpIhycDSNZv1P8SbAek9jnZRlrIhXC+y58Q0yf eFR1O7R3TBM1QPhfomEQiXGsjJwYpTqsMjsjp27/D6zsz6jl9vLmpGpY4yuLxh4P7jrD cDTY+3JJOi4/f4vnqleSbRYYBYF9ME5+/IFH5CY79F4BjQ2ZOL5YwvDJrPP6VylyXgqR /Q== Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 34npkyq635-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 07 Nov 2020 08:00:13 -0500 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0A7CvCCW016083; Sat, 7 Nov 2020 13:00:12 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma04ams.nl.ibm.com with ESMTP id 34nk788ag7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 07 Nov 2020 13:00:12 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0A7D09nF52232700 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 7 Nov 2020 13:00:09 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 11E13A4069; Sat, 7 Nov 2020 13:00:09 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DF2BCA4065; Sat, 7 Nov 2020 13:00:08 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sat, 7 Nov 2020 13:00:08 +0000 (GMT) From: Karsten Graul To: davem@davemloft.net Cc: netdev@vger.kernel.org, linux-s390@vger.kernel.org, hca@linux.ibm.com, raspl@linux.ibm.com Subject: [PATCH net-next v3 05/15] net/smc: Add diagnostic information to smc ib-device Date: Sat, 7 Nov 2020 13:59:48 +0100 Message-Id: <20201107125958.16384-6-kgraul@linux.ibm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201107125958.16384-1-kgraul@linux.ibm.com> References: <20201107125958.16384-1-kgraul@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312, 18.0.737 definitions=2020-11-07_07:2020-11-05,2020-11-07 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_spam_definite policy=outbound score=100 phishscore=0 clxscore=1015 mlxscore=100 spamscore=100 lowpriorityscore=0 adultscore=0 malwarescore=0 impostorscore=0 suspectscore=0 mlxlogscore=-1000 bulkscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011070081 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Guvenc Gulce During smc ib-device creation, add network device name to smc ib-device structure. Register for netdevice name changes and update ib-device accordingly. This is needed for diagnostic purposes. Signed-off-by: Guvenc Gulce Signed-off-by: Karsten Graul --- net/smc/smc_ib.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ net/smc/smc_ib.h | 2 ++ net/smc/smc_pnet.c | 3 +++ 3 files changed, 50 insertions(+) diff --git a/net/smc/smc_ib.c b/net/smc/smc_ib.c index 1c314dbdc7fa..300cca9296be 100644 --- a/net/smc/smc_ib.c +++ b/net/smc/smc_ib.c @@ -557,6 +557,50 @@ static void smc_ib_cleanup_per_ibdev(struct smc_ib_device *smcibdev) static struct ib_client smc_ib_client; +static void smc_copy_netdev_name(struct smc_ib_device *smcibdev, int port) +{ + struct ib_device *ibdev = smcibdev->ibdev; + struct net_device *ndev; + + if (!ibdev->ops.get_netdev) + return; + ndev = ibdev->ops.get_netdev(ibdev, port + 1); + if (ndev) { + snprintf(smcibdev->netdev[port], + sizeof(smcibdev->netdev[port]), + "%s", ndev->name); + dev_put(ndev); + } +} + +void smc_ib_ndev_name_change(struct net_device *ndev) +{ + struct smc_ib_device *smcibdev; + struct ib_device *libdev; + struct net_device *lndev; + u8 port_cnt; + int i; + + mutex_lock(&smc_ib_devices.mutex); + list_for_each_entry(smcibdev, &smc_ib_devices.list, list) { + port_cnt = smcibdev->ibdev->phys_port_cnt; + for (i = 0; i < min_t(size_t, port_cnt, SMC_MAX_PORTS); i++) { + libdev = smcibdev->ibdev; + if (!libdev->ops.get_netdev) + continue; + lndev = libdev->ops.get_netdev(libdev, i + 1); + if (lndev) + dev_put(lndev); + if (lndev != ndev) + continue; + snprintf(smcibdev->netdev[i], + sizeof(smcibdev->netdev[i]), + "%s", ndev->name); + } + } + mutex_unlock(&smc_ib_devices.mutex); +} + /* callback function for ib_register_client() */ static int smc_ib_add_dev(struct ib_device *ibdev) { @@ -596,6 +640,7 @@ static int smc_ib_add_dev(struct ib_device *ibdev) if (smc_pnetid_by_dev_port(ibdev->dev.parent, i, smcibdev->pnetid[i])) smc_pnetid_by_table_ib(smcibdev, i + 1); + smc_copy_netdev_name(smcibdev, i); pr_warn_ratelimited("smc: ib device %s port %d has pnetid " "%.16s%s\n", smcibdev->ibdev->name, i + 1, diff --git a/net/smc/smc_ib.h b/net/smc/smc_ib.h index 3b85360a473b..5319496adea0 100644 --- a/net/smc/smc_ib.h +++ b/net/smc/smc_ib.h @@ -55,11 +55,13 @@ struct smc_ib_device { /* ib-device infos for smc */ struct mutex mutex; /* protect dev setup+cleanup */ atomic_t lnk_cnt_by_port[SMC_MAX_PORTS]; /* number of links per port */ + char netdev[SMC_MAX_PORTS][IFNAMSIZ];/* ndev names */ }; struct smc_buf_desc; struct smc_link; +void smc_ib_ndev_name_change(struct net_device *ndev); int smc_ib_register_client(void) __init; void smc_ib_unregister_client(void); bool smc_ib_port_active(struct smc_ib_device *smcibdev, u8 ibport); diff --git a/net/smc/smc_pnet.c b/net/smc/smc_pnet.c index f3c18b991d35..b0f40d73afd6 100644 --- a/net/smc/smc_pnet.c +++ b/net/smc/smc_pnet.c @@ -828,6 +828,9 @@ static int smc_pnet_netdev_event(struct notifier_block *this, case NETDEV_UNREGISTER: smc_pnet_remove_by_ndev(event_dev); return NOTIFY_OK; + case NETDEV_CHANGENAME: + smc_ib_ndev_name_change(event_dev); + return NOTIFY_OK; case NETDEV_REGISTER: smc_pnet_add_by_ndev(event_dev); return NOTIFY_OK; From patchwork Sat Nov 7 12:59:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karsten Graul X-Patchwork-Id: 322172 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB965C388F7 for ; Sat, 7 Nov 2020 13:00:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 94CB1206F4 for ; Sat, 7 Nov 2020 13:00:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="Xieieob0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728172AbgKGNAk (ORCPT ); Sat, 7 Nov 2020 08:00:40 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:64192 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727863AbgKGNAS (ORCPT ); Sat, 7 Nov 2020 08:00:18 -0500 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0A7CWNmP167110; Sat, 7 Nov 2020 08:00:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=pp1; bh=MSc8z+WqhyinuhVNpHBi7NK/hKxfO/YH9TPNd9lgEIA=; b=Xieieob0UsBF7wcTZvJb6W5BnIMCnVHdL05xyFIw5++wkSgpGe1Vxyy/584S4pKameB+ t0/13yFxD75PY8SVnYo3lhymbV2gWDqsNNCoU/QERBWyX5Ql9JUcBC+UzIPnn/nYG9Y1 OtHC8Nd06B3akvF1p99OnIRevkJ5rSpOWPUS33tC9FncyivmGpA1LHymKQNFeD/jorhA cilOjMxMVsy1U+iAlUnpU7oPxG02olgsBr7TpepIIP/vPbLolI+vGt/IMaGQGIni3D4q y7Op6uCl7+1yqA2dVNdkoajrxQrjX3XD+yEY2UYTtJqgMa5sXxQuyg0+jmb7t1OTH1fH YQ== Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0a-001b2d01.pphosted.com with ESMTP id 34nrb3cjpr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 07 Nov 2020 08:00:15 -0500 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0A7CwCki024939; Sat, 7 Nov 2020 13:00:13 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma02fra.de.ibm.com with ESMTP id 34nk7805c5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 07 Nov 2020 13:00:13 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0A7D0AMt46465518 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 7 Nov 2020 13:00:10 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4FBC2A4072; Sat, 7 Nov 2020 13:00:09 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 261B1A4040; Sat, 7 Nov 2020 13:00:09 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sat, 7 Nov 2020 13:00:09 +0000 (GMT) From: Karsten Graul To: davem@davemloft.net Cc: netdev@vger.kernel.org, linux-s390@vger.kernel.org, hca@linux.ibm.com, raspl@linux.ibm.com Subject: [PATCH net-next v3 06/15] net/smc: Add diagnostic information to link structure Date: Sat, 7 Nov 2020 13:59:49 +0100 Message-Id: <20201107125958.16384-7-kgraul@linux.ibm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201107125958.16384-1-kgraul@linux.ibm.com> References: <20201107125958.16384-1-kgraul@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312, 18.0.737 definitions=2020-11-07_07:2020-11-05,2020-11-07 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_spam_definite policy=outbound score=100 mlxlogscore=-1000 malwarescore=0 mlxscore=100 adultscore=0 clxscore=1015 priorityscore=1501 lowpriorityscore=0 bulkscore=0 impostorscore=0 suspectscore=0 phishscore=0 spamscore=100 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011070081 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Guvenc Gulce During link creation add network and ib-device name to link structure. This is needed for diagnostic purposes. When diagnostic information is gathered, we need to traverse device, linkgroup and link structures, to be able to do that we need to hold a spinlock for the linkgroup list, without this diagnostic information in link structure, another device list mutex holding would be necessary to dereference the device pointer in the link structure which would be impossible when holding a spinlock already. Signed-off-by: Guvenc Gulce Signed-off-by: Karsten Graul --- net/smc/smc_core.c | 11 +++++++++++ net/smc/smc_core.h | 3 +++ 2 files changed, 14 insertions(+) diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c index e5996cf5dd3d..ef0aae43a209 100644 --- a/net/smc/smc_core.c +++ b/net/smc/smc_core.c @@ -303,6 +303,16 @@ static u8 smcr_next_link_id(struct smc_link_group *lgr) return link_id; } +static inline void smcr_copy_dev_info_to_link(struct smc_link *link) +{ + struct smc_ib_device *smcibdev = link->smcibdev; + + snprintf(link->ibname, sizeof(link->ibname), "%s", + smcibdev->ibdev->name); + snprintf(link->ndevname, sizeof(link->ndevname), "%s", + smcibdev->netdev[link->ibport - 1]); +} + int smcr_link_init(struct smc_link_group *lgr, struct smc_link *lnk, u8 link_idx, struct smc_init_info *ini) { @@ -317,6 +327,7 @@ int smcr_link_init(struct smc_link_group *lgr, struct smc_link *lnk, lnk->smcibdev = ini->ib_dev; lnk->ibport = ini->ib_port; smc_ibdev_cnt_inc(lnk); + smcr_copy_dev_info_to_link(lnk); lnk->path_mtu = ini->ib_dev->pattr[ini->ib_port - 1].active_mtu; atomic_set(&lnk->conn_cnt, 0); smc_llc_link_set_uid(lnk); diff --git a/net/smc/smc_core.h b/net/smc/smc_core.h index 4cf8e811940d..a6ba9cc8c60e 100644 --- a/net/smc/smc_core.h +++ b/net/smc/smc_core.h @@ -124,6 +124,9 @@ struct smc_link { u8 link_is_asym; /* is link asymmetric? */ struct smc_link_group *lgr; /* parent link group */ struct work_struct link_down_wrk; /* wrk to bring link down */ + /* Diagnostic relevant link information */ + char ibname[IB_DEVICE_NAME_MAX];/* ib device name */ + char ndevname[IFNAMSIZ];/* network device name */ enum smc_link_state state; /* state of link */ struct delayed_work llc_testlink_wrk; /* testlink worker */ From patchwork Sat Nov 7 12:59:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karsten Graul X-Patchwork-Id: 322170 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9830CC388F7 for ; Sat, 7 Nov 2020 13:01:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5B55020704 for ; Sat, 7 Nov 2020 13:01:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="TRz9fRdX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728210AbgKGNBG (ORCPT ); Sat, 7 Nov 2020 08:01:06 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:64584 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727881AbgKGNAT (ORCPT ); Sat, 7 Nov 2020 08:00:19 -0500 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0A7CUwN7129437; Sat, 7 Nov 2020 08:00:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=pp1; bh=f45+TYglhnKBzsSq/k2fpO82103odcxyODtnYOvDf1U=; b=TRz9fRdXOrcOodi/Y3vjD3EC+lGf3y5bmQV7SIc5NUBHb5THkRMjWoYg1D9ng73Shl3/ ksBOue8hEoXCdJYCG1e/wQUE8HA3ZjkwmXA6PoCKzKXc/lsIgk5T2LpZ6ElN5m2wueEk wtTWYUwimZWdeWfOoAXJ1DX1tTG+XR1km/BYoaKaf7vN8pXqt00tlz0NqlSp8EfpN9sx IPAybZv1Klr/L03I4TFIIndFzH6m+vu6WpL6TMR7QvyewRFGO5wlfmE+ppaiNYZ8tpUX XYbOd4PgbiP57D6GY/TAsSaOB9qzASz5/XnUyRiFvl+QE3NENmcVOcNAeovtg89SWhby 4g== Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0a-001b2d01.pphosted.com with ESMTP id 34nreumer0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 07 Nov 2020 08:00:15 -0500 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0A7CwdGe019413; Sat, 7 Nov 2020 13:00:14 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma06fra.de.ibm.com with ESMTP id 34njuh05qa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 07 Nov 2020 13:00:13 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0A7D0BiI49873402 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 7 Nov 2020 13:00:11 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8C369A408E; Sat, 7 Nov 2020 13:00:09 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 61516A4055; Sat, 7 Nov 2020 13:00:09 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sat, 7 Nov 2020 13:00:09 +0000 (GMT) From: Karsten Graul To: davem@davemloft.net Cc: netdev@vger.kernel.org, linux-s390@vger.kernel.org, hca@linux.ibm.com, raspl@linux.ibm.com Subject: [PATCH net-next v3 07/15] net/smc: Refactor the netlink reply processing routine Date: Sat, 7 Nov 2020 13:59:50 +0100 Message-Id: <20201107125958.16384-8-kgraul@linux.ibm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201107125958.16384-1-kgraul@linux.ibm.com> References: <20201107125958.16384-1-kgraul@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312, 18.0.737 definitions=2020-11-07_07:2020-11-05,2020-11-07 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_spam_definite policy=outbound score=100 mlxscore=100 lowpriorityscore=0 malwarescore=0 adultscore=0 spamscore=100 mlxlogscore=-1000 phishscore=0 bulkscore=0 suspectscore=0 clxscore=1015 priorityscore=1501 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011070081 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Guvenc Gulce Refactor the netlink reply processing routine so that it provides sub functions for specific parts of the processing. Signed-off-by: Guvenc Gulce Signed-off-by: Karsten Graul --- net/smc/smc_diag.c | 218 +++++++++++++++++++++++++++------------------ 1 file changed, 133 insertions(+), 85 deletions(-) diff --git a/net/smc/smc_diag.c b/net/smc/smc_diag.c index c2225231f679..44be723c97fe 100644 --- a/net/smc/smc_diag.c +++ b/net/smc/smc_diag.c @@ -69,35 +69,25 @@ static void smc_diag_msg_common_fill(struct smc_diag_msg *r, struct sock *sk) } } -static int smc_diag_msg_attrs_fill(struct sock *sk, struct sk_buff *skb, - struct smc_diag_msg *r, - struct user_namespace *user_ns) +static bool smc_diag_msg_attrs_fill(struct sock *sk, struct sk_buff *skb, + struct smc_diag_msg *r, + struct user_namespace *user_ns) { - if (nla_put_u8(skb, SMC_DIAG_SHUTDOWN, sk->sk_shutdown)) - return 1; + if (nla_put_u8(skb, SMC_DIAG_SHUTDOWN, sk->sk_shutdown) < 0) + return false; r->diag_uid = from_kuid_munged(user_ns, sock_i_uid(sk)); r->diag_inode = sock_i_ino(sk); - return 0; + return true; } -static int __smc_diag_dump(struct sock *sk, struct sk_buff *skb, - struct netlink_callback *cb, - const struct smc_diag_req *req, - struct nlattr *bc) +static bool smc_diag_fill_base_struct(struct sock *sk, struct sk_buff *skb, + struct netlink_callback *cb, + struct smc_diag_msg *r) { struct smc_sock *smc = smc_sk(sk); - struct smc_diag_fallback fallback; struct user_namespace *user_ns; - struct smc_diag_msg *r; - struct nlmsghdr *nlh; - nlh = nlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, - cb->nlh->nlmsg_type, sizeof(*r), NLM_F_MULTI); - if (!nlh) - return -EMSGSIZE; - - r = nlmsg_data(nlh); smc_diag_msg_common_fill(r, sk); r->diag_state = sk->sk_state; if (smc->use_fallback) @@ -107,89 +97,148 @@ static int __smc_diag_dump(struct sock *sk, struct sk_buff *skb, else r->diag_mode = SMC_DIAG_MODE_SMCR; user_ns = sk_user_ns(NETLINK_CB(cb->skb).sk); - if (smc_diag_msg_attrs_fill(sk, skb, r, user_ns)) - goto errout; + if (!smc_diag_msg_attrs_fill(sk, skb, r, user_ns)) + return false; + return true; +} + +static bool smc_diag_fill_fallback(struct sock *sk, struct sk_buff *skb) +{ + struct smc_diag_fallback fallback; + struct smc_sock *smc = smc_sk(sk); + + memset(&fallback, 0, sizeof(fallback)); fallback.reason = smc->fallback_rsn; fallback.peer_diagnosis = smc->peer_diagnosis; if (nla_put(skb, SMC_DIAG_FALLBACK, sizeof(fallback), &fallback) < 0) + return false; + + return true; +} + +static bool smc_diag_fill_conninfo(struct sock *sk, struct sk_buff *skb) +{ + struct smc_host_cdc_msg *local_tx, *local_rx; + struct smc_diag_conninfo cinfo; + struct smc_connection *conn; + struct smc_sock *smc; + + smc = smc_sk(sk); + conn = &smc->conn; + local_tx = &conn->local_tx_ctrl; + local_rx = &conn->local_rx_ctrl; + memset(&cinfo, 0, sizeof(cinfo)); + cinfo.token = conn->alert_token_local; + cinfo.sndbuf_size = conn->sndbuf_desc ? conn->sndbuf_desc->len : 0; + cinfo.rmbe_size = conn->rmb_desc ? conn->rmb_desc->len : 0; + cinfo.peer_rmbe_size = conn->peer_rmbe_size; + + cinfo.rx_prod.wrap = local_rx->prod.wrap; + cinfo.rx_prod.count = local_rx->prod.count; + cinfo.rx_cons.wrap = local_rx->cons.wrap; + cinfo.rx_cons.count = local_rx->cons.count; + + cinfo.tx_prod.wrap = local_tx->prod.wrap; + cinfo.tx_prod.count = local_tx->prod.count; + cinfo.tx_cons.wrap = local_tx->cons.wrap; + cinfo.tx_cons.count = local_tx->cons.count; + + cinfo.tx_prod_flags = *(u8 *)&local_tx->prod_flags; + cinfo.tx_conn_state_flags = *(u8 *)&local_tx->conn_state_flags; + cinfo.rx_prod_flags = *(u8 *)&local_rx->prod_flags; + cinfo.rx_conn_state_flags = *(u8 *)&local_rx->conn_state_flags; + + cinfo.tx_prep.wrap = conn->tx_curs_prep.wrap; + cinfo.tx_prep.count = conn->tx_curs_prep.count; + cinfo.tx_sent.wrap = conn->tx_curs_sent.wrap; + cinfo.tx_sent.count = conn->tx_curs_sent.count; + cinfo.tx_fin.wrap = conn->tx_curs_fin.wrap; + cinfo.tx_fin.count = conn->tx_curs_fin.count; + + if (nla_put(skb, SMC_DIAG_CONNINFO, sizeof(cinfo), &cinfo) < 0) + return false; + + return true; +} + +static bool smc_diag_fill_lgrinfo(struct sock *sk, struct sk_buff *skb) +{ + struct smc_sock *smc = smc_sk(sk); + struct smc_diag_lgrinfo linfo; + + memset(&linfo, 0, sizeof(linfo)); + linfo.role = smc->conn.lgr->role; + linfo.lnk[0].ibport = smc->conn.lnk->ibport; + linfo.lnk[0].link_id = smc->conn.lnk->link_id; + memcpy(linfo.lnk[0].ibname, smc->conn.lnk->ibname, + sizeof(linfo.lnk[0].ibname)); + smc_gid_be16_convert(linfo.lnk[0].gid, + smc->conn.lnk->gid); + smc_gid_be16_convert(linfo.lnk[0].peer_gid, + smc->conn.lnk->peer_gid); + + if (nla_put(skb, SMC_DIAG_LGRINFO, sizeof(linfo), &linfo) < 0) + return false; + + return true; +} + +static bool smc_diag_fill_dmbinfo(struct sock *sk, struct sk_buff *skb) +{ + struct smc_sock *smc = smc_sk(sk); + struct smcd_diag_dmbinfo dinfo; + struct smc_connection *conn; + + memset(&dinfo, 0, sizeof(dinfo)); + conn = &smc->conn; + dinfo.linkid = *((u32 *)conn->lgr->id); + dinfo.peer_gid = conn->lgr->peer_gid; + dinfo.my_gid = conn->lgr->smcd->local_gid; + dinfo.token = conn->rmb_desc->token; + dinfo.peer_token = conn->peer_token; + + if (nla_put(skb, SMC_DIAG_DMBINFO, sizeof(dinfo), &dinfo) < 0) + return false; + return true; +} + +static int __smc_diag_dump(struct sock *sk, struct sk_buff *skb, + struct netlink_callback *cb, + const struct smc_diag_req *req) +{ + struct smc_sock *smc = smc_sk(sk); + struct smc_diag_msg *r; + struct nlmsghdr *nlh; + + nlh = nlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, + cb->nlh->nlmsg_type, sizeof(*r), NLM_F_MULTI); + if (!nlh) + return -EMSGSIZE; + + r = nlmsg_data(nlh); + if (!smc_diag_fill_base_struct(sk, skb, cb, r)) + goto errout; + + if (!smc_diag_fill_fallback(sk, skb)) goto errout; if ((req->diag_ext & (1 << (SMC_DIAG_CONNINFO - 1))) && smc->conn.alert_token_local) { - struct smc_connection *conn = &smc->conn; - struct smc_diag_conninfo cinfo = { - .token = conn->alert_token_local, - .sndbuf_size = conn->sndbuf_desc ? - conn->sndbuf_desc->len : 0, - .rmbe_size = conn->rmb_desc ? conn->rmb_desc->len : 0, - .peer_rmbe_size = conn->peer_rmbe_size, - - .rx_prod.wrap = conn->local_rx_ctrl.prod.wrap, - .rx_prod.count = conn->local_rx_ctrl.prod.count, - .rx_cons.wrap = conn->local_rx_ctrl.cons.wrap, - .rx_cons.count = conn->local_rx_ctrl.cons.count, - - .tx_prod.wrap = conn->local_tx_ctrl.prod.wrap, - .tx_prod.count = conn->local_tx_ctrl.prod.count, - .tx_cons.wrap = conn->local_tx_ctrl.cons.wrap, - .tx_cons.count = conn->local_tx_ctrl.cons.count, - - .tx_prod_flags = - *(u8 *)&conn->local_tx_ctrl.prod_flags, - .tx_conn_state_flags = - *(u8 *)&conn->local_tx_ctrl.conn_state_flags, - .rx_prod_flags = *(u8 *)&conn->local_rx_ctrl.prod_flags, - .rx_conn_state_flags = - *(u8 *)&conn->local_rx_ctrl.conn_state_flags, - - .tx_prep.wrap = conn->tx_curs_prep.wrap, - .tx_prep.count = conn->tx_curs_prep.count, - .tx_sent.wrap = conn->tx_curs_sent.wrap, - .tx_sent.count = conn->tx_curs_sent.count, - .tx_fin.wrap = conn->tx_curs_fin.wrap, - .tx_fin.count = conn->tx_curs_fin.count, - }; - - if (nla_put(skb, SMC_DIAG_CONNINFO, sizeof(cinfo), &cinfo) < 0) + if (!smc_diag_fill_conninfo(sk, skb)) goto errout; } if (smc->conn.lgr && !smc->conn.lgr->is_smcd && (req->diag_ext & (1 << (SMC_DIAG_LGRINFO - 1))) && !list_empty(&smc->conn.lgr->list)) { - struct smc_diag_lgrinfo linfo = { - .role = smc->conn.lgr->role, - .lnk[0].ibport = smc->conn.lnk->ibport, - .lnk[0].link_id = smc->conn.lnk->link_id, - }; - - memcpy(linfo.lnk[0].ibname, - smc->conn.lgr->lnk[0].smcibdev->ibdev->name, - sizeof(smc->conn.lnk->smcibdev->ibdev->name)); - smc_gid_be16_convert(linfo.lnk[0].gid, - smc->conn.lnk->gid); - smc_gid_be16_convert(linfo.lnk[0].peer_gid, - smc->conn.lnk->peer_gid); - - if (nla_put(skb, SMC_DIAG_LGRINFO, sizeof(linfo), &linfo) < 0) + if (!smc_diag_fill_lgrinfo(sk, skb)) goto errout; } if (smc->conn.lgr && smc->conn.lgr->is_smcd && (req->diag_ext & (1 << (SMC_DIAG_DMBINFO - 1))) && !list_empty(&smc->conn.lgr->list)) { - struct smc_connection *conn = &smc->conn; - struct smcd_diag_dmbinfo dinfo; - - memset(&dinfo, 0, sizeof(dinfo)); - - dinfo.linkid = *((u32 *)conn->lgr->id); - dinfo.peer_gid = conn->lgr->peer_gid; - dinfo.my_gid = conn->lgr->smcd->local_gid; - dinfo.token = conn->rmb_desc->token; - dinfo.peer_token = conn->peer_token; - - if (nla_put(skb, SMC_DIAG_DMBINFO, sizeof(dinfo), &dinfo) < 0) + if (!smc_diag_fill_dmbinfo(sk, skb)) goto errout; } @@ -207,7 +256,6 @@ static int smc_diag_dump_proto(struct proto *prot, struct sk_buff *skb, struct smc_diag_dump_ctx *cb_ctx = smc_dump_context(cb); struct net *net = sock_net(skb->sk); int snum = cb_ctx->pos[p_type]; - struct nlattr *bc = NULL; struct hlist_head *head; int rc = 0, num = 0; struct sock *sk; @@ -222,7 +270,7 @@ static int smc_diag_dump_proto(struct proto *prot, struct sk_buff *skb, continue; if (num < snum) goto next; - rc = __smc_diag_dump(sk, skb, cb, nlmsg_data(cb->nlh), bc); + rc = __smc_diag_dump(sk, skb, cb, nlmsg_data(cb->nlh)); if (rc < 0) goto out; next: From patchwork Sat Nov 7 12:59:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karsten Graul X-Patchwork-Id: 322169 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, UNWANTED_LANGUAGE_BODY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFAA9C388F7 for ; Sat, 7 Nov 2020 13:01:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7D16A20704 for ; Sat, 7 Nov 2020 13:01:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="nPQzgyI4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728233AbgKGNBM (ORCPT ); Sat, 7 Nov 2020 08:01:12 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:59390 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727611AbgKGNAT (ORCPT ); Sat, 7 Nov 2020 08:00:19 -0500 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0A7CWMe0166941; Sat, 7 Nov 2020 08:00:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=pp1; bh=LYsbEPrDtBn11qxNP1oCPQpt4OGeOM4nXfxcNca3l8M=; b=nPQzgyI4Zk8qlXCiKESfwNVrB/YaDM4Wp0NvRcONBfwt0I9GgzMEKLinGZBssg9hT1T6 TqIfVx7EKHdt4kziv0CZ8JJ33IU1Am9IMGOAzBS6B9ciZg6eqiL2OKn7C3HESMF0usnr MXD+5k3pNENSLg4DV3ANg/X4QE6lTdBMEvLRQJX2z8bc4Qrag+SVcAO+3rZyxRHwBWsE pP6i5sH0RlApliW8dLuaGkrg9lA2ayHEwul/9PeygOypPEMHgXnOJtrnVziv/mH3NJUI 3TMiEFHsVSh9h4BeKxGa9EMYpEA97XYIrxFIHUEsSVctdSytDywkH8Fk+VZ05ZpIEGam pw== Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 34nrb3cjp7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 07 Nov 2020 08:00:15 -0500 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0A7Cw3FF030885; Sat, 7 Nov 2020 13:00:13 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma03ams.nl.ibm.com with ESMTP id 34nk78gaq3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 07 Nov 2020 13:00:13 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0A7D0A7053281024 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 7 Nov 2020 13:00:10 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1C8F1A4051; Sat, 7 Nov 2020 13:00:10 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DB6B4A4083; Sat, 7 Nov 2020 13:00:09 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sat, 7 Nov 2020 13:00:09 +0000 (GMT) From: Karsten Graul To: davem@davemloft.net Cc: netdev@vger.kernel.org, linux-s390@vger.kernel.org, hca@linux.ibm.com, raspl@linux.ibm.com Subject: [PATCH net-next v3 09/15] net/smc: Introduce SMCR get linkgroup command Date: Sat, 7 Nov 2020 13:59:52 +0100 Message-Id: <20201107125958.16384-10-kgraul@linux.ibm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201107125958.16384-1-kgraul@linux.ibm.com> References: <20201107125958.16384-1-kgraul@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312, 18.0.737 definitions=2020-11-07_07:2020-11-05,2020-11-07 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_spam_definite policy=outbound score=100 mlxlogscore=-1000 malwarescore=0 mlxscore=100 adultscore=0 clxscore=1015 priorityscore=1501 lowpriorityscore=0 bulkscore=0 impostorscore=0 suspectscore=0 phishscore=0 spamscore=100 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011070081 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Guvenc Gulce Introduce get linkgroup command which loops through all available SMCR linkgroups. It uses the SMC-R linkgroup list as entry point, not the socket list, which makes linkgroup diagnosis possible, in case linkgroup does not contain active connections anymore. Signed-off-by: Guvenc Gulce Signed-off-by: Karsten Graul --- include/net/smc.h | 2 +- include/uapi/linux/smc.h | 5 ++ include/uapi/linux/smc_diag.h | 43 +++++++++++++++++ net/smc/smc.h | 4 +- net/smc/smc_core.c | 15 ++++++ net/smc/smc_core.h | 7 ++- net/smc/smc_diag.c | 91 +++++++++++++++++++++++++++++++++++ 7 files changed, 162 insertions(+), 5 deletions(-) diff --git a/include/net/smc.h b/include/net/smc.h index e441aa97ad61..59d25dcb8e92 100644 --- a/include/net/smc.h +++ b/include/net/smc.h @@ -10,8 +10,8 @@ */ #ifndef _SMC_H #define _SMC_H +#include -#define SMC_MAX_PNETID_LEN 16 /* Max. length of PNET id */ struct smc_hashinfo { rwlock_t lock; diff --git a/include/uapi/linux/smc.h b/include/uapi/linux/smc.h index 0e11ca421ca4..635e2c2aeac5 100644 --- a/include/uapi/linux/smc.h +++ b/include/uapi/linux/smc.h @@ -3,6 +3,7 @@ * Shared Memory Communications over RDMA (SMC-R) and RoCE * * Definitions for generic netlink based configuration of an SMC-R PNET table + * Definitions for SMC Linkgroup and Devices. * * Copyright IBM Corp. 2016 * @@ -33,4 +34,8 @@ enum { /* SMC PNET Table commands */ #define SMCR_GENL_FAMILY_NAME "SMC_PNETID" #define SMCR_GENL_FAMILY_VERSION 1 +#define SMC_MAX_PNETID_LEN 16 /* Max. length of PNET id */ +#define SMC_LGR_ID_SIZE 4 +#define SMC_MAX_HOSTNAME_LEN 32 /* Max length of hostname */ +#define SMC_MAX_EID_LEN 32 /* Max length of eid */ #endif /* _UAPI_LINUX_SMC_H */ diff --git a/include/uapi/linux/smc_diag.h b/include/uapi/linux/smc_diag.h index 236c1c52d562..6ae028344b6d 100644 --- a/include/uapi/linux/smc_diag.h +++ b/include/uapi/linux/smc_diag.h @@ -4,8 +4,10 @@ #include #include +#include #include +#define SMC_DIAG_EXTS_PER_CMD 16 /* Sequence numbers */ enum { MAGIC_SEQ = 123456, @@ -21,6 +23,17 @@ struct smc_diag_req { struct inet_diag_sockid id; }; +/* Request structure v2 */ +struct smc_diag_req_v2 { + __u8 diag_family; + __u8 pad[2]; + __u8 diag_ext; /* Query extended information */ + struct inet_diag_sockid id; + __u32 cmd; + __u32 cmd_ext; + __u8 cmd_val[8]; +}; + /* Base info structure. It contains socket identity (addrs/ports/cookie) based * on the internal clcsock, and more SMC-related socket data */ @@ -57,7 +70,19 @@ enum { __SMC_DIAG_MAX, }; +/* V2 Commands */ +enum { + SMC_DIAG_GET_LGR_INFO = SMC_DIAG_EXTS_PER_CMD, + __SMC_DIAG_EXT_MAX, +}; + +/* SMC_DIAG_GET_LGR_INFO command extensions */ +enum { + SMC_DIAG_LGR_INFO_SMCR = 1, +}; + #define SMC_DIAG_MAX (__SMC_DIAG_MAX - 1) +#define SMC_DIAG_EXT_MAX (__SMC_DIAG_EXT_MAX - 1) /* SMC_DIAG_CONNINFO */ @@ -88,6 +113,14 @@ struct smc_diag_conninfo { struct smc_diag_cursor tx_fin; /* confirmed sent cursor */ }; +struct smc_diag_v2_lgr_info { + __u8 smc_version; /* SMC Version */ + __u8 peer_smc_release; /* Peer SMC Version */ + __u8 peer_os; /* Peer operating system */ + __u8 negotiated_eid[SMC_MAX_EID_LEN]; /* Negotiated EID */ + __u8 peer_hostname[SMC_MAX_HOSTNAME_LEN]; /* Peer host */ +}; + /* SMC_DIAG_LINKINFO */ struct smc_diag_linkinfo { @@ -116,4 +149,14 @@ struct smcd_diag_dmbinfo { /* SMC-D Socket internals */ __aligned_u64 peer_token; /* Token of remote DMBE */ }; +struct smc_diag_lgr { + __u8 lgr_id[SMC_LGR_ID_SIZE]; /* Linkgroup identifier */ + __u8 lgr_role; /* Linkgroup role */ + __u8 lgr_type; /* Linkgroup type */ + __u8 pnet_id[SMC_MAX_PNETID_LEN]; /* Linkgroup pnet id */ + __u8 vlan_id; /* Linkgroup vland id */ + __u32 conns_num; /* Number of connections */ + __u8 reserved; /* Reserved for future use */ + struct smc_diag_v2_lgr_info v2_lgr_info; /* SMCv2 info */ +}; #endif /* _UAPI_SMC_DIAG_H_ */ diff --git a/net/smc/smc.h b/net/smc/smc.h index d65e15f0c944..d3bf81759285 100644 --- a/net/smc/smc.h +++ b/net/smc/smc.h @@ -14,6 +14,7 @@ #include #include #include /* __aligned */ +#include #include #include "smc_ib.h" @@ -29,9 +30,6 @@ * devices */ -#define SMC_MAX_HOSTNAME_LEN 32 -#define SMC_MAX_EID_LEN 32 - extern struct proto smc_proto; extern struct proto smc_proto6; diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c index ef0aae43a209..07b7cc88f9b9 100644 --- a/net/smc/smc_core.c +++ b/net/smc/smc_core.c @@ -204,6 +204,21 @@ static void smc_lgr_unregister_conn(struct smc_connection *conn) conn->lgr = NULL; } +static struct smc_lgr_list *smc_get_lgr_list(void) +{ + return &smc_lgr_list; +} + +static const struct smc_diag_ops smc_diag_ops = { + .get_lgr_list = smc_get_lgr_list, +}; + +const struct smc_diag_ops *smc_get_diag_ops(void) +{ + return &smc_diag_ops; +} +EXPORT_SYMBOL_GPL(smc_get_diag_ops); + void smc_lgr_cleanup_early(struct smc_connection *conn) { struct smc_link_group *lgr = conn->lgr; diff --git a/net/smc/smc_core.h b/net/smc/smc_core.h index a6ba9cc8c60e..0b6951a0b2d8 100644 --- a/net/smc/smc_core.h +++ b/net/smc/smc_core.h @@ -20,6 +20,11 @@ #define SMC_RMBS_PER_LGR_MAX 255 /* max. # of RMBs per link group */ +/* Functions which are needed for diagnostic purposes by smc_diag module */ +struct smc_diag_ops { + struct smc_lgr_list *(*get_lgr_list)(void); +}; + struct smc_lgr_list { /* list of link group definition */ struct list_head list; spinlock_t lock; /* protects list of link groups */ @@ -70,7 +75,6 @@ struct smc_rdma_wr { /* work requests per message struct ib_rdma_wr wr_tx_rdma[SMC_MAX_RDMA_WRITES]; }; -#define SMC_LGR_ID_SIZE 4 struct smc_link { struct smc_ib_device *smcibdev; /* ib-device */ @@ -424,6 +428,7 @@ struct smc_link *smc_switch_conns(struct smc_link_group *lgr, struct smc_link *from_lnk, bool is_dev_err); void smcr_link_down_cond(struct smc_link *lnk); void smcr_link_down_cond_sched(struct smc_link *lnk); +const struct smc_diag_ops *smc_get_diag_ops(void); static inline struct smc_link_group *smc_get_lgr(struct smc_link *link) { diff --git a/net/smc/smc_diag.c b/net/smc/smc_diag.c index bc2b616524ff..c958b23843e6 100644 --- a/net/smc/smc_diag.c +++ b/net/smc/smc_diag.c @@ -22,6 +22,8 @@ #include "smc.h" #include "smc_core.h" +static const struct smc_diag_ops *smc_diag_ops; + struct smc_diag_dump_ctx { int pos[2]; }; @@ -203,6 +205,86 @@ static bool smc_diag_fill_dmbinfo(struct sock *sk, struct sk_buff *skb) return true; } +static int smc_diag_fill_lgr(struct smc_link_group *lgr, + struct sk_buff *skb, + struct netlink_callback *cb, + struct smc_diag_req_v2 *req) +{ + struct smc_diag_lgr lgr_link; + int dummy = 0; + int rc = 0; + + memset(&lgr_link, 0, sizeof(lgr_link)); + memcpy(&lgr_link.lgr_id, lgr->id, sizeof(lgr->id)); + lgr_link.lgr_role = lgr->role; + lgr_link.lgr_type = lgr->type; + lgr_link.conns_num = lgr->conns_num; + lgr_link.vlan_id = lgr->vlan_id; + memcpy(lgr_link.pnet_id, lgr->pnet_id, sizeof(lgr_link.pnet_id)); + + /* Just a command place holder to signal back the command reply type */ + if (nla_put(skb, SMC_DIAG_GET_LGR_INFO, sizeof(dummy), &dummy) < 0) + goto errout; + if (nla_put(skb, SMC_DIAG_LGR_INFO_SMCR, + sizeof(lgr_link), &lgr_link) < 0) + goto errout; + + return rc; +errout: + return -EMSGSIZE; +} + +static int smc_diag_handle_lgr(struct smc_link_group *lgr, + struct sk_buff *skb, + struct netlink_callback *cb, + struct smc_diag_req_v2 *req) +{ + struct nlmsghdr *nlh; + int rc = 0; + + nlh = nlmsg_put(skb, NETLINK_CB(cb->skb).portid, MAGIC_SEQ_V2_ACK, + cb->nlh->nlmsg_type, 0, NLM_F_MULTI); + if (!nlh) + return -EMSGSIZE; + + rc = smc_diag_fill_lgr(lgr, skb, cb, req); + if (rc < 0) + goto errout; + + nlmsg_end(skb, nlh); + return rc; + +errout: + nlmsg_cancel(skb, nlh); + return rc; +} + +static int smc_diag_fill_lgr_list(struct smc_lgr_list *smc_lgr, + struct sk_buff *skb, + struct netlink_callback *cb, + struct smc_diag_req_v2 *req) +{ + struct smc_diag_dump_ctx *cb_ctx = smc_dump_context(cb); + struct smc_link_group *lgr; + int snum = cb_ctx->pos[0]; + int rc = 0, num = 0; + + spin_lock_bh(&smc_lgr->lock); + list_for_each_entry(lgr, &smc_lgr->list, list) { + if (num < snum) + goto next; + rc = smc_diag_handle_lgr(lgr, skb, cb, req); + if (rc < 0) + goto errout; +next: + num++; + } +errout: + spin_unlock_bh(&smc_lgr->lock); + cb_ctx->pos[0] = num; + return rc; +} + static int __smc_diag_dump(struct sock *sk, struct sk_buff *skb, struct netlink_callback *cb, const struct smc_diag_req *req) @@ -295,6 +377,14 @@ static int smc_diag_dump(struct sk_buff *skb, struct netlink_callback *cb) static int smc_diag_dump_ext(struct sk_buff *skb, struct netlink_callback *cb) { + struct smc_diag_req_v2 *req = nlmsg_data(cb->nlh); + + if (req->cmd == SMC_DIAG_GET_LGR_INFO) { + if ((req->cmd_ext & (1 << (SMC_DIAG_LGR_INFO_SMCR - 1)))) + smc_diag_fill_lgr_list(smc_diag_ops->get_lgr_list(), + skb, cb, req); + } + return skb->len; } @@ -322,6 +412,7 @@ static const struct sock_diag_handler smc_diag_handler = { static int __init smc_diag_init(void) { + smc_diag_ops = smc_get_diag_ops(); return sock_diag_register(&smc_diag_handler); } From patchwork Sat Nov 7 12:59:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karsten Graul X-Patchwork-Id: 322168 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C54AFC388F7 for ; Sat, 7 Nov 2020 13:01:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8A93320704 for ; Sat, 7 Nov 2020 13:01:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="W+46vTSa" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728250AbgKGNBS (ORCPT ); Sat, 7 Nov 2020 08:01:18 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:60648 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727824AbgKGNAS (ORCPT ); Sat, 7 Nov 2020 08:00:18 -0500 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0A7CVUux095928; Sat, 7 Nov 2020 08:00:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=pp1; bh=DUuAsc1H3IW9RLmWr3gokQa6/Wwx4onVCTX1skFj8oY=; b=W+46vTSaeMPzOvG1+7TveHoz9H7W1piHYUIvtvNB8P4bC8++yvnLQaAFgGp1dmPOQb24 d53/Y6XIimBjT5tkzEC4umuXbfzgxht/69O+PC5OK8FDV4jVzfBgxNPoB7iECzrfnfMu H1WqeUM7w1wIsQFt2Uw/skiuO4AadULdOkwLScdHjzi041lWE2GwQNcpyBpZG9Fzza68 GyDhqgcrO23od9oBI16uyTKNtgfZQ9drPWFlGiZE2tkm75n0d4Yzk0d3xcNi0Pli9Don LKdulH8HD4xHMlEdVZO/6MI1ysR6ZjbPvMwrzqUZoWk//eVskfuapsWCFqOpt2EKhqES YQ== Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0b-001b2d01.pphosted.com with ESMTP id 34nrmxv60d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 07 Nov 2020 08:00:15 -0500 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0A7CvNIs021144; Sat, 7 Nov 2020 13:00:13 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma06ams.nl.ibm.com with ESMTP id 34njuh0b1j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 07 Nov 2020 13:00:13 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0A7D0AwJ43712880 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 7 Nov 2020 13:00:10 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 933B5A405B; Sat, 7 Nov 2020 13:00:10 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 62E59A4053; Sat, 7 Nov 2020 13:00:10 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sat, 7 Nov 2020 13:00:10 +0000 (GMT) From: Karsten Graul To: davem@davemloft.net Cc: netdev@vger.kernel.org, linux-s390@vger.kernel.org, hca@linux.ibm.com, raspl@linux.ibm.com Subject: [PATCH net-next v3 11/15] net/smc: Add SMC-D Linkgroup diagnostic support Date: Sat, 7 Nov 2020 13:59:54 +0100 Message-Id: <20201107125958.16384-12-kgraul@linux.ibm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201107125958.16384-1-kgraul@linux.ibm.com> References: <20201107125958.16384-1-kgraul@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312, 18.0.737 definitions=2020-11-07_07:2020-11-05,2020-11-07 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_spam_definite policy=outbound score=100 bulkscore=0 lowpriorityscore=0 impostorscore=0 mlxscore=100 spamscore=100 malwarescore=0 suspectscore=0 adultscore=0 mlxlogscore=-1000 phishscore=0 clxscore=1015 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011070081 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Guvenc Gulce Deliver SMCD Linkgroup information via netlink based diagnostic interface. Signed-off-by: Guvenc Gulce Signed-off-by: Karsten Graul --- include/uapi/linux/smc_diag.h | 7 +++ net/smc/smc_core.c | 7 +++ net/smc/smc_core.h | 2 + net/smc/smc_diag.c | 108 ++++++++++++++++++++++++++++++++++ 4 files changed, 124 insertions(+) diff --git a/include/uapi/linux/smc_diag.h b/include/uapi/linux/smc_diag.h index a57df0296aa4..5a80172df757 100644 --- a/include/uapi/linux/smc_diag.h +++ b/include/uapi/linux/smc_diag.h @@ -81,6 +81,7 @@ enum { enum { SMC_DIAG_LGR_INFO_SMCR = 1, SMC_DIAG_LGR_INFO_SMCR_LINK, + SMC_DIAG_LGR_INFO_SMCD, }; #define SMC_DIAG_MAX (__SMC_DIAG_MAX - 1) @@ -155,6 +156,12 @@ struct smcd_diag_dmbinfo { /* SMC-D Socket internals */ __aligned_u64 my_gid; /* My GID */ __aligned_u64 token; /* Token of DMB */ __aligned_u64 peer_token; /* Token of remote DMBE */ + /* Fields above used by legacy v1 code */ + __u8 pnet_id[SMC_MAX_PNETID_LEN]; /* Pnet ID */ + __u32 conns_num; /* Number of connections */ + __u16 chid; /* Linkgroup CHID */ + __u8 vlan_id; /* Linkgroup vlan id */ + struct smc_diag_v2_lgr_info v2_lgr_info; /* SMCv2 info */ }; struct smc_diag_lgr { diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c index 07b7cc88f9b9..c711b4967547 100644 --- a/net/smc/smc_core.c +++ b/net/smc/smc_core.c @@ -204,6 +204,11 @@ static void smc_lgr_unregister_conn(struct smc_connection *conn) conn->lgr = NULL; } +static struct smcd_dev_list *smc_get_smcd_dev_list(void) +{ + return &smcd_dev_list; +} + static struct smc_lgr_list *smc_get_lgr_list(void) { return &smc_lgr_list; @@ -211,6 +216,8 @@ static struct smc_lgr_list *smc_get_lgr_list(void) static const struct smc_diag_ops smc_diag_ops = { .get_lgr_list = smc_get_lgr_list, + .get_smcd_devices = smc_get_smcd_dev_list, + .get_chid = smc_ism_get_chid, }; const struct smc_diag_ops *smc_get_diag_ops(void) diff --git a/net/smc/smc_core.h b/net/smc/smc_core.h index 0b6951a0b2d8..a705a67d6a39 100644 --- a/net/smc/smc_core.h +++ b/net/smc/smc_core.h @@ -23,6 +23,8 @@ /* Functions which are needed for diagnostic purposes by smc_diag module */ struct smc_diag_ops { struct smc_lgr_list *(*get_lgr_list)(void); + struct smcd_dev_list *(*get_smcd_devices)(void); + u16 (*get_chid)(struct smcd_dev *smcd); }; struct smc_lgr_list { /* list of link group definition */ diff --git a/net/smc/smc_diag.c b/net/smc/smc_diag.c index 9a41548d6263..a644e2299dbc 100644 --- a/net/smc/smc_diag.c +++ b/net/smc/smc_diag.c @@ -21,6 +21,7 @@ #include "smc.h" #include "smc_ib.h" +#include "smc_ism.h" #include "smc_core.h" static const struct smc_diag_ops *smc_diag_ops; @@ -254,6 +255,53 @@ static int smc_diag_fill_lgr_link(struct smc_link_group *lgr, return -EMSGSIZE; } +static int smc_diag_fill_smcd_lgr(struct smc_link_group *lgr, + struct sk_buff *skb, + struct netlink_callback *cb, + struct smc_diag_req_v2 *req) +{ + struct smcd_diag_dmbinfo smcd_lgr; + struct nlmsghdr *nlh; + int dummy = 0; + int rc = 0; + + nlh = nlmsg_put(skb, NETLINK_CB(cb->skb).portid, MAGIC_SEQ_V2_ACK, + cb->nlh->nlmsg_type, 0, NLM_F_MULTI); + if (!nlh) + return -EMSGSIZE; + + memset(&smcd_lgr, 0, sizeof(smcd_lgr)); + memcpy(&smcd_lgr.linkid, lgr->id, sizeof(lgr->id)); + smcd_lgr.conns_num = lgr->conns_num; + smcd_lgr.vlan_id = lgr->vlan_id; + smcd_lgr.peer_gid = lgr->peer_gid; + smcd_lgr.my_gid = lgr->smcd->local_gid; + smcd_lgr.chid = smc_diag_ops->get_chid(lgr->smcd); + memcpy(&smcd_lgr.v2_lgr_info.negotiated_eid, lgr->negotiated_eid, + sizeof(smcd_lgr.v2_lgr_info.negotiated_eid)); + memcpy(&smcd_lgr.v2_lgr_info.peer_hostname, lgr->peer_hostname, + sizeof(smcd_lgr.v2_lgr_info.peer_hostname)); + smcd_lgr.v2_lgr_info.peer_os = lgr->peer_os; + smcd_lgr.v2_lgr_info.peer_smc_release = lgr->peer_smc_release; + smcd_lgr.v2_lgr_info.smc_version = lgr->smc_version; + snprintf(smcd_lgr.pnet_id, sizeof(smcd_lgr.pnet_id), "%s", + lgr->smcd->pnetid); + + /* Just a command place holder to signal back the command reply type */ + if (nla_put(skb, SMC_DIAG_GET_LGR_INFO, sizeof(dummy), &dummy) < 0) + goto errout; + + if (nla_put(skb, SMC_DIAG_LGR_INFO_SMCD, + sizeof(smcd_lgr), &smcd_lgr) < 0) + goto errout; + + nlmsg_end(skb, nlh); + return rc; +errout: + nlmsg_cancel(skb, nlh); + return -EMSGSIZE; +} + static int smc_diag_fill_lgr(struct smc_link_group *lgr, struct sk_buff *skb, struct netlink_callback *cb, @@ -345,6 +393,63 @@ static int smc_diag_fill_lgr_list(struct smc_lgr_list *smc_lgr, return rc; } +static int smc_diag_handle_smcd_lgr(struct smcd_dev *dev, + struct sk_buff *skb, + struct netlink_callback *cb, + struct smc_diag_req_v2 *req) +{ + struct smc_diag_dump_ctx *cb_ctx = smc_dump_context(cb); + struct smc_link_group *lgr; + int snum = cb_ctx->pos[1]; + int rc = 0, num = 0; + + spin_lock_bh(&dev->lgr_lock); + list_for_each_entry(lgr, &dev->lgr_list, list) { + if (!lgr->is_smcd) + continue; + if (num < snum) + goto next; + rc = smc_diag_fill_smcd_lgr(lgr, skb, cb, req); + if (rc < 0) + goto errout; +next: + num++; + } +errout: + spin_unlock_bh(&dev->lgr_lock); + cb_ctx->pos[1] = num; + return rc; +} + +static int smc_diag_fill_smcd_dev(struct smcd_dev_list *dev_list, + struct sk_buff *skb, + struct netlink_callback *cb, + struct smc_diag_req_v2 *req) +{ + struct smc_diag_dump_ctx *cb_ctx = smc_dump_context(cb); + struct smcd_dev *smcd_dev; + int snum = cb_ctx->pos[0]; + int rc = 0, num = 0; + + mutex_lock(&dev_list->mutex); + list_for_each_entry(smcd_dev, &dev_list->list, list) { + if (list_empty(&smcd_dev->lgr_list)) + continue; + if (num < snum) + goto next; + rc = smc_diag_handle_smcd_lgr(smcd_dev, skb, + cb, req); + if (rc < 0) + goto errout; +next: + num++; + } +errout: + mutex_unlock(&dev_list->mutex); + cb_ctx->pos[0] = num; + return rc; +} + static int __smc_diag_dump(struct sock *sk, struct sk_buff *skb, struct netlink_callback *cb, const struct smc_diag_req *req) @@ -443,6 +548,9 @@ static int smc_diag_dump_ext(struct sk_buff *skb, struct netlink_callback *cb) if ((req->cmd_ext & (1 << (SMC_DIAG_LGR_INFO_SMCR - 1)))) smc_diag_fill_lgr_list(smc_diag_ops->get_lgr_list(), skb, cb, req); + if ((req->cmd_ext & (1 << (SMC_DIAG_LGR_INFO_SMCD - 1)))) + smc_diag_fill_smcd_dev(smc_diag_ops->get_smcd_devices(), + skb, cb, req); } return skb->len; From patchwork Sat Nov 7 12:59:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karsten Graul X-Patchwork-Id: 322173 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, UNWANTED_LANGUAGE_BODY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3ADAEC4742C for ; Sat, 7 Nov 2020 13:00:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DC960206D4 for ; Sat, 7 Nov 2020 13:00:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="eGBihWlL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728139AbgKGNAg (ORCPT ); Sat, 7 Nov 2020 08:00:36 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:57978 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727908AbgKGNAR (ORCPT ); Sat, 7 Nov 2020 08:00:17 -0500 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0A7CWieG032536; Sat, 7 Nov 2020 08:00:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=pp1; bh=igFlspmE1VIOYeYoPdYXWsLuWrBz+DfjGfVAnx0r1Tg=; b=eGBihWlLK46Ap/ioCgnRzGmukNId+dfzB+kpZbKbHmCg1Nue7QcK6Nbl16sNT0HIj9hS MhnNQNlK2EIcrSpXHdoGu3bv+ql4bmWmpdbMY6wZe25w+UUudqxXpOgXdEPRwX5CslY9 tnrEVEo0L3gaSYsGUmtV6HqSmIctaSJzVkLbfWteb9AkjYf9a3W8AfGc6OECyg+avtpn vqiG/RtifJFCGpWdtxtuz1xtk8HChFwMs9YvhRW4BEMqJW9LpmKCAvO7jp4Hwg6wtflY 3a0LtHwubRYPqK8zSyoXv4INI/l52NQAyhgAaRUOFOzzptokiqn+7N/F4WHkxLcOJNO8 qg== Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 34nrm747ju-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 07 Nov 2020 08:00:16 -0500 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0A7CxLi8003937; Sat, 7 Nov 2020 13:00:14 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma04fra.de.ibm.com with ESMTP id 34nk77r5cq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 07 Nov 2020 13:00:14 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0A7D0Baw26214700 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 7 Nov 2020 13:00:11 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8B512A407C; Sat, 7 Nov 2020 13:00:11 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 64A8FA4072; Sat, 7 Nov 2020 13:00:11 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sat, 7 Nov 2020 13:00:11 +0000 (GMT) From: Karsten Graul To: davem@davemloft.net Cc: netdev@vger.kernel.org, linux-s390@vger.kernel.org, hca@linux.ibm.com, raspl@linux.ibm.com Subject: [PATCH net-next v3 15/15] net/smc: Add support for obtaining system information Date: Sat, 7 Nov 2020 13:59:58 +0100 Message-Id: <20201107125958.16384-16-kgraul@linux.ibm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201107125958.16384-1-kgraul@linux.ibm.com> References: <20201107125958.16384-1-kgraul@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312, 18.0.737 definitions=2020-11-07_07:2020-11-05,2020-11-07 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_spam_definite policy=outbound score=100 clxscore=1015 lowpriorityscore=0 suspectscore=0 phishscore=0 bulkscore=0 malwarescore=0 priorityscore=1501 mlxscore=100 mlxlogscore=-1000 adultscore=0 spamscore=100 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011070085 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Guvenc Gulce Add new netlink command to obtain system information of the smc module. Signed-off-by: Guvenc Gulce Signed-off-by: Karsten Graul --- include/uapi/linux/smc.h | 1 + include/uapi/linux/smc_diag.h | 18 +++++++++++ net/smc/smc_clc.c | 5 +++ net/smc/smc_clc.h | 1 + net/smc/smc_core.c | 3 ++ net/smc/smc_core.h | 3 ++ net/smc/smc_diag.c | 61 +++++++++++++++++++++++++++++++++++ 7 files changed, 92 insertions(+) diff --git a/include/uapi/linux/smc.h b/include/uapi/linux/smc.h index 736e8b98c8a5..04385a98037a 100644 --- a/include/uapi/linux/smc.h +++ b/include/uapi/linux/smc.h @@ -38,6 +38,7 @@ enum { /* SMC PNET Table commands */ #define SMC_LGR_ID_SIZE 4 #define SMC_MAX_HOSTNAME_LEN 32 /* Max length of hostname */ #define SMC_MAX_EID_LEN 32 /* Max length of eid */ +#define SMC_MAX_EID 8 /* Max number of eids */ #define SMC_MAX_PORTS 2 /* Max # of ports per ib device */ #define SMC_PCI_ID_STR_LEN 16 /* Max length of pci id string */ #endif /* _UAPI_LINUX_SMC_H */ diff --git a/include/uapi/linux/smc_diag.h b/include/uapi/linux/smc_diag.h index 4c6332785533..7409e7a854df 100644 --- a/include/uapi/linux/smc_diag.h +++ b/include/uapi/linux/smc_diag.h @@ -75,6 +75,7 @@ enum { enum { SMC_DIAG_GET_LGR_INFO = SMC_DIAG_EXTS_PER_CMD, SMC_DIAG_GET_DEV_INFO, + SMC_DIAG_GET_SYS_INFO, __SMC_DIAG_EXT_MAX, }; @@ -91,6 +92,11 @@ enum { SMC_DIAG_DEV_INFO_SMCR, }; +/* SMC_DIAG_GET_SYS_INFO command extensions */ +enum { + SMC_DIAG_SYS_INFO = 1, +}; + #define SMC_DIAG_MAX (__SMC_DIAG_MAX - 1) #define SMC_DIAG_EXT_MAX (__SMC_DIAG_EXT_MAX - 1) @@ -131,6 +137,18 @@ struct smc_diag_v2_lgr_info { __u8 peer_hostname[SMC_MAX_HOSTNAME_LEN]; /* Peer host */ }; + +struct smc_system_info { + __u8 smc_version; /* SMC Version */ + __u8 smc_release; /* SMC Release */ + __u8 ueid_count; /* Number of UEIDs */ + __u8 smc_ism_is_v2; /* Is ISM SMC v2 capable */ + __u32 reserved; /* Reserved for future use */ + __u8 local_hostname[SMC_MAX_HOSTNAME_LEN]; /* Hostnames */ + __u8 seid[SMC_MAX_EID_LEN]; /* System EID */ + __u8 ueid[SMC_MAX_EID][SMC_MAX_EID_LEN]; /* User EIDs */ +}; + /* SMC_DIAG_LINKINFO */ struct smc_diag_linkinfo { diff --git a/net/smc/smc_clc.c b/net/smc/smc_clc.c index 696d89c2dce4..e286dafd6e88 100644 --- a/net/smc/smc_clc.c +++ b/net/smc/smc_clc.c @@ -772,6 +772,11 @@ int smc_clc_send_accept(struct smc_sock *new_smc, bool srv_first_contact, return len > 0 ? 0 : len; } +void smc_clc_get_hostname(u8 **host) +{ + *host = &smc_hostname[0]; +} + void __init smc_clc_init(void) { struct new_utsname *u; diff --git a/net/smc/smc_clc.h b/net/smc/smc_clc.h index e7ab05683bc9..9ed9eb3abe46 100644 --- a/net/smc/smc_clc.h +++ b/net/smc/smc_clc.h @@ -334,5 +334,6 @@ int smc_clc_send_confirm(struct smc_sock *smc, bool clnt_first_contact, int smc_clc_send_accept(struct smc_sock *smc, bool srv_first_contact, u8 version); void smc_clc_init(void) __init; +void smc_clc_get_hostname(u8 **host); #endif diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c index d31e00f13473..34b77b46ce1d 100644 --- a/net/smc/smc_core.c +++ b/net/smc/smc_core.c @@ -225,6 +225,9 @@ static const struct smc_diag_ops smc_diag_ops = { .get_chid = smc_ism_get_chid, .get_ib_devices = smc_get_smc_ib_devices, .is_ib_port_active = smc_ib_port_active, + .get_system_eid = smc_ism_get_system_eid, + .get_hostname = smc_clc_get_hostname, + .is_v2_capable = smc_ism_is_v2_capable, }; const struct smc_diag_ops *smc_get_diag_ops(void) diff --git a/net/smc/smc_core.h b/net/smc/smc_core.h index 0b175f5931ca..acbc41fb3a10 100644 --- a/net/smc/smc_core.h +++ b/net/smc/smc_core.h @@ -28,6 +28,9 @@ struct smc_diag_ops { u16 (*get_chid)(struct smcd_dev *smcd); struct smc_ib_devices *(*get_ib_devices)(void); bool (*is_ib_port_active)(struct smc_ib_device *smcibdev, u8 ibport); + void (*get_system_eid)(struct smcd_dev *smcd, u8 **eid); + void (*get_hostname)(u8 **host); + bool (*is_v2_capable)(void); }; struct smc_lgr_list { /* list of link group definition */ diff --git a/net/smc/smc_diag.c b/net/smc/smc_diag.c index 725516f8d025..ab185f4e4412 100644 --- a/net/smc/smc_diag.c +++ b/net/smc/smc_diag.c @@ -652,6 +652,63 @@ static int smc_diag_prep_smcr_dev(struct smc_ib_devices *dev_list, return rc; } +static int smc_diag_prep_sys_info(struct smcd_dev_list *dev_list, + struct sk_buff *skb, + struct netlink_callback *cb, + struct smc_diag_req_v2 *req) +{ + struct smc_diag_dump_ctx *cb_ctx = smc_dump_context(cb); + struct smc_system_info smc_sys_info; + int dummy = 0, rc = 0, num = 0; + struct smcd_dev *smcd_dev; + int snum = cb_ctx->pos[0]; + struct nlmsghdr *nlh; + u8 *seid = NULL; + u8 *host = NULL; + + nlh = nlmsg_put(skb, NETLINK_CB(cb->skb).portid, MAGIC_SEQ_V2_ACK, + cb->nlh->nlmsg_type, 0, NLM_F_MULTI); + if (!nlh) + return -EMSGSIZE; + + if (snum > num) + goto errout; + + memset(&smc_sys_info, 0, sizeof(smc_sys_info)); + smc_sys_info.smc_ism_is_v2 = smc_diag_ops->is_v2_capable(); + smc_sys_info.smc_version = SMC_V2; + smc_sys_info.smc_release = SMC_RELEASE; + smc_diag_ops->get_hostname(&host); + + if (host) + memcpy(smc_sys_info.local_hostname, host, + sizeof(smc_sys_info.local_hostname)); + mutex_lock(&dev_list->mutex); + smcd_dev = list_first_entry_or_null(&dev_list->list, struct smcd_dev, list); + if (smcd_dev) + smc_diag_ops->get_system_eid(smcd_dev, &seid); + mutex_unlock(&dev_list->mutex); + + if (seid && smc_sys_info.smc_ism_is_v2) + memcpy(smc_sys_info.seid, seid, sizeof(smc_sys_info.seid)); + + /* Just a command place holder to signal back the command reply type */ + if (nla_put(skb, SMC_DIAG_GET_SYS_INFO, sizeof(dummy), &dummy) < 0) + goto errout; + + if (nla_put(skb, SMC_DIAG_SYS_INFO, + sizeof(smc_sys_info), &smc_sys_info) < 0) + goto errout; + nlmsg_end(skb, nlh); + num++; + cb_ctx->pos[0] = num; + return rc; + +errout: + nlmsg_cancel(skb, nlh); + return -EMSGSIZE; +} + static int __smc_diag_dump(struct sock *sk, struct sk_buff *skb, struct netlink_callback *cb, const struct smc_diag_req *req) @@ -760,6 +817,10 @@ static int smc_diag_dump_ext(struct sk_buff *skb, struct netlink_callback *cb) if ((req->cmd_ext & (1 << (SMC_DIAG_DEV_INFO_SMCR - 1)))) smc_diag_prep_smcr_dev(smc_diag_ops->get_ib_devices(), skb, cb, req); + } else if (req->cmd == SMC_DIAG_GET_SYS_INFO) { + if ((req->cmd_ext & (1 << (SMC_DIAG_SYS_INFO - 1)))) + smc_diag_prep_sys_info(smc_diag_ops->get_smcd_devices(), + skb, cb, req); } return skb->len;