From mboxrd@z Thu Jan 1 00:00:00 1970 From: Santosh Shukla Subject: [PATCH v2 03/26] event/octeontx: introduce specialized mbox message copy Date: Sun, 8 Oct 2017 18:14:07 +0530 Message-ID: <20171008124430.1866-4-santosh.shukla@caviumnetworks.com> References: <20170831145436.5397-1-jerin.jacob@caviumnetworks.com> <20171008124430.1866-1-santosh.shukla@caviumnetworks.com> Mime-Version: 1.0 Content-Type: text/plain Cc: ferruh.yigit@intel.com, jerin.jacob@caviumnetworks.com, Santosh Shukla To: dev@dpdk.org Return-path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0055.outbound.protection.outlook.com [104.47.36.55]) by dpdk.org (Postfix) with ESMTP id 090051B1A1 for ; Sun, 8 Oct 2017 14:45:28 +0200 (CEST) In-Reply-To: <20171008124430.1866-1-santosh.shukla@caviumnetworks.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Jerin Jacob Some of the internal toolchain versions create unaligned memory access fault when copying from 17-31B buffer using memcpy. Subsequent patches in this series will be using 17-31B mbox message. Since the mailbox message copy comes in slow path, changing memcpy to byte-per-byte copy to workaround the issue. Signed-off-by: Jerin Jacob Co-authored-by: Santosh Shukla Signed-off-by: Santosh Shukla --- drivers/event/octeontx/ssovf_mbox.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/event/octeontx/ssovf_mbox.c b/drivers/event/octeontx/ssovf_mbox.c index 764414b59..9ed417d1a 100644 --- a/drivers/event/octeontx/ssovf_mbox.c +++ b/drivers/event/octeontx/ssovf_mbox.c @@ -87,6 +87,16 @@ struct mbox_ram_hdr { }; }; + +static inline void +mbox_msgcpy(uint8_t *d, const uint8_t *s, uint16_t size) +{ + uint16_t i; + + for (i = 0; i < size; i++) + d[i] = s[i]; +} + static inline void mbox_send_request(struct mbox *m, struct octeontx_mbox_hdr *hdr, const void *txmsg, uint16_t txsize) @@ -106,7 +116,7 @@ mbox_send_request(struct mbox *m, struct octeontx_mbox_hdr *hdr, /* Copy msg body */ if (txmsg) - memcpy(ram_mbox_msg, txmsg, txsize); + mbox_msgcpy(ram_mbox_msg, txmsg, txsize); /* Prepare new hdr */ new_hdr.chan_state = MBOX_CHAN_STATE_REQ; @@ -166,7 +176,7 @@ mbox_wait_response(struct mbox *m, struct octeontx_mbox_hdr *hdr, len = RTE_MIN(rx_hdr.len, rxsize); if (rxmsg) - memcpy(rxmsg, ram_mbox_msg, len); + mbox_msgcpy(rxmsg, ram_mbox_msg, len); return len; -- 2.14.1