diff mbox series

[net-next] ibmvnic: fix rx buffer tracking and index management in replenish_rx_pool partial success

Message ID 20201210015331.44966-1-drt@linux.ibm.com (mailing list archive)
State Accepted
Delegated to: Netdev Maintainers
Headers show
Series [net-next] ibmvnic: fix rx buffer tracking and index management in replenish_rx_pool partial success | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 19 this patch: 19
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Dany Madden Dec. 10, 2020, 1:53 a.m. UTC
From: "Dwip N. Banerjee" <dnbanerg@us.ibm.com>

We observed that in the error case for batched send_subcrq_indirect() the
driver does not account for the partial success case. This caused Linux to
crash when free_map and pool index are inconsistent.

Driver needs to update the rx pools "available" count when some batched
sends worked but an error was encountered as part of the whole operation.
Also track replenish_add_buff_failure for statistic purposes.

Fixes: 4f0b6812e9b9a ("ibmvnic: Introduce batched RX buffer descriptor transmission")
Signed-off-by: Dwip N. Banerjee <dnbanerg@us.ibm.com>
Reviewed-by: Dany Madden <drt@linux.ibm.com>
---
 drivers/net/ethernet/ibm/ibmvnic.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

David Miller Dec. 10, 2020, 3:07 a.m. UTC | #1
From: Dany Madden <drt@linux.ibm.com>
Date: Wed,  9 Dec 2020 20:53:31 -0500

> From: "Dwip N. Banerjee" <dnbanerg@us.ibm.com>
> 
> We observed that in the error case for batched send_subcrq_indirect() the
> driver does not account for the partial success case. This caused Linux to
> crash when free_map and pool index are inconsistent.
> 
> Driver needs to update the rx pools "available" count when some batched
> sends worked but an error was encountered as part of the whole operation.
> Also track replenish_add_buff_failure for statistic purposes.
> 
> Fixes: 4f0b6812e9b9a ("ibmvnic: Introduce batched RX buffer descriptor transmission")
> Signed-off-by: Dwip N. Banerjee <dnbanerg@us.ibm.com>
> Reviewed-by: Dany Madden <drt@linux.ibm.com>

Applied, thanks.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index cb701a6c0712..a2191392ca4f 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -398,6 +398,8 @@  static void replenish_rx_pool(struct ibmvnic_adapter *adapter,
 		dev_kfree_skb_any(pool->rx_buff[index].skb);
 		pool->rx_buff[index].skb = NULL;
 	}
+	adapter->replenish_add_buff_failure += ind_bufp->index;
+	atomic_add(buffers_added, &pool->available);
 	ind_bufp->index = 0;
 	if (lpar_rc == H_CLOSED || adapter->failover_pending) {
 		/* Disable buffer pool replenishment and report carrier off if