get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2095635,
    "url": "http://patchwork.ozlabs.org/api/patches/2095635/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/ovn/patch/20250609173539.1636916-9-mmichels@redhat.com/",
    "project": {
        "id": 68,
        "url": "http://patchwork.ozlabs.org/api/projects/68/?format=api",
        "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": "<20250609173539.1636916-9-mmichels@redhat.com>",
    "list_archive_url": null,
    "date": "2025-06-09T17:35:27",
    "name": "[ovs-dev,08/14] northd: Convert ovn_stage from an enum to a struct.",
    "commit_ref": null,
    "pull_url": null,
    "state": "deferred",
    "archived": false,
    "hash": "d7d6bc84ed648d9b0583716e892b3ef9362c0914",
    "submitter": {
        "id": 71978,
        "url": "http://patchwork.ozlabs.org/api/people/71978/?format=api",
        "name": "Mark Michelson",
        "email": "mmichels@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/ovn/patch/20250609173539.1636916-9-mmichels@redhat.com/mbox/",
    "series": [
        {
            "id": 460139,
            "url": "http://patchwork.ozlabs.org/api/series/460139/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/ovn/list/?series=460139",
            "date": "2025-06-09T17:35:19",
            "name": "Logical Flow Sync Refactor.",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/460139/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2095635/comments/",
    "check": "success",
    "checks": "http://patchwork.ozlabs.org/api/patches/2095635/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@legolas.ozlabs.org",
            "ovs-dev@lists.linuxfoundation.org"
        ],
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=T3QwJ4Ba;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org\n (client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org;\n envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org)",
            "smtp2.osuosl.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key)\n header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=T3QwJ4Ba",
            "smtp3.osuosl.org; dmarc=pass (p=quarantine dis=none)\n header.from=redhat.com",
            "smtp3.osuosl.org;\n dkim=fail reason=\"signature verification failed\" (1024-bit key)\n header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=T3QwJ4Ba"
        ],
        "Received": [
            "from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4bGJx85Dt8z1yDx\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 10 Jun 2025 03:35:56 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby smtp2.osuosl.org (Postfix) with ESMTP id ECC9B41E4B;\n\tMon,  9 Jun 2025 17:36:08 +0000 (UTC)",
            "from smtp2.osuosl.org ([127.0.0.1])\n by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id mTxftRA3Djmt; Mon,  9 Jun 2025 17:36:05 +0000 (UTC)",
            "from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56])\n\tby smtp2.osuosl.org (Postfix) with ESMTPS id 8D41341E36;\n\tMon,  9 Jun 2025 17:36:03 +0000 (UTC)",
            "from lf-lists.osuosl.org (localhost [127.0.0.1])\n\tby lists.linuxfoundation.org (Postfix) with ESMTP id 66FB4C0AC5;\n\tMon,  9 Jun 2025 17:36:03 +0000 (UTC)",
            "from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136])\n by lists.linuxfoundation.org (Postfix) with ESMTP id 12BEBC0AC6\n for <dev@openvswitch.org>; Mon,  9 Jun 2025 17:36:02 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n by smtp3.osuosl.org (Postfix) with ESMTP id 144DD6144D\n for <dev@openvswitch.org>; Mon,  9 Jun 2025 17:35:56 +0000 (UTC)",
            "from smtp3.osuosl.org ([127.0.0.1])\n by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id RbY8bARuqRL4 for <dev@openvswitch.org>;\n Mon,  9 Jun 2025 17:35:52 +0000 (UTC)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n by smtp3.osuosl.org (Postfix) with ESMTPS id B54EA61472\n for <dev@openvswitch.org>; Mon,  9 Jun 2025 17:35:50 +0000 (UTC)",
            "from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-58-CvH0zfcRPcyvfu8CRtmYJg-1; Mon,\n 09 Jun 2025 13:35:48 -0400",
            "from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111])\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 mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id 509F318089B8\n for <dev@openvswitch.org>; Mon,  9 Jun 2025 17:35:47 +0000 (UTC)",
            "from localhost.localdomain.com (unknown [10.22.58.15])\n by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id AA4661800285\n for <dev@openvswitch.org>; Mon,  9 Jun 2025 17:35:46 +0000 (UTC)"
        ],
        "X-Virus-Scanned": [
            "amavis at osuosl.org",
            "amavis at osuosl.org"
        ],
        "X-Comment": "SPF check N/A for local connections - client-ip=140.211.9.56;\n helo=lists.linuxfoundation.org;\n envelope-from=ovs-dev-bounces@openvswitch.org; receiver=<UNKNOWN> ",
        "DKIM-Filter": [
            "OpenDKIM Filter v2.11.0 smtp2.osuosl.org 8D41341E36",
            "OpenDKIM Filter v2.11.0 smtp3.osuosl.org B54EA61472"
        ],
        "Received-SPF": "Pass (mailfrom) identity=mailfrom; client-ip=170.10.133.124;\n helo=us-smtp-delivery-124.mimecast.com; envelope-from=mmichels@redhat.com;\n receiver=<UNKNOWN>",
        "DMARC-Filter": "OpenDMARC Filter v1.4.2 smtp3.osuosl.org B54EA61472",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1749490549;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=IvbDKMMwgmaOngpLVbZfW5zjafqsgSx/T9666SjfqxE=;\n b=T3QwJ4Ba0zqPC+NwG9qYLptOVF7fiPVwWe8IiReUITQ5xc0m3NZ/bBPMR2TyCtKNXJ6lma\n X72UzzA1YGQFJEfHREqH1RDLGgXwTSVn8nWR9MK6qrj0oIogy06J3Y7qNWFnOalvD+AXbb\n xafgWsdPi+KQPkkrF3cxm+0QQY15dMk=",
        "X-MC-Unique": "CvH0zfcRPcyvfu8CRtmYJg-1",
        "X-Mimecast-MFC-AGG-ID": "CvH0zfcRPcyvfu8CRtmYJg_1749490547",
        "To": "dev@openvswitch.org",
        "Date": "Mon,  9 Jun 2025 13:35:27 -0400",
        "Message-ID": "<20250609173539.1636916-9-mmichels@redhat.com>",
        "In-Reply-To": "<20250609173539.1636916-1-mmichels@redhat.com>",
        "References": "<20250609173539.1636916-1-mmichels@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 3.4.1 on 10.30.177.111",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-MFC-PROC-ID": "mB0IGMCXArmwhxKDv0bRc9pUM-NbSdVINd-eUXOax8g_1749490547",
        "X-Mimecast-Originator": "redhat.com",
        "Subject": "[ovs-dev] [PATCH ovn 08/14] northd: Convert ovn_stage from an enum\n to a struct.",
        "X-BeenThere": "ovs-dev@openvswitch.org",
        "X-Mailman-Version": "2.1.30",
        "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>",
        "From": "Mark Michelson via dev <ovs-dev@openvswitch.org>",
        "Reply-To": "Mark Michelson <mmichels@redhat.com>",
        "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": "The enum version of ovn_stage was too tightly coupled with the\nparticular stages used by ovn-northd for logical switches and logical\nrouters. Using a struct allows for more flexibility for other logical\ndatapaths.\n\nSigned-off-by: Mark Michelson <mmichels@redhat.com>\n---\n northd/lflow-mgr.c | 33 ++++++++--------\n northd/lflow-mgr.h |  4 +-\n northd/northd.c    | 96 ++++++++++++++++++++++++++++------------------\n northd/northd.h    | 65 ++++++++++++++-----------------\n 4 files changed, 105 insertions(+), 93 deletions(-)",
    "diff": "diff --git a/northd/lflow-mgr.c b/northd/lflow-mgr.c\nindex a4f061b1f..0f7b989cf 100644\n--- a/northd/lflow-mgr.c\n+++ b/northd/lflow-mgr.c\n@@ -35,13 +35,13 @@ struct ovn_lflow;\n \n static void ovn_lflow_init(struct ovn_lflow *,\n                            const struct sbrec_datapath_binding *sb_dp,\n-                           size_t dp_bitmap_len, enum ovn_stage stage,\n+                           size_t dp_bitmap_len, const struct ovn_stage *stage,\n                            uint16_t priority, char *match,\n                            char *actions, char *io_port,\n                            char *ctrl_meter, char *stage_hint,\n                            const char *where, const char *flow_desc);\n static struct ovn_lflow *ovn_lflow_find(const struct hmap *lflows,\n-                                        enum ovn_stage stage,\n+                                        const struct ovn_stage *stage,\n                                         uint16_t priority, const char *match,\n                                         const char *actions,\n                                         const char *ctrl_meter, uint32_t hash);\n@@ -51,7 +51,7 @@ static char *ovn_lflow_hint(const struct ovsdb_idl_row *row);\n \n static struct ovn_lflow *do_ovn_lflow_add(\n     struct lflow_table *, size_t dp_bitmap_len, uint32_t hash,\n-    enum ovn_stage stage, uint16_t priority, const char *match,\n+    const struct ovn_stage *stage, uint16_t priority, const char *match,\n     const char *actions, const char *io_port,\n     const char *ctrl_meter,\n     const struct ovsdb_idl_row *stage_hint,\n@@ -164,7 +164,7 @@ struct ovn_lflow {\n \n     const struct sbrec_datapath_binding *sb_dp;\n     unsigned long *dpg_bitmap;   /* Bitmap of all datapaths by their 'index'.*/\n-    enum ovn_stage stage;\n+    const struct ovn_stage *stage;\n     uint16_t priority;\n     char *match;\n     char *actions;\n@@ -300,10 +300,11 @@ lflow_table_sync_to_sb(struct lflow_table *lflow_table,\n          * datapaths, we should only get valid datapath types here.\n          */\n         ovs_assert(dp_type < DP_MAX);\n+        struct ovn_stage stage = ovn_stage_build(dp_type, pipeline,\n+                                                 sbflow->table_id);\n \n         lflow = ovn_lflow_find(\n-            lflows,\n-            ovn_stage_build(dp_type, pipeline, sbflow->table_id),\n+            lflows, &stage,\n             sbflow->priority, sbflow->match, sbflow->actions,\n             sbflow->controller_meter, sbflow->hash);\n         if (lflow) {\n@@ -685,7 +686,7 @@ void\n lflow_table_add_lflow(struct lflow_table *lflow_table,\n                       const struct ovn_datapath *od,\n                       const unsigned long *dp_bitmap, size_t dp_bitmap_len,\n-                      enum ovn_stage stage, uint16_t priority,\n+                      const struct ovn_stage *stage, uint16_t priority,\n                       const char *match, const char *actions,\n                       const char *io_port, const char *ctrl_meter,\n                       const struct ovsdb_idl_row *stage_hint,\n@@ -757,7 +758,7 @@ lflow_table_add_lflow(struct lflow_table *lflow_table,\n void\n lflow_table_add_lflow_default_drop(struct lflow_table *lflow_table,\n                                    const struct ovn_datapath *od,\n-                                   enum ovn_stage stage,\n+                                   const struct ovn_stage *stage,\n                                    const char *where,\n                                    struct lflow_ref *lflow_ref)\n {\n@@ -880,9 +881,9 @@ lflow_hash_lock_destroy(void)\n static void\n ovn_lflow_init(struct ovn_lflow *lflow,\n                const struct sbrec_datapath_binding *sb_dp,\n-               size_t dp_bitmap_len, enum ovn_stage stage, uint16_t priority,\n-               char *match, char *actions, char *io_port, char *ctrl_meter,\n-               char *stage_hint, const char *where,\n+               size_t dp_bitmap_len, const struct ovn_stage *stage,\n+               uint16_t priority, char *match, char *actions, char *io_port,\n+               char *ctrl_meter, char *stage_hint, const char *where,\n                const char *flow_desc)\n {\n     lflow->dpg_bitmap = bitmap_allocate(dp_bitmap_len);\n@@ -928,11 +929,11 @@ lflow_hash_unlock(struct ovs_mutex *hash_lock)\n }\n \n static bool\n-ovn_lflow_equal(const struct ovn_lflow *a, enum ovn_stage stage,\n+ovn_lflow_equal(const struct ovn_lflow *a, const struct ovn_stage *stage,\n                 uint16_t priority, const char *match,\n                 const char *actions, const char *ctrl_meter)\n {\n-    return (a->stage == stage\n+    return (ovn_stage_equal(a->stage, stage)\n             && a->priority == priority\n             && !strcmp(a->match, match)\n             && !strcmp(a->actions, actions)\n@@ -941,7 +942,7 @@ ovn_lflow_equal(const struct ovn_lflow *a, enum ovn_stage stage,\n \n static struct ovn_lflow *\n ovn_lflow_find(const struct hmap *lflows,\n-               enum ovn_stage stage, uint16_t priority,\n+               const struct ovn_stage *stage, uint16_t priority,\n                const char *match, const char *actions,\n                const char *ctrl_meter, uint32_t hash)\n {\n@@ -984,8 +985,8 @@ ovn_lflow_destroy(struct lflow_table *lflow_table, struct ovn_lflow *lflow)\n \n static struct ovn_lflow *\n do_ovn_lflow_add(struct lflow_table *lflow_table, size_t dp_bitmap_len,\n-                 uint32_t hash, enum ovn_stage stage, uint16_t priority,\n-                 const char *match, const char *actions,\n+                 uint32_t hash, const struct ovn_stage *stage,\n+                 uint16_t priority, const char *match, const char *actions,\n                  const char *io_port, const char *ctrl_meter,\n                  const struct ovsdb_idl_row *stage_hint,\n                  const char *where, const char *flow_desc)\ndiff --git a/northd/lflow-mgr.h b/northd/lflow-mgr.h\nindex 2e454ce63..4e8aace07 100644\n--- a/northd/lflow-mgr.h\n+++ b/northd/lflow-mgr.h\n@@ -83,7 +83,7 @@ bool lflow_ref_sync_lflows(struct lflow_ref *,\n \n void lflow_table_add_lflow(struct lflow_table *, const struct ovn_datapath *,\n                            const unsigned long *dp_bitmap,\n-                           size_t dp_bitmap_len, enum ovn_stage stage,\n+                           size_t dp_bitmap_len, const struct ovn_stage *stage,\n                            uint16_t priority, const char *match,\n                            const char *actions, const char *io_port,\n                            const char *ctrl_meter,\n@@ -92,7 +92,7 @@ void lflow_table_add_lflow(struct lflow_table *, const struct ovn_datapath *,\n                            struct lflow_ref *);\n void lflow_table_add_lflow_default_drop(struct lflow_table *,\n                                         const struct ovn_datapath *,\n-                                        enum ovn_stage stage,\n+                                        const struct ovn_stage *stage,\n                                         const char *where,\n                                         struct lflow_ref *);\n \ndiff --git a/northd/northd.c b/northd/northd.c\nindex 0d450738d..3016be949 100644\n--- a/northd/northd.c\n+++ b/northd/northd.c\n@@ -349,18 +349,33 @@ static const char *reg_ct_state[] = {\n #define ROUTE_PRIO_OFFSET_STATIC 4\n #define ROUTE_PRIO_OFFSET_CONNECTED 6\n \n+/* ovn_stages used by northd for logical switches and logical routers.\n+ * The first three components are combined to form the constant stage's\n+ * struct name, e.g. S_SWITCH_IN_PORT_SEC_L2, S_ROUTER_OUT_DELIVERY.\n+ */\n+#define PIPELINE_STAGE(DP_TYPE, PIPELINE, STAGE, TABLE, NAME)   \\\n+    static const struct ovn_stage T_##DP_TYPE##_##PIPELINE##_##STAGE = {   \\\n+        DP_##DP_TYPE, P_##PIPELINE, TABLE, NAME                       \\\n+    };                                                                \\\n+    static const struct ovn_stage *S_##DP_TYPE##_##PIPELINE##_##STAGE = \\\n+        &T_##DP_TYPE##_##PIPELINE##_##STAGE;\n+    PIPELINE_STAGES\n+#undef PIPELINE_STAGE\n+\n /* Returns the type of the datapath to which a flow with the given 'stage' may\n  * be added. */\n enum ovn_datapath_type\n-ovn_stage_to_datapath_type(enum ovn_stage stage)\n+ovn_stage_to_datapath_type(const struct ovn_stage *stage)\n {\n-    switch (stage) {\n-#define PIPELINE_STAGE(DP_TYPE, PIPELINE, STAGE, TABLE, NAME)       \\\n-        case S_##DP_TYPE##_##PIPELINE##_##STAGE: return DP_##DP_TYPE;\n-    PIPELINE_STAGES\n-#undef PIPELINE_STAGE\n-    default: OVS_NOT_REACHED();\n-    }\n+    return stage->dp_type;\n+}\n+\n+bool\n+ovn_stage_equal(const struct ovn_stage *a, const struct ovn_stage *b)\n+{\n+    return a->dp_type == b->dp_type &&\n+           a->pipeline == b->pipeline &&\n+           a->table == b->table;\n }\n \f\n static uint32_t\n@@ -5253,7 +5268,7 @@ build_mirror_lflow(struct ovn_port *op,\n {\n     struct ds match = DS_EMPTY_INITIALIZER;\n     struct ds action = DS_EMPTY_INITIALIZER;\n-    enum ovn_stage stage;\n+    const struct ovn_stage *stage;\n     const char *dir;\n     uint32_t priority = OVN_LPORT_MIRROR_OFFSET + rule->priority;\n \n@@ -5285,7 +5300,7 @@ build_mirror_pass_lflow(struct ovn_port *op,\n {\n     struct ds match = DS_EMPTY_INITIALIZER;\n     struct ds action = DS_EMPTY_INITIALIZER;\n-    enum ovn_stage stage;\n+    const struct ovn_stage *stage;\n     const char *dir;\n \n     if (egress) {\n@@ -5554,8 +5569,9 @@ build_lswitch_output_port_sec_od(struct ovn_datapath *od,\n \n static void\n skip_port_from_conntrack(const struct ovn_datapath *od, struct ovn_port *op,\n-                         bool has_stateful_acl, enum ovn_stage in_stage,\n-                         enum ovn_stage out_stage, uint16_t priority,\n+                         bool has_stateful_acl,\n+                         const struct ovn_stage *in_stage,\n+                         const struct ovn_stage *out_stage, uint16_t priority,\n                          struct lflow_table *lflows,\n                          struct lflow_ref *lflow_ref)\n {\n@@ -6009,13 +6025,13 @@ build_acl_hints(const struct ls_stateful_record *ls_stateful_rec,\n      * corresponding to all potential matches are set.\n      */\n \n-    enum ovn_stage stages[] = {\n+    const struct ovn_stage *stages[] = {\n         S_SWITCH_IN_ACL_HINT,\n         S_SWITCH_OUT_ACL_HINT,\n     };\n \n     for (size_t i = 0; i < ARRAY_SIZE(stages); i++) {\n-        enum ovn_stage stage = stages[i];\n+        const struct ovn_stage *stage = stages[i];\n \n         /* In any case, advance to the next stage. */\n         if (!ls_stateful_rec->has_acls && !ls_stateful_rec->has_lb_vip) {\n@@ -6297,7 +6313,7 @@ build_acl_sample_label_match(struct ds *match, const struct nbrec_acl *acl,\n static void\n build_acl_sample_new_flows(const struct ovn_datapath *od,\n                            struct lflow_table *lflows,\n-                           enum ovn_stage stage,\n+                           const struct ovn_stage *stage,\n                            struct ds *match, struct ds *actions,\n                            const struct nbrec_acl *acl,\n                            uint8_t sample_domain_id, bool stateful,\n@@ -6335,7 +6351,7 @@ build_acl_sample_new_flows(const struct ovn_datapath *od,\n static void\n build_acl_sample_est_orig_stateful_flows(const struct ovn_datapath *od,\n                                          struct lflow_table *lflows,\n-                                         enum ovn_stage stage,\n+                                         const struct ovn_stage *stage,\n                                          struct ds *match, struct ds *actions,\n                                          const struct nbrec_acl *acl,\n                                          uint8_t sample_domain_id,\n@@ -6368,7 +6384,7 @@ build_acl_sample_est_orig_stateful_flows(const struct ovn_datapath *od,\n static void\n build_acl_sample_est_rpl_stateful_flows(const struct ovn_datapath *od,\n                                         struct lflow_table *lflows,\n-                                        enum ovn_stage rpl_stage,\n+                                        const struct ovn_stage *rpl_stage,\n                                         struct ds *match, struct ds *actions,\n                                         const struct nbrec_acl *acl,\n                                         uint8_t sample_domain_id,\n@@ -6396,7 +6412,7 @@ build_acl_sample_est_rpl_stateful_flows(const struct ovn_datapath *od,\n static void\n build_acl_sample_est_stateful_flows(const struct ovn_datapath *od,\n                                     struct lflow_table *lflows,\n-                                    enum ovn_stage stage,\n+                                    const struct ovn_stage *stage,\n                                     struct ds *match, struct ds *actions,\n                                     const struct nbrec_acl *acl,\n                                     uint8_t sample_domain_id,\n@@ -6410,9 +6426,9 @@ build_acl_sample_est_stateful_flows(const struct ovn_datapath *od,\n \n     /* Install flows in the \"opposite\" pipeline direction to handle reply\n      * traffic on established connections. */\n-    enum ovn_stage rpl_stage = (stage == S_SWITCH_OUT_ACL_SAMPLE\n-                                ? S_SWITCH_IN_ACL_SAMPLE\n-                                : S_SWITCH_OUT_ACL_SAMPLE);\n+    const struct ovn_stage *rpl_stage = (stage == S_SWITCH_OUT_ACL_SAMPLE\n+                                         ? S_SWITCH_IN_ACL_SAMPLE\n+                                         : S_SWITCH_OUT_ACL_SAMPLE);\n     build_acl_sample_est_rpl_stateful_flows(od, lflows, rpl_stage,\n                                             match, actions,\n                                             acl, sample_domain_id, lflow_ref);\n@@ -6427,7 +6443,7 @@ static void build_acl_reject_action(struct ds *actions, bool is_ingress);\n static void\n build_acl_sample_generic_new_flows(const struct ovn_datapath *od,\n                                    struct lflow_table *lflows,\n-                                   enum ovn_stage stage,\n+                                   const struct ovn_stage *stage,\n                                    enum acl_observation_stage obs_stage,\n                                    struct ds *match, struct ds *actions,\n                                    const struct nbrec_sample_collector *coll,\n@@ -6474,7 +6490,7 @@ build_acl_sample_generic_new_flows(const struct ovn_datapath *od,\n static void\n build_acl_sample_generic_est_flows(const struct ovn_datapath *od,\n                                    struct lflow_table *lflows,\n-                                   enum ovn_stage stage,\n+                                   const struct ovn_stage *stage,\n                                    enum acl_observation_stage obs_stage,\n                                    struct ds *match, struct ds *actions,\n                                    const struct nbrec_sample_collector *coll,\n@@ -6505,9 +6521,9 @@ build_acl_sample_generic_est_flows(const struct ovn_datapath *od,\n     ovn_lflow_add(lflows, od, stage, 1000, ds_cstr(match),\n                   ds_cstr(actions), lflow_ref);\n \n-    enum ovn_stage rpl_stage = (stage == S_SWITCH_OUT_ACL_SAMPLE\n-                                ? S_SWITCH_IN_ACL_SAMPLE\n-                                : S_SWITCH_OUT_ACL_SAMPLE);\n+    const struct ovn_stage *rpl_stage = (stage == S_SWITCH_OUT_ACL_SAMPLE\n+                                         ? S_SWITCH_IN_ACL_SAMPLE\n+                                         : S_SWITCH_OUT_ACL_SAMPLE);\n \n     ds_truncate(match, match_len);\n     ds_put_format(match, \"ct.rpl && ct_mark.obs_collector_id == %\"PRIu8,\n@@ -6560,7 +6576,7 @@ build_acl_sample_flows(const struct ls_stateful_record *ls_stateful_rec,\n     }\n \n     bool ingress = !strcmp(acl->direction, \"from-lport\") ? true : false;\n-    enum ovn_stage stage;\n+    const struct ovn_stage *stage;\n     enum acl_observation_stage obs_stage;\n \n     if (ingress && smap_get_bool(&acl->options, \"apply-after-lb\", false)) {\n@@ -6633,7 +6649,7 @@ consider_acl(struct lflow_table *lflows, const struct ovn_datapath *od,\n              const struct sbrec_acl_id_table *sbrec_acl_id_table)\n {\n     bool ingress = !strcmp(acl->direction, \"from-lport\") ? true :false;\n-    enum ovn_stage stage;\n+    const struct ovn_stage *stage;\n     enum acl_observation_stage obs_stage;\n \n     if (ingress && smap_get_bool(&acl->options, \"apply-after-lb\", false)) {\n@@ -6916,13 +6932,13 @@ build_acl_action_lflows(const struct ls_stateful_record *ls_stateful_rec,\n                         struct ds *actions,\n                         struct lflow_ref *lflow_ref)\n {\n-    enum ovn_stage stages [] = {\n+    const struct ovn_stage *stages [] = {\n         S_SWITCH_IN_ACL_ACTION,\n         S_SWITCH_IN_ACL_AFTER_LB_ACTION,\n         S_SWITCH_OUT_ACL_ACTION,\n     };\n \n-    enum ovn_stage eval_stages[] = {\n+    const struct ovn_stage *eval_stages[] = {\n         S_SWITCH_IN_ACL_EVAL,\n         S_SWITCH_IN_ACL_AFTER_LB_EVAL,\n         S_SWITCH_OUT_ACL_EVAL,\n@@ -6941,7 +6957,7 @@ build_acl_action_lflows(const struct ls_stateful_record *ls_stateful_rec,\n \n     size_t verdict_len = actions->length;\n     for (size_t i = 0; i < ARRAY_SIZE(stages); i++) {\n-        enum ovn_stage stage = stages[i];\n+        const struct ovn_stage *stage = stages[i];\n         if (max_acl_tiers[i]) {\n             ds_put_cstr(actions, REG_ACL_TIER \" = 0; \");\n         }\n@@ -7031,7 +7047,7 @@ build_acl_log_related_flows(const struct ovn_datapath *od,\n     /* Related/reply flows need to be set on the opposite pipeline\n      * from where the ACL itself is set.\n      */\n-    enum ovn_stage log_related_stage = ingress ?\n+    const struct ovn_stage *log_related_stage = ingress ?\n         S_SWITCH_OUT_ACL_EVAL :\n         S_SWITCH_IN_ACL_EVAL;\n     ds_clear(match);\n@@ -7378,7 +7394,9 @@ build_qos(struct ovn_datapath *od, struct lflow_table *lflows,\n     for (size_t i = 0; i < od->nbs->n_qos_rules; i++) {\n         struct nbrec_qos *qos = od->nbs->qos_rules[i];\n         bool ingress = !strcmp(qos->direction, \"from-lport\") ? true :false;\n-        enum ovn_stage stage = ingress ? S_SWITCH_IN_QOS : S_SWITCH_OUT_QOS;\n+        const struct ovn_stage *stage = ingress\n+            ? S_SWITCH_IN_QOS\n+            : S_SWITCH_OUT_QOS;\n         static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 1);\n         int64_t rate = 0;\n         int64_t burst = 0;\n@@ -12326,7 +12344,9 @@ lrouter_nat_add_ext_ip_match(const struct ovn_datapath *od,\n                       allowed_ext_ips->name);\n     } else if (exempted_ext_ips) {\n         struct ds match_exempt = DS_EMPTY_INITIALIZER;\n-        enum ovn_stage stage = is_src ? S_ROUTER_IN_DNAT : S_ROUTER_OUT_SNAT;\n+        const struct ovn_stage *stage = is_src\n+            ? S_ROUTER_IN_DNAT\n+            : S_ROUTER_OUT_SNAT;\n \n         /* Priority of logical flows corresponding to exempted_ext_ips is\n          * +2 of the corresponding regular NAT rule.\n@@ -12584,7 +12604,7 @@ build_lrouter_port_nat_arp_nd_flow(struct ovn_port *op,\n static void\n build_lrouter_drop_own_dest(struct ovn_port *op,\n                             const struct lr_stateful_record *lr_stateful_rec,\n-                            enum ovn_stage stage,\n+                            const struct ovn_stage *stage,\n                             uint16_t priority, bool drop_snat_ip,\n                             struct lflow_table *lflows,\n                             struct lflow_ref *lflow_ref)\n@@ -13001,7 +13021,7 @@ build_gateway_get_l2_hdr_size(struct ovn_port *op)\n  */\n static void OVS_PRINTF_FORMAT(10, 11)\n build_gateway_mtu_flow(struct lflow_table *lflows, struct ovn_port *op,\n-                       enum ovn_stage stage, uint16_t prio_low,\n+                       const struct ovn_stage *stage, uint16_t prio_low,\n                        uint16_t prio_high, struct ds *match,\n                        struct ds *actions, const struct ovsdb_idl_row *hint,\n                        struct lflow_ref *lflow_ref,\n@@ -14401,7 +14421,7 @@ create_icmp_need_frag_lflow(const struct ovn_port *op, int mtu,\n                             struct ds *actions, struct ds *match,\n                             const char *meter, struct lflow_table *lflows,\n                             struct lflow_ref *lflow_ref,\n-                            enum ovn_stage stage, uint16_t priority,\n+                            const struct ovn_stage *stage, uint16_t priority,\n                             bool is_ipv6, const char *extra_match,\n                             const char *extra_action)\n {\n@@ -14439,7 +14459,7 @@ static void\n build_icmperr_pkt_big_flows(struct ovn_port *op, int mtu,\n                             struct lflow_table *lflows,\n                             const struct shash *meter_groups, struct ds *match,\n-                            struct ds *actions, enum ovn_stage stage,\n+                            struct ds *actions, const struct ovn_stage *stage,\n                             struct ovn_port *outport,\n                             const char *ct_state_match,\n                             struct lflow_ref *lflow_ref)\ndiff --git a/northd/northd.h b/northd/northd.h\nindex 0239f40fe..3de8fc17a 100644\n--- a/northd/northd.h\n+++ b/northd/northd.h\n@@ -455,21 +455,6 @@ ovn_datapath_is_stale(const struct ovn_datapath *od)\n };\n \n /* Pipeline stages. */\n-/* Returns an \"enum ovn_stage\" built from the arguments.\n- *\n- * (It's better to use ovn_stage_build() for type-safety reasons, but inline\n- * functions can't be used in enums or switch cases.) */\n-#define OVN_STAGE_BUILD(DP_TYPE, PIPELINE, TABLE) \\\n-    (((DP_TYPE) << 9) | ((PIPELINE) << 8) | (TABLE))\n-\n-/* A stage within an OVN logical switch or router.\n- *\n- * An \"enum ovn_stage\" indicates whether the stage is part of a logical switch\n- * or router, whether the stage is part of the ingress or egress pipeline, and\n- * the table within that pipeline.  The first three components are combined to\n- * form the stage's full name, e.g. S_SWITCH_IN_PORT_SEC_L2,\n- * S_ROUTER_OUT_DELIVERY. */\n-enum ovn_stage {\n #define PIPELINE_STAGES                                                   \\\n     /* Logical switch ingress stages. */                                  \\\n     PIPELINE_STAGE(SWITCH, IN,  CHECK_PORT_SEC, 0, \"ls_in_check_port_sec\")   \\\n@@ -564,14 +549,23 @@ enum ovn_stage {\n     PIPELINE_STAGE(ROUTER, OUT, EGR_LOOP,           5, \"lr_out_egr_loop\")    \\\n     PIPELINE_STAGE(ROUTER, OUT, DELIVERY,           6, \"lr_out_delivery\")\n \n-#define PIPELINE_STAGE(DP_TYPE, PIPELINE, STAGE, TABLE, NAME)   \\\n-    S_##DP_TYPE##_##PIPELINE##_##STAGE                          \\\n-        = OVN_STAGE_BUILD(DP_##DP_TYPE, P_##PIPELINE, TABLE),\n-    PIPELINE_STAGES\n-#undef PIPELINE_STAGE\n+/* A stage within an OVN logical switch or router.\n+ *\n+ * A \"struct ovn_stage\" indicates whether the stage is part of a logical switch\n+ * or router, whether the stage is part of the ingress or egress pipeline, and\n+ * the table within that pipeline.\n+ */\n+struct ovn_stage {\n+    enum ovn_datapath_type dp_type;\n+    enum ovn_pipeline pipeline;\n+    int table;\n+    const char *name;\n };\n \n-enum ovn_datapath_type ovn_stage_to_datapath_type(enum ovn_stage stage);\n+bool ovn_stage_equal(const struct ovn_stage *a, const struct ovn_stage *b);\n+\n+enum ovn_datapath_type ovn_stage_to_datapath_type(\n+    const struct ovn_stage *stage);\n \n \n /* Returns 'od''s datapath type. */\n@@ -581,46 +575,43 @@ ovn_datapath_get_type(const struct ovn_datapath *od)\n     return od->nbs ? DP_SWITCH : DP_ROUTER;\n }\n \n-/* Returns an \"enum ovn_stage\" built from the arguments. */\n-static inline enum ovn_stage\n+/* Returns a \"struct ovn_stage\" built from the arguments.\n+ * The stage will not have a proper name, but so far, the only cases\n+ * where stages are built from components, a name is not necessary.\n+ */\n+static inline struct ovn_stage\n ovn_stage_build(enum ovn_datapath_type dp_type, enum ovn_pipeline pipeline,\n                 uint8_t table)\n {\n-    return OVN_STAGE_BUILD(dp_type, pipeline, table);\n+    return (struct ovn_stage) {dp_type, pipeline, table, \"<unknown>\"};\n }\n \n /* Returns the pipeline to which 'stage' belongs. */\n static inline enum ovn_pipeline\n-ovn_stage_get_pipeline(enum ovn_stage stage)\n+ovn_stage_get_pipeline(const struct ovn_stage *stage)\n {\n-    return (stage >> 8) & 1;\n+    return stage->pipeline;\n }\n \n /* Returns the pipeline name to which 'stage' belongs. */\n static inline const char *\n-ovn_stage_get_pipeline_name(enum ovn_stage stage)\n+ovn_stage_get_pipeline_name(const struct ovn_stage *stage)\n {\n     return ovn_stage_get_pipeline(stage) == P_IN ? \"ingress\" : \"egress\";\n }\n \n /* Returns the table to which 'stage' belongs. */\n static inline uint8_t\n-ovn_stage_get_table(enum ovn_stage stage)\n+ovn_stage_get_table(const struct ovn_stage *stage)\n {\n-    return stage & 0xff;\n+    return stage->table;\n }\n \n /* Returns a string name for 'stage'. */\n static inline const char *\n-ovn_stage_to_str(enum ovn_stage stage)\n+ovn_stage_to_str(const struct ovn_stage *stage)\n {\n-    switch (stage) {\n-#define PIPELINE_STAGE(DP_TYPE, PIPELINE, STAGE, TABLE, NAME)       \\\n-        case S_##DP_TYPE##_##PIPELINE##_##STAGE: return NAME;\n-    PIPELINE_STAGES\n-#undef PIPELINE_STAGE\n-        default: return \"<unknown>\";\n-    }\n+    return stage->name;\n }\n \n /* A logical switch port or logical router port.\n",
    "prefixes": [
        "ovs-dev",
        "08/14"
    ]
}