From patchwork Tue Oct 30 13:54:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 10660955 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 9D9D413A4 for ; Tue, 30 Oct 2018 14:00:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 81A0D2A540 for ; Tue, 30 Oct 2018 14:00:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 733E72A545; Tue, 30 Oct 2018 14:00:19 +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 1A0DF2A540 for ; Tue, 30 Oct 2018 14:00:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727876AbeJ3Wxx (ORCPT ); Tue, 30 Oct 2018 18:53:53 -0400 Received: from esa4.dell-outbound.iphmx.com ([68.232.149.214]:62615 "EHLO esa4.dell-outbound.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727705AbeJ3Wxx (ORCPT ); Tue, 30 Oct 2018 18:53:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dell.com; i=@dell.com; q=dns/txt; s=smtpout; t=1540908017; x=1572444017; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=EoNJXKR3Z4aL2Ry0mZptkwLTcOT94LD0Oq36FLDhY6o=; b=K6GnUuRebbCxi9fR9c0JxZCr+MHKhpVRrHMo5iVadYqFGO9XR7yAL8VS PX3CQOEPTg0GJwFwqGD+9hkQfMpdly5ZkgliRiPkBRwfhXidHBDsyksOt qytsD7MinJCfQQqEGZrqczsrbeB1Eprz77q4ObuAStz6ykeblRd2xB5Bs k=; X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2ERAACkY9hbhyeV50NkHAEBAQQBAQcEAQGBUQcBAQsBg2kojA5fpGaBegsBAYRsAoMlIjQNDQEDAQECAQECAQECEAEBAQoLCQgpL4I2IoJkAgEDEhVKCBBRVwcSIoJ/ggKdFgKBEIlYAQEBgWgzhTyEaodBhCaBWD+BEYJkiwcCjmSQLAcCghIEjmYLGJBIln8CBAIEBQIUgUOCDjMaI4M8giYOCY42U4t4AQE X-IPAS-Result: A2ERAACkY9hbhyeV50NkHAEBAQQBAQcEAQGBUQcBAQsBg2kojA5fpGaBegsBAYRsAoMlIjQNDQEDAQECAQECAQECEAEBAQoLCQgpL4I2IoJkAgEDEhVKCBBRVwcSIoJ/ggKdFgKBEIlYAQEBgWgzhTyEaodBhCaBWD+BEYJkiwcCjmSQLAcCghIEjmYLGJBIln8CBAIEBQIUgUOCDjMaI4M8giYOCY42U4t4AQE Received: from mx0a-00154901.pphosted.com ([67.231.149.39]) by esa4.dell-outbound.iphmx.com with ESMTP/TLS/AES256-SHA256; 30 Oct 2018 08:59:54 -0500 Received: from pps.filterd (m0142693.ppops.net [127.0.0.1]) by mx0a-00154901.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w9UDvwum154759 for ; Tue, 30 Oct 2018 09:59:54 -0400 Received: from esa2.dell-outbound2.iphmx.com (esa2.dell-outbound2.iphmx.com [68.232.153.202]) by mx0a-00154901.pphosted.com with ESMTP id 2nekpa1sb3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 30 Oct 2018 09:59:54 -0400 Received: from mailuogwhop.emc.com ([168.159.213.141]) by esa2.dell-outbound2.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA256; 30 Oct 2018 19:59:32 +0600 Received: from maildlpprd06.lss.emc.com (maildlpprd06.lss.emc.com [10.253.24.38]) by mailuogwprd01.lss.emc.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.0) with ESMTP id w9UDxoPo007639 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 30 Oct 2018 09:59:51 -0400 X-DKIM: OpenDKIM Filter v2.4.3 mailuogwprd01.lss.emc.com w9UDxoPo007639 Received: from mailsyshubprd06.lss.emc.com (mailsyshubprd06.lss.emc.com [10.253.24.24]) by maildlpprd06.lss.emc.com (RSA Interceptor); Tue, 30 Oct 2018 09:59:33 -0400 Received: from hopcyc-boyera-1-00.cec.lab.emc.com (hopcyc-boyera-1-00.cec.lab.emc.com [10.244.196.91]) by mailsyshubprd06.lss.emc.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.0) with ESMTP id w9UDseSN028002; Tue, 30 Oct 2018 09:59:33 -0400 From: Andrew Boyer To: monis@mellanox.com, yonatanc@mellanox.com, linux-rdma@vger.kernel.org Cc: Andrew Boyer Subject: [PATCH 3/4] RDMA/rxe: Distinguish between down links and disabled links Date: Tue, 30 Oct 2018 09:54:26 -0400 Message-Id: <20181030135427.19036-4-andrew.boyer@dell.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20181030135427.19036-1-andrew.boyer@dell.com> References: <20181030135427.19036-1-andrew.boyer@dell.com> X-RSA-Classifications: Source Code, public X-Sentrion-Hostname: mailuogwprd01.lss.emc.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-10-30_08:,, 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-1810300122 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 7d232611303f..0497bf330feb 100644 --- a/drivers/infiniband/sw/rxe/rxe.h +++ b/drivers/infiniband/sw/rxe/rxe.h @@ -61,8 +61,9 @@ #define RXE_UVERBS_ABI_VERSION (1) -#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 9da6e37fb70c..d292f590c72f 100644 --- a/drivers/infiniband/sw/rxe/rxe_net.c +++ b/drivers/infiniband/sw/rxe/rxe_net.c @@ -643,7 +643,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); pr_info("set %s active\n", rxe->ib_dev.name); @@ -656,7 +655,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); pr_info("set %s down\n", rxe->ib_dev.name); diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c index ced79e49234b..c861b25cf5dc 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: