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 F000DA00C5; Thu, 4 Jun 2020 07:22:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D50211D59A; Thu, 4 Jun 2020 07:22:45 +0200 (CEST) Received: from NAM04-CO1-obe.outbound.protection.outlook.com (mail-eopbgr690051.outbound.protection.outlook.com [40.107.69.51]) by dpdk.org (Postfix) with ESMTP id 141D81D58A for ; Thu, 4 Jun 2020 07:22:43 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aQjIWkqpde1q/b/LjIT/FYZEy74dh2akvPVMaHxDyLAZFDBmmJDtQocBDxlN4vN1ZECOiEuYmTcY06L802EsjwtIIOYhnoFzS1cOKH5Nih2RUkwf9xrgu6NcdrqmdeJ++rYjY6Byls2LNxLg3DrUb4pawdbUcKs8gcBw8s17mCBacX9uRngEcOopWHFV6bHJCqL7PuDjdXnXk/XO6wfPsK4Muq5QH0xaUWcUYEARQsH4Pnr36q5SYKbgF0ct0kbCAUTf2w6159fPp0ea5qOKnlOS0+ip8AX6zD9T4GH7DnyBVDxOAsX75Dsxpb/dyMtRuwUSobnKTA+Abm4ep/TA+g== 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=tEHeptiPZrgOLdq1qlY3bw2sfIWJgCUkaOkdenOundQ=; b=P/Jc8T9u4r4L8S8ohaJcx7Kwb+jyiEGX0zmyfiLPPYZz1zJn9nhgom60dOo5xX0yfzZpavtDtlKpF9QCmgZqFUnxCv+WAKI2Av3PgHHqIp2yNu3Ldax5jUGVu6++M39mFO6nR2FA5YGxZMXhIKG76faHDWc0P/ICsCVk2sDtu3kB+0VU0yhvLrp6DRDrM6qU7oIbKiHOIeamBTYobPwzYtiaouM8t5MMoGj2nFVlcR0Va+3UoQUNJJLm269PCZJ/m7loXiDi57s7Ub4GsghcL5NLEraA4gsxDUdOVljNWSOStNf8Bn+y4o7n5k/cyIuYAF7ZP8MVUweTRUmWOmq7nA== 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=tEHeptiPZrgOLdq1qlY3bw2sfIWJgCUkaOkdenOundQ=; b=H4UJtlHTfxw/c9va1KMZjNtSiafzH7Nxo1EGrSpQY7vWQKZDazdaDV+oYCZIzTM4WfE/HEiRnlR4nwWlSyeS1wWC8ESxv3AXvKxlQkwoS9GbbYqSlwS5hQqWgMu0iiHuv9/kfOAUikb5TkVX3PwxKCQaa/iaAs7Uv69CPU1BQg8= Received: from CY4PR12MB1574.namprd12.prod.outlook.com (2603:10b6:910:e::23) by CY4PR12MB1829.namprd12.prod.outlook.com (2603:10b6:903:11d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.18; Thu, 4 Jun 2020 05:22:38 +0000 Received: from CY4PR12MB1574.namprd12.prod.outlook.com ([fe80::7405:91a0:a2ea:b344]) by CY4PR12MB1574.namprd12.prod.outlook.com ([fe80::7405:91a0:a2ea:b344%6]) with mapi id 15.20.3045.024; Thu, 4 Jun 2020 05:22:38 +0000 From: "Somalapuram, Amaranath" To: "Nandibasappa, Girish" , "dev@dpdk.org" CC: Ferruh Yigit Thread-Topic: [PATCH v1] net/axgbe: add support for set MTU API Thread-Index: AQHWOCPNq1O5thEi1kmp6WoYKG7xB6jH753Q Date: Thu, 4 Jun 2020 05:22:38 +0000 Message-ID: References: <20200601144841.7814-1-gnandiba@amd.com> In-Reply-To: <20200601144841.7814-1-gnandiba@amd.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_0d814d60-469d-470c-8cb0-58434e2bf457_ActionId=cda105d3-a8f8-4742-9e0c-0000a1b9ca0b; MSIP_Label_0d814d60-469d-470c-8cb0-58434e2bf457_ContentBits=0; MSIP_Label_0d814d60-469d-470c-8cb0-58434e2bf457_Enabled=true; MSIP_Label_0d814d60-469d-470c-8cb0-58434e2bf457_Method=Privileged; MSIP_Label_0d814d60-469d-470c-8cb0-58434e2bf457_Name=Public_0; MSIP_Label_0d814d60-469d-470c-8cb0-58434e2bf457_SetDate=2020-06-04T05:21:20Z; MSIP_Label_0d814d60-469d-470c-8cb0-58434e2bf457_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:d805:fef:e178:9d4d:818a:793e] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: cd3f318a-aab0-48e2-3c0b-08d808474c3b x-ms-traffictypediagnostic: CY4PR12MB1829: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6430; x-forefront-prvs: 04244E0DC5 x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Sj8+q8e5e29tbpJa69LQftldVVmrk/4cuDShlX+Nrha5+YEvoq6Oe3WQl+ZXdY0da/gjcfkmfMteXQA77gYCoQvBPZgMtQesMltcC16bVzB99PYdRJRbs/GmgdwE4Wb1TShp91vm9UxoE6JwQ3o4aMz5GlQ/WW9wfN5Uh9rmlnBJr0jNLaORtUsVYz5QzjjfXheR+40XICS6maTfcWxbs8E3voxpbExBpOjU1WOwv7F+194snTXJ1N+93L1L9Ftay4AZJorSW33ZkqQ/9HKuQGeZlEYkfbNJ5dagyogSnz14QQeYqYyAVKuG7Tw63YXE x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY4PR12MB1574.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(366004)(39860400002)(346002)(136003)(376002)(396003)(9686003)(316002)(478600001)(55016002)(33656002)(83380400001)(5660300002)(110136005)(71200400001)(2906002)(8676002)(7696005)(8936002)(4326008)(52536014)(76116006)(186003)(6506007)(64756008)(66476007)(66556008)(66446008)(66946007)(53546011)(86362001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: 2hUvqzNJzPK4I5UqGuoX9leefOuBeTo1IA3riS2wJawOJdDz6cxLx2Cw+p+dtXsxaWXEnpoUOPrMAHT1sJJJ6Z4BJag5qOaerm9Wg9p1+AgUq98rQmFk6FXFhaIURcwv8+A/alIiJg0u3h6qbWsLrPmYs0RNTL5C+u/cKzH45pxAs6qAOHnkAK41USxQF1nbw5zbo/oSeyDHF4I60tMdDuhXvbVOCOPzjdBkZh376ib3XNmtwpjruhicMZvVp6uwP3bV/hXUbxBqwZpWFYn+1Q7t3QHR9J1DWQaeL3Duy4HeF9+mHjX1Yv1Y4lRfhrsIk+K/bTMPDBdP+TJC/P1AyjD5EeVLWDMKolDeliMxSRE1KRunURA23Etm5erhmSprMnZtheCaLNDaAEQiwhePW1FbEaFzVC5Pic93PlCrmwehotsf351sskTFh9Hw1gi1Tu4IESnnQ0uNxaWMW/HPXX6IvODun5tKe3BU7fu9ORXlohfOJDYvFukyeeGCExoEwNjBns2vYZttvkVveF4mXWbi6xEx2af1qU5Ah+EC1U4= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: cd3f318a-aab0-48e2-3c0b-08d808474c3b X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Jun 2020 05:22:38.6406 (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: MR9HRE7s5Df9aTdNgkn69rNOHbRANtr90Qhliz+kcL1HPt64nLllIZJ+9wFBnIQ2fnqkOz2azwaquWly31TyLA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1829 Subject: Re: [dpdk-dev] [PATCH v1] net/axgbe: add support for set MTU API 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 Public Use] Acked-by: Somalapuram Amaranath -----Original Message----- From: Nandibasappa, Girish Sent: Monday, June 1, 2020 8:19 PM To: dev@dpdk.org Cc: Somalapuram, Amaranath Subject: [PATCH v1] net/axgbe: add support for set MTU API From: gnandiba This patch adds support for set_mtu API which can be used to change the Max= imum Transmission unit (MTU) from application. Signed-off-by: gnandiba --- drivers/net/axgbe/axgbe_ethdev.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_eth= dev.c index 867058845..cdb1297f5 100644 --- a/drivers/net/axgbe/axgbe_ethdev.c +++ b/drivers/net/axgbe/axgbe_ethdev.c @@ -73,6 +73,7 @@ static void axgbe_rxq_info_get(struct rte_eth_dev *dev, u= int16_t queue_id, static void axgbe_txq_info_get(struct rte_eth_dev *dev, = uint16_t queue_id, struct rte_eth_txq_info *qinfo); const uint32_t *axgbe_dev_supported_ptypes_get(struct rte_eth_dev *dev); +static int axgb_mtu_set(struct rte_eth_dev *dev, uint16_t mtu); struct axgbe_xstats { char name[RTE_ETH_XSTATS_NAME_SIZE]; @@ -214,6 +215,7 @@ static const struct eth_dev_ops axgbe_eth_dev_ops =3D { .dev_supported_ptypes_get =3D axgbe_dev_supported_ptypes_get, .rx_descriptor_status =3D axgbe_dev_rx_descriptor_status, .tx_descriptor_status =3D axgbe_dev_tx_descriptor_status, +.mtu_set=3D axgb_mtu_set, }; static int axgbe_phy_reset(struct axgbe_port *pdata) @@ -1254,7 +1256,35 @= @ axgbe_dev_supported_ptypes_get(struct rte_eth_dev *dev) return ptypes; return NULL; } - +static int axgb_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) { +struct rte_eth_dev_info dev_info; +struct axgbe_port *pdata =3D dev->data->dev_private; +uint32_t frame_size =3D mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN; +unsigned int val =3D 0; +axgbe_dev_info_get(dev, &dev_info); +/* check that mtu is within the allowed range */ +if ((mtu < RTE_ETHER_MIN_MTU) || (frame_size > dev_info.max_rx_pktlen)) +return -EINVAL; +/* mtu setting is forbidden if port is start */ +if (dev->data->dev_started) { +PMD_DRV_LOG(ERR, "port %d must be stopped before configuration", +dev->data->port_id); +return -EBUSY; +} +if (frame_size > RTE_ETHER_MAX_LEN) { +dev->data->dev_conf.rxmode.offloads |=3D +DEV_RX_OFFLOAD_JUMBO_FRAME; +val =3D 1; +} else { +dev->data->dev_conf.rxmode.offloads &=3D +~DEV_RX_OFFLOAD_JUMBO_FRAME; +val =3D 0; +} +AXGMAC_IOWRITE_BITS(pdata, MAC_RCR, JE, val); +dev->data->dev_conf.rxmode.max_rx_pkt_len =3D frame_size; +return 0; +} static void axgbe_get_all_hw_features(struct axgbe_port *pdata) { unsigned int mac_hfr0, mac_hfr1, mac_hfr2; -- 2.17.1