summaryrefslogtreecommitdiff
path: root/cesar/cl
diff options
context:
space:
mode:
authorlaranjeiro2010-04-09 13:04:23 +0000
committerlaranjeiro2010-04-09 13:04:23 +0000
commit3f528edee786252c4d813479fc712368427d12ce (patch)
tree41c192b0e06da79c692f70fd32db460d419d7d45 /cesar/cl
parent88614ecf1b0cfb7a1af9e1f772b1327b53bd89b2 (diff)
cesar/cl: clear data send cache on mactotei table change, closes #1410
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@6905 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/cl')
-rw-r--r--cesar/cl/inc/cl.h7
-rw-r--r--cesar/cl/src/cl.c15
-rw-r--r--cesar/cl/src/cl_mactotei.c4
-rw-r--r--cesar/cl/test/src/send.c5
4 files changed, 27 insertions, 4 deletions
diff --git a/cesar/cl/inc/cl.h b/cesar/cl/inc/cl.h
index 2a8283a921..9a4f76e8cc 100644
--- a/cesar/cl/inc/cl.h
+++ b/cesar/cl/inc/cl.h
@@ -37,6 +37,13 @@ cl_mme_init (cl_mme_t *ctx);
uint
cl_mactotei_table_find_tei_from_mac (cl_t *cl, mac_t mac);
+/**
+ * Clear link cache.
+ * \param ctx the module context.
+ */
+void
+cl_data_send_link_clear (cl_t *ctx);
+
END_DECLS
#endif /*CL_INC_CL_H_*/
diff --git a/cesar/cl/src/cl.c b/cesar/cl/src/cl.c
index d9416f876e..ffc7aa4b91 100644
--- a/cesar/cl/src/cl.c
+++ b/cesar/cl/src/cl.c
@@ -339,10 +339,7 @@ void cl_uninit (cl_t *ctx)
/* De-initialize the local bridge table module. */
bridge_table_deinit (ctx);
- /* Release the MFS of the data_send_link context. */
- if (ctx->data_send_link.mfs)
- blk_release (ctx->data_send_link.mfs);
-
+ cl_data_send_link_clear (ctx);
cl_trace_uninit(ctx);
}
@@ -949,3 +946,13 @@ void cl_data_buffer_add (cl_t *ctx, u8 *buffer)
sar_data_buffer_add (ctx->sar, buffer);
}
+void
+cl_data_send_link_clear (cl_t *ctx)
+{
+ arch_dsr_lock ();
+ if (ctx->data_send_link.mfs)
+ blk_release (ctx->data_send_link.mfs);
+ ctx->data_send_link.mfs = NULL;
+ ctx->data_send_link.dmac = MAC_ZERO;
+ arch_dsr_unlock ();
+}
diff --git a/cesar/cl/src/cl_mactotei.c b/cesar/cl/src/cl_mactotei.c
index 74c6b51ddb..391919a449 100644
--- a/cesar/cl/src/cl_mactotei.c
+++ b/cesar/cl/src/cl_mactotei.c
@@ -104,6 +104,8 @@ cl_mactotei_release_table (cl_t *ctx)
ctx->mactotei = NULL;
/* Do the real release. */
cl_mactotei_release_table_internal (tmp);
+ /* Clear data_send_link cache. */
+ cl_data_send_link_clear (ctx);
}
void
@@ -118,6 +120,8 @@ cl_mactotei_use_table (cl_t *ctx, cl_mactotei_blk_t *table)
ctx->mactotei = mac_lookup_table_convert (table);
/* Do the real release of previous table. */
cl_mactotei_release_table_internal (tmp);
+ /* Clear data_send_link cache. */
+ cl_data_send_link_clear (ctx);
}
uint
diff --git a/cesar/cl/test/src/send.c b/cesar/cl/test/src/send.c
index acd7650e75..f520af5c34 100644
--- a/cesar/cl/test/src/send.c
+++ b/cesar/cl/test/src/send.c
@@ -16,6 +16,7 @@
#include "mac/common/timings.h"
#include "cl/test/test.h"
#include "cl/inc/context.h"
+#include "cl/inc/cl.h"
void
sar_msdu_add (sar_t *ctx, u8 *buffer, u16 length,
@@ -104,6 +105,10 @@ cl_test_case__cl_data_send_prepare (test_t test)
&expected);
}
}
+ /* Clear the cache. */
+ cl_mactotei_release_table (t.cl);
+ test_fail_unless (t.cl->data_send_link.mfs == NULL);
+ test_fail_unless (t.cl->data_send_link.dmac == MAC_ZERO);
}
test_end;
for (j = 0; j < COUNT (sta_mac); j++)