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

2018-07-11 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
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(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/firmware/libcommon/source/sniffer.c 
b/firmware/libcommon/source/sniffer.c
index 1c691af..0ca71a5 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: merged
Gerrit-Change-Id: I0e447acdf757dcb5dc5c4d8b84a4235866914cad
Gerrit-Change-Number: 9927
Gerrit-PatchSet: 6
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


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

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9927 )

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


Patch Set 5: Code-Review+2


--
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: comment
Gerrit-Change-Id: I0e447acdf757dcb5dc5c4d8b84a4235866914cad
Gerrit-Change-Number: 9927
Gerrit-PatchSet: 5
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 11 Jul 2018 19:55:44 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


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

2018-07-11 Thread Kévin Redon
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/9927

to look at the new patch set (#5).

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/5
--
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: newpatchset
Gerrit-Change-Id: I0e447acdf757dcb5dc5c4d8b84a4235866914cad
Gerrit-Change-Number: 9927
Gerrit-PatchSet: 5
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Jenkins Builder


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

2018-07-08 Thread Kévin Redon
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