From patchwork Fri Apr 22 17:29:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balasubramanian Manoharan X-Patchwork-Id: 66489 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp846681qge; Fri, 22 Apr 2016 10:31:52 -0700 (PDT) X-Received: by 10.50.92.41 with SMTP id cj9mr5980020igb.38.1461346312330; Fri, 22 Apr 2016 10:31:52 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id im4si186145igc.54.2016.04.22.10.31.51; Fri, 22 Apr 2016 10:31:52 -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; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id AED6568809; Fri, 22 Apr 2016 17:31: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, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id C42DA68382; Fri, 22 Apr 2016 17:31:05 +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 B82FA68509; Fri, 22 Apr 2016 17:30:58 +0000 (UTC) Received: from mail-pf0-f171.google.com (mail-pf0-f171.google.com [209.85.192.171]) by lists.linaro.org (Postfix) with ESMTPS id A89BC68509 for ; Fri, 22 Apr 2016 17:30:21 +0000 (UTC) Received: by mail-pf0-f171.google.com with SMTP id e128so43048933pfe.3 for ; Fri, 22 Apr 2016 10:30:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Bm3R9H389UmECDF76Sc33p4Uw223uXkEIYciWYnyWic=; b=BvNBYxPWyKa7WsK2cK5UZfRw47xTxUtWSMsgNyCdEY6jz1a3XijFPytyWS/BnbI0Mm w3EDoNpkS97hQheI3NXBXvdYEIMF69eYRz8cZ0FPWq75TueWc5FidfO3rmevWKDDyven d/tgheO/mXWBnqFTmrPcgq0pbwyDa5UjTCXYrn9bbdV0HLBul2Q2HVD75g5Eo/Wd1b4z UYnsjav9Z5e0R6ij0cBS2wpLbEAanB5xxewDEvGuMq9El4L4kY0TKD1bFNOEVitUf71C KP7Krflip3B5QbxuZ03F3XrU1JXbUa2BHkybv6jK+yirdYh4ymF1udYFZG9O4yVzNAUc xL7w== X-Gm-Message-State: AOPr4FV8qR6NN3bzEWHXcJ15nKgem1CY3DcCYGNbja1+Hb4yRDvhTQI+HNXzspt/FESOyd6QTZE= X-Received: by 10.98.2.16 with SMTP id 16mr30134281pfc.148.1461346221021; Fri, 22 Apr 2016 10:30:21 -0700 (PDT) Received: from bala-Vostro-2520.domain.name ([117.199.134.57]) by smtp.gmail.com with ESMTPSA id r17sm9744909pfj.39.2016.04.22.10.30.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Apr 2016 10:30:20 -0700 (PDT) From: Balasubramanian Manoharan To: lng-odp@lists.linaro.org Date: Fri, 22 Apr 2016 22:59:54 +0530 Message-Id: <1461346194-16534-4-git-send-email-bala.manoharan@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1461346194-16534-1-git-send-email-bala.manoharan@linaro.org> References: <1461346194-16534-1-git-send-email-bala.manoharan@linaro.org> Cc: petri.savolainen@nokia.com Subject: [lng-odp] [API-NEXTv2 4/4] example: classifier: incorporates capability and PMR range X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Modifies the classifier example to support classification capability and PMR range funcionality. Signed-off-by: Balasubramanian Manoharan Reviewed-by: Bill Fischofer --- example/classifier/odp_classifier.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c index 612ce22..6d228b0 100644 --- a/example/classifier/odp_classifier.c +++ b/example/classifier/odp_classifier.c @@ -56,7 +56,7 @@ typedef struct { odp_atomic_u64_t pool_pkt_count; /**< count of received packets */ char cos_name[ODP_COS_NAME_LEN]; /**< cos name */ struct { - odp_pmr_term_t term; /**< odp pmr term value */ + odp_cls_pmr_term_e term; /**< odp pmr term value */ uint64_t val; /**< pmr term value */ uint64_t mask; /**< pmr term mask */ uint32_t val_sz; /**< size of the pmr term */ @@ -89,7 +89,7 @@ static void print_info(char *progname, appl_args_t *appl_args); static void usage(char *progname); static void configure_cos(odp_cos_t default_cos, appl_args_t *args); static odp_cos_t configure_default_cos(odp_pktio_t pktio, appl_args_t *args); -static int convert_str_to_pmr_enum(char *token, odp_pmr_term_t *term, +static int convert_str_to_pmr_enum(char *token, odp_cls_pmr_term_e *term, uint32_t *offset); static int parse_pmr_policy(appl_args_t *appl_args, char *argv[], char *optarg); @@ -393,6 +393,7 @@ static void configure_cos(odp_cos_t default_cos, appl_args_t *args) char pool_name[ODP_POOL_NAME_LEN]; odp_pool_param_t pool_params; odp_cls_cos_param_t cls_param; + odp_pmr_param_t pmr_param; int i; global_statistics *stats; odp_queue_param_t qparam; @@ -438,15 +439,14 @@ static void configure_cos(odp_cos_t default_cos, appl_args_t *args) cls_param.drop_policy = ODP_COS_DROP_POOL; stats->cos = odp_cls_cos_create(cos_name, &cls_param); - const odp_pmr_match_t match = { - .term = stats->rule.term, - .val = &stats->rule.val, - .mask = &stats->rule.mask, - .val_sz = stats->rule.val_sz, - .offset = stats->rule.offset - }; + odp_cls_pmr_param_init(&pmr_param); + pmr_param.term = stats->rule.term; + pmr_param.match.value = &stats->rule.val; + pmr_param.match.mask = &stats->rule.mask; + pmr_param.val_sz = stats->rule.val_sz; + pmr_param.offset = stats->rule.offset; - stats->pmr = odp_cls_pmr_create(&match, 1, default_cos, + stats->pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, stats->cos); if (stats->pmr == ODP_PMR_INVAL) { EXAMPLE_ERR("odp_pktio_pmr_cos failed"); @@ -665,7 +665,7 @@ static void swap_pkt_addrs(odp_packet_t pkt_tbl[], unsigned len) } } -static int convert_str_to_pmr_enum(char *token, odp_pmr_term_t *term, +static int convert_str_to_pmr_enum(char *token, odp_cls_pmr_term_e *term, uint32_t *offset) { if (NULL == token) @@ -691,7 +691,7 @@ static int parse_pmr_policy(appl_args_t *appl_args, char *argv[], char *optarg) int policy_count; char *token; size_t len; - odp_pmr_term_t term; + odp_cls_pmr_term_e term; global_statistics *stats; char *pmr_str; uint32_t offset; @@ -904,9 +904,9 @@ static void usage(char *progname) "\n" "Mandatory OPTIONS:\n" " -i, --interface Eth interface\n" - " -p, --policy [|]:::\n" + " -p, --policy [|]:::\n" "\n" - " Packet Matching Rule defined with odp_pmr_term_t " + " Packet Matching Rule defined with odp_cls_pmr_term_e " "for the policy\n" " Absolute offset in bytes from frame start to define a " "ODP_PMR_CUSTOM_FRAME Packet Matching Rule for the policy\n"