From patchwork Fri Jan 15 17:28:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 59877 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp683036lbb; Fri, 15 Jan 2016 09:30:19 -0800 (PST) X-Received: by 10.140.25.169 with SMTP id 38mr14684777qgt.73.1452879019065; Fri, 15 Jan 2016 09:30:19 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id c18si14257727qkb.8.2016.01.15.09.30.18; Fri, 15 Jan 2016 09:30:19 -0800 (PST) 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; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 989AB6195C; Fri, 15 Jan 2016 17:30:18 +0000 (UTC) Authentication-Results: lists.linaro.org; dkim=fail reason="verification failed; unprotected key" header.d=linaro.org header.i=@linaro.org header.b=Xg+5//RL; dkim-adsp=none (unprotected policy); dkim-atps=neutral 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.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID, 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 6837A61953; Fri, 15 Jan 2016 17:28:54 +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 B13DB61966; Fri, 15 Jan 2016 17:28:47 +0000 (UTC) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com [209.85.217.170]) by lists.linaro.org (Postfix) with ESMTPS id 7333C61953 for ; Fri, 15 Jan 2016 17:28:19 +0000 (UTC) Received: by mail-lb0-f170.google.com with SMTP id bc4so317683250lbc.2 for ; Fri, 15 Jan 2016 09:28:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2RL7KqYcgEcLO82Rzz1hgWuj/6x//82uC2OBH1TSimE=; b=Xg+5//RLMei0wjp3xHT5Ihd7DrmgvYlRHbvba5MQgR5FuraiUxjIfi5OMo7wkCNiHr jkC8Ts8M6Qw3O1LH+BoLabqQ/Vf/KkJeVBkBg+0AjEdCEOSGZpVvlai6GvcrGL7WMwwr wMnSCvnL098Z7mOaODuDzY8fbHB65qS6Uzr3s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2RL7KqYcgEcLO82Rzz1hgWuj/6x//82uC2OBH1TSimE=; b=TqB7ZWaAx57x28u905cdvgubPG04QixsC18M02rxlNH1OYdhOt8hSyYjUP3AQ7T5bo dhk/rffYKK9Kp+eqqmF3ckq3rHXtuYwTjcTvzfe4QGrorNthiIcaLjreesqOnijLPljs h14kzLqpJltjng09FpDLTw6ny4722lAEX2Vl4mRYJa93H4GivNiuWkSfmIqNV565AV8v rMPRk9uYBGVQlEIGC6FDrzkwCTE2Mu1vO8g3m8tg9EAGQkJUjMNNeYIGBof3oEQHt5ly NTfqQCS6lx4kre893IrqmyvCVCvX2wsp2Bg/zxfV0lM9INorcODtXd09PSMHgHdxM9vd EE3g== X-Gm-Message-State: ALoCoQk4Kn0ti6DUeJo0YOD67jOdfm8oP0PxgcdrQi1CL1LfeSWlU2kscEzpi6jbWg4Jl5pWrU9MwKgQTr2qJHskvFR1zarl0Q== X-Received: by 10.112.134.165 with SMTP id pl5mr3849014lbb.126.1452878898238; Fri, 15 Jan 2016 09:28:18 -0800 (PST) Received: from localhost.localdomain ([195.238.92.128]) by smtp.gmail.com with ESMTPSA id h187sm1495139lfg.18.2016.01.15.09.28.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 15 Jan 2016 09:28:17 -0800 (PST) From: Ivan Khoronzhuk To: lng-odp@lists.linaro.org Date: Fri, 15 Jan 2016 19:28:05 +0200 Message-Id: <1452878885-8508-4-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1452878885-8508-1-git-send-email-ivan.khoronzhuk@linaro.org> References: <1452878885-8508-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH v2 3/3] validation: cls: use correct MAC addresses 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: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" If pktio is in not promisc mode, a packet should contain correct MAC address. Signed-off-by: Ivan Khoronzhuk --- .../classification/odp_classification_test_pmr.c | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/test/validation/classification/odp_classification_test_pmr.c b/test/validation/classification/odp_classification_test_pmr.c index 25960c9..9e6a9e2 100644 --- a/test/validation/classification/odp_classification_test_pmr.c +++ b/test/validation/classification/odp_classification_test_pmr.c @@ -156,6 +156,7 @@ void classification_test_pmr_term_tcp_dport(void) odp_pool_t pool; odp_pool_t pool_recv; odp_pmr_match_t match; + odph_ethhdr_t *eth; val = CLS_DEFAULT_DPORT; mask = 0xffff; @@ -200,6 +201,9 @@ void classification_test_pmr_term_tcp_dport(void) CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); seqno = cls_pkt_get_seq(pkt); CU_ASSERT(seqno != TEST_SEQ_INVALID); + eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL); + odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN); + odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN); tcp = (odph_tcphdr_t *)odp_packet_l4_ptr(pkt, NULL); tcp->dst_port = odp_cpu_to_be_16(CLS_DEFAULT_DPORT); @@ -220,6 +224,9 @@ void classification_test_pmr_term_tcp_dport(void) CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); seqno = cls_pkt_get_seq(pkt); CU_ASSERT(seqno != TEST_SEQ_INVALID); + eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL); + odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN); + odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN); tcp = (odph_tcphdr_t *)odp_packet_l4_ptr(pkt, NULL); tcp->dst_port = odp_cpu_to_be_16(CLS_DEFAULT_DPORT + 1); @@ -266,6 +273,7 @@ void classification_test_pmr_term_tcp_sport(void) char cosname[ODP_COS_NAME_LEN]; odp_cls_cos_param_t cls_param; odp_pmr_match_t match; + odph_ethhdr_t *eth; val = CLS_DEFAULT_SPORT; mask = 0xffff; @@ -309,6 +317,9 @@ void classification_test_pmr_term_tcp_sport(void) CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); seqno = cls_pkt_get_seq(pkt); CU_ASSERT(seqno != TEST_SEQ_INVALID); + eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL); + odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN); + odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN); tcp = (odph_tcphdr_t *)odp_packet_l4_ptr(pkt, NULL); tcp->src_port = odp_cpu_to_be_16(CLS_DEFAULT_SPORT); @@ -327,6 +338,9 @@ void classification_test_pmr_term_tcp_sport(void) CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); seqno = cls_pkt_get_seq(pkt); CU_ASSERT(seqno != TEST_SEQ_INVALID); + eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL); + odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN); + odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN); tcp = (odph_tcphdr_t *)odp_packet_l4_ptr(pkt, NULL); tcp->src_port = odp_cpu_to_be_16(CLS_DEFAULT_SPORT + 1); @@ -373,6 +387,7 @@ void classification_test_pmr_term_udp_dport(void) char cosname[ODP_COS_NAME_LEN]; odp_pmr_match_t match; odp_cls_cos_param_t cls_param; + odph_ethhdr_t *eth; val = CLS_DEFAULT_DPORT; mask = 0xffff; @@ -416,6 +431,9 @@ void classification_test_pmr_term_udp_dport(void) CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); seqno = cls_pkt_get_seq(pkt); CU_ASSERT(seqno != TEST_SEQ_INVALID); + eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL); + odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN); + odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN); udp = (odph_udphdr_t *)odp_packet_l4_ptr(pkt, NULL); udp->dst_port = odp_cpu_to_be_16(CLS_DEFAULT_DPORT); @@ -435,6 +453,9 @@ void classification_test_pmr_term_udp_dport(void) CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); seqno = cls_pkt_get_seq(pkt); CU_ASSERT(seqno != TEST_SEQ_INVALID); + eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL); + odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN); + odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN); udp = (odph_udphdr_t *)odp_packet_l4_ptr(pkt, NULL); udp->dst_port = odp_cpu_to_be_16(CLS_DEFAULT_DPORT + 1); @@ -481,6 +502,7 @@ void classification_test_pmr_term_udp_sport(void) char cosname[ODP_COS_NAME_LEN]; odp_pmr_match_t match; odp_cls_cos_param_t cls_param; + odph_ethhdr_t *eth; val = CLS_DEFAULT_SPORT; mask = 0xffff; @@ -524,6 +546,9 @@ void classification_test_pmr_term_udp_sport(void) CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); seqno = cls_pkt_get_seq(pkt); CU_ASSERT(seqno != TEST_SEQ_INVALID); + eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL); + odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN); + odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN); udp = (odph_udphdr_t *)odp_packet_l4_ptr(pkt, NULL); udp->src_port = odp_cpu_to_be_16(CLS_DEFAULT_SPORT); @@ -542,6 +567,9 @@ void classification_test_pmr_term_udp_sport(void) CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); seqno = cls_pkt_get_seq(pkt); CU_ASSERT(seqno != TEST_SEQ_INVALID); + eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL); + odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN); + odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN); udp = (odph_udphdr_t *)odp_packet_l4_ptr(pkt, NULL); udp->src_port = odp_cpu_to_be_16(CLS_DEFAULT_SPORT + 1); @@ -587,6 +615,7 @@ void classification_test_pmr_term_ipproto(void) char cosname[ODP_COS_NAME_LEN]; odp_cls_cos_param_t cls_param; odp_pmr_match_t match; + odph_ethhdr_t *eth; val = ODPH_IPPROTO_UDP; mask = 0xff; @@ -630,6 +659,9 @@ void classification_test_pmr_term_ipproto(void) CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); seqno = cls_pkt_get_seq(pkt); CU_ASSERT(seqno != TEST_SEQ_INVALID); + eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL); + odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN); + odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN); enqueue_pktio_interface(pkt, pktio); @@ -646,6 +678,9 @@ void classification_test_pmr_term_ipproto(void) CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); seqno = cls_pkt_get_seq(pkt); CU_ASSERT(seqno != TEST_SEQ_INVALID); + eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL); + odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN); + odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN); enqueue_pktio_interface(pkt, pktio); @@ -792,6 +827,7 @@ void classification_test_pmr_term_packet_len(void) char cosname[ODP_COS_NAME_LEN]; odp_cls_cos_param_t cls_param; odp_pmr_match_t match; + odph_ethhdr_t *eth; val = 1024; /*Mask value will match any packet of length 1000 - 1099*/ @@ -837,6 +873,9 @@ void classification_test_pmr_term_packet_len(void) CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); seqno = cls_pkt_get_seq(pkt); CU_ASSERT(seqno != TEST_SEQ_INVALID); + eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL); + odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN); + odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN); enqueue_pktio_interface(pkt, pktio); @@ -853,6 +892,9 @@ void classification_test_pmr_term_packet_len(void) CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); seqno = cls_pkt_get_seq(pkt); CU_ASSERT(seqno != TEST_SEQ_INVALID); + eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL); + odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN); + odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN); enqueue_pktio_interface(pkt, pktio); @@ -896,6 +938,7 @@ static void classification_test_pmr_pool_set(void) char cosname[ODP_COS_NAME_LEN]; odp_cls_cos_param_t cls_param; odp_pmr_match_t match; + odph_ethhdr_t *eth; val = ODPH_IPPROTO_UDP; mask = 0xff; @@ -946,6 +989,9 @@ static void classification_test_pmr_pool_set(void) CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); seqno = cls_pkt_get_seq(pkt); CU_ASSERT(seqno != TEST_SEQ_INVALID); + eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL); + odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN); + odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN); enqueue_pktio_interface(pkt, pktio); @@ -990,6 +1036,7 @@ static void classification_test_pmr_queue_set(void) char cosname[ODP_COS_NAME_LEN]; odp_cls_cos_param_t cls_param; odp_pmr_match_t match; + odph_ethhdr_t *eth; val = ODPH_IPPROTO_UDP; mask = 0xff; @@ -1040,6 +1087,9 @@ static void classification_test_pmr_queue_set(void) CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); seqno = cls_pkt_get_seq(pkt); CU_ASSERT(seqno != TEST_SEQ_INVALID); + eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL); + odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN); + odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN); enqueue_pktio_interface(pkt, pktio); @@ -1084,6 +1134,7 @@ static void classification_test_pmr_term_daddr(void) odp_cls_cos_param_t cls_param; odph_ipv4hdr_t *ip; const char *dst_addr = "10.0.0.99/32"; + odph_ethhdr_t *eth; pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); @@ -1122,6 +1173,9 @@ static void classification_test_pmr_term_daddr(void) /* packet with dst ip address matching PMR rule to be received in the CoS queue*/ pkt = create_packet(pkt_pool, false, &seq, false); + eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL); + odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN); + odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN); ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL); ip->dst_addr = odp_cpu_to_be_32(addr); ip->chksum = odph_ipv4_csum_update(pkt); @@ -1141,6 +1195,9 @@ static void classification_test_pmr_term_daddr(void) pkt = create_packet(pkt_pool, false, &seq, false); seqno = cls_pkt_get_seq(pkt); CU_ASSERT(seqno != TEST_SEQ_INVALID); + eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL); + odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN); + odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN); enqueue_pktio_interface(pkt, pktio);