From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0056.outbound.protection.outlook.com [104.47.32.56]) by dpdk.org (Postfix) with ESMTP id D168FBD2A for ; Tue, 21 Feb 2017 10:30:03 +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=nv7U+GdpFEg37AA8UCQ0pjEzcdjL3GDVHZQDkp3FbiU=; b=CLc5z+xcOkHy3ENd2nhWrRczRPJTbbdz4nrWr3eKKMeol9NuCH8xoxRubAZhVAytuIiACemK+WGFli8AkgjM0C4GiSx7IfkuqQjeIzM8taQ3FJ1d2dTYqYVYRg2ntqaXgW/DWvNOk0RTRmC3WA2dXNlgceKudI8ibfMK151jdxw= 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:30:00 +0000 From: Shijith Thotton To: dev@dpdk.org Cc: Jerin Jacob , Derek Chickles , Venkat Koppula , Mallesham Jatharakonda Date: Tue, 21 Feb 2017 14:56:52 +0530 Message-Id: <1487669225-30091-38-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: dc223938-013f-4c97-e8c8-08d45a3c3648 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:SN1PR07MB2285; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 3:uAUm6C8Fuxr6Dx9a1HCyEfRodOtsCiWNsCkeRIHVllkhxXYe8RK+xu7yjoZiN+yhQaJWp64d8Fw1GuW09J5+af7CmWkuyySVhA0gHlx4rF0BDtSyVSF6yx263t/2/LeHKVz7j4+2lboU18Z6a6Wen4TvcsKlXRQi6HTTtYUO84/fsUKvav7KwJp678o4HXualnRrcd3w4DhpOB1F7wrlmrnAxxyMD8L7S/6QAyFZxxNtU6d5NWUf7lE7as63lLo82BqVeNBPn0aytlBMOZccNg==; 25:kOP8cO4yef6sAxLDz/vp/Q7tuXT8N24l0XJ/ppfALtdraEBbp4xaDPUB21brykPxCBwW3N8AsjFCc8znAZUDArnNyBvvhyhenKpO1r3dx4sQ20wVy4wdjUJplW5hdu/CsOe2DBMIbZALqr2CLECJ4hndVQajr2m8rKsursLL5PxqAo4hZbqZzrSKVBGnGHsIUUOi99OP6mSRIXQumg7eq/+cefjmZR/Tci3pzwcahm5C3NWyj98e4RbRnRtKFLOpCJOjVZW/xCg/S0jV1aD+0izRIWcwrgtz3iz4O8QnrGSeLS9CYrdc6DvBtrCABsAknm4XZc08SwT59TU737TZ0Y3yN2rP5ieV/hr56CzhzvPRia3ilvMeuLhJ4la3IjqaAYGSmP4q2PnfXLGSMwwhWytyAUn6cscuRY1+2y3YrdP9c260d/a8fEn5ktQaWMEJrbIRxzMAqjQnzgrjo81yeA== X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 31:qY9boTTntfofYMwCHf3Wxwp2W4THu79A3WQLaYDtECx5raytvd4OduY41sLkRRyHjAwixE2KLIfoOSHRFj42rTR66f4y7ytQe8hL23rIaxLMhNfRbfUpRQpATvPDdorMdr9GVkhtxtI9ouUWThjPCEXPclOPtzGxf/1ShOy4uyPE+FMPE2ybw5+AKvJxCm9d9ZMuGKmGzP/sJkHSSDEvDktV5z1lbCxz67R7piDXY9E=; 20:bDixopaTlBsf7iTXqj3D07/Vb1xXhufPL0P6J2Bx0/Wo4Z8e6mccmhtcc3G9u8kYXmqsB9MKyQiY0xrPXmgF/uSlnh/PhCi/xEkKKGedwUOZCkPGZjUy9R23Es4ABwTfKwZa0Ju83MiNwjmjni+8UvabFmYwH5JG8lE0CpGEFLK/qUfB41L1oNJPpp5uGHyGZYLpoDPDXXjcH0mtHWmkpTr7iFN0F5gNEoTCy4Gdic25HKpIrIsRaOF91sqlfhL5XY7azBMOfih+mZV+61d59z5aYoIC7tscqn6dpD5meaNY65XZQ7aH7gXKKecPodWBQHJ3hKt653PLL26atk7USXrzJOlokmntEVAuQlcYoW8XgUHX/CuaVCoUEvmOyUZeYmiWqnugV1I6G7fNrjdCRmVHo0ja/KzzmBRcEyJNQFaPkpQEfHiJi9hB9xVnzYnupn+P5eO8waKQkiaN9TH0WjcQ32uKSNhOlFN329fDPG2naUrgXQy6MbBmlFyrzB/J8Hh1NNbed4DNbn3eXWY76sjlplKZOseisOiM+VRV5Q6dFCYGNEq/eZtzcgyXzanjpNTuXoNVAWhJdLqX5PXpKcDoATfouH82xYmQwX5niuc= 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:eBA7SpKN8pyDiwslIwfdpYXyfgt8dD7I5F0m5IFPul4XBJtKL+G6NUk9OmawZEu/HHd1i6HnufNS58sdrNfiOeK+Q0ZOhuAg7mQ/GSJK7BRTMbwnTvWyuE+RgRVy1LytoaDIP/UpftR+y39u6vfVZUOQqqR00ThAfW0UgDFJQ9k7tJ+ewviQ60nncxU6am97d+WUs3MnOcMwWPOao4BbtgaY+lEV/TgZIvrksWIJyV+lQpEzQA4Qj1tdkskj4w9p1JeeHCGGvq2DeIo/db9d73q6+07M8gSv04333wwB4pD98VOad7M2Sc5PeQeOPFyG2wIarLpr+kEMP9nymNykhd1zvMSWNPEXZP16ucScr3EYPsu8eQv5XchZUCUPIRKlPnp9gjFszcoqJYRoe9imquzLm+pLKwLZknvxUeliIn5fakvPST3ty7U2K5GQe0MOonK0t0MOGTtUXu9XNITHW69pFwGL/K6ebQoi0y5nCxEnKeA8/vD4aRnC/+AT60XQzIn9O+fuxRGwehHddmlrPxNTCwRu9tFvfndbPxc6VAfzNmM2I3NFv+a63an0XqDbK/eECNK7PH7MpgUcPoSkc4NbqYIAq85Tr4AxtP5cX3c= X-Forefront-PRVS: 0225B0D5BC X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39450400003)(39410400002)(39830400002)(189002)(199003)(50226002)(81166006)(42186005)(2361001)(575784001)(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)(83323001); 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; 23:Y6bKo76fhBbAdp7uy181oZEKU/ospnUez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zEEXZkY318Bh0ji4uVcJfaRhac2WuCtsdigPyx2x9uXpSJD5kvrjr3VQ5lyZJ01tLcr8AAj8S7PIJj6YclzU9FiUHKJUvt0yolIca5pcA==; 24:tlB8rVaylBCWuaoa8jlhW7BqkfGkoSoM5AsXc3Z0Ho5kYiIhcu11Fn/eSoK7jNECUECRxdKduH1k73xA0aUyx2SJCj3gQYJ4iCYl8G1Belk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 7:R3v6YRx8BoZ5whIrM9icvJHFh2J8z11wRHjb4AlsQa3iK+lMcvMZgo1+jUOCkSmYmGQXjkOJE7HqA8ik8B2USQtZXaBtVhQnmfw0CGaUUUSK3f3QS1umZsIZTXSDm6NvhuU+EDcfPhbqcA0cZjwo3TDAsuT9Gx1F+Qova6ns1zEMKyE0Ew9IbvpnX0Lfhpv3fiDuAXe+DpuStSKmKqaCdy35eFjcqkIQ+Ov4m2UPAF8CC1uD4y9QwRFhZhIiSVvRsdaaNsEXFT/4G6Irgf7tGsjNFQfP8qtk9b4OG1Y6ZRlKTYcES22dVNqW0gu3oXyFXt+Bzi7oIKX7LnNzNpPmUw== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2017 09:30:00.1992 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR07MB2285 Subject: [dpdk-dev] [PATCH 37/50] 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: Tue, 21 Feb 2017 09:30:04 -0000 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 | 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 3943438..8a0a60c 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 299d28b..0c2cdd8 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