From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0050.outbound.protection.outlook.com [104.47.42.50]) by dpdk.org (Postfix) with ESMTP id BAA90FA39 for ; Thu, 2 Mar 2017 12:39:42 +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=j51bAMadaTjun4wJCzRwuhb6wTTaTaZbmdSRUOIP09M=; b=of+GmROXmG7A3M9D5lb74x3jYOMGP7c8FKyPUr9Gc9oIO1GMUJIzfkgX18hZSXvfKgNbzoORzTk5das3f9f437fs1hnz4HnFLMU1Q1OqC80OCdE32xE+q8Qbtd7OtqeKJOdPSbosuF8vxPy4BmOuxPqHUOKJqkxnbdkkXT896+k= Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=caviumnetworks.com; Received: from lio357.in.caveonetworks.com (14.140.2.178) by CY1PR07MB2277.namprd07.prod.outlook.com (10.164.112.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.947.12; Thu, 2 Mar 2017 11:39:33 +0000 From: Shijith Thotton To: ferruh.yigit@intel.com Cc: dev@dpdk.org, Jerin Jacob , Derek Chickles , Venkat Koppula , Srisivasubramanian S , Mallesham Jatharakonda Date: Thu, 2 Mar 2017 17:02:37 +0530 Message-Id: <1488454371-3342-33-git-send-email-shijith.thotton@caviumnetworks.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1488454371-3342-1-git-send-email-shijith.thotton@caviumnetworks.com> References: <1487669225-30091-1-git-send-email-shijith.thotton@caviumnetworks.com> <1488454371-3342-1-git-send-email-shijith.thotton@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: BM1PR01CA0021.INDPRD01.PROD.OUTLOOK.COM (10.163.198.156) To CY1PR07MB2277.namprd07.prod.outlook.com (10.164.112.155) X-MS-Office365-Filtering-Correlation-Id: 01f05643-4aba-458e-1b22-08d46160cd96 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY1PR07MB2277; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 3:s25h6l3aqsRbEBmnlMrZ6pQONYeqRwJb+kctyE+co5UDp3X4OvLT6XX0Dua0DPiBrVlW+B+soqDFw6mwsE3oweSHaeYlBegAB4wVdXp5OvBJIwtSkjDDq1eUe7Rx6bDE2q3V7okgr5Rx+HkmD8BFbaViugaG6ytSgreYKzksYiycurebKlYqsE6qJqV1OAH3gqYPf24a8OhPGyM1KhgMu+dXz49Gq2php4aQWz2Q445Ge3lIcsOPxscvjEoerCO5YMoDARHHlzQ97EHsg0igDw==; 25:ETR8eUQAMgMRZdi38MmGrDUZzdnX1jlV7qu3ErhHa1Ml+hT0fM1j6Ew8ZFq+Zdox2IL2GEttBbvtSKcyIJUxrXhlgWwfT68xnwEKgCCFn+j69wR3HdZVUrBEa6TgSIo62o8BSSxPfXrDyk716UqgXdkMK5UUq6CqnMDZNwJtq+UHnUsqX/Tj0aB5DqHnNXTRwJqYar2yStQpBo/xfYaUC0lU7WlU/bGIrHa3Oh3nbxZM6HEroGdAgcX16v7cnCuc05TWzfuSc+ovjEsfbsMWW/ERd5/Wo1+eH2hZA3UvU7F9o+ekwN6IHmC5lQ5TF8/BVYGi6iLqI0xPVR9VJ6B4GkLkZfsfNJ89u+MU97mtDN85M0re/9DhTP3nmMTT94UyBg7v703uiVmr3noT2/bHT+qsQT5ZpkZQ8B90uufUNS78/F9U017pyaHcNkHM3I80XTvv4UtU7NrGpP0XoZi7rw== X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 31:QhQEHJ37CMHYvTEL8jzuf5DvK8VI0G8CBvMkHnaXNu9HYJzLGfTD2t+yFlTmKWy1t0aY8cmboVuu71ucDjodMBZEKFlvF1H1DN26u3lA4fIlgh6BSpaVeNfojaJhCYdPanVWS7bEzu3GbC2XXMMHmGCG+71qfTbmshBlzlz4dTkdg8yt5pw8BtmTsegz4Ai9yUKhSqrdY2SjPYgoPPKlwScE1WdLlZAoHSESoP41yR3Y1j+LMMS0uIrdv+6P6XlBNpwpCpi1kpj72B16BycXoA==; 20:jlSrULTm55olgnP97XYSzfZm9fWedV+c0Xo5UQiWZ/4SIvxEIc9oozhYF+yArYNVAKclog+SXlvYfTeUHbNVZlAezm1ar73jFSQXIibyAhukX53j3mIsjJdy81gmSkYL4K0pMiHqu1Op6HORvvhaZhccXobuFOEJ3n5bZ8hA+Excx8dNOOP5sRDjExhbowyrPQaAd9yhxZE4lry+Sc5b7OFtwd1wjB5LBWuBHqkHmL6hvR6ZCH9jN3aBYQ5Hh0D9BLOaa5PdvCiSMVXYNA7EId2k9EBiwEBZRm435OYYivd91MV1DHhJQQJ0KPPNgcwXQZwV0lrbDJljphvmZNaHALFPX7qkjFLy7NYzHMf1xHPtA+NSR1zTgnI2gbMmeWEEu4Cb1ISN38gRurFUia+mazDNkVeXMM/SCyqjwo5VQ5ejd5RXrnRV1LEO/ziTcNNvg1/H8zYsd6g6SYo5QQ/BQ70Cd7TA+7yLrFEHbyoYXTHV5OrO33bL4zQO3575wKvRC0HrPc0XjljZcFglXJrruM2gkpu9bbbFRq0YzFMFBawY7GpGqOsfs5B9OVvxuqiruPvPFDvY+JIe/oW6WsqiHzh8bcrHYMS2XUJegkxpkdo= 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)(10201501046)(3002001)(6041248)(20161123558025)(20161123555025)(20161123560025)(20161123564025)(20161123562025)(6072148)(6042181); SRVR:CY1PR07MB2277; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2277; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 4:WOb7D1fL5LtO7oDWgPVQk6FVncVFEHMQ752bUkAZey1Z/LMrv3x8wp7ISaaEsFJ7zVkq97rXkbk6oAlTF7x86GtMpEr2PtjY8mLj2lI1UKkWV/R7t3oK4Yd4asYL3GGpEQ5SUHHkuRGNKflmxWB5m6cQrus3E7KnDoM90Z8/SuKnpdJxKDb78Ex894t1CZUW5RyRJC9+3kkrPY+qY2vU6SEFeMf4f2li2GWKswMmVTgf6coHOVYR/TXH6khvwC+yiDX0Q2GFqUJglmVfN7VEIlOvFb33az2ReAT9HQc8GskVfza6upCFzaOiwPEF3SSyZEhuA8IFvt6+Q9Gdc9GxCiQntkerhfGfgeDCsctBrobwbJAhUeLer25qOur8L1u/NtyONe99weRAqiS30G6o1YWNDJkzF7ySdsjMVyGZMbCEzA8sfvQAXRz2gPA/KxbHncmYq7EKH/uaHyRe6mQxfV/SdkUY3lG33AE9KYw3QbTyaxTlxjznciAZWNx8+9SWUZoZQyu14LXq38CYAWwWXa53tMzi0eZjDfJ9leQwcqrOkx8DVQuUL2FRQN0UWxfUm1MXwuY+HSzZxdKDNqZ9jWzDFsCrEVWEteqfDaS6+i+zmkCfDR3wxm1+qp56WuAC X-Forefront-PRVS: 023495660C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(2950100002)(6916009)(42882006)(5660300001)(92566002)(4720700003)(33646002)(48376002)(50226002)(2906002)(5003940100001)(36756003)(8676002)(50466002)(81166006)(110136004)(38730400002)(4326008)(305945005)(2361001)(53936002)(2351001)(25786008)(6512007)(189998001)(54906002)(47776003)(6506006)(6486002)(66066001)(6116002)(3846002)(50986999)(76176999)(5009440100003)(42186005)(7736002)(7099028)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR07MB2277; H:lio357.in.caveonetworks.com; FPR:; SPF:None; MLV:nov; PTR:InfoNoRecords; LANG:en; X-Microsoft-Exchange-Diagnostics: =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wdI+ohVz8SswEQmPiIT?= =?us-ascii?Q?kvOjSu1QBNDutMTxMQFvFOEqi25rltj5VwlXw5+gXwKbbpD8FzAKwWag7ZDH?= =?us-ascii?Q?fItx76qNiNUTOf/fJ2o54unOdYoLwrhIkot94x4FZ0zHRYzOURxY7R0U4QfO?= =?us-ascii?Q?92UqrooedTMPz8WVBeL7BgKbfdTyzWI7O7OkH9ZQ8NB/jVK8UeUxlsw/vmBT?= =?us-ascii?Q?81ePW4=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 6:wU/2sXenBiFhC/PsNowXpubmYhrW1ded572QRDtdISJhK2Aa/M41Eq41UG9jzfm3A3Q0lwD/zbAouPWRZC2ak/TXmxsZzo7bpJQZ3OnN9ey7dak3WvuaeJgDvZF2h8ZxmQrVsath323jSbDQRkQzlbLzwG+X60Luo6JXyA5RUvBziF/WRu5edFOR30nSiaH3Rk4mxktG/H0nNkDNJhBokWuxWlQy+yTnNrWx0LU7nGPC7nowrxUMC/KauvM5sHLIoJyYxPh6mzf0SVAIbBBJkjBh7jJ6JEu8Yxb2FFX/1dY6m4Xc3z3rSmbweeXJ1hEoQ6o16glEeZhZQk1WDg2sTFoD+KOtuUEKgIBvWKDIFoP8EyOv2bqFAbuJWM/ftdGm9G7rhJGWxj4T1ZlsWZNolw==; 5:OCtPNCgRRc3INiv9kkPFMBcgURGhTa8mjukTAGWoHWgfQ5okhPVK25Y8KQxpLEZ+axG83WQLRXRptJ+f7VunM7klWaJBGbasia3GoDD9A6B2Yv3XhFqbpgS2cjVIFQbgFfUnCF4CBhhuscwGl+e0Jg==; 24:+cPNr8F5Aox8azFwJ+CmjPqUq8x4BRmQdgyAri+an0GhO33YgI5Armfp0Dw3dsiVaUQB8IbfArlAiEdw/bFtyZUfra5TDEUyZrvtFxrHu7A= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 7:mqTgkqXRdKJT6MAnTIj0X8a1/nZ6DJEZYGrJTjv/O3W5SwH28uAq2Ig/SocNMjoA7WVI2bkAVpkOqkU0wbbHVXfKa6aPj0Cs0+r+RTXrzcsIsAl8dHgO42KctY46HOsbYixdLLLQlHvZsUDOwDJtOqyRfLtByweoVfD3swE1lTand4Fgt95ugPGRTUWaXTgeet27WtKkxpzftvg+Xl/E7FlcbXi6Ufpocf/cOny5KBHk8y1uBatNTeVSIoO7vqgDadQZ0uXo+t1xI3DUSiAf+8NcvdcyWG+BDaYiKRGi1dTRfoHA21PMtFSHhcri9cQXESoOuwD0zZxFTVFoStsyXA== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2017 11:39:33.6096 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2277 Subject: [dpdk-dev] [PATCH v2 32/46] net/liquidio: add APIs to alloc and send control command 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: Thu, 02 Mar 2017 11:39:43 -0000 Signed-off-by: Shijith Thotton Signed-off-by: Jerin Jacob Signed-off-by: Derek Chickles Signed-off-by: Venkat Koppula Signed-off-by: Srisivasubramanian S Signed-off-by: Mallesham Jatharakonda --- drivers/net/liquidio/base/lio_hw_defs.h | 1 + drivers/net/liquidio/lio_ethdev.h | 6 +++ drivers/net/liquidio/lio_rxtx.c | 82 +++++++++++++++++++++++++++++++++ drivers/net/liquidio/lio_rxtx.h | 44 ++++++++++++++++++ 4 files changed, 133 insertions(+) diff --git a/drivers/net/liquidio/base/lio_hw_defs.h b/drivers/net/liquidio/base/lio_hw_defs.h index e3f18e3..d38c835 100644 --- a/drivers/net/liquidio/base/lio_hw_defs.h +++ b/drivers/net/liquidio/base/lio_hw_defs.h @@ -122,6 +122,7 @@ enum octeon_tag_type { /** LIO_OPCODE subcodes */ /* This subcode is sent by core PCI driver to indicate cores are ready. */ #define LIO_OPCODE_NW_DATA 0x02 /* network packet data */ +#define LIO_OPCODE_CMD 0x03 #define LIO_OPCODE_INFO 0x04 #define LIO_OPCODE_IF_CFG 0x09 diff --git a/drivers/net/liquidio/lio_ethdev.h b/drivers/net/liquidio/lio_ethdev.h index 98ff493..7b5343a 100644 --- a/drivers/net/liquidio/lio_ethdev.h +++ b/drivers/net/liquidio/lio_ethdev.h @@ -44,6 +44,12 @@ #define LIO_DEV(_eth_dev) ((_eth_dev)->data->dev_private) +/* LIO Response condition variable */ +struct lio_dev_ctrl_cmd { + struct rte_eth_dev *eth_dev; + uint64_t cond; +}; + enum lio_bus_speed { LIO_LINK_SPEED_UNKNOWN = 0, LIO_LINK_SPEED_10000 = 10000 diff --git a/drivers/net/liquidio/lio_rxtx.c b/drivers/net/liquidio/lio_rxtx.c index d7e17bf..c12960c 100644 --- a/drivers/net/liquidio/lio_rxtx.c +++ b/drivers/net/liquidio/lio_rxtx.c @@ -1557,6 +1557,88 @@ struct lio_soft_command * return count ? 0 : 1; } +static void +lio_ctrl_cmd_callback(uint32_t status __rte_unused, void *sc_ptr) +{ + struct lio_soft_command *sc = sc_ptr; + struct lio_dev_ctrl_cmd *ctrl_cmd; + struct lio_ctrl_pkt *ctrl_pkt; + + ctrl_pkt = (struct lio_ctrl_pkt *)sc->ctxptr; + ctrl_cmd = ctrl_pkt->ctrl_cmd; + ctrl_cmd->cond = 1; + + lio_free_soft_command(sc); +} + +static inline struct lio_soft_command * +lio_alloc_ctrl_pkt_sc(struct lio_device *lio_dev, + struct lio_ctrl_pkt *ctrl_pkt) +{ + struct lio_soft_command *sc = NULL; + uint32_t uddsize, datasize; + uint32_t rdatasize; + uint8_t *data; + + uddsize = (uint32_t)(ctrl_pkt->ncmd.s.more * 8); + + datasize = OCTEON_CMD_SIZE + uddsize; + rdatasize = (ctrl_pkt->wait_time) ? 16 : 0; + + sc = lio_alloc_soft_command(lio_dev, datasize, + rdatasize, sizeof(struct lio_ctrl_pkt)); + if (sc == NULL) + return NULL; + + rte_memcpy(sc->ctxptr, ctrl_pkt, sizeof(struct lio_ctrl_pkt)); + + data = (uint8_t *)sc->virtdptr; + + rte_memcpy(data, &ctrl_pkt->ncmd, OCTEON_CMD_SIZE); + + lio_swap_8B_data((uint64_t *)data, OCTEON_CMD_SIZE >> 3); + + if (uddsize) { + /* Endian-Swap for UDD should have been done by caller. */ + rte_memcpy(data + OCTEON_CMD_SIZE, ctrl_pkt->udd, uddsize); + } + + sc->iq_no = (uint32_t)ctrl_pkt->iq_no; + + lio_prepare_soft_command(lio_dev, sc, + LIO_OPCODE, LIO_OPCODE_CMD, + 0, 0, 0); + + sc->callback = lio_ctrl_cmd_callback; + sc->callback_arg = sc; + sc->wait_time = ctrl_pkt->wait_time; + + return sc; +} + +int +lio_send_ctrl_pkt(struct lio_device *lio_dev, struct lio_ctrl_pkt *ctrl_pkt) +{ + struct lio_soft_command *sc = NULL; + int retval; + + sc = lio_alloc_ctrl_pkt_sc(lio_dev, ctrl_pkt); + if (sc == NULL) { + lio_dev_err(lio_dev, "soft command allocation failed\n"); + return -1; + } + + retval = lio_send_soft_command(lio_dev, sc); + if (retval == LIO_IQ_SEND_FAILED) { + lio_free_soft_command(sc); + lio_dev_err(lio_dev, "Port: %d soft command: %d send failed status: %x\n", + lio_dev->port_id, ctrl_pkt->ncmd.s.cmd, retval); + return -1; + } + + return retval; +} + /** Send data packet to the device * @param lio_dev - lio device pointer * @param ndata - control structure with queueing, and buffer information diff --git a/drivers/net/liquidio/lio_rxtx.h b/drivers/net/liquidio/lio_rxtx.h index 964a884..95d0007 100644 --- a/drivers/net/liquidio/lio_rxtx.h +++ b/drivers/net/liquidio/lio_rxtx.h @@ -249,6 +249,40 @@ struct lio_iq_post_status { #define OCTEON_CMD_SIZE (sizeof(union octeon_cmd)) +/* Maximum number of 8-byte words can be + * sent in a NIC control message. + */ +#define LIO_MAX_NCTRL_UDD 32 + +/* Structure of control information passed by driver to the BASE + * layer when sending control commands to Octeon device software. + */ +struct lio_ctrl_pkt { + /** Command to be passed to the Octeon device software. */ + union octeon_cmd ncmd; + + /** Send buffer */ + void *data; + uint64_t dmadata; + + /** Response buffer */ + void *rdata; + uint64_t dmardata; + + /** Additional data that may be needed by some commands. */ + uint64_t udd[LIO_MAX_NCTRL_UDD]; + + /** Input queue to use to send this command. */ + uint64_t iq_no; + + /** Time to wait for Octeon software to respond to this control command. + * If wait_time is 0, BASE assumes no response is expected. + */ + size_t wait_time; + + struct lio_dev_ctrl_cmd *ctrl_cmd; +}; + /** Structure of data information passed by driver to the BASE * layer when forwarding data to Octeon device software. */ @@ -570,6 +604,16 @@ int lio_send_soft_command(struct lio_device *lio_dev, struct lio_soft_command *sc); void lio_free_soft_command(struct lio_soft_command *sc); +/** Send control packet to the device + * @param lio_dev - lio device pointer + * @param nctrl - control structure with command, timeout, and callback info + * + * @returns IQ_FAILED if it failed to add to the input queue. IQ_STOP if it the + * queue should be stopped, and LIO_IQ_SEND_OK if it sent okay. + */ +int lio_send_ctrl_pkt(struct lio_device *lio_dev, + struct lio_ctrl_pkt *ctrl_pkt); + /** Maximum ordered requests to process in every invocation of * lio_process_ordered_list(). The function will continue to process requests * as long as it can find one that has finished processing. If it keeps -- 1.8.3.1