diff options
author | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2015-04-03 16:27:14 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2015-04-14 18:56:35 -0400 |
commit | da61b36706f06a95bedeef0168db5b40a2940f8a (patch) | |
tree | 51771f5f1ec2b2aa50fe93df6959d2b6d28a1371 | |
parent | 78288e3750c568f0f95db235a06475db3b1a122a (diff) |
fm10k: mbx_update_max_size does not drop all oversized messages
When we call update_max_size it does not drop all oversized messages.
This is due to the difficulty in performing this operation, since it is
a FIFO which makes updating anything other than head or tail very
difficult. To fix this, modify validate_msg_size to ensure that we error
out later when trying to transmit the message that could be oversized.
This will generally be a rare condition, as it requires the FIFO to
include a message larger than the max_size negotiated during mailbox
connect. Note that max_size is always smaller than rx.size so it should
be safe to use here.
Also, update the update_max_size function header comment to clearly
indicate that it does not drop all oversized messages, but only those at
the head of the FIFO.
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Acked-by: Matthew Vick <matthew.vick@intel.com>
Tested-by: Krishneil Singh <krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r-- | drivers/net/ethernet/intel/fm10k/fm10k_mbx.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c b/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c index 27f82791e39a..1b2738380518 100644 --- a/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c +++ b/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c | |||
@@ -327,7 +327,7 @@ static u16 fm10k_mbx_validate_msg_size(struct fm10k_mbx_info *mbx, u16 len) | |||
327 | } while (total_len < len); | 327 | } while (total_len < len); |
328 | 328 | ||
329 | /* message extends out of pushed section, but fits in FIFO */ | 329 | /* message extends out of pushed section, but fits in FIFO */ |
330 | if ((len < total_len) && (msg_len <= mbx->rx.size)) | 330 | if ((len < total_len) && (msg_len <= mbx->max_size)) |
331 | return 0; | 331 | return 0; |
332 | 332 | ||
333 | /* return length of invalid section */ | 333 | /* return length of invalid section */ |
@@ -1063,8 +1063,11 @@ static void fm10k_mbx_reset_work(struct fm10k_mbx_info *mbx) | |||
1063 | * @mbx: pointer to mailbox | 1063 | * @mbx: pointer to mailbox |
1064 | * @size: new value for max_size | 1064 | * @size: new value for max_size |
1065 | * | 1065 | * |
1066 | * This function will update the max_size value and drop any outgoing messages | 1066 | * This function updates the max_size value and drops any outgoing messages |
1067 | * from the head of the Tx FIFO that are larger than max_size. | 1067 | * at the head of the Tx FIFO if they are larger than max_size. It does not |
1068 | * drop all messages, as this is too difficult to parse and remove them from | ||
1069 | * the FIFO. Instead, rely on the checking to ensure that messages larger | ||
1070 | * than max_size aren't pushed into the memory buffer. | ||
1068 | **/ | 1071 | **/ |
1069 | static void fm10k_mbx_update_max_size(struct fm10k_mbx_info *mbx, u16 size) | 1072 | static void fm10k_mbx_update_max_size(struct fm10k_mbx_info *mbx, u16 size) |
1070 | { | 1073 | { |