Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp6963599rdb; Tue, 2 Jan 2024 22:47:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IF206oZFj6g3Vf4FDjB8kc/ZpGd+1yyNbqrLMNvGU9LwfqHd2VYCpVCEm75q9RuZ5OOTVnc X-Received: by 2002:a05:6a00:3923:b0:6d9:eb21:fed0 with SMTP id fh35-20020a056a00392300b006d9eb21fed0mr13940610pfb.52.1704264476158; Tue, 02 Jan 2024 22:47:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704264476; cv=none; d=google.com; s=arc-20160816; b=CQzvxVtXFsZSz5QwNROc1rccHfLxrmW2eojt1MhpZig+QSo+68fjG3YQ84eVeWFkHv beuPuLHpPxbRS2aMu0ccMeRgPWEEMf+22xTs7WBEmy53mW2qq9odQWMRZH7zihNNNOXs 9NiCCx8j6bn6MjvwjbUVVedUnxMuSoW1oYs36VKNGUzKi64jMqEYdIzLVoBOXDnqIic+ rOdBmy2/E3ddh+CtsVkiQydTKqwm7BG1ZOlq+DjwunUN9cTDiFX7oQSRxh2TPqLgiiZv Tuqz3KJDWt2qVXhL5ZatlPgBd9FI8lSFyMT1Fs8JhUCWOeS5/hLVOn/X/3BN1op5iF7x +sEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :date:dkim-signature:message-id; bh=1PgmObQBIUB1Wpwl0+pUQdlsVPnKw4+0yNlnbhzkwWs=; fh=kZjCL7Z/0lUxkEKGc8InXh3XKsdF5Wr8kk60QOPUBwg=; b=uXOkzhTZpntAD7dDBz+waaDR+7dwI39rNVAkxxRxsnIyQkjm4RWBohP8TSW49dzhqn U4okfpfHz9+/Kdl6FPX9Fzn+cgA3T87avs/wOVMbt/MEPq1awoNmFbwod3wRbuCnokiZ Lr18rSaEMG1y+PjEFslvDbPpYz+V9saNbdPH4MtJerxAN4FmAiJcCPdO0G5FCu/p58RV 3h8P+jQWbZ5G5QAKTypdcyCDUh/jIveJnQMf6RiML5+fW2fLZrl0Ry8GnWZ8trgNWtC1 q6sLTJ0dit1PXPbTmAPbNDbn2YuLKjF8yQBYP2WfgCTfDOJ6ViTtPPM082rbDO3Mwqbb aDrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=jSTxiwf6; spf=pass (google.com: domain of linux-kernel+bounces-15218-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15218-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 29-20020a630c5d000000b005c65d99187asi21809918pgm.140.2024.01.02.22.47.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 22:47:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15218-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=jSTxiwf6; spf=pass (google.com: domain of linux-kernel+bounces-15218-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15218-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id B0A51284FD9 for ; Wed, 3 Jan 2024 06:47:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F0D74179A7; Wed, 3 Jan 2024 06:47:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="jSTxiwf6" X-Original-To: linux-kernel@vger.kernel.org Received: from out-189.mta0.migadu.com (out-189.mta0.migadu.com [91.218.175.189]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 486801798C for ; Wed, 3 Jan 2024 06:47:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Message-ID: <96f1e8d4-18fc-461e-9916-f7ddd6ea4b26@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1704264464; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1PgmObQBIUB1Wpwl0+pUQdlsVPnKw4+0yNlnbhzkwWs=; b=jSTxiwf6igRyeZPLf5y9oNKTzHhra5Qhq8xaURP53Lb59K2kaU7hlRAQFyU+SfQoGK7my2 RhE8PgJ0OXt5TLMHXAPWhZN/TkGg4HOS2vJv0qnmoGEm2/bytWgUm49MdyxS7PGVmORmbh o06kh/ZAul4Jn0rwDoyKYnglxDIIo7A= Date: Wed, 3 Jan 2024 14:47:11 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH] RDMA/rxe: Fix port state on associating netdev successfully To: zhenwei pi , zyjzyj2000@gmail.com, jgg@ziepe.ca, leon@kernel.org Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240103020133.664928-1-pizhenwei@bytedance.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Zhu Yanjun In-Reply-To: <20240103020133.664928-1-pizhenwei@bytedance.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT 在 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 > --- > 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; > } >