MCPcopy Create free account
hub / github.com/F-Stack/f-stack / mlx5_txq_devx_modify

Function mlx5_txq_devx_modify

dpdk/drivers/net/mlx5/mlx5_devx.c:122–163  ·  view source on GitHub ↗

* Modify SQ using DevX API. * * @param txq_obj * DevX Tx queue object. * @param type * Type of change queue state. * @param dev_port * Unnecessary. * * @return * 0 on success, a negative errno value otherwise and rte_errno is set. */

Source from the content-addressed store, hash-verified

120 * 0 on success, a negative errno value otherwise and rte_errno is set.
121 */
122int
123mlx5_txq_devx_modify(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type,
124 uint8_t dev_port)
125{
126 struct mlx5_devx_modify_sq_attr msq_attr = { 0 };
127 int ret;
128
129 if (type != MLX5_TXQ_MOD_RST2RDY) {
130 /* Change queue state to reset. */
131 if (type == MLX5_TXQ_MOD_ERR2RDY)
132 msq_attr.sq_state = MLX5_SQC_STATE_ERR;
133 else
134 msq_attr.sq_state = MLX5_SQC_STATE_RDY;
135 msq_attr.state = MLX5_SQC_STATE_RST;
136 ret = mlx5_devx_cmd_modify_sq(obj->sq_obj.sq, &msq_attr);
137 if (ret) {
138 DRV_LOG(ERR, "Cannot change the Tx SQ state to RESET"
139 " %s", strerror(errno));
140 rte_errno = errno;
141 return ret;
142 }
143 }
144 if (type != MLX5_TXQ_MOD_RDY2RST) {
145 /* Change queue state to ready. */
146 msq_attr.sq_state = MLX5_SQC_STATE_RST;
147 msq_attr.state = MLX5_SQC_STATE_RDY;
148 ret = mlx5_devx_cmd_modify_sq(obj->sq_obj.sq, &msq_attr);
149 if (ret) {
150 DRV_LOG(ERR, "Cannot change the Tx SQ state to READY"
151 " %s", strerror(errno));
152 rte_errno = errno;
153 return ret;
154 }
155 }
156 /*
157 * The dev_port variable is relevant only in Verbs API, and there is a
158 * pointer that points to this function and a parallel function in verbs
159 * intermittently, so they should have the same parameters.
160 */
161 (void)dev_port;
162 return 0;
163}
164
165/**
166 * Release an Rx DevX queue object.

Callers 1

mlx5_txq_devx_obj_newFunction · 0.85

Calls 1

mlx5_devx_cmd_modify_sqFunction · 0.85

Tested by

no test coverage detected