| .. | .. |
|---|
| 1 | 1 | /* |
|---|
| 2 | | - * Copyright (c) 2012 - 2017 Intel Corporation. All rights reserved. |
|---|
| 2 | + * Copyright (c) 2012 - 2019 Intel Corporation. All rights reserved. |
|---|
| 3 | 3 | * Copyright (c) 2006 - 2012 QLogic Corporation. * All rights reserved. |
|---|
| 4 | 4 | * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. |
|---|
| 5 | 5 | * |
|---|
| .. | .. |
|---|
| 378 | 378 | * qib_check_send_wqe - validate wr/wqe |
|---|
| 379 | 379 | * @qp - The qp |
|---|
| 380 | 380 | * @wqe - The built wqe |
|---|
| 381 | + * @call_send - Determine if the send should be posted or scheduled |
|---|
| 381 | 382 | * |
|---|
| 382 | | - * validate wr/wqe. This is called |
|---|
| 383 | | - * prior to inserting the wqe into |
|---|
| 384 | | - * the ring but after the wqe has been |
|---|
| 385 | | - * setup. |
|---|
| 386 | | - * |
|---|
| 387 | | - * Returns 1 to force direct progress, 0 otherwise, -EINVAL on failure |
|---|
| 383 | + * Returns 0 on success, -EINVAL on failure |
|---|
| 388 | 384 | */ |
|---|
| 389 | 385 | int qib_check_send_wqe(struct rvt_qp *qp, |
|---|
| 390 | | - struct rvt_swqe *wqe) |
|---|
| 386 | + struct rvt_swqe *wqe, bool *call_send) |
|---|
| 391 | 387 | { |
|---|
| 392 | 388 | struct rvt_ah *ah; |
|---|
| 393 | | - int ret = 0; |
|---|
| 394 | 389 | |
|---|
| 395 | 390 | switch (qp->ibqp.qp_type) { |
|---|
| 396 | 391 | case IB_QPT_RC: |
|---|
| 397 | 392 | case IB_QPT_UC: |
|---|
| 398 | 393 | if (wqe->length > 0x80000000U) |
|---|
| 399 | 394 | return -EINVAL; |
|---|
| 395 | + if (wqe->length > qp->pmtu) |
|---|
| 396 | + *call_send = false; |
|---|
| 400 | 397 | break; |
|---|
| 401 | 398 | case IB_QPT_SMI: |
|---|
| 402 | 399 | case IB_QPT_GSI: |
|---|
| 403 | 400 | case IB_QPT_UD: |
|---|
| 404 | | - ah = ibah_to_rvtah(wqe->ud_wr.ah); |
|---|
| 401 | + ah = rvt_get_swqe_ah(wqe); |
|---|
| 405 | 402 | if (wqe->length > (1 << ah->log_pmtu)) |
|---|
| 406 | 403 | return -EINVAL; |
|---|
| 407 | 404 | /* progress hint */ |
|---|
| 408 | | - ret = 1; |
|---|
| 405 | + *call_send = true; |
|---|
| 409 | 406 | break; |
|---|
| 410 | 407 | default: |
|---|
| 411 | 408 | break; |
|---|
| 412 | 409 | } |
|---|
| 413 | | - return ret; |
|---|
| 410 | + return 0; |
|---|
| 414 | 411 | } |
|---|
| 415 | 412 | |
|---|
| 416 | 413 | #ifdef CONFIG_DEBUG_FS |
|---|