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 B20E4A04EF; Mon, 1 Jun 2020 16:49:11 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D61D51BFCC; Mon, 1 Jun 2020 16:49:10 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2042.outbound.protection.outlook.com [40.107.220.42]) by dpdk.org (Postfix) with ESMTP id 7C7731BF74 for ; Mon, 1 Jun 2020 16:49:09 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YtM6xNAItnqZ756HSbfWepWiSOd7gQM1c34tgS1eaeHKvF5X9t/pdtveDkQeJDf/wbJv9HswuCPARhXx1mOilVUdoUxdjLu5n6jEJmxuKUH316G0Tme5De/COz/zqXTqrYgzM3bMzNjDzb6snwGRBXaInPtaqRXdQMFnm5axXKH4dR7sku88tX8bZau0pNw72d8DCFal1s8jab2rt2fsf6So5Ln/au1RBttTg0WOJY4ySn/VmNog0hAOXzJFKgA77jz/NUPtTGrD3iiab8dNcB8uiJLpuFKGPXAPw5YiGUHFEDSneLgfhd8dp6G5NSFKY66YIRMcRRrZ/m4Kbz09wg== 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=SFE0cAgjhhjodsxvyKFBQZlRilnf8WcNiKc0zjq7NBk=; b=gyZSRxJr/DxIrb1MDayFOmXcyLwUH3PxHfKzuPk3rr/gOaIW9uEu7Io2TyDg3EBfI3GIinGp1csbG/LU3Kp7egSG7JRd4voG5ipa95Cncy3PnFdIuSkBRsrvxgzHxlZGTkgFTfbWi00BlsGD+10VXaI6dFmRU9twMEKvRg1wha8rOfrDSGmkMTnoT3xAn1KksTHO9BQZNkUXkU5mLQmdi8UkFHnEzZn0U7JwTe+aR7OAVuYnztj1zrWZsME7ygJgkUb+gEGXc6KW76YRcwqXAVJ4WsP7ubXVrLMrj5tjFXCGbwky9ZFZH2AkHBnVKK5L0iIjj3l7ptuPNhdAHzT42w== 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=SFE0cAgjhhjodsxvyKFBQZlRilnf8WcNiKc0zjq7NBk=; b=guVEXoEypqRpt9x8QKYNYtVfPYPcNUN9Oh4xwnOGbLM4gNe4qbHhax4KHwtpP+hhqGhL1Lx/sVAyPQ5/N5v76lix2HKU2LzJCBmJ/bYdwZJ/F0yQHXMnKo7spADGcFWBNksjLCrwiYQNh1N5BWS5CiBFWJRJapQUG7YH21G4vuw= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=amd.com; Received: from SA0PR12MB4384.namprd12.prod.outlook.com (2603:10b6:806:9f::22) by SA0PR12MB4368.namprd12.prod.outlook.com (2603:10b6:806:9f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.19; Mon, 1 Jun 2020 14:49:07 +0000 Received: from SA0PR12MB4384.namprd12.prod.outlook.com ([fe80::208b:68d9:421f:5e80]) by SA0PR12MB4384.namprd12.prod.outlook.com ([fe80::208b:68d9:421f:5e80%3]) with mapi id 15.20.3045.022; Mon, 1 Jun 2020 14:49:06 +0000 From: gnandiba@amd.com To: dev@dpdk.org Cc: Amaranath.Somalapuram@amd.com Date: Mon, 1 Jun 2020 20:18:41 +0530 Message-Id: <20200601144841.7814-1-gnandiba@amd.com> X-Mailer: git-send-email 2.17.1 Content-Type: text/plain X-ClientProxiedBy: MA1PR0101CA0009.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::19) To SA0PR12MB4384.namprd12.prod.outlook.com (2603:10b6:806:9f::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from cae-Bilby-RV1.amd.com (165.204.156.251) by MA1PR0101CA0009.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::19) 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 14:49:05 +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: 3093898a-ca7e-400a-242e-08d8063aef60 X-MS-TrafficTypeDiagnostic: SA0PR12MB4368: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-Forefront-PRVS: 0421BF7135 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mP4DtIQ57FPVTwUB0GLEoePi/ayEk549xGWa8WloNoNCUzdnNd7xiBH+pRH8yhTLrrKz55FrwTyFOMGhk6o61wkOy0tj5bs59xOT16A0ospsPIspta6UljEH1Ho8O2q2M43rIHkRF+c9iuXCy0hrmWg5Wnv10a9uIQyMT7/KpfOX3h7OskBa46Lv04OZo+ozBkTZESGfOa7Ls1ZovkjoaUqUv22GudmY/YBV/q6EMrIKpRP4jOUtQKgw01uEnfdm+DARxy4kF6YXRIxx2L/EW92M3c8abgkH8nTzbknImHy8HD7+KNBVRggR2fDTrK2X X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SA0PR12MB4384.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(366004)(136003)(396003)(346002)(376002)(39860400002)(2906002)(8676002)(5660300002)(2616005)(956004)(9686003)(1076003)(16526019)(186003)(66476007)(66946007)(66556008)(8936002)(26005)(6486002)(6916009)(4326008)(7696005)(6666004)(83380400001)(316002)(36756003)(478600001)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Iz+fRJ08yCDVswnWsDB2zbkkOWmY5rvKAL71/oJbG7SthF4geGTRBSBbVGjtpp/FAjBSPh4aMNddH1quHXaPLJ2Cl6xLNtNZlQeRALSYLfHM4ZemoF6SL1DudaqonzdyA4RPPM7vdGwyXgrIx9b4QvTPZSYBO52x7siPZim7c8cfDRCSZ2APhPHB7ypM0CM/yIZMPSNBlXAT3tXWB+vKClFPD+OyyNdfotngfad6fJ0y0MvyX7AtC3TKo1URkc61AEBv5fgru5oIZLuwTOgXSyAa2Vfg1vsmn7lBYUVdhacVRYFZQU/J63QXy8i/hN3AYRENBpN5cQlCgvX5EezaWdmbgihF090Qv8bnTLIH7TOQmpQK0lfxYojOF6LiFsGj9vxk2UvdIl9G7oduTRxylMTwAH8f5dlOQrjE+k9znHxMNtL/B6WjI1o9EiQWr0QGYXujjgK9+JttKdYgI+YVFqy1cwsNQloymwN6MUqVqJI= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3093898a-ca7e-400a-242e-08d8063aef60 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2020 14:49:06.8164 (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: Mb6mOFI58ldGVm5PeCff5ppzu9MZl8UY07LNXK1E/fi/rc5yw3oO2Oy4wVXMtWfO0D2hp0hXZlu3OeRQJc5MTw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4368 Subject: [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" From: gnandiba This patch adds support for set_mtu API which can be used to change the Maximum 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_ethdev.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, uint16_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 = { .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, + .mtu_set = 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 = dev->data->dev_private; + uint32_t frame_size = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN; + unsigned int val = 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 |= + DEV_RX_OFFLOAD_JUMBO_FRAME; + val = 1; + } else { + dev->data->dev_conf.rxmode.offloads &= + ~DEV_RX_OFFLOAD_JUMBO_FRAME; + val = 0; + } + AXGMAC_IOWRITE_BITS(pdata, MAC_RCR, JE, val); + dev->data->dev_conf.rxmode.max_rx_pkt_len = 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