summaryrefslogtreecommitdiff
path: root/cesar/mac/sar/test/utest/host/src/segmentation.c
diff options
context:
space:
mode:
authorNicolas Schodet2012-08-27 13:08:04 +0200
committerNicolas Schodet2012-08-27 13:08:04 +0200
commit45494a752e1d2281a1dc136ae4890128817d8cd0 (patch)
tree0cc89f1a69e7a5c340906da597460b317ad721b0 /cesar/mac/sar/test/utest/host/src/segmentation.c
parent6a4e75cafcb754f8bd11fa8be5d69ab028ce014c (diff)
parent5c37d533c836ce90df9c67b546947fe2200baa2b (diff)
Merge branch 'qos'
Diffstat (limited to 'cesar/mac/sar/test/utest/host/src/segmentation.c')
-rw-r--r--cesar/mac/sar/test/utest/host/src/segmentation.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/cesar/mac/sar/test/utest/host/src/segmentation.c b/cesar/mac/sar/test/utest/host/src/segmentation.c
index dfd0947f09..72f2b223c9 100644
--- a/cesar/mac/sar/test/utest/host/src/segmentation.c
+++ b/cesar/mac/sar/test/utest/host/src/segmentation.c
@@ -312,6 +312,48 @@ test_case_segmentation_em_max_pb_allowed (test_t test)
}
void
+test_case_segmentation_mfs_tx_max_seg_nb_test (test_t test, sar_test_t ctx,
+ mfs_tx_t *mfs)
+{
+ u8 *buffer = NULL;
+ test_within (test);
+ buffer = bufmgr_get (ctx.sar->bufmgr);
+ sar_msdu_process (ctx.sar, buffer, ETH_PACKET_MIN_SIZE_ALLOWED, mfs,
+ 0x0);
+ sar_bridge_dma_free_head (ctx.sar);
+ test_fail_unless (mfs->seg_nb == mfs_tx_max_seg_nb);
+ bufmgr_give_back (ctx.sar->bufmgr, buffer);
+}
+
+void
+test_case_segmentation_mfs_tx_max_seg_nb (test_t test)
+{
+ sar_test_t ctx;
+ bool added;
+ test_case_begin (test, "Test mfs_tx_max_seg_nb");
+ sar_test_init (&ctx, INVALID_PTR, INVALID_PTR);
+ mfs_tx_t *mfs = mac_store_mfs_add_tx (ctx.mac_store, false, false, 1,
+ 1, &added);
+ sar_activate (ctx.sar, true);
+ test_begin (test, "less than limit")
+ {
+ mfs->seg_nb = mfs_tx_max_seg_nb - 1;
+ test_case_segmentation_mfs_tx_max_seg_nb_test (test, ctx, mfs);
+ }
+ test_end;
+ test_begin (test, "more than limit")
+ {
+ mfs->seg_nb = mfs_tx_max_seg_nb;
+ test_case_segmentation_mfs_tx_max_seg_nb_test (test, ctx, mfs);
+ }
+ test_end;
+ sar_mfs_remove (ctx.sar, PARENT_OF (mfs_t, tx, mfs));
+ blk_release (mfs);
+ sar_sta_remove (ctx.sar, 1);
+ sar_test_uninit (&ctx);
+}
+
+void
test_suite_segmentation (test_t test)
{
test_suite_begin (test, "Segmentation");
@@ -320,6 +362,7 @@ test_suite_segmentation (test_t test)
test_case_segmentation (test);
test_case_segmentation_mfs_release (test);
test_case_segmentation_em_max_pb_allowed (test);
+ test_case_segmentation_mfs_tx_max_seg_nb (test);
test_begin (test, "Memory")
{