From patchwork Tue Feb 13 14:00:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 128238 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp4283081ljc; Tue, 13 Feb 2018 06:02:25 -0800 (PST) X-Google-Smtp-Source: AH8x224Dy9flWUCmcF44RUqMXWrNL6GEeuclzZhoaDmfRY30OtJD6zstOOakK7Zm1kPaPyDlZoFl X-Received: by 10.200.35.188 with SMTP id q57mr1952206qtq.73.1518530545169; Tue, 13 Feb 2018 06:02:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518530545; cv=none; d=google.com; s=arc-20160816; b=l7vgkScu73e4wpgj1OfgkatBdUxGYbPARDokYALS/jsiR3FzTPFri+/PMec2n8GkfZ FqGT5vQus/+16gsrxNnP0L/seghAW7OMiuQkhTPyTMOUfA59tTuossOl0n3lv8nOPEZE zYZz5HJvxGSjfS5ZG0WYbV/0bEN0TUKvWYIIy5EdPtbsppEPoA132JBfS4o6v8yE8v5y QDws9vMTQJwLjJJL1r3JYJ503Rlx/nbzUJEQt8YRlRYZs8DXvhLEJT0303VtkqKRRC2L QXbabpsZUPFhWxLIrKP8CWhkzhZF/9+B8At3fPOcA1pqdbSJwZ3GTgSuhX28Bt24gYb0 Zpsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=YJ3UPXmlWO9msyHgfgGEuo+GvAtMg2U2KGIvpOkRvoM=; b=Psodq3Xk7/Bd13c4LV3bXvF8dAypV1RArZ73CPnGpOqGRyQGz7WCnWlE10CQ0zHPQJ eUOUZvjgAJ0hxewPDDITh50qtc2U6o6KdQkqTnQOWY40teZM+CIrXp4ixgVVoOUBCGEn bCcDhaIXfv96TGC4U+xraNQJMW2mGMtODR5u86FLNFiBtLolFv0ZubAEZ6sKyetkySoO n7r/WFPSfbmyMhjqVk3ifsrwjON+kLppaZ72TSGM7SsQSBe2hw9qRB1YgY59qO1cC5fq hA3g5CSvPFclgnObtXGjNRlGeOMukrs8PJ0IiPtghVZ+hzA4vJD7r1xAarwMIPF+UaxI RgVw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id u40si1792466qth.23.2018.02.13.06.02.24; Tue, 13 Feb 2018 06:02:25 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id A70E861758; Tue, 13 Feb 2018 14:02:24 +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,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 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 302CA60C5D; Tue, 13 Feb 2018 14:00:35 +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 B62E1608F8; Tue, 13 Feb 2018 14:00:23 +0000 (UTC) Received: from forward101o.mail.yandex.net (forward101o.mail.yandex.net [37.140.190.181]) by lists.linaro.org (Postfix) with ESMTPS id C6E0A61511 for ; Tue, 13 Feb 2018 14:00:14 +0000 (UTC) Received: from mxback14g.mail.yandex.net (mxback14g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:93]) by forward101o.mail.yandex.net (Yandex) with ESMTP id 3E6F31343090 for ; Tue, 13 Feb 2018 17:00:13 +0300 (MSK) Received: from smtp1o.mail.yandex.net (smtp1o.mail.yandex.net [2a02:6b8:0:1a2d::25]) by mxback14g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id Ia8tPvDi9l-0DE8q8de; Tue, 13 Feb 2018 17:00:13 +0300 Received: by smtp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 6Ss5leStGE-0CFucFSL; Tue, 13 Feb 2018 17:00:12 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Tue, 13 Feb 2018 17:00:04 +0300 Message-Id: <1518530410-18574-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518530410-18574-1-git-send-email-odpbot@yandex.ru> References: <1518530410-18574-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 472 Subject: [lng-odp] [PATCH v2 1/7] validation: common: remove camel case names 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: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen Rename struct fields to not use camel case names. Signed-off-by: Petri Savolainen --- /** Email created from pull request 472 (psavol:master-parser-validation) ** https://github.com/Linaro/odp/pull/472 ** Patch: https://github.com/Linaro/odp/pull/472.patch ** Base sha: 41b3fa2cd994a7ef68290a07dcde5564e4640847 ** Merge commit sha: 38d924655e8119f902e986011a477e1ad9094ab6 **/ test/common/odp_cunit_common.c | 52 +++++++++++----------- test/common/odp_cunit_common.h | 12 ++--- .../validation/api/classification/classification.c | 20 ++++----- test/validation/api/crypto/odp_crypto_test_inp.c | 4 +- test/validation/api/ipsec/ipsec.c | 4 +- test/validation/api/packet/packet.c | 8 ++-- test/validation/api/pool/pool.c | 4 +- 7 files changed, 52 insertions(+), 52 deletions(-) diff --git a/test/common/odp_cunit_common.c b/test/common/odp_cunit_common.c index 6e51388f5..d8a17a75e 100644 --- a/test/common/odp_cunit_common.c +++ b/test/common/odp_cunit_common.c @@ -126,8 +126,8 @@ static odp_suiteinfo_t *cunit_get_suite_info(const char *suite_name) { odp_suiteinfo_t *sinfo; - for (sinfo = global_testsuites; sinfo->pName; sinfo++) - if (strcmp(sinfo->pName, suite_name) == 0) + for (sinfo = global_testsuites; sinfo->name; sinfo++) + if (strcmp(sinfo->name, suite_name) == 0) return sinfo; return NULL; @@ -138,8 +138,8 @@ static odp_testinfo_t *cunit_get_test_info(odp_suiteinfo_t *sinfo, { odp_testinfo_t *tinfo; - for (tinfo = sinfo->pTests; tinfo->pName; tinfo++) - if (strcmp(tinfo->pName, test_name) == 0) + for (tinfo = sinfo->testinfo_tbl; tinfo->name; tinfo++) + if (strcmp(tinfo->name, test_name) == 0) return tinfo; return NULL; @@ -167,14 +167,14 @@ static int _cunit_suite_init(void) return -1; /* execute its init function */ - if (sinfo->pInitFunc) { - ret = sinfo->pInitFunc(); + if (sinfo->init_func) { + ret = sinfo->init_func(); if (ret) return ret; } /* run any configured conditional checks and mark inactive tests */ - for (tinfo = sinfo->pTests; tinfo->pName; tinfo++) { + for (tinfo = sinfo->testinfo_tbl; tinfo->name; tinfo++) { CU_pTest ptest; CU_ErrorCode err; @@ -182,7 +182,7 @@ static int _cunit_suite_init(void) continue; /* test is inactive, mark it as such */ - ptest = CU_get_test_by_name(tinfo->pName, cur_suite); + ptest = CU_get_test_by_name(tinfo->name, cur_suite); if (ptest) err = CU_set_test_active(ptest, CU_FALSE); else @@ -190,7 +190,7 @@ static int _cunit_suite_init(void) if (err != CUE_SUCCESS) { fprintf(stderr, "%s: failed to set test %s inactive\n", - __func__, tinfo->pName); + __func__, tinfo->name); return -1; } } @@ -211,15 +211,15 @@ static int cunit_register_suites(odp_suiteinfo_t testsuites[]) CU_pSuite suite; CU_pTest test; - for (sinfo = testsuites; sinfo->pName; sinfo++) { - suite = CU_add_suite(sinfo->pName, - _cunit_suite_init, sinfo->pCleanupFunc); + for (sinfo = testsuites; sinfo->name; sinfo++) { + suite = CU_add_suite(sinfo->name, + _cunit_suite_init, sinfo->term_func); if (!suite) return CU_get_error(); - for (tinfo = sinfo->pTests; tinfo->pName; tinfo++) { - test = CU_add_test(suite, tinfo->pName, - tinfo->pTestFunc); + for (tinfo = sinfo->testinfo_tbl; tinfo->name; tinfo++) { + test = CU_add_test(suite, tinfo->name, + tinfo->test_func); if (!test) return CU_get_error(); } @@ -235,7 +235,7 @@ static int cunit_update_test(CU_pSuite suite, CU_pTest test = NULL; CU_ErrorCode err; odp_testinfo_t *tinfo; - const char *test_name = updated_tinfo->pName; + const char *test_name = updated_tinfo->name; tinfo = cunit_get_test_info(sinfo, test_name); if (tinfo) @@ -247,7 +247,7 @@ static int cunit_update_test(CU_pSuite suite, return -1; } - err = CU_set_test_func(test, updated_tinfo->pTestFunc); + err = CU_set_test_func(test, updated_tinfo->test_func); if (err != CUE_SUCCESS) { fprintf(stderr, "%s: failed to update test func for %s\n", __func__, test_name); @@ -267,31 +267,31 @@ static int cunit_update_suite(odp_suiteinfo_t *updated_sinfo) odp_testinfo_t *tinfo; /* find previously registered suite with matching name */ - sinfo = cunit_get_suite_info(updated_sinfo->pName); + sinfo = cunit_get_suite_info(updated_sinfo->name); if (sinfo) { /* lookup the associated CUnit suite */ - suite = CU_get_suite_by_name(updated_sinfo->pName, + suite = CU_get_suite_by_name(updated_sinfo->name, CU_get_registry()); } if (!sinfo || !suite) { fprintf(stderr, "%s: unable to find existing suite named %s\n", - __func__, updated_sinfo->pName); + __func__, updated_sinfo->name); return -1; } - sinfo->pInitFunc = updated_sinfo->pInitFunc; - sinfo->pCleanupFunc = updated_sinfo->pCleanupFunc; + sinfo->init_func = updated_sinfo->init_func; + sinfo->term_func = updated_sinfo->term_func; - err = CU_set_suite_cleanupfunc(suite, updated_sinfo->pCleanupFunc); + err = CU_set_suite_cleanupfunc(suite, updated_sinfo->term_func); if (err != CUE_SUCCESS) { fprintf(stderr, "%s: failed to update cleanup func for %s\n", - __func__, updated_sinfo->pName); + __func__, updated_sinfo->name); return -1; } - for (tinfo = updated_sinfo->pTests; tinfo->pName; tinfo++) { + for (tinfo = updated_sinfo->testinfo_tbl; tinfo->name; tinfo++) { int ret; ret = cunit_update_test(suite, sinfo, tinfo); @@ -345,7 +345,7 @@ int odp_cunit_update(odp_suiteinfo_t testsuites[]) int ret = 0; odp_suiteinfo_t *sinfo; - for (sinfo = testsuites; sinfo->pName && ret == 0; sinfo++) + for (sinfo = testsuites; sinfo->name && ret == 0; sinfo++) ret = cunit_update_suite(sinfo); return ret; diff --git a/test/common/odp_cunit_common.h b/test/common/odp_cunit_common.h index 390e8f57b..f6d384321 100644 --- a/test/common/odp_cunit_common.h +++ b/test/common/odp_cunit_common.h @@ -23,16 +23,16 @@ typedef int (*cunit_test_check_active)(void); typedef struct { - const char *pName; - CU_TestFunc pTestFunc; + const char *name; + CU_TestFunc test_func; cunit_test_check_active check_active; } odp_testinfo_t; typedef struct { - const char *pName; - CU_InitializeFunc pInitFunc; - CU_CleanupFunc pCleanupFunc; - odp_testinfo_t *pTests; + const char *name; + CU_InitializeFunc init_func; + CU_CleanupFunc term_func; + odp_testinfo_t *testinfo_tbl; } odp_suiteinfo_t; static inline int odp_cunit_test_inactive(void) { return 0; } diff --git a/test/validation/api/classification/classification.c b/test/validation/api/classification/classification.c index a0d290ec5..ef621f72d 100644 --- a/test/validation/api/classification/classification.c +++ b/test/validation/api/classification/classification.c @@ -12,18 +12,18 @@ #include "classification.h" odp_suiteinfo_t classification_suites[] = { - { .pName = "classification basic", - .pTests = classification_suite_basic, + { .name = "classification basic", + .testinfo_tbl = classification_suite_basic, }, - { .pName = "classification pmr tests", - .pTests = classification_suite_pmr, - .pInitFunc = classification_suite_pmr_init, - .pCleanupFunc = classification_suite_pmr_term, + { .name = "classification pmr tests", + .testinfo_tbl = classification_suite_pmr, + .init_func = classification_suite_pmr_init, + .term_func = classification_suite_pmr_term, }, - { .pName = "classification tests", - .pTests = classification_suite, - .pInitFunc = classification_suite_init, - .pCleanupFunc = classification_suite_term, + { .name = "classification tests", + .testinfo_tbl = classification_suite, + .init_func = classification_suite_init, + .term_func = classification_suite_term, }, ODP_SUITE_INFO_NULL, }; diff --git a/test/validation/api/crypto/odp_crypto_test_inp.c b/test/validation/api/crypto/odp_crypto_test_inp.c index ad9784a69..df1c7b6f5 100644 --- a/test/validation/api/crypto/odp_crypto_test_inp.c +++ b/test/validation/api/crypto/odp_crypto_test_inp.c @@ -1230,14 +1230,14 @@ int crypto_suite_term(void) int i; int first = 1; - for (i = 0; crypto_suite[i].pName; i++) { + for (i = 0; crypto_suite[i].name; i++) { if (crypto_suite[i].check_active && crypto_suite[i].check_active() == ODP_TEST_INACTIVE) { if (first) { first = 0; printf("\n\n Inactive tests:\n"); } - printf(" %s\n", crypto_suite[i].pName); + printf(" %s\n", crypto_suite[i].name); } } return 0; diff --git a/test/validation/api/ipsec/ipsec.c b/test/validation/api/ipsec/ipsec.c index ea3cff052..b16f84ac9 100644 --- a/test/validation/api/ipsec/ipsec.c +++ b/test/validation/api/ipsec/ipsec.c @@ -789,14 +789,14 @@ static int ipsec_suite_term(odp_testinfo_t *suite) if (suite_context.pktio != ODP_PKTIO_INVALID) pktio_stop(suite_context.pktio); - for (i = 0; suite[i].pName; i++) { + for (i = 0; suite[i].name; i++) { if (suite[i].check_active && suite[i].check_active() == ODP_TEST_INACTIVE) { if (first) { first = 0; printf("\n\n Inactive tests:\n"); } - printf(" %s\n", suite[i].pName); + printf(" %s\n", suite[i].name); } } diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c index 78ccbeaef..1188c683c 100644 --- a/test/validation/api/packet/packet.c +++ b/test/validation/api/packet/packet.c @@ -2703,10 +2703,10 @@ odp_testinfo_t packet_suite[] = { }; odp_suiteinfo_t packet_suites[] = { - { .pName = "packet tests", - .pTests = packet_suite, - .pInitFunc = packet_suite_init, - .pCleanupFunc = packet_suite_term, + { .name = "packet tests", + .testinfo_tbl = packet_suite, + .init_func = packet_suite_init, + .term_func = packet_suite_term, }, ODP_SUITE_INFO_NULL, }; diff --git a/test/validation/api/pool/pool.c b/test/validation/api/pool/pool.c index 84c17720d..3a2c74122 100644 --- a/test/validation/api/pool/pool.c +++ b/test/validation/api/pool/pool.c @@ -230,8 +230,8 @@ odp_testinfo_t pool_suite[] = { }; odp_suiteinfo_t pool_suites[] = { - { .pName = "Pool tests", - .pTests = pool_suite, + { .name = "Pool tests", + .testinfo_tbl = pool_suite, }, ODP_SUITE_INFO_NULL, }; From patchwork Tue Feb 13 14:00:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 128237 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp4281585ljc; Tue, 13 Feb 2018 06:01:17 -0800 (PST) X-Google-Smtp-Source: AH8x225SMeNY//LrP6oEo6ipGN6BkCVgLv7xAFT1IqO/88cI0HvCJdFlcbCV/L9g9UVuyCaPTj4B X-Received: by 10.200.12.203 with SMTP id o11mr2063312qti.95.1518530477269; Tue, 13 Feb 2018 06:01:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518530477; cv=none; d=google.com; s=arc-20160816; b=dqhLkhN6b2zti84/TRJ0yPzaN+0TxodckwfFy9/mzUY+is8ubO/SJ+tz5dZPRDjYW3 gd8ECUoikoGGb9Ivz/wt+BWjdQYVMt459w/H/X/6QfK0KgRCXT96rybCP9EmpjHOjr7/ hMU4ZabLeu0d8Q3Chf1ppXsDRnS2pVZnve7KSlih/bJnPTn+kDlv8diCE8SBCckWXFRi djt10xq798/38qq9njupN+nOzjH586idVpHtMKstyliOD0lozXT0X3lTkquBPHhqtHVM n66F4RTr4ceC0bhmJrq7pVTbumb51M3zcL/yexvh6sVqYCDa2oJprNcvOXU1OxoAdeZq 8epw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=AV8Itd/lJv3mMRk+auToDNd+AIG9BjRrvAPkf76mrpk=; b=O8KdcE5a8vqVeXQmysO6lO4fUuHmgGjIgR6ySyjhOjPgZiN8d6DdL4NAKP0PE3w3L7 y/5yrQh4WLZhlC2lkVa+q0KyOZyaaa31Mjko05rNca4SSb17ZyhCbyMRmdm/iCHlJwxo ySzBsqRfDOpTJMF2cN9VoqzFlSs6UAavpaFuwLEBieRY+oDbpjVbg0PV+l0p7P0I3irP Zxh9yk23OxVHo5CJBVCNXmS0CeT23hbIUYQerVE+YNNUB5DikrTB+agyn3BjEYbcxRWj wKQ/uF2ZDvn30BEz6g56UHQV8KUbd8M3xHHaHiLuRuGEcI3b2iDSgstKEYF4xOEOtPgq Pmbg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id s65si1909089qks.388.2018.02.13.06.01.16; Tue, 13 Feb 2018 06:01:17 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id DBCC160BF4; Tue, 13 Feb 2018 14:01:16 +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,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL 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 9E9A4608A2; Tue, 13 Feb 2018 14:00:26 +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 15789616E8; Tue, 13 Feb 2018 14:00:19 +0000 (UTC) Received: from forward103j.mail.yandex.net (forward103j.mail.yandex.net [5.45.198.246]) by lists.linaro.org (Postfix) with ESMTPS id 4527160C5E for ; Tue, 13 Feb 2018 14:00:15 +0000 (UTC) Received: from mxback9g.mail.yandex.net (mxback9g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:170]) by forward103j.mail.yandex.net (Yandex) with ESMTP id 3F5A534C4DEC for ; Tue, 13 Feb 2018 17:00:14 +0300 (MSK) Received: from smtp1o.mail.yandex.net (smtp1o.mail.yandex.net [2a02:6b8:0:1a2d::25]) by mxback9g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id kirrbNZcW3-0EE8Nrqi; Tue, 13 Feb 2018 17:00:14 +0300 Received: by smtp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 6Ss5leStGE-0DFqTfhf; Tue, 13 Feb 2018 17:00:13 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Tue, 13 Feb 2018 17:00:05 +0300 Message-Id: <1518530410-18574-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518530410-18574-1-git-send-email-odpbot@yandex.ru> References: <1518530410-18574-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 472 Subject: [lng-odp] [PATCH v2 2/7] validation: packet: create parse test suite 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: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen Move parse tests into own suite before adding new test cases. There will be many parse test cases as there are many combinations of good and bad packet formats. Signed-off-by: Petri Savolainen --- /** Email created from pull request 472 (psavol:master-parser-validation) ** https://github.com/Linaro/odp/pull/472 ** Patch: https://github.com/Linaro/odp/pull/472.patch ** Base sha: 41b3fa2cd994a7ef68290a07dcde5564e4640847 ** Merge commit sha: 38d924655e8119f902e986011a477e1ad9094ab6 **/ test/validation/api/packet/packet.c | 234 ++++++++++++++++++++++-------------- test/validation/api/packet/packet.h | 1 - 2 files changed, 141 insertions(+), 94 deletions(-) diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c index 1188c683c..05ec2b554 100644 --- a/test/validation/api/packet/packet.c +++ b/test/validation/api/packet/packet.c @@ -23,6 +23,9 @@ ODP_STATIC_ASSERT(PACKET_POOL_NUM_SEG > 1 && PACKET_POOL_NUM_SEG < PACKET_POOL_NUM, "Invalid PACKET_POOL_NUM_SEG value"); +/* Number of packets in parse test */ +#define PARSE_TEST_NUM_PKT 10 + static odp_pool_t packet_pool, packet_pool_no_uarea, packet_pool_double_uarea; static uint32_t packet_len; @@ -41,6 +44,25 @@ static struct udata_struct { "abcdefg", }; +static struct { + odp_pool_t pool; + odp_proto_chksums_t all_chksums; + uint32_t offset_zero[PARSE_TEST_NUM_PKT]; +} parse_test; + +static uint32_t parse_test_pkt_len[] = { + sizeof(test_packet_arp), + sizeof(test_packet_ipv4_icmp), + sizeof(test_packet_ipv4_tcp), + sizeof(test_packet_ipv4_udp), + sizeof(test_packet_vlan_ipv4_udp), + sizeof(test_packet_vlan_qinq_ipv4_udp), + sizeof(test_packet_ipv6_icmp), + sizeof(test_packet_ipv6_tcp), + sizeof(test_packet_ipv6_udp), + sizeof(test_packet_vlan_ipv6_udp) +}; + #define packet_compare_offset(pkt1, off1, pkt2, off2, len) \ _packet_compare_offset((pkt1), (off1), (pkt2), (off2), (len), __LINE__) @@ -2459,41 +2481,18 @@ void packet_test_ref(void) odp_packet_free(ref_pkt[1]); } -void packet_test_parse(void) +static int packet_parse_suite_init(void) { - odp_pool_t pool; + int num_test_pkt, i; + uint32_t max_len; odp_pool_param_t param; - odp_packet_parse_param_t parse; - int ret, num_test_pkt, i; - uint32_t len, max_len; - odp_packet_chksum_status_t chksum_status; - odp_proto_chksums_t all_chksums; - int num_pkt = 10; - odp_packet_t pkt[num_pkt]; - uint32_t offset[num_pkt]; - uint32_t test_pkt_len[] = {sizeof(test_packet_arp), - sizeof(test_packet_ipv4_icmp), - sizeof(test_packet_ipv4_tcp), - sizeof(test_packet_ipv4_udp), - sizeof(test_packet_vlan_ipv4_udp), - sizeof(test_packet_vlan_qinq_ipv4_udp), - sizeof(test_packet_ipv6_icmp), - sizeof(test_packet_ipv6_tcp), - sizeof(test_packet_ipv6_udp), - sizeof(test_packet_vlan_ipv6_udp) }; - - all_chksums.all_chksum = 0; - all_chksums.chksum.ipv4 = 1; - all_chksums.chksum.udp = 1; - all_chksums.chksum.tcp = 1; - all_chksums.chksum.sctp = 1; - - num_test_pkt = sizeof(test_pkt_len) / sizeof(uint32_t); + + num_test_pkt = sizeof(parse_test_pkt_len) / sizeof(uint32_t); max_len = 0; for (i = 0; i < num_test_pkt; i++) { - if (max_len < test_pkt_len[i]) - max_len = test_pkt_len[i]; + if (max_len < parse_test_pkt_len[i]) + max_len = parse_test_pkt_len[i]; } odp_pool_param_init(¶m); @@ -2503,21 +2502,59 @@ void packet_test_parse(void) param.pkt.len = max_len; param.pkt.num = 100; - pool = odp_pool_create("test_parse_pool", ¶m); - CU_ASSERT_FATAL(pool != ODP_POOL_INVALID); + parse_test.pool = odp_pool_create("parse_test_pool", ¶m); + + if (parse_test.pool == ODP_POOL_INVALID) + return -1; + + parse_test.all_chksums.all_chksum = 0; + parse_test.all_chksums.chksum.ipv4 = 1; + parse_test.all_chksums.chksum.udp = 1; + parse_test.all_chksums.chksum.tcp = 1; + parse_test.all_chksums.chksum.sctp = 1; + + for (i = 0; i < PARSE_TEST_NUM_PKT; i++) + parse_test.offset_zero[i] = 0; + + return 0; +} + +static int packet_parse_suite_term(void) +{ + if (odp_pool_destroy(parse_test.pool)) + return -1; - /* Ethernet/IPv4/UDP */ - len = sizeof(test_packet_ipv4_udp); - ret = odp_packet_alloc_multi(pool, len, pkt, num_pkt); + return 0; +} + +static void parse_test_alloc(odp_packet_t pkt[], const uint8_t test_packet[], + uint32_t len) +{ + int ret, i; + int num_pkt = PARSE_TEST_NUM_PKT; + + ret = odp_packet_alloc_multi(parse_test.pool, len, pkt, num_pkt); CU_ASSERT_FATAL(ret == num_pkt); for (i = 0; i < num_pkt; i++) { - ret = odp_packet_copy_from_mem(pkt[i], 0, len, - test_packet_ipv4_udp); - CU_ASSERT(ret == 0); + ret = odp_packet_copy_from_mem(pkt[i], 0, len, test_packet); + CU_ASSERT_FATAL(ret == 0); + } +} - offset[i] = 0; +/* Ethernet/IPv4/UDP */ +static void parse_eth_ipv4_udp(void) +{ + odp_packet_parse_param_t parse; + int i; + odp_packet_chksum_status_t chksum_status; + int num_pkt = PARSE_TEST_NUM_PKT; + odp_packet_t pkt[num_pkt]; + + parse_test_alloc(pkt, test_packet_ipv4_udp, + sizeof(test_packet_ipv4_udp)); + for (i = 0; i < num_pkt; i++) { chksum_status = odp_packet_l3_chksum_status(pkt[i]); CU_ASSERT(chksum_status == ODP_PACKET_CHKSUM_UNKNOWN); chksum_status = odp_packet_l4_chksum_status(pkt[i]); @@ -2526,10 +2563,10 @@ void packet_test_parse(void) parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_ALL; - parse.chksums = all_chksums; + parse.chksums = parse_test.all_chksums; - CU_ASSERT(odp_packet_parse(pkt[0], offset[0], &parse) == 0); - CU_ASSERT(odp_packet_parse_multi(&pkt[1], &offset[1], + CU_ASSERT(odp_packet_parse(pkt[0], 0, &parse) == 0); + CU_ASSERT(odp_packet_parse_multi(&pkt[1], parse_test.offset_zero, num_pkt - 1, &parse) == (num_pkt - 1)); for (i = 0; i < num_pkt; i++) { @@ -2541,19 +2578,22 @@ void packet_test_parse(void) } odp_packet_free_multi(pkt, num_pkt); +} - /* IPv4/UDP */ - len = sizeof(test_packet_ipv4_udp); - ret = odp_packet_alloc_multi(pool, len, pkt, num_pkt); - CU_ASSERT_FATAL(ret == num_pkt); +/* IPv4/UDP */ +static void parse_ipv4_udp(void) +{ + odp_packet_parse_param_t parse; + int i; + int num_pkt = PARSE_TEST_NUM_PKT; + odp_packet_t pkt[num_pkt]; + uint32_t offset[num_pkt]; - for (i = 0; i < num_pkt; i++) { - ret = odp_packet_copy_from_mem(pkt[i], 0, len, - test_packet_ipv4_udp); - CU_ASSERT(ret == 0); + parse_test_alloc(pkt, test_packet_ipv4_udp, + sizeof(test_packet_ipv4_udp)); + for (i = 0; i < num_pkt; i++) offset[i] = 14; - } parse.proto = ODP_PROTO_IPV4; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -2571,26 +2611,25 @@ void packet_test_parse(void) } odp_packet_free_multi(pkt, num_pkt); +} - /* Ethernet/IPv4/TCP */ - len = sizeof(test_packet_ipv4_tcp); - ret = odp_packet_alloc_multi(pool, len, pkt, num_pkt); - CU_ASSERT_FATAL(ret == num_pkt); - - for (i = 0; i < num_pkt; i++) { - ret = odp_packet_copy_from_mem(pkt[i], 0, len, - test_packet_ipv4_tcp); - CU_ASSERT(ret == 0); +/* Ethernet/IPv4/TCP */ +static void parse_eth_ipv4_tcp(void) +{ + odp_packet_parse_param_t parse; + int i; + int num_pkt = PARSE_TEST_NUM_PKT; + odp_packet_t pkt[num_pkt]; - offset[i] = 0; - } + parse_test_alloc(pkt, test_packet_ipv4_tcp, + sizeof(test_packet_ipv4_tcp)); parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; parse.chksums.all_chksum = 0; - CU_ASSERT(odp_packet_parse(pkt[0], offset[0], &parse) == 0); - CU_ASSERT(odp_packet_parse_multi(&pkt[1], &offset[1], + CU_ASSERT(odp_packet_parse(pkt[0], 0, &parse) == 0); + CU_ASSERT(odp_packet_parse_multi(&pkt[1], parse_test.offset_zero, num_pkt - 1, &parse) == (num_pkt - 1)); for (i = 0; i < num_pkt; i++) { @@ -2601,26 +2640,25 @@ void packet_test_parse(void) } odp_packet_free_multi(pkt, num_pkt); +} - /* Ethernet/IPv6/UDP */ - len = sizeof(test_packet_ipv6_udp); - ret = odp_packet_alloc_multi(pool, len, pkt, num_pkt); - CU_ASSERT_FATAL(ret == num_pkt); - - for (i = 0; i < num_pkt; i++) { - ret = odp_packet_copy_from_mem(pkt[i], 0, len, - test_packet_ipv6_udp); - CU_ASSERT(ret == 0); +/* Ethernet/IPv6/UDP */ +static void parse_eth_ipv6_udp(void) +{ + odp_packet_parse_param_t parse; + int i; + int num_pkt = PARSE_TEST_NUM_PKT; + odp_packet_t pkt[num_pkt]; - offset[i] = 0; - } + parse_test_alloc(pkt, test_packet_ipv6_udp, + sizeof(test_packet_ipv6_udp)); parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; parse.chksums.all_chksum = 0; - CU_ASSERT(odp_packet_parse(pkt[0], offset[0], &parse) == 0); - CU_ASSERT(odp_packet_parse_multi(&pkt[1], &offset[1], + CU_ASSERT(odp_packet_parse(pkt[0], 0, &parse) == 0); + CU_ASSERT(odp_packet_parse_multi(&pkt[1], parse_test.offset_zero, num_pkt - 1, &parse) == (num_pkt - 1)); for (i = 0; i < num_pkt; i++) { @@ -2632,26 +2670,25 @@ void packet_test_parse(void) } odp_packet_free_multi(pkt, num_pkt); +} - /* Ethernet/IPv6/TCP */ - len = sizeof(test_packet_ipv6_tcp); - ret = odp_packet_alloc_multi(pool, len, pkt, num_pkt); - CU_ASSERT_FATAL(ret == num_pkt); - - for (i = 0; i < num_pkt; i++) { - ret = odp_packet_copy_from_mem(pkt[i], 0, len, - test_packet_ipv6_tcp); - CU_ASSERT(ret == 0); +/* Ethernet/IPv6/TCP */ +static void parse_eth_ipv6_tcp(void) +{ + odp_packet_parse_param_t parse; + int i; + int num_pkt = PARSE_TEST_NUM_PKT; + odp_packet_t pkt[num_pkt]; - offset[i] = 0; - } + parse_test_alloc(pkt, test_packet_ipv6_tcp, + sizeof(test_packet_ipv6_tcp)); parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_ALL; parse.chksums.all_chksum = 0; - CU_ASSERT(odp_packet_parse(pkt[0], offset[0], &parse) == 0); - CU_ASSERT(odp_packet_parse_multi(&pkt[1], &offset[1], + CU_ASSERT(odp_packet_parse(pkt[0], 0, &parse) == 0); + CU_ASSERT(odp_packet_parse_multi(&pkt[1], parse_test.offset_zero, num_pkt - 1, &parse) == (num_pkt - 1)); for (i = 0; i < num_pkt; i++) { @@ -2663,8 +2700,6 @@ void packet_test_parse(void) } odp_packet_free_multi(pkt, num_pkt); - - odp_pool_destroy(pool); } odp_testinfo_t packet_suite[] = { @@ -2698,7 +2733,15 @@ odp_testinfo_t packet_suite[] = { ODP_TEST_INFO(packet_test_align), ODP_TEST_INFO(packet_test_offset), ODP_TEST_INFO(packet_test_ref), - ODP_TEST_INFO(packet_test_parse), + ODP_TEST_INFO_NULL, +}; + +odp_testinfo_t packet_parse_suite[] = { + ODP_TEST_INFO(parse_eth_ipv4_udp), + ODP_TEST_INFO(parse_ipv4_udp), + ODP_TEST_INFO(parse_eth_ipv4_tcp), + ODP_TEST_INFO(parse_eth_ipv6_udp), + ODP_TEST_INFO(parse_eth_ipv6_tcp), ODP_TEST_INFO_NULL, }; @@ -2708,6 +2751,11 @@ odp_suiteinfo_t packet_suites[] = { .init_func = packet_suite_init, .term_func = packet_suite_term, }, + { .name = "packet parse tests", + .testinfo_tbl = packet_parse_suite, + .init_func = packet_parse_suite_init, + .term_func = packet_parse_suite_term, + }, ODP_SUITE_INFO_NULL, }; diff --git a/test/validation/api/packet/packet.h b/test/validation/api/packet/packet.h index 1d9947afa..798b272b9 100644 --- a/test/validation/api/packet/packet.h +++ b/test/validation/api/packet/packet.h @@ -40,7 +40,6 @@ void packet_test_extend_ref(void); void packet_test_align(void); void packet_test_offset(void); void packet_test_ref(void); -void packet_test_parse(void); /* test arrays: */ extern odp_testinfo_t packet_suite[]; From patchwork Tue Feb 13 14:00:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 128242 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp4287777ljc; Tue, 13 Feb 2018 06:06:40 -0800 (PST) X-Google-Smtp-Source: AH8x225hG7K7CmKixjZL1WIRHZkT3AzYXGdjuDi5QXlH6yKJByVU7hYMbgMNPZMw33raBtLFxzgG X-Received: by 10.55.192.144 with SMTP id v16mr2009468qkv.233.1518530799977; Tue, 13 Feb 2018 06:06:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518530799; cv=none; d=google.com; s=arc-20160816; b=EwxE1WLc7T+ftl7e/uZpKjLq2/Gt1PUcaHii/WWaFdnQcf+ANXFE6t+l0HsRXLRsHz T6iU/Fj7cjOf7RkRX3NHIKeJwEbkZOiIxct0vDg6KCBFkDJJ7j0IX78p7DArl9i6yemP 4IrRCC808cFdw3DPVJwLpZW+HeFjKg75DfHJVnaRKloHAVt0f7vFwbWSLDXc3X/6VXUg ARTAd71LktUrFNFHbf2WGHWuXtQSWvBlhcqi/q8tteYjwnZ6IHTvNGAvwVUgk7ERiBWi 6zT96UulRqtvLM8n3rzMcAvlLpXDxsNNS4MNh+KqQ4Uv18Y+GDdsGj2RtHh2TccnB5Se j7wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=mrCyAGkvMJ5230OZ/FL9H/xTHDRHNhVlGiMvElfPz+M=; b=I3GqAzoMNfxNCAP+OZgsQJmoR8grq/udOXj2ySJtvT5ERlTq/UrW7UhnhgOrmpaGII JvE4F8LlnH5jofUCKLQFjxB1Wfg7HAowQ73QJ/a5VyFhUzwyus7H4ltqPwuFxQaiETmI HX6HdIWBiLnpk99XWMnyO/i01QFDbZCU2OcKMud1tBQmywyUCuhP7YwObp++Tx7c6ZdV iQx+OSdSZiJoEglyMXrgUr7fMMZrgq9e36q/jI60paKEk5qyVgK4AYMPUt3Zj08D1Dn4 J2Tw/zpqfo0S9xQ38No7PSVezMI0smNnIm9/jtzpvMxa/hWWxWL8XjAG+69XorodakE9 H+Aw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id p18si1805784qkl.227.2018.02.13.06.06.39; Tue, 13 Feb 2018 06:06:39 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 7D6BE616F9; Tue, 13 Feb 2018 14:06:39 +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,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 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 61A4B6170B; Tue, 13 Feb 2018 14:00:49 +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 4498E60928; Tue, 13 Feb 2018 14:00:28 +0000 (UTC) Received: from forward100o.mail.yandex.net (forward100o.mail.yandex.net [37.140.190.180]) by lists.linaro.org (Postfix) with ESMTPS id 8F7D461555 for ; Tue, 13 Feb 2018 14:00:16 +0000 (UTC) Received: from mxback3j.mail.yandex.net (mxback3j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10c]) by forward100o.mail.yandex.net (Yandex) with ESMTP id 20AA82A23E2E for ; Tue, 13 Feb 2018 17:00:15 +0300 (MSK) Received: from smtp1o.mail.yandex.net (smtp1o.mail.yandex.net [2a02:6b8:0:1a2d::25]) by mxback3j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id eCHWhij6Or-0EhuqMWN; Tue, 13 Feb 2018 17:00:15 +0300 Received: by smtp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 6Ss5leStGE-0EFiNSqx; Tue, 13 Feb 2018 17:00:14 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Tue, 13 Feb 2018 17:00:06 +0300 Message-Id: <1518530410-18574-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518530410-18574-1-git-send-email-odpbot@yandex.ru> References: <1518530410-18574-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 472 Subject: [lng-odp] [PATCH v2 3/7] validation: packet: add parser test cases 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: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen Add remaining test cases for packet formats already defined in test_packet_parser.h file. Signed-off-by: Petri Savolainen --- /** Email created from pull request 472 (psavol:master-parser-validation) ** https://github.com/Linaro/odp/pull/472 ** Patch: https://github.com/Linaro/odp/pull/472.patch ** Base sha: 41b3fa2cd994a7ef68290a07dcde5564e4640847 ** Merge commit sha: 38d924655e8119f902e986011a477e1ad9094ab6 **/ test/validation/api/packet/packet.c | 195 ++++++++++++++++++++++++++++++++++++ 1 file changed, 195 insertions(+) diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c index 05ec2b554..ea7e89b2f 100644 --- a/test/validation/api/packet/packet.c +++ b/test/validation/api/packet/packet.c @@ -2633,6 +2633,7 @@ static void parse_eth_ipv4_tcp(void) num_pkt - 1, &parse) == (num_pkt - 1)); for (i = 0; i < num_pkt; i++) { + CU_ASSERT(odp_packet_has_eth(pkt[i])); CU_ASSERT(odp_packet_has_ipv4(pkt[i])); CU_ASSERT(odp_packet_has_tcp(pkt[i])); CU_ASSERT(!odp_packet_has_ipv6(pkt[i])); @@ -2702,6 +2703,194 @@ static void parse_eth_ipv6_tcp(void) odp_packet_free_multi(pkt, num_pkt); } +/* Ethernet/VLAN/IPv4/UDP */ +static void parse_eth_vlan_ipv4_udp(void) +{ + odp_packet_parse_param_t parse; + int i; + int num_pkt = PARSE_TEST_NUM_PKT; + odp_packet_t pkt[num_pkt]; + + parse_test_alloc(pkt, test_packet_vlan_ipv4_udp, + sizeof(test_packet_vlan_ipv4_udp)); + + parse.proto = ODP_PROTO_ETH; + parse.last_layer = ODP_PROTO_LAYER_L4; + parse.chksums.all_chksum = 0; + + CU_ASSERT(odp_packet_parse(pkt[0], 0, &parse) == 0); + CU_ASSERT(odp_packet_parse_multi(&pkt[1], parse_test.offset_zero, + num_pkt - 1, &parse) == (num_pkt - 1)); + + for (i = 0; i < num_pkt; i++) { + CU_ASSERT(odp_packet_has_eth(pkt[i])); + CU_ASSERT(odp_packet_has_vlan(pkt[i])); + CU_ASSERT(odp_packet_has_ipv4(pkt[i])); + CU_ASSERT(odp_packet_has_udp(pkt[i])); + CU_ASSERT(!odp_packet_has_ipv6(pkt[i])); + CU_ASSERT(!odp_packet_has_tcp(pkt[i])); + } + + odp_packet_free_multi(pkt, num_pkt); +} + +/* Ethernet/VLAN/IPv6/UDP */ +static void parse_eth_vlan_ipv6_udp(void) +{ + odp_packet_parse_param_t parse; + int i; + int num_pkt = PARSE_TEST_NUM_PKT; + odp_packet_t pkt[num_pkt]; + + parse_test_alloc(pkt, test_packet_vlan_ipv6_udp, + sizeof(test_packet_vlan_ipv6_udp)); + + parse.proto = ODP_PROTO_ETH; + parse.last_layer = ODP_PROTO_LAYER_L4; + parse.chksums.all_chksum = 0; + + CU_ASSERT(odp_packet_parse(pkt[0], 0, &parse) == 0); + CU_ASSERT(odp_packet_parse_multi(&pkt[1], parse_test.offset_zero, + num_pkt - 1, &parse) == (num_pkt - 1)); + + for (i = 0; i < num_pkt; i++) { + CU_ASSERT(odp_packet_has_eth(pkt[i])); + CU_ASSERT(odp_packet_has_vlan(pkt[i])); + CU_ASSERT(odp_packet_has_ipv6(pkt[i])); + CU_ASSERT(odp_packet_has_udp(pkt[i])); + CU_ASSERT(!odp_packet_has_ipv4(pkt[i])); + CU_ASSERT(!odp_packet_has_tcp(pkt[i])); + } + + odp_packet_free_multi(pkt, num_pkt); +} + +/* Ethernet/VLAN/VLAN/IPv4/UDP */ +static void parse_eth_vlan_qinq_ipv4_udp(void) +{ + odp_packet_parse_param_t parse; + int i; + int num_pkt = PARSE_TEST_NUM_PKT; + odp_packet_t pkt[num_pkt]; + + parse_test_alloc(pkt, test_packet_vlan_qinq_ipv4_udp, + sizeof(test_packet_vlan_qinq_ipv4_udp)); + + parse.proto = ODP_PROTO_ETH; + parse.last_layer = ODP_PROTO_LAYER_L4; + parse.chksums.all_chksum = 0; + + CU_ASSERT(odp_packet_parse(pkt[0], 0, &parse) == 0); + CU_ASSERT(odp_packet_parse_multi(&pkt[1], parse_test.offset_zero, + num_pkt - 1, &parse) == (num_pkt - 1)); + + for (i = 0; i < num_pkt; i++) { + CU_ASSERT(odp_packet_has_eth(pkt[i])); + CU_ASSERT(odp_packet_has_vlan(pkt[i])); + CU_ASSERT(odp_packet_has_vlan_qinq(pkt[i])); + CU_ASSERT(odp_packet_has_ipv4(pkt[i])); + CU_ASSERT(odp_packet_has_udp(pkt[i])); + CU_ASSERT(!odp_packet_has_ipv6(pkt[i])); + CU_ASSERT(!odp_packet_has_tcp(pkt[i])); + } + + odp_packet_free_multi(pkt, num_pkt); +} + +/* Ethernet/ARP */ +static void parse_eth_arp(void) +{ + odp_packet_parse_param_t parse; + int i; + int num_pkt = PARSE_TEST_NUM_PKT; + odp_packet_t pkt[num_pkt]; + + parse_test_alloc(pkt, test_packet_arp, + sizeof(test_packet_arp)); + + parse.proto = ODP_PROTO_ETH; + parse.last_layer = ODP_PROTO_LAYER_L4; + parse.chksums.all_chksum = 0; + + CU_ASSERT(odp_packet_parse(pkt[0], 0, &parse) == 0); + CU_ASSERT(odp_packet_parse_multi(&pkt[1], parse_test.offset_zero, + num_pkt - 1, &parse) == (num_pkt - 1)); + + for (i = 0; i < num_pkt; i++) { + CU_ASSERT(odp_packet_has_eth(pkt[i])); + CU_ASSERT(odp_packet_has_eth_bcast(pkt[i])); + CU_ASSERT(odp_packet_has_arp(pkt[i])); + CU_ASSERT(!odp_packet_has_vlan(pkt[i])); + CU_ASSERT(!odp_packet_has_ipv4(pkt[i])); + CU_ASSERT(!odp_packet_has_ipv6(pkt[i])); + CU_ASSERT(!odp_packet_has_udp(pkt[i])); + } + + odp_packet_free_multi(pkt, num_pkt); +} + +/* Ethernet/IPv4/ICMP */ +static void parse_eth_ipv4_icmp(void) +{ + odp_packet_parse_param_t parse; + int i; + int num_pkt = PARSE_TEST_NUM_PKT; + odp_packet_t pkt[num_pkt]; + + parse_test_alloc(pkt, test_packet_ipv4_icmp, + sizeof(test_packet_ipv4_icmp)); + + parse.proto = ODP_PROTO_ETH; + parse.last_layer = ODP_PROTO_LAYER_L4; + parse.chksums.all_chksum = 0; + + CU_ASSERT(odp_packet_parse(pkt[0], 0, &parse) == 0); + CU_ASSERT(odp_packet_parse_multi(&pkt[1], parse_test.offset_zero, + num_pkt - 1, &parse) == (num_pkt - 1)); + + for (i = 0; i < num_pkt; i++) { + CU_ASSERT(odp_packet_has_eth(pkt[i])); + CU_ASSERT(odp_packet_has_ipv4(pkt[i])); + CU_ASSERT(odp_packet_has_icmp(pkt[i])); + CU_ASSERT(!odp_packet_has_eth_bcast(pkt[i])); + CU_ASSERT(!odp_packet_has_ipv6(pkt[i])); + CU_ASSERT(!odp_packet_has_tcp(pkt[i])); + } + + odp_packet_free_multi(pkt, num_pkt); +} + +/* Ethernet/IPv6/ICMP */ +static void parse_eth_ipv6_icmp(void) +{ + odp_packet_parse_param_t parse; + int i; + int num_pkt = PARSE_TEST_NUM_PKT; + odp_packet_t pkt[num_pkt]; + + parse_test_alloc(pkt, test_packet_ipv6_icmp, + sizeof(test_packet_ipv6_icmp)); + + parse.proto = ODP_PROTO_ETH; + parse.last_layer = ODP_PROTO_LAYER_L4; + parse.chksums.all_chksum = 0; + + CU_ASSERT(odp_packet_parse(pkt[0], 0, &parse) == 0); + CU_ASSERT(odp_packet_parse_multi(&pkt[1], parse_test.offset_zero, + num_pkt - 1, &parse) == (num_pkt - 1)); + + for (i = 0; i < num_pkt; i++) { + CU_ASSERT(odp_packet_has_eth(pkt[i])); + CU_ASSERT(odp_packet_has_ipv6(pkt[i])); + CU_ASSERT(odp_packet_has_icmp(pkt[i])); + CU_ASSERT(!odp_packet_has_eth_bcast(pkt[i])); + CU_ASSERT(!odp_packet_has_ipv4(pkt[i])); + CU_ASSERT(!odp_packet_has_tcp(pkt[i])); + } + + odp_packet_free_multi(pkt, num_pkt); +} + odp_testinfo_t packet_suite[] = { ODP_TEST_INFO(packet_test_alloc_free), ODP_TEST_INFO(packet_test_alloc_free_multi), @@ -2742,6 +2931,12 @@ odp_testinfo_t packet_parse_suite[] = { ODP_TEST_INFO(parse_eth_ipv4_tcp), ODP_TEST_INFO(parse_eth_ipv6_udp), ODP_TEST_INFO(parse_eth_ipv6_tcp), + ODP_TEST_INFO(parse_eth_vlan_ipv4_udp), + ODP_TEST_INFO(parse_eth_vlan_ipv6_udp), + ODP_TEST_INFO(parse_eth_vlan_qinq_ipv4_udp), + ODP_TEST_INFO(parse_eth_arp), + ODP_TEST_INFO(parse_eth_ipv4_icmp), + ODP_TEST_INFO(parse_eth_ipv6_icmp), ODP_TEST_INFO_NULL, }; From patchwork Tue Feb 13 14:00:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 128243 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp4290669ljc; Tue, 13 Feb 2018 06:09:28 -0800 (PST) X-Google-Smtp-Source: AH8x225leg6B3DvptrjrybIJnlLDf9gOTf1g0S/c8k0lc+1/EuvqShWu5B8C05jKsjIw+lmNDVv5 X-Received: by 10.55.94.129 with SMTP id s123mr1955156qkb.222.1518530968338; Tue, 13 Feb 2018 06:09:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518530968; cv=none; d=google.com; s=arc-20160816; b=laMhtmIfhIMVtbdCcHjlZuGSupBaP+tTPJaxo+ZiU5QEEOx+KU8RyB7VjxEf9zHkW9 d5lgyOvWQbLo1K99CxSE53I6KZF9KonLm9yUEtOpRmGjyiE3pAWQoZNaNSMtlb6Kq23P xNRS9En+2HCk+26EWAHJJFEtGLUT5QitEEW9R3kyXh/INn/OZaZb2EqFClxy89x5VRNb 6tgceFmHw586FX5jTTusagujSske1gnvTJzESaR0oA2xbvoN+IkWfJe8urJBNLyM/oXg bRG2+2KhBsRP3Qi6qIDEiHGi4kSNV0LL798nIYwnYUoxGapgNt7MqvRQZp5llAmFv2kB /+gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=RMqdT77TE396ojYTBWnDS2lm3y+7ylvEPzcB2zHomuY=; b=kVEVb+5qgsUVwXhtdvzEo5N1gAg99sEcS2+nIBItuuWQv4iPzlJX5/lpSpWA1yKA44 cHEnjHUnJgx1pXN+pgGsIksB+chLQunqHxkeSRmYYeFKG0oiVI6g6KsaZaXs4cdvXmEW e5yJ9FiwDxu2HWLNtKLaaaurcqqI3uI2AWMIlKWsseppfumnt1LTVzKZMvXALU/Jq648 b3JoyJX5+n1qGriTig8LZmetEeH+FDLH37OL/rWUFyvtcWPgOP1h+cAJ1DDsqjnlfvSW JQWrpiKrx7s6VFJ6894DC0+2pkja7IKxyRnhKjnA0b4PSfmTR7Ttmefc3ZmUde0kgemd w2xA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id y64si5725239qke.22.2018.02.13.06.09.27; Tue, 13 Feb 2018 06:09:28 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 98F0660855; Tue, 13 Feb 2018 14:09:27 +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,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW 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 BAD8E60946; Tue, 13 Feb 2018 14:05:59 +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 2C0A860929; Tue, 13 Feb 2018 14:05:53 +0000 (UTC) Received: from forward103o.mail.yandex.net (forward103o.mail.yandex.net [37.140.190.177]) by lists.linaro.org (Postfix) with ESMTPS id 7E02A608C1 for ; Tue, 13 Feb 2018 14:02:13 +0000 (UTC) Received: from mxback20j.mail.yandex.net (mxback20j.mail.yandex.net [IPv6:2a02:6b8:0:1619::114]) by forward103o.mail.yandex.net (Yandex) with ESMTP id D66B25883E67 for ; Tue, 13 Feb 2018 17:00:15 +0300 (MSK) Received: from smtp1o.mail.yandex.net (smtp1o.mail.yandex.net [2a02:6b8:0:1a2d::25]) by mxback20j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 6Gcw24KBd9-0FIS46ls; Tue, 13 Feb 2018 17:00:15 +0300 Received: by smtp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 6Ss5leStGE-0FFWKtqO; Tue, 13 Feb 2018 17:00:15 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Tue, 13 Feb 2018 17:00:07 +0300 Message-Id: <1518530410-18574-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518530410-18574-1-git-send-email-odpbot@yandex.ru> References: <1518530410-18574-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 472 Subject: [lng-odp] [PATCH v2 4/7] validation: packet: add IPv4 SCTP parse test 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: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen Added test for IPv4 / SCTP packet with payload data chunk type. Signed-off-by: Petri Savolainen --- /** Email created from pull request 472 (psavol:master-parser-validation) ** https://github.com/Linaro/odp/pull/472 ** Patch: https://github.com/Linaro/odp/pull/472.patch ** Base sha: 41b3fa2cd994a7ef68290a07dcde5564e4640847 ** Merge commit sha: 38d924655e8119f902e986011a477e1ad9094ab6 **/ test/common/test_packet_parser.h | 74 ++++++++++++++++++------------------- test/validation/api/packet/packet.c | 35 +++++++++++++++++- 2 files changed, 71 insertions(+), 38 deletions(-) diff --git a/test/common/test_packet_parser.h b/test/common/test_packet_parser.h index 918e0ad65..22c7e6c57 100644 --- a/test/common/test_packet_parser.h +++ b/test/common/test_packet_parser.h @@ -4,12 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -/** - * @file - * - * Test packets for parser tests - */ - #ifndef TEST_PACKET_PARSER_H_ #define TEST_PACKET_PARSER_H_ @@ -21,9 +15,7 @@ extern "C" { /* Test packets without CRC */ -/** - * ARP request - */ +/* ARP request */ static const uint8_t test_packet_arp[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x09, 0x00, 0x04, 0x00, 0x08, 0x06, 0x00, 0x01, @@ -35,9 +27,7 @@ static const uint8_t test_packet_arp[] = { 0x0E, 0x0F, 0x10, 0x11 }; -/** - * ICMPv4 echo reply - */ +/* ICMPv4 echo reply */ static const uint8_t test_packet_ipv4_icmp[] = { 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00, 0x09, 0x00, 0x04, 0x00, 0x08, 0x00, 0x45, 0x00, @@ -49,9 +39,7 @@ static const uint8_t test_packet_ipv4_icmp[] = { 0x0E, 0x0F, 0x10, 0x11 }; -/** - * IPv4 TCP - */ +/* IPv4 TCP */ static const uint8_t test_packet_ipv4_tcp[] = { 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00, 0x09, 0x00, 0x04, 0x00, 0x08, 0x00, 0x45, 0x00, @@ -63,9 +51,7 @@ static const uint8_t test_packet_ipv4_tcp[] = { 0x02, 0x03, 0x04, 0x05 }; -/** - * IPv4 UDP - */ +/* IPv4 UDP */ static const uint8_t test_packet_ipv4_udp[] = { 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00, 0x09, 0x00, 0x04, 0x00, 0x08, 0x00, 0x45, 0x00, @@ -77,9 +63,8 @@ static const uint8_t test_packet_ipv4_udp[] = { 0x0E, 0x0F, 0x10, 0x11 }; -/** - * VLAN IPv4 UDP - * - ID: 23 +/* VLAN IPv4 UDP + * - type 0x8100, tag 23 */ static const uint8_t test_packet_vlan_ipv4_udp[] = { 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00, @@ -92,10 +77,9 @@ static const uint8_t test_packet_vlan_ipv4_udp[] = { 0x0A, 0x0B, 0x0C, 0x0D }; -/** - * VLAN Q-in-Q IPv4 UDP - * - Outer: Tag Protocol ID 0x88a8, VLAN ID 1 - * - Inner: Tag Protocol ID 0x8100, VLAN ID 2 +/* VLAN Q-in-Q IPv4 UDP + * - Outer: type 0x88a8, tag 1 + * - Inner: type 0x8100, tag 2 */ static const uint8_t test_packet_vlan_qinq_ipv4_udp[] = { 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00, @@ -108,9 +92,7 @@ static const uint8_t test_packet_vlan_qinq_ipv4_udp[] = { 0x06, 0x07, 0x08, 0x09 }; -/** - * ICMPv6 echo request - */ +/* ICMPv6 echo request */ static const uint8_t test_packet_ipv6_icmp[] = { 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00, 0x09, 0x00, 0x04, 0x00, 0x86, 0xDD, 0x60, 0x30, @@ -122,9 +104,7 @@ static const uint8_t test_packet_ipv6_icmp[] = { 0x1B, 0xC2, 0x00, 0x01, 0x00, 0x02 }; -/** - * IPv6 TCP - */ +/* IPv6 TCP */ static const uint8_t test_packet_ipv6_tcp[] = { 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00, 0x09, 0x00, 0x04, 0x00, 0x86, 0xDD, 0x60, 0x30, @@ -138,9 +118,7 @@ static const uint8_t test_packet_ipv6_tcp[] = { 0x00, 0x00 }; -/** - * IPv6 UDP - */ +/* IPv6 UDP */ static const uint8_t test_packet_ipv6_udp[] = { 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00, 0x09, 0x00, 0x04, 0x00, 0x86, 0xDD, 0x60, 0x30, @@ -152,9 +130,8 @@ static const uint8_t test_packet_ipv6_udp[] = { 0x00, 0x3F, 0x00, 0x08, 0x9B, 0x68 }; -/** - * VLAN IPv6 - * - ID: 23 +/* VLAN IPv6 + * - type 0x8100, tag 23 */ static const uint8_t test_packet_vlan_ipv6_udp[] = { 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00, @@ -168,6 +145,29 @@ static const uint8_t test_packet_vlan_ipv6_udp[] = { 0x9B, 0x68 }; +/* IPv4 SCTP + * - chunk type: payload data + */ +static const uint8_t test_packet_ipv4_sctp[] = { + 0x00, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x00, 0x01, + 0x02, 0x03, 0x04, 0x05, 0x08, 0x00, 0x45, 0x00, + 0x00, 0x77, 0x00, 0x01, 0x00, 0x00, 0x40, 0x84, + 0xF8, 0xAE, 0xC0, 0xA8, 0x00, 0x01, 0xC0, 0xA8, + 0x00, 0x02, 0x04, 0xD2, 0x16, 0x2E, 0xDE, 0xAD, + 0xBE, 0xEF, 0x31, 0x44, 0xE3, 0xFE, 0x00, 0x00, + 0x00, 0x57, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x68, + 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x6D, 0x79, + 0x20, 0x64, 0x75, 0x6D, 0x6D, 0x79, 0x20, 0x70, + 0x61, 0x79, 0x6C, 0x6F, 0x61, 0x64, 0x20, 0x73, + 0x74, 0x72, 0x69, 0x6E, 0x67, 0x2E, 0x20, 0x54, + 0x68, 0x65, 0x20, 0x6C, 0x65, 0x6E, 0x67, 0x74, + 0x68, 0x20, 0x6F, 0x66, 0x20, 0x74, 0x68, 0x69, + 0x73, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6E, 0x67, + 0x20, 0x69, 0x73, 0x20, 0x37, 0x31, 0x20, 0x62, + 0x79, 0x74, 0x65, 0x73, 0x2E +}; + #ifdef __cplusplus } #endif diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c index ea7e89b2f..ad5520408 100644 --- a/test/validation/api/packet/packet.c +++ b/test/validation/api/packet/packet.c @@ -60,7 +60,8 @@ static uint32_t parse_test_pkt_len[] = { sizeof(test_packet_ipv6_icmp), sizeof(test_packet_ipv6_tcp), sizeof(test_packet_ipv6_udp), - sizeof(test_packet_vlan_ipv6_udp) + sizeof(test_packet_vlan_ipv6_udp), + sizeof(test_packet_ipv4_sctp) }; #define packet_compare_offset(pkt1, off1, pkt2, off2, len) \ @@ -2891,6 +2892,37 @@ static void parse_eth_ipv6_icmp(void) odp_packet_free_multi(pkt, num_pkt); } +/* Ethernet/IPv4/SCTP */ +static void parse_eth_ipv4_sctp(void) +{ + odp_packet_parse_param_t parse; + int i; + int num_pkt = PARSE_TEST_NUM_PKT; + odp_packet_t pkt[num_pkt]; + + parse_test_alloc(pkt, test_packet_ipv4_sctp, + sizeof(test_packet_ipv4_sctp)); + + parse.proto = ODP_PROTO_ETH; + parse.last_layer = ODP_PROTO_LAYER_L4; + parse.chksums.all_chksum = 0; + + CU_ASSERT(odp_packet_parse(pkt[0], 0, &parse) == 0); + CU_ASSERT(odp_packet_parse_multi(&pkt[1], parse_test.offset_zero, + num_pkt - 1, &parse) == (num_pkt - 1)); + + for (i = 0; i < num_pkt; i++) { + CU_ASSERT(odp_packet_has_eth(pkt[i])); + CU_ASSERT(odp_packet_has_ipv4(pkt[i])); + CU_ASSERT(odp_packet_has_sctp(pkt[i])); + CU_ASSERT(!odp_packet_has_ipv6(pkt[i])); + CU_ASSERT(!odp_packet_has_tcp(pkt[i])); + CU_ASSERT(!odp_packet_has_udp(pkt[i])); + } + + odp_packet_free_multi(pkt, num_pkt); +} + odp_testinfo_t packet_suite[] = { ODP_TEST_INFO(packet_test_alloc_free), ODP_TEST_INFO(packet_test_alloc_free_multi), @@ -2937,6 +2969,7 @@ odp_testinfo_t packet_parse_suite[] = { ODP_TEST_INFO(parse_eth_arp), ODP_TEST_INFO(parse_eth_ipv4_icmp), ODP_TEST_INFO(parse_eth_ipv6_icmp), + ODP_TEST_INFO(parse_eth_ipv4_sctp), ODP_TEST_INFO_NULL, }; From patchwork Tue Feb 13 14:00:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 128239 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp4284763ljc; Tue, 13 Feb 2018 06:03:50 -0800 (PST) X-Google-Smtp-Source: AH8x225+nkGp1itW/IkzqBG/eczkcZ6pk2SPqkp0YHJYNcOBX3TSHe8E96C+TJkuLCAjLHNoazA8 X-Received: by 10.200.24.152 with SMTP id s24mr2008064qtj.239.1518530630088; Tue, 13 Feb 2018 06:03:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518530630; cv=none; d=google.com; s=arc-20160816; b=xD5/yOFXXjF2rZFTdDmh4H43M00AQhgnvWNoOt6XjfH0/itjgBseqqGNbEmfnZyXNx WgkfOeXXmeFxcLrWPchsm8+bZKPaFwC7S17h+3vCgsYj3nDR27hKzAtSDdcRp1b6IITl 1IxuI3DDHRmPOos9utHxdZWKJF/CkF7UZcCp4KYAmvJFLeh9YPQbF1FA8S0uw2MMJ30K 13z47rSg72JQMnMeQyfdCLmt7HzC/dwiCGsx0RyuEMcQ45urtOaiacT3YkKfIaNpTaHc 7abhaEEEsoXQY9erM5WYlupfnFks9n0NwzfQR0wm9t/rB3vqKfASNM7y7azZU95nPeZQ 8Yaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=3paAO+OXS3ZPEZk89KQMsSLkqe6BdRAX194Yo3h5ktM=; b=peC4HbWUwCR6r9rD5BnPDvLm+oIN8+Er4Hot08rdtK6ReON1nu7mU/o0eF1Vkjlz12 xecEeILETasgf2bg7BPAJzmiWWGESOEaUlP/XVKrd2SkTI8FpIor+7mO6lExGLx6aont BRfaxUapKq7z1Ql3ueAtued2ZB5nAt2+pKBev+T/6UHTLQVQmOUpDz/PXgh9JPwxI4Hc Aw350J/3eTrSXpFq4ZWwCG4h7g9S6nYiny0lDTNBP8oZzx8kj2Bzq2bAlCuF/WsGXtoF QbsixDncsBZFqJTugEfEwfpG+S+jY1NdY6P00tltcL/6+6vDsP2rfBCQXQdW1RMgIkzz 5l6A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id h48si1051244qta.136.2018.02.13.06.03.39; Tue, 13 Feb 2018 06:03:50 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 30AA961724; Tue, 13 Feb 2018 14:03:39 +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,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW 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 79AF561555; Tue, 13 Feb 2018 14:00:41 +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 69186608A2; Tue, 13 Feb 2018 14:00:25 +0000 (UTC) Received: from forward104p.mail.yandex.net (forward104p.mail.yandex.net [77.88.28.107]) by lists.linaro.org (Postfix) with ESMTPS id 06D0561510 for ; Tue, 13 Feb 2018 14:00:18 +0000 (UTC) Received: from mxback8j.mail.yandex.net (mxback8j.mail.yandex.net [IPv6:2a02:6b8:0:1619::111]) by forward104p.mail.yandex.net (Yandex) with ESMTP id 973B8184FDC for ; Tue, 13 Feb 2018 17:00:16 +0300 (MSK) Received: from smtp1o.mail.yandex.net (smtp1o.mail.yandex.net [2a02:6b8:0:1a2d::25]) by mxback8j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id bi9uRAMC59-0G6e5kDe; Tue, 13 Feb 2018 17:00:16 +0300 Received: by smtp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 6Ss5leStGE-0FF8qD4i; Tue, 13 Feb 2018 17:00:15 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Tue, 13 Feb 2018 17:00:08 +0300 Message-Id: <1518530410-18574-6-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518530410-18574-1-git-send-email-odpbot@yandex.ru> References: <1518530410-18574-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 472 Subject: [lng-odp] [PATCH v2 5/7] validation: packet: add IPSEC parse test 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: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen Added test cases for IPSEC. AH and ESP headers with both IP versions. Signed-off-by: Petri Savolainen --- /** Email created from pull request 472 (psavol:master-parser-validation) ** https://github.com/Linaro/odp/pull/472 ** Patch: https://github.com/Linaro/odp/pull/472.patch ** Base sha: 41b3fa2cd994a7ef68290a07dcde5564e4640847 ** Merge commit sha: 38d924655e8119f902e986011a477e1ad9094ab6 **/ test/common/test_packet_parser.h | 165 ++++++++++++++++++++++++++++++++++++ test/validation/api/packet/packet.c | 134 ++++++++++++++++++++++++++++- 2 files changed, 298 insertions(+), 1 deletion(-) diff --git a/test/common/test_packet_parser.h b/test/common/test_packet_parser.h index 22c7e6c57..b7d02113e 100644 --- a/test/common/test_packet_parser.h +++ b/test/common/test_packet_parser.h @@ -168,6 +168,171 @@ static const uint8_t test_packet_ipv4_sctp[] = { 0x79, 0x74, 0x65, 0x73, 0x2E }; +static const uint8_t test_packet_ipv4_ipsec_ah[] = { + /* ETH */ + 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, + 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00, + + /* IPv4 */ + 0x45, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x00, + 0x40, 0x33, 0xab, 0xd9, 0xc0, 0xa8, 0x6f, 0x02, + 0xc0, 0xa8, 0xde, 0x02, + + /* AH */ + 0x01, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7b, + 0x00, 0x00, 0x00, 0x01, + 0x6c, 0x2e, 0xf7, 0x1f, 0x7c, 0x70, 0x39, 0xa3, + 0x4a, 0x77, 0x01, 0x47, 0x9e, 0x45, 0x73, 0x51, + + /* ICMP */ + 0x08, 0x00, 0xfb, 0x37, 0x12, 0x34, 0x00, 0x00, + 0xba, 0xbe, 0x01, 0x23, 0x45, 0x67, 0xca, 0xfe, + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5a, 0x5b +}; + +static const uint8_t test_packet_ipv4_ipsec_esp[] = { + /* ETH */ + 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, + 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00, + + /* IPv4 */ + 0x45, 0x00, 0x00, 0xb0, 0x00, 0x00, 0x00, 0x00, + 0x40, 0x32, 0x19, 0x18, 0x0a, 0x00, 0x6f, 0x02, + 0x0a, 0x00, 0xde, 0x02, + + /* ESP */ + 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x01, + + /* IPv4 */ + 0x45, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, + 0x40, 0x01, 0xac, 0x27, 0xc0, 0xa8, 0x6f, 0x02, + 0xc0, 0xa8, 0xde, 0x02, + + /* ICMP */ + 0x08, 0x00, 0xfb, 0x37, 0x12, 0x34, 0x00, 0x00, + 0xba, 0xbe, 0x01, 0x23, 0x45, 0x67, 0xca, 0xfe, + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5a, 0x5b, + + /* ESP TRL */ + 0x01, 0x02, 0x02, 0x04, + + /* ICV */ + 0x73, 0x8d, 0xf6, 0x9a, 0x26, 0x06, 0x4d, 0xa1, + 0x88, 0x37, 0x65, 0xab, 0x0d, 0xe9, 0x95, 0x3b +}; + +static const uint8_t test_packet_ipv6_ipsec_ah[] = { + /* ETH */ + 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, + 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x86, 0xdd, + + /* IPv6 */ + 0x60, 0x00, 0x00, 0x00, 0x00, 0xbc, 0x33, 0x40, + 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, + 0x02, 0x11, 0x43, 0xff, 0xfe, 0x4a, 0xd7, 0x0a, + 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, + + /* AH */ + 0x29, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7b, + 0x00, 0x00, 0x00, 0x01, + 0x62, 0x96, 0x2b, 0x40, 0x3e, 0x53, 0x76, 0x4a, + 0x4d, 0x7f, 0xf6, 0x22, 0x35, 0x3c, 0x74, 0xe2, + 0x00, 0x00, 0x00, 0x00, + + /* IPv6 */ + 0x60, 0x00, 0x00, 0x00, 0x00, 0x74, 0x00, 0x40, + 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, + 0x02, 0x11, 0x43, 0xff, 0xfe, 0x4a, 0xd7, 0x0a, + 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, + + /* Hop-by-Hop */ + 0x3a, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, + + /* ICMP */ + 0x08, 0x00, 0xfb, 0x37, 0x12, 0x34, 0x00, 0x00, + 0xba, 0xbe, 0x01, 0x23, 0x45, 0x67, 0xca, 0xfe, + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5a, 0x5b +}; + +static const uint8_t test_packet_ipv6_ipsec_esp[] = { + /* ETH */ + 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, + 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x86, 0xdd, + + /* IPv6 */ + 0x60, 0x00, 0x00, 0x00, 0x00, 0x9c, 0x32, 0x40, + 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, + 0x02, 0x11, 0x43, 0xff, 0xfe, 0x4a, 0xd7, 0x0a, + 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, + + /* ESP */ + 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x01, + + /* IPv4 */ + 0x45, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, + 0x40, 0x01, 0xac, 0x27, 0xc0, 0xa8, 0x6f, 0x02, + 0xc0, 0xa8, 0xde, 0x02, + + /* ICMP */ + 0x08, 0x00, 0xfb, 0x37, 0x12, 0x34, 0x00, 0x00, + 0xba, 0xbe, 0x01, 0x23, 0x45, 0x67, 0xca, 0xfe, + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5a, 0x5b, + + /* ESP TRL */ + 0x01, 0x02, 0x02, 0x04, + + /* ICV */ + 0x73, 0x8d, 0xf6, 0x9a, 0x26, 0x06, 0x4d, 0xa1, + 0x88, 0x37, 0x65, 0xab, 0x0d, 0xe9, 0x95, 0x3b +}; + #ifdef __cplusplus } #endif diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c index ad5520408..ccfe6e512 100644 --- a/test/validation/api/packet/packet.c +++ b/test/validation/api/packet/packet.c @@ -61,7 +61,11 @@ static uint32_t parse_test_pkt_len[] = { sizeof(test_packet_ipv6_tcp), sizeof(test_packet_ipv6_udp), sizeof(test_packet_vlan_ipv6_udp), - sizeof(test_packet_ipv4_sctp) + sizeof(test_packet_ipv4_sctp), + sizeof(test_packet_ipv4_ipsec_ah), + sizeof(test_packet_ipv4_ipsec_esp), + sizeof(test_packet_ipv6_ipsec_ah), + sizeof(test_packet_ipv6_ipsec_esp) }; #define packet_compare_offset(pkt1, off1, pkt2, off2, len) \ @@ -2923,6 +2927,130 @@ static void parse_eth_ipv4_sctp(void) odp_packet_free_multi(pkt, num_pkt); } +/* Ethernet/IPv4/IPSEC AH*/ +static void parse_eth_ipv4_ipsec_ah(void) +{ + odp_packet_parse_param_t parse; + int i; + int num_pkt = PARSE_TEST_NUM_PKT; + odp_packet_t pkt[num_pkt]; + + parse_test_alloc(pkt, test_packet_ipv4_ipsec_ah, + sizeof(test_packet_ipv4_ipsec_ah)); + + parse.proto = ODP_PROTO_ETH; + parse.last_layer = ODP_PROTO_LAYER_L4; + parse.chksums.all_chksum = 0; + + CU_ASSERT(odp_packet_parse(pkt[0], 0, &parse) == 0); + CU_ASSERT(odp_packet_parse_multi(&pkt[1], parse_test.offset_zero, + num_pkt - 1, &parse) == (num_pkt - 1)); + + for (i = 0; i < num_pkt; i++) { + CU_ASSERT(odp_packet_has_eth(pkt[i])); + CU_ASSERT(odp_packet_has_ipv4(pkt[i])); + CU_ASSERT(odp_packet_has_ipsec(pkt[i])); + CU_ASSERT(!odp_packet_has_ipv6(pkt[i])); + CU_ASSERT(!odp_packet_has_tcp(pkt[i])); + CU_ASSERT(!odp_packet_has_udp(pkt[i])); + } + + odp_packet_free_multi(pkt, num_pkt); +} + +/* Ethernet/IPv4/IPSEC ESP*/ +static void parse_eth_ipv4_ipsec_esp(void) +{ + odp_packet_parse_param_t parse; + int i; + int num_pkt = PARSE_TEST_NUM_PKT; + odp_packet_t pkt[num_pkt]; + + parse_test_alloc(pkt, test_packet_ipv4_ipsec_esp, + sizeof(test_packet_ipv4_ipsec_esp)); + + parse.proto = ODP_PROTO_ETH; + parse.last_layer = ODP_PROTO_LAYER_L4; + parse.chksums.all_chksum = 0; + + CU_ASSERT(odp_packet_parse(pkt[0], 0, &parse) == 0); + CU_ASSERT(odp_packet_parse_multi(&pkt[1], parse_test.offset_zero, + num_pkt - 1, &parse) == (num_pkt - 1)); + + for (i = 0; i < num_pkt; i++) { + CU_ASSERT(odp_packet_has_eth(pkt[i])); + CU_ASSERT(odp_packet_has_ipv4(pkt[i])); + CU_ASSERT(odp_packet_has_ipsec(pkt[i])); + CU_ASSERT(!odp_packet_has_ipv6(pkt[i])); + CU_ASSERT(!odp_packet_has_tcp(pkt[i])); + CU_ASSERT(!odp_packet_has_udp(pkt[i])); + } + + odp_packet_free_multi(pkt, num_pkt); +} + +/* Ethernet/IPv6/IPSEC AH*/ +static void parse_eth_ipv6_ipsec_ah(void) +{ + odp_packet_parse_param_t parse; + int i; + int num_pkt = PARSE_TEST_NUM_PKT; + odp_packet_t pkt[num_pkt]; + + parse_test_alloc(pkt, test_packet_ipv6_ipsec_ah, + sizeof(test_packet_ipv6_ipsec_ah)); + + parse.proto = ODP_PROTO_ETH; + parse.last_layer = ODP_PROTO_LAYER_L4; + parse.chksums.all_chksum = 0; + + CU_ASSERT(odp_packet_parse(pkt[0], 0, &parse) == 0); + CU_ASSERT(odp_packet_parse_multi(&pkt[1], parse_test.offset_zero, + num_pkt - 1, &parse) == (num_pkt - 1)); + + for (i = 0; i < num_pkt; i++) { + CU_ASSERT(odp_packet_has_eth(pkt[i])); + CU_ASSERT(odp_packet_has_ipv6(pkt[i])); + CU_ASSERT(odp_packet_has_ipsec(pkt[i])); + CU_ASSERT(!odp_packet_has_ipv4(pkt[i])); + CU_ASSERT(!odp_packet_has_tcp(pkt[i])); + CU_ASSERT(!odp_packet_has_udp(pkt[i])); + } + + odp_packet_free_multi(pkt, num_pkt); +} + +/* Ethernet/IPv6/IPSEC ESP*/ +static void parse_eth_ipv6_ipsec_esp(void) +{ + odp_packet_parse_param_t parse; + int i; + int num_pkt = PARSE_TEST_NUM_PKT; + odp_packet_t pkt[num_pkt]; + + parse_test_alloc(pkt, test_packet_ipv6_ipsec_esp, + sizeof(test_packet_ipv6_ipsec_esp)); + + parse.proto = ODP_PROTO_ETH; + parse.last_layer = ODP_PROTO_LAYER_L4; + parse.chksums.all_chksum = 0; + + CU_ASSERT(odp_packet_parse(pkt[0], 0, &parse) == 0); + CU_ASSERT(odp_packet_parse_multi(&pkt[1], parse_test.offset_zero, + num_pkt - 1, &parse) == (num_pkt - 1)); + + for (i = 0; i < num_pkt; i++) { + CU_ASSERT(odp_packet_has_eth(pkt[i])); + CU_ASSERT(odp_packet_has_ipv6(pkt[i])); + CU_ASSERT(odp_packet_has_ipsec(pkt[i])); + CU_ASSERT(!odp_packet_has_ipv4(pkt[i])); + CU_ASSERT(!odp_packet_has_tcp(pkt[i])); + CU_ASSERT(!odp_packet_has_udp(pkt[i])); + } + + odp_packet_free_multi(pkt, num_pkt); +} + odp_testinfo_t packet_suite[] = { ODP_TEST_INFO(packet_test_alloc_free), ODP_TEST_INFO(packet_test_alloc_free_multi), @@ -2970,6 +3098,10 @@ odp_testinfo_t packet_parse_suite[] = { ODP_TEST_INFO(parse_eth_ipv4_icmp), ODP_TEST_INFO(parse_eth_ipv6_icmp), ODP_TEST_INFO(parse_eth_ipv4_sctp), + ODP_TEST_INFO(parse_eth_ipv4_ipsec_ah), + ODP_TEST_INFO(parse_eth_ipv4_ipsec_esp), + ODP_TEST_INFO(parse_eth_ipv6_ipsec_ah), + ODP_TEST_INFO(parse_eth_ipv6_ipsec_esp), ODP_TEST_INFO_NULL, }; From patchwork Tue Feb 13 14:00:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 128240 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp4285950ljc; Tue, 13 Feb 2018 06:04:55 -0800 (PST) X-Google-Smtp-Source: AH8x226TPEYe6/2AOcnyr8sARUXcD3il7uj/IFVEhkWoLYqa7bEGVVo7M6nyizZ8lFBRUClG/dD2 X-Received: by 10.237.59.201 with SMTP id s9mr1972449qte.83.1518530695359; Tue, 13 Feb 2018 06:04:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518530695; cv=none; d=google.com; s=arc-20160816; b=bZq4oJpTCEJFXR1xQ5/aE0ld6/jk50zatTVqsFhnQTqg1aTuBH07ikQj00UkcPESnh AzNI8ynE34UuLv9mYA3TT5PLDUhq7MTbqnA3CaHwhLNumjQSIrybCQ81nQcaZ/vUiDA2 rbojqupC8XGc5FOx7aS0nP2A8SyxU2i5OyU2Drkb1l0STCZwvwU+3tq/8n35nT+vGORl nbrPCrSbG8EvV7Z9oMbhsyrEj7IXY48mHZZ5oXY31aGFVHckB939eZiu6MNdjPjQ3Uih ZWezE6WTZERYdUhRhAfyi3abfmLuEw/YOpJCnvQW9qmH0/4kYxsL/R54wR/8nyXbh/q1 fYtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=c+WeaMLEGED9JfSP/5JRgnZs3kQxwLaeYHXUsrwbjVo=; b=UasyzQ1T+83alnlbVlb1sb6X7NMYDsmqTvzUX/zh60jU2fdRPgaqWD/dwL3C6AhQVZ YM4165gwFUc50LZ/j6vbsuZq75mB2TS/kqPvhHqgAg5eZIF8xC0GAH4UzufMolc+X5Sn X8+zc7R+ybpnHGgo+Krc/ILPKwOKNVNcUFpwU4p069v+2jwjCpguKZvdTNQUOhkRdZRm ScAVY6jOwA1lWPOyzaG1lph/1LLInuVn1YwOANAz5pROFQJDeT+LkynGTpXV64XO8Fnn 3vYUBEF4TuIT1I3cKodMyMmJIWg0LUk8LYqsf5rNF6QCUzNso+St+NWXW8SK6HyfPpQx Q/Kg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id l2si2260837qkd.70.2018.02.13.06.04.51; Tue, 13 Feb 2018 06:04:55 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 9DFD36175E; Tue, 13 Feb 2018 14:04:51 +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,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 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 CE3906151E; Tue, 13 Feb 2018 14:00:43 +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 3941A608A2; Tue, 13 Feb 2018 14:00:26 +0000 (UTC) Received: from forward101j.mail.yandex.net (forward101j.mail.yandex.net [5.45.198.241]) by lists.linaro.org (Postfix) with ESMTPS id 6F1AE616DA for ; Tue, 13 Feb 2018 14:00:18 +0000 (UTC) Received: from mxback8o.mail.yandex.net (mxback8o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::22]) by forward101j.mail.yandex.net (Yandex) with ESMTP id 21AD81242030 for ; Tue, 13 Feb 2018 17:00:17 +0300 (MSK) Received: from smtp1o.mail.yandex.net (smtp1o.mail.yandex.net [2a02:6b8:0:1a2d::25]) by mxback8o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id e6cAiLzgcE-0HV4cC8U; Tue, 13 Feb 2018 17:00:17 +0300 Received: by smtp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 6Ss5leStGE-0GFuNtPF; Tue, 13 Feb 2018 17:00:16 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Tue, 13 Feb 2018 17:00:09 +0300 Message-Id: <1518530410-18574-7-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518530410-18574-1-git-send-email-odpbot@yandex.ru> References: <1518530410-18574-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 472 Subject: [lng-odp] [PATCH v2 6/7] linux-gen: packet: fix IP multicast parse 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: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen IPv4 multicast address range is between 224.0.0.0 and 239.255.255.255. So, first four bits are always 0xe (1110). Signed-off-by: Petri Savolainen --- /** Email created from pull request 472 (psavol:master-parser-validation) ** https://github.com/Linaro/odp/pull/472 ** Patch: https://github.com/Linaro/odp/pull/472.patch ** Base sha: 41b3fa2cd994a7ef68290a07dcde5564e4640847 ** Merge commit sha: 38d924655e8119f902e986011a477e1ad9094ab6 **/ platform/linux-generic/odp_packet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index b2a22903c..05b8c4854 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -2028,7 +2028,7 @@ static inline uint8_t parse_ipv4(packet_parser_t *prs, const uint8_t **parseptr, if (odp_unlikely(dstaddr == 0xffffffff)) prs->input_flags.ip_bcast = 1; - if (odp_unlikely((dstaddr >> 28) == 0xd)) + if (odp_unlikely((dstaddr >> 28) == 0xe)) prs->input_flags.ip_mcast = 1; return ipv4->proto; From patchwork Tue Feb 13 14:00:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 128241 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp4286669ljc; Tue, 13 Feb 2018 06:05:38 -0800 (PST) X-Google-Smtp-Source: AH8x224WgGdAPVbaS3NQaTMTukFv9f9AhdzEqlVYANnOAxBHso/v8IjnvBIe1J3gM6H6WA3jA4DJ X-Received: by 10.237.37.196 with SMTP id y4mr2193143qtc.182.1518530738141; Tue, 13 Feb 2018 06:05:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518530738; cv=none; d=google.com; s=arc-20160816; b=SnrvQ/VIWmcGlGAkBnq2bXcK7ubdbTKM1JznDU0xYvreaQkqCdoyeBSsaziAqlBcp7 sN593t9hyAxubqxDD3aeuMvuriUaPvh6MyxuM/MH3rhtw3QYDcCBvQro+zF4hd1QcE5v YLeQQHcKZbcXavqqRgmOqjMCtU7oBlKXcLe7qzLu1aBJXrhqia67so9V0lrKAcLTttRo BA3AnCPP2kLv7ykM8KZMA+OaQ4DS4D8inBj1jZWQkJNKMHwSAeDLF9W4FxjPTUgoXHUN 8+zZxN7QZvtKIHJnyh+/LNYIHfsWLulOGhCpgb1Gglaf0eNwUf+dlmJ45tlgDEdDHC4J mOdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=JGSbF3jEmtAEpZDu31FHb5ixhzjUTIFekR+c1wyHPEw=; b=Zx/ACREUXNg+9MnvbzmlVs4AWKEk4UizK8SrS3eKk1O+LfL05MGISVWXc6gsU2Cjbh IOTMNuEe2i02t//3IfrqWwHjw/x/NxtlOsT7WoIijvjbU0UwQtco6P1J+SPZt/PpaYT7 AvjmMwk0bkhQ5CQLaTay7lzVgP7xOYQ9+XDqfuAJSaD5WtxRvPdMcDPVoFcjgAwSIpr3 vqDDbYMfxJUMuUZWj1IV4FJ2BVchMXaewi82HtrDm8/MGiMfvbJLbqxl/gjJD6DkDVlr 2JTrZTdrmv7RgoLLLjsdhcqfAFqKAptu3pIZjbe6sO85KgKYO++5H9lhNw80k0bCmM1j Q1Mg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id x4si5125533qkl.113.2018.02.13.06.05.37; Tue, 13 Feb 2018 06:05:38 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id CAF9660855; Tue, 13 Feb 2018 14:05:37 +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,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 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 1A724616F9; Tue, 13 Feb 2018 14:00:47 +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 C938D60928; Tue, 13 Feb 2018 14:00:26 +0000 (UTC) Received: from forward101o.mail.yandex.net (forward101o.mail.yandex.net [37.140.190.181]) by lists.linaro.org (Postfix) with ESMTPS id 5AF9B60C5E for ; Tue, 13 Feb 2018 14:00:19 +0000 (UTC) Received: from mxback20j.mail.yandex.net (mxback20j.mail.yandex.net [IPv6:2a02:6b8:0:1619::114]) by forward101o.mail.yandex.net (Yandex) with ESMTP id D49DD1341F97 for ; Tue, 13 Feb 2018 17:00:17 +0300 (MSK) Received: from smtp1o.mail.yandex.net (smtp1o.mail.yandex.net [2a02:6b8:0:1a2d::25]) by mxback20j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id IXBW65Z65s-0HI0WMQg; Tue, 13 Feb 2018 17:00:17 +0300 Received: by smtp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 6Ss5leStGE-0HFe50Ig; Tue, 13 Feb 2018 17:00:17 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Tue, 13 Feb 2018 17:00:10 +0300 Message-Id: <1518530410-18574-8-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518530410-18574-1-git-send-email-odpbot@yandex.ru> References: <1518530410-18574-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 472 Subject: [lng-odp] [PATCH v2 7/7] validation: packet: add IP multicast tests 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: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen Added test cases for Ethernet/IP multi- and broadcasts. Signed-off-by: Petri Savolainen --- /** Email created from pull request 472 (psavol:master-parser-validation) ** https://github.com/Linaro/odp/pull/472 ** Patch: https://github.com/Linaro/odp/pull/472.patch ** Base sha: 41b3fa2cd994a7ef68290a07dcde5564e4640847 ** Merge commit sha: 38d924655e8119f902e986011a477e1ad9094ab6 **/ test/common/test_packet_parser.h | 56 ++++++++++++++++++ test/validation/api/packet/packet.c | 111 +++++++++++++++++++++++++++++++++++- 2 files changed, 166 insertions(+), 1 deletion(-) diff --git a/test/common/test_packet_parser.h b/test/common/test_packet_parser.h index b7d02113e..d0a0582ab 100644 --- a/test/common/test_packet_parser.h +++ b/test/common/test_packet_parser.h @@ -333,6 +333,62 @@ static const uint8_t test_packet_ipv6_ipsec_esp[] = { 0x88, 0x37, 0x65, 0xab, 0x0d, 0xe9, 0x95, 0x3b }; +static const uint8_t test_packet_mcast_eth_ipv4_udp[] = { + 0x03, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x02, 0x00, + 0x00, 0x03, 0x04, 0x05, 0x08, 0x00, 0x45, 0x00, + 0x00, 0x63, 0x00, 0x01, 0x00, 0x00, 0x40, 0x11, + 0xC8, 0xDB, 0xC0, 0xA8, 0x00, 0x01, 0xEF, 0x01, + 0x02, 0x03, 0x04, 0xD2, 0x16, 0x2E, 0x00, 0x4F, + 0x25, 0x61, 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, + 0x73, 0x20, 0x6D, 0x79, 0x20, 0x64, 0x75, 0x6D, + 0x6D, 0x79, 0x20, 0x70, 0x61, 0x79, 0x6C, 0x6F, + 0x61, 0x64, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6E, + 0x67, 0x2E, 0x20, 0x54, 0x68, 0x65, 0x20, 0x6C, + 0x65, 0x6E, 0x67, 0x74, 0x68, 0x20, 0x6F, 0x66, + 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x73, 0x74, + 0x72, 0x69, 0x6E, 0x67, 0x20, 0x69, 0x73, 0x20, + 0x37, 0x31, 0x20, 0x62, 0x79, 0x74, 0x65, 0x73, + 0x2E +}; + +static const uint8_t test_packet_bcast_eth_ipv4_udp[] = { + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x02, 0x00, + 0x00, 0x03, 0x04, 0x05, 0x08, 0x00, 0x45, 0x00, + 0x00, 0x63, 0x00, 0x01, 0x00, 0x00, 0x40, 0x11, + 0xB9, 0xE0, 0xC0, 0xA8, 0x00, 0x01, 0xFF, 0xFF, + 0xFF, 0xFF, 0x04, 0xD2, 0x16, 0x2E, 0x00, 0x4F, + 0x16, 0x66, 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, + 0x73, 0x20, 0x6D, 0x79, 0x20, 0x64, 0x75, 0x6D, + 0x6D, 0x79, 0x20, 0x70, 0x61, 0x79, 0x6C, 0x6F, + 0x61, 0x64, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6E, + 0x67, 0x2E, 0x20, 0x54, 0x68, 0x65, 0x20, 0x6C, + 0x65, 0x6E, 0x67, 0x74, 0x68, 0x20, 0x6F, 0x66, + 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x73, 0x74, + 0x72, 0x69, 0x6E, 0x67, 0x20, 0x69, 0x73, 0x20, + 0x37, 0x31, 0x20, 0x62, 0x79, 0x74, 0x65, 0x73, + 0x2E +}; + +static const uint8_t test_packet_mcast_eth_ipv6_udp[] = { + 0x33, 0x33, 0x01, 0x02, 0x03, 0x04, 0x02, 0x00, + 0x00, 0x03, 0x04, 0x05, 0x86, 0xDD, 0x60, 0x00, + 0x00, 0x00, 0x00, 0x4F, 0x11, 0x40, 0xFE, 0x80, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xFF, 0xFE, 0x03, 0x04, 0x05, 0xFF, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x02, 0x00, 0x03, 0x00, 0x04, 0x04, 0xD2, + 0x16, 0x2E, 0x00, 0x4F, 0xD6, 0x79, 0x54, 0x68, + 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x6D, 0x79, + 0x20, 0x64, 0x75, 0x6D, 0x6D, 0x79, 0x20, 0x70, + 0x61, 0x79, 0x6C, 0x6F, 0x61, 0x64, 0x20, 0x73, + 0x74, 0x72, 0x69, 0x6E, 0x67, 0x2E, 0x20, 0x54, + 0x68, 0x65, 0x20, 0x6C, 0x65, 0x6E, 0x67, 0x74, + 0x68, 0x20, 0x6F, 0x66, 0x20, 0x74, 0x68, 0x69, + 0x73, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6E, 0x67, + 0x20, 0x69, 0x73, 0x20, 0x37, 0x31, 0x20, 0x62, + 0x79, 0x74, 0x65, 0x73, 0x2E +}; + #ifdef __cplusplus } #endif diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c index ccfe6e512..db3a47cf8 100644 --- a/test/validation/api/packet/packet.c +++ b/test/validation/api/packet/packet.c @@ -65,7 +65,10 @@ static uint32_t parse_test_pkt_len[] = { sizeof(test_packet_ipv4_ipsec_ah), sizeof(test_packet_ipv4_ipsec_esp), sizeof(test_packet_ipv6_ipsec_ah), - sizeof(test_packet_ipv6_ipsec_esp) + sizeof(test_packet_ipv6_ipsec_esp), + sizeof(test_packet_mcast_eth_ipv4_udp), + sizeof(test_packet_bcast_eth_ipv4_udp), + sizeof(test_packet_mcast_eth_ipv6_udp) }; #define packet_compare_offset(pkt1, off1, pkt2, off2, len) \ @@ -3051,6 +3054,109 @@ static void parse_eth_ipv6_ipsec_esp(void) odp_packet_free_multi(pkt, num_pkt); } +/* Ethernet mcast/IPv4 mcast/UDP */ +static void parse_mcast_eth_ipv4_udp(void) +{ + odp_packet_parse_param_t parse; + int i; + int num_pkt = PARSE_TEST_NUM_PKT; + odp_packet_t pkt[num_pkt]; + + parse_test_alloc(pkt, test_packet_mcast_eth_ipv4_udp, + sizeof(test_packet_mcast_eth_ipv4_udp)); + + parse.proto = ODP_PROTO_ETH; + parse.last_layer = ODP_PROTO_LAYER_L4; + parse.chksums.all_chksum = 0; + + CU_ASSERT(odp_packet_parse(pkt[0], 0, &parse) == 0); + CU_ASSERT(odp_packet_parse_multi(&pkt[1], parse_test.offset_zero, + num_pkt - 1, &parse) == (num_pkt - 1)); + + for (i = 0; i < num_pkt; i++) { + CU_ASSERT(odp_packet_has_eth(pkt[i])); + CU_ASSERT(odp_packet_has_eth_mcast(pkt[i])); + CU_ASSERT(odp_packet_has_ipv4(pkt[i])); + CU_ASSERT(odp_packet_has_ip_mcast(pkt[i])); + CU_ASSERT(odp_packet_has_udp(pkt[i])); + CU_ASSERT(!odp_packet_has_ipv6(pkt[i])); + CU_ASSERT(!odp_packet_has_tcp(pkt[i])); + CU_ASSERT(!odp_packet_has_eth_bcast(pkt[i])); + CU_ASSERT(!odp_packet_has_ip_bcast(pkt[i])); + } + + odp_packet_free_multi(pkt, num_pkt); +} + +/* Ethernet bcast/IPv4 bcast/UDP */ +static void parse_bcast_eth_ipv4_udp(void) +{ + odp_packet_parse_param_t parse; + int i; + int num_pkt = PARSE_TEST_NUM_PKT; + odp_packet_t pkt[num_pkt]; + + parse_test_alloc(pkt, test_packet_bcast_eth_ipv4_udp, + sizeof(test_packet_bcast_eth_ipv4_udp)); + + parse.proto = ODP_PROTO_ETH; + parse.last_layer = ODP_PROTO_LAYER_L4; + parse.chksums.all_chksum = 0; + + CU_ASSERT(odp_packet_parse(pkt[0], 0, &parse) == 0); + CU_ASSERT(odp_packet_parse_multi(&pkt[1], parse_test.offset_zero, + num_pkt - 1, &parse) == (num_pkt - 1)); + + for (i = 0; i < num_pkt; i++) { + CU_ASSERT(odp_packet_has_eth(pkt[i])); + CU_ASSERT(odp_packet_has_eth_bcast(pkt[i])); + /* API specifies that Ethernet broadcast is also multicast */ + CU_ASSERT(odp_packet_has_eth_mcast(pkt[i])); + CU_ASSERT(odp_packet_has_ipv4(pkt[i])); + CU_ASSERT(odp_packet_has_ip_bcast(pkt[i])); + CU_ASSERT(odp_packet_has_udp(pkt[i])); + CU_ASSERT(!odp_packet_has_ipv6(pkt[i])); + CU_ASSERT(!odp_packet_has_tcp(pkt[i])); + CU_ASSERT(!odp_packet_has_ip_mcast(pkt[i])); + } + + odp_packet_free_multi(pkt, num_pkt); +} + +/* Ethernet mcast/IPv6 mcast/UDP */ +static void parse_mcast_eth_ipv6_udp(void) +{ + odp_packet_parse_param_t parse; + int i; + int num_pkt = PARSE_TEST_NUM_PKT; + odp_packet_t pkt[num_pkt]; + + parse_test_alloc(pkt, test_packet_mcast_eth_ipv6_udp, + sizeof(test_packet_mcast_eth_ipv6_udp)); + + parse.proto = ODP_PROTO_ETH; + parse.last_layer = ODP_PROTO_LAYER_L4; + parse.chksums.all_chksum = 0; + + CU_ASSERT(odp_packet_parse(pkt[0], 0, &parse) == 0); + CU_ASSERT(odp_packet_parse_multi(&pkt[1], parse_test.offset_zero, + num_pkt - 1, &parse) == (num_pkt - 1)); + + for (i = 0; i < num_pkt; i++) { + CU_ASSERT(odp_packet_has_eth(pkt[i])); + CU_ASSERT(odp_packet_has_eth_mcast(pkt[i])); + CU_ASSERT(odp_packet_has_ipv6(pkt[i])); + CU_ASSERT(odp_packet_has_ip_mcast(pkt[i])); + CU_ASSERT(odp_packet_has_udp(pkt[i])); + CU_ASSERT(!odp_packet_has_ipv4(pkt[i])); + CU_ASSERT(!odp_packet_has_tcp(pkt[i])); + CU_ASSERT(!odp_packet_has_eth_bcast(pkt[i])); + CU_ASSERT(!odp_packet_has_ip_bcast(pkt[i])); + } + + odp_packet_free_multi(pkt, num_pkt); +} + odp_testinfo_t packet_suite[] = { ODP_TEST_INFO(packet_test_alloc_free), ODP_TEST_INFO(packet_test_alloc_free_multi), @@ -3102,6 +3208,9 @@ odp_testinfo_t packet_parse_suite[] = { ODP_TEST_INFO(parse_eth_ipv4_ipsec_esp), ODP_TEST_INFO(parse_eth_ipv6_ipsec_ah), ODP_TEST_INFO(parse_eth_ipv6_ipsec_esp), + ODP_TEST_INFO(parse_mcast_eth_ipv4_udp), + ODP_TEST_INFO(parse_bcast_eth_ipv4_udp), + ODP_TEST_INFO(parse_mcast_eth_ipv6_udp), ODP_TEST_INFO_NULL, };