X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_flow_classify%2Frte_flow_classify.c;h=639b0051f5691952b0e7baf440c2c061b00483ad;hb=cf38bcd7763fa4cf6347a93a6193e00205404275;hp=591d98e258355f0e10b40b71ebbcd706d6b8ca60;hpb=ee6c1f770b6b4f335b3c691b673157e59e6dd53d;p=dpdk.git diff --git a/lib/librte_flow_classify/rte_flow_classify.c b/lib/librte_flow_classify/rte_flow_classify.c index 591d98e258..639b0051f5 100644 --- a/lib/librte_flow_classify/rte_flow_classify.c +++ b/lib/librte_flow_classify/rte_flow_classify.c @@ -2,6 +2,7 @@ * Copyright(c) 2017 Intel Corporation */ +#include #include #include #include "rte_flow_classify_parse.h" @@ -9,8 +10,6 @@ #include #include -int librte_flow_classify_logtype; - static uint32_t unique_id = 1; enum rte_flow_classify_table_type table_type @@ -88,7 +87,7 @@ struct rte_flow_classify_rule { void *entry_ptr; /* handle to the table entry for rule meta data */ }; -int __rte_experimental +int rte_flow_classify_validate( struct rte_flow_classifier *cls, const struct rte_flow_attr *attr, @@ -247,8 +246,7 @@ rte_flow_classifier_check_params(struct rte_flow_classifier_params *params) } /* socket */ - if ((params->socket_id < 0) || - (params->socket_id >= RTE_MAX_NUMA_NODES)) { + if (params->socket_id < 0) { RTE_FLOW_CLASSIFY_LOG(ERR, "%s: Incorrect value for parameter socket_id\n", __func__); @@ -258,7 +256,7 @@ rte_flow_classifier_check_params(struct rte_flow_classifier_params *params) return 0; } -struct rte_flow_classifier * __rte_experimental +struct rte_flow_classifier * rte_flow_classifier_create(struct rte_flow_classifier_params *params) { struct rte_flow_classifier *cls; @@ -286,8 +284,7 @@ rte_flow_classifier_create(struct rte_flow_classifier_params *params) } /* Save input parameters */ - snprintf(cls->name, RTE_FLOW_CLASSIFIER_MAX_NAME_SZ, "%s", - params->name); + strlcpy(cls->name, params->name, RTE_FLOW_CLASSIFIER_MAX_NAME_SZ); cls->socket_id = params->socket_id; @@ -301,7 +298,7 @@ rte_flow_classify_table_free(struct rte_cls_table *table) table->ops.f_free(table->h_table); } -int __rte_experimental +int rte_flow_classifier_free(struct rte_flow_classifier *cls) { uint32_t i; @@ -373,7 +370,7 @@ rte_table_check_params(struct rte_flow_classifier *cls, return 0; } -int __rte_experimental +int rte_flow_classify_table_create(struct rte_flow_classifier *cls, struct rte_flow_classify_table_params *params) { @@ -418,7 +415,6 @@ static struct rte_flow_classify_rule * allocate_acl_ipv4_5tuple_rule(struct rte_flow_classifier *cls) { struct rte_flow_classify_rule *rule; - int log_level; rule = malloc(sizeof(struct rte_flow_classify_rule)); if (!rule) @@ -467,9 +463,7 @@ allocate_acl_ipv4_5tuple_rule(struct rte_flow_classifier *cls) cls->ntuple_filter.dst_port_mask; rule->rules.u.ipv4_5tuple.dst_port = cls->ntuple_filter.dst_port; - log_level = rte_log_get_level(librte_flow_classify_logtype); - - if (log_level == RTE_LOG_DEBUG) + if (rte_log_can_log(librte_flow_classify_logtype, RTE_LOG_DEBUG)) print_acl_ipv4_key_add(&rule->u.key.key_add); /* key delete values */ @@ -477,13 +471,13 @@ allocate_acl_ipv4_5tuple_rule(struct rte_flow_classifier *cls) &rule->u.key.key_add.field_value[PROTO_FIELD_IPV4], NUM_FIELDS_IPV4 * sizeof(struct rte_acl_field)); - if (log_level == RTE_LOG_DEBUG) + if (rte_log_can_log(librte_flow_classify_logtype, RTE_LOG_DEBUG)) print_acl_ipv4_key_delete(&rule->u.key.key_del); return rule; } -struct rte_flow_classify_rule * __rte_experimental +struct rte_flow_classify_rule * rte_flow_classify_table_entry_add(struct rte_flow_classifier *cls, const struct rte_flow_attr *attr, const struct rte_flow_item pattern[], @@ -565,7 +559,7 @@ rte_flow_classify_table_entry_add(struct rte_flow_classifier *cls, return NULL; } -int __rte_experimental +int rte_flow_classify_table_entry_delete(struct rte_flow_classifier *cls, struct rte_flow_classify_rule *rule) { @@ -643,7 +637,7 @@ action_apply(struct rte_flow_classifier *cls, return ret; } -int __rte_experimental +int rte_flow_classifier_query(struct rte_flow_classifier *cls, struct rte_mbuf **pkts, const uint16_t nb_pkts, @@ -673,13 +667,4 @@ rte_flow_classifier_query(struct rte_flow_classifier *cls, return ret; } -RTE_INIT(librte_flow_classify_init_log); - -static void -librte_flow_classify_init_log(void) -{ - librte_flow_classify_logtype = - rte_log_register("lib.flow_classify"); - if (librte_flow_classify_logtype >= 0) - rte_log_set_level(librte_flow_classify_logtype, RTE_LOG_INFO); -} +RTE_LOG_REGISTER(librte_flow_classify_logtype, lib.flow_classify, INFO);