diff mbox series

[v4,9/10] linux-generic: ipc: cannot share references across ipc

Message ID 1500580834-26476-10-git-send-email-odpbot@yandex.ru
State Superseded
Headers show
Series [v4,1/10] linux-generic: packet: restructure inline routines to use macros | expand

Commit Message

Github ODP bot July 20, 2017, 8 p.m. UTC
From: Bill Fischofer <bill.fischofer@linaro.org>


When attempting to send a reference via IPC, make a copy of the packet as
reference sharing is only supported within a single ODP instance.

Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>

---
/** Email created from pull request 82 (Bill-Fischofer-Linaro:pktrefs)
 ** https://github.com/Linaro/odp/pull/82
 ** Patch: https://github.com/Linaro/odp/pull/82.patch
 ** Base sha: 3eeb249a4774f12d2d16ca349a591654eae620ae
 ** Merge commit sha: f6e0d4b8b10f1803fb4513254c404df31e3f9f3f
 **/
 platform/linux-generic/pktio/ipc.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/platform/linux-generic/pktio/ipc.c b/platform/linux-generic/pktio/ipc.c
index bc7d7564..8c7db84e 100644
--- a/platform/linux-generic/pktio/ipc.c
+++ b/platform/linux-generic/pktio/ipc.c
@@ -592,7 +592,9 @@  static int ipc_pktio_send_lockless(pktio_entry_t *pktio_entry,
 
 	_ipc_free_ring_packets(pktio_entry, pktio_entry->s.ipc.tx.free);
 
-	/* Copy packets to shm shared pool if they are in different */
+	/* Copy packets to shm shared pool if they are in different
+	 * pool, or if they are references (we can't share across IPC).
+	 */
 	for (i = 0; i < len; i++) {
 		odp_packet_t pkt =  pkt_table[i];
 		pool_t *ipc_pool = pool_entry_from_hdl(pktio_entry->s.ipc.pool);
@@ -602,7 +604,8 @@  static int ipc_pktio_send_lockless(pktio_entry_t *pktio_entry,
 		pkt_hdr = odp_packet_hdr(pkt);
 		pool = pkt_hdr->buf_hdr.pool_ptr;
 
-		if (pool->pool_idx != ipc_pool->pool_idx) {
+		if (pool->pool_idx != ipc_pool->pool_idx ||
+		    odp_packet_has_ref(pkt)) {
 			odp_packet_t newpkt;
 
 			newpkt = odp_packet_copy(pkt, pktio_entry->s.ipc.pool);