aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Falcon <tlfalcon@linux.vnet.ibm.com>2017-03-05 13:18:42 -0500
committerDavid S. Miller <davem@davemloft.net>2017-03-07 17:14:30 -0500
commit068d9f90a6978c3e3a662d9e85204a7d6be240d2 (patch)
tree55566d7f4bdef6420e737eef4bb8092013591ad1
parent142c0ac445792c492579cb01f1cfd4e32e6dfcce (diff)
ibmvnic: Allocate number of rx/tx buffers agreed on by firmware
The amount of TX/RX buffers that the vNIC driver currently allocates is different from the amount agreed upon in negotiation with firmware. Correct that by allocating the requested number of buffers confirmed by firmware. Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/ibm/ibmvnic.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 0e87b83f25e2..5f11b4dc95d2 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -404,7 +404,7 @@ static int ibmvnic_open(struct net_device *netdev)
404 send_map_query(adapter); 404 send_map_query(adapter);
405 for (i = 0; i < rxadd_subcrqs; i++) { 405 for (i = 0; i < rxadd_subcrqs; i++) {
406 init_rx_pool(adapter, &adapter->rx_pool[i], 406 init_rx_pool(adapter, &adapter->rx_pool[i],
407 IBMVNIC_BUFFS_PER_POOL, i, 407 adapter->req_rx_add_entries_per_subcrq, i,
408 be64_to_cpu(size_array[i]), 1); 408 be64_to_cpu(size_array[i]), 1);
409 if (alloc_rx_pool(adapter, &adapter->rx_pool[i])) { 409 if (alloc_rx_pool(adapter, &adapter->rx_pool[i])) {
410 dev_err(dev, "Couldn't alloc rx pool\n"); 410 dev_err(dev, "Couldn't alloc rx pool\n");
@@ -419,23 +419,23 @@ static int ibmvnic_open(struct net_device *netdev)
419 for (i = 0; i < tx_subcrqs; i++) { 419 for (i = 0; i < tx_subcrqs; i++) {
420 tx_pool = &adapter->tx_pool[i]; 420 tx_pool = &adapter->tx_pool[i];
421 tx_pool->tx_buff = 421 tx_pool->tx_buff =
422 kcalloc(adapter->max_tx_entries_per_subcrq, 422 kcalloc(adapter->req_tx_entries_per_subcrq,
423 sizeof(struct ibmvnic_tx_buff), GFP_KERNEL); 423 sizeof(struct ibmvnic_tx_buff), GFP_KERNEL);
424 if (!tx_pool->tx_buff) 424 if (!tx_pool->tx_buff)
425 goto tx_pool_alloc_failed; 425 goto tx_pool_alloc_failed;
426 426
427 if (alloc_long_term_buff(adapter, &tx_pool->long_term_buff, 427 if (alloc_long_term_buff(adapter, &tx_pool->long_term_buff,
428 adapter->max_tx_entries_per_subcrq * 428 adapter->req_tx_entries_per_subcrq *
429 adapter->req_mtu)) 429 adapter->req_mtu))
430 goto tx_ltb_alloc_failed; 430 goto tx_ltb_alloc_failed;
431 431
432 tx_pool->free_map = 432 tx_pool->free_map =
433 kcalloc(adapter->max_tx_entries_per_subcrq, 433 kcalloc(adapter->req_tx_entries_per_subcrq,
434 sizeof(int), GFP_KERNEL); 434 sizeof(int), GFP_KERNEL);
435 if (!tx_pool->free_map) 435 if (!tx_pool->free_map)
436 goto tx_fm_alloc_failed; 436 goto tx_fm_alloc_failed;
437 437
438 for (j = 0; j < adapter->max_tx_entries_per_subcrq; j++) 438 for (j = 0; j < adapter->req_tx_entries_per_subcrq; j++)
439 tx_pool->free_map[j] = j; 439 tx_pool->free_map[j] = j;
440 440
441 tx_pool->consumer_index = 0; 441 tx_pool->consumer_index = 0;
@@ -746,7 +746,7 @@ static int ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev)
746 746
747 tx_pool->consumer_index = 747 tx_pool->consumer_index =
748 (tx_pool->consumer_index + 1) % 748 (tx_pool->consumer_index + 1) %
749 adapter->max_tx_entries_per_subcrq; 749 adapter->req_tx_entries_per_subcrq;
750 750
751 tx_buff = &tx_pool->tx_buff[index]; 751 tx_buff = &tx_pool->tx_buff[index];
752 tx_buff->skb = skb; 752 tx_buff->skb = skb;
@@ -819,7 +819,7 @@ static int ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev)
819 819
820 if (tx_pool->consumer_index == 0) 820 if (tx_pool->consumer_index == 0)
821 tx_pool->consumer_index = 821 tx_pool->consumer_index =
822 adapter->max_tx_entries_per_subcrq - 1; 822 adapter->req_tx_entries_per_subcrq - 1;
823 else 823 else
824 tx_pool->consumer_index--; 824 tx_pool->consumer_index--;
825 825
@@ -1387,7 +1387,7 @@ restart_loop:
1387 producer_index] = index; 1387 producer_index] = index;
1388 adapter->tx_pool[pool].producer_index = 1388 adapter->tx_pool[pool].producer_index =
1389 (adapter->tx_pool[pool].producer_index + 1) % 1389 (adapter->tx_pool[pool].producer_index + 1) %
1390 adapter->max_tx_entries_per_subcrq; 1390 adapter->req_tx_entries_per_subcrq;
1391 } 1391 }
1392 /* remove tx_comp scrq*/ 1392 /* remove tx_comp scrq*/
1393 next->tx_comp.first = 0; 1393 next->tx_comp.first = 0;