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,