<br><font size=2 face="sans-serif">Roland,</font>
<br>
<br><font size=2 face="sans-serif">Here is the updated patch for review.
I have updated the max value to 8k and min to 32.</font>
<br><font size=2 face="sans-serif">Attachment is for you to apply the patch.</font>
<br>
<br><font size=2 face="sans-serif">Signed-off-by: Shirley Ma <xma@us.ibm.com></font>
<br>
<div>
<br><font size=2 face="sans-serif">diff -urpN infiniband/ulp/ipoib/ipoib.h
infiniband-queue/ulp/ipoib/ipoib.h<br>
--- infiniband/ulp/ipoib/ipoib.h 2006-03-26
11:57:15.000000000 -0800<br>
+++ infiniband-queue/ulp/ipoib/ipoib.h 2006-04-04
16:53:24.702300792 -0700<br>
@@ -338,6 +338,8 @@ static inline void ipoib_unregister_debu<br>
#define ipoib_warn(priv, format, arg...)
\<br>
ipoib_printk(KERN_WARNING, priv, format
, ## arg)<br>
<br>
+extern int ipoib_sendq_size;<br>
+extern int ipoib_recvq_size;<br>
<br>
#ifdef CONFIG_INFINIBAND_IPOIB_DEBUG<br>
extern int ipoib_debug_level;<br>
diff -urpN infiniband/ulp/ipoib/ipoib_ib.c infiniband-queue/ulp/ipoib/ipoib_ib.c<br>
--- infiniband/ulp/ipoib/ipoib_ib.c 2006-03-26
11:57:15.000000000 -0800<br>
+++ infiniband-queue/ulp/ipoib/ipoib_ib.c 2006-04-04
16:56:49.475170584 -0700<br>
@@ -161,7 +161,7 @@ static int ipoib_ib_post_receives(struct<br>
struct ipoib_dev_priv *priv = netdev_priv(dev);<br>
int i;<br>
<br>
- for (i = 0; i < IPOIB_RX_RING_SIZE;
++i) {<br>
+ for (i = 0; i < ipoib_recvq_size;
++i) {<br>
if
(ipoib_alloc_rx_skb(dev, i)) {<br>
ipoib_warn(priv, "failed to allocate
receive buffer %d\n", i);</font>
<br><font size=2 face="sans-serif">
return
-ENOMEM;<br>
@@ -187,7 +187,7 @@ static void ipoib_ib_handle_wc(struct ne<br>
if (wr_id & IPOIB_OP_RECV) {<br>
wr_id
&= ~IPOIB_OP_RECV;<br>
<br>
- if
(wr_id < IPOIB_RX_RING_SIZE) {<br>
+ if
(wr_id < ipoib_recvq_size) {<br>
struct sk_buff *skb = priv->rx_ring[wr_id].skb;<br>
dma_addr_t addr = priv->rx_ring[wr_id].mapping;<br>
<br>
@@ -252,9 +252,9 @@ static void ipoib_ib_handle_wc(struct ne<br>
struct
ipoib_tx_buf *tx_req;<br>
unsigned
long flags;<br>
<br>
- if
(wr_id >= IPOIB_TX_RING_SIZE) {<br>
+ if
(wr_id >= ipoib_sendq_size) {<br>
ipoib_warn(priv, "completion event with
wrid %d (> %d)\n",<br>
-
wr_id, IPOIB_TX_RING_SIZE);<br>
+
wr_id, ipoib_sendq_size);<br>
return;<br>
}<br>
<br>
@@ -275,7 +275,7 @@ static void ipoib_ib_handle_wc(struct ne<br>
spin_lock_irqsave(&priv->tx_lock,
flags);<br>
++priv->tx_tail;<br>
if
(netif_queue_stopped(dev) &&<br>
-
priv->tx_head - priv->tx_tail <= IPOIB_TX_RING_SIZE
/ 2)<br>
+
priv->tx_head - priv->tx_tail <= ipoib_sendq_size
/ 2)<br>
netif_wake_queue(dev);<br>
spin_unlock_irqrestore(&priv->tx_lock,
flags);</font>
<br><font size=2 face="sans-serif"> <br>
@@ -344,13 +344,13 @@ void ipoib_send(struct net_device *dev, <br>
* means we have to make sure
everything is properly recorded and<br>
* our state is consistent before
we call post_send().<br>
*/<br>
- tx_req = &priv->tx_ring[priv->tx_head
& (IPOIB_TX_RING_SIZE - 1)];<br>
+ tx_req = &priv->tx_ring[priv->tx_head
& (ipoib_sendq_size - 1)];<br>
tx_req->skb = skb;<br>
addr = dma_map_single(priv->ca->dma_device,
skb->data, skb->len,<br>
DMA_TO_DEVICE);<br>
pci_unmap_addr_set(tx_req, mapping,
addr);<br>
<br>
- if (unlikely(post_send(priv, priv->tx_head
& (IPOIB_TX_RING_SIZE - 1),<br>
+ if (unlikely(post_send(priv, priv->tx_head
& (ipoib_sendq_size - 1),<br>
address->ah,
qpn, addr, skb->len))) {<br>
ipoib_warn(priv,
"post_send failed\n");<br>
++priv->stats.tx_errors;<br>
@@ -363,7 +363,7 @@ void ipoib_send(struct net_device *dev, <br>
address->last_send
= priv->tx_head;<br>
++priv->tx_head;<br>
<br>
- if
(priv->tx_head - priv->tx_tail == IPOIB_TX_RING_SIZE) {<br>
+ if
(priv->tx_head - priv->tx_tail == ipoib_sendq_size) {<br>
ipoib_dbg(priv, "TX ring full, stopping
kernel net queue\n");</font>
<br><font size=2 face="sans-serif">
netif_stop_queue(dev);<br>
}<br>
@@ -488,7 +488,7 @@ static int recvs_pending(struct net_devi<br>
int pending = 0;<br>
int i;<br>
<br>
- for (i = 0; i < IPOIB_RX_RING_SIZE;
++i)<br>
+ for (i = 0; i < ipoib_recvq_size;
++i)<br>
if
(priv->rx_ring[i].skb)<br>
++pending;<br>
<br>
@@ -527,7 +527,7 @@ int ipoib_ib_dev_stop(struct net_device <br>
*/<br>
while ((int) priv->tx_tail - (int) priv->tx_head
< 0) {<br>
tx_req
= &priv->tx_ring[priv->tx_tail &<br>
-
(IPOIB_TX_RING_SIZE - 1)];<br>
+
(ipoib_sendq_size - 1)];<br>
dma_unmap_single(priv->ca->dma_device,<br>
pci_unmap_addr(tx_req,
mapping),<br>
tx_req->skb->len,<br>
@@ -536,7 +536,7 @@ int ipoib_ib_dev_stop(struct net_device <br>
++priv->tx_tail;<br>
}<br>
<br>
-
for (i = 0; i < IPOIB_RX_RING_SIZE;
++i)<br>
+
for (i = 0; i < ipoib_recvq_size;
++i)<br>
if (priv->rx_ring[i].skb)
{<br>
dma_unmap_single(priv->ca->dma_device,<br>
pci_unmap_addr(&priv->rx_ring[i],<br>
diff -urpN infiniband/ulp/ipoib/ipoib_main.c infiniband-queue/ulp/ipoib/ipoib_main.c<br>
--- infiniband/ulp/ipoib/ipoib_main.c 2006-03-28
19:20:21.000000000 -0800</font>
<br><font size=2 face="sans-serif">+++ infiniband-queue/ulp/ipoib/ipoib_main.c
2006-04-04 17:17:14.643916624 -0700<br>
@@ -41,6 +41,7 @@<br>
#include <linux/init.h><br>
#include <linux/slab.h><br>
#include <linux/vmalloc.h><br>
+#include <linux/kernel.h><br>
<br>
#include <linux/if_arp.h> /*
For ARPHRD_xxx */<br>
<br>
@@ -53,6 +54,17 @@ MODULE_AUTHOR("Roland Dreier");<br>
MODULE_DESCRIPTION("IP-over-InfiniBand net driver");<br>
MODULE_LICENSE("Dual BSD/GPL");<br>
<br>
+#define IPOIB_MAX_QUEUE_SIZE 8192
/* max is 8k */<br>
+#define IPOIB_MIN_QUEUE_SIZE 32 /*
min is 32 */<br>
+<br>
+int ipoib_sendq_size = IPOIB_TX_RING_SIZE;<br>
+int ipoib_recvq_size = IPOIB_RX_RING_SIZE;<br>
+<br>
+module_param_named(sendq_size, ipoib_sendq_size, int, 0444);<br>
+MODULE_PARM_DESC(sendq_size, "Number of wqe in send queue");<br>
+module_param_named(recvq_size, ipoib_recvq_size, int, 0444);<br>
+MODULE_PARM_DESC(recvq_size, "Number of wqe in receive queue");<br>
+<br>
#ifdef CONFIG_INFINIBAND_IPOIB_DEBUG<br>
int ipoib_debug_level;<br>
<br>
@@ -843,19 +855,39 @@ int ipoib_dev_init(struct net_device *de<br>
<br>
/* Allocate RX/TX "rings"
to hold queued skbs */<br>
</font>
<br><font size=2 face="sans-serif">- priv->rx_ring
= kzalloc(IPOIB_RX_RING_SIZE * sizeof
(struct ipoib_rx_buf),<br>
+ if (ipoib_recvq_size > IPOIB_MAX_QUEUE_SIZE)
{<br>
+ ipoib_recvq_size
= IPOIB_MAX_QUEUE_SIZE;<br>
+
printk(KERN_WARNING "%s: ipoib_recvq_size is too big, use max %d instead\n",
ca->name, IPOIB_MAX_QUEUE_SIZE);<br>
+ }<br>
+ if (ipoib_recvq_size < IPOIB_MIN_QUEUE_SIZE)
{<br>
+ ipoib_recvq_size
= IPOIB_MIN_QUEUE_SIZE;<br>
+ printk(KERN_WARNING
"%s: ipoib_recvq_size is too small, use min %d instead\n", ca->name,
IPOIB_MIN_QUEUE_SIZE);<br>
+ }<br>
+ ipoib_recvq_size = roundup_pow_of_two(ipoib_recvq_size);<br>
+ priv->rx_ring =
kzalloc(ipoib_recvq_size * sizeof (struct ipoib_rx_buf),<br>
GFP_KERNEL);<br>
if (!priv->rx_ring) {<br>
printk(KERN_WARNING
"%s: failed to allocate RX ring (%d entries)\n",<br>
-
ca->name, IPOIB_RX_RING_SIZE);<br>
+
ca->name, ipoib_sendq_size);<br>
goto
out;<br>
}<br>
<br>
- priv->tx_ring = kzalloc(IPOIB_TX_RING_SIZE
* sizeof (struct ipoib_tx_buf),<br>
+ if (ipoib_sendq_size > IPOIB_MAX_QUEUE_SIZE)
{<br>
+ ipoib_sendq_size
= IPOIB_MAX_QUEUE_SIZE;<br>
+ printk(KERN_WARNING
"%s: ipoib_sendq_size is too big, use max %d instead\n", ca->name,
IPOIB_MAX_QUEUE_SIZE);</font>
<br><font size=2 face="sans-serif">+ }<br>
+ if (ipoib_sendq_size < IPOIB_MIN_QUEUE_SIZE)
{<br>
+ ipoib_sendq_size
= IPOIB_MIN_QUEUE_SIZE;<br>
+ printk(KERN_WARNING
"%s: ipoib_sendq_size is too small, use min %d instead\n", ca->name,
IPOIB_MIN_QUEUE_SIZE);<br>
+ } <br>
+<br>
+ ipoib_sendq_size = roundup_pow_of_two(ipoib_sendq_size);<br>
+<br>
+ priv->tx_ring = kzalloc(ipoib_sendq_size
* sizeof (struct ipoib_tx_buf),<br>
GFP_KERNEL);<br>
if (!priv->tx_ring) {<br>
printk(KERN_WARNING
"%s: failed to allocate TX ring (%d entries)\n",<br>
-
ca->name, IPOIB_TX_RING_SIZE);<br>
+
ca->name, ipoib_sendq_size);<br>
goto
out_rx_ring_cleanup;<br>
}<br>
<br>
@@ -923,7 +955,7 @@ static void ipoib_setup(struct net_devic<br>
dev->hard_header_len
= IPOIB_ENCAP_LEN + INFINIBAND_ALEN;<br>
dev->addr_len
= INFINIBAND_ALEN;<br>
dev->type
= ARPHRD_INFINIBAND;<br>
- dev->tx_queue_len
= IPOIB_TX_RING_SIZE * 2;<br>
+ dev->tx_queue_len
= ipoib_sendq_size * 2;<br>
dev->features
= NETIF_F_VLAN_CHALLENGED | NETIF_F_LLTX;<br>
<br>
/* MTU will be reset when mcast join
happens */<br>
diff -urpN infiniband/ulp/ipoib/ipoib_verbs.c infiniband-queue/ulp/ipoib/ipoib_verbs.c</font>
<br><font size=2 face="sans-serif">--- infiniband/ulp/ipoib/ipoib_verbs.c
2006-03-26 11:57:15.000000000 -0800<br>
+++ infiniband-queue/ulp/ipoib/ipoib_verbs.c 2006-04-04
16:57:07.098491432 -0700<br>
@@ -159,8 +159,8 @@ int ipoib_transport_dev_init(struct net_<br>
struct ipoib_dev_priv *priv = netdev_priv(dev);<br>
struct ib_qp_init_attr init_attr =
{<br>
.cap
= {<br>
-
.max_send_wr = IPOIB_TX_RING_SIZE,<br>
-
.max_recv_wr = IPOIB_RX_RING_SIZE,<br>
+
.max_send_wr = ipoib_sendq_size,<br>
+
.max_recv_wr = ipoib_recvq_size,<br>
.max_send_sge = 1,<br>
.max_recv_sge = 1<br>
},<br>
@@ -175,7 +175,7 @@ int ipoib_transport_dev_init(struct net_<br>
}<br>
<br>
priv->cq = ib_create_cq(priv->ca,
ipoib_ib_completion, NULL, dev,<br>
-
IPOIB_TX_RING_SIZE
+ IPOIB_RX_RING_SIZE + 1);<br>
+
ipoib_sendq_size
+ ipoib_recvq_size + 1);<br>
if (IS_ERR(priv->cq)) {<br>
printk(KERN_WARNING
"%s: failed to create CQ\n", ca->name);<br>
goto
out_free_pd;</font>
<br>
<br>
<br>
<br>
<br>
<br><font size=2 face="sans-serif"><br>
Thanks<br>
Shirley Ma<br>
IBM Linux Technology Center<br>
15300 SW Koll Parkway<br>
Beaverton, OR 97006-6063<br>
Phone(Fax): (503) 578-7638<br>
<br>
</font></div>