Skip to contentSkip to conversation

ibmvnic: drop bad optimization in reuse_rx_pools()

PATCH Applied Sukadev Bhattiprolu 4 participants 7 messages Dec 1, 2021 – Dec 2, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ibmvnic: drop bad optimization in reuse_rx_pools()

When trying to decide whether or not reuse existing rx/tx pools we tried to allow a range of values for the pool parameters rather than exact matches. This was intended to reuse the resources for instance when switching between two VIO servers with different default parameters.

But this optimization is incomplete and breaks when we try to change the number of queues for instance. The optimization needs to be updated, so drop it for now and simplify the code.

Fixes 489de956e7a2 ("ibmvnic: Reuse rx pools when possible")
---
 drivers/net/ethernet/ibm/ibmvnic.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/net/ethernet/ibm/ibmvnic.c +3 -11
index 3cca51735421..6df92a872f0f 100644
@@ -628,17 +628,9 @@ static bool reuse_rx_pools(struct ibmvnic_adapter *adapter)
 	old_buff_size = adapter->prev_rx_buf_sz;
 	new_buff_size = adapter->cur_rx_buf_sz;
 
-	/* Require buff size to be exactly same for now */
-	if (old_buff_size != new_buff_size)
-		return false;
-
-	if (old_num_pools == new_num_pools && old_pool_size == new_pool_size)
-		return true;
-
-	if (old_num_pools < adapter->min_rx_queues ||
-	    old_num_pools > adapter->max_rx_queues ||
-	    old_pool_size < adapter->min_rx_add_entries_per_subcrq ||
-	    old_pool_size > adapter->max_rx_add_entries_per_subcrq)
+	if (old_buff_size != new_buff_size ||
+	    old_num_pools != new_num_pools ||
+	    old_pool_size != new_pool_size)
 		return false;
 
 	return true;
Signature · 1 line
2.27.0
#1 lore raw

PATCH 2/2 ibmvnic: drop bad optimization in reuse_tx_pools()

When trying to decide whether or not reuse existing rx/tx pools we tried to allow a range of values for the pool parameters rather than exact matches. This was intended to reuse the resources for instance when switching between two VIO servers with different default parameters.

But this optimization is incomplete and breaks when we try to change the number of queues for instance. The optimization needs to be updated, so drop it for now and simplify the code.

Fixes bbd809305bc7 ("ibmvnic: Reuse tx pools when possible")
---
 drivers/net/ethernet/ibm/ibmvnic.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/net/ethernet/ibm/ibmvnic.c +3 -11
index 6df92a872f0f..0bb3911dd014 100644
@@ -866,17 +866,9 @@ static bool reuse_tx_pools(struct ibmvnic_adapter *adapter)
 	old_mtu = adapter->prev_mtu;
 	new_mtu = adapter->req_mtu;
 
-	/* Require MTU to be exactly same to reuse pools for now */
-	if (old_mtu != new_mtu)
-		return false;
-
-	if (old_num_pools == new_num_pools && old_pool_size == new_pool_size)
-		return true;
-
-	if (old_num_pools < adapter->min_tx_queues ||
-	    old_num_pools > adapter->max_tx_queues ||
-	    old_pool_size < adapter->min_tx_entries_per_subcrq ||
-	    old_pool_size > adapter->max_tx_entries_per_subcrq)
+	if (old_mtu != new_mtu ||
+	    old_num_pools != new_num_pools ||
+	    old_pool_size != new_pool_size)
 		return false;
 
 	return true;
Signature · 1 line
2.27.0
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH net 2/2] ibmvnic: drop bad optimization in reuse_tx_pools()

Quoted 6 lines · Sukadev Bhattiprolu

When trying to decide whether or not reuse existing rx/tx pools we tried to allow a range of values for the pool parameters rather than exact matches. This was intended to reuse the resources for instance when switching between two VIO servers with different default parameters.

Quoted 7 lines

