diff options
author | Nathan Fontenot <nfont@linux.vnet.ibm.com> | 2017-04-25 22:01:10 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-04-26 21:49:15 +0300 |
commit | 1bb3c739ad2c0030792cd527f30865accc50c460 (patch) | |
tree | c510f6edb3a2b6a90d5a64636b446e54de62937e /drivers/net/ethernet/ibm/ibmvnic.c | |
parent | d346b9bc4f652ddaf29b2d80ec7fc75d3b07124e (diff) | |
download | linux-1bb3c739ad2c0030792cd527f30865accc50c460.tar.xz |
ibmvnic: Move initialization of sub crqs to ibmvnic_init
The sub crq structures are initialized in interrupt context while
handling the response to crqs when negotiating capabilities for
the driver. The sub crqs do not need to be initialized at this point
and can be moved to being done from ibmvnic_init. Moving the init
of the sub crqs to ibmvnic_init also allows use to allocate the
memory with GFP_KERNEL instead of GFP_ATOMIC.
Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/ibm/ibmvnic.c')
-rw-r--r-- | drivers/net/ethernet/ibm/ibmvnic.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c index c2e260ce45bb..4fcd2f0378ba 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c @@ -1390,12 +1390,12 @@ static struct ibmvnic_sub_crq_queue *init_sub_crq_queue(struct ibmvnic_adapter struct ibmvnic_sub_crq_queue *scrq; int rc; - scrq = kzalloc(sizeof(*scrq), GFP_ATOMIC); + scrq = kzalloc(sizeof(*scrq), GFP_KERNEL); if (!scrq) return NULL; scrq->msgs = - (union sub_crq *)__get_free_pages(GFP_ATOMIC | __GFP_ZERO, 2); + (union sub_crq *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, 2); if (!scrq->msgs) { dev_warn(dev, "Couldn't allocate crq queue messages page\n"); goto zero_page_failed; @@ -1689,7 +1689,7 @@ static int init_sub_crqs(struct ibmvnic_adapter *adapter) total_queues = adapter->req_tx_queues + adapter->req_rx_queues; - allqueues = kcalloc(total_queues, sizeof(*allqueues), GFP_ATOMIC); + allqueues = kcalloc(total_queues, sizeof(*allqueues), GFP_KERNEL); if (!allqueues) return -1; @@ -1729,7 +1729,7 @@ static int init_sub_crqs(struct ibmvnic_adapter *adapter) } adapter->tx_scrq = kcalloc(adapter->req_tx_queues, - sizeof(*adapter->tx_scrq), GFP_ATOMIC); + sizeof(*adapter->tx_scrq), GFP_KERNEL); if (!adapter->tx_scrq) goto tx_failed; @@ -1739,7 +1739,7 @@ static int init_sub_crqs(struct ibmvnic_adapter *adapter) } adapter->rx_scrq = kcalloc(adapter->req_rx_queues, - sizeof(*adapter->rx_scrq), GFP_ATOMIC); + sizeof(*adapter->rx_scrq), GFP_KERNEL); if (!adapter->rx_scrq) goto rx_failed; @@ -1765,7 +1765,6 @@ static void ibmvnic_send_req_caps(struct ibmvnic_adapter *adapter, int retry) { struct device *dev = &adapter->vdev->dev; union ibmvnic_crq crq; - int rc; if (!retry) { /* Sub-CRQ entries are 32 byte long */ @@ -1794,10 +1793,6 @@ static void ibmvnic_send_req_caps(struct ibmvnic_adapter *adapter, int retry) adapter->req_mtu = adapter->netdev->mtu + ETH_HLEN; } - rc = init_sub_crqs(adapter); - if (rc) - return; - memset(&crq, 0, sizeof(crq)); crq.request_capability.first = IBMVNIC_CRQ_CMD; crq.request_capability.cmd = REQUEST_CAPABILITY; @@ -3317,7 +3312,13 @@ static int ibmvnic_init(struct ibmvnic_adapter *adapter) return -1; } - return 0; + rc = init_sub_crqs(adapter); + if (rc) { + dev_err(dev, "Initialization of sub crqs failed\n"); + release_crq_queue(adapter); + } + + return rc; } static int ibmvnic_probe(struct vio_dev *dev, const struct vio_device_id *id) |