Lines Matching refs:vsi

18 static struct irdma_ws_node *irdma_alloc_node(struct irdma_sc_vsi *vsi,  in irdma_alloc_node()  argument
33 node_index = irdma_alloc_ws_node_id(vsi->dev); in irdma_alloc_node()
42 node->vsi_index = vsi->vsi_idx; in irdma_alloc_node()
46 node->traffic_class = vsi->qos[user_pri].traffic_class; in irdma_alloc_node()
48 node->rel_bw = vsi->qos[user_pri].rel_bw; in irdma_alloc_node()
52 node->lan_qs_handle = vsi->qos[user_pri].lan_qos_handle; in irdma_alloc_node()
70 static void irdma_free_node(struct irdma_sc_vsi *vsi, in irdma_free_node() argument
76 irdma_free_ws_node_id(vsi->dev, node->index); in irdma_free_node()
89 static int irdma_ws_cqp_cmd(struct irdma_sc_vsi *vsi, in irdma_ws_cqp_cmd() argument
95 node_info.vsi = node->vsi_index; in irdma_ws_cqp_cmd()
106 if (irdma_cqp_ws_node_cmd(vsi->dev, cmd, &node_info)) { in irdma_ws_cqp_cmd()
107 ibdev_dbg(to_ibdev(vsi->dev), "WS: CQP WS CMD failed\n"); in irdma_ws_cqp_cmd()
113 vsi->qos[node->user_pri].qs_handle = node_info.qs_handle; in irdma_ws_cqp_cmd()
156 static bool irdma_tc_in_use(struct irdma_sc_vsi *vsi, u8 user_pri) in irdma_tc_in_use() argument
160 mutex_lock(&vsi->qos[user_pri].qos_mutex); in irdma_tc_in_use()
161 if (!list_empty(&vsi->qos[user_pri].qplist)) { in irdma_tc_in_use()
162 mutex_unlock(&vsi->qos[user_pri].qos_mutex); in irdma_tc_in_use()
170 if (vsi->qos[i].traffic_class == vsi->qos[user_pri].traffic_class && in irdma_tc_in_use()
171 !list_empty(&vsi->qos[i].qplist)) { in irdma_tc_in_use()
172 mutex_unlock(&vsi->qos[user_pri].qos_mutex); in irdma_tc_in_use()
176 mutex_unlock(&vsi->qos[user_pri].qos_mutex); in irdma_tc_in_use()
186 static void irdma_remove_leaf(struct irdma_sc_vsi *vsi, u8 user_pri) in irdma_remove_leaf() argument
192 traffic_class = vsi->qos[user_pri].traffic_class; in irdma_remove_leaf()
194 if (vsi->qos[i].traffic_class == traffic_class) in irdma_remove_leaf()
195 vsi->qos[i].valid = false; in irdma_remove_leaf()
197 ws_tree_root = vsi->dev->ws_tree_root; in irdma_remove_leaf()
201 vsi_node = ws_find_node(ws_tree_root, vsi->vsi_idx, in irdma_remove_leaf()
207 vsi->qos[user_pri].traffic_class, in irdma_remove_leaf()
212 irdma_ws_cqp_cmd(vsi, tc_node, IRDMA_OP_WS_DELETE_NODE); in irdma_remove_leaf()
213 vsi->unregister_qset(vsi, tc_node); in irdma_remove_leaf()
215 irdma_free_node(vsi, tc_node); in irdma_remove_leaf()
218 irdma_ws_cqp_cmd(vsi, vsi_node, IRDMA_OP_WS_DELETE_NODE); in irdma_remove_leaf()
220 irdma_free_node(vsi, vsi_node); in irdma_remove_leaf()
223 irdma_ws_cqp_cmd(vsi, ws_tree_root, in irdma_remove_leaf()
225 irdma_free_node(vsi, ws_tree_root); in irdma_remove_leaf()
226 vsi->dev->ws_tree_root = NULL; in irdma_remove_leaf()
236 int irdma_ws_add(struct irdma_sc_vsi *vsi, u8 user_pri) in irdma_ws_add() argument
245 mutex_lock(&vsi->dev->ws_mutex); in irdma_ws_add()
246 if (vsi->tc_change_pending) { in irdma_ws_add()
251 if (vsi->qos[user_pri].valid) in irdma_ws_add()
254 ws_tree_root = vsi->dev->ws_tree_root; in irdma_ws_add()
256 ibdev_dbg(to_ibdev(vsi->dev), "WS: Creating root node\n"); in irdma_ws_add()
257 ws_tree_root = irdma_alloc_node(vsi, user_pri, in irdma_ws_add()
264 ret = irdma_ws_cqp_cmd(vsi, ws_tree_root, IRDMA_OP_WS_ADD_NODE); in irdma_ws_add()
266 irdma_free_node(vsi, ws_tree_root); in irdma_ws_add()
270 vsi->dev->ws_tree_root = ws_tree_root; in irdma_ws_add()
274 vsi_node = ws_find_node(ws_tree_root, vsi->vsi_idx, in irdma_ws_add()
279 ibdev_dbg(to_ibdev(vsi->dev), in irdma_ws_add()
281 vsi->vsi_idx); in irdma_ws_add()
282 vsi_node = irdma_alloc_node(vsi, user_pri, WS_NODE_TYPE_PARENT, in irdma_ws_add()
289 ret = irdma_ws_cqp_cmd(vsi, vsi_node, IRDMA_OP_WS_ADD_NODE); in irdma_ws_add()
291 irdma_free_node(vsi, vsi_node); in irdma_ws_add()
298 ibdev_dbg(to_ibdev(vsi->dev), in irdma_ws_add()
300 vsi_node->index, vsi->vsi_idx); in irdma_ws_add()
301 traffic_class = vsi->qos[user_pri].traffic_class; in irdma_ws_add()
306 ibdev_dbg(to_ibdev(vsi->dev), in irdma_ws_add()
308 vsi->vsi_idx, traffic_class); in irdma_ws_add()
309 tc_node = irdma_alloc_node(vsi, user_pri, WS_NODE_TYPE_LEAF, in irdma_ws_add()
316 ret = irdma_ws_cqp_cmd(vsi, tc_node, IRDMA_OP_WS_ADD_NODE); in irdma_ws_add()
318 irdma_free_node(vsi, tc_node); in irdma_ws_add()
326 ret = vsi->register_qset(vsi, tc_node); in irdma_ws_add()
331 ret = irdma_ws_cqp_cmd(vsi, tc_node, IRDMA_OP_WS_MODIFY_NODE); in irdma_ws_add()
333 vsi->unregister_qset(vsi, tc_node); in irdma_ws_add()
337 ibdev_dbg(to_ibdev(vsi->dev), in irdma_ws_add()
339 tc_node->index, vsi->vsi_idx, traffic_class); in irdma_ws_add()
345 if (vsi->qos[i].traffic_class == traffic_class) { in irdma_ws_add()
346 vsi->qos[i].qs_handle = tc_node->qs_handle; in irdma_ws_add()
347 vsi->qos[i].lan_qos_handle = tc_node->lan_qs_handle; in irdma_ws_add()
348 vsi->qos[i].l2_sched_node_id = tc_node->l2_sched_node_id; in irdma_ws_add()
349 vsi->qos[i].valid = true; in irdma_ws_add()
355 irdma_ws_cqp_cmd(vsi, tc_node, IRDMA_OP_WS_DELETE_NODE); in irdma_ws_add()
357 irdma_free_node(vsi, tc_node); in irdma_ws_add()
360 if (irdma_ws_cqp_cmd(vsi, vsi_node, IRDMA_OP_WS_DELETE_NODE)) in irdma_ws_add()
363 irdma_free_node(vsi, vsi_node); in irdma_ws_add()
369 irdma_ws_cqp_cmd(vsi, ws_tree_root, IRDMA_OP_WS_DELETE_NODE); in irdma_ws_add()
370 vsi->dev->ws_tree_root = NULL; in irdma_ws_add()
371 irdma_free_node(vsi, ws_tree_root); in irdma_ws_add()
375 mutex_unlock(&vsi->dev->ws_mutex); in irdma_ws_add()
384 void irdma_ws_remove(struct irdma_sc_vsi *vsi, u8 user_pri) in irdma_ws_remove() argument
386 mutex_lock(&vsi->dev->ws_mutex); in irdma_ws_remove()
387 if (irdma_tc_in_use(vsi, user_pri)) in irdma_ws_remove()
389 irdma_remove_leaf(vsi, user_pri); in irdma_ws_remove()
391 mutex_unlock(&vsi->dev->ws_mutex); in irdma_ws_remove()
398 void irdma_ws_reset(struct irdma_sc_vsi *vsi) in irdma_ws_reset() argument
402 mutex_lock(&vsi->dev->ws_mutex); in irdma_ws_reset()
404 irdma_remove_leaf(vsi, i); in irdma_ws_reset()
405 mutex_unlock(&vsi->dev->ws_mutex); in irdma_ws_reset()