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
90 smp = send_buf->mad; in qib_send_trap()
91 smp->base_version = IB_MGMT_BASE_VERSION; in qib_send_trap()
92 smp->mgmt_class = IB_MGMT_CLASS_SUBN_LID_ROUTED; in qib_send_trap()
93 smp->class_version = 1; in qib_send_trap()
94 smp->method = IB_MGMT_METHOD_TRAP; in qib_send_trap()
96 smp->tid = cpu_to_be64(ibp->tid); in qib_send_trap()
97 smp->attr_id = IB_SMP_ATTR_NOTICE; in qib_send_trap()
99 memcpy(smp->data, data, len); in qib_send_trap()
168 static void qib_bad_mkey(struct qib_ibport *ibp, struct ib_smp *smp) in qib_bad_mkey() argument
181 data.details.ntc_256.method = smp->method; in qib_bad_mkey()
182 data.details.ntc_256.attr_id = smp->attr_id; in qib_bad_mkey()
183 data.details.ntc_256.attr_mod = smp->attr_mod; in qib_bad_mkey()
184 data.details.ntc_256.mkey = smp->mkey; in qib_bad_mkey()
185 if (smp->mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) { in qib_bad_mkey()
188 data.details.ntc_256.dr_slid = smp->dr_slid; in qib_bad_mkey()
190 hop_cnt = smp->hop_cnt; in qib_bad_mkey()
197 memcpy(data.details.ntc_256.dr_rtn_path, smp->return_path, in qib_bad_mkey()
265 static int subn_get_nodedescription(struct ib_smp *smp, in subn_get_nodedescription() argument
268 if (smp->attr_mod) in subn_get_nodedescription()
269 smp->status |= IB_SMP_INVALID_FIELD; in subn_get_nodedescription()
271 memcpy(smp->data, ibdev->node_desc, sizeof(smp->data)); in subn_get_nodedescription()
273 return reply(smp); in subn_get_nodedescription()
276 static int subn_get_nodeinfo(struct ib_smp *smp, struct ib_device *ibdev, in subn_get_nodeinfo() argument
279 struct ib_node_info *nip = (struct ib_node_info *)&smp->data; in subn_get_nodeinfo()
285 if (smp->attr_mod || pidx >= dd->num_pports || in subn_get_nodeinfo()
287 smp->status |= IB_SMP_INVALID_FIELD; in subn_get_nodeinfo()
309 return reply(smp); in subn_get_nodeinfo()
312 static int subn_get_guidinfo(struct ib_smp *smp, struct ib_device *ibdev, in subn_get_guidinfo() argument
316 u32 startgx = 8 * be32_to_cpu(smp->attr_mod); in subn_get_guidinfo()
317 __be64 *p = (__be64 *) smp->data; in subn_get_guidinfo()
322 memset(smp->data, 0, sizeof(smp->data)); in subn_get_guidinfo()
332 smp->status |= IB_SMP_INVALID_FIELD; in subn_get_guidinfo()
340 smp->status |= IB_SMP_INVALID_FIELD; in subn_get_guidinfo()
342 return reply(smp); in subn_get_guidinfo()
405 static int check_mkey(struct qib_ibport *ibp, struct ib_smp *smp, int mad_flags) in check_mkey() argument
419 ibp->mkey == smp->mkey) in check_mkey()
424 (smp->method == IB_MGMT_METHOD_GET || in check_mkey()
425 smp->method == IB_MGMT_METHOD_SET || in check_mkey()
426 smp->method == IB_MGMT_METHOD_TRAP_REPRESS)) in check_mkey()
430 switch (smp->method) { in check_mkey()
443 qib_bad_mkey(ibp, smp); in check_mkey()
451 static int subn_get_portinfo(struct ib_smp *smp, struct ib_device *ibdev, in subn_get_portinfo() argument
457 struct ib_port_info *pip = (struct ib_port_info *)smp->data; in subn_get_portinfo()
461 u32 port_num = be32_to_cpu(smp->attr_mod); in subn_get_portinfo()
467 smp->status |= IB_SMP_INVALID_FIELD; in subn_get_portinfo()
468 ret = reply(smp); in subn_get_portinfo()
473 ret = check_mkey(ibp, smp, 0); in subn_get_portinfo()
487 memset(smp->data, 0, sizeof(smp->data)); in subn_get_portinfo()
490 if (!(smp->method == IB_MGMT_METHOD_GET && in subn_get_portinfo()
491 ibp->mkey != smp->mkey && in subn_get_portinfo()
566 ret = reply(smp); in subn_get_portinfo()
593 static int subn_get_pkeytable(struct ib_smp *smp, struct ib_device *ibdev, in subn_get_pkeytable() argument
596 u32 startpx = 32 * (be32_to_cpu(smp->attr_mod) & 0xffff); in subn_get_pkeytable()
597 u16 *p = (u16 *) smp->data; in subn_get_pkeytable()
598 __be16 *q = (__be16 *) smp->data; in subn_get_pkeytable()
602 memset(smp->data, 0, sizeof(smp->data)); in subn_get_pkeytable()
612 smp->status |= IB_SMP_INVALID_FIELD; in subn_get_pkeytable()
614 return reply(smp); in subn_get_pkeytable()
617 static int subn_set_guidinfo(struct ib_smp *smp, struct ib_device *ibdev, in subn_set_guidinfo() argument
621 u32 startgx = 8 * be32_to_cpu(smp->attr_mod); in subn_set_guidinfo()
622 __be64 *p = (__be64 *) smp->data; in subn_set_guidinfo()
636 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_guidinfo()
639 return subn_get_guidinfo(smp, ibdev, port); in subn_set_guidinfo()
650 static int subn_set_portinfo(struct ib_smp *smp, struct ib_device *ibdev, in subn_set_portinfo() argument
653 struct ib_port_info *pip = (struct ib_port_info *)smp->data; in subn_set_portinfo()
668 u32 port_num = be32_to_cpu(smp->attr_mod); in subn_set_portinfo()
694 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
709 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
733 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
749 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
767 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
777 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
785 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
801 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
804 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
817 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
838 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
849 if (lstate == QIB_IB_LINKDOWN_DISABLE && smp->hop_cnt) { in subn_set_portinfo()
862 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
870 ret = subn_get_portinfo(smp, ibdev, port); in subn_set_portinfo()
878 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_portinfo()
880 ret = subn_get_portinfo(smp, ibdev, port); in subn_set_portinfo()
1037 static int subn_set_pkeytable(struct ib_smp *smp, struct ib_device *ibdev, in subn_set_pkeytable() argument
1040 u32 startpx = 32 * (be32_to_cpu(smp->attr_mod) & 0xffff); in subn_set_pkeytable()
1041 __be16 *p = (__be16 *) smp->data; in subn_set_pkeytable()
1042 u16 *q = (u16 *) smp->data; in subn_set_pkeytable()
1050 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_pkeytable()
1052 return subn_get_pkeytable(smp, ibdev, port); in subn_set_pkeytable()
1055 static int subn_get_sl_to_vl(struct ib_smp *smp, struct ib_device *ibdev, in subn_get_sl_to_vl() argument
1059 u8 *p = (u8 *) smp->data; in subn_get_sl_to_vl()
1062 memset(smp->data, 0, sizeof(smp->data)); in subn_get_sl_to_vl()
1065 smp->status |= IB_SMP_UNSUP_METHOD; in subn_get_sl_to_vl()
1070 return reply(smp); in subn_get_sl_to_vl()
1073 static int subn_set_sl_to_vl(struct ib_smp *smp, struct ib_device *ibdev, in subn_set_sl_to_vl() argument
1077 u8 *p = (u8 *) smp->data; in subn_set_sl_to_vl()
1081 smp->status |= IB_SMP_UNSUP_METHOD; in subn_set_sl_to_vl()
1082 return reply(smp); in subn_set_sl_to_vl()
1092 return subn_get_sl_to_vl(smp, ibdev, port); in subn_set_sl_to_vl()
1095 static int subn_get_vl_arb(struct ib_smp *smp, struct ib_device *ibdev, in subn_get_vl_arb() argument
1098 unsigned which = be32_to_cpu(smp->attr_mod) >> 16; in subn_get_vl_arb()
1101 memset(smp->data, 0, sizeof(smp->data)); in subn_get_vl_arb()
1104 smp->status |= IB_SMP_UNSUP_METHOD; in subn_get_vl_arb()
1107 smp->data); in subn_get_vl_arb()
1110 smp->data); in subn_get_vl_arb()
1112 smp->status |= IB_SMP_INVALID_FIELD; in subn_get_vl_arb()
1114 return reply(smp); in subn_get_vl_arb()
1117 static int subn_set_vl_arb(struct ib_smp *smp, struct ib_device *ibdev, in subn_set_vl_arb() argument
1120 unsigned which = be32_to_cpu(smp->attr_mod) >> 16; in subn_set_vl_arb()
1124 smp->status |= IB_SMP_UNSUP_METHOD; in subn_set_vl_arb()
1127 smp->data); in subn_set_vl_arb()
1130 smp->data); in subn_set_vl_arb()
1132 smp->status |= IB_SMP_INVALID_FIELD; in subn_set_vl_arb()
1134 return subn_get_vl_arb(smp, ibdev, port); in subn_set_vl_arb()
1137 static int subn_trap_repress(struct ib_smp *smp, struct ib_device *ibdev, in subn_trap_repress() argument
1860 struct ib_smp *smp = (struct ib_smp *)out_mad; in process_subn() local
1866 if (smp->class_version != 1) { in process_subn()
1867 smp->status |= IB_SMP_UNSUP_VERSION; in process_subn()
1868 ret = reply(smp); in process_subn()
1872 ret = check_mkey(ibp, smp, mad_flags); in process_subn()
1874 u32 port_num = be32_to_cpu(smp->attr_mod); in process_subn()
1884 (smp->method == IB_MGMT_METHOD_GET || in process_subn()
1885 smp->method == IB_MGMT_METHOD_SET) && in process_subn()
1888 (void) check_mkey(to_iport(ibdev, port_num), smp, 0); in process_subn()
1893 switch (smp->method) { in process_subn()
1895 switch (smp->attr_id) { in process_subn()
1897 ret = subn_get_nodedescription(smp, ibdev); in process_subn()
1900 ret = subn_get_nodeinfo(smp, ibdev, port); in process_subn()
1903 ret = subn_get_guidinfo(smp, ibdev, port); in process_subn()
1906 ret = subn_get_portinfo(smp, ibdev, port); in process_subn()
1909 ret = subn_get_pkeytable(smp, ibdev, port); in process_subn()
1912 ret = subn_get_sl_to_vl(smp, ibdev, port); in process_subn()
1915 ret = subn_get_vl_arb(smp, ibdev, port); in process_subn()
1929 smp->status |= IB_SMP_UNSUP_METH_ATTR; in process_subn()
1930 ret = reply(smp); in process_subn()
1935 switch (smp->attr_id) { in process_subn()
1937 ret = subn_set_guidinfo(smp, ibdev, port); in process_subn()
1940 ret = subn_set_portinfo(smp, ibdev, port); in process_subn()
1943 ret = subn_set_pkeytable(smp, ibdev, port); in process_subn()
1946 ret = subn_set_sl_to_vl(smp, ibdev, port); in process_subn()
1949 ret = subn_set_vl_arb(smp, ibdev, port); in process_subn()
1963 smp->status |= IB_SMP_UNSUP_METH_ATTR; in process_subn()
1964 ret = reply(smp); in process_subn()
1969 if (smp->attr_id == IB_SMP_ATTR_NOTICE) in process_subn()
1970 ret = subn_trap_repress(smp, ibdev, port); in process_subn()
1972 smp->status |= IB_SMP_UNSUP_METH_ATTR; in process_subn()
1973 ret = reply(smp); in process_subn()
1990 if (ib_get_smp_direction(smp) && in process_subn()
1991 smp->attr_id == QIB_VENDOR_IPG) { in process_subn()
1993 smp->data[0]); in process_subn()
2000 smp->status |= IB_SMP_UNSUP_METHOD; in process_subn()
2001 ret = reply(smp); in process_subn()