From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f178.google.com (mail-wr0-f178.google.com [209.85.128.178]) by dpdk.org (Postfix) with ESMTP id 65EBF5F5D for ; Wed, 14 Mar 2018 13:19:11 +0100 (CET) Received: by mail-wr0-f178.google.com with SMTP id l8so4535735wrg.5 for ; Wed, 14 Mar 2018 05:19:11 -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=bp7wzOS680e3CNnmFv3qrOa9VVIt5cCerrpr9tTHB8A=; b=RNKVV658FjpGnnTBt5wCv470RTy2gS2gDcmU6gJyNZvalZfXtzfmVl1UtKKdXUASDC fT+DiZnRiKxyv9Lzj4ELFUtchJIQnFBWAfxdqAeOm/3fv8auUmmwQhw4ItvtWvsI6aMY rikRlwK2RRtLnDkpYW+LEIg2fM2gUeduYbXnHr6VBCVzkyseraNfCHSNAwmDvxmy3/VF 7bOsHk8wPWwP7LLxvcG5tMU/nPhgw5/81hM0DWtwo/iFSSR/qPSyh379hib8l0s5PlPw 36EEAB7SNth1ies3do4lfryS0YLyIZ1rMSS1vJ4JwLvmFwfKMFeexcNpD1vLzyuPMqFw YUag== 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=bp7wzOS680e3CNnmFv3qrOa9VVIt5cCerrpr9tTHB8A=; b=c7yIuWzv+FUhII8P5Wl46QmEwZWKNKYEgjI33J1ISwJjbI6UIOQDSCAhgpSlz5k7pi PLHsKKAgn1QrQzlKfFSdHxKH0twA80B1nvL5ake+tPeJJKpWz1d+FvFb/2eG2tkQLwpn zPvoZu4SVnpjsWXyMal66wsUkZWQMynJRtZnM/kR5SL8SI0KaoE17Fvp7a+bm4y7Em2I A1Ch7rgIjJ/OCEVIbKv5FtrD7UMaWSnKk6qgZXd2hi6CPuuqftp1/f3oq/FCfQU/cWar WGiCB4/lBf7d+TJgT3Y4e6yYtTICtFjKzp0YAF56J96q2RKcw0wU1sUjEw8kylfT452Z Q+bQ== X-Gm-Message-State: AElRT7F8CE9ZW6Wnuwkak6xrI+oSX6NEeZVBLL3pBTkJ5mH7g0AdJX/n Gg5fVxo+1/DayMzaswFW3DiEkA== X-Google-Smtp-Source: AG47ELu49CjiyU4HNtpdxBmLkFzINpFHjhfqknR1ymNbgpm8YVr4eBzmosbzu+VCNMm4E4YWOLhycw== X-Received: by 10.223.182.16 with SMTP id f16mr3554348wre.51.1521029950993; Wed, 14 Mar 2018 05:19:10 -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 j42sm2627112wre.55.2018.03.14.05.19.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Mar 2018 05:19:10 -0700 (PDT) Date: Wed, 14 Mar 2018 13:18:56 +0100 From: Adrien Mazarguil To: Yongseok Koh Cc: Nelio Laranjeiro , dev@dpdk.org, shahafs@mellanox.com, stable@dpdk.org Message-ID: <20180314121856.GK3994@6wind.com> References: <21fb91002768a627d9c7f3d81e0c8a12fbf6811f.1518684427.git.nelio.laranjeiro@6wind.com> <20180313215443.GB26229@yongseok-MBP.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180313215443.GB26229@yongseok-MBP.local> Subject: Re: [dpdk-dev] [PATCH v2 2/3] net/mlx5: fix link status behavior 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: Wed, 14 Mar 2018 12:19:11 -0000 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] http://dpdk.org/doc/api/rte__ethdev_8h.html#a51d7a0d2bb4202f9ebf9f174ba1f6e5c 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 Mazarguil 6WIND