[API-NEXT,PATCHv3] linux-gen: pktio ipc: compile if ipc pktio disable with config

Message ID 1481827559-29986-1-git-send-email-maxim.uvarov@linaro.org
State New
Headers show

Commit Message

Maxim Uvarov Dec. 15, 2016, 6:45 p.m.
Compile all function code except places where it's lined to
external files even if ipc pktio disable with config option.

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>

---
 Bill, looks like we forgot to test with disabled option. I send thos as separate
 patch but it's reasonable to merge it to main. I think review small patch will be
 more easy.

 Thank you,
 Maxim.


 platform/linux-generic/pktio/ipc.c | 9 +++++++++
 1 file changed, 9 insertions(+)

-- 
2.7.1.250.gff4ea60

Comments

Bill Fischofer Dec. 15, 2016, 9:51 p.m. | #1
On Thu, Dec 15, 2016 at 12:45 PM, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:
> Compile all function code except places where it's lined to

> external files even if ipc pktio disable with config option.

>

> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>

> ---

>  Bill, looks like we forgot to test with disabled option. I send thos as separate

>  patch but it's reasonable to merge it to main. I think review small patch will be

>  more easy.

>

>  Thank you,

>  Maxim.


Sorry about that. Yes, please feel free to add my review to the tiny
correction. I had (mistakenly) assumed that the patch only affected
the enabled code.

>

>

>  platform/linux-generic/pktio/ipc.c | 9 +++++++++

>  1 file changed, 9 insertions(+)

>

> diff --git a/platform/linux-generic/pktio/ipc.c b/platform/linux-generic/pktio/ipc.c

> index 5e47a33..5f26b56 100644

> --- a/platform/linux-generic/pktio/ipc.c

> +++ b/platform/linux-generic/pktio/ipc.c

> @@ -459,7 +459,12 @@ static int ipc_pktio_recv_lockless(pktio_entry_t *pktio_entry,

>                 if (odp_unlikely(pool == ODP_POOL_INVALID))

>                         ODP_ABORT("invalid pool");

>

> +#ifdef _ODP_PKTIO_IPC

>                 data_pool_off = phdr->buf_hdr.seg[0].ipc_data_offset;

> +#else

> +               /* compile all function code even if ipc disabled with config */

> +               data_pool_off = 0;

> +#endif

>

>                 pkt = odp_packet_alloc(pool, phdr->frame_len);

>                 if (odp_unlikely(pkt == ODP_PACKET_INVALID)) {

> @@ -584,12 +589,16 @@ static int ipc_pktio_send_lockless(pktio_entry_t *pktio_entry,

>                              (uint8_t *)odp_shm_addr(pool->shm);

>                 data_pool_off = (uint8_t *)pkt_hdr->buf_hdr.seg[0].data -

>                                 (uint8_t *)odp_shm_addr(pool->shm);

> +

> +#ifdef _ODP_PKTIO_IPC

> +               /* compile all function code even if ipc disabled with config */

>                 pkt_hdr->buf_hdr.seg[0].ipc_data_offset = data_pool_off;

>                 IPC_ODP_DBG("%d/%d send packet %llx, pool %llx,"

>                             "phdr = %p, offset %x\n",

>                             i, len,

>                             odp_packet_to_u64(pkt), odp_pool_to_u64(pool_hdl),

>                             pkt_hdr, pkt_hdr->buf_hdr.seg[0].ipc_data_offset);

> +#endif

>         }

>

>         /* Put packets to ring to be processed by other process. */

> --

> 2.7.1.250.gff4ea60

>

Patch

diff --git a/platform/linux-generic/pktio/ipc.c b/platform/linux-generic/pktio/ipc.c
index 5e47a33..5f26b56 100644
--- a/platform/linux-generic/pktio/ipc.c
+++ b/platform/linux-generic/pktio/ipc.c
@@ -459,7 +459,12 @@  static int ipc_pktio_recv_lockless(pktio_entry_t *pktio_entry,
 		if (odp_unlikely(pool == ODP_POOL_INVALID))
 			ODP_ABORT("invalid pool");
 
+#ifdef _ODP_PKTIO_IPC
 		data_pool_off = phdr->buf_hdr.seg[0].ipc_data_offset;
+#else
+		/* compile all function code even if ipc disabled with config */
+		data_pool_off = 0;
+#endif
 
 		pkt = odp_packet_alloc(pool, phdr->frame_len);
 		if (odp_unlikely(pkt == ODP_PACKET_INVALID)) {
@@ -584,12 +589,16 @@  static int ipc_pktio_send_lockless(pktio_entry_t *pktio_entry,
 			     (uint8_t *)odp_shm_addr(pool->shm);
 		data_pool_off = (uint8_t *)pkt_hdr->buf_hdr.seg[0].data -
 				(uint8_t *)odp_shm_addr(pool->shm);
+
+#ifdef _ODP_PKTIO_IPC
+		/* compile all function code even if ipc disabled with config */
 		pkt_hdr->buf_hdr.seg[0].ipc_data_offset = data_pool_off;
 		IPC_ODP_DBG("%d/%d send packet %llx, pool %llx,"
 			    "phdr = %p, offset %x\n",
 			    i, len,
 			    odp_packet_to_u64(pkt), odp_pool_to_u64(pool_hdl),
 			    pkt_hdr, pkt_hdr->buf_hdr.seg[0].ipc_data_offset);
+#endif
 	}
 
 	/* Put packets to ring to be processed by other process. */