From patchwork Wed Nov 29 10:11:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Donald Hunter X-Patchwork-Id: 13472586 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dQqEkhOi" Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 455B2E1; Wed, 29 Nov 2023 02:12:35 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-40b552deba0so1659005e9.1; Wed, 29 Nov 2023 02:12:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701252753; x=1701857553; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vnVO+XG5c6orDmPhNlnDUKCa0vfQLqdJ0lxbJhkoXw8=; b=dQqEkhOietnylAHFpZT20w/7wqjDEd6b8zJ9ehzDOTJzUafR6esy3519bDxueMum0y T68Xn19Gmyuy30p2rQCxFPN2x9LD7qGF0KnT9Lwx8qezeJUzzs0bkOy/DJRg8cIfi3cD 8XC3AAQXr/JeD2KfWarmSsMiKa3f2lbd95fBwnxMzwCGh528gdLV3CqAOev4kSdmlEkt 46NpNBNuKFXzfbWpLeYpaSNZroZH19t4lf9u+Bl9Soa/wAPVnksI4sB8Oemdz1C1JZY8 715Kt2f2GES/l9H89LfAI/GrVJXzHCMVBAdPV0UL7UH5Vb9am4jhr9Oz9mcUuLZNSdoG AI1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701252753; x=1701857553; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vnVO+XG5c6orDmPhNlnDUKCa0vfQLqdJ0lxbJhkoXw8=; b=g8b8JAsVZ2RrM2LuCUjN881ToxXoADFsi6GSjhEw8YOD0gqIV2dj3ThredCYhx+gdH MTNwoEr1GO2kXqnAmh01Yik8UMzOlOQ6cJeoJuRuMJIJ9AcT4gCXiGC4OqKE+ynAnTVx iQzxbtctC9JMlhPIMtlShVtPCeEmHMserVwkkQm7O3/azVBf9MN/VRuHwKOHU7qxPIO5 EoGqBr2HjTMk/yGkPvgYbddvlu30++BDopjDMCdEg5EDjXnOHsx9YyBQ7O89w3HKDKBN yLHTatjo9x37XX+AO5dk5RZ6yh6LWFVMntw0ma289dQag+ndaxZjIwt4C5JLy1dV4/Js GGNg== X-Gm-Message-State: AOJu0YwqSh51CPZczQfQ3LT1/bzvGKEug6fH4Ly/eBhb6jTPsyAnu0Xi SU8vVHmDv9m6uYz6BROyXeqe1klQYJyFtA== X-Google-Smtp-Source: AGHT+IHiCiTnro+tWPMZSmaLUtqWNNA9LWwe1Pn+OOPV8cN6cElVkDBwZrUwYvHhKRfpFgIgrqgAkA== X-Received: by 2002:a5d:5045:0:b0:332:f895:f58f with SMTP id h5-20020a5d5045000000b00332f895f58fmr8178889wrt.2.1701252753016; Wed, 29 Nov 2023 02:12:33 -0800 (PST) Received: from imac.fritz.box ([2a02:8010:60a0:0:648d:8c5c:f210:5d75]) by smtp.gmail.com with ESMTPSA id k24-20020a5d5258000000b00332d04514b9sm17296877wrc.95.2023.11.29.02.12.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 02:12:32 -0800 (PST) From: Donald Hunter To: netdev@vger.kernel.org, Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Jonathan Corbet , linux-doc@vger.kernel.org Cc: donald.hunter@redhat.com, Donald Hunter Subject: [RFC PATCH net-next v1 1/6] doc/netlink: Add bitfield32, s8, s16 to the netlink-raw schema Date: Wed, 29 Nov 2023 10:11:54 +0000 Message-ID: <20231129101159.99197-2-donald.hunter@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231129101159.99197-1-donald.hunter@gmail.com> References: <20231129101159.99197-1-donald.hunter@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC The netlink-raw schema was not updated when bitfield32 was added to the genetlink-legacy schema. It is needed for rtnetlink families. s8 and s16 were also missing. Signed-off-by: Donald Hunter --- Documentation/netlink/netlink-raw.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation/netlink/netlink-raw.yaml b/Documentation/netlink/netlink-raw.yaml index 775cce8c548a..ad5395040765 100644 --- a/Documentation/netlink/netlink-raw.yaml +++ b/Documentation/netlink/netlink-raw.yaml @@ -200,7 +200,8 @@ properties: type: string type: &attr-type description: The netlink attribute type - enum: [ unused, pad, flag, binary, u8, u16, u32, u64, s32, s64, + enum: [ unused, pad, flag, binary, bitfield32, + u8, u16, u32, u64, s8, s16, s32, s64, string, nest, array-nest, nest-type-value ] doc: description: Documentation of the attribute. From patchwork Wed Nov 29 10:11:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Donald Hunter X-Patchwork-Id: 13472587 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="N4NgSl9v" Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7A0DD7F; Wed, 29 Nov 2023 02:12:36 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-332cb136335so4520963f8f.0; Wed, 29 Nov 2023 02:12:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701252754; x=1701857554; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2yWoSEmRIuqlmSxP7Kp9u1Gyx2u43lx1c7DNGAxn/Dc=; b=N4NgSl9vOM+lZ8JrS7qZ96avTIQrGUSEHZPa4a0NX5ZajQJrIFzQizVkN9I9VEIvUr /TcpH/Acpavp9KGxptE4OV5gg7Yo2QHBAmte0n5tNewKw5gsF7yBi9UNG+KBlS7yhABh KSqRyZm2VyZRfRiaEkk03Y7vs0FpRtQ5LiZWENuLrXAL2NiuqpxAaziCiZ17BUxAhQz9 OCHiPsk+hhrPauXp4a84ViEJxTw1L7Z3d5LHzKPX7kiguvuvamKEPGeirQxws9iQZkpQ 8tofP7yvXFUfpRI2uLnBePcGc8qf1mADawZAo70Y5sGicmk9e6AKS8sCEOKpjDLxkrCa OmPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701252754; x=1701857554; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2yWoSEmRIuqlmSxP7Kp9u1Gyx2u43lx1c7DNGAxn/Dc=; b=mjT6FYGEx5q5AlvepJXDyGDAy9JIfK1x/K5uhfTaQGlmCzCB9wapqxcMxsqRs/M7Rx PQmPCDH06Gh7QK29O1+abFmKHZdnk0mJ2F0eb5rac1u/n/pDso+rgSCy98a8VP7cAG8D wTO8kjacc8RlTLmcemXA4etC19KAqA00764P3UPZLD+eETF1+pxq5nnbvuh1wYaDF77E HVFpAZ/ASo9ZFZfSygyFcWSnr3VIZVVtUAV3PZhWYFv9egWSp+cjCaIg4N8JJYatjq6p aE+QrEuaKp9yRvJEatGLTYBdNyYNlNoGd5DGK+r3wDbVw/JeIEm/vEeJNQZK9EksHU1G hEyw== X-Gm-Message-State: AOJu0YxMLTNrQFhnF/hL2NregxTMXSp4d2GG5BnHKeL6yMC/nXY6tHUq 8pNEyve5KFyRS0QP0dtFIou71rW4z63BCA== X-Google-Smtp-Source: AGHT+IGhaObCzarZG9YqZ4pTQOaRxnkjKHamCuHB7ICDeB68d4Wtu4eFjW5ONT5EuBl6IMBhl7pK8Q== X-Received: by 2002:a5d:488f:0:b0:333:19b:d32e with SMTP id g15-20020a5d488f000000b00333019bd32emr5566097wrq.56.1701252754365; Wed, 29 Nov 2023 02:12:34 -0800 (PST) Received: from imac.fritz.box ([2a02:8010:60a0:0:648d:8c5c:f210:5d75]) by smtp.gmail.com with ESMTPSA id k24-20020a5d5258000000b00332d04514b9sm17296877wrc.95.2023.11.29.02.12.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 02:12:33 -0800 (PST) From: Donald Hunter To: netdev@vger.kernel.org, Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Jonathan Corbet , linux-doc@vger.kernel.org Cc: donald.hunter@redhat.com, Donald Hunter Subject: [RFC PATCH net-next v1 2/6] doc/netlink: Add a nest selector to netlink-raw schema Date: Wed, 29 Nov 2023 10:11:55 +0000 Message-ID: <20231129101159.99197-3-donald.hunter@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231129101159.99197-1-donald.hunter@gmail.com> References: <20231129101159.99197-1-donald.hunter@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Add a 'dynamic' attribute type with a selector that declares how to choose the attribute-space for nested attributes. Use the value of another attribute as the selector key. For example if the following attribute has already been decoded: { "kind": "gre" } then the following selector: selector: attribute: kind list: - value: bridge type: nest nested-attributes: linkinfo-bridge-attrs - value: gre type: nest nested-attributes: linkinfo-gre-attrs - value: geneve type: nest nested-attributes: linkinfo-geneve-attrs would decode the value as nested attributes, using the 'linkinfo-gre-attrs' attribute space. This approach was chosen so that different value types can be handled by the same selector, allowing a mix of e.g. nest, struct and binary. Signed-off-by: Donald Hunter --- Documentation/netlink/netlink-raw.yaml | 38 +++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/Documentation/netlink/netlink-raw.yaml b/Documentation/netlink/netlink-raw.yaml index ad5395040765..62061e180f8f 100644 --- a/Documentation/netlink/netlink-raw.yaml +++ b/Documentation/netlink/netlink-raw.yaml @@ -202,7 +202,7 @@ properties: description: The netlink attribute type enum: [ unused, pad, flag, binary, bitfield32, u8, u16, u32, u64, s8, s16, s32, s64, - string, nest, array-nest, nest-type-value ] + string, nest, array-nest, nest-type-value, dynamic ] doc: description: Documentation of the attribute. type: string @@ -261,6 +261,42 @@ properties: description: Name of the struct type used for the attribute. type: string # End genetlink-legacy + # Start netlink-raw + selector: + description: + Map of attribute definitions for dynamic selection of type + specific attribute spaces. + type: object + required: [ attribute, list ] + additionalProperties: false + properties: + attribute: + description: + Name of the attribute that contains the type identifier + string. + type: string + list: + type: array + items: + type: object + required: [ value, type ] + additionalProperties: false + properties: + value: + description: Type identifier string to match. + type: string + type: + description: The netlink attribute type. + enum: [ binary, nest ] + nested-attributes: + description: + Name of the sub-space used inside the attribute. + type: string + struct: + description: + Name of the struct type used for the attribute. + type: string + # End netlink-raw # Make sure name-prefix does not appear in subsets (subsets inherit naming) dependencies: From patchwork Wed Nov 29 10:11:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Donald Hunter X-Patchwork-Id: 13472588 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HuaWtwe6" Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9BF910C0; Wed, 29 Nov 2023 02:12:37 -0800 (PST) Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-332eeb16e39so2844269f8f.1; Wed, 29 Nov 2023 02:12:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701252756; x=1701857556; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Te2xZ3LGiGKvdmyNt2KwT8wR0BVKNTLKW0pRiCg1eQY=; b=HuaWtwe62oQO/4Ot8d8iVj6BmPHNLVNxgdQ3hHQNrw+VuZoyP1JDl+dmbbVm2GIrc3 1DT+Hgk7GivoP3TtL4Xp66MPwJswHMreqDiMHQZ71sudhUoVuQrWptr2VoyNB0IgA2F5 f1gqTJXho2RzCWEt5Qt3UIZFarBbfImohf6cwvcyBTZAiXi1ezQxPjO6+fMyl83nTuFt 1DUW0XfOc8Ril/ECjQOyNAht+dkx7OQhB4gUClIZxZb/k3lfzG5MH2Dt49sVKs22+B34 hlcVyz3HccFbADbmGsGL92wkq7snue+W0NubKOMPD145Ifn2DZpFUPo6fJpxa/iNV6M4 31kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701252756; x=1701857556; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Te2xZ3LGiGKvdmyNt2KwT8wR0BVKNTLKW0pRiCg1eQY=; b=W/W/1D0w43kHTxO3PteXaGwsClPK6VF4Vhv7hVwIbzWpPp+M1Aa4J3jJSlMKBp3cUt DmNSCAb4tKn4OGw/Tl+WtVuOve78lwdVzO4lkIPXFXr12y9GMmFX2KDBIWg4wlei4xFr WIQUnwUk+N+MMcsEVPkYfWo3mdCwsZlypp58Wg25ov3m6yV09OQNgOiNIDaeZDtBJkHo Uu8QNQym8mZG0nb+uoLt0wPXEe/sB0VZ4NVk4T4j6df5QRR6n3iDcCQIIIdfLs99rs98 V1R+zyeOxg9D6VnN48K+sLb8j03IKPqyNW0yec5l2a+Ky70O9G85IA97VmPob9ozIb/e yoVg== X-Gm-Message-State: AOJu0YyJH0+G9Hls4InyF+fADooO6GYmxtKFgLAs+a7Q7WwMYg0H0BzL /RsHpdRDUyIwYbPo+JUyDYedUSccCAXM4A== X-Google-Smtp-Source: AGHT+IG1v8egTwKqRxhVvfXv9Ct69hz779yjsLCIqc3TRqZoPCqtTD31ZK9qYE6E4zQ4eWcY24ZNag== X-Received: by 2002:adf:e602:0:b0:333:9eb:5005 with SMTP id p2-20020adfe602000000b0033309eb5005mr3722156wrm.27.1701252755852; Wed, 29 Nov 2023 02:12:35 -0800 (PST) Received: from imac.fritz.box ([2a02:8010:60a0:0:648d:8c5c:f210:5d75]) by smtp.gmail.com with ESMTPSA id k24-20020a5d5258000000b00332d04514b9sm17296877wrc.95.2023.11.29.02.12.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 02:12:34 -0800 (PST) From: Donald Hunter To: netdev@vger.kernel.org, Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Jonathan Corbet , linux-doc@vger.kernel.org Cc: donald.hunter@redhat.com, Donald Hunter Subject: [RFC PATCH net-next v1 3/6] tools/net/ynl: Add dynamic attribute decoding to ynl Date: Wed, 29 Nov 2023 10:11:56 +0000 Message-ID: <20231129101159.99197-4-donald.hunter@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231129101159.99197-1-donald.hunter@gmail.com> References: <20231129101159.99197-1-donald.hunter@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Implement dynamic attribute space selection and decoding to the ynl library. Encode support is not yet implemented. Support for dynamic selectors at a different nest level from the key attribute is not yet supported. Signed-off-by: Donald Hunter --- tools/net/ynl/lib/nlspec.py | 27 +++++++++++++++++++++++++++ tools/net/ynl/lib/ynl.py | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/tools/net/ynl/lib/nlspec.py b/tools/net/ynl/lib/nlspec.py index 92889298b197..c32c85ddf8fb 100644 --- a/tools/net/ynl/lib/nlspec.py +++ b/tools/net/ynl/lib/nlspec.py @@ -142,6 +142,29 @@ class SpecEnumSet(SpecElement): mask += e.user_value(as_flags) return mask +class SpecDynAttr(SpecElement): + """ Single Dynamic Netlink atttribute type + + Represents a choice of dynamic attribute type within an attr space. + + Attributes: + value attribute value to match against dynamic type selector + struct_name string, name of struct definition + sub_type string, name of sub type + len integer, optional byte length of binary types + display_hint string, hint to help choose format specifier + when displaying the value + """ + def __init__(self, family, parent, yaml): + super().__init__(family, yaml) + + self.value = yaml.get('value') + self.struct_name = yaml.get('struct') + self.sub_type = yaml.get('sub-type') + self.byte_order = yaml.get('byte-order') + self.len = yaml.get('len') + self.display_hint = yaml.get('display-hint') + class SpecAttr(SpecElement): """ Single Netlink atttribute type @@ -173,9 +196,13 @@ class SpecAttr(SpecElement): self.byte_order = yaml.get('byte-order') self.len = yaml.get('len') self.display_hint = yaml.get('display-hint') + self.dynamic_types = {} self.is_auto_scalar = self.type == "sint" or self.type == "uint" + if 'selector' in yaml: + for item in yaml.get('selector').get('list', []): + self.dynamic_types[item['value']] = SpecDynAttr(family, self, item) class SpecAttrSet(SpecElement): """ Netlink Attribute Set class. diff --git a/tools/net/ynl/lib/ynl.py b/tools/net/ynl/lib/ynl.py index 92995bca14e1..5ce01ce37573 100644 --- a/tools/net/ynl/lib/ynl.py +++ b/tools/net/ynl/lib/ynl.py @@ -549,6 +549,36 @@ class YnlFamily(SpecFamily): else: rsp[name] = [decoded] + def _resolve_selector(self, attr_spec, vals): + if 'selector' in attr_spec: + selector = attr_spec['selector'] + key = selector['attribute'] + if key in vals: + value = vals[key] + if value in attr_spec.dynamic_types: + spec = attr_spec.dynamic_types[value] + return spec + else: + raise Exception(f"No entry for {key}={value} in selector for '{attr_spec['name']}'") + else: + raise Exception(f"There is no value for {key} to use in selector for '{attr_spec['name']}'") + else: + raise Exception("type=dynamic requires a selector in '{attr_spec['name']}'") + + def _decode_dynamic(self, attr, attr_spec, rsp): + dyn_spec = self._resolve_selector(attr_spec, rsp) + if dyn_spec['type'] == 'binary': + decoded = self._decode_binary(attr, dyn_spec) + elif dyn_spec['type'] == 'nest': + attr_space = dyn_spec['nested-attributes'] + if attr_space in self.attr_sets: + decoded = self._decode(NlAttrs(attr.raw), attr_space) + else: + raise Exception(f"Unknown attribute-set '{attr_space}'") + else: + raise Exception(f"Unknown type '{spec['type']}' for value '{value}'") + return decoded + def _decode(self, attrs, space): if space: attr_space = self.attr_sets[space] @@ -586,6 +616,8 @@ class YnlFamily(SpecFamily): value = self._decode_enum(value, attr_spec) selector = self._decode_enum(selector, attr_spec) decoded = {"value": value, "selector": selector} + elif attr_spec["type"] == 'dynamic': + decoded = self._decode_dynamic(attr, attr_spec, rsp) else: if not self.process_unknown: raise Exception(f'Unknown {attr_spec["type"]} with name {attr_spec["name"]}') From patchwork Wed Nov 29 10:11:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Donald Hunter X-Patchwork-Id: 13472589 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nWoH+C92" Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 748D010C4; Wed, 29 Nov 2023 02:12:39 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-40b538d5c4eso2933655e9.1; Wed, 29 Nov 2023 02:12:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701252757; x=1701857557; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mNRtIfPDAXy/iSMm8fC7H/C6Gm/957WZE4QOKoqhkm8=; b=nWoH+C9281AVuW9e9YsJNRZb2qW+7BatfvwKXT6L1VR8D6nRko3O/4hs/xjpdYDmzr VYxvQ4r7hHMxPjk2WejPxj1s4u1bLjmOUUTZ3Bmgk4TsUXNlv7LYyyckc036k5hOIkjO M6dmcMtDMuvoN+Y6Bcy6EYFo+fn6/RD48Xq8xn5Qc/T9K6ee8F27r5WMrc01R4bZUVZJ QJgoBw5EmGpTd5/stOIcSvARxRInq41+0LdBfOUzj1knIInr64n+UKIB0WW4zb7OGi+C UubUj2VDyil2kLPAX8CC/k7tU6PUprVALZj34+oyvkSJYDfGF96xf+jsbvZ10Y6rOaqg H8YQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701252757; x=1701857557; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mNRtIfPDAXy/iSMm8fC7H/C6Gm/957WZE4QOKoqhkm8=; b=MnYHyMCgwmd1gAfFkln3aq3lSQlIg0xzwuf4uUR3vQ8S65lzWiOpcbJ3NWFQ5sbmZV 1a120re3AdUNtY0SBYS+GhIa4pvPEiDiia2uIhCU/ThG7qRyOyuUXqwMTaWSs9zK4YyE OMNEazqE0oTfe+bRtj91Nsrk85p58l9C6L9IpJn+PSiBGQUji2dU4HtykC70LAt1GD7V 1bQAn5FqjsAXRxBcDJTdSnPqfhiM0ro2VwkMmtddcswl6fcqf1plzkSsNIIVDqaiqRpW es+mDxn+ESzO4a66GHlRrD5GtQhm3f0Y2zO8nX7rdyZSDaS4pqCyzUadyQVCdflgDrJz +xnA== X-Gm-Message-State: AOJu0YybvLrESrvpnTJKjAkwhIbbZI757Evp5rHXodzX0eqWN099rMzP DXwLq98gJXYfgkumRugXiIBIp+QjsC3m5A== X-Google-Smtp-Source: AGHT+IETEMw6tqKFHXlN1Eyu77dsNeWbiPUtYoSe/Kl2sgyBHIHNIG6G2jcQhuucaX7xnzcW+y4xIQ== X-Received: by 2002:a05:600c:1f8e:b0:409:247b:b0ae with SMTP id je14-20020a05600c1f8e00b00409247bb0aemr11853226wmb.36.1701252756985; Wed, 29 Nov 2023 02:12:36 -0800 (PST) Received: from imac.fritz.box ([2a02:8010:60a0:0:648d:8c5c:f210:5d75]) by smtp.gmail.com with ESMTPSA id k24-20020a5d5258000000b00332d04514b9sm17296877wrc.95.2023.11.29.02.12.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 02:12:36 -0800 (PST) From: Donald Hunter To: netdev@vger.kernel.org, Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Jonathan Corbet , linux-doc@vger.kernel.org Cc: donald.hunter@redhat.com, Donald Hunter Subject: [RFC PATCH net-next v1 4/6] doc/netlink/specs: add dynamic nest selector for rt_link data Date: Wed, 29 Nov 2023 10:11:57 +0000 Message-ID: <20231129101159.99197-5-donald.hunter@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231129101159.99197-1-donald.hunter@gmail.com> References: <20231129101159.99197-1-donald.hunter@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Switch to using a dynamic nest selector in the rt_link spec for the link-specific 'data' attribute. Signed-off-by: Donald Hunter --- Documentation/netlink/specs/rt_link.yaml | 278 ++++++++++++++++++++++- 1 file changed, 274 insertions(+), 4 deletions(-) diff --git a/Documentation/netlink/specs/rt_link.yaml b/Documentation/netlink/specs/rt_link.yaml index 1ec6cb6a0d96..498d3ce38c91 100644 --- a/Documentation/netlink/specs/rt_link.yaml +++ b/Documentation/netlink/specs/rt_link.yaml @@ -965,8 +965,46 @@ attribute-sets: type: string - name: data - type: binary - # kind specific nest, e.g. linkinfo-bridge-attrs + type: dynamic + selector: + attribute: kind + list: + - + value: bridge + type: nest + nested-attributes: linkinfo-bridge-attrs + - + value: erspan + type: nest + nested-attributes: linkinfo-gre-attrs + - + value: gre + type: nest + nested-attributes: linkinfo-gre-attrs + - + value: gretap + type: nest + nested-attributes: linkinfo-gre-attrs + - + value: geneve + type: nest + nested-attributes: linkinfo-geneve-attrs + - + value: ipip + type: nest + nested-attributes: linkinfo-iptun-attrs + - + value: sit + type: nest + nested-attributes: linkinfo-iptun-attrs + - + value: tun + type: nest + nested-attributes: linkinfo-tun-attrs + - + value: vrf + type: nest + nested-attributes: linkinfo-vrf-attrs - name: xstats type: binary @@ -975,10 +1013,10 @@ attribute-sets: type: string - name: slave-data - type: binary - # kind specific nest + type: binary # kind specific nest - name: linkinfo-bridge-attrs + name-prefix: ifla-br- attributes: - name: forward-delay @@ -1122,6 +1160,238 @@ attribute-sets: - name: mcast-querier-state type: binary + - + name: linkinfo-gre-attrs + name-prefix: ifla-gre- + attributes: + - + name: link + type: u32 + - + name: iflags + type: u16 + - + name: oflags + type: u16 + - + name: ikey + type: u32 + - + name: okey + type: u32 + - + name: local + type: binary + display-hint: ipv4 + - + name: remote + type: binary + display-hint: ipv4 + - + name: ttl + type: u8 + - + name: tos + type: u8 + - + name: pmtudisc + type: u8 + - + name: encap-limit + type: u32 + - + name: flowinfo + type: u32 + - + name: flags + type: u32 + - + name: encap-type + type: u16 + - + name: encap-flags + type: u16 + - + name: encap-sport + type: u16 + - + name: encap-dport + type: u16 + - + name: collect-metadata + type: flag + - + name: ignore-df + type: u8 + - + name: fwmark + type: u32 + - + name: erspan-index + type: u32 + - + name: erspan-ver + type: u8 + - + name: erspan-dir + type: u8 + - + name: erspan-hwid + type: u16 + - + name: linkinfo-geneve-attrs + name-prefix: ifla-geneve- + attributes: + - + name: id + type: u32 + - + name: remote + type: binary + display-hint: ipv4 + - + name: ttl + type: u8 + - + name: tos + type: u8 + - + name: port + type: u16 + - + name: collect-metadata + type: flag + - + name: remote6 + type: binary + display-hint: ipv6 + - + name: udp-csum + type: u8 + - + name: udp-zero-csum6-tx + type: u8 + - + name: udp-zero-csum6-rx + type: u8 + - + name: label + type: u32 + - + name: ttl-inherit + type: u8 + - + name: df + type: u8 + - + name: inner-proto-inherit + type: flag + - + name: linkinfo-iptun-attrs + name-prefix: ifla-iptun- + attributes: + - + name: link + type: u32 + - + name: local + type: binary + display-hint: ipv4 + - + name: remote + type: binary + display-hint: ipv4 + - + name: ttl + type: u8 + - + name: tos + type: u8 + - + name: encap-limit + type: u8 + - + name: flowinfo + type: u32 + - + name: flags + type: u16 + - + name: proto + type: u8 + - + name: pmtudisc + type: u8 + - + name: 6rd-prefix + type: binary + display-hint: ipv6 + - + name: 6rd-relay-prefix + type: binary + display-hint: ipv4 + - + name: 6rd-prefixlen + type: u16 + - + name: 6rd-relay-prefixlen + type: u16 + - + name: encap-type + type: u16 + - + name: encap-flags + type: u16 + - + name: encap-sport + type: u16 + - + name: encap-dport + type: u16 + - + name: collect-metadata + type: flag + - + name: fwmark + type: u32 + - + name: linkinfo-tun-attrs + name-prefix: ifla-tun- + attributes: + - + name: owner + type: u32 + - + name: group + type: u32 + - + name: type + type: u8 + - + name: pi + type: u8 + - + name: vnet-hdr + type: u8 + - + name: persist + type: u8 + - + name: multi-queue + type: u8 + - + name: num-queues + type: u32 + - + name: num-disabled-queues + type: u32 + - + name: linkinfo-vrf-attrs + name-prefix: ifla-vrf- + attributes: + - + name: table + type: u32 - name: xdp-attrs attributes: From patchwork Wed Nov 29 10:11:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Donald Hunter X-Patchwork-Id: 13472591 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OUDpRPL5" Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5498D6C; Wed, 29 Nov 2023 02:12:40 -0800 (PST) Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-409299277bbso49625725e9.2; Wed, 29 Nov 2023 02:12:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701252759; x=1701857559; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6OiXF+wSumcaIiWQAp9R+NZ5wr+B+h86icAQ57NmgD4=; b=OUDpRPL5dvim3XL/9v7HEPJK9U2O5kigeRyj0DbKBWGRXqGdFn4OX6BOlGwLZFBqpK eGGbyo7m3QqqsRC7Dp+/Un9xEz46DMPFCDsixUuDudSHOK4TZ+o3dNLNyRQOTLGmyb9X mqONCt1dRVETMPnIio6qu70ee9Kdz1AHTmIVyMfBjSiQrzo771QRWkp/QloRQF6xBoMP 58JhMK1vD5Cm/CtAFEMqsqi4WWk9+GTW8C6lVfniXBs9NDr3TZIGSY1WKbf5AID2nSPE qU9dbuAbT2hkyRenicpLr5m8xLc6sspeSzuWfIzn77EHot+yVkde4vUHO7ZavAfj7jJe BgFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701252759; x=1701857559; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6OiXF+wSumcaIiWQAp9R+NZ5wr+B+h86icAQ57NmgD4=; b=FNnROzOqElfm8nuXQmsH4O3NXKJa84yl3KJYyqlwFoDxGeLeExARb+Ttj4S1QuhR6n SOX6reN7cSOGLUDGvKpWHTh3k9WkA+0FEgQpGDbOAI3md1G+tsBFYN94Y8U5FLPadyU4 NIq6T3fFJ6FW6lGuE7gqULtbNN+zTpf9rOeir1Ap8AdwYvIT3KMmiIMl4VBciSFHIkc1 j/FEJFUp45gwUucgOHR2l8P1dO/DsdNKk4xrSfp9WuONCDdU7nSjTLEYDhhzj4m78xl7 btC9lwkrBw41UAchlNFLY3z0mPOAMMBq7TtfRUotDbksFUatXAFSK5XXBBk5qmHtpZef XEWw== X-Gm-Message-State: AOJu0YxUhQ/1KYKnmBZZWJi8i9SV7zfsAdvNos+fYHl/YsFzDJw0C4H/ BF+sDFS12E5Nu+j956u4gsOjglK/WlKqCA== X-Google-Smtp-Source: AGHT+IEb1G5KGeNi155xEZCaZDYcLdU0rR2+hQfT8nFDSAJI8xnp2Pcl7AdoOuAfRxX+e8B0U+NMUQ== X-Received: by 2002:a05:600c:35ca:b0:406:54e4:359c with SMTP id r10-20020a05600c35ca00b0040654e4359cmr13234269wmq.19.1701252758568; Wed, 29 Nov 2023 02:12:38 -0800 (PST) Received: from imac.fritz.box ([2a02:8010:60a0:0:648d:8c5c:f210:5d75]) by smtp.gmail.com with ESMTPSA id k24-20020a5d5258000000b00332d04514b9sm17296877wrc.95.2023.11.29.02.12.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 02:12:37 -0800 (PST) From: Donald Hunter To: netdev@vger.kernel.org, Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Jonathan Corbet , linux-doc@vger.kernel.org Cc: donald.hunter@redhat.com, Donald Hunter Subject: [RFC PATCH net-next v1 5/6] doc/netlink/specs: Add a spec for tc Date: Wed, 29 Nov 2023 10:11:58 +0000 Message-ID: <20231129101159.99197-6-donald.hunter@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231129101159.99197-1-donald.hunter@gmail.com> References: <20231129101159.99197-1-donald.hunter@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC This is a work-in-progress spec for tc that covers: - most of the qdiscs - the flower classifier - new, del, get for qdisc, chain, class and filter Notable omissions: - most of the stats attrs are left as binary blobs - notifications are not yet implemented Signed-off-by: Donald Hunter --- Documentation/netlink/specs/tc.yaml | 2074 +++++++++++++++++++++++++++ 1 file changed, 2074 insertions(+) create mode 100644 Documentation/netlink/specs/tc.yaml diff --git a/Documentation/netlink/specs/tc.yaml b/Documentation/netlink/specs/tc.yaml new file mode 100644 index 000000000000..885761e2c97a --- /dev/null +++ b/Documentation/netlink/specs/tc.yaml @@ -0,0 +1,2073 @@ +# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) + +name: tc +protocol: netlink-raw +protonum: 0 + +doc: + Netlink raw family for tc qdisc, chain, class and filter configuration + over rtnetlink. + +definitions: + - + name: tcmsg + type: struct + members: + - + name: family + type: u8 + - + name: pad1 + type: u8 + - + name: pad2 + type: u16 + - + name: ifindex + type: s32 + - + name: handle + type: u32 + - + name: parent + type: u32 + - + name: info + type: u32 + - + name: tc-cls-flags + type: flags + entries: + - skip-hw + - skip-sw + - in-hw + - not-in-nw + - verbose + - + name: tc-stats + type: struct + members: + - + name: bytes + type: u64 + - + name: packets + type: u32 + - + name: drops + type: u32 + - + name: overlimits + type: u32 + - + name: bps + type: u32 + - + name: pps + type: u32 + - + name: qlen + type: u32 + - + name: backlog + type: u32 + - + name: tc-cbs-qopt + type: struct + members: + - + name: offload + type: u8 + - + name: pad + type: binary + len: 3 + - + name: hicredit + type: s32 + - + name: locredit + type: s32 + - + name: idleslope + type: s32 + - + name: sendslope + type: s32 + - + name: tc-etf-qopt + type: struct + members: + - + name: delta + type: s32 + - + name: clockid + type: s32 + - + name: flags + type: s32 + - + name: tc-fifo-qopt + type: struct + members: + - + name: limit + type: u32 + - + name: tc-htb-opt + type: struct + members: + - + name: rate + type: binary + len: 12 + - + name: ceil + type: binary + len: 12 + - + name: buffer + type: u32 + - + name: cbuffer + type: u32 + - + name: quantum + type: u32 + - + name: level + type: u32 + - + name: prio + type: u32 + - + name: tc-htb-glob + type: struct + members: + - + name: version + type: u32 + - + name: rate2quantum + type: u32 + - + name: defcls + type: u32 + - + name: debug + type: u32 + - + name: direct-pkts + type: u32 + - + name: tc-gred-qopt + type: struct + members: + - + name: limit + type: u32 + - + name: qth-min + type: u32 + - + name: qth-max + type: u32 + - + name: DP + type: u32 + - + name: backlog + type: u32 + - + name: qave + type: u32 + - + name: forced + type: u32 + - + name: early + type: u32 + - + name: other + type: u32 + - + name: pdrop + type: u32 + - + name: Wlog + type: u8 + - + name: Plog + type: u8 + - + name: Scell_log + type: u8 + - + name: prio + type: u8 + - + name: packets + type: u32 + - + name: bytesin + type: u32 + - + name: tc-gred-sopt + type: struct + members: + - + name: DPs + type: u32 + - + name: def_DP + type: u32 + - + name: grio + type: u8 + - + name: flags + type: u8 + - + name: pad1 + type: u16 + - + name: tc-hfsc-qopt + type: struct + members: + - + name: defcls + type: u16 + - + name: tc-mqprio-qopt + type: struct + members: + - + name: num-tc + type: u8 + - + name: prio-tc-map + type: binary + len: 16 + - + name: hw + type: u8 + - + name: count + type: binary + len: 32 + - + name: offset + type: binary + len: 32 + - + name: tc-multiq-qopt + type: struct + members: + - + name: bands + type: u16 + - + name: max-bands + type: u16 + - + name: tc-netem-qopt + type: struct + members: + - + name: latency + type: u32 + - + name: limit + type: u32 + - + name: loss + type: u32 + - + name: gap + type: u32 + - + name: duplicate + type: u32 + - + name: jitter + type: u32 + - + name: tc-prio-qopt + type: struct + members: + - + name: bands + type: u16 + - + name: priomap + type: binary + len: 16 + - + name: tc-red-qopt + type: struct + members: + - + name: limit + type: u32 + - + name: qth-min + type: u32 + - + name: qth-max + type: u32 + - + name: Wlog + type: u8 + - + name: Plog + type: u8 + - + name: Scell-log + type: u8 + - + name: flags + type: u8 + - + name: tc-sfb-qopt + type: struct + members: + - + name: rehash-interval + type: u32 + - + name: warmup-time + type: u32 + - + name: max + type: u32 + - + name: bin-size + type: u32 + - + name: increment + type: u32 + - + name: decrement + type: u32 + - + name: limit + type: u32 + - + name: penalty-rate + type: u32 + - + name: penalty-burst + type: u32 + - + name: tc-sfq-qopt-v1 # TODO nested structs + type: struct + members: + - + name: quantum + type: u32 + - + name: perturb-period + type: s32 + - + name: limit + type: u32 + - + name: divisor + type: u32 + - + name: flows + type: u32 + - + name: depth + type: u32 + - + name: headdrop + type: u32 + - + name: limit + type: u32 + - + name: qth-min + type: u32 + - + name: qth-mac + type: u32 + - + name: Wlog + type: u8 + - + name: Plog + type: u8 + - + name: Scell-log + type: u8 + - + name: flags + type: u8 + - + name: max-P + type: u32 + - + name: prob-drop + type: u32 + - + name: forced-drop + type: u32 + - + name: prob-mark + type: u32 + - + name: forced-mark + type: u32 + - + name: prob-mark-head + type: u32 + - + name: forced-mark-head + type: u32 + - + name: tc-tbf-qopt + type: struct + members: + - + name: rate + type: binary # TODO nested struct tc_ratespec + len: 12 + - + name: peakrate + type: binary # TODO nested struct tc_ratespec + len: 12 + - + name: limit + type: u32 + - + name: buffer + type: u32 + - + name: mtu + type: u32 + - + name: tc-sizespec + type: struct + members: + - + name: cell-log + type: u8 + - + name: size-log + type: u8 + - + name: cell-align + type: s16 + - + name: overhead + type: s32 + - + name: linklayer + type: u32 + - + name: mpu + type: u32 + - + name: mtu + type: u32 + - + name: tsize + type: u32 + - + name: gnet-estimator + type: struct + members: + - + name: interval + type: s8 + - + name: ewma-log + type: u8 +attribute-sets: + - + name: tc-attrs + attributes: + - + name: kind + type: string + - + name: options + type: dynamic + selector: + attribute: kind + list: + - + value: bfifo + type: binary + struct: tc-fifo-qopt + - + value: cake + type: nest + nested-attributes: tc-cake-attrs + - + value: cbs + type: nest + nested-attributes: tc-cbs-attrs + - + value: choke + type: nest + nested-attributes: tc-choke-attrs + - + value: clsact + type: binary # empty nest + - + value: codel + type: nest + nested-attributes: tc-codel-attrs + - + value: drr + type: binary # TODO + - + value: etf + type: nest + nested-attributes: tc-etf-attrs + - + value: ets + type: nest + nested-attributes: tc-ets-attrs + - + value: fq + type: nest + nested-attributes: tc-fq-attrs + - + value: fq_codel + type: nest + nested-attributes: tc-fq-codel-attrs + - + value: fq_pie + type: nest + nested-attributes: tc-fq-pie-attrs + - + value: flower + type: nest + nested-attributes: tc-flower-attrs + - + value: gred + type: nest + nested-attributes: tc-gred-attrs + - + value: hfsc + type: binary + struct: tc-hfsc-qopt + - + value: hhf + type: nest + nested-attributes: tc-hhf-attrs + - + value: htb + type: nest + nested-attributes: tc-htb-attrs + - + value: ingress + type: binary # empty nest + - + value: mq + type: binary # TODO + - + value: mqprio + type: binary + struct: tc-mqprio-qopt + - + value: multiq + type: binary + struct: tc-multiq-qopt + - + value: netem + type: nest + fixed-header: tc-netem-qopt + nested-attributes: tc-netem-attrs + - + value: pfifo + type: binary + struct: tc-fifo-qopt + - + value: pfifo_fast + type: binary + struct: tc-prio-qopt + - + value: pfifo_head_drop + type: binary + struct: tc-fifo-qopt + - + value: pie + type: nest + nested-attributes: tc-pie-attrs + - + value: plug + type: binary # TODO + - + value: prio + type: binary + struct: tc-prio-qopt + - + value: qfq + type: binary # TODO + - + value: red + type: nest + nested-attributes: tc-red-attrs + - + value: sfb + type: binary + struct: tc-sfb-qopt + - + value: sfq + type: binary + struct: tc-sfq-qopt-v1 + - + value: taprio + type: nest + nested-attributes: tc-taprio-attrs + - + value: tbf + type: nest + nested-attributes: tc-tbf-attrs + - + name: stats + type: binary + struct: tc-stats + - + name: xstats + type: binary + - + name: rate + type: binary + struct: gnet-estimator + - + name: fcnt + type: u32 + - + name: stats2 + type: nest + nested-attributes: tca-stats-attrs + - + name: stab + type: nest + nested-attributes: tca-stab-attrs + - + name: pad + type: pad + - + name: dump-invisible + type: flag + - + name: chain + type: u32 + - + name: hw-offload + type: u8 + - + name: ingress-block + type: u32 + - + name: egress-block + type: u32 + - + name: dump-flags + type: bitfield32 + - + name: ext-warn-msg + type: string + - + name: tc-cake-attrs + attributes: + - + name: pad + type: pad + - + name: base-rate64 + type: u64 + - + name: diffserv-mode + type: u32 + - + name: atm + type: u32 + - + name: flow-mode + type: u32 + - + name: overhead + type: u32 + - + name: rtt + type: u32 + - + name: target + type: u32 + - + name: autorate + type: u32 + - + name: memory + type: u32 + - + name: nat + type: u32 + - + name: raw + type: u32 + - + name: wash + type: u32 + - + name: mpu + type: u32 + - + name: ingress + type: u32 + - + name: ack-filter + type: u32 + - + name: split-gso + type: u32 + - + name: fwmark + type: u32 + - + name: tc-cake-stats-attrs + attributes: + - + name: pad + type: pad + - + name: capacity-estimate64 + type: u64 + - + name: memory-limit + type: u32 + - + name: memory-used + type: u32 + - + name: avg-netoff + type: u32 + - + name: min-netlen + type: u32 + - + name: max-netlen + type: u32 + - + name: min-adjlen + type: u32 + - + name: max-adjlen + type: u32 + - + name: tin-stats + type: binary + - + name: deficit + type: s32 + - + name: cobalt-count + type: u32 + - + name: dropping + type: u32 + - + name: drop-next-us + type: s32 + - + name: p-drop + type: u32 + - + name: blue-timer-us + type: s32 + - + name: tc-cbs-attrs + attributes: + - + name: parms + type: binary + struct: tc-cbs-qopt + - + name: tc-choke-attrs + attributes: + - + name: parms + type: binary + struct: tc-red-qopt + - + name: stab + type: binary + - + name: max-p + type: u32 + - + name: tc-codel-attrs + attributes: + - + name: target + type: u32 + - + name: limit + type: u32 + - + name: interval + type: u32 + - + name: ecn + type: u32 + - + name: ce-threshold + type: u32 + - + name: tc-flower-attrs + attributes: + - + name: classid + type: u32 + - + name: indev + type: string + - + name: act + type: array-nest + nested-attributes: tc-act-attrs + - + name: key-eth-dst + type: binary + display-hint: mac + - + name: key-eth-dst-mask + type: binary + display-hint: mac + - + name: key-eth-src + type: binary + display-hint: mac + - + name: key-eth-src-mask + type: binary + display-hint: mac + - + name: key-eth-type + type: u16 + byte-order: big-endian + - + name: key-ip-proto + type: u8 + - + name: key-ipv4-src + type: u32 + byte-order: big-endian + display-hint: ipv4 + - + name: key-ipv4-src-mask + type: u32 + byte-order: big-endian + display-hint: ipv4 + - + name: key-ipv4-dst + type: u32 + byte-order: big-endian + display-hint: ipv4 + - + name: key-ipv4-dst-mask + type: u32 + byte-order: big-endian + display-hint: ipv4 + - + name: key-ipv6-src + type: binary + display-hint: ipv6 + - + name: key-ipv6-src-mask + type: binary + display-hint: ipv6 + - + name: key-ipv6-dst + type: binary + display-hint: ipv6 + - + name: key-ipv6-dst-mask + type: binary + display-hint: ipv6 + - + name: key-tcp-src + type: u16 + byte-order: big-endian + - + name: key-tcp-dst + type: u16 + byte-order: big-endian + - + name: key-udp-src + type: u16 + byte-order: big-endian + - + name: key-udp-dst + type: u16 + byte-order: big-endian + - + name: flags + type: u32 + enum: tc-cls-flags + enum-as-flags: true + - + name: key-vlan-id + type: u16 + byte-order: big-endian + - + name: key-vlan-prio + type: u8 + - + name: key-vlan-eth-type + type: u16 + byte-order: big-endian + - + name: key-enc-key-id + type: u32 + byte-order: big-endian + - + name: key-enc-ipv4-src + type: u32 + byte-order: big-endian + display-hint: ipv4 + - + name: key-enc-ipv4-src-mask + type: u32 + byte-order: big-endian + display-hint: ipv4 + - + name: key-enc-ipv4-dst + type: u32 + byte-order: big-endian + display-hint: ipv4 + - + name: key-enc-ipv4-dst-mask + type: u32 + byte-order: big-endian + display-hint: ipv4 + - + name: key-enc-ipv6-src + type: binary + display-hint: ipv6 + - + name: key-enc-ipv6-src-mask + type: binary + display-hint: ipv6 + - + name: key-enc-ipv6-dst + type: binary + display-hint: ipv6 + - + name: key-enc-ipv6-dst-mask + type: binary + display-hint: ipv6 + - + name: key-tcp-src-mask + type: u16 + byte-order: big-endian + - + name: key-tcp-dst-mask + type: u16 + byte-order: big-endian + - + name: key-udp-src-mask + type: u16 + byte-order: big-endian + - + name: key-udp-dst-mask + type: u16 + byte-order: big-endian + - + name: key-sctp-src-mask + type: u16 + byte-order: big-endian + - + name: key-sctp-dst-mask + type: u16 + byte-order: big-endian + - + name: key-sctp-src + type: u16 + byte-order: big-endian + - + name: key-sctp-dst + type: u16 + byte-order: big-endian + - + name: key-enc-udp-src-port + type: u16 + byte-order: big-endian + - + name: key-enc-udp-src-port-mask + type: u16 + byte-order: big-endian + - + name: key-enc-udp-dst-port + type: u16 + byte-order: big-endian + - + name: key-enc-udp-dst-port-mask + type: u16 + byte-order: big-endian + - + name: key-flags + type: u32 + byte-order: big-endian + - + name: key-flags-mask + type: u32 + byte-order: big-endian + - + name: key-icmpv4-code + type: u8 + - + name: key-icmpv4-code-mask + type: u8 + - + name: key-icmpv4-type + type: u8 + - + name: key-icmpv4-type-mask + type: u8 + - + name: key-icmpv6-code + type: u8 + - + name: key-icmpv6-code-mask + type: u8 + - + name: key-icmpv6-type + type: u8 + - + name: key-icmpv6-type-mask + type: u8 + - + name: key-arp-sip + type: u32 + byte-order: big-endian + - + name: key-arp-sip-mask + type: u32 + byte-order: big-endian + - + name: key-arp-tip + type: u32 + byte-order: big-endian + - + name: key-arp-tip-mask + type: u32 + byte-order: big-endian + - + name: key-arp-op + type: u8 + - + name: key-arp-op-mask + type: u8 + - + name: key-arp-sha + type: binary + - + name: key-arp-sha-mask + type: binary + - + name: key-arp-tha + type: binary + - + name: key-arp-tha-mask + type: binary + - + name: key-mpls-ttl + type: u8 + - + name: key-mpls-bos + type: u8 + - + name: key-mpls-tc + type: u8 + - + name: key-mpls-label + type: u32 + byte-order: big-endian + - + name: key-tcp-flags + type: u16 + byte-order: big-endian + - + name: key-tcp-flags-mask + type: u16 + byte-order: big-endian + - + name: key-ip-tos + type: u8 + - + name: key-ip-tos-mask + type: u8 + - + name: key-ip-ttl + type: u8 + - + name: key-ip-ttl-mask + type: u8 + - + name: key-cvlan-id + type: u16 + byte-order: big-endian + - + name: key-cvlan-prio + type: u8 + - + name: key-cvlan-eth-type + type: u16 + byte-order: big-endian + - + name: key-enc-ip-tos + type: u8 + - + name: key-enc-ip-tos-mask + type: u8 + - + name: key-enc-ip-ttl + type: u8 + - + name: key-enc-ip-ttl-mask + type: u8 + - + name: key-enc-opts + type: binary + - + name: key-enc-opts-mask + type: binary + - + name: in-hw-count + type: u32 + - + name: key-port-src-min + type: u16 + byte-order: big-endian + - + name: key-port-src-max + type: u16 + byte-order: big-endian + - + name: key-port-dst-min + type: u16 + byte-order: big-endian + - + name: key-port-dst-max + type: u16 + byte-order: big-endian + - + name: key-ct-state + type: u16 + - + name: key-ct-state-mask + type: u16 + - + name: key-ct-zone + type: u16 + - + name: key-ct-zone-mask + type: u16 + - + name: key-ct-mark + type: u32 + - + name: key-ct-mark-mask + type: u32 + - + name: key-ct-labels + type: binary + - + name: key-ct-labels-mask + type: binary + - + name: key-mpls-opts + type: binary + - + name: key-hash + type: u32 + - + name: key-hash-mask + type: u32 + - + name: key-num-of-vlans + type: u8 + - + name: key-pppoe-sid + type: u16 + byte-order: big-endian + - + name: key-ppp-proto + type: u16 + byte-order: big-endian + - + name: key-l2-tpv3-sid + type: u32 + byte-order: big-endian + - + name: tc-gred-attrs + attributes: + - + name: parms + type: binary # array of struct: tc-gred-qopt + - + name: stab + type: binary + sub-type: u8 + - + name: dps + type: binary + struct: tc-gred-sopt + - + name: max-p + type: binary + sub-type: u32 + - + name: limit + type: u32 + - + name: vq-list + type: nest + nested-attributes: tca-gred-vq-list-attrs + - + name: tca-gred-vq-list-attrs + attributes: + - + name: entry + type: nest + nested-attributes: tca-gred-vq-entry-attrs + multi-attr: true + - + name: tca-gred-vq-entry-attrs + attributes: + - + name: pad + type: pad + - + name: dp + type: u32 + - + name: stat-bytes + type: u32 + - + name: stat-packets + type: u32 + - + name: stat-backlog + type: u32 + - + name: stat-prob-drop + type: u32 + - + name: stat-prob-mark + type: u32 + - + name: stat-forced-drop + type: u32 + - + name: stat-forced-mark + type: u32 + - + name: stat-pdrop + type: u32 + - + name: stat-other + type: u32 + - + name: flags + type: u32 + - + name: tc-hfsc-attrs + attributes: + - + name: rsc + type: binary + - + name: fsc + type: binary + - + name: usc + type: binary + - + name: tc-hhf-attrs + attributes: + - + name: backlog-limit + type: u32 + - + name: quantum + type: u32 + - + name: hh-flows-limit + type: u32 + - + name: reset-timeout + type: u32 + - + name: admit-bytes + type: u32 + - + name: evict-timeout + type: u32 + - + name: non-hh-weight + type: u32 + - + name: tc-htb-attrs + attributes: + - + name: parms + type: binary + struct: tc-htb-opt + - + name: init + type: binary + struct: tc-htb-glob + - + name: ctab + type: binary + - + name: rtab + type: binary + - + name: direct-qlen + type: u32 + - + name: rate64 + type: u64 + - + name: ceil64 + type: u64 + - + name: pad + type: pad + - + name: offload + type: flag + - + name: tc-act-attrs + attributes: + - + name: kind + type: string + - + name: options + type: dynamic + selector: + attribute: kind + list: + - + value: gact + type: nest + nested-attributes: tca-gact-attrs + - + name: index + type: u32 + - + name: stats + type: binary + - + name: pad + type: pad + - + name: cookie + type: binary + - + name: flags + type: bitfield32 + - + name: hw-stats + type: bitfield32 + - + name: used-hw-stats + type: bitfield32 + - + name: in-hw-count + type: u32 + - + name: tc-etf-attrs + attributes: + - + name: parms + type: binary + struct: tc-etf-qopt + - + name: tc-ets-attrs + attributes: + - + name: nbands + type: u8 + - + name: nstrict + type: u8 + - + name: quanta + type: nest + nested-attributes: tc-ets-attrs + - + name: quanta-band + type: u32 + multi-attr: true + - + name: priomap + type: nest + nested-attributes: tc-ets-attrs + - + name: priomap-band + type: u8 + multi-attr: true + - + name: tc-fq-attrs + attributes: + - + name: plimit + type: u32 + - + name: flow-plimit + type: u32 + - + name: quantum + type: u32 + - + name: initial-quantum + type: u32 + - + name: rate-enable + type: u32 + - + name: flow-default-rate + type: u32 + - + name: flow-max-rate + type: u32 + - + name: buckets-log + type: u32 + - + name: flow-refill-delay + type: u32 + - + name: orphan-mask + type: u32 + - + name: low-rate-threshold + type: u32 + - + name: ce-threshold + type: u32 + - + name: timer-slack + type: u32 + - + name: horizon + type: u32 + - + name: horizon-drop + type: u8 + - + name: tc-fq-codel-attrs + attributes: + - + name: target + type: u32 + - + name: limit + type: u32 + - + name: interval + type: u32 + - + name: ecn + type: u32 + - + name: flows + type: u32 + - + name: quantum + type: u32 + - + name: ce-threshold + type: u32 + - + name: drop-batch-size + type: u32 + - + name: memory-limit + type: u32 + - + name: ce-threshold-selector + type: u8 + - + name: ce-threshold-mask + type: u8 + - + name: tc-fq-pie-attrs + attributes: + - + name: limit + type: u32 + - + name: flows + type: u32 + - + name: target + type: u32 + - + name: tupdate + type: u32 + - + name: alpha + type: u32 + - + name: beta + type: u32 + - + name: quantum + type: u32 + - + name: memory-limit + type: u32 + - + name: ecn-prob + type: u32 + - + name: ecn + type: u32 + - + name: bytemode + type: u32 + - + name: dq-rate-estimator + type: u32 + - + name: tc-netem-attrs + attributes: + - + name: corr + type: binary + - + name: delay-dist + type: binary + sub-type: s16 + - + name: reorder + type: binary + - + name: corrupt + type: binary + - + name: loss + type: binary + - + name: rate + type: binary + - + name: ecn + type: u32 + - + name: rate64 + type: u64 + - + name: pad + type: u32 + - + name: latency64 + type: s64 + - + name: jitter64 + type: s64 + - + name: slot + type: binary + - + name: slot-dist + type: binary + sub-type: s16 + - + name: tc-pie-attrs + attributes: + - + name: target + type: u32 + - + name: limit + type: u32 + - + name: tupdate + type: u32 + - + name: alpha + type: u32 + - + name: beta + type: u32 + - + name: ecn + type: u32 + - + name: bytemode + type: u32 + - + name: dq-rate-estimator + type: u32 + - + name: tc-red-attrs + attributes: + - + name: parms + type: binary + struct: tc-red-qopt + - + name: stab + type: binary + - + name: max-p + type: u32 + - + name: flags + type: binary + - + name: early-drop-block + type: u32 + - + name: mark-block + type: u32 + - + name: tc-taprio-attrs + attributes: + - + name: priomap + type: binary + struct: tc-mqprio-qopt + - + name: sched-entry-list + type: nest + nested-attributes: tc-taprio-sched-entry-list + - + name: sched-base-time + type: s64 + - + name: sched-single-entry + type: nest + nested-attributes: tc-taprio-sched-entry + - + name: sched-clockid + type: s32 + - + name: pad + type: pad + - + name: admin-sched + type: binary + - + name: sched-cycle-time + type: s64 + - + name: sched-cycle-time-extension + type: s64 + - + name: flags + type: u32 + - + name: txtime-delay + type: u32 + - + name: tc-entry + type: nest + nested-attributes: tc-taprio-tc-entry-attrs + - + name: tc-taprio-sched-entry-list + attributes: + - + name: entry + type: nest + nested-attributes: tc-taprio-sched-entry + - + name: tc-taprio-sched-entry + attributes: + - + name: index + type: u32 + - + name: cmd + type: u8 + - + name: gate-mask + type: u32 + - + name: interval + type: u32 + - + name: tc-taprio-tc-entry-attrs + attributes: + - + name: index + type: u32 + - + name: max-sdu + type: u32 + - + name: fp + type: u32 + - + name: tc-tbf-attrs + attributes: + - + name: parms + type: binary + struct: tc-tbf-qopt + - + name: rtab + type: binary + - + name: ptab + type: binary + - + name: rate64 + type: u64 + - + name: prate4 + type: u64 + - + name: burst + type: u32 + - + name: pburst + type: u32 + - + name: pad + type: pad + - + name: tca-gact-attrs + attributes: + - + name: tm + type: binary + - + name: parms + type: binary + - + name: prob + type: binary + - + name: pad + type: pad + - + name: tca-stab-attrs + attributes: + - + name: base + type: binary + struct: tc-sizespec + - + name: data + type: binary + - + name: tca-stats-attrs + attributes: + - + name: basic + type: binary + - + name: rate-est + type: binary + - + name: queue + type: binary + - + name: app + type: binary # TODO dynamic 2+ level nest + selector: + attribute: tca-kind + list: + - + value: bfifo + type: binary + - + value: blackhole + type: binary + - + value: cake + type: nest + nested-attributes: tc-cake-stats-attrs + - + value: cbs + type: binary + - + value: choke + type: binary + - + value: clsact + type: binary + - + value: codel + type: binary + - + value: drr + type: binary + - + value: etf + type: binary + - + value: ets + type: binary + - + value: fq + type: binary + - + value: fq_codel + type: binary + - + value: fq_pie + type: binary + - + value: flower + type: binary + - + value: gred + type: binary + - + value: hfsc + type: binary + - + value: hhf + type: binary + - + value: htb + type: binary + - + value: ingress + type: binary + - + value: mq + type: binary + - + value: mqprio + type: binary + - + value: multiq + type: binary + - + value: netem + type: binary + - + value: noqueue + type: binary + - + value: pfifo + type: binary + - + value: pfifo_fast + type: binary + - + value: pfifo_head_drop + type: binary + - + value: pie + type: binary + - + value: plug + type: binary + - + value: prio + type: binary + - + value: qfq + type: binary + - + value: red + type: binary + - + value: sfb + type: binary + - + value: sfq + type: binary + - + value: taprio + type: binary + - + value: tbf + type: binary + - + name: rate-est64 + type: binary + - + name: pad + type: pad + - + name: basic-hw + type: binary + - + name: pkt64 + type: binary + +operations: + enum-model: directional + list: + - + name: newqdisc + doc: Create new tc qdisc. + attribute-set: tc-attrs + fixed-header: tcmsg + do: + request: + value: 36 + attributes: &create-params + - tcm-family + - tcm-ifindex + - tcm-handle + - tcm-parent + - tca-kind + - tca-options + - tca-rate + - tca-stab + - tca-chain + - tca-ingress-block + - tca-egress-block + - + name: delqdisc + doc: Delete existing tc qdisc. + attribute-set: tc-attrs + fixed-header: tcmsg + do: + request: + value: 37 + attributes: &lookup-params + - tcm-family + - tcm-ifindex + - tcm-handle + - tcm-parent + - + name: getqdisc + doc: Get / dump tc qdisc information. + attribute-set: tc-attrs + fixed-header: tcmsg + do: + request: + value: 38 + attributes: + - tcm-family + - tcm-ifindex + - tcm-handle + - tcm-parent + - tca-dump-invisible + - tca-dump-flags + reply: + value: 36 + attributes: &tc-all + - tcm-family + - tcm-ifindex + - tcm-handle + - tcm-parent + - tca-kind + - tca-options + - tca-stats + - tca-xstats + - tca-rate + - tca-fcnt + - tca-stats2 + - tca-stab + - tca-chain + - tca-ingress-block + - tca-egress-block + - + name: newtclass + doc: Get / dump tc traffic class information. + attribute-set: tc-attrs + fixed-header: tcmsg + do: + request: + value: 40 + attributes: *create-params + - + name: deltclass + doc: Get / dump tc traffic class information. + attribute-set: tc-attrs + fixed-header: tcmsg + do: + request: + value: 41 + attributes: *lookup-params + - + name: gettclass + doc: Get / dump tc traffic class information. + attribute-set: tc-attrs + fixed-header: tcmsg + do: + request: + value: 42 + attributes: *lookup-params + reply: + value: 40 + attributes: *tc-all + - + name: newtfilter + doc: Get / dump tc filter information. + attribute-set: tc-attrs + fixed-header: tcmsg + do: + request: + value: 44 + attributes: *create-params + - + name: deltfilter + doc: Get / dump tc filter information. + attribute-set: tc-attrs + fixed-header: tcmsg + do: + request: + value: 45 + attributes: *lookup-params + - + name: gettfilter + doc: Get / dump tc filter information. + attribute-set: tc-attrs + fixed-header: tcmsg + do: + request: + value: 46 + attributes: *lookup-params + reply: + value: 44 + attributes: *tc-all + - + name: newchain + doc: Get / dump tc chain information. + attribute-set: tc-attrs + fixed-header: tcmsg + do: + request: + value: 100 + attributes: *create-params + - + name: delchain + doc: Get / dump tc chain information. + attribute-set: tc-attrs + fixed-header: tcmsg + do: + request: + value: 101 + attributes: *lookup-params + - + name: getchain + doc: Get / dump tc chain information. + attribute-set: tc-attrs + fixed-header: tcmsg + do: + request: + value: 102 + attributes: *lookup-params + reply: + value: 100 + attributes: *tc-all + +mcast-groups: + list: + - + name: rtnlgrp-tc + value: 4 From patchwork Wed Nov 29 10:11:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Donald Hunter X-Patchwork-Id: 13472590 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hey1Amx2" Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18B7D10DD; Wed, 29 Nov 2023 02:12:42 -0800 (PST) Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-332fd81fc8dso2488216f8f.3; Wed, 29 Nov 2023 02:12:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701252760; x=1701857560; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NkBsTL9nrVjctijvE+YbYrzImc81e4ljZYTKXc6wv0k=; b=hey1Amx2+s22hk9Ib0dK1mvL64Wj7QLVrFN/bcmNLa7D9QY2ZluZchdQbJXMnCXAiX 1Jr4hYKM+KVVC7IItE+N11SGhEGbkyCQsNO6u6K42mTxcE4nsBvdVcCAaFyYjFKHVsFQ qV9bLp34PlyZO9O81S6kq8pvAK7atULyt8k7BsMonTXfA5hanIxciAZugIWrEF9oCYx7 g9doocwwcXu2BBxKRefNkBo5n8xuivM4rMhcFb/OvRqqmtDzwSY6o93CRNVjC3+zzB/d dgv8iAvOnsB+sTL14rVezqLoxPIXw28Nq1QGhXICgoQT6NTt8/YDNP73x+o5AJV7PnIk 2aKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701252760; x=1701857560; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NkBsTL9nrVjctijvE+YbYrzImc81e4ljZYTKXc6wv0k=; b=j449IG0Hkzsd5jkCjZfXrdlqvU2dgpIITrPcJMJhXXZLd4bX8VxlMvYXoEt5qWJWG1 V/Cw0nj03RFl9q4SDsFzcuF8gq5AEO2/IukxMRyusWt5bh331pMNc7v1yNRz7aNavIkx Z/WgWOFA/91SGaMJ3RlRM+mMpV3pQ54BCrAAZYhiZqO+zYGeyg5FcsoQ6lcBqNynUX+j jt1BYupeNB5lAW0oynSFppwOBuxcLDDUk1Rgq8TZWRZG8nVpPe6I3LGOmjhjSpHMHc8d JPSaaTlF7svm4UTDCpMS91SOTFWcJQD8WVWX6hdH4NNXQNPrMNYbwEf8rgg5a4pCZQsT uyVg== X-Gm-Message-State: AOJu0YzjrSbnlEO360id986aOSAsZxatICvaamjVCb72jN+kpW856OLy UvpyQKIltmOXX5PQdTEqWXKXCo0VYpfzjw== X-Google-Smtp-Source: AGHT+IED4UjOCVMDV75Pc1W80n94fzjHbzOklqDy8vqSwaspmOB9xfAfwvHqMlAhmFGyB5NUNVXoGQ== X-Received: by 2002:adf:ee49:0:b0:333:a27:2326 with SMTP id w9-20020adfee49000000b003330a272326mr3736606wro.25.1701252759876; Wed, 29 Nov 2023 02:12:39 -0800 (PST) Received: from imac.fritz.box ([2a02:8010:60a0:0:648d:8c5c:f210:5d75]) by smtp.gmail.com with ESMTPSA id k24-20020a5d5258000000b00332d04514b9sm17296877wrc.95.2023.11.29.02.12.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 02:12:39 -0800 (PST) From: Donald Hunter To: netdev@vger.kernel.org, Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Jonathan Corbet , linux-doc@vger.kernel.org Cc: donald.hunter@redhat.com, Donald Hunter Subject: [RFC PATCH net-next v1 6/6] tools/net/ynl: Add optional fixed-header to dynamic nests Date: Wed, 29 Nov 2023 10:11:59 +0000 Message-ID: <20231129101159.99197-7-donald.hunter@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231129101159.99197-1-donald.hunter@gmail.com> References: <20231129101159.99197-1-donald.hunter@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Add support for an optional fixed-header to dynamic nested attribute spaces. Several of the tc qdiscs have a binary struct for their 'options' instead of nested attributes. But the 'netem' qdisc has a struct followed by nlattrs in its 'options'. If a nest can have an optional fixed-header followed by zero or more nlattrs then all cases can be supported. Signed-off-by: Donald Hunter --- Documentation/netlink/netlink-raw.yaml | 2 ++ tools/net/ynl/lib/ynl.py | 24 +++++++++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Documentation/netlink/netlink-raw.yaml b/Documentation/netlink/netlink-raw.yaml index 62061e180f8f..b5295057dcea 100644 --- a/Documentation/netlink/netlink-raw.yaml +++ b/Documentation/netlink/netlink-raw.yaml @@ -292,6 +292,8 @@ properties: description: Name of the sub-space used inside the attribute. type: string + fixed-header: + type: string struct: description: Name of the struct type used for the attribute. diff --git a/tools/net/ynl/lib/ynl.py b/tools/net/ynl/lib/ynl.py index 5ce01ce37573..86d591cb0047 100644 --- a/tools/net/ynl/lib/ynl.py +++ b/tools/net/ynl/lib/ynl.py @@ -170,10 +170,9 @@ class NlAttr: class NlAttrs: - def __init__(self, msg): + def __init__(self, msg, offset=0): self.attrs = [] - offset = 0 while offset < len(msg): attr = NlAttr(msg, offset) offset += attr.full_len @@ -371,8 +370,8 @@ class NetlinkProtocol: fixed_header_size = 0 if ynl: op = ynl.rsp_by_value[msg.cmd()] - fixed_header_size = ynl._fixed_header_size(op) - msg.raw_attrs = NlAttrs(msg.raw[fixed_header_size:]) + fixed_header_size = ynl._fixed_header_size(op.fixed_header) + msg.raw_attrs = NlAttrs(msg.raw, fixed_header_size) return msg def get_mcast_id(self, mcast_name, mcast_groups): @@ -571,8 +570,15 @@ class YnlFamily(SpecFamily): decoded = self._decode_binary(attr, dyn_spec) elif dyn_spec['type'] == 'nest': attr_space = dyn_spec['nested-attributes'] + fixed_header_name = dyn_spec.yaml.get('fixed-header') if attr_space in self.attr_sets: - decoded = self._decode(NlAttrs(attr.raw), attr_space) + decoded = {} + offset = 0 + if fixed_header_name: + decoded.update(self._decode_fixed_header(attr, fixed_header_name)); + offset = self._fixed_header_size(fixed_header_name) + subdict = self._decode(NlAttrs(attr.raw, offset), attr_space) + decoded.update(subdict) else: raise Exception(f"Unknown attribute-set '{attr_space}'") else: @@ -658,16 +664,16 @@ class YnlFamily(SpecFamily): return msg = self.nlproto.decode(self, NlMsg(request, 0, op.attr_set)) - offset = 20 + self._fixed_header_size(op) + offset = 20 + self._fixed_header_size(op.fixed_header) path = self._decode_extack_path(msg.raw_attrs, op.attr_set, offset, extack['bad-attr-offs']) if path: del extack['bad-attr-offs'] extack['bad-attr'] = path - def _fixed_header_size(self, op): - if op.fixed_header: - fixed_header_members = self.consts[op.fixed_header].members + def _fixed_header_size(self, name): + if name: + fixed_header_members = self.consts[name].members size = 0 for m in fixed_header_members: format = NlAttr.get_format(m.type, m.byte_order)