aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2021-01-30 22:03:26 +0100
committerHarald Welte <laforge@osmocom.org>2021-01-31 12:34:36 +0100
commit5e0ef6f95858160a9a69633461d98d8aa11a9fb3 (patch)
treee7bc9984bf5683e7c6649bf64a0d9a7c7849c2b8 /src
parente5f55f73bd4e2fed1691394bfc30cb4082c21587 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/gb/gprs_ns2_fr.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/gb/gprs_ns2_fr.c b/src/gb/gprs_ns2_fr.c
index 4bd9ff11..9de2b060 100644
--- a/src/gb/gprs_ns2_fr.c
+++ b/src/gb/gprs_ns2_fr.c
@@ -340,7 +340,7 @@ static void enqueue_at_tail(struct gprs_ns2_vc_bind *bind, struct msgb *msg)
#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 @@ static void backlog_enqueue_or_free(struct gprs_ns2_vc_bind *bind, struct msgb *
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 @@ static void backlog_enqueue_or_free(struct gprs_ns2_vc_bind *bind, struct msgb *
/* 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 @@ static void backlog_enqueue_or_free(struct gprs_ns2_vc_bind *bind, struct msgb *
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 @@ int fr_tx_cb(void *data, struct msgb *msg)
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;