From patchwork Wed Oct 21 05:14:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balasubramanian Manoharan X-Patchwork-Id: 55340 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 patches.linaro.org (Postfix) with ESMTPS id 0D67F22EA2 for ; Wed, 21 Oct 2015 05:15:52 +0000 (UTC) Received: by wiclg3 with SMTP id lg3sf16338645wic.3 for ; Tue, 20 Oct 2015 22:15:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:date :message-id:in-reply-to:references: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=urorMHe4SymzyWfHkwCHVANfOLSzehA1kJpyiGJS16Q=; b=lfFBgYfTQb8Dp2lj/7i4CfUEA9z3XmtGibwDZLzH8j6/smysHlzDRA7FtHObTbrLbH ejPoYYiJkrxRGca36gzQB5OyuGTE0PyttFEMPlx4bSiWEUd44YbtUKDpF/ai69LuclAJ GB9jQvjferUNeIn7waZizr84ocTcAI7cTb6EbFzjylYH6qVB3LyGbPE1N6BGkIaPNyuO Mqa+G6fGaSP1C1Gcc47YOn8CguWep/zGAXMViYVNYnwaNSYC6i7VWXsXugTXagbyIo6s zUc+J8NcWNyHV0sRXJDG1YKmx0qca70BxiuS9ynidyv396FVyejL3kc/cnxef3/tIWWJ skCA== X-Gm-Message-State: ALoCoQlL6FDksk04ydxXujucJAOTnOGe+DgzjacU7GuzUU4/mHMJ3cjlr6lvw0131ULutnYw4gzX X-Received: by 10.112.198.33 with SMTP id iz1mr1582087lbc.8.1445404551313; Tue, 20 Oct 2015 22:15:51 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.89.207 with SMTP id n198ls143921lfb.54.gmail; Tue, 20 Oct 2015 22:15:51 -0700 (PDT) X-Received: by 10.112.147.232 with SMTP id tn8mr3908157lbb.84.1445404551174; Tue, 20 Oct 2015 22:15:51 -0700 (PDT) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id l6si5029154lbs.117.2015.10.20.22.15.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Oct 2015 22:15:51 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by lbcao8 with SMTP id ao8so30028716lbc.3 for ; Tue, 20 Oct 2015 22:15:51 -0700 (PDT) X-Received: by 10.112.146.104 with SMTP id tb8mr4066279lbb.35.1445404551023; Tue, 20 Oct 2015 22:15:51 -0700 (PDT) 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.59.35 with SMTP id w3csp2467204lbq; Tue, 20 Oct 2015 22:15:50 -0700 (PDT) X-Received: by 10.140.99.49 with SMTP id p46mr8465711qge.76.1445404550256; Tue, 20 Oct 2015 22:15:50 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id g74si6460077qhc.67.2015.10.20.22.15.49; Tue, 20 Oct 2015 22:15:50 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Received: by lists.linaro.org (Postfix, from userid 109) id DEC9361FD0; Wed, 21 Oct 2015 05:15:49 +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=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED 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 6FAE461FEB; Wed, 21 Oct 2015 05:15:21 +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 1083961FEA; Wed, 21 Oct 2015 05:15:16 +0000 (UTC) Received: from mail-pa0-f45.google.com (mail-pa0-f45.google.com [209.85.220.45]) by lists.linaro.org (Postfix) with ESMTPS id 15E7161FE2 for ; Wed, 21 Oct 2015 05:15:10 +0000 (UTC) Received: by pabrc13 with SMTP id rc13so43356972pab.0 for ; Tue, 20 Oct 2015 22:15:09 -0700 (PDT) X-Received: by 10.68.200.167 with SMTP id jt7mr8235279pbc.83.1445404509251; Tue, 20 Oct 2015 22:15:09 -0700 (PDT) Received: from localhost.localdomain ([122.166.219.57]) by smtp.gmail.com with ESMTPSA id dd4sm6749251pbb.52.2015.10.20.22.15.07 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Oct 2015 22:15:08 -0700 (PDT) From: Balasubramanian Manoharan To: lng-odp@lists.linaro.org Date: Wed, 21 Oct 2015 10:44:53 +0530 Message-Id: <1445404495-14144-2-git-send-email-bala.manoharan@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1445404495-14144-1-git-send-email-bala.manoharan@linaro.org> References: <1445404495-14144-1-git-send-email-bala.manoharan@linaro.org> X-Topics: Classification patch Subject: [lng-odp] [API-NEXT/PATCHv1 2/4] validation: classification: use tcp data offset field to calculate data offset X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 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" 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.176 as permitted sender) smtp.mailfrom=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 TCP data offset field is used to calculate the data offset for accessing the sequence number field in the packet. Signed-off-by: Balasubramanian Manoharan Reviewed-by: Ivan Khoronzhuk --- test/validation/classification/odp_classification_common.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/test/validation/classification/odp_classification_common.c b/test/validation/classification/odp_classification_common.c index 9966d5f..ba3ade4 100644 --- a/test/validation/classification/odp_classification_common.c +++ b/test/validation/classification/odp_classification_common.c @@ -50,6 +50,7 @@ int cls_pkt_set_seq(odp_packet_t pkt) cls_test_packet_t data; uint32_t offset; odph_ipv4hdr_t *ip; + odph_tcphdr_t *tcp; int status; data.magic = DATA_MAGIC; @@ -62,9 +63,11 @@ int cls_pkt_set_seq(odp_packet_t pkt) if (ip->proto == ODPH_IPPROTO_UDP) status = odp_packet_copydata_in(pkt, offset + ODPH_UDPHDR_LEN, sizeof(data), &data); - else - status = odp_packet_copydata_in(pkt, offset + ODPH_TCPHDR_LEN, + else { + tcp = (odph_tcphdr_t *)odp_packet_l4_ptr(pkt, NULL); + status = odp_packet_copydata_in(pkt, offset + tcp->hl * 4, sizeof(data), &data); + } return status; } @@ -74,6 +77,7 @@ uint32_t cls_pkt_get_seq(odp_packet_t pkt) uint32_t offset; cls_test_packet_t data; odph_ipv4hdr_t *ip; + odph_tcphdr_t *tcp; ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL); offset = odp_packet_l4_offset(pkt); @@ -84,9 +88,11 @@ uint32_t cls_pkt_get_seq(odp_packet_t pkt) if (ip->proto == ODPH_IPPROTO_UDP) odp_packet_copydata_out(pkt, offset + ODPH_UDPHDR_LEN, sizeof(data), &data); - else - odp_packet_copydata_out(pkt, offset + ODPH_TCPHDR_LEN, + else { + tcp = (odph_tcphdr_t *)odp_packet_l4_ptr(pkt, NULL); + odp_packet_copydata_out(pkt, offset + tcp->hl * 4, sizeof(data), &data); + } if (data.magic == DATA_MAGIC) return data.seq;