get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 104466,
    "url": "http://patchwork.dpdk.org/api/patches/104466/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20211117112847.7362-3-david.marchand@redhat.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": "<20211117112847.7362-3-david.marchand@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20211117112847.7362-3-david.marchand@redhat.com",
    "date": "2021-11-17T11:28:44",
    "name": "[v2,2/5] build: make GRO/GSO optional",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "2fe563c341cb3e0e99e07ccaa7fa59cad697b8cb",
    "submitter": {
        "id": 1173,
        "url": "http://patchwork.dpdk.org/api/people/1173/?format=api",
        "name": "David Marchand",
        "email": "david.marchand@redhat.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patchwork.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20211117112847.7362-3-david.marchand@redhat.com/mbox/",
    "series": [
        {
            "id": 20618,
            "url": "http://patchwork.dpdk.org/api/series/20618/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=20618",
            "date": "2021-11-17T11:28:42",
            "name": "Extend optional libraries list",
            "version": 2,
            "mbox": "http://patchwork.dpdk.org/series/20618/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/104466/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/104466/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 2BEF9A0C41;\n\tWed, 17 Nov 2021 12:30:38 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 15926411A4;\n\tWed, 17 Nov 2021 12:30:38 +0100 (CET)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.124])\n by mails.dpdk.org (Postfix) with ESMTP id 3CB514116D\n for <dev@dpdk.org>; Wed, 17 Nov 2021 12:30:36 +0100 (CET)",
            "from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com\n [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id\n us-mta-403-rAnwFMs0OtCqGKwWwzmJAA-1; Wed, 17 Nov 2021 06:30:32 -0500",
            "from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com\n [10.5.11.23])\n (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n (No client certificate requested)\n by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3A07110168C0;\n Wed, 17 Nov 2021 11:30:31 +0000 (UTC)",
            "from dmarchan.remote.csb (unknown [10.40.192.8])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 387E91F46B;\n Wed, 17 Nov 2021 11:30:05 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1637148635;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc: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=ttZ255ma/X78Kc0l+TS+zmy9zZ+1EWsoGsjkL8MLDRE=;\n b=aDvMVY7bpsdofDQ7Yjuqzv5069mvauFp8Uw1BqPJCEXrzzHMGZPiukvj6V1PTlnwDfEB6d\n HcPNePvfic4we/OoxZNDKh/6jbFnCGxcqO3s8b4DDBdlxnCJKHjx2UrAa7hKkyO14/UVR0\n sPqxz47eI0hf0oR4QG3QkJ0dAEEcG50=",
        "X-MC-Unique": "rAnwFMs0OtCqGKwWwzmJAA-1",
        "From": "David Marchand <david.marchand@redhat.com>",
        "To": "dev@dpdk.org",
        "Cc": "bruce.richardson@intel.com, thomas@monjalon.net, bluca@debian.org,\n tredaelli@redhat.com, i.maximets@ovn.org, james.r.harris@intel.com,\n mohammed@hawari.fr, Xiaoyun Li <xiaoyun.li@intel.com>",
        "Subject": "[PATCH v2 2/5] build: make GRO/GSO optional",
        "Date": "Wed, 17 Nov 2021 12:28:44 +0100",
        "Message-Id": "<20211117112847.7362-3-david.marchand@redhat.com>",
        "In-Reply-To": "<20211117112847.7362-1-david.marchand@redhat.com>",
        "References": "<20211110164814.5231-1-david.marchand@redhat.com>\n <20211117112847.7362-1-david.marchand@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 2.84 on 10.5.11.23",
        "Authentication-Results": "relay.mimecast.com;\n auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-Originator": "redhat.com",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain; charset=\"US-ASCII\"",
        "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"
    },
    "content": "GRO and GSO integration in testpmd is relatively self contained and easy\nto extract.\nThose libraries can be made optional as they provide standalone\nfeatures.\n\nSigned-off-by: David Marchand <david.marchand@redhat.com>\nAcked-by: Bruce Richardson <bruce.richardson@intel.com>\nAcked-by: Thomas Monjalon <thomas@monjalon.net>\n---\n app/test-pmd/cmdline.c   | 14 ++++++++++++++\n app/test-pmd/config.c    |  6 ++++++\n app/test-pmd/csumonly.c  | 35 +++++++++++++++++++++++++++++------\n app/test-pmd/meson.build |  8 +++++++-\n app/test-pmd/testpmd.c   | 14 ++++++++++++++\n app/test-pmd/testpmd.h   | 18 ++++++++++++++++++\n lib/meson.build          |  2 ++\n 7 files changed, 90 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c\nindex 85d9b57a9b..3faa37db6d 100644\n--- a/app/test-pmd/cmdline.c\n+++ b/app/test-pmd/cmdline.c\n@@ -34,7 +34,9 @@\n #include <rte_string_fns.h>\n #include <rte_devargs.h>\n #include <rte_flow.h>\n+#ifdef RTE_LIB_GRO\n #include <rte_gro.h>\n+#endif\n #include <rte_mbuf_dyn.h>\n \n #include <cmdline_rdline.h>\n@@ -458,6 +460,7 @@ static void cmd_help_long_parsed(void *parsed_result,\n \t\t\t\"tso show (portid)\"\n \t\t\t\"    Display the status of TCP Segmentation Offload.\\n\\n\"\n \n+#ifdef RTE_LIB_GRO\n \t\t\t\"set port (port_id) gro on|off\\n\"\n \t\t\t\"    Enable or disable Generic Receive Offload in\"\n \t\t\t\" csum forwarding engine.\\n\\n\"\n@@ -468,7 +471,9 @@ static void cmd_help_long_parsed(void *parsed_result,\n \t\t\t\"set gro flush (cycles)\\n\"\n \t\t\t\"    Set the cycle to flush GROed packets from\"\n \t\t\t\" reassembly tables.\\n\\n\"\n+#endif\n \n+#ifdef RTE_LIB_GSO\n \t\t\t\"set port (port_id) gso (on|off)\"\n \t\t\t\"    Enable or disable Generic Segmentation Offload in\"\n \t\t\t\" csum forwarding engine.\\n\\n\"\n@@ -479,6 +484,7 @@ static void cmd_help_long_parsed(void *parsed_result,\n \n \t\t\t\"show port (port_id) gso\\n\"\n \t\t\t\"    Show GSO configuration.\\n\\n\"\n+#endif\n \n \t\t\t\"set fwd (%s)\\n\"\n \t\t\t\"    Set packet forwarding mode.\\n\\n\"\n@@ -5149,6 +5155,7 @@ cmdline_parse_inst_t cmd_tunnel_tso_show = {\n \t},\n };\n \n+#ifdef RTE_LIB_GRO\n /* *** SET GRO FOR A PORT *** */\n struct cmd_gro_enable_result {\n \tcmdline_fixed_string_t cmd_set;\n@@ -5292,7 +5299,9 @@ cmdline_parse_inst_t cmd_gro_flush = {\n \t\tNULL,\n \t},\n };\n+#endif /* RTE_LIB_GRO */\n \n+#ifdef RTE_LIB_GSO\n /* *** ENABLE/DISABLE GSO *** */\n struct cmd_gso_enable_result {\n \tcmdline_fixed_string_t cmd_set;\n@@ -5459,6 +5468,7 @@ cmdline_parse_inst_t cmd_gso_show = {\n \t\tNULL,\n \t},\n };\n+#endif /* RTE_LIB_GSO */\n \n /* *** ENABLE/DISABLE FLUSH ON RX STREAMS *** */\n struct cmd_set_flush_rx {\n@@ -17660,12 +17670,16 @@ cmdline_parse_ctx_t main_ctx[] = {\n \t(cmdline_parse_inst_t *)&cmd_tso_show,\n \t(cmdline_parse_inst_t *)&cmd_tunnel_tso_set,\n \t(cmdline_parse_inst_t *)&cmd_tunnel_tso_show,\n+#ifdef RTE_LIB_GRO\n \t(cmdline_parse_inst_t *)&cmd_gro_enable,\n \t(cmdline_parse_inst_t *)&cmd_gro_flush,\n \t(cmdline_parse_inst_t *)&cmd_gro_show,\n+#endif\n+#ifdef RTE_LIB_GSO\n \t(cmdline_parse_inst_t *)&cmd_gso_enable,\n \t(cmdline_parse_inst_t *)&cmd_gso_size,\n \t(cmdline_parse_inst_t *)&cmd_gso_show,\n+#endif\n \t(cmdline_parse_inst_t *)&cmd_link_flow_control_set,\n \t(cmdline_parse_inst_t *)&cmd_link_flow_control_set_rx,\n \t(cmdline_parse_inst_t *)&cmd_link_flow_control_set_tx,\ndiff --git a/app/test-pmd/config.c b/app/test-pmd/config.c\nindex 2c2ab449b5..6fca09527b 100644\n--- a/app/test-pmd/config.c\n+++ b/app/test-pmd/config.c\n@@ -48,7 +48,9 @@\n #ifdef RTE_NET_BNXT\n #include <rte_pmd_bnxt.h>\n #endif\n+#ifdef RTE_LIB_GRO\n #include <rte_gro.h>\n+#endif\n #include <rte_hexdump.h>\n \n #include \"testpmd.h\"\n@@ -4191,6 +4193,7 @@ set_tx_pkt_times(unsigned int *tx_times)\n \ttx_pkt_times_intra = tx_times[1];\n }\n \n+#ifdef RTE_LIB_GRO\n void\n setup_gro(const char *onoff, portid_t port_id)\n {\n@@ -4272,7 +4275,9 @@ show_gro(portid_t port_id)\n \t} else\n \t\tprintf(\"Port %u doesn't enable GRO.\\n\", port_id);\n }\n+#endif /* RTE_LIB_GRO */\n \n+#ifdef RTE_LIB_GSO\n void\n setup_gso(const char *mode, portid_t port_id)\n {\n@@ -4296,6 +4301,7 @@ setup_gso(const char *mode, portid_t port_id)\n \t\tgso_ports[port_id].enable = 0;\n \t}\n }\n+#endif /* RTE_LIB_GSO */\n \n char*\n list_pkt_forwarding_modes(void)\ndiff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c\nindex e0b00abe8c..2aeea243b6 100644\n--- a/app/test-pmd/csumonly.c\n+++ b/app/test-pmd/csumonly.c\n@@ -40,8 +40,12 @@\n #include <rte_prefetch.h>\n #include <rte_string_fns.h>\n #include <rte_flow.h>\n+#ifdef RTE_LIB_GRO\n #include <rte_gro.h>\n+#endif\n+#ifdef RTE_LIB_GSO\n #include <rte_gso.h>\n+#endif\n #include <rte_geneve.h>\n \n #include \"testpmd.h\"\n@@ -68,7 +72,9 @@ uint16_t geneve_udp_port = RTE_GENEVE_DEFAULT_PORT;\n /* structure that caches offload info for the current packet */\n struct testpmd_offload_info {\n \tuint16_t ethertype;\n+#ifdef RTE_LIB_GSO\n \tuint8_t gso_enable;\n+#endif\n \tuint16_t l2_len;\n \tuint16_t l3_len;\n \tuint16_t l4_len;\n@@ -510,8 +516,10 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,\n \t\t\t\t\t\tinfo->ethertype);\n \t\t\t}\n \t\t}\n+#ifdef RTE_LIB_GSO\n \t\tif (info->gso_enable)\n \t\t\tol_flags |= RTE_MBUF_F_TX_UDP_SEG;\n+#endif\n \t} else if (info->l4_proto == IPPROTO_TCP) {\n \t\ttcp_hdr = (struct rte_tcp_hdr *)((char *)l3_hdr + info->l3_len);\n \t\tif (tso_segsz)\n@@ -524,8 +532,10 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,\n \t\t\t\tget_udptcp_checksum(l3_hdr, tcp_hdr,\n \t\t\t\t\tinfo->ethertype);\n \t\t}\n+#ifdef RTE_LIB_GSO\n \t\tif (info->gso_enable)\n \t\t\tol_flags |= RTE_MBUF_F_TX_TCP_SEG;\n+#endif\n \t} else if (info->l4_proto == IPPROTO_SCTP) {\n \t\tsctp_hdr = (struct rte_sctp_hdr *)\n \t\t\t((char *)l3_hdr + info->l3_len);\n@@ -794,16 +804,20 @@ static void\n pkt_burst_checksum_forward(struct fwd_stream *fs)\n {\n \tstruct rte_mbuf *pkts_burst[MAX_PKT_BURST];\n+#ifdef RTE_LIB_GSO\n \tstruct rte_mbuf *gso_segments[GSO_MAX_PKT_BURST];\n \tstruct rte_gso_ctx *gso_ctx;\n+#endif\n \tstruct rte_mbuf **tx_pkts_burst;\n \tstruct rte_port *txp;\n \tstruct rte_mbuf *m, *p;\n \tstruct rte_ether_hdr *eth_hdr;\n \tvoid *l3_hdr = NULL, *outer_l3_hdr = NULL; /* can be IPv4 or IPv6 */\n+#ifdef RTE_LIB_GRO\n \tvoid **gro_ctx;\n \tuint16_t gro_pkts_num;\n \tuint8_t gro_enable;\n+#endif\n \tuint16_t nb_rx;\n \tuint16_t nb_tx;\n \tuint16_t nb_prep;\n@@ -816,8 +830,6 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)\n \tuint32_t rx_bad_outer_l4_csum;\n \tuint32_t rx_bad_outer_ip_csum;\n \tstruct testpmd_offload_info info;\n-\tuint16_t nb_segments = 0;\n-\tint ret;\n \n \tuint64_t start_tsc = 0;\n \n@@ -835,15 +847,19 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)\n \trx_bad_l4_csum = 0;\n \trx_bad_outer_l4_csum = 0;\n \trx_bad_outer_ip_csum = 0;\n+#ifdef RTE_LIB_GRO\n \tgro_enable = gro_ports[fs->rx_port].enable;\n+#endif\n \n \ttxp = &ports[fs->tx_port];\n \ttx_offloads = txp->dev_conf.txmode.offloads;\n \tmemset(&info, 0, sizeof(info));\n \tinfo.tso_segsz = txp->tso_segsz;\n \tinfo.tunnel_tso_segsz = txp->tunnel_tso_segsz;\n+#ifdef RTE_LIB_GSO\n \tif (gso_ports[fs->tx_port].enable)\n \t\tinfo.gso_enable = 1;\n+#endif\n \n \tfor (i = 0; i < nb_rx; i++) {\n \t\tif (likely(i < nb_rx - 1))\n@@ -1052,6 +1068,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)\n \t\t}\n \t}\n \n+#ifdef RTE_LIB_GRO\n \tif (unlikely(gro_enable)) {\n \t\tif (gro_flush_cycles == GRO_DEFAULT_FLUSH_CYCLES) {\n \t\t\tnb_rx = rte_gro_reassemble_burst(pkts_burst, nb_rx,\n@@ -1073,13 +1090,17 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)\n \t\t\t}\n \t\t}\n \t}\n+#endif\n+\n+#ifdef RTE_LIB_GSO\n+\tif (gso_ports[fs->tx_port].enable != 0) {\n+\t\tuint16_t nb_segments = 0;\n \n-\tif (gso_ports[fs->tx_port].enable == 0)\n-\t\ttx_pkts_burst = pkts_burst;\n-\telse {\n \t\tgso_ctx = &(current_fwd_lcore()->gso_ctx);\n \t\tgso_ctx->gso_size = gso_max_segment_size;\n \t\tfor (i = 0; i < nb_rx; i++) {\n+\t\t\tint ret;\n+\n \t\t\tret = rte_gso_segment(pkts_burst[i], gso_ctx,\n \t\t\t\t\t&gso_segments[nb_segments],\n \t\t\t\t\tGSO_MAX_PKT_BURST - nb_segments);\n@@ -1101,7 +1122,9 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)\n \n \t\ttx_pkts_burst = gso_segments;\n \t\tnb_rx = nb_segments;\n-\t}\n+\t} else\n+#endif\n+\t\ttx_pkts_burst = pkts_burst;\n \n \tnb_prep = rte_eth_tx_prepare(fs->tx_port, fs->tx_queue,\n \t\t\ttx_pkts_burst, nb_rx);\ndiff --git a/app/test-pmd/meson.build b/app/test-pmd/meson.build\nindex d5df52c470..eba03b572c 100644\n--- a/app/test-pmd/meson.build\n+++ b/app/test-pmd/meson.build\n@@ -32,7 +32,7 @@ if dpdk_conf.has('RTE_HAS_JANSSON')\n     ext_deps += jansson_dep\n endif\n \n-deps += ['ethdev', 'gro', 'gso', 'cmdline', 'metrics', 'bus_pci']\n+deps += ['ethdev', 'cmdline', 'metrics', 'bus_pci']\n if dpdk_conf.has('RTE_CRYPTO_SCHEDULER')\n     deps += 'crypto_scheduler'\n endif\n@@ -43,6 +43,12 @@ if dpdk_conf.has('RTE_LIB_BPF')\n     sources += files('bpf_cmd.c')\n     deps += 'bpf'\n endif\n+if dpdk_conf.has('RTE_LIB_GRO')\n+    deps += 'gro'\n+endif\n+if dpdk_conf.has('RTE_LIB_GSO')\n+    deps += 'gso'\n+endif\n if dpdk_conf.has('RTE_LIB_LATENCYSTATS')\n     deps += 'latencystats'\n endif\ndiff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c\nindex 59cc4580b2..f74ba61be6 100644\n--- a/app/test-pmd/testpmd.c\n+++ b/app/test-pmd/testpmd.c\n@@ -517,8 +517,10 @@ lcoreid_t bitrate_lcore_id;\n uint8_t bitrate_enabled;\n #endif\n \n+#ifdef RTE_LIB_GRO\n struct gro_status gro_ports[RTE_MAX_ETHPORTS];\n uint8_t gro_flush_cycles = GRO_DEFAULT_FLUSH_CYCLES;\n+#endif\n \n /*\n  * hexadecimal bitmask of RX mq mode can be enabled.\n@@ -657,8 +659,10 @@ static void fill_xstats_display_info(void);\n  */\n static int all_ports_started(void);\n \n+#ifdef RTE_LIB_GSO\n struct gso_status gso_ports[RTE_MAX_ETHPORTS];\n uint16_t gso_max_segment_size = RTE_ETHER_MAX_LEN - RTE_ETHER_CRC_LEN;\n+#endif\n \n /* Holds the registered mbuf dynamic flags names. */\n char dynf_names[64][RTE_MBUF_DYN_NAMESIZE];\n@@ -1632,8 +1636,12 @@ init_config(void)\n \tstruct rte_mempool *mbp;\n \tunsigned int nb_mbuf_per_pool;\n \tlcoreid_t  lc_id;\n+#ifdef RTE_LIB_GRO\n \tstruct rte_gro_param gro_param;\n+#endif\n+#ifdef RTE_LIB_GSO\n \tuint32_t gso_types;\n+#endif\n \n \t/* Configuration of logical cores. */\n \tfwd_lcores = rte_zmalloc(\"testpmd: fwd_lcores\",\n@@ -1716,8 +1724,10 @@ init_config(void)\n \n \tinit_port_config();\n \n+#ifdef RTE_LIB_GSO\n \tgso_types = RTE_ETH_TX_OFFLOAD_TCP_TSO | RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO |\n \t\tRTE_ETH_TX_OFFLOAD_GRE_TNL_TSO | RTE_ETH_TX_OFFLOAD_UDP_TSO;\n+#endif\n \t/*\n \t * Records which Mbuf pool to use by each logical core, if needed.\n \t */\n@@ -1728,6 +1738,7 @@ init_config(void)\n \t\tif (mbp == NULL)\n \t\t\tmbp = mbuf_pool_find(0, 0);\n \t\tfwd_lcores[lc_id]->mbp = mbp;\n+#ifdef RTE_LIB_GSO\n \t\t/* initialize GSO context */\n \t\tfwd_lcores[lc_id]->gso_ctx.direct_pool = mbp;\n \t\tfwd_lcores[lc_id]->gso_ctx.indirect_pool = mbp;\n@@ -1735,10 +1746,12 @@ init_config(void)\n \t\tfwd_lcores[lc_id]->gso_ctx.gso_size = RTE_ETHER_MAX_LEN -\n \t\t\tRTE_ETHER_CRC_LEN;\n \t\tfwd_lcores[lc_id]->gso_ctx.flag = 0;\n+#endif\n \t}\n \n \tfwd_config_setup();\n \n+#ifdef RTE_LIB_GRO\n \t/* create a gro context for each lcore */\n \tgro_param.gro_types = RTE_GRO_TCP_IPV4;\n \tgro_param.max_flow_num = GRO_MAX_FLUSH_CYCLES;\n@@ -1752,6 +1765,7 @@ init_config(void)\n \t\t\t\t\t\"rte_gro_ctx_create() failed\\n\");\n \t\t}\n \t}\n+#endif\n }\n \n \ndiff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h\nindex 669ce1e87d..b1dfd097c7 100644\n--- a/app/test-pmd/testpmd.h\n+++ b/app/test-pmd/testpmd.h\n@@ -9,8 +9,12 @@\n \n #include <rte_pci.h>\n #include <rte_bus_pci.h>\n+#ifdef RTE_LIB_GRO\n #include <rte_gro.h>\n+#endif\n+#ifdef RTE_LIB_GSO\n #include <rte_gso.h>\n+#endif\n #include <rte_os_shim.h>\n #include <cmdline.h>\n #include <sys/queue.h>\n@@ -143,7 +147,9 @@ struct fwd_stream {\n \t/**< received packets has bad outer l4 checksum */\n \tuint64_t rx_bad_outer_ip_csum;\n \t/**< received packets having bad outer ip checksum */\n+#ifdef RTE_LIB_GRO\n \tunsigned int gro_times;\t/**< GRO operation times */\n+#endif\n \tuint64_t     core_cycles; /**< used for RX and TX processing */\n \tstruct pkt_burst_stats rx_burst_stats;\n \tstruct pkt_burst_stats tx_burst_stats;\n@@ -264,9 +270,13 @@ struct rte_port {\n  * CPU id. configuration table.\n  */\n struct fwd_lcore {\n+#ifdef RTE_LIB_GSO\n \tstruct rte_gso_ctx gso_ctx;     /**< GSO context */\n+#endif\n \tstruct rte_mempool *mbp; /**< The mbuf pool to use by this core */\n+#ifdef RTE_LIB_GRO\n \tvoid *gro_ctx;\t\t/**< GRO context */\n+#endif\n \tstreamid_t stream_idx;   /**< index of 1st stream in \"fwd_streams\" */\n \tstreamid_t stream_nb;    /**< number of streams in \"fwd_streams\" */\n \tlcoreid_t  cpuid_idx;    /**< index of logical core in CPU id table */\n@@ -560,6 +570,7 @@ extern struct rte_ether_addr peer_eth_addrs[RTE_MAX_ETHPORTS];\n extern uint32_t burst_tx_delay_time; /**< Burst tx delay time(us) for mac-retry. */\n extern uint32_t burst_tx_retry_num;  /**< Burst tx retry number for mac-retry. */\n \n+#ifdef RTE_LIB_GRO\n #define GRO_DEFAULT_ITEM_NUM_PER_FLOW 32\n #define GRO_DEFAULT_FLOW_NUM (RTE_GRO_MAX_BURST_ITEM_NUM / \\\n \t\tGRO_DEFAULT_ITEM_NUM_PER_FLOW)\n@@ -573,13 +584,16 @@ struct gro_status {\n };\n extern struct gro_status gro_ports[RTE_MAX_ETHPORTS];\n extern uint8_t gro_flush_cycles;\n+#endif /* RTE_LIB_GRO */\n \n+#ifdef RTE_LIB_GSO\n #define GSO_MAX_PKT_BURST 2048\n struct gso_status {\n \tuint8_t enable;\n };\n extern struct gso_status gso_ports[RTE_MAX_ETHPORTS];\n extern uint16_t gso_max_segment_size;\n+#endif /* RTE_LIB_GSO */\n \n /* VXLAN encap/decap parameters. */\n struct vxlan_encap_conf {\n@@ -1006,10 +1020,14 @@ void port_rss_hash_key_update(portid_t port_id, char rss_type[],\n \t\t\t      uint8_t *hash_key, uint8_t hash_key_len);\n int rx_queue_id_is_invalid(queueid_t rxq_id);\n int tx_queue_id_is_invalid(queueid_t txq_id);\n+#ifdef RTE_LIB_GRO\n void setup_gro(const char *onoff, portid_t port_id);\n void setup_gro_flush_cycles(uint8_t cycles);\n void show_gro(portid_t port_id);\n+#endif\n+#ifdef RTE_LIB_GSO\n void setup_gso(const char *mode, portid_t port_id);\n+#endif\n int eth_dev_info_get_print_err(uint16_t port_id,\n \t\t\tstruct rte_eth_dev_info *dev_info);\n int eth_dev_conf_get_print_err(uint16_t port_id,\ndiff --git a/lib/meson.build b/lib/meson.build\nindex 8537a5ab80..2766c02bd2 100644\n--- a/lib/meson.build\n+++ b/lib/meson.build\n@@ -66,6 +66,8 @@ libraries = [\n ]\n \n optional_libs = [\n+        'gro',\n+        'gso',\n         'kni',\n         'power',\n         'vhost',\n",
    "prefixes": [
        "v2",
        "2/5"
    ]
}