Lines Matching full:smp

40 static int reply(struct ib_smp *smp)  in reply()  argument
46 smp->method = IB_MGMT_METHOD_GET_RESP; in reply()
47 if (smp->mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) in reply()
48 smp->status |= IB_SMP_DIRECTION; in reply()
52 static int reply_failure(struct ib_smp *smp) in reply_failure() argument
58 smp->method = IB_MGMT_METHOD_GET_RESP; in reply_failure()
59 if (smp->mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) in reply_failure()
60 smp->status |= IB_SMP_DIRECTION; in reply_failure()
68 struct ib_smp *smp; in qib_send_trap() local
92 smp = send_buf->mad; in qib_send_trap()
93 smp->base_version = IB_MGMT_BASE_VERSION; in qib_send_trap()
94 smp->mgmt_class = IB_MGMT_CLASS_SUBN_LID_ROUTED; in qib_send_trap()
95 smp->class_version = 1; in qib_send_trap()
96 smp->method = IB_MGMT_METHOD_TRAP; in qib_send_trap()
98 smp->tid = cpu_to_be64(ibp->rvp.tid); in qib_send_trap()
99 smp->attr_id = IB_SMP_ATTR_NOTICE; in qib_send_trap()
100 /* o14-1: smp->mkey = 0; */ in qib_send_trap()
101 memcpy(smp->data, data, len); in qib_send_trap()
167 static void qib_bad_mkey(struct qib_ibport *ibp, struct ib_smp *smp) in qib_bad_mkey() argument
180 data.details.ntc_256.method = smp->method; in qib_bad_mkey()
181 data.details.ntc_256.attr_id = smp->attr_id; in qib_bad_mkey()
182 data.details.ntc_256.attr_mod = smp->attr_mod; in qib_bad_mkey()
183 data.details.ntc_256.mkey = smp->mkey; in qib_bad_mkey()
184 if (smp->mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) { in qib_bad_mkey()
187 data.details.ntc_256.dr_slid = smp->dr_slid; in qib_bad_mkey()
189 hop_cnt = smp->hop_cnt; in qib_bad_mkey()
196 memcpy(data.details.ntc_256.dr_rtn_path, smp->return_path, in qib_bad_mkey()
267 static int subn_get_nodedescription(struct ib_smp *smp, in subn_get_nodedescription() argument
270 if (smp->attr_mod) in subn_get_nodedescription()
271 smp->status |= IB_SMP_INVALID_FIELD; in subn_get_nodedescription()
273 memcpy(smp->data, ibdev->node_desc, sizeof(smp->data)); in subn_get_nodedescription()
275 return reply(smp); in subn_get_nodedescription()
278 static int subn_get_nodeinfo(struct ib_smp *smp, struct ib_device *ibdev, in subn_get_nodeinfo() argument
281 struct ib_node_info *nip = (struct ib_node_info *)&smp->data; in subn_get_nodeinfo()
287 if (smp->attr_mod || pidx >= dd->num_pports || in subn_get_nodeinfo()
289 smp->status |= IB_SMP_INVALID_FIELD; in subn_get_nodeinfo()
310 return reply(smp); in subn_get_nodeinfo()
313 static int subn_get_guidinfo(struct ib_smp *smp, struct ib_device *ibdev, in subn_get_guidinfo() argument
317 u32 startgx = 8 * be32_to_cpu(smp->attr_mod); in subn_get_guidinfo()
318 __be64 *p = (__be64 *) smp->data; in subn_get_guidinfo()
323 memset(smp->data, 0, sizeof(smp->data)); in subn_get_guidinfo()
333 smp->status |= IB_SMP_INVALID_FIELD; in subn_get_guidinfo()
341 smp->status |= IB_SMP_INVALID_FIELD; in subn_get_guidinfo()
343 return reply(smp); in subn_get_guidinfo()
406 static int check_mkey(struct qib_ibport *ibp, struct ib_smp *smp, int mad_flags) in check_mkey() argument
420 ibp->rvp.mkey == smp->mkey) in check_mkey()
425 (smp->method == IB_MGMT_METHOD_GET || in check_mkey()
426 smp->method == IB_MGMT_METHOD_SET || in check_mkey()
427 smp->method == IB_MGMT_METHOD_TRAP_REPRESS)) in check_mkey()
431 switch (smp->method) { in check_mkey()
446 qib_bad_mkey(ibp, smp); in check_mkey()
454 static int subn_get_portinfo(struct ib_smp *smp, struct ib_device *ibdev, in subn_get_portinfo() argument
460 struct ib_port_info *pip = (struct ib_port_info *)smp->data; in subn_get_portinfo()
464 u32 port_num = be32_to_cpu(smp->attr_mod); in subn_get_portinfo()
470 smp->status |= IB_SMP_INVALID_FIELD; in subn_get_portinfo()
471 ret = reply(smp); in subn_get_portinfo()
476 ret = check_mkey(ibp, smp, 0); in subn_get_portinfo()
490 memset(smp->data, 0, sizeof(smp->data)); in subn_get_portinfo()
493 if (!(smp->method == IB_MGMT_METHOD_GET && in subn_get_portinfo()
494 ibp->rvp.mkey != smp->mkey && in subn_get_portinfo()
569 ret = reply(smp); in subn_get_portinfo()
596 static int subn_get_pkeytable(struct ib_smp *smp, struct ib_device *ibdev, in subn_get_pkeytable() argument
599 u32 startpx = 32 * (be32_to_cpu(smp->attr_mod) & 0xffff); in subn_get_pkeytable()
600 u16 *p = (u16 *) smp->data; in subn_get_pkeytable()
601 __be16 *q = (__be16 *) smp->data; in subn_get_pkeytable()
605 memset(smp->data, 0, sizeof(smp->data)); in subn_get_pkeytable()
615 smp->status |= IB_SMP_INVALID_FIELD; in subn_get_pkeytable()
617 return reply(smp); in subn_get_pkeytable()
620 static int subn_set_guidinfo(struct ib_smp *smp, struct ib_device *ibdev, in subn_set_guidinfo() argument
624 u32 startgx = 8 * be32_to_cpu(smp->attr_mod); in subn_set_guidinfo()
625 __be64 *p = (__be64 *) smp->data; in subn_set_guidinfo()
639 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_guidinfo()
642 return subn_get_guidinfo(smp, ibdev, port); in subn_set_guidinfo()
647 * @smp: the incoming SM packet
653 static int subn_set_portinfo(struct ib_smp *smp, struct ib_device *ibdev, in subn_set_portinfo() argument
656 struct ib_port_info *pip = (struct ib_port_info *)smp->data; in subn_set_portinfo()
671 u32 port_num = be32_to_cpu(smp->attr_mod); in subn_set_portinfo()
697 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
712 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
737 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
753 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
771 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
781 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
789 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
805 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
808 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
821 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
842 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
853 if (lstate == QIB_IB_LINKDOWN_DISABLE && smp->hop_cnt) { in subn_set_portinfo()
866 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
880 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
882 ret = subn_get_portinfo(smp, ibdev, port); in subn_set_portinfo()
1039 static int subn_set_pkeytable(struct ib_smp *smp, struct ib_device *ibdev, in subn_set_pkeytable() argument
1042 u32 startpx = 32 * (be32_to_cpu(smp->attr_mod) & 0xffff); in subn_set_pkeytable()
1043 __be16 *p = (__be16 *) smp->data; in subn_set_pkeytable()
1044 u16 *q = (u16 *) smp->data; in subn_set_pkeytable()
1052 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_pkeytable()
1054 return subn_get_pkeytable(smp, ibdev, port); in subn_set_pkeytable()
1057 static int subn_get_sl_to_vl(struct ib_smp *smp, struct ib_device *ibdev, in subn_get_sl_to_vl() argument
1061 u8 *p = (u8 *) smp->data; in subn_get_sl_to_vl()
1064 memset(smp->data, 0, sizeof(smp->data)); in subn_get_sl_to_vl()
1067 smp->status |= IB_SMP_UNSUP_METHOD; in subn_get_sl_to_vl()
1072 return reply(smp); in subn_get_sl_to_vl()
1075 static int subn_set_sl_to_vl(struct ib_smp *smp, struct ib_device *ibdev, in subn_set_sl_to_vl() argument
1079 u8 *p = (u8 *) smp->data; in subn_set_sl_to_vl()
1083 smp->status |= IB_SMP_UNSUP_METHOD; in subn_set_sl_to_vl()
1084 return reply(smp); in subn_set_sl_to_vl()
1094 return subn_get_sl_to_vl(smp, ibdev, port); in subn_set_sl_to_vl()
1097 static int subn_get_vl_arb(struct ib_smp *smp, struct ib_device *ibdev, in subn_get_vl_arb() argument
1100 unsigned which = be32_to_cpu(smp->attr_mod) >> 16; in subn_get_vl_arb()
1103 memset(smp->data, 0, sizeof(smp->data)); in subn_get_vl_arb()
1106 smp->status |= IB_SMP_UNSUP_METHOD; in subn_get_vl_arb()
1109 smp->data); in subn_get_vl_arb()
1112 smp->data); in subn_get_vl_arb()
1114 smp->status |= IB_SMP_INVALID_FIELD; in subn_get_vl_arb()
1116 return reply(smp); in subn_get_vl_arb()
1119 static int subn_set_vl_arb(struct ib_smp *smp, struct ib_device *ibdev, in subn_set_vl_arb() argument
1122 unsigned which = be32_to_cpu(smp->attr_mod) >> 16; in subn_set_vl_arb()
1126 smp->status |= IB_SMP_UNSUP_METHOD; in subn_set_vl_arb()
1129 smp->data); in subn_set_vl_arb()
1132 smp->data); in subn_set_vl_arb()
1134 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_vl_arb()
1136 return subn_get_vl_arb(smp, ibdev, port); in subn_set_vl_arb()
1139 static int subn_trap_repress(struct ib_smp *smp, struct ib_device *ibdev, in subn_trap_repress() argument
1864 struct ib_smp *smp = (struct ib_smp *)out_mad; in process_subn() local
1870 if (smp->class_version != 1) { in process_subn()
1871 smp->status |= IB_SMP_UNSUP_VERSION; in process_subn()
1872 ret = reply(smp); in process_subn()
1876 ret = check_mkey(ibp, smp, mad_flags); in process_subn()
1878 u32 port_num = be32_to_cpu(smp->attr_mod); in process_subn()
1888 (smp->method == IB_MGMT_METHOD_GET || in process_subn()
1889 smp->method == IB_MGMT_METHOD_SET) && in process_subn()
1892 (void) check_mkey(to_iport(ibdev, port_num), smp, 0); in process_subn()
1897 switch (smp->method) { in process_subn()
1899 switch (smp->attr_id) { in process_subn()
1901 ret = subn_get_nodedescription(smp, ibdev); in process_subn()
1904 ret = subn_get_nodeinfo(smp, ibdev, port); in process_subn()
1907 ret = subn_get_guidinfo(smp, ibdev, port); in process_subn()
1910 ret = subn_get_portinfo(smp, ibdev, port); in process_subn()
1913 ret = subn_get_pkeytable(smp, ibdev, port); in process_subn()
1916 ret = subn_get_sl_to_vl(smp, ibdev, port); in process_subn()
1919 ret = subn_get_vl_arb(smp, ibdev, port); in process_subn()
1933 smp->status |= IB_SMP_UNSUP_METH_ATTR; in process_subn()
1934 ret = reply(smp); in process_subn()
1939 switch (smp->attr_id) { in process_subn()
1941 ret = subn_set_guidinfo(smp, ibdev, port); in process_subn()
1944 ret = subn_set_portinfo(smp, ibdev, port); in process_subn()
1947 ret = subn_set_pkeytable(smp, ibdev, port); in process_subn()
1950 ret = subn_set_sl_to_vl(smp, ibdev, port); in process_subn()
1953 ret = subn_set_vl_arb(smp, ibdev, port); in process_subn()
1967 smp->status |= IB_SMP_UNSUP_METH_ATTR; in process_subn()
1968 ret = reply(smp); in process_subn()
1973 if (smp->attr_id == IB_SMP_ATTR_NOTICE) in process_subn()
1974 ret = subn_trap_repress(smp, ibdev, port); in process_subn()
1976 smp->status |= IB_SMP_UNSUP_METH_ATTR; in process_subn()
1977 ret = reply(smp); in process_subn()
1994 if (ib_get_smp_direction(smp) && in process_subn()
1995 smp->attr_id == QIB_VENDOR_IPG) { in process_subn()
1997 smp->data[0]); in process_subn()
2004 smp->status |= IB_SMP_UNSUP_METHOD; in process_subn()
2005 ret = reply(smp); in process_subn()