diff options
author | David J. Wilder <dwilder@us.ibm.com> | 2008-08-08 18:51:29 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2008-08-08 18:51:29 -0400 |
commit | b1404069f64457c94de241738fdca142c2e5698f (patch) | |
tree | 671e50585d0baf9f01b1a8b301ca650087d87012 | |
parent | f2d7499be1b1fe1cd8a5e6a01c1f44173894a241 (diff) |
IPoIB/cm: Use vmalloc() to allocate rx_rings
There are users that are running UDP applications that require a large
receive queue size in order to get good performance. To prevent
allocation failures for rx_rings when using non-SRQ mode and large
recv_queue_size (1K or larger), use vmalloc() instead of kcalloc() to
alocate rx_rings.
Signed-off-by: David Wilder <dwilder@us.ibm.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_cm.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c index 7ebc400a4b3d..341ffedafed6 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c | |||
@@ -202,7 +202,7 @@ static void ipoib_cm_free_rx_ring(struct net_device *dev, | |||
202 | dev_kfree_skb_any(rx_ring[i].skb); | 202 | dev_kfree_skb_any(rx_ring[i].skb); |
203 | } | 203 | } |
204 | 204 | ||
205 | kfree(rx_ring); | 205 | vfree(rx_ring); |
206 | } | 206 | } |
207 | 207 | ||
208 | static void ipoib_cm_start_rx_drain(struct ipoib_dev_priv *priv) | 208 | static void ipoib_cm_start_rx_drain(struct ipoib_dev_priv *priv) |
@@ -352,9 +352,14 @@ static int ipoib_cm_nonsrq_init_rx(struct net_device *dev, struct ib_cm_id *cm_i | |||
352 | int ret; | 352 | int ret; |
353 | int i; | 353 | int i; |
354 | 354 | ||
355 | rx->rx_ring = kcalloc(ipoib_recvq_size, sizeof *rx->rx_ring, GFP_KERNEL); | 355 | rx->rx_ring = vmalloc(ipoib_recvq_size * sizeof *rx->rx_ring); |
356 | if (!rx->rx_ring) | 356 | if (!rx->rx_ring) { |
357 | printk(KERN_WARNING "%s: failed to allocate CM non-SRQ ring (%d entries)\n", | ||
358 | priv->ca->name, ipoib_recvq_size); | ||
357 | return -ENOMEM; | 359 | return -ENOMEM; |
360 | } | ||
361 | |||
362 | memset(rx->rx_ring, 0, ipoib_recvq_size * sizeof *rx->rx_ring); | ||
358 | 363 | ||
359 | t = kmalloc(sizeof *t, GFP_KERNEL); | 364 | t = kmalloc(sizeof *t, GFP_KERNEL); |
360 | if (!t) { | 365 | if (!t) { |
@@ -1494,14 +1499,16 @@ static void ipoib_cm_create_srq(struct net_device *dev, int max_sge) | |||
1494 | return; | 1499 | return; |
1495 | } | 1500 | } |
1496 | 1501 | ||
1497 | priv->cm.srq_ring = kzalloc(ipoib_recvq_size * sizeof *priv->cm.srq_ring, | 1502 | priv->cm.srq_ring = vmalloc(ipoib_recvq_size * sizeof *priv->cm.srq_ring); |
1498 | GFP_KERNEL); | ||
1499 | if (!priv->cm.srq_ring) { | 1503 | if (!priv->cm.srq_ring) { |
1500 | printk(KERN_WARNING "%s: failed to allocate CM SRQ ring (%d entries)\n", | 1504 | printk(KERN_WARNING "%s: failed to allocate CM SRQ ring (%d entries)\n", |
1501 | priv->ca->name, ipoib_recvq_size); | 1505 | priv->ca->name, ipoib_recvq_size); |
1502 | ib_destroy_srq(priv->cm.srq); | 1506 | ib_destroy_srq(priv->cm.srq); |
1503 | priv->cm.srq = NULL; | 1507 | priv->cm.srq = NULL; |
1508 | return; | ||
1504 | } | 1509 | } |
1510 | |||
1511 | memset(priv->cm.srq_ring, 0, ipoib_recvq_size * sizeof *priv->cm.srq_ring); | ||
1505 | } | 1512 | } |
1506 | 1513 | ||
1507 | int ipoib_cm_dev_init(struct net_device *dev) | 1514 | int ipoib_cm_dev_init(struct net_device *dev) |