From: Roland Dreier <roland@topspin.com>
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org, openib-general@openib.org
Subject: [PATCH][2/3] IPoIB: fix static rate calculation
Date: Thu, 31 Mar 2005 19:36:12 -0800 [thread overview]
Message-ID: <20053311936.qOWRURSZd0itPjAn@topspin.com> (raw)
In-Reply-To: <20053311936.983q6QLaPvAkIcQj@topspin.com>
Correct and simplify calculation of static rate. We need to round up
the quotient of (local_rate - path_rate) / path_rate. To round up we
add (path_rate - 1) to the numerator, so the quotient simplifies to
(local_rate - 1) / path_rate.
No idea how I came up with the old formula.
Signed-off-by: Roland Dreier <roland@topspin.com>
--- linux-export.orig/drivers/infiniband/ulp/ipoib/ipoib_main.c 2005-03-31 19:06:47.984714505 -0800
+++ linux-export/drivers/infiniband/ulp/ipoib/ipoib_main.c 2005-03-31 19:26:39.094134171 -0800
@@ -302,11 +302,10 @@
.sl = pathrec->sl,
.port_num = priv->port
};
+ int path_rate = ib_sa_rate_enum_to_int(pathrec->rate);
- if (ib_sa_rate_enum_to_int(pathrec->rate) > 0)
- av.static_rate = (2 * priv->local_rate -
- ib_sa_rate_enum_to_int(pathrec->rate) - 1) /
- (priv->local_rate ? priv->local_rate : 1);
+ if (path_rate > 0 && priv->local_rate > path_rate)
+ av.static_rate = (priv->local_rate - 1) / path_rate;
ipoib_dbg(priv, "static_rate %d for local port %dX, path %dX\n",
av.static_rate, priv->local_rate,
--- linux-export.orig/drivers/infiniband/ulp/ipoib/ipoib_multicast.c 2005-03-31 19:07:01.877698296 -0800
+++ linux-export/drivers/infiniband/ulp/ipoib/ipoib_multicast.c 2005-03-31 19:26:03.861782487 -0800
@@ -258,13 +258,12 @@
.traffic_class = mcast->mcmember.traffic_class
}
};
+ int path_rate = ib_sa_rate_enum_to_int(mcast->mcmember.rate);
av.grh.dgid = mcast->mcmember.mgid;
- if (ib_sa_rate_enum_to_int(mcast->mcmember.rate) > 0)
- av.static_rate = (2 * priv->local_rate -
- ib_sa_rate_enum_to_int(mcast->mcmember.rate) - 1) /
- (priv->local_rate ? priv->local_rate : 1);
+ if (path_rate > 0 && priv->local_rate > path_rate)
+ av.static_rate = (priv->local_rate - 1) / path_rate;
ipoib_dbg_mcast(priv, "static_rate %d for local port %dX, mcmember %dX\n",
av.static_rate, priv->local_rate,
next prev parent reply other threads:[~2005-04-01 3:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-01 3:36 [PATCH][1/3] IPoIB: set skb->mac.raw on receive Roland Dreier
2005-04-01 3:36 ` Roland Dreier [this message]
2005-04-01 3:36 ` [PATCH][3/3] IPoIB: convert to debugfs Roland Dreier
2005-04-01 17:45 ` [PATCH][4/3] IPoIB: document conversion " Roland Dreier
2005-04-01 4:18 ` [PATCH][1/3] IPoIB: set skb->mac.raw on receive David S. Miller
2005-04-01 4:24 ` Roland Dreier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20053311936.qOWRURSZd0itPjAn@topspin.com \
--to=roland@topspin.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=openib-general@openib.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox