Change in simtrace2[master]: sniffer: only allocate USB message if queue is not too long

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Kévin Redon gerrit-no-reply at lists.osmocom.org
Sun Jul 8 15:36:27 UTC 2018


Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/9927


Change subject: sniffer: only allocate USB message if queue is not too long
......................................................................

sniffer: only allocate USB message if queue is not too long

When the host does not retrieved the USB messages, they keep getting
queue in the firmware, filling the RAM, and preventing further memory
to be allocated.

Change-Id: I0e447acdf757dcb5dc5c4d8b84a4235866914cad
---
M firmware/libcommon/source/sniffer.c
1 file changed, 8 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/27/9927/1

diff --git a/firmware/libcommon/source/sniffer.c b/firmware/libcommon/source/sniffer.c
index 79d825f..cd732f9 100644
--- a/firmware/libcommon/source/sniffer.c
+++ b/firmware/libcommon/source/sniffer.c
@@ -226,6 +226,14 @@
  */
 static struct msgb *usb_msg_alloc_hdr(uint8_t ep, uint8_t msg_class, uint8_t msg_type)
 {
+	/* Only allocate message if not too many are already in the queue */
+	struct llist_head *head = usb_get_queue(SIMTRACE_USB_EP_CARD_DATAIN);
+	if (!head) {
+		return NULL;
+	}
+	if (llist_count(head) > 5) {
+		return NULL;
+	}
 	struct msgb *usb_msg = usb_buf_alloc(SIMTRACE_USB_EP_CARD_DATAIN);
 	if (!usb_msg) {
 		return NULL;

-- 
To view, visit https://gerrit.osmocom.org/9927
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0e447acdf757dcb5dc5c4d8b84a4235866914cad
Gerrit-Change-Number: 9927
Gerrit-PatchSet: 1
Gerrit-Owner: Kévin Redon <kredon at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180708/89207523/attachment.htm>


More information about the gerrit-log mailing list