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 A048185C51 for ; Thu, 28 Mar 2024 16:02:21 +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=1711641741; cv=none; b=X4DnrzPI9spJe04bjEEA5+/2hv8gUFsTHSrvL2CTFv/8II68PamJTsEF+irNKPxXBFyjCvxI6RSkWO60RELVnfnGfOPMIuOy1jL+rxdMBgh9JQrodE+hTEhdvRZh2un/Qbne2B5UxsAJKoqe6OwSNzIgZIbI/qnLsKUIVMh8xSg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711641741; c=relaxed/simple; bh=cFB7+60j1G8ByR1TMqXmy0CmTGoln42FGZD7jOF0uAc=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HlvjIpiKaa0Nm+8h6tA765LQhpTS7kHnJ+q6Qhw8gG/bvTghn3ViN7d9+wIno3y+3CjdrLXFpYvNEXGP9k91gZhbjdCaPWVCttehNaKWRzR6txytU19/vnpXKFgNADZ65YDwFcZJWS0RdZxGQ6rVRyqAkDMpjQh7eEDq9r4AuZ0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Dg8OSPNL; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Dg8OSPNL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11B89C433F1; Thu, 28 Mar 2024 16:02:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711641741; bh=cFB7+60j1G8ByR1TMqXmy0CmTGoln42FGZD7jOF0uAc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Dg8OSPNLOdNN+HIMHLfGJL10U7gq536BMjLu7eXwx4Tk3/8eiHNB5hq1cWhBQN1qI G+JFifL109xJCt/t7HicGzX3g1ZMVL15uHj9KLa6XzHpbJMQpOCf6koSlBVlskL6dG UaZJ/sfkCJVquDYz+Cf+LrsxOOsZjqJ8zTjAf1Zqg/kNN0WH30xjp2TT/EsC9It5FF 9VmMpjdLyAIXB7D3DkP42QAPSnNtFg9pb4JlhQ0GuMv/kowL2uS9mwcCz0tfXzQG6w BF3brsB+sgWjVpfSD2f1n9PeNOns3M5xhhrToTFjlJB40w5hmGF4vll21HmxeNh9Re KmRhfshCFctww== Date: Thu, 28 Mar 2024 09:02:20 -0700 From: Jakub Kicinski To: Hangbin Liu Cc: netdev@vger.kernel.org, "David S. Miller" , Eric Dumazet , Paolo Abeni , Donald Hunter , Jiri Pirko , Jacob Keller , Stanislav Fomichev Subject: Re: [PATCH net-next 1/2] ynl: rename array-nest to indexed-array Message-ID: <20240328090220.458c98c2@kernel.org> In-Reply-To: References: <20240326063728.2369353-1-liuhangbin@gmail.com> <20240326063728.2369353-2-liuhangbin@gmail.com> <20240326204610.1cb1715b@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 Thu, 28 Mar 2024 15:50:35 +0800 Hangbin Liu wrote: > I agree we need raise exception when only support nest sub-type. But > what about after adding other sub-types in patch 2/2. e.g. > > if attr_spec["sub-type"] == 'nest': > decoded = self._decode_array_nest(attr, attr_spec) > else: > decoded = self._decode_index_array(attr, attr_spec) > > Should we remove the exception in patch 2? Looking a bit closer you should probably have: - elif attr_spec["type"] == 'array-nest': - decoded = self._decode_array_nest(attr, attr_spec) + elif attr_spec["type"] == 'indexed-array': + decoded = self._decode_array_attr(attr, attr_spec) elif attr_spec["type"] == 'bitfield32': and do the sub-type handling inside (now renamed) _decode_array_attr() Throw the exception there appropriately.