From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0040.outbound.protection.outlook.com [104.47.42.40]) by dpdk.org (Postfix) with ESMTP id 91C1C37B3 for ; Thu, 2 Mar 2017 12:39:50 +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=Xy36OiT8XUZ6HolsODRSUICaNVR0npqKIyDgGWdSrVY=; b=Ajn4mqBj4ECcBK1veAxaWIJocEJlDTrvY/5Dnw/jPa2s1Zgnk6OMh2+XDJTepMPafOD/Hu1wrq3z9EwSgYfF34HgBkBshJlCLFAwoMy/8GIj657UGV9ewEL04ApiUVo5Z0bD2KOjuZF0ulsCtwupUFsbt+rPGg/MKNlQHrEXdgg= Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=caviumnetworks.com; Received: from lio357.in.caveonetworks.com (14.140.2.178) by CY1PR07MB2277.namprd07.prod.outlook.com (10.164.112.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.947.12; Thu, 2 Mar 2017 11:39:46 +0000 From: Shijith Thotton To: ferruh.yigit@intel.com Cc: dev@dpdk.org, Jerin Jacob , Derek Chickles , Venkat Koppula , Srisivasubramanian S , Mallesham Jatharakonda Date: Thu, 2 Mar 2017 17:02:41 +0530 Message-Id: <1488454371-3342-37-git-send-email-shijith.thotton@caviumnetworks.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1488454371-3342-1-git-send-email-shijith.thotton@caviumnetworks.com> References: <1487669225-30091-1-git-send-email-shijith.thotton@caviumnetworks.com> <1488454371-3342-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: BM1PR01CA0021.INDPRD01.PROD.OUTLOOK.COM (10.163.198.156) To CY1PR07MB2277.namprd07.prod.outlook.com (10.164.112.155) X-MS-Office365-Filtering-Correlation-Id: 542ea045-8966-400a-5956-08d46160d540 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY1PR07MB2277; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 3:7WQQQBrbGfjeJzDNWVeOj7xo3rkfdETlwpQoif4YtVEOrQHRle8CJKvFskGH5bv1FUC3IPmKrC6hlneSKyKrxlR0LKPJgZEp3WaanmTBH2BIWOvTxWe0pRBMG8+9USXoPBTeyz1taxzLKutOL6ombNcMceByJU40J6Df+LhZhpzY2FffLEMgSGBFuYjWi8Ux+WoFhX5iotUbI4h1addS91KkUOI5gq4P5+YoNIo8TE3Q3sUkQH7O8VmQ05JuNEjhYc57XebPkWzVZ/a/p4GVlg==; 25:nJtzmX3Js0GSCpDYaleRha66X3zSp0KC/iCYW4DPhM4UU/4oqT16wDBVOX2zh14ANbGe3vNgNE3lT5G5wck6Tv4Q2ZtByp/U+m8vamH+JLLE1jsKcLD8P9PpcUV5hJfgjwLzKoOwF6nno85HmSUQ7SHBt73RXzuZh2NbHlA9HoMegSt82voNWZKKcGzTiY6Q+SdxQcumM++TvoSxYIauZ/QEsumGpdRLuqI/NWWYBe09p7CQUYFngPEZsEWQmJSNMTdLeFsoqc1acxxfpdxiBrlwMmQ5Eogilm0KF6uqTKkVf/SX87uExmWO5BNW4jPlypFNNT9Ae6RD6GmvMGfaNlHUJX3Eh8d02jNeQy64AWd96p/cBd3U4/DoKqfyGSEJJOKiOKxxp0I7eiCOl+ZrtWtXlkHVMMP8xv2flFBMcxk7pyLgCKiTx+ZFW5O82WpJam55+nrYYuUc6gA1gXgoSA== X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 31:CNNGsFKmc4fnwffU5cE26oOIrBRwNqkzGG1JAef5ayQSZ/UfJn33QxflLRJW/bBeIzxNlF56z13S+l7sGdqMZZJ6qcAYHzRFIrfnilGQxZWN2TCMvIhyFmkpqD8mSS2HoMtf9RSPO8FfIK/BkxeLTZMeq2QtAYEEfE3hHXnqNM4zFHnWOvE84foTtyzUwBUuqeRSp0g+tipQcn+73kRF8oHArPzQBrkH6KP5tgreW8n2vEvKnWuJ0F27xHUPdCG1; 20:LhPbF62y6IRBaCnwJcz9o8AJnfIxnzt0zrrPzLAXp8N5KrLDMdQavNN8DNuGX0tS1LP8T9ZGAUciIJ50ahRfeiVgUfgFMo/I07bIk6XwM8MP/BmFIKDE37Bh3TjVeTYh6H6wYT5veAZdPNwtwJS0SySNnKnKuGGt3/qXQUNYUyZa8nuPNiXcGH2lcJuK/PBiB2Z/twtTkAPjXF7I5ziT4qP1HIqM5is+xOaqvt+jGLZz1UM7AGtgXHLtFB1XopDB0x9FHdralWzepYk0FW1P2Uw2WjjcwxZ3iqEc4dhAA7cUQ2lT6OWVFhEMJKdrKW/0jCv7USWRopkFyLwR+VcxQn/2KeP9oSiNazqxZ0ruGLyKDRqoUQx7CmUVIUF5VG+/BmdBrbKlRtRjTuW9Wkh3O94NSdklkhcNqtsRc5LVukx+eo7FjIEIXRlWoTn6xvqoYaCx1BD+y4TEccu4I1buPEJkdAvMJq6ssHTYmGjuBwjTy/Nsx3NdkL5Pkpwh+sPKjaW+Jd74CPlyh30xUNfRcXxA86v/HTQfppeCa1QPQeX+zBdPzPuSBJ3UD6loyyukPYqrL1HdsdM8VbmXXG7cOjsCyaLC6huoOWP27Qn7EX0= 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)(10201501046)(3002001)(6041248)(20161123558025)(20161123555025)(20161123560025)(20161123564025)(20161123562025)(6072148); SRVR:CY1PR07MB2277; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2277; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 4:mquZEoeSqZLVkPWbi+tHQ5o7sRZ10tNjU6Zdt6g3jy2MhlY0BrxHUYNa8+NUow2gpAy0WwHWhCaXO5CeHXk4HVKnWx0ghWwDsvSFuZUh1K6E3Dxmc6ZwQ5X5utmDfffIGwem/klVcadntqw5HJYUU+620xa+8wVMRJ0xoY87RYe79yR6+7J1J+T1aSOAsEjRCSs+mURsKhT8THlIzSklrIr/XX8IEnFqCDGF6XxaDVSbrSOPL7NuK912uCTdHg8CDjB7Q+1aT5R14jV7hQ9y2wKF2FvrlDXpz7AwS/+eRURJFlFAznyyO3kUIjoxvCCx69bEb5PKH8U2MLaF7DK+LeXQhfxlV1A0vjYyP77msa5FjEAIoFVPx4AaIF1Xbs/HLzET4eRdLRvgFpM5XhXGoqb9FYezqQ+XbLfxSuD8hSRSBAYIe6IrkceiT9iTaUvGUwPsyXXx5pBww4yUgVEx2g5Sxa+/pt+79+866gNQ8NbB/ZhhKFAsolk8xdMXulQn6Cw5aIAZesEdd4NIKJBfCpbR9qiylqfmkDhzyOG+eVeOFOzgZBObQFq3D4RF7Q+cyj5r31pLbeFvqkkKJo802zNIGCmWO3B1UJyB8r1DaIc= X-Forefront-PRVS: 023495660C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39450400003)(2950100002)(6916009)(42882006)(5660300001)(92566002)(4720700003)(33646002)(48376002)(50226002)(6666003)(2906002)(5003940100001)(36756003)(8676002)(50466002)(81166006)(110136004)(38730400002)(4326008)(305945005)(2361001)(53936002)(2351001)(25786008)(6512007)(189998001)(54906002)(47776003)(6506006)(6486002)(66066001)(6116002)(3846002)(50986999)(76176999)(5009440100003)(42186005)(7736002)(7099028)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR07MB2277; H:lio357.in.caveonetworks.com; FPR:; SPF:None; MLV:nov; PTR:InfoNoRecords; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;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BHtQovkHVK/xK?= =?us-ascii?Q?VRYZUUyeliq6iZybcDBrpw4EjTozsyzYNL2iyr66ekPiIKZ5iccbRZ3Itvha?= =?us-ascii?Q?tYFUvoOyNgtEVCHEcMdGFcBVWbdMQ6P0XF3h44PxDmMg4WI+0AkEGozGOtKR?= =?us-ascii?Q?j1zirYfPJRuKTl8iI/K58FeqTg75ogevTckec8gtcvzSW2y2y+UcT0AS+dxL?= =?us-ascii?Q?mDUyMuAv0H8iCIWxz+eTxBCLe8+qomPh57l7DN33NSrbA7yIA=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 6:Zkrp3AarFiawgIZi4c+0LTyJIPXaEl68rMFwaB2Rge7CmDpW/SZbJDdDAIqT4A3wgRDDXuuyfXfXkx0RSwkWT4xthNo8DYFaxQ5Bds90TM6yM5c4309SRLwLcRh5sX0btw5XUpjpGGGf7WO8NdCuavS55GIJ21HNScy0rdoNtZJaDKdUDaHSHVSORa4wx1fNn5HMepRfSQX01PcpJB+R4hdbiCyly0LdFMdJKLN2E+qN1YPIqwv6umzNc9YtRz02mjMc825RCM7iNu+JTBjxyRG8g8Md9sbcUIBec9ShhnXSwe8NRQYCib4eTdHuKkuC/H/cvtyqk/rFxmF4dfbYRWDBp+UogQrdY0PAj7xalzwhWGInr5tVfuSJOXHJRniFCyeDFPybnKbz2IWKj/zYYg==; 5:D408RVSc1AL8lGJTdzxZ7aymWhUHqgYB7Mz6O7j58yn+4Tv2XlqXB9Xdx/X/G/DpwPVHGytM5QfHTsWB/9qjIfpm7kBzJO7HAN5DcKPSO5dbmvP+ne5+XpDPPZJ5tFXVSa3mSRHSE/V1z3f+OnQXLA==; 24:lNSAysMefnTJnIUWcpWBrwXIIt2onb4uBqj3lxiBs358VFVMcOgxJT40gWI3zkZZAskWcQ9YI53nVtBwM8HBHk1PPo1RVrWrSiZIiHJGJcs= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 7:RFeH0AedRDO7txp3f/tFzs60B5xLY7s6BgXLME4JSZY9s4m6Kom1h9Mg7oICeJ1Ya5C8znilQVoo7KgMgsMdCONMnQVAouA2IK41QMq4etT8/L6V4qubINb/Bcv4jSGTrOI9qpBYTjvObow3HH4yrUkOAtuASxze7tdsuLSYQtTx0Ucr+nzDrDvguy6Vn7TSQJek3cM86beD6gJdSN5DYZWQqf+8Toy/FVNflicx8LBWLD4xS3q9oJ0AlpFCMg6CpppJytj1dCiRLkAKQgzIueTaBnboqH9ZCcJIbMF8oPj4SRbsGsLxaC8k22IVW7NllrZW7Y8x+FtbdgSVcD2Qsg== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2017 11:39:46.2975 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2277 Subject: [dpdk-dev] [PATCH v2 36/46] 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: Thu, 02 Mar 2017 11:39:51 -0000 Signed-off-by: Shijith Thotton Signed-off-by: Jerin Jacob Signed-off-by: Derek Chickles Signed-off-by: Venkat Koppula Signed-off-by: Srisivasubramanian S Signed-off-by: Mallesham Jatharakonda --- drivers/net/liquidio/lio_ethdev.c | 47 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index e2040b9..167d41e 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,25 @@ 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) { + ret = lio_dev_change_vf_mtu(eth_dev, mtu); + if (ret) + 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 +1080,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