From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) by dpdk.org (Postfix) with ESMTP id A2EE558C4 for ; Fri, 31 Aug 2018 14:26:21 +0200 (CEST) Received: by mail-lj1-f196.google.com with SMTP id 203-v6so9889313ljj.13 for ; Fri, 31 Aug 2018 05:26:21 -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=E4itDI2qlSRvuwfrYOlSRjyKGKfSb2mu2PnFh0wXjf4=; b=BWpQpvnsox5H5Y1ICibnJTNtkdZFaaPGmi5GH9rlJzGq8CcWs6qYPrv82XuOGK91g6 t+itysWunqXKcsYzVm3fOhYXR+VYXOBDy2ieuW0VhzcprmjLq1VFgJuA3j7Kll3U22Nj qrn1sYRIWmc/hEg83s6NDRhXyZAoGqhkvh8D7IVbfNIfaq0+v8A5o2a+bl2tBjgYBILB gp2J30m66JeKWcyT5yNoQPBWz2m+zGUKsSxTmhcdADDiiSUpxH4Ks3lvxJnvn0j/K+HO tLCGFxu12tmOs3Eievpligr7MW+TnLcSZbpCDVW4kjKw1PWkQzFcGN7a+684LY1AiT4x JWoQ== 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=E4itDI2qlSRvuwfrYOlSRjyKGKfSb2mu2PnFh0wXjf4=; b=U1aoDqfHJMRLDkLqoSs/2YlO3n1XKVqpyPISZiz4OKFibZ384v7fPrhxcy+6ulod/S oWzuO+DLIKFZsaE9YrqadggwieOtyK9EDcqKVGo0jAKPXf4uqySQ9a0wKiv3jByCge0q w6jM9LI9XjKFrh0RrOzp4DmXQ9bs8SInNYabTszdSjPsc77Mw4jEC0s0G3JDHWeMTk69 pLs+vP6tp8pZ186avmXCgP2nZZmU0D9dv5uaSNw9DkLX8mq6mp7R3eDpOuvQcONjKu9L wi0WqeZogM5iWBkNn6y2JZqEqpvusxV3jq/eIQ7+LZTbO6lYXmr//RDeX3PQ+4AKPAyF k1Sg== X-Gm-Message-State: APzg51BRClsWKsdc3wWeC6re7e6dsFvqz5Y3RG7HCKExiWz0vI3oXuww M8FehW7qYQC3Xa6tsrBGwi6jiK51h2w= X-Google-Smtp-Source: ANB0VdZ0FKWfT7WdO9jsw1CCOMdxxoRK1TOP/S4SfDVf6jxVhGHY3X5l2C/u1rudMsPJCoaWebVRrA== X-Received: by 2002:a2e:9599:: with SMTP id w25-v6mr536834ljh.6.1535718381123; Fri, 31 Aug 2018 05:26:21 -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 t4-v6sm1825422lfd.13.2018.08.31.05.26.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 31 Aug 2018 05:26:20 -0700 (PDT) From: Andrzej Ostruszka To: dev@dpdk.org Cc: mw@semihalf.com, zr@semihalf.com, tdu@semihalf.com, nsamsono@marvell.com Date: Fri, 31 Aug 2018 14:26:05 +0200 Message-Id: <1535718368-15803-10-git-send-email-amo@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535718368-15803-1-git-send-email-amo@semihalf.com> References: <1535469030-18647-1-git-send-email-amo@semihalf.com> <1535718368-15803-1-git-send-email-amo@semihalf.com> Subject: [dpdk-dev] [PATCH v2 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: Fri, 31 Aug 2018 12:26:21 -0000 From: Zyta Szpak Add callbacks for enabling/disabling of promiscuous mode. Signed-off-by: Yelena Krivosheev Signed-off-by: Zyta Szpak --- 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 a7e79ea..68d363e 100644 --- a/drivers/net/mvneta/mvneta_ethdev.c +++ b/drivers/net/mvneta/mvneta_ethdev.c @@ -1527,6 +1527,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"); + return; + } + + ret = neta_ppio_set_promisc(priv->ppio, 1); + if (ret) + MVNETA_LOG(ERR, "Failed to enable promiscuous mode"); +} + +/** + * 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"); + return; + } + + ret = neta_ppio_set_promisc(priv->ppio, 0); + if (ret) + MVNETA_LOG(ERR, "Failed to disable promiscuous mode"); +} + +/** * DPDK callback to set the primary MAC address. * * @param dev @@ -1560,6 +1612,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