Skip to content

Commit

Permalink
mldev: add queue pair count
Browse files Browse the repository at this point in the history
Added API to get ML device queue-pair count.

Signed-off-by: Srikanth Yalavarthi <syalavarthi@marvell.com>
  • Loading branch information
syalavarthi authored and tmonjalo committed Oct 17, 2024
1 parent 6011b12 commit 804786f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/mldev/rte_mldev.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,21 @@ rte_ml_dev_stop(int16_t dev_id)
return ret;
}

uint16_t
rte_ml_dev_queue_pair_count(int16_t dev_id)
{
struct rte_ml_dev *dev;

if (!rte_ml_dev_is_valid_dev(dev_id)) {
RTE_MLDEV_LOG(ERR, "Invalid dev_id = %d", dev_id);
return -EINVAL;
}

dev = rte_ml_dev_pmd_get_dev(dev_id);

return dev->data->nb_queue_pairs;
}

int
rte_ml_dev_queue_pair_setup(int16_t dev_id, uint16_t queue_pair_id,
const struct rte_ml_dev_qp_conf *qp_conf, int socket_id)
Expand Down
13 changes: 13 additions & 0 deletions lib/mldev/rte_mldev.h
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,19 @@ struct rte_ml_dev_qp_conf {
*/
};

/**
* Get the number of queue pairs on a specific ML device.
*
* @param dev_id
* The identifier of the device.
*
* @return
* - The number of configured queue pairs.
*/
__rte_experimental
uint16_t
rte_ml_dev_queue_pair_count(int16_t dev_id);

/**
* Set up a queue pair for a device. This should only be called when the device is stopped.
*
Expand Down
1 change: 1 addition & 0 deletions lib/mldev/version.map
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ EXPERIMENTAL {
rte_ml_dev_init;
rte_ml_dev_is_valid_dev;
rte_ml_dev_logtype;
rte_ml_dev_queue_pair_count;
rte_ml_dev_queue_pair_setup;
rte_ml_dev_selftest;
rte_ml_dev_socket_id;
Expand Down

0 comments on commit 804786f

Please sign in to comment.