net/mlx5: replace verbs priorities by flow

Previous work introduce verbs priorities, whereas the PMD is making
translation between Flow priority into Verbs.  Rename this to make more
sense on what the PMD has to translate.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
This commit is contained in:
Nelio Laranjeiro 2018-07-12 11:30:49 +02:00 committed by Shahaf Shuler
parent 78be885295
commit 2815702bae
3 changed files with 18 additions and 25 deletions

View File

@ -717,7 +717,6 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
unsigned int tunnel_en = 0;
unsigned int mpls_en = 0;
unsigned int swp = 0;
unsigned int verb_priorities = 0;
unsigned int mprq = 0;
unsigned int mprq_min_stride_size_n = 0;
unsigned int mprq_max_stride_size_n = 0;
@ -1139,16 +1138,10 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
/* Store device configuration on private structure. */
priv->config = config;
/* Supported Verbs flow priority number detection. */
if (verb_priorities == 0) {
err = mlx5_verbs_max_prio(eth_dev);
if (err < 0) {
DRV_LOG(ERR, "port %u wrong Verbs flow priorities",
eth_dev->data->port_id);
goto error;
}
verb_priorities = err;
}
priv->config.max_verbs_prio = verb_priorities;
err = mlx5_flow_discover_priorities(eth_dev);
if (err < 0)
goto error;
priv->config.flow_prio = err;
/*
* Once the device is added to the list of memory event
* callback, its global MR cache table cannot be expanded

View File

@ -122,7 +122,7 @@ struct mlx5_dev_config {
unsigned int min_rxqs_num;
/* Rx queue count threshold to enable MPRQ. */
} mprq; /* Configurations for Multi-Packet RQ. */
unsigned int max_verbs_prio; /* Number of Verb flow priorities. */
unsigned int flow_prio; /* Number of flow priorities. */
unsigned int tso_max_payload_sz; /* Maximum TCP payload for TSO. */
unsigned int ind_table_max_size; /* Maximum indirection table size. */
int txq_inline; /* Maximum packet size for inlining. */
@ -317,7 +317,7 @@ int mlx5_traffic_restart(struct rte_eth_dev *dev);
/* mlx5_flow.c */
int mlx5_verbs_max_prio(struct rte_eth_dev *dev);
int mlx5_flow_discover_priorities(struct rte_eth_dev *dev);
void mlx5_flow_print(struct rte_flow *flow);
int mlx5_flow_validate(struct rte_eth_dev *dev,
const struct rte_flow_attr *attr,

View File

@ -76,17 +76,17 @@ struct ibv_spec_header {
};
/**
* Get the maximum number of priority available.
* Discover the maximum number of priority available.
*
* @param[in] dev
* Pointer to Ethernet device.
*
* @return
* number of supported Verbs flow priority on success, a negative errno
* value otherwise and rte_errno is set.
* number of supported flow priority on success, a negative errno value
* otherwise and rte_errno is set.
*/
int
mlx5_verbs_max_prio(struct rte_eth_dev *dev)
mlx5_flow_discover_priorities(struct rte_eth_dev *dev)
{
struct {
struct ibv_flow_attr attr;
@ -106,25 +106,25 @@ mlx5_verbs_max_prio(struct rte_eth_dev *dev)
},
};
struct ibv_flow *flow;
uint32_t verb_priorities;
struct mlx5_hrxq *drop = mlx5_hrxq_drop_new(dev);
uint16_t vprio[] = { 8, 16 };
int i;
if (!drop) {
rte_errno = ENOTSUP;
return -rte_errno;
}
for (verb_priorities = 0; 1; verb_priorities++) {
flow_attr.attr.priority = verb_priorities;
flow = mlx5_glue->create_flow(drop->qp,
&flow_attr.attr);
for (i = 0; i != RTE_DIM(vprio); i++) {
flow_attr.attr.priority = vprio[i] - 1;
flow = mlx5_glue->create_flow(drop->qp, &flow_attr.attr);
if (!flow)
break;
claim_zero(mlx5_glue->destroy_flow(flow));
}
mlx5_hrxq_drop_release(dev);
DRV_LOG(INFO, "port %u flow maximum priority: %d",
dev->data->port_id, verb_priorities);
return verb_priorities;
dev->data->port_id, vprio[i - 1]);
return vprio[i - 1];
}
/**
@ -318,7 +318,7 @@ mlx5_ctrl_flow_vlan(struct rte_eth_dev *dev,
struct priv *priv = dev->data->dev_private;
const struct rte_flow_attr attr = {
.ingress = 1,
.priority = priv->config.max_verbs_prio - 1,
.priority = priv->config.flow_prio - 1,
};
struct rte_flow_item items[] = {
{