@@ -422,10 +422,15 @@ odp_pool_t odp_pool_create(const char *name,
odp_pool_param_t *params)
{
#ifdef ODP_PKTIO_IPC
- return _pool_create(name, params, ODP_SHM_PROC);
-#else
+ /* For now we do not change API to support IPC
+ * pktio. But we need to say that pool should be
+ * exported to shm. Use name prefix until there
+ * will be not API for that.
+ */
+ if (strncmp(name, "ipc_", 4) == 0)
+ return _pool_create(name, params, ODP_SHM_PROC);
+#endif
return _pool_create(name, params, 0);
-#endif
}
odp_pool_t odp_pool_lookup(const char *name)
@@ -302,7 +302,7 @@ int main(int argc, char *argv[])
params.pkt.num = SHM_PKT_POOL_SIZE;
params.type = ODP_POOL_PACKET;
- pool = odp_pool_create("packet_pool1", ¶ms);
+ pool = odp_pool_create("ipc_packet_pool1", ¶ms);
if (pool == ODP_POOL_INVALID) {
EXAMPLE_ERR("Error: packet pool create failed.\n");
exit(EXIT_FAILURE);
@@ -39,7 +39,7 @@ static int ipc_second_process(void)
params.pkt.num = SHM_PKT_POOL_SIZE;
params.type = ODP_POOL_PACKET;
- pool = odp_pool_create("packet_pool2", ¶ms);
+ pool = odp_pool_create("ipc_packet_pool2", ¶ms);
if (pool == ODP_POOL_INVALID) {
EXAMPLE_ERR("Error: packet pool create failed.\n");
exit(EXIT_FAILURE);
@@ -24,8 +24,8 @@ run()
#if test was interrupted with CTRL+c than files
#might remain in shm. Needed cleanely delete them.
rm -rf /dev/shm/ipc_pktio_* 2>&1 > /dev/null
- rm -rf /dev/shm/packet_pool1 2>&1 > /dev/null
- rm -rf /dev/shm/packet_pool2 2>&1 > /dev/null
+ rm -rf /dev/shm/ipc_packet_pool1 2>&1 > /dev/null
+ rm -rf /dev/shm/ipc_packet_pool2 2>&1 > /dev/null
echo "==== run pktio_ipc1 then pktio_ipc2 ===="
pktio_ipc1${EXEEXT} -t 30 &
@@ -40,8 +40,8 @@ run()
kill ${IPC_PID} 2>&1 > /dev/null
if [ $? -eq 0 ]; then
rm -rf /dev/shm/ipc_pktio_* 2>&1 > /dev/null
- rm -rf /dev/shm/packet_pool1 2>&1 > /dev/null
- rm -rf /dev/shm/packet_pool2 2>&1 > /dev/null
+ rm -rf /dev/shm/ipc_packet_pool1 2>&1 > /dev/null
+ rm -rf /dev/shm/ipc_packet_pool2 2>&1 > /dev/null
fi
if [ $ret -ne 0 ]; then
Make check usually works fine but if it runs several tests in parallel and each test uses the same pool name which mapped to /dev/shm/ file memory corruption can occur. This patch isolates pool sharing in shm. Because shm flags are hidden there is no other way to do it with not touching api. Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> --- platform/linux-generic/odp_pool.c | 11 ++++++++--- platform/linux-generic/test/pktio_ipc/pktio_ipc1.c | 2 +- platform/linux-generic/test/pktio_ipc/pktio_ipc2.c | 2 +- platform/linux-generic/test/pktio_ipc/pktio_ipc_run | 8 ++++---- 4 files changed, 14 insertions(+), 9 deletions(-)