Change in libosmocore[master]: ns2: Properly report packet drops in FR code

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/.

laforge gerrit-no-reply at lists.osmocom.org
Mon Feb 1 08:32:17 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/22559 )

Change subject: ns2: Properly report packet drops in FR code
......................................................................

ns2: Properly report packet drops in FR code

When the FR code decides to drop a packet (ENOBUFS from the AF_PACKET
socket for non-signaling packet), let's report that back via the
frame_relay code into the generic NS2 code.

This way the generic NS2 code always knows if a packet was actually
successfully  transmitted, or if it was dropped for some reason.

Change-Id: I4bb517fd04af69dbe6da628b132d57994ab3e5a4
---
M src/gb/gprs_ns2_fr.c
1 file changed, 7 insertions(+), 6 deletions(-)

Approvals:
  Jenkins Builder: Verified
  lynxis lazus: Looks good to me, approved



diff --git a/src/gb/gprs_ns2_fr.c b/src/gb/gprs_ns2_fr.c
index 4bd9ff1..9de2b06 100644
--- a/src/gb/gprs_ns2_fr.c
+++ b/src/gb/gprs_ns2_fr.c
@@ -340,7 +340,7 @@
 #define LMI_Q933A_DLCI 0
 
 /* enqueue to backlog (LMI, signaling) or drop (userdata msg) */
-static void backlog_enqueue_or_free(struct gprs_ns2_vc_bind *bind, struct msgb *msg)
+static int backlog_enqueue_or_free(struct gprs_ns2_vc_bind *bind, struct msgb *msg)
 {
 	uint8_t dlci = msg->data[0];
 	uint8_t ns_pdu_type;
@@ -354,7 +354,7 @@
 	case LMI_Q933A_DLCI:
 		/* enqueue Q.933 LMI at head of queue */
 		enqueue_at_head(bind, msg);
-		return;
+		return 0;
 	default:
 		if (msgb_length(msg) < 3)
 			break;
@@ -367,13 +367,13 @@
 			/* enqueue BVCI=0 traffic at tail of queue */
 			if (bvci == BVCI_SIGNALLING) {
 				enqueue_at_tail(bind, msg);
-				return;
+				return 0;
 			}
 			break;
 		default:
 			/* enqueue NS signaling traffic at head of queue */
 			enqueue_at_head(bind, msg);
-			return;
+			return 0;
 		}
 		break;
 	}
@@ -381,6 +381,7 @@
 out_free:
 	/* drop everything that is not LMI, NS-signaling or BVCI-0 */
 	msgb_free(msg);
+	return -1;
 }
 
 static void fr_backlog_timer_cb(void *data)
@@ -420,11 +421,11 @@
 		rc = fr_netif_write_one(bind, msg);
 		if (rc < 0) {
 			/* enqueue to backlog in case it fails */
-			backlog_enqueue_or_free(bind, msg);
+			return backlog_enqueue_or_free(bind, msg);
 		}
 	} else {
 		/* enqueue to backlog */
-		backlog_enqueue_or_free(bind, msg);
+		return backlog_enqueue_or_free(bind, msg);
 	}
 
 	return 0;

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I4bb517fd04af69dbe6da628b132d57994ab3e5a4
Gerrit-Change-Number: 22559
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210201/079149fa/attachment.htm>


More information about the gerrit-log mailing list