X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_acl%2Frte_acl.h;h=0979a09831db5dda24e44333fc613104feeeaa64;hb=6efca1e9f87305b08ee1e26d817a5c770fa444fa;hp=652a234526bd9c571e158d87457e904ef801e420;hpb=5dd71363bfd2b8d33d6b7aea9ab43db5792fd4e2;p=dpdk.git diff --git a/lib/librte_acl/rte_acl.h b/lib/librte_acl/rte_acl.h index 652a234526..0979a09831 100644 --- a/lib/librte_acl/rte_acl.h +++ b/lib/librte_acl/rte_acl.h @@ -94,6 +94,8 @@ struct rte_acl_config { uint32_t num_fields; /**< Number of field definitions. */ struct rte_acl_field_def defs[RTE_ACL_MAX_FIELDS]; /**< array of field definitions. */ + size_t max_size; + /**< max memory limit for internal run-time structures. */ }; /** @@ -113,13 +115,16 @@ struct rte_acl_field { enum { RTE_ACL_TYPE_SHIFT = 29, - RTE_ACL_MAX_INDEX = LEN2MASK(RTE_ACL_TYPE_SHIFT), + RTE_ACL_MAX_INDEX = RTE_LEN2MASK(RTE_ACL_TYPE_SHIFT, uint32_t), RTE_ACL_MAX_PRIORITY = RTE_ACL_MAX_INDEX, RTE_ACL_MIN_PRIORITY = 0, }; #define RTE_ACL_INVALID_USERDATA 0 +#define RTE_ACL_MASKLEN_TO_BITMASK(v, s) \ +((v) == 0 ? (v) : (typeof(v))((uint64_t)-1 << ((s) * CHAR_BIT - (v)))) + /** * Miscellaneous data for ACL rule. */ @@ -168,7 +173,6 @@ struct rte_acl_param { * Pointer to ACL context structure that is used in future ACL * operations, or NULL on error, with error code set in rte_errno. * Possible rte_errno errors include: - * - E_RTE_NO_TAILQ - no tailq list could be got for the ACL context list * - EINVAL - invalid parameter passed to function */ struct rte_acl_ctx * @@ -266,6 +270,7 @@ enum rte_acl_classify_alg { RTE_ACL_CLASSIFY_SCALAR = 1, /**< generic implementation. */ RTE_ACL_CLASSIFY_SSE = 2, /**< requires SSE4.1 support. */ RTE_ACL_CLASSIFY_AVX2 = 3, /**< requires AVX2 support. */ + RTE_ACL_CLASSIFY_NEON = 4, /**< requires NEON support. */ RTE_ACL_CLASSIFY_NUM /* should always be the last one. */ }; @@ -376,110 +381,6 @@ rte_acl_dump(const struct rte_acl_ctx *ctx); void rte_acl_list_dump(void); -/** - * Legacy support for 7-tuple IPv4 and VLAN rule. - * This structure and corresponding API is deprecated. - */ -struct rte_acl_ipv4vlan_rule { - struct rte_acl_rule_data data; /**< Miscellaneous data for the rule. */ - uint8_t proto; /**< IPv4 protocol ID. */ - uint8_t proto_mask; /**< IPv4 protocol ID mask. */ - uint16_t vlan; /**< VLAN ID. */ - uint16_t vlan_mask; /**< VLAN ID mask. */ - uint16_t domain; /**< VLAN domain. */ - uint16_t domain_mask; /**< VLAN domain mask. */ - uint32_t src_addr; /**< IPv4 source address. */ - uint32_t src_mask_len; /**< IPv4 source address mask. */ - uint32_t dst_addr; /**< IPv4 destination address. */ - uint32_t dst_mask_len; /**< IPv4 destination address mask. */ - uint16_t src_port_low; /**< L4 source port low. */ - uint16_t src_port_high; /**< L4 source port high. */ - uint16_t dst_port_low; /**< L4 destination port low. */ - uint16_t dst_port_high; /**< L4 destination port high. */ -}; - -/** - * Specifies fields layout inside rte_acl_rule for rte_acl_ipv4vlan_rule. - */ -enum { - RTE_ACL_IPV4VLAN_PROTO_FIELD, - RTE_ACL_IPV4VLAN_VLAN1_FIELD, - RTE_ACL_IPV4VLAN_VLAN2_FIELD, - RTE_ACL_IPV4VLAN_SRC_FIELD, - RTE_ACL_IPV4VLAN_DST_FIELD, - RTE_ACL_IPV4VLAN_SRCP_FIELD, - RTE_ACL_IPV4VLAN_DSTP_FIELD, - RTE_ACL_IPV4VLAN_NUM_FIELDS -}; - -/** - * Macro to define rule size for rte_acl_ipv4vlan_rule. - */ -#define RTE_ACL_IPV4VLAN_RULE_SZ \ - RTE_ACL_RULE_SZ(RTE_ACL_IPV4VLAN_NUM_FIELDS) - -/* - * That effectively defines order of IPV4VLAN classifications: - * - PROTO - * - VLAN (TAG and DOMAIN) - * - SRC IP ADDRESS - * - DST IP ADDRESS - * - PORTS (SRC and DST) - */ -enum { - RTE_ACL_IPV4VLAN_PROTO, - RTE_ACL_IPV4VLAN_VLAN, - RTE_ACL_IPV4VLAN_SRC, - RTE_ACL_IPV4VLAN_DST, - RTE_ACL_IPV4VLAN_PORTS, - RTE_ACL_IPV4VLAN_NUM -}; - -/** - * Add ipv4vlan rules to an existing ACL context. - * This function is not multi-thread safe. - * - * @param ctx - * ACL context to add patterns to. - * @param rules - * Array of rules to add to the ACL context. - * Note that all fields in rte_acl_ipv4vlan_rule structures are expected - * to be in host byte order. - * @param num - * Number of elements in the input array of rules. - * @return - * - -ENOMEM if there is no space in the ACL context for these rules. - * - -EINVAL if the parameters are invalid. - * - Zero if operation completed successfully. - */ -int -rte_acl_ipv4vlan_add_rules(struct rte_acl_ctx *ctx, - const struct rte_acl_ipv4vlan_rule *rules, - uint32_t num); - -/** - * Analyze set of ipv4vlan rules and build required internal - * run-time structures. - * This function is not multi-thread safe. - * - * @param ctx - * ACL context to build. - * @param layout - * Layout of input data to search through. - * @param num_categories - * Maximum number of categories to use in that build. - * @return - * - -ENOMEM if couldn't allocate enough memory. - * - -EINVAL if the parameters are invalid. - * - Negative error code if operation failed. - * - Zero if operation completed successfully. - */ -int -rte_acl_ipv4vlan_build(struct rte_acl_ctx *ctx, - const uint32_t layout[RTE_ACL_IPV4VLAN_NUM], - uint32_t num_categories); - - #ifdef __cplusplus } #endif