35 #include <linux/string.h>
36 #include <linux/slab.h>
62 ret, dev->
ib_dev.name, port_num);
84 memset(&ah_attr, 0,
sizeof ah_attr);
95 if (dev->
sm_ah[port_num - 1])
97 dev->
sm_ah[port_num - 1] = new_ah;
98 spin_unlock_irqrestore(&dev->
sm_lock, flags);
105 static void smp_snoop(
struct ib_device *ibdev,
120 mthca_update_rate(to_mdev(ibdev), port_num);
121 update_sm_ah(to_mdev(ibdev), port_num,
125 event.device = ibdev;
133 if (prev_lid != lid) {
140 event.device = ibdev;
148 static void node_desc_override(
struct ib_device *dev,
161 static void forward_trap(
struct mthca_dev *dev,
174 if (IS_ERR(send_buf))
184 if ((send_buf->
ah = dev->
sm_ah[port_num - 1]))
188 spin_unlock_irqrestore(&dev->
sm_lock, flags);
211 forward_trap(to_mdev(ibdev), port_num, in_mad);
249 prev_lid = pattr.
lid;
254 port_num, in_wc, in_grh, in_mad, out_mad);
258 mthca_err(to_mdev(ibdev),
"MAD_IFC returned %d\n", err);
262 if (!out_mad->
mad_hdr.status) {
263 smp_snoop(ibdev, port_num, in_mad, prev_lid);
264 node_desc_override(ibdev, out_mad);
292 for (p = 0; p < dev->
limits.num_ports; ++
p)
293 for (q = 0; q <= 1; ++
q) {
299 ret = PTR_ERR(agent);
306 for (p = 1; p <= dev->
limits.num_ports; ++
p) {
307 ret = mthca_update_rate(dev, p);
309 mthca_err(dev,
"Failed to obtain port %d rate."
318 for (p = 0; p < dev->
limits.num_ports; ++
p)
319 for (q = 0; q <= 1; ++
q)
331 for (p = 0; p < dev->
limits.num_ports; ++
p) {
332 for (q = 0; q <= 1; ++
q) {