From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0042.outbound.protection.outlook.com [104.47.42.42]) by dpdk.org (Postfix) with ESMTP id CBB59F8C0 for ; Thu, 2 Mar 2017 12:39:40 +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=XjAVQyldW2yJsE04EXPW/bEKKGmwIfSIzbYzi08ZFMC5lujGmNMaLjGTWKnnl+BzA/cOJhblswPAAjOFKt+RdHRh0/DcPDBy/ABS/RKVDPP1KjFjltgkEJaZEPlEpCf3fuZrLZfkxDfz60EJttPXt4IVZUXV5A28Pr/9DU3KZmk= 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:36 +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:38 +0530 Message-Id: <1488454371-3342-34-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: c9b6c4c7-0a27-430c-a474-08d46160cfa2 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY1PR07MB2277; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 3:35wnsV6NKCbUKvkPTZHt8v6VyBP4+wSJ6ZQv/nGJsPiSLNXgzubeQlHizGtnnS75i4xOm7KlAwxrCzEIhTn6lBVSWnNqUc/QeiIYdWl7ZNez87S/qSkYIgK0IrFSwtAYiwlCUOAn39wfax+nave1f7ACSpOCc7G/71oTN9pzIcJuvPKrPwy+sd/86iXHKp5vXQKBdLuiOFEiVyPzMwtYWAZZelmMzvEw3ClshQ4ArR52Gy1ygZWyhpkHBjA4YlMSPRNYMQcGjLbOz8+oqTZlqQ==; 25:muFuKrLfI/tvM2cYUhuVUDE0hwRHU457sVWc2BM5Robmcm1ICVliw9uCKFwWBLSSK/vlWo/LEvLv4zcfw8Qpsq90JMzCl2e5tgQWzycPxi6P139XkhPkss58ZpdFdYlOUj9AOwQarqd0gOYX8E2kMW82sJBOEAvYdwCvxzJCsptYTqAwRneSIq1+EVtV60hhhVf0QZgu8XcF6ITY6HVszhAeMW9bMuCb2/9wEmDBDsE1hKD7o78uzDCOTYGEiW+672NiKM/n1XrpVd3h77wGWVpdofxdiA9fnnNs2coGq00ON8OGqfjqeC1+owWNTN79eZ9GKWGHVbXf3m2/YTccCmoDSlTsFwO3GswZWTWP+ZJ09ffU7muklzfI0LBEmaTOsSdQCdXw0z7DdVLblVYD0QtPfbdMO6r8j1LMpS0q9KNAYcKfdgvwChj8oVHSogZ4LkyHIvx7hyhoDB2NUZUWtA== X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 31:4duj/aMumAzST4KMGHKbQiJ0WFllBhdbMVn7Aq7yv+lTpvZX+qH726283m3NOB4dwpA9PVbvhVJ6xd4COa/f0epCk+JWIzuZ5fPRGKnwooljxpzG4npJzhc/L0cE97pA3accVjWYncUsvIo1aoC71gZbQK3kblvNAT1Ui8VyJQh4tiB1hVgMGd2kkyMoUALVaQgXXXHyG9hJbcLBveqvviz/MFCF2qhrIl3PPO98DY90Q6spRHiYNUtcuWM/wknSabzIo806uVKhHg2BIkofSw==; 20:DNpmp8UD6PE6gj3NNJHqOvvMmyTTndJUaEY+hwM+SYrBW2Og4/AKrS5EJfiA/YbWAL19DBK/7gAOh+ukhElgdMJaEYpkEY78nwRDMnH0U52h3eb2SfxKysTVJMZJ/CjY1J9Y/8xYroSS1V3m/KU4T8YMe4WcE3sKyy4PnYqId6WnRfltHryVGO6YFUC0/nDQ3fdDP18D7X07msTJgHROUOCDLM1Si0KiD3gMqgaX8NIitY9UcS7aZXT+xkTQS0QJkgcVAIRUZCfd5JhsfZ5/LyJ36n9kWnBym5il795tcAPx/A0TpCCf67meoWSOfWtLHVfwOK2UaBDX15KVeuJ8b9zdZv8PCXXhRwjjTwwFq4jKcSGHExLGbtG32GLJrhuVZj+T/wZ8/bsveAH606EKFDaynkdf+0XCK5qfg76z40EoYXn6ipK/w6ZuzXbntefD5c+J78Qybe7CVJJER9WpxQNedwdE2rzya7LrMHiZ/wUeAUVcFZyy+o8lbKVRmv6g5ox1yGUMF5cXGSNPfZGr0RZciXCiHTYmYqWJWRsPgeJIx2gQxGuszdwWsPnnHBuSEVkbp2A1R/AFEb8aoRsD2tU8tst0cdzuuDPAHQ5SO0k= 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:f9yEMXaNuA9b6aIQ7RE0BIUP9jYm3ONUveUZ0C7gaOqKiKfU0yh/U+WdnspRVbdQRrzXGh/9E35Swek/OEIF0cyriCnvLOMFSzkRtZWoy8OsEc0FresH2MEW2yFwgieBhbE6ARpCI5HqF090QgF0zp3/0WWSuaIQDshGLLLZ4MVgaIUE2ma0OC4D6QfP38ui/sdKGmSfUNtVsK6vy+z8koehoYYyTta7Zi+PX9anq7BQAPxgyKiZZpeo6ygGcxnRn0+4PtkbDuhZSU3r/Zf7WANI4irDp+w4aveHn4PIqg58hOmeJDeQ19ZzUOo8LJMyWGf/uXMWFDakQQKDAU1WLSXynxEiW5zwPZJrxGDW/74n3HR6UESVYAsZ64fw2bMxBIS8vCQv1GH+6zTy80RiKqcKMY5K6kBhgh6tCRSGh0jQ/N+pOluT143mTUm18Mi1lkQNCucDtEKs/cg70vJOWoIaDF+Km4pWSPTTWM8FfvDkctXAAFuJ8TepXKNVZWKAVm2+zHRX8WgkbF7N4E87yAzAm2qKTTikzitv2mK0VUoudUzmlblhmTZf1HJRk4uoSHpOCxzyfreaptqgA0dZ5+zYDJmQgK8NIepoC0tfpKB/XQPQR+WOGbx42QNdqvLN 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)(83323001); 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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Ta+6xEm0TVpYUCBYFDur7VNMbr?= =?us-ascii?Q?iw3723H+EmbXGoQyVWldnkoFRBl/JQBQQIYtJ4jesRa24qTD65skNwGHTKvQ?= =?us-ascii?Q?AYLw1V1HaIvkv+U1vGZmNhemMkRyJaMvXqtTeEvsY1VWdQTeCAQAEJ6GXd7N?= =?us-ascii?Q?W2toERZhpnJ4RHbngwvn1I60EhSS3WjmeTFNd1kMczZY9MiyoLbuxHPGd68r?= =?us-ascii?Q?WMbK/aGoIXYB9amarC/QvmEw1yC?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 6:OTzvjXUOzkK4cHaNM0bHFAp+61TitEVc8YK22ewUEtx3Mb+G4T+xZH0sN+GbdZvwZ3wRXVaVkx8hkqXfwYljl9qfi65B1vy1OKa6QbRUqIJLNmJRwI0UyRVssnINFKnuZSGaZInC+ArKBlTmtHKlCRZxvgVal4iH2yNB9cxLzENjsqPUhalZA9SFOKNAHdl5BZIH/CiOZySddPwEWcsl33oKaLzGkBldd4tBp/PHLuQ4VMsHdfBIN/BR+aw43yb/kVzk6DQSD8GhBiKAbTWRGsGf7xL/+Q/5o8uISUe8vDQqNZmwEOuxCfHRGt2BtkPzJcZOrgf0NAGrfrlAUftDN3qgc7G/liZxYnlef4pCM3bpmAZ//jQrjJE018oOwJLg4RU/EctIwKu5ChnQA4qTpA==; 5:WAgF+Lv9zk9ugipjl1NO37MErU4B5QNPdCaAM4nHmUaJty7YiH8f9dpS+IrTKCSuYZypuo7c+BfdW8NZzDkLmcven3tftycNaTsgYPcFU8NwiExZAuFlkOC3j+0z2/Ire3SBdRIL6tltIgbwJ2pHrg==; 24:b5aEe52sG0GoNMOiPk3sGLvaFb42uxmmTeNPRzTFHzE9ddCcavgljsde8BOYv6egS36FKvHdsUEKJe9JfjkcgMUOY4Uk5DsaW8pkAHSTXo4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 7:KSrJBNJbGIeV5fpcVwB6XLgmhBj3lyEvt3+pBE1c8pz+lWUTY6hCtllLktNzs21jw7kB4BEvUH+4YQuDXpeVLz58s+MQuIYmyTmz1/rGfdWtUok2IIxRWqM1xZ5ib6I8G1imsEqUWD7AEelCY33w5pl6Kz5CQTk3K4WrVu0UfPDB7eUKR6Sfxz4rKdOYO3JWY11QNdMP+k2ZrWnaKq/V2IRAZtMBsNj025MB+UCkIjdLHGR1mAN3IyrefxyNxkud96qEKgotQkHxKEBdmaxkxO8O6tB8/aqhoxgrPAWHtk/VSRF7PDegSYcv7L6kFfO9oprtq23wp43f6MpvR/vHBA== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2017 11:39:36.6722 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2277 Subject: [dpdk-dev] [PATCH v2 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: Thu, 02 Mar 2017 11:39:41 -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