From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0064.outbound.protection.outlook.com [104.47.36.64]) by dpdk.org (Postfix) with ESMTP id 97543D45E for ; Sat, 25 Mar 2017 07:28:37 +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=FmC/YsgMIF91fSbZGMTTiPBKNlWM1O2m7USgrNOSFgE=; b=eT8/I/J5uHgirfcWNvuKF+YuZFlpwppa//GH4f0qbPS59BPA1QITKx4R65QfgW8AefgBkPZnSyR/sRQnTtflBwR84SZiyNjp48nf6w+NgKH0RJOiIRUwu2kZwJ4fCktrYMFlBoP37n7Nzhjp0P/DS6PbAC1KOyZ5MNvQtRF5loo= 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:33 +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:44 +0530 Message-Id: <1490423097-6797-34-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: 74f5483c-cc64-4359-62db-08d473482ac3 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY1PR07MB2280; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 3:KzSGLd25wG5lRI1Yd+rpo0SrZ+LzGTxY3GPncT4B0gBDSQFEtg1PQSilyOA9x7auxC802h4GsweHpq/JuXmI7c5DaIHtxuGWeAW54ZMhhE/NrretkfyLXVEGAh4fadtMJkkUGK1TtGyIY1JsUn16l/JzqG8urY0nmGce+xPQRE+T+mLKUroPZlxNY1TFETP8o9naPwV1QIVW2aKH0PWIJqzzFYzmDNlaOdbU6soGbQdKlrhj12cL/dkTjhtOOFuPkopGHpu5Hk3+DajTo8BKtA==; 25:L5BG+hhbk1dd4qMkU1Y5vVVlP1WGT8/dRyRrZT6I22Z2x4p7V4WEObbmHWSi1D3arzdmPN1zpHPdgw9IUXnzZDNTXWivnlwBAQLZ/PhNnM8EJzl+pSKZR1sSSsH43k2ZTWrej/wlV0uH/4XBJcPFfOWB9uo0vd3C+vypAlPP5Cn852m1Mo0+yv9zA3E+oauSamu7aiFU+VA53NLwhiUtRlhbRuESYAfI2CPDOVeeg1c+g913Sd7cYiQWxqols065DouA6ykf44u1FGcFULrq/SI6LExjfrC27DKr+WMIwTkIphj5Cq0upLbOIQRMvBL12g6PBySgPFgC+2+iTvYzIJPsbfc8KfKdR8tN/DkD6htJWJO5RB1/DEXsOAVECnN6T3fwR5usVpGWdYDB51ywzLuruyqdrBGFi/ArdJfZVguL8JwnLvdbJj9187CPG3kXgO9E8ugXya4ZpNr/8MqY+A== X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 31:sBWs8j9KmWg/Vdk6qYEUhD+HeyTGm9dUPGOs8T5kv2f47YT5GjZgcXRZswlOQ5nlO5cdFOJ3r4aiKVsw8WG4JerJTVxudR/rjrXPfBWWZ3QjYCREuW1Se2on69jgmHx/4caBBxvGzfyGzxwt3Dh0RgWQkv9I8XhyTb9iCcpPduYa6Fz7oEqbubLQYdkW2ysI8sqvfr6/CLxrhC00xQQGkn0FLEwSJjo7dw2DQancB+V72FtugIBvmIECcvbPaqMa; 20:vvTt0Ah9BcQMdOi+0k/kSSI0C8K0XUuC/NthnM/FY0uCrP7kaQLJKbjXyR6VWamyQtzg3bO7KTWOVpYv+dhxrXvnTs6ifuVlO0FnjX0HNTYiw3rifn5ov5OhHpkeF1MMJmTdaAQll0qYzrlNQBPebGX5QzoUX/JSMRCL0q63YzeLq3anxl+Lo0IVH7yKUtZViZTvUu71NNWw2233oowalz3xOhoOB5H3RNSP4aafcp/JhIQIGTnQw5dpz7iQzD6X5Ahem8eChgirATWgtrXP+flQjhtjbhp4SuzMLKzTr4H7JuYi3WtSwkaCfUqXgLCzpKbFuXOe98A2BCN91+qpqlHHMKe80Lm7pnv1xr2oVPb3FO5EF+eGSKyk4HXtLPBV7MVkUkODExddkVohrHtPj95o3OjCFNTSjLOIw1dKrR9WQjcRC0JK8N45afCgqLetvpI6u0YI0/xwcfWESpbL1U0dlm3GlX8KYVo383Tq+DZqyZN28eqytPitM1rHCWFMMhvDEDFHeOQx+sirYG+QdFWfi8zJKaOMf2BbxDPOp9cgqcjfQen8OUXn57Rk1d9rUUwA+S9QTsxAEWSpegVDLCybEDKGheuDztbMswXkfRU= 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:eOC/B1N8qAzcs+n1Ej0oX4leMP0L0LRvA0oKXHazhHJ1W1UolUA2YP2lVxMSXuJLfvA07iNnd5FwUxrzJmaf8vVlzNm88EjPS9KmyKdC9Xy30cLqGxX+Zq+MUZBxD8d0UI/B9xuzbcLI4uXkprsy6LsD+uTTfvyWVnKcrfmRNUPD3GO4dIkuEMi+H50aWN9Yz7Vg+a1giY8OTNGdVH8ySjH44YZsU6smYpxVgUwrt1LoseOg3ivIZQDsemtDhBzviTYzoeTtbBO+hPpkSV4NwmttGtCpPIecYVI8AUEe2Tk/VWujoALHN6JT8egRfP9/t/+ljIhO59ZZ8YalzX26S9HzkeySZGeDqx6jXWJsvtA10z4pgfevTySvxzB+Bby9PJumECLTCJcKWMAYwf8uovRuaEljvkxJsgSpdpdADqp69HA7kHhheAz9IzrvL1Ueuv+gYS53RoRsQdDSKjyVICYJwvw4b6Y0xRbC46NXHnaxUKd4QurlwzQ1NfUViaSrD+JWu4MfCq2HDon6GNQ88Ozgq6VZ7UrIgr2U543SWn4KtPptdu48X8gSBrcKwCeGXV8wFs3T/n9a7p9b/NR0P8SiFl41fiLF1GiK8/8injg= 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)(83323001); 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:3dFziwXGYVq/lE7kVAL4/IEnwqR+Y1W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PHR2XJr+U8/EK3B1a+Xi2Ol0UWzFA5nMFAMOWAXLb/?= =?us-ascii?Q?/ZEOUpxy0Si8BPQV+jxD175xN+0ueki44u5hwQusGdFVgxmwsDDhYHxGgBDM?= =?us-ascii?Q?BbYbnKTLQnoICsX6Q7vCyme3pd8Z2nTMVid3X4Dl3172CqbdjLFvLz/XKW1+?= =?us-ascii?Q?Np1MQryj9eS1WVs+L0pg7a2z/kYaUHRxPYm/lhWN02akSl2Aw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 6:0OCtz1vAMgemliNWWmEEz/SzaE9YV7QaucpMZSdJjzBqCzr6p+XUo2L7X9hm5p830/YWENmYnDtbuO9rurct0AIr6zHVSI9l/weK5DZm7vpjmmB+Kq1WcoLhR7MRLt+OAjFvRMS19fyJKQ36+tzY7ec2uyiKG3UAPFAC8x1QjKHFuJv4xlnIRegZmCQ5obmTjVyJoPerDh6xIUhqVroLCGjn9gv4gG2JiwZALSjvIXBQtjhynQE47FfhzxCkDZjxSm+8FEI10Zli5IlQGDhW15yVi8YjL31rpz5BKlhX/UusMBha+M87IX00BEZVM51XPAB9k9m4cgOJQEYi3zLu1MlQWd30A/GTmA1VHFVocelhTdtmfV6Xw1rw7WEvpKCX9ina+NWtulFGJummIM1Cug==; 5:BGNISOmNt6RzEDiL8K14/apVg+/xIiWiIpiMHKYOee/Q7udNsU19e2kqtS57KFAzvnWC3uiWV4zjepJ4ODYfKLAURDwnWEuCXuEwm6gy4ebTLfdLR3eQWIaJHIPSme9mSM/b8b4sCiQ0/JYYgyiJww==; 24:cW6wMCnhW5StAck0u0IqjIbCmxwDFbE3WNs+vdxVzqWVCSOFh/zBRk+fiSiKQCUa0ZWLsqrDyz4aCSHqL0TJXrD8KwriVEpf6wHKLE8aKSk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 7:X7hW99uIVHHZqSy3diA00Gv3zLKBXZ1xtpw7aBkWeSNuqQhQbKcE4VVKQtGvRqNX4cZJxWhoEe6XgCb4qXC/cM0K2yFG75rLOQ1QVIUPEG6UBn1jpLyVSnrwnAL4+F+ECyLTevbelyWMPT6nnEEl6vpUihJa8+XtVAVuAVIsxO8dsHTPQPAe6bO1DlHw6J9PhWU6yRrg7v6V/W3Xlq+dpk0F/RTI6v9IOcBsiAgMIny3IViTNiSybxNBVJJjzrY6G1PgBEnSHdtEwZp/GMhQM/bgPnbMf0dG9oRWpQAOIMiG4uiLBTdyevdVmqZInf/iMjQgSgSclQ49Ks0gmVdo9Q== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2017 06:28:33.4631 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2280 Subject: [dpdk-dev] [PATCH v3 33/46] net/liquidio: add API to control Rx 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:38 -0000 Enable or disable packet reception. 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 | 3 ++ drivers/net/liquidio/lio_ethdev.c | 59 +++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/drivers/net/liquidio/base/lio_hw_defs.h b/drivers/net/liquidio/base/lio_hw_defs.h index d38c835..59668c0 100644 --- a/drivers/net/liquidio/base/lio_hw_defs.h +++ b/drivers/net/liquidio/base/lio_hw_defs.h @@ -128,6 +128,9 @@ enum octeon_tag_type { #define LIO_MAX_RX_PKTLEN (64 * 1024) +/* NIC Command types */ +#define LIO_CMD_RX_CTL 0x4 + /* RX(packets coming from wire) Checksum verification flags */ /* TCP/UDP csum */ #define LIO_L4_CSUM_VERIFIED 0x1 diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index 4962cad..c698c70 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -41,6 +41,61 @@ #include "lio_ethdev.h" #include "lio_rxtx.h" +/* Wait for control command to reach nic. */ +static uint16_t +lio_wait_for_ctrl_cmd(struct lio_device *lio_dev, + struct lio_dev_ctrl_cmd *ctrl_cmd) +{ + uint16_t timeout = LIO_MAX_CMD_TIMEOUT; + + while ((ctrl_cmd->cond == 0) && --timeout) { + lio_flush_iq(lio_dev, lio_dev->instr_queue[0]); + rte_delay_ms(1); + } + + return !timeout; +} + +/** + * \brief Send Rx control command + * @param eth_dev Pointer to the structure rte_eth_dev + * @param start_stop whether to start or stop + */ +static int +lio_send_rx_ctrl_cmd(struct rte_eth_dev *eth_dev, int start_stop) +{ + struct lio_device *lio_dev = LIO_DEV(eth_dev); + struct lio_dev_ctrl_cmd ctrl_cmd; + struct lio_ctrl_pkt ctrl_pkt; + + /* flush added to prevent cmd failure + * incase the queue is full + */ + lio_flush_iq(lio_dev, lio_dev->instr_queue[0]); + + memset(&ctrl_pkt, 0, sizeof(struct lio_ctrl_pkt)); + memset(&ctrl_cmd, 0, sizeof(struct lio_dev_ctrl_cmd)); + + ctrl_cmd.eth_dev = eth_dev; + ctrl_cmd.cond = 0; + + ctrl_pkt.ncmd.s.cmd = LIO_CMD_RX_CTL; + ctrl_pkt.ncmd.s.param1 = start_stop; + ctrl_pkt.ctrl_cmd = &ctrl_cmd; + + if (lio_send_ctrl_pkt(lio_dev, &ctrl_pkt)) { + lio_dev_err(lio_dev, "Failed to send RX Control message\n"); + return -1; + } + + if (lio_wait_for_ctrl_cmd(lio_dev, &ctrl_cmd)) { + lio_dev_err(lio_dev, "RX Control command timed out\n"); + return -1; + } + + return 0; +} + /** * Atomically writes the link status information into global * structure rte_eth_dev. @@ -402,6 +457,9 @@ if (lio_dev->fn_list.enable_io_queues(lio_dev)) return -1; + if (lio_send_rx_ctrl_cmd(eth_dev, 1)) + return -1; + /* Ready for link status updates */ lio_dev->intf_open = 1; rte_mb(); @@ -420,6 +478,7 @@ dev_lsc_handle_error: lio_dev->intf_open = 0; + lio_send_rx_ctrl_cmd(eth_dev, 0); return ret; } -- 1.8.3.1