Lines Matching refs:dev
63 static int find_mgm(struct mthca_dev *dev,
73 mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL);
80 err = mthca_MGID_HASH(dev, mailbox, hash, &status);
84 mthca_err(dev, "MGID_HASH returned status %02x\n", status);
90 mthca_dbg(dev, "Hash for %pI6 is %04x\n", gid, *hash);
96 err = mthca_READ_MGM(dev, *index, mgm_mailbox, &status);
100 mthca_err(dev, "READ_MGM returned status %02x\n", status);
107 mthca_err(dev, "Found zero MGID in AMGM.\n");
123 mthca_free_mailbox(dev, mailbox);
129 struct mthca_dev *dev = to_mdev(ibqp->device);
139 mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL);
144 mutex_lock(&dev->mcg_table.mutex);
146 err = find_mgm(dev, gid->raw, mailbox, &hash, &prev, &index);
156 index = mthca_alloc(&dev->mcg_table.alloc);
158 mthca_err(dev, "No AMGM entries left\n");
163 err = mthca_READ_MGM(dev, index, mailbox, &status);
167 mthca_err(dev, "READ_MGM returned status %02x\n", status);
177 mthca_dbg(dev, "QP %06x already a member of MGM\n",
187 mthca_err(dev, "MGM at index %x is full.\n", index);
192 err = mthca_WRITE_MGM(dev, index, mailbox, &status);
196 mthca_err(dev, "WRITE_MGM returned status %02x\n", status);
204 err = mthca_READ_MGM(dev, prev, mailbox, &status);
208 mthca_err(dev, "READ_MGM returned status %02x\n", status);
215 err = mthca_WRITE_MGM(dev, prev, mailbox, &status);
219 mthca_err(dev, "WRITE_MGM returned status %02x\n", status);
225 BUG_ON(index < dev->limits.num_mgms);
226 mthca_free(&dev->mcg_table.alloc, index);
228 mutex_unlock(&dev->mcg_table.mutex);
230 mthca_free_mailbox(dev, mailbox);
236 struct mthca_dev *dev = to_mdev(ibqp->device);
245 mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL);
250 mutex_lock(&dev->mcg_table.mutex);
252 err = find_mgm(dev, gid->raw, mailbox, &hash, &prev, &index);
257 mthca_err(dev, "MGID %pI6 not found\n", gid->raw);
270 mthca_err(dev, "QP %06x not found in MGM\n", ibqp->qp_num);
278 err = mthca_WRITE_MGM(dev, index, mailbox, &status);
282 mthca_err(dev, "WRITE_MGM returned status %02x\n", status);
294 err = mthca_READ_MGM(dev, amgm_index_to_free,
299 mthca_err(dev, "READ_MGM returned status %02x\n",
307 err = mthca_WRITE_MGM(dev, index, mailbox, &status);
311 mthca_err(dev, "WRITE_MGM returned status %02x\n", status);
316 BUG_ON(amgm_index_to_free < dev->limits.num_mgms);
317 mthca_free(&dev->mcg_table.alloc, amgm_index_to_free);
322 err = mthca_READ_MGM(dev, prev, mailbox, &status);
326 mthca_err(dev, "READ_MGM returned status %02x\n", status);
333 err = mthca_WRITE_MGM(dev, prev, mailbox, &status);
337 mthca_err(dev, "WRITE_MGM returned status %02x\n", status);
341 BUG_ON(index < dev->limits.num_mgms);
342 mthca_free(&dev->mcg_table.alloc, index);
346 mutex_unlock(&dev->mcg_table.mutex);
348 mthca_free_mailbox(dev, mailbox);
352 int mthca_init_mcg_table(struct mthca_dev *dev)
355 int table_size = dev->limits.num_mgms + dev->limits.num_amgms;
357 err = mthca_alloc_init(&dev->mcg_table.alloc,
360 dev->limits.num_mgms);
364 mutex_init(&dev->mcg_table.mutex);
369 void mthca_cleanup_mcg_table(struct mthca_dev *dev)
371 mthca_alloc_cleanup(&dev->mcg_table.alloc);