get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 89122,
    "url": "https://patches.dpdk.org/api/patches/89122/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20210315113439.1045223-5-conor.walsh@intel.com/",
    "project": {
        "id": 1,
        "url": "https://patches.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": "<20210315113439.1045223-5-conor.walsh@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210315113439.1045223-5-conor.walsh@intel.com",
    "date": "2021-03-15T11:34:38",
    "name": "[v5,4/5] examples/l3fwd: implement FIB lookup method",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "d3b57a6a603738c1084c51143ddb0825240992d0",
    "submitter": {
        "id": 1935,
        "url": "https://patches.dpdk.org/api/people/1935/?format=api",
        "name": "Conor Walsh",
        "email": "conor.walsh@intel.com"
    },
    "delegate": {
        "id": 24651,
        "url": "https://patches.dpdk.org/api/users/24651/?format=api",
        "username": "dmarchand",
        "first_name": "David",
        "last_name": "Marchand",
        "email": "david.marchand@redhat.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20210315113439.1045223-5-conor.walsh@intel.com/mbox/",
    "series": [
        {
            "id": 15658,
            "url": "https://patches.dpdk.org/api/series/15658/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=15658",
            "date": "2021-03-15T11:34:34",
            "name": "examples/l3fwd: add FIB lookup method to l3fwd",
            "version": 5,
            "mbox": "https://patches.dpdk.org/series/15658/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/89122/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/89122/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 C8AC4A054F;\n\tMon, 15 Mar 2021 12:35:15 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 17F2424264D;\n\tMon, 15 Mar 2021 12:35:01 +0100 (CET)",
            "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n by mails.dpdk.org (Postfix) with ESMTP id D95FF242652\n for <dev@dpdk.org>; Mon, 15 Mar 2021 12:34:58 +0100 (CET)",
            "from fmsmga003.fm.intel.com ([10.253.24.29])\n by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 15 Mar 2021 04:34:58 -0700",
            "from silpixa00400466.ir.intel.com ([10.237.213.210])\n by FMSMGA003.fm.intel.com with ESMTP; 15 Mar 2021 04:34:56 -0700"
        ],
        "IronPort-SDR": [
            "\n kERUNnWGmfTTkUF0saesI+Ouc5djCTOPE9zLLwD7ghytBntrm8M9G+xUy1SC4QpWb3kBC0U3ac\n 9KTuSzrWZkew==",
            "\n sND1TF16zh7MDmW87ilub6viOd6i6BL+EXm6e2h8M8caD4ptb/+Of3rOXR+iY5Qs5C/EA53ry/\n UevA/dlYnp3g=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9923\"; a=\"188432277\"",
            "E=Sophos;i=\"5.81,249,1610438400\"; d=\"scan'208\";a=\"188432277\"",
            "E=Sophos;i=\"5.81,249,1610438400\"; d=\"scan'208\";a=\"439728835\""
        ],
        "X-ExtLoop1": "1",
        "From": "Conor Walsh <conor.walsh@intel.com>",
        "To": "jerinj@marvell.com, stephen@networkplumber.org,\n bernard.iremonger@intel.com, konstantin.ananyev@intel.com,\n vladimir.medvedkin@intel.com, anatoly.burakov@intel.com",
        "Cc": "dev@dpdk.org,\n\tConor Walsh <conor.walsh@intel.com>",
        "Date": "Mon, 15 Mar 2021 11:34:38 +0000",
        "Message-Id": "<20210315113439.1045223-5-conor.walsh@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20210315113439.1045223-1-conor.walsh@intel.com>",
        "References": "<20210311120153.186213-1-conor.walsh@intel.com>\n <20210315113439.1045223-1-conor.walsh@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v5 4/5] examples/l3fwd: implement FIB lookup\n method",
        "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": "This patch implements the Forwarding Information Base (FIB) library\nin l3fwd using the function calls and infrastructure introduced in\nthe previous patch.\n\nSigned-off-by: Conor Walsh <conor.walsh@intel.com>\nAcked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>\n---\n examples/l3fwd/l3fwd_fib.c | 480 ++++++++++++++++++++++++++++++++++++-\n 1 file changed, 474 insertions(+), 6 deletions(-)",
    "diff": "diff --git a/examples/l3fwd/l3fwd_fib.c b/examples/l3fwd/l3fwd_fib.c\nindex 0a2d02db2f..a58b933f83 100644\n--- a/examples/l3fwd/l3fwd_fib.c\n+++ b/examples/l3fwd/l3fwd_fib.c\n@@ -2,59 +2,527 @@\n  * Copyright(c) 2021 Intel Corporation\n  */\n \n+#include <stdio.h>\n+#include <stddef.h>\n+#include <stdint.h>\n+#include <sys/socket.h>\n+#include <arpa/inet.h>\n+\n #include <rte_fib.h>\n #include <rte_fib6.h>\n \n #include \"l3fwd.h\"\n+#if defined RTE_ARCH_X86\n+#include \"l3fwd_sse.h\"\n+#elif defined __ARM_NEON\n+#include \"l3fwd_neon.h\"\n+#elif defined RTE_ARCH_PPC_64\n+#include \"l3fwd_altivec.h\"\n+#endif\n #include \"l3fwd_event.h\"\n #include \"l3fwd_common_route.h\"\n \n+/* Configure how many packets ahead to prefetch for fib. */\n+#define FIB_PREFETCH_OFFSET 4\n+\n+/* A non-existent portid is needed to denote a default hop for fib. */\n+#define FIB_DEFAULT_HOP 999\n+\n+/*\n+ * If the machine has SSE, NEON or PPC 64 then multiple packets\n+ * can be sent at once if not only single packets will be sent\n+ */\n+#if defined RTE_ARCH_X86 || defined __ARM_NEON \\\n+\t\t|| defined RTE_ARCH_PPC_64\n+#define FIB_SEND_MULTI\n+#endif\n+\n+static struct rte_fib *ipv4_l3fwd_fib_lookup_struct[NB_SOCKETS];\n+static struct rte_fib6 *ipv6_l3fwd_fib_lookup_struct[NB_SOCKETS];\n+\n+/* Parse packet type and ip address. */\n+static inline void\n+fib_parse_packet(struct rte_mbuf *mbuf,\n+\t\tuint32_t *ipv4, uint32_t *ipv4_cnt,\n+\t\tuint8_t ipv6[RTE_FIB6_IPV6_ADDR_SIZE],\n+\t\tuint32_t *ipv6_cnt, uint8_t *ip_type)\n+{\n+\tstruct rte_ether_hdr *eth_hdr;\n+\tstruct rte_ipv4_hdr *ipv4_hdr;\n+\tstruct rte_ipv6_hdr *ipv6_hdr;\n+\n+\teth_hdr = rte_pktmbuf_mtod(mbuf, struct rte_ether_hdr *);\n+\t/* IPv4 */\n+\tif (mbuf->packet_type & RTE_PTYPE_L3_IPV4) {\n+\t\tipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1);\n+\t\t*ipv4 = rte_be_to_cpu_32(ipv4_hdr->dst_addr);\n+\t\t/* Store type of packet in type_arr (IPv4=1, IPv6=0). */\n+\t\t*ip_type = 1;\n+\t\t(*ipv4_cnt)++;\n+\t}\n+\t/* IPv6 */\n+\telse {\n+\t\tipv6_hdr = (struct rte_ipv6_hdr *)(eth_hdr + 1);\n+\t\trte_mov16(ipv6, (const uint8_t *)ipv6_hdr->dst_addr);\n+\t\t*ip_type = 0;\n+\t\t(*ipv6_cnt)++;\n+\t}\n+}\n+\n+/*\n+ * If the machine does not have SSE, NEON or PPC 64 then the packets\n+ * are sent one at a time using send_single_packet()\n+ */\n+#if !defined FIB_SEND_MULTI\n+static inline void\n+fib_send_single(int nb_tx, struct lcore_conf *qconf,\n+\t\tstruct rte_mbuf **pkts_burst, uint16_t hops[nb_tx])\n+{\n+\tint32_t j;\n+\tstruct rte_ether_hdr *eth_hdr;\n+\n+\tfor (j = 0; j < nb_tx; j++) {\n+\t\t/* Run rfc1812 if packet is ipv4 and checks enabled. */\n+#if defined DO_RFC_1812_CHECKS\n+\t\trfc1812_process((struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(\n+\t\t\t\tpkts_burst[j], struct rte_ether_hdr *) + 1),\n+\t\t\t\t&hops[j], pkts_burst[j]->packet_type);\n+#endif\n+\n+\t\t/* Set MAC addresses. */\n+\t\teth_hdr = rte_pktmbuf_mtod(pkts_burst[j],\n+\t\t\t\tstruct rte_ether_hdr *);\n+\t\t*(uint64_t *)&eth_hdr->d_addr = dest_eth_addr[hops[j]];\n+\t\trte_ether_addr_copy(&ports_eth_addr[hops[j]],\n+\t\t\t\t&eth_hdr->s_addr);\n+\n+\t\t/* Send single packet. */\n+\t\tsend_single_packet(qconf, pkts_burst[j], hops[j]);\n+\t}\n+}\n+#endif\n+\n+/* Bulk parse, fib lookup and send. */\n+static inline void\n+fib_send_packets(int nb_rx, struct rte_mbuf **pkts_burst,\n+\t\tuint16_t portid, struct lcore_conf *qconf)\n+{\n+\tuint32_t ipv4_arr[nb_rx];\n+\tuint8_t ipv6_arr[nb_rx][RTE_FIB6_IPV6_ADDR_SIZE];\n+\tuint16_t hops[nb_rx];\n+\tuint64_t hopsv4[nb_rx], hopsv6[nb_rx];\n+\tuint8_t type_arr[nb_rx];\n+\tuint32_t ipv4_cnt = 0, ipv6_cnt = 0;\n+\tuint32_t ipv4_arr_assem = 0, ipv6_arr_assem = 0;\n+\tuint16_t nh;\n+\tint32_t i;\n+\n+\t/* Prefetch first packets. */\n+\tfor (i = 0; i < FIB_PREFETCH_OFFSET && i < nb_rx; i++)\n+\t\trte_prefetch0(rte_pktmbuf_mtod(pkts_burst[i], void *));\n+\n+\t/* Parse packet info and prefetch. */\n+\tfor (i = 0; i < (nb_rx - FIB_PREFETCH_OFFSET); i++) {\n+\t\t/* Prefetch packet. */\n+\t\trte_prefetch0(rte_pktmbuf_mtod(pkts_burst[\n+\t\t\t\ti + FIB_PREFETCH_OFFSET], void *));\n+\t\tfib_parse_packet(pkts_burst[i],\n+\t\t\t\t&ipv4_arr[ipv4_cnt], &ipv4_cnt,\n+\t\t\t\tipv6_arr[ipv6_cnt], &ipv6_cnt,\n+\t\t\t\t&type_arr[i]);\n+\t}\n+\n+\t/* Parse remaining packet info. */\n+\tfor (; i < nb_rx; i++)\n+\t\tfib_parse_packet(pkts_burst[i],\n+\t\t\t\t&ipv4_arr[ipv4_cnt], &ipv4_cnt,\n+\t\t\t\tipv6_arr[ipv6_cnt], &ipv6_cnt,\n+\t\t\t\t&type_arr[i]);\n+\n+\t/* Lookup IPv4 hops if IPv4 packets are present. */\n+\tif (likely(ipv4_cnt > 0))\n+\t\trte_fib_lookup_bulk(qconf->ipv4_lookup_struct,\n+\t\t\t\tipv4_arr, hopsv4, ipv4_cnt);\n+\n+\t/* Lookup IPv6 hops if IPv6 packets are present. */\n+\tif (ipv6_cnt > 0)\n+\t\trte_fib6_lookup_bulk(qconf->ipv6_lookup_struct,\n+\t\t\t\tipv6_arr, hopsv6, ipv6_cnt);\n+\n+\t/* Add IPv4 and IPv6 hops to one array depending on type. */\n+\tfor (i = 0; i < nb_rx; i++) {\n+\t\tif (type_arr[i])\n+\t\t\tnh = (uint16_t)hopsv4[ipv4_arr_assem++];\n+\t\telse\n+\t\t\tnh = (uint16_t)hopsv6[ipv6_arr_assem++];\n+\t\thops[i] = nh != FIB_DEFAULT_HOP ? nh : portid;\n+\t}\n+\n+#if defined FIB_SEND_MULTI\n+\tsend_packets_multi(qconf, pkts_burst, hops, nb_rx);\n+#else\n+\tfib_send_single(nb_rx, qconf, pkts_burst, hops);\n+#endif\n+}\n+\n /* Main fib processing loop. */\n int\n fib_main_loop(__rte_unused void *dummy)\n {\n+\tstruct rte_mbuf *pkts_burst[MAX_PKT_BURST];\n+\tunsigned int lcore_id;\n+\tuint64_t prev_tsc, diff_tsc, cur_tsc;\n+\tint i, nb_rx;\n+\tuint16_t portid;\n+\tuint8_t queueid;\n+\tstruct lcore_conf *qconf;\n+\tconst uint64_t drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) /\n+\t\t\tUS_PER_S * BURST_TX_DRAIN_US;\n+\n+\tprev_tsc = 0;\n+\n+\tlcore_id = rte_lcore_id();\n+\tqconf = &lcore_conf[lcore_id];\n+\n+\tif (qconf->n_rx_queue == 0) {\n+\t\tRTE_LOG(INFO, L3FWD, \"lcore %u has nothing to do\\n\", lcore_id);\n+\t\treturn 0;\n+\t}\n+\n+\tRTE_LOG(INFO, L3FWD, \"entering main loop on lcore %u\\n\", lcore_id);\n+\n+\tfor (i = 0; i < qconf->n_rx_queue; i++) {\n+\n+\t\tportid = qconf->rx_queue_list[i].port_id;\n+\t\tqueueid = qconf->rx_queue_list[i].queue_id;\n+\t\tRTE_LOG(INFO, L3FWD,\n+\t\t\t\t\" -- lcoreid=%u portid=%u rxqueueid=%hhu\\n\",\n+\t\t\t\tlcore_id, portid, queueid);\n+\t}\n+\n+\twhile (!force_quit) {\n+\n+\t\tcur_tsc = rte_rdtsc();\n+\n+\t\t/* TX burst queue drain. */\n+\t\tdiff_tsc = cur_tsc - prev_tsc;\n+\t\tif (unlikely(diff_tsc > drain_tsc)) {\n+\n+\t\t\tfor (i = 0; i < qconf->n_tx_port; ++i) {\n+\t\t\t\tportid = qconf->tx_port_id[i];\n+\t\t\t\tif (qconf->tx_mbufs[portid].len == 0)\n+\t\t\t\t\tcontinue;\n+\t\t\t\tsend_burst(qconf,\n+\t\t\t\t\tqconf->tx_mbufs[portid].len,\n+\t\t\t\t\tportid);\n+\t\t\t\tqconf->tx_mbufs[portid].len = 0;\n+\t\t\t}\n+\n+\t\t\tprev_tsc = cur_tsc;\n+\t\t}\n+\n+\t\t/* Read packet from RX queues. */\n+\t\tfor (i = 0; i < qconf->n_rx_queue; ++i) {\n+\t\t\tportid = qconf->rx_queue_list[i].port_id;\n+\t\t\tqueueid = qconf->rx_queue_list[i].queue_id;\n+\t\t\tnb_rx = rte_eth_rx_burst(portid, queueid, pkts_burst,\n+\t\t\t\t\tMAX_PKT_BURST);\n+\t\t\tif (nb_rx == 0)\n+\t\t\t\tcontinue;\n+\n+\t\t\t/* Use fib to lookup port IDs and transmit them. */\n+\t\t\tfib_send_packets(nb_rx, pkts_burst,\tportid, qconf);\n+\t\t}\n+\t}\n+\n \treturn 0;\n }\n \n+/* One eventdev loop for single and burst using fib. */\n+static __rte_always_inline void\n+fib_event_loop(struct l3fwd_event_resources *evt_rsrc,\n+\t\tconst uint8_t flags)\n+{\n+\tconst int event_p_id = l3fwd_get_free_event_port(evt_rsrc);\n+\tconst uint8_t tx_q_id = evt_rsrc->evq.event_q_id[\n+\t\t\tevt_rsrc->evq.nb_queues - 1];\n+\tconst uint8_t event_d_id = evt_rsrc->event_d_id;\n+\tconst uint16_t deq_len = evt_rsrc->deq_depth;\n+\tstruct rte_event events[MAX_PKT_BURST];\n+\tstruct lcore_conf *lconf;\n+\tunsigned int lcore_id;\n+\tint nb_enq, nb_deq, i;\n+\n+\tuint32_t ipv4_arr[MAX_PKT_BURST];\n+\tuint8_t ipv6_arr[MAX_PKT_BURST][RTE_FIB6_IPV6_ADDR_SIZE];\n+\tuint64_t hopsv4[MAX_PKT_BURST], hopsv6[MAX_PKT_BURST];\n+\tuint16_t nh;\n+\tuint8_t type_arr[MAX_PKT_BURST];\n+\tuint32_t ipv4_cnt, ipv6_cnt;\n+\tuint32_t ipv4_arr_assem, ipv6_arr_assem;\n+\n+\tif (event_p_id < 0)\n+\t\treturn;\n+\n+\tlcore_id = rte_lcore_id();\n+\n+\tlconf = &lcore_conf[lcore_id];\n+\n+\tRTE_LOG(INFO, L3FWD, \"entering %s on lcore %u\\n\", __func__, lcore_id);\n+\n+\twhile (!force_quit) {\n+\t\t/* Read events from RX queues. */\n+\t\tnb_deq = rte_event_dequeue_burst(event_d_id, event_p_id,\n+\t\t\t\tevents, deq_len, 0);\n+\t\tif (nb_deq == 0) {\n+\t\t\trte_pause();\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\t/* Reset counters. */\n+\t\tipv4_cnt = 0;\n+\t\tipv6_cnt = 0;\n+\t\tipv4_arr_assem = 0;\n+\t\tipv6_arr_assem = 0;\n+\n+\t\t/* Prefetch first packets. */\n+\t\tfor (i = 0; i < FIB_PREFETCH_OFFSET && i < nb_deq; i++)\n+\t\t\trte_prefetch0(rte_pktmbuf_mtod(events[i].mbuf, void *));\n+\n+\t\t/* Parse packet info and prefetch. */\n+\t\tfor (i = 0; i < (nb_deq - FIB_PREFETCH_OFFSET); i++) {\n+\t\t\tif (flags & L3FWD_EVENT_TX_ENQ) {\n+\t\t\t\tevents[i].queue_id = tx_q_id;\n+\t\t\t\tevents[i].op = RTE_EVENT_OP_FORWARD;\n+\t\t\t}\n+\n+\t\t\tif (flags & L3FWD_EVENT_TX_DIRECT)\n+\t\t\t\trte_event_eth_tx_adapter_txq_set(events[i].mbuf,\n+\t\t\t\t\t\t0);\n+\n+\t\t\t/* Prefetch packet. */\n+\t\t\trte_prefetch0(rte_pktmbuf_mtod(events[\n+\t\t\t\t\ti + FIB_PREFETCH_OFFSET].mbuf,\n+\t\t\t\t\tvoid *));\n+\n+\t\t\tfib_parse_packet(events[i].mbuf,\n+\t\t\t\t\t&ipv4_arr[ipv4_cnt], &ipv4_cnt,\n+\t\t\t\t\tipv6_arr[ipv6_cnt], &ipv6_cnt,\n+\t\t\t\t\t&type_arr[i]);\n+\t\t}\n+\n+\t\t/* Parse remaining packet info. */\n+\t\tfor (; i < nb_deq; i++) {\n+\t\t\tif (flags & L3FWD_EVENT_TX_ENQ) {\n+\t\t\t\tevents[i].queue_id = tx_q_id;\n+\t\t\t\tevents[i].op = RTE_EVENT_OP_FORWARD;\n+\t\t\t}\n+\n+\t\t\tif (flags & L3FWD_EVENT_TX_DIRECT)\n+\t\t\t\trte_event_eth_tx_adapter_txq_set(events[i].mbuf,\n+\t\t\t\t\t\t0);\n+\n+\t\t\tfib_parse_packet(events[i].mbuf,\n+\t\t\t\t\t&ipv4_arr[ipv4_cnt], &ipv4_cnt,\n+\t\t\t\t\tipv6_arr[ipv6_cnt], &ipv6_cnt,\n+\t\t\t\t\t&type_arr[i]);\n+\t\t}\n+\n+\t\t/* Lookup IPv4 hops if IPv4 packets are present. */\n+\t\tif (likely(ipv4_cnt > 0))\n+\t\t\trte_fib_lookup_bulk(lconf->ipv4_lookup_struct,\n+\t\t\t\t\tipv4_arr, hopsv4, ipv4_cnt);\n+\n+\t\t/* Lookup IPv6 hops if IPv6 packets are present. */\n+\t\tif (ipv6_cnt > 0)\n+\t\t\trte_fib6_lookup_bulk(lconf->ipv6_lookup_struct,\n+\t\t\t\t\tipv6_arr, hopsv6, ipv6_cnt);\n+\n+\t\t/* Assign ports looked up in fib depending on IPv4 or IPv6 */\n+\t\tfor (i = 0; i < nb_deq; i++) {\n+\t\t\tif (type_arr[i])\n+\t\t\t\tnh = (uint16_t)hopsv4[ipv4_arr_assem++];\n+\t\t\telse\n+\t\t\t\tnh = (uint16_t)hopsv6[ipv6_arr_assem++];\n+\t\t\tif (nh != FIB_DEFAULT_HOP)\n+\t\t\t\tevents[i].mbuf->port = nh;\n+\t\t}\n+\n+\t\tif (flags & L3FWD_EVENT_TX_ENQ) {\n+\t\t\tnb_enq = rte_event_enqueue_burst(event_d_id, event_p_id,\n+\t\t\t\t\tevents, nb_deq);\n+\t\t\twhile (nb_enq < nb_deq && !force_quit)\n+\t\t\t\tnb_enq += rte_event_enqueue_burst(event_d_id,\n+\t\t\t\t\t\tevent_p_id, events + nb_enq,\n+\t\t\t\t\t\tnb_deq - nb_enq);\n+\t\t}\n+\n+\t\tif (flags & L3FWD_EVENT_TX_DIRECT) {\n+\t\t\tnb_enq = rte_event_eth_tx_adapter_enqueue(event_d_id,\n+\t\t\t\t\tevent_p_id, events, nb_deq, 0);\n+\t\t\twhile (nb_enq < nb_deq && !force_quit)\n+\t\t\t\tnb_enq += rte_event_eth_tx_adapter_enqueue(\n+\t\t\t\t\t\tevent_d_id, event_p_id,\n+\t\t\t\t\t\tevents + nb_enq,\n+\t\t\t\t\t\tnb_deq - nb_enq, 0);\n+\t\t}\n+\t}\n+}\n+\n int __rte_noinline\n fib_event_main_loop_tx_d(__rte_unused void *dummy)\n {\n+\tstruct l3fwd_event_resources *evt_rsrc =\n+\t\t\tl3fwd_get_eventdev_rsrc();\n+\n+\tfib_event_loop(evt_rsrc, L3FWD_EVENT_TX_DIRECT);\n \treturn 0;\n }\n \n int __rte_noinline\n fib_event_main_loop_tx_d_burst(__rte_unused void *dummy)\n {\n+\tstruct l3fwd_event_resources *evt_rsrc =\n+\t\t\tl3fwd_get_eventdev_rsrc();\n+\n+\tfib_event_loop(evt_rsrc, L3FWD_EVENT_TX_DIRECT);\n \treturn 0;\n }\n \n int __rte_noinline\n fib_event_main_loop_tx_q(__rte_unused void *dummy)\n {\n+\tstruct l3fwd_event_resources *evt_rsrc =\n+\t\t\tl3fwd_get_eventdev_rsrc();\n+\n+\tfib_event_loop(evt_rsrc, L3FWD_EVENT_TX_ENQ);\n \treturn 0;\n }\n \n int __rte_noinline\n fib_event_main_loop_tx_q_burst(__rte_unused void *dummy)\n {\n+\tstruct l3fwd_event_resources *evt_rsrc =\n+\t\t\tl3fwd_get_eventdev_rsrc();\n+\n+\tfib_event_loop(evt_rsrc, L3FWD_EVENT_TX_ENQ);\n \treturn 0;\n }\n \n /* Function to setup fib. */\n void\n-setup_fib(__rte_unused const int socketid)\n-{}\n+setup_fib(const int socketid)\n+{\n+\tstruct rte_fib6_conf config;\n+\tstruct rte_fib_conf config_ipv4;\n+\tunsigned int i;\n+\tint ret;\n+\tchar s[64];\n+\tchar abuf[INET6_ADDRSTRLEN];\n+\n+\t/* Create the fib IPv4 table. */\n+\tconfig_ipv4.type = RTE_FIB_DIR24_8;\n+\tconfig_ipv4.max_routes = (1 << 16);\n+\tconfig_ipv4.default_nh = FIB_DEFAULT_HOP;\n+\tconfig_ipv4.dir24_8.nh_sz = RTE_FIB_DIR24_8_4B;\n+\tconfig_ipv4.dir24_8.num_tbl8 = (1 << 15);\n+\tsnprintf(s, sizeof(s), \"IPV4_L3FWD_FIB_%d\", socketid);\n+\tipv4_l3fwd_fib_lookup_struct[socketid] =\n+\t\t\trte_fib_create(s, socketid, &config_ipv4);\n+\tif (ipv4_l3fwd_fib_lookup_struct[socketid] == NULL)\n+\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\"Unable to create the l3fwd FIB table on socket %d\\n\",\n+\t\t\tsocketid);\n+\n+\t/* Populate the fib ipv4 table. */\n+\tfor (i = 0; i < RTE_DIM(ipv4_l3fwd_common_route_array); i++) {\n+\t\tstruct in_addr in;\n+\n+\t\t/* Skip unused ports. */\n+\t\tif ((1 << ipv4_l3fwd_common_route_array[i].if_out &\n+\t\t\t\tenabled_port_mask) == 0)\n+\t\t\tcontinue;\n+\n+\t\tret = rte_fib_add(ipv4_l3fwd_fib_lookup_struct[socketid],\n+\t\t\tipv4_l3fwd_common_route_array[i].ip,\n+\t\t\tipv4_l3fwd_common_route_array[i].depth,\n+\t\t\tipv4_l3fwd_common_route_array[i].if_out);\n+\n+\t\tif (ret < 0) {\n+\t\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\t\t\"Unable to add entry %u to the l3fwd FIB table on socket %d\\n\",\n+\t\t\t\t\ti, socketid);\n+\t\t}\n+\n+\t\tin.s_addr = htonl(ipv4_l3fwd_common_route_array[i].ip);\n+\t\tif (inet_ntop(AF_INET, &in, abuf, sizeof(abuf)) != NULL) {\n+\t\t\tprintf(\"FIB: Adding route %s / %d (%d)\\n\",\n+\t\t\t\tabuf,\n+\t\t\t\tipv4_l3fwd_common_route_array[i].depth,\n+\t\t\t\tipv4_l3fwd_common_route_array[i].if_out);\n+\t\t} else {\n+\t\t\tprintf(\"FIB: IPv4 route added to port %d\\n\",\n+\t\t\t\tipv4_l3fwd_common_route_array[i].if_out);\n+\t\t}\n+\t}\n+\n+\t/* Create the fib IPv6 table. */\n+\tsnprintf(s, sizeof(s), \"IPV6_L3FWD_FIB_%d\", socketid);\n+\n+\tconfig.type = RTE_FIB6_TRIE;\n+\tconfig.max_routes = (1 << 16) - 1;\n+\tconfig.default_nh = FIB_DEFAULT_HOP;\n+\tconfig.trie.nh_sz = RTE_FIB6_TRIE_4B;\n+\tconfig.trie.num_tbl8 = (1 << 15);\n+\tipv6_l3fwd_fib_lookup_struct[socketid] = rte_fib6_create(s, socketid,\n+\t\t\t&config);\n+\tif (ipv6_l3fwd_fib_lookup_struct[socketid] == NULL)\n+\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\t\"Unable to create the l3fwd FIB table on socket %d\\n\",\n+\t\t\t\tsocketid);\n+\n+\t/* Populate the fib IPv6 table. */\n+\tfor (i = 0; i < RTE_DIM(ipv6_l3fwd_common_route_array); i++) {\n+\n+\t\t/* Skip unused ports. */\n+\t\tif ((1 << ipv6_l3fwd_common_route_array[i].if_out &\n+\t\t\t\tenabled_port_mask) == 0)\n+\t\t\tcontinue;\n+\n+\t\tret = rte_fib6_add(ipv6_l3fwd_fib_lookup_struct[socketid],\n+\t\t\tipv6_l3fwd_common_route_array[i].ip,\n+\t\t\tipv6_l3fwd_common_route_array[i].depth,\n+\t\t\tipv6_l3fwd_common_route_array[i].if_out);\n+\n+\t\tif (ret < 0) {\n+\t\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\t\t\"Unable to add entry %u to the l3fwd FIB table on socket %d\\n\",\n+\t\t\t\t\ti, socketid);\n+\t\t}\n+\n+\t\tif (inet_ntop(AF_INET6, ipv6_l3fwd_common_route_array[i].ip,\n+\t\t\t\tabuf, sizeof(abuf)) != NULL) {\n+\t\t\tprintf(\"FIB: Adding route %s / %d (%d)\\n\",\n+\t\t\t\tabuf,\n+\t\t\t\tipv6_l3fwd_common_route_array[i].depth,\n+\t\t\t\tipv6_l3fwd_common_route_array[i].if_out);\n+\t\t} else {\n+\t\t\tprintf(\"FIB: IPv6 route added to port %d\\n\",\n+\t\t\t\tipv6_l3fwd_common_route_array[i].if_out);\n+\t\t}\n+\t}\n+}\n \n /* Return ipv4 fib lookup struct. */\n void *\n-fib_get_ipv4_l3fwd_lookup_struct(__rte_unused const int socketid)\n+fib_get_ipv4_l3fwd_lookup_struct(const int socketid)\n {\n-\treturn 0;\n+\treturn ipv4_l3fwd_fib_lookup_struct[socketid];\n }\n \n /* Return ipv6 fib lookup struct. */\n void *\n-fib_get_ipv6_l3fwd_lookup_struct(__rte_unused const int socketid)\n+fib_get_ipv6_l3fwd_lookup_struct(const int socketid)\n {\n-\treturn 0;\n+\treturn ipv6_l3fwd_fib_lookup_struct[socketid];\n }\n",
    "prefixes": [
        "v5",
        "4/5"
    ]
}