summaryrefslogtreecommitdiff
path: root/cesar/hal/ipmbox
diff options
context:
space:
mode:
authorThierry Carré2012-10-16 12:45:48 +0200
committerThierry Carré2013-01-31 15:04:48 +0100
commit4452a8abe0d135b1f690b530a3bb4b1e495d7b65 (patch)
treeffa06423693d00cdaccd3d8a51d3c6c61ec2b2f3 /cesar/hal/ipmbox
parent83441de4ab01355295cfe6a6e389ad5bc66fd361 (diff)
cesar/maximus: C++ maximus refactoring, closes #3336, closes #3098
Feedback on new performance on tests inside: test_general/station Ratio = Test duration before this commit divided by new duration. |--------------------------------------------|-------| | Unit test | Ratio | |--------------------------------------------|-------| | maximus/py/sc01_long_simu.py | 6.5 | | maximus/py/sc02_long_simu.py | 4.5 | | scenario/av/py/sc01_assoc_auth.py | 3.3 | | scenario/av/py/sc02_stas_communication.py | 4.5 | | scenario/av/py/sc03_two_avln_coexisting.py | 2.1 | | scenario/av/py/sc04_cc_whoru.py | 2.1 | | scenario/av/py/sc05_cc_leave.py | 2.3 | | scenario/av/py/sc06_discover_procedure.py | 2.3 | | scenario/av/py/sc07_bridge.py | 2.2 | | scenario/av/py/sc08_bentry_change.py | 2.1 | | scenario/av/py/sc09_simple_connect.py | 2.2 | | scenario/av/py/sc10_short_messages.py | 5.7 | | scenario/av/py/sc11_cm_nw_info.py | 4.7 | | scenario/av/py/sc12_change_nmk.py | 5.5 | | scenario/av/py/sc14_igmp.py | 4.0 | | scenario/av/py/sc15_hide.py | 6.0 | | compliance/py/sc01_dut_as_a_cco.py | 5.8 | | tonemap/py/sc01_bl_initial.py | 2.3 | | tonemap/py/sc02_vs_get_tonemap.py | 2.3 | |--------------------------------------------|-------| | Average speed improvement of Maximus is | 4.9 | |--------------------------------------------|-------| Many tickets have been opened to continue the refactoring. Titles begin by "[Maximus][Refactoring]" in pessac's trac. For this reason #3336 is close. #3098 is really fixed.
Diffstat (limited to 'cesar/hal/ipmbox')
-rw-r--r--cesar/hal/ipmbox/maximus/src/maximus_ether.c18
-rw-r--r--cesar/hal/ipmbox/maximus/src/maximus_ipmbox.c1
-rw-r--r--cesar/hal/ipmbox/maximus/test/src/test_maximus_ether.c18
3 files changed, 15 insertions, 22 deletions
diff --git a/cesar/hal/ipmbox/maximus/src/maximus_ether.c b/cesar/hal/ipmbox/maximus/src/maximus_ether.c
index 1ae04b268c..ab0977f363 100644
--- a/cesar/hal/ipmbox/maximus/src/maximus_ether.c
+++ b/cesar/hal/ipmbox/maximus/src/maximus_ether.c
@@ -58,8 +58,7 @@ maximus_ether_fill_hdr (ipmbox_t *ctx, sci_msg_t *msg, u8 type, u8 flags)
else
{
/* Reserve space. */
- if ((int) sizeof (ether_msg_hdr_t) != sci_msg_push (msg,
- sizeof(ether_msg_hdr_t)))
+ if (0 > sci_msg_push (msg, sizeof(ether_msg_hdr_t)))
{
station_log (&my_station, STATION_LOG_ERROR, STATION_LOGTYPE_ETHER,
"%s: errno = %d", __FUNCTION__, errno);
@@ -104,8 +103,7 @@ maximus_ether_recv (sci_msg_t *msg, void *ipmbox)
/* Set header pointer in case of not already done. */
memcpy (&ether_hdr, msg->data_begin, sizeof (ether_msg_hdr_t));
- if ((int) sizeof (ether_msg_hdr_t) != sci_msg_pop (msg,
- sizeof (ether_msg_hdr_t)))
+ if (0 > sci_msg_pop (msg, sizeof (ether_msg_hdr_t)))
{
station_log (&my_station, STATION_LOG_ERROR, STATION_LOGTYPE_ETHER,
"%s: errno = %d", __FUNCTION__, errno);
@@ -186,7 +184,7 @@ maximus_ether_recv_data (ipmbox_t *ctx, sci_msg_t *msg)
memcpy (data, msg->data_begin, msg->length);
msg_data.buffer_addr = (u32) data;
- if ((int) msg_len != sci_msg_pop (msg, (int) msg_len))
+ if (0 > sci_msg_pop (msg, msg->length))
{
station_log(&my_station, STATION_LOG_ERROR, STATION_LOGTYPE_ETHER,
"%s: errno = %d", __FUNCTION__, errno);
@@ -258,7 +256,7 @@ maximus_ether_recv_mbx (ipmbox_t *ctx, sci_msg_t *msg)
memcpy (mme, msg->data_begin, msg->length);
msg_mbx.buffer_addr = (u32) mme;
- if ((int) msg_len != sci_msg_pop (msg, (int) msg_len))
+ if (0 > sci_msg_pop (msg, msg->length))
{
station_log (&my_station, STATION_LOG_ERROR, STATION_LOGTYPE_ETHER,
"%s: errno = %d", __FUNCTION__, errno);
@@ -332,7 +330,7 @@ maximus_ether_recv_empty_buf (ipmbox_t *ctx, sci_msg_t *msg)
/* Get requested buffer nb. */
memcpy (&buffer_nb, msg->data_begin, sizeof (u32));
- if ((int) sizeof (u32) != sci_msg_pop (msg, sizeof (u32)))
+ if (0 > sci_msg_pop (msg, sizeof (u32)))
{
station_log (&my_station, STATION_LOG_ERROR, STATION_LOGTYPE_ETHER,
"%s: errno = %d", __FUNCTION__, errno);
@@ -366,7 +364,7 @@ maximus_ether_recv_empty_buf (ipmbox_t *ctx, sci_msg_t *msg)
/* Get buffer id. */
memcpy (&buffer_id, msg->data_begin, sizeof (u32));
- if ((int) sizeof (u32) != sci_msg_pop (msg, sizeof (u32)))
+ if (0 > sci_msg_pop (msg, sizeof (u32)))
{
station_log (&my_station, STATION_LOG_ERROR,
STATION_LOGTYPE_ETHER, "%s: errno = %d",
@@ -443,7 +441,7 @@ maximus_ether_send (ipmbox_t *ctx, u8 type, u8 flags, uint data_length,
else
{
/* Fill sci data. */
- if ((int) data_length != sci_msg_push (&msg, data_length))
+ if (0 > sci_msg_push (&msg, data_length))
{
station_log (&my_station, STATION_LOG_ERROR,
STATION_LOGTYPE_ETHER, "%s: errno = %d",
@@ -469,7 +467,7 @@ maximus_ether_send (ipmbox_t *ctx, u8 type, u8 flags, uint data_length,
else
{
/* Send the message. */
- if (msg.length != sci_send (my_station.sci, &msg))
+ if (0 > sci_send (my_station.sci, &msg))
{
station_log (&my_station, STATION_LOG_ERROR,
STATION_LOGTYPE_ETHER, "%s: errno = %d",
diff --git a/cesar/hal/ipmbox/maximus/src/maximus_ipmbox.c b/cesar/hal/ipmbox/maximus/src/maximus_ipmbox.c
index 3418256536..325760cee8 100644
--- a/cesar/hal/ipmbox/maximus/src/maximus_ipmbox.c
+++ b/cesar/hal/ipmbox/maximus/src/maximus_ipmbox.c
@@ -499,4 +499,5 @@ uint
ipmbox_rx_sync (ipmbox_t *ctx, const u32 **first_msg)
{
dbg_assert_print (false, "NOT IMPLEMENTED");
+ return 0;
}
diff --git a/cesar/hal/ipmbox/maximus/test/src/test_maximus_ether.c b/cesar/hal/ipmbox/maximus/test/src/test_maximus_ether.c
index 3e6b602fbd..7124f11465 100644
--- a/cesar/hal/ipmbox/maximus/test/src/test_maximus_ether.c
+++ b/cesar/hal/ipmbox/maximus/test/src/test_maximus_ether.c
@@ -196,8 +196,7 @@ maximus_ether_recv_test_case (test_t t)
{
data[i] = (u8) i;
}
- test_fail_unless (((int) data_length == sci_msg_push (&msg,
- data_length))
+ test_fail_unless (0 <= sci_msg_push (&msg, data_length)
&& (EINVAL != errno)
&& (ENOSPC != errno));
memcpy (msg.data_begin, data, data_length);
@@ -207,22 +206,19 @@ maximus_ether_recv_test_case (test_t t)
{
for (buf_id = total_buf_nb; buf_id > 0; buf_id--)
{
- test_fail_unless (((int) sizeof (u32) == sci_msg_push (&msg,
- sizeof(u32)))
+ test_fail_unless (0 <= sci_msg_push (&msg, sizeof (u32))
&& (EINVAL != errno)
&& (ENOSPC != errno));
memcpy (msg.data_begin, &buf_id, sizeof (u32));
}
- test_fail_unless (((int) sizeof (u32) == sci_msg_push (&msg,
- sizeof(u32)))
+ test_fail_unless (0 <= sci_msg_push (&msg, sizeof (u32))
&& (EINVAL != errno)
&& (ENOSPC != errno));
memcpy (msg.data_begin, &total_buf_nb, sizeof (u32));
}
/* Fill ether header. */
- test_fail_unless (((int) sizeof (ether_msg_hdr_t) == \
- sci_msg_push (&msg, sizeof (ether_msg_hdr_t)))
+ test_fail_unless (0 <= sci_msg_push (&msg, sizeof (ether_msg_hdr_t))
&& (EINVAL != errno)
&& (ENOSPC != errno));
memcpy (msg.data_begin, &ether_hdr, sizeof (ether_msg_hdr_t));
@@ -393,8 +389,7 @@ maximus_ether_recv_test_case (test_t t)
ether_hdr.type = ETHERNET_TYPE_NONE;
/* Fill ether header. */
- test_fail_unless (((int) sizeof (ether_msg_hdr_t) == sci_msg_push (&msg,
- sizeof (ether_msg_hdr_t)))
+ test_fail_unless (0 <= sci_msg_push (&msg, sizeof (ether_msg_hdr_t))
&& (EINVAL != errno)
&& (ENOSPC != errno));
memcpy (msg.data_begin, &ether_hdr, sizeof (ether_msg_hdr_t));
@@ -420,8 +415,7 @@ maximus_ether_recv_test_case (test_t t)
ether_hdr.type = ETHERNET_TYPE_BUFFER_RELEASED;
/* Fill ether header. */
- test_fail_unless (((int) sizeof (ether_msg_hdr_t) == sci_msg_push (&msg,
- sizeof (ether_msg_hdr_t)))
+ test_fail_unless (0 <= sci_msg_push (&msg, sizeof (ether_msg_hdr_t))
&& (EINVAL != errno)
&& (ENOSPC != errno));
memcpy (msg.data_begin, &ether_hdr, sizeof (ether_msg_hdr_t));