From patchwork Tue Aug 22 08: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: 110614 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp5003843obb; Tue, 22 Aug 2017 01:02:05 -0700 (PDT) X-Received: by 10.200.3.73 with SMTP id w9mr5152172qtg.108.1503388925809; Tue, 22 Aug 2017 01:02:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503388925; cv=none; d=google.com; s=arc-20160816; b=ybcJbX7dkyApQwo67G+dt7H3Hqj/7yaRKkSrjGb57dCF5MpZ3ynXDj3lSDK2+0tbAL Hd4k7QdrOpgUvZl0HdyG1JONhcYJN5ZT4kY5V68h9it0Cwxtsp8n2JCBFziPE/JcwQC2 52reMHfHPY5EcCmWvk7fOyXJfYMesLE2ry6B18GquFvPVrVz6Vb02y7mVWO85AylM90L jYbzFj351X7u4ux67gOYhHTdLNNqv/HunyuM7vQVHaZTjbX4n+8CE82m8X4ZiFG5o2Lp 8mv66pkJu7sq0PVBVhqF+2fFEfNLhi8S/9Jva+k5anaZ1ojWyFGPSZxcgyqaRnFIL1aw EmgQ== 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=EYIIFMHsuIUlTzMoUjtF18MIbQL+vL+RKFaeSdRU1jY=; b=XDM24Oa4HJ0H1ppZVBpfP8+cjNiOzBUyiUGgqMG+0y2e3+LI0Vbuj5MAPNSkA0imAg I+taqbLfVKY72LzatbVBzGvnn6pys+x3BE7uhX4mkk8/sDcdyzzk/XpeOU8x9OlHA85+ hVwmAIh4YqlARjBPaO95XeOOa1GWWXstHbqZyvRx4T/jByGHxEr1BKS5tha/nx043P51 8vO82fvoBILh9LVcHqiGoA+aRVXcdWSszpiWIH4Fz1q2CUETkmHwaetvBqVnYwMATa6n nEIaay3vLOtP8uz8WuwXc046JzI+xBHSBRPFGu0pC5ErEdtPIxbeKWQkSLAyvryOPZYu zqCQ== 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 m97si14367241qkh.236.2017.08.22.01.02.05; Tue, 22 Aug 2017 01:02:05 -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 49EF3644B7; Tue, 22 Aug 2017 08:02:05 +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 5C6C360896; Tue, 22 Aug 2017 08:01:04 +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 88EF6644CD; Tue, 22 Aug 2017 08:00:48 +0000 (UTC) Received: from forward102j.mail.yandex.net (forward102j.mail.yandex.net [5.45.198.243]) by lists.linaro.org (Postfix) with ESMTPS id A9435644DD for ; Tue, 22 Aug 2017 08:00:16 +0000 (UTC) Received: from mxback8j.mail.yandex.net (mxback8j.mail.yandex.net [IPv6:2a02:6b8:0:1619::111]) by forward102j.mail.yandex.net (Yandex) with ESMTP id BA43B5601AF2 for ; Tue, 22 Aug 2017 11:00:14 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback8j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 3k9UAo4gJB-0EWKPDuC; Tue, 22 Aug 2017 11:00:14 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id IVkIzK7jNZ-0E0S1cIt; Tue, 22 Aug 2017 11:00:14 +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: Tue, 22 Aug 2017 11:00:06 +0300 Message-Id: <1503388810-6999-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1503388810-6999-1-git-send-email-odpbot@yandex.ru> References: <1503388810-6999-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 124 Subject: [lng-odp] [PATCH v3 1/5] 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: aecb3c7a442b426761f1e6f43308a1e9ea709ef3 ** Merge commit sha: 23658e7f5acf9d3621ec7a8f617db98a26ee1bda **/ platform/linux-generic/pktio/dpdk.c | 54 +++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c index 19310651..a4884b91 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,58 @@ 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: + /* Fall through */ + case RTE_PTYPE_L3_IPV4_EXT_UNKNOWN: + /* Fall through */ + 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,