<html><body>
<p>Hello Eli,<br>
<br>
If i undersand your code correctly, you post_receive 16 skb's at once. when ib_post_receive returns error, all these 16 skb's would fail, not just this skb failure, am I right? If all failure, then we should free these 16 skb's not just one. Also the same issue in ipoib-cm code.<br>
<br>
Thanks<br>
Shirley<br>
<br>
<br>
<img width="16" height="16" src="cid:1__=08BBF975DFA3C03F8f9e8a93df938@us.ibm.com" border="0" alt="Inactive hide details for Eli Cohen <eli@dev.mellanox.co.il>">Eli Cohen <eli@dev.mellanox.co.il><br>
<br>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top"><td style="background-image:url(cid:2__=08BBF975DFA3C03F8f9e8a93df938@us.ibm.com); background-repeat: no-repeat; " width="40%">
<ul>
<ul>
<ul>
<ul><b><font size="2">Eli Cohen <eli@dev.mellanox.co.il></font></b><font size="2"> </font>
<p><font size="2">02/05/08 12:38 AM</font>
<table border="1">
<tr valign="top"><td width="168" bgcolor="#FFFFFF"><div align="center"><font size="2">Please respond to<br>
eli@dev.mellanox.co.il</font></div></td></tr>
</table>
</ul>
</ul>
</ul>
</ul>
</td><td width="60%">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top"><td width="1%"><img width="58" height="1" src="cid:3__=08BBF975DFA3C03F8f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<div align="right"><font size="2">To</font></div></td><td width="100%"><img width="1" height="1" src="cid:3__=08BBF975DFA3C03F8f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<font size="2">Shirley Ma/Beaverton/IBM@IBMUS</font></td></tr>
<tr valign="top"><td width="1%"><img width="58" height="1" src="cid:3__=08BBF975DFA3C03F8f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<div align="right"><font size="2">cc</font></div></td><td width="100%"><img width="1" height="1" src="cid:3__=08BBF975DFA3C03F8f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<font size="2">openfabrics <openib-general@lists.openfabrics.org>, Roland Dreier <rdreier@cisco.com>, tziporet@dev.mellanox.co.il</font></td></tr>
<tr valign="top"><td width="1%"><img width="58" height="1" src="cid:3__=08BBF975DFA3C03F8f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<div align="right"><font size="2">Subject</font></div></td><td width="100%"><img width="1" height="1" src="cid:3__=08BBF975DFA3C03F8f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<font size="2">Re: [ofa-general] [PATCH 0/5]: Improve small UDP messages</font></td></tr>
</table>
<table border="0" cellspacing="0" cellpadding="0">
<tr valign="top"><td width="58"><img width="1" height="1" src="cid:3__=08BBF975DFA3C03F8f9e8a93df938@us.ibm.com" border="0" alt=""></td><td width="336"><img width="1" height="1" src="cid:3__=08BBF975DFA3C03F8f9e8a93df938@us.ibm.com" border="0" alt=""></td></tr>
</table>
</td></tr>
</table>
<br>
<tt><br>
On Tue, 2008-02-05 at 00:29 -0800, Shirley Ma wrote:<br>
> Hello Eli,<br>
> <br>
> Did you see my another email regarding the memory leak issue in<br>
> post_receive()?<br>
<br>
No, I saw you suggested using dynamic allocations for the list of<br>
receive WQEs but nothing re memory leak. Can you be more specific?<br>
<br>
> <br>
> +static int ipoib_ib_post_receive(struct net_device *dev, int id)<br>
> +{<br>
> + struct ipoib_dev_priv *priv = netdev_priv(dev);<br>
> + struct ib_recv_wr *bad_wr;<br>
> + int ret = 0;<br>
> + int i = priv->rx_outst;<br>
> +<br>
> + priv->sglist_draft[i].addr = priv->rx_ring[id].mapping;<br>
> + priv->rx_wr_draft[i].wr_id = id | IPOIB_OP_RECV;<br>
> + if (++priv->rx_outst == UD_POST_RCV_COUNT) {<br>
> + ret = ib_post_recv(priv->qp, priv->rx_wr_draft,<br>
> &bad_wr);<br>
> +<br>
> + if (unlikely(ret)) {<br>
> + ipoib_warn(priv, "receive failed for buf %d (%<br>
> d)\n", id, ret);<br>
> + while (bad_wr) {<br>
> + id = bad_wr->wr_id & ~IPOIB_OP_RECV;<br>
> + ib_dma_unmap_single(priv->ca,<br>
> priv->rx_ring[id].mapping,<br>
> + IPOIB_BUF_SIZE,<br>
> DMA_FROM_DEVICE);<br>
> +<br>
> dev_kfree_skb_any(priv->rx_ring[id].skb);<br>
> + priv->rx_ring[id].skb = NULL;<br>
> + }<br>
> <br>
> 16 skbs need to be freed here when errors, not just this one.<br>
> <br>
> + }<br>
> + priv->rx_outst = 0;<br>
> + }<br>
> <br>
> return ret;<br>
> } <br>
> <br>
> Thanks<br>
> Shirley<br>
> <br>
> <br>
<br>
</tt><br>
</body></html>