From patchwork Mon Dec 4 09:00:22 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: 120493 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4175291qgn; Mon, 4 Dec 2017 01:02:00 -0800 (PST) X-Google-Smtp-Source: AGs4zMZ9VMSJRvPxPbX9lAL9j5OV+UlWEnxEGWbuL2DqrczY/pXwS2c8CiiVfidjB3VEgqfNvlXB X-Received: by 10.200.15.155 with SMTP id b27mr20439784qtk.151.1512378120431; Mon, 04 Dec 2017 01:02:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512378120; cv=none; d=google.com; s=arc-20160816; b=wUlWce1YNbFO2ou2lzsN+BrmcNJSPkIy1p93NvSCFX5SAqTPjPC008stIATjjhLAiP TXVIl3NfnRnM44XXesulhkPxh8Fa4X2ZGtXpa4TgqNdKecJPIhxPJTAs3f3Xxw5NLWoT MIfm84Es34701rhFfj4XuhQsHoKolvDZ+pf+gMxyXJp6yRkP6sb9HleEy9JgFZpVIzWo OYdsgFzzZrdyWrhZyLNa3rxoegKZFodps8k6LAvMghNj+gk9R1V3eN7TQuD5IQTpEcwE +w6LylC+atZ+2eSCWfy2w+jmYB88Gl3sRGXzk8ONqY95DEtlOfZeYzgJWg2ednMshxT4 U+xw== 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=o1uLqsx/q6pxWcpkEFxmr23CTWFiDXK2yDhUrl1CFM0=; b=GoUMbkB3LLDyKqs4xJ7An0WbPbG/bk7w+64BUU6DozQqZGl2WCaRUU7MxnJ4hAu2bt /wm5K6Ymu79H/0XkZ+d6qM/+4BeEHI0wdlnTNiTkOAsf/idMNK+WJeY8hCVijWEyg4rJ 20ee7pxvhoagzhwmZvPxji/pn/zJfMee+Qhw5TlELKY0H0s8t5uYx6xdF3/ZxLK/e+gs 5ODKLrZ+m6LNCYxpVkvrs+GpjfLCh/64pk4FDFMc/HNXI93TyHruC18JmBprl7mtr2Jb LvOT9wZrpDrVRwMwIeyp3u41pLJ1E7GIfDdmoLLR2U8+ao//Od2p89qdIHTlO8yFjxom w/0Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 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 (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id r24si1765297qtk.168.2017.12.04.01.02.00; Mon, 04 Dec 2017 01:02:00 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 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 EA30E608BA; Mon, 4 Dec 2017 09:01:59 +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=-0.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, URIBL_BLOCKED, URIBL_DBL_ABUSE_SPAM 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 015B1608D5; Mon, 4 Dec 2017 09:00:43 +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 E06F26086D; Mon, 4 Dec 2017 09:00:34 +0000 (UTC) Received: from forward100j.mail.yandex.net (forward100j.mail.yandex.net [5.45.198.240]) by lists.linaro.org (Postfix) with ESMTPS id E65DE60890 for ; Mon, 4 Dec 2017 09:00:30 +0000 (UTC) Received: from mxback13g.mail.yandex.net (mxback13g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:92]) by forward100j.mail.yandex.net (Yandex) with ESMTP id 0D3315D81BD5 for ; Mon, 4 Dec 2017 12:00:29 +0300 (MSK) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback13g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id bWLtHTcZIC-0SkOo67X; Mon, 04 Dec 2017 12:00:29 +0300 Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 2pKugCeR78-0SHCiIFl; Mon, 04 Dec 2017 12: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, 4 Dec 2017 12:00:22 +0300 Message-Id: <1512378024-15857-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512378024-15857-1-git-send-email-odpbot@yandex.ru> References: <1512378024-15857-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 313 Subject: [lng-odp] [PATCH API-NEXT v2 3/5] linux-gen: dpdk: use checksum insert enable config 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: Petri Savolainen Enable checksum insertion only when requested. DPDK uses less optimized driver code (on Intel NICs at least) when any of the L4 checksum offloads is enabled. Signed-off-by: Petri Savolainen --- /** Email created from pull request 313 (psavol:next-pktout-config) ** https://github.com/Linaro/odp/pull/313 ** Patch: https://github.com/Linaro/odp/pull/313.patch ** Base sha: bdb7cbf620ada8682c89b5ae5a97cb84f16c0ed0 ** Merge commit sha: e4a122986c2750ffb044994107b385bd8002cbf4 **/ platform/linux-generic/pktio/dpdk.c | 48 ++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c index d0a238aa6..4a37fe6e5 100644 --- a/platform/linux-generic/pktio/dpdk.c +++ b/platform/linux-generic/pktio/dpdk.c @@ -123,6 +123,7 @@ static inline void mbuf_update(struct rte_mbuf *mbuf, odp_packet_hdr_t *pkt_hdr, mbuf->data_len = pkt_len; mbuf->pkt_len = pkt_len; mbuf->refcnt = 1; + mbuf->ol_flags = 0; if (odp_unlikely(pkt_hdr->buf_hdr.base_data != pkt_hdr->buf_hdr.seg[0].data)) @@ -1253,6 +1254,13 @@ static void dpdk_init_capability(pktio_entry_t *pktio_entry, (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; + + capa->config.pktout.bit.ipv4_chksum_ena = + capa->config.pktout.bit.ipv4_chksum; + capa->config.pktout.bit.udp_chksum_ena = + capa->config.pktout.bit.udp_chksum; + capa->config.pktout.bit.tcp_chksum_ena = + capa->config.pktout.bit.tcp_chksum; } static int dpdk_open(odp_pktio_t id ODP_UNUSED, @@ -1388,9 +1396,47 @@ static int dpdk_start(pktio_entry_t *pktio_entry) } /* Init TX queues */ for (i = 0; i < pktio_entry->s.num_out_queue; i++) { + struct rte_eth_dev_info dev_info; + const struct rte_eth_txconf *txconf = NULL; + int ip_ena = pktio_entry->s.config.pktout.bit.ipv4_chksum_ena; + int udp_ena = pktio_entry->s.config.pktout.bit.udp_chksum_ena; + int tcp_ena = pktio_entry->s.config.pktout.bit.tcp_chksum_ena; + int sctp_ena = pktio_entry->s.config.pktout.bit.sctp_chksum_ena; + int chksum_ena = ip_ena | udp_ena | tcp_ena | sctp_ena; + + if (chksum_ena) { + /* Enable UDP, TCP, STCP checksum offload */ + uint32_t txq_flags = 0; + + if (udp_ena == 0) + txq_flags |= ETH_TXQ_FLAGS_NOXSUMUDP; + + if (tcp_ena == 0) + txq_flags |= ETH_TXQ_FLAGS_NOXSUMTCP; + + if (sctp_ena == 0) + txq_flags |= ETH_TXQ_FLAGS_NOXSUMSCTP; + + /* When IP checksum is requested alone, enable UDP + * offload. DPDK IP checksum offload is enabled only + * when one of the L4 checksum offloads is requested.*/ + if ((udp_ena == 0) && (tcp_ena == 0) && (sctp_ena == 0)) + txq_flags = ETH_TXQ_FLAGS_NOXSUMTCP | + ETH_TXQ_FLAGS_NOXSUMSCTP; + + txq_flags |= ETH_TXQ_FLAGS_NOMULTSEGS | + ETH_TXQ_FLAGS_NOREFCOUNT | + ETH_TXQ_FLAGS_NOMULTMEMP | + ETH_TXQ_FLAGS_NOVLANOFFL; + + rte_eth_dev_info_get(port_id, &dev_info); + dev_info.default_txconf.txq_flags = txq_flags; + txconf = &dev_info.default_txconf; + } + ret = rte_eth_tx_queue_setup(port_id, i, DPDK_NM_TX_DESC, rte_eth_dev_socket_id(port_id), - NULL); + txconf); if (ret < 0) { ODP_ERR("Queue setup failed: err=%d, port=%" PRIu8 "\n", ret, port_id);