From mboxrd@z Thu Jan 1 00:00:00 1970 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 53734181 for ; Wed, 9 Aug 2023 02:45:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49193C433C8; Wed, 9 Aug 2023 02:45:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691549112; bh=pyxUNDci4sxB1wNfmcV69RY2TDxRDhfEARSmUExkJrs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=G7Vydx4fkgsHZsKkGw098Beu9kEAY+jmirB0yHPMYCq4wy99U7H+dLrpiyc9PSCbk BTucSG6I6qd6TWuHsRKgLSmXckz4qxbwj2Rxu72tMHG4mmiqQ1eTI6+rnCTwvQ1f9B sVIEnnHzO0Nz2Y0SDlnt4BSq7Ybaq1I5Kpc8F1QzyEGog4JVqSV7ulIyGNBVab1DN4 jXfu3gg1KFlNsV1QMQdJ5DO6+eb3l9CB9bYI0hhcZAXvfVop98d7jYR+b7qKd9bURg kHTOshe1EK51WWRX4W7F0sFhJB0zmefrUx7LDuttAeE7QWbeTDR6ZQLRrQP33o1q2x k7Ei4VxEF9IBA== Date: Tue, 8 Aug 2023 19:45:11 -0700 From: Jakub Kicinski To: "Nambiar, Amritha" Cc: , , Subject: Re: [net-next PATCH v1 3/9] netdev-genl: spec: Extend netdev netlink spec in YAML for NAPI Message-ID: <20230808194511.538a0784@kernel.org> In-Reply-To: References: <169059098829.3736.381753570945338022.stgit@anambiarhost.jf.intel.com> <169059162756.3736.16797255590375805440.stgit@anambiarhost.jf.intel.com> <20230731123651.45b33c89@kernel.org> <6cb18abe-89aa-a8a8-a7e1-8856acaaef64@intel.com> <20230731171308.230bf737@kernel.org> <20230731173512.55ca051d@kernel.org> Precedence: bulk X-Mailing-List: netdev@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 Tue, 8 Aug 2023 17:17:34 -0700 Nambiar, Amritha wrote: > > The main thing to focus on for next version is to make the NAPI objects > > "flat" and individual, rather than entries in multi-attr nest within > > per-netdev object. > > Would this be acceptable: > $ netdev.yaml --do napi-get --json='{"ifindex": 12}' > > {'napi-info': [{'ifindex': 12, 'irq': 293, 'napi-id': 595, ...}, > {'ifindex': 12, 'irq': 292, 'napi-id': 594, ...}, > {'ifindex': 12, 'irq': 291, 'napi-id': 593, ...}]} > > Here, "napi-info" represents a list of NAPI objects. A NAPI object is an > individual element in the list, and are not within per-netdev object. > The ifindex is just another attribute that is part of the NAPI object. > The result for non-NAPI devices will just be empty. > > I am not sure how to totally avoid multi-attr nest in this case. For the > 'do napi-get' command, the response is a list of elements with multiple > attributes and not an individual entry. This transforms to a struct > array of NAPI objects in the 'do' response, and is achieved with the > multi-attr nest in the YAML. Subsequently, the 'dump napi-get' response > is a list of the 'NAPI objects struct list' for all netdevs. Am I > missing any special type in the YAML that can also give out a > struct-array in the 'do' response besides using multi-attr nest ? napi-get needs to take napi-id as an argument, if you want to filter by ifindex - that means a dump. Dumps work kind-of similar to do, you still get the attributes for the request (although in a somewhat convoluted way: static int your_dumpit(struct sk_buff *skb, struct netlink_callback *cb) { const struct genl_dumpit_info *info = genl_dumpit_info(cb); info->attr[attrs-as-normal] So if info->attrs[IFINDEX] is provided by the user - limit the dump to only napis from that netdev.