}
priv->caps = attr.vdpa;
priv->log_max_rqt_size = attr.log_max_rqt_size;
+ priv->num_lag_ports = attr.num_lag_ports;
+ if (attr.num_lag_ports == 0)
+ priv->num_lag_ports = 1;
priv->ctx = ctx;
priv->pci_dev = pci_dev;
priv->var = mlx5_glue->dv_alloc_var(ctx, 0);
struct rte_intr_handle intr_handle;
struct rte_intr_handle err_intr_handle;
struct mlx5_devx_obj *td;
- struct mlx5_devx_obj *tis;
+ struct mlx5_devx_obj *tiss[16]; /* TIS list for each LAG port. */
uint16_t nr_virtqs;
+ uint8_t num_lag_ports;
uint64_t features; /* Negotiated features. */
uint16_t log_max_rqt_size;
struct mlx5_vdpa_steer steer;
memset(virtq->err_time, 0, sizeof(virtq->err_time));
virtq->n_retry = 0;
}
- if (priv->tis) {
- claim_zero(mlx5_devx_cmd_destroy(priv->tis));
- priv->tis = NULL;
+ for (i = 0; i < priv->num_lag_ports; i++) {
+ if (priv->tiss[i]) {
+ claim_zero(mlx5_devx_cmd_destroy(priv->tiss[i]));
+ priv->tiss[i] = NULL;
+ }
}
if (priv->td) {
claim_zero(mlx5_devx_cmd_destroy(priv->td));
attr.hw_used_index = last_used_idx;
attr.q_size = vq.size;
attr.mkey = priv->gpa_mkey_index;
- attr.tis_id = priv->tis->id;
+ attr.tis_id = priv->tiss[(index / 2) % priv->num_lag_ports]->id;
attr.queue_index = index;
attr.pd = priv->pdn;
virtq->virtq = mlx5_devx_cmd_create_virtq(priv->ctx, &attr);
return -rte_errno;
}
tis_attr.transport_domain = priv->td->id;
- priv->tis = mlx5_devx_cmd_create_tis(priv->ctx, &tis_attr);
- if (!priv->tis) {
- DRV_LOG(ERR, "Failed to create TIS.");
- goto error;
+ for (i = 0; i < priv->num_lag_ports; i++) {
+ /* 0 is auto affinity, non-zero value to propose port. */
+ tis_attr.lag_tx_port_affinity = i + 1;
+ priv->tiss[i] = mlx5_devx_cmd_create_tis(priv->ctx, &tis_attr);
+ if (!priv->tiss[i]) {
+ DRV_LOG(ERR, "Failed to create TIS %u.", i);
+ goto error;
+ }
}
priv->nr_virtqs = nr_vring;
for (i = 0; i < nr_vring; i++)