Lines Matching refs: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
91 smp = send_buf->mad; in qib_send_trap()
92 smp->base_version = IB_MGMT_BASE_VERSION; in qib_send_trap()
93 smp->mgmt_class = IB_MGMT_CLASS_SUBN_LID_ROUTED; in qib_send_trap()
94 smp->class_version = 1; in qib_send_trap()
95 smp->method = IB_MGMT_METHOD_TRAP; in qib_send_trap()
97 smp->tid = cpu_to_be64(ibp->tid); in qib_send_trap()
98 smp->attr_id = IB_SMP_ATTR_NOTICE; in qib_send_trap()
100 memcpy(smp->data, data, len); in qib_send_trap()
169 static void qib_bad_mkey(struct qib_ibport *ibp, struct ib_smp *smp) in qib_bad_mkey() argument
182 data.details.ntc_256.method = smp->method; in qib_bad_mkey()
183 data.details.ntc_256.attr_id = smp->attr_id; in qib_bad_mkey()
184 data.details.ntc_256.attr_mod = smp->attr_mod; in qib_bad_mkey()
185 data.details.ntc_256.mkey = smp->mkey; in qib_bad_mkey()
186 if (smp->mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) { in qib_bad_mkey()
189 data.details.ntc_256.dr_slid = smp->dr_slid; in qib_bad_mkey()
191 hop_cnt = smp->hop_cnt; in qib_bad_mkey()
198 memcpy(data.details.ntc_256.dr_rtn_path, smp->return_path, in qib_bad_mkey()
266 static int subn_get_nodedescription(struct ib_smp *smp, in subn_get_nodedescription() argument
269 if (smp->attr_mod) in subn_get_nodedescription()
270 smp->status |= IB_SMP_INVALID_FIELD; in subn_get_nodedescription()
272 memcpy(smp->data, ibdev->node_desc, sizeof(smp->data)); in subn_get_nodedescription()
274 return reply(smp); in subn_get_nodedescription()
277 static int subn_get_nodeinfo(struct ib_smp *smp, struct ib_device *ibdev, in subn_get_nodeinfo() argument
280 struct ib_node_info *nip = (struct ib_node_info *)&smp->data; in subn_get_nodeinfo()
286 if (smp->attr_mod || pidx >= dd->num_pports || in subn_get_nodeinfo()
288 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->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()
444 qib_bad_mkey(ibp, smp); in check_mkey()
452 static int subn_get_portinfo(struct ib_smp *smp, struct ib_device *ibdev, in subn_get_portinfo() argument
458 struct ib_port_info *pip = (struct ib_port_info *)smp->data; in subn_get_portinfo()
462 u32 port_num = be32_to_cpu(smp->attr_mod); in subn_get_portinfo()
468 smp->status |= IB_SMP_INVALID_FIELD; in subn_get_portinfo()
469 ret = reply(smp); in subn_get_portinfo()
474 ret = check_mkey(ibp, smp, 0); in subn_get_portinfo()
488 memset(smp->data, 0, sizeof(smp->data)); in subn_get_portinfo()
491 if (!(smp->method == IB_MGMT_METHOD_GET && in subn_get_portinfo()
492 ibp->mkey != smp->mkey && in subn_get_portinfo()
567 ret = reply(smp); in subn_get_portinfo()
594 static int subn_get_pkeytable(struct ib_smp *smp, struct ib_device *ibdev, in subn_get_pkeytable() argument
597 u32 startpx = 32 * (be32_to_cpu(smp->attr_mod) & 0xffff); in subn_get_pkeytable()
598 u16 *p = (u16 *) smp->data; in subn_get_pkeytable()
599 __be16 *q = (__be16 *) smp->data; in subn_get_pkeytable()
603 memset(smp->data, 0, sizeof(smp->data)); in subn_get_pkeytable()
613 smp->status |= IB_SMP_INVALID_FIELD; in subn_get_pkeytable()
615 return reply(smp); in subn_get_pkeytable()
618 static int subn_set_guidinfo(struct ib_smp *smp, struct ib_device *ibdev, in subn_set_guidinfo() argument
622 u32 startgx = 8 * be32_to_cpu(smp->attr_mod); in subn_set_guidinfo()
623 __be64 *p = (__be64 *) smp->data; in subn_set_guidinfo()
637 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_guidinfo()
640 return subn_get_guidinfo(smp, ibdev, port); in subn_set_guidinfo()
651 static int subn_set_portinfo(struct ib_smp *smp, struct ib_device *ibdev, in subn_set_portinfo() argument
654 struct ib_port_info *pip = (struct ib_port_info *)smp->data; in subn_set_portinfo()
669 u32 port_num = be32_to_cpu(smp->attr_mod); in subn_set_portinfo()
695 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
710 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
734 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
750 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
768 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
778 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
786 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
802 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
805 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
818 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
839 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
850 if (lstate == QIB_IB_LINKDOWN_DISABLE && smp->hop_cnt) { in subn_set_portinfo()
863 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
871 ret = subn_get_portinfo(smp, ibdev, port); in subn_set_portinfo()
879 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
881 ret = subn_get_portinfo(smp, ibdev, port); in subn_set_portinfo()
1038 static int subn_set_pkeytable(struct ib_smp *smp, struct ib_device *ibdev, in subn_set_pkeytable() argument
1041 u32 startpx = 32 * (be32_to_cpu(smp->attr_mod) & 0xffff); in subn_set_pkeytable()
1042 __be16 *p = (__be16 *) smp->data; in subn_set_pkeytable()
1043 u16 *q = (u16 *) smp->data; in subn_set_pkeytable()
1051 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_pkeytable()
1053 return subn_get_pkeytable(smp, ibdev, port); in subn_set_pkeytable()
1056 static int subn_get_sl_to_vl(struct ib_smp *smp, struct ib_device *ibdev, in subn_get_sl_to_vl() argument
1060 u8 *p = (u8 *) smp->data; in subn_get_sl_to_vl()
1063 memset(smp->data, 0, sizeof(smp->data)); in subn_get_sl_to_vl()
1066 smp->status |= IB_SMP_UNSUP_METHOD; in subn_get_sl_to_vl()
1071 return reply(smp); in subn_get_sl_to_vl()
1074 static int subn_set_sl_to_vl(struct ib_smp *smp, struct ib_device *ibdev, in subn_set_sl_to_vl() argument
1078 u8 *p = (u8 *) smp->data; in subn_set_sl_to_vl()
1082 smp->status |= IB_SMP_UNSUP_METHOD; in subn_set_sl_to_vl()
1083 return reply(smp); in subn_set_sl_to_vl()
1093 return subn_get_sl_to_vl(smp, ibdev, port); in subn_set_sl_to_vl()
1096 static int subn_get_vl_arb(struct ib_smp *smp, struct ib_device *ibdev, in subn_get_vl_arb() argument
1099 unsigned which = be32_to_cpu(smp->attr_mod) >> 16; in subn_get_vl_arb()
1102 memset(smp->data, 0, sizeof(smp->data)); in subn_get_vl_arb()
1105 smp->status |= IB_SMP_UNSUP_METHOD; in subn_get_vl_arb()
1108 smp->data); in subn_get_vl_arb()
1111 smp->data); in subn_get_vl_arb()
1113 smp->status |= IB_SMP_INVALID_FIELD; in subn_get_vl_arb()
1115 return reply(smp); in subn_get_vl_arb()
1118 static int subn_set_vl_arb(struct ib_smp *smp, struct ib_device *ibdev, in subn_set_vl_arb() argument
1121 unsigned which = be32_to_cpu(smp->attr_mod) >> 16; in subn_set_vl_arb()
1125 smp->status |= IB_SMP_UNSUP_METHOD; in subn_set_vl_arb()
1128 smp->data); in subn_set_vl_arb()
1131 smp->data); in subn_set_vl_arb()
1133 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_vl_arb()
1135 return subn_get_vl_arb(smp, ibdev, port); in subn_set_vl_arb()
1138 static int subn_trap_repress(struct ib_smp *smp, struct ib_device *ibdev, in subn_trap_repress() argument
1861 struct ib_smp *smp = (struct ib_smp *)out_mad; in process_subn() local
1867 if (smp->class_version != 1) { in process_subn()
1868 smp->status |= IB_SMP_UNSUP_VERSION; in process_subn()
1869 ret = reply(smp); in process_subn()
1873 ret = check_mkey(ibp, smp, mad_flags); in process_subn()
1875 u32 port_num = be32_to_cpu(smp->attr_mod); in process_subn()
1885 (smp->method == IB_MGMT_METHOD_GET || in process_subn()
1886 smp->method == IB_MGMT_METHOD_SET) && in process_subn()
1889 (void) check_mkey(to_iport(ibdev, port_num), smp, 0); in process_subn()
1894 switch (smp->method) { in process_subn()
1896 switch (smp->attr_id) { in process_subn()
1898 ret = subn_get_nodedescription(smp, ibdev); in process_subn()
1901 ret = subn_get_nodeinfo(smp, ibdev, port); in process_subn()
1904 ret = subn_get_guidinfo(smp, ibdev, port); in process_subn()
1907 ret = subn_get_portinfo(smp, ibdev, port); in process_subn()
1910 ret = subn_get_pkeytable(smp, ibdev, port); in process_subn()
1913 ret = subn_get_sl_to_vl(smp, ibdev, port); in process_subn()
1916 ret = subn_get_vl_arb(smp, ibdev, port); in process_subn()
1930 smp->status |= IB_SMP_UNSUP_METH_ATTR; in process_subn()
1931 ret = reply(smp); in process_subn()
1936 switch (smp->attr_id) { in process_subn()
1938 ret = subn_set_guidinfo(smp, ibdev, port); in process_subn()
1941 ret = subn_set_portinfo(smp, ibdev, port); in process_subn()
1944 ret = subn_set_pkeytable(smp, ibdev, port); in process_subn()
1947 ret = subn_set_sl_to_vl(smp, ibdev, port); in process_subn()
1950 ret = subn_set_vl_arb(smp, ibdev, port); in process_subn()
1964 smp->status |= IB_SMP_UNSUP_METH_ATTR; in process_subn()
1965 ret = reply(smp); in process_subn()
1970 if (smp->attr_id == IB_SMP_ATTR_NOTICE) in process_subn()
1971 ret = subn_trap_repress(smp, ibdev, port); in process_subn()
1973 smp->status |= IB_SMP_UNSUP_METH_ATTR; in process_subn()
1974 ret = reply(smp); in process_subn()
1991 if (ib_get_smp_direction(smp) && in process_subn()
1992 smp->attr_id == QIB_VENDOR_IPG) { in process_subn()
1994 smp->data[0]); in process_subn()
2001 smp->status |= IB_SMP_UNSUP_METHOD; in process_subn()
2002 ret = reply(smp); in process_subn()