Hello Vlad,

Below is the patch to optimize ipoib_ud_skb_put_frags() call to avoid 
unnecessary calculation. This patch has been touch tested for RC4 build. 
I tried a few hours to generate a patch on top of the 4k mtu patch. 
It's not being successful. I gave up. I am giving the ipoib_ib.c diff here.
Appreciate if you can help here.

thanks
Shirley

Signed-off-by: Shirley Ma <[EMAIL PROTECTED]>
---

diff -urpN ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c 
ofed_a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
--- ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c        2008-02-12 
10:53:00.000000000 -0800
+++ ofed_a/drivers/infiniband/ulp/ipoib/ipoib_ib.c      2008-02-12 
11:04:54.000000000 -0800
@@ -107,22 +107,17 @@ static void clean_pending_receives(struc
 static void ipoib_ud_skb_put_frags(struct ipoib_dev_priv *priv, struct sk_buff 
*skb,
                                   unsigned int length)
 {
-       if (ipoib_ud_need_sg(priv->max_ib_mtu)) {
-               unsigned int size;
-               skb_frag_t *frag = &skb_shinfo(skb)->frags[0];
-
-               /* put header into skb */
-               size = min(length, (unsigned)IPOIB_UD_HEAD_SIZE);
-               skb->tail += size;
-               skb->len += size;
-               length -= size;
-
-               size = min(length, (unsigned) PAGE_SIZE);
-               frag->size = size;
-               skb->data_len += size;
-               skb->truesize += size;
-               skb->len += size;
-               length -= size;
+       skb_frag_t *frag = &skb_shinfo(skb)->frags[0];
+       if (skb_shinfo(skb)->nr_frags) {
+               /*
+                * we know only two buffers here, first buf size is
+                * IPOIB_UD_HEAD_SIZE
+                */
+               skb->tail += IPOIB_UD_HEAD_SIZE;
+               frag->size = length - IPOIB_UD_HEAD_SIZE;
+               skb->data_len += frag->size;
+               skb->truesize += frag->size;
+               skb->len += length;
        } else
                skb_put(skb, length);
 }


_______________________________________________
ewg mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ewg

Reply via email to