Commit 51b53712 authored by Sukadev Bhattiprolu's avatar Sukadev Bhattiprolu Committed by Michael Ellerman

powerpc/vas: Validate window credits

NX-842, the only user of VAS, sets the window credits to default values
but VAS should check the credits against the possible max values.

The VAS_WCREDS_MIN is not needed and can be dropped.
Signed-off-by: default avatarSukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent e34917fb
...@@ -738,6 +738,9 @@ static bool rx_win_args_valid(enum vas_cop_type cop, ...@@ -738,6 +738,9 @@ static bool rx_win_args_valid(enum vas_cop_type cop,
if (attr->rx_fifo_size > VAS_RX_FIFO_SIZE_MAX) if (attr->rx_fifo_size > VAS_RX_FIFO_SIZE_MAX)
return false; return false;
if (attr->wcreds_max > VAS_RX_WCREDS_MAX)
return false;
if (attr->nx_win) { if (attr->nx_win) {
/* cannot be fault or user window if it is nx */ /* cannot be fault or user window if it is nx */
if (attr->fault_win || attr->user_win) if (attr->fault_win || attr->user_win)
...@@ -927,6 +930,9 @@ static bool tx_win_args_valid(enum vas_cop_type cop, ...@@ -927,6 +930,9 @@ static bool tx_win_args_valid(enum vas_cop_type cop,
if (cop > VAS_COP_TYPE_MAX) if (cop > VAS_COP_TYPE_MAX)
return false; return false;
if (attr->wcreds_max > VAS_TX_WCREDS_MAX)
return false;
if (attr->user_win && if (attr->user_win &&
(cop != VAS_COP_TYPE_FTW || attr->rsvd_txbuf_count)) (cop != VAS_COP_TYPE_FTW || attr->rsvd_txbuf_count))
return false; return false;
......
...@@ -106,8 +106,8 @@ ...@@ -106,8 +106,8 @@
* *
* TODO: Needs tuning for per-process credits * TODO: Needs tuning for per-process credits
*/ */
#define VAS_WCREDS_MIN 16 #define VAS_RX_WCREDS_MAX ((64 << 10) - 1)
#define VAS_WCREDS_MAX ((64 << 10) - 1) #define VAS_TX_WCREDS_MAX ((4 << 10) - 1)
#define VAS_WCREDS_DEFAULT (1 << 10) #define VAS_WCREDS_DEFAULT (1 << 10)
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment