From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5DCB0A04EF; Mon, 1 Jun 2020 15:57:27 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A350C1C19C; Mon, 1 Jun 2020 15:57:26 +0200 (CEST) Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-eopbgr750048.outbound.protection.outlook.com [40.107.75.48]) by dpdk.org (Postfix) with ESMTP id 5A3E74C90 for ; Mon, 1 Jun 2020 15:57:25 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lH9rKdXNY8qYvueGVgzU1h48SmPxdOtIWLgTv8nJ8ySjrlBgOFFpPF5ORrSQKBVUziQ+R/4snXGqILh6t8+BOlWRBlLA9x05I3Blpf1cT1oBQaAL5oMI8Z1bTu+7qvQGRDtIARy8DMWMFReXk1IBS0lJ/ZjWcR6e1eJb1mQ8FzicAFniRQutCHH3tPbg5yy1OmFxSB92buxvnts0b609KwGKxxd/fxC868NWOim4oTdVA5kYhg8RxUpYHiy5kvA7UdHQ0b1Fek7MfIEh5z5kqTphn9abJLNXEvOSWVqu8Crjt8jCMyXoKI1Gl7Fb1R8leNfEdRXKxEuQp/LDwV7hAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VYgcFd9XFqg6Yc8NnaIqgXN1K9Hq0sCDqWlWulGGsDI=; b=dYjV7cbTTg7kDfF8R+1goXWStM6pmXQkJGK0Ca9CdRsL89tqV6XGt6iJBzsCxsfCqgtjjHYATZHyAJS+XBwXPHv6bh2SdR29nHEtTFhmVMphhb46bPeQ9qG0LjZsY3u2gCsyLwxlCmsAUyPFOncbeX8P++GLkKdCzibZD7/V7wpSSbkYiDH+Rlcj4OpgPe3Y2Osh951G2Ww014deByASbsQ2LKGVY7w8tU4SRTsixBO1G9sCb3jFTLqyv1lsug24w6VMV/Y9nEXNK4aDQO9zze9IOTBJ5dBQEqizhqtxhRRE+LRnAZdbp7naH7uaGTFSXbjPSl4sPeptgkbWqWHP6Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VYgcFd9XFqg6Yc8NnaIqgXN1K9Hq0sCDqWlWulGGsDI=; b=MUp1Yj+uwPeUWfYfN0CBG3u225qjeRAVcwOEnhTV9p4f7IHy4D9GUpuYVV+dm/2Atw9MQJ/lGFdha38M+itAO9MgdiIEbRyp23bEEhWLeBNJbtXZNiZcLz5nH2OvjFohIHwgqtWX7anYJx58zpeE7GPlfU/LEeG815AF939xGYc= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=amd.com; Received: from SN6PR12MB2704.namprd12.prod.outlook.com (2603:10b6:805:72::20) by SN6PR12MB2765.namprd12.prod.outlook.com (2603:10b6:805:77::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.17; Mon, 1 Jun 2020 13:57:23 +0000 Received: from SN6PR12MB2704.namprd12.prod.outlook.com ([fe80::41be:1aa:2c92:71e4]) by SN6PR12MB2704.namprd12.prod.outlook.com ([fe80::41be:1aa:2c92:71e4%3]) with mapi id 15.20.3045.024; Mon, 1 Jun 2020 13:57:23 +0000 From: selwin.sebastian@amd.com To: dev@dpdk.org Cc: asomalap@amd.com Date: Mon, 1 Jun 2020 19:27:03 +0530 Message-Id: <20200601135703.18815-1-selwin.sebastian@amd.com> X-Mailer: git-send-email 2.17.1 Content-Type: text/plain X-ClientProxiedBy: MAXPR01CA0096.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:5d::14) To SN6PR12MB2704.namprd12.prod.outlook.com (2603:10b6:805:72::20) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from cae-Bilby-RV1.amd.com (165.204.156.251) by MAXPR01CA0096.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:5d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.17 via Frontend Transport; Mon, 1 Jun 2020 13:57:22 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [165.204.156.251] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a5bbea9b-8928-4b4e-f634-08d80633b578 X-MS-TrafficTypeDiagnostic: SN6PR12MB2765: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:962; X-Forefront-PRVS: 0421BF7135 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DeqENBJL4ZfDgiPU2Gbh6c4YtOQ/oVaW0eqASUfaIUWcxQwhjpvTlhDP17EjaDBkqFuw87kaHzrlIxgknQga7zNqUl/BDwTYf4PGIq7AVM2v17R5lNKr12R7kkEckg4JHJ5nM8wH381wA8ySd98z5yGpGpc58WL1wHwKNjT74tm9/iS+X6B9XNuPKdN/uWhT/a9ydPfHlCHVxoDKJf3/50p6J5w+OqPBLeW67DeEQtdVlzzeDS95oRBtDoWbPBmtQA+u9q0aNvWTm51Rmd8BFi6JjJyacnSqf7QQjhFWAQzbJDcLFFkuFUDaL/P1WtzSB6sKiL8hsn6dqlwvTCISyQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN6PR12MB2704.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(136003)(39860400002)(376002)(346002)(366004)(396003)(9686003)(86362001)(186003)(16526019)(956004)(6916009)(478600001)(2906002)(2616005)(36756003)(52116002)(7696005)(4326008)(8676002)(26005)(8936002)(1076003)(6666004)(5660300002)(6486002)(66556008)(66476007)(316002)(66946007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Xenwzj09TtPVlm+6ALkNwoz42jBGaFKvruUwdRC13boV+Kn9DzvropK+/LfwDB+lEZxu9NEH097WMleWSnwhXKlo2VILaQa2ITnRW9QEzU1pTJd26hfBNvs7hlAcaJDMraBLMR4U8QPJ4HWQVJc1mNYZtmZBE4r882SF4n+8GlwfSNT25qjnlXRFhjuKncBRh0YYFe5D9AEItPf4kZcafYTHVJUAkn0DszYDH1Tfq5yKo+yKJ1OfNoQrfpAfn4i4OG9DAGmnnCJRF8HYLGNbTPHickgcoK7OBErweDqosUr3j2lPpN72B+yRd1crYGTcj1I/yxvPWV+6/RRjvG5z3OrDtXGJ3aHiRSbXdekfZJZIbKsgNX7Sb5cfv41RCzvcSHfRsBecJYAUjnB3WvvmmreAW5juDNn4E1k1S26j+TTDFLVqy2qFyH5TLbF/jM0RrJsmRE6ohE7n+Ly4Dmp1Po1k/5jlrhZRJVMAQAis/P7lnMFF3VE7BSseDbex2VQZ X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: a5bbea9b-8928-4b4e-f634-08d80633b578 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2020 13:57:23.5534 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Gpi2glE7p28twTWWl6DA6Dr4vtNwi311s1fGWou54KVYTwFF1gz77MmopPqLgzozcKEGgtKT5ohNZtSVepSKqQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2765 Subject: [dpdk-dev] [PATCH v1] net/axgbe: add support for utility APIs 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Selwin Sebastian Add support for rx, tx queue utility APIs Add support for 'fw_revision_get' API Signed-off-by: Selwin Sebastian --- drivers/net/axgbe/axgbe_ethdev.c | 7 +++ drivers/net/axgbe/axgbe_rxtx.c | 89 ++++++++++++++++++++++++++++++++ drivers/net/axgbe/axgbe_rxtx.h | 4 ++ 3 files changed, 100 insertions(+) diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c index 867058845..e943d1dae 100644 --- a/drivers/net/axgbe/axgbe_ethdev.c +++ b/drivers/net/axgbe/axgbe_ethdev.c @@ -214,6 +214,11 @@ static const struct eth_dev_ops axgbe_eth_dev_ops = { .dev_supported_ptypes_get = axgbe_dev_supported_ptypes_get, .rx_descriptor_status = axgbe_dev_rx_descriptor_status, .tx_descriptor_status = axgbe_dev_tx_descriptor_status, + .rx_queue_start = axgbe_dev_rx_queue_start, + .rx_queue_stop = axgbe_dev_rx_queue_stop, + .tx_queue_start = axgbe_dev_tx_queue_start, + .tx_queue_stop = axgbe_dev_tx_queue_stop, + .fw_version_get = axgbe_dev_fw_version_get, }; static int axgbe_phy_reset(struct axgbe_port *pdata) @@ -1006,6 +1011,8 @@ axgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) DEV_TX_OFFLOAD_IPV4_CKSUM | DEV_TX_OFFLOAD_UDP_CKSUM | DEV_TX_OFFLOAD_TCP_CKSUM; + dev_info->dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP | + RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP; if (pdata->hw_feat.rss) { dev_info->flow_type_rss_offloads = AXGBE_RSS_OFFLOAD; diff --git a/drivers/net/axgbe/axgbe_rxtx.c b/drivers/net/axgbe/axgbe_rxtx.c index 30c467db7..495e07902 100644 --- a/drivers/net/axgbe/axgbe_rxtx.c +++ b/drivers/net/axgbe/axgbe_rxtx.c @@ -565,6 +565,95 @@ int axgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, return 0; } +int axgbe_dev_tx_queue_start(struct rte_eth_dev *eth_dev, + uint16_t queue_idx) +{ + struct axgbe_port *pdata = + (struct axgbe_port *)eth_dev->data->dev_private; + int ret = 0; + + PMD_INIT_FUNC_TRACE(); + + AXGMAC_MTL_IOWRITE_BITS(pdata, queue_idx, + MTL_Q_TQOMR, TXQEN, MTL_Q_ENABLED); + eth_dev->data->tx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STARTED; + + return ret; +} + +int axgbe_dev_tx_queue_stop(struct rte_eth_dev *eth_dev, + uint16_t queue_idx) +{ + int ret = 0; + struct axgbe_port *pdata = + (struct axgbe_port *)eth_dev->data->dev_private; + + PMD_INIT_FUNC_TRACE(); + + AXGMAC_MTL_IOWRITE_BITS(pdata, queue_idx, MTL_Q_TQOMR, TXQEN, 0); + eth_dev->data->tx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STOPPED; + + return ret; +} + +int axgbe_dev_rx_queue_start(struct rte_eth_dev *eth_dev, + uint16_t queue_idx) +{ + struct axgbe_port *pdata = + (struct axgbe_port *)eth_dev->data->dev_private; + unsigned int reg_val = 0; + int ret = 0; + + PMD_INIT_FUNC_TRACE(); + + reg_val |= (0x02 << (queue_idx << 1)); + AXGMAC_IOWRITE(pdata, MAC_RQC0R, reg_val); + eth_dev->data->rx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STARTED; + + return ret; +} + +int axgbe_dev_rx_queue_stop(struct rte_eth_dev *eth_dev, + uint16_t queue_idx) +{ + int ret = 0; + struct axgbe_port *pdata = + (struct axgbe_port *)eth_dev->data->dev_private; + struct axgbe_rx_queue *rxq; + + PMD_INIT_FUNC_TRACE(); + + AXGMAC_IOWRITE(pdata, MAC_RQC0R, 0); + rxq = eth_dev->data->rx_queues[queue_idx]; + + /* Disable Rx DMA channel */ + AXGMAC_DMA_IOWRITE_BITS(rxq, DMA_CH_RCR, SR, 0); + eth_dev->data->rx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STOPPED; + + return ret; +} + +int axgbe_dev_fw_version_get(struct rte_eth_dev *eth_dev, + char *fw_version, size_t fw_size) +{ + struct axgbe_port *pdata; + struct axgbe_hw_features *hw_feat; + char fw_ver[32]; + + pdata = (struct axgbe_port *)eth_dev->data->dev_private; + hw_feat = &pdata->hw_feat; + + if (fw_version == NULL || fw_size <= 0) + return -EINVAL; + + snprintf(fw_version, sizeof(fw_ver), "%d.%d.%d", + AXGMAC_GET_BITS(hw_feat->version, MAC_VR, USERVER), + AXGMAC_GET_BITS(hw_feat->version, MAC_VR, DEVID), + AXGMAC_GET_BITS(hw_feat->version, MAC_VR, SNPSVER)); + + return 0; +} + static void axgbe_txq_prepare_tx_stop(struct axgbe_port *pdata, unsigned int queue) { diff --git a/drivers/net/axgbe/axgbe_rxtx.h b/drivers/net/axgbe/axgbe_rxtx.h index f2fbe9299..3e05e0e6f 100644 --- a/drivers/net/axgbe/axgbe_rxtx.h +++ b/drivers/net/axgbe/axgbe_rxtx.h @@ -161,6 +161,10 @@ void axgbe_dev_enable_tx(struct rte_eth_dev *dev); void axgbe_dev_disable_tx(struct rte_eth_dev *dev); int axgbe_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id); int axgbe_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id); +int axgbe_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t queue_idx); +int axgbe_dev_rx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t queue_idx); +int axgbe_dev_fw_version_get(struct rte_eth_dev *eth_dev, + char *fw_version, size_t fw_size); uint16_t axgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts); -- 2.17.1