33 #include <linux/string.h>
46 static const u8 zero_gid[16];
81 mthca_err(dev,
"MGID_HASH failed (%d)\n", err);
86 mthca_dbg(dev,
"Hash for %pI6 is %04x\n", gid, *hash);
94 mthca_err(dev,
"READ_MGM failed (%d)\n", err);
99 if (*index != *hash) {
100 mthca_err(dev,
"Found zero MGID in AMGM.\n");
133 return PTR_ERR(mailbox);
138 err = find_mgm(dev, gid->
raw, mailbox, &hash, &prev, &index);
150 mthca_err(dev,
"No AMGM entries left\n");
157 mthca_err(dev,
"READ_MGM failed (%d)\n", err);
160 memset(mgm, 0,
sizeof *mgm);
166 mthca_dbg(dev,
"QP %06x already a member of MGM\n",
175 if (i == MTHCA_QP_PER_MGM) {
176 mthca_err(dev,
"MGM at index %x is full.\n", index);
183 mthca_err(dev,
"WRITE_MGM failed %d\n", err);
193 mthca_err(dev,
"READ_MGM failed %d\n", err);
201 mthca_err(dev,
"WRITE_MGM returned %d\n", err);
204 if (err && link && index != -1) {
205 BUG_ON(index < dev->limits.num_mgms);
226 return PTR_ERR(mailbox);
231 err = find_mgm(dev, gid->
raw, mailbox, &hash, &prev, &index);
259 mthca_err(dev,
"WRITE_MGM returned %d\n", err);
269 if (amgm_index_to_free) {
273 mthca_err(dev,
"READ_MGM returned %d\n", err);
281 mthca_err(dev,
"WRITE_MGM returned %d\n", err);
284 if (amgm_index_to_free) {
285 BUG_ON(amgm_index_to_free < dev->limits.num_mgms);
293 mthca_err(dev,
"READ_MGM returned %d\n", err);
301 mthca_err(dev,
"WRITE_MGM returned %d\n", err);
304 BUG_ON(index < dev->limits.num_mgms);
318 int table_size = dev->
limits.num_mgms + dev->
limits.num_amgms;