From patchwork Mon Feb 23 04:50:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balasubramanian Manoharan X-Patchwork-Id: 44888 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2989921562 for ; Mon, 23 Feb 2015 04:51:01 +0000 (UTC) Received: by mail-wi0-f198.google.com with SMTP id h11sf8181633wiw.1 for ; Sun, 22 Feb 2015 20:51:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:subject :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=/z3/dneGvdD5wOSkI3cggj/UxiHOIZ2D4EoI0qqQAJI=; b=JLn+xmAxmP1vywrj3Twu+qPCJRNZYEKulJXJX0q65ZZbht2KpKOk9mrBIgSCtxkvM/ /YLJr9RSHQtJ2q1WkceeZatDsNWSsrXbbbwgu56LefVb9mIzEpqH9lBAaUOhNJMl/5Rt DQUXb17/oNjsiykOKiUV5mGsPsTu/F/TOP3mRS7JeO2qA0jDEPB50u3PKN7ZAqsHDe3/ sSMm+qic69DSvOULyUtSoAbQQtkvOreIVFJ0BiS1GDuaeSAyJfNc9bhGqV69gXGquUlr cCz3PNtcg54IE/mzWyY7zjmawXGwQ1drRiTUdPURhrOxgTvDaBbv5srx4i+klxe1mNKX XUxQ== X-Gm-Message-State: ALoCoQlTimHnwJI2sGcxjP44O9KbL54p6JnUzAOQdaUt/6ZQUlcsqt6DQutTD4u9+d/9CLWmWJ75 X-Received: by 10.112.219.102 with SMTP id pn6mr365449lbc.12.1424667060308; Sun, 22 Feb 2015 20:51:00 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.4.71 with SMTP id i7ls456500lai.44.gmail; Sun, 22 Feb 2015 20:51:00 -0800 (PST) X-Received: by 10.112.170.100 with SMTP id al4mr8224152lbc.42.1424667060164; Sun, 22 Feb 2015 20:51:00 -0800 (PST) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPS id a3si25147415lae.58.2015.02.22.20.50.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 22 Feb 2015 20:50:59 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by labgf13 with SMTP id gf13so16130009lab.9 for ; Sun, 22 Feb 2015 20:50:59 -0800 (PST) X-Received: by 10.112.135.196 with SMTP id pu4mr7961396lbb.41.1424667059536; Sun, 22 Feb 2015 20:50:59 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp1035071lbj; Sun, 22 Feb 2015 20:50:58 -0800 (PST) X-Received: by 10.229.191.3 with SMTP id dk3mr21596770qcb.30.1424667058175; Sun, 22 Feb 2015 20:50:58 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id b90si35005764qgb.50.2015.02.22.20.50.56 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 22 Feb 2015 20:50:58 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YPkyq-0005gX-Qy; Mon, 23 Feb 2015 04:50:52 +0000 Received: from mail-pa0-f41.google.com ([209.85.220.41]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YPkyl-0005gS-JU for lng-odp@lists.linaro.org; Mon, 23 Feb 2015 04:50:47 +0000 Received: by padhz1 with SMTP id hz1so24499625pad.9 for ; Sun, 22 Feb 2015 20:50:42 -0800 (PST) X-Received: by 10.70.45.165 with SMTP id o5mr15913547pdm.152.1424667042155; Sun, 22 Feb 2015 20:50:42 -0800 (PST) Received: from manoharan-Vostro-2520.domain.name ([117.199.142.236]) by mx.google.com with ESMTPSA id v2sm34086278pdm.77.2015.02.22.20.50.40 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 22 Feb 2015 20:50:41 -0800 (PST) From: bala.manoharan@linaro.org To: lng-odp@lists.linaro.org Date: Mon, 23 Feb 2015 10:20:31 +0530 Message-Id: <1424667031-11687-1-git-send-email-bala.manoharan@linaro.org> X-Mailer: git-send-email 2.0.1.472.g6f92e5f X-Topics: Classification patch Subject: [lng-odp] [PATCH v2] validation: classification: fix incorrect ipv4 checksum update X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: bala.manoharan@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Balasubramanian Manoharan Fixes an issue where ipv4 checksum field was not updated after modifying the src addr of the packet. https://bugs.linaro.org/show_bug.cgi?id=1231 Signed-off-by: Balasubramanian Manoharan Reviewed-by: Mike Holmes --- v2: updates review comments from Mike test/validation/classification/odp_classification_tests.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/validation/classification/odp_classification_tests.c b/test/validation/classification/odp_classification_tests.c index 564455c..3688dd0 100644 --- a/test/validation/classification/odp_classification_tests.c +++ b/test/validation/classification/odp_classification_tests.c @@ -221,7 +221,7 @@ odp_packet_t create_packet(bool vlan) seqno = odp_atomic_fetch_inc_u32(&seq); ip->id = odp_cpu_to_be_16(seqno); ip->chksum = 0; - odph_ipv4_csum_update(pkt); + ip->chksum = odp_cpu_to_be_16(odph_ipv4_csum_update(pkt)); offset += ODPH_IPV4HDR_LEN; /* udp */ @@ -404,6 +404,9 @@ void test_cls_pmr_chain(void) ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL); parse_ipv4_string(CLS_PMR_CHAIN_SADDR, &addr, &mask); ip->src_addr = odp_cpu_to_be_32(addr); + ip->chksum = 0; + ip->chksum = odp_cpu_to_be_16(odph_ipv4_csum_update(pkt)); + udp = (odph_udphdr_t *)odp_packet_l4_ptr(pkt, NULL); udp->src_port = odp_cpu_to_be_16(CLS_PMR_CHAIN_SPORT); @@ -419,6 +422,8 @@ void test_cls_pmr_chain(void) ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL); parse_ipv4_string(CLS_PMR_CHAIN_SADDR, &addr, &mask); ip->src_addr = odp_cpu_to_be_32(addr); + ip->chksum = 0; + ip->chksum = odp_cpu_to_be_16(odph_ipv4_csum_update(pkt)); enqueue_loop_interface(pkt); pkt = receive_packet(&queue, ODP_TIME_SEC); @@ -729,6 +734,9 @@ void test_pktio_pmr_match_set_cos(void) ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL); parse_ipv4_string(CLS_PMR_SET_SADDR, &addr, &mask); ip->src_addr = odp_cpu_to_be_32(addr); + ip->chksum = 0; + ip->chksum = odp_cpu_to_be_16(odph_ipv4_csum_update(pkt)); + udp = (odph_udphdr_t *)odp_packet_l4_ptr(pkt, NULL); udp->src_port = odp_cpu_to_be_16(CLS_PMR_SET_SPORT); enqueue_loop_interface(pkt);