Lines Matching +full:rpc +full:- +full:if
2 * Copyright (c) 2004-2009 Voltaire Inc. All rights reserved.
14 * - Redistributions of source code must retain the above
18 * - Redistributions in binary form must reproduce the above
34 #if HAVE_CONFIG_H
49 #define DEBUG if (ibdebug) IBWARN
51 int mad_send(ib_rpc_t * rpc, ib_portid_t * dport, ib_rmpp_hdr_t * rmpp, in mad_send() argument
54 return mad_send_via(rpc, dport, rmpp, data, ibmp); in mad_send()
57 int mad_send_via(ib_rpc_t * rpc, ib_portid_t * dport, ib_rmpp_hdr_t * rmpp, in mad_send_via() argument
67 if (mad_build_pkt(umad, rpc, dport, rmpp, data) < 0) in mad_send_via()
68 return -1; in mad_send_via()
70 if (ibdebug) { in mad_send_via()
71 IBWARN("data offs %d sz %d", rpc->dataoffs, rpc->datasz); in mad_send_via()
73 (char *)umad_get_mad(umad) + rpc->dataoffs, rpc->datasz); in mad_send_via()
76 if (umad_send(srcport->port_id, srcport->class_agents[rpc->mgtclass & 0xff], in mad_send_via()
77 umad, IB_MAD_SIZE, mad_get_timeout(srcport, rpc->timeout), in mad_send_via()
80 return -1; in mad_send_via()
96 ib_rpc_t rpc = { 0 }; in mad_respond_via() local
100 if (!portid) { in mad_respond_via()
101 if (!(mad_addr = umad_get_mad_addr(umad))) { in mad_respond_via()
103 return -1; in mad_respond_via()
108 rport.lid = ntohs(mad_addr->lid); in mad_respond_via()
109 rport.qp = ntohl(mad_addr->qpn); in mad_respond_via()
110 rport.qkey = ntohl(mad_addr->qkey); in mad_respond_via()
111 rport.sl = mad_addr->sl; in mad_respond_via()
113 if (mad_addr->grh_present) { in mad_respond_via()
115 memcpy(&rport.gid, &mad_addr->gid, sizeof(rport.gid)); in mad_respond_via()
123 rpc.mgtclass = mad_get_field(mad, 0, IB_MAD_MGMTCLASS_F); in mad_respond_via()
125 rpc.method = mad_get_field(mad, 0, IB_MAD_METHOD_F); in mad_respond_via()
126 if (rpc.method == IB_MAD_METHOD_SET) in mad_respond_via()
127 rpc.method = IB_MAD_METHOD_GET; in mad_respond_via()
128 if (rpc.method != IB_MAD_METHOD_SEND) in mad_respond_via()
129 rpc.method |= IB_MAD_RESPONSE; in mad_respond_via()
131 rpc.attr.id = mad_get_field(mad, 0, IB_MAD_ATTRID_F); in mad_respond_via()
132 rpc.attr.mod = mad_get_field(mad, 0, IB_MAD_ATTRMOD_F); in mad_respond_via()
133 if (rpc.mgtclass == IB_SA_CLASS) in mad_respond_via()
134 rpc.recsz = mad_get_field(mad, 0, IB_SA_ATTROFFS_F); in mad_respond_via()
135 if (mad_is_vendor_range2(rpc.mgtclass)) in mad_respond_via()
136 rpc.oui = mad_get_field(mad, 0, IB_VEND2_OUI_F); in mad_respond_via()
138 rpc.trid = mad_get_field64(mad, 0, IB_MAD_TRID_F); in mad_respond_via()
139 rpc.rstatus = rstatus; in mad_respond_via()
143 is_smi = rpc.mgtclass == IB_SMI_CLASS || in mad_respond_via()
144 rpc.mgtclass == IB_SMI_DIRECT_CLASS; in mad_respond_via()
146 if (is_smi) in mad_respond_via()
147 portid->qp = 0; in mad_respond_via()
148 else if (!portid->qp) in mad_respond_via()
149 portid->qp = 1; in mad_respond_via()
151 if (!portid->qkey && portid->qp == 1) in mad_respond_via()
152 portid->qkey = IB_DEFAULT_QP1_QKEY; in mad_respond_via()
156 portid->qp, rpc.mgtclass, rpc.method, rpc.attr.id, rpc.attr.mod, in mad_respond_via()
157 rpc.datasz, rpc.dataoffs, portid->qkey); in mad_respond_via()
159 if (mad_build_pkt(umad, &rpc, portid, 0, 0) < 0) in mad_respond_via()
160 return -1; in mad_respond_via()
162 if (ibdebug > 1) in mad_respond_via()
165 if (umad_send in mad_respond_via()
166 (srcport->port_id, srcport->class_agents[rpc.mgtclass], umad, in mad_respond_via()
167 IB_MAD_SIZE, mad_get_timeout(srcport, rpc.timeout), 0) < 0) { in mad_respond_via()
169 return -1; in mad_respond_via()
186 if ((agent = umad_recv(srcport->port_id, mad, &length, in mad_receive_via()
188 if (!umad) in mad_receive_via()