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 27456A04DD; Fri, 20 Nov 2020 06:16:28 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4BD36F90; Fri, 20 Nov 2020 06:16:26 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2080.outbound.protection.outlook.com [40.107.93.80]) by dpdk.org (Postfix) with ESMTP id 04CB92AB for ; Fri, 20 Nov 2020 06:16:24 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gceom6G9ET4sSXDPXWUG4OG1r9WRFSCmfjaoRYBcmhtlB0XghRJ/YUPWlgcK747RM5ve+KvAJ8Q80+NJVWQlenGbT5/Ak8w+rQNr3DSkUwBQkVyin1xqX1a0bdIpV/B7bcI4Djw3ptE+V7iMXOi+v0dFeab6mCCvzYSw1PGMkrDGAj7f19EnrKGWqkyOGLwWSsVX2KzsM9Q20Hkw33PALOX8iVy7IjtXDnBazaWgireMc0mFBBnmkt9FwRAFrMRDSG59BQRNn+fpq+wSuMbZtjom/s5s0v0vcQ6NAdTpHV1dUGbssOg+UvfrJBhH7PEwFWlTWl+rmpr2IhG5z8ilpA== 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=o4+P1Z84I3u+PiGjfdq9Fx+LgQLwJ9Q/x0Wr1aydla8=; b=fvhpvSQ2pyUYfSadLC8fgoDEKXpAovpv/haCMJeBFJbnqmX9Wcuy3tqeRxK7hbVDXfB5tYkmxqkr+bxER4jtV1IlpXM0Z+lBL4jXPXKevX3LlzLT8bELLZy+V6kClHxaTFj1bSQeh2cMObZ14TUb3y3Q2C69xdDBjtuEf4peBqkbvMaS4b6GQgD9hL5I/gIHPA4j4gswLiBlcM0IAOlLOpCU6MX8q9GXha2E9nJLH3yMK1RZ+Lyd6kKswMG5bN0JgwwI2rCiE5IXWDgDx/jV7IEvXCffiEwWIQ21P/V1IWmn5AiR8Wi+r/2QCqZtvCBVNAWNDxSa9D5fmyhWr7Xlwg== 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=o4+P1Z84I3u+PiGjfdq9Fx+LgQLwJ9Q/x0Wr1aydla8=; b=lmbNi5O3jHl35by9f3r/iG3SwLFV31U/qMuq1nm5HF/8eAz/axarAqntJQBs3hNElCh9KJNGNuUANtrR/3kRH1HwyOoDSV5rvX1r5LWh/0u3D5dHYoMLoO+y4a114YQK12nMvwegBuw3j0bi33bij4LWhf2nuJIu9M5QHDwyE/4= Received: from BYAPR12MB2821.namprd12.prod.outlook.com (2603:10b6:a03:9b::30) by BYAPR12MB3575.namprd12.prod.outlook.com (2603:10b6:a03:ab::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3564.25; Fri, 20 Nov 2020 05:16:21 +0000 Received: from BYAPR12MB2821.namprd12.prod.outlook.com ([fe80::c9e:efb6:8cd1:5a6d]) by BYAPR12MB2821.namprd12.prod.outlook.com ([fe80::c9e:efb6:8cd1:5a6d%4]) with mapi id 15.20.3589.022; Fri, 20 Nov 2020 05:16:21 +0000 From: "Somalapuram, Amaranath" To: "Sebastian, Selwin" , "dev@dpdk.org" , Ferruh Yigit Thread-Topic: [PATCH v1] net/axgbe: add support for device reset Thread-Index: AQHWvncBMVrDBdFZc0uyz2lTj9sWoKnQeh6w Date: Fri, 20 Nov 2020 05:16:20 +0000 Message-ID: References: <20201119132158.10821-1-selwin.sebastian@amd.com> In-Reply-To: <20201119132158.10821-1-selwin.sebastian@amd.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_76546daa-41b6-470c-bb85-f6f40f044d7f_ActionId=b2bfd123-b328-48b8-b64d-4cf72d67f0b2; MSIP_Label_76546daa-41b6-470c-bb85-f6f40f044d7f_ContentBits=0; MSIP_Label_76546daa-41b6-470c-bb85-f6f40f044d7f_Enabled=true; MSIP_Label_76546daa-41b6-470c-bb85-f6f40f044d7f_Method=Standard; MSIP_Label_76546daa-41b6-470c-bb85-f6f40f044d7f_Name=Internal Use Only - Unrestricted; MSIP_Label_76546daa-41b6-470c-bb85-f6f40f044d7f_SetDate=2020-11-20T05:10:57Z; MSIP_Label_76546daa-41b6-470c-bb85-f6f40f044d7f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; authentication-results: amd.com; dkim=none (message not signed) header.d=none;amd.com; dmarc=none action=none header.from=amd.com; x-originating-ip: [2405:201:d005:904d:2d9d:4b0b:6b64:93fe] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: d7e38fe7-23e0-418b-c98c-08d88d136afc x-ms-traffictypediagnostic: BYAPR12MB3575: 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: m1NbzzpBvF6J6xrvEs+dthwoI3N1oR1nEOH9igkbFmTWmBeSdlmn6XnffOZ//qilRxnRt3NqcyN47KdY5MjwR2SKDxFdCBXCpnc1dknN/7tJhZNCEH3dw8aCx3G9KIpfq/vxGoV+V1s5mgHkPR7QMKelw1bBVEcV9VIPcKzOSZsCHkzRzXvUNPVN5OmlYPoPmcS2zXuogC747c/JYth87mo/bTkS6QWKRQORumJsyAdKaAznh4x16uLHTQ2ytyGekoBlS0JOkyvZ7rt09J+6GTbdv7ybbIX1pq7MqHKSVmRE/79aZFdYQ8n1SH1lea24 x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR12MB2821.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(346002)(376002)(396003)(136003)(366004)(76116006)(66476007)(66556008)(7696005)(186003)(53546011)(64756008)(71200400001)(316002)(83380400001)(8676002)(9686003)(5660300002)(33656002)(55016002)(52536014)(86362001)(8936002)(6506007)(110136005)(66946007)(2906002)(66446008)(478600001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: k57MhKO0CCdVBAsMSvbqlszZKhasHYjrj0i0uwpQDdACKieIWu+SUPkC0SIxLO54R6pb7imllLpzcGeWzBvM8wPk5Y7Ip2gSGTP5oSNav0N3OI9mtNSny3DxZG6Xd4fxtkwPlSVQgfOpeQauw7LyCj+X4BGEZo++PpHxid2q+HXjlIwLaQACZtT2Pjr4cQB5HqN9t9giLApF76c6RY2Zp8k2aI/dQJbEjGnIVRm2CTXPjz3GzRw+9v0eR+B2C5s9aCgOBRv664epnSqqhE//vVKkdBOgw9Gsln3GRfcP4BiwyX7kJMda7gNL1blkGmI5/G0J2bQhiQjyO3AHtU5SPYw01vh0uT9OOGVCKiBGPEssqW3IEpebZdL6ixqSGOcaNo/U+BE1Bj1BvSmiOJJc97D7PIIAaCpHnJ2kZ5Tld5L4Brt0OS5ca3WVKZVWE2Gr1MYBmtQU5Z1FAloS72YBdy/70fIh/QGP4sJL93+4gz8fFociweTewTSeQUhmOzs7baUO425YxzOWDmYRkcfzVHRvXGyDHEZX5D5VPj+pkX2VOoBxQki+CLaVM6Z6g2ALSZU5nyHUa3kHIJnZGQKFTm6Qz1giSnBYPq6SrecFNkZzjqBkIP8ffx2nIPUfhg1/Ju4d+hDoZ8O+3+G8sDXb7dPAwz0akg0cRoHiSfU+t00v5xF2dPzzXKPjt2RjyP1TZXa3qm1PAbNIL/YPVXlmxg== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2821.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d7e38fe7-23e0-418b-c98c-08d88d136afc X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Nov 2020 05:16:21.0312 (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: WIoJlrUP+kJw0kAd4Pd2lfbd0QDEDnoBsRaOdNUaW4BJ7iFrgUw5xsWidUk7LeEryzYZlSwuuq3zBMU2vBMtqQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB3575 Subject: Re: [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" [AMD Official Use Only - Internal Distribution Only] -----Original Message----- From: Sebastian, Selwin Sent: Thursday, November 19, 2020 6:52 PM To: dev@dpdk.org Cc: Somalapuram, Amaranath Subject: [PATCH v1] net/axgbe: add support for device reset 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_eth= dev.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); st= atic int axgbe_dev_stop(struct rte_eth_dev *dev); static void axgbe_dev_i= nterrupt_handler(void *param); static int axgbe_dev_close(struct rte_eth_d= ev *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 axg= be_dev_allmulticast_enable(struct rte_eth_dev *dev); @@ -215,6 +216,7 @@ st= atic const struct eth_dev_ops axgbe_eth_dev_ops =3D { .dev_start =3D axgbe_dev_start, .dev_stop =3D axgbe_dev_stop, .dev_close =3D axgbe_dev_close, +.dev_reset =3D axgbe_dev_reset, .promiscuous_enable =3D axgbe_dev_promiscuous_enable, .promiscuous_disable =3D axgbe_dev_promiscuous_disable, .allmulticast_enable =3D 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 =3D 0; + +ret =3D axgbe_dev_close(dev); +if (ret) +return ret; + +ret =3D 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 =3D 0; i < dev->data->nb_rx_queues; i++) { rxq =3D dev->data->rx_queues[i]; -stats->q_ipackets[i] =3D rxq->pkts; -stats->ipackets +=3D rxq->pkts; -stats->q_ibytes[i] =3D rxq->bytes; -stats->ibytes +=3D rxq->bytes; -stats->rx_nombuf +=3D rxq->rx_mbuf_alloc_failed; -stats->q_errors[i] =3D rxq->errors + rxq->rx_mbuf_alloc_failed; -stats->ierrors +=3D rxq->errors; +if (rxq) { +stats->q_ipackets[i] =3D rxq->pkts; +stats->ipackets +=3D rxq->pkts; +stats->q_ibytes[i] =3D rxq->bytes; +stats->ibytes +=3D rxq->bytes; +stats->rx_nombuf +=3D rxq->rx_mbuf_alloc_failed; +stats->q_errors[i] =3D rxq->errors ++ rxq->rx_mbuf_alloc_failed; +stats->ierrors +=3D rxq->errors; +} else { +PMD_DRV_LOG(DEBUG, "Rx queue not setup for port %d\n", +dev->data->port_id); +} } for (i =3D 0; i < dev->data->nb_tx_queues; i++) { txq =3D dev->data->tx_queues[i]; -stats->q_opackets[i] =3D txq->pkts; -stats->opackets +=3D txq->pkts; -stats->q_obytes[i] =3D txq->bytes; -stats->obytes +=3D txq->bytes; -stats->oerrors +=3D txq->errors; +if (txq) { +stats->q_opackets[i] =3D txq->pkts; +stats->opackets +=3D txq->pkts; +stats->q_obytes[i] =3D txq->bytes; +stats->obytes +=3D txq->bytes; +stats->oerrors +=3D 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 =3D 0; i < dev->data->nb_rx_queues; i++) { rxq =3D dev->data->rx_queues[i]; -rxq->pkts =3D 0; -rxq->bytes =3D 0; -rxq->errors =3D 0; -rxq->rx_mbuf_alloc_failed =3D 0; +if (rxq) { +rxq->pkts =3D 0; +rxq->bytes =3D 0; +rxq->errors =3D 0; +rxq->rx_mbuf_alloc_failed =3D 0; +} else { +PMD_DRV_LOG(DEBUG, "Rx queue not setup for port %d\n", +dev->data->port_id); +} } for (i =3D 0; i < dev->data->nb_tx_queues; i++) { txq =3D dev->data->tx_queues[i]; -txq->pkts =3D 0; -txq->bytes =3D 0; -txq->errors =3D 0; +if (txq) { +txq->pkts =3D 0; +txq->bytes =3D 0; +txq->errors =3D 0; +} else { +PMD_DRV_LOG(DEBUG, "Tx queue not setup for port %d\n", +dev->data->port_id); +} } return 0; -- 2.17.1 Acked-by: Amaranath Somalapuram