From patchwork Wed Aug 16 08: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: 110208 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp458727qge; Wed, 16 Aug 2017 01:02:21 -0700 (PDT) X-Received: by 10.55.66.84 with SMTP id p81mr901132qka.243.1502870541857; Wed, 16 Aug 2017 01:02:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502870541; cv=none; d=google.com; s=arc-20160816; b=fkdcezuErbZClhQ5TOIA9yIz73zu+rZjDHQk+QYiGgEZ7/xpIBPog+qc788sc6pN3T IscNi81b8rKQjFs76N9fNPju3u9T1fFWs/rUZ9tLyvtoxR3LqK07VwoRz/UF1tMpdFnr iptywvXYd9hwKnJW0ky8mSIFwoHrwO2yZHxldZbVljJZ4UPn3OBozPlnNCohx7YXWDIN CtkRAwrP/ixrn5GBV0rgrq9rpag7a1dN6Q4HNwiInpb/xNYnSx3EQGWgUPUjgpH16kzs voFteh/GA3ktA1gvis273Cj1ZRN5f6ywuFwz61jUcMdXf0ocwGTVW2GUf07PsrV11Fkc KTdg== 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=4A5eBljcF3lBB/KoHGVSpzxlTP/Rp+/OSKwXpUFYgSw=; b=xr/fJcyty/jUH+SmYMKLETCw1roHEYKwqfbJ9viZBHP7lkDYQFhtdeeXOhTkey0AlN WdeUcZFvd7BAT+sFdEj/YwK8/IUzcJqdjJ3YFGDv3T+UJp5X83wsuddwjnywdWfzqf3r shymogryTmdAHleJdRKUehyGlBkB/U5IElYa8qKYkjEUenaZM3Sj25wnQrPP2yerglCc BQ0vAj0p+rEEZAVZd5irN0//NXFidVMERuIGSKdb003FxVh15dCRG79LAu0wyoFx4p3d u7O8jfHKwDEh/ITDeQqZthcqnT9Gxe/t2KFGYxjbqeQSZToQNaKJTGQsqVZA+z4FN7Cm +MpA== 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 x201si291807qkx.56.2017.08.16.01.02.21; Wed, 16 Aug 2017 01:02:21 -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 83FBB64484; Wed, 16 Aug 2017 08:02:21 +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 636F560C18; Wed, 16 Aug 2017 08:01:09 +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 4BFC9644B1; Wed, 16 Aug 2017 08:00:48 +0000 (UTC) Received: from forward101p.mail.yandex.net (forward101p.mail.yandex.net [77.88.28.101]) by lists.linaro.org (Postfix) with ESMTPS id D9CD1644BC for ; Wed, 16 Aug 2017 08:00:35 +0000 (UTC) Received: from mxback13j.mail.yandex.net (mxback13j.mail.yandex.net [IPv6:2a02:6b8:0:1619::88]) by forward101p.mail.yandex.net (Yandex) with ESMTP id 149E76A84AAF for ; Wed, 16 Aug 2017 11:00:34 +0300 (MSK) Received: from smtp1j.mail.yandex.net (smtp1j.mail.yandex.net [2a02:6b8:0:801::ab]) by mxback13j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id F31vSEXP8g-0XK07xcm; Wed, 16 Aug 2017 11:00:33 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id lI5XI3wvqw-0W1KVIW6; Wed, 16 Aug 2017 11:00:32 +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: Wed, 16 Aug 2017 11:00:04 +0300 Message-Id: <1502870408-2658-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502870408-2658-1-git-send-email-odpbot@yandex.ru> References: <1502870408-2658-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 124 Subject: [lng-odp] [PATCH v2 2/6] linux-gen: 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: 223e557905dfa62704233e593e0a052a44fb3b4e **/ 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,