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

Message ID 1501599610-28388-10-git-send-email-odpbot@yandex.ru
State New
Headers show
Series
  • [v3,1/10] linux-generic: packet: restructure inline routines to use macros
Related show

Commit Message

Github ODP bot Aug. 1, 2017, 3 p.m.
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 90 (Bill-Fischofer-Linaro:pktrefs)
 ** https://github.com/Linaro/odp/pull/90
 ** Patch: https://github.com/Linaro/odp/pull/90.patch
 ** Base sha: bb0ca193f8c28036fdf8b3d6c8aa5d4f11980e6c
 ** Merge commit sha: dfef320840f96825686124135a6e509db80b7b82
 **/
 platform/linux-generic/pktio/ipc.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

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);