[07/10] net/mlx5: get priority to send traffic to kernel
Checks
Commit Message
Introduce mlx5_get_send_to_kernel_priority() function which returns
value of priority which must be used to jump back to table 0 in order
to send traffic to kernel. This function returns lowest priority.
Signed-off-by: Michael Savisko <michaelsav@nvidia.com>
---
drivers/net/mlx5/mlx5_flow.c | 33 +++++++++++++++++++++++++++++++++
drivers/net/mlx5/mlx5_flow.h | 1 +
2 files changed, 34 insertions(+)
@@ -10968,6 +10968,39 @@ mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,
return res;
}
+/**
+ * Get the priority for sending traffic to kernel table.
+ *
+ * @param[in] dev
+ * Pointer to the Ethernet device structure.
+ *
+ * @return
+ * On success: the value of priority for sending traffic to kernel table
+ * On failure: -1
+ */
+uint32_t
+mlx5_get_send_to_kernel_priority(struct rte_eth_dev *dev)
+{
+ struct mlx5_priv *priv = dev->data->dev_private;
+ uint32_t res;
+
+ switch (priv->sh->flow_max_priority) {
+ case RTE_DIM(priority_map_5):
+ res = 15;
+ break;
+ case RTE_DIM(priority_map_3):
+ res = 7;
+ break;
+ default:
+ DRV_LOG(ERR,
+ "port %u maximum priority: %d expected 8/16",
+ dev->data->port_id, priv->sh->flow_max_priority);
+ res = (uint32_t)-1;
+ }
+
+ return res;
+}
+
/**
* Get the E-Switch Manager vport id.
*
@@ -1750,6 +1750,7 @@ uint32_t mlx5_get_lowest_priority(struct rte_eth_dev *dev,
uint16_t mlx5_get_matcher_priority(struct rte_eth_dev *dev,
const struct rte_flow_attr *attr,
uint32_t subpriority, bool external);
+uint32_t mlx5_get_send_to_kernel_priority(struct rte_eth_dev *dev);
int mlx5_flow_get_reg_id(struct rte_eth_dev *dev,
enum mlx5_feature_name feature,
uint32_t id,