From patchwork Fri Feb 13 07:31:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balasubramanian Manoharan X-Patchwork-Id: 44672 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D0BC721527 for ; Fri, 13 Feb 2015 07:32:23 +0000 (UTC) Received: by mail-lb0-f197.google.com with SMTP id w7sf9586851lbi.0 for ; Thu, 12 Feb 2015 23:32:22 -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=8iWLwrh63TRhil5m6E7DyUxH0SazX++Fgg/x/mUeZhU=; b=DlCuaCX1WwBViMMLVKEC+YXIEOhS1Yz7LpA+6eqJMXxsM+q4vwfYEZxVDubDe/lhRU bk58l/SJpEW2F/FEyMutjOXJkf5NL6p8p0JzPDPzOcS3lmMenocYOw+oYh+HhgCbC8EV PiFaAvSpPGASzoAu+zMpZgBIqku5M1Sdk7bxFzVtZdzyxHqj0M7kOmHd7Gz171uuX/I3 2I+lwkKlwKlp9UrUN3Jsujdd3MP8idw4CSFEtyBbn0C6u3KVDSEBMNa4yZZdfRfkRbGw XDmXLJqhdd+WEoF7G2sD0DhD4/0KrY6QcEYlUA/ReeZFYr88L5jMwlwMfTMZ6gp4KAzw CLPg== X-Gm-Message-State: ALoCoQlQEqTInPHtINcxe2ge6+YZdlC7XCucPiBoEoqQU87i3WGW8u0o6hh+7TdDeXKLNklX7cvu X-Received: by 10.112.171.37 with SMTP id ar5mr1135199lbc.16.1423812742778; Thu, 12 Feb 2015 23:32:22 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.26.74 with SMTP id j10ls296357lag.7.gmail; Thu, 12 Feb 2015 23:32:22 -0800 (PST) X-Received: by 10.112.135.196 with SMTP id pu4mr6553866lbb.41.1423812742634; Thu, 12 Feb 2015 23:32:22 -0800 (PST) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com. [209.85.217.171]) by mx.google.com with ESMTPS id nv4si969830lbb.16.2015.02.12.23.32.22 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Feb 2015 23:32:22 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by mail-lb0-f171.google.com with SMTP id b6so13893001lbj.2 for ; Thu, 12 Feb 2015 23:32:22 -0800 (PST) X-Received: by 10.152.26.199 with SMTP id n7mr6586242lag.29.1423812742208; Thu, 12 Feb 2015 23:32:22 -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 h5csp903786lbj; Thu, 12 Feb 2015 23:32:21 -0800 (PST) X-Received: by 10.140.81.74 with SMTP id e68mr19715302qgd.41.1423812741118; Thu, 12 Feb 2015 23:32:21 -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 y34si1998838qgy.28.2015.02.12.23.32.19 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 12 Feb 2015 23:32:21 -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 1YMAjZ-0006be-2K; Fri, 13 Feb 2015 07:32:17 +0000 Received: from mail-pa0-f50.google.com ([209.85.220.50]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YMAjT-0006Za-FH for lng-odp@lists.linaro.org; Fri, 13 Feb 2015 07:32:11 +0000 Received: by mail-pa0-f50.google.com with SMTP id hz1so17114166pad.9 for ; Thu, 12 Feb 2015 23:32:05 -0800 (PST) X-Received: by 10.68.96.194 with SMTP id du2mr12803733pbb.107.1423812725774; Thu, 12 Feb 2015 23:32:05 -0800 (PST) Received: from manoharan-Vostro-2520.solutionip.com ([210.177.145.245]) by mx.google.com with ESMTPSA id i5sm5799570pat.42.2015.02.12.23.32.04 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 12 Feb 2015 23:32:05 -0800 (PST) From: bala.manoharan@linaro.org To: lng-odp@lists.linaro.org Date: Fri, 13 Feb 2015 15:31:56 +0800 Message-Id: <1423812716-3148-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 v1] 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.217.171 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. Signed-off-by: Balasubramanian Manoharan --- 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 45822d3..a47ad1f 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 */ @@ -403,6 +403,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); @@ -418,6 +421,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); @@ -728,6 +733,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);