From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-f65.google.com (mail-lf1-f65.google.com [209.85.167.65]) by dpdk.org (Postfix) with ESMTP id BCA254CA7 for ; Wed, 19 Sep 2018 17:01:43 +0200 (CEST) Received: by mail-lf1-f65.google.com with SMTP id m26-v6so5453441lfb.0 for ; Wed, 19 Sep 2018 08:01:43 -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=eys1OtVMMLZc/UoQmSd3C6QGeiVbG3LU32RKL0NTz6I=; b=bxTcW3toj0X90JbPM7NPWpEExzPuNnknEHFHpihlXxYloVWuqu+OfnrmUOxrCApT0y S8E8JkbgDzBv9sqaii39aBmlWxNO6fkUs6l1Uzs4SEi20k3AGVo74mQ6tHQwlS0eBSza RnFvoH5hXLpI1ACicGEDbiEQg4MmT4JxL5E7Nd3LWwUwLTEcHKfG1ujzMWE/iReuD+7U MUbaokTpV3buLijRXKMlHtHhK9p3Wc+MDXB6WC0shsnDBC2Awh90Z7sj8148SjBV2cXx rEIr8KQYcr3HYOC3mhd7knk3dWM7Hd+M82wZ6gOx/iEkk9aYVNilZ2E6uw1r0tMz2emm OQMw== 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=eys1OtVMMLZc/UoQmSd3C6QGeiVbG3LU32RKL0NTz6I=; b=j2saZHaFXJjzdvFRjdkfNTjpyzP2Mz0k4eADN/2Al1Zn0cPOIB2u4p5gmGT7yQyRU2 Tf2C7IDtKxDZBAbXvEYS+VcCoaXIlo3S5rvyKyigT+YejGykvdD3zElDGK+3S13Ae+MQ sTLvVppAZ5R6uBTMpX6CG27EgIr186L6U3XdTz371dt5OFnTLzWMhwM2Ew0/xDjnnlPx wVdy317yrO6LZnoGLl8f6aYYKmMWA6H2vuUwbI2D/eya3AdbVaqYMVvML4iRinVgX1qc BuzI4CLaSDz2sj1BsAftJWguRNuDuzgj1Gve1d2e3BSUAGFwPierJUxu+R7wReBep5ZX mIUA== X-Gm-Message-State: APzg51Bmum4oKSzx9UFdiNieqz+X31J5VIss6jSb66Ujh8nfvSJ0mMxk xFozJi9f1XoVpK3U5CKNQ9ArhjL5o/4= X-Google-Smtp-Source: ANB0VdbE8Jk9ohDdf38rVbGQmFFRuV8Q/+VKFPxIVhAbEC29XjS3o4hg1c8wg+Gn+p+G0X8RPin5Ew== X-Received: by 2002:a19:eadb:: with SMTP id y88-v6mr12649262lfi.1.1537369303072; Wed, 19 Sep 2018 08:01:43 -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 z3-v6sm1107711lfj.89.2018.09.19.08.01.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Sep 2018 08:01:42 -0700 (PDT) From: Andrzej Ostruszka To: dev@dpdk.org Cc: mw@semihalf.com, zr@semihalf.com, tdu@semihalf.com, nadavh@marvell.com Date: Wed, 19 Sep 2018 17:01:31 +0200 Message-Id: <1537369294-17099-6-git-send-email-amo@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537369294-17099-1-git-send-email-amo@semihalf.com> References: <1535720386-18775-1-git-send-email-amo@semihalf.com> <1537369294-17099-1-git-send-email-amo@semihalf.com> Subject: [dpdk-dev] [PATCH v4 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, 19 Sep 2018 15:01:44 -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 85cdd1d..1912c3e 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 e40437f..0f4dece 100644 --- a/drivers/net/mvneta/mvneta_ethdev.c +++ b/drivers/net/mvneta/mvneta_ethdev.c @@ -547,6 +547,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 @@ -580,6 +632,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