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>

authored by David J. Wilder and committed by Roland Dreier b1404069 f2d7499b

Changed files
+12 -5
drivers
infiniband
ulp
ipoib
+12 -5
drivers/infiniband/ulp/ipoib/ipoib_cm.c
··· 202 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 208 static void ipoib_cm_start_rx_drain(struct ipoib_dev_priv *priv) ··· 352 352 int ret; 353 353 int i; 354 354 355 - rx->rx_ring = kcalloc(ipoib_recvq_size, sizeof *rx->rx_ring, GFP_KERNEL); 356 - if (!rx->rx_ring) 355 + rx->rx_ring = vmalloc(ipoib_recvq_size * sizeof *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 359 return -ENOMEM; 360 + } 361 + 362 + memset(rx->rx_ring, 0, ipoib_recvq_size * sizeof *rx->rx_ring); 358 363 359 364 t = kmalloc(sizeof *t, GFP_KERNEL); 360 365 if (!t) { ··· 1499 1494 return; 1500 1495 } 1501 1496 1502 - priv->cm.srq_ring = kzalloc(ipoib_recvq_size * sizeof *priv->cm.srq_ring, 1503 - GFP_KERNEL); 1497 + priv->cm.srq_ring = vmalloc(ipoib_recvq_size * sizeof *priv->cm.srq_ring); 1504 1498 if (!priv->cm.srq_ring) { 1505 1499 printk(KERN_WARNING "%s: failed to allocate CM SRQ ring (%d entries)\n", 1506 1500 priv->ca->name, ipoib_recvq_size); 1507 1501 ib_destroy_srq(priv->cm.srq); 1508 1502 priv->cm.srq = NULL; 1503 + return; 1509 1504 } 1505 + 1506 + memset(priv->cm.srq_ring, 0, ipoib_recvq_size * sizeof *priv->cm.srq_ring); 1510 1507 } 1511 1508 1512 1509 int ipoib_cm_dev_init(struct net_device *dev)