#include <rte_mbuf.h>
#include <rte_memory.h>
+#define RTE_REGEXDEV_NAME_MAX_LEN RTE_DEV_NAME_MAX_LEN
+
+extern int rte_regexdev_logtype;
+
+#define RTE_REGEXDEV_LOG(level, ...) \
+ rte_log(RTE_LOG_ ## level, rte_regexdev_logtype, "" __VA_ARGS__)
+
+/* Macros to check for valid port */
+#define RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, retval) do { \
+ if (!rte_regexdev_is_valid_dev(dev_id)) { \
+ RTE_REGEXDEV_LOG(ERR, "Invalid dev_id=%u\n", dev_id); \
+ return retval; \
+ } \
+} while (0)
+
+#define RTE_REGEXDEV_VALID_DEV_ID_OR_RET(dev_id) do { \
+ if (!rte_regexdev_is_valid_dev(dev_id)) { \
+ RTE_REGEXDEV_LOG(ERR, "Invalid dev_id=%u\n", dev_id); \
+ return; \
+ } \
+} while (0)
+
+/**
+ * Check if dev_id is ready.
+ *
+ * @param dev_id
+ * The dev identifier of the RegEx device.
+ *
+ * @return
+ * - 0 if device state is not in ready state.
+ * - 1 if device state is ready state.
+ */
+int rte_regexdev_is_valid_dev(uint16_t dev_id);
+
/**
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
* @see RTE_REGEXDEV_CFG_MATCH_ALL_F
*/
+#define RTE_REGEXDEV_CAPA_QUEUE_PAIR_OOS_F (1ULL << 22)
+/**< RegEx device supports out of order scan.
+ * Out of order scan means the response of a specific job can be returned as
+ * soon as it is ready even if previous jobs on the same queue didn't complete.
+ *
+ * @see RTE_REGEX_QUEUE_PAIR_CFG_OOS_F
+ * @see struct rte_regexdev_info::regexdev_capa
+ */
+
/* Enumerates PCRE rule flags */
#define RTE_REGEX_PCRE_RULE_ALLOW_EMPTY_F (1ULL << 0)
/**< When this flag is set, the pattern that can match against an empty string,
* @see RTE_REGEXDEV_ATTR_MAX_PREFIX
*/
+#define RTE_REGEX_OPS_RSP_RESOURCE_LIMIT_REACHED_F (1 << 4)
+/**< Indicates that the RegEx device has reached the max allowed resource
+ * allowed while scanning the given buffer.
+ */
+
/**
* The generic *rte_regex_ops* structure to hold the RegEx attributes
* for enqueue and dequeue operation.
*/
};
+#include "rte_regexdev_core.h"
+
/**
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
* to take care of them.
*/
__rte_experimental
-uint16_t
+static inline uint16_t
rte_regexdev_enqueue_burst(uint8_t dev_id, uint16_t qp_id,
- struct rte_regex_ops **ops, uint16_t nb_ops);
+ struct rte_regex_ops **ops, uint16_t nb_ops)
+{
+ struct rte_regexdev *dev = &rte_regex_devices[dev_id];
+#ifdef RTE_LIBRTE_REGEXDEV_DEBUG
+ RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
+ RTE_FUNC_PTR_OR_ERR_RET(*dev->enqueue, -ENOTSUP);
+ if (qp_id >= dev->data->dev_conf.nb_queue_pairs) {
+ RTE_REGEXDEV_LOG(ERR, "Invalid queue %d\n", qp_id);
+ return -EINVAL;
+ }
+#endif
+ return (*dev->enqueue)(dev, qp_id, ops, nb_ops);
+}
/**
* @warning
* of them.
*/
__rte_experimental
-uint16_t
+static inline uint16_t
rte_regexdev_dequeue_burst(uint8_t dev_id, uint16_t qp_id,
- struct rte_regex_ops **ops, uint16_t nb_ops);
+ struct rte_regex_ops **ops, uint16_t nb_ops)
+{
+ struct rte_regexdev *dev = &rte_regex_devices[dev_id];
+#ifdef RTE_LIBRTE_REGEXDEV_DEBUG
+ RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
+ RTE_FUNC_PTR_OR_ERR_RET(*dev->dequeue, -ENOTSUP);
+ if (qp_id >= dev->data->dev_conf.nb_queue_pairs) {
+ RTE_REGEXDEV_LOG(ERR, "Invalid queue %d\n", qp_id);
+ return -EINVAL;
+ }
+#endif
+ return (*dev->dequeue)(dev, qp_id, ops, nb_ops);
+}
#ifdef __cplusplus
}