Lines Matching refs:smp
81 static int reply(struct ib_mad_hdr *smp)
87 smp->method = IB_MGMT_METHOD_GET_RESP;
88 if (smp->mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE)
89 smp->status |= IB_SMP_DIRECTION;
93 static inline void clear_opa_smp_data(struct opa_smp *smp)
95 void *data = opa_get_smp_data(smp);
96 size_t size = opa_get_smp_data_size(smp);
229 struct opa_smp *smp)
236 if (smp->attr_id != IB_SMP_ATTR_NOTICE)
244 if (trap && trap->tid == smp->tid) {
317 struct opa_smp *smp;
352 smp = send_buf->mad;
353 smp->base_version = OPA_MGMT_BASE_VERSION;
354 smp->mgmt_class = IB_MGMT_CLASS_SUBN_LID_ROUTED;
355 smp->class_version = OPA_SM_CLASS_VERSION;
356 smp->method = IB_MGMT_METHOD_TRAP;
366 smp->tid = trap->tid;
368 smp->attr_id = IB_SMP_ATTR_NOTICE;
369 /* o14-1: smp->mkey = 0; */
371 memcpy(smp->route.lid.data, &trap->data, trap->len);
582 static int __subn_get_opa_nodedesc(struct opa_smp *smp, u32 am,
589 smp->status |= IB_SMP_INVALID_FIELD;
590 return reply((struct ib_mad_hdr *)smp);
600 return reply((struct ib_mad_hdr *)smp);
603 static int __subn_get_opa_nodeinfo(struct opa_smp *smp, u32 am, u8 *data,
617 smp->status |= IB_SMP_INVALID_FIELD;
618 return reply((struct ib_mad_hdr *)smp);
640 return reply((struct ib_mad_hdr *)smp);
643 static int subn_get_nodeinfo(struct ib_smp *smp, struct ib_device *ibdev,
646 struct ib_node_info *nip = (struct ib_node_info *)&smp->data;
651 if (smp->attr_mod || pidx >= dd->num_pports ||
654 smp->status |= IB_SMP_INVALID_FIELD;
655 return reply((struct ib_mad_hdr *)smp);
674 return reply((struct ib_mad_hdr *)smp);
796 static int __subn_get_opa_portinfo(struct opa_smp *smp, u32 am, u8 *data,
815 smp->status |= IB_SMP_INVALID_FIELD;
816 return reply((struct ib_mad_hdr *)smp);
826 smp->status |= IB_SMP_INVALID_FIELD;
827 return reply((struct ib_mad_hdr *)smp);
833 if (!(smp->method == IB_MGMT_METHOD_GET &&
834 ibp->rvp.mkey != smp->mkey &&
1003 return reply((struct ib_mad_hdr *)smp);
1021 static int __subn_get_opa_pkeytable(struct opa_smp *smp, u32 am, u8 *data,
1038 smp->status |= IB_SMP_INVALID_FIELD;
1039 return reply((struct ib_mad_hdr *)smp);
1047 smp->status |= IB_SMP_INVALID_FIELD;
1048 return reply((struct ib_mad_hdr *)smp);
1054 "avail 0x%x; blk/smp 0x%lx\n",
1057 smp->status |= IB_SMP_INVALID_FIELD;
1058 return reply((struct ib_mad_hdr *)smp);
1071 smp->status |= IB_SMP_INVALID_FIELD;
1073 return reply((struct ib_mad_hdr *)smp);
1240 static int set_port_states(struct hfi1_pportdata *ppd, struct opa_smp *smp,
1251 smp->status |= IB_SMP_INVALID_FIELD;
1263 smp->status |= IB_SMP_INVALID_FIELD;
1288 smp->status |= IB_SMP_INVALID_FIELD;
1332 smp->status |= IB_SMP_INVALID_FIELD;
1338 smp->status |= IB_SMP_INVALID_FIELD;
1346 * @smp: the incoming SM packet
1351 static int __subn_set_opa_portinfo(struct opa_smp *smp, u32 am, u8 *data,
1376 smp->status |= IB_SMP_INVALID_FIELD;
1377 return reply((struct ib_mad_hdr *)smp);
1383 smp->status |= IB_SMP_INVALID_FIELD;
1391 smp->status |= IB_SMP_INVALID_FIELD;
1418 smp->status |= IB_SMP_INVALID_FIELD;
1451 smp->status |= IB_SMP_INVALID_FIELD;
1493 smp->status |= IB_SMP_INVALID_FIELD;
1510 smp->status |= IB_SMP_INVALID_FIELD;
1517 smp->status |= IB_SMP_INVALID_FIELD;
1528 smp->status |= IB_SMP_INVALID_FIELD;
1529 return reply((struct ib_mad_hdr *)smp);
1542 smp->status |= IB_SMP_INVALID_FIELD;
1575 smp->status |= IB_SMP_INVALID_FIELD;
1579 smp->status |= IB_SMP_INVALID_FIELD;
1618 smp->status |= IB_SMP_INVALID_FIELD;
1637 ret = set_port_states(ppd, smp, ls_new, ps_new, local_mad);
1642 ret = __subn_get_opa_portinfo(smp, am, data, ibdev, port, resp_len,
1660 return __subn_get_opa_portinfo(smp, am, data, ibdev, port, resp_len,
1720 static int __subn_set_opa_pkeytable(struct opa_smp *smp, u32 am, u8 *data,
1737 smp->status |= IB_SMP_INVALID_FIELD;
1738 return reply((struct ib_mad_hdr *)smp);
1746 smp->status |= IB_SMP_INVALID_FIELD;
1747 return reply((struct ib_mad_hdr *)smp);
1752 pr_warn("OPA Set PKey AM Invalid : s 0x%x; req 0x%x; avail 0x%x; blk/smp 0x%lx\n",
1755 smp->status |= IB_SMP_INVALID_FIELD;
1756 return reply((struct ib_mad_hdr *)smp);
1763 smp->status |= IB_SMP_INVALID_FIELD;
1764 return reply((struct ib_mad_hdr *)smp);
1767 return __subn_get_opa_pkeytable(smp, am, data, ibdev, port, resp_len,
1827 static int __subn_get_opa_sl_to_sc(struct opa_smp *smp, u32 am, u8 *data,
1837 smp->status |= IB_SMP_INVALID_FIELD;
1838 return reply((struct ib_mad_hdr *)smp);
1847 return reply((struct ib_mad_hdr *)smp);
1850 static int __subn_set_opa_sl_to_sc(struct opa_smp *smp, u32 am, u8 *data,
1861 smp->status |= IB_SMP_INVALID_FIELD;
1862 return reply((struct ib_mad_hdr *)smp);
1875 return __subn_get_opa_sl_to_sc(smp, am, data, ibdev, port, resp_len,
1879 static int __subn_get_opa_sc_to_sl(struct opa_smp *smp, u32 am, u8 *data,
1889 smp->status |= IB_SMP_INVALID_FIELD;
1890 return reply((struct ib_mad_hdr *)smp);
1899 return reply((struct ib_mad_hdr *)smp);
1902 static int __subn_set_opa_sc_to_sl(struct opa_smp *smp, u32 am, u8 *data,
1912 smp->status |= IB_SMP_INVALID_FIELD;
1913 return reply((struct ib_mad_hdr *)smp);
1919 return __subn_get_opa_sc_to_sl(smp, am, data, ibdev, port, resp_len,
1923 static int __subn_get_opa_sc_to_vlt(struct opa_smp *smp, u32 am, u8 *data,
1933 smp->status |= IB_SMP_INVALID_FIELD;
1934 return reply((struct ib_mad_hdr *)smp);
1942 return reply((struct ib_mad_hdr *)smp);
1945 static int __subn_set_opa_sc_to_vlt(struct opa_smp *smp, u32 am, u8 *data,
1964 smp->status |= IB_SMP_INVALID_FIELD;
1965 return reply((struct ib_mad_hdr *)smp);
1977 smp->status |= IB_SMP_INVALID_FIELD;
1978 return reply((struct ib_mad_hdr *)smp);
1983 return __subn_get_opa_sc_to_vlt(smp, am, data, ibdev, port, resp_len,
1987 static int __subn_get_opa_sc_to_vlnt(struct opa_smp *smp, u32 am, u8 *data,
1998 smp->status |= IB_SMP_INVALID_FIELD;
1999 return reply((struct ib_mad_hdr *)smp);
2009 return reply((struct ib_mad_hdr *)smp);
2012 static int __subn_set_opa_sc_to_vlnt(struct opa_smp *smp, u32 am, u8 *data,
2024 smp->status |= IB_SMP_INVALID_FIELD;
2025 return reply((struct ib_mad_hdr *)smp);
2032 smp->status |= IB_SMP_INVALID_FIELD;
2033 return reply((struct ib_mad_hdr *)smp);
2040 return __subn_get_opa_sc_to_vlnt(smp, am, data, ibdev, port,
2044 static int __subn_get_opa_psi(struct opa_smp *smp, u32 am, u8 *data,
2056 smp->status |= IB_SMP_INVALID_FIELD;
2057 return reply((struct ib_mad_hdr *)smp);
2083 return reply((struct ib_mad_hdr *)smp);
2086 static int __subn_set_opa_psi(struct opa_smp *smp, u32 am, u8 *data,
2100 smp->status |= IB_SMP_INVALID_FIELD;
2101 return reply((struct ib_mad_hdr *)smp);
2119 smp->status |= IB_SMP_INVALID_FIELD;
2125 ret = set_port_states(ppd, smp, ls_new, ps_new, local_mad);
2130 return __subn_get_opa_psi(smp, am, data, ibdev, port, resp_len,
2134 static int __subn_get_opa_cable_info(struct opa_smp *smp, u32 am, u8 *data,
2145 smp->status |= IB_SMP_INVALID_FIELD;
2146 return reply((struct ib_mad_hdr *)smp);
2159 smp->status |= IB_SMP_INVALID_FIELD;
2160 return reply((struct ib_mad_hdr *)smp);
2166 smp->status |= IB_SMP_UNSUP_METH_ATTR;
2167 return reply((struct ib_mad_hdr *)smp);
2176 smp->status |= IB_SMP_INVALID_FIELD;
2177 return reply((struct ib_mad_hdr *)smp);
2183 return reply((struct ib_mad_hdr *)smp);
2186 static int __subn_get_opa_bct(struct opa_smp *smp, u32 am, u8 *data,
2197 smp->status |= IB_SMP_INVALID_FIELD;
2198 return reply((struct ib_mad_hdr *)smp);
2207 return reply((struct ib_mad_hdr *)smp);
2210 static int __subn_set_opa_bct(struct opa_smp *smp, u32 am, u8 *data,
2220 smp->status |= IB_SMP_INVALID_FIELD;
2221 return reply((struct ib_mad_hdr *)smp);
2226 smp->status |= IB_SMP_INVALID_FIELD;
2227 return reply((struct ib_mad_hdr *)smp);
2230 return __subn_get_opa_bct(smp, am, data, ibdev, port, resp_len,
2234 static int __subn_get_opa_vl_arb(struct opa_smp *smp, u32 am, u8 *data,
2245 smp->status |= IB_SMP_INVALID_FIELD;
2246 return reply((struct ib_mad_hdr *)smp);
2264 be32_to_cpu(smp->attr_mod));
2265 smp->status |= IB_SMP_INVALID_FIELD;
2273 return reply((struct ib_mad_hdr *)smp);
2276 static int __subn_set_opa_vl_arb(struct opa_smp *smp, u32 am, u8 *data,
2287 smp->status |= IB_SMP_INVALID_FIELD;
2288 return reply((struct ib_mad_hdr *)smp);
2304 smp->status |= IB_SMP_UNSUP_METH_ATTR;
2308 be32_to_cpu(smp->attr_mod));
2309 smp->status |= IB_SMP_INVALID_FIELD;
2313 return __subn_get_opa_vl_arb(smp, am, data, ibdev, port, resp_len,
3704 static int __subn_get_opa_cong_info(struct opa_smp *smp, u32 am, u8 *data,
3714 smp->status |= IB_SMP_INVALID_FIELD;
3715 return reply((struct ib_mad_hdr *)smp);
3725 return reply((struct ib_mad_hdr *)smp);
3728 static int __subn_get_opa_cong_setting(struct opa_smp *smp, u32 am,
3741 smp->status |= IB_SMP_INVALID_FIELD;
3742 return reply((struct ib_mad_hdr *)smp);
3751 return reply((struct ib_mad_hdr *)smp);
3770 return reply((struct ib_mad_hdr *)smp);
3821 static int __subn_set_opa_cong_setting(struct opa_smp *smp, u32 am, u8 *data,
3833 smp->status |= IB_SMP_INVALID_FIELD;
3834 return reply((struct ib_mad_hdr *)smp);
3857 return __subn_get_opa_cong_setting(smp, am, data, ibdev, port,
3861 static int __subn_get_opa_hfi1_cong_log(struct opa_smp *smp, u32 am,
3872 smp->status |= IB_SMP_INVALID_FIELD;
3873 return reply((struct ib_mad_hdr *)smp);
3924 return reply((struct ib_mad_hdr *)smp);
3927 static int __subn_get_opa_cc_table(struct opa_smp *smp, u32 am, u8 *data,
3946 smp->status |= IB_SMP_INVALID_FIELD;
3947 return reply((struct ib_mad_hdr *)smp);
3956 return reply((struct ib_mad_hdr *)smp);
3976 return reply((struct ib_mad_hdr *)smp);
3979 static int __subn_set_opa_cc_table(struct opa_smp *smp, u32 am, u8 *data,
3997 smp->status |= IB_SMP_INVALID_FIELD;
3998 return reply((struct ib_mad_hdr *)smp);
4008 smp->status |= IB_SMP_INVALID_FIELD;
4009 return reply((struct ib_mad_hdr *)smp);
4026 return __subn_get_opa_cc_table(smp, am, data, ibdev, port, resp_len,
4038 static int __subn_get_opa_led_info(struct opa_smp *smp, u32 am, u8 *data,
4049 smp->status |= IB_SMP_INVALID_FIELD;
4050 return reply((struct ib_mad_hdr *)smp);
4065 return reply((struct ib_mad_hdr *)smp);
4068 static int __subn_set_opa_led_info(struct opa_smp *smp, u32 am, u8 *data,
4078 smp->status |= IB_SMP_INVALID_FIELD;
4079 return reply((struct ib_mad_hdr *)smp);
4087 return __subn_get_opa_led_info(smp, am, data, ibdev, port, resp_len,
4091 static int subn_get_opa_sma(__be16 attr_id, struct opa_smp *smp, u32 am,
4100 ret = __subn_get_opa_nodedesc(smp, am, data, ibdev, port,
4104 ret = __subn_get_opa_nodeinfo(smp, am, data, ibdev, port,
4108 ret = __subn_get_opa_portinfo(smp, am, data, ibdev, port,
4112 ret = __subn_get_opa_pkeytable(smp, am, data, ibdev, port,
4116 ret = __subn_get_opa_sl_to_sc(smp, am, data, ibdev, port,
4120 ret = __subn_get_opa_sc_to_sl(smp, am, data, ibdev, port,
4124 ret = __subn_get_opa_sc_to_vlt(smp, am, data, ibdev, port,
4128 ret = __subn_get_opa_sc_to_vlnt(smp, am, data, ibdev, port,
4132 ret = __subn_get_opa_psi(smp, am, data, ibdev, port,
4136 ret = __subn_get_opa_bct(smp, am, data, ibdev, port,
4140 ret = __subn_get_opa_cable_info(smp, am, data, ibdev, port,
4144 ret = __subn_get_opa_vl_arb(smp, am, data, ibdev, port,
4148 ret = __subn_get_opa_cong_info(smp, am, data, ibdev, port,
4152 ret = __subn_get_opa_cong_setting(smp, am, data, ibdev,
4156 ret = __subn_get_opa_hfi1_cong_log(smp, am, data, ibdev,
4160 ret = __subn_get_opa_cc_table(smp, am, data, ibdev, port,
4164 ret = __subn_get_opa_led_info(smp, am, data, ibdev, port,
4174 smp->status |= IB_SMP_UNSUP_METH_ATTR;
4175 ret = reply((struct ib_mad_hdr *)smp);
4181 static int subn_set_opa_sma(__be16 attr_id, struct opa_smp *smp, u32 am,
4190 ret = __subn_set_opa_portinfo(smp, am, data, ibdev, port,
4194 ret = __subn_set_opa_pkeytable(smp, am, data, ibdev, port,
4198 ret = __subn_set_opa_sl_to_sc(smp, am, data, ibdev, port,
4202 ret = __subn_set_opa_sc_to_sl(smp, am, data, ibdev, port,
4206 ret = __subn_set_opa_sc_to_vlt(smp, am, data, ibdev, port,
4210 ret = __subn_set_opa_sc_to_vlnt(smp, am, data, ibdev, port,
4214 ret = __subn_set_opa_psi(smp, am, data, ibdev, port,
4218 ret = __subn_set_opa_bct(smp, am, data, ibdev, port,
4222 ret = __subn_set_opa_vl_arb(smp, am, data, ibdev, port,
4226 ret = __subn_set_opa_cong_setting(smp, am, data, ibdev,
4230 ret = __subn_set_opa_cc_table(smp, am, data, ibdev, port,
4234 ret = __subn_set_opa_led_info(smp, am, data, ibdev, port,
4244 smp->status |= IB_SMP_UNSUP_METH_ATTR;
4245 ret = reply((struct ib_mad_hdr *)smp);
4256 static int subn_get_opa_aggregate(struct opa_smp *smp,
4261 u32 num_attr = be32_to_cpu(smp->attr_mod) & 0x000000ff;
4262 u8 *next_smp = opa_get_smp_data(smp);
4265 smp->status |= IB_SMP_INVALID_FIELD;
4266 return reply((struct ib_mad_hdr *)smp);
4282 if (next_smp + agg_size > ((u8 *)smp) + sizeof(*smp)) {
4283 smp->status |= IB_SMP_INVALID_FIELD;
4284 return reply((struct ib_mad_hdr *)smp);
4290 (void)subn_get_opa_sma(agg->attr_id, smp, am, agg->data,
4293 if (smp->status & IB_SMP_INVALID_FIELD)
4295 if (smp->status & ~IB_SMP_DIRECTION) {
4297 return reply((struct ib_mad_hdr *)smp);
4302 return reply((struct ib_mad_hdr *)smp);
4305 static int subn_set_opa_aggregate(struct opa_smp *smp,
4310 u32 num_attr = be32_to_cpu(smp->attr_mod) & 0x000000ff;
4311 u8 *next_smp = opa_get_smp_data(smp);
4314 smp->status |= IB_SMP_INVALID_FIELD;
4315 return reply((struct ib_mad_hdr *)smp);
4331 if (next_smp + agg_size > ((u8 *)smp) + sizeof(*smp)) {
4332 smp->status |= IB_SMP_INVALID_FIELD;
4333 return reply((struct ib_mad_hdr *)smp);
4336 (void)subn_set_opa_sma(agg->attr_id, smp, am, agg->data,
4340 if (smp->status & IB_SMP_INVALID_FIELD)
4342 if (smp->status & ~IB_SMP_DIRECTION) {
4344 return reply((struct ib_mad_hdr *)smp);
4349 return reply((struct ib_mad_hdr *)smp);
4399 const struct opa_smp *smp = (const struct opa_smp *)mad;
4401 if (smp->mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) {
4402 return (smp->hop_cnt == 0 &&
4403 smp->route.dr.dr_slid == OPA_LID_PERMISSIVE &&
4404 smp->route.dr.dr_dlid == OPA_LID_PERMISSIVE);
4516 struct opa_smp *smp = (struct opa_smp *)out_mad;
4524 data = opa_get_smp_data(smp);
4525 data_size = (u32)opa_get_smp_data_size(smp);
4527 am = be32_to_cpu(smp->attr_mod);
4528 attr_id = smp->attr_id;
4529 if (smp->class_version != OPA_SM_CLASS_VERSION) {
4530 smp->status |= IB_SMP_UNSUP_VERSION;
4531 ret = reply((struct ib_mad_hdr *)smp);
4534 ret = check_mkey(ibp, (struct ib_mad_hdr *)smp, mad_flags, smp->mkey,
4535 smp->route.dr.dr_slid, smp->route.dr.return_path,
4536 smp->hop_cnt);
4538 u32 port_num = be32_to_cpu(smp->attr_mod);
4548 (smp->method == IB_MGMT_METHOD_GET ||
4549 smp->method == IB_MGMT_METHOD_SET) &&
4553 (struct ib_mad_hdr *)smp, 0,
4554 smp->mkey, smp->route.dr.dr_slid,
4555 smp->route.dr.return_path,
4556 smp->hop_cnt);
4561 *resp_len = opa_get_smp_header_size(smp);
4563 switch (smp->method) {
4567 clear_opa_smp_data(smp);
4568 ret = subn_get_opa_sma(attr_id, smp, am, data,
4573 ret = subn_get_opa_aggregate(smp, ibdev, port,
4581 ret = subn_set_opa_sma(attr_id, smp, am, data,
4586 ret = subn_set_opa_aggregate(smp, ibdev, port,
4603 subn_handle_opa_trap_repress(ibp, smp);
4608 smp->status |= IB_SMP_UNSUP_METHOD;
4609 ret = reply((struct ib_mad_hdr *)smp);
4620 struct ib_smp *smp = (struct ib_smp *)out_mad;
4625 if (smp->class_version != 1) {
4626 smp->status |= IB_SMP_UNSUP_VERSION;
4627 ret = reply((struct ib_mad_hdr *)smp);
4631 ret = check_mkey(ibp, (struct ib_mad_hdr *)smp, mad_flags,
4632 smp->mkey, (__force __be32)smp->dr_slid,
4633 smp->return_path, smp->hop_cnt);
4635 u32 port_num = be32_to_cpu(smp->attr_mod);
4645 (smp->method == IB_MGMT_METHOD_GET ||
4646 smp->method == IB_MGMT_METHOD_SET) &&
4650 (struct ib_mad_hdr *)smp, 0,
4651 smp->mkey,
4652 (__force __be32)smp->dr_slid,
4653 smp->return_path, smp->hop_cnt);
4658 switch (smp->method) {
4660 switch (smp->attr_id) {
4662 ret = subn_get_nodeinfo(smp, ibdev, port);
4665 smp->status |= IB_SMP_UNSUP_METH_ATTR;
4666 ret = reply((struct ib_mad_hdr *)smp);