Message ID | 20240103020133.664928-1-pizhenwei@bytedance.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-15056-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4787055dyb; Tue, 2 Jan 2024 18:02:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IHHt3Xr+W0VVIo8HY6ncBCozLckTNKv+g7+8bN3WM+WDWgMOAuwHztgkjl15OpPjDUUUZcH X-Received: by 2002:a17:906:7394:b0:a26:f2f8:1df4 with SMTP id f20-20020a170906739400b00a26f2f81df4mr6198248ejl.37.1704247323354; Tue, 02 Jan 2024 18:02:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704247323; cv=none; d=google.com; s=arc-20160816; b=ENWHxzR/bCu/D406gzrOUca/RW/jQ/gx5cgA4rhQ2sNzHDRIHeLVseh99i+1zV2lpz 6/AAPqsTxM2TLgvWRTLASMuHazkqY/VU2WnID2IZD8Llt9S1yPoObnAAUpVJgAxWlv8l tEgyoLQCYd6mW4OzqKKovX+oPk2kqn4V4m3OZABasBy5RM+JotinJxtrjfUt3bM9auu8 sVXZUDTy+mjbvmXy9pRLQwWMR6kZu7FdiuQNcRpHZoDJVEDWkv9WpMJyTSxmyIk+EM2G qSN2YYL9su9Dmpx0wSYZfVmjrqDFBnL8FBVV8fyRny5fRlk2GtDCaL00mUNNxPRwCRX4 82Kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=C9J+xmhh3o2qb5UA/Lzz6b6u4mxmFjot2u0XPV7yids=; fh=NA/+FAV5KEwz58JrhNfLafxNhf6g1D8GA4AMZce1l0I=; b=s1vCfR4qAlxZiuU0uFHuaUoOPBFNWQGx18Y00hF9xNugFnq91DbdasvJ1o6D4g7VHK QonmkZMv/Y7/XlcVT3333dVHkQKuJmGoGt9Tx9ldBRmzpTaMnAeMPgJIzSUA3RzZy9Mz 2HIm5HCWlsf21yDNAeaTr7l+PdZqnhm9Zsdgm+t+osJZagT6oIsEt0cCWbOj7yVHZG0K DQVuR0185xhzMp6njzr/6WhuoFdVSISDAWhc8eUREN0hTj6tqFjmL76YLKdqjDN6FkBc PUuaf4Bc6U19c4cu7qiwzK5dbOf9aNcvqWoGYWNcNZfK3TJ6zup8FyV3KjUqA6wFE4ns 2VAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=GZlNilYL; spf=pass (google.com: domain of linux-kernel+bounces-15056-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15056-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id g17-20020a170906199100b00a269fa0dcb3si10374786ejd.399.2024.01.02.18.02.03 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 18:02:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15056-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=GZlNilYL; spf=pass (google.com: domain of linux-kernel+bounces-15056-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15056-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id F213D1F22AB5 for <ouuuleilei@gmail.com>; Wed, 3 Jan 2024 02:02:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 46B7E1C2E; Wed, 3 Jan 2024 02:01:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="GZlNilYL" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69D051848 for <linux-kernel@vger.kernel.org>; Wed, 3 Jan 2024 02:01:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Received: by mail-pg1-f173.google.com with SMTP id 41be03b00d2f7-5ce0efd60ddso2216933a12.0 for <linux-kernel@vger.kernel.org>; Tue, 02 Jan 2024 18:01:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1704247300; x=1704852100; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=C9J+xmhh3o2qb5UA/Lzz6b6u4mxmFjot2u0XPV7yids=; b=GZlNilYLnI1HKXYwNa2nl/Kow5L9hzkpRgA156s/d/e7eJgCpnXNnXDZ0Kwb6O2yK/ fonOzsr6naC9/tRbV0snMeKWMXTlKYVG3Y/Yk5dQbkQYXHZNe/AvfLWi/GhDRmV00mrl k3bigFhLIBzruHFTJZ/hOHlSRl2gb9igndfS12KnbBE7gCAymm9O/T8gllE6ZyFWdvol kg/bRJImsZx8dhk3JexM86KEyh+RLnKzZJ7vGGLP4+BohIPC4pyimHVsuP2aN8JMIRwr GkbL5nNpgGrE73h5GyQpE9zqDz90/HxBEoaj2p/7nNSB2JBuMcSUluPyiLv9Lyu7n5On Hs3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704247300; x=1704852100; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=C9J+xmhh3o2qb5UA/Lzz6b6u4mxmFjot2u0XPV7yids=; b=Aj593ALi9CepFKVXsMo13IO7eCG7QPU2ZDgEiOqtKSkPqh3z1GbCmF+2wAbw/r2EqY NWwSTtMDvHIxwbJkSknUdbK/+kXOypGDKzgXoGfjFfqIHR3HGlBYDaAGmJlOmMrrbdOM 7VWW3RzqM2eqPpZkzpZ3+SEvOlu4SX5rmXKTEGsHyLRpUkVpCSW55PtsTdMfb5yVVqsB JWa/dEJKwax6ioVXGRumJGtp2U7scENOfW7caKza0D++7fZl/jBxa/Q71j3tRYls4BzU WIwqIgD01/e8O11Bqz6P+jYDzsps3j9wQ91Ubu/HXpubRVn/ClFNqpwVo+O2i3ieaXlp 02qg== X-Gm-Message-State: AOJu0YzOtTaqKY6BzDRyw3Uu9fK0uXtv75NMEEwZoniMbVCq8kxcfqzm jTBhksTUvofjcCzTKLD1J8cv8S9qkV3x3w== X-Received: by 2002:a05:6a00:3243:b0:6da:2ee0:50bd with SMTP id bn3-20020a056a00324300b006da2ee050bdmr3230918pfb.53.1704247299704; Tue, 02 Jan 2024 18:01:39 -0800 (PST) Received: from always-x1.bytedance.net ([61.213.176.12]) by smtp.gmail.com with ESMTPSA id v21-20020a056a00149500b006d9cf4b56edsm14219784pfu.175.2024.01.02.18.01.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 18:01:39 -0800 (PST) From: zhenwei pi <pizhenwei@bytedance.com> To: zyjzyj2000@gmail.com, jgg@ziepe.ca, leon@kernel.org Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, zhenwei pi <pizhenwei@bytedance.com> Subject: [PATCH] RDMA/rxe: Fix port state on associating netdev successfully Date: Wed, 3 Jan 2024 10:01:33 +0800 Message-Id: <20240103020133.664928-1-pizhenwei@bytedance.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787032841115647651 X-GMAIL-MSGID: 1787032841115647651 |
Series |
RDMA/rxe: Fix port state on associating netdev successfully
|
|
Commit Message
zhenwei pi
Jan. 3, 2024, 2:01 a.m. UTC
Originally, after adding a RXE device successfully, the RXE device
gets ready, it still reports 'PORT_DOWN' state. Set the state to
*IB_PORT_ACTIVE* once it becomes ready to access.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
---
drivers/infiniband/sw/rxe/rxe_net.c | 6 ++++++
1 file changed, 6 insertions(+)
Comments
在 2024/1/3 10:01, zhenwei pi 写道: > Originally, after adding a RXE device successfully, the RXE device > gets ready, it still reports 'PORT_DOWN' state. Set the state to > *IB_PORT_ACTIVE* once it becomes ready to access. IB_PORT_ACTIVE is set in the function rxe_port_up. The followings are the call chain. rxe_net_add -- > rxe_register_device -- > ib_register_device -- > enable_device_and_get -- > rxe_enable_driver -- > rxe_set_port_state -- > rxe_port_up In this commit, in rxe_net_add, the port->attr.state is set to IB_PORT_ACTIVE. But then in the function rxe_init_port_param, port->attr.state is set to IB_PORT_DOWN again. Zhu Yanjun > > Signed-off-by: zhenwei pi <pizhenwei@bytedance.com> > --- > drivers/infiniband/sw/rxe/rxe_net.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c > index cd59666158b1..eafcb2351a7b 100644 > --- a/drivers/infiniband/sw/rxe/rxe_net.c > +++ b/drivers/infiniband/sw/rxe/rxe_net.c > @@ -524,6 +524,7 @@ int rxe_net_add(const char *ibdev_name, struct net_device *ndev) > { > int err; > struct rxe_dev *rxe = NULL; > + struct rxe_port *port; > > rxe = ib_alloc_device(rxe_dev, ib_dev); > if (!rxe) > @@ -537,6 +538,11 @@ int rxe_net_add(const char *ibdev_name, struct net_device *ndev) > return err; > } > > + if (netif_running(ndev) && netif_carrier_ok(ndev)) { > + port = &rxe->port; > + port->attr.state = IB_PORT_ACTIVE; > + } > + > return 0; > } >
On 1/3/24 14:47, Zhu Yanjun wrote: > 在 2024/1/3 10:01, zhenwei pi 写道: >> Originally, after adding a RXE device successfully, the RXE device >> gets ready, it still reports 'PORT_DOWN' state. Set the state to >> *IB_PORT_ACTIVE* once it becomes ready to access. > > IB_PORT_ACTIVE is set in the function rxe_port_up. > > The followings are the call chain. > > rxe_net_add -- > rxe_register_device -- > ib_register_device -- > > enable_device_and_get -- > rxe_enable_driver -- > rxe_set_port_state -- > > rxe_port_up > > In this commit, in rxe_net_add, the port->attr.state is set to > IB_PORT_ACTIVE. > > But then in the function rxe_init_port_param, port->attr.state is set to > IB_PORT_DOWN again. > > Zhu Yanjun > Thanks, I guess anything got wrong in my env(virtual interface in a virtual machine), let's drop this. >> >> Signed-off-by: zhenwei pi <pizhenwei@bytedance.com> >> --- >> drivers/infiniband/sw/rxe/rxe_net.c | 6 ++++++ >> 1 file changed, 6 insertions(+) >> >> diff --git a/drivers/infiniband/sw/rxe/rxe_net.c >> b/drivers/infiniband/sw/rxe/rxe_net.c >> index cd59666158b1..eafcb2351a7b 100644 >> --- a/drivers/infiniband/sw/rxe/rxe_net.c >> +++ b/drivers/infiniband/sw/rxe/rxe_net.c >> @@ -524,6 +524,7 @@ int rxe_net_add(const char *ibdev_name, struct >> net_device *ndev) >> { >> int err; >> struct rxe_dev *rxe = NULL; >> + struct rxe_port *port; >> rxe = ib_alloc_device(rxe_dev, ib_dev); >> if (!rxe) >> @@ -537,6 +538,11 @@ int rxe_net_add(const char *ibdev_name, struct >> net_device *ndev) >> return err; >> } >> + if (netif_running(ndev) && netif_carrier_ok(ndev)) { >> + port = &rxe->port; >> + port->attr.state = IB_PORT_ACTIVE; >> + } >> + >> return 0; >> } >
diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c index cd59666158b1..eafcb2351a7b 100644 --- a/drivers/infiniband/sw/rxe/rxe_net.c +++ b/drivers/infiniband/sw/rxe/rxe_net.c @@ -524,6 +524,7 @@ int rxe_net_add(const char *ibdev_name, struct net_device *ndev) { int err; struct rxe_dev *rxe = NULL; + struct rxe_port *port; rxe = ib_alloc_device(rxe_dev, ib_dev); if (!rxe) @@ -537,6 +538,11 @@ int rxe_net_add(const char *ibdev_name, struct net_device *ndev) return err; } + if (netif_running(ndev) && netif_carrier_ok(ndev)) { + port = &rxe->port; + port->attr.state = IB_PORT_ACTIVE; + } + return 0; }