From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0071.outbound.protection.outlook.com [104.47.37.71]) by dpdk.org (Postfix) with ESMTP id DDCC2CF68 for ; Fri, 24 Mar 2017 10:58:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=3VaPx7P2VugD4ispBCTVVqpvZ1N+MyXoMVC88u78MOU=; b=G/ZHFcF/VpQ1WQBaIonCxj7hv5mjZMpLP9opBdRpe5/TSVi4B1E/HdTosiAL02sc6pStZI8mzUZuLSnliGORXDqUwHgMUVk+e6enDFoVoAHhAoMlW4Ml94QBdI7qmUaZgCTSWCr+qnolkhRo32vV+PsgrA9lsCkAjCyPE5255Oo= Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=caviumnetworks.com; Received: from localhost.localdomain (171.76.89.237) by BY1PR0701MB1722.namprd07.prod.outlook.com (10.162.111.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.977.11; Fri, 24 Mar 2017 09:58:04 +0000 Date: Fri, 24 Mar 2017 15:27:49 +0530 From: Jerin Jacob To: "Eads, Gage" Cc: "dev@dpdk.org" , "thomas.monjalon@6wind.com" , "Richardson, Bruce" , "Van Haaren, Harry" , "hemant.agrawal@nxp.com" , "nipun.gupta@nxp.com" , "santosh.shukla@caviumnetworks.com" Message-ID: <20170324095450.vs6zkj3rnoqqsgob@localhost.localdomain> References: <1488562101-6658-1-git-send-email-jerin.jacob@caviumnetworks.com> <1488562101-6658-9-git-send-email-jerin.jacob@caviumnetworks.com> <9184057F7FC11744A2107296B6B8EB1E01E9073C@FMSMSX108.amr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9184057F7FC11744A2107296B6B8EB1E01E9073C@FMSMSX108.amr.corp.intel.com> User-Agent: NeoMutt/20170306 (1.8.0) X-Originating-IP: [171.76.89.237] X-ClientProxiedBy: BM1PR01CA0042.INDPRD01.PROD.OUTLOOK.COM (10.163.199.14) To BY1PR0701MB1722.namprd07.prod.outlook.com (10.162.111.141) X-MS-Office365-Filtering-Correlation-Id: 9236857e-9f3d-4aa3-747a-08d4729c45d8 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BY1PR0701MB1722; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1722; 3:yoSn/5fOhAFHGMWOsHclWAo3z7CBKi4/oyV11IwmUE6ONDGhnVkzdcfwz2p4WrTAy50Hfhm2Kw5kB4ECMznEWM80JG5mOSywCMA3ZwGEtHEqECAeILQ8tSZ5sS6bnusvAdQl14XvbHCYYG/R3faGJBrueZz6ypKh5nftMHbzFICubmoU+FhC2ros9kcWCdS7tFN24ffdgyMK3piE67mulq3RcaX0UkENo3L6REmuaZ7UqyI5dG/ufSeiT7c8wk6/9TuBn4P5JjgDMjbC/1h21w==; 25:Ptsq0pS/NpUo8GFKKQVr2CCBNMDtkrLJNeaDNhOXtCXKa/bFU8StYktj+YtnsmbZk19Jkg7LLPHx4QSINA/LFneGWOOoQ6PnEcpHk9Otoszkw3tnKp1MOTcAskkArAahSSVRyDimwQGpgpkC83Bf1nnktUKuKu3j2j/vr4kPr4+se3KRyZ+AqbhrOfBatSVr7DJ/QdJ7+8J7py+EacKg+FEkCLfv7hbUfrHshbaW0ph6HbkOquBLzeE4KEI11M6106ewZHWAcganI/JlLOIoAabGcTKsI+JOaEG0PXLBk8Pscv57wXEvdGmoJKMynJivMEQQ4jqak84HNz2X+dIrSpClTB4QHYDPdzXCNlrdu3afrOv6K+Q0WmRzwLvVFC4BORdImkJUSY4boHvN7h5KjJFtG+x37kRsW2QhdBFOcog42oIvn6AiMy0xXCnnF+uylOo2wAqfypytsK/8gVYctQ== X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1722; 31:HJLDVAWNr54Yy+ENaPWpsOELL6w2VbVis+lfYNMLqw5XgSrrKbgM+AjYiokzI5/8Mtnp5WnylW402v9HeqiNU4/s2tL4zpz5pEwIWUEB4cFFR5u33LcqR6oOyUkXil/Ii4hZ8KVcbXEAnFvIISLnS2UnOwBT4fAppGu5+W1s/PSagccK9aovNkXiJaou7OKOlfjo9BdjV7YTi1drvPMyKhRodF0tn8Bm5ukJG7qjZw8MoPskmKqrUX8INjfECJ/S; 20:0iBQHd9XQ3BSyWxx9Z6MuBxmARkpuIlEGkob2FVtsd1HfM72toTogZQZS7dvufwQuJpb2X+IHF/M5mCPPGoVsPE2+IshE0zo6M7J/a4BUqmd7ut2aCzG/B6xMRSoMY6mTNCEsGhkBFTXIq8lra11VVvIxfTH1qOHNRzWmzYfAmo4Dxm44v/xBKV01GwnanBmBNPGw4oVoJ0w2AjDlt8e9Ef2tSh+1L/kSY/aVzWpUFyHRsuupb+8KF2Nhp32ZfIH2FujHMvYpwI0cmXRc1aU9xmlbuO5NHWZigEq4BRk26qgdmU/QLjDisb+iECQZYJ8SHasIEiAJxUDLS19myKTHcIh5ZXxnN4fX9NLWwecMPoTpjRHbg/nFQqozVDuQzOL2/SssCszo6S2yci9kKob9mwkbZfHzbNnbUVEb4F69028DZgjYRkodORi4+N45elSucs969Z8RINOh7FI6mDwNckbSE9vztVXyBwVo3roH15pGmKkjjy+sANVHBsLTzpQ40BvX+Wx7TN7zpVNVX995oq8q8vY4SUtv1kfluWhzdwVzj7d4T7fAvekfZtA5IvB7ce7XUfegWNEFXTxvHNDl8+OJCJ0A3L+SKWtevUnxM4= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6041248)(20161123564025)(20161123560025)(20161123555025)(20161123562025)(20161123558025)(6072148); SRVR:BY1PR0701MB1722; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0701MB1722; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1722; 4:Ac5y6OgKD6Z2RjsDKYiUo56+65EFkW0JWa8YmmYA2KGg52AoYFKTqKyxrA+R4gyuEd5KrGEXszMPmtJ1qr+tpIJk4e0nBQ3bJwDJnWOgXP1r2os9CRtUP2bsPmchDbYzBomPgyJkFnuqwl/U37fGNq3scz2mi24gVLQwc5SsGKFFlJUg9iE6v4s3mL2u23mpeV2uiOZxJxlNVTuL+VyKaRjLx1mpQlLUfNDDpkQJYf6vG/0IV3hkzihpdyxMx3+ImXPNZCI25yLIJNacyxCltRxN0RIbzU5P17cJ7OCN8A/QWcCIPMV47y92o+OVZMPDfjTiMTabSSTF9QnZpOALlhqYkKJ/Mut3wtGNH0W8g2w6TvcQAAXZjLJOHzzG/rT0Q+5Id1phLiZySv8Mqxax59BVUB8IZlOD5d83UCsmGc9LvoHhtJ5OsDl5cU43MB1xvsgLvRT0pQe5IBjp3gHJNQ+5uDDmpHw7ilDrS2/QaeZ//mO0HXdCJYaAnNVYLurh91pcf8g4biTfH1gcayVtCZ2SZNusk9iv+Z8z3N3/1YJ/++/UcHApJmU7+BeK8RZbg+qOBIZxzE8uLnAskJCpR1WFAEaOHSdQ22BTrVZsxXg= X-Forefront-PRVS: 0256C18696 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(39830400002)(39450400003)(39410400002)(24454002)(50466002)(6116002)(3846002)(229853002)(189998001)(1076002)(305945005)(8656002)(53936002)(47776003)(6506006)(23726003)(5660300001)(25786009)(66066001)(7736002)(4326008)(54356999)(76176999)(33646002)(50986999)(8676002)(6246003)(107886003)(61506002)(55016002)(42186005)(83506001)(6666003)(2950100002)(42882006)(6916009)(38730400002)(110136004)(9686003); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0701MB1722; H:localhost.localdomain; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY1PR0701MB1722; 23:BSY8GtVwV8Y78QCFCsPC6D5M1ACLMy7ihXmr4Sg?= =?us-ascii?Q?f2BXd23EOEPyOdsI7wCkuqb4pajEYVOFmXesteJI/nfTjK6Wk8G8gl+r8bvM?= =?us-ascii?Q?MpNFQEu7/pm31PepoesGqFL4raqGztNissUI/gRJTOcSyCMQIfqCCEFYLW3I?= =?us-ascii?Q?vnvuaTir2DWZuoWNFWphsSfxKZtWQj58npPQspi72BDJ2+9c6fxPkcKkgGgN?= =?us-ascii?Q?DwwqIqOS7+dUM8MnLviTMaTdjdn9frkBRtDLHQa1BS1I6FUjV/nxOurIvYMW?= =?us-ascii?Q?GWzWFqlEH/n/pvSFuRxc17mx3JWNMQv4hVFG5BHkzR5VeRuljIUtSG/t0iuj?= =?us-ascii?Q?nj8yXGt6qPEpKNdkP6u9qfwq7PJEdMeGMSD0DU7hGh/w5RL0BrJ/s9ZY/Uv7?= =?us-ascii?Q?FBZdt1ho3HiXWXBodbICyYUOAGyXDqQwIxjz+D4KO9P2eeszQXT/JFRr8biZ?= =?us-ascii?Q?kQIjNALTsm2pEBxrhPchLF9D1q2SWTAOcjjsCujAkm9UhXELWzmUdeYoS05V?= =?us-ascii?Q?HSkYEJLjhRsriIkt35LCY/Fe3NQHFUzz0RNMYs+Xyb9lP59RoVbxL7dMBIK/?= =?us-ascii?Q?d5Hn0/P7lTDhSv2EKmMfNtlTdpoi1wq7laJFKX1Aa0fMsI+B0x7HrqBG/NRe?= =?us-ascii?Q?jRu1trT9iMHlfAZTlkNichRoJUgjeQiZRQd1iqF7di2ijsr6P/5SzcZm/SXX?= =?us-ascii?Q?6ZTDXbrYqNHedI5lJReEjpf91fvw1q72BYMeuDESTmsxuRnURbN/ERfemAL6?= =?us-ascii?Q?Xk8EVIvB5gJKGQG9RcH6SBnZs+mStYRqGG4N6VQNvYai5pWup+2hBU6ZUK4w?= =?us-ascii?Q?/xffHE/7yWure1s4KwIwltwCdVkymPTr0GRVVuC+KnECD62qAbYsvWldMPV+?= =?us-ascii?Q?2c2gjjAJQKw5w6JlAzdrBm1H91QUnXYDyU213eUJjlTAyJJkPQgGoTCJUzJy?= =?us-ascii?Q?JlgXMt4bDS/Ihu7JbofcqEvqRTydH2HMCaYjt7s2va+ErfBZheK/qeHkIAqx?= =?us-ascii?Q?3uj7uPROQKIiyQaF47CPpjsu3sTGk7KI+356e7q8sxHosQQ=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1722; 6:PGMweZoe97eMNfj5lYDYerU0iPDfjcTXKzjteGBtzRDSpsLk6KCsEgMs0Xjk2chxM/uYIBkx8K087ikC3Awe8P8P45LlAWCXuJ61+/17/49UBTDKpKJ1+GP/4fEyFgf6b3rkNOFZeg9YDXhoT5P0xbXlyvirntQnD8HwsMJOuz6JrMbrac24Q7nLvzLR6G7pEh2eBQeZ7swAdkBiRsjP7kjouYgI92wzGNQGh8Y9z2i8cXEkA0NWiTb0T97Uc1CLgGn/puFi1CyWSrP3fbihcrmbcOkxeO7kIEJAhQf961Kcl64qdQqJN3sI5qmPff6sMdjiNdwSeKK2+A+aJZFFeEiISZ/X9LmvRMu2Poj15XZSqoUN64DWEM1fLl3XyYu8Ba4WuKekNvepyKlOtEBE/w==; 5:JGmR8iHqhrc/XO1ktBFGiha1qeqiEvGJI3GaBIEonvgsUeI2VHqv547M5c3Jz3xOWDmIWvMq1HJJu5/vhXGWlPeIjX+JFcmiotQ7NTBhiTMX6SZUEe6ComtE3+bCRGPT8Nk5bKS5Qoj4+dvFp1B/8w==; 24:Rrqp8R83YufThvuDGR5pUHU1NRKB4Bx50p+ZHlFkEGeYba+BZwaCh6ObepB0E+i8bB5v67LXZ+Gu2xnHIGfjQgH5Dpe98v2EgE/lTTcuh4I= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1722; 7:gUgY5xnCAJhavVvC7gmGT32Zk0XvI84Q3TSw8YIH5FB7odGVSzXdiRK2vShm0LhcDuLXiLtwdYo7fMQ7xNbOvXwLFWnx+dIqATlDAKtPclJ3FLOXA6gad6/4HYG4xTZWlgxC1xR1I6I5g5fxYHjLs2I4tA+oYF3iB4cr1cLz6zyJu771mOQBAjyvpFX3PDDXT2iJuVZr+qW2IVZ6HCcmH2/dJikibaoj2iidnWUkMzyp1Hkd5wjtiiUtwAK6GcAFUJQ4Gk9GzNXKLqeNH2envxLvMitDPrd6ohMCuKWEjqCQS8GGMAupXDLbA6vzg554cOatKM9dTM6n0p9ERTyhyA== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Mar 2017 09:58:04.7015 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1722 Subject: Re: [dpdk-dev] [PATCH 08/39] event/octeontx: add mailbox support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Mar 2017 09:58:10 -0000 On Thu, Mar 23, 2017 at 04:46:07PM +0000, Eads, Gage wrote: > Hi Jerin, Thanks Gage for the review. > > I identified a few issues below. > > Thanks, > Gage > > > > > +static inline void > > +mbox_send_requeust(struct mbox *m, struct octeontx_mbox_hdr *hdr, > > + const void *txmsg, uint16_t txsize) > > "requeust" -> "request" Will fix the typos in v2 > > > > > + > > +static inline int > > +mbox_wait_response(struct mbox *m, struct octeontx_mbox_hdr *hdr, > > + void *rxmsg, uint16_t rxsize) > > +{ > > + int res = 0, wait; > > + uint16_t len; > > + struct mbox_ram_hdr rx_hdr; > > + uint64_t *ram_mbox_hdr = (uint64_t *)m->ram_mbox_base; > > + uint8_t *ram_mbox_msg = m->ram_mbox_base + sizeof(struct > > +mbox_ram_hdr); > > + > > + /* Wait for response */ > > + wait = MBOX_WAIT_TIME; > > + while (wait > 0) { > > + rte_delay_us(100); > > + rx_hdr.u64 = rte_read64(ram_mbox_hdr); > > + if (rx_hdr.chan_state == MBOX_CHAN_STATE_RES) > > + break; > > + wait -= 10; > > + } > > 'wait' is in units of milliseconds ("Mbox operation timeout in milliseconds"), so the function subtracts 10 ms after spinning for 100 us. Is that intentional? No. its unintentional. Thanks for pointing it out. I will fix it by #define MBOX_WAIT_TIME_SEC 3 wait = MBOX_WAIT_TIME_SEC * 1000 * 10; while (wait > 0) { rte_delay_us(100); wait -= 1; } > > > + > > + hdr->res_code = rx_hdr.res_code; > > + m->tag_own++; > > + > > + /* Tag mismatch */ > > + if (m->tag_own != rx_hdr.tag) { > > + res = -EBADR; > > + goto error; > > + } > > + > > + /* PF nacked the msg */ > > + if (rx_hdr.res_code != MBOX_RET_SUCCESS) { > > + res = -EBADMSG; > > + goto error; > > + } > > + > > + /* Timeout */ > > + if (wait <= 0) { > > + res = -ETIMEDOUT; > > + goto error; > > + } > > Will a timeout mean rx_hdr is invalid? If so, the timeout error should be checked before checking for a PF nack or tag mismatch. rx_hdr is valid. But No harm in moving timeout to first. I will move the timeout to first as you suggested. > > > > +static inline int > > +mbox_send(struct mbox *m, struct octeontx_mbox_hdr *hdr, const void > > *txmsg, > > + uint16_t txsize, void *rxmsg, uint16_t rxsize) { > > + int res = -EINVAL; > > + > > + if (m->init_once == 0 || hdr == NULL || > > + txsize > MAX_RAM_MBOX_LEN || rxsize > > > MAX_RAM_MBOX_LEN) { > > + ssovf_log_err("Invalid init_once=%d hdr=%p txsz=%d rxsz=%d", > > + m->init_once, hdr, txsize, rxsize); > > + return res; > > + } > > + > > + rte_spinlock_lock(&m->lock); > > + > > + mbox_send_requeust(m, hdr, txmsg, txsize); > > "requeust" -> "request" >