From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f193.google.com (mail-lj1-f193.google.com [209.85.208.193]) by dpdk.org (Postfix) with ESMTP id 3A8AD3572 for ; Wed, 3 Oct 2018 09:22:25 +0200 (CEST) Received: by mail-lj1-f193.google.com with SMTP id p89-v6so4119383ljb.3 for ; Wed, 03 Oct 2018 00:22:25 -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=iIgD9PfN9ipG2chnKi2ZVxTXweExmjzcXf48C0iXdOU=; b=dU2Ji11BfMCTSGpohyDtR1SCZzO9Zz1Lebt5il5UgZYGf+bbT87ErQJL1MgyKGgeNl r4yib7P+1keycCc+zS2BEzpOOzvY596dHmrcdkFGYwrtF0o0P5dJvGYdyJDy74JQlUqM kHzAhSjSgn7oSgEF0jw/66BobR3cWo/O0Uo4U5xy7HTGkMZw4CzYEW+pTEJPEkIlUECL iqAIhJIWLmPROgtM2Cuad897qxOvJ3EtqabqpG0TJwaLUaYg1+A/xS9u9ghGOhUj17F9 Guv37iwnoLEiRjf8m9ltEaRBCBO1gaebg54mFvKCoE/EXeFXtuaPTb7qOT77Oo0KBya2 +glQ== 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=iIgD9PfN9ipG2chnKi2ZVxTXweExmjzcXf48C0iXdOU=; b=b5KuKens1Ko4cSUgg/C4nOMe3pgnmNcia+p/urkS4jUFbhz6N1dLHdjM013/Sps6Vi qU/pOqus0JDmOe4qLpQjrtT+AA6r9F4DCmd+0C3+VIcdBsmK50Gp/XRaRRqRzYrCGQJo /eIYUmCU4QvMOYN1eAR5X407oVecXE+3TCLo5mtzpMCOPzqJFNvNvX82zObq5jWCKuyQ Rab3vvkdCnlCTiY1VwTqPj076wPQB+MTs88VR4EEyPMV2bVNG0ahYapNz/Gle1dzznac deXeGNiiTpyCJYkFwn3kDNnVtLW1fHbX9KVqJn4t4PeDvSrRD82a/pfB99w9vv/GwWc7 Va9g== X-Gm-Message-State: ABuFfoiJYHVweAYfdHWXv0K4eeYtTjX/8U/L/rbA6F4e2RWQbydh7J6w VCI1KU/92rzTA98qMUa72NGDU+55q4H9sw== X-Google-Smtp-Source: ACcGV6189tScCmbEZR7tgnL1SLWPk21ZWxSGsZ7cxwrkoZRhqDGRbhbZXQDC+SyQpGOeWCYkwZQPfA== X-Received: by 2002:a2e:6e08:: with SMTP id j8-v6mr154091ljc.61.1538551344691; Wed, 03 Oct 2018 00:22:24 -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 f73-v6sm123659lfl.80.2018.10.03.00.22.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 03 Oct 2018 00:22:23 -0700 (PDT) From: Andrzej Ostruszka X-Google-Original-From: Andrzej Ostruszka To: dev@dpdk.org Cc: mw@semihalf.com, nadavh@marvell.com, zr@semihalf.com, tdu@semihalf.com Date: Wed, 3 Oct 2018 09:22:13 +0200 Message-Id: <1538551336-19259-6-git-send-email-andrzej.ostruszka@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1538551336-19259-1-git-send-email-andrzej.ostruszka@gmail.com> References: <1538385970-21260-1-git-send-email-andrzej.ostruszka@gmail.com> <1538551336-19259-1-git-send-email-andrzej.ostruszka@gmail.com> Subject: [dpdk-dev] [PATCH v7 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: Wed, 03 Oct 2018 07:22:25 -0000 From: Zyta Szpak Add callbacks for enabling/disabling of promiscuous mode. Signed-off-by: Yelena Krivosheev Signed-off-by: Zyta Szpak --- doc/guides/nics/features/mvneta.ini | 1 + doc/guides/nics/mvneta.rst | 1 + drivers/net/mvneta/mvneta_ethdev.c | 54 +++++++++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+) diff --git a/doc/guides/nics/features/mvneta.ini b/doc/guides/nics/features/mvneta.ini index 581ed31..6a140a3 100644 --- a/doc/guides/nics/features/mvneta.ini +++ b/doc/guides/nics/features/mvneta.ini @@ -8,6 +8,7 @@ Speed capabilities = Y Link status = Y MTU update = Y Jumbo frame = Y +Promiscuous mode = Y CRC offload = Y L3 checksum offload = Y L4 checksum offload = Y diff --git a/doc/guides/nics/mvneta.rst b/doc/guides/nics/mvneta.rst index fdea3da..ccd19f2 100644 --- a/doc/guides/nics/mvneta.rst +++ b/doc/guides/nics/mvneta.rst @@ -31,6 +31,7 @@ Features of the MVNETA PMD are: - Speed capabilities - Jumbo frame - MTU update +- Promiscuous mode - Link status - CRC offload - L3 checksum offload diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c index 052e97f..a3dbe56 100644 --- a/drivers/net/mvneta/mvneta_ethdev.c +++ b/drivers/net/mvneta/mvneta_ethdev.c @@ -522,6 +522,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 @@ -555,6 +607,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