From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f41.google.com (mail-wm0-f41.google.com [74.125.82.41]) by dpdk.org (Postfix) with ESMTP id 88BE82A66 for ; Wed, 14 Mar 2018 20:00:38 +0100 (CET) Received: by mail-wm0-f41.google.com with SMTP id h76so6113790wme.4 for ; Wed, 14 Mar 2018 12:00:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=xbaO1HRnTgh0Zg6Al9Zsw3vRd8J9AqKAeZEzzYYjJNo=; b=A7n6e/QFsZ6Xt1Mu/FcSTA26/M4CLwRvfxpIH3wsPhARkobGDi5sW5CxBEl6HSnmvj 3B+vOA46Q3lHocWEgcA0MS8JDCLNJa4rBWBjxjQXskflhk+tUO9+2BMwbhiFfkFVJ6O3 5keYsRhPNmyfLNIdx0X75ZHvv/+dDCtdCDVOHdhi7NWCHxGDh3CVkUWwIxWp0RYemLG8 vP5t32iHoWjBHxYV5OmHOoV2z05MT/+bj/+m0u4F7od4/j2GupD0A0VcEt+QiUhgesFq cjXqmFqYlPFpDP0vxAbr+VB0sTx5UXWSMhYaAcQ07Sq6yTBOucTFMva86RueDhdAI2Ho wAHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=xbaO1HRnTgh0Zg6Al9Zsw3vRd8J9AqKAeZEzzYYjJNo=; b=GhcYvZWbn2Im9yIU7DJL+8odjcOly0mSj0Gmd3/OgQCiD3ESpGUotHqNUl8FGK4DMf xsQwkJVQOpmebGa3QTbZWzCXPo9ugz3ofvX9holzl8BZ1a85Dw8VZIM5/6cVB2a9bY42 FIBLOmBK3n4FTaU4JFdpRf0L+eCbe88uLj/KKpdT5P59K2xG6XRGDlKSJckvBG7B9hXJ LiLayNWPSnr2slfB6WZLpGhi7a51U81tMg9oCedPPfmKGigpJh6bUXvP1WajX5aqZHwX qwHMK3fP9LNdPQn3uz332hZ5x7oWX9n05bxy6adCfxnd3MKjQmI+IqkEgUoB1PdaKtnl gTBQ== X-Gm-Message-State: AElRT7GxuhNHsCzaKbxSnrAWrOS5yrBNAYIo44BvREDhlGqttrgwSIgv h3UIP1BrrPw66FUA3Y5MaVjkvPJr X-Google-Smtp-Source: AG47ELvLIpqXrtWmb9vE8G6z5CEoVTbbNL3fUaGa1jh+MleJjbTiW5SErjVvjsBcBoHOpP2gzkywag== X-Received: by 10.28.72.132 with SMTP id v126mr2490098wma.150.1521054037105; Wed, 14 Mar 2018 12:00:37 -0700 (PDT) Received: from 6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id n9sm3965703wri.48.2018.03.14.12.00.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Mar 2018 12:00:36 -0700 (PDT) Date: Wed, 14 Mar 2018 20:00:22 +0100 From: Adrien Mazarguil To: Yongseok Koh Cc: Nelio Laranjeiro , dev@dpdk.org, shahafs@mellanox.com, stable@dpdk.org Message-ID: <20180314190022.GR3994@6wind.com> References: <21fb91002768a627d9c7f3d81e0c8a12fbf6811f.1518684427.git.nelio.laranjeiro@6wind.com> <20180313215443.GB26229@yongseok-MBP.local> <20180314121856.GK3994@6wind.com> <20180314174058.GA31022@yongseok-MBP.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180314174058.GA31022@yongseok-MBP.local> Subject: Re: [dpdk-stable] [PATCH v2 2/3] net/mlx5: fix link status behavior X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Mar 2018 19:00:38 -0000 On Wed, Mar 14, 2018 at 10:40:59AM -0700, Yongseok Koh wrote: > On Wed, Mar 14, 2018 at 01:18:56PM +0100, Adrien Mazarguil wrote: > > On Tue, Mar 13, 2018 at 02:54:44PM -0700, Yongseok Koh wrote: > > > On Mon, Mar 12, 2018 at 02:43:18PM +0100, Nelio Laranjeiro wrote: > > > > This behavior is mixed between what should be handled by the application > > > > and what is under PMD responsibility. > > > > > > > > According to DPDK API: > > > > - link_update() should only query the link status [1] > > > > - link_set_{up,down}() should only set the link to the according status [1] > > > > - dev_{start,stop}() should enable/disable traffic reception/emission [2] > > > > > > The description of rte_eth_dev_set_link_up() is [1] : > > > The device rx/tx functionality will be disabled if success, and it can > > > be re-enabled with a call to rte_eth_dev_set_link_up() > > > > > > This means, if user runs "set link-down port 0" on testpmd, traffic should stop > > > by disabling Rx/Tx on device. But unfortunately, mlx5 doesn't have a way to stop > > > device but it rather relies on kernel implementation - e.g. SIOCSIFFLAGS. So, > > > even if the command is run, traffic goes on. I guess the original > > > implementation might be needed to workaround this situation. > > > > > > Shall we talk to HW and driver people regarding how to access dev (or PHY) from > > > user-level? > > > > > > [1] https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdpdk.org%2Fdoc%2Fapi%2Frte__ethdev_8h.html%23a51d7a0d2bb4202f9ebf9f174ba1f6e5c&data=02%7C01%7Cyskoh%40mellanox.com%7C346b9914b7664dcf0e7008d589a5cb53%7Ca652971c7d2e4d9ba6a4d149256f461b%7C0%7C0%7C636566267555398866&sdata=Ad1%2FyQqyXeifXFJjxMMRxq81YGpF7nEFHvaX28nncl8%3D&reserved=0 > > > > As you mentioned, since the mlx5 PMD doesn't really own the device, it > > doesn't have the final say on whether traffic still flows after putting the > > link down at the DPDK level. It has been worked around by replacing burst > > callbacks with no-ops since up/down ethops were added [3]. > > > > Problem is that updating burst callback pointers while traffic is flowing > > has always been more or less unsafe. It's not necessarily atomic and only > > really safe to do when traffic is guaranteed to be stopped (i.e. after > > dev_stop() was called by the application). Moreover these no-ops don't > > prevent device RX queues from still getting filled up. > > > > Looking at the original implementation [4][5], other PMDs simply have to > > turn off the laser or some such which doesn't prevent RX/TX functions from > > working as before except traffic happens to be lost instead of ending up > > rejected by dedicated burst callbacks. > > > > The main purpose of up/down callbacks and the reason they were implemented > > in mlx5 is that customers want to see something happen at the carrier level > > on the remote end (as with other PMDs) when a DPDK port is brought up or > > down. This is why they are seldom implemented in other PMDs for VF > > eth_dev_ops given those can't control PHY. > > > > Actively preventing traffic is secondary and either has a performance impact > > (permanent status check in the data plane) or is somewhat unsafe (live > > replacement of burst callbacks). > > > > Given the above, I'm in favor of removing the no-ops. Applications are the > > ones performing up/down calls, they manage the administrative status of > > interfaces and should refrain from calling TX/RX burst functions > > afterward. Carrier status is left to PMDs and can't necessarily be modified. > > > > [3] 62072098b54e ("mlx5: support setting link up or down") > > [4] 915e67837586 ("ethdev: API for link up and down") > > [5] c38f4f83edc0 ("ixgbe: link up and down") > > Adrien, Nelio > > Please don't get me wrong. I didn't mean to defend the status quo. I didn't like > the null burst function either since I firstly joined this project. I was just > mentioning it was anyway non-compliant to the document and suggesting to find > out a better way if any, e.g. accessing PHY. Even if you don't think it is a > critical matter, there's no need to change the kernel flag and we just can make > dev_set_link_down/up() return without doing anything. If we can't/don't change > carrier status in the functions and those funcs have no effect, how about not > changing the kernel interface flag? Or, if you still insist no change is needed > in this patch, that is also fine to me as this isn't a critical path and doesn't > have any erroneous behavior. Heh, all right, I felt obligated to describe how it ended up like that. I agree that somehow controlling PHY should be OK assuming there was a way to do it. Currently bringing the netdevice down achieves the desired effect with PF devices (well, at least it should, according to memory). The code is the same for VF devices though it has no effect on them, perhaps we could do like other PMDs by providing a separate set of eth_dev_ops without up/down capabilities. One problem will always remain though: an external application can always re-enable PHY through other interfaces, resuming traffic by doing so. -- Adrien Mazarguil 6WIND