Lines Matching refs:slave

306 static void rem_slave_vlans(struct mlx4_dev *dev, int slave);
307 static inline int mlx4_grant_resource(struct mlx4_dev *dev, int slave, in mlx4_grant_resource() argument
318 if (slave > dev->persist->num_vfs) in mlx4_grant_resource()
324 (dev->persist->num_vfs + 1) + slave] : in mlx4_grant_resource()
325 res_alloc->allocated[slave]; in mlx4_grant_resource()
330 guaranteed = res_alloc->guaranteed[slave]; in mlx4_grant_resource()
332 if (allocated + count > res_alloc->quota[slave]) { in mlx4_grant_resource()
334 slave, port, resource_str(res_type), count, in mlx4_grant_resource()
335 allocated, res_alloc->quota[slave]); in mlx4_grant_resource()
355 slave, port, resource_str(res_type), free, in mlx4_grant_resource()
363 (dev->persist->num_vfs + 1) + slave] += count; in mlx4_grant_resource()
367 res_alloc->allocated[slave] += count; in mlx4_grant_resource()
378 static inline void mlx4_release_resource(struct mlx4_dev *dev, int slave, in mlx4_release_resource() argument
387 if (slave > dev->persist->num_vfs) in mlx4_release_resource()
394 (dev->persist->num_vfs + 1) + slave] : in mlx4_release_resource()
395 res_alloc->allocated[slave]; in mlx4_release_resource()
396 guaranteed = res_alloc->guaranteed[slave]; in mlx4_release_resource()
410 (dev->persist->num_vfs + 1) + slave] -= count; in mlx4_release_resource()
414 res_alloc->allocated[slave] -= count; in mlx4_release_resource()
691 static void update_pkey_index(struct mlx4_dev *dev, int slave, in update_pkey_index() argument
702 new_index = priv->virt2phys_pkey[slave][port - 1][orig_index]; in update_pkey_index()
707 u8 slave) in update_gid() argument
718 mlx4_get_base_gid_ix(dev, slave, port) | 0x80; in update_gid()
720 qp_ctx->pri_path.mgid_index = slave | 0x80; in update_gid()
727 mlx4_get_base_gid_ix(dev, slave, port); in update_gid()
730 qp_ctx->pri_path.mgid_index = slave & 0x7F; in update_gid()
737 mlx4_get_base_gid_ix(dev, slave, port); in update_gid()
740 qp_ctx->alt_path.mgid_index = slave & 0x7F; in update_gid()
747 u8 slave, int port);
751 u8 slave, u32 qpn) in update_vport_qp_param() argument
761 vp_oper = &priv->mfunc.master.vf_oper[slave].vport[port]; in update_vport_qp_param()
764 err = handle_counter(dev, qpc, slave, port); in update_vport_qp_param()
891 static int _get_res(struct mlx4_dev *dev, int slave, u64 res_id, in _get_res() argument
908 func_name, slave, res_id, mlx4_resource_type_to_str(type), in _get_res()
914 if (r->owner != slave) { in _get_res()
931 #define get_res(dev, slave, res_id, type, res) \ argument
932 _get_res((dev), (slave), (res_id), (type), (res), __func__)
936 u64 res_id, int *slave) in mlx4_get_slave_from_resource_id() argument
949 *slave = r->owner; in mlx4_get_slave_from_resource_id()
957 static void put_res(struct mlx4_dev *dev, int slave, u64 res_id, in put_res() argument
971 static int counter_alloc_res(struct mlx4_dev *dev, int slave, int op, int cmd,
974 static int handle_existing_counter(struct mlx4_dev *dev, u8 slave, int port, in handle_existing_counter() argument
986 if (!r || r->owner != slave) { in handle_existing_counter()
999 struct mlx4_qp_context *qpc, u8 slave, in handle_unexisting_counter() argument
1011 &tracker->slave_list[slave].res_list[RES_COUNTER], in handle_unexisting_counter()
1023 err = counter_alloc_res(dev, slave, RES_OP_RESERVE, 0, 0, &counter_idx, in handle_unexisting_counter()
1029 __func__, slave, err); in handle_unexisting_counter()
1033 __func__, slave, qpc->pri_path.counter_index); in handle_unexisting_counter()
1041 u8 slave, int port) in handle_counter() argument
1044 return handle_existing_counter(dev, slave, port, in handle_counter()
1047 return handle_unexisting_counter(dev, qpc, slave, port); in handle_counter()
1186 static struct res_common *alloc_tr(u64 id, enum mlx4_resource type, int slave, in alloc_tr() argument
1226 ret->owner = slave; in alloc_tr()
1231 int mlx4_calc_vf_counters(struct mlx4_dev *dev, int slave, int port, in mlx4_calc_vf_counters() argument
1250 &tracker->slave_list[slave].res_list[RES_COUNTER], in mlx4_calc_vf_counters()
1278 static int add_res_range(struct mlx4_dev *dev, int slave, u64 base, int count, in add_res_range() argument
1293 res_arr[i] = alloc_tr(base + i, type, slave, extra); in add_res_range()
1313 &tracker->slave_list[slave].res_list[type]); in add_res_range()
1465 static int rem_res_range(struct mlx4_dev *dev, int slave, u64 base, int count, in rem_res_range() argument
1481 if (r->owner != slave) { in rem_res_range()
1504 static int qp_res_start_move_to(struct mlx4_dev *dev, int slave, int qpn, in qp_res_start_move_to() argument
1517 else if (r->com.owner != slave) in qp_res_start_move_to()
1569 static int mr_res_start_move_to(struct mlx4_dev *dev, int slave, int index, in mr_res_start_move_to() argument
1581 else if (r->com.owner != slave) in mr_res_start_move_to()
1622 static int eq_res_start_move_to(struct mlx4_dev *dev, int slave, int index, in eq_res_start_move_to() argument
1634 else if (r->com.owner != slave) in eq_res_start_move_to()
1671 static int cq_res_start_move_to(struct mlx4_dev *dev, int slave, int cqn, in cq_res_start_move_to() argument
1683 } else if (r->com.owner != slave) { in cq_res_start_move_to()
1711 static int srq_res_start_move_to(struct mlx4_dev *dev, int slave, int index, in srq_res_start_move_to() argument
1723 } else if (r->com.owner != slave) { in srq_res_start_move_to()
1747 static void res_abort_move(struct mlx4_dev *dev, int slave, in res_abort_move() argument
1756 if (r && (r->owner == slave)) in res_abort_move()
1761 static void res_end_move(struct mlx4_dev *dev, int slave, in res_end_move() argument
1770 if (r && (r->owner == slave)) in res_end_move()
1775 static int valid_reserved(struct mlx4_dev *dev, int slave, int qpn) in valid_reserved() argument
1778 (mlx4_is_master(dev) || mlx4_is_guest_proxy(dev, slave, qpn)); in valid_reserved()
1786 static int qp_alloc_res(struct mlx4_dev *dev, int slave, int op, int cmd, in qp_alloc_res() argument
1804 err = mlx4_grant_resource(dev, slave, RES_QP, count, 0); in qp_alloc_res()
1810 mlx4_release_resource(dev, slave, RES_QP, count, 0); in qp_alloc_res()
1814 err = add_res_range(dev, slave, base, count, RES_QP, 0); in qp_alloc_res()
1816 mlx4_release_resource(dev, slave, RES_QP, count, 0); in qp_alloc_res()
1824 if (valid_reserved(dev, slave, qpn)) { in qp_alloc_res()
1825 err = add_res_range(dev, slave, qpn, 1, RES_QP, 0); in qp_alloc_res()
1830 err = qp_res_start_move_to(dev, slave, qpn, RES_QP_MAPPED, in qp_alloc_res()
1838 res_abort_move(dev, slave, RES_QP, qpn); in qp_alloc_res()
1843 res_end_move(dev, slave, RES_QP, qpn); in qp_alloc_res()
1853 static int mtt_alloc_res(struct mlx4_dev *dev, int slave, int op, int cmd, in mtt_alloc_res() argument
1865 err = mlx4_grant_resource(dev, slave, RES_MTT, 1 << order, 0); in mtt_alloc_res()
1871 mlx4_release_resource(dev, slave, RES_MTT, 1 << order, 0); in mtt_alloc_res()
1875 err = add_res_range(dev, slave, base, 1, RES_MTT, order); in mtt_alloc_res()
1877 mlx4_release_resource(dev, slave, RES_MTT, 1 << order, 0); in mtt_alloc_res()
1886 static int mpt_alloc_res(struct mlx4_dev *dev, int slave, int op, int cmd, in mpt_alloc_res() argument
1896 err = mlx4_grant_resource(dev, slave, RES_MPT, 1, 0); in mpt_alloc_res()
1902 mlx4_release_resource(dev, slave, RES_MPT, 1, 0); in mpt_alloc_res()
1907 err = add_res_range(dev, slave, id, 1, RES_MPT, index); in mpt_alloc_res()
1909 mlx4_release_resource(dev, slave, RES_MPT, 1, 0); in mpt_alloc_res()
1918 err = mr_res_start_move_to(dev, slave, id, in mpt_alloc_res()
1925 res_abort_move(dev, slave, RES_MPT, id); in mpt_alloc_res()
1929 res_end_move(dev, slave, RES_MPT, id); in mpt_alloc_res()
1935 static int cq_alloc_res(struct mlx4_dev *dev, int slave, int op, int cmd, in cq_alloc_res() argument
1943 err = mlx4_grant_resource(dev, slave, RES_CQ, 1, 0); in cq_alloc_res()
1949 mlx4_release_resource(dev, slave, RES_CQ, 1, 0); in cq_alloc_res()
1953 err = add_res_range(dev, slave, cqn, 1, RES_CQ, 0); in cq_alloc_res()
1955 mlx4_release_resource(dev, slave, RES_CQ, 1, 0); in cq_alloc_res()
1970 static int srq_alloc_res(struct mlx4_dev *dev, int slave, int op, int cmd, in srq_alloc_res() argument
1978 err = mlx4_grant_resource(dev, slave, RES_SRQ, 1, 0); in srq_alloc_res()
1984 mlx4_release_resource(dev, slave, RES_SRQ, 1, 0); in srq_alloc_res()
1988 err = add_res_range(dev, slave, srqn, 1, RES_SRQ, 0); in srq_alloc_res()
1990 mlx4_release_resource(dev, slave, RES_SRQ, 1, 0); in srq_alloc_res()
2005 static int mac_find_smac_ix_in_slave(struct mlx4_dev *dev, int slave, int port, in mac_find_smac_ix_in_slave() argument
2011 &tracker->slave_list[slave].res_list[RES_MAC]; in mac_find_smac_ix_in_slave()
2023 static int mac_add_to_slave(struct mlx4_dev *dev, int slave, u64 mac, int port, u8 smac_index) in mac_add_to_slave() argument
2028 &tracker->slave_list[slave].res_list[RES_MAC]; in mac_add_to_slave()
2039 if (mlx4_grant_resource(dev, slave, RES_MAC, 1, port)) in mac_add_to_slave()
2043 mlx4_release_resource(dev, slave, RES_MAC, 1, port); in mac_add_to_slave()
2051 &tracker->slave_list[slave].res_list[RES_MAC]); in mac_add_to_slave()
2055 static void mac_del_from_slave(struct mlx4_dev *dev, int slave, u64 mac, in mac_del_from_slave() argument
2061 &tracker->slave_list[slave].res_list[RES_MAC]; in mac_del_from_slave()
2068 mlx4_release_resource(dev, slave, RES_MAC, 1, port); in mac_del_from_slave()
2076 static void rem_slave_macs(struct mlx4_dev *dev, int slave) in rem_slave_macs() argument
2081 &tracker->slave_list[slave].res_list[RES_MAC]; in rem_slave_macs()
2090 mlx4_release_resource(dev, slave, RES_MAC, 1, res->port); in rem_slave_macs()
2095 static int mac_alloc_res(struct mlx4_dev *dev, int slave, int op, int cmd, in mac_alloc_res() argument
2108 dev, slave, port); in mac_alloc_res()
2122 err = mac_add_to_slave(dev, slave, mac, port, smac_index); in mac_alloc_res()
2129 static int vlan_add_to_slave(struct mlx4_dev *dev, int slave, u16 vlan, in vlan_add_to_slave() argument
2135 &tracker->slave_list[slave].res_list[RES_VLAN]; in vlan_add_to_slave()
2146 if (mlx4_grant_resource(dev, slave, RES_VLAN, 1, port)) in vlan_add_to_slave()
2150 mlx4_release_resource(dev, slave, RES_VLAN, 1, port); in vlan_add_to_slave()
2158 &tracker->slave_list[slave].res_list[RES_VLAN]); in vlan_add_to_slave()
2163 static void vlan_del_from_slave(struct mlx4_dev *dev, int slave, u16 vlan, in vlan_del_from_slave() argument
2169 &tracker->slave_list[slave].res_list[RES_VLAN]; in vlan_del_from_slave()
2176 mlx4_release_resource(dev, slave, RES_VLAN, in vlan_del_from_slave()
2185 static void rem_slave_vlans(struct mlx4_dev *dev, int slave) in rem_slave_vlans() argument
2190 &tracker->slave_list[slave].res_list[RES_VLAN]; in rem_slave_vlans()
2199 mlx4_release_resource(dev, slave, RES_VLAN, 1, res->port); in rem_slave_vlans()
2204 static int vlan_alloc_res(struct mlx4_dev *dev, int slave, int op, int cmd, in vlan_alloc_res() argument
2220 dev, slave, port); in vlan_alloc_res()
2226 slave_state[slave].old_vlan_api = true; in vlan_alloc_res()
2235 err = vlan_add_to_slave(dev, slave, vlan, port, vlan_index); in vlan_alloc_res()
2242 static int counter_alloc_res(struct mlx4_dev *dev, int slave, int op, int cmd, in counter_alloc_res() argument
2251 err = mlx4_grant_resource(dev, slave, RES_COUNTER, 1, 0); in counter_alloc_res()
2257 mlx4_release_resource(dev, slave, RES_COUNTER, 1, 0); in counter_alloc_res()
2261 err = add_res_range(dev, slave, index, 1, RES_COUNTER, port); in counter_alloc_res()
2264 mlx4_release_resource(dev, slave, RES_COUNTER, 1, 0); in counter_alloc_res()
2272 static int xrcdn_alloc_res(struct mlx4_dev *dev, int slave, int op, int cmd, in xrcdn_alloc_res() argument
2285 err = add_res_range(dev, slave, xrcdn, 1, RES_XRCD, 0); in xrcdn_alloc_res()
2294 int mlx4_ALLOC_RES_wrapper(struct mlx4_dev *dev, int slave, in mlx4_ALLOC_RES_wrapper() argument
2305 err = qp_alloc_res(dev, slave, vhcr->op_modifier, alop, in mlx4_ALLOC_RES_wrapper()
2310 err = mtt_alloc_res(dev, slave, vhcr->op_modifier, alop, in mlx4_ALLOC_RES_wrapper()
2315 err = mpt_alloc_res(dev, slave, vhcr->op_modifier, alop, in mlx4_ALLOC_RES_wrapper()
2320 err = cq_alloc_res(dev, slave, vhcr->op_modifier, alop, in mlx4_ALLOC_RES_wrapper()
2325 err = srq_alloc_res(dev, slave, vhcr->op_modifier, alop, in mlx4_ALLOC_RES_wrapper()
2330 err = mac_alloc_res(dev, slave, vhcr->op_modifier, alop, in mlx4_ALLOC_RES_wrapper()
2336 err = vlan_alloc_res(dev, slave, vhcr->op_modifier, alop, in mlx4_ALLOC_RES_wrapper()
2342 err = counter_alloc_res(dev, slave, vhcr->op_modifier, alop, in mlx4_ALLOC_RES_wrapper()
2347 err = xrcdn_alloc_res(dev, slave, vhcr->op_modifier, alop, in mlx4_ALLOC_RES_wrapper()
2359 static int qp_free_res(struct mlx4_dev *dev, int slave, int op, int cmd, in qp_free_res() argument
2371 err = rem_res_range(dev, slave, base, count, RES_QP, 0); in qp_free_res()
2374 mlx4_release_resource(dev, slave, RES_QP, count, 0); in qp_free_res()
2379 err = qp_res_start_move_to(dev, slave, qpn, RES_QP_RESERVED, in qp_free_res()
2387 res_end_move(dev, slave, RES_QP, qpn); in qp_free_res()
2389 if (valid_reserved(dev, slave, qpn)) in qp_free_res()
2390 err = rem_res_range(dev, slave, qpn, 1, RES_QP, 0); in qp_free_res()
2399 static int mtt_free_res(struct mlx4_dev *dev, int slave, int op, int cmd, in mtt_free_res() argument
2411 err = rem_res_range(dev, slave, base, 1, RES_MTT, order); in mtt_free_res()
2413 mlx4_release_resource(dev, slave, RES_MTT, 1 << order, 0); in mtt_free_res()
2419 static int mpt_free_res(struct mlx4_dev *dev, int slave, int op, int cmd, in mpt_free_res() argument
2431 err = get_res(dev, slave, id, RES_MPT, &mpt); in mpt_free_res()
2435 put_res(dev, slave, id, RES_MPT); in mpt_free_res()
2437 err = rem_res_range(dev, slave, id, 1, RES_MPT, 0); in mpt_free_res()
2440 mlx4_release_resource(dev, slave, RES_MPT, 1, 0); in mpt_free_res()
2446 err = mr_res_start_move_to(dev, slave, id, in mpt_free_res()
2452 res_end_move(dev, slave, RES_MPT, id); in mpt_free_res()
2461 static int cq_free_res(struct mlx4_dev *dev, int slave, int op, int cmd, in cq_free_res() argument
2470 err = rem_res_range(dev, slave, cqn, 1, RES_CQ, 0); in cq_free_res()
2474 mlx4_release_resource(dev, slave, RES_CQ, 1, 0); in cq_free_res()
2486 static int srq_free_res(struct mlx4_dev *dev, int slave, int op, int cmd, in srq_free_res() argument
2495 err = rem_res_range(dev, slave, srqn, 1, RES_SRQ, 0); in srq_free_res()
2499 mlx4_release_resource(dev, slave, RES_SRQ, 1, 0); in srq_free_res()
2511 static int mac_free_res(struct mlx4_dev *dev, int slave, int op, int cmd, in mac_free_res() argument
2521 dev, slave, port); in mac_free_res()
2525 mac_del_from_slave(dev, slave, in_param, port); in mac_free_res()
2537 static int vlan_free_res(struct mlx4_dev *dev, int slave, int op, int cmd, in vlan_free_res() argument
2545 dev, slave, port); in vlan_free_res()
2551 if (slave_state[slave].old_vlan_api) in vlan_free_res()
2555 vlan_del_from_slave(dev, slave, in_param, port); in vlan_free_res()
2566 static int counter_free_res(struct mlx4_dev *dev, int slave, int op, int cmd, in counter_free_res() argument
2579 err = rem_res_range(dev, slave, index, 1, RES_COUNTER, 0); in counter_free_res()
2584 mlx4_release_resource(dev, slave, RES_COUNTER, 1, 0); in counter_free_res()
2589 static int xrcdn_free_res(struct mlx4_dev *dev, int slave, int op, int cmd, in xrcdn_free_res() argument
2599 err = rem_res_range(dev, slave, xrcdn, 1, RES_XRCD, 0); in xrcdn_free_res()
2608 int mlx4_FREE_RES_wrapper(struct mlx4_dev *dev, int slave, in mlx4_FREE_RES_wrapper() argument
2619 err = qp_free_res(dev, slave, vhcr->op_modifier, alop, in mlx4_FREE_RES_wrapper()
2624 err = mtt_free_res(dev, slave, vhcr->op_modifier, alop, in mlx4_FREE_RES_wrapper()
2629 err = mpt_free_res(dev, slave, vhcr->op_modifier, alop, in mlx4_FREE_RES_wrapper()
2634 err = cq_free_res(dev, slave, vhcr->op_modifier, alop, in mlx4_FREE_RES_wrapper()
2639 err = srq_free_res(dev, slave, vhcr->op_modifier, alop, in mlx4_FREE_RES_wrapper()
2644 err = mac_free_res(dev, slave, vhcr->op_modifier, alop, in mlx4_FREE_RES_wrapper()
2650 err = vlan_free_res(dev, slave, vhcr->op_modifier, alop, in mlx4_FREE_RES_wrapper()
2656 err = counter_free_res(dev, slave, vhcr->op_modifier, alop, in mlx4_FREE_RES_wrapper()
2661 err = xrcdn_free_res(dev, slave, vhcr->op_modifier, alop, in mlx4_FREE_RES_wrapper()
2744 static int check_mtt_range(struct mlx4_dev *dev, int slave, int start, in check_mtt_range() argument
2755 int mlx4_SW2HW_MPT_wrapper(struct mlx4_dev *dev, int slave, in mlx4_SW2HW_MPT_wrapper() argument
2772 err = mr_res_start_move_to(dev, slave, id, RES_MPT_HW, &mpt); in mlx4_SW2HW_MPT_wrapper()
2785 if (pd_slave != 0 && --pd_slave != slave) { in mlx4_SW2HW_MPT_wrapper()
2805 err = get_res(dev, slave, mtt_base, RES_MTT, &mtt); in mlx4_SW2HW_MPT_wrapper()
2809 err = check_mtt_range(dev, slave, mtt_base, in mlx4_SW2HW_MPT_wrapper()
2817 err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd); in mlx4_SW2HW_MPT_wrapper()
2823 put_res(dev, slave, mtt->com.res_id, RES_MTT); in mlx4_SW2HW_MPT_wrapper()
2826 res_end_move(dev, slave, RES_MPT, id); in mlx4_SW2HW_MPT_wrapper()
2831 put_res(dev, slave, mtt->com.res_id, RES_MTT); in mlx4_SW2HW_MPT_wrapper()
2833 res_abort_move(dev, slave, RES_MPT, id); in mlx4_SW2HW_MPT_wrapper()
2838 int mlx4_HW2SW_MPT_wrapper(struct mlx4_dev *dev, int slave, in mlx4_HW2SW_MPT_wrapper() argument
2850 err = mr_res_start_move_to(dev, slave, id, RES_MPT_MAPPED, &mpt); in mlx4_HW2SW_MPT_wrapper()
2854 err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd); in mlx4_HW2SW_MPT_wrapper()
2861 res_end_move(dev, slave, RES_MPT, id); in mlx4_HW2SW_MPT_wrapper()
2865 res_abort_move(dev, slave, RES_MPT, id); in mlx4_HW2SW_MPT_wrapper()
2870 int mlx4_QUERY_MPT_wrapper(struct mlx4_dev *dev, int slave, in mlx4_QUERY_MPT_wrapper() argument
2882 err = get_res(dev, slave, id, RES_MPT, &mpt); in mlx4_QUERY_MPT_wrapper()
2908 err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd); in mlx4_QUERY_MPT_wrapper()
2916 put_res(dev, slave, id, RES_MPT); in mlx4_QUERY_MPT_wrapper()
2948 static int adjust_qp_sched_queue(struct mlx4_dev *dev, int slave,
2952 int mlx4_RST2INIT_QP_wrapper(struct mlx4_dev *dev, int slave, in mlx4_RST2INIT_QP_wrapper() argument
2974 err = adjust_qp_sched_queue(dev, slave, qpc, inbox); in mlx4_RST2INIT_QP_wrapper()
2978 err = qp_res_start_move_to(dev, slave, qpn, RES_QP_HW, &qp, 0); in mlx4_RST2INIT_QP_wrapper()
2991 err = get_res(dev, slave, mtt_base, RES_MTT, &mtt); in mlx4_RST2INIT_QP_wrapper()
2995 err = check_mtt_range(dev, slave, mtt_base, mtt_size, mtt); in mlx4_RST2INIT_QP_wrapper()
2999 err = get_res(dev, slave, rcqn, RES_CQ, &rcq); in mlx4_RST2INIT_QP_wrapper()
3004 err = get_res(dev, slave, scqn, RES_CQ, &scq); in mlx4_RST2INIT_QP_wrapper()
3011 err = get_res(dev, slave, srqn, RES_SRQ, &srq); in mlx4_RST2INIT_QP_wrapper()
3017 update_pkey_index(dev, slave, inbox); in mlx4_RST2INIT_QP_wrapper()
3018 err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd); in mlx4_RST2INIT_QP_wrapper()
3029 put_res(dev, slave, scqn, RES_CQ); in mlx4_RST2INIT_QP_wrapper()
3033 put_res(dev, slave, srqn, RES_SRQ); in mlx4_RST2INIT_QP_wrapper()
3039 put_res(dev, slave, rcqn, RES_CQ); in mlx4_RST2INIT_QP_wrapper()
3040 put_res(dev, slave, mtt_base, RES_MTT); in mlx4_RST2INIT_QP_wrapper()
3041 res_end_move(dev, slave, RES_QP, qpn); in mlx4_RST2INIT_QP_wrapper()
3047 put_res(dev, slave, srqn, RES_SRQ); in mlx4_RST2INIT_QP_wrapper()
3050 put_res(dev, slave, scqn, RES_CQ); in mlx4_RST2INIT_QP_wrapper()
3052 put_res(dev, slave, rcqn, RES_CQ); in mlx4_RST2INIT_QP_wrapper()
3054 put_res(dev, slave, mtt_base, RES_MTT); in mlx4_RST2INIT_QP_wrapper()
3056 res_abort_move(dev, slave, RES_QP, qpn); in mlx4_RST2INIT_QP_wrapper()
3093 int mlx4_SW2HW_EQ_wrapper(struct mlx4_dev *dev, int slave, in mlx4_SW2HW_EQ_wrapper() argument
3101 int res_id = (slave << 10) | eqn; in mlx4_SW2HW_EQ_wrapper()
3108 err = add_res_range(dev, slave, res_id, 1, RES_EQ, 0); in mlx4_SW2HW_EQ_wrapper()
3111 err = eq_res_start_move_to(dev, slave, res_id, RES_EQ_HW, &eq); in mlx4_SW2HW_EQ_wrapper()
3115 err = get_res(dev, slave, mtt_base, RES_MTT, &mtt); in mlx4_SW2HW_EQ_wrapper()
3119 err = check_mtt_range(dev, slave, mtt_base, mtt_size, mtt); in mlx4_SW2HW_EQ_wrapper()
3123 err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd); in mlx4_SW2HW_EQ_wrapper()
3129 put_res(dev, slave, mtt->com.res_id, RES_MTT); in mlx4_SW2HW_EQ_wrapper()
3130 res_end_move(dev, slave, RES_EQ, res_id); in mlx4_SW2HW_EQ_wrapper()
3134 put_res(dev, slave, mtt->com.res_id, RES_MTT); in mlx4_SW2HW_EQ_wrapper()
3136 res_abort_move(dev, slave, RES_EQ, res_id); in mlx4_SW2HW_EQ_wrapper()
3138 rem_res_range(dev, slave, res_id, 1, RES_EQ, 0); in mlx4_SW2HW_EQ_wrapper()
3142 int mlx4_CONFIG_DEV_wrapper(struct mlx4_dev *dev, int slave, in mlx4_CONFIG_DEV_wrapper() argument
3154 err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd); in mlx4_CONFIG_DEV_wrapper()
3159 static int get_containing_mtt(struct mlx4_dev *dev, int slave, int start, in get_containing_mtt() argument
3168 list_for_each_entry(mtt, &tracker->slave_list[slave].res_list[RES_MTT], in get_containing_mtt()
3170 if (!check_mtt_range(dev, slave, start, len, mtt)) { in get_containing_mtt()
3186 enum qp_transition transition, u8 slave) in verify_qp_parameters() argument
3199 if (slave != mlx4_master_func_num(dev)) { in verify_qp_parameters()
3216 if (slave != mlx4_master_func_num(dev)) { in verify_qp_parameters()
3220 num_gids = mlx4_get_slave_num_gids(dev, slave, port); in verify_qp_parameters()
3229 num_gids = mlx4_get_slave_num_gids(dev, slave, port); in verify_qp_parameters()
3246 slave != mlx4_master_func_num(dev) && in verify_qp_parameters()
3248 !mlx4_vf_smi_enabled(dev, slave, port)) { in verify_qp_parameters()
3251 __func__, slave, port); in verify_qp_parameters()
3263 int mlx4_WRITE_MTT_wrapper(struct mlx4_dev *dev, int slave, in mlx4_WRITE_MTT_wrapper() argument
3278 err = get_containing_mtt(dev, slave, start, npages, &rmtt); in mlx4_WRITE_MTT_wrapper()
3296 put_res(dev, slave, rmtt->com.res_id, RES_MTT); in mlx4_WRITE_MTT_wrapper()
3301 int mlx4_HW2SW_EQ_wrapper(struct mlx4_dev *dev, int slave, in mlx4_HW2SW_EQ_wrapper() argument
3308 int res_id = eqn | (slave << 10); in mlx4_HW2SW_EQ_wrapper()
3312 err = eq_res_start_move_to(dev, slave, res_id, RES_EQ_RESERVED, &eq); in mlx4_HW2SW_EQ_wrapper()
3316 err = get_res(dev, slave, eq->mtt->com.res_id, RES_MTT, NULL); in mlx4_HW2SW_EQ_wrapper()
3320 err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd); in mlx4_HW2SW_EQ_wrapper()
3325 put_res(dev, slave, eq->mtt->com.res_id, RES_MTT); in mlx4_HW2SW_EQ_wrapper()
3326 res_end_move(dev, slave, RES_EQ, res_id); in mlx4_HW2SW_EQ_wrapper()
3327 rem_res_range(dev, slave, res_id, 1, RES_EQ, 0); in mlx4_HW2SW_EQ_wrapper()
3332 put_res(dev, slave, eq->mtt->com.res_id, RES_MTT); in mlx4_HW2SW_EQ_wrapper()
3334 res_abort_move(dev, slave, RES_EQ, res_id); in mlx4_HW2SW_EQ_wrapper()
3339 int mlx4_GEN_EQE(struct mlx4_dev *dev, int slave, struct mlx4_eqe *eqe) in mlx4_GEN_EQE() argument
3353 if (slave < 0 || slave > dev->persist->num_vfs || in mlx4_GEN_EQE()
3354 slave == dev->caps.function || in mlx4_GEN_EQE()
3355 !priv->mfunc.master.slave_state[slave].active) in mlx4_GEN_EQE()
3358 event_eq = &priv->mfunc.master.slave_state[slave].event_eq[eqe->type]; in mlx4_GEN_EQE()
3364 mutex_lock(&priv->mfunc.master.gen_eqe_mutex[slave]); in mlx4_GEN_EQE()
3365 res_id = (slave << 10) | event_eq->eqn; in mlx4_GEN_EQE()
3366 err = get_res(dev, slave, res_id, RES_EQ, &req); in mlx4_GEN_EQE()
3388 in_modifier = (slave & 0xff) | ((event_eq->eqn & 0x3ff) << 16); in mlx4_GEN_EQE()
3394 put_res(dev, slave, res_id, RES_EQ); in mlx4_GEN_EQE()
3395 mutex_unlock(&priv->mfunc.master.gen_eqe_mutex[slave]); in mlx4_GEN_EQE()
3400 put_res(dev, slave, res_id, RES_EQ); in mlx4_GEN_EQE()
3403 mutex_unlock(&priv->mfunc.master.gen_eqe_mutex[slave]); in mlx4_GEN_EQE()
3407 int mlx4_QUERY_EQ_wrapper(struct mlx4_dev *dev, int slave, in mlx4_QUERY_EQ_wrapper() argument
3414 int res_id = eqn | (slave << 10); in mlx4_QUERY_EQ_wrapper()
3418 err = get_res(dev, slave, res_id, RES_EQ, &eq); in mlx4_QUERY_EQ_wrapper()
3427 err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd); in mlx4_QUERY_EQ_wrapper()
3430 put_res(dev, slave, res_id, RES_EQ); in mlx4_QUERY_EQ_wrapper()
3434 int mlx4_SW2HW_CQ_wrapper(struct mlx4_dev *dev, int slave, in mlx4_SW2HW_CQ_wrapper() argument
3447 err = cq_res_start_move_to(dev, slave, cqn, RES_CQ_HW, &cq); in mlx4_SW2HW_CQ_wrapper()
3450 err = get_res(dev, slave, mtt_base, RES_MTT, &mtt); in mlx4_SW2HW_CQ_wrapper()
3453 err = check_mtt_range(dev, slave, mtt_base, cq_get_mtt_size(cqc), mtt); in mlx4_SW2HW_CQ_wrapper()
3456 err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd); in mlx4_SW2HW_CQ_wrapper()
3461 put_res(dev, slave, mtt->com.res_id, RES_MTT); in mlx4_SW2HW_CQ_wrapper()
3462 res_end_move(dev, slave, RES_CQ, cqn); in mlx4_SW2HW_CQ_wrapper()
3466 put_res(dev, slave, mtt->com.res_id, RES_MTT); in mlx4_SW2HW_CQ_wrapper()
3468 res_abort_move(dev, slave, RES_CQ, cqn); in mlx4_SW2HW_CQ_wrapper()
3472 int mlx4_HW2SW_CQ_wrapper(struct mlx4_dev *dev, int slave, in mlx4_HW2SW_CQ_wrapper() argument
3482 err = cq_res_start_move_to(dev, slave, cqn, RES_CQ_ALLOCATED, &cq); in mlx4_HW2SW_CQ_wrapper()
3485 err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd); in mlx4_HW2SW_CQ_wrapper()
3489 res_end_move(dev, slave, RES_CQ, cqn); in mlx4_HW2SW_CQ_wrapper()
3493 res_abort_move(dev, slave, RES_CQ, cqn); in mlx4_HW2SW_CQ_wrapper()
3497 int mlx4_QUERY_CQ_wrapper(struct mlx4_dev *dev, int slave, in mlx4_QUERY_CQ_wrapper() argument
3507 err = get_res(dev, slave, cqn, RES_CQ, &cq); in mlx4_QUERY_CQ_wrapper()
3514 err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd); in mlx4_QUERY_CQ_wrapper()
3516 put_res(dev, slave, cqn, RES_CQ); in mlx4_QUERY_CQ_wrapper()
3521 static int handle_resize(struct mlx4_dev *dev, int slave, in handle_resize() argument
3534 err = get_res(dev, slave, cq->mtt->com.res_id, RES_MTT, &orig_mtt); in handle_resize()
3543 err = get_res(dev, slave, mtt_base, RES_MTT, &mtt); in handle_resize()
3547 err = check_mtt_range(dev, slave, mtt_base, cq_get_mtt_size(cqc), mtt); in handle_resize()
3550 err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd); in handle_resize()
3554 put_res(dev, slave, orig_mtt->com.res_id, RES_MTT); in handle_resize()
3557 put_res(dev, slave, mtt->com.res_id, RES_MTT); in handle_resize()
3561 put_res(dev, slave, mtt->com.res_id, RES_MTT); in handle_resize()
3563 put_res(dev, slave, orig_mtt->com.res_id, RES_MTT); in handle_resize()
3569 int mlx4_MODIFY_CQ_wrapper(struct mlx4_dev *dev, int slave, in mlx4_MODIFY_CQ_wrapper() argument
3579 err = get_res(dev, slave, cqn, RES_CQ, &cq); in mlx4_MODIFY_CQ_wrapper()
3587 err = handle_resize(dev, slave, vhcr, inbox, outbox, cmd, cq); in mlx4_MODIFY_CQ_wrapper()
3591 err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd); in mlx4_MODIFY_CQ_wrapper()
3593 put_res(dev, slave, cqn, RES_CQ); in mlx4_MODIFY_CQ_wrapper()
3610 int mlx4_SW2HW_SRQ_wrapper(struct mlx4_dev *dev, int slave, in mlx4_SW2HW_SRQ_wrapper() argument
3626 err = srq_res_start_move_to(dev, slave, srqn, RES_SRQ_HW, &srq); in mlx4_SW2HW_SRQ_wrapper()
3629 err = get_res(dev, slave, mtt_base, RES_MTT, &mtt); in mlx4_SW2HW_SRQ_wrapper()
3632 err = check_mtt_range(dev, slave, mtt_base, srq_get_mtt_size(srqc), in mlx4_SW2HW_SRQ_wrapper()
3637 err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd); in mlx4_SW2HW_SRQ_wrapper()
3643 put_res(dev, slave, mtt->com.res_id, RES_MTT); in mlx4_SW2HW_SRQ_wrapper()
3644 res_end_move(dev, slave, RES_SRQ, srqn); in mlx4_SW2HW_SRQ_wrapper()
3648 put_res(dev, slave, mtt->com.res_id, RES_MTT); in mlx4_SW2HW_SRQ_wrapper()
3650 res_abort_move(dev, slave, RES_SRQ, srqn); in mlx4_SW2HW_SRQ_wrapper()
3655 int mlx4_HW2SW_SRQ_wrapper(struct mlx4_dev *dev, int slave, in mlx4_HW2SW_SRQ_wrapper() argument
3665 err = srq_res_start_move_to(dev, slave, srqn, RES_SRQ_ALLOCATED, &srq); in mlx4_HW2SW_SRQ_wrapper()
3668 err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd); in mlx4_HW2SW_SRQ_wrapper()
3674 res_end_move(dev, slave, RES_SRQ, srqn); in mlx4_HW2SW_SRQ_wrapper()
3679 res_abort_move(dev, slave, RES_SRQ, srqn); in mlx4_HW2SW_SRQ_wrapper()
3684 int mlx4_QUERY_SRQ_wrapper(struct mlx4_dev *dev, int slave, in mlx4_QUERY_SRQ_wrapper() argument
3694 err = get_res(dev, slave, srqn, RES_SRQ, &srq); in mlx4_QUERY_SRQ_wrapper()
3701 err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd); in mlx4_QUERY_SRQ_wrapper()
3703 put_res(dev, slave, srqn, RES_SRQ); in mlx4_QUERY_SRQ_wrapper()
3707 int mlx4_ARM_SRQ_wrapper(struct mlx4_dev *dev, int slave, in mlx4_ARM_SRQ_wrapper() argument
3717 err = get_res(dev, slave, srqn, RES_SRQ, &srq); in mlx4_ARM_SRQ_wrapper()
3726 err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd); in mlx4_ARM_SRQ_wrapper()
3728 put_res(dev, slave, srqn, RES_SRQ); in mlx4_ARM_SRQ_wrapper()
3732 int mlx4_GEN_QP_wrapper(struct mlx4_dev *dev, int slave, in mlx4_GEN_QP_wrapper() argument
3742 err = get_res(dev, slave, qpn, RES_QP, &qp); in mlx4_GEN_QP_wrapper()
3750 err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd); in mlx4_GEN_QP_wrapper()
3752 put_res(dev, slave, qpn, RES_QP); in mlx4_GEN_QP_wrapper()
3756 int mlx4_INIT2INIT_QP_wrapper(struct mlx4_dev *dev, int slave, in mlx4_INIT2INIT_QP_wrapper() argument
3764 update_pkey_index(dev, slave, inbox); in mlx4_INIT2INIT_QP_wrapper()
3765 return mlx4_GEN_QP_wrapper(dev, slave, vhcr, inbox, outbox, cmd); in mlx4_INIT2INIT_QP_wrapper()
3768 static int adjust_qp_sched_queue(struct mlx4_dev *dev, int slave, in adjust_qp_sched_queue() argument
3775 dev, slave, (qpc->pri_path.sched_queue >> 6 & 1) + 1) - 1; in adjust_qp_sched_queue()
3790 dev, slave, (qpc->alt_path.sched_queue >> 6 & 1) in adjust_qp_sched_queue()
3801 static int roce_verify_mac(struct mlx4_dev *dev, int slave, in roce_verify_mac() argument
3814 if (mac_find_smac_ix_in_slave(dev, slave, port, smac_ix, &mac)) in roce_verify_mac()
3820 int mlx4_INIT2RTR_QP_wrapper(struct mlx4_dev *dev, int slave, in mlx4_INIT2RTR_QP_wrapper() argument
3837 err = adjust_qp_sched_queue(dev, slave, qpc, inbox); in mlx4_INIT2RTR_QP_wrapper()
3840 err = verify_qp_parameters(dev, vhcr, inbox, QP_TRANS_INIT2RTR, slave); in mlx4_INIT2RTR_QP_wrapper()
3844 if (roce_verify_mac(dev, slave, qpc, inbox)) in mlx4_INIT2RTR_QP_wrapper()
3847 update_pkey_index(dev, slave, inbox); in mlx4_INIT2RTR_QP_wrapper()
3848 update_gid(dev, inbox, (u8)slave); in mlx4_INIT2RTR_QP_wrapper()
3852 err = get_res(dev, slave, qpn, RES_QP, &qp); in mlx4_INIT2RTR_QP_wrapper()
3860 err = update_vport_qp_param(dev, inbox, slave, qpn); in mlx4_INIT2RTR_QP_wrapper()
3864 err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd); in mlx4_INIT2RTR_QP_wrapper()
3878 put_res(dev, slave, qpn, RES_QP); in mlx4_INIT2RTR_QP_wrapper()
3882 int mlx4_RTR2RTS_QP_wrapper(struct mlx4_dev *dev, int slave, in mlx4_RTR2RTS_QP_wrapper() argument
3891 err = adjust_qp_sched_queue(dev, slave, context, inbox); in mlx4_RTR2RTS_QP_wrapper()
3894 err = verify_qp_parameters(dev, vhcr, inbox, QP_TRANS_RTR2RTS, slave); in mlx4_RTR2RTS_QP_wrapper()
3898 update_pkey_index(dev, slave, inbox); in mlx4_RTR2RTS_QP_wrapper()
3899 update_gid(dev, inbox, (u8)slave); in mlx4_RTR2RTS_QP_wrapper()
3901 return mlx4_GEN_QP_wrapper(dev, slave, vhcr, inbox, outbox, cmd); in mlx4_RTR2RTS_QP_wrapper()
3904 int mlx4_RTS2RTS_QP_wrapper(struct mlx4_dev *dev, int slave, in mlx4_RTS2RTS_QP_wrapper() argument
3913 err = adjust_qp_sched_queue(dev, slave, context, inbox); in mlx4_RTS2RTS_QP_wrapper()
3916 err = verify_qp_parameters(dev, vhcr, inbox, QP_TRANS_RTS2RTS, slave); in mlx4_RTS2RTS_QP_wrapper()
3920 update_pkey_index(dev, slave, inbox); in mlx4_RTS2RTS_QP_wrapper()
3921 update_gid(dev, inbox, (u8)slave); in mlx4_RTS2RTS_QP_wrapper()
3923 return mlx4_GEN_QP_wrapper(dev, slave, vhcr, inbox, outbox, cmd); in mlx4_RTS2RTS_QP_wrapper()
3927 int mlx4_SQERR2RTS_QP_wrapper(struct mlx4_dev *dev, int slave, in mlx4_SQERR2RTS_QP_wrapper() argument
3934 int err = adjust_qp_sched_queue(dev, slave, context, inbox); in mlx4_SQERR2RTS_QP_wrapper()
3938 return mlx4_GEN_QP_wrapper(dev, slave, vhcr, inbox, outbox, cmd); in mlx4_SQERR2RTS_QP_wrapper()
3941 int mlx4_SQD2SQD_QP_wrapper(struct mlx4_dev *dev, int slave, in mlx4_SQD2SQD_QP_wrapper() argument
3950 err = adjust_qp_sched_queue(dev, slave, context, inbox); in mlx4_SQD2SQD_QP_wrapper()
3953 err = verify_qp_parameters(dev, vhcr, inbox, QP_TRANS_SQD2SQD, slave); in mlx4_SQD2SQD_QP_wrapper()
3958 update_gid(dev, inbox, (u8)slave); in mlx4_SQD2SQD_QP_wrapper()
3959 update_pkey_index(dev, slave, inbox); in mlx4_SQD2SQD_QP_wrapper()
3960 return mlx4_GEN_QP_wrapper(dev, slave, vhcr, inbox, outbox, cmd); in mlx4_SQD2SQD_QP_wrapper()
3963 int mlx4_SQD2RTS_QP_wrapper(struct mlx4_dev *dev, int slave, in mlx4_SQD2RTS_QP_wrapper() argument
3972 err = adjust_qp_sched_queue(dev, slave, context, inbox); in mlx4_SQD2RTS_QP_wrapper()
3975 err = verify_qp_parameters(dev, vhcr, inbox, QP_TRANS_SQD2RTS, slave); in mlx4_SQD2RTS_QP_wrapper()
3980 update_gid(dev, inbox, (u8)slave); in mlx4_SQD2RTS_QP_wrapper()
3981 update_pkey_index(dev, slave, inbox); in mlx4_SQD2RTS_QP_wrapper()
3982 return mlx4_GEN_QP_wrapper(dev, slave, vhcr, inbox, outbox, cmd); in mlx4_SQD2RTS_QP_wrapper()
3985 int mlx4_2RST_QP_wrapper(struct mlx4_dev *dev, int slave, in mlx4_2RST_QP_wrapper() argument
3995 err = qp_res_start_move_to(dev, slave, qpn, RES_QP_MAPPED, &qp, 0); in mlx4_2RST_QP_wrapper()
3998 err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd); in mlx4_2RST_QP_wrapper()
4007 res_end_move(dev, slave, RES_QP, qpn); in mlx4_2RST_QP_wrapper()
4011 res_abort_move(dev, slave, RES_QP, qpn); in mlx4_2RST_QP_wrapper()
4016 static struct res_gid *find_gid(struct mlx4_dev *dev, int slave, in find_gid() argument
4028 static int add_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp, in add_mcg_res() argument
4040 if (find_gid(dev, slave, rqp, gid)) { in add_mcg_res()
4056 static int rem_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp, in rem_mcg_res() argument
4064 res = find_gid(dev, slave, rqp, gid); in rem_mcg_res()
4078 static int qp_attach(struct mlx4_dev *dev, int slave, struct mlx4_qp *qp, in qp_attach() argument
4084 int port = mlx4_slave_convert_port(dev, slave, gid[5]); in qp_attach()
4093 int port = mlx4_slave_convert_port(dev, slave, gid[5]); in qp_attach()
4119 static int mlx4_adjust_port(struct mlx4_dev *dev, int slave, in mlx4_adjust_port() argument
4129 real_port = mlx4_slave_convert_port(dev, slave, gid[5]); in mlx4_adjust_port()
4138 int mlx4_QP_ATTACH_wrapper(struct mlx4_dev *dev, int slave, in mlx4_QP_ATTACH_wrapper() argument
4157 err = get_res(dev, slave, qpn, RES_QP, &rqp); in mlx4_QP_ATTACH_wrapper()
4163 err = qp_attach(dev, slave, &qp, gid, block_loopback, prot, in mlx4_QP_ATTACH_wrapper()
4169 err = add_mcg_res(dev, slave, rqp, gid, prot, type, reg_id); in mlx4_QP_ATTACH_wrapper()
4173 err = mlx4_adjust_port(dev, slave, gid, prot); in mlx4_QP_ATTACH_wrapper()
4177 err = rem_mcg_res(dev, slave, rqp, gid, prot, type, &reg_id); in mlx4_QP_ATTACH_wrapper()
4186 put_res(dev, slave, qpn, RES_QP); in mlx4_QP_ATTACH_wrapper()
4192 put_res(dev, slave, qpn, RES_QP); in mlx4_QP_ATTACH_wrapper()
4200 static int validate_eth_header_mac(int slave, struct _rule_hw *eth_header, in validate_eth_header_mac() argument
4215 eth_header->eth.dst_mac, slave); in validate_eth_header_mac()
4225 static int add_eth_header(struct mlx4_dev *dev, int slave, in add_eth_header() argument
4284 int mlx4_UPDATE_QP_wrapper(struct mlx4_dev *dev, int slave, in mlx4_UPDATE_QP_wrapper() argument
4311 slave); in mlx4_UPDATE_QP_wrapper()
4316 err = get_res(dev, slave, qpn, RES_QP, &rqp); in mlx4_UPDATE_QP_wrapper()
4318 mlx4_err(dev, "Updating qpn 0x%x for slave %d rejected\n", qpn, slave); in mlx4_UPDATE_QP_wrapper()
4326 err = mac_find_smac_ix_in_slave(dev, slave, port, in mlx4_UPDATE_QP_wrapper()
4346 put_res(dev, slave, qpn, RES_QP); in mlx4_UPDATE_QP_wrapper()
4366 int mlx4_QP_FLOW_STEERING_ATTACH_wrapper(struct mlx4_dev *dev, int slave, in mlx4_QP_FLOW_STEERING_ATTACH_wrapper() argument
4375 struct list_head *rlist = &tracker->slave_list[slave].res_list[RES_MAC]; in mlx4_QP_FLOW_STEERING_ATTACH_wrapper()
4390 err = mlx4_slave_convert_port(dev, slave, ctrl->port); in mlx4_QP_FLOW_STEERING_ATTACH_wrapper()
4395 err = get_res(dev, slave, qpn, RES_QP, &rqp); in mlx4_QP_FLOW_STEERING_ATTACH_wrapper()
4408 if (validate_eth_header_mac(slave, rule_header, rlist)) { in mlx4_QP_FLOW_STEERING_ATTACH_wrapper()
4419 if (add_eth_header(dev, slave, inbox, rlist, header_id)) { in mlx4_QP_FLOW_STEERING_ATTACH_wrapper()
4440 err = add_res_range(dev, slave, vhcr->out_param, 1, RES_FS_RULE, qpn); in mlx4_QP_FLOW_STEERING_ATTACH_wrapper()
4446 err = get_res(dev, slave, vhcr->out_param, RES_FS_RULE, &rrule); in mlx4_QP_FLOW_STEERING_ATTACH_wrapper()
4473 put_res(dev, slave, vhcr->out_param, RES_FS_RULE); in mlx4_QP_FLOW_STEERING_ATTACH_wrapper()
4481 put_res(dev, slave, qpn, RES_QP); in mlx4_QP_FLOW_STEERING_ATTACH_wrapper()
4500 int mlx4_QP_FLOW_STEERING_DETACH_wrapper(struct mlx4_dev *dev, int slave, in mlx4_QP_FLOW_STEERING_DETACH_wrapper() argument
4516 err = get_res(dev, slave, vhcr->in_param, RES_FS_RULE, &rrule); in mlx4_QP_FLOW_STEERING_DETACH_wrapper()
4522 put_res(dev, slave, vhcr->in_param, RES_FS_RULE); in mlx4_QP_FLOW_STEERING_DETACH_wrapper()
4530 put_res(dev, slave, vhcr->in_param, RES_FS_RULE); in mlx4_QP_FLOW_STEERING_DETACH_wrapper()
4531 err = get_res(dev, slave, qpn, RES_QP, &rqp); in mlx4_QP_FLOW_STEERING_DETACH_wrapper()
4536 err = get_res(dev, slave, mirr_reg_id, RES_FS_RULE, &rrule); in mlx4_QP_FLOW_STEERING_DETACH_wrapper()
4540 put_res(dev, slave, mirr_reg_id, RES_FS_RULE); in mlx4_QP_FLOW_STEERING_DETACH_wrapper()
4544 err = rem_res_range(dev, slave, vhcr->in_param, 1, RES_FS_RULE, 0); in mlx4_QP_FLOW_STEERING_DETACH_wrapper()
4556 put_res(dev, slave, qpn, RES_QP); in mlx4_QP_FLOW_STEERING_DETACH_wrapper()
4564 int mlx4_QUERY_IF_STAT_wrapper(struct mlx4_dev *dev, int slave, in mlx4_QUERY_IF_STAT_wrapper() argument
4573 err = get_res(dev, slave, index, RES_COUNTER, NULL); in mlx4_QUERY_IF_STAT_wrapper()
4577 err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd); in mlx4_QUERY_IF_STAT_wrapper()
4578 put_res(dev, slave, index, RES_COUNTER); in mlx4_QUERY_IF_STAT_wrapper()
4582 static void detach_qp(struct mlx4_dev *dev, int slave, struct res_qp *rqp) in detach_qp() argument
4604 static int _move_all_busy(struct mlx4_dev *dev, int slave, in _move_all_busy() argument
4610 struct list_head *rlist = &tracker->slave_list[slave].res_list[type]; in _move_all_busy()
4618 if (r->owner == slave) { in _move_all_busy()
4640 static int move_all_busy(struct mlx4_dev *dev, int slave, in move_all_busy() argument
4648 busy = _move_all_busy(dev, slave, type, 0); in move_all_busy()
4656 busy = _move_all_busy(dev, slave, type, 1); in move_all_busy()
4660 static void rem_slave_qps(struct mlx4_dev *dev, int slave) in rem_slave_qps() argument
4665 &tracker->slave_list[slave].res_list[RES_QP]; in rem_slave_qps()
4673 err = move_all_busy(dev, slave, RES_QP); in rem_slave_qps()
4676 slave); in rem_slave_qps()
4681 if (qp->com.owner == slave) { in rem_slave_qps()
4683 detach_qp(dev, slave, qp); in rem_slave_qps()
4693 if (!valid_reserved(dev, slave, qpn)) { in rem_slave_qps()
4695 mlx4_release_resource(dev, slave, in rem_slave_qps()
4702 if (!valid_reserved(dev, slave, qpn)) in rem_slave_qps()
4707 in_param = slave; in rem_slave_qps()
4715 slave, qp->local_qpn); in rem_slave_qps()
4733 static void rem_slave_srqs(struct mlx4_dev *dev, int slave) in rem_slave_srqs() argument
4738 &tracker->slave_list[slave].res_list[RES_SRQ]; in rem_slave_srqs()
4746 err = move_all_busy(dev, slave, RES_SRQ); in rem_slave_srqs()
4749 slave); in rem_slave_srqs()
4754 if (srq->com.owner == slave) { in rem_slave_srqs()
4766 mlx4_release_resource(dev, slave, in rem_slave_srqs()
4773 in_param = slave; in rem_slave_srqs()
4780 slave, srqn); in rem_slave_srqs()
4798 static void rem_slave_cqs(struct mlx4_dev *dev, int slave) in rem_slave_cqs() argument
4803 &tracker->slave_list[slave].res_list[RES_CQ]; in rem_slave_cqs()
4811 err = move_all_busy(dev, slave, RES_CQ); in rem_slave_cqs()
4814 slave); in rem_slave_cqs()
4819 if (cq->com.owner == slave && !atomic_read(&cq->ref_count)) { in rem_slave_cqs()
4831 mlx4_release_resource(dev, slave, in rem_slave_cqs()
4838 in_param = slave; in rem_slave_cqs()
4845 slave, cqn); in rem_slave_cqs()
4860 static void rem_slave_mrs(struct mlx4_dev *dev, int slave) in rem_slave_mrs() argument
4865 &tracker->slave_list[slave].res_list[RES_MPT]; in rem_slave_mrs()
4873 err = move_all_busy(dev, slave, RES_MPT); in rem_slave_mrs()
4876 slave); in rem_slave_mrs()
4881 if (mpt->com.owner == slave) { in rem_slave_mrs()
4893 mlx4_release_resource(dev, slave, in rem_slave_mrs()
4905 in_param = slave; in rem_slave_mrs()
4912 slave, mptn); in rem_slave_mrs()
4927 static void rem_slave_mtts(struct mlx4_dev *dev, int slave) in rem_slave_mtts() argument
4933 &tracker->slave_list[slave].res_list[RES_MTT]; in rem_slave_mtts()
4940 err = move_all_busy(dev, slave, RES_MTT); in rem_slave_mtts()
4943 slave); in rem_slave_mtts()
4948 if (mtt->com.owner == slave) { in rem_slave_mtts()
4961 mlx4_release_resource(dev, slave, RES_MTT, in rem_slave_mtts()
5063 static void rem_slave_fs_rule(struct mlx4_dev *dev, int slave) in rem_slave_fs_rule() argument
5069 &tracker->slave_list[slave].res_list[RES_FS_RULE]; in rem_slave_fs_rule()
5076 err = move_all_busy(dev, slave, RES_FS_RULE); in rem_slave_fs_rule()
5079 slave); in rem_slave_fs_rule()
5084 if (fs_rule->com.owner == slave) { in rem_slave_fs_rule()
5116 static void rem_slave_eqs(struct mlx4_dev *dev, int slave) in rem_slave_eqs() argument
5121 &tracker->slave_list[slave].res_list[RES_EQ]; in rem_slave_eqs()
5128 err = move_all_busy(dev, slave, RES_EQ); in rem_slave_eqs()
5131 slave); in rem_slave_eqs()
5136 if (eq->com.owner == slave) { in rem_slave_eqs()
5152 err = mlx4_cmd(dev, slave, eqn & 0x3ff, in rem_slave_eqs()
5158 slave, eqn & 0x3ff); in rem_slave_eqs()
5173 static void rem_slave_counters(struct mlx4_dev *dev, int slave) in rem_slave_counters() argument
5178 &tracker->slave_list[slave].res_list[RES_COUNTER]; in rem_slave_counters()
5185 err = move_all_busy(dev, slave, RES_COUNTER); in rem_slave_counters()
5188 slave); in rem_slave_counters()
5200 if (counter->com.owner == slave) { in rem_slave_counters()
5212 mlx4_release_resource(dev, slave, RES_COUNTER, 1, 0); in rem_slave_counters()
5219 static void rem_slave_xrcdns(struct mlx4_dev *dev, int slave) in rem_slave_xrcdns() argument
5224 &tracker->slave_list[slave].res_list[RES_XRCD]; in rem_slave_xrcdns()
5230 err = move_all_busy(dev, slave, RES_XRCD); in rem_slave_xrcdns()
5233 slave); in rem_slave_xrcdns()
5237 if (xrcd->com.owner == slave) { in rem_slave_xrcdns()
5248 void mlx4_delete_all_resources_for_slave(struct mlx4_dev *dev, int slave) in mlx4_delete_all_resources_for_slave() argument
5251 mlx4_reset_roce_gids(dev, slave); in mlx4_delete_all_resources_for_slave()
5252 mutex_lock(&priv->mfunc.master.res_tracker.slave_list[slave].mutex); in mlx4_delete_all_resources_for_slave()
5253 rem_slave_vlans(dev, slave); in mlx4_delete_all_resources_for_slave()
5254 rem_slave_macs(dev, slave); in mlx4_delete_all_resources_for_slave()
5255 rem_slave_fs_rule(dev, slave); in mlx4_delete_all_resources_for_slave()
5256 rem_slave_qps(dev, slave); in mlx4_delete_all_resources_for_slave()
5257 rem_slave_srqs(dev, slave); in mlx4_delete_all_resources_for_slave()
5258 rem_slave_cqs(dev, slave); in mlx4_delete_all_resources_for_slave()
5259 rem_slave_mrs(dev, slave); in mlx4_delete_all_resources_for_slave()
5260 rem_slave_eqs(dev, slave); in mlx4_delete_all_resources_for_slave()
5261 rem_slave_mtts(dev, slave); in mlx4_delete_all_resources_for_slave()
5262 rem_slave_counters(dev, slave); in mlx4_delete_all_resources_for_slave()
5263 rem_slave_xrcdns(dev, slave); in mlx4_delete_all_resources_for_slave()
5264 mutex_unlock(&priv->mfunc.master.res_tracker.slave_list[slave].mutex); in mlx4_delete_all_resources_for_slave()
5284 &tracker->slave_list[work->slave].res_list[RES_QP]; in mlx4_vf_immed_vlan_work_handler()
5310 work->slave); in mlx4_vf_immed_vlan_work_handler()
5343 if (qp->com.owner == work->slave) { in mlx4_vf_immed_vlan_work_handler()
5400 work->slave, port, qp->local_qpn, err); in mlx4_vf_immed_vlan_work_handler()
5411 errors, work->slave, work->port); in mlx4_vf_immed_vlan_work_handler()