git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
pci: rework interrupt handling
[dpdk.git]
/
app
/
test
/
test_interrupts.c
diff --git
a/app/test/test_interrupts.c
b/app/test/test_interrupts.c
index
f16cf5a
..
c810c15
100644
(file)
--- a/
app/test/test_interrupts.c
+++ b/
app/test/test_interrupts.c
@@
-171,13
+171,16
@@
static void
test_interrupt_callback(struct rte_intr_handle *intr_handle, void *arg)
{
if (test_interrupt_handle_sanity_check(intr_handle) < 0) {
test_interrupt_callback(struct rte_intr_handle *intr_handle, void *arg)
{
if (test_interrupt_handle_sanity_check(intr_handle) < 0) {
- printf("null or invalid intr_handle for %s\n", __FUNCTION__);
+ printf("null or invalid intr_handle for %s\n", __func__);
+ flag = -1;
return;
}
if (rte_intr_callback_unregister(intr_handle,
return;
}
if (rte_intr_callback_unregister(intr_handle,
- test_interrupt_callback, arg) <= 0) {
- printf("fail to unregister callback\n");
+ test_interrupt_callback, arg) >= 0) {
+ printf("%s: unexpectedly able to unregister itself\n",
+ __func__);
+ flag = -1;
return;
}
return;
}
@@
-188,15
+191,12
@@
test_interrupt_callback(struct rte_intr_handle *intr_handle, void *arg)
}
static void
}
static void
-test_interrupt_callback_1(struct rte_intr_handle *intr_handle, void *arg)
+test_interrupt_callback_1(struct rte_intr_handle *intr_handle,
+ __attribute__((unused)) void *arg)
{
if (test_interrupt_handle_sanity_check(intr_handle) < 0) {
{
if (test_interrupt_handle_sanity_check(intr_handle) < 0) {
- printf("null or invalid intr_handle for %s\n", __FUNCTION__);
- return;
- }
- if (rte_intr_callback_unregister(intr_handle,
- test_interrupt_callback_1, arg) <= 0) {
- printf("fail to unregister callback\n");
+ printf("null or invalid intr_handle for %s\n", __func__);
+ flag = -1;
return;
}
}
return;
}
}
@@
-281,7
+281,7
@@
test_interrupt_disable(void)
int
test_interrupt(void)
{
int
test_interrupt(void)
{
- int count
= 0, ret = -1
;
+ int count
, ret
;
struct rte_intr_handle test_intr_handle;
if (test_interrupt_init() < 0) {
struct rte_intr_handle test_intr_handle;
if (test_interrupt_init() < 0) {
@@
-291,6
+291,8
@@
test_interrupt(void)
printf("check if callback registered can be called\n");
printf("check if callback registered can be called\n");
+ ret = -1;
+
/* check if callback registered can be called */
flag = 0;
test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID];
/* check if callback registered can be called */
flag = 0;
test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID];
@@
-305,13
+307,28
@@
test_interrupt(void)
goto out;
}
/* check flag in 3 seconds */
goto out;
}
/* check flag in 3 seconds */
-
while (flag == 0 && count++ < 3
)
+
for (count = 0; flag == 0 && count < 3; count++
)
rte_delay_ms(TEST_INTERRUPT_CHECK_INTERVAL);
rte_delay_ms(TEST_INTERRUPT_CHECK_INTERVAL);
+
+ rte_delay_ms(TEST_INTERRUPT_CHECK_INTERVAL);
+
+ if ((ret = rte_intr_callback_unregister(&test_intr_handle,
+ test_interrupt_callback, NULL)) < 0) {
+ printf("rte_intr_callback_unregister() failed with error "
+ "code: %d\n", ret);
+ goto out;
+ }
+
+ ret = -1;
+
if (flag == 0) {
printf("registered callback has not been called\n");
goto out;
if (flag == 0) {
printf("registered callback has not been called\n");
goto out;
+ } else if (flag < 0) {
+ printf("registered callback failed\n");
+ ret = flag;
+ goto out;
}
}
- rte_delay_ms(1000);
printf("start register/unregister test\n");
printf("start register/unregister test\n");
@@
-386,18
+403,18
@@
test_interrupt(void)
"for all\n");
goto out;
}
"for all\n");
goto out;
}
- rte_delay_ms(
1000
);
+ rte_delay_ms(
TEST_INTERRUPT_CHECK_INTERVAL
);
printf("start interrupt enable/disable test\n");
/* check interrupt enable/disable functions */
if (test_interrupt_enable() < 0)
goto out;
printf("start interrupt enable/disable test\n");
/* check interrupt enable/disable functions */
if (test_interrupt_enable() < 0)
goto out;
- rte_delay_ms(
1000
);
+ rte_delay_ms(
TEST_INTERRUPT_CHECK_INTERVAL
);
if (test_interrupt_disable() < 0)
goto out;
if (test_interrupt_disable() < 0)
goto out;
- rte_delay_ms(
1000
);
+ rte_delay_ms(
TEST_INTERRUPT_CHECK_INTERVAL
);
ret = 0;
ret = 0;
@@
-409,7
+426,7
@@
out:
rte_intr_callback_unregister(&test_intr_handle,
test_interrupt_callback_1, (void *)-1);
rte_intr_callback_unregister(&test_intr_handle,
test_interrupt_callback_1, (void *)-1);
- rte_delay_ms(2
000
);
+ rte_delay_ms(2
* TEST_INTERRUPT_CHECK_INTERVAL
);
/* deinit */
test_interrupt_deinit();
/* deinit */
test_interrupt_deinit();