Commit 5c4d87c7 authored by Philippe Gerum's avatar Philippe Gerum Committed by Jan Kiszka

net/proxy: fix non-rt signal overflow

rtdm_nrtsig_pend() is based on ipipe_post_root_work(), which keeps a
copy of every request descriptor internally until it is consumed by
the secondary mode handler. Triggering rtdm_nrtsig_pend() every time a
packet is relayed from the stack to the virtual netdev may cause such
request buffer to overflow under pressure.

To address this issue, trigger the non-rt signal from
rtnetproxy_recv() only when the proxy RX queue transitions from empty
to non-empty as a result of enqueuing the next skb. To this end,
rtskb_queue_tail_check() is introduced.
Signed-off-by: Philippe Gerum's avatarPhilippe Gerum <rpm@xenomai.org>
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent 393ece85
......@@ -218,8 +218,8 @@ static void rtnetproxy_recv(struct rtskb *rtskb)
return;
}
rtskb_queue_tail(&rx_queue, rtskb);
rtdm_nrtsig_pend(&rtnetproxy_rx_signal);
if (rtskb_queue_tail_check(&rx_queue, rtskb))
rtdm_nrtsig_pend(&rtnetproxy_rx_signal);
}
/* ************************************************************************
......
......@@ -436,6 +436,26 @@ static inline void rtskb_queue_tail(struct rtskb_queue *queue,
rtdm_lock_put_irqrestore(&queue->lock, context);
}
/***
* rtskb_queue_tail_check - variant of rtskb_queue_tail
* returning true on empty->non empty transition.
* @queue: queue to use
* @skb: buffer to queue
*/
static inline bool rtskb_queue_tail_check(struct rtskb_queue *queue,
struct rtskb *skb)
{
rtdm_lockctx_t context;
bool ret;
rtdm_lock_get_irqsave(&queue->lock, context);
ret = queue->first == NULL;
__rtskb_queue_tail(queue, skb);
rtdm_lock_put_irqrestore(&queue->lock, context);
return ret;
}
/***
* __rtskb_prio_queue_tail - insert a buffer at the prioritized queue tail
* (w/o locks)
......
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