diff options
author | Tal Alon <talal@mellanox.com> | 2013-10-16 10:37:48 -0400 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2013-11-08 17:42:48 -0500 |
commit | 22252b4e09f19431f82dc26428e0edf697d19a04 (patch) | |
tree | a6e68cfa1afbe4390e6e6b452d783019777a5bb3 /drivers/infiniband/ulp | |
parent | c2bb5628db44735bc0095a8ef8efc0278ba245df (diff) |
IPoIB: Change CM skb memory allocation to be non-atomic during init
Change CM skb memory allocation to use GFP_KERNEL when possible.
During device init there's no need to use GFP_ATOMIC when allocating
memory for the CM skbs -- use GFP_KERNEL instead.
Signed-off-by: Tal Alon <talal@mellanox.com>
Signed-off-by: Erez Shitrit <erezsh@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband/ulp')
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_cm.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c index 7a3175400b2a..1377f85911c2 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c | |||
@@ -140,7 +140,8 @@ static int ipoib_cm_post_receive_nonsrq(struct net_device *dev, | |||
140 | static struct sk_buff *ipoib_cm_alloc_rx_skb(struct net_device *dev, | 140 | static struct sk_buff *ipoib_cm_alloc_rx_skb(struct net_device *dev, |
141 | struct ipoib_cm_rx_buf *rx_ring, | 141 | struct ipoib_cm_rx_buf *rx_ring, |
142 | int id, int frags, | 142 | int id, int frags, |
143 | u64 mapping[IPOIB_CM_RX_SG]) | 143 | u64 mapping[IPOIB_CM_RX_SG], |
144 | gfp_t gfp) | ||
144 | { | 145 | { |
145 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 146 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
146 | struct sk_buff *skb; | 147 | struct sk_buff *skb; |
@@ -164,7 +165,7 @@ static struct sk_buff *ipoib_cm_alloc_rx_skb(struct net_device *dev, | |||
164 | } | 165 | } |
165 | 166 | ||
166 | for (i = 0; i < frags; i++) { | 167 | for (i = 0; i < frags; i++) { |
167 | struct page *page = alloc_page(GFP_ATOMIC); | 168 | struct page *page = alloc_page(gfp); |
168 | 169 | ||
169 | if (!page) | 170 | if (!page) |
170 | goto partial_error; | 171 | goto partial_error; |
@@ -382,7 +383,8 @@ static int ipoib_cm_nonsrq_init_rx(struct net_device *dev, struct ib_cm_id *cm_i | |||
382 | 383 | ||
383 | for (i = 0; i < ipoib_recvq_size; ++i) { | 384 | for (i = 0; i < ipoib_recvq_size; ++i) { |
384 | if (!ipoib_cm_alloc_rx_skb(dev, rx->rx_ring, i, IPOIB_CM_RX_SG - 1, | 385 | if (!ipoib_cm_alloc_rx_skb(dev, rx->rx_ring, i, IPOIB_CM_RX_SG - 1, |
385 | rx->rx_ring[i].mapping)) { | 386 | rx->rx_ring[i].mapping, |
387 | GFP_KERNEL)) { | ||
386 | ipoib_warn(priv, "failed to allocate receive buffer %d\n", i); | 388 | ipoib_warn(priv, "failed to allocate receive buffer %d\n", i); |
387 | ret = -ENOMEM; | 389 | ret = -ENOMEM; |
388 | goto err_count; | 390 | goto err_count; |
@@ -639,7 +641,8 @@ void ipoib_cm_handle_rx_wc(struct net_device *dev, struct ib_wc *wc) | |||
639 | frags = PAGE_ALIGN(wc->byte_len - min(wc->byte_len, | 641 | frags = PAGE_ALIGN(wc->byte_len - min(wc->byte_len, |
640 | (unsigned)IPOIB_CM_HEAD_SIZE)) / PAGE_SIZE; | 642 | (unsigned)IPOIB_CM_HEAD_SIZE)) / PAGE_SIZE; |
641 | 643 | ||
642 | newskb = ipoib_cm_alloc_rx_skb(dev, rx_ring, wr_id, frags, mapping); | 644 | newskb = ipoib_cm_alloc_rx_skb(dev, rx_ring, wr_id, frags, |
645 | mapping, GFP_ATOMIC); | ||
643 | if (unlikely(!newskb)) { | 646 | if (unlikely(!newskb)) { |
644 | /* | 647 | /* |
645 | * If we can't allocate a new RX buffer, dump | 648 | * If we can't allocate a new RX buffer, dump |
@@ -1556,7 +1559,8 @@ int ipoib_cm_dev_init(struct net_device *dev) | |||
1556 | for (i = 0; i < ipoib_recvq_size; ++i) { | 1559 | for (i = 0; i < ipoib_recvq_size; ++i) { |
1557 | if (!ipoib_cm_alloc_rx_skb(dev, priv->cm.srq_ring, i, | 1560 | if (!ipoib_cm_alloc_rx_skb(dev, priv->cm.srq_ring, i, |
1558 | priv->cm.num_frags - 1, | 1561 | priv->cm.num_frags - 1, |
1559 | priv->cm.srq_ring[i].mapping)) { | 1562 | priv->cm.srq_ring[i].mapping, |
1563 | GFP_KERNEL)) { | ||
1560 | ipoib_warn(priv, "failed to allocate " | 1564 | ipoib_warn(priv, "failed to allocate " |
1561 | "receive buffer %d\n", i); | 1565 | "receive buffer %d\n", i); |
1562 | ipoib_cm_dev_cleanup(dev); | 1566 | ipoib_cm_dev_cleanup(dev); |