From patchwork Mon Aug 20 11:00:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 144604 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp3830681ljj; Mon, 20 Aug 2018 04:06:16 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZQ8kB52pMqIMvzkeTXOJAlKfPDQJBG1Z8TK1/zOZnUcyfxGj8ey5afhaUx+/OyGwmq1Ve2 X-Received: by 2002:ac8:364b:: with SMTP id n11-v6mr14044218qtb.339.1534763176230; Mon, 20 Aug 2018 04:06:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534763176; cv=none; d=google.com; s=arc-20160816; b=kh6umTWsBlcDEskL2JaPuBvh+XS7gc+nup2qIfY2FdqweK/pBjGtr+klk7EKM3Y0Rp hEmC9ULlQGoxfX4B2gkluL/eplBQi4H7G7b3V/OSuJJ4JB0r6LAGcEIfR2MMEVk7GRlZ DgRWDhkkhbi7c13D57kEUu8StOCu3vjk9JrzrYbJ9Gd4abYlaiociROcA4qfpvJNc+hV s0V8UHRkWKFZGOvoHX8ndfb1QPErrMZYvdui5pN+TM88w2lehfVepee9OgmXKZ085jPE mKRATECM3pq1+gd2u8YDJrrDUSJCrF6l2FkSqCJrJw/Tl690qQfWYkZYI5JvhHJHkvwy QDFg== 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=QmVcYVGvxWsLNrFC3Uj7k3vtyJcsrIYhKPSXJr3oAo0=; b=fybrKO34pYvx2O955e9MvhB2e3lIVcYDNJPfqGOUM9A3cWeZ1RgAy47dUKdqNQM5XB DhTMUL7p3DaaVnpEICFuhFl7gSGcvVsrB0nwUwr6ZNAjM0u9njmggA4lBfRAOL2mBd6U c4HQHFD/GciM/a/AgcshMGjlD/II26BVwmBEkWPSitdeQeI9TNIhR3oOjmXdN+7OIcUP Qx6Vtj4jvHOg/8HrgNlBthMqQhR6yf9wa42AcjZyUC6I70PmAQEqpOsiTBu1+7TuNpcn x5yW/XodnllbJ37khWgWrkRZFW2Cpd8n7dZbe81TwPVHTqFp0i7JV8vZpUT6cIjWsvSs B48w== 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 i17-v6si1087735qvj.89.2018.08.20.04.06.16; Mon, 20 Aug 2018 04:06:16 -0700 (PDT) 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 E941668610; Mon, 20 Aug 2018 11:06:15 +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.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_LOW 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 AD3EB68612; Mon, 20 Aug 2018 11:01: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 7E9186864C; Mon, 20 Aug 2018 11:01:36 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id 7E18860AA8 for ; Mon, 20 Aug 2018 11:00:27 +0000 (UTC) Received: from mxback10o.mail.yandex.net (mxback10o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::24]) by forward102p.mail.yandex.net (Yandex) with ESMTP id B30DC4305B9E for ; Mon, 20 Aug 2018 14:00:16 +0300 (MSK) Received: from smtp1j.mail.yandex.net (smtp1j.mail.yandex.net [2a02:6b8:0:801::ab]) by mxback10o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id m6blzqkudM-0GG8fDxE; Mon, 20 Aug 2018 14:00:16 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id x8w3cLDY5J-0Ftib0Fj; Mon, 20 Aug 2018 14:00:16 +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, 20 Aug 2018 11:00:06 +0000 Message-Id: <1534762808-15588-10-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534762808-15588-1-git-send-email-odpbot@yandex.ru> References: <1534762808-15588-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 674 Subject: [lng-odp] [PATCH v3 9/11] linux-gen: pktio: loop: handle SCTP checksums 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: Dmitry Eremin-Solenikov Add code to emulate hardware SCTP checksumming support over loop device (as it is done for IPv4/TCP/UDP). Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 674 (lumag:sctp-checksum) ** https://github.com/Linaro/odp/pull/674 ** Patch: https://github.com/Linaro/odp/pull/674.patch ** Base sha: dc28824415ea510e3ef62e47f7640bf4a8420fde ** Merge commit sha: b482f9618a6edb2a2f2491ee5a7af757eab93b24 **/ platform/linux-generic/pktio/loop.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c index faaef3ab5..388a00494 100644 --- a/platform/linux-generic/pktio/loop.c +++ b/platform/linux-generic/pktio/loop.c @@ -235,7 +235,8 @@ static inline void loopback_fix_checksums(odp_packet_t pkt, uint8_t l4_proto; void *l3_hdr; uint32_t l3_len; - odp_bool_t ipv4_chksum_pkt, udp_chksum_pkt, tcp_chksum_pkt; + odp_bool_t ipv4_chksum_pkt, udp_chksum_pkt, tcp_chksum_pkt, + sctp_chksum_pkt; odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); l3_hdr = odp_packet_l3_ptr(pkt, &l3_len); @@ -259,6 +260,11 @@ static inline void loopback_fix_checksums(odp_packet_t pkt, l4_proto == _ODP_IPPROTO_TCP, pkt_hdr->p.flags.l4_chksum_set, pkt_hdr->p.flags.l4_chksum); + sctp_chksum_pkt = OL_TX_CHKSUM_PKT(pktout_cfg->bit.sctp_chksum, + pktout_capa->bit.sctp_chksum, + l4_proto == _ODP_IPPROTO_SCTP, + pkt_hdr->p.flags.l4_chksum_set, + pkt_hdr->p.flags.l4_chksum); if (ipv4_chksum_pkt) _odp_packet_ipv4_chksum_insert(pkt); @@ -268,6 +274,9 @@ static inline void loopback_fix_checksums(odp_packet_t pkt, if (udp_chksum_pkt) _odp_packet_udp_chksum_insert(pkt); + + if (sctp_chksum_pkt) + _odp_packet_sctp_chksum_insert(pkt); } static int loopback_send(pktio_entry_t *pktio_entry, int index ODP_UNUSED, @@ -375,9 +384,11 @@ static int loopback_init_capability(pktio_entry_t *pktio_entry) capa->config.pktin.bit.ipv4_chksum = 1; capa->config.pktin.bit.tcp_chksum = 1; capa->config.pktin.bit.udp_chksum = 1; + capa->config.pktin.bit.sctp_chksum = 1; capa->config.pktout.bit.ipv4_chksum = 1; capa->config.pktout.bit.tcp_chksum = 1; capa->config.pktout.bit.udp_chksum = 1; + capa->config.pktout.bit.sctp_chksum = 1; capa->config.inbound_ipsec = 1; capa->config.outbound_ipsec = 1; @@ -387,6 +398,8 @@ static int loopback_init_capability(pktio_entry_t *pktio_entry) capa->config.pktout.bit.udp_chksum; capa->config.pktout.bit.tcp_chksum_ena = capa->config.pktout.bit.tcp_chksum; + capa->config.pktout.bit.sctp_chksum_ena = + capa->config.pktout.bit.sctp_chksum; return 0; }