From patchwork Wed Apr 29 08:34:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balasubramanian Manoharan X-Patchwork-Id: 47703 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E177020553 for ; Wed, 29 Apr 2015 08:34:29 +0000 (UTC) Received: by wghm4 with SMTP id m4sf4682954wgh.2 for ; Wed, 29 Apr 2015 01:34:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:date :message-id:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=w3L6FcAggunQpKC2ErQZPcVw/kExNKk9pfgUnnjBkMs=; b=iaWl82AO50OvRy9nCnYmA+d5PbchnZSuZZrxNvF/0+kv6c4uSE3oKNPw9/w8zyKB/4 l4p0R2EUDEdqn9/6v7obc7N0q8UIWuoEd1qsVBVc83a2lIAgIkWi0KUNqUj8rAYDUCl4 UAv98Z/V0fK9KoJ9HCdp6W0f/04vmSolJT4p3brIbWVnmQnckTSsve9+f0NWkKU+9JaL 0jSsQWyN0MzdVfH7nqC9F2KrasaOdni5cZik3GnitHNU8sZIFNAodkhCOg/syeW0dCH/ p12T7QXCSm2w5M4rIsx/Qf1rn2FJ6j5tHKcqWqR3E0YsDYZQMvFVPb+HXZ8/vy7mRtrZ ET4w== X-Gm-Message-State: ALoCoQm4jrfw3wpwjagFqg+6+DtbhpmFzgvMs0lMbqxwXvtMTHlFu+MWdmFvly0dJEJ9kP1SWnIX X-Received: by 10.180.96.6 with SMTP id do6mr12391034wib.4.1430296469177; Wed, 29 Apr 2015 01:34:29 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.180.202 with SMTP id dq10ls203307lac.109.gmail; Wed, 29 Apr 2015 01:34:28 -0700 (PDT) X-Received: by 10.152.2.227 with SMTP id 3mr11597613lax.73.1430296468903; Wed, 29 Apr 2015 01:34:28 -0700 (PDT) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com. [209.85.217.171]) by mx.google.com with ESMTPS id l9si18842396lam.73.2015.04.29.01.34.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Apr 2015 01:34:28 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by lbbzk7 with SMTP id zk7so14817361lbb.0 for ; Wed, 29 Apr 2015 01:34:28 -0700 (PDT) X-Received: by 10.112.125.138 with SMTP id mq10mr18329041lbb.35.1430296468749; Wed, 29 Apr 2015 01:34:28 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.67.65 with SMTP id l1csp2361404lbt; Wed, 29 Apr 2015 01:34:27 -0700 (PDT) X-Received: by 10.55.55.72 with SMTP id e69mr26421877qka.78.1430296467254; Wed, 29 Apr 2015 01:34:27 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id i74si20449847qge.99.2015.04.29.01.34.26; Wed, 29 Apr 2015 01:34:27 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Received: by lists.linaro.org (Postfix, from userid 109) id 3736561B40; Wed, 29 Apr 2015 08:34:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 56E6A6181E; Wed, 29 Apr 2015 08:34:23 +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 01EF36181E; Wed, 29 Apr 2015 08:34:20 +0000 (UTC) Received: from mail-pd0-f179.google.com (mail-pd0-f179.google.com [209.85.192.179]) by lists.linaro.org (Postfix) with ESMTPS id DC0BD6181C for ; Wed, 29 Apr 2015 08:34:19 +0000 (UTC) Received: by pdbqd1 with SMTP id qd1so21918927pdb.2 for ; Wed, 29 Apr 2015 01:34:19 -0700 (PDT) X-Received: by 10.66.145.74 with SMTP id ss10mr38687242pab.28.1430296459041; Wed, 29 Apr 2015 01:34:19 -0700 (PDT) Received: from localhost.localdomain ([111.93.218.67]) by mx.google.com with ESMTPSA id p1sm24680706pdl.60.2015.04.29.01.34.17 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 29 Apr 2015 01:34:18 -0700 (PDT) From: bala.manoharan@linaro.org To: lng-odp@lists.linaro.org Date: Wed, 29 Apr 2015 14:04:07 +0530 Message-Id: <1430296447-19441-1-git-send-email-bala.manoharan@linaro.org> X-Mailer: git-send-email 2.0.1.472.g6f92e5f X-Topics: patch Subject: [lng-odp] [PATCHv1] example: classifier: remove odp_pmr_create_range() support X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: bala.manoharan@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Balasubramanian Manoharan This patch removes support for odp_pmr_create_range() function in the classifier example application. Signed-off-by: Balasubramanian Manoharan Reviewed-by: Mike Holmes --- example/classifier/odp_classifier.c | 106 ++++++++++-------------------------- 1 file changed, 29 insertions(+), 77 deletions(-) diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c index cf53565..d78eb7b 100644 --- a/example/classifier/odp_classifier.c +++ b/example/classifier/odp_classifier.c @@ -52,22 +52,15 @@ typedef struct { odp_cos_t cos; /**< Associated cos handle */ odp_pmr_t pmr; /**< Associated pmr handle */ odp_atomic_u64_t packet_count; /**< count of received packets */ - odp_pmr_term_e term; /**< odp pmr term value */ char queue_name[ODP_QUEUE_NAME_LEN]; /**< queue name */ - odp_pmr_match_type_e match_type; /**< pmr match type */ int val_sz; /**< size of the pmr term */ - union { - struct { - uint32_t val; /**< pmr term value */ - uint32_t mask; /**< pmr term mask */ - } match; - struct { - uint32_t val1; /**< pmr term start range */ - uint32_t val2; /**< pmr term end range */ - } range; - }; - char value1[DISPLAY_STRING_LEN]; /**< Display string1 */ - char value2[DISPLAY_STRING_LEN]; /**< Display string2 */ + struct { + odp_pmr_term_e term; /**< odp pmr term value */ + uint32_t val; /**< pmr term value */ + uint32_t mask; /**< pmr term mask */ + } rule; + char value[DISPLAY_STRING_LEN]; /**< Display string for value */ + char mask[DISPLAY_STRING_LEN]; /**< Display string for mask */ } global_statistics; typedef struct { @@ -114,18 +107,14 @@ void print_cls_statistics(appl_args_t *args) printf("\n"); printf("CONFIGURATION\n"); printf("\n"); - printf("QUEUE\tMATCH\tVALUE1\t\tVALUE2\n"); + printf("QUEUE\tVALUE\t\tMASK\n"); for (i = 0; i < 40; i++) printf("-"); printf("\n"); for (i = 0; i < args->policy_count - 1; i++) { printf("%s\t", args->stats[i].queue_name); - if (args->stats[i].match_type == ODP_PMR_MASK) - printf("MATCH\t"); - else - printf("RANGE\t"); - printf("%s\t", args->stats[i].value1); - printf("%s\n", args->stats[i].value2); + printf("%s\t", args->stats[i].value); + printf("%s\n", args->stats[i].mask); } printf("\n"); printf("RECEIVED PACKETS\n"); @@ -357,17 +346,10 @@ static void configure_cos_queue(odp_pktio_t pktio, appl_args_t *args) sprintf(cos_name, "CoS%s", stats->queue_name); stats->cos = odp_cos_create(cos_name); - if (stats->match_type == ODP_PMR_MASK) { - stats->pmr = odp_pmr_create_match(stats->term, - &stats->match.val, - &stats->match.mask, - stats->val_sz); - } else { - stats->pmr = odp_pmr_create_range(stats->term, - &stats->range.val1, - &stats->range.val2, - stats->val_sz); - } + stats->pmr = odp_pmr_create(stats->rule.term, + &stats->rule.val, + &stats->rule.mask, + stats->val_sz); qparam.sched.prio = i % odp_schedule_num_prio(); qparam.sched.sync = ODP_SCHED_SYNC_NONE; qparam.sched.group = ODP_SCHED_GROUP_ALL; @@ -614,39 +596,18 @@ static int parse_pmr_policy(appl_args_t *appl_args, char *argv[], char *optarg) EXAMPLE_ERR("Invalid ODP_PMR_TERM string\n"); exit(EXIT_FAILURE); } - stats[policy_count].term = term; - /* PMR RANGE vs MATCH */ - token = strtok(NULL, ":"); - if (0 == strcasecmp(token, "range")) { - stats[policy_count].match_type = ODP_PMR_RANGE; - } else if (0 == strcasecmp(token, "match")) { - stats[policy_count].match_type = ODP_PMR_MASK; - } else { - usage(argv[0]); - exit(EXIT_FAILURE); - } + stats[policy_count].rule.term = term; /* PMR value */ switch (term) { case ODP_PMR_SIP_ADDR: - if (stats[policy_count].match_type == ODP_PMR_MASK) { - token = strtok(NULL, ":"); - strcpy(stats[policy_count].value1, token); - parse_ipv4_addr(token, &stats[policy_count].match.val); - token = strtok(NULL, ":"); - strcpy(stats[policy_count].value2, token); - parse_ipv4_mask(token, &stats[policy_count].match.mask); - stats[policy_count].val_sz = 4; - } else { - token = strtok(NULL, ":"); - strcpy(stats[policy_count].value1, - token); - parse_ipv4_addr(token, &stats[policy_count].range.val1); - token = strtok(NULL, ":"); - strcpy(stats[policy_count].value2, token); - parse_ipv4_addr(token, &stats[policy_count].range.val2); - stats[policy_count].val_sz = 4; - } + token = strtok(NULL, ":"); + strcpy(stats[policy_count].value, token); + parse_ipv4_addr(token, &stats[policy_count].rule.val); + token = strtok(NULL, ":"); + strcpy(stats[policy_count].mask, token); + parse_ipv4_mask(token, &stats[policy_count].rule.mask); + stats[policy_count].val_sz = 4; break; default: usage(argv[0]); @@ -788,34 +749,25 @@ static void usage(char *progname) printf("\n" "OpenDataPlane Classifier example.\n" "Usage: %s OPTIONS\n" - " E.g. %s -i eth1 -m 0 -p \"ODP_PMR_SIP_ADDR:match:10.10.10.5:FFFFFFFF:queue1\" \\\n" - "\t\t\t-p \"ODP_PMR_SIP_ADDR:MATCH:10.10.10.6:FFFFFFFF:queue2\" \\\n" - "\t\t\t-p \"ODP_PMR_SIP_ADDR:MATCH:10.10.10.7:000000FF:queue3\" \\\n" - "\t\t\t-p \"ODP_PMR_SIP_ADDR:RANGE:10.10.10.10:10.10.10.20:queue3\"\n" + " E.g. %s -i eth1 -m 0 -p \"ODP_PMR_SIP_ADDR:10.10.10.5:FFFFFFFF:queue1\" \\\n" + "\t\t\t-p \"ODP_PMR_SIP_ADDR:10.10.10.7:000000FF:queue2\" \\\n" + "\t\t\t-p \"ODP_PMR_SIP_ADDR:10.5.5.10:FFFFFF00:queue3\"\n" "\n" "For the above example configuration the following will be the packet distribution\n" "queue1\t\tPackets with source ip address 10.10.10.5\n" "queue2\t\tPackets with source ip address whose last 8 bits match 7\n" - "queue3\t\tPackets with source ip address in the range 10.10.10.10 to 10.10.10.20\n" + "queue3\t\tPackets with source ip address in the subnet 10.5.5.0\n" "\n" "Mandatory OPTIONS:\n" " -i, --interface Eth interface\n" - " -p, --policy ::::\n" + " -p, --policy :::\n" "\n" " Packet Matching Rule defined with odp_pmr_term_e " "for the policy\n" "\n" - " PMR Match type.\n" - " MATCH: PMR rule type MATCH\n" - " RANGE: PMR rule type RANCE\n" - "\n" - " PMR value1.\n" - " If match type is MATCH is the the matching value.\n" - " If match type is RANGE it is start range.\n" + " PMR value to be matched.\n" "\n" - " PMR value2.\n" - " If match type is \"MATCH\" it is the MASK value\n" - " If match type is \"RANCE\" it is end range.\n" + " PMR mask bits to be applied on the PMR term value\n" "\n" "Optional OPTIONS\n" " -c, --count CPU count.\n"