get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 98629,
    "url": "http://patchwork.dpdk.org/api/patches/98629/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20210910123003.85448-21-cristian.dumitrescu@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20210910123003.85448-21-cristian.dumitrescu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210910123003.85448-21-cristian.dumitrescu@intel.com",
    "date": "2021-09-10T12:30:00",
    "name": "[21/24] pipeline: generate action functions",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "9bb8792bb9395f4287039d21506e33e0dfb05963",
    "submitter": {
        "id": 19,
        "url": "http://patchwork.dpdk.org/api/people/19/?format=api",
        "name": "Cristian Dumitrescu",
        "email": "cristian.dumitrescu@intel.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20210910123003.85448-21-cristian.dumitrescu@intel.com/mbox/",
    "series": [
        {
            "id": 18838,
            "url": "http://patchwork.dpdk.org/api/series/18838/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=18838",
            "date": "2021-09-10T12:29:44",
            "name": "[01/24] pipeline: move data structures to internal header file",
            "version": 1,
            "mbox": "http://patchwork.dpdk.org/series/18838/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/98629/comments/",
    "check": "warning",
    "checks": "http://patchwork.dpdk.org/api/patches/98629/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 43FE7A0547;\n\tFri, 10 Sep 2021 14:33:14 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 7CEB0411CB;\n\tFri, 10 Sep 2021 14:30:54 +0200 (CEST)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n by mails.dpdk.org (Postfix) with ESMTP id 946E04114B\n for <dev@dpdk.org>; Fri, 10 Sep 2021 14:30:27 +0200 (CEST)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 10 Sep 2021 05:30:23 -0700",
            "from silpixa00400573.ir.intel.com (HELO\n silpixa00400573.ger.corp.intel.com) ([10.237.223.107])\n by orsmga001.jf.intel.com with ESMTP; 10 Sep 2021 05:30:23 -0700"
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6200,9189,10102\"; a=\"243386328\"",
            "E=Sophos;i=\"5.85,282,1624345200\"; d=\"scan'208\";a=\"243386328\"",
            "E=Sophos;i=\"5.85,282,1624345200\"; d=\"scan'208\";a=\"514279833\""
        ],
        "X-ExtLoop1": "1",
        "From": "Cristian Dumitrescu <cristian.dumitrescu@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Fri, 10 Sep 2021 13:30:00 +0100",
        "Message-Id": "<20210910123003.85448-21-cristian.dumitrescu@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20210910123003.85448-1-cristian.dumitrescu@intel.com>",
        "References": "<20210910123003.85448-1-cristian.dumitrescu@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 21/24] pipeline: generate action functions",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Generate a C function for each action. For most instructions, the\nassociated inline function is called directly. Special care is taken\nfor TX, jump and return instructions.\n\nSigned-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\n---\n lib/pipeline/rte_swx_pipeline.c | 662 ++++++++++++++++++++++++++++++++\n 1 file changed, 662 insertions(+)",
    "diff": "diff --git a/lib/pipeline/rte_swx_pipeline.c b/lib/pipeline/rte_swx_pipeline.c\nindex 0153c70b5f..019dbafbf3 100644\n--- a/lib/pipeline/rte_swx_pipeline.c\n+++ b/lib/pipeline/rte_swx_pipeline.c\n@@ -1376,6 +1376,26 @@ instruction_is_tx(enum instruction_type type)\n \t}\n }\n \n+static int\n+instruction_does_tx(struct instruction *instr)\n+{\n+\tswitch (instr->type) {\n+\tcase INSTR_TX:\n+\tcase INSTR_TX_I:\n+\tcase INSTR_HDR_EMIT_TX:\n+\tcase INSTR_HDR_EMIT2_TX:\n+\tcase INSTR_HDR_EMIT3_TX:\n+\tcase INSTR_HDR_EMIT4_TX:\n+\tcase INSTR_HDR_EMIT5_TX:\n+\tcase INSTR_HDR_EMIT6_TX:\n+\tcase INSTR_HDR_EMIT7_TX:\n+\tcase INSTR_HDR_EMIT8_TX:\n+\t\treturn 1;\n+\tdefault:\n+\t\treturn 0;\n+\t}\n+}\n+\n static int\n instruction_is_jmp(struct instruction *instr)\n {\n@@ -10857,6 +10877,644 @@ action_data_codegen(struct action *a, FILE *f)\n \tfprintf(f, \"};\\n\");\n }\n \n+static const char *\n+instr_type_to_func(struct instruction *instr)\n+{\n+\tswitch (instr->type) {\n+\t\tcase INSTR_RX: return NULL;\n+\n+\t\tcase INSTR_TX: return \"__instr_tx_exec\";\n+\t\tcase INSTR_TX_I: return \"__instr_tx_i_exec\";\n+\n+\t\tcase INSTR_HDR_EXTRACT: return \"__instr_hdr_extract_exec\";\n+\t\tcase INSTR_HDR_EXTRACT2: return \"__instr_hdr_extract2_exec\";\n+\t\tcase INSTR_HDR_EXTRACT3: return \"__instr_hdr_extract3_exec\";\n+\t\tcase INSTR_HDR_EXTRACT4: return \"__instr_hdr_extract4_exec\";\n+\t\tcase INSTR_HDR_EXTRACT5: return \"__instr_hdr_extract5_exec\";\n+\t\tcase INSTR_HDR_EXTRACT6: return \"__instr_hdr_extract6_exec\";\n+\t\tcase INSTR_HDR_EXTRACT7: return \"__instr_hdr_extract7_exec\";\n+\t\tcase INSTR_HDR_EXTRACT8: return \"__instr_hdr_extract8_exec\";\n+\n+\t\tcase INSTR_HDR_EXTRACT_M: return \"__instr_hdr_extract_m_exec\";\n+\n+\t\tcase INSTR_HDR_LOOKAHEAD: return \"__instr_hdr_lookahead_exec\";\n+\n+\t\tcase INSTR_HDR_EMIT: return \"__instr_hdr_emit_exec\";\n+\t\tcase INSTR_HDR_EMIT_TX: return \"__instr_hdr_emit_tx_exec\";\n+\t\tcase INSTR_HDR_EMIT2_TX: return \"__instr_hdr_emit2_tx_exec\";\n+\t\tcase INSTR_HDR_EMIT3_TX: return \"__instr_hdr_emit3_tx_exec\";\n+\t\tcase INSTR_HDR_EMIT4_TX: return \"__instr_hdr_emit4_tx_exec\";\n+\t\tcase INSTR_HDR_EMIT5_TX: return \"__instr_hdr_emit5_tx_exec\";\n+\t\tcase INSTR_HDR_EMIT6_TX: return \"__instr_hdr_emit6_tx_exec\";\n+\t\tcase INSTR_HDR_EMIT7_TX: return \"__instr_hdr_emit7_tx_exec\";\n+\t\tcase INSTR_HDR_EMIT8_TX: return \"__instr_hdr_emit8_tx_exec\";\n+\n+\t\tcase INSTR_HDR_VALIDATE: return \"__instr_hdr_validate_exec\";\n+\t\tcase INSTR_HDR_INVALIDATE: return \"__instr_hdr_invalidate_exec\";\n+\n+\t\tcase INSTR_MOV: return \"__instr_mov_exec\";\n+\t\tcase INSTR_MOV_MH: return \"__instr_mov_mh_exec\";\n+\t\tcase INSTR_MOV_HM: return \"__instr_mov_hm_exec\";\n+\t\tcase INSTR_MOV_HH: return \"__instr_mov_hh_exec\";\n+\t\tcase INSTR_MOV_I: return \"__instr_mov_i_exec\";\n+\n+\t\tcase INSTR_DMA_HT: return \"__instr_dma_ht_exec\";\n+\t\tcase INSTR_DMA_HT2: return \"__instr_dma_ht2_exec\";\n+\t\tcase INSTR_DMA_HT3: return \"__instr_dma_ht3_exec\";\n+\t\tcase INSTR_DMA_HT4: return \"__instr_dma_ht4_exec\";\n+\t\tcase INSTR_DMA_HT5: return \"__instr_dma_ht5_exec\";\n+\t\tcase INSTR_DMA_HT6: return \"__instr_dma_ht6_exec\";\n+\t\tcase INSTR_DMA_HT7: return \"__instr_dma_ht7_exec\";\n+\t\tcase INSTR_DMA_HT8: return \"__instr_dma_ht8_exec\";\n+\n+\t\tcase INSTR_ALU_ADD: return \"__instr_alu_add_exec\";\n+\t\tcase INSTR_ALU_ADD_MH: return \"__instr_alu_add_mh_exec\";\n+\t\tcase INSTR_ALU_ADD_HM: return \"__instr_alu_add_hm_exec\";\n+\t\tcase INSTR_ALU_ADD_HH: return \"__instr_alu_add_hh_exec\";\n+\t\tcase INSTR_ALU_ADD_MI: return \"__instr_alu_add_mi_exec\";\n+\t\tcase INSTR_ALU_ADD_HI: return \"__instr_alu_add_hi_exec\";\n+\n+\t\tcase INSTR_ALU_SUB: return \"__instr_alu_sub_exec\";\n+\t\tcase INSTR_ALU_SUB_MH: return \"__instr_alu_sub_mh_exec\";\n+\t\tcase INSTR_ALU_SUB_HM: return \"__instr_alu_sub_hm_exec\";\n+\t\tcase INSTR_ALU_SUB_HH: return \"__instr_alu_sub_hh_exec\";\n+\t\tcase INSTR_ALU_SUB_MI: return \"__instr_alu_sub_mi_exec\";\n+\t\tcase INSTR_ALU_SUB_HI: return \"__instr_alu_sub_hi_exec\";\n+\n+\t\tcase INSTR_ALU_CKADD_FIELD: return \"__instr_alu_ckadd_field_exec\";\n+\t\tcase INSTR_ALU_CKADD_STRUCT20: return \"__instr_alu_ckadd_struct20_exec\";\n+\t\tcase INSTR_ALU_CKADD_STRUCT: return \"__instr_alu_ckadd_struct_exec\";\n+\t\tcase INSTR_ALU_CKSUB_FIELD: return \"__instr_alu_cksub_field_exec\";\n+\n+\t\tcase INSTR_ALU_AND: return \"__instr_alu_and_exec\";\n+\t\tcase INSTR_ALU_AND_MH: return \"__instr_alu_and_mh_exec\";\n+\t\tcase INSTR_ALU_AND_HM: return \"__instr_alu_and_hm_exec\";\n+\t\tcase INSTR_ALU_AND_HH: return \"__instr_alu_and_hh_exec\";\n+\t\tcase INSTR_ALU_AND_I: return \"__instr_alu_and_i_exec\";\n+\n+\t\tcase INSTR_ALU_OR: return \"__instr_alu_or_exec\";\n+\t\tcase INSTR_ALU_OR_MH: return \"__instr_alu_or_mh_exec\";\n+\t\tcase INSTR_ALU_OR_HM: return \"__instr_alu_or_hm_exec\";\n+\t\tcase INSTR_ALU_OR_HH: return \"__instr_alu_or_hh_exec\";\n+\t\tcase INSTR_ALU_OR_I: return \"__instr_alu_or_i_exec\";\n+\n+\t\tcase INSTR_ALU_XOR: return \"__instr_alu_xor_exec\";\n+\t\tcase INSTR_ALU_XOR_MH: return \"__instr_alu_xor_mh_exec\";\n+\t\tcase INSTR_ALU_XOR_HM: return \"__instr_alu_xor_hm_exec\";\n+\t\tcase INSTR_ALU_XOR_HH: return \"__instr_alu_xor_hh_exec\";\n+\t\tcase INSTR_ALU_XOR_I: return \"__instr_alu_xor_i_exec\";\n+\n+\t\tcase INSTR_ALU_SHL: return \"__instr_alu_shl_exec\";\n+\t\tcase INSTR_ALU_SHL_MH: return \"__instr_alu_shl_mh_exec\";\n+\t\tcase INSTR_ALU_SHL_HM: return \"__instr_alu_shl_hm_exec\";\n+\t\tcase INSTR_ALU_SHL_HH: return \"__instr_alu_shl_hh_exec\";\n+\t\tcase INSTR_ALU_SHL_MI: return \"__instr_alu_shl_mi_exec\";\n+\t\tcase INSTR_ALU_SHL_HI: return \"__instr_alu_shl_hi_exec\";\n+\n+\t\tcase INSTR_ALU_SHR: return \"__instr_alu_shr_exec\";\n+\t\tcase INSTR_ALU_SHR_MH: return \"__instr_alu_shr_mh_exec\";\n+\t\tcase INSTR_ALU_SHR_HM: return \"__instr_alu_shr_hm_exec\";\n+\t\tcase INSTR_ALU_SHR_HH: return \"__instr_alu_shr_hh_exec\";\n+\t\tcase INSTR_ALU_SHR_MI: return \"__instr_alu_shr_mi_exec\";\n+\t\tcase INSTR_ALU_SHR_HI: return \"__instr_alu_shr_hi_exec\";\n+\n+\t\tcase INSTR_REGPREFETCH_RH: return \"__instr_regprefetch_rh_exec\";\n+\t\tcase INSTR_REGPREFETCH_RM: return \"__instr_regprefetch_rm_exec\";\n+\t\tcase INSTR_REGPREFETCH_RI: return \"__instr_regprefetch_ri_exec\";\n+\n+\t\tcase INSTR_REGRD_HRH: return \"__instr_regrd_hrh_exec\";\n+\t\tcase INSTR_REGRD_HRM: return \"__instr_regrd_hrm_exec\";\n+\t\tcase INSTR_REGRD_HRI: return \"__instr_regrd_hri_exec\";\n+\t\tcase INSTR_REGRD_MRH: return \"__instr_regrd_mrh_exec\";\n+\t\tcase INSTR_REGRD_MRM: return \"__instr_regrd_mrm_exec\";\n+\t\tcase INSTR_REGRD_MRI: return \"__instr_regrd_mri_exec\";\n+\n+\t\tcase INSTR_REGWR_RHH: return \"__instr_regwr_rhh_exec\";\n+\t\tcase INSTR_REGWR_RHM: return \"__instr_regwr_rhm_exec\";\n+\t\tcase INSTR_REGWR_RHI: return \"__instr_regwr_rhi_exec\";\n+\t\tcase INSTR_REGWR_RMH: return \"__instr_regwr_rmh_exec\";\n+\t\tcase INSTR_REGWR_RMM: return \"__instr_regwr_rmm_exec\";\n+\t\tcase INSTR_REGWR_RMI: return \"__instr_regwr_rmi_exec\";\n+\t\tcase INSTR_REGWR_RIH: return \"__instr_regwr_rih_exec\";\n+\t\tcase INSTR_REGWR_RIM: return \"__instr_regwr_rim_exec\";\n+\t\tcase INSTR_REGWR_RII: return \"__instr_regwr_rii_exec\";\n+\n+\t\tcase INSTR_REGADD_RHH: return \"__instr_regadd_rhh_exec\";\n+\t\tcase INSTR_REGADD_RHM: return \"__instr_regadd_rhm_exec\";\n+\t\tcase INSTR_REGADD_RHI: return \"__instr_regadd_rhi_exec\";\n+\t\tcase INSTR_REGADD_RMH: return \"__instr_regadd_rmh_exec\";\n+\t\tcase INSTR_REGADD_RMM: return \"__instr_regadd_rmm_exec\";\n+\t\tcase INSTR_REGADD_RMI: return \"__instr_regadd_rmi_exec\";\n+\t\tcase INSTR_REGADD_RIH: return \"__instr_regadd_rih_exec\";\n+\t\tcase INSTR_REGADD_RIM: return \"__instr_regadd_rim_exec\";\n+\t\tcase INSTR_REGADD_RII: return \"__instr_regadd_rii_exec\";\n+\n+\t\tcase INSTR_METPREFETCH_H: return \"__instr_metprefetch_h_exec\";\n+\t\tcase INSTR_METPREFETCH_M: return \"__instr_metprefetch_m_exec\";\n+\t\tcase INSTR_METPREFETCH_I: return \"__instr_metprefetch_i_exec\";\n+\n+\t\tcase INSTR_METER_HHM: return \"__instr_meter_hhm_exec\";\n+\t\tcase INSTR_METER_HHI: return \"__instr_meter_hhi_exec\";\n+\t\tcase INSTR_METER_HMM: return \"__instr_meter_hmm_exec\";\n+\t\tcase INSTR_METER_HMI: return \"__instr_meter_hmi_exec\";\n+\t\tcase INSTR_METER_MHM: return \"__instr_meter_mhm_exec\";\n+\t\tcase INSTR_METER_MHI: return \"__instr_meter_mhi_exec\";\n+\t\tcase INSTR_METER_MMM: return \"__instr_meter_mmm_exec\";\n+\t\tcase INSTR_METER_MMI: return \"__instr_meter_mmi_exec\";\n+\t\tcase INSTR_METER_IHM: return \"__instr_meter_ihm_exec\";\n+\t\tcase INSTR_METER_IHI: return \"__instr_meter_ihi_exec\";\n+\t\tcase INSTR_METER_IMM: return \"__instr_meter_imm_exec\";\n+\t\tcase INSTR_METER_IMI: return \"__instr_meter_imi_exec\";\n+\n+\t\tcase INSTR_TABLE: return NULL;\n+\t\tcase INSTR_TABLE_AF: return NULL;\n+\t\tcase INSTR_SELECTOR: return NULL;\n+\t\tcase INSTR_LEARNER: return NULL;\n+\t\tcase INSTR_LEARNER_AF: return NULL;\n+\n+\t\tcase INSTR_LEARNER_LEARN: return \"__instr_learn_exec\";\n+\t\tcase INSTR_LEARNER_FORGET: return \"__instr_forget_exec\";\n+\n+\t\tcase INSTR_EXTERN_OBJ: return NULL;\n+\t\tcase INSTR_EXTERN_FUNC: return NULL;\n+\n+\t\tcase INSTR_JMP: return NULL;\n+\t\tcase INSTR_JMP_VALID: return NULL;\n+\t\tcase INSTR_JMP_INVALID: return NULL;\n+\t\tcase INSTR_JMP_HIT: return NULL;\n+\t\tcase INSTR_JMP_MISS: return NULL;\n+\t\tcase INSTR_JMP_ACTION_HIT: return NULL;\n+\t\tcase INSTR_JMP_ACTION_MISS: return NULL;\n+\t\tcase INSTR_JMP_EQ: return NULL;\n+\t\tcase INSTR_JMP_EQ_MH: return NULL;\n+\t\tcase INSTR_JMP_EQ_HM: return NULL;\n+\t\tcase INSTR_JMP_EQ_HH: return NULL;\n+\t\tcase INSTR_JMP_EQ_I: return NULL;\n+\t\tcase INSTR_JMP_NEQ: return NULL;\n+\t\tcase INSTR_JMP_NEQ_MH: return NULL;\n+\t\tcase INSTR_JMP_NEQ_HM: return NULL;\n+\t\tcase INSTR_JMP_NEQ_HH: return NULL;\n+\t\tcase INSTR_JMP_NEQ_I: return NULL;\n+\t\tcase INSTR_JMP_LT: return NULL;\n+\t\tcase INSTR_JMP_LT_MH: return NULL;\n+\t\tcase INSTR_JMP_LT_HM: return NULL;\n+\t\tcase INSTR_JMP_LT_HH: return NULL;\n+\t\tcase INSTR_JMP_LT_MI: return NULL;\n+\t\tcase INSTR_JMP_LT_HI: return NULL;\n+\t\tcase INSTR_JMP_GT: return NULL;\n+\t\tcase INSTR_JMP_GT_MH: return NULL;\n+\t\tcase INSTR_JMP_GT_HM: return NULL;\n+\t\tcase INSTR_JMP_GT_HH: return NULL;\n+\t\tcase INSTR_JMP_GT_MI: return NULL;\n+\t\tcase INSTR_JMP_GT_HI: return NULL;\n+\n+\t\tcase INSTR_RETURN: return NULL;\n+\n+\t\tdefault: return NULL;\n+\t}\n+}\n+\n+static void\n+action_instr_does_tx_codegen(struct action *a,\n+\t\t\tuint32_t instr_pos,\n+\t\t\tstruct instruction *instr,\n+\t\t\tFILE *f)\n+{\n+\tfprintf(f,\n+\t\t\"%s(p, t, &action_%s_instructions[%u]);\\n\"\n+\t\t\"\\tthread_ip_reset(p, t);\\n\"\n+\t\t\"\\tinstr_rx_exec(p);\\n\"\n+\t\t\"\\treturn;\\n\",\n+\t\tinstr_type_to_func(instr),\n+\t\ta->name,\n+\t\tinstr_pos);\n+}\n+\n+static void\n+action_instr_extern_obj_codegen(struct action *a,\n+\t\t\t\tuint32_t instr_pos,\n+\t\t\t\tFILE *f)\n+{\n+\tfprintf(f,\n+\t\t\"while (!__instr_extern_obj_exec(p, t, &action_%s_instructions[%u]));\\n\",\n+\t\ta->name,\n+\t\tinstr_pos);\n+}\n+\n+static void\n+action_instr_extern_func_codegen(struct action *a,\n+\t\t\t\t uint32_t instr_pos,\n+\t\t\t\t FILE *f)\n+{\n+\tfprintf(f,\n+\t\t\"while (!__instr_extern_func_exec(p, t, &action_%s_instructions[%u]));\\n\",\n+\t\ta->name,\n+\t\tinstr_pos);\n+}\n+\n+static void\n+action_instr_jmp_codegen(struct action *a,\n+\t\t\t uint32_t instr_pos,\n+\t\t\t struct instruction *instr,\n+\t\t\t struct instruction_data *data,\n+\t\t\t FILE *f)\n+{\n+\tswitch (instr->type) {\n+\tcase INSTR_JMP:\n+\t\tfprintf(f,\n+\t\t\t\"goto %s;\\n\",\n+\t\t\tdata->jmp_label);\n+\t\treturn;\n+\n+\tcase INSTR_JMP_VALID:\n+\t\tfprintf(f,\n+\t\t\t\"if (HEADER_VALID(t, action_%s_instructions[%u].jmp.header_id))\\n\"\n+\t\t\t\"\\t\\tgoto %s;\\n\",\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\tdata->jmp_label);\n+\t\treturn;\n+\n+\tcase INSTR_JMP_INVALID:\n+\t\tfprintf(f,\n+\t\t\t\"if (!HEADER_VALID(t, action_%s_instructions[%u].jmp.header_id))\\n\"\n+\t\t\t\"\\t\\tgoto %s;\\n\",\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\tdata->jmp_label);\n+\t\treturn;\n+\n+\tcase INSTR_JMP_HIT:\n+\t\tfprintf(f,\n+\t\t\t\"if (t->hit)\\n\"\n+\t\t\t\"\\t\\tgoto %s;\\n\",\n+\t\t\tdata->jmp_label);\n+\t\treturn;\n+\n+\tcase INSTR_JMP_MISS:\n+\t\tfprintf(f,\n+\t\t\t\"if (!t->hit)\\n\"\n+\t\t\t\"\\t\\tgoto %s;\\n\",\n+\t\t\tdata->jmp_label);\n+\t\treturn;\n+\n+\tcase INSTR_JMP_ACTION_HIT:\n+\t\tfprintf(f,\n+\t\t\t\"if (t->action_id == action_%s_instructions[%u].jmp.action_id)\\n\"\n+\t\t\t\"\\t\\tgoto %s;\\n\",\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\tdata->jmp_label);\n+\t\treturn;\n+\n+\tcase INSTR_JMP_ACTION_MISS:\n+\t\tfprintf(f,\n+\t\t\t\"if (t->action_id != action_%s_instructions[%u].jmp.action_id)\\n\"\n+\t\t\t\"\\t\\tgoto %s;\\n\",\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\tdata->jmp_label);\n+\t\treturn;\n+\n+\tcase INSTR_JMP_EQ:\n+\t\tfprintf(f,\n+\t\t\t\"if (instr_operand_hbo(t, &action_%s_instructions[%u].jmp.a) == \"\n+\t\t\t\"instr_operand_hbo(t, &action_%s_instructions[%u].jmp.b))\\n\"\n+\t\t\t\"\\t\\tgoto %s;\\n\",\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\tdata->jmp_label);\n+\t\treturn;\n+\n+\tcase INSTR_JMP_EQ_MH:\n+\t\tfprintf(f,\n+\t\t\t\"if (instr_operand_hbo(t, &action_%s_instructions[%u].jmp.a) == \"\n+\t\t\t\"instr_operand_nbo(t, &action_%s_instructions[%u].jmp.b))\\n\"\n+\t\t\t\"\\t\\tgoto %s;\\n\",\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\tdata->jmp_label);\n+\t\treturn;\n+\n+\tcase INSTR_JMP_EQ_HM:\n+\t\tfprintf(f,\n+\t\t\t\"if (instr_operand_nbo(t, &action_%s_instructions[%u].jmp.a) == \"\n+\t\t\t\"instr_operand_hbo(t, &action_%s_instructions[%u].jmp.b))\\n\"\n+\t\t\t\"\\t\\tgoto %s;\\n\",\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\tdata->jmp_label);\n+\t\treturn;\n+\n+\tcase INSTR_JMP_EQ_HH:\n+\t\tfprintf(f,\n+\t\t\t\"if (instr_operand_nbo(t, &action_%s_instructions[%u].jmp.a) == \"\n+\t\t\t\"instr_operand_nbo(t, &action_%s_instructions[%u].jmp.b))\\n\"\n+\t\t\t\"\\t\\tgoto %s;\\n\",\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\tdata->jmp_label);\n+\t\treturn;\n+\n+\tcase INSTR_JMP_EQ_I:\n+\t\tfprintf(f,\n+\t\t\t\"if (instr_operand_hbo(t, &action_%s_instructions[%u].jmp.a) == \"\n+\t\t\t\"action_%s_instructions[%u].jmp.b_val)\\n\"\n+\t\t\t\"\\t\\tgoto %s;\\n\",\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\tdata->jmp_label);\n+\t\treturn;\n+\n+\tcase INSTR_JMP_NEQ:\n+\t\tfprintf(f,\n+\t\t\t\"if (instr_operand_hbo(t, &action_%s_instructions[%u].jmp.a) != \"\n+\t\t\t\"instr_operand_hbo(t, &action_%s_instructions[%u].jmp.b))\\n\"\n+\t\t\t\"\\t\\tgoto %s;\\n\",\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\tdata->jmp_label);\n+\t\treturn;\n+\n+\tcase INSTR_JMP_NEQ_MH:\n+\t\tfprintf(f,\n+\t\t\t\"if (instr_operand_hbo(t, &action_%s_instructions[%u].jmp.a) != \"\n+\t\t\t\"instr_operand_nbo(t, &action_%s_instructions[%u].jmp.b))\\n\"\n+\t\t\t\"\\t\\tgoto %s;\\n\",\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\tdata->jmp_label);\n+\t\treturn;\n+\n+\tcase INSTR_JMP_NEQ_HM:\n+\t\tfprintf(f,\n+\t\t\t\"if (instr_operand_nbo(t, &action_%s_instructions[%u].jmp.a) != \"\n+\t\t\t\"instr_operand_hbo(t, &action_%s_instructions[%u].jmp.b))\\n\"\n+\t\t\t\"\\t\\tgoto %s;\\n\",\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\tdata->jmp_label);\n+\t\treturn;\n+\n+\tcase INSTR_JMP_NEQ_HH:\n+\t\tfprintf(f,\n+\t\t\t\"if (instr_operand_nbo(t, &action_%s_instructions[%u].jmp.a) != \"\n+\t\t\t\"instr_operand_nbo(t, &action_%s_instructions[%u].jmp.b))\\n\"\n+\t\t\t\"\\t\\tgoto %s;\\n\",\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\tdata->jmp_label);\n+\t\treturn;\n+\n+\tcase INSTR_JMP_NEQ_I:\n+\t\tfprintf(f,\n+\t\t\t\"if (instr_operand_hbo(t, &action_%s_instructions[%u].jmp.a) != \"\n+\t\t\t\"action_%s_instructions[%u].jmp.b_val)\\n\"\n+\t\t\t\"\\t\\tgoto %s;\\n\",\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\tdata->jmp_label);\n+\t\treturn;\n+\n+\tcase INSTR_JMP_LT:\n+\t\tfprintf(f,\n+\t\t\t\"if (instr_operand_hbo(t, &action_%s_instructions[%u].jmp.a) < \"\n+\t\t\t\"instr_operand_hbo(t, &action_%s_instructions[%u].jmp.b))\\n\"\n+\t\t\t\"\\t\\tgoto %s;\\n\",\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\tdata->jmp_label);\n+\t\treturn;\n+\n+\tcase INSTR_JMP_LT_MH:\n+\t\tfprintf(f,\n+\t\t\t\"if (instr_operand_hbo(t, &action_%s_instructions[%u].jmp.a) < \"\n+\t\t\t\"instr_operand_nbo(t, &action_%s_instructions[%u].jmp.b))\\n\"\n+\t\t\t\"\\t\\tgoto %s;\\n\",\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\tdata->jmp_label);\n+\t\treturn;\n+\n+\tcase INSTR_JMP_LT_HM:\n+\t\tfprintf(f,\n+\t\t\t\"if (instr_operand_nbo(t, &action_%s_instructions[%u].jmp.a) < \"\n+\t\t\t\"instr_operand_hbo(t, &action_%s_instructions[%u].jmp.b))\\n\"\n+\t\t\t\"\\t\\tgoto %s;\\n\",\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\tdata->jmp_label);\n+\t\treturn;\n+\n+\tcase INSTR_JMP_LT_HH:\n+\t\tfprintf(f,\n+\t\t\t\"if (instr_operand_nbo(t, &action_%s_instructions[%u].jmp.a) < \"\n+\t\t\t\"instr_operand_nbo(t, &action_%s_instructions[%u].jmp.b))\\n\"\n+\t\t\t\"\\t\\tgoto %s;\\n\",\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\tdata->jmp_label);\n+\t\treturn;\n+\n+\tcase INSTR_JMP_LT_MI:\n+\t\tfprintf(f,\n+\t\t\t\"if (instr_operand_hbo(t, &action_%s_instructions[%u].jmp.a) < \"\n+\t\t\t\"action_%s_instructions[%u].jmp.b_val)\\n\"\n+\t\t\t\"\\t\\tgoto %s;\\n\",\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\tdata->jmp_label);\n+\t\treturn;\n+\n+\tcase INSTR_JMP_LT_HI:\n+\t\tfprintf(f,\n+\t\t\t\"if (instr_operand_nbo(t, &action_%s_instructions[%u].jmp.a) < \"\n+\t\t\t\"action_%s_instructions[%u].jmp.b_val)\\n\"\n+\t\t\t\"\\t\\tgoto %s;\\n\",\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\tdata->jmp_label);\n+\t\treturn;\n+\n+\tcase INSTR_JMP_GT:\n+\t\tfprintf(f,\n+\t\t\t\"if (instr_operand_hbo(t, &action_%s_instructions[%u].jmp.a) > \"\n+\t\t\t\"instr_operand_hbo(t, &action_%s_instructions[%u].jmp.b))\\n\"\n+\t\t\t\"\\t\\tgoto %s;\\n\",\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\tdata->jmp_label);\n+\t\treturn;\n+\n+\tcase INSTR_JMP_GT_MH:\n+\t\tfprintf(f,\n+\t\t\t\"if (instr_operand_hbo(t, &action_%s_instructions[%u].jmp.a) > \"\n+\t\t\t\"instr_operand_nbo(t, &action_%s_instructions[%u].jmp.b))\\n\"\n+\t\t\t\"\\t\\tgoto %s;\\n\",\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\tdata->jmp_label);\n+\t\treturn;\n+\n+\tcase INSTR_JMP_GT_HM:\n+\t\tfprintf(f,\n+\t\t\t\"if (instr_operand_nbo(t, &action_%s_instructions[%u].jmp.a) > \"\n+\t\t\t\"instr_operand_hbo(t, &action_%s_instructions[%u].jmp.b))\\n\"\n+\t\t\t\"\\t\\tgoto %s;\\n\",\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\tdata->jmp_label);\n+\t\treturn;\n+\n+\tcase INSTR_JMP_GT_HH:\n+\t\tfprintf(f,\n+\t\t\t\"if (instr_operand_nbo(t, &action_%s_instructions[%u].jmp.a) > \"\n+\t\t\t\"instr_operand_nbo(t, &action_%s_instructions[%u].jmp.b))\\n\"\n+\t\t\t\"\\t\\tgoto %s;\\n\",\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\tdata->jmp_label);\n+\t\treturn;\n+\n+\tcase INSTR_JMP_GT_MI:\n+\t\tfprintf(f,\n+\t\t\t\"if (instr_operand_hbo(t, &action_%s_instructions[%u].jmp.a) > \"\n+\t\t\t\"action_%s_instructions[%u].jmp.b_val)\\n\"\n+\t\t\t\"\\t\\tgoto %s;\\n\",\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\tdata->jmp_label);\n+\t\treturn;\n+\n+\tcase INSTR_JMP_GT_HI:\n+\t\tfprintf(f,\n+\t\t\t\"if (instr_operand_nbo(t, &action_%s_instructions[%u].jmp.a) > \"\n+\t\t\t\"action_%s_instructions[%u].jmp.b_val)\\n\"\n+\t\t\t\"\\t\\tgoto %s;\\n\",\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\ta->name,\n+\t\t\tinstr_pos,\n+\t\t\tdata->jmp_label);\n+\t\treturn;\n+\n+\tdefault:\n+\t\treturn;\n+\t}\n+}\n+\n+static void\n+action_instr_return_codegen(FILE *f)\n+{\n+\tfprintf(f,\n+\t\t\"return;\\n\");\n+}\n+\n+static void\n+action_instr_codegen(struct action *a, FILE *f)\n+{\n+\tuint32_t i;\n+\n+\tfprintf(f,\n+\t\t\"void\\n\"\n+\t\t\"action_%s_run(struct rte_swx_pipeline *p)\\n\"\n+\t\t\"{\\n\"\n+\t\t\"\\tstruct thread *t = &p->threads[p->thread_id];\\n\"\n+\t\t\"\\n\",\n+\t\ta->name);\n+\n+\tfor (i = 0; i < a->n_instructions; i++) {\n+\t\tstruct instruction *instr = &a->instructions[i];\n+\t\tstruct instruction_data *data = &a->instruction_data[i];\n+\n+\t\t/* Label, if present. */\n+\t\tif (data->label[0])\n+\t\t\tfprintf(f, \"\\n%s : \", data->label);\n+\t\telse\n+\t\t\tfprintf(f, \"\\n\\t\");\n+\n+\t\t/* TX instruction type. */\n+\t\tif (instruction_does_tx(instr)) {\n+\t\t\taction_instr_does_tx_codegen(a, i, instr, f);\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\t/* Extern object/function instruction type. */\n+\t\tif (instr->type == INSTR_EXTERN_OBJ) {\n+\t\t\taction_instr_extern_obj_codegen(a, i, f);\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\tif (instr->type == INSTR_EXTERN_FUNC) {\n+\t\t\taction_instr_extern_func_codegen(a, i, f);\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\t/* Jump instruction type. */\n+\t\tif (instruction_is_jmp(instr)) {\n+\t\t\taction_instr_jmp_codegen(a, i, instr, data, f);\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\t/* Return instruction type. */\n+\t\tif (instr->type == INSTR_RETURN) {\n+\t\t\taction_instr_return_codegen(f);\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\t/* Any other instruction type. */\n+\t\tfprintf(f,\n+\t\t\t\"%s(p, t, &action_%s_instructions[%u]);\\n\",\n+\t\t\tinstr_type_to_func(instr),\n+\t\t\ta->name,\n+\t\t\ti);\n+\t}\n+\n+\tfprintf(f, \"}\\n\\n\");\n+}\n+\n static int\n pipeline_codegen(struct rte_swx_pipeline *p)\n {\n@@ -10881,6 +11539,10 @@ pipeline_codegen(struct rte_swx_pipeline *p)\n \t\taction_data_codegen(a, f);\n \n \t\tfprintf(f, \"\\n\");\n+\n+\t\taction_instr_codegen(a, f);\n+\n+\t\tfprintf(f, \"\\n\");\n \t}\n \n \t/* Close the .c file. */\n",
    "prefixes": [
        "21/24"
    ]
}