From patchwork Thu Nov 1 13:18:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 10663959 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4314E157A for ; Thu, 1 Nov 2018 13:19:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3467F2B463 for ; Thu, 1 Nov 2018 13:19:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 274D32B661; Thu, 1 Nov 2018 13:19:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E3282B463 for ; Thu, 1 Nov 2018 13:19:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728357AbeKAWWu (ORCPT ); Thu, 1 Nov 2018 18:22:50 -0400 Received: from esa7.dell-outbound.iphmx.com ([68.232.153.96]:17799 "EHLO esa7.dell-outbound.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727644AbeKAWWu (ORCPT ); Thu, 1 Nov 2018 18:22:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dell.com; i=@dell.com; q=dns/txt; s=smtpout; t=1541078391; x=1572614391; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=Leop7xfao/I9uAYv7ANVNseUvfwGUNUMlRzWYZXsGEw=; b=wUos9FJUIFkSShoEicU5mV7qP2mCBWe/tNeSHrfgd/Ykfw0DF0xw0Vc6 GCu/SW6h3Z7mpOJ+hSEj9SZy6qJZU1FO52DbgH3AU2z4/UvjQsz3/ZChs 17LiZ+kOscRoqL/n9iWHezv6kDm0cXCvaK1g9W4DPGh/kwLTlpI3PEF/A E=; X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2EmAAAv/NpbhyWd50NkHQEBBQEHBQGBUgcBCwGDaSiMbaRvgXoLAQGEbAKDOiI1DA0BAwEBAgEBAgEBAhABAQEKCwkIKS+CNiKCZAIBAxIVSggQUVcHEiKCf4ICnD8CgRCJWAEBAYFoM4och0aEJoFYP4ERgmSLBwKfIgcCghIEjmkLGJBTlxACBAIEBQIUgUUCggozGiODPIImDgmONlOLRwEB X-IPAS-Result: A2EmAAAv/NpbhyWd50NkHQEBBQEHBQGBUgcBCwGDaSiMbaRvgXoLAQGEbAKDOiI1DA0BAwEBAgEBAgEBAhABAQEKCwkIKS+CNiKCZAIBAxIVSggQUVcHEiKCf4ICnD8CgRCJWAEBAYFoM4och0aEJoFYP4ERgmSLBwKfIgcCghIEjmkLGJBTlxACBAIEBQIUgUUCggozGiODPIImDgmONlOLRwEB Received: from mx0b-00154901.pphosted.com ([67.231.157.37]) by esa7.dell-outbound.iphmx.com with ESMTP/TLS/AES256-SHA256; 01 Nov 2018 08:19:51 -0500 Received: from pps.filterd (m0144104.ppops.net [127.0.0.1]) by mx0b-00154901.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wA1DHmhD052537 for ; Thu, 1 Nov 2018 09:19:52 -0400 Received: from esa3.dell-outbound2.iphmx.com (esa3.dell-outbound2.iphmx.com [68.232.154.63]) by mx0b-00154901.pphosted.com with ESMTP id 2ng1p707jk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 01 Nov 2018 09:19:52 -0400 Received: from mailuogwhop.emc.com ([168.159.213.141]) by esa3.dell-outbound2.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA256; 01 Nov 2018 19:19:40 +0600 Received: from maildlpprd02.lss.emc.com (maildlpprd02.lss.emc.com [10.253.24.34]) by mailuogwprd02.lss.emc.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.0) with ESMTP id wA1DJe7e020250 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 1 Nov 2018 09:19:43 -0400 X-DKIM: OpenDKIM Filter v2.4.3 mailuogwprd02.lss.emc.com wA1DJe7e020250 Received: from mailsyshubprd53.lss.emc.com (mailsyshubprd53.lss.emc.com [10.106.48.28]) by maildlpprd02.lss.emc.com (RSA Interceptor); Thu, 1 Nov 2018 09:19:27 -0400 Received: from hopcyc-boyera-1-00.cec.lab.emc.com (hopcyc-boyera-1-00.cec.lab.emc.com [10.244.196.91]) by mailsyshubprd53.lss.emc.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.0) with ESMTP id wA1DJCwB013224; Thu, 1 Nov 2018 09:19:27 -0400 From: Andrew Boyer To: majd@mellanox.com, yanjun.zhu@oracle.com, monis@mellanox.com, yonatanc@mellanox.com, linux-rdma@vger.kernel.org Cc: Andrew Boyer Subject: [PATCH v2 1/2] RDMA/rxe: Distinguish between down links and disabled links Date: Thu, 1 Nov 2018 09:18:45 -0400 Message-Id: <20181101131846.7441-2-andrew.boyer@dell.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20181101131846.7441-1-andrew.boyer@dell.com> References: <20181030135427.19036-1-andrew.boyer@dell.com> <20181101131846.7441-1-andrew.boyer@dell.com> X-RSA-Classifications: Source Code, public X-Sentrion-Hostname: mailuogwprd02.lss.emc.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-11-01_09:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1811010118 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In ib_query_port(), use the netdev's IFF_UP flag to determine phys_state (flag set = down = POLLING, flag clear = disabled = DISABLED). Callers can then use the phys_state field to distinguish between links which have a dead partner, cable missing, etc., from links which are turned off on the local node. This is useful for HA and supportability. Signed-off-by: Andrew Boyer --- drivers/infiniband/sw/rxe/rxe.h | 5 +++-- drivers/infiniband/sw/rxe/rxe_net.c | 2 -- drivers/infiniband/sw/rxe/rxe_verbs.c | 8 ++++++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe.h b/drivers/infiniband/sw/rxe/rxe.h index d9ec2de68738..8f79bd86d033 100644 --- a/drivers/infiniband/sw/rxe/rxe.h +++ b/drivers/infiniband/sw/rxe/rxe.h @@ -65,8 +65,9 @@ */ #define RXE_UVERBS_ABI_VERSION 2 -#define IB_PHYS_STATE_LINK_UP (5) -#define IB_PHYS_STATE_LINK_DOWN (3) +#define RDMA_LINK_PHYS_STATE_LINK_UP (5) +#define RDMA_LINK_PHYS_STATE_DISABLED (3) +#define RDMA_LINK_PHYS_STATE_POLLING (2) #define RXE_ROCE_V2_SPORT (0xc000) diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c index 40e82e0f6c2d..cb028a3d8275 100644 --- a/drivers/infiniband/sw/rxe/rxe_net.c +++ b/drivers/infiniband/sw/rxe/rxe_net.c @@ -607,7 +607,6 @@ void rxe_port_up(struct rxe_dev *rxe) port = &rxe->port; port->attr.state = IB_PORT_ACTIVE; - port->attr.phys_state = IB_PHYS_STATE_LINK_UP; rxe_port_event(rxe, IB_EVENT_PORT_ACTIVE); dev_info(&rxe->ib_dev.dev, "set active\n"); @@ -620,7 +619,6 @@ void rxe_port_down(struct rxe_dev *rxe) port = &rxe->port; port->attr.state = IB_PORT_DOWN; - port->attr.phys_state = IB_PHYS_STATE_LINK_DOWN; rxe_port_event(rxe, IB_EVENT_PORT_ERR); dev_info(&rxe->ib_dev.dev, "set down\n"); diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c index 9c19f2027511..4eef87c103b2 100644 --- a/drivers/infiniband/sw/rxe/rxe_verbs.c +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c @@ -71,6 +71,14 @@ static int rxe_query_port(struct ib_device *dev, mutex_lock(&rxe->usdev_lock); rc = ib_get_eth_speed(dev, port_num, &attr->active_speed, &attr->active_width); + + if (attr->state == IB_PORT_ACTIVE) + attr->phys_state = RDMA_LINK_PHYS_STATE_LINK_UP; + else if (dev_get_flags(rxe->ndev) & IFF_UP) + attr->phys_state = RDMA_LINK_PHYS_STATE_POLLING; + else + attr->phys_state = RDMA_LINK_PHYS_STATE_DISABLED; + mutex_unlock(&rxe->usdev_lock); out: