From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-f66.google.com (mail-lf1-f66.google.com [209.85.167.66]) by dpdk.org (Postfix) with ESMTP id 81B7D4CA9 for ; Tue, 28 Aug 2018 17:10:38 +0200 (CEST) Received: by mail-lf1-f66.google.com with SMTP id x26-v6so1672706lfi.7 for ; Tue, 28 Aug 2018 08:10:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DheHix/GNDEtCeh5Lk97qQzGldXYSXInBqrczZR1+g0=; b=UgWFOU/9jGaUuMldWFscjDB+oPqClX3e0pUC1cEjALqPTqjC5eSeBm2ZPcGO3PkH+y V57AMzED11LtGheqZgfXqBtx8KCnbZeuYTqyCKh3aboQZgUK8lDiLBO21NM73oyCex92 MLVTqPVCmmxWOtHFZ7sui6mBzwCMDxWJgnQtOC3yvTMAcneJ9NOZ2XXjPWBG2YYQxX8L XIYK0GKwQdAwusc/hzuB1ScGpy4mI92TNAXe+k57q9waiit41dVqbr3KaFYW3UZp5r60 UTH8ef5BPUMBfJ5i/i/O7zOcgKmPxASxWt/ktk7MknRAg3kWe74zkmhnmP8yHtQfsMTr kw9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=DheHix/GNDEtCeh5Lk97qQzGldXYSXInBqrczZR1+g0=; b=HRkry6//UP01JbYF/4Db8eTx3R2JHp9fi+9mQuSveRAceCePNtFKyLDf06hJZutb3f DhP4ugDoW/W1BBfiyfsHCp9HHt1/derG9YSNlF1RgtNWK8XW5aMIENE15OVCojwrBvFx bqy3S9ALgNa9V8U3JIP94lly16BZo4gBVNiZPlw0qdd9FcZV/wDmegM2X0OJQYcWoND6 voB/VpLG8Scni7sH/U5skSEjlc3lVTpayCkeQ9ugr+Zz44UDlXw5ainQHkvNlCFleTxa km+mGQmQspHeovdyH2vzanjE+puk2Uij8hm7TJZiMIDRCUOpxXAv0EcdtRz+iIPWv0A9 YRWA== X-Gm-Message-State: APzg51C0e3C+61gLhIcNd2GbZXDedkFaJJkvkjjWsQvQWAcBIlrHkl6g wzyDDQFGLF522IQ/suCmPLEPzkqInbI= X-Google-Smtp-Source: ANB0VdYM2FaVQRV0u9CtsMp6QnAEqtdxgJL+U6LoXwb8rGpNppe2zNZgdAxquxEyRFmk1zY+cuUMsg== X-Received: by 2002:a19:f83:: with SMTP id 3-v6mr1533649lfp.131.1535469037957; Tue, 28 Aug 2018 08:10:37 -0700 (PDT) Received: from amok.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.googlemail.com with ESMTPSA id p28-v6sm260685ljp.90.2018.08.28.08.10.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 28 Aug 2018 08:10:37 -0700 (PDT) From: Andrzej Ostruszka To: dev@dpdk.org Cc: nsamsono@marvell.com Date: Tue, 28 Aug 2018 17:10:27 +0200 Message-Id: <1535469030-18647-6-git-send-email-amo@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535469030-18647-1-git-send-email-amo@semihalf.com> References: <1535469030-18647-1-git-send-email-amo@semihalf.com> Subject: [dpdk-dev] [PATCH 5/8] net/mvneta: support for promiscuous 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, 28 Aug 2018 15:10:38 -0000 From: Yelena Krivosheev Add callbacks for enabling/disabling of promiscuous mode. Signed-off-by: Yelena Krivosheev --- drivers/net/mvneta/mvneta_ethdev.c | 54 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c index d1c180c..3236e93 100644 --- a/drivers/net/mvneta/mvneta_ethdev.c +++ b/drivers/net/mvneta/mvneta_ethdev.c @@ -1534,6 +1534,58 @@ mvneta_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused) } /** + * DPDK callback to enable promiscuous mode. + * + * @param dev + * Pointer to Ethernet device structure. + */ +static void +mvneta_promiscuous_enable(struct rte_eth_dev *dev) +{ + struct mvneta_priv *priv = dev->data->dev_private; + int ret, en; + + if (!priv->ppio) + return; + + neta_ppio_get_promisc(priv->ppio, &en); + if (en) { + MVNETA_LOG(INFO, "Promiscuous already enabled\n"); + return; + } + + ret = neta_ppio_set_promisc(priv->ppio, 1); + if (ret) + MVNETA_LOG(ERR, "Failed to enable promiscuous mode\n"); +} + +/** + * DPDK callback to disable allmulticast mode. + * + * @param dev + * Pointer to Ethernet device structure. + */ +static void +mvneta_promiscuous_disable(struct rte_eth_dev *dev) +{ + struct mvneta_priv *priv = dev->data->dev_private; + int ret, en; + + if (!priv->ppio) + return; + + neta_ppio_get_promisc(priv->ppio, &en); + if (!en) { + MVNETA_LOG(INFO, "Promiscuous already disabled\n"); + return; + } + + ret = neta_ppio_set_promisc(priv->ppio, 0); + if (ret) + MVNETA_LOG(ERR, "Failed to disable promiscuous mode\n"); +} + +/** * DPDK callback to set the primary MAC address. * * @param dev @@ -1567,6 +1619,8 @@ static const struct eth_dev_ops mvneta_ops = { .dev_set_link_down = mvneta_dev_set_link_down, .dev_close = mvneta_dev_close, .link_update = mvneta_link_update, + .promiscuous_enable = mvneta_promiscuous_enable, + .promiscuous_disable = mvneta_promiscuous_disable, .mac_addr_set = mvneta_mac_addr_set, .mtu_set = mvneta_mtu_set, .dev_infos_get = mvneta_dev_infos_get, -- 2.7.4