From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0076.outbound.protection.outlook.com [104.47.42.76]) by dpdk.org (Postfix) with ESMTP id 604049113 for ; Thu, 31 Aug 2017 16:56:22 +0200 (CEST) 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=OD2DXZ+/4YhlJKFichUmUuD86pPUbR/npPWBhnz/9dY=; b=oEtkpXv4mx5XliPuP8ZsdQUsRJ3bquzRPmrzk3IEA7pGWU5sSf7lODpRopW9qCmxJk9nowP57u6gys3JEe6kQi7Uw0gxGQwecgv/CsBSn1BGYzYje8lr8VdHC4ID3FVbSBUnnyThce0SLBr+s9kHlkp7VrryPlJ6/gHPlN06Hnk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.JacobKollanukkaran@cavium.com; Received: from jerin.domain.name (171.76.126.71) by SN2PR07MB2526.namprd07.prod.outlook.com (2603:10b6:804:6::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.13.10; Thu, 31 Aug 2017 14:56:19 +0000 From: Jerin Jacob To: dev@dpdk.org Cc: ferruh.yigit@intel.com, santosh.shukla@caviumnetworks.com, Jerin Jacob Date: Thu, 31 Aug 2017 20:24:35 +0530 Message-Id: <20170831145436.5397-26-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170831145436.5397-1-jerin.jacob@caviumnetworks.com> References: <20170831145436.5397-1-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [171.76.126.71] X-ClientProxiedBy: MA1PR01CA0109.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::25) To SN2PR07MB2526.namprd07.prod.outlook.com (2603:10b6:804:6::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 074e555c-173d-4d30-1363-08d4f0807117 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:SN2PR07MB2526; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2526; 3:90XdAit8pmx1zv6cSslJapXyTH55KeMR9mBIg5koJ1BhvvFezmF0fDyABOy07Mj7vU5ibFZZ2dwRzybxBbm1lrhmoqMkTJuSgqiF2KqaCW0/wUmQ5fFe7sGKei2VYuA8ut+DimSX/WR0zh/DX5n/7q3RP5NTtaD9dXFyNgokNtWzpenVzGeIwVrMHLwI8MVOu4DdQpE3MqPlxNIqRA7I0WFeXtQatAtabdlbPxzmimO49P1I9xTo0Ge9Vx3NQzQ3; 25:pKE/VK/Q2b/Tlj35JIb9BYO5ypdO5p1vfA7LW+sn9beTF4bQhbz5RHfMhqHKkT+vpsbMp1OTL0Nl/YDPgaBlupxcxpoz6s8PQuYmKRc7rA43q8B5NxhxpTjdODFWVXLfLZXlTCZdSbq14QxZyUhZxZtKN+MceWVMwoWVmcB+IIvDiOHTL5mm8LM2KrUvxAKYQYRhDGu/ZDX/+x4NrTcecsZzr6ZxPAdFBraEUKtduuaWbz38iebWmrmcWu/3DT0gj5OMvA9+AejZoaIiOAMIK9l4gmW3KFJ/Pd4FA8SZf5i2FIqTmwhcVPme+vtc4CnRAolkmagT5jEUiPb1kpeRdg==; 31:TG4SFjgkgN1RWSSahAKxWWdiSshQJ18CcmCnQgbTn+f/5KVqxQ3JUokz/54TeXm4hYvvrADcU6Amidz89vOexxrg49jGw8VfuTLH1rI8TLqAPpVhDgtS7YT1LBvBAPHJ9x+5lteSarcW2+SR+erEYAoRBRI7JNrUU+fyuNNe/161nZRSItT/pZwDAKV9CM3HHw1RcbThca2lwpieCJ2WgAPgMql/l/3EjlZvy3l+C10= X-MS-TrafficTypeDiagnostic: SN2PR07MB2526: X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2526; 20:7MWrQ3SWs2vu9s3isHCYuXvlPgKwgeYhkBCUgsxgx07+u2/YPNk02rUJJBeXTVyXtHd0eqfcMRJ5ntRStBP5xRhTOqwoY51N73gj8PUEeHRktHsMVVnySPUfaEUoAfbcN9R6BmU6hPSfgKxSmmwDttuR1SRi3mSPIpI5k8kHwgjpIQwb3lRidSWuT2usX67JHNLQuckD2HdJN2VqLQcm6znjW8tBRXTDmxdyneZPPMi1B4MBxOyShv5XAG9+eubfJG1lWsEOIPhzObw4x12lNxeguf0lzsVCKjeCP1XXMrXdw8X7p8QyRLKha1wz938ZlG9CSHZfwvn1y8lVWA+RF2tBl/eZOfWFlxJsMrl2jVOddoRTgWQi/C06dTn8dzjXnWoonehStLtwCPi5T2OSEnEvFAnii8nNJ4NZS/ROTTMnFju0WHZ8Q8BOvgMKparepBtbvsI25EylKtWpUKWgsqXvWiJuaRzwrE6wGFYvRQM1+X4HrFPar5iSPqJwBnUgm5x41GApxkXtxKhnX/j5p7bq6SIHzyqO8qyCfgsCJqRw6DOlW8liF9i8IIBtmhBcCLv1q68HgJe6jgqzEr7d99a13PoqJ/v/t3vjt4m/rC8=; 4:DXiuv6lqPDyhCsNPofWKQ04kq0BTT4uIuIYTGUEqfTtjjbxWtwpTSbrGKUk3iOx8/WIULp2MPUDBOLmso9S75TB8+k/NJz/NdZ5rqqPSdFzg8am5NlRKOmtUFfcwwhlKiZ1y7uplPL1cXKrOqnO5/NZErFkpI9FNQ8UVqPK4QT6UE/Er/buP3KGYJ9WmiTBgEjQ62Mye814lpWXsMKUkxcfqstKHC8YgcLXjt3aXSVWwMLgvPWk/v6YGrqV61v8l X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(93006095)(100000703101)(100105400095)(10201501046)(3002001)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123564025)(20161123562025)(20161123560025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:SN2PR07MB2526; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:SN2PR07MB2526; X-Forefront-PRVS: 04163EF38A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(199003)(189002)(25786009)(1076002)(53936002)(3846002)(6116002)(575784001)(478600001)(110136004)(72206003)(7736002)(6666003)(107886003)(6512007)(305945005)(6506006)(36756003)(6486002)(68736007)(5003940100001)(189998001)(50986999)(42882006)(106356001)(101416001)(76176999)(2950100002)(6916009)(5660300001)(2361001)(33646002)(2351001)(2906002)(4326008)(97736004)(105586002)(48376002)(50466002)(81166006)(66066001)(69596002)(8936002)(47776003)(53416004)(8676002)(50226002)(81156014)(42186005); DIR:OUT; SFP:1101; SCL:1; SRVR:SN2PR07MB2526; H:jerin.domain.name; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; SN2PR07MB2526; 23:NVlzhlVvi1PB3gTYNBdNvrqYqcODCjbRdGVOh5MiR?= =?us-ascii?Q?CaQG66o4G1qPoKLJz7A3I6pnarorvB9uZkaiGjNHn8CbBQqlb4bRN35v52tV?= =?us-ascii?Q?ruAn2f57PmZld325jEyBn8t7N9Q+47rtg3McskbZkIMOSNaByUkdnoW6hmnv?= =?us-ascii?Q?1VW5HsGN+oH4M3y9V3e4eDG+Lq1D41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agnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2017 14:56:19.4119 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2526 Subject: [dpdk-dev] [PATCH 25/26] net/octeontx: add start and stop support 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, 31 Aug 2017 14:56:23 -0000 add start, stop and close support. Signed-off-by: Jerin Jacob Co-authored-by: Santosh Shukla --- drivers/net/octeontx/octeontx_ethdev.c | 137 +++++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+) diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c index cc0badb88..d41904fad 100644 --- a/drivers/net/octeontx/octeontx_ethdev.c +++ b/drivers/net/octeontx/octeontx_ethdev.c @@ -161,6 +161,14 @@ octeontx_port_close(struct octeontx_nic *nic) octeontx_log_dbg("port closed %d", nic->port_id); } +static int +octeontx_port_start(struct octeontx_nic *nic) +{ + PMD_INIT_FUNC_TRACE(); + + return octeontx_bgx_port_start(nic->port_id); +} + static int octeontx_port_stop(struct octeontx_nic *nic) { @@ -336,6 +344,130 @@ octeontx_dev_configure(struct rte_eth_dev *dev) return 0; } +static void +octeontx_dev_close(struct rte_eth_dev *dev) +{ + struct octeontx_txq *txq = NULL; + struct octeontx_nic *nic = octeontx_pmd_priv(dev); + unsigned int i; + int ret; + + PMD_INIT_FUNC_TRACE(); + + rte_event_dev_close(nic->evdev); + + ret = octeontx_pko_channel_close(nic->base_ochan); + if (ret < 0) { + octeontx_log_err("failed to close channel %d VF%d %d %d", + nic->base_ochan, nic->port_id, nic->num_tx_queues, + ret); + } + /* Free txq resources for this port */ + for (i = 0; i < nic->num_tx_queues; i++) { + txq = dev->data->tx_queues[i]; + if (!txq) + continue; + + rte_free(txq); + } +} + +static int +octeontx_dev_start(struct rte_eth_dev *dev) +{ + struct octeontx_nic *nic = octeontx_pmd_priv(dev); + int ret; + + ret = 0; + + PMD_INIT_FUNC_TRACE(); + /* + * Tx start + */ + dev->tx_pkt_burst = octeontx_xmit_pkts; + ret = octeontx_pko_channel_start(nic->base_ochan); + if (ret < 0) { + octeontx_log_err("fail to conf VF%d no. txq %d chan %d ret %d", + nic->port_id, nic->num_tx_queues, nic->base_ochan, + ret); + goto error; + } + + /* + * Rx start + */ + dev->rx_pkt_burst = octeontx_recv_pkts; + ret = octeontx_pki_port_start(nic->port_id); + if (ret < 0) { + octeontx_log_err("fail to start Rx on port %d", nic->port_id); + goto channel_stop_error; + } + + /* + * Start port + */ + ret = octeontx_port_start(nic); + if (ret < 0) { + octeontx_log_err("failed start port %d", ret); + goto pki_port_stop_error; + } + + PMD_TX_LOG(DEBUG, "pko: start channel %d no.of txq %d port %d", + nic->base_ochan, nic->num_tx_queues, nic->port_id); + + ret = rte_event_dev_start(nic->evdev); + if (ret < 0) { + octeontx_log_err("failed to start evdev: ret (%d)", ret); + goto pki_port_stop_error; + } + + /* Success */ + return ret; + +pki_port_stop_error: + octeontx_pki_port_stop(nic->port_id); +channel_stop_error: + octeontx_pko_channel_stop(nic->base_ochan); +error: + return ret; +} + +static void +octeontx_dev_stop(struct rte_eth_dev *dev) +{ + struct octeontx_nic *nic = octeontx_pmd_priv(dev); + int ret; + + PMD_INIT_FUNC_TRACE(); + + rte_event_dev_stop(nic->evdev); + + ret = octeontx_port_stop(nic); + if (ret < 0) { + octeontx_log_err("failed to req stop port %d res=%d", + nic->port_id, ret); + return; + } + + ret = octeontx_pki_port_stop(nic->port_id); + if (ret < 0) { + octeontx_log_err("failed to stop pki port %d res=%d", + nic->port_id, ret); + return; + } + + ret = octeontx_pko_channel_stop(nic->base_ochan); + if (ret < 0) { + octeontx_log_err("failed to stop channel %d VF%d %d %d", + nic->base_ochan, nic->port_id, nic->num_tx_queues, + ret); + return; + } + + dev->tx_pkt_burst = NULL; + dev->rx_pkt_burst = NULL; +} + static void octeontx_dev_promisc_enable(struct rte_eth_dev *dev) { @@ -865,6 +997,9 @@ octeontx_dev_supported_ptypes_get(struct rte_eth_dev *dev) static const struct eth_dev_ops octeontx_dev_ops = { .dev_configure = octeontx_dev_configure, .dev_infos_get = octeontx_dev_info, + .dev_close = octeontx_dev_close, + .dev_start = octeontx_dev_start, + .dev_stop = octeontx_dev_stop, .promiscuous_enable = octeontx_dev_promisc_enable, .promiscuous_disable = octeontx_dev_promisc_disable, .link_update = octeontx_dev_link_update, @@ -900,6 +1035,8 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev, if (eth_dev == NULL) return -ENODEV; + eth_dev->tx_pkt_burst = octeontx_xmit_pkts; + eth_dev->rx_pkt_burst = octeontx_recv_pkts; return 0; } -- 2.14.1