From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0062.outbound.protection.outlook.com [104.47.32.62]) by dpdk.org (Postfix) with ESMTP id 6A646FAB7 for ; Tue, 21 Feb 2017 10:30:01 +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=YcxfPFUCu+3IEVXIw0ChkK4XisvMaYKOn3P/GmHOZWM=; b=YlXxp4eXa6gky/KMxrbi46Z+couHuVsLXGFWDRfCo7lPIYuDf0L5G4aBBwPLwYVNFSFQ05IG7NM91QyfwlqUOpGBjvhzBR7d2aEE4CYoddWgsZ8I4nFR3c79EX1bl6i6kemewe7jyf0lHcv1JMtWIEAdRKZh9MrPD59QssycP9o= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Shijith.Thotton@cavium.com; Received: from lio357.in.caveonetworks.com (14.140.2.178) by SN1PR07MB2285.namprd07.prod.outlook.com (10.164.47.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.919.13; Tue, 21 Feb 2017 09:29:57 +0000 From: Shijith Thotton To: dev@dpdk.org Cc: Jerin Jacob , Derek Chickles , Venkat Koppula , Mallesham Jatharakonda Date: Tue, 21 Feb 2017 14:56:51 +0530 Message-Id: <1487669225-30091-37-git-send-email-shijith.thotton@caviumnetworks.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487669225-30091-1-git-send-email-shijith.thotton@caviumnetworks.com> References: <1487669225-30091-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: MA1PR01CA0089.INDPRD01.PROD.OUTLOOK.COM (10.174.56.29) To SN1PR07MB2285.namprd07.prod.outlook.com (10.164.47.155) X-MS-Office365-Filtering-Correlation-Id: 041f3e3d-e880-454d-d29d-08d45a3c348f X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:SN1PR07MB2285; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 3:q5P2/cmPNvjT+ef6K9z2D9waJR+ZgalhQaa7qRLjPterbB2mBdqUrfixAB3qao+nZt35ttBnJvXgq9Gy7PdCwsWG6RBvlZ434Ro9KAWL3Kiky3r8spFj3tydEYkwt+NHdlmDnljuy5ijLgwFvmN9XrRopqWDq8yPPVs9wxBs5y4sT4srkOi/2r0fTHqsm09wAOF50ODJaPh/iHZaxXDlvWYOi+ILu6EunGL/4Xx73roJR5lPTcr8sBjY9a0eSkkvtRTXTHaRKnDc5yl7SfZnHw==; 25:jOLD1JN1GWWbuh1mDacQo0xLCpcKVM55Rx+OJ3zGovl3yQ4KSCUIGIygu6eOvOxJqDRtMpurriyrzkjkhZ9kLaiTgEgexfe9rWdlmlshGRxfqRK5wfqCM9XKRrclLrY5STHsT+KF64+EvaQXKrOkuO9mh+T4GZaa67x0Cmv1Q3LKkZbZ33eVwQ7tdqG4neDo9IsEtldq+R3QEelmuRAcoBEagXwnHcLBKABlD4nvWSLBvAiTUmc0YiIxj19BuEE1mC5+lsx+zFe4UNC3di39S+WnM98KKgXdqXpi93x/OSvxJxmxI0tqGgETr7L8K2lWVY1n+lzyWVdFuMQEzGAN4x1FwJgaE2xzff8IEofcR6vkK8W29SRiEl3tCc1P1h7AEhGWIIIQDXKeh93ocQUdDlqWCgbPybX1Vu/XozBsYJM7BMynvZweV48d1aQo0rN0EDGit0sh4He5c5oHrSC1/w== X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 31:M6HGG07gR4YCXizOcCIGxXoK8upm/6eYw5d6d/JR5IFLkgci74Y7u0IclvbgOQNY1vph8i/i9ZPR4+ifgpzmNdoVBFQzYWNylcD8XEpnAv0up/LxtMbpEI+WSqoq/XGNQp+pmbelyVr1Fbs9IKbqNyrIo1Q6lhJFAGuhavCd6QrJpXgFYmkBzeZ3H+SVamywYrlce8ntHK5mEwfWDgCrO9TdtkXMHz+gExP9v44dRcQRqnHcG33Xoq8bwq32XrC5; 20:pgUwjhL3qvfvVn96Sb0WLm+or4Bh58R5Yd9E14IHSeFbGUIrC/8j/f1az3j/QkNls++UIS1jQ5/CILnJdXefCCYHpof0KJlal0z5TaJceJye2V3fxhMDJLzfgAwkC5wfOWUwtwOrW+0t6f2DE4HDQ8/4ychd8I0pbyjkZYEkyF5kVdtFc03WnY6aXTMXhYZtXZbj6ISBu/LRmETEjXd/CxsoPzGhZNQrUtJ+PWeEXaHb6YaFL21gM5pZjbK8Aoya+jbuvivIT1UX8kQWZWsFDUrieSB57uoadem+ze+yrkuuJ2SQDmWijbHxhW/dAXbRnNGtRRk+ZKp3olPkAvDxqTUIEpeoOIeflK6pT9XwDfXjYtFTLQq+8qiRd5aLbRicuvy1nups6kWk6kLgbDod0koYrP36LYNP9bHUbNWYcGPS481RJIwmqvjlpwvQgtHxSeR765/hdWOYoeVdCzrxMkrqswr0ge+7wy4xoikM/CpCDXcjpUX2QvPb6K02KY3r/rvu/r9wbSjMOvCyO5D9KACKyUTlngl9+gw9607PqLyN6HAaqNkBKhTgobmvMETceOba02mToWgIK18q0wRycQOM2Vd6nVgVv6T6fVPube0= 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)(20161123555025)(20161123564025)(20161123562025)(20161123560025)(20161123558025)(6072148); SRVR:SN1PR07MB2285; BCL:0; PCL:0; RULEID:; SRVR:SN1PR07MB2285; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 4:I5cEU6JQY2/8QH1uW6TO/gu5sMTPF9j0yl9Qkhl995biR/MUpbxOtVmI7xfCQpbW9Oz7qsjiQf1Na/mqfMh7+fK92sIvhwKPWuZDM+dCNYP98Svp8aamOH7D4qT8aIJ1LolQhF8h2UF2pa+rkX5BwptMofD4N0eodtld9aoXM+naWHMNUEP4WL9ZAtOu+ZqbUnSkKbDLuqcMXu0psYHk7FBEzQ58/oDsQYXiRin6b4M4C0AIbWkEBKVtzzZxmCGazJKb3HRMGKT0J13O9yBCV1Q3Z64AEqGoseQYc76S1XydU1LKhL9yE9gjZFXenL6usxqBaBc0BZkscdkIrudhowaFBgPoElA8y1qiphyCM3zhEy0XCwERI+wJNw3nObzx/yCeqP3Ny7gXOaa1SdsmKcUKnNp3mgOM1SVSoKBLrWuwEOiFpOJBRYmOrYYr4HyXZKtgZsZNZu5suUx2tKyEZ2/ZHJlvxXiavjhUKC/t/MriUjSVgLfkLmLSwpt7gkvn1eQ0mlvQGpaOFdU1MMqfRjscVPKlZH1Y4eaUXrjNWlvgkovrdPg+h8TSckJyyqShdpOt2Hr3O9r31/voyNM02HXICCgFBrk+hcRYfeSI3Zo= X-Forefront-PRVS: 0225B0D5BC X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39450400003)(39410400002)(39830400002)(189002)(199003)(50226002)(81166006)(42186005)(2361001)(101416001)(81156014)(305945005)(3846002)(6116002)(5009440100003)(8676002)(105586002)(7736002)(53936002)(36756003)(110136004)(106356001)(6506006)(25786008)(38730400002)(2351001)(92566002)(48376002)(6486002)(97736004)(50466002)(5003940100001)(189998001)(68736007)(2906002)(4326007)(33646002)(76176999)(54906002)(5660300001)(6666003)(6916009)(50986999)(2950100002)(6512007)(4720700003)(42882006)(66066001)(47776003)(7099028)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR07MB2285; H:lio357.in.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR07MB2285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UDRIX08oKvbMvygV7picvqlecYS0My+uQO5mMzI2giytt4uHeGQxjzkluHIUAGYsfd2KWCst7MgiWpx5myn4GoQ==; 24:6BkPBEkd5X2ycSq5YWR8MhGWuIGTvjWt+ZdKldpsGd4QB4Yuk20BXU2lUwk47QhLdh5Alqij4tN8xDvVaLTkCy2+hU9TajXY3+T0nC5uTzg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 7:c+FNxGQupRhwYgW45xya+8Q/qgtGUmu0QJF4mEAlhYeWQ1zinzQ+snqGxkkGVjSlJn5JbmNJoyvSTc2WLdRHki5JXMQVGkCZKzUz5cmJp5rPNMiMyCaDRqLQ/jDeaAkRobxTyk8bHXOqcYGf984I7WL28d3lu9DHEd6gJDhc9mo/ciqrRfpLuk7A40stGQ4SxvGYeqPLM08mr7mww3Ke6EE7kYkQFvJT7Tiz2Bl+g4wq+qzeaogxKNbgEyEu9Z+xSoKz2lAUyfL0j31Zbr76GJUBTcrj0XpISfZCLd6GyN3xzK/gGnoKbHiki55RVAIOZVAkOfp43giEauaf285hnw== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2017 09:29:57.3397 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR07MB2285 Subject: [dpdk-dev] [PATCH 36/50] net/liquidio: add API to alloc and send 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: Tue, 21 Feb 2017 09:30:01 -0000 Add APIs to allocate and send control command to device. Signed-off-by: Shijith Thotton Signed-off-by: Jerin Jacob Signed-off-by: Derek Chickles Signed-off-by: Venkat Koppula 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 302a512..3943438 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 fe9a7f1..d26aa6f 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 2461fef..e846d30 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