get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 70193,
    "url": "https://patches.dpdk.org/api/patches/70193/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1589391919-20388-1-git-send-email-anoobj@marvell.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": "<1589391919-20388-1-git-send-email-anoobj@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1589391919-20388-1-git-send-email-anoobj@marvell.com",
    "date": "2020-05-13T17:45:19",
    "name": "[v4] examples/ipsec-secgw: add per core packet stats",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "b1c460a2f9b167792260cf922008fb9cb3819723",
    "submitter": {
        "id": 1205,
        "url": "https://patches.dpdk.org/api/people/1205/?format=api",
        "name": "Anoob Joseph",
        "email": "anoobj@marvell.com"
    },
    "delegate": {
        "id": 6690,
        "url": "https://patches.dpdk.org/api/users/6690/?format=api",
        "username": "akhil",
        "first_name": "akhil",
        "last_name": "goyal",
        "email": "gakhil@marvell.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1589391919-20388-1-git-send-email-anoobj@marvell.com/mbox/",
    "series": [
        {
            "id": 10040,
            "url": "https://patches.dpdk.org/api/series/10040/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=10040",
            "date": "2020-05-13T17:45:19",
            "name": "[v4] examples/ipsec-secgw: add per core packet stats",
            "version": 4,
            "mbox": "https://patches.dpdk.org/series/10040/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/70193/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/70193/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 24652A00C5;\n\tWed, 13 May 2020 19:46:39 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id E87221D655;\n\tWed, 13 May 2020 19:46:37 +0200 (CEST)",
            "from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com\n [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 181321D654\n for <dev@dpdk.org>; Wed, 13 May 2020 19:46:36 +0200 (CEST)",
            "from pps.filterd (m0045851.ppops.net [127.0.0.1])\n by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id\n 04DHQE1f012513; Wed, 13 May 2020 10:46:36 -0700",
            "from sc-exch02.marvell.com ([199.233.58.182])\n by mx0b-0016f401.pphosted.com with ESMTP id 3100xjwwa4-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);\n Wed, 13 May 2020 10:46:35 -0700",
            "from DC5-EXCH02.marvell.com (10.69.176.39) by SC-EXCH02.marvell.com\n (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2;\n Wed, 13 May 2020 10:46:33 -0700",
            "from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com\n (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.2;\n Wed, 13 May 2020 10:46:32 -0700",
            "from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend\n Transport; Wed, 13 May 2020 10:46:32 -0700",
            "from ajoseph83.caveonetworks.com (ajoseph83.caveonetworks.com\n [10.29.45.60])\n by maili.marvell.com (Postfix) with ESMTP id 40E883F703F;\n Wed, 13 May 2020 10:46:30 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;\n h=from : to : cc :\n subject : date : message-id : in-reply-to : references : mime-version :\n content-transfer-encoding : content-type; s=pfpt0818;\n bh=/SwrSiZUuuQBneICZ1P60tjAND2ZuVhmtvq/KkCW98o=;\n b=sy23xM9pK5KN0jigp26u0yY7BGc8AZKrwgxHTQKiG8rCfN0a2FbtZtWHosDFUti66F8U\n LaZ2l+TEwYIMVuai7GqZAXgA5JluiQZkbc2hxKh9Cq8xjnHe9SJBalvqkZhxhVYe8HCd\n 3vsjwku9phaofy8+Uj5aTOpn9hmENED3HlCZrmfbeNBCBFag8c4HG00ksalUoKctF6rm\n zog+P/LokVQref7xbMBawDg39dbqWXLErMAPtbDZDwxcCij8H06FuxyXJXJxtWlrmHct\n XLwV1AJ2ZBooWeT8kTnDbAu8QIwrJ/CN+1HKS7AE7dcmrSQYoHMJab7EFPBPXHnfSuDa cw==",
        "From": "Anoob Joseph <anoobj@marvell.com>",
        "To": "Akhil Goyal <akhil.goyal@nxp.com>, Radu Nicolau <radu.nicolau@intel.com>",
        "CC": "Anoob Joseph <anoobj@marvell.com>, Narayana Prasad <pathreya@marvell.com>,\n Konstantin Ananyev <konstantin.ananyev@intel.com>, <dev@dpdk.org>",
        "Date": "Wed, 13 May 2020 23:15:19 +0530",
        "Message-ID": "<1589391919-20388-1-git-send-email-anoobj@marvell.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1588769253-10405-1-git-send-email-anoobj@marvell.com>",
        "References": "<1588769253-10405-1-git-send-email-anoobj@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10434:6.0.216, 18.0.676\n definitions=2020-05-13_08:2020-05-13,\n 2020-05-13 signatures=0",
        "Subject": "[dpdk-dev] [PATCH v4] examples/ipsec-secgw: add per core packet\n\tstats",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "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": "Adding per core packet handling stats to analyze traffic distribution\nwhen multiple cores are engaged.\n\nSince aggregating the packet stats across cores would affect\nperformance, keeping the feature disabled using compile time flags.\n\nSigned-off-by: Anoob Joseph <anoobj@marvell.com>\n---\nv4:\n* Moved print stats routine to control thread\n* Added stats for rx/tx pkts per call\n* Replaced free_pkt(m) with free_pkts(&m, 1)\n\nv3:\n* Added wrapper functions for updating rx, tx & dropped counts\n* Updated free_pkts() so that stats is updated internally\n* Introduced similar free_pkt() function which updates stats and frees the packet\n* Moved all inline functions and macros to ipsec-secgw.h\n* Made STATS_INTERVAL macro to control the interval of the stats update.\n  STATS_INTERVAL = 0 would disable the feature.\n\nv2:\n* Added lookup failure cases to drop count\n\n examples/ipsec-secgw/ipsec-secgw.c   | 114 ++++++++++++++++++++++++++++-------\n examples/ipsec-secgw/ipsec-secgw.h   |  66 ++++++++++++++++++++\n examples/ipsec-secgw/ipsec.c         |  20 +++---\n examples/ipsec-secgw/ipsec_process.c |  11 +---\n 4 files changed, 170 insertions(+), 41 deletions(-)",
    "diff": "diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c\nindex f777ce2..d2b5b2c 100644\n--- a/examples/ipsec-secgw/ipsec-secgw.c\n+++ b/examples/ipsec-secgw/ipsec-secgw.c\n@@ -47,6 +47,7 @@\n #include <rte_eventdev.h>\n #include <rte_ip.h>\n #include <rte_ip_frag.h>\n+#include <rte_alarm.h>\n \n #include \"event_helper.h\"\n #include \"ipsec.h\"\n@@ -287,6 +288,70 @@ adjust_ipv6_pktlen(struct rte_mbuf *m, const struct rte_ipv6_hdr *iph,\n \t}\n }\n \n+#if (STATS_INTERVAL > 0)\n+\n+/* Print out statistics on packet distribution */\n+static void\n+print_stats_cb(__rte_unused void *param)\n+{\n+\tuint64_t total_packets_dropped, total_packets_tx, total_packets_rx;\n+\tfloat burst_percent, rx_per_call, tx_per_call;\n+\tunsigned int coreid;\n+\n+\ttotal_packets_dropped = 0;\n+\ttotal_packets_tx = 0;\n+\ttotal_packets_rx = 0;\n+\n+\tconst char clr[] = { 27, '[', '2', 'J', '\\0' };\n+\tconst char topLeft[] = { 27, '[', '1', ';', '1', 'H', '\\0' };\n+\n+\t/* Clear screen and move to top left */\n+\tprintf(\"%s%s\", clr, topLeft);\n+\n+\tprintf(\"\\nCore statistics ====================================\");\n+\n+\tfor (coreid = 0; coreid < RTE_MAX_LCORE; coreid++) {\n+\t\t/* skip disabled cores */\n+\t\tif (rte_lcore_is_enabled(coreid) == 0)\n+\t\t\tcontinue;\n+\t\tburst_percent = (float)(core_statistics[coreid].burst_rx * 100)/\n+\t\t\t\t\tcore_statistics[coreid].rx;\n+\t\trx_per_call =  (float)(core_statistics[coreid].rx)/\n+\t\t\t\t       core_statistics[coreid].rx_call;\n+\t\ttx_per_call =  (float)(core_statistics[coreid].tx)/\n+\t\t\t\t       core_statistics[coreid].tx_call;\n+\t\tprintf(\"\\nStatistics for core %u ------------------------------\"\n+\t\t\t   \"\\nPackets received: %20\"PRIu64\n+\t\t\t   \"\\nPackets sent: %24\"PRIu64\n+\t\t\t   \"\\nPackets dropped: %21\"PRIu64\n+\t\t\t   \"\\nBurst percent: %23.2f\"\n+\t\t\t   \"\\nPackets per Rx call: %17.2f\"\n+\t\t\t   \"\\nPackets per Tx call: %17.2f\",\n+\t\t\t   coreid,\n+\t\t\t   core_statistics[coreid].rx,\n+\t\t\t   core_statistics[coreid].tx,\n+\t\t\t   core_statistics[coreid].dropped,\n+\t\t\t   burst_percent,\n+\t\t\t   rx_per_call,\n+\t\t\t   tx_per_call);\n+\n+\t\ttotal_packets_dropped += core_statistics[coreid].dropped;\n+\t\ttotal_packets_tx += core_statistics[coreid].tx;\n+\t\ttotal_packets_rx += core_statistics[coreid].rx;\n+\t}\n+\tprintf(\"\\nAggregate statistics ===============================\"\n+\t\t   \"\\nTotal packets received: %14\"PRIu64\n+\t\t   \"\\nTotal packets sent: %18\"PRIu64\n+\t\t   \"\\nTotal packets dropped: %15\"PRIu64,\n+\t\t   total_packets_rx,\n+\t\t   total_packets_tx,\n+\t\t   total_packets_dropped);\n+\tprintf(\"\\n====================================================\\n\");\n+\n+\trte_eal_alarm_set(STATS_INTERVAL * US_PER_S, print_stats_cb, NULL);\n+}\n+#endif /* STATS_INTERVAL */\n+\n static inline void\n prepare_one_packet(struct rte_mbuf *pkt, struct ipsec_traffic *t)\n {\n@@ -332,7 +397,7 @@ prepare_one_packet(struct rte_mbuf *pkt, struct ipsec_traffic *t)\n \n \t\t/* drop packet when IPv6 header exceeds first segment length */\n \t\tif (unlikely(l3len > pkt->data_len)) {\n-\t\t\trte_pktmbuf_free(pkt);\n+\t\t\tfree_pkts(&pkt, 1);\n \t\t\treturn;\n \t\t}\n \n@@ -349,7 +414,7 @@ prepare_one_packet(struct rte_mbuf *pkt, struct ipsec_traffic *t)\n \t\t/* Unknown/Unsupported type, drop the packet */\n \t\tRTE_LOG(ERR, IPSEC, \"Unsupported packet type 0x%x\\n\",\n \t\t\trte_be_to_cpu_16(eth->ether_type));\n-\t\trte_pktmbuf_free(pkt);\n+\t\tfree_pkts(&pkt, 1);\n \t\treturn;\n \t}\n \n@@ -476,9 +541,12 @@ send_burst(struct lcore_conf *qconf, uint16_t n, uint16_t port)\n \tprepare_tx_burst(m_table, n, port, qconf);\n \n \tret = rte_eth_tx_burst(port, queueid, m_table, n);\n+\n+\tcore_stats_update_tx(ret);\n+\n \tif (unlikely(ret < n)) {\n \t\tdo {\n-\t\t\trte_pktmbuf_free(m_table[ret]);\n+\t\t\tfree_pkts(&m_table[ret], 1);\n \t\t} while (++ret < n);\n \t}\n \n@@ -524,7 +592,7 @@ send_fragment_packet(struct lcore_conf *qconf, struct rte_mbuf *m,\n \t\t\t\"error code: %d\\n\",\n \t\t\t__func__, m->pkt_len, rte_errno);\n \n-\trte_pktmbuf_free(m);\n+\tfree_pkts(&m, 1);\n \treturn len;\n }\n \n@@ -549,7 +617,7 @@ send_single_packet(struct rte_mbuf *m, uint16_t port, uint8_t proto)\n \t} else if (frag_tbl_sz > 0)\n \t\tlen = send_fragment_packet(qconf, m, port, proto);\n \telse\n-\t\trte_pktmbuf_free(m);\n+\t\tfree_pkts(&m, 1);\n \n \t/* enough pkts to be sent */\n \tif (unlikely(len == MAX_PKT_BURST)) {\n@@ -583,19 +651,19 @@ inbound_sp_sa(struct sp_ctx *sp, struct sa_ctx *sa, struct traffic_type *ip,\n \t\t\tcontinue;\n \t\t}\n \t\tif (res == DISCARD) {\n-\t\t\trte_pktmbuf_free(m);\n+\t\t\tfree_pkts(&m, 1);\n \t\t\tcontinue;\n \t\t}\n \n \t\t/* Only check SPI match for processed IPSec packets */\n \t\tif (i < lim && ((m->ol_flags & PKT_RX_SEC_OFFLOAD) == 0)) {\n-\t\t\trte_pktmbuf_free(m);\n+\t\t\tfree_pkts(&m, 1);\n \t\t\tcontinue;\n \t\t}\n \n \t\tsa_idx = res - 1;\n \t\tif (!inbound_sa_check(sa, m, sa_idx)) {\n-\t\t\trte_pktmbuf_free(m);\n+\t\t\tfree_pkts(&m, 1);\n \t\t\tcontinue;\n \t\t}\n \t\tip->pkts[j++] = m;\n@@ -630,7 +698,7 @@ split46_traffic(struct ipsec_traffic *trf, struct rte_mbuf *mb[], uint32_t num)\n \t\t\t\t\toffsetof(struct ip6_hdr, ip6_nxt));\n \t\t\tn6++;\n \t\t} else\n-\t\t\trte_pktmbuf_free(m);\n+\t\t\tfree_pkts(&m, 1);\n \t}\n \n \ttrf->ip4.num = n4;\n@@ -682,7 +750,7 @@ outbound_sp(struct sp_ctx *sp, struct traffic_type *ip,\n \t\tm = ip->pkts[i];\n \t\tsa_idx = ip->res[i] - 1;\n \t\tif (ip->res[i] == DISCARD)\n-\t\t\trte_pktmbuf_free(m);\n+\t\t\tfree_pkts(&m, 1);\n \t\telse if (ip->res[i] == BYPASS)\n \t\t\tip->pkts[j++] = m;\n \t\telse {\n@@ -701,8 +769,7 @@ process_pkts_outbound(struct ipsec_ctx *ipsec_ctx,\n \tuint16_t idx, nb_pkts_out, i;\n \n \t/* Drop any IPsec traffic from protected ports */\n-\tfor (i = 0; i < traffic->ipsec.num; i++)\n-\t\trte_pktmbuf_free(traffic->ipsec.pkts[i]);\n+\tfree_pkts(traffic->ipsec.pkts, traffic->ipsec.num);\n \n \ttraffic->ipsec.num = 0;\n \n@@ -742,14 +809,12 @@ process_pkts_inbound_nosp(struct ipsec_ctx *ipsec_ctx,\n \tuint32_t nb_pkts_in, i, idx;\n \n \t/* Drop any IPv4 traffic from unprotected ports */\n-\tfor (i = 0; i < traffic->ip4.num; i++)\n-\t\trte_pktmbuf_free(traffic->ip4.pkts[i]);\n+\tfree_pkts(traffic->ip4.pkts, traffic->ip4.num);\n \n \ttraffic->ip4.num = 0;\n \n \t/* Drop any IPv6 traffic from unprotected ports */\n-\tfor (i = 0; i < traffic->ip6.num; i++)\n-\t\trte_pktmbuf_free(traffic->ip6.pkts[i]);\n+\tfree_pkts(traffic->ip6.pkts, traffic->ip6.num);\n \n \ttraffic->ip6.num = 0;\n \n@@ -785,8 +850,7 @@ process_pkts_outbound_nosp(struct ipsec_ctx *ipsec_ctx,\n \tstruct ip *ip;\n \n \t/* Drop any IPsec traffic from protected ports */\n-\tfor (i = 0; i < traffic->ipsec.num; i++)\n-\t\trte_pktmbuf_free(traffic->ipsec.pkts[i]);\n+\tfree_pkts(traffic->ipsec.pkts, traffic->ipsec.num);\n \n \tn = 0;\n \n@@ -900,7 +964,7 @@ route4_pkts(struct rt_ctx *rt_ctx, struct rte_mbuf *pkts[], uint8_t nb_pkts)\n \t\t}\n \n \t\tif ((pkt_hop & RTE_LPM_LOOKUP_SUCCESS) == 0) {\n-\t\t\trte_pktmbuf_free(pkts[i]);\n+\t\t\tfree_pkts(&pkts[i], 1);\n \t\t\tcontinue;\n \t\t}\n \t\tsend_single_packet(pkts[i], pkt_hop & 0xff, IPPROTO_IP);\n@@ -952,7 +1016,7 @@ route6_pkts(struct rt_ctx *rt_ctx, struct rte_mbuf *pkts[], uint8_t nb_pkts)\n \t\t}\n \n \t\tif (pkt_hop == -1) {\n-\t\t\trte_pktmbuf_free(pkts[i]);\n+\t\t\tfree_pkts(&pkts[i], 1);\n \t\t\tcontinue;\n \t\t}\n \t\tsend_single_packet(pkts[i], pkt_hop & 0xff, IPPROTO_IPV6);\n@@ -1168,8 +1232,10 @@ ipsec_poll_mode_worker(void)\n \t\t\tnb_rx = rte_eth_rx_burst(portid, queueid,\n \t\t\t\t\tpkts, MAX_PKT_BURST);\n \n-\t\t\tif (nb_rx > 0)\n+\t\t\tif (nb_rx > 0) {\n+\t\t\t\tcore_stats_update_rx(nb_rx);\n \t\t\t\tprocess_pkts(qconf, pkts, nb_rx, portid);\n+\t\t\t}\n \n \t\t\t/* dequeue and process completed crypto-ops */\n \t\t\tif (is_unprotected_port(portid))\n@@ -2916,6 +2982,12 @@ main(int32_t argc, char **argv)\n \n \tcheck_all_ports_link_status(enabled_port_mask);\n \n+#if (STATS_INTERVAL > 0)\n+\trte_eal_alarm_set(STATS_INTERVAL * US_PER_S, print_stats_cb, NULL);\n+#else\n+\tRTE_LOG(INFO, IPSEC, \"Stats display disabled\\n\");\n+#endif /* STATS_INTERVAL */\n+\n \t/* launch per-lcore init on every lcore */\n \trte_eal_mp_remote_launch(ipsec_launch_one_lcore, eh_conf, CALL_MASTER);\n \tRTE_LCORE_FOREACH_SLAVE(lcore_id) {\ndiff --git a/examples/ipsec-secgw/ipsec-secgw.h b/examples/ipsec-secgw/ipsec-secgw.h\nindex 4b53cb5..572a930 100644\n--- a/examples/ipsec-secgw/ipsec-secgw.h\n+++ b/examples/ipsec-secgw/ipsec-secgw.h\n@@ -6,6 +6,10 @@\n \n #include <stdbool.h>\n \n+#ifndef STATS_INTERVAL\n+#define STATS_INTERVAL 0\n+#endif\n+\n #define NB_SOCKETS 4\n \n #define MAX_PKT_BURST 32\n@@ -69,6 +73,19 @@ struct ethaddr_info {\n \tuint64_t src, dst;\n };\n \n+#if (STATS_INTERVAL > 0)\n+struct ipsec_core_statistics {\n+\tuint64_t tx;\n+\tuint64_t rx;\n+\tuint64_t rx_call;\n+\tuint64_t tx_call;\n+\tuint64_t dropped;\n+\tuint64_t burst_rx;\n+} __rte_cache_aligned;\n+\n+struct ipsec_core_statistics core_statistics[RTE_MAX_LCORE];\n+#endif /* STATS_INTERVAL */\n+\n extern struct ethaddr_info ethaddr_tbl[RTE_MAX_ETHPORTS];\n \n /* Port mask to identify the unprotected ports */\n@@ -85,4 +102,53 @@ is_unprotected_port(uint16_t port_id)\n \treturn unprotected_port_mask & (1 << port_id);\n }\n \n+static inline void\n+core_stats_update_rx(int n)\n+{\n+#if (STATS_INTERVAL > 0)\n+\tint lcore_id = rte_lcore_id();\n+\tcore_statistics[lcore_id].rx += n;\n+\tcore_statistics[lcore_id].rx_call++;\n+\tif (n == MAX_PKT_BURST)\n+\t\tcore_statistics[lcore_id].burst_rx += n;\n+#else\n+\tRTE_SET_USED(n);\n+#endif /* STATS_INTERVAL */\n+}\n+\n+static inline void\n+core_stats_update_tx(int n)\n+{\n+#if (STATS_INTERVAL > 0)\n+\tint lcore_id = rte_lcore_id();\n+\tcore_statistics[lcore_id].tx += n;\n+\tcore_statistics[lcore_id].tx_call++;\n+#else\n+\tRTE_SET_USED(n);\n+#endif /* STATS_INTERVAL */\n+}\n+\n+static inline void\n+core_stats_update_drop(int n)\n+{\n+#if (STATS_INTERVAL > 0)\n+\tint lcore_id = rte_lcore_id();\n+\tcore_statistics[lcore_id].dropped += n;\n+#else\n+\tRTE_SET_USED(n);\n+#endif /* STATS_INTERVAL */\n+}\n+\n+/* helper routine to free bulk of packets */\n+static inline void\n+free_pkts(struct rte_mbuf *mb[], uint32_t n)\n+{\n+\tuint32_t i;\n+\n+\tfor (i = 0; i != n; i++)\n+\t\trte_pktmbuf_free(mb[i]);\n+\n+\tcore_stats_update_drop(n);\n+}\n+\n #endif /* _IPSEC_SECGW_H_ */\ndiff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c\nindex bf88d80..01faa7a 100644\n--- a/examples/ipsec-secgw/ipsec.c\n+++ b/examples/ipsec-secgw/ipsec.c\n@@ -500,7 +500,7 @@ enqueue_cop_burst(struct cdev_qp *cqp)\n \t\t\tcqp->id, cqp->qp, ret, len);\n \t\t\t/* drop packets that we fail to enqueue */\n \t\t\tfor (i = ret; i < len; i++)\n-\t\t\t\trte_pktmbuf_free(cqp->buf[i]->sym->m_src);\n+\t\t\t\tfree_pkts(&cqp->buf[i]->sym->m_src, 1);\n \t}\n \tcqp->in_flight += ret;\n \tcqp->len = 0;\n@@ -528,7 +528,7 @@ ipsec_enqueue(ipsec_xform_fn xform_func, struct ipsec_ctx *ipsec_ctx,\n \n \tfor (i = 0; i < nb_pkts; i++) {\n \t\tif (unlikely(sas[i] == NULL)) {\n-\t\t\trte_pktmbuf_free(pkts[i]);\n+\t\t\tfree_pkts(&pkts[i], 1);\n \t\t\tcontinue;\n \t\t}\n \n@@ -549,7 +549,7 @@ ipsec_enqueue(ipsec_xform_fn xform_func, struct ipsec_ctx *ipsec_ctx,\n \n \t\t\tif ((unlikely(ips->security.ses == NULL)) &&\n \t\t\t\tcreate_lookaside_session(ipsec_ctx, sa, ips)) {\n-\t\t\t\trte_pktmbuf_free(pkts[i]);\n+\t\t\t\tfree_pkts(&pkts[i], 1);\n \t\t\t\tcontinue;\n \t\t\t}\n \n@@ -563,7 +563,7 @@ ipsec_enqueue(ipsec_xform_fn xform_func, struct ipsec_ctx *ipsec_ctx,\n \t\tcase RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO:\n \t\t\tRTE_LOG(ERR, IPSEC, \"CPU crypto is not supported by the\"\n \t\t\t\t\t\" legacy mode.\");\n-\t\t\trte_pktmbuf_free(pkts[i]);\n+\t\t\tfree_pkts(&pkts[i], 1);\n \t\t\tcontinue;\n \n \t\tcase RTE_SECURITY_ACTION_TYPE_NONE:\n@@ -575,7 +575,7 @@ ipsec_enqueue(ipsec_xform_fn xform_func, struct ipsec_ctx *ipsec_ctx,\n \n \t\t\tif ((unlikely(ips->crypto.ses == NULL)) &&\n \t\t\t\tcreate_lookaside_session(ipsec_ctx, sa, ips)) {\n-\t\t\t\trte_pktmbuf_free(pkts[i]);\n+\t\t\t\tfree_pkts(&pkts[i], 1);\n \t\t\t\tcontinue;\n \t\t\t}\n \n@@ -584,7 +584,7 @@ ipsec_enqueue(ipsec_xform_fn xform_func, struct ipsec_ctx *ipsec_ctx,\n \n \t\t\tret = xform_func(pkts[i], sa, &priv->cop);\n \t\t\tif (unlikely(ret)) {\n-\t\t\t\trte_pktmbuf_free(pkts[i]);\n+\t\t\t\tfree_pkts(&pkts[i], 1);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tbreak;\n@@ -608,7 +608,7 @@ ipsec_enqueue(ipsec_xform_fn xform_func, struct ipsec_ctx *ipsec_ctx,\n \n \t\t\tret = xform_func(pkts[i], sa, &priv->cop);\n \t\t\tif (unlikely(ret)) {\n-\t\t\t\trte_pktmbuf_free(pkts[i]);\n+\t\t\t\tfree_pkts(&pkts[i], 1);\n \t\t\t\tcontinue;\n \t\t\t}\n \n@@ -643,7 +643,7 @@ ipsec_inline_dequeue(ipsec_xform_fn xform_func, struct ipsec_ctx *ipsec_ctx,\n \t\tsa = priv->sa;\n \t\tret = xform_func(pkt, sa, &priv->cop);\n \t\tif (unlikely(ret)) {\n-\t\t\trte_pktmbuf_free(pkt);\n+\t\t\tfree_pkts(&pkt, 1);\n \t\t\tcontinue;\n \t\t}\n \t\tpkts[nb_pkts++] = pkt;\n@@ -690,13 +690,13 @@ ipsec_dequeue(ipsec_xform_fn xform_func, struct ipsec_ctx *ipsec_ctx,\n \t\t\t\tRTE_SECURITY_ACTION_TYPE_NONE) {\n \t\t\t\tret = xform_func(pkt, sa, cops[j]);\n \t\t\t\tif (unlikely(ret)) {\n-\t\t\t\t\trte_pktmbuf_free(pkt);\n+\t\t\t\t\tfree_pkts(&pkt, 1);\n \t\t\t\t\tcontinue;\n \t\t\t\t}\n \t\t\t} else if (ipsec_get_action_type(sa) ==\n \t\t\t\tRTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL) {\n \t\t\t\tif (cops[j]->status) {\n-\t\t\t\t\trte_pktmbuf_free(pkt);\n+\t\t\t\t\tfree_pkts(&pkt, 1);\n \t\t\t\t\tcontinue;\n \t\t\t\t}\n \t\t\t}\ndiff --git a/examples/ipsec-secgw/ipsec_process.c b/examples/ipsec-secgw/ipsec_process.c\nindex 6d3a3c9..5012e1a 100644\n--- a/examples/ipsec-secgw/ipsec_process.c\n+++ b/examples/ipsec-secgw/ipsec_process.c\n@@ -12,22 +12,13 @@\n #include <rte_mbuf.h>\n \n #include \"ipsec.h\"\n+#include \"ipsec-secgw.h\"\n \n #define SATP_OUT_IPV4(t)\t\\\n \t((((t) & RTE_IPSEC_SATP_MODE_MASK) == RTE_IPSEC_SATP_MODE_TRANS && \\\n \t(((t) & RTE_IPSEC_SATP_IPV_MASK) == RTE_IPSEC_SATP_IPV4)) || \\\n \t((t) & RTE_IPSEC_SATP_MODE_MASK) == RTE_IPSEC_SATP_MODE_TUNLV4)\n \n-/* helper routine to free bulk of packets */\n-static inline void\n-free_pkts(struct rte_mbuf *mb[], uint32_t n)\n-{\n-\tuint32_t i;\n-\n-\tfor (i = 0; i != n; i++)\n-\t\trte_pktmbuf_free(mb[i]);\n-}\n-\n /* helper routine to free bulk of crypto-ops and related packets */\n static inline void\n free_cops(struct rte_crypto_op *cop[], uint32_t n)\n",
    "prefixes": [
        "v4"
    ]
}