From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0083.outbound.protection.outlook.com [104.47.36.83]) by dpdk.org (Postfix) with ESMTP id 57261D267 for ; Sat, 25 Mar 2017 07:28:34 +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=GEysPP26gtMT8bEx3MvJyq9PVwKtmeT+GFccO1KbGRFBVXKIQAA2vEjTuu4yEQxvrq1Y7Q8k5YB5dUanac4gfRAs2fUWOhMvD2dhIeu66qSr45lRGsXx74nUG9l3VUhuorSqLGQ0SY/v4gWQoYLY6e+fmZ3+3vsusObxgy1iGEc= 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 CY1PR07MB2280.namprd07.prod.outlook.com (10.164.112.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.977.11; Sat, 25 Mar 2017 06:28:30 +0000 From: Shijith Thotton To: Ferruh Yigit Cc: dev@dpdk.org, Jerin Jacob , Derek Chickles , Venkat Koppula , Srisivasubramanian S , Mallesham Jatharakonda Date: Sat, 25 Mar 2017 11:54:43 +0530 Message-Id: <1490423097-6797-33-git-send-email-shijith.thotton@caviumnetworks.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1490423097-6797-1-git-send-email-shijith.thotton@caviumnetworks.com> References: <1488454371-3342-1-git-send-email-shijith.thotton@caviumnetworks.com> <1490423097-6797-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: BM1PR01CA0117.INDPRD01.PROD.OUTLOOK.COM (10.174.208.33) To CY1PR07MB2280.namprd07.prod.outlook.com (10.164.112.158) X-MS-Office365-Filtering-Correlation-Id: 2d92ecf3-06fc-459b-a658-08d4734828ed X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY1PR07MB2280; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 3:Il9D7FNQdmfKdrh5rB3mRORwq0Du2vZJAcSVKJCeJ+nZ7513RGEq2veXvqF4tF6/FwSHmFZoZyGjzoES6cMv6T+x+bbDm933dwhBTkdYI3ozyouCVsxfP8841nESZ3jUScO61fWIH9zbXQ14oVSM0d+6A2JnrGcvUSMV1tETiJqDuy/dfoCuNznM7i+nbA6m0ppLgtV5/5eWG/+2oO7hyAl8Dv7d2mDLFZYtCKNNMx62cr6lM6aGAhFrDAvUsBkGQIfMq8UGm/hzGMtOly2fIQ==; 25:KdL01Cy7g8hZ2gGa6+jLjq18vqLk2IQbZ940YMXbYPaAVm36sf7unrfKaeOA0bVj08sVoqZYDYLKnAlND/rUhDL/nDe+fG16//fN10WcB+N68sX3aHq8q7/mc0zOw78nUkFdtsoRspmPg4VLUEeQXQcrZpJAl7p1rM523obRPOUlNkathiWaHjElDvZu3YPgaJUnQ20Pq4vu6lAy6WADvjWBynx2GByd4DGUE0kk0LVgsSURNdu7vNoK12vg/h3qcDCRJQ8XbDppKw29eJM17LA/yGblMgqkAIkOCZP6pDgxFeDj10b7EBhMTIkzuU7l6PR98P1g01SSie+KY3P6ZYAnLUpb5TO64lx3JEYxIlP9Mf0VUFfI1qbSUhAC4PPztoL7OPlib0zSF/0vZnjxWqP3ys0I7hQWZhhrKqpDk1xVCD3NMBIJd+OdC4zBPVoPkfXoU4WHGSuQe4ksQ3MrTA== X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 31:LC/kv2e3VrjlnIZkybxkcfIyFAXJDC5PgkeW/xDwCGxlyEBrU0mRTVTGGwvVRlVtnFyclSt21FME9oDIrqXxhWw48tKcXpt9YupkqHjoKb/x9f5cJynspoCqflo5RuI7ZsbC65irwEZaNZ7FE+OqnEs1QwwgxqtxDU3A4uItHGW6NbqpHcMJHhHnh3LJmAtvcCQfq1FSks2GuPBfW2Fq8KbgIfLcq+oP+7mVA0GZWx3IYBD+VU6HbA6Tx261YV81; 20:ZaYi457tdobopIoRNjZeCnI64HqXpH/p/wqUD0YzIu/utMH87pIPtk9l2MKGKAsHBPxqOqCU87iyobpIBYegZ5TmE+ypAKP1c8mB001ltY7qccqyJNkl6sFvaJsSuGezOPWlhyUERIWK8PphW9JPvT5TI5Zk5lOGmHtKDiHYQYOa/LKHKACPVrLtI+rVT+1cqk0NLraWDzfu5xF0cqMhe0j5XhuNcxDz8H2JEml8bSe3kbGQ/fymh9fXyHCBy2hGmufgwK17FNomB0Jc+r9gY23/0512ZfZAyAjYQL740RVptwiI1TKbeWQuFTQNfCMlqB0RslAFLLSWOr5wr16qlyHFB8ke+QGkMorbDX9gS8whf0eZOjK5gtbMd3N7PQi/Ofg4W4kfPyxNQUK2xsbz/J2QBGS9ZdifQAttOO/MK7hW3WAZzAQ6ePk1Qojop3lDab6KqS/65RvKKq8HnQGHwiuNiqbOe3IzQIJ98x3wjmP/4JlJPjDWADmfPB5YS0xREym0nvdOmpk65u7L2RGQrhVAj9ukIskn+tcZ1NEu0UKFsLlx4F/e2ka60I6bupyUE4wP/leIfQnBcGiALr5gSKec7JeyLoMHxdlWKHNP8iY= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041248)(20161123564025)(20161123560025)(20161123562025)(20161123558025)(20161123555025)(6072148); SRVR:CY1PR07MB2280; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2280; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 4:kwVjKYag9VjsSal++L1hS5wW+fJK+VF9jBDrlhWbPq2loa7lMJPIMGutrKGLBsexdXTqFnzor6GdiJAslAEEUA2corXrZjD9x6wVj0ObTbAbMtyIthRfE+Eh15m1ZnC4YsoBJz775rAA5W1hlb3ORCGNuHtQOBSJBQZ7L7RH+nLmcArTKXMA6kOvvqqtvmcUt/7yHyLdWDndQUngloXRynzHel6cMlbuUIE7yKRx8w7YlwFCtcsJgcITypidCzeLhq3UTIb7D2MfUOVhAxgP/UW8ltK0hcNsa5sMvxf+jEsDj49Ayig0kWgy9kV8d4K3U1i7JJ190Ug/PCkWfYsqxg0PHVdkN74U2I9eL7iH1UigFBTFfrZE3BHv+h2pZuOhnhAuT/RsdU8s2Kt0q4RuZlPFjoe7mmovYLPDqz/LZsVKFxjJqYWhxby8L+pRA+trbQ7OhUs4hXj3Z9pRBfvo9u2Mo7/ChXyyXMd2vD9fixqHlDt93vvqAlWFv1L1HI42FbuAKJqzD6/pken01xmEF2jMizvESBvYSPw6bjVU2FSKIHEGCh7SPVJgNXHZC4i7dd/hJ108xb12BzHXhhYhg9hkNC8ziALg0IuX3lO7uu4= X-Forefront-PRVS: 025796F161 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39450400003)(39410400002)(39830400002)(2906002)(2950100002)(5003940100001)(66066001)(42882006)(6916009)(50466002)(48376002)(47776003)(42186005)(53936002)(6512007)(68736007)(5009440100003)(54906002)(50226002)(38730400002)(6486002)(6666003)(25786009)(305945005)(81166006)(7736002)(6116002)(3846002)(4326008)(8676002)(6506006)(189998001)(36756003)(50986999)(76176999)(33646002)(4720700003)(5660300001)(110136004)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR07MB2280; H:lio357.in.caveonetworks.com; FPR:; SPF:None; MLV:nov; PTR:InfoNoRecords; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR07MB2280; 23:R2Gbb2GwAA1dXGBp4/qj7+DesCZ5rTs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ejvzyklWuqMLpc2zJA71Vp2vjjdEuJxNfHqnGDChv?= =?us-ascii?Q?3TplDVY8Zn/CXQb+NYBCngazSMPz6gLu1F7pIylmkjri9P6H2Mj4f914FGwG?= =?us-ascii?Q?uic2/NfzYDhhjd3NkfxrwbgWjpzx5kdADskmalujg5bHEJHsz0erolNiWpu1?= =?us-ascii?Q?n42pLTyOrIej9RbWMqt0jUUEWlX?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 6:WODLAtrkYlf5pg9SlN0ye7ONyplviOQJhtgBg6O7DeyWOE8yswAVXwhGeRJBjF09Hy/UkLxdgm6QgaH14fWmtPaYwcmFA1QCsjHJ1HOq8kgsB+bp7jDYMLYDD2XsjXZOxpZ2q5NeCbR6s5Ly9FK5RNx0rI65o0lCbRnIiigIsqVNZ4tPagkylSRbqRDlH5wt9eLFt59UEgONBnUs/6eP7vyO9R7ZfDkSc54c0d1dBXyaW12+EQAARGjFgAhex77+f3NuSgfV6St/bXU35v7bum/9aRCUUt38dlxeE/g8qJybCOr9XCZQLMOayKG6WGyUfcAYpq791LhudjupDfkS7llybPClvYJH7HrtSGGi5IObRX490qYa/fVgsIWI7pBNpS9510Gw3g3t2RJ4u8dmsA==; 5:5CbTJ64nUU8P+uPBmzLj0wB6Cuv5LV2hH6RnaDNN7UJFzLi6lXHBj3z2zOdKC2DW/E44VFG/uaJO9H++hmc1Uw/yFN3ccDype4qnJTxbYmc+51pqTQOTZNT/20JR0Q7sI3j2wqoViQ5PWDOAv0TWVg==; 24:+ZaRrHgF5LhsfnfirmfQistkKT5P3+1n9n4gf4JAebubUO6AfH9fLIMcrnIj66mGElCGd19TBupZNt6e16j5ti9E3Y7Gi3N52yAXWX53yjw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 7:ORrOOw6vZA3xJg233FmKnJz66P2EwCtDQgKWtDOvAM1pImue/Z9OkdqYAxQQfPeflLRmtIkqcqTPPzQAKGY4ZunTwd3CnfWmFp+Vj/gUJIkrszDl5Vqg+7pPvcZTHhM5MBhEQt4W2h/ImEYUb2x53Lhq/o9K3aqEtYYnKTewHxp/i56HwVifAgVwyNmJeG+OXpdE19PKy4p2az4WGp3shR54R2pWN0x46L2nh7Wsr9yq5sZAyRM5mX9kraIgapQGhyGuY9SUOgm2ZBBRwg6KpFWu3H6ToI/hcBsLk6gfxQxILVIhNMLqpsol0MxG9kHTTYL36rErNBo2lVdwu6yFSA== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2017 06:28:30.3265 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2280 Subject: [dpdk-dev] [PATCH v3 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: Sat, 25 Mar 2017 06:28:35 -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