summaryrefslogtreecommitdiff
path: root/cesar/cl
diff options
context:
space:
mode:
authorAleksandar Cecaric2011-10-18 10:09:43 +0200
committerAleksandar Cecaric2011-10-18 10:09:43 +0200
commit652fe7afa35ee9dcdcf59090b0d6ee7472ff39e5 (patch)
tree8210a3e9216c858681f3b5910a60c42ab2b57d43 /cesar/cl
parent572d57302cb0163ffa7a185a02588a72fbc56636 (diff)
parenta6bea4a24e98365390e1a5e6b1e8ebc98b1a20f4 (diff)
Merge commit 'av-1.1.11' into eoc
Conflicts: cesar/bsu/inc/context.h cesar/bsu/ntb/ntb.h cesar/bsu/ntb/src/ntb.c cesar/bsu/ntb/test/utest/src/ntb_compute.c cesar/bsu/src/bsu.c cesar/cp/sta/mgr/test/src/sta_mgr.c cesar/hal/phy/src/phy.c cesar/mac/pbproc/src/fsm_rx_sound.c cesar/mac/pbproc/src/fsm_tx_sound.c cesar/mac/pbproc/src/prep_mpdu.c cesar/mac/pbproc/test/int/sparc-Config cesar/station/src/station.c cleopatre/devkit/plcdrv/arm/inc/linux_drv.h cleopatre/linux-2.6.25.10-spc300/drivers/net/arm/synop3504.c
Diffstat (limited to 'cesar/cl')
-rw-r--r--cesar/cl/inc/context.h4
-rw-r--r--cesar/cl/inc/trace.h1
-rw-r--r--cesar/cl/src/bridge_table.c14
-rw-r--r--cesar/cl/src/cl.c27
-rw-r--r--cesar/cl/src/trace.c2
5 files changed, 40 insertions, 8 deletions
diff --git a/cesar/cl/inc/context.h b/cesar/cl/inc/context.h
index 662e56118f..965a190ccd 100644
--- a/cesar/cl/inc/context.h
+++ b/cesar/cl/inc/context.h
@@ -17,6 +17,7 @@
#include "common/defs/ethernet.h"
#include "lib/slab.h"
+#include "lib/seq_check.h"
#include "mac/common/mfs.h"
#include "mac/common/store.h"
#include "mac/common/config.h"
@@ -171,6 +172,9 @@ struct cl_t
/** cl Trace */
trace_buffer_t trace;
#endif /* !CONFIG_TRACE */
+#if CONFIG_SEQ_CHECK
+ lib_seq_check_t seq_check_rx_ctx;
+#endif
};
#endif /* CL_INC_CONTEXT_H_ */
diff --git a/cesar/cl/inc/trace.h b/cesar/cl/inc/trace.h
index e312a292f6..7192677e7c 100644
--- a/cesar/cl/inc/trace.h
+++ b/cesar/cl/inc/trace.h
@@ -47,6 +47,7 @@ enum
CL_TRACE_DATA_RECV,
CL_TRACE_DATA_BUFFER_ADD,
CL_TRACE_BRIDGE_ADD,
+ CL_TRACE_SEQ_CHECK,
};
BEGIN_DECLS
diff --git a/cesar/cl/src/bridge_table.c b/cesar/cl/src/bridge_table.c
index 94d96f0cc2..c5bd352e6b 100644
--- a/cesar/cl/src/bridge_table.c
+++ b/cesar/cl/src/bridge_table.c
@@ -146,12 +146,11 @@ bridge_table_update (cl_t *ctx)
/* The temporary local bridge is now empty. */
ctx->bridge_table.table_tmp_entry_count = 0;
- /* Remove old table. */
- if (ctx->bridge_table.table)
- mac_lookup_table_release (ctx->bridge_table.table);
-
- /* Affect new local bridge table. */
+ /* Atomically replace local bridge table. */
+ mac_lookup_table_t *old_table = ctx->bridge_table.table;
ctx->bridge_table.table = mac_lookup_table_convert (new_bridge_table);
+ if (old_table)
+ mac_lookup_table_release (old_table);
/* Bridge table has been modified. */
return true;
@@ -173,12 +172,11 @@ bridge_table_update (cl_t *ctx)
0xFFFF,
ctx->bridge_table.cycle_counter);
- /* Remove old table. */
- mac_lookup_table_release (ctx->bridge_table.table);
-
/* Affect new local bridge table. */
+ mac_lookup_table_t *old_table = ctx->bridge_table.table;
ctx->bridge_table.table
= mac_lookup_table_convert (new_bridge_table);
+ mac_lookup_table_release (old_table);
/* Bridge table has been modified. */
return true;
diff --git a/cesar/cl/src/cl.c b/cesar/cl/src/cl.c
index fc6b7d22bb..11d721149f 100644
--- a/cesar/cl/src/cl.c
+++ b/cesar/cl/src/cl.c
@@ -15,6 +15,7 @@
#include "common/std.h"
#include "common/defs/ethernet.h"
#include "lib/bitstream.h"
+#include "lib/seq_check.h"
#include "config/cl.h"
#include "cl/cl.h"
@@ -42,6 +43,26 @@
static struct cl_t cl_global;
/**
+ * Callback when the lib sequencer detect a wrong sequencing.
+ * \param user user data
+ * \param vlan the VLAN id
+ * \param seq_expected the sequence number expected
+ * \param seq_actual the actual sequence number found in the packet
+ */
+void
+cl_lib_seq_check_cb (void *user, uint vlan, uint seq_expected,
+ uint seq_actual);
+
+void
+cl_lib_seq_check_cb (void *user, uint vlan, uint seq_expected,
+ uint seq_actual)
+{
+ dbg_assert (user);
+ trace_do (cl_t *ctx = (cl_t *) user);
+ CL_TRACE (SEQ_CHECK, vlan, seq_expected, seq_actual);
+}
+
+/**
* Search for the lid in the classifier
*
* \param ctx CL context
@@ -324,6 +345,9 @@ cl_init (mac_store_t *mac_store, sar_t *sar, mac_config_t *mac_config)
CL_TRACE (INIT, phy_date ());
+ /* Initialise packet sequence check. */
+ lib_seq_check_init (&ctx->seq_check_rx_ctx, cl_lib_seq_check_cb, ctx);
+
/* Debug leds. */
GPIO_SETUP (LED_CL_RX, GPIO_DIRECTION_OUT);
GPIO_SET (LED_CL_RX, 0);
@@ -985,6 +1009,9 @@ void cl_data_recv (cl_t *ctx, u8 *buffer, uint length, mfs_rx_t *mfs)
&& (length <= ETH_PACKET_MAX_SIZE));
dbg_assert (mfs);
+ /* Check sequence number of throughput. */
+ lib_seq_check_packet (&ctx->seq_check_rx_ctx, buffer, length);
+
dbg_assert (ctx->data_rx.cb);
mac_t smac, dmac;
bitstream_direct_read_macs (buffer, &dmac, &smac);
diff --git a/cesar/cl/src/trace.c b/cesar/cl/src/trace.c
index 9ad0392a54..758caa7561 100644
--- a/cesar/cl/src/trace.c
+++ b/cesar/cl/src/trace.c
@@ -52,6 +52,8 @@ cl_trace_init (cl_t *ctx)
TRACE_EVENT (CL_TRACE_DATA_RECV, "CL_DATA_RECV buffer @ : %x, destination : %m, source : %m, length : %d", TIMESTAMP),
TRACE_EVENT (CL_TRACE_DATA_BUFFER_ADD, "CL_DATA_BUFFER_ADD buffer @ : %x", TIMESTAMP),
TRACE_EVENT (CL_TRACE_BRIDGE_ADD, "Bridging MAC %m"),
+ TRACE_EVENT (CL_TRACE_SEQ_CHECK, "[SeqCheck] input from PLC: "
+ "[%02d] expected=%04X, actual=%04X"),
};
dbg_assert (ctx);
trace_namespace_init (&namespace, event_ids, COUNT (event_ids));