Lines Matching refs:smp
39 static int reply(struct ib_mad_hdr *smp)
45 smp->method = IB_MGMT_METHOD_GET_RESP;
46 if (smp->mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE)
47 smp->status |= IB_SMP_DIRECTION;
51 static inline void clear_opa_smp_data(struct opa_smp *smp)
53 void *data = opa_get_smp_data(smp);
54 size_t size = opa_get_smp_data_size(smp);
187 struct opa_smp *smp)
194 if (smp->attr_id != IB_SMP_ATTR_NOTICE)
202 if (trap && trap->tid == smp->tid) {
275 struct opa_smp *smp;
310 smp = send_buf->mad;
311 smp->base_version = OPA_MGMT_BASE_VERSION;
312 smp->mgmt_class = IB_MGMT_CLASS_SUBN_LID_ROUTED;
313 smp->class_version = OPA_SM_CLASS_VERSION;
314 smp->method = IB_MGMT_METHOD_TRAP;
324 smp->tid = trap->tid;
326 smp->attr_id = IB_SMP_ATTR_NOTICE;
327 /* o14-1: smp->mkey = 0; */
329 memcpy(smp->route.lid.data, &trap->data, trap->len);
540 static int __subn_get_opa_nodedesc(struct opa_smp *smp, u32 am,
547 smp->status |= IB_SMP_INVALID_FIELD;
548 return reply((struct ib_mad_hdr *)smp);
558 return reply((struct ib_mad_hdr *)smp);
561 static int __subn_get_opa_nodeinfo(struct opa_smp *smp, u32 am, u8 *data,
575 smp->status |= IB_SMP_INVALID_FIELD;
576 return reply((struct ib_mad_hdr *)smp);
598 return reply((struct ib_mad_hdr *)smp);
601 static int subn_get_nodeinfo(struct ib_smp *smp, struct ib_device *ibdev,
604 struct ib_node_info *nip = (struct ib_node_info *)&smp->data;
609 if (smp->attr_mod || pidx >= dd->num_pports ||
612 smp->status |= IB_SMP_INVALID_FIELD;
613 return reply((struct ib_mad_hdr *)smp);
632 return reply((struct ib_mad_hdr *)smp);
754 static int __subn_get_opa_portinfo(struct opa_smp *smp, u32 am, u8 *data,
773 smp->status |= IB_SMP_INVALID_FIELD;
774 return reply((struct ib_mad_hdr *)smp);
784 smp->status |= IB_SMP_INVALID_FIELD;
785 return reply((struct ib_mad_hdr *)smp);
791 if (!(smp->method == IB_MGMT_METHOD_GET &&
792 ibp->rvp.mkey != smp->mkey &&
961 return reply((struct ib_mad_hdr *)smp);
979 static int __subn_get_opa_pkeytable(struct opa_smp *smp, u32 am, u8 *data,
996 smp->status |= IB_SMP_INVALID_FIELD;
997 return reply((struct ib_mad_hdr *)smp);
1005 smp->status |= IB_SMP_INVALID_FIELD;
1006 return reply((struct ib_mad_hdr *)smp);
1012 "avail 0x%x; blk/smp 0x%lx\n",
1015 smp->status |= IB_SMP_INVALID_FIELD;
1016 return reply((struct ib_mad_hdr *)smp);
1029 smp->status |= IB_SMP_INVALID_FIELD;
1031 return reply((struct ib_mad_hdr *)smp);
1198 static int set_port_states(struct hfi1_pportdata *ppd, struct opa_smp *smp,
1209 smp->status |= IB_SMP_INVALID_FIELD;
1221 smp->status |= IB_SMP_INVALID_FIELD;
1246 smp->status |= IB_SMP_INVALID_FIELD;
1290 smp->status |= IB_SMP_INVALID_FIELD;
1296 smp->status |= IB_SMP_INVALID_FIELD;
1304 * @smp: the incoming SM packet
1309 static int __subn_set_opa_portinfo(struct opa_smp *smp, u32 am, u8 *data,
1334 smp->status |= IB_SMP_INVALID_FIELD;
1335 return reply((struct ib_mad_hdr *)smp);
1341 smp->status |= IB_SMP_INVALID_FIELD;
1349 smp->status |= IB_SMP_INVALID_FIELD;
1376 smp->status |= IB_SMP_INVALID_FIELD;
1409 smp->status |= IB_SMP_INVALID_FIELD;
1451 smp->status |= IB_SMP_INVALID_FIELD;
1468 smp->status |= IB_SMP_INVALID_FIELD;
1475 smp->status |= IB_SMP_INVALID_FIELD;
1486 smp->status |= IB_SMP_INVALID_FIELD;
1487 return reply((struct ib_mad_hdr *)smp);
1500 smp->status |= IB_SMP_INVALID_FIELD;
1533 smp->status |= IB_SMP_INVALID_FIELD;
1537 smp->status |= IB_SMP_INVALID_FIELD;
1576 smp->status |= IB_SMP_INVALID_FIELD;
1595 ret = set_port_states(ppd, smp, ls_new, ps_new, local_mad);
1600 ret = __subn_get_opa_portinfo(smp, am, data, ibdev, port, resp_len,
1618 return __subn_get_opa_portinfo(smp, am, data, ibdev, port, resp_len,
1678 static int __subn_set_opa_pkeytable(struct opa_smp *smp, u32 am, u8 *data,
1695 smp->status |= IB_SMP_INVALID_FIELD;
1696 return reply((struct ib_mad_hdr *)smp);
1704 smp->status |= IB_SMP_INVALID_FIELD;
1705 return reply((struct ib_mad_hdr *)smp);
1710 pr_warn("OPA Set PKey AM Invalid : s 0x%x; req 0x%x; avail 0x%x; blk/smp 0x%lx\n",
1713 smp->status |= IB_SMP_INVALID_FIELD;
1714 return reply((struct ib_mad_hdr *)smp);
1721 smp->status |= IB_SMP_INVALID_FIELD;
1722 return reply((struct ib_mad_hdr *)smp);
1725 return __subn_get_opa_pkeytable(smp, am, data, ibdev, port, resp_len,
1785 static int __subn_get_opa_sl_to_sc(struct opa_smp *smp, u32 am, u8 *data,
1795 smp->status |= IB_SMP_INVALID_FIELD;
1796 return reply((struct ib_mad_hdr *)smp);
1805 return reply((struct ib_mad_hdr *)smp);
1808 static int __subn_set_opa_sl_to_sc(struct opa_smp *smp, u32 am, u8 *data,
1819 smp->status |= IB_SMP_INVALID_FIELD;
1820 return reply((struct ib_mad_hdr *)smp);
1833 return __subn_get_opa_sl_to_sc(smp, am, data, ibdev, port, resp_len,
1837 static int __subn_get_opa_sc_to_sl(struct opa_smp *smp, u32 am, u8 *data,
1847 smp->status |= IB_SMP_INVALID_FIELD;
1848 return reply((struct ib_mad_hdr *)smp);
1857 return reply((struct ib_mad_hdr *)smp);
1860 static int __subn_set_opa_sc_to_sl(struct opa_smp *smp, u32 am, u8 *data,
1870 smp->status |= IB_SMP_INVALID_FIELD;
1871 return reply((struct ib_mad_hdr *)smp);
1877 return __subn_get_opa_sc_to_sl(smp, am, data, ibdev, port, resp_len,
1881 static int __subn_get_opa_sc_to_vlt(struct opa_smp *smp, u32 am, u8 *data,
1891 smp->status |= IB_SMP_INVALID_FIELD;
1892 return reply((struct ib_mad_hdr *)smp);
1900 return reply((struct ib_mad_hdr *)smp);
1903 static int __subn_set_opa_sc_to_vlt(struct opa_smp *smp, u32 am, u8 *data,
1922 smp->status |= IB_SMP_INVALID_FIELD;
1923 return reply((struct ib_mad_hdr *)smp);
1935 smp->status |= IB_SMP_INVALID_FIELD;
1936 return reply((struct ib_mad_hdr *)smp);
1941 return __subn_get_opa_sc_to_vlt(smp, am, data, ibdev, port, resp_len,
1945 static int __subn_get_opa_sc_to_vlnt(struct opa_smp *smp, u32 am, u8 *data,
1956 smp->status |= IB_SMP_INVALID_FIELD;
1957 return reply((struct ib_mad_hdr *)smp);
1967 return reply((struct ib_mad_hdr *)smp);
1970 static int __subn_set_opa_sc_to_vlnt(struct opa_smp *smp, u32 am, u8 *data,
1982 smp->status |= IB_SMP_INVALID_FIELD;
1983 return reply((struct ib_mad_hdr *)smp);
1990 smp->status |= IB_SMP_INVALID_FIELD;
1991 return reply((struct ib_mad_hdr *)smp);
1998 return __subn_get_opa_sc_to_vlnt(smp, am, data, ibdev, port,
2002 static int __subn_get_opa_psi(struct opa_smp *smp, u32 am, u8 *data,
2014 smp->status |= IB_SMP_INVALID_FIELD;
2015 return reply((struct ib_mad_hdr *)smp);
2041 return reply((struct ib_mad_hdr *)smp);
2044 static int __subn_set_opa_psi(struct opa_smp *smp, u32 am, u8 *data,
2058 smp->status |= IB_SMP_INVALID_FIELD;
2059 return reply((struct ib_mad_hdr *)smp);
2077 smp->status |= IB_SMP_INVALID_FIELD;
2083 ret = set_port_states(ppd, smp, ls_new, ps_new, local_mad);
2088 return __subn_get_opa_psi(smp, am, data, ibdev, port, resp_len,
2092 static int __subn_get_opa_cable_info(struct opa_smp *smp, u32 am, u8 *data,
2103 smp->status |= IB_SMP_INVALID_FIELD;
2104 return reply((struct ib_mad_hdr *)smp);
2117 smp->status |= IB_SMP_INVALID_FIELD;
2118 return reply((struct ib_mad_hdr *)smp);
2124 smp->status |= IB_SMP_UNSUP_METH_ATTR;
2125 return reply((struct ib_mad_hdr *)smp);
2134 smp->status |= IB_SMP_INVALID_FIELD;
2135 return reply((struct ib_mad_hdr *)smp);
2141 return reply((struct ib_mad_hdr *)smp);
2144 static int __subn_get_opa_bct(struct opa_smp *smp, u32 am, u8 *data,
2155 smp->status |= IB_SMP_INVALID_FIELD;
2156 return reply((struct ib_mad_hdr *)smp);
2165 return reply((struct ib_mad_hdr *)smp);
2168 static int __subn_set_opa_bct(struct opa_smp *smp, u32 am, u8 *data,
2178 smp->status |= IB_SMP_INVALID_FIELD;
2179 return reply((struct ib_mad_hdr *)smp);
2184 smp->status |= IB_SMP_INVALID_FIELD;
2185 return reply((struct ib_mad_hdr *)smp);
2188 return __subn_get_opa_bct(smp, am, data, ibdev, port, resp_len,
2192 static int __subn_get_opa_vl_arb(struct opa_smp *smp, u32 am, u8 *data,
2203 smp->status |= IB_SMP_INVALID_FIELD;
2204 return reply((struct ib_mad_hdr *)smp);
2222 be32_to_cpu(smp->attr_mod));
2223 smp->status |= IB_SMP_INVALID_FIELD;
2231 return reply((struct ib_mad_hdr *)smp);
2234 static int __subn_set_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);
2262 smp->status |= IB_SMP_UNSUP_METH_ATTR;
2266 be32_to_cpu(smp->attr_mod));
2267 smp->status |= IB_SMP_INVALID_FIELD;
2271 return __subn_get_opa_vl_arb(smp, am, data, ibdev, port, resp_len,
3662 static int __subn_get_opa_cong_info(struct opa_smp *smp, u32 am, u8 *data,
3672 smp->status |= IB_SMP_INVALID_FIELD;
3673 return reply((struct ib_mad_hdr *)smp);
3683 return reply((struct ib_mad_hdr *)smp);
3686 static int __subn_get_opa_cong_setting(struct opa_smp *smp, u32 am,
3699 smp->status |= IB_SMP_INVALID_FIELD;
3700 return reply((struct ib_mad_hdr *)smp);
3709 return reply((struct ib_mad_hdr *)smp);
3728 return reply((struct ib_mad_hdr *)smp);
3779 static int __subn_set_opa_cong_setting(struct opa_smp *smp, u32 am, u8 *data,
3791 smp->status |= IB_SMP_INVALID_FIELD;
3792 return reply((struct ib_mad_hdr *)smp);
3815 return __subn_get_opa_cong_setting(smp, am, data, ibdev, port,
3819 static int __subn_get_opa_hfi1_cong_log(struct opa_smp *smp, u32 am,
3830 smp->status |= IB_SMP_INVALID_FIELD;
3831 return reply((struct ib_mad_hdr *)smp);
3882 return reply((struct ib_mad_hdr *)smp);
3885 static int __subn_get_opa_cc_table(struct opa_smp *smp, u32 am, u8 *data,
3904 smp->status |= IB_SMP_INVALID_FIELD;
3905 return reply((struct ib_mad_hdr *)smp);
3914 return reply((struct ib_mad_hdr *)smp);
3934 return reply((struct ib_mad_hdr *)smp);
3937 static int __subn_set_opa_cc_table(struct opa_smp *smp, u32 am, u8 *data,
3955 smp->status |= IB_SMP_INVALID_FIELD;
3956 return reply((struct ib_mad_hdr *)smp);
3966 smp->status |= IB_SMP_INVALID_FIELD;
3967 return reply((struct ib_mad_hdr *)smp);
3984 return __subn_get_opa_cc_table(smp, am, data, ibdev, port, resp_len,
3996 static int __subn_get_opa_led_info(struct opa_smp *smp, u32 am, u8 *data,
4007 smp->status |= IB_SMP_INVALID_FIELD;
4008 return reply((struct ib_mad_hdr *)smp);
4023 return reply((struct ib_mad_hdr *)smp);
4026 static int __subn_set_opa_led_info(struct opa_smp *smp, u32 am, u8 *data,
4036 smp->status |= IB_SMP_INVALID_FIELD;
4037 return reply((struct ib_mad_hdr *)smp);
4045 return __subn_get_opa_led_info(smp, am, data, ibdev, port, resp_len,
4049 static int subn_get_opa_sma(__be16 attr_id, struct opa_smp *smp, u32 am,
4058 ret = __subn_get_opa_nodedesc(smp, am, data, ibdev, port,
4062 ret = __subn_get_opa_nodeinfo(smp, am, data, ibdev, port,
4066 ret = __subn_get_opa_portinfo(smp, am, data, ibdev, port,
4070 ret = __subn_get_opa_pkeytable(smp, am, data, ibdev, port,
4074 ret = __subn_get_opa_sl_to_sc(smp, am, data, ibdev, port,
4078 ret = __subn_get_opa_sc_to_sl(smp, am, data, ibdev, port,
4082 ret = __subn_get_opa_sc_to_vlt(smp, am, data, ibdev, port,
4086 ret = __subn_get_opa_sc_to_vlnt(smp, am, data, ibdev, port,
4090 ret = __subn_get_opa_psi(smp, am, data, ibdev, port,
4094 ret = __subn_get_opa_bct(smp, am, data, ibdev, port,
4098 ret = __subn_get_opa_cable_info(smp, am, data, ibdev, port,
4102 ret = __subn_get_opa_vl_arb(smp, am, data, ibdev, port,
4106 ret = __subn_get_opa_cong_info(smp, am, data, ibdev, port,
4110 ret = __subn_get_opa_cong_setting(smp, am, data, ibdev,
4114 ret = __subn_get_opa_hfi1_cong_log(smp, am, data, ibdev,
4118 ret = __subn_get_opa_cc_table(smp, am, data, ibdev, port,
4122 ret = __subn_get_opa_led_info(smp, am, data, ibdev, port,
4132 smp->status |= IB_SMP_UNSUP_METH_ATTR;
4133 ret = reply((struct ib_mad_hdr *)smp);
4139 static int subn_set_opa_sma(__be16 attr_id, struct opa_smp *smp, u32 am,
4148 ret = __subn_set_opa_portinfo(smp, am, data, ibdev, port,
4152 ret = __subn_set_opa_pkeytable(smp, am, data, ibdev, port,
4156 ret = __subn_set_opa_sl_to_sc(smp, am, data, ibdev, port,
4160 ret = __subn_set_opa_sc_to_sl(smp, am, data, ibdev, port,
4164 ret = __subn_set_opa_sc_to_vlt(smp, am, data, ibdev, port,
4168 ret = __subn_set_opa_sc_to_vlnt(smp, am, data, ibdev, port,
4172 ret = __subn_set_opa_psi(smp, am, data, ibdev, port,
4176 ret = __subn_set_opa_bct(smp, am, data, ibdev, port,
4180 ret = __subn_set_opa_vl_arb(smp, am, data, ibdev, port,
4184 ret = __subn_set_opa_cong_setting(smp, am, data, ibdev,
4188 ret = __subn_set_opa_cc_table(smp, am, data, ibdev, port,
4192 ret = __subn_set_opa_led_info(smp, am, data, ibdev, port,
4202 smp->status |= IB_SMP_UNSUP_METH_ATTR;
4203 ret = reply((struct ib_mad_hdr *)smp);
4214 static int subn_get_opa_aggregate(struct opa_smp *smp,
4219 u32 num_attr = be32_to_cpu(smp->attr_mod) & 0x000000ff;
4220 u8 *next_smp = opa_get_smp_data(smp);
4223 smp->status |= IB_SMP_INVALID_FIELD;
4224 return reply((struct ib_mad_hdr *)smp);
4240 if (next_smp + agg_size > ((u8 *)smp) + sizeof(*smp)) {
4241 smp->status |= IB_SMP_INVALID_FIELD;
4242 return reply((struct ib_mad_hdr *)smp);
4248 (void)subn_get_opa_sma(agg->attr_id, smp, am, agg->data,
4251 if (smp->status & IB_SMP_INVALID_FIELD)
4253 if (smp->status & ~IB_SMP_DIRECTION) {
4255 return reply((struct ib_mad_hdr *)smp);
4260 return reply((struct ib_mad_hdr *)smp);
4263 static int subn_set_opa_aggregate(struct opa_smp *smp,
4268 u32 num_attr = be32_to_cpu(smp->attr_mod) & 0x000000ff;
4269 u8 *next_smp = opa_get_smp_data(smp);
4272 smp->status |= IB_SMP_INVALID_FIELD;
4273 return reply((struct ib_mad_hdr *)smp);
4289 if (next_smp + agg_size > ((u8 *)smp) + sizeof(*smp)) {
4290 smp->status |= IB_SMP_INVALID_FIELD;
4291 return reply((struct ib_mad_hdr *)smp);
4294 (void)subn_set_opa_sma(agg->attr_id, smp, am, agg->data,
4298 if (smp->status & IB_SMP_INVALID_FIELD)
4300 if (smp->status & ~IB_SMP_DIRECTION) {
4302 return reply((struct ib_mad_hdr *)smp);
4307 return reply((struct ib_mad_hdr *)smp);
4357 const struct opa_smp *smp = (const struct opa_smp *)mad;
4359 if (smp->mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) {
4360 return (smp->hop_cnt == 0 &&
4361 smp->route.dr.dr_slid == OPA_LID_PERMISSIVE &&
4362 smp->route.dr.dr_dlid == OPA_LID_PERMISSIVE);
4474 struct opa_smp *smp = (struct opa_smp *)out_mad;
4482 data = opa_get_smp_data(smp);
4483 data_size = (u32)opa_get_smp_data_size(smp);
4485 am = be32_to_cpu(smp->attr_mod);
4486 attr_id = smp->attr_id;
4487 if (smp->class_version != OPA_SM_CLASS_VERSION) {
4488 smp->status |= IB_SMP_UNSUP_VERSION;
4489 ret = reply((struct ib_mad_hdr *)smp);
4492 ret = check_mkey(ibp, (struct ib_mad_hdr *)smp, mad_flags, smp->mkey,
4493 smp->route.dr.dr_slid, smp->route.dr.return_path,
4494 smp->hop_cnt);
4496 u32 port_num = be32_to_cpu(smp->attr_mod);
4506 (smp->method == IB_MGMT_METHOD_GET ||
4507 smp->method == IB_MGMT_METHOD_SET) &&
4511 (struct ib_mad_hdr *)smp, 0,
4512 smp->mkey, smp->route.dr.dr_slid,
4513 smp->route.dr.return_path,
4514 smp->hop_cnt);
4519 *resp_len = opa_get_smp_header_size(smp);
4521 switch (smp->method) {
4525 clear_opa_smp_data(smp);
4526 ret = subn_get_opa_sma(attr_id, smp, am, data,
4531 ret = subn_get_opa_aggregate(smp, ibdev, port,
4539 ret = subn_set_opa_sma(attr_id, smp, am, data,
4544 ret = subn_set_opa_aggregate(smp, ibdev, port,
4561 subn_handle_opa_trap_repress(ibp, smp);
4566 smp->status |= IB_SMP_UNSUP_METHOD;
4567 ret = reply((struct ib_mad_hdr *)smp);
4578 struct ib_smp *smp = (struct ib_smp *)out_mad;
4583 if (smp->class_version != 1) {
4584 smp->status |= IB_SMP_UNSUP_VERSION;
4585 ret = reply((struct ib_mad_hdr *)smp);
4589 ret = check_mkey(ibp, (struct ib_mad_hdr *)smp, mad_flags,
4590 smp->mkey, (__force __be32)smp->dr_slid,
4591 smp->return_path, smp->hop_cnt);
4593 u32 port_num = be32_to_cpu(smp->attr_mod);
4603 (smp->method == IB_MGMT_METHOD_GET ||
4604 smp->method == IB_MGMT_METHOD_SET) &&
4608 (struct ib_mad_hdr *)smp, 0,
4609 smp->mkey,
4610 (__force __be32)smp->dr_slid,
4611 smp->return_path, smp->hop_cnt);
4616 switch (smp->method) {
4618 switch (smp->attr_id) {
4620 ret = subn_get_nodeinfo(smp, ibdev, port);
4623 smp->status |= IB_SMP_UNSUP_METH_ATTR;
4624 ret = reply((struct ib_mad_hdr *)smp);