+/*
+ * Learner Table Query API.
+ */
+
+/** Learner table info. */
+struct rte_swx_ctl_learner_info {
+ /** Learner table name. */
+ char name[RTE_SWX_CTL_NAME_SIZE];
+
+ /** Number of match fields. */
+ uint32_t n_match_fields;
+
+ /** Number of actions. */
+ uint32_t n_actions;
+
+ /** Non-zero (true) when the default action is constant, therefore it
+ * cannot be changed; zero (false) when the default action not constant,
+ * therefore it can be changed.
+ */
+ int default_action_is_const;
+
+ /** Learner table size parameter. */
+ uint32_t size;
+};
+
+/**
+ * Learner table info get
+ *
+ * @param[in] p
+ * Pipeline handle.
+ * @param[in] learner_id
+ * Learner table ID (0 .. *n_learners* - 1).
+ * @param[out] learner
+ * Learner table info.
+ * @return
+ * 0 on success or the following error codes otherwise:
+ * -EINVAL: Invalid argument.
+ */
+__rte_experimental
+int
+rte_swx_ctl_learner_info_get(struct rte_swx_pipeline *p,
+ uint32_t learner_id,
+ struct rte_swx_ctl_learner_info *learner);
+
+/**
+ * Learner table match field info get
+ *
+ * @param[in] p
+ * Pipeline handle.
+ * @param[in] learner_id
+ * Learner table ID (0 .. *n_learners* - 1).
+ * @param[in] match_field_id
+ * Match field ID (0 .. *n_match_fields* - 1).
+ * @param[out] match_field
+ * Learner table match field info.
+ * @return
+ * 0 on success or the following error codes otherwise:
+ * -EINVAL: Invalid argument.
+ */
+__rte_experimental
+int
+rte_swx_ctl_learner_match_field_info_get(struct rte_swx_pipeline *p,
+ uint32_t learner_id,
+ uint32_t match_field_id,
+ struct rte_swx_ctl_table_match_field_info *match_field);
+
+/**
+ * Learner table action info get
+ *
+ * @param[in] p
+ * Pipeline handle.
+ * @param[in] learner_id
+ * Learner table ID (0 .. *n_learners* - 1).
+ * @param[in] learner_action_id
+ * Action index within the set of learner table actions (0 .. learner table n_actions - 1). Not
+ * to be confused with the pipeline-leve action ID (0 .. pipeline n_actions - 1), which is
+ * precisely what this function returns as part of the *learner_action*.
+ * @param[out] learner_action
+ * Learner action info.
+ * @return
+ * 0 on success or the following error codes otherwise:
+ * -EINVAL: Invalid argument.
+ */
+__rte_experimental
+int
+rte_swx_ctl_learner_action_info_get(struct rte_swx_pipeline *p,
+ uint32_t learner_id,
+ uint32_t learner_action_id,
+ struct rte_swx_ctl_table_action_info *learner_action);
+
+/** Learner table statistics. */
+struct rte_swx_learner_stats {
+ /** Number of packets with lookup hit. */
+ uint64_t n_pkts_hit;
+
+ /** Number of packets with lookup miss. */
+ uint64_t n_pkts_miss;
+
+ /** Number of packets with successful learning. */
+ uint64_t n_pkts_learn_ok;
+
+ /** Number of packets with learning error. */
+ uint64_t n_pkts_learn_err;
+
+ /** Number of packets with forget event. */
+ uint64_t n_pkts_forget;
+
+ /** Number of packets (with either lookup hit or miss) per pipeline action. Array of
+ * pipeline *n_actions* elements indedex by the pipeline-level *action_id*, therefore this
+ * array has the same size for all the tables within the same pipeline.
+ */
+ uint64_t *n_pkts_action;
+};
+
+/**
+ * Learner table statistics counters read
+ *
+ * @param[in] p
+ * Pipeline handle.
+ * @param[in] learner_name
+ * Learner table name.
+ * @param[out] stats
+ * Learner table stats. Must point to a pre-allocated structure. The *n_pkts_action* field also
+ * needs to be pre-allocated as array of pipeline *n_actions* elements. The pipeline actions that
+ * are not valid for the current learner table have their associated *n_pkts_action* element
+ * always set to zero.
+ * @return
+ * 0 on success or the following error codes otherwise:
+ * -EINVAL: Invalid argument.
+ */
+__rte_experimental
+int
+rte_swx_ctl_pipeline_learner_stats_read(struct rte_swx_pipeline *p,
+ const char *learner_name,
+ struct rte_swx_learner_stats *stats);
+