From patchwork Mon Dec 4 09:00:20 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: 120495 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4176221qgn; Mon, 4 Dec 2017 01:02:59 -0800 (PST) X-Google-Smtp-Source: AGs4zMbVApaSSeFlT4h86JNpOB2YZhOb9nl85hTk5+cfV9vdlPB95oYYkFeLEurAnDFxvyCx8nDw X-Received: by 10.200.0.131 with SMTP id c3mr20842152qtg.49.1512378179627; Mon, 04 Dec 2017 01:02:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512378179; cv=none; d=google.com; s=arc-20160816; b=fmDJbDRBNbj3Bu9EgZdZ40CQfwEbx+DuwjOQ/FD37Nq03igUjZ2RlmJNh7+gXrITyV P58I6Pt09bLcSH5DYostDxHiu5lCf4G/EWK1uaw8FnwGe/Z4pzoPUV3XzXcNic6pjcPx rLCW9X9OGueBGaKALO2qCA8LGL54f/6d8KjOX2L5L23JNFlr1kaH/VbK+N1zbDEifivL 0cjySf1Cjvy//dq4IvE+slXP6UH0FAsTMl69zIgW8crJ5XQrfuW4/dBnd2rPxI0a6jaI svSwSvLiIzk1gNfPerVX5F+8WeYkk0JTcCLlrd9Zacaycu3J3cCM65FWWsh8uNwFQALq 2rUg== 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=R5PXkfArvQ0Qq0cdz839w9csW5zgUYL5iHb/Z+t9Sww=; b=As7sci+v6F31Pyz59luHuOkltMdEoTWzRVEpGh3d0Jx4y8GAj6GBmaqYI5nxeWmyGh ZX/I6lft2xwfkyoRhFkIlVyb6YOrOrXoVzYpGXzbuZ+7v2Q9y6g/rtqJy2tpjAaPQyy4 2xlTB0JBsDrTh8V4B6usx0vGQ8I/1d9ejGVWqm/ltCUASN5M96cRNo578BexW2AVyGLv Q6Cbxhp6JahCx48dLXzwQM7KWe/d8JpO53T32g1hhx9YdVqR6/vnebaZKhSb4TkhZfDI Jvgj7fEPTVQAMtpWlBXtTE18Qg1XNhQmf/URgeQITqhiIP3DgPcXnM1SJvBASVnl2KJk BdgA== 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 m82si2339794qkm.371.2017.12.04.01.02.59; Mon, 04 Dec 2017 01:02:59 -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 52E4A608BB; Mon, 4 Dec 2017 09:02: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, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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 84E6C60890; Mon, 4 Dec 2017 09:00:52 +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 E59F16086D; Mon, 4 Dec 2017 09:00:35 +0000 (UTC) Received: from forward104j.mail.yandex.net (forward104j.mail.yandex.net [5.45.198.247]) by lists.linaro.org (Postfix) with ESMTPS id 5C7A260810 for ; Mon, 4 Dec 2017 09:00:28 +0000 (UTC) Received: from mxback8j.mail.yandex.net (mxback8j.mail.yandex.net [IPv6:2a02:6b8:0:1619::111]) by forward104j.mail.yandex.net (Yandex) with ESMTP id E9F2541C29 for ; Mon, 4 Dec 2017 12:00:26 +0300 (MSK) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback8j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 81uw9lm2Pf-0Qi01evQ; Mon, 04 Dec 2017 12:00:26 +0300 Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 2pKugCeR78-0PHalVAM; Mon, 04 Dec 2017 12: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, 4 Dec 2017 12:00:20 +0300 Message-Id: <1512378024-15857-2-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 1/5] api: pktio: add checksum insert enable bits 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 Added bits to control if checksum insertion is enabled / disabled at packet output. Current configuration options control if checksum is inserted / not inserted by default, but leaves it open for application to request checksum always with override functions. Explicit disable allows implementation to optimize performance (e.g. DPDK does this). 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 **/ include/odp/api/spec/packet.h | 4 +-- include/odp/api/spec/packet_io.h | 62 ++++++++++++++++++++++++++++------------ 2 files changed, 46 insertions(+), 20 deletions(-) diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h index b897c9d3c..1dbbfafe6 100644 --- a/include/odp/api/spec/packet.h +++ b/include/odp/api/spec/packet.h @@ -1531,7 +1531,7 @@ odp_packet_chksum_status_t odp_packet_l4_chksum_status(odp_packet_t pkt); * * Calling this function is always allowed but the checksum will not be * inserted if the packet is output through a pktio that does not have - * the relevant pktout chksum bit set in the pktio capability. + * the relevant checksum insertion enabled. * * @param pkt Packet handle * @param insert 0: do not insert L3 checksum @@ -1548,7 +1548,7 @@ void odp_packet_l3_chksum_insert(odp_packet_t pkt, int insert); * * Calling this function is always allowed but the checksum will not be * inserted if the packet is output through a pktio that does not have - * the relevant pktout chksum bit set in the pktio capability. + * the relevant checksum insertion enabled. * * @param pkt Packet handle * @param insert 0: do not insert L4 checksum diff --git a/include/odp/api/spec/packet_io.h b/include/odp/api/spec/packet_io.h index 60d13043d..d25afa3e4 100644 --- a/include/odp/api/spec/packet_io.h +++ b/include/odp/api/spec/packet_io.h @@ -329,15 +329,29 @@ typedef union odp_pktin_config_opt_t { * Packet output configuration options bit field * * Packet output configuration options listed in a bit field structure. Packet - * output checksum insertion may be enabled or disabled. When it is enabled, - * implementation will calculate and insert checksum into every outgoing packet - * by default. Application may disable checksum insertion (e.g. - * odp_packet_l4_chksum_insert()) on per packet basis. For correct operation, - * packet metadata must provide valid offsets for the appropriate protocols. - * For example, UDP checksum calculation needs both L3 and L4 offsets (to access - * IP and UDP headers). When application (e.g. a switch) does not modify L3/L4 - * data and thus checksum does not need to be updated, output checksum insertion - * should be disabled for optimal performance. + * output checksum insertion may be enabled or disabled (e.g. ipv4_chksum_ena): + * + * 0: Disable checksum insertion. Application will not request checksum + * insertion for any packet. This is the default value for xxx_chksum_ena + * bits. + * 1: Enable checksum insertion. Application will request checksum insertion + * for some packets. + * + * When checksum insertion is enabled, application may use configuration options + * to set the default behaviour on packet output (e.g. ipv4_chksum): + * + * 0: Do not insert checksum by default. This is the default value for + * xxx_chksum bits. + * 1: Calculate and insert checksum by default. + * + * These defaults may be overridden on per packet basis using e.g. + * odp_packet_l4_chksum_insert(). + * + * For correct operation, packet metadata must provide valid offsets for the + * appropriate protocols. For example, UDP checksum calculation needs both L3 + * and L4 offsets (to access IP and UDP headers). When application + * (e.g. a switch) does not modify L3/L4 data and thus checksum does not need + * to be updated, checksum insertion should be disabled for optimal performance. * * Packet flags (odp_packet_has_*()) are ignored for the purpose of checksum * insertion in packet output. @@ -354,19 +368,31 @@ typedef union odp_pktin_config_opt_t { * insertion. */ typedef union odp_pktout_config_opt_t { - /** Option flags */ + /** Option flags for packet output */ struct { - /** Insert IPv4 header checksum on packet output */ - uint64_t ipv4_chksum : 1; + /** Enable IPv4 header checksum insertion. */ + uint64_t ipv4_chksum_ena : 1; + + /** Enable UDP checksum insertion */ + uint64_t udp_chksum_ena : 1; + + /** Enable TCP checksum insertion */ + uint64_t tcp_chksum_ena : 1; + + /** Enable SCTP checksum insertion */ + uint64_t sctp_chksum_ena : 1; + + /** Insert IPv4 header checksum by default */ + uint64_t ipv4_chksum : 1; - /** Insert UDP checksum on packet output */ - uint64_t udp_chksum : 1; + /** Insert UDP checksum on packet by default */ + uint64_t udp_chksum : 1; - /** Insert TCP checksum on packet output */ - uint64_t tcp_chksum : 1; + /** Insert TCP checksum on packet by default */ + uint64_t tcp_chksum : 1; - /** Insert SCTP checksum on packet output */ - uint64_t sctp_chksum : 1; + /** Insert SCTP checksum on packet by default */ + uint64_t sctp_chksum : 1; } bit; From patchwork Mon Dec 4 09:00:21 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: 120492 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4174727qgn; Mon, 4 Dec 2017 01:01:24 -0800 (PST) X-Google-Smtp-Source: AGs4zMZ0yvxsrVKhwZgLdXTUfYVDNUj4iF2mTv63EbZu3Mx8U/4F2zb9+ISDIsffxOR4u8sIk7io X-Received: by 10.237.59.74 with SMTP id q10mr19495284qte.254.1512378084569; Mon, 04 Dec 2017 01:01:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512378084; cv=none; d=google.com; s=arc-20160816; b=BFJM19Eq5SjbWwHy9BMImXNRHkkPcIP38ScOEGQNuX6aNlD493o6VQX0u4AUlHzKkd dFYBB1AN0j2eQoKMN9lNst/tSFc1UKhsrxVt5FuGD8Onwx74V0K8NcgYpyACqajm2Wqs AArjNFXOWR/wgajmj5qy75ZVyBJv24GKpuz/Cx2xBIfQHT1r92cMWyRjxVEkDznHYTVY IRLFF6H9zhldLjBBSlXVs+gTAQnps9oPqnmtG5Qa3cohy5spj63dArBfvyIQ0Gt/iOsz yiY5CChPxziJeVLORHBgoaFohphSWfc2M3fCr6B0XSdHsSTp65Fn5Vc8LQ8YphOsSILw 3s5w== 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=rJQ00EvxiOTcUIhtgrIQBo0DpZt4RF4NTw8a/g6Nklo=; b=aySVXZZLpuWR1/aZ7I4CY8ZVeq75C6h7GWAUHr5jeKjAGnbCfBFnmQ1boJlR48qCfB VhaVbDAqNYrROOkk+kNxq2ltWrXeSds395pDjYdEYH+Ag5jiDeFOyGjOFUv+VZV64Eh7 Ii9OPF6K9ilg69EPJ8ITo8cHzU2hLJ8cwiMaYWu+N+mMOMIp/4+8ettgctRHvwNhBpFZ jV6Q8fJFDpSRSt5U2+geZ3Ym7KQZga0aVEVq1eZhU/wsFloCt/VYMxSSfv+/OWvTjPpo Dd+jmC+ZDJeA0/lXC/ZF1bVYqvC44lsaQa5CHMxj83Yk10xc+Vb6iGKpGKqtNw84VvQJ H/iw== 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 s82si261538qke.478.2017.12.04.01.01.24; Mon, 04 Dec 2017 01:01:24 -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 3584660939; Mon, 4 Dec 2017 09:01:24 +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=-3.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, 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 9F806608AA; Mon, 4 Dec 2017 09: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 0D14B608AA; Mon, 4 Dec 2017 09:00:34 +0000 (UTC) Received: from forward102o.mail.yandex.net (forward102o.mail.yandex.net [37.140.190.182]) by lists.linaro.org (Postfix) with ESMTPS id 305136086D for ; Mon, 4 Dec 2017 09:00:30 +0000 (UTC) Received: from mxback10j.mail.yandex.net (mxback10j.mail.yandex.net [IPv6:2a02:6b8:0:1619::113]) by forward102o.mail.yandex.net (Yandex) with ESMTP id 0E9095A019C6 for ; Mon, 4 Dec 2017 12:00:28 +0300 (MSK) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback10j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id pzzjdCwJP6-0REeofu2; Mon, 04 Dec 2017 12:00:28 +0300 Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 2pKugCeR78-0QHarf0g; Mon, 04 Dec 2017 12:00:27 +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:21 +0300 Message-Id: <1512378024-15857-3-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 2/5] example: generator use checksum enable 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 Use new checksum insert enable bits. 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 **/ example/generator/odp_generator.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index e1d98539f..81d954662 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -523,6 +523,10 @@ static int create_pktio(const char *dev, odp_pool_t pool, 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_ena = + capa.config.pktout.bit.ipv4_chksum_ena; + itf->config.pktout.bit.udp_chksum_ena = + capa.config.pktout.bit.udp_chksum_ena; itf->config.pktout.bit.ipv4_chksum = capa.config.pktout.bit.ipv4_chksum; itf->config.pktout.bit.udp_chksum = capa.config.pktout.bit.udp_chksum; 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); From patchwork Mon Dec 4 09:00:23 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: 120494 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4176084qgn; Mon, 4 Dec 2017 01:02:51 -0800 (PST) X-Google-Smtp-Source: AGs4zMaXbgUe95vTDRpk+hwsnkM+r3lzR+0cC8ST8OyI/71Zdd1vt43Rb62pCSl+gSBRP90VjVdE X-Received: by 10.55.108.7 with SMTP id h7mr19175116qkc.111.1512378171179; Mon, 04 Dec 2017 01:02:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512378171; cv=none; d=google.com; s=arc-20160816; b=qlk+32yt45A89NaX3EaPRQNqNW7ACjY+h+oB+ugINa7vDj7sogMjlGOd2yMkggQkft Kbr/oJLnFfpq5U10uU6E0yIc7Qhr2sxHNef9k7VWUnjwYsjVriDzIQb5G5BSOv8/EPKP NFIVhKSNel75LxZlu01K9Cqn8jRN/L9dLw5ms8nT0lm+O/GNg57udXg5m5hLpCatazML glGkeZBgJKq2SkDXjEUTK0oFvp6wC3nJbxk1wO6zHkUNLe0jT0PeeEayuYFa0eCBLyJj 1c4UE40QYx7DqPrYkSZ3P7EH3RZ8+MlGzOVRHZTZvo/4AWL9AgmrXnnrDrViHGr7XnQ5 ARVA== 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=WG12sythjIBQ+JdWmCsChPRVSA3exFhjQw5HXaj8j4k=; b=ZVCVYCmlPU4Nr+rgYxZL/OuEiwszrIL0rvIHAnAQY/mrk31ZIdtM5BVf7rAHQ6BnjD xyAG6L9mbYwmZJJfONk8C0laf/WRA8wDW3bT2CYMVXPC/Ga418Os3W6BHcD7impcXhN2 Mlrn2utOwElvPxMh5zb8tMSI51eLVj619qdE0MLgnqbvWpco6TXEacaE5uxDqIsWr9Qp 78NT3Mv/4EaD0OBOZO3KNnTVoWqDyeYdqFL6hOpUHu2AoGBKBcQQgpAXbBhr96WtOOBU wuB+R9Qa49cnTJAOiPOLL6xnbneAeUqdsFB+HU3ysZDAnOR0VC/uvref5FjJTaKu4cIQ v7LA== 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 p7si7163335qki.429.2017.12.04.01.02.50; Mon, 04 Dec 2017 01:02:51 -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 CA0F3608BA; Mon, 4 Dec 2017 09:02:50 +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 431D3608CC; Mon, 4 Dec 2017 09:00:48 +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 8FB0A6086D; Mon, 4 Dec 2017 09:00:35 +0000 (UTC) Received: from forward100j.mail.yandex.net (forward100j.mail.yandex.net [5.45.198.240]) by lists.linaro.org (Postfix) with ESMTPS id EB94E608A8 for ; Mon, 4 Dec 2017 09:00:30 +0000 (UTC) Received: from mxback1o.mail.yandex.net (mxback1o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1b]) by forward100j.mail.yandex.net (Yandex) with ESMTP id CC2675D81966 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 mxback1o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id PYIGaXZ54B-0TkmMK0v; Mon, 04 Dec 2017 12:00:29 +0300 Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 2pKugCeR78-0TH0iIuU; Mon, 04 Dec 2017 12:00:29 +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:23 +0300 Message-Id: <1512378024-15857-5-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 4/5] test: l2fwd: add checksum offload option 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 Added option to enable checksum insertion at packet output. This can be used to test checksum offload in various packet IO combinations. 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 **/ test/performance/odp_l2fwd.c | 105 +++++++++++++++++++++++++++++++------------ 1 file changed, 76 insertions(+), 29 deletions(-) diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c index 2daf0e2db..0ebb0dd17 100644 --- a/test/performance/odp_l2fwd.c +++ b/test/performance/odp_l2fwd.c @@ -92,6 +92,7 @@ static inline int sched_mode(pktin_mode_t in_mode) * Parsed command line application arguments */ typedef struct { + int extra_check; /**< Some extra checks have been enabled */ int cpu_count; int if_count; /**< Number of interfaces to be used */ int addr_count; /**< Number of dst addresses to be used */ @@ -106,6 +107,7 @@ typedef struct { int dst_change; /**< Change destination eth addresses */ int src_change; /**< Change source eth addresses */ int error_check; /**< Check packet errors */ + int chksum; /**< Checksum offload */ int sched_mode; /**< Scheduler mode */ int num_groups; /**< Number of scheduling groups */ int verbose; /**< Verbose output */ @@ -293,6 +295,18 @@ static inline int event_queue_send(odp_queue_t queue, odp_packet_t *pkt_tbl, return sent; } +static inline void chksum_insert(odp_packet_t *pkt_tbl, int pkts) +{ + odp_packet_t pkt; + int i; + + for (i = 0; i < pkts; i++) { + pkt = pkt_tbl[i]; + odp_packet_l3_chksum_insert(pkt, 1); + odp_packet_l4_chksum_insert(pkt, 1); + } +} + /** * Packet IO worker thread using scheduled queues * @@ -366,18 +380,23 @@ static int run_worker_sched_mode(void *arg) for (i = 0; i < pkts; i++) pkt_tbl[i] = odp_packet_from_event(ev_tbl[i]); - if (gbl_args->appl.error_check) { - int rx_drops; + if (odp_unlikely(gbl_args->appl.extra_check)) { + if (gbl_args->appl.chksum) + chksum_insert(pkt_tbl, pkts); - /* Drop packets with errors */ - rx_drops = drop_err_pkts(pkt_tbl, pkts); + if (gbl_args->appl.error_check) { + int rx_drops; - if (odp_unlikely(rx_drops)) { - stats->s.rx_drops += rx_drops; - if (pkts == rx_drops) - continue; + /* Drop packets with errors */ + rx_drops = drop_err_pkts(pkt_tbl, pkts); - pkts -= rx_drops; + if (odp_unlikely(rx_drops)) { + stats->s.rx_drops += rx_drops; + if (pkts == rx_drops) + continue; + + pkts -= rx_drops; + } } } @@ -487,18 +506,23 @@ static int run_worker_plain_queue_mode(void *arg) for (i = 0; i < pkts; i++) pkt_tbl[i] = odp_packet_from_event(event[i]); - if (gbl_args->appl.error_check) { - int rx_drops; + if (odp_unlikely(gbl_args->appl.extra_check)) { + if (gbl_args->appl.chksum) + chksum_insert(pkt_tbl, pkts); - /* Drop packets with errors */ - rx_drops = drop_err_pkts(pkt_tbl, pkts); + if (gbl_args->appl.error_check) { + int rx_drops; - if (odp_unlikely(rx_drops)) { - stats->s.rx_drops += rx_drops; - if (pkts == rx_drops) - continue; + /* Drop packets with errors */ + rx_drops = drop_err_pkts(pkt_tbl, pkts); - pkts -= rx_drops; + if (odp_unlikely(rx_drops)) { + stats->s.rx_drops += rx_drops; + if (pkts == rx_drops) + continue; + + pkts -= rx_drops; + } } } @@ -605,18 +629,23 @@ static int run_worker_direct_mode(void *arg) if (odp_unlikely(pkts <= 0)) continue; - if (gbl_args->appl.error_check) { - int rx_drops; + if (odp_unlikely(gbl_args->appl.extra_check)) { + if (gbl_args->appl.chksum) + chksum_insert(pkt_tbl, pkts); + + if (gbl_args->appl.error_check) { + int rx_drops; - /* Drop packets with errors */ - rx_drops = drop_err_pkts(pkt_tbl, pkts); + /* Drop packets with errors */ + rx_drops = drop_err_pkts(pkt_tbl, pkts); - if (odp_unlikely(rx_drops)) { - stats->s.rx_drops += rx_drops; - if (pkts == rx_drops) - continue; + if (odp_unlikely(rx_drops)) { + stats->s.rx_drops += rx_drops; + if (pkts == rx_drops) + continue; - pkts -= rx_drops; + pkts -= rx_drops; + } } } @@ -707,9 +736,17 @@ static int create_pktio(const char *dev, int idx, int num_rx, int num_tx, } odp_pktio_config_init(&config); - config.parser.layer = gbl_args->appl.error_check ? + config.parser.layer = gbl_args->appl.extra_check ? ODP_PKTIO_PARSER_LAYER_ALL : ODP_PKTIO_PARSER_LAYER_NONE; + + if (gbl_args->appl.chksum) { + printf("Checksum offload enabled\n"); + config.pktout.bit.ipv4_chksum_ena = 1; + config.pktout.bit.udp_chksum_ena = 1; + config.pktout.bit.tcp_chksum_ena = 1; + } + odp_pktio_config(pktio, &config); odp_pktin_queue_param_init(&pktin_param); @@ -1132,9 +1169,12 @@ static void usage(char *progname) " Requires also the -d flag to be set\n" " -e, --error_check 0: Don't check packet errors (default)\n" " 1: Check packet errors\n" + " -k, --chksum 0: Don't use checksum offload (default)\n" + " 1: Use checksum offload\n" " -g, --groups Number of groups to use: 0 ... num\n" " 0: SCHED_GROUP_ALL (default)\n" " num: must not exceed number of interfaces or workers\n" + " -v, --verbose Verbose output.\n" " -h, --help Display help and exit.\n\n" "\n", NO_PATH(progname), NO_PATH(progname), MAX_PKTIOS ); @@ -1166,13 +1206,14 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) {"dst_change", required_argument, NULL, 'd'}, {"src_change", required_argument, NULL, 's'}, {"error_check", required_argument, NULL, 'e'}, + {"chksum", required_argument, NULL, 'k'}, {"groups", required_argument, NULL, 'g'}, {"verbose", no_argument, NULL, 'v'}, {"help", no_argument, NULL, 'h'}, {NULL, 0, NULL, 0} }; - static const char *shortopts = "+c:+t:+a:i:m:o:r:d:s:e:g:vh"; + static const char *shortopts = "+c:+t:+a:i:m:o:r:d:s:e:k:g:vh"; /* let helper collect its own arguments (e.g. --odph_proc) */ odph_parse_options(argc, argv, shortopts, longopts); @@ -1184,6 +1225,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) appl_args->num_groups = 0; /* use default group */ appl_args->error_check = 0; /* don't check packet errors by default */ appl_args->verbose = 0; + appl_args->chksum = 0; /* don't use checksum offload by default */ opterr = 0; /* do not issue errors on helper options */ @@ -1308,6 +1350,9 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) case 'e': appl_args->error_check = atoi(optarg); break; + case 'k': + appl_args->chksum = atoi(optarg); + break; case 'g': appl_args->num_groups = atoi(optarg); break; @@ -1335,6 +1380,8 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) exit(EXIT_FAILURE); } + appl_args->extra_check = appl_args->error_check || appl_args->chksum; + optind = 1; /* reset 'extern optind' from the getopt lib */ } From patchwork Mon Dec 4 09:00:24 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: 120496 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4176927qgn; Mon, 4 Dec 2017 01:03:43 -0800 (PST) X-Google-Smtp-Source: AGs4zMY8UeXB04VT1QAaiQhwFc83birJky5TpkAjYe7pmj/ENmkFZINWtOnVsokt/XfcoObEnUDI X-Received: by 10.200.27.43 with SMTP id y40mr20366146qtj.126.1512378222921; Mon, 04 Dec 2017 01:03:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512378222; cv=none; d=google.com; s=arc-20160816; b=Qi9Gvjv/78g0MApw7B+yLk69InRt3h3xyZJCl5SWBvKvirAZP+3Q/6Xk9cTMAi55Ar qSb4RysNGjZosV81Ff9LD+BjiA9eJ4rObSqfeIihMlkZJI2EHzrD9j+F2kH/l3FzyFtg rfb0F0PEv9gmaILur+itSR4YM6O6x1g+mHx4d92TPtqQImiQDl0eoccvl6wmbR0FQ4oc msDSRBNu+dcPrz/dGB2iJ3U0/uxaNazovx3d7b/aVkqQhK22YNvwNGsqtJQmEUSXmgWz s66weoLQ5d4NPDrXMkyNpud7/HqzGGCa7M/Ubwd5vvRai1/By+0R5RS0RLg1/ZhZlmvY 31+g== 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=RZBXqGo1jcI5xweyZFVZKBpTlT40JL6+CnMDm0lnacg=; b=WMbrZv4NFeXMt3CX4MQ/Su5gPCY/D7YTVJVqkfXspQyx6IOvDiSRgTI9bzBn6lxttH dbT2tz8WI9lZicYMo+SDAwWpALO3ic88QJlr1+KsY0GiEfT3zX0G+BNuHNmAcga7SsHT t5OLpCQlpBbL5mjQF48myclmQfTG60rABlleWlEO0wrjIQoEVOdNUIMvwf2SQ0b0Kans xHJ52rsB8PlOi2Jug7Bie9PPhtvdB4MhZi9DuuZ2QzyLkbQB8PICgNseAESPWVE/dhf9 1a9+sJRSshuese3Dc6E4P8gTG012v4Pwabi5bz6TPoOONeMyFvZRaQ+Fs8n319pdherB XmMA== 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 f6si2197008qkd.374.2017.12.04.01.03.42; Mon, 04 Dec 2017 01:03:42 -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 831A8608D9; Mon, 4 Dec 2017 09:03:42 +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, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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 B995560905; Mon, 4 Dec 2017 09:00:59 +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 5650C60810; Mon, 4 Dec 2017 09:00:36 +0000 (UTC) Received: from forward103p.mail.yandex.net (forward103p.mail.yandex.net [77.88.28.106]) by lists.linaro.org (Postfix) with ESMTPS id C6D5A6065D for ; Mon, 4 Dec 2017 09:00:33 +0000 (UTC) Received: from mxback16j.mail.yandex.net (mxback16j.mail.yandex.net [IPv6:2a02:6b8:0:1619::92]) by forward103p.mail.yandex.net (Yandex) with ESMTP id 110732184404 for ; Mon, 4 Dec 2017 12:00:31 +0300 (MSK) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback16j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id elaGr8OQpn-0UaGxx5K; Mon, 04 Dec 2017 12:00:30 +0300 Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 2pKugCeR78-0THmofnY; Mon, 04 Dec 2017 12:00:29 +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:24 +0300 Message-Id: <1512378024-15857-6-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 5/5] linux-gen: dpdk: checksum insert enabled flag 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 Added interface level flag to optimize checksum insertion checks. If checksum insertion has not been enabled, further configuration or packet level checks are not performed. 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/include/odp_packet_io_internal.h | 3 ++- platform/linux-generic/pktio/dpdk.c | 11 +++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h index f323d5c31..598b1ad50 100644 --- a/platform/linux-generic/include/odp_packet_io_internal.h +++ b/platform/linux-generic/include/odp_packet_io_internal.h @@ -113,7 +113,8 @@ struct pktio_entry { /* These two locks together lock the whole pktio device */ odp_ticketlock_t rxl; /**< RX ticketlock */ odp_ticketlock_t txl; /**< TX ticketlock */ - int cls_enabled; /**< is classifier enabled */ + uint8_t cls_enabled; /**< classifier enabled */ + uint8_t chksum_insert_ena; /**< pktout checksum offload enabled */ odp_pktio_t handle; /**< pktio handle */ union { pkt_loop_t pkt_loop; /**< Using loopback for IO */ diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c index 4a37fe6e5..48c2d0b0e 100644 --- a/platform/linux-generic/pktio/dpdk.c +++ b/platform/linux-generic/pktio/dpdk.c @@ -546,6 +546,9 @@ static inline void pkt_set_ol_tx(odp_pktout_config_opt_t *pktout_cfg, odp_bool_t ipv4_chksum_pkt, udp_chksum_pkt, tcp_chksum_pkt; packet_parser_t *pkt_p = &pkt_hdr->p; + if (pkt_p->l3_offset == ODP_PACKET_OFFSET_INVALID) + return; + l3_hdr = (void *)(mbuf_data + pkt_p->l3_offset); if (check_proto(l3_hdr, &l3_proto_v4, &l4_proto)) @@ -633,7 +636,7 @@ static inline int pkt_to_mbuf(pktio_entry_t *pktio_entry, odp_packet_copy_to_mem(pkt_table[i], 0, pkt_len, data); - if (pkt_hdr->p.l3_offset != ODP_PACKET_OFFSET_INVALID) { + if (odp_unlikely(pktio_entry->s.chksum_insert_ena)) { odp_pktout_config_opt_t *pktout_capa = &pktio_entry->s.capa.config.pktout; @@ -748,7 +751,7 @@ static inline int pkt_to_mbuf_zero(pktio_entry_t *pktio_entry, pkt_hdr->extra_type == PKT_EXTRA_TYPE_DPDK)) { mbuf_update(mbuf, pkt_hdr, pkt_len); - if (pkt_hdr->p.l3_offset != ODP_PACKET_OFFSET_INVALID) + if (odp_unlikely(pktio_entry->s.chksum_insert_ena)) pkt_set_ol_tx(pktout_cfg, pktout_capa, pkt_hdr, mbuf, _odp_packet_data(pkt)); } else { @@ -771,8 +774,7 @@ static inline int pkt_to_mbuf_zero(pktio_entry_t *pktio_entry, mbuf_init((struct rte_mempool *) pool_entry->ext_desc, mbuf, pkt_hdr); mbuf_update(mbuf, pkt_hdr, pkt_len); - if (pkt_hdr->p.l3_offset != - ODP_PACKET_OFFSET_INVALID) + if (pktio_entry->s.chksum_insert_ena) pkt_set_ol_tx(pktout_cfg, pktout_capa, pkt_hdr, mbuf, _odp_packet_data(pkt)); @@ -1432,6 +1434,7 @@ static int dpdk_start(pktio_entry_t *pktio_entry) rte_eth_dev_info_get(port_id, &dev_info); dev_info.default_txconf.txq_flags = txq_flags; txconf = &dev_info.default_txconf; + pktio_entry->s.chksum_insert_ena = 1; } ret = rte_eth_tx_queue_setup(port_id, i, DPDK_NM_TX_DESC,