Received: by 2002:ab2:788f:0:b0:1ee:8f2e:70ae with SMTP id b15csp453891lqi; Thu, 7 Mar 2024 02:09:31 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVQSVrOvdgb/nbiTvXpFT+cMGIs4qabS1i7UytyT60O9JHBY4aTNzQFKU65geaO1DxfBXQ6NEQo3WHMr60y3i9Yd+ckgL1FLywdwlzpsQ== X-Google-Smtp-Source: AGHT+IFl7Yly9Zng4J49qiZtwpvfmUM6XWvAoRR6nZB+P8Yh5DbAGBI7Uz3qh+sSIM8CFzZCvxH8 X-Received: by 2002:ad4:4e32:0:b0:690:7bf5:e742 with SMTP id dm18-20020ad44e32000000b006907bf5e742mr7145186qvb.58.1709806171134; Thu, 07 Mar 2024 02:09:31 -0800 (PST) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id jm10-20020ad45eca000000b0068ff18d7766si16729939qvb.47.2024.03.07.02.09.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 02:09:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-95302-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=neutral (body hash did not verify) header.i=@kernel.org header.s=k20201202 header.b=Ap6V7M73; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-95302-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-95302-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 C2B1D1C217C6 for ; Thu, 7 Mar 2024 10:09:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1CB6A129A90; Thu, 7 Mar 2024 10:06:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Ap6V7M73" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 45D9B1292C1; Thu, 7 Mar 2024 10:06:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709806015; cv=none; b=dv/g2lD9aWKRjZ79URRULkrb+gzYshQ8BJpyL2a7M2QVkybeYxC+c3aEUfqwRfdRRa81gimlhB8GpzOfHkKtkJWxoCOLcBuke/VtsU34d7mXRvR8ZavIxDWD8s5esGjAxZ7Jr7A7eeyTxCNNPhm2ieDMEBE/GNY6My9PrJJDDJQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709806015; c=relaxed/simple; bh=8ix+DtleFB6ZlJBt/yYcZLhNl0FOKjRVkyS681gcIVU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VSU37kHP0y0Q5ZTxwZ83+EkYo1fE7JVT3y6rHwo1uNCQmSg5CIKJWfUnHtz63rpMKkV+kekxmPqrjPGWbi+IvL6jiSHkfEO1yHmWppT0ydCJEF8NCW2uI2kQj6ymXGKTNZoZnpjNk6cTy8uryQh8Jqkh6qVm4eqVpqUmNXhyMYo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Ap6V7M73; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D5A8C433C7; Thu, 7 Mar 2024 10:06:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709806014; bh=8ix+DtleFB6ZlJBt/yYcZLhNl0FOKjRVkyS681gcIVU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Ap6V7M73103CwlFFkQarLa2zlMQvNaW6MPGbmbg/hFCXJB2SnMNVwE5vF7dt5Htjo Pka2DebBLed4VR3JbPQPx+fVvBk6bs7eJN3wRm4AnSd9fXUl8qoiePrnCKrnjXCJP6 d0Nen6HQuE+2YAAaqywAtJ/wmXwCKP8FbqFYMtrlkkb7OMlCszQfVlIM9qsY8Jk3DT gf1Vb9QuOW3SDfFLDX79NZvn20WW3fkF+BLpS0MFhM8lnfBQWwzBBAcuKaz5acVuoE EUHJYu/PwogdvCDuFYKdiGJuQ5M+MnB5Q1TgWl8jOCji7hc2cVacBR1z2kSJRZLG3e y72+HkwCD/hUg== Date: Thu, 7 Mar 2024 10:06:50 +0000 From: Simon Horman To: Oleksij Rempel Cc: Jiri Pirko , Ivan Vecera , "David S. Miller" , Andrew Lunn , Eric Dumazet , Florian Fainelli , Jakub Kicinski , Paolo Abeni , Vladimir Oltean , kernel@pengutronix.de, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH net-next v1 1/1] net: bridge: switchdev: Improve error message clarity for switchdev_port_obj_add/del_deffered operations Message-ID: <20240307100650.GK281974@kernel.org> References: <20240306132130.2720721-1-o.rempel@pengutronix.de> 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=us-ascii Content-Disposition: inline In-Reply-To: <20240306132130.2720721-1-o.rempel@pengutronix.de> On Wed, Mar 06, 2024 at 02:21:30PM +0100, Oleksij Rempel wrote: > Enhance the error reporting mechanism in the switchdev framework to > provide more informative and user-friendly error messages. > > Following feedback from users struggling to understand the implications > of error messages like "failed (err=-28) to add object (id=2)", this > update aims to clarify what operation failed and how this might impact > the system or network. > > With this change, error messages now include a description of the failed > operation, the specific object involved, and a brief explanation of the > potential impact on the system. This approach helps administrators and > developers better understand the context and severity of errors, > facilitating quicker and more effective troubleshooting. > > Example of the improved logging: > > [ 70.516446] ksz-switch spi0.0 uplink: Failed to add Port Multicast > Database entry (object id=2) with error: -ENOSPC (-28). > [ 70.516446] Failure in updating the port's Multicast Database could > lead to multicast forwarding issues. > [ 70.516446] Current HW/SW setup lacks sufficient resources. > > This comprehensive update includes handling for a range of switchdev > object IDs, ensuring that most operations within the switchdev framework > benefit from clearer error reporting. > > Signed-off-by: Oleksij Rempel > --- > net/switchdev/switchdev.c | 106 ++++++++++++++++++++++++++++++++++++-- > 1 file changed, 102 insertions(+), 4 deletions(-) > > diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c > index c9189a970eec3..d5a30b626fd9c 100644 > --- a/net/switchdev/switchdev.c > +++ b/net/switchdev/switchdev.c > @@ -244,6 +244,106 @@ static int switchdev_port_obj_notify(enum switchdev_notifier_type nt, > return 0; > } > > +static void switchdev_obj_id_to_helpful_msg(struct net_device *dev, > + enum switchdev_obj_id obj_id, > + int err, bool add) > +{ > + char *action = add ? "add" : "del"; > + char *reason = ""; > + char *problem; > + char *obj_str; Hi Oleksij, I think the above variables could be const. That not withstanding, this looks good to me. Reviewed-by: Simon Horman ..