From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f178.google.com (mail-wi0-f178.google.com [209.85.212.178]) by dpdk.org (Postfix) with ESMTP id 2FFCF93F8 for ; Mon, 5 Oct 2015 19:55:42 +0200 (CEST) Received: by wicfx3 with SMTP id fx3so131847143wic.1 for ; Mon, 05 Oct 2015 10:55:42 -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=2A2c4f/aPydFh5Peico4hq3jk+JYgUXYGhQa/v3S+WI=; b=S6doDE4rNwZhsHVgt0SjAYmFwG4Q9dLv66XZpzWLKLLicF4cIjNYs2wS0h5ody+Jpt JfOAUIzHYW5iBnQIRVJyQ6VAAKEE/nUXueFwtsnSRQ82AB72cxVKLa9zF6mtm9fTl3I5 cTjoEGuz3epfHFrS+NlKTfHQPvBgiMgEZhu3IXbLYOvL2EKwlRQv4BWy39Q49atNTRq+ Y9OspjOzGanIbIimwrSCMiPlX+shdK7dY+yitY0kVwIOirYSJqHPy/7G9+/ZW5C5C3t8 42XW9kO5Xp4X/050/A9qydvzZTpC8fPW6ZGsJsZJkSNqk6SYT5XFsK2HENF9sJZoFr6E zN9A== X-Gm-Message-State: ALoCoQkSOD1E2pgGysy7Ed6iAvuBNSnrRym5+n97rm6M2se0SERuAlo5WZDE3AwVhmdO3Oqb7Ct7 X-Received: by 10.180.101.163 with SMTP id fh3mr13825586wib.94.1444067741845; Mon, 05 Oct 2015 10:55:41 -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 m9sm15802072wib.13.2015.10.05.10.55.41 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 05 Oct 2015 10:55:41 -0700 (PDT) From: Adrien Mazarguil To: dev@dpdk.org Date: Mon, 5 Oct 2015 19:54:48 +0200 Message-Id: <1444067692-29645-14-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 13/17] mlx5: remove normal MAC flows when enabling promiscuous mode 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:42 -0000 From: Nelio Laranjeiro Normal MAC flows are not necessary when promiscuous mode is enabled. Removing them frees up hardware resources. Signed-off-by: Nelio Laranjeiro Signed-off-by: Adrien Mazarguil --- drivers/net/mlx5/mlx5_rxmode.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxmode.c b/drivers/net/mlx5/mlx5_rxmode.c index aab38ee..578f2fb 100644 --- a/drivers/net/mlx5/mlx5_rxmode.c +++ b/drivers/net/mlx5/mlx5_rxmode.c @@ -123,6 +123,8 @@ priv_promiscuous_enable(struct priv *priv) struct hash_rxq *hash_rxq = &(*priv->hash_rxqs)[i]; int ret; + /* Remove normal MAC flows first. */ + hash_rxq_mac_addrs_del(hash_rxq); ret = hash_rxq_promiscuous_enable(hash_rxq); if (!ret) continue; @@ -130,6 +132,9 @@ priv_promiscuous_enable(struct priv *priv) while (i != 0) { hash_rxq = &(*priv->hash_rxqs)[--i]; hash_rxq_promiscuous_disable(hash_rxq); + /* Restore MAC flows. */ + if (priv->started) + hash_rxq_mac_addrs_add(hash_rxq); } return ret; } @@ -189,8 +194,14 @@ priv_promiscuous_disable(struct priv *priv) if (!priv->promisc) return; - for (i = 0; (i != priv->hash_rxqs_n); ++i) - hash_rxq_promiscuous_disable(&(*priv->hash_rxqs)[i]); + for (i = 0; (i != priv->hash_rxqs_n); ++i) { + struct hash_rxq *hash_rxq = &(*priv->hash_rxqs)[i]; + + hash_rxq_promiscuous_disable(hash_rxq); + /* Restore MAC flows. */ + if (priv->started) + hash_rxq_mac_addrs_add(hash_rxq); + } priv->promisc = 0; } -- 2.1.0