Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1760932lqa; Mon, 29 Apr 2024 20:11:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXIg0daPrNLDS3TmhzMBGlZaMYiAbx+Bx/0+u2AUPPlMhBFYc95VklUz1WwYTDSRPLEiQktSi1UBUUKhwQ/s3AnXJALWsHhdGktuO/BmA== X-Google-Smtp-Source: AGHT+IH+wfL/ecKqde1Me30J8nlZ5HlndY8gE39dKch41lPwM4w4cZsjuTrd3JBpu0W2BTuIuwR2 X-Received: by 2002:a50:c303:0:b0:572:7b95:7d14 with SMTP id a3-20020a50c303000000b005727b957d14mr4580488edb.27.1714446702622; Mon, 29 Apr 2024 20:11:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714446702; cv=pass; d=google.com; s=arc-20160816; b=qdNUkmrRy9ukc+QvlBi48uhLn8TdAWMrShiYIwcPtIuhB7Uts4KFgtUxhm17CErc7m GPYDWlpENRm6IAnUnZmslgiTDsv/7Pifa2858sYi4zOXMwMu3uXxTzlUZwupySEVfTWF 1KDdMH+WKrQR9RpHkg9nDSQIpJCEd5qCFtn5st2aZRogihLSXcjizwhHcpoc7tCdeqGR 4e0e7n4Ix5zMY997VAGTzx2cN+PmBFB4EFIU/AhTUfMX0Y5+iybvr4g2pAl4mf63C7/f w6WZKiR1BaztOVgAc0jJj6KcSd5qKXvrFM8infoLk2Cu7fWLlnXn9YYx5X6a28MhzP2A 4nHA== 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:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=CzQsd4dWcg8q4sviLROeZbGfaDXrWHHGPG6PxuQ+ruM=; fh=MUR88bFMIx3vFKp/j9Y9fWtpE04vvnu3U9YY6g14FHI=; b=Py2j57S+fCfl0dxiutpuumelLcImSgi/AFWwtCg4Uft/q2Qnvt0Lv1tzdDTn+q4a+z EuNkoHHFn0JVb+7y6JwxQquvogRg9GosgzzxKjctKyYigpsErfjWolIFM3dBs1FvNjYG X2EfTZ/GntJEHp7plbdOHGqrfUZlHyWb8AgSyXmwlFBPfSD+VSoxGO4Qf2Oh2aet8xb5 AsKoBdaaFPzZdohtKP8SaNH1CvucCYVCuGCXgAjF0TBlBEABzFRRMVvgC5g0rauKMHI4 R9aQSj5w6VUbVM063l1yR/DQaFVGoEYUH0QGIeJl1Kbk5bm4hC4zlWbTvocFZpNiJEJO Sv6A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PDqXwkYz; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-163282-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163282-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id c5-20020a50d645000000b0057270344eafsi3240839edj.452.2024.04.29.20.11.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 20:11:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-163282-linux.lists.archive=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=@kernel.org header.s=k20201202 header.b=PDqXwkYz; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-163282-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163282-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 27CC61F224C9 for ; Tue, 30 Apr 2024 03:11:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0F307101CE; Tue, 30 Apr 2024 03:11:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PDqXwkYz" 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 27444DDA6; Tue, 30 Apr 2024 03:11:32 +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=1714446693; cv=none; b=iefF/QNSae5LIE2q1W18MaJE/Zeamd3YAkI8l+/FhFvYMekgD0J2GO+sXCB+s60hP/N0GrMjcJD3myFDj/1uS7sl0YpMBGgESffdEoGYPxfSryC1JpZ7GPTEfkZWRKANdKCTLXtOwZz6Wt28fiOWLUnBE907QjA7Mhd0w07lt0s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714446693; c=relaxed/simple; bh=F38alO0+pqAFw+N4jjta2j7kT+Zse5cYwkzjPS2r5AU=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cHLlE+HNlntbM4yil2c3BT+V4Lc/3Vm9PpOuZFX6xxZ/MGr8XcrdI2MuzNqHPXN50a/uo4Ro8ILHC61Uw3X9+cw/NMdtMGPHhLREvuM1tGsCrpJWNYJPbdnbTZUOb5iKa25z2/OYDrI6uPGDRihhqnHCd1MSXJ0u/D7S7vOWF9U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PDqXwkYz; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6692C116B1; Tue, 30 Apr 2024 03:11:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714446692; bh=F38alO0+pqAFw+N4jjta2j7kT+Zse5cYwkzjPS2r5AU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=PDqXwkYzHfm8sTFGf4/2hVAeUC5mZRfvJS/A7IKkOK8TBiv+kGfdNa0ZctD3O45Yg dbJVF/2XgKbqhYvJtcby5pYo+t4ClH1E9cUydBNUp6RQlSyyUtLEpsHoZXbj18HuOO bw5xlx5D0Ei0ZqPWhr681rhN+zQdcl54YWpJwJNxJAM7T7Y9aPRpMPzZe2LJUCX1lW 0gEDdMPaCu/y7Ti0NMAvApbzHCniLuomnYPxqBkk2yjDRV+4/GteSzNFeLqyCgvD/0 eMupoBttXsj2kfxwFyAFXvuKKcbMR8D3jlTupIaODC1Sl9SOpza9tV2No5RMxRzQs1 eXOzNEFhowlHg== Date: Mon, 29 Apr 2024 20:11:30 -0700 From: Jakub Kicinski To: Danielle Ratson Cc: , , , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH net-next v5 04/10] ethtool: Add flashing transceiver modules' firmware notifications ability Message-ID: <20240429201130.5fad6d05@kernel.org> In-Reply-To: <20240424133023.4150624-5-danieller@nvidia.com> References: <20240424133023.4150624-1-danieller@nvidia.com> <20240424133023.4150624-5-danieller@nvidia.com> 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-Transfer-Encoding: 7bit On Wed, 24 Apr 2024 16:30:17 +0300 Danielle Ratson wrote: > + hdr = ethnl_bcastmsg_put(skb, ETHTOOL_MSG_MODULE_FW_FLASH_NTF); > + if (!hdr) > + goto err_skb; Do we want to blast it to all listeners or treat it as an async reply? We can save the seq and portid of the original requester and use reply, I think. > + ret = ethnl_fill_reply_header(skb, dev, > + ETHTOOL_A_MODULE_FW_FLASH_HEADER); > + if (ret < 0) > + goto err_skb; > + > + if (nla_put_u32(skb, ETHTOOL_A_MODULE_FW_FLASH_STATUS, status)) > + goto err_skb; > + > + if (status_msg && > + nla_put_string(skb, ETHTOOL_A_MODULE_FW_FLASH_STATUS_MSG, > + status_msg)) > + goto err_skb; > + > + if (nla_put_u64_64bit(skb, ETHTOOL_A_MODULE_FW_FLASH_DONE, done, > + ETHTOOL_A_MODULE_FW_FLASH_PAD)) nla_put_uint() > + goto err_skb; > + > + if (nla_put_u64_64bit(skb, ETHTOOL_A_MODULE_FW_FLASH_TOTAL, total, > + ETHTOOL_A_MODULE_FW_FLASH_PAD)) nla_put_uint() > + goto err_skb; > + > + genlmsg_end(skb, hdr); > + ethnl_multicast(skb, dev); > + return; > + > +err_skb: > + nlmsg_free(skb); > +} > + > +void ethnl_module_fw_flash_ntf_err(struct net_device *dev, > + char *err_msg, char *sub_err_msg) > +{ > + char status_msg[120]; > + > + if (sub_err_msg) > + sprintf(status_msg, "%s, %s.", err_msg, sub_err_msg); > + else > + sprintf(status_msg, "%s.", err_msg); Hm, printing in the dot, and assuming sizeof err_msg + sub_err < 116 is a bit surprising. But I guess you have a reason... Maybe pass them separately to ethnl_module_fw_flash_ntf() then you can nla_reserve() the right amount of space and sprintf() directly into the skb? > + ethnl_module_fw_flash_ntf(dev, ETHTOOL_MODULE_FW_FLASH_STATUS_ERROR, > + status_msg, 0, 0);