diff options
author | Thomas Falcon <tlfalcon@linux.vnet.ibm.com> | 2018-03-16 21:00:25 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-03-17 20:12:39 -0400 |
commit | e26dc25bc0b6f66b51d740af03962a30ee33ca7e (patch) | |
tree | dd0c0a640a9448a925c22664dd0b4a8fac73371e | |
parent | 4bd95a51b6e32c3267b8beb097bd719380147d36 (diff) |
ibmvnic: Update and clean up reset TX pool routine
Update TX pool reset routine to accommodate new TSO pool array. Introduce
a function that resets one TX pool, and use that function to initialize
each pool in both pool arrays.
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.c | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c index 9c7d19c926f9..4dc304422ece 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c | |||
@@ -557,36 +557,41 @@ static int init_rx_pools(struct net_device *netdev) | |||
557 | return 0; | 557 | return 0; |
558 | } | 558 | } |
559 | 559 | ||
560 | static int reset_one_tx_pool(struct ibmvnic_adapter *adapter, | ||
561 | struct ibmvnic_tx_pool *tx_pool) | ||
562 | { | ||
563 | int rc, i; | ||
564 | |||
565 | rc = reset_long_term_buff(adapter, &tx_pool->long_term_buff); | ||
566 | if (rc) | ||
567 | return rc; | ||
568 | |||
569 | memset(tx_pool->tx_buff, 0, | ||
570 | tx_pool->num_buffers * | ||
571 | sizeof(struct ibmvnic_tx_buff)); | ||
572 | |||
573 | for (i = 0; i < tx_pool->num_buffers; i++) | ||
574 | tx_pool->free_map[i] = i; | ||
575 | |||
576 | tx_pool->consumer_index = 0; | ||
577 | tx_pool->producer_index = 0; | ||
578 | |||
579 | return 0; | ||
580 | } | ||
581 | |||
560 | static int reset_tx_pools(struct ibmvnic_adapter *adapter) | 582 | static int reset_tx_pools(struct ibmvnic_adapter *adapter) |
561 | { | 583 | { |
562 | struct ibmvnic_tx_pool *tx_pool; | ||
563 | int tx_scrqs; | 584 | int tx_scrqs; |
564 | int i, j, rc; | 585 | int i, rc; |
565 | 586 | ||
566 | tx_scrqs = be32_to_cpu(adapter->login_rsp_buf->num_txsubm_subcrqs); | 587 | tx_scrqs = be32_to_cpu(adapter->login_rsp_buf->num_txsubm_subcrqs); |
567 | for (i = 0; i < tx_scrqs; i++) { | 588 | for (i = 0; i < tx_scrqs; i++) { |
568 | netdev_dbg(adapter->netdev, "Re-setting tx_pool[%d]\n", i); | 589 | rc = reset_one_tx_pool(adapter, &adapter->tso_pool[i]); |
569 | |||
570 | tx_pool = &adapter->tx_pool[i]; | ||
571 | |||
572 | rc = reset_long_term_buff(adapter, &tx_pool->long_term_buff); | ||
573 | if (rc) | 590 | if (rc) |
574 | return rc; | 591 | return rc; |
575 | 592 | rc = reset_one_tx_pool(adapter, &adapter->tx_pool[i]); | |
576 | rc = reset_long_term_buff(adapter, &tx_pool->tso_ltb); | ||
577 | if (rc) | 593 | if (rc) |
578 | return rc; | 594 | return rc; |
579 | |||
580 | memset(tx_pool->tx_buff, 0, | ||
581 | adapter->req_tx_entries_per_subcrq * | ||
582 | sizeof(struct ibmvnic_tx_buff)); | ||
583 | |||
584 | for (j = 0; j < adapter->req_tx_entries_per_subcrq; j++) | ||
585 | tx_pool->free_map[j] = j; | ||
586 | |||
587 | tx_pool->consumer_index = 0; | ||
588 | tx_pool->producer_index = 0; | ||
589 | tx_pool->tso_index = 0; | ||
590 | } | 595 | } |
591 | 596 | ||
592 | return 0; | 597 | return 0; |