From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0044.outbound.protection.outlook.com [104.47.32.44]) by dpdk.org (Postfix) with ESMTP id 0B0D6FA3D for ; Tue, 21 Feb 2017 10:30:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=w1RadhStNphuwL5zEC7MhrrqeAlt37kErEi4Z4uYdDY=; b=BM159Wi+GH4jahR3V5FisQWAJpNM2p95EC3K4vEpRp4Z7N1nfTH1KfR+nlz6bq8/JuF+byg95GkW2zVdq01VLgj5iH7jy8olzPWdhHpTWSo2x8jeSdrzTRSB4XUB0q6rgAzjkDeMrdT141fMxRooMY8WlcVDEDzahMSi6A7t920= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Shijith.Thotton@cavium.com; Received: from lio357.in.caveonetworks.com (14.140.2.178) by SN1PR07MB2285.namprd07.prod.outlook.com (10.164.47.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.919.13; Tue, 21 Feb 2017 09:30:08 +0000 From: Shijith Thotton To: dev@dpdk.org Cc: Jerin Jacob , Derek Chickles , Venkat Koppula , Mallesham Jatharakonda Date: Tue, 21 Feb 2017 14:56:55 +0530 Message-Id: <1487669225-30091-41-git-send-email-shijith.thotton@caviumnetworks.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487669225-30091-1-git-send-email-shijith.thotton@caviumnetworks.com> References: <1487669225-30091-1-git-send-email-shijith.thotton@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: MA1PR01CA0089.INDPRD01.PROD.OUTLOOK.COM (10.174.56.29) To SN1PR07MB2285.namprd07.prod.outlook.com (10.164.47.155) X-MS-Office365-Filtering-Correlation-Id: eda42b76-d9af-4200-8ed8-08d45a3c3b57 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:SN1PR07MB2285; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 3:65oJ7vADH2xU3sYxkjed+VWRxofDCoVTOjYMdIiXIBlQ5Yg+lzOTg2JaRnKV2hA5lVutkf/YeCRb6Ldcb3EiL+16v+IE7B4N6apN/u2oDaqYAAO5/sJ+TnDR/0Re8CWszoKRFF5m+LlPdBlHL8Uvbt07a6o0lsTF7wpIDPuqRymfmJMAtM92nghvHenSuAPp+sN/lTwWw6VWFOQ9N3zl8/dBG9b37LEFcKfWgtb6k0bKnlc4ukPGepI07u5ZMMZ+304f91pdWQrBCkX1YA7Dbg==; 25:xeyY1jgC02YeGMqjGJXqRdZODbFpMYPv17ZMy7ivqnwx886Lo16D0NfGJvjKSB15n6Af2hxYt8Zp6aNYlVJyLequ0lIIix6c6OeKmvonQnltxwr0VH+EsDAIymfrDYxl1R/91S9bAnbRqhemSA9WAsMvNT339gKBGH7EiQnCcnopVahzGf+hcebP1L5teihaf8YFKR+Mzy9mJ3QtxP9Nn72TOHbJV+gaLJOJnuhZbkY10QiTFYPnARIY4yaEixI5viWKSHi2rsiMeFePyy6gWAqlPtKRa7Md67wldIVhgihduWbti7VhVJI4mdvUJONDwjFN9fQbUbupsN07V7tDC70QKg8rPzfbiE6HotrmAsfbqgJvOl1oiPgA2iUaAh/ewK9SE430yGUOPySy+1ZMjF6yrOabbQfJiVbtRSBhk1xO0jO+rXy5PA/QlbqAhZs+rloT9aeQmKTJZfWaFab1Ng== X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 31:bk8/vGqLLJ0qmJMzYF3iCE+4c2lythGaaEgM73LXH1Wk+/JRIHGd+BWRHYVriZ9693HK4d0M+1NFbRb37KEePbIjL5PxXgth7+Chv2R700tQaZozIQs8xhdlmLkxhwlt2CZD7zLcIy6i+R/EzaMxxCJCZQbOveo8rztsxb6eyT49hgYl5L+4O0HEYHKg7T45FN7vlfB4AFbcUR8w7Dphbp7QHTerGsq3CGSpHJj15p0kuYm9QjTIqc94azcL4Cd4; 20:sglKitJlV1PE7E1RNGMg9JXWh2hFAFoiu0IaTgRKXW4tXjPDANJZsZXaicXpKHrd5WXlGF7gfZzYJme0ggifiL5exPBDq5+Hdd8cUcBS3CGTRJUUjmfkCaI/9nJ+n7aLDR+0WAZmuzmN5E3pXSJOQpS8FmG+dE93oFXhjIs5Nzd1jFGkZ2w76+APG+KawbK1Y55CmvTe8y96E3YTaWh/81LZDK96o5m2Hf0X3tsnHH+KrOtQWgfY+PWdqKtHuPwWtEqGr06Terb52M/5wiPdeShybjwhVVdskGclwuELc7ej3UvPt/fq0034yjBRvX/J/i6bPzb2I2FRlr03ZlPTTd6x4qzeyn27g68dfzL0Q+f7JqwlGyEJN2joDWgpZY0FejqKw+Kide50faJl6J6vCAlZ6/7JDbmrf1wkkaaIN6X8rSK88Q6cDVrHJloLpmwqKPFgz9SYtfa+priwxbSi0dvOqXUkaflLUAiAacKj1PQYWeXNnVomW686LHdWVPljTKMmYoKwSL3bLlwzNGJMlKD25QLu/oHoH5j9cV44Yghle+hU+ZB0pEUkx8uEBNr27MYixO9+zRSAFdKzq1R5B1FmDjevKrDaFLA5pQ3fxeE= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6041248)(20161123555025)(20161123564025)(20161123562025)(20161123560025)(20161123558025)(6072148); SRVR:SN1PR07MB2285; BCL:0; PCL:0; RULEID:; SRVR:SN1PR07MB2285; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 4:iaTcgS7BnooikAAApl+d3kR9IjbZ7kABP+FrglRttRQCKMXtjx1DOfBiJEhP4BYPs4Lqkdu6iIGDhwF10skXgZDFfuoNCXFa0IBwxzf2M9tJRTkvlc2XSVsukTIoqVuXebp53yQ4HCwUUL3Mg1U0Km4vP4EjRFucMBRmVHIfThrTaoI2sXwFCsTSCUXp3iQdzxFVIg/zXZHb8kthDZX2zBalSRQkclyjG+afmto4PDv29LXiBy8kAs0j1dEfNZdvDYGpUhds3osMt9nBnYyjagjSmyMLqceBT864nJzFfkjnmcBKDsNTPbaDbTJ+dA0mIT2Jr3KwGKeScNCMvqiav8TZXwteH55/1k4UnS20wvglQs/QY1LD6rDe3bE+6wHXhfORTLZ2TvcAk8mM9y+1sqgtB6DyXpDwRlUErb1YbKchlfd/0DeDYfTMi7LHGLvQGHbDFYIkG7/0NcVRkEVyxAxg4ixtvQVOu2i7lR3AeK99Tq2klQ2bO170O/PAejQk7bKWEz8sRP/zQlNQrrkFP8l9aJZjFdb9N4XJt5l5anNIzme7gHD7BPBco20EhzYqTWgTzDJR1Y67746zCfrNtoXXwYbegQDB9QK7wloptiU= X-Forefront-PRVS: 0225B0D5BC X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39450400003)(39410400002)(39830400002)(189002)(199003)(50226002)(81166006)(42186005)(2361001)(101416001)(81156014)(305945005)(3846002)(6116002)(5009440100003)(8676002)(105586002)(7736002)(53936002)(36756003)(110136004)(106356001)(6506006)(25786008)(38730400002)(2351001)(92566002)(48376002)(6486002)(97736004)(50466002)(5003940100001)(189998001)(68736007)(2906002)(4326007)(33646002)(76176999)(54906002)(5660300001)(6666003)(6916009)(50986999)(2950100002)(6512007)(4720700003)(42882006)(66066001)(47776003)(7099028)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR07MB2285; H:lio357.in.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR07MB2285; 23:jcL55MHa5+/6CMR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KjSrAwE/lBLUvnLQXA/SBWyWKRudoQPmcVnNSOTMEvQvHvENWcSzpnbuhJ4fUVELX8qv3uJcw==; 24:zZ5RihMrBSJvge9DvlOU8uY7D58BIWQx8ogsVK9yYBiX/0KZtwZrquF3AVEFd0rv08+tzy77XwqGEw7uWHA5Z7MVhtZg/5pIvR7INTHwXpM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 7:JP+7/aEkiAfaJFsIoFHXHXTeAZPYTEotJFfLI+UhlfmFzm5PlsFSZxO6jS7EFCy6BkLN0zgqMnNwiPfMXvREYHfEcrS25/K8CV1IurUxebNXdDEuCykkif4nw3XTCw3CEi3LTZxdivaFZ+6LNuyAdnKAIrEh5LGQAujEk1/cOxjo7Y5egni2BWITDViCZRLQbUN/d9Z92hDbU/L7uusQF/662fnSHx9cuDGRdmjccwBrL1qGeBv1qfY4v6dXJNaU0Ge32bhO8vyHhz5zPYFxhvzve88umenKbSfu8AeWjpDF7g1fdXW8L6HUsIVmx5mj27SgnrxbBgQ1WnSQHuYUlA== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2017 09:30:08.7151 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR07MB2285 Subject: [dpdk-dev] [PATCH 40/50] net/liquidio: add API to set MTU 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: , X-List-Received-Date: Tue, 21 Feb 2017 09:30:12 -0000 Signed-off-by: Shijith Thotton Signed-off-by: Jerin Jacob Signed-off-by: Derek Chickles Signed-off-by: Venkat Koppula Signed-off-by: Mallesham Jatharakonda --- drivers/net/liquidio/lio_ethdev.c | 48 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index ad827f8..d82a46b 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -152,6 +152,33 @@ } static int +lio_dev_change_vf_mtu(struct rte_eth_dev *eth_dev, uint16_t new_mtu) +{ + struct lio_device *lio_dev = LIO_DEV(eth_dev); + + PMD_INIT_FUNC_TRACE(); + + if (!lio_dev->intf_open) { + lio_dev_err(lio_dev, "Port %d down, can't change MTU\n", + lio_dev->port_id); + return -EINVAL; + } + + /* Limit the MTU to make sure the ethernet packets are between + * ETHER_MIN_MTU bytes and PF's MTU + */ + if ((new_mtu < ETHER_MIN_MTU) || + (new_mtu > lio_dev->linfo.link.s.mtu)) { + lio_dev_err(lio_dev, "Invalid MTU: %d\n", new_mtu); + lio_dev_err(lio_dev, "Valid range %d and %d\n", + ETHER_MIN_MTU, lio_dev->linfo.link.s.mtu); + return -EINVAL; + } + + return 0; +} + +static int lio_dev_rss_reta_update(struct rte_eth_dev *eth_dev, struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size) @@ -824,7 +851,9 @@ static int lio_dev_start(struct rte_eth_dev *eth_dev) { + uint16_t mtu = eth_dev->data->dev_conf.rxmode.max_rx_pkt_len; struct lio_device *lio_dev = LIO_DEV(eth_dev); + uint16_t timeout = LIO_MAX_CMD_TIMEOUT; int ret = 0; lio_dev_info(lio_dev, "Starting port %d\n", eth_dev->data->port_id); @@ -852,8 +881,26 @@ goto dev_lsc_handle_error; } + while ((lio_dev->linfo.link.link_status64 == 0) && (--timeout)) + rte_delay_ms(1); + + if (lio_dev->linfo.link.link_status64 == 0) { + ret = -1; + goto dev_mtu_updation_error; + } + + if (lio_dev->linfo.link.s.mtu != mtu) { + if (lio_dev_change_vf_mtu(eth_dev, mtu)) { + ret = -1; + goto dev_mtu_updation_error; + } + } + return 0; +dev_mtu_updation_error: +rte_eal_alarm_cancel(lio_sync_link_state_check, eth_dev); + dev_lsc_handle_error: lio_dev->intf_open = 0; lio_send_rx_ctrl_cmd(eth_dev, 0); @@ -1034,6 +1081,7 @@ static int lio_dev_configure(struct rte_eth_dev *eth_dev) .dev_start = lio_dev_start, .link_update = lio_dev_link_update, .dev_infos_get = lio_dev_info_get, + .mtu_set = lio_dev_change_vf_mtu, .rx_queue_setup = lio_dev_rx_queue_setup, .rx_queue_release = lio_dev_rx_queue_release, .tx_queue_setup = lio_dev_tx_queue_setup, -- 1.8.3.1