From patchwork Tue Jul 21 14:23:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pablo Neira Ayuso X-Patchwork-Id: 498243 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.osmocom.org (unknown [IPv6:2a01:4f8:191:444b::2:7]) by ozlabs.org (Postfix) with ESMTP id 8A107140E19 for ; Wed, 22 Jul 2015 00:24:45 +1000 (AEST) Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by lists.osmocom.org (Postfix) with ESMTP id 7FD69841A; Tue, 21 Jul 2015 14:24:43 +0000 (UTC) X-Original-To: openbsc@lists.osmocom.org Delivered-To: openbsc@lists.osmocom.org Received: from mail.us.es (mail.us.es [193.147.175.20]) by lists.osmocom.org (Postfix) with ESMTP id 8A79883F7 for ; Tue, 21 Jul 2015 14:24:42 +0000 (UTC) Received: (qmail 7749 invoked from network); 21 Jul 2015 16:18:01 +0200 Received: from unknown (HELO us.es) (192.168.2.12) by us.es with SMTP; 21 Jul 2015 16:18:01 +0200 Received: (qmail 3793 invoked by uid 507); 21 Jul 2015 14:18:01 -0000 X-Qmail-Scanner-Diagnostics: from 127.0.0.1 by antivirus2 (envelope-from , uid 501) with qmail-scanner-2.10 (clamdscan: 0.98.7/20703. spamassassin: 3.4.0. Clear:RC:1(127.0.0.1):SA:0(-103.2/7.5):. Processed in 1.821708 secs); 21 Jul 2015 14:18:01 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on antivirus2 X-Spam-Level: X-Spam-Status: No, score=-103.2 required=7.5 tests=BAYES_50,SMTPAUTH_US, USER_IN_WHITELIST autolearn=disabled version=3.4.0 X-Spam-ASN: AS12715 87.216.0.0/16 X-Envelope-From: pablo@gnumonks.org Received: from unknown (HELO antivirus2) (127.0.0.1) by us.es with SMTP; 21 Jul 2015 14:17:59 -0000 Received: from 192.168.1.13 (192.168.1.13) by antivirus2 (F-Secure/fsigk_smtp/412/antivirus2); Tue, 21 Jul 2015 16:17:59 +0200 (CEST) X-Virus-Status: clean(F-Secure/fsigk_smtp/412/antivirus2) Received: (qmail 12729 invoked from network); 21 Jul 2015 16:17:59 +0200 Received: from 129.166.216.87.static.jazztel.es (HELO salvia.here) (pneira@us.es@87.216.166.129) by mail.us.es with SMTP; 21 Jul 2015 16:17:59 +0200 From: pablo@gnumonks.org To: openbsc@lists.osmocom.org Subject: [PATCH libosmo-netif 06/18] osmux: pass up struct osmux_batch Date: Tue, 21 Jul 2015 16:23:21 +0200 Message-Id: <1437488613-3943-7-git-send-email-pablo@gnumonks.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1437488613-3943-1-git-send-email-pablo@gnumonks.org> References: <1437488613-3943-1-git-send-email-pablo@gnumonks.org> X-BeenThere: openbsc@lists.osmocom.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Development of the OpenBSC GSM base station controller List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openbsc-bounces@lists.osmocom.org Sender: "OpenBSC" From: Pablo Neira Ayuso Instead of struct osmux_in_handle. This object contains the internal batching state information. --- src/osmux.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/osmux.c b/src/osmux.c index 187ca1c..bd400f6 100644 --- a/src/osmux.c +++ b/src/osmux.c @@ -231,10 +231,9 @@ struct osmux_input_state { int add_osmux_hdr; }; -static int osmux_batch_put(struct osmux_in_handle *h, +static int osmux_batch_put(struct osmux_batch *batch, struct osmux_input_state *state) { - struct osmux_batch *batch = (struct osmux_batch *)h->internal_data; struct osmux_hdr *osmuxh; if (state->add_osmux_hdr) { @@ -268,7 +267,7 @@ static int osmux_batch_put(struct osmux_in_handle *h, return 0; } -static int osmux_xfrm_encode_amr(struct osmux_in_handle *h, +static int osmux_xfrm_encode_amr(struct osmux_batch *batch, struct osmux_input_state *state) { uint32_t amr_len; @@ -279,23 +278,23 @@ static int osmux_xfrm_encode_amr(struct osmux_in_handle *h, state->amr_payload_len = amr_len - sizeof(struct amr_hdr); - if (osmux_batch_put(h, state) < 0) + if (osmux_batch_put(batch, state) < 0) return -1; return 0; } -static struct msgb *osmux_build_batch(struct osmux_in_handle *h) +static struct msgb *osmux_build_batch(struct osmux_batch *batch, + uint32_t batch_size) { struct msgb *batch_msg; struct osmux_circuit *circuit, *next; - struct osmux_batch *batch = (struct osmux_batch *)h->internal_data; #ifdef DEBUG_MSG LOGP(DLMIB, LOGL_DEBUG, "Now building batch\n"); #endif - batch_msg = msgb_alloc(h->batch_size, "osmux"); + batch_msg = msgb_alloc(batch_size, "osmux"); if (batch_msg == NULL) { LOGP(DLMIB, LOGL_ERROR, "Not enough memory\n"); return NULL; @@ -330,7 +329,7 @@ static struct msgb *osmux_build_batch(struct osmux_in_handle *h) state.add_osmux_hdr = 1; } - osmux_xfrm_encode_amr(h, &state); + osmux_xfrm_encode_amr(batch, &state); osmux_batch_dequeue(cur, circuit); msgb_free(cur); ctr++; @@ -349,7 +348,7 @@ void osmux_xfrm_input_deliver(struct osmux_in_handle *h) #ifdef DEBUG_MSG LOGP(DLMIB, LOGL_DEBUG, "invoking delivery function\n"); #endif - batch_msg = osmux_build_batch(h); + batch_msg = osmux_build_batch(batch, h->batch_size); h->stats.output_osmux_msgs++; h->stats.output_osmux_bytes += batch_msg->len;