From patchwork Mon Aug 14 11:00:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 109982 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp4177160qge; Mon, 14 Aug 2017 04:01:18 -0700 (PDT) X-Received: by 10.55.51.81 with SMTP id z78mr6954794qkz.148.1502708478647; Mon, 14 Aug 2017 04:01:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502708478; cv=none; d=google.com; s=arc-20160816; b=LRNF3tjCuk5BaDxe1PsyahWYu+tLtmBqHIKSEF9uqUrplqeh+eqHWyeqLjB0k1B4M2 5Iz89oI1SO4NUmdEWleLcXdXPXZuB2JdCCo/IyYcAbf5M7ArKM+UPYA42M6ZfJKoO1yZ WFJIs6OVzP5tdvLo1ZsWTd0prcgY4CVZpR7i/LaaMV8X2NNGX76lxYkVoSSWr9LfRm6j ddcxx6t/CwZdx/YN2VF7xTafHeK52ibo4QZYjGXAkadyIUqx0oss0lvRqrTYOrIi/5Zg c6XAOd3MDRvW1JV+seY1ABqG1VfjpA8rSWe8nDk3th8Sk/pvw66Jzw4Ejnp0nh45MlKp fpxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=7QzmJCfX+l0XivAwsMGgKsCBzUtjfnz0UfhrLJhat4w=; b=E+VU78TAoAkf7SMlCPELwVKWnOZVsaVTKbtvmw6s1jqG9U7PY4vWadg6O2KxRH/0sa +eLadWTxZuGtYlS8f3zF7lCaNp+NrCCt6lguOAWJ5If/sf4uBRAChrFMCutu25Ta+aZF 73M30SI/My+Oqhc9MjZcb6rtEGJCv9kVgUp1qJuCnJ6vM67YR87nLHg+h/ICFi3qvlvg 7WZNV2MaYeHpOVMCV5imZiynovyxRwCjGjFx8fF8nbS9MJ34nmME1QRPDewlgf8bv9Ja fMUiwirQr2PeXpZpbspHh4cvGhQgXmsyz+fJvhruPrY7XYqpgI5MX2tdoOT+WGbFl6d5 9r0A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id u39si6347789qth.165.2017.08.14.04.01.18; Mon, 14 Aug 2017 04:01:18 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 4B24965C35; Mon, 14 Aug 2017 11:01:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 345E265C39; Mon, 14 Aug 2017 11:00:33 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 1DAD465C34; Mon, 14 Aug 2017 11:00:28 +0000 (UTC) Received: from forward104p.mail.yandex.net (forward104p.mail.yandex.net [77.88.28.107]) by lists.linaro.org (Postfix) with ESMTPS id CA7A765C2E for ; Mon, 14 Aug 2017 11:00:25 +0000 (UTC) Received: from mxback12j.mail.yandex.net (mxback12j.mail.yandex.net [IPv6:2a02:6b8:0:1619::87]) by forward104p.mail.yandex.net (Yandex) with ESMTP id 7827D1834CF for ; Mon, 14 Aug 2017 14:00:24 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback12j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id FzkHxOS9gJ-0Oauuv0Z; Mon, 14 Aug 2017 14:00:24 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id n8iAsiDcdV-0NV4whhW; Mon, 14 Aug 2017 14:00:23 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Mon, 14 Aug 2017 14:00:03 +0300 Message-Id: <1502708408-10504-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502708408-10504-1-git-send-email-odpbot@yandex.ru> References: <1502708408-10504-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 124 Subject: [lng-odp] [PATCH v1 1/6] Initialize pktio configuration structure X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Bogdan Pricope Signed-off-by: Bogdan Pricope --- /** Email created from pull request 124 (bogdanPricope:dpdk_hw_csum_pr) ** https://github.com/Linaro/odp/pull/124 ** Patch: https://github.com/Linaro/odp/pull/124.patch ** Base sha: 90d4ce1b3b25ca18446131906007571cc0ed0191 ** Merge commit sha: de5ffd818401be95fd7eb3398670d1b92d27d2de **/ platform/linux-generic/odp_packet_io.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index 9419adf6..70a488cc 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -150,6 +150,8 @@ static void init_pktio_entry(pktio_entry_t *entry) init_out_queues(entry); pktio_classifier_init(entry); + + odp_pktio_config_init(&entry->s.config); } static odp_pktio_t alloc_lock_pktio_entry(void) From patchwork Mon Aug 14 11:00:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 109984 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp4178446qge; Mon, 14 Aug 2017 04:02:26 -0700 (PDT) X-Received: by 10.55.114.194 with SMTP id n185mr33396549qkc.71.1502708546645; Mon, 14 Aug 2017 04:02:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502708546; cv=none; d=google.com; s=arc-20160816; b=lOArHGl4q5OeKsIsdgC5ObMTddIEWqYEWCjXaiQuW83DQrvyQ8nZ3+3DlohqGUycmO 1nUOhsiqj3ZpAlE4YF7pOjXPALyuihnCY9ZuY5yQ8Y/c3gyGNKJw/clp96nwzOlM0Fvo 73V44pBGs4Z7w82ttatx9l/WzFQGZydf8gmXFdT++csS+7d/H/VShVaVgRmy48v5TC+H +pn2a1qTSohnl1AKmgPUa3DsQL7zxdh0yNnw7wElObNOpDwWiU5OYr5omuaMj8vJHP12 vI3JcTzi7tgsc8dCwR7ZydcGV6iF0phSp0Y4IJP9CrFxZFcXl/DRmCkMl/b6DmZizTvr guSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=ucySmrnO0crKjC7Nl3DhQACnVv1nGodkLzWynPM4CRI=; b=EQumgM0P/T6am/G53doR5BkMkrHcIAXNOGJ/mNUZSL5z10ROO0YaSvUPM08nd1hHvt b2p+vDRIXJIB9SBYRZ+JMJcHYo03wPyv4llx/p12Tn8AWz8KC14TKVV2Laoq4ZvawY6S Wwo7w7zepZB6C5DplMfs8U0m7HEBor0WnI0CivnDIJIOd6JGVgcQbt38UfyMwV/IOK73 +juw46JxqZCUGZqRIZ0fCQ4n0H9qezBzd9TvcRBaQbMgTlw5E9scYO7b3cShs6A1tJ/x iTsOMlLUMnpuZ6tr5t7T5ZZuvw3qMcyJkCav5g/ob4tAzeVaej5rvDF2otiaNfhbGZvZ N39g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id p15si6269812qtb.61.2017.08.14.04.02.26; Mon, 14 Aug 2017 04:02:26 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 5849C65C3F; Mon, 14 Aug 2017 11:02:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id C04AB65C49; Mon, 14 Aug 2017 11:00:40 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 9B52265C3B; Mon, 14 Aug 2017 11:00:31 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id 325FF65C30 for ; Mon, 14 Aug 2017 11:00:26 +0000 (UTC) Received: from mxback12j.mail.yandex.net (mxback12j.mail.yandex.net [IPv6:2a02:6b8:0:1619::87]) by forward102p.mail.yandex.net (Yandex) with ESMTP id 11F174302622 for ; Mon, 14 Aug 2017 14:00:25 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback12j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id qjmOBYefhg-0Pa8tQNm; Mon, 14 Aug 2017 14:00:25 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id n8iAsiDcdV-0OVW7Dpp; Mon, 14 Aug 2017 14:00:24 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Mon, 14 Aug 2017 14:00:04 +0300 Message-Id: <1502708408-10504-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502708408-10504-1-git-send-email-odpbot@yandex.ru> References: <1502708408-10504-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 124 Subject: [lng-odp] [PATCH v1 2/6] dpdk: retrieve offload capabilities X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Bogdan Pricope Signed-off-by: Bogdan Pricope --- /** Email created from pull request 124 (bogdanPricope:dpdk_hw_csum_pr) ** https://github.com/Linaro/odp/pull/124 ** Patch: https://github.com/Linaro/odp/pull/124.patch ** Base sha: 90d4ce1b3b25ca18446131906007571cc0ed0191 ** Merge commit sha: de5ffd818401be95fd7eb3398670d1b92d27d2de **/ platform/linux-generic/pktio/dpdk.c | 52 +++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c index 19310651..9b402478 100644 --- a/platform/linux-generic/pktio/dpdk.c +++ b/platform/linux-generic/pktio/dpdk.c @@ -897,6 +897,11 @@ static void dpdk_init_capability(pktio_entry_t *pktio_entry, { pkt_dpdk_t *pkt_dpdk = &pktio_entry->s.pkt_dpdk; odp_pktio_capability_t *capa = &pkt_dpdk->capa; + int ptype_cnt; + int ptype_l3_ipv4 = 0; + int ptype_l4_tcp = 0; + int ptype_l4_udp = 0; + uint32_t ptype_mask = RTE_PTYPE_L3_MASK | RTE_PTYPE_L4_MASK; memset(dev_info, 0, sizeof(struct rte_eth_dev_info)); memset(capa, 0, sizeof(odp_pktio_capability_t)); @@ -908,9 +913,56 @@ static void dpdk_init_capability(pktio_entry_t *pktio_entry, PKTIO_MAX_QUEUES); capa->set_op.op.promisc_mode = 1; + ptype_cnt = rte_eth_dev_get_supported_ptypes(pkt_dpdk->port_id, + ptype_mask, NULL, 0); + if (ptype_cnt > 0) { + uint32_t ptypes[ptype_cnt]; + int i; + + ptype_cnt = rte_eth_dev_get_supported_ptypes(pkt_dpdk->port_id, + ptype_mask, ptypes, + ptype_cnt); + for (i = 0; i < ptype_cnt; i++) + switch (ptypes[i]) { + case RTE_PTYPE_L3_IPV4: + case RTE_PTYPE_L3_IPV4_EXT_UNKNOWN: + case RTE_PTYPE_L3_IPV4_EXT: + ptype_l3_ipv4 = 1; + break; + case RTE_PTYPE_L4_TCP: + ptype_l4_tcp = 1; + break; + case RTE_PTYPE_L4_UDP: + ptype_l4_udp = 1; + break; + } + } + odp_pktio_config_init(&capa->config); capa->config.pktin.bit.ts_all = 1; capa->config.pktin.bit.ts_ptp = 1; + + capa->config.pktin.bit.ipv4_chksum = ptype_l3_ipv4 && + (dev_info->rx_offload_capa & DEV_RX_OFFLOAD_IPV4_CKSUM) ? 1 : 0; + if (capa->config.pktin.bit.ipv4_chksum) + capa->config.pktin.bit.drop_ipv4_err = 1; + + capa->config.pktin.bit.udp_chksum = ptype_l4_udp && + (dev_info->rx_offload_capa & DEV_RX_OFFLOAD_UDP_CKSUM) ? 1 : 0; + if (capa->config.pktin.bit.udp_chksum) + capa->config.pktin.bit.drop_udp_err = 1; + + capa->config.pktin.bit.tcp_chksum = ptype_l4_tcp && + (dev_info->rx_offload_capa & DEV_RX_OFFLOAD_TCP_CKSUM) ? 1 : 0; + if (capa->config.pktin.bit.tcp_chksum) + capa->config.pktin.bit.drop_tcp_err = 1; + + capa->config.pktout.bit.ipv4_chksum = + (dev_info->tx_offload_capa & DEV_TX_OFFLOAD_IPV4_CKSUM) ? 1 : 0; + capa->config.pktout.bit.udp_chksum = + (dev_info->tx_offload_capa & DEV_TX_OFFLOAD_UDP_CKSUM) ? 1 : 0; + capa->config.pktout.bit.tcp_chksum = + (dev_info->tx_offload_capa & DEV_TX_OFFLOAD_TCP_CKSUM) ? 1 : 0; } static int dpdk_open(odp_pktio_t id ODP_UNUSED, From patchwork Mon Aug 14 11:00:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 109985 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp4179303qge; Mon, 14 Aug 2017 04:03:11 -0700 (PDT) X-Received: by 10.55.25.82 with SMTP id k79mr6432531qkh.149.1502708590971; Mon, 14 Aug 2017 04:03:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502708590; cv=none; d=google.com; s=arc-20160816; b=kXbLoAmaoYcWdpA4SJK8hVoGDRzyyHUSvdOLUZYOywgvsJjZPsoWZashG0UupTw+9S DNBZLHZvQ8sIDXYvdrNl9B8RXyWUEIKy4LdfiPB/nmhRoG1KPedRnWyuLfd6f8SabPtO 0ByiQ6c/DdQQYh+dZt7elrn+K5pSCM9cj+ybaFThmd6kFQthiXCgLfqwqkUHKdQqRi+F fqCF4dtRB9wtoLSgPaqpXGnhuC1NxKM60fXlhPWxbzLUu9o68P/Ot1jzfbp2eIo+iqum 4z3FTTVPHGa7M0YEwFO9ynSja5An5DlXMl+A3NDRfLjznBekHETkSGKRD2xbaQ3Bqdms jgbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=dKgwoEpaCHIzIexVNhL/yAxYODVlH36bkIG45t1A6fE=; b=ojSDPV7kM4lqTOE0xOWtItJ/kxHnjVJw1ilyPNqDKWTPhxbTuDVPpGLXr3ip+K1IYw 4z5AYUXHsXhdpon6XBCtbbr+QYxfEK5RiiZkjPlxbteKtBG8BaHWcdP45/KjLkDUHl/S xwXBzfRvy8VCMDB14MD6yvg8ObfQ+4mKVVuyG3OcXGtX3VS2zvOU9Sh1ZuYalQC6Vofi kXUAUHr1ILKYAOt91n+yYzJW5bXmzKKWmPSqzrwKYgv20nIrVYgQ5og8c7NkaL8eahu5 UUo7HpHOCnCx7i2MGGHwyTIsEwq/epB26Apkhy+zWgTHJc49aWvERyM+YrHhAuVwmBvZ lkDQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id v45si6237689qta.33.2017.08.14.04.03.10; Mon, 14 Aug 2017 04:03:10 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 88F2E65C3F; Mon, 14 Aug 2017 11:03:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 2E37765C4C; Mon, 14 Aug 2017 11:00:41 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 1D36665C3F; Mon, 14 Aug 2017 11:00:34 +0000 (UTC) Received: from forward101j.mail.yandex.net (forward101j.mail.yandex.net [5.45.198.241]) by lists.linaro.org (Postfix) with ESMTPS id 71FEF65C2D for ; Mon, 14 Aug 2017 11:00:27 +0000 (UTC) Received: from mxback5o.mail.yandex.net (mxback5o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1f]) by forward101j.mail.yandex.net (Yandex) with ESMTP id EEDA41241DF7 for ; Mon, 14 Aug 2017 14:00:25 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback5o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id iA8Z5wmkg5-0PAu4DFO; Mon, 14 Aug 2017 14:00:25 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id n8iAsiDcdV-0PVibkwQ; Mon, 14 Aug 2017 14:00:25 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Mon, 14 Aug 2017 14:00:05 +0300 Message-Id: <1502708408-10504-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502708408-10504-1-git-send-email-odpbot@yandex.ru> References: <1502708408-10504-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 124 Subject: [lng-odp] [PATCH v1 3/6] dpdk: enable per pktio RX IP/UDP/TCP checksum offload X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Bogdan Pricope Signed-off-by: Bogdan Pricope --- /** Email created from pull request 124 (bogdanPricope:dpdk_hw_csum_pr) ** https://github.com/Linaro/odp/pull/124 ** Patch: https://github.com/Linaro/odp/pull/124.patch ** Base sha: 90d4ce1b3b25ca18446131906007571cc0ed0191 ** Merge commit sha: de5ffd818401be95fd7eb3398670d1b92d27d2de **/ platform/linux-generic/pktio/dpdk.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c index 9b402478..a5e1d4b5 100644 --- a/platform/linux-generic/pktio/dpdk.c +++ b/platform/linux-generic/pktio/dpdk.c @@ -666,6 +666,7 @@ static int dpdk_setup_port(pktio_entry_t *pktio_entry) int ret; pkt_dpdk_t *pkt_dpdk = &pktio_entry->s.pkt_dpdk; struct rte_eth_rss_conf rss_conf; + uint16_t hw_ip_checksum = 0; /* Always set some hash functions to enable DPDK RSS hash calculation */ if (pkt_dpdk->hash.all_bits == 0) { @@ -675,12 +676,17 @@ static int dpdk_setup_port(pktio_entry_t *pktio_entry) rss_conf_to_hash_proto(&rss_conf, &pkt_dpdk->hash); } + if (pktio_entry->s.config.pktin.bit.ipv4_chksum || + pktio_entry->s.config.pktin.bit.udp_chksum || + pktio_entry->s.config.pktin.bit.tcp_chksum) + hw_ip_checksum = 1; + struct rte_eth_conf port_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_RSS, .split_hdr_size = 0, .header_split = 0, - .hw_ip_checksum = 0, + .hw_ip_checksum = hw_ip_checksum, .hw_vlan_filter = 0, .hw_strip_crc = 0, .enable_scatter = 0, From patchwork Mon Aug 14 11:00:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 109983 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp4177762qge; Mon, 14 Aug 2017 04:01:51 -0700 (PDT) X-Received: by 10.200.26.247 with SMTP id h52mr8699335qtk.173.1502708511672; Mon, 14 Aug 2017 04:01:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502708511; cv=none; d=google.com; s=arc-20160816; b=oY7tfsk4Ghn+COgqkuE37xvamlPVw/xt79y61Ky7/3oLGSwPOv53Eej91UhzIAmrXD UiJ2bYLqQWPkOjrFZZmaU6PtycCPuY5gi4kCzEipUy7e8T+0xTlQa7FoTkvH/7stQ9d1 n2kMAHgSXNPqhkD1TOrRfUbJg9IaJZtSHJBGicpf8mBngLpinBnQOmXTqNa2f8fAVUJP LM8zhYMe3M+XDISYF9zqFkmk7Ptr4FSxIYZmATQQA0sv6rfAz7oCxquWRJ1ttxYn724N raqyrtQFannRHKvRwd4auNwOAoVjsYbLUDVp/VkjrmOkfMyB5vG9pLMUT2QckFEwuuBF rKsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=K5U4lerk4mMsWA+l/KnsdC92/fgJhU2zwkyjXcbB1Pk=; b=bliw5Gij4DvHTTf3zLCPNim1YMjk1O3+7RraJAWxH0BmSH96PfuhEMj+QBI3LwYroJ FuGMyzBlRXgsVycJZf98zrdrBM1r9l/A9XtYVlUHO4wnNNJS2fHcM7erl4jSKQosDYuv kl2TBh/Xvi2qUwYdWbwZYYprk7/DB3QE03b9U3E0GSizl6nlUgVRnE2SZ2r+9NFsbFMy eKM0CiRQZ97fN6rsZqF8z9N0+yUSMshjzViBrxJaMY5VjJaqXvAHUjRwQsgBP2XuYv9j SZ5liAT3xC5jiduR5r2Sbj2mtAn28JUotxfLxJjNegfANrfXuRYQhM7VnFqJHmz1Aure cwIA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id r28si2007988qki.207.2017.08.14.04.01.51; Mon, 14 Aug 2017 04:01:51 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 2A65165C35; Mon, 14 Aug 2017 11:01:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 93D4065C3F; Mon, 14 Aug 2017 11:00:37 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 196E865C34; Mon, 14 Aug 2017 11:00:30 +0000 (UTC) Received: from forward101o.mail.yandex.net (forward101o.mail.yandex.net [37.140.190.181]) by lists.linaro.org (Postfix) with ESMTPS id 8C24065C2E for ; Mon, 14 Aug 2017 11:00:28 +0000 (UTC) Received: from mxback3o.mail.yandex.net (mxback3o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1d]) by forward101o.mail.yandex.net (Yandex) with ESMTP id A56621342680 for ; Mon, 14 Aug 2017 14:00:26 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback3o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 5q7ZHYutoH-0QcqPPWa; Mon, 14 Aug 2017 14:00:26 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id n8iAsiDcdV-0QVeE6le; Mon, 14 Aug 2017 14:00:26 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Mon, 14 Aug 2017 14:00:06 +0300 Message-Id: <1502708408-10504-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502708408-10504-1-git-send-email-odpbot@yandex.ru> References: <1502708408-10504-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 124 Subject: [lng-odp] [PATCH v1 4/6] dpdk: RX - process checksum validation offload flags X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Bogdan Pricope Signed-off-by: Bogdan Pricope --- /** Email created from pull request 124 (bogdanPricope:dpdk_hw_csum_pr) ** https://github.com/Linaro/odp/pull/124 ** Patch: https://github.com/Linaro/odp/pull/124.patch ** Base sha: 90d4ce1b3b25ca18446131906007571cc0ed0191 ** Merge commit sha: de5ffd818401be95fd7eb3398670d1b92d27d2de **/ platform/linux-generic/pktio/dpdk.c | 47 +++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c index a5e1d4b5..af727ae0 100644 --- a/platform/linux-generic/pktio/dpdk.c +++ b/platform/linux-generic/pktio/dpdk.c @@ -301,6 +301,40 @@ static struct rte_mempool_ops ops_stack = { MEMPOOL_REGISTER_OPS(ops_stack); +#define HAS_L4_PROTO(m, proto) ((m->packet_type & RTE_PTYPE_L4_MASK) == proto) + +static inline int pkt_set_ol_rx(odp_pktin_config_opt_t *pktin_cfg, + odp_packet_hdr_t *pkt_hdr, + struct rte_mbuf *mbuf) +{ + if (pktin_cfg->bit.ipv4_chksum && + (mbuf->packet_type & RTE_PTYPE_L3_IPV4) && + mbuf->ol_flags & PKT_RX_IP_CKSUM_BAD) { + if (pktin_cfg->bit.drop_ipv4_err) + return -1; + + pkt_hdr->p.error_flags.ip_err = 1; + } + + if (pktin_cfg->bit.udp_chksum && + HAS_L4_PROTO(mbuf, RTE_PTYPE_L4_UDP) && + mbuf->ol_flags & PKT_RX_L4_CKSUM_BAD) { + if (pktin_cfg->bit.drop_udp_err) + return -1; + + pkt_hdr->p.error_flags.udp_err = 1; + } else if (pktin_cfg->bit.tcp_chksum && + HAS_L4_PROTO(mbuf, RTE_PTYPE_L4_TCP) && + mbuf->ol_flags & PKT_RX_L4_CKSUM_BAD) { + if (pktin_cfg->bit.drop_tcp_err) + return -1; + + pkt_hdr->p.error_flags.tcp_err = 1; + } + + return 0; +} + static inline int mbuf_to_pkt(pktio_entry_t *pktio_entry, odp_packet_t pkt_table[], struct rte_mbuf *mbuf_table[], @@ -315,6 +349,7 @@ static inline int mbuf_to_pkt(pktio_entry_t *pktio_entry, int nb_pkts = 0; int alloc_len, num; odp_pool_t pool = pktio_entry->s.pkt_dpdk.pool; + odp_pktin_config_opt_t *pktin_cfg = &pktio_entry->s.config.pktin; /* Allocate maximum sized packets */ alloc_len = pktio_entry->s.pkt_dpdk.data_room; @@ -369,6 +404,12 @@ static inline int mbuf_to_pkt(pktio_entry_t *pktio_entry, packet_set_ts(pkt_hdr, ts); + if (pkt_set_ol_rx(pktin_cfg, pkt_hdr, mbuf)) { + odp_packet_free(pkt); + rte_pktmbuf_free(mbuf); + continue; + } + pkt_table[nb_pkts++] = pkt; rte_pktmbuf_free(mbuf); @@ -435,6 +476,7 @@ static inline int mbuf_to_pkt_zero(pktio_entry_t *pktio_entry, int i; int nb_pkts = 0; odp_pool_t pool = pktio_entry->s.pkt_dpdk.pool; + odp_pktin_config_opt_t *pktin_cfg = &pktio_entry->s.config.pktin; for (i = 0; i < mbuf_num; i++) { odp_packet_hdr_t parsed_hdr; @@ -480,6 +522,11 @@ static inline int mbuf_to_pkt_zero(pktio_entry_t *pktio_entry, packet_set_ts(pkt_hdr, ts); + if (pkt_set_ol_rx(pktin_cfg, pkt_hdr, mbuf)) { + rte_pktmbuf_free(mbuf); + continue; + } + pkt_table[nb_pkts++] = pkt; } From patchwork Mon Aug 14 11:00:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 109986 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp4179941qge; Mon, 14 Aug 2017 04:03:49 -0700 (PDT) X-Received: by 10.55.59.193 with SMTP id i184mr8211838qka.214.1502708629635; Mon, 14 Aug 2017 04:03:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502708629; cv=none; d=google.com; s=arc-20160816; b=UMmhqzjeU0x+FEO9Xpq0MeyYTNXxplglBGM6sze117F6v6V4MihCbnN0eJmyC5o4tr fX4kGtxw2BDiRLKg/CO+mHGFWLoUNn9uGPsyn5OoxYagZXvZXudfFKQ/qK0LFrJcjdXB tt1ESFWA2q2YcTdfUPkDkmM6mUWy731iKns4QlBiKdZ50XD5/rtMAZCtc/bATl5Edhj3 kj6KRKAV4k+Z6PtSCOtBdANMVPgs51pRRbIQyoTW6Wc1kBHFR1wTQ0oIj8uMBLMZaQpe 1hXW8eeVDLq6fYUqH7VGVWjgaZUhYYmnQjUpQSm3XdcqEWdysJcItzmGqi+BweF0+NJj hkAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=R7EkdrFqQ3P5+a6IxU5qi1z/+kd8HxSb5Inv/AIi+1w=; b=weL88KwZ0yU/vGJ3FK2xePUZB0gADfpUTaaLh/YRHzvek8Vuo/wUuqE1kGr+6lSKt2 gIuIcXJCgH712AcPcLaxxqM8/CLxjP+mglCZuxuOixLSDoVDdaPXha0UvQgL6jewVCPM P47OFQEoGDPl22n4GfTM4cwr/jbhRvw4RgTHlHI9ef8/2U7/AbcD9UR+IF2+eW2vqNAW 6ozpl1sQrfYIpZbNHwYoE7c0FlqJwQ7LWKgkhG5EHHsF7Ft11upJAOYMP9dEQt6ivFLY NEgW9XmGkXvcDpNRqOUcdJKqJtK3EIt08RHy53r6AxWnuTac/RYLR5bx34DaPOUBr4H9 nUsQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id k64si4675862qkf.265.2017.08.14.04.03.49; Mon, 14 Aug 2017 04:03:49 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 358E565C3F; Mon, 14 Aug 2017 11:03:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 915C265C47; Mon, 14 Aug 2017 11:00:46 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 3A5F665C33; Mon, 14 Aug 2017 11:00:34 +0000 (UTC) Received: from forward105p.mail.yandex.net (forward105p.mail.yandex.net [77.88.28.108]) by lists.linaro.org (Postfix) with ESMTPS id 38A4C65C2E for ; Mon, 14 Aug 2017 11:00:30 +0000 (UTC) Received: from mxback4g.mail.yandex.net (mxback4g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:165]) by forward105p.mail.yandex.net (Yandex) with ESMTP id 43A354080C9D for ; Mon, 14 Aug 2017 14:00:28 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback4g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id dMEwdMA2li-0RbWAlp9; Mon, 14 Aug 2017 14:00:28 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id n8iAsiDcdV-0QVOkAme; Mon, 14 Aug 2017 14:00:26 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Mon, 14 Aug 2017 14:00:07 +0300 Message-Id: <1502708408-10504-6-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502708408-10504-1-git-send-email-odpbot@yandex.ru> References: <1502708408-10504-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 124 Subject: [lng-odp] [PATCH v1 5/6] dpdk: TX - set checksum calculation offload flags X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Bogdan Pricope Signed-off-by: Bogdan Pricope --- /** Email created from pull request 124 (bogdanPricope:dpdk_hw_csum_pr) ** https://github.com/Linaro/odp/pull/124 ** Patch: https://github.com/Linaro/odp/pull/124.patch ** Base sha: 90d4ce1b3b25ca18446131906007571cc0ed0191 ** Merge commit sha: de5ffd818401be95fd7eb3398670d1b92d27d2de **/ platform/linux-generic/pktio/dpdk.c | 109 ++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c index af727ae0..1172e9e2 100644 --- a/platform/linux-generic/pktio/dpdk.c +++ b/platform/linux-generic/pktio/dpdk.c @@ -30,6 +30,10 @@ #include #include #include +#include +#include +#include +#include #include #if ODP_DPDK_ZERO_COPY @@ -426,6 +430,96 @@ static inline int mbuf_to_pkt(pktio_entry_t *pktio_entry, return (i > 0 ? i : -1); } +static inline int packet_parse(void *l3_hdr, uint8_t *l3_proto_v4, + uint8_t *l4_proto) +{ + uint8_t l3_proto_ver = _ODP_IPV4HDR_VER(*(uint8_t *)l3_hdr); + + if (l3_proto_ver == _ODP_IPV4) { + struct ipv4_hdr *ip = (struct ipv4_hdr *)l3_hdr; + + *l3_proto_v4 = 1; + if (!rte_ipv4_frag_pkt_is_fragmented(ip)) + *l4_proto = ip->next_proto_id; + else + *l4_proto = 0; + + return 0; + } else if (l3_proto_ver == _ODP_IPV6) { + struct ipv6_hdr *ipv6 = (struct ipv6_hdr *)l3_hdr; + + *l3_proto_v4 = 0; + *l4_proto = ipv6->proto; + return 0; + } + + return -1; +} + +static inline uint16_t phdr_csum(int ipv4, void *l3_hdr, + uint64_t ol_flags) +{ + if (ipv4) + return rte_ipv4_phdr_cksum(l3_hdr, ol_flags); + else /*ipv6*/ + return rte_ipv6_phdr_cksum(l3_hdr, ol_flags); +} + +static inline int pkt_set_ol_tx(odp_pktout_config_opt_t *pktout_cfg, + odp_packet_hdr_t *pkt_hdr, + struct rte_mbuf *mbuf, + char *mbuf_data) +{ + void *l3_hdr, *l4_hdr; + uint8_t l3_proto_v4, l4_proto; + odp_bool_t ipv4_chksum_pkt, udp_chksum_pkt, tcp_chksum_pkt; + packet_parser_t *pkt_p = &pkt_hdr->p; + + l3_hdr = (void *)(mbuf_data + pkt_p->l3_offset); + + if (packet_parse(l3_hdr, &l3_proto_v4, &l4_proto)) + return 0; + + ipv4_chksum_pkt = pktout_cfg->bit.ipv4_chksum && l3_proto_v4; + udp_chksum_pkt = pktout_cfg->bit.udp_chksum && + (l4_proto == _ODP_IPPROTO_UDP); + tcp_chksum_pkt = pktout_cfg->bit.tcp_chksum && + (l4_proto == _ODP_IPPROTO_TCP); + + if (!ipv4_chksum_pkt && !udp_chksum_pkt && !tcp_chksum_pkt) + return 0; + + mbuf->l2_len = pkt_p->l3_offset - pkt_p->l2_offset; + mbuf->l3_len = pkt_p->l4_offset - pkt_p->l3_offset; + + if (l3_proto_v4) + mbuf->ol_flags = PKT_TX_IPV4; + else + mbuf->ol_flags = PKT_TX_IPV6; + + if (ipv4_chksum_pkt) { + mbuf->ol_flags |= PKT_TX_IP_CKSUM; + + ((struct ipv4_hdr *)l3_hdr)->hdr_checksum = 0; + } + + l4_hdr = (void *)(mbuf_data + pkt_p->l4_offset); + + if (udp_chksum_pkt) { + mbuf->ol_flags |= PKT_TX_UDP_CKSUM; + + ((struct udp_hdr *)l4_hdr)->dgram_cksum = + phdr_csum(l3_proto_v4, l3_hdr, mbuf->ol_flags); + } else if (tcp_chksum_pkt) { + mbuf->ol_flags |= PKT_TX_TCP_CKSUM; + + ((struct tcp_hdr *)l4_hdr)->cksum = + phdr_csum(l3_proto_v4, l3_hdr, mbuf->ol_flags); + } + + return 0; +} + static inline int pkt_to_mbuf(pktio_entry_t *pktio_entry, struct rte_mbuf *mbuf_table[], const odp_packet_t pkt_table[], uint16_t num) @@ -434,6 +528,7 @@ static inline int pkt_to_mbuf(pktio_entry_t *pktio_entry, int i, j; char *data; uint16_t pkt_len; + odp_pktout_config_opt_t *pktout_cfg = &pktio_entry->s.config.pktout; if (odp_unlikely((rte_pktmbuf_alloc_bulk(pkt_dpdk->pkt_pool, mbuf_table, num)))) { @@ -453,6 +548,11 @@ static inline int pkt_to_mbuf(pktio_entry_t *pktio_entry, data = rte_pktmbuf_append(mbuf_table[i], pkt_len); odp_packet_copy_to_mem(pkt_table[i], 0, pkt_len, data); + + if (pktout_cfg->all_bits) + pkt_set_ol_tx(pktout_cfg, + odp_packet_hdr(pkt_table[i]), + mbuf_table[i], data); } return i; @@ -539,6 +639,7 @@ static inline int pkt_to_mbuf_zero(pktio_entry_t *pktio_entry, uint16_t *copy_count) { pkt_dpdk_t *pkt_dpdk = &pktio_entry->s.pkt_dpdk; + odp_pktout_config_opt_t *pktout_cfg = &pktio_entry->s.config.pktout; int i; *copy_count = 0; @@ -555,6 +656,10 @@ static inline int pkt_to_mbuf_zero(pktio_entry_t *pktio_entry, if (odp_likely(pkt_hdr->buf_hdr.segcount == 1 && pkt_hdr->extra_type == PKT_EXTRA_TYPE_DPDK)) { mbuf_update(mbuf, pkt_hdr, pkt_len); + + if (pktout_cfg->all_bits) + pkt_set_ol_tx(pktout_cfg, pkt_hdr, + mbuf, odp_packet_data(pkt)); } else { pool_t *pool_entry = pkt_hdr->buf_hdr.pool_ptr; @@ -570,6 +675,10 @@ static inline int pkt_to_mbuf_zero(pktio_entry_t *pktio_entry, mbuf_init(pkt_dpdk->pkt_pool, mbuf, pkt_hdr); mbuf_update(mbuf, pkt_hdr, pkt_len); + if (pktout_cfg->all_bits) + pkt_set_ol_tx(pktout_cfg, pkt_hdr, + mbuf, + odp_packet_data(pkt)); } } mbuf_table[i] = mbuf; From patchwork Mon Aug 14 11:00:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 109987 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp4181158qge; Mon, 14 Aug 2017 04:05:01 -0700 (PDT) X-Received: by 10.200.53.251 with SMTP id l56mr31293755qtb.82.1502708700776; Mon, 14 Aug 2017 04:05:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502708700; cv=none; d=google.com; s=arc-20160816; b=SQpnuGYnGRdQWSpXJ4SjxGXFlTLVKuXUB+COo/3ScH3+hxcQZXXJLfnqwboMZooJLO V7BLxfvYFbjKTbE+XoWVF8TLftFVp0bAp4GRV1C8zlfnk2NTPvFbJ7R+dl974a2UV4MO pq9NiFU+tdrPGkCXwHaVhldCceAkLQpc++Dn9RSJW9rp06rynF4+LgiaVMBwu7VyfwKL aP2TTEzxrsWmIftbvF2gSpmqZ61xnurlIJPJ4adBprSdumFEIb5TtOJfFJEim4eJ62X1 UW73MMQQc7xUk/mtifps+4HDl41UnjC3uw6xtv7cttgY8KHYRVfVA4teGVBPjfLIcfta WuSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=qE6MVXaXjTTKPlgxYXlNVOSrR1gE9eFdctfT70A234A=; b=PqpJ2kahWe+5URIZxHfG7WxK+e6cL398tjv8g6fi0qIktbgxYEy8/lWc1tr4HS0k1i 0B8MbxXzhs5t4VLSdwSLsS3meEWIz3SE+rK/C6tp17zYxNyxzesdhm5JXcEWoPRvVOF1 /G9in7hXpxrTMnCnUEywbqdDK3nu7FQ5JWDyJ+WH0tLmu/FOwfy2iuXtiAR3+jH05lqB gNGprxU/Fkw31fStYzSLEmlhONIxSz9R0RZ3p15Tk9Gtgopelatzceo1KKHqAvU/8FJD 39S/JQsydbYGQiJGJxl03klhJ6rgqx87r9vy5QgDj2UszQdOTWVtwT9/zw6HCcYGDXwN i41w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 39si6211748qtz.529.2017.08.14.04.05.00; Mon, 14 Aug 2017 04:05:00 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 72DEC65C49; Mon, 14 Aug 2017 11:05:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 5EB1B607FC; Mon, 14 Aug 2017 11:01:11 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id EDB49644E9; Mon, 14 Aug 2017 11:01:06 +0000 (UTC) Received: from forward100j.mail.yandex.net (forward100j.mail.yandex.net [5.45.198.240]) by lists.linaro.org (Postfix) with ESMTPS id 0160365C36 for ; Mon, 14 Aug 2017 11:00:30 +0000 (UTC) Received: from mxback1g.mail.yandex.net (mxback1g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:162]) by forward100j.mail.yandex.net (Yandex) with ESMTP id 9300F5D815EE for ; Mon, 14 Aug 2017 14:00:29 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback1g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id p70luBsWIJ-0TbikKjA; Mon, 14 Aug 2017 14:00:29 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id n8iAsiDcdV-0SV86aNY; Mon, 14 Aug 2017 14:00:28 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Mon, 14 Aug 2017 14:00:08 +0300 Message-Id: <1502708408-10504-7-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502708408-10504-1-git-send-email-odpbot@yandex.ru> References: <1502708408-10504-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 124 Subject: [lng-odp] [PATCH v1 6/6] examples: generator: update odp_generator to use HW checksum capabilities X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Bogdan Pricope Signed-off-by: Bogdan Pricope --- /** Email created from pull request 124 (bogdanPricope:dpdk_hw_csum_pr) ** https://github.com/Linaro/odp/pull/124 ** Patch: https://github.com/Linaro/odp/pull/124.patch ** Base sha: 90d4ce1b3b25ca18446131906007571cc0ed0191 ** Merge commit sha: de5ffd818401be95fd7eb3398670d1b92d27d2de **/ example/generator/odp_generator.c | 156 ++++++++++++++++++++++++++++++-------- 1 file changed, 124 insertions(+), 32 deletions(-) diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index f3ec43be..65471f54 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -46,6 +46,7 @@ typedef struct { odp_pktio_t pktio; + odp_pktio_config_t config; odp_pktout_queue_t pktout[MAX_WORKERS]; unsigned pktout_count; } interface_t; @@ -91,7 +92,16 @@ static struct { /** * Thread specific arguments */ typedef struct { - odp_pktout_queue_t pktout; /**< Packet output queue to use*/ + union { + struct { + odp_pktout_queue_t pktout; /**< Packet output queue */ + odp_pktout_config_opt_t *pktout_cfg; /**< Packet output config*/ + } tx; + struct { + interface_t *ifs; /**< Interfaces array */ + int ifs_count; /**< Interfaces array size */ + } rx; + }; odp_pool_t pool; /**< Pool for packet IO */ odp_timer_pool_t tp; /**< Timer pool handle */ odp_queue_t tq; /**< Queue for timeouts */ @@ -116,6 +126,10 @@ static args_t *args; /** Barrier to sync threads execution */ static odp_barrier_t barrier; +/** Packet processing function types */ +typedef odp_packet_t (*setup_pkt_ref_t)(odp_pool_t, odp_pktout_config_opt_t *); +typedef int (*setup_pkt_t)(odp_packet_t, odp_pktout_config_opt_t *); + /* helper funcs */ static void parse_args(int argc, char *argv[], appl_args_t *appl_args); static void print_info(char *progname, appl_args_t *appl_args); @@ -190,20 +204,22 @@ static int scan_ip(char *buf, unsigned int *paddr) * Setup array of reference packets * * @param pool Packet pool + * @param pktout_cfg Interface output configuration * @param pkt_ref_array Packet array * @param pkt_ref_array_size Packet array size * @param setup_ref Packet setup function * @return 0 success, -1 failed */ static int setup_pkt_ref_array(odp_pool_t pool, + odp_pktout_config_opt_t *pktout_cfg, odp_packet_t *pkt_ref_array, int pkt_ref_array_size, - odp_packet_t (*setup_ref)(odp_pool_t)) + setup_pkt_ref_t setup_ref) { int i; for (i = 0; i < pkt_ref_array_size; i++) { - pkt_ref_array[i] = (*setup_ref)(pool); + pkt_ref_array[i] = (*setup_ref)(pool, pktout_cfg); if (pkt_ref_array[i] == ODP_PACKET_INVALID) break; } @@ -218,21 +234,23 @@ static int setup_pkt_ref_array(odp_pool_t pool, /** * Setup array of packets * + * @param pktout_cfg Interface output configuration * @param pkt_ref_array Reference packet array * @param pkt_array Packet array * @param pkt_array_size Packet array size * @param setup_pkt Packet setup function * @return 0 success, -1 failed */ -static int setup_pkt_array(odp_packet_t *pkt_ref_array, +static int setup_pkt_array(odp_pktout_config_opt_t *pktout_cfg, + odp_packet_t *pkt_ref_array, odp_packet_t *pkt_array, int pkt_array_size, - int (*setup_pkt)(odp_packet_t)) + setup_pkt_t setup_pkt) { int i; for (i = 0; i < pkt_array_size; i++) { - if ((*setup_pkt)(pkt_ref_array[i])) + if ((*setup_pkt)(pkt_ref_array[i], pktout_cfg)) break; pkt_array[i] = odp_packet_ref_static(pkt_ref_array[i]); @@ -252,13 +270,15 @@ static int setup_pkt_array(odp_packet_t *pkt_ref_array, * set up an udp packet reference * * @param pool Buffer pool to create packet in + * @param pktout_cfg Interface output configuration * * * @retval Handle of created packet * @retval ODP_PACKET_INVALID Packet could not be created * */ -static odp_packet_t setup_udp_pkt_ref(odp_pool_t pool) +static odp_packet_t setup_udp_pkt_ref(odp_pool_t pool, + odp_pktout_config_opt_t *pktout_cfg) { odp_packet_t pkt; char *buf; @@ -302,8 +322,10 @@ static odp_packet_t setup_udp_pkt_ref(odp_pool_t pool) udp->src_port = odp_cpu_to_be_16(args->appl.srcport); udp->dst_port = odp_cpu_to_be_16(args->appl.dstport); udp->length = odp_cpu_to_be_16(args->appl.payload + ODPH_UDPHDR_LEN); - udp->chksum = 0; - udp->chksum = odph_ipv4_udp_chksum(pkt); + if (!pktout_cfg->bit.udp_chksum) { + udp->chksum = 0; + udp->chksum = odph_ipv4_udp_chksum(pkt); + } return pkt; } @@ -312,11 +334,12 @@ static odp_packet_t setup_udp_pkt_ref(odp_pool_t pool) * set up an udp packet * * @param pkt Reference UDP packet + * @param pktout_cfg Interface output configuration * * @return Success/Failed * @retval 0 on success, -1 on fail */ -static int setup_udp_pkt(odp_packet_t pkt) +static int setup_udp_pkt(odp_packet_t pkt, odp_pktout_config_opt_t *pktout_cfg) { char *buf; odph_ipv4hdr_t *ip; @@ -328,9 +351,17 @@ static int setup_udp_pkt(odp_packet_t pkt) ip = (odph_ipv4hdr_t *)(buf + ODPH_ETHHDR_LEN); seq = odp_atomic_fetch_add_u64(&counters.seq, 1) % 0xFFFF; ip->id = odp_cpu_to_be_16(seq); - ip->chksum = 0; - ip->chksum = odph_chksum(ip, ODPH_IPV4HDR_LEN); + if (!pktout_cfg->bit.ipv4_chksum) { + ip->chksum = 0; + ip->chksum = odph_chksum(ip, ODPH_IPV4HDR_LEN); + } + if (pktout_cfg->bit.ipv4_chksum || pktout_cfg->bit.udp_chksum) { + odp_packet_l2_offset_set(pkt, 0); + odp_packet_l3_offset_set(pkt, ODPH_ETHHDR_LEN); + odp_packet_l4_offset_set(pkt, ODPH_ETHHDR_LEN + + ODPH_IPV4HDR_LEN); + } return 0; } @@ -338,11 +369,13 @@ static int setup_udp_pkt(odp_packet_t pkt) * Set up an icmp packet reference * * @param pool Buffer pool to create packet in + * @param pktout_cfg Interface output configuration * * @return Handle of created packet * @retval ODP_PACKET_INVALID Packet could not be created */ -static odp_packet_t setup_icmp_pkt_ref(odp_pool_t pool) +static odp_packet_t setup_icmp_pkt_ref(odp_pool_t pool, + odp_pktout_config_opt_t *pktout_cfg) { odp_packet_t pkt; char *buf; @@ -350,6 +383,8 @@ static odp_packet_t setup_icmp_pkt_ref(odp_pool_t pool) odph_ipv4hdr_t *ip; odph_icmphdr_t *icmp; + (void)pktout_cfg; + args->appl.payload = 56; pkt = odp_packet_alloc(pool, args->appl.payload + ODPH_ICMPHDR_LEN + ODPH_IPV4HDR_LEN + ODPH_ETHHDR_LEN); @@ -393,11 +428,13 @@ static odp_packet_t setup_icmp_pkt_ref(odp_pool_t pool) * Set up an icmp packet * * @param pkt Reference ICMP packet + * @param pktout_cfg Interface output configuration * * @return Success/Failed * @retval 0 on success, -1 on fail */ -static int setup_icmp_pkt(odp_packet_t pkt) +static int setup_icmp_pkt(odp_packet_t pkt, + odp_pktout_config_opt_t *pktout_cfg) { char *buf; odph_ipv4hdr_t *ip; @@ -412,8 +449,10 @@ static int setup_icmp_pkt(odp_packet_t pkt) ip = (odph_ipv4hdr_t *)(buf + ODPH_ETHHDR_LEN); seq = odp_atomic_fetch_add_u64(&counters.seq, 1) % 0xffff; ip->id = odp_cpu_to_be_16(seq); - ip->chksum = 0; - ip->chksum = odph_chksum(ip, ODPH_IPV4HDR_LEN); + if (!pktout_cfg->bit.ipv4_chksum) { + ip->chksum = 0; + ip->chksum = odph_chksum(ip, ODPH_IPV4HDR_LEN); + } /* icmp */ icmp = (odph_icmphdr_t *)(buf + ODPH_ETHHDR_LEN + ODPH_IPV4HDR_LEN); @@ -427,6 +466,13 @@ static int setup_icmp_pkt(odp_packet_t pkt) icmp->chksum = 0; icmp->chksum = odph_chksum(icmp, args->appl.payload + ODPH_ICMPHDR_LEN); + if (pktout_cfg->bit.ipv4_chksum) { + odp_packet_l2_offset_set(pkt, 0); + odp_packet_l3_offset_set(pkt, ODPH_ETHHDR_LEN); + odp_packet_l4_offset_set(pkt, ODPH_ETHHDR_LEN + + ODPH_IPV4HDR_LEN); + } + return 0; } @@ -467,6 +513,22 @@ static int create_pktio(const char *dev, odp_pool_t pool, dev); return -1; } + odp_pktio_config_init(&itf->config); + itf->config.pktin.bit.ipv4_chksum = capa.config.pktin.bit.ipv4_chksum; + itf->config.pktin.bit.udp_chksum = capa.config.pktin.bit.udp_chksum; + itf->config.pktin.bit.drop_ipv4_err = + capa.config.pktin.bit.drop_ipv4_err; + itf->config.pktin.bit.drop_udp_err = capa.config.pktin.bit.drop_udp_err; + + itf->config.pktout.bit.ipv4_chksum = capa.config.pktout.bit.ipv4_chksum; + itf->config.pktout.bit.udp_chksum = capa.config.pktout.bit.udp_chksum; + + if (odp_pktio_config(itf->pktio, &itf->config)) { + EXAMPLE_ERR("Error: Failed to set interface configuration %s\n", + dev); + return -1; + } + if (num_rx_queues > capa.max_input_queues) num_rx_queues = capa.max_input_queues; @@ -527,17 +589,18 @@ static int gen_send_thread(void *arg) int ret = 0; thread_args_t *thr_args; odp_pktout_queue_t pktout; + odp_pktout_config_opt_t *pktout_cfg; odp_packet_t pkt_ref_array[MAX_UDP_TX_BURST]; odp_packet_t pkt_array[MAX_UDP_TX_BURST]; int pkt_array_size; int burst_start, burst_size; - odp_packet_t (*setup_pkt_ref)(odp_pool_t) = NULL; - int (*setup_pkt)(odp_packet_t) = NULL; + setup_pkt_ref_t setup_pkt_ref = NULL; + setup_pkt_t setup_pkt = NULL; thr = odp_thread_id(); thr_args = arg; - - pktout = thr_args->pktout; + pktout = thr_args->tx.pktout; + pktout_cfg = thr_args->tx.pktout_cfg; /* Create reference packets*/ if (args->appl.mode == APPL_MODE_UDP) { @@ -554,8 +617,9 @@ static int gen_send_thread(void *arg) return -1; } - if (setup_pkt_ref_array(thr_args->pool, pkt_ref_array, - pkt_array_size, setup_pkt_ref)) { + if (setup_pkt_ref_array(thr_args->pool, pktout_cfg, + pkt_ref_array, pkt_array_size, + setup_pkt_ref)) { EXAMPLE_ERR("[%02i] Error: failed to create" " reference packets\n", thr); return -1; @@ -572,7 +636,7 @@ static int gen_send_thread(void *arg) break; /* Setup TX burst*/ - if (setup_pkt_array(pkt_ref_array, pkt_array, + if (setup_pkt_array(pktout_cfg, pkt_ref_array, pkt_array, pkt_array_size, setup_pkt)) { EXAMPLE_ERR("[%02i] Error: failed to setup packets\n", thr); @@ -718,12 +782,15 @@ static void print_pkts(int thr, odp_packet_t pkt_tbl[], unsigned len) static int gen_recv_thread(void *arg) { int thr; + thread_args_t *thr_args; odp_packet_t pkts[MAX_RX_BURST], pkt; odp_event_t events[MAX_RX_BURST]; int pkt_cnt, ev_cnt, i; + interface_t *itfs, *itf; thr = odp_thread_id(); - (void)arg; + thr_args = (thread_args_t *)arg; + itfs = thr_args->rx.ifs; printf(" [%02i] created mode: RECEIVE\n", thr); odp_barrier_wait(&barrier); @@ -742,6 +809,23 @@ static int gen_recv_thread(void *arg) continue; for (i = 0, pkt_cnt = 0; i < ev_cnt; i++) { pkt = odp_packet_from_event(events[i]); + itf = &itfs[odp_pktio_index(odp_packet_input(pkt))]; + + if (odp_packet_has_ipv4(pkt)) { + if (itf->config.pktin.bit.ipv4_chksum) { + /* HW validation */ + if (odp_packet_has_l3_error(pkt)) + printf("HW detected L3 error\n"); + } /* else SW validation */ + } + + if (odp_packet_has_udp(pkt)) { + if (itf->config.pktin.bit.udp_chksum) { + /* HW validation*/ + if (odp_packet_has_l4_error(pkt)) + printf("HW detected L4 error\n"); + } /* else SW validation */ + } /* Drop packets with errors */ if (odp_unlikely(odp_packet_has_error(pkt))) { @@ -751,9 +835,11 @@ static int gen_recv_thread(void *arg) pkts[pkt_cnt++] = pkt; } - print_pkts(thr, pkts, pkt_cnt); + if (pkt_cnt) { + print_pkts(thr, pkts, pkt_cnt); - odp_packet_free_multi(pkts, pkt_cnt); + odp_packet_free_multi(pkts, pkt_cnt); + } } return 0; @@ -1008,7 +1094,8 @@ int main(int argc, char *argv[]) EXAMPLE_ERR("queue_create failed\n"); abort(); } - (void)args->thread[1].pktout; /* Not used*/ + args->thread[1].rx.ifs = ifs; + args->thread[1].rx.ifs_count = args->appl.if_count; args->thread[1].pool = pool; args->thread[1].tp = tp; args->thread[1].tq = tq; @@ -1037,7 +1124,8 @@ int main(int argc, char *argv[]) EXAMPLE_ERR("queue_create failed\n"); abort(); } - args->thread[0].pktout = ifs[0].pktout[0]; + args->thread[0].tx.pktout = ifs[0].pktout[0]; + args->thread[0].tx.pktout_cfg = &ifs[0].config.pktout; args->thread[0].pool = pool; args->thread[0].tp = tp; args->thread[0].tq = tq; @@ -1069,15 +1157,19 @@ int main(int argc, char *argv[]) int (*thr_run_func)(void *); int if_idx, pktout_idx; - if (args->appl.mode == APPL_MODE_RCV) - (void)args->thread[i].pktout; /*not used*/ - else { + if (args->appl.mode == APPL_MODE_RCV) { + args->thread[i].rx.ifs = ifs; + args->thread[i].rx.ifs_count = + args->appl.if_count; + } else { if_idx = i % args->appl.if_count; pktout_idx = (i / args->appl.if_count) % ifs[if_idx].pktout_count; - args->thread[i].pktout = + args->thread[i].tx.pktout = ifs[if_idx].pktout[pktout_idx]; + args->thread[i].tx.pktout_cfg = + &ifs[if_idx].config.pktout; } tq = odp_queue_create("", NULL); if (tq == ODP_QUEUE_INVALID) {