summaryrefslogtreecommitdiff
path: root/cesar/mac/sar/src/sar.c
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/mac/sar/src/sar.c')
-rw-r--r--cesar/mac/sar/src/sar.c57
1 files changed, 14 insertions, 43 deletions
diff --git a/cesar/mac/sar/src/sar.c b/cesar/mac/sar/src/sar.c
index dae1867901..2dc34653b1 100644
--- a/cesar/mac/sar/src/sar.c
+++ b/cesar/mac/sar/src/sar.c
@@ -1695,47 +1695,6 @@ sar_rx_upper_layer_transmit_data (sar_t *sar_ctx, sar_reassembly_ctx_t *ctx)
}
}
-void ARCH_ILRAM
-sar_tx_mac_framing__take_last_pb (sar_t *ctx, sar_msdu_t *md_data,
- sar_job_mfs_t *job_mfs)
-{
- dbg_assert (ctx);
- dbg_assert (md_data);
- dbg_assert (job_mfs);
-
- job_mfs->pb_last_taken = false;
- if (md_data->mfs->last_seg_offset != 0)
- {
- int pending_seg_nb = md_data->mfs->pending_seg_nb;
- pb_t *last = pbproc_mfs_extract_tail (md_data->mfs);
- if (last)
- {
- if ((u16)(last->header.ssn + 1) == md_data->mfs->next_ssn)
- {
- job_mfs->job.first_pb_desc = (blk_t*) last;
- job_mfs->pb_last_taken = true;
- /* Add a reference on the PB. */
- blk_addref_desc (job_mfs->job.first_pb_desc);
- last->expiration_ntb = md_data->arrival_ntb
- + md_data->mfs->common.expiration_delay_tck;
- }
- else
- {
- /* Give back the taken segment to the PBproc only if the
- * PBProc owns it. */
- if (!pending_seg_nb)
- pbproc_mfs_provide (md_data->mfs, 1);
-
- md_data->mfs->last_seg_offset = 0;
- }
- }
- else
- md_data->mfs->last_seg_offset = 0;
- }
- else
- md_data->mfs->last_seg_offset = 0;
-}
-
void
sar_tx_mac_framing (sar_t *ctx, sar_msdu_t *md_data)
{
@@ -1748,9 +1707,21 @@ sar_tx_mac_framing (sar_t *ctx, sar_msdu_t *md_data)
/* initialise the job descriptor. */
ctx->job_tx->mfs = (mfs_t *) md_data->mfs;
ctx->job_tx->user_data = md_data->user_data;
- ctx->job_tx->job.first_pb_desc = NULL;
+ ctx->job_tx->pb_last_taken = false;
/* Take the last PB from the MFS if possible. */
- sar_tx_mac_framing__take_last_pb (ctx, md_data, ctx->job_tx);
+ if ((ctx->job_tx->job.first_pb_desc =
+ (blk_t*) pbproc_mfs_extract_tail (md_data->mfs)))
+ {
+ ctx->job_tx->pb_last_taken = true;
+ /* Add a reference on the PB. */
+ blk_addref_desc (ctx->job_tx->job.first_pb_desc);
+ ((pb_t*) ctx->job_tx->job.first_pb_desc)->expiration_ntb =
+ md_data->arrival_ntb + md_data->mfs->common.expiration_delay_tck;
+ }
+ dbg_assert ((ctx->job_tx->job.first_pb_desc == NULL
+ && ctx->job_tx->mfs->tx.last_seg_offset == 0)
+ || (ctx->job_tx->job.first_pb_desc
+ && ctx->job_tx->mfs->tx.last_seg_offset != 0));
/* Create the job for the Bridge DMA
* Fill the job and create allocate the PBs necessary to stock the MF
* contained in the md_data