From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0041.outbound.protection.outlook.com [104.47.36.41]) by dpdk.org (Postfix) with ESMTP id 948A41AEE8 for ; Sun, 8 Oct 2017 14:46:25 +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=kiUFKLTu0z3byHxlPFsnMFmSXSr5wiizEOy21YbWQgc=; b=MFTkYq9IUPIBUndJj+aQZfDepCEOo1EBT/rp59Qhx65HQiXoVeFMz+h03vcj9zhubQeEurNBYjjdPD7CNcaG3ZxILgl6dEzMNIXzUXnLLuXwcYEq9ZPqrl62lr7/ufLAZzL1XwuUuHmSvc8rXQkrE4KM9Ot+gfdZbkjNf+zEJDc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; Received: from localhost.localdomain (14.140.2.178) by BN6PR07MB3089.namprd07.prod.outlook.com (10.172.105.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Sun, 8 Oct 2017 12:46:22 +0000 From: Santosh Shukla To: dev@dpdk.org Cc: ferruh.yigit@intel.com, jerin.jacob@caviumnetworks.com, Santosh Shukla Date: Sun, 8 Oct 2017 18:14:29 +0530 Message-Id: <20171008124430.1866-26-santosh.shukla@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171008124430.1866-1-santosh.shukla@caviumnetworks.com> References: <20170831145436.5397-1-jerin.jacob@caviumnetworks.com> <20171008124430.1866-1-santosh.shukla@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: MA1PR01CA0113.INDPRD01.PROD.OUTLOOK.COM (10.174.56.157) To BN6PR07MB3089.namprd07.prod.outlook.com (10.172.105.7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e29405db-6d8c-468c-0e50-08d50e4a95c1 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:BN6PR07MB3089; X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3089; 3:PCgBYYbfz9SOEUMOKw67qHyoF3oumqqdyH+2vXkW/o6phq991d2AZSwNRVAvkYd9hY0WLvQvtPiGLRJV7Q+2FF+wxDhqBZuoQnn2W11DpBSiES3Icysar4iWjyUAEiG9z8EVH2g4/ezsAVfavmTsO2uyGZ5ha89mjZhw+NN/u5bGb4p3xR1zpJwe2CrddtSM9cIOh01FDV8Z6r4TXXv2Bf+akoRNVS0a0ixi7VotsyR8dNFj86yZd0WqzaqwyLgr; 25:7y1YKDHOboWo+vQO+dpiZZZelbXQd+IMqasezCcXq/+69niD/jlDWcZ1zuxFAuUby1ZuzBEtLobdA3FfzmDSeyOX3c/YVynE5cckmYm6PWivPLMZSMHw7ZbGS6H/7Bmm6KlresLLur5WtnzXzZUIx+VnXbYUvUjurME5M+RajI4DAaTBXAiiTQPbNQ0vq2G9fDJazDQO2Z4IEw+5I465E3oq87iGcM9gaaPulNf9/qQMHcQAVpcM4UmWkEKri5x3ZiJHGNSHRQHxn4dSr+1eZEEsi3l/YrCWy1hHBk3mQaZP0QVkY6XsrHaThi8uEtyx34p/UcXqifeCiida3Oo0bg==; 31:CALaTTQ7hgSruCs0H4Ta8ZYHPsYLgw87Gfy59ldAxoFTS9jQTZ9VBK4gmRDE67kmKH/GSc7hXH5Y7GEeBA+6G9tDrW+b+h+Bk/olaU7yTpF3xB8lLsp/QTZH0zaetq+iC8OKbaUtUvM9yzK8Zgrdv1fgrJWu75AUpNygd8G8cW4iA1ibM/BpRrlPwzlgFcsbnyIz4VF94lia/Ut5c7Ly95Qm8WT1owIP03V3BpTrypw= X-MS-TrafficTypeDiagnostic: BN6PR07MB3089: X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3089; 20:gTRDiXSNgmAxYLuJp5lDc0hIlF7p8HgJ/JI4Uctb5+6WwWNEHi7XALQLVuJivcpZLE6H9QSJOd5/FW5gc3KhyOZXJhnQN43acGpk14Lx1RlCNivyYIeZplHyJN2qiEorbLTByvVVDbnISzjtwy1/6RuT9jmcAqyPqnubtSAsmabYHtcktyCUZ27sCwSVmYhCT7jsWwvJfwOVZEzD2eMKNInRlHnTIjmJinjDoQBYRb6x+VLKI1IkVFUFvCYN7JQJ283HJ8D4qLkCRQwpv6TVsxNWHFll3OKF6aK4ERX6Jo0aVyq2mC69A1+C+MBgy8t+qGAqCLZswQy5onhj4pNCdDr33brZunxUqxj3RS+sAKRax4y0Ah/Hr6rJGy88XcudL9NxpM391/qupGZncdB046jNzzgJB6VGa9WgXeWopi+lkWllUKzw6bHH1XT+O8a0nN3AkW0y8QHwsGC3wsyqOT2Kt/Apcuh4CUt7E4faVFwsJyEvUGSqbAGqGG9twNritAbWbK6yqbfRct9VpbVJ420cg2NHxXDPNzjqtuLGkzIc8QeBjV4gkarOeNqrHWOLz1t59SMgzDglSSCmDLrsPyaSs+1caKnL0ITBfiy6cx4=; 4:gcxC/oOBTzXVEAWlLqS/TiteN4vMBljTevNmw9bRDOmiUS3pNI4Z8kSST5q3R1ug93MAUS79djjMb7qO1wCtUFzNiqNGuNzIC9NHi9tUSOPxDL92jtsky3UfbeIL0rfDgbQzwhjwwqy6u+JGqxglMGulnptbTOcqgXb736Ve7taxx/KSR653wj1JQmhytWvbYLYcn8iX5f+Su/RHSpIqSo+XX9Wy6Al3wAbrxrhe2tfpdn9+WbOKCk1sYW1IYfu7 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)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(100000703101)(100105400095)(6041248)(20161123562025)(20161123558100)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN6PR07MB3089; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN6PR07MB3089; X-Forefront-PRVS: 0454444834 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(6009001)(376002)(346002)(199003)(189002)(6916009)(42882006)(81166006)(575784001)(2950100002)(81156014)(8936002)(50226002)(6486002)(16526018)(189998001)(16586007)(316002)(6116002)(1076002)(6506006)(3846002)(7736002)(305945005)(8676002)(106356001)(105586002)(5009440100003)(53936002)(4326008)(66066001)(107886003)(47776003)(2906002)(5660300001)(6512007)(76176999)(5003940100001)(50986999)(97736004)(25786009)(101416001)(68736007)(48376002)(50466002)(478600001)(72206003)(2351001)(2361001)(33646002)(36756003)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR07MB3089; H:localhost.localdomain; 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; BN6PR07MB3089; 23:ZJfZK8T3kVtkxCxeq0aBQpmVZQvptc4hLwW1VTJ0k?= =?us-ascii?Q?dMH9E8ixKJ/rEl7UH6YjdRZRwa1f5svs/G/eWwdKsNN1BW24oxWm1E/Cfpfw?= =?us-ascii?Q?GcYWp38ycFc/hk534V9AAmqlvGSo4rj+/EcgCsQQUY/Zyo6TawDi2uHZMNWK?= =?us-ascii?Q?OOv1csl87ucsVjykXcUtd04AyGMbt++s3opM3XkZ8jaEg9+6jOhQyigCkKCp?= =?us-ascii?Q?7MOuP7OAN1tl9o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amDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2017 12:46:22.6802 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR07MB3089 Subject: [dpdk-dev] [PATCH v2 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: Sun, 08 Oct 2017 12:46:27 -0000 From: Jerin Jacob add start, stop and close support. Signed-off-by: Jerin Jacob Co-authored-by: Santosh Shukla Signed-off-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