Commit ce7eb8a2 authored by Alessandro Rubini's avatar Alessandro Rubini Committed by Adam Wujek

kernel/wr-nic: fix a memory leakage under heavy load

When the switch is loaded, some PTP outgoing frames get discarded, so we
never get back the timestamp interrupt.  By round-robin'ing the slots,
we get back to the "busy" one, which holds an skb structure that must be
released.

Without this freeing, the skb remains in the output queue of the
socket, and after a while we get EAGAIN in send() because the buffer
is full (400 frames, more or less). And the ptp port is stuck until we
reopen the socket.

This diagnosis exposed the fact that it's not an overflow of pending
descriptors, so I change the message from

  descriptor overflow: tx timestamp pending

to

  discarding tx frame that got no timestamp

Finally, this is pr_warn, not pr_err as we now know it's expected.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 5bd07e8e
......@@ -200,8 +200,9 @@ static int wrn_start_xmit(struct sk_buff *skb, struct net_device *dev)
//spin_lock_irqsave(&ep->lock, flags);
if (wrn->skb_desc[desc].skb) {
pr_err("%s: descriptor overflow: tx timestamp pending\n",
pr_warn("%s: discarding tx frame that got no timestamp\n",
__func__);
dev_kfree_skb_irq(wrn->skb_desc[desc].skb);
}
wrn->skb_desc[desc].skb = skb; /* Save for tx irq and stamping */
wrn->skb_desc[desc].frame_id = id; /* Save for tx irq and stamping */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment