From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com [209.85.212.173]) by dpdk.org (Postfix) with ESMTP id BC8499231 for ; Mon, 5 Oct 2015 19:55:21 +0200 (CEST) Received: by wicfx3 with SMTP id fx3so131834633wic.1 for ; Mon, 05 Oct 2015 10:55:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1qzEshnHVdHhI5+Ig02bzxzHmxomzyb4I+65xdLLqSc=; b=OWjZCBbqzem7lvyaiD1d2g6LKpUagQSvDoQqxmsD5NzMjF9QZmig6VJJnw1/Ecp0ot 4GehgyBd+/2Rybowmi/kDSjo1kU7dY4/2r41Zjmy8b5zVadM+vhEDm9Mo+XMCQklslnZ Z0xPiaojQeB8dhF3aCuDzPwyQPrqRJgcyLgkyh69lwEEhNS+afvS3woE8vJ7cVBQ57gt coLN/eKQV1la0gVvfW2ADvF3/tq2u5Wyv4cixh8y/yQh1eseMx/yjXvx8i9NbiRlHpXE 4+UFtSsukJWgSZYUHC3esqMuo6whfGG7EyfE6AGmUxd6vHyZ17t/xPpn+dmWQspv31Tv YH0w== X-Gm-Message-State: ALoCoQnDjgCwcHS06BMRnWEWucG0xa8Ah5ZPwtJB1N4an+j5r7RdctlBZziZE9IQRS2XaitC0hrQ X-Received: by 10.180.85.229 with SMTP id k5mr13677671wiz.76.1444067721645; Mon, 05 Oct 2015 10:55:21 -0700 (PDT) Received: from 6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id t7sm15820068wia.9.2015.10.05.10.55.20 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 05 Oct 2015 10:55:21 -0700 (PDT) From: Adrien Mazarguil To: dev@dpdk.org Date: Mon, 5 Oct 2015 19:54:39 +0200 Message-Id: <1444067692-29645-5-git-send-email-adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1444067692-29645-1-git-send-email-adrien.mazarguil@6wind.com> References: <1444067692-29645-1-git-send-email-adrien.mazarguil@6wind.com> Subject: [dpdk-dev] [PATCH 04/17] mlx5: restore allmulti and promisc modes after device restart X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Oct 2015 17:55:22 -0000 These modes are otherwise lost when device is stopped. Signed-off-by: Adrien Mazarguil Signed-off-by: Nelio Laranjeiro --- drivers/net/mlx5/mlx5.h | 2 ++ drivers/net/mlx5/mlx5_rxmode.c | 12 ++++-------- drivers/net/mlx5/mlx5_trigger.c | 4 ++-- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 9720e96..9dcfe89 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -99,7 +99,9 @@ struct priv { uint16_t mtu; /* Configured MTU. */ uint8_t port; /* Physical port number. */ unsigned int started:1; /* Device started, flows enabled. */ + unsigned int promisc_req:1; /* Promiscuous mode requested. */ unsigned int promisc:1; /* Device in promiscuous mode. */ + unsigned int allmulti_req:1; /* All multicast mode requested. */ unsigned int allmulti:1; /* Device receives all multicast packets. */ unsigned int hw_csum:1; /* Checksum offload is supported. */ unsigned int hw_csum_l2tun:1; /* Same for L2 tunnels. */ diff --git a/drivers/net/mlx5/mlx5_rxmode.c b/drivers/net/mlx5/mlx5_rxmode.c index 1f5cd40..7fe7f0e 100644 --- a/drivers/net/mlx5/mlx5_rxmode.c +++ b/drivers/net/mlx5/mlx5_rxmode.c @@ -118,9 +118,6 @@ priv_promiscuous_enable(struct priv *priv) if (priv->promisc) return 0; - /* If device isn't started, this is all we need to do. */ - if (!priv->started) - goto end; for (i = 0; (i != priv->hash_rxqs_n); ++i) { struct hash_rxq *hash_rxq = &(*priv->hash_rxqs)[i]; int ret; @@ -135,7 +132,6 @@ priv_promiscuous_enable(struct priv *priv) } return ret; } -end: priv->promisc = 1; return 0; } @@ -153,6 +149,7 @@ mlx5_promiscuous_enable(struct rte_eth_dev *dev) int ret; priv_lock(priv); + priv->promisc_req = 1; ret = priv_promiscuous_enable(priv); if (ret) ERROR("cannot enable promiscuous mode: %s", strerror(ret)); @@ -208,6 +205,7 @@ mlx5_promiscuous_disable(struct rte_eth_dev *dev) struct priv *priv = dev->data->dev_private; priv_lock(priv); + priv->promisc_req = 0; priv_promiscuous_disable(priv); priv_unlock(priv); } @@ -267,9 +265,6 @@ priv_allmulticast_enable(struct priv *priv) if (priv->allmulti) return 0; - /* If device isn't started, this is all we need to do. */ - if (!priv->started) - goto end; for (i = 0; (i != priv->hash_rxqs_n); ++i) { struct hash_rxq *hash_rxq = &(*priv->hash_rxqs)[i]; int ret; @@ -284,7 +279,6 @@ priv_allmulticast_enable(struct priv *priv) } return ret; } -end: priv->allmulti = 1; return 0; } @@ -302,6 +296,7 @@ mlx5_allmulticast_enable(struct rte_eth_dev *dev) int ret; priv_lock(priv); + priv->allmulti_req = 1; ret = priv_allmulticast_enable(priv); if (ret) ERROR("cannot enable allmulticast mode: %s", strerror(ret)); @@ -355,6 +350,7 @@ mlx5_allmulticast_disable(struct rte_eth_dev *dev) struct priv *priv = dev->data->dev_private; priv_lock(priv); + priv->allmulti_req = 0; priv_allmulticast_disable(priv); priv_unlock(priv); } diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c index 2876ea7..233c0d8 100644 --- a/drivers/net/mlx5/mlx5_trigger.c +++ b/drivers/net/mlx5/mlx5_trigger.c @@ -71,9 +71,9 @@ mlx5_dev_start(struct rte_eth_dev *dev) err = priv_create_hash_rxqs(priv); if (!err) err = priv_mac_addrs_enable(priv); - if (!err && priv->promisc) + if (!err && priv->promisc_req) err = priv_promiscuous_enable(priv); - if (!err && priv->allmulti) + if (!err && priv->allmulti_req) err = priv_allmulticast_enable(priv); if (!err) priv->started = 1; -- 2.1.0