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 DCACFA04DD; Thu, 19 Nov 2020 14:22:24 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 974505AA7; Thu, 19 Nov 2020 14:22:23 +0100 (CET) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2078.outbound.protection.outlook.com [40.107.92.78]) by dpdk.org (Postfix) with ESMTP id 71FAE592C for ; Thu, 19 Nov 2020 14:22:20 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kd/lhd1ykyp2UHv+OmvsIFKj7iiDpxBbYA5ceLUfuhPvF8f9d7EqKT3ylX2qbydy6V5t1yPuMseGyNAMW3KpHoIdyCakJE/WKNzMcEQclzMVD6N/slxOIM9FtLHHFLQ4tAQXHlTebvlwaQwsNA3TaU647tLdKJwIPLQ29TUvASO1vOBLsyUjPvJZZVDyyL6R0KUfIOr88Z9qLqYJ1hWjV0WtMrDJS6T2RXJp3a3VHng/BzSFaTeujbFmpzVct4FKM2vYamcZWoBfkz1rxRE7e6oe/j8qHuU1CLTgKtdWsz/OXeByv/9OxVp/sJD/WuQjAbOw0B/JBkfGhmXp7Dt7PA== 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=Wg3lcw9Rb712IAI4vjDTHcbX1N8YlfUBLLVHonxS0ZE=; b=lG/R3QDsOy7ljiOmvAFOgzPw/TKQhnTkKvvJkwFZUYAFqDVU19cqw1jzt9dTSggWeU1oHVoKcBY8afebaETrMVSfBZ8BpRYQOstgz3ThzaOxVTi+4MuUGFatrdFCgc8j5CrD3/4djI0QzILhrODNQ7Q2zM2JWbS3EHkIGTyJkkuGAmhM3+aFpf67j0huo8QmZULz8gAE77rbVnzZKXK0cdsYJh3xuY6YY23V/ciXILh1G+RsVFx989zItIBIA7iGNiQN9G0Czxrdpd+2MNEXQRVcDIpiwppwiURz77hgR8a5tNpQAhH9GnY206Qw/oLo+wK0OC2Lk9B7cceEUUbWTg== 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=Wg3lcw9Rb712IAI4vjDTHcbX1N8YlfUBLLVHonxS0ZE=; b=IA6a2/hJ8ovufuu4xkxNYIpkETLzTenmTdUmY98Z9FQD0xGg11OonZFhhslO/sMhPuEQspiHpPWlD6PRf1obN+/DOhwM/NJiUZ9SpPr+IwsO4t8bf+Uo749yhT/+jKCoRKteSRzmpcJ9lBVnew0OyUugyDrn3vj1jLuteyWGFWo= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=amd.com; Received: from MWHPR1201MB2542.namprd12.prod.outlook.com (2603:10b6:300:e8::20) by MWHPR1201MB2493.namprd12.prod.outlook.com (2603:10b6:300:ec::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3589.22; Thu, 19 Nov 2020 13:22:17 +0000 Received: from MWHPR1201MB2542.namprd12.prod.outlook.com ([fe80::e5d1:2be0:3306:6b26]) by MWHPR1201MB2542.namprd12.prod.outlook.com ([fe80::e5d1:2be0:3306:6b26%9]) with mapi id 15.20.3589.024; Thu, 19 Nov 2020 13:22:16 +0000 From: selwin.sebastian@amd.com To: dev@dpdk.org Cc: amaranath.somalapuram@amd.com Date: Thu, 19 Nov 2020 18:51:58 +0530 Message-Id: <20201119132158.10821-1-selwin.sebastian@amd.com> X-Mailer: git-send-email 2.17.1 Content-Type: text/plain X-Originating-IP: [165.204.156.251] X-ClientProxiedBy: MAXPR0101CA0069.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::31) To MWHPR1201MB2542.namprd12.prod.outlook.com (2603:10b6:300:e8::20) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from cae-Bilby-RV1.amd.com (165.204.156.251) by MAXPR0101CA0069.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3589.20 via Frontend Transport; Thu, 19 Nov 2020 13:22:15 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: f713e41a-f18e-4821-56c1-08d88c8e2246 X-MS-TrafficTypeDiagnostic: MWHPR1201MB2493: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1751; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GiuZKk0a1943sL9Pzrd0sjf9U+RhyPC1cOcW0cfekH6nZqu9HQqd1ZRLjBO5544PXYgQvmHS99+SaGfq/aaJ0bI+zJ+Ffzxyak/ACWcRlpYZmXsRO8TFZHLm0/zhqZ0cPZXCEkG0OIdoxkCscwy5b/ao/+m7cqxtMSR5Gtu25YSYgAfXBPu6CG3zKxWGSwVNWXNoVEnBDDyxPaUw4j44sW7H//8Qnevfm9elFzBbk1KPeegMdoYkjU6VXNQd66yIURKsMCrEs8gbhWmVNRju56zweRd0HhINhcc8yi5ErK/mSmEgAVlKBty4yDtxq/5+ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1201MB2542.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(366004)(346002)(136003)(39860400002)(376002)(8936002)(66556008)(2906002)(86362001)(66476007)(6916009)(83380400001)(316002)(5660300002)(8676002)(52116002)(186003)(16526019)(7696005)(36756003)(1076003)(6486002)(4326008)(6666004)(956004)(2616005)(26005)(478600001)(66946007)(9686003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: wo2q8UTKJT0Qk/9+FmAmCxXNSgDjygqKg+ueit9eYk2fHVaH3dIjfAqtAT0coItFccN1yWQyQh9UN23fcuvmBkyNV8cqu/le0mbcwP4InisTD7kUGVIps19+VHcFP3TG2L6djBkTZ/J/rBMummj2eU+Q9lLuUqBViR6RAXCDyWkWPCwzHduVwMZym9L+D0jX/PqpZzg/nQS365MAxhv6DtPj/mN9fgIeKSWyhXHRVu2YwLswJPjq5825gWWdIvF8Uld6rGL9cq8DGco+4DdQGfV44PJ/HUoQVxpHx22goLyWOCUdR9Q6TM+fJiinFiXU/ulvSw35AFZMn0OwQg+TDapEI4krN5GZxZ9OPWrjJ8TXWtcPzZQVGGVIyYQnGUeKzV2gj6PFcBpzl3+xwQTSsJbgJTucy20oFsutjfEtXyL0P2ytnuGKiuLxAToP4rC9Mi0zwM6ajWxS+g44BN7lOL06JczB2BcA0c37idvVb7e9MozIiDHEyWFfXTftT++DK58fvJWaLBJl2IsYnIYbnW4qz0a6NuPKzLOCpJN9ftwsEi/CMwHupXMl9BMxQfYkkDN6qQmbS1SbVY7HWMqWY6KQcT5rRKmM/dxmkGSu/ye3NqR36MHjJzblzh+/a/yCkKGaqObl7BNEGy1jtm/lug== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: f713e41a-f18e-4821-56c1-08d88c8e2246 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1201MB2542.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Nov 2020 13:22:16.4703 (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: oUKhvNHv75v/i/twfBRLKhYlnpWnxbJoksRMAyN1MXsISFGBC9duwSTjSEmYhX0EXuA0icPJaaW+zY3nfj/XRQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1201MB2493 Subject: [dpdk-dev] [PATCH v1] net/axgbe: add support for device reset 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 Added support for device reset Signed-off-by: Selwin Sebastian --- drivers/net/axgbe/axgbe_ethdev.c | 75 ++++++++++++++++++++++++-------- 1 file changed, 56 insertions(+), 19 deletions(-) diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c index cfe6aba73..4c6366da8 100644 --- a/drivers/net/axgbe/axgbe_ethdev.c +++ b/drivers/net/axgbe/axgbe_ethdev.c @@ -16,6 +16,7 @@ static int axgbe_dev_start(struct rte_eth_dev *dev); static int axgbe_dev_stop(struct rte_eth_dev *dev); static void axgbe_dev_interrupt_handler(void *param); static int axgbe_dev_close(struct rte_eth_dev *dev); +static int axgbe_dev_reset(struct rte_eth_dev *dev); static int axgbe_dev_promiscuous_enable(struct rte_eth_dev *dev); static int axgbe_dev_promiscuous_disable(struct rte_eth_dev *dev); static int axgbe_dev_allmulticast_enable(struct rte_eth_dev *dev); @@ -215,6 +216,7 @@ static const struct eth_dev_ops axgbe_eth_dev_ops = { .dev_start = axgbe_dev_start, .dev_stop = axgbe_dev_stop, .dev_close = axgbe_dev_close, + .dev_reset = axgbe_dev_reset, .promiscuous_enable = axgbe_dev_promiscuous_enable, .promiscuous_disable = axgbe_dev_promiscuous_disable, .allmulticast_enable = axgbe_dev_allmulticast_enable, @@ -618,6 +620,20 @@ axgbe_dev_rss_hash_conf_get(struct rte_eth_dev *dev, return 0; } +static int +axgbe_dev_reset(struct rte_eth_dev *dev) +{ + int ret = 0; + + ret = axgbe_dev_close(dev); + if (ret) + return ret; + + ret = eth_axgbe_dev_init(dev); + + return ret; +} + static void axgbe_dev_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) { @@ -1104,22 +1120,33 @@ axgbe_dev_stats_get(struct rte_eth_dev *dev, for (i = 0; i < dev->data->nb_rx_queues; i++) { rxq = dev->data->rx_queues[i]; - stats->q_ipackets[i] = rxq->pkts; - stats->ipackets += rxq->pkts; - stats->q_ibytes[i] = rxq->bytes; - stats->ibytes += rxq->bytes; - stats->rx_nombuf += rxq->rx_mbuf_alloc_failed; - stats->q_errors[i] = rxq->errors + rxq->rx_mbuf_alloc_failed; - stats->ierrors += rxq->errors; + if (rxq) { + stats->q_ipackets[i] = rxq->pkts; + stats->ipackets += rxq->pkts; + stats->q_ibytes[i] = rxq->bytes; + stats->ibytes += rxq->bytes; + stats->rx_nombuf += rxq->rx_mbuf_alloc_failed; + stats->q_errors[i] = rxq->errors + + rxq->rx_mbuf_alloc_failed; + stats->ierrors += rxq->errors; + } else { + PMD_DRV_LOG(DEBUG, "Rx queue not setup for port %d\n", + dev->data->port_id); + } } for (i = 0; i < dev->data->nb_tx_queues; i++) { txq = dev->data->tx_queues[i]; - stats->q_opackets[i] = txq->pkts; - stats->opackets += txq->pkts; - stats->q_obytes[i] = txq->bytes; - stats->obytes += txq->bytes; - stats->oerrors += txq->errors; + if (txq) { + stats->q_opackets[i] = txq->pkts; + stats->opackets += txq->pkts; + stats->q_obytes[i] = txq->bytes; + stats->obytes += txq->bytes; + stats->oerrors += txq->errors; + } else { + PMD_DRV_LOG(DEBUG, "Tx queue not setup for port %d\n", + dev->data->port_id); + } } return 0; @@ -1134,16 +1161,26 @@ axgbe_dev_stats_reset(struct rte_eth_dev *dev) for (i = 0; i < dev->data->nb_rx_queues; i++) { rxq = dev->data->rx_queues[i]; - rxq->pkts = 0; - rxq->bytes = 0; - rxq->errors = 0; - rxq->rx_mbuf_alloc_failed = 0; + if (rxq) { + rxq->pkts = 0; + rxq->bytes = 0; + rxq->errors = 0; + rxq->rx_mbuf_alloc_failed = 0; + } else { + PMD_DRV_LOG(DEBUG, "Rx queue not setup for port %d\n", + dev->data->port_id); + } } for (i = 0; i < dev->data->nb_tx_queues; i++) { txq = dev->data->tx_queues[i]; - txq->pkts = 0; - txq->bytes = 0; - txq->errors = 0; + if (txq) { + txq->pkts = 0; + txq->bytes = 0; + txq->errors = 0; + } else { + PMD_DRV_LOG(DEBUG, "Tx queue not setup for port %d\n", + dev->data->port_id); + } } return 0; -- 2.17.1