| .. | .. |
|---|
| 36 | 36 | * Description: Slow Path Operators |
|---|
| 37 | 37 | */ |
|---|
| 38 | 38 | |
|---|
| 39 | +#define dev_fmt(fmt) "QPLIB: " fmt |
|---|
| 40 | + |
|---|
| 39 | 41 | #include <linux/interrupt.h> |
|---|
| 40 | 42 | #include <linux/spinlock.h> |
|---|
| 41 | 43 | #include <linux/sched.h> |
|---|
| .. | .. |
|---|
| 89 | 91 | sbuf = bnxt_qplib_rcfw_alloc_sbuf(rcfw, sizeof(*sb)); |
|---|
| 90 | 92 | if (!sbuf) { |
|---|
| 91 | 93 | dev_err(&rcfw->pdev->dev, |
|---|
| 92 | | - "QPLIB: SP: QUERY_FUNC alloc side buffer failed"); |
|---|
| 94 | + "SP: QUERY_FUNC alloc side buffer failed\n"); |
|---|
| 93 | 95 | return -ENOMEM; |
|---|
| 94 | 96 | } |
|---|
| 95 | 97 | |
|---|
| .. | .. |
|---|
| 117 | 119 | * reporting the max number |
|---|
| 118 | 120 | */ |
|---|
| 119 | 121 | attr->max_qp_wqes -= BNXT_QPLIB_RESERVED_QP_WRS; |
|---|
| 120 | | - attr->max_qp_sges = sb->max_sge; |
|---|
| 122 | + attr->max_qp_sges = bnxt_qplib_is_chip_gen_p5(rcfw->res->cctx) ? |
|---|
| 123 | + 6 : sb->max_sge; |
|---|
| 121 | 124 | attr->max_cq = le32_to_cpu(sb->max_cq); |
|---|
| 122 | 125 | attr->max_cq_wqes = le32_to_cpu(sb->max_cqe); |
|---|
| 123 | 126 | attr->max_cq_sges = attr->max_qp_sges; |
|---|
| .. | .. |
|---|
| 129 | 132 | attr->max_raw_ethy_qp = le32_to_cpu(sb->max_raw_eth_qp); |
|---|
| 130 | 133 | attr->max_ah = le32_to_cpu(sb->max_ah); |
|---|
| 131 | 134 | |
|---|
| 132 | | - attr->max_fmr = le32_to_cpu(sb->max_fmr); |
|---|
| 133 | | - attr->max_map_per_fmr = sb->max_map_per_fmr; |
|---|
| 134 | | - |
|---|
| 135 | 135 | attr->max_srq = le16_to_cpu(sb->max_srq); |
|---|
| 136 | 136 | attr->max_srq_wqes = le32_to_cpu(sb->max_srq_wr) - 1; |
|---|
| 137 | 137 | attr->max_srq_sges = sb->max_srq_sge; |
|---|
| 138 | | - /* Bono only reports 1 PKEY for now, but it can support > 1 */ |
|---|
| 139 | 138 | attr->max_pkey = le32_to_cpu(sb->max_pkeys); |
|---|
| 139 | + /* |
|---|
| 140 | + * Some versions of FW reports more than 0xFFFF. |
|---|
| 141 | + * Restrict it for now to 0xFFFF to avoid |
|---|
| 142 | + * reporting trucated value |
|---|
| 143 | + */ |
|---|
| 144 | + if (attr->max_pkey > 0xFFFF) { |
|---|
| 145 | + /* ib_port_attr::pkey_tbl_len is u16 */ |
|---|
| 146 | + attr->max_pkey = 0xFFFF; |
|---|
| 147 | + } |
|---|
| 140 | 148 | |
|---|
| 141 | 149 | attr->max_inline_data = le32_to_cpu(sb->max_inline_data); |
|---|
| 142 | 150 | attr->l2_db_size = (sb->l2_db_space_size + 1) * |
|---|
| .. | .. |
|---|
| 186 | 194 | (void *)&resp, |
|---|
| 187 | 195 | NULL, 0); |
|---|
| 188 | 196 | if (rc) { |
|---|
| 189 | | - dev_err(&res->pdev->dev, |
|---|
| 190 | | - "QPLIB: Failed to set function resources"); |
|---|
| 197 | + dev_err(&res->pdev->dev, "Failed to set function resources\n"); |
|---|
| 191 | 198 | } |
|---|
| 192 | 199 | return rc; |
|---|
| 193 | 200 | } |
|---|
| .. | .. |
|---|
| 199 | 206 | { |
|---|
| 200 | 207 | if (index >= sgid_tbl->max) { |
|---|
| 201 | 208 | dev_err(&res->pdev->dev, |
|---|
| 202 | | - "QPLIB: Index %d exceeded SGID table max (%d)", |
|---|
| 209 | + "Index %d exceeded SGID table max (%d)\n", |
|---|
| 203 | 210 | index, sgid_tbl->max); |
|---|
| 204 | 211 | return -EINVAL; |
|---|
| 205 | 212 | } |
|---|
| 206 | | - memcpy(gid, &sgid_tbl->tbl[index], sizeof(*gid)); |
|---|
| 213 | + memcpy(gid, &sgid_tbl->tbl[index].gid, sizeof(*gid)); |
|---|
| 207 | 214 | return 0; |
|---|
| 208 | 215 | } |
|---|
| 209 | 216 | |
|---|
| 210 | 217 | int bnxt_qplib_del_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl, |
|---|
| 211 | | - struct bnxt_qplib_gid *gid, bool update) |
|---|
| 218 | + struct bnxt_qplib_gid *gid, u16 vlan_id, bool update) |
|---|
| 212 | 219 | { |
|---|
| 213 | 220 | struct bnxt_qplib_res *res = to_bnxt_qplib(sgid_tbl, |
|---|
| 214 | 221 | struct bnxt_qplib_res, |
|---|
| .. | .. |
|---|
| 217 | 224 | int index; |
|---|
| 218 | 225 | |
|---|
| 219 | 226 | if (!sgid_tbl) { |
|---|
| 220 | | - dev_err(&res->pdev->dev, "QPLIB: SGID table not allocated"); |
|---|
| 227 | + dev_err(&res->pdev->dev, "SGID table not allocated\n"); |
|---|
| 221 | 228 | return -EINVAL; |
|---|
| 222 | 229 | } |
|---|
| 223 | 230 | /* Do we need a sgid_lock here? */ |
|---|
| 224 | 231 | if (!sgid_tbl->active) { |
|---|
| 225 | | - dev_err(&res->pdev->dev, |
|---|
| 226 | | - "QPLIB: SGID table has no active entries"); |
|---|
| 232 | + dev_err(&res->pdev->dev, "SGID table has no active entries\n"); |
|---|
| 227 | 233 | return -ENOMEM; |
|---|
| 228 | 234 | } |
|---|
| 229 | 235 | for (index = 0; index < sgid_tbl->max; index++) { |
|---|
| 230 | | - if (!memcmp(&sgid_tbl->tbl[index], gid, sizeof(*gid))) |
|---|
| 236 | + if (!memcmp(&sgid_tbl->tbl[index].gid, gid, sizeof(*gid)) && |
|---|
| 237 | + vlan_id == sgid_tbl->tbl[index].vlan_id) |
|---|
| 231 | 238 | break; |
|---|
| 232 | 239 | } |
|---|
| 233 | 240 | if (index == sgid_tbl->max) { |
|---|
| 234 | | - dev_warn(&res->pdev->dev, "GID not found in the SGID table"); |
|---|
| 241 | + dev_warn(&res->pdev->dev, "GID not found in the SGID table\n"); |
|---|
| 235 | 242 | return 0; |
|---|
| 236 | 243 | } |
|---|
| 237 | 244 | /* Remove GID from the SGID table */ |
|---|
| .. | .. |
|---|
| 244 | 251 | RCFW_CMD_PREP(req, DELETE_GID, cmd_flags); |
|---|
| 245 | 252 | if (sgid_tbl->hw_id[index] == 0xFFFF) { |
|---|
| 246 | 253 | dev_err(&res->pdev->dev, |
|---|
| 247 | | - "QPLIB: GID entry contains an invalid HW id"); |
|---|
| 254 | + "GID entry contains an invalid HW id\n"); |
|---|
| 248 | 255 | return -EINVAL; |
|---|
| 249 | 256 | } |
|---|
| 250 | 257 | req.gid_index = cpu_to_le16(sgid_tbl->hw_id[index]); |
|---|
| .. | .. |
|---|
| 253 | 260 | if (rc) |
|---|
| 254 | 261 | return rc; |
|---|
| 255 | 262 | } |
|---|
| 256 | | - memcpy(&sgid_tbl->tbl[index], &bnxt_qplib_gid_zero, |
|---|
| 263 | + memcpy(&sgid_tbl->tbl[index].gid, &bnxt_qplib_gid_zero, |
|---|
| 257 | 264 | sizeof(bnxt_qplib_gid_zero)); |
|---|
| 265 | + sgid_tbl->tbl[index].vlan_id = 0xFFFF; |
|---|
| 258 | 266 | sgid_tbl->vlan[index] = 0; |
|---|
| 259 | 267 | sgid_tbl->active--; |
|---|
| 260 | 268 | dev_dbg(&res->pdev->dev, |
|---|
| 261 | | - "QPLIB: SGID deleted hw_id[0x%x] = 0x%x active = 0x%x", |
|---|
| 269 | + "SGID deleted hw_id[0x%x] = 0x%x active = 0x%x\n", |
|---|
| 262 | 270 | index, sgid_tbl->hw_id[index], sgid_tbl->active); |
|---|
| 263 | 271 | sgid_tbl->hw_id[index] = (u16)-1; |
|---|
| 264 | 272 | |
|---|
| .. | .. |
|---|
| 277 | 285 | int i, free_idx; |
|---|
| 278 | 286 | |
|---|
| 279 | 287 | if (!sgid_tbl) { |
|---|
| 280 | | - dev_err(&res->pdev->dev, "QPLIB: SGID table not allocated"); |
|---|
| 288 | + dev_err(&res->pdev->dev, "SGID table not allocated\n"); |
|---|
| 281 | 289 | return -EINVAL; |
|---|
| 282 | 290 | } |
|---|
| 283 | 291 | /* Do we need a sgid_lock here? */ |
|---|
| 284 | 292 | if (sgid_tbl->active == sgid_tbl->max) { |
|---|
| 285 | | - dev_err(&res->pdev->dev, "QPLIB: SGID table is full"); |
|---|
| 293 | + dev_err(&res->pdev->dev, "SGID table is full\n"); |
|---|
| 286 | 294 | return -ENOMEM; |
|---|
| 287 | 295 | } |
|---|
| 288 | 296 | free_idx = sgid_tbl->max; |
|---|
| 289 | 297 | for (i = 0; i < sgid_tbl->max; i++) { |
|---|
| 290 | | - if (!memcmp(&sgid_tbl->tbl[i], gid, sizeof(*gid))) { |
|---|
| 298 | + if (!memcmp(&sgid_tbl->tbl[i], gid, sizeof(*gid)) && |
|---|
| 299 | + sgid_tbl->tbl[i].vlan_id == vlan_id) { |
|---|
| 291 | 300 | dev_dbg(&res->pdev->dev, |
|---|
| 292 | | - "QPLIB: SGID entry already exist in entry %d!", |
|---|
| 293 | | - i); |
|---|
| 301 | + "SGID entry already exist in entry %d!\n", i); |
|---|
| 294 | 302 | *index = i; |
|---|
| 295 | 303 | return -EALREADY; |
|---|
| 296 | 304 | } else if (!memcmp(&sgid_tbl->tbl[i], &bnxt_qplib_gid_zero, |
|---|
| .. | .. |
|---|
| 301 | 309 | } |
|---|
| 302 | 310 | if (free_idx == sgid_tbl->max) { |
|---|
| 303 | 311 | dev_err(&res->pdev->dev, |
|---|
| 304 | | - "QPLIB: SGID table is FULL but count is not MAX??"); |
|---|
| 312 | + "SGID table is FULL but count is not MAX??\n"); |
|---|
| 305 | 313 | return -ENOMEM; |
|---|
| 306 | 314 | } |
|---|
| 307 | 315 | if (update) { |
|---|
| .. | .. |
|---|
| 343 | 351 | } |
|---|
| 344 | 352 | /* Add GID to the sgid_tbl */ |
|---|
| 345 | 353 | memcpy(&sgid_tbl->tbl[free_idx], gid, sizeof(*gid)); |
|---|
| 354 | + sgid_tbl->tbl[free_idx].vlan_id = vlan_id; |
|---|
| 346 | 355 | sgid_tbl->active++; |
|---|
| 347 | 356 | if (vlan_id != 0xFFFF) |
|---|
| 348 | 357 | sgid_tbl->vlan[free_idx] = 1; |
|---|
| 349 | 358 | |
|---|
| 350 | 359 | dev_dbg(&res->pdev->dev, |
|---|
| 351 | | - "QPLIB: SGID added hw_id[0x%x] = 0x%x active = 0x%x", |
|---|
| 360 | + "SGID added hw_id[0x%x] = 0x%x active = 0x%x\n", |
|---|
| 352 | 361 | free_idx, sgid_tbl->hw_id[free_idx], sgid_tbl->active); |
|---|
| 353 | 362 | |
|---|
| 354 | 363 | *index = free_idx; |
|---|
| .. | .. |
|---|
| 404 | 413 | } |
|---|
| 405 | 414 | if (index >= pkey_tbl->max) { |
|---|
| 406 | 415 | dev_err(&res->pdev->dev, |
|---|
| 407 | | - "QPLIB: Index %d exceeded PKEY table max (%d)", |
|---|
| 416 | + "Index %d exceeded PKEY table max (%d)\n", |
|---|
| 408 | 417 | index, pkey_tbl->max); |
|---|
| 409 | 418 | return -EINVAL; |
|---|
| 410 | 419 | } |
|---|
| .. | .. |
|---|
| 419 | 428 | int i, rc = 0; |
|---|
| 420 | 429 | |
|---|
| 421 | 430 | if (!pkey_tbl) { |
|---|
| 422 | | - dev_err(&res->pdev->dev, "QPLIB: PKEY table not allocated"); |
|---|
| 431 | + dev_err(&res->pdev->dev, "PKEY table not allocated\n"); |
|---|
| 423 | 432 | return -EINVAL; |
|---|
| 424 | 433 | } |
|---|
| 425 | 434 | |
|---|
| 426 | 435 | /* Do we need a pkey_lock here? */ |
|---|
| 427 | 436 | if (!pkey_tbl->active) { |
|---|
| 428 | | - dev_err(&res->pdev->dev, |
|---|
| 429 | | - "QPLIB: PKEY table has no active entries"); |
|---|
| 437 | + dev_err(&res->pdev->dev, "PKEY table has no active entries\n"); |
|---|
| 430 | 438 | return -ENOMEM; |
|---|
| 431 | 439 | } |
|---|
| 432 | 440 | for (i = 0; i < pkey_tbl->max; i++) { |
|---|
| .. | .. |
|---|
| 435 | 443 | } |
|---|
| 436 | 444 | if (i == pkey_tbl->max) { |
|---|
| 437 | 445 | dev_err(&res->pdev->dev, |
|---|
| 438 | | - "QPLIB: PKEY 0x%04x not found in the pkey table", |
|---|
| 439 | | - *pkey); |
|---|
| 446 | + "PKEY 0x%04x not found in the pkey table\n", *pkey); |
|---|
| 440 | 447 | return -ENOMEM; |
|---|
| 441 | 448 | } |
|---|
| 442 | 449 | memset(&pkey_tbl->tbl[i], 0, sizeof(*pkey)); |
|---|
| .. | .. |
|---|
| 453 | 460 | int i, free_idx, rc = 0; |
|---|
| 454 | 461 | |
|---|
| 455 | 462 | if (!pkey_tbl) { |
|---|
| 456 | | - dev_err(&res->pdev->dev, "QPLIB: PKEY table not allocated"); |
|---|
| 463 | + dev_err(&res->pdev->dev, "PKEY table not allocated\n"); |
|---|
| 457 | 464 | return -EINVAL; |
|---|
| 458 | 465 | } |
|---|
| 459 | 466 | |
|---|
| 460 | 467 | /* Do we need a pkey_lock here? */ |
|---|
| 461 | 468 | if (pkey_tbl->active == pkey_tbl->max) { |
|---|
| 462 | | - dev_err(&res->pdev->dev, "QPLIB: PKEY table is full"); |
|---|
| 469 | + dev_err(&res->pdev->dev, "PKEY table is full\n"); |
|---|
| 463 | 470 | return -ENOMEM; |
|---|
| 464 | 471 | } |
|---|
| 465 | 472 | free_idx = pkey_tbl->max; |
|---|
| .. | .. |
|---|
| 471 | 478 | } |
|---|
| 472 | 479 | if (free_idx == pkey_tbl->max) { |
|---|
| 473 | 480 | dev_err(&res->pdev->dev, |
|---|
| 474 | | - "QPLIB: PKEY table is FULL but count is not MAX??"); |
|---|
| 481 | + "PKEY table is FULL but count is not MAX??\n"); |
|---|
| 475 | 482 | return -ENOMEM; |
|---|
| 476 | 483 | } |
|---|
| 477 | 484 | /* Add PKEY to the pkey_tbl */ |
|---|
| .. | .. |
|---|
| 483 | 490 | } |
|---|
| 484 | 491 | |
|---|
| 485 | 492 | /* AH */ |
|---|
| 486 | | -int bnxt_qplib_create_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah) |
|---|
| 493 | +int bnxt_qplib_create_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah, |
|---|
| 494 | + bool block) |
|---|
| 487 | 495 | { |
|---|
| 488 | 496 | struct bnxt_qplib_rcfw *rcfw = res->rcfw; |
|---|
| 489 | 497 | struct cmdq_create_ah req; |
|---|
| .. | .. |
|---|
| 517 | 525 | req.dest_mac[2] = cpu_to_le16(temp16[2]); |
|---|
| 518 | 526 | |
|---|
| 519 | 527 | rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, (void *)&resp, |
|---|
| 520 | | - NULL, 1); |
|---|
| 528 | + NULL, block); |
|---|
| 521 | 529 | if (rc) |
|---|
| 522 | 530 | return rc; |
|---|
| 523 | 531 | |
|---|
| .. | .. |
|---|
| 525 | 533 | return 0; |
|---|
| 526 | 534 | } |
|---|
| 527 | 535 | |
|---|
| 528 | | -int bnxt_qplib_destroy_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah) |
|---|
| 536 | +void bnxt_qplib_destroy_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah, |
|---|
| 537 | + bool block) |
|---|
| 529 | 538 | { |
|---|
| 530 | 539 | struct bnxt_qplib_rcfw *rcfw = res->rcfw; |
|---|
| 531 | 540 | struct cmdq_destroy_ah req; |
|---|
| 532 | 541 | struct creq_destroy_ah_resp resp; |
|---|
| 533 | 542 | u16 cmd_flags = 0; |
|---|
| 534 | | - int rc; |
|---|
| 535 | 543 | |
|---|
| 536 | 544 | /* Clean up the AH table in the device */ |
|---|
| 537 | 545 | RCFW_CMD_PREP(req, DESTROY_AH, cmd_flags); |
|---|
| 538 | 546 | |
|---|
| 539 | 547 | req.ah_cid = cpu_to_le32(ah->id); |
|---|
| 540 | 548 | |
|---|
| 541 | | - rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, (void *)&resp, |
|---|
| 542 | | - NULL, 1); |
|---|
| 543 | | - if (rc) |
|---|
| 544 | | - return rc; |
|---|
| 545 | | - return 0; |
|---|
| 549 | + bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, (void *)&resp, NULL, |
|---|
| 550 | + block); |
|---|
| 546 | 551 | } |
|---|
| 547 | 552 | |
|---|
| 548 | 553 | /* MRW */ |
|---|
| .. | .. |
|---|
| 555 | 560 | int rc; |
|---|
| 556 | 561 | |
|---|
| 557 | 562 | if (mrw->lkey == 0xFFFFFFFF) { |
|---|
| 558 | | - dev_info(&res->pdev->dev, |
|---|
| 559 | | - "QPLIB: SP: Free a reserved lkey MRW"); |
|---|
| 563 | + dev_info(&res->pdev->dev, "SP: Free a reserved lkey MRW\n"); |
|---|
| 560 | 564 | return 0; |
|---|
| 561 | 565 | } |
|---|
| 562 | 566 | |
|---|
| .. | .. |
|---|
| 578 | 582 | |
|---|
| 579 | 583 | /* Free the qplib's MRW memory */ |
|---|
| 580 | 584 | if (mrw->hwq.max_elements) |
|---|
| 581 | | - bnxt_qplib_free_hwq(res->pdev, &mrw->hwq); |
|---|
| 585 | + bnxt_qplib_free_hwq(res, &mrw->hwq); |
|---|
| 582 | 586 | |
|---|
| 583 | 587 | return 0; |
|---|
| 584 | 588 | } |
|---|
| .. | .. |
|---|
| 639 | 643 | if (mrw->hwq.max_elements) { |
|---|
| 640 | 644 | mrw->va = 0; |
|---|
| 641 | 645 | mrw->total_size = 0; |
|---|
| 642 | | - bnxt_qplib_free_hwq(res->pdev, &mrw->hwq); |
|---|
| 646 | + bnxt_qplib_free_hwq(res, &mrw->hwq); |
|---|
| 643 | 647 | } |
|---|
| 644 | 648 | |
|---|
| 645 | 649 | return 0; |
|---|
| 646 | 650 | } |
|---|
| 647 | 651 | |
|---|
| 648 | 652 | int bnxt_qplib_reg_mr(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mr, |
|---|
| 649 | | - u64 *pbl_tbl, int num_pbls, bool block, u32 buf_pg_size) |
|---|
| 653 | + struct ib_umem *umem, int num_pbls, u32 buf_pg_size) |
|---|
| 650 | 654 | { |
|---|
| 651 | 655 | struct bnxt_qplib_rcfw *rcfw = res->rcfw; |
|---|
| 652 | | - struct cmdq_register_mr req; |
|---|
| 656 | + struct bnxt_qplib_hwq_attr hwq_attr = {}; |
|---|
| 657 | + struct bnxt_qplib_sg_info sginfo = {}; |
|---|
| 653 | 658 | struct creq_register_mr_resp resp; |
|---|
| 659 | + struct cmdq_register_mr req; |
|---|
| 654 | 660 | u16 cmd_flags = 0, level; |
|---|
| 655 | | - int pg_ptrs, pages, i, rc; |
|---|
| 656 | | - dma_addr_t **pbl_ptr; |
|---|
| 661 | + int pages, rc, pg_ptrs; |
|---|
| 657 | 662 | u32 pg_size; |
|---|
| 658 | 663 | |
|---|
| 659 | 664 | if (num_pbls) { |
|---|
| .. | .. |
|---|
| 666 | 671 | pages++; |
|---|
| 667 | 672 | |
|---|
| 668 | 673 | if (pages > MAX_PBL_LVL_1_PGS) { |
|---|
| 669 | | - dev_err(&res->pdev->dev, "QPLIB: SP: Reg MR pages "); |
|---|
| 670 | 674 | dev_err(&res->pdev->dev, |
|---|
| 671 | | - "requested (0x%x) exceeded max (0x%x)", |
|---|
| 675 | + "SP: Reg MR: pages requested (0x%x) exceeded max (0x%x)\n", |
|---|
| 672 | 676 | pages, MAX_PBL_LVL_1_PGS); |
|---|
| 673 | 677 | return -ENOMEM; |
|---|
| 674 | 678 | } |
|---|
| 675 | 679 | /* Free the hwq if it already exist, must be a rereg */ |
|---|
| 676 | 680 | if (mr->hwq.max_elements) |
|---|
| 677 | | - bnxt_qplib_free_hwq(res->pdev, &mr->hwq); |
|---|
| 678 | | - |
|---|
| 679 | | - mr->hwq.max_elements = pages; |
|---|
| 680 | | - /* Use system PAGE_SIZE */ |
|---|
| 681 | | - rc = bnxt_qplib_alloc_init_hwq(res->pdev, &mr->hwq, NULL, 0, |
|---|
| 682 | | - &mr->hwq.max_elements, |
|---|
| 683 | | - PAGE_SIZE, 0, PAGE_SIZE, |
|---|
| 684 | | - HWQ_TYPE_CTX); |
|---|
| 681 | + bnxt_qplib_free_hwq(res, &mr->hwq); |
|---|
| 682 | + hwq_attr.res = res; |
|---|
| 683 | + hwq_attr.depth = pages; |
|---|
| 684 | + hwq_attr.stride = sizeof(dma_addr_t); |
|---|
| 685 | + hwq_attr.type = HWQ_TYPE_MR; |
|---|
| 686 | + hwq_attr.sginfo = &sginfo; |
|---|
| 687 | + hwq_attr.sginfo->umem = umem; |
|---|
| 688 | + hwq_attr.sginfo->npages = pages; |
|---|
| 689 | + hwq_attr.sginfo->pgsize = buf_pg_size; |
|---|
| 690 | + hwq_attr.sginfo->pgshft = ilog2(buf_pg_size); |
|---|
| 691 | + rc = bnxt_qplib_alloc_init_hwq(&mr->hwq, &hwq_attr); |
|---|
| 685 | 692 | if (rc) { |
|---|
| 686 | 693 | dev_err(&res->pdev->dev, |
|---|
| 687 | | - "SP: Reg MR memory allocation failed"); |
|---|
| 694 | + "SP: Reg MR memory allocation failed\n"); |
|---|
| 688 | 695 | return -ENOMEM; |
|---|
| 689 | 696 | } |
|---|
| 690 | | - /* Write to the hwq */ |
|---|
| 691 | | - pbl_ptr = (dma_addr_t **)mr->hwq.pbl_ptr; |
|---|
| 692 | | - for (i = 0; i < num_pbls; i++) |
|---|
| 693 | | - pbl_ptr[PTR_PG(i)][PTR_IDX(i)] = |
|---|
| 694 | | - (pbl_tbl[i] & PAGE_MASK) | PTU_PTE_VALID; |
|---|
| 695 | 697 | } |
|---|
| 696 | 698 | |
|---|
| 697 | 699 | RCFW_CMD_PREP(req, REGISTER_MR, cmd_flags); |
|---|
| .. | .. |
|---|
| 703 | 705 | req.pbl = 0; |
|---|
| 704 | 706 | pg_size = PAGE_SIZE; |
|---|
| 705 | 707 | } else { |
|---|
| 706 | | - level = mr->hwq.level + 1; |
|---|
| 708 | + level = mr->hwq.level; |
|---|
| 707 | 709 | req.pbl = cpu_to_le64(mr->hwq.pbl[PBL_LVL_0].pg_map_arr[0]); |
|---|
| 708 | 710 | } |
|---|
| 709 | 711 | pg_size = buf_pg_size ? buf_pg_size : PAGE_SIZE; |
|---|
| .. | .. |
|---|
| 720 | 722 | req.mr_size = cpu_to_le64(mr->total_size); |
|---|
| 721 | 723 | |
|---|
| 722 | 724 | rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, |
|---|
| 723 | | - (void *)&resp, NULL, block); |
|---|
| 725 | + (void *)&resp, NULL, false); |
|---|
| 724 | 726 | if (rc) |
|---|
| 725 | 727 | goto fail; |
|---|
| 726 | 728 | |
|---|
| .. | .. |
|---|
| 728 | 730 | |
|---|
| 729 | 731 | fail: |
|---|
| 730 | 732 | if (mr->hwq.max_elements) |
|---|
| 731 | | - bnxt_qplib_free_hwq(res->pdev, &mr->hwq); |
|---|
| 733 | + bnxt_qplib_free_hwq(res, &mr->hwq); |
|---|
| 732 | 734 | return rc; |
|---|
| 733 | 735 | } |
|---|
| 734 | 736 | |
|---|
| .. | .. |
|---|
| 736 | 738 | struct bnxt_qplib_frpl *frpl, |
|---|
| 737 | 739 | int max_pg_ptrs) |
|---|
| 738 | 740 | { |
|---|
| 741 | + struct bnxt_qplib_hwq_attr hwq_attr = {}; |
|---|
| 742 | + struct bnxt_qplib_sg_info sginfo = {}; |
|---|
| 739 | 743 | int pg_ptrs, pages, rc; |
|---|
| 740 | 744 | |
|---|
| 741 | 745 | /* Re-calculate the max to fit the HWQ allocation model */ |
|---|
| .. | .. |
|---|
| 747 | 751 | if (pages > MAX_PBL_LVL_1_PGS) |
|---|
| 748 | 752 | return -ENOMEM; |
|---|
| 749 | 753 | |
|---|
| 750 | | - frpl->hwq.max_elements = pages; |
|---|
| 751 | | - rc = bnxt_qplib_alloc_init_hwq(res->pdev, &frpl->hwq, NULL, 0, |
|---|
| 752 | | - &frpl->hwq.max_elements, PAGE_SIZE, 0, |
|---|
| 753 | | - PAGE_SIZE, HWQ_TYPE_CTX); |
|---|
| 754 | + sginfo.pgsize = PAGE_SIZE; |
|---|
| 755 | + sginfo.nopte = true; |
|---|
| 756 | + |
|---|
| 757 | + hwq_attr.res = res; |
|---|
| 758 | + hwq_attr.depth = pg_ptrs; |
|---|
| 759 | + hwq_attr.stride = PAGE_SIZE; |
|---|
| 760 | + hwq_attr.sginfo = &sginfo; |
|---|
| 761 | + hwq_attr.type = HWQ_TYPE_CTX; |
|---|
| 762 | + rc = bnxt_qplib_alloc_init_hwq(&frpl->hwq, &hwq_attr); |
|---|
| 754 | 763 | if (!rc) |
|---|
| 755 | 764 | frpl->max_pg_ptrs = pg_ptrs; |
|---|
| 756 | 765 | |
|---|
| .. | .. |
|---|
| 760 | 769 | int bnxt_qplib_free_fast_reg_page_list(struct bnxt_qplib_res *res, |
|---|
| 761 | 770 | struct bnxt_qplib_frpl *frpl) |
|---|
| 762 | 771 | { |
|---|
| 763 | | - bnxt_qplib_free_hwq(res->pdev, &frpl->hwq); |
|---|
| 772 | + bnxt_qplib_free_hwq(res, &frpl->hwq); |
|---|
| 764 | 773 | return 0; |
|---|
| 765 | 774 | } |
|---|
| 766 | 775 | |
|---|
| .. | .. |
|---|
| 794 | 803 | sbuf = bnxt_qplib_rcfw_alloc_sbuf(rcfw, sizeof(*sb)); |
|---|
| 795 | 804 | if (!sbuf) { |
|---|
| 796 | 805 | dev_err(&rcfw->pdev->dev, |
|---|
| 797 | | - "QPLIB: SP: QUERY_ROCE_STATS alloc side buffer failed"); |
|---|
| 806 | + "SP: QUERY_ROCE_STATS alloc side buffer failed\n"); |
|---|
| 798 | 807 | return -ENOMEM; |
|---|
| 799 | 808 | } |
|---|
| 800 | 809 | |
|---|
| .. | .. |
|---|
| 844 | 853 | stats->res_srq_load_err = le64_to_cpu(sb->res_srq_load_err); |
|---|
| 845 | 854 | stats->res_tx_pci_err = le64_to_cpu(sb->res_tx_pci_err); |
|---|
| 846 | 855 | stats->res_rx_pci_err = le64_to_cpu(sb->res_rx_pci_err); |
|---|
| 856 | + if (!rcfw->init_oos_stats) { |
|---|
| 857 | + rcfw->oos_prev = le64_to_cpu(sb->res_oos_drop_count); |
|---|
| 858 | + rcfw->init_oos_stats = 1; |
|---|
| 859 | + } else { |
|---|
| 860 | + stats->res_oos_drop_count += |
|---|
| 861 | + (le64_to_cpu(sb->res_oos_drop_count) - |
|---|
| 862 | + rcfw->oos_prev) & BNXT_QPLIB_OOS_COUNT_MASK; |
|---|
| 863 | + rcfw->oos_prev = le64_to_cpu(sb->res_oos_drop_count); |
|---|
| 864 | + } |
|---|
| 865 | + |
|---|
| 847 | 866 | bail: |
|---|
| 848 | 867 | bnxt_qplib_rcfw_free_sbuf(rcfw, sbuf); |
|---|
| 849 | 868 | return rc; |
|---|