Lines Matching full:slave
136 static int mlx4_master_process_vhcr(struct mlx4_dev *dev, int slave,
318 /* check if the slave is trying to boot in the middle of in mlx4_comm_cmd_poll()
813 int slave, u64 slave_addr, in mlx4_ACCESS_MEM() argument
820 (slave & ~0x7f) | (size & 0xff)) { in mlx4_ACCESS_MEM()
822 slave_addr, master_addr, slave, size); in mlx4_ACCESS_MEM()
827 in_param = (u64) slave | slave_addr; in mlx4_ACCESS_MEM()
831 out_param = (u64) slave | slave_addr; in mlx4_ACCESS_MEM()
891 static int mlx4_MAD_IFC_wrapper(struct mlx4_dev *dev, int slave, in mlx4_MAD_IFC_wrapper() argument
912 port = mlx4_slave_convert_port(dev, slave, slave_port); in mlx4_MAD_IFC_wrapper()
938 pidx = priv->virt2phys_pkey[slave][port - 1][vidx]; in mlx4_MAD_IFC_wrapper()
946 /*get the slave specific caps:*/ in mlx4_MAD_IFC_wrapper()
953 if (!err && slave != mlx4_master_func_num(dev)) { in mlx4_MAD_IFC_wrapper()
956 *state = (*state & 0xf0) | vf_port_state(dev, port, slave); in mlx4_MAD_IFC_wrapper()
957 slave_cap_mask = priv->mfunc.master.slave_state[slave].ib_cap_mask[port]; in mlx4_MAD_IFC_wrapper()
963 __be64 guid = mlx4_get_admin_guid(dev, slave, in mlx4_MAD_IFC_wrapper()
969 if (slave == 0 && guid == 0) { in mlx4_MAD_IFC_wrapper()
983 data, slave, port); in mlx4_MAD_IFC_wrapper()
997 slave_node_guid = mlx4_get_slave_node_guid(dev, slave); in mlx4_MAD_IFC_wrapper()
1008 if (slave != mlx4_master_func_num(dev) && in mlx4_MAD_IFC_wrapper()
1009 !mlx4_vf_smi_enabled(dev, slave, port)) { in mlx4_MAD_IFC_wrapper()
1012 …mlx4_err(dev, "Unprivileged slave %d is trying to execute a Subnet MGMT MAD, class 0x%x, method 0x… in mlx4_MAD_IFC_wrapper()
1013 slave, smp->mgmt_class, smp->method, in mlx4_MAD_IFC_wrapper()
1025 static int mlx4_CMD_EPERM_wrapper(struct mlx4_dev *dev, int slave, in mlx4_CMD_EPERM_wrapper() argument
1034 int mlx4_DMA_wrapper(struct mlx4_dev *dev, int slave, in mlx4_DMA_wrapper() argument
1048 in_param |= slave; in mlx4_DMA_wrapper()
1661 static int mlx4_master_process_vhcr(struct mlx4_dev *dev, int slave, in mlx4_master_process_vhcr() argument
1683 ret = mlx4_ACCESS_MEM(dev, priv->mfunc.vhcr_dma, slave, in mlx4_master_process_vhcr()
1684 priv->mfunc.master.slave_state[slave].vhcr_dma, in mlx4_master_process_vhcr()
1714 mlx4_err(dev, "Unknown command:0x%x accepted from slave:%d\n", in mlx4_master_process_vhcr()
1715 vhcr->op, slave); in mlx4_master_process_vhcr()
1730 ret = mlx4_ACCESS_MEM(dev, inbox->dma, slave, in mlx4_master_process_vhcr()
1744 if (cmd->verify && cmd->verify(dev, slave, vhcr, inbox)) { in mlx4_master_process_vhcr()
1745 mlx4_warn(dev, "Command:0x%x from slave: %d failed protection checks for resource_id:%d\n", in mlx4_master_process_vhcr()
1746 vhcr->op, slave, vhcr->in_modifier); in mlx4_master_process_vhcr()
1763 err = cmd->wrapper(dev, slave, vhcr, inbox, outbox, in mlx4_master_process_vhcr()
1790 "Unable to allocate counter for slave %d (%d)\n", in mlx4_master_process_vhcr()
1791 slave, err); in mlx4_master_process_vhcr()
1793 mlx4_warn(dev, "vhcr command:0x%x slave:%d failed with error:%d, status %d\n", in mlx4_master_process_vhcr()
1794 vhcr->op, slave, vhcr->errno, err); in mlx4_master_process_vhcr()
1803 ret = mlx4_ACCESS_MEM(dev, outbox->dma, slave, in mlx4_master_process_vhcr()
1809 * slave, as it is now in undefined state */ in mlx4_master_process_vhcr()
1820 ret = mlx4_ACCESS_MEM(dev, priv->mfunc.vhcr_dma, slave, in mlx4_master_process_vhcr()
1821 priv->mfunc.master.slave_state[slave].vhcr_dma, in mlx4_master_process_vhcr()
1829 mlx4_GEN_EQE(dev, slave, &priv->mfunc.master.cmd_eqe)) in mlx4_master_process_vhcr()
1830 mlx4_warn(dev, "Failed to generate command completion eqe for slave %d\n", in mlx4_master_process_vhcr()
1831 slave); in mlx4_master_process_vhcr()
1842 int slave, int port) in mlx4_master_immediate_activate_vlan_qos() argument
1851 vp_oper = &priv->mfunc.master.vf_oper[slave].vport[port]; in mlx4_master_immediate_activate_vlan_qos()
1852 vp_admin = &priv->mfunc.master.vf_admin[slave].vport[port]; in mlx4_master_immediate_activate_vlan_qos()
1861 if (!(priv->mfunc.master.slave_state[slave].active && in mlx4_master_immediate_activate_vlan_qos()
1870 mlx4_dbg(dev, "updating immediately admin params slave %d port %d\n", in mlx4_master_immediate_activate_vlan_qos()
1871 slave, port); in mlx4_master_immediate_activate_vlan_qos()
1888 "No vlan resources slave %d, port %d\n", in mlx4_master_immediate_activate_vlan_qos()
1889 slave, port); in mlx4_master_immediate_activate_vlan_qos()
1897 "alloc vlan %d idx %d slave %d port %d\n", in mlx4_master_immediate_activate_vlan_qos()
1899 admin_vlan_ix, slave, port); in mlx4_master_immediate_activate_vlan_qos()
1922 /* iterate over QPs owned by this slave, using UPDATE_QP */ in mlx4_master_immediate_activate_vlan_qos()
1924 work->slave = slave; in mlx4_master_immediate_activate_vlan_qos()
1995 static int mlx4_master_activate_admin_state(struct mlx4_priv *priv, int slave) in mlx4_master_activate_admin_state() argument
2001 &priv->mfunc.master.slave_state[slave]; in mlx4_master_activate_admin_state()
2003 &priv->dev, slave); in mlx4_master_activate_admin_state()
2007 priv->mfunc.master.vf_oper[slave].smi_enabled[port] = in mlx4_master_activate_admin_state()
2008 priv->mfunc.master.vf_admin[slave].enable_smi[port]; in mlx4_master_activate_admin_state()
2009 vp_oper = &priv->mfunc.master.vf_oper[slave].vport[port]; in mlx4_master_activate_admin_state()
2010 vp_admin = &priv->mfunc.master.vf_admin[slave].vport[port]; in mlx4_master_activate_admin_state()
2032 "No vlan resources slave %d, port %d\n", in mlx4_master_activate_admin_state()
2033 slave, port); in mlx4_master_activate_admin_state()
2036 mlx4_dbg(&priv->dev, "alloc vlan %d idx %d slave %d port %d\n", in mlx4_master_activate_admin_state()
2038 vp_oper->vlan_idx, slave, port); in mlx4_master_activate_admin_state()
2048 "No mac resources slave %d, port %d\n", in mlx4_master_activate_admin_state()
2049 slave, port); in mlx4_master_activate_admin_state()
2052 mlx4_dbg(&priv->dev, "alloc mac %llx idx %d slave %d port %d\n", in mlx4_master_activate_admin_state()
2053 vp_oper->state.mac, vp_oper->mac_idx, slave, port); in mlx4_master_activate_admin_state()
2059 static void mlx4_master_deactivate_admin_state(struct mlx4_priv *priv, int slave) in mlx4_master_deactivate_admin_state() argument
2064 &priv->dev, slave); in mlx4_master_deactivate_admin_state()
2068 priv->mfunc.master.vf_oper[slave].smi_enabled[port] = in mlx4_master_deactivate_admin_state()
2070 vp_oper = &priv->mfunc.master.vf_oper[slave].vport[port]; in mlx4_master_deactivate_admin_state()
2084 static void mlx4_master_do_cmd(struct mlx4_dev *dev, int slave, u8 cmd, in mlx4_master_do_cmd() argument
2094 slave_state[slave].comm_toggle ^= 1; in mlx4_master_do_cmd()
2095 reply = (u32) slave_state[slave].comm_toggle << 31; in mlx4_master_do_cmd()
2096 if (toggle != slave_state[slave].comm_toggle) { in mlx4_master_do_cmd()
2097 mlx4_warn(dev, "Incorrect toggle %d from slave %d. *** MASTER STATE COMPROMISED ***\n", in mlx4_master_do_cmd()
2098 toggle, slave); in mlx4_master_do_cmd()
2102 mlx4_warn(dev, "Received reset from slave:%d\n", slave); in mlx4_master_do_cmd()
2103 slave_state[slave].active = false; in mlx4_master_do_cmd()
2104 slave_state[slave].old_vlan_api = false; in mlx4_master_do_cmd()
2105 slave_state[slave].vst_qinq_supported = false; in mlx4_master_do_cmd()
2106 mlx4_master_deactivate_admin_state(priv, slave); in mlx4_master_do_cmd()
2108 slave_state[slave].event_eq[i].eqn = -1; in mlx4_master_do_cmd()
2109 slave_state[slave].event_eq[i].token = 0; in mlx4_master_do_cmd()
2112 if so return "retry" status to the slave*/ in mlx4_master_do_cmd()
2113 if (MLX4_COMM_CMD_FLR == slave_state[slave].last_cmd) in mlx4_master_do_cmd()
2116 mlx4_dispatch_event(dev, MLX4_DEV_EVENT_SLAVE_SHUTDOWN, &slave); in mlx4_master_do_cmd()
2123 /*command from slave in the middle of FLR*/ in mlx4_master_do_cmd()
2125 MLX4_COMM_CMD_FLR == slave_state[slave].last_cmd) { in mlx4_master_do_cmd()
2126 mlx4_warn(dev, "slave:%d is Trying to run cmd(0x%x) in the middle of FLR\n", in mlx4_master_do_cmd()
2127 slave, cmd); in mlx4_master_do_cmd()
2133 if (slave_state[slave].last_cmd != MLX4_COMM_CMD_RESET) in mlx4_master_do_cmd()
2135 slave_state[slave].vhcr_dma = ((u64) param) << 48; in mlx4_master_do_cmd()
2136 priv->mfunc.master.slave_state[slave].cookie = 0; in mlx4_master_do_cmd()
2139 if (slave_state[slave].last_cmd != MLX4_COMM_CMD_VHCR0) in mlx4_master_do_cmd()
2141 slave_state[slave].vhcr_dma |= ((u64) param) << 32; in mlx4_master_do_cmd()
2144 if (slave_state[slave].last_cmd != MLX4_COMM_CMD_VHCR1) in mlx4_master_do_cmd()
2146 slave_state[slave].vhcr_dma |= ((u64) param) << 16; in mlx4_master_do_cmd()
2149 if (slave_state[slave].last_cmd != MLX4_COMM_CMD_VHCR2) in mlx4_master_do_cmd()
2151 slave_state[slave].vhcr_dma |= param; in mlx4_master_do_cmd()
2152 if (mlx4_master_activate_admin_state(priv, slave)) in mlx4_master_do_cmd()
2154 slave_state[slave].active = true; in mlx4_master_do_cmd()
2155 mlx4_dispatch_event(dev, MLX4_DEV_EVENT_SLAVE_INIT, &slave); in mlx4_master_do_cmd()
2158 if ((slave_state[slave].last_cmd != MLX4_COMM_CMD_VHCR_EN) && in mlx4_master_do_cmd()
2159 (slave_state[slave].last_cmd != MLX4_COMM_CMD_VHCR_POST)) { in mlx4_master_do_cmd()
2160 mlx4_warn(dev, "slave:%d is out of sync, cmd=0x%x, last command=0x%x, reset is needed\n", in mlx4_master_do_cmd()
2161 slave, cmd, slave_state[slave].last_cmd); in mlx4_master_do_cmd()
2166 if (mlx4_master_process_vhcr(dev, slave, NULL)) { in mlx4_master_do_cmd()
2167 mlx4_err(dev, "Failed processing vhcr for slave:%d, resetting slave\n", in mlx4_master_do_cmd()
2168 slave); in mlx4_master_do_cmd()
2175 mlx4_warn(dev, "Bad comm cmd:%d from slave:%d\n", cmd, slave); in mlx4_master_do_cmd()
2179 if (!slave_state[slave].is_slave_going_down) in mlx4_master_do_cmd()
2180 slave_state[slave].last_cmd = cmd; in mlx4_master_do_cmd()
2185 mlx4_warn(dev, "Slave is going down aborting command(%d) executing from slave:%d\n", in mlx4_master_do_cmd()
2186 cmd, slave); in mlx4_master_do_cmd()
2190 &priv->mfunc.comm[slave].slave_read); in mlx4_master_do_cmd()
2195 /* cleanup any slave resources */ in mlx4_master_do_cmd()
2197 mlx4_delete_all_resources_for_slave(dev, slave); in mlx4_master_do_cmd()
2200 mlx4_warn(dev, "Turn on internal error to force reset, slave=%d, cmd=0x%x\n", in mlx4_master_do_cmd()
2201 slave, cmd); in mlx4_master_do_cmd()
2202 /* Turn on internal error letting slave reset itself in mlx4_master_do_cmd()
2210 if (!slave_state[slave].is_slave_going_down) in mlx4_master_do_cmd()
2211 slave_state[slave].last_cmd = MLX4_COMM_CMD_RESET; in mlx4_master_do_cmd()
2213 /*with slave in the middle of flr, no need to clean resources again.*/ in mlx4_master_do_cmd()
2215 memset(&slave_state[slave].event_eq, 0, in mlx4_master_do_cmd()
2218 &priv->mfunc.comm[slave].slave_read); in mlx4_master_do_cmd()
2237 int i, slave; in mlx4_master_comm_channel() local
2249 slave = master->next_slave; in mlx4_master_comm_channel()
2251 slave = find_next_bit((const unsigned long *)&lbit_vec, nmbr_bits, slave); in mlx4_master_comm_channel()
2252 if (!first && slave >= master->next_slave) in mlx4_master_comm_channel()
2254 if (slave == nmbr_bits) { in mlx4_master_comm_channel()
2258 slave = 0; in mlx4_master_comm_channel()
2262 comm_cmd = swab32(readl(&mfunc->comm[slave].slave_write)); in mlx4_master_comm_channel()
2263 slt = swab32(readl(&mfunc->comm[slave].slave_read)) >> 31; in mlx4_master_comm_channel()
2266 if (master->slave_state[slave].comm_toggle in mlx4_master_comm_channel()
2268 pr_info("slave %d out of sync. read toggle %d, state toggle %d. Resynching.\n", in mlx4_master_comm_channel()
2269 slave, slt, in mlx4_master_comm_channel()
2270 master->slave_state[slave].comm_toggle); in mlx4_master_comm_channel()
2271 master->slave_state[slave].comm_toggle = in mlx4_master_comm_channel()
2274 mlx4_master_do_cmd(dev, slave, in mlx4_master_comm_channel()
2279 slave++; in mlx4_master_comm_channel()
2552 int slave; in mlx4_report_internal_err_comm_event() local
2565 for (slave = 0; slave < dev->num_slaves; slave++) { in mlx4_report_internal_err_comm_event()
2566 slave_read = swab32(readl(&priv->mfunc.comm[slave].slave_read)); in mlx4_report_internal_err_comm_event()
2569 &priv->mfunc.comm[slave].slave_read); in mlx4_report_internal_err_comm_event()
2738 int mlx4_get_vf_indx(struct mlx4_dev *dev, int slave) in mlx4_get_vf_indx() argument
2740 if (slave < 1 || slave > dev->persist->num_vfs) { in mlx4_get_vf_indx()
2742 "Bad slave number:%d (number of activated slaves: %lu)\n", in mlx4_get_vf_indx()
2743 slave, dev->num_slaves); in mlx4_get_vf_indx()
2746 return slave - 1; in mlx4_get_vf_indx()
2768 struct mlx4_active_ports mlx4_get_active_ports(struct mlx4_dev *dev, int slave) in mlx4_get_active_ports() argument
2775 if (slave == 0) { in mlx4_get_active_ports()
2780 vf = mlx4_get_vf_indx(dev, slave); in mlx4_get_active_ports()
2785 min((int)dev->dev_vfs[mlx4_get_vf_indx(dev, slave)].n_ports, in mlx4_get_active_ports()
2792 int mlx4_slave_convert_port(struct mlx4_dev *dev, int slave, int port) in mlx4_slave_convert_port() argument
2795 struct mlx4_active_ports actv_ports = mlx4_get_active_ports(dev, slave); in mlx4_slave_convert_port()
2809 int mlx4_phys_to_slave_port(struct mlx4_dev *dev, int slave, int port) in mlx4_phys_to_slave_port() argument
2811 struct mlx4_active_ports actv_ports = mlx4_get_active_ports(dev, slave); in mlx4_phys_to_slave_port()
2863 static int mlx4_slaves_closest_port(struct mlx4_dev *dev, int slave, int port) in mlx4_slaves_closest_port() argument
2865 struct mlx4_active_ports actv_ports = mlx4_get_active_ports(dev, slave); in mlx4_slaves_closest_port()
2879 static int mlx4_set_vport_qos(struct mlx4_priv *priv, int slave, int port, in mlx4_set_vport_qos() argument
2891 if (slave > port_qos->num_of_qos_vfs) { in mlx4_set_vport_qos()
2916 err = mlx4_SET_VPORT_QOS_set(dev, port, slave, vpp_qos); in mlx4_set_vport_qos()
2918 mlx4_info(dev, "Failed to set Vport %d QoS values\n", slave); in mlx4_set_vport_qos()
2980 int slave; in mlx4_set_vf_mac() local
2988 slave = mlx4_get_slave_indx(dev, vf); in mlx4_set_vf_mac()
2989 if (slave < 0) in mlx4_set_vf_mac()
2992 port = mlx4_slaves_closest_port(dev, slave, port); in mlx4_set_vf_mac()
2993 s_info = &priv->mfunc.master.vf_admin[slave].vport[port]; in mlx4_set_vf_mac()
3015 int slave; in mlx4_set_vf_vlan() local
3036 slave = mlx4_get_slave_indx(dev, vf); in mlx4_set_vf_vlan()
3037 if (slave < 0) in mlx4_set_vf_vlan()
3040 slave_state = &priv->mfunc.master.slave_state[slave]; in mlx4_set_vf_vlan()
3046 port = mlx4_slaves_closest_port(dev, slave, port); in mlx4_set_vf_vlan()
3047 vf_admin = &priv->mfunc.master.vf_admin[slave].vport[port]; in mlx4_set_vf_vlan()
3048 vf_oper = &priv->mfunc.master.vf_oper[slave].vport[port]; in mlx4_set_vf_vlan()
3065 vf_admin->qos_vport = slave; in mlx4_set_vf_vlan()
3072 mlx4_master_immediate_activate_vlan_qos(priv, slave, port)) in mlx4_set_vf_vlan()
3084 int slave; in mlx4_set_vf_rate() local
3097 slave = mlx4_get_slave_indx(dev, vf); in mlx4_set_vf_rate()
3098 if (slave < 0) in mlx4_set_vf_rate()
3101 port = mlx4_slaves_closest_port(dev, slave, port); in mlx4_set_vf_rate()
3102 vf_admin = &priv->mfunc.master.vf_admin[slave].vport[port]; in mlx4_set_vf_rate()
3104 err = mlx4_set_vport_qos(priv, slave, port, max_tx_rate); in mlx4_set_vf_rate()
3133 vf_admin->qos_vport = max_tx_rate ? slave : MLX4_VPP_DEFAULT_VPORT; in mlx4_set_vf_rate()
3135 if (priv->mfunc.master.slave_state[slave].active && in mlx4_set_vf_rate()
3137 mlx4_master_immediate_activate_vlan_qos(priv, slave, port); in mlx4_set_vf_rate()
3147 bool mlx4_get_slave_default_vlan(struct mlx4_dev *dev, int port, int slave, in mlx4_get_slave_default_vlan() argument
3154 port = mlx4_slaves_closest_port(dev, slave, port); in mlx4_get_slave_default_vlan()
3155 vp_oper = &priv->mfunc.master.vf_oper[slave].vport[port]; in mlx4_get_slave_default_vlan()
3172 int slave; in mlx4_set_vf_spoofchk() local
3179 slave = mlx4_get_slave_indx(dev, vf); in mlx4_set_vf_spoofchk()
3180 if (slave < 0) in mlx4_set_vf_spoofchk()
3183 port = mlx4_slaves_closest_port(dev, slave, port); in mlx4_set_vf_spoofchk()
3184 s_info = &priv->mfunc.master.vf_admin[slave].vport[port]; in mlx4_set_vf_spoofchk()
3202 int slave; in mlx4_get_vf_config() local
3207 slave = mlx4_get_slave_indx(dev, vf); in mlx4_get_vf_config()
3208 if (slave < 0) in mlx4_get_vf_config()
3211 s_info = &priv->mfunc.master.vf_admin[slave].vport[port]; in mlx4_get_vf_config()
3243 int slave; in mlx4_set_vf_link_state() local
3246 slave = mlx4_get_slave_indx(dev, vf); in mlx4_set_vf_link_state()
3247 if (slave < 0) in mlx4_set_vf_link_state()
3250 port = mlx4_slaves_closest_port(dev, slave, port); in mlx4_set_vf_link_state()
3269 mlx4_warn(dev, "unknown value for link_state %02x on slave %d port %d\n", in mlx4_set_vf_link_state()
3270 link_state, slave, port); in mlx4_set_vf_link_state()
3273 s_info = &priv->mfunc.master.vf_admin[slave].vport[port]; in mlx4_set_vf_link_state()
3277 mlx4_gen_port_state_change_eqe(dev, slave, port, link_stat_event); in mlx4_set_vf_link_state()
3279 if (mlx4_master_immediate_activate_vlan_qos(priv, slave, port)) in mlx4_set_vf_link_state()
3347 int slave; in mlx4_get_vf_stats() local
3356 slave = mlx4_get_slave_indx(dev, vf_idx); in mlx4_get_vf_stats()
3357 if (slave < 0) in mlx4_get_vf_stats()
3360 port = mlx4_slaves_closest_port(dev, slave, port); in mlx4_get_vf_stats()
3361 err = mlx4_calc_vf_counters(dev, slave, port, &tmp_vf_stats); in mlx4_get_vf_stats()
3373 int mlx4_vf_smi_enabled(struct mlx4_dev *dev, int slave, int port) in mlx4_vf_smi_enabled() argument
3377 if (slave < 1 || slave >= dev->num_slaves || in mlx4_vf_smi_enabled()
3381 return priv->mfunc.master.vf_oper[slave].smi_enabled[port] == in mlx4_vf_smi_enabled()
3386 int mlx4_vf_get_enable_smi_admin(struct mlx4_dev *dev, int slave, int port) in mlx4_vf_get_enable_smi_admin() argument
3390 if (slave == mlx4_master_func_num(dev)) in mlx4_vf_get_enable_smi_admin()
3393 if (slave < 1 || slave >= dev->num_slaves || in mlx4_vf_get_enable_smi_admin()
3397 return priv->mfunc.master.vf_admin[slave].enable_smi[port] == in mlx4_vf_get_enable_smi_admin()
3402 int mlx4_vf_set_enable_smi_admin(struct mlx4_dev *dev, int slave, int port, in mlx4_vf_set_enable_smi_admin() argument
3407 &priv->dev, slave); in mlx4_vf_set_enable_smi_admin()
3413 if (slave == mlx4_master_func_num(dev)) in mlx4_vf_set_enable_smi_admin()
3416 if (slave < 1 || slave >= dev->num_slaves || in mlx4_vf_set_enable_smi_admin()
3426 priv->mfunc.master.vf_admin[slave].enable_smi[port] = enabled; in mlx4_vf_set_enable_smi_admin()