get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/1524526/
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 1524526,
    "url": "http://patchwork.ozlabs.org/api/patches/1524526/",
    "web_url": "http://patchwork.ozlabs.org/project/ovn/patch/20210903192748.1408062-10-frode.nordahl@canonical.com/",
    "project": {
        "id": 68,
        "url": "http://patchwork.ozlabs.org/api/projects/68/",
        "name": "Open Virtual Network development",
        "link_name": "ovn",
        "list_id": "ovs-dev.openvswitch.org",
        "list_email": "ovs-dev@openvswitch.org",
        "web_url": "http://openvswitch.org/",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20210903192748.1408062-10-frode.nordahl@canonical.com>",
    "list_archive_url": null,
    "date": "2021-09-03T19:27:48",
    "name": "[ovs-dev,v4,9/9] plug_providers: Introduce representor plugin.",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": false,
    "hash": "c8469d75ba75bf9fa31e529a32340edffc9146fb",
    "submitter": {
        "id": 77851,
        "url": "http://patchwork.ozlabs.org/api/people/77851/",
        "name": "Frode Nordahl",
        "email": "frode.nordahl@canonical.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/ovn/patch/20210903192748.1408062-10-frode.nordahl@canonical.com/mbox/",
    "series": [
        {
            "id": 260950,
            "url": "http://patchwork.ozlabs.org/api/series/260950/",
            "web_url": "http://patchwork.ozlabs.org/project/ovn/list/?series=260950",
            "date": "2021-09-03T19:27:42",
            "name": "Introduce infrastructure for plugging providers",
            "version": 4,
            "mbox": "http://patchwork.ozlabs.org/series/260950/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1524526/comments/",
    "check": "success",
    "checks": "http://patchwork.ozlabs.org/api/patches/1524526/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<ovs-dev-bounces@openvswitch.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "dev@openvswitch.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "ovs-dev@lists.linuxfoundation.org"
        ],
        "Authentication-Results": [
            "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=canonical.com header.i=@canonical.com\n header.a=rsa-sha256 header.s=20210705 header.b=E4jOT6p8;\n\tdkim-atps=neutral",
            "ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org\n (client-ip=140.211.166.133; helo=smtp2.osuosl.org;\n envelope-from=ovs-dev-bounces@openvswitch.org; receiver=<UNKNOWN>)",
            "smtp3.osuosl.org (amavisd-new);\n dkim=pass (2048-bit key) header.d=canonical.com"
        ],
        "Received": [
            "from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 4H1SWZ58FXz9sCD\n\tfor <incoming@patchwork.ozlabs.org>; Sat,  4 Sep 2021 05:28:26 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby smtp2.osuosl.org (Postfix) with ESMTP id B29C24088A;\n\tFri,  3 Sep 2021 19:28:24 +0000 (UTC)",
            "from smtp2.osuosl.org ([127.0.0.1])\n\tby localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id aviEbR5x0kg9; Fri,  3 Sep 2021 19:28:18 +0000 (UTC)",
            "from lists.linuxfoundation.org (lf-lists.osuosl.org\n [IPv6:2605:bc80:3010:104::8cd3:938])\n\tby smtp2.osuosl.org (Postfix) with ESMTPS id 46EC74027D;\n\tFri,  3 Sep 2021 19:28:12 +0000 (UTC)",
            "from lf-lists.osuosl.org (localhost [127.0.0.1])\n\tby lists.linuxfoundation.org (Postfix) with ESMTP id B60D5C0040;\n\tFri,  3 Sep 2021 19:28:03 +0000 (UTC)",
            "from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n by lists.linuxfoundation.org (Postfix) with ESMTP id 5937AC0030\n for <dev@openvswitch.org>; Fri,  3 Sep 2021 19:27:58 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n by smtp3.osuosl.org (Postfix) with ESMTP id 2D3FD615A3\n for <dev@openvswitch.org>; Fri,  3 Sep 2021 19:27:58 +0000 (UTC)",
            "from smtp3.osuosl.org ([127.0.0.1])\n by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n with ESMTP id sPByZGaMjXYh for <dev@openvswitch.org>;\n Fri,  3 Sep 2021 19:27:54 +0000 (UTC)",
            "from smtp-relay-canonical-1.canonical.com\n (smtp-relay-canonical-1.canonical.com [185.125.188.121])\n by smtp3.osuosl.org (Postfix) with ESMTPS id 348D561584\n for <dev@openvswitch.org>; Fri,  3 Sep 2021 19:27:54 +0000 (UTC)",
            "from frode-threadripper.. (1.general.frode.uk.vpn [10.172.193.250])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id 1200F40EA4;\n Fri,  3 Sep 2021 19:27:52 +0000 (UTC)"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.8.0",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com;\n s=20210705; t=1630697272;\n bh=wU7K7Q4llmEgv58FVkVYnTlfjN2YNNc25BJ3E/oFuto=;\n h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:\n MIME-Version;\n b=E4jOT6p8tf0bl6zQNQp99d4EAR74zUc+szYAcfSFkxs+r81ynAOuBN8nr/6z2+BDF\n unqKj+dzgu1iFJpPj4kPQoHv1GG8+gNg9xMUcI6mzx0kQjYP+wQjJwSobusoYukMt5\n pL18Qb0WS37Kd02x3Swb+nqvp1sVZZCQ+46Iz71Uyg+QkVahEcs2cyb4zQCyuvMqLm\n kbUFZl0436eyGcjVUrVj9Kz+8exmBOl/Qs4lV/5klMzk/awx8+0owS4aZcYEwEVzu2\n nUv6jbkEZAigU4ICHL3PPVSUOLQDJxjBlrQV2+pC0sBciEsf5TpWM0uL2i/BRsC1KQ\n L1mz9wmXI2Vzw==",
        "From": "Frode Nordahl <frode.nordahl@canonical.com>",
        "To": "dev@openvswitch.org",
        "Date": "Fri,  3 Sep 2021 21:27:48 +0200",
        "Message-Id": "<20210903192748.1408062-10-frode.nordahl@canonical.com>",
        "X-Mailer": "git-send-email 2.32.0",
        "In-Reply-To": "<20210903192748.1408062-1-frode.nordahl@canonical.com>",
        "References": "<20210903192748.1408062-1-frode.nordahl@canonical.com>",
        "MIME-Version": "1.0",
        "Subject": "[ovs-dev] [PATCH ovn v4 9/9] plug_providers: Introduce representor\n\tplugin.",
        "X-BeenThere": "ovs-dev@openvswitch.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "<ovs-dev.openvswitch.org>",
        "List-Unsubscribe": "<https://mail.openvswitch.org/mailman/options/ovs-dev>,\n <mailto:ovs-dev-request@openvswitch.org?subject=unsubscribe>",
        "List-Archive": "<http://mail.openvswitch.org/pipermail/ovs-dev/>",
        "List-Post": "<mailto:ovs-dev@openvswitch.org>",
        "List-Help": "<mailto:ovs-dev-request@openvswitch.org?subject=help>",
        "List-Subscribe": "<https://mail.openvswitch.org/mailman/listinfo/ovs-dev>,\n <mailto:ovs-dev-request@openvswitch.org?subject=subscribe>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "ovs-dev-bounces@openvswitch.org",
        "Sender": "\"dev\" <ovs-dev-bounces@openvswitch.org>"
    },
    "content": "Add the first in-tree plug provider plugin and its dependencies.\nThe representor plugin can be used with multiple NIC vendors\nsupporting Open vSwitch hardware offload and the devlink-port\ninfrastructure[0].\n\nIt is particularly useful for use with NICs connected to multiple\ndistinct CPUs where the instance runs on one host and Open\nvSwitch and OVN runs on a different host, the smartnic CPU.\n\nExtend the build system with macros from the OVS build system to\nallow checking for dependencies of the plugin as well as providing\nkernel header files that may not be available at build time.\n\nThe plugin will only be built when enabled and when building on\na Linux system.\n\n0: https://www.kernel.org/doc/html/latest/networking/devlink/devlink-port.html\nSigned-off-by: Frode Nordahl <frode.nordahl@canonical.com>\n---\n Documentation/automake.mk                     |   1 +\n Documentation/topics/plug_providers/index.rst |   1 +\n .../topics/plug_providers/plug-providers.rst  |   5 +\n .../plug_providers/plug-representor.rst       |  45 ++\n build-aux/initial-tab-whitelist               |   1 +\n configure.ac                                  |   2 +\n include/automake.mk                           |   4 +\n include/linux/automake.mk                     |   2 +\n include/linux/devlink.h                       | 625 ++++++++++++++++++\n lib/automake.mk                               |  11 +\n lib/plug-provider.h                           |   6 +-\n lib/plug.c                                    |   1 +\n .../representor/netlink-devlink.c             | 499 ++++++++++++++\n .../representor/netlink-devlink.h             | 115 ++++\n .../representor/plug-representor.c            | 307 +++++++++\n m4/ovn.m4                                     |  26 +\n 16 files changed, 1650 insertions(+), 1 deletion(-)\n create mode 100644 Documentation/topics/plug_providers/plug-representor.rst\n create mode 100644 include/linux/automake.mk\n create mode 100644 include/linux/devlink.h\n create mode 100644 lib/plug_providers/representor/netlink-devlink.c\n create mode 100644 lib/plug_providers/representor/netlink-devlink.h\n create mode 100644 lib/plug_providers/representor/plug-representor.c",
    "diff": "diff --git a/Documentation/automake.mk b/Documentation/automake.mk\nindex 92a843d76..2a3483bc0 100644\n--- a/Documentation/automake.mk\n+++ b/Documentation/automake.mk\n@@ -29,6 +29,7 @@ DOC_SOURCE = \\\n \tDocumentation/topics/role-based-access-control.rst \\\n \tDocumentation/topics/debugging-ddlog.rst \\\n \tDocumentation/topics/plug_providers/plug-providers.rst \\\n+\tDocumentation/topics/plug_providers/plug-representor.rst \\\n \tDocumentation/howto/index.rst \\\n \tDocumentation/howto/docker.rst \\\n \tDocumentation/howto/firewalld.rst \\\ndiff --git a/Documentation/topics/plug_providers/index.rst b/Documentation/topics/plug_providers/index.rst\nindex 837eeae15..3d16458a2 100644\n--- a/Documentation/topics/plug_providers/index.rst\n+++ b/Documentation/topics/plug_providers/index.rst\n@@ -30,3 +30,4 @@ Plug Providers\n    :maxdepth: 2\n \n    plug-providers\n+   plug-representor\ndiff --git a/Documentation/topics/plug_providers/plug-providers.rst b/Documentation/topics/plug_providers/plug-providers.rst\nindex 7b891156c..5f0089ed9 100644\n--- a/Documentation/topics/plug_providers/plug-providers.rst\n+++ b/Documentation/topics/plug_providers/plug-providers.rst\n@@ -163,6 +163,11 @@ Building with in-tree plugging providers\n Plugging providers hosted in the OVN repository living under\n `lib/plug_providers`:\n \n+* :doc:`representor <plug-representor>`\n+\n+  - Representor port lookup making use of the Linux kernel devlink-port\n+    infrastructure.\n+\n To enable them, provide the `--enable-plug-providers` command line option to\n the configure script when building OVN.\n \ndiff --git a/Documentation/topics/plug_providers/plug-representor.rst b/Documentation/topics/plug_providers/plug-representor.rst\nnew file mode 100644\nindex 000000000..c301a6cd2\n--- /dev/null\n+++ b/Documentation/topics/plug_providers/plug-representor.rst\n@@ -0,0 +1,45 @@\n+..\n+      Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n+      not use this file except in compliance with the License. You may obtain\n+      a copy of the License at\n+\n+          http://www.apache.org/licenses/LICENSE-2.0\n+\n+      Unless required by applicable law or agreed to in writing, software\n+      distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n+      WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n+      License for the specific language governing permissions and limitations\n+      under the License.\n+\n+      Convention for heading levels in OVN documentation:\n+\n+      =======  Heading 0 (reserved for the title in a document)\n+      -------  Heading 1\n+      ~~~~~~~  Heading 2\n+      +++++++  Heading 3\n+      '''''''  Heading 4\n+\n+      Avoid deeper levels because they do not render well.\n+\n+=============================\n+The Representor Plug Provider\n+=============================\n+\n+Logical Switch Port Options\n+---------------------------\n+\n+plug:representor:pf-mac\n+~~~~~~~~~~~~~~~~~~~~~~~\n+\n+MAC address for identifying PF device.  When\n+`OVN_Northbound:Logical_Switch_Port:options` key `plug:representor:vf-num` is\n+also set, this option is used to identify PF to use as base to locate the\n+correct VF representor port.  When `OVN_Northbound:Logical_Switch_Port:options`\n+key `plug:representor:vf-num` is not set this option is used to locate a PF\n+representor port.\n+\n+plug:representor:vf-num\n+~~~~~~~~~~~~~~~~~~~~~~~\n+\n+Logical VF number relative to PF device specified in\n+`OVN_Northbound:Logical_Switch_Port:options` key `plug-pf-mac`.\ndiff --git a/build-aux/initial-tab-whitelist b/build-aux/initial-tab-whitelist\nindex b2f5a0791..c70f93891 100644\n--- a/build-aux/initial-tab-whitelist\n+++ b/build-aux/initial-tab-whitelist\n@@ -3,6 +3,7 @@\n \\.mk$\n \\.png$\n \\.sln$\n+^include/linux/\n ^ovs/\n ^third-party/\n ^xenserver/\ndiff --git a/configure.ac b/configure.ac\nindex 7f3274e59..5b542bfd1 100644\n--- a/configure.ac\n+++ b/configure.ac\n@@ -174,6 +174,8 @@ OVS_CHECK_PRAGMA_MESSAGE\n OVN_CHECK_OVS\n OVN_CHECK_PLUG_PROVIDER\n OVN_ENABLE_PLUG\n+OVS_CHECK_NETLINK\n+OVS_CHECK_LINUX_NETLINK\n OVS_CTAGS_IDENTIFIERS\n AC_SUBST([OVS_CFLAGS])\n AC_SUBST([OVS_LDFLAGS])\ndiff --git a/include/automake.mk b/include/automake.mk\nindex 9e8403f8d..75638bd9a 100644\n--- a/include/automake.mk\n+++ b/include/automake.mk\n@@ -1,2 +1,6 @@\n include include/ovn/automake.mk\n \n+if LINUX\n+include include/linux/automake.mk\n+endif\n+\ndiff --git a/include/linux/automake.mk b/include/linux/automake.mk\nnew file mode 100644\nindex 000000000..5b53597eb\n--- /dev/null\n+++ b/include/linux/automake.mk\n@@ -0,0 +1,2 @@\n+noinst_HEADERS += \\\n+\tinclude/linux/devlink.h\ndiff --git a/include/linux/devlink.h b/include/linux/devlink.h\nnew file mode 100644\nindex 000000000..28ea92b62\n--- /dev/null\n+++ b/include/linux/devlink.h\n@@ -0,0 +1,625 @@\n+/*\n+ * The kernel devlink interface has gained a number of additions in recent\n+ * kernel versions. To allow Open vSwitch to consume these interfaces in its\n+ * runtime environment regardless of what kernel version was available at build\n+ * time, and also avoiding an elaborate set of autoconf macros to check for\n+ * presence of individual pieces, we include the entire file here.\n+ *\n+ * Source:\n+ * https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/include/uapi/linux/devlink.h @ a556dded9c23c51c82654f1ebe389cbc0bc22057 */\n+#if !defined(__KERNEL__)\n+#ifndef __UAPI_LINUX_DEVLINK_WRAPPER_H\n+#define __UAPI_LINUX_DEVLINK_WRAPPER_H 1\n+/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */\n+/*\n+ * include/uapi/linux/devlink.h - Network physical device Netlink interface\n+ * Copyright (c) 2016 Mellanox Technologies. All rights reserved.\n+ * Copyright (c) 2016 Jiri Pirko <jiri@mellanox.com>\n+ *\n+ * This program is free software; you can redistribute it and/or modify\n+ * it under the terms of the GNU General Public License as published by\n+ * the Free Software Foundation; either version 2 of the License, or\n+ * (at your option) any later version.\n+ */\n+\n+#ifndef _UAPI_LINUX_DEVLINK_H_\n+#define _UAPI_LINUX_DEVLINK_H_\n+\n+#include <linux/const.h>\n+\n+#define DEVLINK_GENL_NAME \"devlink\"\n+#define DEVLINK_GENL_VERSION 0x1\n+#define DEVLINK_GENL_MCGRP_CONFIG_NAME \"config\"\n+\n+enum devlink_command {\n+\t/* don't change the order or add anything between, this is ABI! */\n+\tDEVLINK_CMD_UNSPEC,\n+\n+\tDEVLINK_CMD_GET,\t\t/* can dump */\n+\tDEVLINK_CMD_SET,\n+\tDEVLINK_CMD_NEW,\n+\tDEVLINK_CMD_DEL,\n+\n+\tDEVLINK_CMD_PORT_GET,\t\t/* can dump */\n+\tDEVLINK_CMD_PORT_SET,\n+\tDEVLINK_CMD_PORT_NEW,\n+\tDEVLINK_CMD_PORT_DEL,\n+\n+\tDEVLINK_CMD_PORT_SPLIT,\n+\tDEVLINK_CMD_PORT_UNSPLIT,\n+\n+\tDEVLINK_CMD_SB_GET,\t\t/* can dump */\n+\tDEVLINK_CMD_SB_SET,\n+\tDEVLINK_CMD_SB_NEW,\n+\tDEVLINK_CMD_SB_DEL,\n+\n+\tDEVLINK_CMD_SB_POOL_GET,\t/* can dump */\n+\tDEVLINK_CMD_SB_POOL_SET,\n+\tDEVLINK_CMD_SB_POOL_NEW,\n+\tDEVLINK_CMD_SB_POOL_DEL,\n+\n+\tDEVLINK_CMD_SB_PORT_POOL_GET,\t/* can dump */\n+\tDEVLINK_CMD_SB_PORT_POOL_SET,\n+\tDEVLINK_CMD_SB_PORT_POOL_NEW,\n+\tDEVLINK_CMD_SB_PORT_POOL_DEL,\n+\n+\tDEVLINK_CMD_SB_TC_POOL_BIND_GET,\t/* can dump */\n+\tDEVLINK_CMD_SB_TC_POOL_BIND_SET,\n+\tDEVLINK_CMD_SB_TC_POOL_BIND_NEW,\n+\tDEVLINK_CMD_SB_TC_POOL_BIND_DEL,\n+\n+\t/* Shared buffer occupancy monitoring commands */\n+\tDEVLINK_CMD_SB_OCC_SNAPSHOT,\n+\tDEVLINK_CMD_SB_OCC_MAX_CLEAR,\n+\n+\tDEVLINK_CMD_ESWITCH_GET,\n+#define DEVLINK_CMD_ESWITCH_MODE_GET /* obsolete, never use this! */ \\\n+\tDEVLINK_CMD_ESWITCH_GET\n+\n+\tDEVLINK_CMD_ESWITCH_SET,\n+#define DEVLINK_CMD_ESWITCH_MODE_SET /* obsolete, never use this! */ \\\n+\tDEVLINK_CMD_ESWITCH_SET\n+\n+\tDEVLINK_CMD_DPIPE_TABLE_GET,\n+\tDEVLINK_CMD_DPIPE_ENTRIES_GET,\n+\tDEVLINK_CMD_DPIPE_HEADERS_GET,\n+\tDEVLINK_CMD_DPIPE_TABLE_COUNTERS_SET,\n+\tDEVLINK_CMD_RESOURCE_SET,\n+\tDEVLINK_CMD_RESOURCE_DUMP,\n+\n+\t/* Hot driver reload, makes configuration changes take place. The\n+\t * devlink instance is not released during the process.\n+\t */\n+\tDEVLINK_CMD_RELOAD,\n+\n+\tDEVLINK_CMD_PARAM_GET,\t\t/* can dump */\n+\tDEVLINK_CMD_PARAM_SET,\n+\tDEVLINK_CMD_PARAM_NEW,\n+\tDEVLINK_CMD_PARAM_DEL,\n+\n+\tDEVLINK_CMD_REGION_GET,\n+\tDEVLINK_CMD_REGION_SET,\n+\tDEVLINK_CMD_REGION_NEW,\n+\tDEVLINK_CMD_REGION_DEL,\n+\tDEVLINK_CMD_REGION_READ,\n+\n+\tDEVLINK_CMD_PORT_PARAM_GET,\t/* can dump */\n+\tDEVLINK_CMD_PORT_PARAM_SET,\n+\tDEVLINK_CMD_PORT_PARAM_NEW,\n+\tDEVLINK_CMD_PORT_PARAM_DEL,\n+\n+\tDEVLINK_CMD_INFO_GET,\t\t/* can dump */\n+\n+\tDEVLINK_CMD_HEALTH_REPORTER_GET,\n+\tDEVLINK_CMD_HEALTH_REPORTER_SET,\n+\tDEVLINK_CMD_HEALTH_REPORTER_RECOVER,\n+\tDEVLINK_CMD_HEALTH_REPORTER_DIAGNOSE,\n+\tDEVLINK_CMD_HEALTH_REPORTER_DUMP_GET,\n+\tDEVLINK_CMD_HEALTH_REPORTER_DUMP_CLEAR,\n+\n+\tDEVLINK_CMD_FLASH_UPDATE,\n+\tDEVLINK_CMD_FLASH_UPDATE_END,\t\t/* notification only */\n+\tDEVLINK_CMD_FLASH_UPDATE_STATUS,\t/* notification only */\n+\n+\tDEVLINK_CMD_TRAP_GET,\t\t/* can dump */\n+\tDEVLINK_CMD_TRAP_SET,\n+\tDEVLINK_CMD_TRAP_NEW,\n+\tDEVLINK_CMD_TRAP_DEL,\n+\n+\tDEVLINK_CMD_TRAP_GROUP_GET,\t/* can dump */\n+\tDEVLINK_CMD_TRAP_GROUP_SET,\n+\tDEVLINK_CMD_TRAP_GROUP_NEW,\n+\tDEVLINK_CMD_TRAP_GROUP_DEL,\n+\n+\tDEVLINK_CMD_TRAP_POLICER_GET,\t/* can dump */\n+\tDEVLINK_CMD_TRAP_POLICER_SET,\n+\tDEVLINK_CMD_TRAP_POLICER_NEW,\n+\tDEVLINK_CMD_TRAP_POLICER_DEL,\n+\n+\tDEVLINK_CMD_HEALTH_REPORTER_TEST,\n+\n+\t/* add new commands above here */\n+\t__DEVLINK_CMD_MAX,\n+\tDEVLINK_CMD_MAX = __DEVLINK_CMD_MAX - 1\n+};\n+\n+enum devlink_port_type {\n+\tDEVLINK_PORT_TYPE_NOTSET,\n+\tDEVLINK_PORT_TYPE_AUTO,\n+\tDEVLINK_PORT_TYPE_ETH,\n+\tDEVLINK_PORT_TYPE_IB,\n+};\n+\n+enum devlink_sb_pool_type {\n+\tDEVLINK_SB_POOL_TYPE_INGRESS,\n+\tDEVLINK_SB_POOL_TYPE_EGRESS,\n+};\n+\n+/* static threshold - limiting the maximum number of bytes.\n+ * dynamic threshold - limiting the maximum number of bytes\n+ *   based on the currently available free space in the shared buffer pool.\n+ *   In this mode, the maximum quota is calculated based\n+ *   on the following formula:\n+ *     max_quota = alpha / (1 + alpha) * Free_Buffer\n+ *   While Free_Buffer is the amount of none-occupied buffer associated to\n+ *   the relevant pool.\n+ *   The value range which can be passed is 0-20 and serves\n+ *   for computation of alpha by following formula:\n+ *     alpha = 2 ^ (passed_value - 10)\n+ */\n+\n+enum devlink_sb_threshold_type {\n+\tDEVLINK_SB_THRESHOLD_TYPE_STATIC,\n+\tDEVLINK_SB_THRESHOLD_TYPE_DYNAMIC,\n+};\n+\n+#define DEVLINK_SB_THRESHOLD_TO_ALPHA_MAX 20\n+\n+enum devlink_eswitch_mode {\n+\tDEVLINK_ESWITCH_MODE_LEGACY,\n+\tDEVLINK_ESWITCH_MODE_SWITCHDEV,\n+};\n+\n+enum devlink_eswitch_inline_mode {\n+\tDEVLINK_ESWITCH_INLINE_MODE_NONE,\n+\tDEVLINK_ESWITCH_INLINE_MODE_LINK,\n+\tDEVLINK_ESWITCH_INLINE_MODE_NETWORK,\n+\tDEVLINK_ESWITCH_INLINE_MODE_TRANSPORT,\n+};\n+\n+enum devlink_eswitch_encap_mode {\n+\tDEVLINK_ESWITCH_ENCAP_MODE_NONE,\n+\tDEVLINK_ESWITCH_ENCAP_MODE_BASIC,\n+};\n+\n+enum devlink_port_flavour {\n+\tDEVLINK_PORT_FLAVOUR_PHYSICAL, /* Any kind of a port physically\n+\t\t\t\t\t* facing the user.\n+\t\t\t\t\t*/\n+\tDEVLINK_PORT_FLAVOUR_CPU, /* CPU port */\n+\tDEVLINK_PORT_FLAVOUR_DSA, /* Distributed switch architecture\n+\t\t\t\t   * interconnect port.\n+\t\t\t\t   */\n+\tDEVLINK_PORT_FLAVOUR_PCI_PF, /* Represents eswitch port for\n+\t\t\t\t      * the PCI PF. It is an internal\n+\t\t\t\t      * port that faces the PCI PF.\n+\t\t\t\t      */\n+\tDEVLINK_PORT_FLAVOUR_PCI_VF, /* Represents eswitch port\n+\t\t\t\t      * for the PCI VF. It is an internal\n+\t\t\t\t      * port that faces the PCI VF.\n+\t\t\t\t      */\n+\tDEVLINK_PORT_FLAVOUR_VIRTUAL, /* Any virtual port facing the user. */\n+\tDEVLINK_PORT_FLAVOUR_UNUSED, /* Port which exists in the switch, but\n+\t\t\t\t      * is not used in any way.\n+\t\t\t\t      */\n+\tDEVLINK_PORT_FLAVOUR_PCI_SF, /* Represents eswitch port\n+\t\t\t\t      * for the PCI SF. It is an internal\n+\t\t\t\t      * port that faces the PCI SF.\n+\t\t\t\t      */\n+};\n+\n+enum devlink_param_cmode {\n+\tDEVLINK_PARAM_CMODE_RUNTIME,\n+\tDEVLINK_PARAM_CMODE_DRIVERINIT,\n+\tDEVLINK_PARAM_CMODE_PERMANENT,\n+\n+\t/* Add new configuration modes above */\n+\t__DEVLINK_PARAM_CMODE_MAX,\n+\tDEVLINK_PARAM_CMODE_MAX = __DEVLINK_PARAM_CMODE_MAX - 1\n+};\n+\n+enum devlink_param_fw_load_policy_value {\n+\tDEVLINK_PARAM_FW_LOAD_POLICY_VALUE_DRIVER,\n+\tDEVLINK_PARAM_FW_LOAD_POLICY_VALUE_FLASH,\n+\tDEVLINK_PARAM_FW_LOAD_POLICY_VALUE_DISK,\n+\tDEVLINK_PARAM_FW_LOAD_POLICY_VALUE_UNKNOWN,\n+};\n+\n+enum devlink_param_reset_dev_on_drv_probe_value {\n+\tDEVLINK_PARAM_RESET_DEV_ON_DRV_PROBE_VALUE_UNKNOWN,\n+\tDEVLINK_PARAM_RESET_DEV_ON_DRV_PROBE_VALUE_ALWAYS,\n+\tDEVLINK_PARAM_RESET_DEV_ON_DRV_PROBE_VALUE_NEVER,\n+\tDEVLINK_PARAM_RESET_DEV_ON_DRV_PROBE_VALUE_DISK,\n+};\n+\n+enum {\n+\tDEVLINK_ATTR_STATS_RX_PACKETS,\t\t/* u64 */\n+\tDEVLINK_ATTR_STATS_RX_BYTES,\t\t/* u64 */\n+\tDEVLINK_ATTR_STATS_RX_DROPPED,\t\t/* u64 */\n+\n+\t__DEVLINK_ATTR_STATS_MAX,\n+\tDEVLINK_ATTR_STATS_MAX = __DEVLINK_ATTR_STATS_MAX - 1\n+};\n+\n+/* Specify what sections of a flash component can be overwritten when\n+ * performing an update. Overwriting of firmware binary sections is always\n+ * implicitly assumed to be allowed.\n+ *\n+ * Each section must be documented in\n+ * Documentation/networking/devlink/devlink-flash.rst\n+ *\n+ */\n+enum {\n+\tDEVLINK_FLASH_OVERWRITE_SETTINGS_BIT,\n+\tDEVLINK_FLASH_OVERWRITE_IDENTIFIERS_BIT,\n+\n+\t__DEVLINK_FLASH_OVERWRITE_MAX_BIT,\n+\tDEVLINK_FLASH_OVERWRITE_MAX_BIT = __DEVLINK_FLASH_OVERWRITE_MAX_BIT - 1\n+};\n+\n+#define DEVLINK_FLASH_OVERWRITE_SETTINGS _BITUL(DEVLINK_FLASH_OVERWRITE_SETTINGS_BIT)\n+#define DEVLINK_FLASH_OVERWRITE_IDENTIFIERS _BITUL(DEVLINK_FLASH_OVERWRITE_IDENTIFIERS_BIT)\n+\n+#define DEVLINK_SUPPORTED_FLASH_OVERWRITE_SECTIONS \\\n+\t(_BITUL(__DEVLINK_FLASH_OVERWRITE_MAX_BIT) - 1)\n+\n+/**\n+ * enum devlink_trap_action - Packet trap action.\n+ * @DEVLINK_TRAP_ACTION_DROP: Packet is dropped by the device and a copy is not\n+ *                            sent to the CPU.\n+ * @DEVLINK_TRAP_ACTION_TRAP: The sole copy of the packet is sent to the CPU.\n+ * @DEVLINK_TRAP_ACTION_MIRROR: Packet is forwarded by the device and a copy is\n+ *                              sent to the CPU.\n+ */\n+enum devlink_trap_action {\n+\tDEVLINK_TRAP_ACTION_DROP,\n+\tDEVLINK_TRAP_ACTION_TRAP,\n+\tDEVLINK_TRAP_ACTION_MIRROR,\n+};\n+\n+/**\n+ * enum devlink_trap_type - Packet trap type.\n+ * @DEVLINK_TRAP_TYPE_DROP: Trap reason is a drop. Trapped packets are only\n+ *                          processed by devlink and not injected to the\n+ *                          kernel's Rx path.\n+ * @DEVLINK_TRAP_TYPE_EXCEPTION: Trap reason is an exception. Packet was not\n+ *                               forwarded as intended due to an exception\n+ *                               (e.g., missing neighbour entry) and trapped to\n+ *                               control plane for resolution. Trapped packets\n+ *                               are processed by devlink and injected to\n+ *                               the kernel's Rx path.\n+ * @DEVLINK_TRAP_TYPE_CONTROL: Packet was trapped because it is required for\n+ *                             the correct functioning of the control plane.\n+ *                             For example, an ARP request packet. Trapped\n+ *                             packets are injected to the kernel's Rx path,\n+ *                             but not reported to drop monitor.\n+ */\n+enum devlink_trap_type {\n+\tDEVLINK_TRAP_TYPE_DROP,\n+\tDEVLINK_TRAP_TYPE_EXCEPTION,\n+\tDEVLINK_TRAP_TYPE_CONTROL,\n+};\n+\n+enum {\n+\t/* Trap can report input port as metadata */\n+\tDEVLINK_ATTR_TRAP_METADATA_TYPE_IN_PORT,\n+\t/* Trap can report flow action cookie as metadata */\n+\tDEVLINK_ATTR_TRAP_METADATA_TYPE_FA_COOKIE,\n+};\n+\n+enum devlink_reload_action {\n+\tDEVLINK_RELOAD_ACTION_UNSPEC,\n+\tDEVLINK_RELOAD_ACTION_DRIVER_REINIT,\t/* Driver entities re-instantiation */\n+\tDEVLINK_RELOAD_ACTION_FW_ACTIVATE,\t/* FW activate */\n+\n+\t/* Add new reload actions above */\n+\t__DEVLINK_RELOAD_ACTION_MAX,\n+\tDEVLINK_RELOAD_ACTION_MAX = __DEVLINK_RELOAD_ACTION_MAX - 1\n+};\n+\n+enum devlink_reload_limit {\n+\tDEVLINK_RELOAD_LIMIT_UNSPEC,\t/* unspecified, no constraints */\n+\tDEVLINK_RELOAD_LIMIT_NO_RESET,\t/* No reset allowed, no down time allowed,\n+\t\t\t\t\t * no link flap and no configuration is lost.\n+\t\t\t\t\t */\n+\n+\t/* Add new reload limit above */\n+\t__DEVLINK_RELOAD_LIMIT_MAX,\n+\tDEVLINK_RELOAD_LIMIT_MAX = __DEVLINK_RELOAD_LIMIT_MAX - 1\n+};\n+\n+#define DEVLINK_RELOAD_LIMITS_VALID_MASK (_BITUL(__DEVLINK_RELOAD_LIMIT_MAX) - 1)\n+\n+enum devlink_attr {\n+\t/* don't change the order or add anything between, this is ABI! */\n+\tDEVLINK_ATTR_UNSPEC,\n+\n+\t/* bus name + dev name together are a handle for devlink entity */\n+\tDEVLINK_ATTR_BUS_NAME,\t\t\t/* string */\n+\tDEVLINK_ATTR_DEV_NAME,\t\t\t/* string */\n+\n+\tDEVLINK_ATTR_PORT_INDEX,\t\t/* u32 */\n+\tDEVLINK_ATTR_PORT_TYPE,\t\t\t/* u16 */\n+\tDEVLINK_ATTR_PORT_DESIRED_TYPE,\t\t/* u16 */\n+\tDEVLINK_ATTR_PORT_NETDEV_IFINDEX,\t/* u32 */\n+\tDEVLINK_ATTR_PORT_NETDEV_NAME,\t\t/* string */\n+\tDEVLINK_ATTR_PORT_IBDEV_NAME,\t\t/* string */\n+\tDEVLINK_ATTR_PORT_SPLIT_COUNT,\t\t/* u32 */\n+\tDEVLINK_ATTR_PORT_SPLIT_GROUP,\t\t/* u32 */\n+\tDEVLINK_ATTR_SB_INDEX,\t\t\t/* u32 */\n+\tDEVLINK_ATTR_SB_SIZE,\t\t\t/* u32 */\n+\tDEVLINK_ATTR_SB_INGRESS_POOL_COUNT,\t/* u16 */\n+\tDEVLINK_ATTR_SB_EGRESS_POOL_COUNT,\t/* u16 */\n+\tDEVLINK_ATTR_SB_INGRESS_TC_COUNT,\t/* u16 */\n+\tDEVLINK_ATTR_SB_EGRESS_TC_COUNT,\t/* u16 */\n+\tDEVLINK_ATTR_SB_POOL_INDEX,\t\t/* u16 */\n+\tDEVLINK_ATTR_SB_POOL_TYPE,\t\t/* u8 */\n+\tDEVLINK_ATTR_SB_POOL_SIZE,\t\t/* u32 */\n+\tDEVLINK_ATTR_SB_POOL_THRESHOLD_TYPE,\t/* u8 */\n+\tDEVLINK_ATTR_SB_THRESHOLD,\t\t/* u32 */\n+\tDEVLINK_ATTR_SB_TC_INDEX,\t\t/* u16 */\n+\tDEVLINK_ATTR_SB_OCC_CUR,\t\t/* u32 */\n+\tDEVLINK_ATTR_SB_OCC_MAX,\t\t/* u32 */\n+\tDEVLINK_ATTR_ESWITCH_MODE,\t\t/* u16 */\n+\tDEVLINK_ATTR_ESWITCH_INLINE_MODE,\t/* u8 */\n+\n+\tDEVLINK_ATTR_DPIPE_TABLES,\t\t/* nested */\n+\tDEVLINK_ATTR_DPIPE_TABLE,\t\t/* nested */\n+\tDEVLINK_ATTR_DPIPE_TABLE_NAME,\t\t/* string */\n+\tDEVLINK_ATTR_DPIPE_TABLE_SIZE,\t\t/* u64 */\n+\tDEVLINK_ATTR_DPIPE_TABLE_MATCHES,\t/* nested */\n+\tDEVLINK_ATTR_DPIPE_TABLE_ACTIONS,\t/* nested */\n+\tDEVLINK_ATTR_DPIPE_TABLE_COUNTERS_ENABLED,\t/* u8 */\n+\n+\tDEVLINK_ATTR_DPIPE_ENTRIES,\t\t/* nested */\n+\tDEVLINK_ATTR_DPIPE_ENTRY,\t\t/* nested */\n+\tDEVLINK_ATTR_DPIPE_ENTRY_INDEX,\t\t/* u64 */\n+\tDEVLINK_ATTR_DPIPE_ENTRY_MATCH_VALUES,\t/* nested */\n+\tDEVLINK_ATTR_DPIPE_ENTRY_ACTION_VALUES,\t/* nested */\n+\tDEVLINK_ATTR_DPIPE_ENTRY_COUNTER,\t/* u64 */\n+\n+\tDEVLINK_ATTR_DPIPE_MATCH,\t\t/* nested */\n+\tDEVLINK_ATTR_DPIPE_MATCH_VALUE,\t\t/* nested */\n+\tDEVLINK_ATTR_DPIPE_MATCH_TYPE,\t\t/* u32 */\n+\n+\tDEVLINK_ATTR_DPIPE_ACTION,\t\t/* nested */\n+\tDEVLINK_ATTR_DPIPE_ACTION_VALUE,\t/* nested */\n+\tDEVLINK_ATTR_DPIPE_ACTION_TYPE,\t\t/* u32 */\n+\n+\tDEVLINK_ATTR_DPIPE_VALUE,\n+\tDEVLINK_ATTR_DPIPE_VALUE_MASK,\n+\tDEVLINK_ATTR_DPIPE_VALUE_MAPPING,\t/* u32 */\n+\n+\tDEVLINK_ATTR_DPIPE_HEADERS,\t\t/* nested */\n+\tDEVLINK_ATTR_DPIPE_HEADER,\t\t/* nested */\n+\tDEVLINK_ATTR_DPIPE_HEADER_NAME,\t\t/* string */\n+\tDEVLINK_ATTR_DPIPE_HEADER_ID,\t\t/* u32 */\n+\tDEVLINK_ATTR_DPIPE_HEADER_FIELDS,\t/* nested */\n+\tDEVLINK_ATTR_DPIPE_HEADER_GLOBAL,\t/* u8 */\n+\tDEVLINK_ATTR_DPIPE_HEADER_INDEX,\t/* u32 */\n+\n+\tDEVLINK_ATTR_DPIPE_FIELD,\t\t/* nested */\n+\tDEVLINK_ATTR_DPIPE_FIELD_NAME,\t\t/* string */\n+\tDEVLINK_ATTR_DPIPE_FIELD_ID,\t\t/* u32 */\n+\tDEVLINK_ATTR_DPIPE_FIELD_BITWIDTH,\t/* u32 */\n+\tDEVLINK_ATTR_DPIPE_FIELD_MAPPING_TYPE,\t/* u32 */\n+\n+\tDEVLINK_ATTR_PAD,\n+\n+\tDEVLINK_ATTR_ESWITCH_ENCAP_MODE,\t/* u8 */\n+\tDEVLINK_ATTR_RESOURCE_LIST,\t\t/* nested */\n+\tDEVLINK_ATTR_RESOURCE,\t\t\t/* nested */\n+\tDEVLINK_ATTR_RESOURCE_NAME,\t\t/* string */\n+\tDEVLINK_ATTR_RESOURCE_ID,\t\t/* u64 */\n+\tDEVLINK_ATTR_RESOURCE_SIZE,\t\t/* u64 */\n+\tDEVLINK_ATTR_RESOURCE_SIZE_NEW,\t\t/* u64 */\n+\tDEVLINK_ATTR_RESOURCE_SIZE_VALID,\t/* u8 */\n+\tDEVLINK_ATTR_RESOURCE_SIZE_MIN,\t\t/* u64 */\n+\tDEVLINK_ATTR_RESOURCE_SIZE_MAX,\t\t/* u64 */\n+\tDEVLINK_ATTR_RESOURCE_SIZE_GRAN,        /* u64 */\n+\tDEVLINK_ATTR_RESOURCE_UNIT,\t\t/* u8 */\n+\tDEVLINK_ATTR_RESOURCE_OCC,\t\t/* u64 */\n+\tDEVLINK_ATTR_DPIPE_TABLE_RESOURCE_ID,\t/* u64 */\n+\tDEVLINK_ATTR_DPIPE_TABLE_RESOURCE_UNITS,/* u64 */\n+\n+\tDEVLINK_ATTR_PORT_FLAVOUR,\t\t/* u16 */\n+\tDEVLINK_ATTR_PORT_NUMBER,\t\t/* u32 */\n+\tDEVLINK_ATTR_PORT_SPLIT_SUBPORT_NUMBER,\t/* u32 */\n+\n+\tDEVLINK_ATTR_PARAM,\t\t\t/* nested */\n+\tDEVLINK_ATTR_PARAM_NAME,\t\t/* string */\n+\tDEVLINK_ATTR_PARAM_GENERIC,\t\t/* flag */\n+\tDEVLINK_ATTR_PARAM_TYPE,\t\t/* u8 */\n+\tDEVLINK_ATTR_PARAM_VALUES_LIST,\t\t/* nested */\n+\tDEVLINK_ATTR_PARAM_VALUE,\t\t/* nested */\n+\tDEVLINK_ATTR_PARAM_VALUE_DATA,\t\t/* dynamic */\n+\tDEVLINK_ATTR_PARAM_VALUE_CMODE,\t\t/* u8 */\n+\n+\tDEVLINK_ATTR_REGION_NAME,               /* string */\n+\tDEVLINK_ATTR_REGION_SIZE,               /* u64 */\n+\tDEVLINK_ATTR_REGION_SNAPSHOTS,          /* nested */\n+\tDEVLINK_ATTR_REGION_SNAPSHOT,           /* nested */\n+\tDEVLINK_ATTR_REGION_SNAPSHOT_ID,        /* u32 */\n+\n+\tDEVLINK_ATTR_REGION_CHUNKS,             /* nested */\n+\tDEVLINK_ATTR_REGION_CHUNK,              /* nested */\n+\tDEVLINK_ATTR_REGION_CHUNK_DATA,         /* binary */\n+\tDEVLINK_ATTR_REGION_CHUNK_ADDR,         /* u64 */\n+\tDEVLINK_ATTR_REGION_CHUNK_LEN,          /* u64 */\n+\n+\tDEVLINK_ATTR_INFO_DRIVER_NAME,\t\t/* string */\n+\tDEVLINK_ATTR_INFO_SERIAL_NUMBER,\t/* string */\n+\tDEVLINK_ATTR_INFO_VERSION_FIXED,\t/* nested */\n+\tDEVLINK_ATTR_INFO_VERSION_RUNNING,\t/* nested */\n+\tDEVLINK_ATTR_INFO_VERSION_STORED,\t/* nested */\n+\tDEVLINK_ATTR_INFO_VERSION_NAME,\t\t/* string */\n+\tDEVLINK_ATTR_INFO_VERSION_VALUE,\t/* string */\n+\n+\tDEVLINK_ATTR_SB_POOL_CELL_SIZE,\t\t/* u32 */\n+\n+\tDEVLINK_ATTR_FMSG,\t\t\t/* nested */\n+\tDEVLINK_ATTR_FMSG_OBJ_NEST_START,\t/* flag */\n+\tDEVLINK_ATTR_FMSG_PAIR_NEST_START,\t/* flag */\n+\tDEVLINK_ATTR_FMSG_ARR_NEST_START,\t/* flag */\n+\tDEVLINK_ATTR_FMSG_NEST_END,\t\t/* flag */\n+\tDEVLINK_ATTR_FMSG_OBJ_NAME,\t\t/* string */\n+\tDEVLINK_ATTR_FMSG_OBJ_VALUE_TYPE,\t/* u8 */\n+\tDEVLINK_ATTR_FMSG_OBJ_VALUE_DATA,\t/* dynamic */\n+\n+\tDEVLINK_ATTR_HEALTH_REPORTER,\t\t\t/* nested */\n+\tDEVLINK_ATTR_HEALTH_REPORTER_NAME,\t\t/* string */\n+\tDEVLINK_ATTR_HEALTH_REPORTER_STATE,\t\t/* u8 */\n+\tDEVLINK_ATTR_HEALTH_REPORTER_ERR_COUNT,\t\t/* u64 */\n+\tDEVLINK_ATTR_HEALTH_REPORTER_RECOVER_COUNT,\t/* u64 */\n+\tDEVLINK_ATTR_HEALTH_REPORTER_DUMP_TS,\t\t/* u64 */\n+\tDEVLINK_ATTR_HEALTH_REPORTER_GRACEFUL_PERIOD,\t/* u64 */\n+\tDEVLINK_ATTR_HEALTH_REPORTER_AUTO_RECOVER,\t/* u8 */\n+\n+\tDEVLINK_ATTR_FLASH_UPDATE_FILE_NAME,\t/* string */\n+\tDEVLINK_ATTR_FLASH_UPDATE_COMPONENT,\t/* string */\n+\tDEVLINK_ATTR_FLASH_UPDATE_STATUS_MSG,\t/* string */\n+\tDEVLINK_ATTR_FLASH_UPDATE_STATUS_DONE,\t/* u64 */\n+\tDEVLINK_ATTR_FLASH_UPDATE_STATUS_TOTAL,\t/* u64 */\n+\n+\tDEVLINK_ATTR_PORT_PCI_PF_NUMBER,\t/* u16 */\n+\tDEVLINK_ATTR_PORT_PCI_VF_NUMBER,\t/* u16 */\n+\n+\tDEVLINK_ATTR_STATS,\t\t\t\t/* nested */\n+\n+\tDEVLINK_ATTR_TRAP_NAME,\t\t\t\t/* string */\n+\t/* enum devlink_trap_action */\n+\tDEVLINK_ATTR_TRAP_ACTION,\t\t\t/* u8 */\n+\t/* enum devlink_trap_type */\n+\tDEVLINK_ATTR_TRAP_TYPE,\t\t\t\t/* u8 */\n+\tDEVLINK_ATTR_TRAP_GENERIC,\t\t\t/* flag */\n+\tDEVLINK_ATTR_TRAP_METADATA,\t\t\t/* nested */\n+\tDEVLINK_ATTR_TRAP_GROUP_NAME,\t\t\t/* string */\n+\n+\tDEVLINK_ATTR_RELOAD_FAILED,\t\t\t/* u8 0 or 1 */\n+\n+\tDEVLINK_ATTR_HEALTH_REPORTER_DUMP_TS_NS,\t/* u64 */\n+\n+\tDEVLINK_ATTR_NETNS_FD,\t\t\t/* u32 */\n+\tDEVLINK_ATTR_NETNS_PID,\t\t\t/* u32 */\n+\tDEVLINK_ATTR_NETNS_ID,\t\t\t/* u32 */\n+\n+\tDEVLINK_ATTR_HEALTH_REPORTER_AUTO_DUMP,\t/* u8 */\n+\n+\tDEVLINK_ATTR_TRAP_POLICER_ID,\t\t\t/* u32 */\n+\tDEVLINK_ATTR_TRAP_POLICER_RATE,\t\t\t/* u64 */\n+\tDEVLINK_ATTR_TRAP_POLICER_BURST,\t\t/* u64 */\n+\n+\tDEVLINK_ATTR_PORT_FUNCTION,\t\t\t/* nested */\n+\n+\tDEVLINK_ATTR_INFO_BOARD_SERIAL_NUMBER,\t/* string */\n+\n+\tDEVLINK_ATTR_PORT_LANES,\t\t\t/* u32 */\n+\tDEVLINK_ATTR_PORT_SPLITTABLE,\t\t\t/* u8 */\n+\n+\tDEVLINK_ATTR_PORT_EXTERNAL,\t\t/* u8 */\n+\tDEVLINK_ATTR_PORT_CONTROLLER_NUMBER,\t/* u32 */\n+\n+\tDEVLINK_ATTR_FLASH_UPDATE_STATUS_TIMEOUT,\t/* u64 */\n+\tDEVLINK_ATTR_FLASH_UPDATE_OVERWRITE_MASK,\t/* bitfield32 */\n+\n+\tDEVLINK_ATTR_RELOAD_ACTION,\t\t/* u8 */\n+\tDEVLINK_ATTR_RELOAD_ACTIONS_PERFORMED,\t/* bitfield32 */\n+\tDEVLINK_ATTR_RELOAD_LIMITS,\t\t/* bitfield32 */\n+\n+\tDEVLINK_ATTR_DEV_STATS,\t\t\t/* nested */\n+\tDEVLINK_ATTR_RELOAD_STATS,\t\t/* nested */\n+\tDEVLINK_ATTR_RELOAD_STATS_ENTRY,\t/* nested */\n+\tDEVLINK_ATTR_RELOAD_STATS_LIMIT,\t/* u8 */\n+\tDEVLINK_ATTR_RELOAD_STATS_VALUE,\t/* u32 */\n+\tDEVLINK_ATTR_REMOTE_RELOAD_STATS,\t/* nested */\n+\tDEVLINK_ATTR_RELOAD_ACTION_INFO,        /* nested */\n+\tDEVLINK_ATTR_RELOAD_ACTION_STATS,       /* nested */\n+\n+\tDEVLINK_ATTR_PORT_PCI_SF_NUMBER,\t/* u32 */\n+\t/* add new attributes above here, update the policy in devlink.c */\n+\n+\t__DEVLINK_ATTR_MAX,\n+\tDEVLINK_ATTR_MAX = __DEVLINK_ATTR_MAX - 1\n+};\n+\n+/* Mapping between internal resource described by the field and system\n+ * structure\n+ */\n+enum devlink_dpipe_field_mapping_type {\n+\tDEVLINK_DPIPE_FIELD_MAPPING_TYPE_NONE,\n+\tDEVLINK_DPIPE_FIELD_MAPPING_TYPE_IFINDEX,\n+};\n+\n+/* Match type - specify the type of the match */\n+enum devlink_dpipe_match_type {\n+\tDEVLINK_DPIPE_MATCH_TYPE_FIELD_EXACT,\n+};\n+\n+/* Action type - specify the action type */\n+enum devlink_dpipe_action_type {\n+\tDEVLINK_DPIPE_ACTION_TYPE_FIELD_MODIFY,\n+};\n+\n+enum devlink_dpipe_field_ethernet_id {\n+\tDEVLINK_DPIPE_FIELD_ETHERNET_DST_MAC,\n+};\n+\n+enum devlink_dpipe_field_ipv4_id {\n+\tDEVLINK_DPIPE_FIELD_IPV4_DST_IP,\n+};\n+\n+enum devlink_dpipe_field_ipv6_id {\n+\tDEVLINK_DPIPE_FIELD_IPV6_DST_IP,\n+};\n+\n+enum devlink_dpipe_header_id {\n+\tDEVLINK_DPIPE_HEADER_ETHERNET,\n+\tDEVLINK_DPIPE_HEADER_IPV4,\n+\tDEVLINK_DPIPE_HEADER_IPV6,\n+};\n+\n+enum devlink_resource_unit {\n+\tDEVLINK_RESOURCE_UNIT_ENTRY,\n+};\n+\n+enum devlink_port_function_attr {\n+\tDEVLINK_PORT_FUNCTION_ATTR_UNSPEC,\n+\tDEVLINK_PORT_FUNCTION_ATTR_HW_ADDR,\t/* binary */\n+\tDEVLINK_PORT_FN_ATTR_STATE,\t/* u8 */\n+\tDEVLINK_PORT_FN_ATTR_OPSTATE,\t/* u8 */\n+\n+\t__DEVLINK_PORT_FUNCTION_ATTR_MAX,\n+\tDEVLINK_PORT_FUNCTION_ATTR_MAX = __DEVLINK_PORT_FUNCTION_ATTR_MAX - 1\n+};\n+\n+enum devlink_port_fn_state {\n+\tDEVLINK_PORT_FN_STATE_INACTIVE,\n+\tDEVLINK_PORT_FN_STATE_ACTIVE,\n+};\n+\n+/**\n+ * enum devlink_port_fn_opstate - indicates operational state of the function\n+ * @DEVLINK_PORT_FN_OPSTATE_ATTACHED: Driver is attached to the function.\n+ * For graceful tear down of the function, after inactivation of the\n+ * function, user should wait for operational state to turn DETACHED.\n+ * @DEVLINK_PORT_FN_OPSTATE_DETACHED: Driver is detached from the function.\n+ * It is safe to delete the port.\n+ */\n+enum devlink_port_fn_opstate {\n+\tDEVLINK_PORT_FN_OPSTATE_DETACHED,\n+\tDEVLINK_PORT_FN_OPSTATE_ATTACHED,\n+};\n+\n+#endif /* _UAPI_LINUX_DEVLINK_H_ */\n+#endif /* __UAPI_LINUX_DEVLINK_WRAPPER_H */\n+#endif /* !__KERNEL__ */\ndiff --git a/lib/automake.mk b/lib/automake.mk\nindex 086fbd62d..1057504d1 100644\n--- a/lib/automake.mk\n+++ b/lib/automake.mk\n@@ -43,6 +43,17 @@ lib_libovn_la_SOURCES = \\\n \tlib/plug.c \\\n \tlib/plug-dummy.h \\\n \tlib/plug-dummy.c\n+\n+# in-tree plug providers\n+if ENABLE_PLUG\n+if LINUX\n+lib_libovn_la_SOURCES += \\\n+\tlib/plug_providers/representor/netlink-devlink.h \\\n+\tlib/plug_providers/representor/netlink-devlink.c \\\n+\tlib/plug_providers/representor/plug-representor.c\n+endif\n+endif\n+\n nodist_lib_libovn_la_SOURCES = \\\n \tlib/ovn-dirs.c \\\n \tlib/ovn-nb-idl.c \\\ndiff --git a/lib/plug-provider.h b/lib/plug-provider.h\nindex 487534ee5..6587be8dc 100644\n--- a/lib/plug-provider.h\n+++ b/lib/plug-provider.h\n@@ -87,9 +87,13 @@ struct plug_class {\n };\n \n extern const struct plug_class plug_dummy_class;\n+#ifdef ENABLE_PLUG\n+/* in-tree plug classes */\n+extern const struct plug_class plug_representor;\n+#endif /* ENABLE_PLUG */\n #ifdef HAVE_PLUG_PROVIDER\n extern const struct plug_class *plug_provider_classes[];\n-#endif\n+#endif /* HAVE_PLUG_PROVIDER */\n \n #ifdef  __cplusplus\n }\ndiff --git a/lib/plug.c b/lib/plug.c\nindex c0c34214e..dab06713a 100644\n--- a/lib/plug.c\n+++ b/lib/plug.c\n@@ -32,6 +32,7 @@ VLOG_DEFINE_THIS_MODULE(plug);\n \n #ifdef ENABLE_PLUG\n static const struct plug_class *base_plug_classes[] = {\n+    &plug_representor,\n };\n #endif\n \ndiff --git a/lib/plug_providers/representor/netlink-devlink.c b/lib/plug_providers/representor/netlink-devlink.c\nnew file mode 100644\nindex 000000000..82e9c71f3\n--- /dev/null\n+++ b/lib/plug_providers/representor/netlink-devlink.c\n@@ -0,0 +1,499 @@\n+/*\n+ * Copyright (c) 2021 Canonical\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at:\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+#include <config.h>\n+#include <errno.h>\n+#include <inttypes.h>\n+#include <linux/devlink.h>\n+#include <linux/genetlink.h>\n+#include \"netlink.h\"\n+#include \"netlink-socket.h\"\n+#include \"netlink-devlink.h\"\n+#include \"openvswitch/vlog.h\"\n+#include \"packets.h\"\n+\n+VLOG_DEFINE_THIS_MODULE(netlink_devlink);\n+\n+/* Initialized by nl_devlink_init() */\n+static int ovs_devlink_family;\n+\n+struct nl_dl_dump_state {\n+    struct nl_dump dump;\n+    struct ofpbuf buf;\n+    int error;\n+};\n+\n+static int nl_devlink_init(void);\n+\n+const char *dl_str_not_present = \"\";\n+\n+/* Allocates memory for and returns a pointer to devlink dump state object.\n+ *\n+ * One-time initialization and lookup of the devlink generic netlink family is\n+ * also performed, and the caller should check for error condition with a call\n+ * to nl_dl_dump_init_error before attempting to dump devlink data.\n+ *\n+ * The caller owns the allocated object and is responsible for freeing the\n+ * allocated memory with a call to nl_dl_dump_destroy when done. */\n+struct nl_dl_dump_state *\n+nl_dl_dump_init(void)\n+{\n+    struct nl_dl_dump_state *dump_state;\n+\n+    dump_state = xmalloc(sizeof(*dump_state));\n+    dump_state->error = nl_devlink_init();\n+    return dump_state;\n+}\n+\n+/* Get error indicator from the devlink initialization process. */\n+int\n+nl_dl_dump_init_error(struct nl_dl_dump_state *dump_state)\n+{\n+    return dump_state->error;\n+}\n+\n+/* Free memory previously allocated by call to nl_dl_dump_init.\n+ *\n+ * Note that the caller is responsible for making a call to nl_dl_dump_finish\n+ * to free up resources associated with any in-flight dump process prior to\n+ * destroying the dump state object. */\n+void\n+nl_dl_dump_destroy(struct nl_dl_dump_state *dump_state)\n+{\n+    free(dump_state);\n+}\n+\n+void\n+nl_msg_put_dlgenmsg(struct ofpbuf *msg, size_t expected_payload,\n+                    int family, uint8_t cmd, uint32_t flags)\n+{\n+    nl_msg_put_genlmsghdr(msg, expected_payload, family,\n+                          flags, cmd, DEVLINK_GENL_VERSION);\n+}\n+\n+/* Starts a Netlink-devlink \"dump\" operation, by sending devlink request with\n+ * command 'cmd' to the kernel on a Netlink socket, and initializes 'state'\n+ * with buffer and dump state. */\n+void\n+nl_dl_dump_start(uint8_t cmd, struct nl_dl_dump_state *state)\n+{\n+    struct ofpbuf *request;\n+\n+    request = ofpbuf_new(NLMSG_HDRLEN + GENL_HDRLEN);\n+    nl_msg_put_dlgenmsg(request, 0, ovs_devlink_family, cmd,\n+                        NLM_F_REQUEST);\n+    nl_dump_start(&state->dump, NETLINK_GENERIC, request);\n+    ofpbuf_delete(request);\n+\n+    ofpbuf_init(&state->buf, NL_DUMP_BUFSIZE);\n+}\n+\n+static bool\n+nl_dl_dump_next__(struct nl_dl_dump_state *state,\n+                  bool (*parse_function)(struct ofpbuf *, void *),\n+                  void *entry)\n+{\n+    struct ofpbuf msg;\n+\n+    if (!nl_dump_next(&state->dump, &msg, &state->buf)) {\n+        return false;\n+    }\n+    if (!parse_function(&msg, entry)) {\n+        ovs_mutex_lock(&state->dump.mutex);\n+        state->dump.status = EPROTO;\n+        ovs_mutex_unlock(&state->dump.mutex);\n+        return false;\n+    }\n+    return true;\n+}\n+\n+/* Attempts to retrieve and parse another reply in on-going dump operation.\n+ *\n+ * If successful, returns true and assignes values or pointers to data in\n+ * 'port_entry'.  The caller must not modify 'port_entry' (because it may\n+ * contain pointers to data within the buffer which will be used by future\n+ * calls to this function.\n+ *\n+ * On failure, returns false.  Failure might indicate an actual error or merely\n+ * the end of replies.  An error status for the entire dump operation is\n+ * provided when it is completed by calling nl_dl_dump_finish()\n+ */\n+bool\n+nl_dl_port_dump_next(struct nl_dl_dump_state *state,\n+                     struct dl_port *port_entry)\n+{\n+    return nl_dl_dump_next__(\n+        state,\n+        (bool ( * )(struct ofpbuf *, void *)) &nl_dl_parse_port_policy,\n+        (void *) port_entry);\n+}\n+\n+bool\n+nl_dl_info_dump_next(struct nl_dl_dump_state *state,\n+                     struct dl_info *info_entry)\n+{\n+    return nl_dl_dump_next__(\n+        state,\n+        (bool ( * )(struct ofpbuf *, void *)) &nl_dl_parse_info_policy,\n+        (void *) info_entry);\n+}\n+\n+int\n+nl_dl_dump_finish(struct nl_dl_dump_state *state)\n+{\n+    ofpbuf_uninit(&state->buf);\n+    return nl_dump_done(&state->dump);\n+}\n+\n+static uint64_t\n+attr_get_up_to_u64(size_t attr_idx, struct nlattr *attrs[],\n+                   const struct nl_policy policy[],\n+                   size_t policy_len)\n+{\n+    if (attr_idx < policy_len && attrs[attr_idx]) {\n+        switch (policy[attr_idx].type) {\n+        case NL_A_U8:\n+            return nl_attr_get_u8(attrs[attr_idx]);\n+            break;\n+        case NL_A_U16:\n+            return nl_attr_get_u16(attrs[attr_idx]);\n+            break;\n+        case NL_A_U32:\n+            return nl_attr_get_u32(attrs[attr_idx]);\n+            break;\n+        case NL_A_U64:\n+            return nl_attr_get_u64(attrs[attr_idx]);\n+            break;\n+        case NL_A_U128:\n+        case NL_A_STRING:\n+        case NL_A_NO_ATTR:\n+        case NL_A_UNSPEC:\n+        case NL_A_FLAG:\n+        case NL_A_IPV6:\n+        case NL_A_NESTED:\n+        case NL_A_LL_ADDR:\n+        case N_NL_ATTR_TYPES: default: OVS_NOT_REACHED();\n+        };\n+    }\n+    return -1;\n+}\n+\n+static const char *\n+attr_get_str(size_t attr_idx, struct nlattr *attrs[],\n+             const struct nl_policy policy[],\n+             size_t policy_len)\n+{\n+    if (attr_idx < policy_len && attrs[attr_idx]) {\n+        ovs_assert(policy[attr_idx].type == NL_A_STRING);\n+        return nl_attr_get_string(attrs[attr_idx]);\n+    }\n+    return dl_str_not_present;\n+}\n+\n+bool\n+nl_dl_parse_port_function(struct nlattr *nla, struct dl_port_function *port_fn)\n+{\n+    static const struct nl_policy policy[] = {\n+        /* Appeared in Linux v5.9 */\n+        [DEVLINK_PORT_FUNCTION_ATTR_UNSPEC] = { .type = NL_A_UNSPEC,\n+                                                .optional = true, },\n+        [DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR] = { .type = NL_A_LL_ADDR,\n+                                                 .optional = true, },\n+\n+        /* Appeared in Linnux v5.12 */\n+        [DEVLINK_PORT_FN_ATTR_STATE] = { .type = NL_A_U8, .optional = true, },\n+        [DEVLINK_PORT_FN_ATTR_OPSTATE] = { .type = NL_A_U8,\n+                                           .optional = true, },\n+    };\n+    struct nlattr *attrs[ARRAY_SIZE(policy)];\n+    bool parsed;\n+\n+    parsed = nl_parse_nested(nla, policy, attrs, ARRAY_SIZE(policy));\n+\n+    if (parsed) {\n+        if (attrs[DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR]) {\n+            size_t hw_addr_size = nl_attr_get_size(\n+                            attrs[DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR]);\n+            if (hw_addr_size == sizeof(struct eth_addr)) {\n+                port_fn->eth_addr = nl_attr_get_eth_addr(\n+                                attrs[DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR]);\n+            } else if (hw_addr_size == sizeof(struct ib_addr)) {\n+                port_fn->ib_addr = nl_attr_get_ib_addr(\n+                                attrs[DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR]);\n+            } else {\n+                return false;\n+            }\n+        } else {\n+            memset(&port_fn->eth_addr, 0, sizeof(port_fn->eth_addr));\n+            memset(&port_fn->ib_addr, 0, sizeof(port_fn->ib_addr));\n+        }\n+        port_fn->state = attr_get_up_to_u64(\n+                        DEVLINK_PORT_FN_ATTR_STATE,\n+                        attrs, policy, ARRAY_SIZE(policy));\n+        port_fn->opstate = attr_get_up_to_u64(\n+                        DEVLINK_PORT_FN_ATTR_OPSTATE,\n+                        attrs, policy, ARRAY_SIZE(policy));\n+    }\n+\n+    return parsed;\n+}\n+\n+bool\n+nl_dl_parse_port_policy(struct ofpbuf *msg, struct dl_port *port)\n+{\n+    static const struct nl_policy policy[] = {\n+        /* Appeared in Linux v4.6 */\n+        [DEVLINK_ATTR_BUS_NAME] = { .type = NL_A_STRING, .optional = false, },\n+        [DEVLINK_ATTR_DEV_NAME] = { .type = NL_A_STRING, .optional = false, },\n+        [DEVLINK_ATTR_PORT_INDEX] = { .type = NL_A_U32, .optional = false, },\n+\n+        [DEVLINK_ATTR_PORT_TYPE] = { .type = NL_A_U16, .optional = true, },\n+        [DEVLINK_ATTR_PORT_DESIRED_TYPE] = { .type = NL_A_U16,\n+                                            .optional = true, },\n+        [DEVLINK_ATTR_PORT_NETDEV_IFINDEX] = { .type = NL_A_U32,\n+                                               .optional = true, },\n+        [DEVLINK_ATTR_PORT_NETDEV_NAME] = { .type = NL_A_STRING,\n+                                            .optional = true, },\n+        [DEVLINK_ATTR_PORT_IBDEV_NAME] = { .type = NL_A_STRING,\n+                                           .optional = true, },\n+        [DEVLINK_ATTR_PORT_SPLIT_COUNT] = { .type = NL_A_U32,\n+                                            .optional = true, },\n+        [DEVLINK_ATTR_PORT_SPLIT_GROUP] = { .type = NL_A_U32,\n+                                            .optional = true, },\n+\n+        /* Appeared in Linux v4.18 */\n+        [DEVLINK_ATTR_PORT_FLAVOUR] = { .type = NL_A_U16, .optional = true, },\n+        [DEVLINK_ATTR_PORT_NUMBER] = { .type = NL_A_U32, .optional = true, },\n+        [DEVLINK_ATTR_PORT_SPLIT_SUBPORT_NUMBER] = { .type = NL_A_U32,\n+                                                     .optional = true, },\n+\n+        /* Appeared in Linux v5.3 */\n+        [DEVLINK_ATTR_PORT_PCI_PF_NUMBER] = { .type = NL_A_U16,\n+                                              .optional = true, },\n+        [DEVLINK_ATTR_PORT_PCI_VF_NUMBER] = { .type = NL_A_U16,\n+                                              .optional = true, },\n+\n+        /* Appeared in Linux v5.9 */\n+        [DEVLINK_ATTR_PORT_FUNCTION] = { .type = NL_A_NESTED,\n+                                         .optional = true, },\n+        [DEVLINK_ATTR_PORT_LANES] = { .type = NL_A_U32, .optional = true, },\n+        [DEVLINK_ATTR_PORT_SPLITTABLE] = { .type = NL_A_U8,\n+                                           .optional = true, },\n+\n+        /* Appeared in Linux v5.10 */\n+        [DEVLINK_ATTR_PORT_EXTERNAL] = { .type = NL_A_U8, .optional = true },\n+        [DEVLINK_ATTR_PORT_CONTROLLER_NUMBER] = { .type = NL_A_U32,\n+                                                  .optional = true},\n+\n+        /* Appeared in Linux v5.12 */\n+        [DEVLINK_ATTR_PORT_PCI_SF_NUMBER] = { .type = NL_A_U32,\n+                                              .optional = true },\n+    };\n+    struct nlattr *attrs[ARRAY_SIZE(policy)];\n+\n+    if (!nl_policy_parse(msg, NLMSG_HDRLEN + GENL_HDRLEN,\n+                         policy, attrs,\n+                         ARRAY_SIZE(policy)))\n+    {\n+        return false;\n+    }\n+    port->bus_name = nl_attr_get_string(attrs[DEVLINK_ATTR_BUS_NAME]);\n+    port->dev_name = nl_attr_get_string(attrs[DEVLINK_ATTR_DEV_NAME]);\n+    port->index = nl_attr_get_u32(attrs[DEVLINK_ATTR_PORT_INDEX]);\n+\n+    port->type = attr_get_up_to_u64(\n+                    DEVLINK_ATTR_PORT_TYPE,\n+                    attrs, policy, ARRAY_SIZE(policy));\n+    port->desired_type = attr_get_up_to_u64(\n+                    DEVLINK_ATTR_PORT_DESIRED_TYPE,\n+                    attrs, policy, ARRAY_SIZE(policy));\n+    port->netdev_ifindex = attr_get_up_to_u64(\n+                    DEVLINK_ATTR_PORT_NETDEV_IFINDEX,\n+                    attrs, policy, ARRAY_SIZE(policy));\n+    if (port->type == DEVLINK_PORT_TYPE_ETH &&\n+            attrs[DEVLINK_ATTR_PORT_NETDEV_NAME]) {\n+        port->netdev_name = nl_attr_get_string(\n+            attrs[DEVLINK_ATTR_PORT_NETDEV_NAME]);\n+    } else if (port->type == DEVLINK_PORT_TYPE_IB &&\n+            attrs[DEVLINK_ATTR_PORT_IBDEV_NAME]) {\n+        port->ibdev_name = nl_attr_get_string(\n+            attrs[DEVLINK_ATTR_PORT_IBDEV_NAME]);\n+    } else {\n+        port->netdev_name = dl_str_not_present;\n+    }\n+    port->split_count = attr_get_up_to_u64(\n+                    DEVLINK_ATTR_PORT_SPLIT_COUNT,\n+                    attrs, policy, ARRAY_SIZE(policy));\n+    port->split_group = attr_get_up_to_u64(\n+                    DEVLINK_ATTR_PORT_SPLIT_GROUP,\n+                    attrs, policy, ARRAY_SIZE(policy));\n+    port->flavour = attr_get_up_to_u64(\n+                    DEVLINK_ATTR_PORT_FLAVOUR,\n+                    attrs, policy, ARRAY_SIZE(policy));\n+    port->number = attr_get_up_to_u64(\n+                    DEVLINK_ATTR_PORT_NUMBER,\n+                    attrs, policy, ARRAY_SIZE(policy));\n+    port->split_subport_number = attr_get_up_to_u64(\n+                    DEVLINK_ATTR_PORT_SPLIT_SUBPORT_NUMBER,\n+                    attrs, policy, ARRAY_SIZE(policy));\n+    port->pci_pf_number = attr_get_up_to_u64(\n+                    DEVLINK_ATTR_PORT_PCI_PF_NUMBER,\n+                    attrs, policy, ARRAY_SIZE(policy));\n+    port->pci_vf_number = attr_get_up_to_u64(\n+                    DEVLINK_ATTR_PORT_PCI_VF_NUMBER,\n+                    attrs, policy, ARRAY_SIZE(policy));\n+    port->lanes = attr_get_up_to_u64(\n+                    DEVLINK_ATTR_PORT_LANES,\n+                    attrs, policy, ARRAY_SIZE(policy));\n+    port->splittable = attr_get_up_to_u64(\n+                    DEVLINK_ATTR_PORT_SPLITTABLE,\n+                    attrs, policy, ARRAY_SIZE(policy));\n+    port->external = attr_get_up_to_u64(\n+                    DEVLINK_ATTR_PORT_EXTERNAL,\n+                    attrs, policy, ARRAY_SIZE(policy));\n+    port->controller_number = attr_get_up_to_u64(\n+                    DEVLINK_ATTR_PORT_CONTROLLER_NUMBER,\n+                    attrs, policy, ARRAY_SIZE(policy));\n+    port->pci_sf_number = attr_get_up_to_u64(\n+                    DEVLINK_ATTR_PORT_PCI_SF_NUMBER,\n+                    attrs, policy, ARRAY_SIZE(policy));\n+\n+    if (attrs[DEVLINK_ATTR_PORT_FUNCTION]) {\n+        if (!nl_dl_parse_port_function(attrs[DEVLINK_ATTR_PORT_FUNCTION],\n+                                       &port->function))\n+        {\n+            return false;\n+        }\n+    } else {\n+        memset(&port->function, 0, sizeof(port->function));\n+        port->function.state = UINT8_MAX;\n+        port->function.opstate = UINT8_MAX;\n+    }\n+\n+    return true;\n+}\n+\n+bool\n+nl_dl_parse_info_version(struct nlattr *nla, struct dl_info_version *info_ver)\n+{\n+    static const struct nl_policy policy[] = {\n+        /* Appeared in Linux v5.1 */\n+        [DEVLINK_ATTR_INFO_VERSION_NAME] = { .type = NL_A_STRING,\n+                                             .optional = true, },\n+        [DEVLINK_ATTR_INFO_VERSION_VALUE] = { .type = NL_A_STRING,\n+                                              .optional = true, },\n+    };\n+    struct nlattr *attrs[ARRAY_SIZE(policy)];\n+    bool parsed;\n+\n+    parsed = nl_parse_nested(nla, policy, attrs, ARRAY_SIZE(policy));\n+\n+    if (parsed) {\n+        info_ver->name = attr_get_str(\n+                        DEVLINK_ATTR_INFO_VERSION_NAME,\n+                        attrs, policy, ARRAY_SIZE(policy));\n+        info_ver->value = attr_get_str(\n+                        DEVLINK_ATTR_INFO_VERSION_NAME,\n+                        attrs, policy, ARRAY_SIZE(policy));\n+    }\n+\n+    return parsed;\n+}\n+\n+static bool\n+attr_fill_version(size_t attr_idx, struct nlattr *attrs[],\n+                  size_t attrs_len,\n+                  struct dl_info_version *version)\n+{\n+    if (attr_idx < attrs_len && attrs[attr_idx]) {\n+        if (!nl_dl_parse_info_version(attrs[attr_idx],\n+                                      version))\n+        {\n+            return false;\n+        }\n+    } else {\n+        version->name = dl_str_not_present;\n+        version->value = dl_str_not_present;\n+    }\n+    return true;\n+}\n+\n+bool\n+nl_dl_parse_info_policy(struct ofpbuf *msg, struct dl_info *info)\n+{\n+    static const struct nl_policy policy[] = {\n+        /* Appeared in Linux v5.1 */\n+        [DEVLINK_ATTR_INFO_DRIVER_NAME] = { .type = NL_A_STRING,\n+                                            .optional = false, },\n+        [DEVLINK_ATTR_INFO_SERIAL_NUMBER] = { .type = NL_A_STRING,\n+                                              .optional = true, },\n+        [DEVLINK_ATTR_INFO_VERSION_FIXED] = { .type = NL_A_NESTED,\n+                                              .optional = true, },\n+        [DEVLINK_ATTR_INFO_VERSION_RUNNING] = { .type = NL_A_NESTED,\n+                                                .optional = true, },\n+        [DEVLINK_ATTR_INFO_VERSION_STORED] = { .type = NL_A_NESTED,\n+                                               .optional = true, },\n+\n+        /* Appeared in Linux v5.9 */\n+        [DEVLINK_ATTR_INFO_BOARD_SERIAL_NUMBER] = { .type = NL_A_STRING,\n+                                                    .optional = true, },\n+    };\n+    struct nlattr *attrs[ARRAY_SIZE(policy)];\n+\n+    if (!nl_policy_parse(msg, NLMSG_HDRLEN + GENL_HDRLEN,\n+                         policy, attrs,\n+                         ARRAY_SIZE(policy)))\n+    {\n+        return false;\n+    }\n+    info->driver_name = attr_get_str(\n+                    DEVLINK_ATTR_INFO_DRIVER_NAME,\n+                    attrs, policy, ARRAY_SIZE(policy));\n+    info->serial_number = attr_get_str(\n+                    DEVLINK_ATTR_INFO_SERIAL_NUMBER,\n+                    attrs, policy, ARRAY_SIZE(policy));\n+    info->board_serial_number = attr_get_str(\n+                    DEVLINK_ATTR_INFO_BOARD_SERIAL_NUMBER,\n+                    attrs, policy, ARRAY_SIZE(policy));\n+    if (!attr_fill_version(DEVLINK_ATTR_INFO_VERSION_FIXED, attrs,\n+                           ARRAY_SIZE(policy), &info->version_fixed)\n+        || !attr_fill_version(DEVLINK_ATTR_INFO_VERSION_RUNNING, attrs,\n+                              ARRAY_SIZE(policy), &info->version_running)\n+        || !attr_fill_version(DEVLINK_ATTR_INFO_VERSION_STORED, attrs,\n+                              ARRAY_SIZE(policy), &info->version_stored))\n+    {\n+        return false;\n+    }\n+\n+    return true;\n+}\n+\n+static int\n+nl_devlink_init(void)\n+{\n+    static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER;\n+    static int error;\n+\n+    if (ovsthread_once_start(&once)) {\n+        error = nl_lookup_genl_family(DEVLINK_GENL_NAME, &ovs_devlink_family);\n+        if (error) {\n+            VLOG_INFO(\"Generic Netlink family '%s' does not exist. \"\n+                      \"Linux version 4.6 or newer required.\",\n+                      DEVLINK_GENL_NAME);\n+        }\n+        ovsthread_once_done(&once);\n+    }\n+    return error;\n+}\ndiff --git a/lib/plug_providers/representor/netlink-devlink.h b/lib/plug_providers/representor/netlink-devlink.h\nnew file mode 100644\nindex 000000000..a7b108435\n--- /dev/null\n+++ b/lib/plug_providers/representor/netlink-devlink.h\n@@ -0,0 +1,115 @@\n+/*\n+ * Copyright (c) 2021 Canonical\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at:\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+#ifndef NETLINK_DEVLINK_H\n+#define NETLINK_DEVLINK_H 1\n+\n+/* Presence of each individual value in these structs is determined at runtime\n+ * and depends on which kernel version we are communicating with as well as\n+ * which driver implementation is filling in the information for each\n+ * individual device or port.\n+ *\n+ * To signal non-presence of values the library follows the following\n+ * convention:\n+ *\n+ * - integer type values will be set to their maximum value\n+ *   (e.g. UNIT8_MAX for a unit8_t)\n+ *\n+ * - hardware address type values will be set to all zero\n+ *\n+ * - string type values will be set to a pointer to dl_str_not_present\n+ *   (an empty string).\n+ */\n+\n+extern const char *dl_str_not_present;\n+\n+struct dl_port_function {\n+    struct eth_addr eth_addr;\n+    struct ib_addr ib_addr;\n+    uint8_t state;\n+    uint8_t opstate;\n+};\n+\n+struct dl_port {\n+    const char *bus_name;\n+    const char *dev_name;\n+    uint32_t index;\n+    uint16_t type;\n+    uint16_t desired_type;\n+    uint32_t netdev_ifindex;\n+    union {\n+        const char *netdev_name; /* type DEVLINK_PORT_TYPE_ETH */\n+        const char *ibdev_name;  /* type DEVLINK_PORT_TYPE_IB */\n+    };\n+    uint32_t split_count;\n+    uint32_t split_group;\n+    uint16_t flavour;\n+    uint32_t number;\n+    uint32_t split_subport_number;\n+    uint16_t pci_pf_number;\n+    uint16_t pci_vf_number;\n+    struct dl_port_function function;\n+    uint32_t lanes;\n+    uint8_t splittable;\n+    uint8_t external;\n+    uint32_t controller_number;\n+    uint32_t pci_sf_number;\n+};\n+\n+struct dl_info_version {\n+    const char *name;\n+    const char *value;\n+};\n+\n+struct dl_info {\n+    const char *driver_name;\n+    const char *serial_number;\n+    const char *board_serial_number;\n+    struct dl_info_version version_fixed;\n+    struct dl_info_version version_running;\n+    struct dl_info_version version_stored;\n+};\n+\n+struct eth_addr nl_attr_get_eth_addr(const struct nlattr *nla);\n+struct ib_addr nl_attr_get_ib_addr(const struct nlattr *nla);\n+\n+/* The nl_dl_dump_state record declaration refers to types declared in\n+ * netlink-socket.h, which requires OVS internal autoconf macros and\n+ * definitions to be present for successful compilation.\n+ *\n+ * To enable friction free consumtion of these interfaces from programs\n+ * external to Open vSwitch, such as OVN, we keep the declaration of\n+ * nl_dl_dump_state private.\n+ *\n+ * Use the nl_dl_dump_init function to allocate memory for and get a pointer to\n+ * a devlink dump state object. The caller owns the allocated object and is\n+ * responsible for freeing the allocated memory when done. */\n+struct nl_dl_dump_state;\n+\n+struct nl_dl_dump_state * nl_dl_dump_init(void);\n+int nl_dl_dump_init_error(struct nl_dl_dump_state *);\n+void nl_dl_dump_destroy(struct nl_dl_dump_state *);\n+void nl_msg_put_dlgenmsg(struct ofpbuf *, size_t, int, uint8_t, uint32_t);\n+void nl_dl_dump_start(uint8_t, struct nl_dl_dump_state *);\n+bool nl_dl_port_dump_next(struct nl_dl_dump_state *, struct dl_port *);\n+bool nl_dl_info_dump_next(struct nl_dl_dump_state *, struct dl_info *);\n+int nl_dl_dump_finish(struct nl_dl_dump_state *);\n+bool nl_dl_parse_port_policy(struct ofpbuf *, struct dl_port *);\n+bool nl_dl_parse_port_function(struct nlattr *, struct dl_port_function *);\n+bool nl_dl_parse_info_policy(struct ofpbuf *, struct dl_info *);\n+bool nl_dl_parse_info_version(struct nlattr *, struct dl_info_version *);\n+\n+#endif /* NETLINK_DEVLINK_H */\ndiff --git a/lib/plug_providers/representor/plug-representor.c b/lib/plug_providers/representor/plug-representor.c\nnew file mode 100644\nindex 000000000..4c4187114\n--- /dev/null\n+++ b/lib/plug_providers/representor/plug-representor.c\n@@ -0,0 +1,307 @@\n+/* Copyright (c) 2021 Canonical\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at:\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+#include <config.h>\n+#include <errno.h>\n+#include <inttypes.h>\n+#include <linux/devlink.h>\n+#include <net/if.h>\n+\n+#include \"plug-provider.h\"\n+#include \"plug.h\"\n+\n+#include \"hash.h\"\n+#include \"lib/vswitch-idl.h\"\n+#include \"openvswitch/hmap.h\"\n+#include \"openvswitch/vlog.h\"\n+#include \"lib/ovn-sb-idl.h\"\n+#include \"netlink-devlink.h\"\n+#include \"openvswitch/shash.h\"\n+#include \"packets.h\"\n+\n+VLOG_DEFINE_THIS_MODULE(plug_representor);\n+\n+/* Contains netdev name of ports known to devlink indexed by PF MAC\n+ * address and logical function number (if applicable).\n+ *\n+ * Examples:\n+ *     SR-IOV Physical Function: key \"00:53:00:00:00:42\"    value \"pf0hpf\"\n+ *     SR-IOV Virtual Function:  key \"00:53:00:00:00:42-42\" value \"pf0vf42\"\n+ */\n+static struct shash devlink_ports;\n+\n+/* Max number of physical ports connected to a single NIC SoC. */\n+#define MAX_NIC_PHY_PORTS 64\n+/* string repr of eth MAC, '-', logical function number (uint32_t) */\n+#define MAX_KEY_LEN 17+1+10+1\n+\n+static bool compat_get_host_pf_mac(const char *, struct eth_addr *);\n+\n+static bool\n+fill_devlink_ports_key_from_strs(char *buf, size_t bufsiz,\n+                                const char *host_pf_mac,\n+                                const char *function)\n+{\n+    return snprintf(buf, bufsiz,\n+                    function != NULL ? \"%s-%s\": \"%s\",\n+                    host_pf_mac, function) < bufsiz;\n+}\n+\n+/* We deliberately pass the struct eth_addr by value as we would have to copy\n+ * the data either way to make use of the ETH_ADDR_ARGS macro */\n+static bool\n+fill_devlink_ports_key_from_typed(char *buf, size_t bufsiz,\n+                    struct eth_addr host_pf_mac,\n+                    uint32_t function)\n+{\n+    return snprintf(\n+        buf, bufsiz,\n+        function < UINT32_MAX ? ETH_ADDR_FMT\"-%\"PRIu32 : ETH_ADDR_FMT,\n+        ETH_ADDR_ARGS(host_pf_mac), function) < bufsiz;\n+}\n+\n+static void\n+devlink_port_add_function(struct dl_port *port_entry,\n+                          struct eth_addr *host_pf_mac)\n+{\n+    char keybuf[MAX_KEY_LEN];\n+    uint32_t function_number;\n+\n+    switch (port_entry->flavour) {\n+    case DEVLINK_PORT_FLAVOUR_PCI_PF:\n+        /* for Physical Function representor ports we only add the MAC address\n+         * and no logical function number */\n+        function_number = -1;\n+        break;\n+    case DEVLINK_PORT_FLAVOUR_PCI_VF:\n+        function_number = port_entry->pci_vf_number;\n+        break;\n+    default:\n+        VLOG_WARN(\"Unsupported flavour for port '%s': %s\",\n+            port_entry->netdev_name,\n+            port_entry->flavour == DEVLINK_PORT_FLAVOUR_PHYSICAL ? \"PHYSICAL\" :\n+            port_entry->flavour == DEVLINK_PORT_FLAVOUR_CPU ? \"CPU\" :\n+            port_entry->flavour == DEVLINK_PORT_FLAVOUR_DSA ? \"DSA\" :\n+            port_entry->flavour == DEVLINK_PORT_FLAVOUR_PCI_PF ? \"PCI_PF\":\n+            port_entry->flavour == DEVLINK_PORT_FLAVOUR_PCI_VF ? \"PCI_VF\":\n+            port_entry->flavour == DEVLINK_PORT_FLAVOUR_VIRTUAL ? \"VIRTUAL\":\n+            port_entry->flavour == DEVLINK_PORT_FLAVOUR_UNUSED ? \"UNUSED\":\n+            port_entry->flavour == DEVLINK_PORT_FLAVOUR_PCI_SF ? \"PCI_SF\":\n+            \"UNKNOWN\");\n+        return;\n+    };\n+    /* Failure to fill key from typed values means calculation of the max key\n+     * length is wrong, i.e. a bug. */\n+    ovs_assert(fill_devlink_ports_key_from_typed(\n+                            keybuf, sizeof(keybuf),\n+                            *host_pf_mac, function_number));\n+    shash_add(&devlink_ports, keybuf, xstrdup(port_entry->netdev_name));\n+}\n+\n+\n+static int\n+plug_representor_init(void)\n+{\n+    struct nl_dl_dump_state *port_dump;\n+    struct dl_port port_entry;\n+    int error;\n+    struct eth_addr host_pf_macs[MAX_NIC_PHY_PORTS];\n+\n+    shash_init(&devlink_ports);\n+\n+    port_dump = nl_dl_dump_init();\n+    if ((error = nl_dl_dump_init_error(port_dump))) {\n+        VLOG_WARN(\n+            \"unable to start dump of ports from devlink-port interface\");\n+        return error;\n+    }\n+    /* The core devlink infrastructure in the kernel keeps a linked list of\n+     * the devices and each of those has a linked list of ports. These are\n+     * populated by each device driver as devices are enumerated, and as such\n+     * we can rely on ports being dumped in a consistent order on a device\n+     * by device basis with logical numbering for each port flavour starting\n+     * on 0 for each new device.\n+     */\n+    nl_dl_dump_start(DEVLINK_CMD_PORT_GET, port_dump);\n+    while (nl_dl_port_dump_next(port_dump, &port_entry)) {\n+        switch (port_entry.flavour) {\n+        case DEVLINK_PORT_FLAVOUR_PHYSICAL:\n+            /* The PHYSICAL flavoured port represent a network facing port on\n+             * the NIC.\n+             *\n+             * For kernel versions where the devlink-port infrastructure does\n+             * not provide MAC address for PCI_PF flavoured ports, there exist\n+             * a interface in sysfs which is relative to the name of the\n+             * PHYSICAL port netdev name.\n+             *\n+             * Since we at this point in the dump do not know if the MAC will\n+             * be provided for the PCI_PF or not, proactively store the MAC\n+             * address by looking up through the sysfs interface.\n+             *\n+             * If MAC address is available once we get to the PCI_PF we will\n+             * overwrite the stored value.\n+             */\n+            if (port_entry.number > MAX_NIC_PHY_PORTS) {\n+                VLOG_WARN(\"physical port number out of range for port '%s': \"\n+                          \"%\"PRIu32,\n+                          port_entry.netdev_name, port_entry.number);\n+                continue;\n+            }\n+            compat_get_host_pf_mac(port_entry.netdev_name,\n+                                   &host_pf_macs[port_entry.number]);\n+            break;\n+        case DEVLINK_PORT_FLAVOUR_PCI_PF: /* FALL THROUGH */\n+            /* The PCI_PF flavoured port represent a host facing port.\n+             *\n+             * For function flavours other than PHYSICAL pci_pf_number will be\n+             * set to the logical number of which physical port the function\n+             * belongs.\n+             */\n+            if (!eth_addr_is_zero(port_entry.function.eth_addr)) {\n+                host_pf_macs[port_entry.pci_pf_number] =\n+                    port_entry.function.eth_addr;\n+            }\n+            /* FALL THROUGH */\n+        case DEVLINK_PORT_FLAVOUR_PCI_VF:\n+            /* The PCI_VF flavoured port represent a host facing\n+             * PCI Virtual Function.\n+             *\n+             * For function flavours other than PHYSICAL pci_pf_number will be\n+             * set to the logical number of which physical port the function\n+             * belongs.\n+             */\n+            if (port_entry.pci_pf_number > MAX_NIC_PHY_PORTS) {\n+                VLOG_WARN(\"physical port number out of range for port '%s': \"\n+                          \"%\"PRIu32,\n+                          port_entry.netdev_name, port_entry.pci_pf_number);\n+                continue;\n+            }\n+            devlink_port_add_function(&port_entry,\n+                                      &host_pf_macs[port_entry.pci_pf_number]);\n+            break;\n+        };\n+    }\n+    nl_dl_dump_finish(port_dump);\n+    nl_dl_dump_destroy(port_dump);\n+\n+    return 0;\n+}\n+\n+static int\n+plug_representor_destroy(void)\n+{\n+    shash_destroy_free_data(&devlink_ports);\n+\n+    return 0;\n+}\n+\n+static bool\n+plug_representor_port_prepare(const struct plug_port_ctx_in *ctx_in,\n+                              struct plug_port_ctx_out *ctx_out)\n+{\n+    char keybuf[MAX_KEY_LEN];\n+    const char *pf_mac = smap_get(ctx_in->lport_options,\n+                                  \"plug:representor:pf-mac\");\n+    const char *vf_num = smap_get(ctx_in->lport_options,\n+                                  \"plug:representor:vf-num\");\n+    if (!fill_devlink_ports_key_from_strs(keybuf, sizeof(keybuf),\n+                                          pf_mac, vf_num))\n+    {\n+        /* Overflow, most likely incorrect input data from database */\n+        VLOG_WARN(\"Southbound DB port plugging options out of range for \"\n+                  \"lport: %s pf-mac: '%s' vf-num: '%s'\",\n+                  ctx_in->lport_name, pf_mac, vf_num);\n+        return false;\n+    }\n+\n+    char *rep_port;\n+    rep_port = shash_find_data(&devlink_ports, keybuf);\n+    VLOG_INFO(\"plug_representor %s (%s) -> %s\",\n+              ctx_in->lport_name, rep_port, ctx_in->br_int->name);\n+    ctx_out->name = rep_port;\n+    ctx_out->type = NULL;\n+    ctx_out->iface_options = NULL;\n+    return true;\n+}\n+\n+static void\n+plug_representor_port_finish(const struct plug_port_ctx_in *ctx_in OVS_UNUSED,\n+                             struct plug_port_ctx_out *ctx_out OVS_UNUSED)\n+{\n+    /* Nothing to be done here for now */\n+}\n+\n+static void\n+plug_representor_port_ctx_destroy(\n+                const struct plug_port_ctx_in *ctx_in OVS_UNUSED,\n+                struct plug_port_ctx_out *ctx_out OVS_UNUSED)\n+{\n+    /* Noting to be done here for now */\n+}\n+\n+const struct plug_class plug_representor = {\n+    .type = \"representor\",\n+    .init = plug_representor_init,\n+    .destroy = plug_representor_destroy,\n+    .plug_get_maintained_iface_options = NULL, /* TODO */\n+    .run = NULL, /* TODO */\n+    .plug_port_prepare = plug_representor_port_prepare,\n+    .plug_port_finish = plug_representor_port_finish,\n+    .plug_port_ctx_destroy = plug_representor_port_ctx_destroy,\n+};\n+\n+/* The kernel devlink-port interface provides a vendor neutral and standard way\n+ * of discovering host visible resources such as MAC address of interfaces from\n+ * a program running on the NIC SoC side.\n+ *\n+ * However a fairly recent kernel version is required for it to work, so until\n+ * this is widely available we provide this helper to retrieve the same\n+ * information from the interim sysfs solution. */\n+static bool\n+compat_get_host_pf_mac(const char *netdev_name, struct eth_addr *ea)\n+{\n+    char file_name[IFNAMSIZ + 35 + 1];\n+    FILE *stream;\n+    char line[128];\n+    bool retval = false;\n+\n+    snprintf(file_name, sizeof(file_name),\n+             \"/sys/class/net/%s/smart_nic/pf/config\", netdev_name);\n+    stream = fopen(file_name, \"r\");\n+    if (!stream) {\n+        VLOG_WARN(\"%s: open failed (%s)\",\n+                  file_name, ovs_strerror(errno));\n+        *ea = eth_addr_zero;\n+        return false;\n+    }\n+    while (fgets(line, sizeof(line), stream)) {\n+        char key[16];\n+        char *cp;\n+        if (ovs_scan(line, \"%15[^:]: \", key)\n+            && key[0] == 'M' && key[1] == 'A' && key[2] == 'C')\n+        {\n+            /* strip any newline character */\n+            if ((cp = strchr(line, '\\n')) != NULL) {\n+                *cp = '\\0';\n+            }\n+            /* point cp at end of key + ': ', i.e. start of MAC address */\n+            cp = line + strnlen(key, sizeof(key)) + 2;\n+            retval = eth_addr_from_string(cp, ea);\n+            break;\n+        }\n+    }\n+    fclose(stream);\n+    return retval;\n+}\ndiff --git a/m4/ovn.m4 b/m4/ovn.m4\nindex 2909914fb..2f274fc65 100644\n--- a/m4/ovn.m4\n+++ b/m4/ovn.m4\n@@ -592,3 +592,29 @@ AC_DEFUN([OVS_CHECK_DDLOG_FAST_BUILD],\n    if $ddlog_fast_build; then\n       DDLOG_EXTRA_RUSTFLAGS=\"-C opt-level=z\"\n    fi])\n+\n+dnl Checks for Netlink support.\n+AC_DEFUN([OVS_CHECK_NETLINK],\n+  [AC_CHECK_HEADER([linux/netlink.h],\n+                   [HAVE_NETLINK=yes],\n+                   [HAVE_NETLINK=no],\n+                   [#include <sys/socket.h>\n+   ])\n+   AM_CONDITIONAL([HAVE_NETLINK], [test \"$HAVE_NETLINK\" = yes])\n+   if test \"$HAVE_NETLINK\" = yes; then\n+      AC_DEFINE([HAVE_NETLINK], [1],\n+                [Define to 1 if Netlink protocol is available.])\n+   fi])\n+\n+dnl OVS_CHECK_LINUX_NETLINK\n+dnl\n+dnl Configure Linux netlink compat.\n+AC_DEFUN([OVS_CHECK_LINUX_NETLINK], [\n+  AC_COMPILE_IFELSE([\n+    AC_LANG_PROGRAM([#include <linux/netlink.h>], [\n+        struct nla_bitfield32 x =  { 0 };\n+    ])],\n+    [AC_DEFINE([HAVE_NLA_BITFIELD32], [1],\n+    [Define to 1 if struct nla_bitfield32 is available.])])\n+])\n+\n",
    "prefixes": [
        "ovs-dev",
        "v4",
        "9/9"
    ]
}