From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by dpdk.org (Postfix) with ESMTP id 02D191B017 for ; Tue, 16 Jan 2018 09:20:58 +0100 (CET) Received: by mail-wm0-f66.google.com with SMTP id g1so6451458wmg.2 for ; Tue, 16 Jan 2018 00:20:58 -0800 (PST) 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:content-transfer-encoding:in-reply-to :user-agent; bh=7y4oN+gdfnQ/6xai2humDe5TZmtkyqCnQYixcoiBXn8=; b=oeHvzVft+jsQS1SQy5DE0KF/47Z1xBfBz5iA1NcLow5jhOqP0gwG/uHbiVu1p80WOQ w2tQWGk7bmy0qjKRFGgeuPWc2TjYMRnah4VhiLzjyYQnP8u06TbZ9rMoY+ucsSX3oInV rWJKFvUittcPa+fQ2lqgA2ISptMhEwpTdRKBEh7z995Gc+D1GJpoxTfCK+lbwm2Fx/0+ l73RR+tt+0Gq3wipXp9OOqy5DZ03OurmpZlJuNw0pUokMLJL8odAgF3MOw/jE3g8jU/I RyRzv4BzsVduE0WUGkMHMAsv35vly9lz/HkDDfS/ex3XH9QkrUd8o5R/vZZrx3sqRz4Y NO/Q== 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:content-transfer-encoding :in-reply-to:user-agent; bh=7y4oN+gdfnQ/6xai2humDe5TZmtkyqCnQYixcoiBXn8=; b=lDsAzobTM5NKFr/4OAst32Xt2HE4EurRzJ57UKaEV497TruvrQ1OsRH02WeVN+UZio LJKSnyxg7O/sy94NlwLJ+QiePj/klHDUDgiLqrZcIUsFIL1j8Fg7Hd7yrwdDbgEFVNR4 djqLePsBFxbv8tmnF46iUCfgQNUSoIWSEIxIhJYomxbAhI+cNCs1EJtHWk0+pfpJDNEK fEKRk6Jh/2jCmQiTGMG5emU41pluZQaf9sYabNp7QIhuNLWKm/aeNc7uWWd1sp0abSSV X+do61bgH9/lZtqXh6tKRLQihXT1EGTDMxCj1ojGk68niLlEEPM6fm6sDfdOmDU9b4ho 1E8Q== X-Gm-Message-State: AKGB3mKQ1p2t9E1yfbH6XZuc33O+sY7lx0SIM6Pa+LPro8EN2ZEaWaId ngf4M596LuMIjzYV4yrThJ+G X-Google-Smtp-Source: ACJfBosGK4hoHzbz9/12BD37r+n9yTshXGfRR7ajxUbIvaDQXdV8C9qaD0ItIPEcQDz3LUaOcbfLaQ== X-Received: by 10.80.221.70 with SMTP id u6mr51358533edk.192.1516090858534; Tue, 16 Jan 2018 00:20:58 -0800 (PST) Received: from laranjeiro-vm.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id z42sm1086407edz.39.2018.01.16.00.20.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Jan 2018 00:20:57 -0800 (PST) Date: Tue, 16 Jan 2018 09:20:40 +0100 From: =?iso-8859-1?Q?N=E9lio?= Laranjeiro To: Yongseok Koh Cc: adrien.mazarguil@6wind.com, dev@dpdk.org, stable@dpdk.org Message-ID: <20180116082040.tjpr4b4qtlbj453v@laranjeiro-vm.dev.6wind.com> References: <20180115234800.3316-1-yskoh@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180115234800.3316-1-yskoh@mellanox.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-dev] [PATCH] net/mlx5: fix handling link status change event 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, 16 Jan 2018 08:20:59 -0000 Hi Yongseok, Small nips. On Mon, Jan 15, 2018 at 03:48:00PM -0800, Yongseok Koh wrote: > Even though link of a port gets down, device still can receive traffic. > That is the reason why mlx5_set_link_up/down() switches rx/tx_pkt_burst(). > However, if link gets down by an external command (e.g. ifconfig), it isn't > effective. It is better to change burst functions when link status change > is detected. > > Fixes: 62072098b54e ("mlx5: support setting link up or down") > Cc: stable@dpdk.org > > Signed-off-by: Yongseok Koh > --- > drivers/net/mlx5/mlx5.c | 1 - > drivers/net/mlx5/mlx5.h | 1 + > drivers/net/mlx5/mlx5_ethdev.c | 112 +++++++++++++++++++++++++++++++--------- > drivers/net/mlx5/mlx5_trigger.c | 23 ++------- > 4 files changed, 93 insertions(+), 44 deletions(-) > > diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c > index 1c95f3520..fc2d59fee 100644 > --- a/drivers/net/mlx5/mlx5.c > +++ b/drivers/net/mlx5/mlx5.c > @@ -869,7 +869,6 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) > /* Bring Ethernet device up. */ > DEBUG("forcing Ethernet interface up"); > priv_set_flags(priv, ~IFF_UP, IFF_UP); > - mlx5_link_update(priv->dev, 1); > /* Store device configuration on private structure. */ > priv->config = config; > continue; > diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h > index e740a4e77..9a4a59bd4 100644 > --- a/drivers/net/mlx5/mlx5.h > +++ b/drivers/net/mlx5/mlx5.h > @@ -225,6 +225,7 @@ int priv_set_flags(struct priv *, unsigned int, unsigned int); > int mlx5_dev_configure(struct rte_eth_dev *); > void mlx5_dev_infos_get(struct rte_eth_dev *, struct rte_eth_dev_info *); > const uint32_t *mlx5_dev_supported_ptypes_get(struct rte_eth_dev *dev); > +int priv_link_update(struct priv *, int); > int mlx5_link_update(struct rte_eth_dev *, int); > int mlx5_dev_set_mtu(struct rte_eth_dev *, uint16_t); > int mlx5_dev_get_flow_ctrl(struct rte_eth_dev *, struct rte_eth_fc_conf *); > diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c > index 6f78adc4a..16377a8cb 100644 > --- a/drivers/net/mlx5/mlx5_ethdev.c > +++ b/drivers/net/mlx5/mlx5_ethdev.c > @@ -885,7 +885,49 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev, int wait_to_complete) > } > > /** > - * DPDK callback to retrieve physical link information. > + * Enable receiving and transmitting traffic. > + * > + * @param dev > + * Pointer to Ethernet device structure. > + */ > +static void > +priv_link_start(struct priv *priv) Comments says dev but parameter is priv. > +{ > + struct rte_eth_dev *dev = priv->dev; > + int err; > + > + dev->tx_pkt_burst = priv_select_tx_function(priv, dev); > + dev->rx_pkt_burst = priv_select_rx_function(priv, dev); > + err = priv_dev_traffic_enable(priv, dev); > + if (err) > + ERROR("%p: error occurred while configuring control flows: %s", > + (void *)priv, strerror(err)); > + err = priv_flow_start(priv, &priv->flows); > + if (err) > + ERROR("%p: error occurred while configuring flows: %s", > + (void *)priv, strerror(err)); > +} > + > +/** > + * Disable receiving and transmitting traffic. > + * > + * @param dev > + * Pointer to Ethernet device structure. > + */ > +static void > +priv_link_stop(struct priv *priv) Same here. > +{ > + struct rte_eth_dev *dev = priv->dev; > + > + priv_flow_stop(priv, &priv->flows); > + priv_dev_traffic_disable(priv, dev); > + dev->rx_pkt_burst = removed_rx_burst; > + dev->tx_pkt_burst = removed_tx_burst; > +} > + > +/** > + * Retrieve physical link information and update rx/tx_pkt_burst callbacks > + * accordingly. > * > * @param dev > * Pointer to Ethernet device structure. > @@ -893,17 +935,54 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev, int wait_to_complete) > * Wait for request completion (ignored). > */ > int > -mlx5_link_update(struct rte_eth_dev *dev, int wait_to_complete) > +priv_link_update(struct priv *priv, int wait_to_complete) Seems to be also the case here. Thanks, -- Nélio Laranjeiro 6WIND