[openib-general] IPOIB NAPI
Eli Cohen
eli at dev.mellanox.co.il
Mon Oct 16 09:41:20 PDT 2006
On Sun, 2006-10-15 at 09:39 -0700, Roland Dreier wrote:
> I've been meaning to mention this... I have a preliminary version in
>
> git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband.git ipoib-napi
>
> There are further changes I would like to add on top of that, but
> comments on the two patches there would be appreciated. And also
> benchmarks would be good.
Please diff to see my comments. Generaly it looks like the condition on
netif_rx_reschedule() should be inverted. Also ou need to set max to
some large value since you don't know if how many completions you missed
and you want to make sure you get all the ones the sneaked from the last
poll to the request notify.
int ipoib_poll(struct net_device *dev, int *budget)
{
struct ipoib_dev_priv *priv = netdev_priv(dev);
int max = min(*budget, dev->quota);
int done;
int t;
int empty;
int missed_event;
int n, i;
repoll:
done = 0;
empty = 0;
while (max) {
t = min(IPOIB_NUM_WC, max);
n = ib_poll_cq(priv->cq, t, priv->ibwc);
for (i = 0; i < n; ++i) {
if (priv->ibwc[i].wr_id & IPOIB_OP_RECV) {
++done;
--max;
ipoib_ib_handle_rx_wc(dev, priv->ibwc + i);
} else
ipoib_ib_handle_tx_wc(dev, priv->ibwc + i);
}
if (n != t) {
empty = 1;
break;
}
}
dev->quota -= done;
*budget -= done;
if (empty) {
netif_rx_complete(dev);
ib_req_notify_cq(priv->cq, IB_CQ_NEXT_COMP, &missed_event);
if (missed_event && !netif_rx_reschedule(dev, 0)) {
max = 1000;
goto repoll;
}
return 0;
}
return 1;
}
More information about the general
mailing list