But this optimization is incomplete and breaks when we try to change the number of queues for instance. The optimization needs to be updated, so drop it for now and simplify the code.

Fixes bbd809305bc7 ("ibmvnic: Reuse tx pools when possible")
Quoted 31 lines
---
 drivers/net/ethernet/ibm/ibmvnic.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/net/ethernet/ibm/ibmvnic.c +3 -11
index 6df92a872f0f..0bb3911dd014 100644
@@ -866,17 +866,9 @@ static bool reuse_tx_pools(struct ibmvnic_adapter 
 *adapter)
 	old_mtu = adapter->prev_mtu;
 	new_mtu = adapter->req_mtu;
 
-	/* Require MTU to be exactly same to reuse pools for now */
-	if (old_mtu != new_mtu)
-		return false;
-
-	if (old_num_pools == new_num_pools && old_pool_size == new_pool_size)
-		return true;
-
-	if (old_num_pools < adapter->min_tx_queues ||
-	    old_num_pools > adapter->max_tx_queues ||
-	    old_pool_size < adapter->min_tx_entries_per_subcrq ||
-	    old_pool_size > adapter->max_tx_entries_per_subcrq)
+	if (old_mtu != new_mtu ||
+	    old_num_pools != new_num_pools ||
+	    old_pool_size != new_pool_size)
 		return false;
 

return true;

Reviewed-by on v1 2/2
#3 lore raw

Re: [PATCH net 2/2] ibmvnic: drop bad optimization in reuse_tx_pools()

In reply to Sukadev Bhattiprolu
Quoted 6 lines · Sukadev Bhattiprolu

When trying to decide whether or not reuse existing rx/tx pools we tried to allow a range of values for the pool parameters rather than exact matches. This was intended to reuse the resources for instance when switching between two VIO servers with different default parameters.

Quoted 7 lines

But this optimization is incomplete and breaks when we try to change the number of queues for instance. The optimization needs to be updated, so drop it for now and simplify the code.

Fixes bbd809305bc7 ("ibmvnic: Reuse tx pools when possible")
Quoted 30 lines
---
  drivers/net/ethernet/ibm/ibmvnic.c | 14 +++-----------
  1 file changed, 3 insertions(+), 11 deletions(-)
drivers/net/ethernet/ibm/ibmvnic.c +3 -11
index 6df92a872f0f..0bb3911dd014 100644
@@ -866,17 +866,9 @@ static bool reuse_tx_pools(struct ibmvnic_adapter *adapter)
  	old_mtu = adapter->prev_mtu;
  	new_mtu = adapter->req_mtu;
 
-	/* Require MTU to be exactly same to reuse pools for now */
-	if (old_mtu != new_mtu)
-		return false;
-
-	if (old_num_pools == new_num_pools && old_pool_size == new_pool_size)
-		return true;
-
-	if (old_num_pools < adapter->min_tx_queues ||
-	    old_num_pools > adapter->max_tx_queues ||
-	    old_pool_size < adapter->min_tx_entries_per_subcrq ||
-	    old_pool_size > adapter->max_tx_entries_per_subcrq)
+	if (old_mtu != new_mtu ||
+	    old_num_pools != new_num_pools ||
+	    old_pool_size != new_pool_size)
  		return false;
 
  	return true;
Reviewed-by on v1 1/2
#4 lore raw
In reply to Sukadev Bhattiprolu
Quoted 6 lines · Sukadev Bhattiprolu

When trying to decide whether or not reuse existing rx/tx pools we tried to allow a range of values for the pool parameters rather than exact matches. This was intended to reuse the resources for instance when switching between two VIO servers with different default parameters.

Quoted 7 lines

But this optimization is incomplete and breaks when we try to change the number of queues for instance. The optimization needs to be updated, so drop it for now and simplify the code.

Fixes 489de956e7a2 ("ibmvnic: Reuse rx pools when possible")
Quoted 31 lines
---
 drivers/net/ethernet/ibm/ibmvnic.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/net/ethernet/ibm/ibmvnic.c +3 -11
index 3cca51735421..6df92a872f0f 100644
@@ -628,17 +628,9 @@ static bool reuse_rx_pools(struct ibmvnic_adapter 
 *adapter)
 	old_buff_size = adapter->prev_rx_buf_sz;
 	new_buff_size = adapter->cur_rx_buf_sz;
 
-	/* Require buff size to be exactly same for now */
-	if (old_buff_size != new_buff_size)
-		return false;
-
-	if (old_num_pools == new_num_pools && old_pool_size == new_pool_size)
-		return true;
-
-	if (old_num_pools < adapter->min_rx_queues ||
-	    old_num_pools > adapter->max_rx_queues ||
-	    old_pool_size < adapter->min_rx_add_entries_per_subcrq ||
-	    old_pool_size > adapter->max_rx_add_entries_per_subcrq)
+	if (old_buff_size != new_buff_size ||
+	    old_num_pools != new_num_pools ||
+	    old_pool_size != new_pool_size)
 		return false;
 

return true;

Reviewed-by on v1 1/2
#5 lore raw
In reply to Sukadev Bhattiprolu
Quoted 6 lines · Sukadev Bhattiprolu

When trying to decide whether or not reuse existing rx/tx pools we tried to allow a range of values for the pool parameters rather than exact matches. This was intended to reuse the resources for instance when switching between two VIO servers with different default parameters.

Quoted 7 lines

But this optimization is incomplete and breaks when we try to change the number of queues for instance. The optimization needs to be updated, so drop it for now and simplify the code.

Fixes 489de956e7a2 ("ibmvnic: Reuse rx pools when possible")
Quoted 30 lines
---
  drivers/net/ethernet/ibm/ibmvnic.c | 14 +++-----------
  1 file changed, 3 insertions(+), 11 deletions(-)
drivers/net/ethernet/ibm/ibmvnic.c +3 -11
index 3cca51735421..6df92a872f0f 100644
@@ -628,17 +628,9 @@ static bool reuse_rx_pools(struct ibmvnic_adapter *adapter)
  	old_buff_size = adapter->prev_rx_buf_sz;
  	new_buff_size = adapter->cur_rx_buf_sz;
 
-	/* Require buff size to be exactly same for now */
-	if (old_buff_size != new_buff_size)
-		return false;
-
-	if (old_num_pools == new_num_pools && old_pool_size == new_pool_size)
-		return true;
-
-	if (old_num_pools < adapter->min_rx_queues ||
-	    old_num_pools > adapter->max_rx_queues ||
-	    old_pool_size < adapter->min_rx_add_entries_per_subcrq ||
-	    old_pool_size > adapter->max_rx_add_entries_per_subcrq)
+	if (old_buff_size != new_buff_size ||
+	    old_num_pools != new_num_pools ||
+	    old_pool_size != new_pool_size)
  		return false;
 
  	return true;
#6 lore raw
In reply to Sukadev Bhattiprolu
This series was applied to netdev/net.git (master) by David S. Miller <[email protected]>:

Hello:

This series was applied to netdev/net.git (master) by David S. Miller <[email protected]>:

Quoted 11 lines · On Tue, 30 Nov 2021 21:48:35 -0800 you wrote:

When trying to decide whether or not reuse existing rx/tx pools we tried to allow a range of values for the pool parameters rather than exact matches. This was intended to reuse the resources for instance when switching between two VIO servers with different default parameters.

But this optimization is incomplete and breaks when we try to change the number of queues for instance. The optimization needs to be updated, so drop it for now and simplify the code.

[...]

Here is the summary with links:
- [net,1/2] ibmvnic: drop bad optimization in reuse_rx_pools()

    https://git.kernel.org/netdev/net/c/0584f4949609
  - [net,2/2] ibmvnic: drop bad optimization in reuse_tx_pools()
    https://git.kernel.org/netdev/net/c/5b08560181b5

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html