From patchwork Tue Jul 14 21:18:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 51112 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8C5F822A24 for ; Tue, 14 Jul 2015 21:19:10 +0000 (UTC) Received: by lbvb1 with SMTP id b1sf5774640lbv.3 for ; Tue, 14 Jul 2015 14:19:09 -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:cc: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=mZI6WA9G9eb+9y65ZwYUYfbVZQFeDzpUQgjO47XPAMc=; b=Kxlul1teFCmNA7lpZc72Azm6KDCt/0c/YI392lgTyufAcLwtAdogUes/sOkXRmGT8X RcoD0qXXgJBpGotsAaTQx09NQdifbOvMLB+/k7rhvjxBD32Nn1L/0BMTsiM/q1oTBvGW V1J4102Pu+Kqi2qVXPFN6iqCYvqjV/56ct1ZSYxnRy2Dtu2/Se6dmLdX76u1OuXRPrEy WPrOwNKVK5UEdgr5aRcp0+R/H9EMO2Ow1BKNek0RyIyjGKV8OoluJxuMItzQqj/AFVTF Sul4deRA2utI3acahyEh1jmt7pWzbZi28R0Gx4XV+SO3zRP3DWUaD88W6GasgHtOO9cF qHtg== X-Gm-Message-State: ALoCoQk2okuqm4Dd2QywHZB2XxVGq5yf+Zqnq18WsdwrhsBacZTypQqb4dZ5Jv2Fb0Cm0tuK9f8U X-Received: by 10.180.182.49 with SMTP id eb17mr11107398wic.2.1436908749487; Tue, 14 Jul 2015 14:19:09 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.234.108 with SMTP id ud12ls111370lac.43.gmail; Tue, 14 Jul 2015 14:19:09 -0700 (PDT) X-Received: by 10.112.129.131 with SMTP id nw3mr674638lbb.34.1436908749180; Tue, 14 Jul 2015 14:19:09 -0700 (PDT) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id ev1si2072559lbc.0.2015.07.14.14.19.09 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Jul 2015 14:19:09 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by lahh5 with SMTP id h5so13497806lah.2 for ; Tue, 14 Jul 2015 14:19:09 -0700 (PDT) X-Received: by 10.112.209.106 with SMTP id ml10mr618717lbc.112.1436908749027; Tue, 14 Jul 2015 14:19:09 -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.108.230 with SMTP id hn6csp2653945lbb; Tue, 14 Jul 2015 14:19:08 -0700 (PDT) X-Received: by 10.55.24.219 with SMTP id 88mr1481042qky.54.1436908747843; Tue, 14 Jul 2015 14:19:07 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id b4si2706933qkb.125.2015.07.14.14.19.06; Tue, 14 Jul 2015 14:19:07 -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 BC15B61F1C; Tue, 14 Jul 2015 21:19:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal 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 ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 4F18461ED7; Tue, 14 Jul 2015 21:19:02 +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 0CC0061F17; Tue, 14 Jul 2015 21:19:00 +0000 (UTC) Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com [209.85.212.181]) by lists.linaro.org (Postfix) with ESMTPS id 2B3B361E41 for ; Tue, 14 Jul 2015 21:18:59 +0000 (UTC) Received: by wiga1 with SMTP id a1so110978139wig.0 for ; Tue, 14 Jul 2015 14:18:58 -0700 (PDT) X-Received: by 10.180.86.6 with SMTP id l6mr36627847wiz.91.1436908738424; Tue, 14 Jul 2015 14:18:58 -0700 (PDT) Received: from khorivan.synapse.com (41-172-94-178.pool.ukrtel.net. [178.94.172.41]) by smtp.gmail.com with ESMTPSA id ul1sm4176793wjc.30.2015.07.14.14.18.57 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 14 Jul 2015 14:18:57 -0700 (PDT) From: Ivan Khoronzhuk To: bala.manoharan@linaro.org Date: Wed, 15 Jul 2015 00:18:49 +0300 Message-Id: <1436908729-18958-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: Classification patch Cc: lng-odp@lists.linaro.org Subject: [lng-odp] [RFC] [Patch] validation: classification: improve pmr set check test 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: ivan.khoronzhuk@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.53 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 It's simple improvement is intended to open eyes on possible hidden issues when a packet can be lost (or sent to def CoS) while matching one of the rules of first PMR match set, but intendent to second PMR match set. To correctly check, the new dst CoS should be used, but for simplicity I used only one. It's not formated patch and is only for demonstration. Signed-off-by: Ivan Khoronzhuk --- .../classification/odp_classification_tests.c | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/test/validation/classification/odp_classification_tests.c b/test/validation/classification/odp_classification_tests.c index 6e8d152..b5daf32 100644 --- a/test/validation/classification/odp_classification_tests.c +++ b/test/validation/classification/odp_classification_tests.c @@ -41,7 +41,9 @@ #define TEST_PMR_SET 1 #define CLS_PMR_SET 5 #define CLS_PMR_SET_SADDR "10.0.0.6/32" +#define CLS_PMR_SET_DADDR "10.0.0.7/32" #define CLS_PMR_SET_SPORT 5000 +#define CLS_PMR_SET_SPORT2 5001 /* Config values for CoS L2 Priority */ #define TEST_L2_QOS 1 @@ -723,6 +725,7 @@ void configure_pktio_pmr_match_set_cos(void) odp_queue_param_t qparam; char cosname[ODP_COS_NAME_LEN]; char queuename[ODP_QUEUE_NAME_LEN]; + static odp_pmr_set_t pmr_set2; uint32_t addr = 0; uint32_t mask; @@ -743,6 +746,22 @@ void configure_pktio_pmr_match_set_cos(void) retval = odp_pmr_match_set_create(num_terms, pmr_terms, &pmr_set); CU_ASSERT(retval > 0); + parse_ipv4_string(CLS_PMR_SET_DADDR, &addr, &mask); + pmr_terms[0].term = ODP_PMR_DIP_ADDR; + pmr_terms[0].val = &addr; + pmr_terms[0].mask = &mask; + pmr_terms[0].val_sz = sizeof(addr); + + val = CLS_PMR_SET_SPORT2; + maskport = 0xffff; + pmr_terms[1].term = ODP_PMR_UDP_SPORT; + pmr_terms[1].val = &val; + pmr_terms[1].mask = &maskport; + pmr_terms[1].val_sz = sizeof(val); + + retval = odp_pmr_match_set_create(num_terms, pmr_terms, &pmr_set2); + CU_ASSERT(retval > 0); + sprintf(cosname, "cos_pmr_set"); cos_list[CLS_PMR_SET] = odp_cos_create(cosname); CU_ASSERT_FATAL(cos_list[CLS_PMR_SET] != ODP_COS_INVALID) @@ -764,6 +783,9 @@ void configure_pktio_pmr_match_set_cos(void) retval = odp_pktio_pmr_match_set_cos(pmr_set, pktio_loop, cos_list[CLS_PMR_SET]); CU_ASSERT(retval == 0); + retval = odp_pktio_pmr_match_set_cos(pmr_set2, pktio_loop, + cos_list[CLS_PMR_SET]); + CU_ASSERT(retval == 0); } void test_pktio_pmr_match_set_cos(void) @@ -781,6 +803,8 @@ 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); + parse_ipv4_string(CLS_PMR_SET_DADDR, &addr, &mask); + ip->dst_addr = odp_cpu_to_be_32(addr); ip->chksum = 0; ip->chksum = odp_cpu_to_be_16(odph_ipv4_csum_update(pkt)); @@ -791,6 +815,24 @@ void test_pktio_pmr_match_set_cos(void) CU_ASSERT(queue == queue_list[CLS_PMR_SET]); CU_ASSERT(seq == cls_pkt_get_seq(pkt)); odp_packet_free(pkt); + + pkt = create_packet(false); + seq = cls_pkt_get_seq(pkt); + 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); + parse_ipv4_string(CLS_PMR_SET_DADDR, &addr, &mask); + ip->dst_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_SPORT2); + enqueue_loop_interface(pkt); + pkt = receive_packet(&queue, ODP_TIME_SEC); + CU_ASSERT(queue == queue_list[CLS_PMR_SET]); + CU_ASSERT(seq == cls_pkt_get_seq(pkt)); + odp_packet_free(pkt); } static void classification_test_pmr_terms_avail(void)