From patchwork Fri Jun 23 20:19:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Donald Hunter X-Patchwork-Id: 13290908 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 D1ED210965 for ; Fri, 23 Jun 2023 20:20:30 +0000 (UTC) Received: from mail-qt1-x82b.google.com (mail-qt1-x82b.google.com [IPv6:2607:f8b0:4864:20::82b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE1521A1 for ; Fri, 23 Jun 2023 13:20:28 -0700 (PDT) Received: by mail-qt1-x82b.google.com with SMTP id d75a77b69052e-4009130358cso3546491cf.2 for ; Fri, 23 Jun 2023 13:20:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687551627; x=1690143627; 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=+NgGibosWgwXZWCvlEufPEdWqtxqzB4K6Z81fqz2pho=; b=ErmaKSRuPyBdeZPmtZUXCMHv9U+mTNj7iqf9dV8OYcN6tVgK5qubDzk8/60JqWG0R6 YbBcFsjjl8q60VQzit5rKkQApW/qFhtSbCR8/IQs6Pz5DERcR/StYkbNZwYKuuQZt9Gd s/TStK3oZ8Md+v3RpuPaFt0jgy6LWUiPIhxCxsLXrh6tuxikB/WMxGI7V/31pCgkiIZS YOQQwcuYAvgbPNfKat3aHjQluhdTRA70j8oZwkGsWSZKRUXDBGazXeu4swhtaYwiBN7P 1gxz0m776n68XAT6JvutfslZ6jVgSrJY0i6Nwvt7uz0EyJMVQkBBhQBCiPYjX/GSsnpq Qy4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687551627; x=1690143627; 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=+NgGibosWgwXZWCvlEufPEdWqtxqzB4K6Z81fqz2pho=; b=a3vLV8H7CtvZfYJSdNbkw6ZyI7TMiOsnBrLQS1W6cMjL4M9pYjzwxwt+tvb3R0/NGd kUIucqgSlDDOvp7lkjIVl/paUZnIJFKuCPRpO2pjwI7MppBu5Hs3YJw4zKJvFdTpNXSJ 8GU+Na6/1NjLySGb+7A+rWeMwvBuHWg0GQe9OT/kZML59jmt2RsJ6o0bjzvF+efl2uxm Qpra9hJJK7+5/71cJF8WHOOeH6AcYyWHu51iLJPEcdlSvohdx5LjIYZHt+g97fEiVONK ouqYzJ5PvCik4uvcHHaSGrTnLbztkirZb+UvCkSO7J+4g4+kqkK2vz0BM8i0oVfp3SBf IA5A== X-Gm-Message-State: AC+VfDzDQRPCwuTeoOSdGhF3ZAPPUSgIPQfsJt2lAlAAUGw9PKYeBnNP kJXZ4thz4BsOh8LQfG4ZImWlxMBnUTMuQg== X-Google-Smtp-Source: ACHHUZ4c7MGu4/kha55ZY/1DTsYYApqnF1XPaZqztA0idB4Rx9pckJRFhXPI3UtLnp7mdE+P/dSoig== X-Received: by 2002:a05:622a:611:b0:3fd:d376:d9bb with SMTP id z17-20020a05622a061100b003fdd376d9bbmr27619069qta.18.1687551627554; Fri, 23 Jun 2023 13:20:27 -0700 (PDT) Received: from imac.redhat.com ([88.97.103.74]) by smtp.gmail.com with ESMTPSA id d24-20020ac84e38000000b003ff0d00a71esm2274152qtw.13.2023.06.23.13.20.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 13:20:27 -0700 (PDT) From: Donald Hunter To: netdev@vger.kernel.org, Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni Cc: donald.hunter@redhat.com, Donald Hunter Subject: [PATCH net-next v1 1/3] netlink: specs: add display-hint to schema definitions Date: Fri, 23 Jun 2023 21:19:26 +0100 Message-Id: <20230623201928.14275-2-donald.hunter@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230623201928.14275-1-donald.hunter@gmail.com> References: <20230623201928.14275-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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Add a display-hint property to the netlink schema that is for providing optional hints to generic netlink clients about how to display attribute values. A display-hint on an attribute definition is intended for letting a client such as ynl know that, for example, a u32 should be rendered as an ipv4 address. The display-hint enumeration includes a small number of networking domain-specific value types. Signed-off-by: Donald Hunter --- Documentation/netlink/genetlink-c.yaml | 6 ++++++ Documentation/netlink/genetlink-legacy.yaml | 11 ++++++++++- Documentation/netlink/genetlink.yaml | 6 ++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Documentation/netlink/genetlink-c.yaml b/Documentation/netlink/genetlink-c.yaml index 0519c257ecf4..57d1c1c4918f 100644 --- a/Documentation/netlink/genetlink-c.yaml +++ b/Documentation/netlink/genetlink-c.yaml @@ -195,6 +195,12 @@ properties: description: Max length for a string or a binary attribute. $ref: '#/$defs/len-or-define' sub-type: *attr-type + display-hint: &display-hint + description: | + Optional format indicator that is intended only for choosing + the right formatting mechanism when displaying values of this + type. + enum: [ hex, mac, fddi, ipv4, ipv6, uuid ] # Start genetlink-c name-prefix: type: string diff --git a/Documentation/netlink/genetlink-legacy.yaml b/Documentation/netlink/genetlink-legacy.yaml index b474889b49ff..43b769c98fb2 100644 --- a/Documentation/netlink/genetlink-legacy.yaml +++ b/Documentation/netlink/genetlink-legacy.yaml @@ -119,7 +119,8 @@ properties: name: type: string type: - enum: [ u8, u16, u32, u64, s8, s16, s32, s64, string ] + description: The netlink attribute type + enum: [ u8, u16, u32, u64, s8, s16, s32, s64, string, binary ] len: $ref: '#/$defs/len-or-define' byte-order: @@ -130,6 +131,12 @@ properties: enum: description: Name of the enum type used for the attribute. type: string + display-hint: &display-hint + description: | + Optional format indicator that is intended only for choosing + the right formatting mechanism when displaying values of this + type. + enum: [ hex, mac, fddi, ipv4, ipv6, uuid ] # End genetlink-legacy attribute-sets: @@ -179,6 +186,7 @@ properties: name: type: string type: &attr-type + description: The netlink attribute type enum: [ unused, pad, flag, binary, u8, u16, u32, u64, s32, s64, string, nest, array-nest, nest-type-value ] doc: @@ -226,6 +234,7 @@ properties: description: Max length for a string or a binary attribute. $ref: '#/$defs/len-or-define' sub-type: *attr-type + display-hint: *display-hint # Start genetlink-c name-prefix: type: string diff --git a/Documentation/netlink/genetlink.yaml b/Documentation/netlink/genetlink.yaml index d8b2cdeba058..1cbb448d2f1c 100644 --- a/Documentation/netlink/genetlink.yaml +++ b/Documentation/netlink/genetlink.yaml @@ -168,6 +168,12 @@ properties: description: Max length for a string or a binary attribute. $ref: '#/$defs/len-or-define' sub-type: *attr-type + display-hint: &display-hint + description: | + Optional format indicator that is intended only for choosing + the right formatting mechanism when displaying values of this + type. + enum: [ hex, mac, fddi, ipv4, ipv6, uuid ] # Make sure name-prefix does not appear in subsets (subsets inherit naming) dependencies: From patchwork Fri Jun 23 20:19:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Donald Hunter X-Patchwork-Id: 13290910 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 1E59211C82 for ; Fri, 23 Jun 2023 20:20:32 +0000 (UTC) Received: from mail-qt1-x830.google.com (mail-qt1-x830.google.com [IPv6:2607:f8b0:4864:20::830]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEC6E135 for ; Fri, 23 Jun 2023 13:20:30 -0700 (PDT) Received: by mail-qt1-x830.google.com with SMTP id d75a77b69052e-4008dbf2ef4so4057931cf.1 for ; Fri, 23 Jun 2023 13:20:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687551629; x=1690143629; 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=glYCMtFlMW1OMcQ0oi9WvgXo6oKCKLuP/+3Vbg0ZNmg=; b=rR+dI3A3RojMOCPpW578d60JUmIZzFFmaZ83xqTAHiXvSiA6IkYswck5wBhSfV8KkS tmod4tlaLOjqW8beGKtEsv2c4YOLWESCbr2E1+bLvODhZTNYQ+3C9OTZjw7yLmze+AsW BoXcz7wqs046uSvhm9PDr8Mkyqr4jO6tvaqYHaVlxCl3WD6r440/X8ht4198AJfMl/mD gR5N+tXVgDKr0hBMd22Qch6vO7iqagTc9a9rWoz7wO8w40GM9ypvYuJNDed8t6a3EHuu ea1iVoIHJcNDg0pC/1jwI7JbSXGK1fuq70cHzOfi9bmNOe5lwzQMSssZWwOy5yTyZPTv MePA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687551629; x=1690143629; 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=glYCMtFlMW1OMcQ0oi9WvgXo6oKCKLuP/+3Vbg0ZNmg=; b=XEVmiQpUPs826BYWc3ukcOODsSfuEtiavrMDUDLQdMU2qcjIDlwsBqnyXejUEY0LjU lFyV6iM+OhsApl1kPCjovauXK+4Ls/Mp+59wu3ppW5Eosn1LVwEkeb89TUWAUxtGxufU PaaELEYhm6XG4jRlk3Ro7o27a4x2vf43UPFCAIfmRpUyUuGbNa+Gj51J+f6/6OGN98xE XNNDvQmr30yX2g04mUG/eje7PBnBXcd4T4jkxfrTqfyDEqZr8fxxyCMJBiTDmmzLxi4L YQLErJBw6lja28AC0fBcg95qQRjmFcGGTxUIdeMKNS+X8gUwIGpaEyHKmkyc8BmYttFc +k/Q== X-Gm-Message-State: AC+VfDzJ2Kv4BiEO11ttMkeH/Oh3/SsiElN9FM8i4b3RhO/iTh2gaIvu K32xvOsnybRKyPp2MP6kNnMY/EBj7mOzww== X-Google-Smtp-Source: ACHHUZ4OP1M2US5XwSadRP7ZtAm0ik4mt3ZHXML2Xc9FNd07/NQDNIKCe9obmK0pzjy84H0ZgF9Jkw== X-Received: by 2002:ac8:5f46:0:b0:3f5:2177:eca0 with SMTP id y6-20020ac85f46000000b003f52177eca0mr23374619qta.5.1687551629348; Fri, 23 Jun 2023 13:20:29 -0700 (PDT) Received: from imac.redhat.com ([88.97.103.74]) by smtp.gmail.com with ESMTPSA id d24-20020ac84e38000000b003ff0d00a71esm2274152qtw.13.2023.06.23.13.20.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 13:20:28 -0700 (PDT) From: Donald Hunter To: netdev@vger.kernel.org, Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni Cc: donald.hunter@redhat.com, Donald Hunter Subject: [PATCH net-next v1 2/3] tools: ynl: add display-hint support to ynl Date: Fri, 23 Jun 2023 21:19:27 +0100 Message-Id: <20230623201928.14275-3-donald.hunter@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230623201928.14275-1-donald.hunter@gmail.com> References: <20230623201928.14275-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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Add support to the ynl tool for rendering output based on display-hint properties. Signed-off-by: Donald Hunter --- tools/net/ynl/lib/nlspec.py | 10 ++++++++++ tools/net/ynl/lib/ynl.py | 34 +++++++++++++++++++++++++++++----- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/tools/net/ynl/lib/nlspec.py b/tools/net/ynl/lib/nlspec.py index 1ba572cae27b..0ff0d18666b2 100644 --- a/tools/net/ynl/lib/nlspec.py +++ b/tools/net/ynl/lib/nlspec.py @@ -154,6 +154,9 @@ class SpecAttr(SpecElement): is_multi bool, attr may repeat multiple times 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, attr_set, yaml, value): super().__init__(family, yaml) @@ -164,6 +167,8 @@ class SpecAttr(SpecElement): 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 SpecAttrSet(SpecElement): @@ -229,12 +234,17 @@ class SpecStructMember(SpecElement): type string, type of the member attribute byte_order string or None for native byte order enum string, name of the enum definition + 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, yaml): super().__init__(family, yaml) self.type = yaml['type'] self.byte_order = yaml.get('byte-order') self.enum = yaml.get('enum') + self.len = yaml.get('len') + self.display_hint = yaml.get('display-hint') class SpecStruct(SpecElement): diff --git a/tools/net/ynl/lib/ynl.py b/tools/net/ynl/lib/ynl.py index 3b343d6cbbc0..1b3a36fbb1c3 100644 --- a/tools/net/ynl/lib/ynl.py +++ b/tools/net/ynl/lib/ynl.py @@ -8,6 +8,8 @@ import socket import struct from struct import Struct import yaml +import ipaddress +import uuid from .nlspec import SpecFamily @@ -105,6 +107,20 @@ class NlAttr: else format.little return format.native + @classmethod + def formatted_string(cls, raw, display_hint): + if display_hint == 'mac': + formatted = ':'.join('%02x' % b for b in raw) + elif display_hint == 'hex': + formatted = bytes.hex(raw, ' ') + elif display_hint in [ 'ipv4', 'ipv6' ]: + formatted = format(ipaddress.ip_address(raw)) + elif display_hint == 'uuid': + formatted = str(uuid.UUID(bytes=raw)) + else: + formatted = raw + return formatted + def as_scalar(self, attr_type, byte_order=None): format = self.get_format(attr_type, byte_order) return format.unpack(self.raw)[0] @@ -124,10 +140,16 @@ class NlAttr: offset = 0 for m in members: # TODO: handle non-scalar members - format = self.get_format(m.type, m.byte_order) - decoded = format.unpack_from(self.raw, offset) - offset += format.size - value[m.name] = decoded[0] + if m.type == 'binary': + decoded = self.raw[offset:offset+m['len']] + offset += m['len'] + elif m.type in NlAttr.type_formats: + format = self.get_format(m.type, m.byte_order) + [ decoded ] = format.unpack_from(self.raw, offset) + offset += format.size + if m.display_hint: + decoded = self.formatted_string(decoded, m.display_hint) + value[m.name] = decoded return value def __repr__(self): @@ -385,7 +407,7 @@ class YnlFamily(SpecFamily): elif attr["type"] == 'string': attr_payload = str(value).encode('ascii') + b'\x00' elif attr["type"] == 'binary': - attr_payload = value + attr_payload = bytes.fromhex(value) elif attr['type'] in NlAttr.type_formats: format = NlAttr.get_format(attr['type'], attr.byte_order) attr_payload = format.pack(int(value)) @@ -421,6 +443,8 @@ class YnlFamily(SpecFamily): decoded = attr.as_c_array(attr_spec.sub_type) else: decoded = attr.as_bin() + if attr_spec.display_hint: + decoded = NlAttr.formatted_string(decoded, attr_spec.display_hint) return decoded def _decode(self, attrs, space): From patchwork Fri Jun 23 20:19:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Donald Hunter X-Patchwork-Id: 13290911 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 956DC11C82 for ; Fri, 23 Jun 2023 20:20:33 +0000 (UTC) Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DD399B for ; Fri, 23 Jun 2023 13:20:32 -0700 (PDT) Received: by mail-qk1-x735.google.com with SMTP id af79cd13be357-7653bd3ff2fso91930285a.3 for ; Fri, 23 Jun 2023 13:20:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687551631; x=1690143631; 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=1KXRmwGlX26l6IoJaqpuWsvFXl//DVOiUglxpZ5psQI=; b=M5p3NoHm07kG+oLLAlNOWfxMIxXHTC8VSIj3a/ad6EgSlkkoninYG+D2g0hJuS0Gzh IRtqQajc0HtpXlkkGwv3ShU9ur2Ksk7ChxwG/oPYm7Ug6bId9N0ujgS14bLwkQ2pj+pO 8rakYs4rQcxoid9wMITiOK4iZoRPbZllY17hv5lu7dztgavVv7i8rGnuUc5UTEmqU1to xxcmBsLD3BsW/bSy76NScXbH+0TgsK4y4PMXgbifxX2IxopFI3FEANXzxTVxHujuhZmZ fSLsi7MUW9FYYNRq4dmFWE/zrWUXu1kXThk8SWzkYYYHIjpZQXEB3Kdxg1HZujTKrG1e PsDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687551631; x=1690143631; 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=1KXRmwGlX26l6IoJaqpuWsvFXl//DVOiUglxpZ5psQI=; b=f5gel2L3UTPE6PmjMwjhH4iNRzYyDSX4XAKIVwjGhucv2jjEKWsijlm9PfNSPp9snL T2wYpraIjY+Hz5kGLiWnBlnifdPyERWLHLrVttNBplV6iRguZ92jJ15ZNKq3sQgXxCJ6 ASWs8jTByAOlzEJPZQkyHHik0VKK5mo7zI74nIBya1c7cSrGi3bYsVPiPY23Ol6p0CB0 GBVudnkrZXVMILnqamttkE7eiLctXt6fwFfvQcv26MEc9xU8hIGyryyPE6TjkVLHDCBi ImyuT8X5x6fogS+SE2Kd1qksb6vpNdjh7U3np2qJOsn+kRiDsyAN7t+HoQ6IRLlMmTAh 2JYQ== X-Gm-Message-State: AC+VfDx9WbZhPoI10pWH6J9pls6Ct5mGaA+rRGSAK8eeSyZxXrB2d3+k aSvDZB9ui4I6MR4SIaZKU/lbbdHTO3axJw== X-Google-Smtp-Source: ACHHUZ7j6Q4nIGtLGV1GfbizE7ldFv+aNitX9mctnb8wwkXya/954jFEgbFLFfUzcAEvStA62+7wiA== X-Received: by 2002:a05:622a:194:b0:400:92bd:9e96 with SMTP id s20-20020a05622a019400b0040092bd9e96mr180146qtw.67.1687551630958; Fri, 23 Jun 2023 13:20:30 -0700 (PDT) Received: from imac.redhat.com ([88.97.103.74]) by smtp.gmail.com with ESMTPSA id d24-20020ac84e38000000b003ff0d00a71esm2274152qtw.13.2023.06.23.13.20.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 13:20:30 -0700 (PDT) From: Donald Hunter To: netdev@vger.kernel.org, Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni Cc: donald.hunter@redhat.com, Donald Hunter Subject: [PATCH net-next v1 3/3] netlink: specs: add display hints to ovs_flow Date: Fri, 23 Jun 2023 21:19:28 +0100 Message-Id: <20230623201928.14275-4-donald.hunter@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230623201928.14275-1-donald.hunter@gmail.com> References: <20230623201928.14275-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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Add display hints for mac, ipv4, ipv6, hex and uuid to the ovs_flow schema. Signed-off-by: Donald Hunter --- Documentation/netlink/specs/ovs_flow.yaml | 107 ++++++++++++++++++++++ 1 file changed, 107 insertions(+) diff --git a/Documentation/netlink/specs/ovs_flow.yaml b/Documentation/netlink/specs/ovs_flow.yaml index 1ecbcd117385..109ca1f57b6c 100644 --- a/Documentation/netlink/specs/ovs_flow.yaml +++ b/Documentation/netlink/specs/ovs_flow.yaml @@ -33,6 +33,20 @@ definitions: name: n-bytes type: u64 doc: Number of matched bytes. + - + name: ovs-key-ethernet + type: struct + members: + - + name: eth-src + type: binary + len: 6 + display-hint: mac + - + name: eth-dst + type: binary + len: 6 + display-hint: mac - name: ovs-key-mpls type: struct @@ -49,10 +63,12 @@ definitions: name: ipv4-src type: u32 byte-order: big-endian + display-hint: ipv4 - name: ipv4-dst type: u32 byte-order: big-endian + display-hint: ipv4 - name: ipv4-proto type: u8 @@ -66,6 +82,45 @@ definitions: name: ipv4-frag type: u8 enum: ovs-frag-type + - + name: ovs-key-ipv6 + type: struct + members: + - + name: ipv6-src + type: binary + len: 16 + byte-order: big-endian + display-hint: ipv6 + - + name: ipv6-dst + type: binary + len: 16 + byte-order: big-endian + display-hint: ipv6 + - + name: ipv6-label + type: u32 + byte-order: big-endian + - + name: ipv6-proto + type: u8 + - + name: ipv6-tclass + type: u8 + - + name: ipv6-hlimit + type: u8 + - + name: ipv6-frag + type: u8 + - + name: ovs-key-ipv6-exthdrs + type: struct + members: + - + name: hdrs + type: u16 - name: ovs-frag-type name-prefix: ovs-frag-type- @@ -129,6 +184,51 @@ definitions: - name: icmp-code type: u8 + - + name: ovs-key-arp + type: struct + members: + - + name: arp-sip + type: u32 + byte-order: big-endian + - + name: arp-tip + type: u32 + byte-order: big-endian + - + name: arp-op + type: u16 + byte-order: big-endian + - + name: arp-sha + type: binary + len: 6 + display-hint: mac + - + name: arp-tha + type: binary + len: 6 + display-hint: mac + - + name: ovs-key-nd + type: struct + members: + - + name: nd_target + type: binary + len: 16 + byte-order: big-endian + - + name: nd-sll + type: binary + len: 6 + display-hint: mac + - + name: nd-tll + type: binary + len: 6 + display-hint: mac - name: ovs-key-ct-tuple-ipv4 type: struct @@ -345,6 +445,7 @@ attribute-sets: value of the OVS_FLOW_ATTR_KEY attribute. Optional for all requests. Present in notifications if the flow was created with this attribute. + display-hint: uuid - name: ufid-flags type: u32 @@ -374,6 +475,7 @@ attribute-sets: - name: ethernet type: binary + struct: ovs-key-ethernet doc: struct ovs_key_ethernet - name: vlan @@ -390,6 +492,7 @@ attribute-sets: - name: ipv6 type: binary + struct: ovs-key-ipv6 doc: struct ovs_key_ipv6 - name: tcp @@ -410,10 +513,12 @@ attribute-sets: - name: arp type: binary + struct: ovs-key-arp doc: struct ovs_key_arp - name: nd type: binary + struct: ovs-key-nd doc: struct ovs_key_nd - name: skb-mark @@ -457,6 +562,7 @@ attribute-sets: - name: ct-labels type: binary + display-hint: hex doc: 16-octet connection tracking label - name: ct-orig-tuple-ipv4 @@ -486,6 +592,7 @@ attribute-sets: - name: ipv6-exthdrs type: binary + struct: ovs-key-ipv6-exthdrs doc: struct ovs_key_ipv6_exthdr - name: action-attrs