Received: by 2002:ab2:784b:0:b0:1fd:adc2:8405 with SMTP id m11csp237382lqp; Mon, 10 Jun 2024 02:26:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVLyuunAQJf+CxQ++vj9BDPYXknD6Wy6tusrOiFxsoO4o2oniIVvdVICB5fofCjjwg54CYZ0jVcfJLBI/lF4KPwGY67QSDbe+tAivAhxg== X-Google-Smtp-Source: AGHT+IHadGm3qLKNc6zJ/42yJ3YrFRLusFI0713tJPBbGNmeggLI5TSlJVawxgl+5EGvpNfAQ378 X-Received: by 2002:a05:6214:2dc8:b0:6b0:7afb:5c85 with SMTP id 6a1803df08f44-6b07afb6026mr41230006d6.3.1718011583622; Mon, 10 Jun 2024 02:26:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718011583; cv=pass; d=google.com; s=arc-20160816; b=Y2skzWmuWye5dTbWD+S+nI9HO50PctLB8YetwGQSemKNqcGA8DlPXu2h0VKsW0QwyD a9HJNk29OkhRjOYIltPrF+kFJTkkN0le4GeKKYcLEkjPocmyoppT+bMYpZCqYU4z2sjQ +j1Mn9oP2SLSbiadun+Rmcz4c8cSOK2EOWCnan/XJZ213tWgb0lvoxR6sW8tTfxUC2rR YeoNkhbMg1XF0ixLnCOmWUBRI5avrxFuFKGtqpidAp75LytwnLz+D5cTl7Zlb+Hd/h4s qrSFlvgdqtVoMV1j8j3p/AFL03c+1BZw1ITJwB5NejYrhHReY4ocmw9y2hD5HQEp0fQB mNQg== ARC-Message-Signature: i=2; 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:organization:references :in-reply-to:message-id:subject:cc:to:from:date:dkim-signature; bh=eytCldcOr0ZAkk3Ut2yG/8HucBDVZ65zXES9P1bpuOo=; fh=ZQkK8Nn48jQqvMVfUgaQOyOyaInHyJHsbEKwSqiGSTs=; b=rTpXg91zoyzW/XJ9wSsiWZCPbKydPWz3JILKYZi6yYnmXhxsdW+nLZ7fcvibK/I2HH ItSYUWfEn0dnhX+qYJbpZgJJRctfGPyRP/saS46p8kcLa0eBQM+aiMBwMkTTuUKz0nFz Vmcx5ExgMKqhctq3o0psi1g28bzSF0pvBM1Us+iIiC8ZW+Ksfsc+3CZqJT43EfEB5Tt0 jk99CXT0DFYet0VN6J9cwxBjf0vCtr2btKihU8b1qu+kf3GVtn67F/pBNGH1zQgLMNoI YQscikwnDCoULgd/uJdbXJbA1LYl4ELhzPJaQzpPkw6g+M48bj4FqlM2Z/okEGq2DsSF uVeg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=F7v86O19; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-207936-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207936-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6b0713356cesi45519686d6.485.2024.06.10.02.26.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 02:26:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-207936-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=F7v86O19; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-207936-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207936-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 0627C1C2120D for ; Mon, 10 Jun 2024 09:26:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DF0CA74404; Mon, 10 Jun 2024 09:26:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="F7v86O19" Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (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 83FF7335A7; Mon, 10 Jun 2024 09:26:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.197 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718011571; cv=none; b=eckhxiPyY3btO8/1xIWwZbFi4bVeNRUaLDnb0y6ndXOa16VZjVST3CkEciRTlDnNgr14XCqXpowir+P/O3iHDBmAhEdzT+Mpy7czL2dpfsmc556fwG/KDvD3jxv/3Sf1M/yD/tDHxLdOri6pmDrOyNc9svV6L1nM8HQPSdHpHgU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718011571; c=relaxed/simple; bh=3z/wCMzo000cWjGkOKkDvzYB+nRA0ZJj5v7KXtRWU7E=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BG5w8eiDIt5xlB6bqU5DsTi6vjQzAucOx5Z8gTlrgSUyU9N7D4o2e8Bze8OCiaG1+N+JYRx7Xue+H/xuuTWtGpYTNgp+L4yjvDioAqzdjJyvY02VKUo67YH9LAsBdwl4HYQ8/ispX8t9ywroX9CtxCgYjC8bE9rVptVJklX3nXg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=F7v86O19; arc=none smtp.client-ip=217.70.183.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 03F461C000D; Mon, 10 Jun 2024 09:25:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1718011560; 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=eytCldcOr0ZAkk3Ut2yG/8HucBDVZ65zXES9P1bpuOo=; b=F7v86O19KfamSoyyQR4SuCBgLKUbgTE1YyLhz7eU0oEXQMIimTD1Vts65B0JWY4P5pv/nN pFYXgnNX+5KKMJhd532lAsMkM0I6lqRGOPADXDqFwzpJLfI9F4aGPRoxteC9WVCvjsCpkW aBUGzH/zTWaTkiEk3Fk7g/Xn4KITiYb7Gk7jTK/zrxMap0aFHXYBu6laMX0wWY+fuEFtQ1 ftaG6ER1p74ip9WmVcnyD1uYfq7vJ4xlDHcK5r9w24xMQOJ6vuIaUmbE7sZPAjhGQSMouV 1AzhhQb/WB5Ggr4Hpv2LB+KoPprBE8OqP2MX0VUkyw/axJSpwgvegEuklwgNwA== Date: Mon, 10 Jun 2024 11:25:59 +0200 From: Kory Maincent To: Oleksij Rempel Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Donald Hunter , Thomas Petazzoni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Dent Project , kernel@pengutronix.de Subject: Re: [PATCH net-next v2 2/8] net: ethtool: pse-pd: Expand C33 PSE status with class, power and extended state Message-ID: <20240610112559.57806b8c@kmaincent-XPS-13-7390> In-Reply-To: References: <20240607-feature_poe_power_cap-v2-0-c03c2deb83ab@bootlin.com> <20240607-feature_poe_power_cap-v2-2-c03c2deb83ab@bootlin.com> Organization: bootlin X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Sasl: kory.maincent@bootlin.com Hello Oleksij, On Mon, 10 Jun 2024 07:16:09 +0200 Oleksij Rempel wrote: > Hi K=C3=B6ry, >=20 > Thank you for your work. >=20 > On Fri, Jun 07, 2024 at 09:30:19AM +0200, Kory Maincent wrote: > > From: "Kory Maincent (Dent Project)" =20 >=20 > ... >=20 > > /** > > diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h > > index 8733a3117902..ef65ad4612d2 100644 > > --- a/include/uapi/linux/ethtool.h > > +++ b/include/uapi/linux/ethtool.h > > @@ -752,6 +752,47 @@ enum ethtool_module_power_mode { > > ETHTOOL_MODULE_POWER_MODE_HIGH, > > }; > > =20 > > +/* C33 PSE extended state */ > > +enum ethtool_c33_pse_ext_state { > > + ETHTOOL_C33_PSE_EXT_STATE_UNKNOWN =3D 1, =20 >=20 > I assume, In case the state is unknown, better to set it to 0 and not > report it to the user space in the first place. Do we really need it? The pd692x0 report this for the unknown state: "Port is not mapped to physi= cal port, port is in unknown state, or PD692x0 fails to communicate with PD69208 device allocated for this port." Also it has a status for open port (not connected) state. (ETHTOOL_C33_PSE_EXT_SUBSTATE_V_OPEN) Do you prefer to use the same error for both state? =20 > > + ETHTOOL_C33_PSE_EXT_STATE_DETECTION, > > + ETHTOOL_C33_PSE_EXT_STATE_CLASSIFICATION_FAILURE, > > + ETHTOOL_C33_PSE_EXT_STATE_HARDWARE_ISSUE, > > + ETHTOOL_C33_PSE_EXT_STATE_VOLTAGE_ISSUE, > > + ETHTOOL_C33_PSE_EXT_STATE_CURRENT_ISSUE, > > + ETHTOOL_C33_PSE_EXT_STATE_POWER_BUDGET_EXCEEDED, =20 >=20 > What is the difference between POWER_BUDGET_EXCEEDED and > STATE_CURRENT_ISSUE->CRT_OVERLOAD? If there is some difference, it > should be commented. Current overload seems to be describing the "Overload current detection ran= ge (Icut)" As described in the IEEE standard. Not sure If budget exceeded should use the same error. > Please provide comments describing how all of this states and substates > should be used. The enum errors I wrote is a bit subjective and are taken from the PD692x0 port status list. Go ahead to purpose any change, I have tried to make categories that make sense but I might have made wrong choice. > > /** > > * enum ethtool_pse_types - Types of PSE controller. > > * @ETHTOOL_PSE_UNKNOWN: Type of PSE controller is unknown > > diff --git a/include/uapi/linux/ethtool_netlink.h > > b/include/uapi/linux/ethtool_netlink.h index b49b804b9495..ccbe8294dfd5 > > 100644 --- a/include/uapi/linux/ethtool_netlink.h > > +++ b/include/uapi/linux/ethtool_netlink.h > > @@ -915,6 +915,10 @@ enum { > > ETHTOOL_A_C33_PSE_ADMIN_STATE, /* u32 */ > > ETHTOOL_A_C33_PSE_ADMIN_CONTROL, /* u32 */ > > ETHTOOL_A_C33_PSE_PW_D_STATUS, /* u32 */ > > + ETHTOOL_A_C33_PSE_PW_CLASS, /* u32 */ > > + ETHTOOL_A_C33_PSE_ACTUAL_PW, /* u32 */ > > + ETHTOOL_A_C33_PSE_EXT_STATE, /* u8 */ > > + ETHTOOL_A_C33_PSE_EXT_SUBSTATE, /* u8 */ =20 >=20 > Please, increase the size to u32 for state and substate. Ack, > > /* add new constants above here */ > > __ETHTOOL_A_PSE_CNT, > > diff --git a/net/ethtool/pse-pd.c b/net/ethtool/pse-pd.c > > index 2c981d443f27..3d74cfe7765b 100644 > > --- a/net/ethtool/pse-pd.c > > +++ b/net/ethtool/pse-pd.c > > @@ -86,7 +86,14 @@ static int pse_reply_size(const struct ethnl_req_info > > *req_base, len +=3D nla_total_size(sizeof(u32)); /* _C33_PSE_ADMIN_STAT= E */ > > if (st->c33_pw_status > 0) > > len +=3D nla_total_size(sizeof(u32)); /* > > _C33_PSE_PW_D_STATUS */ - > > + if (st->c33_pw_class > 0) > > + len +=3D nla_total_size(sizeof(u32)); /* _C33_PSE_PW_CLASS */ > > + if (st->c33_actual_pw > 0) > > + len +=3D nla_total_size(sizeof(u32)); /* _C33_PSE_ACTUAL_PW > > */ > > + if (st->c33_ext_state_info.c33_pse_ext_state) > > + len +=3D nla_total_size(sizeof(u8)); /* _C33_PSE_EXT_STATE */ > > + if (st->c33_ext_state_info.__c33_pse_ext_substate) > > + len +=3D nla_total_size(sizeof(u8)); /* > > _C33_PSE_EXT_SUBSTATE */ =20 >=20 > Substate can be properly decoded only if state is not zero. Indeed, thanks for spotting that mistake. =20 > Please update Documentation/networking/ethtool-netlink.rst Oh right, indeed. Forgot to add the netlink docs.=20 Regards, --=20 K=C3=B6ry Maincent, Bootlin Embedded Linux and kernel engineering https://bootlin.com