From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by dpdk.org (Postfix) with ESMTP id 5491F5F62 for ; Thu, 20 Sep 2018 11:05:48 +0200 (CEST) Received: by mail-lj1-f195.google.com with SMTP id y17-v6so7658010ljy.8 for ; Thu, 20 Sep 2018 02:05:48 -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=dbQtmI1d4P6lnY4MaqXDw6ZVdre6FiMteayNdCVAaT4=; b=fZbiTg49r1chUdEvIfKbdtPjKgOdWlH9wXUrQoe0dLHwxVDbKPu73QR3VZcVYVempf tZnJHVIzo0R2S1NwCJvycZpUTn/1ZU4u9RWNW0Qm6GJqAFbGQUt5b1Vv5tX6u8E70Z6O rf0w4XuTRX8m5E0GjkPnwRIJduiVY4BF3kwEJRYWt2QQnSGTaQWHoWN68D1GBGufl7a4 aDUXMARfbquu6sSVh0QLQ16h/IzbJBo6HPXfkQ3wT8BZeT2FBV/fZy+/dZ94DLvfxsmx LAmXHHs6BabCTCa2gVK13nCcfkV2vksfo3OlAA5GicRoPWhTLnsBIVPcYfJ4d+TWzUZq pFHw== 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=dbQtmI1d4P6lnY4MaqXDw6ZVdre6FiMteayNdCVAaT4=; b=JEq/IZCmxydkDS3BFIQalAsiRbYRaH+CsSeP0wuto2SdzQpCpVkhtHnYSHiVRe/7H8 XwQuv4k67i53Z6G16Ka6KK7DZPh8LvF2Mpvy+G1Zv30HDopnv9ieNDSKkCZ643l2Jvgu Eo/5qUC+us7YNSGz2KI02DGg8nihbAIonZfRkXeMoXSyDISedntj6Rh0rmgQ845bphUr 8mptyBInJ3tumL4RPN+0or8WXJIg1y9zkmDssy/DUyKq3FlGil8JHC0iC6/dZqlAINyz lBD+YkAeJ3WK3EkhF0b2RwI1u1+VlXJvpj4HkK+wTs7rxRHYKj28ZNifVwD7IGDqVTEC sFwQ== X-Gm-Message-State: APzg51BhiHhqzvOmWlacHz1xqUKES6ND3tVV8bRMQKNGRdEFHHzxV5DC 91jno6jYmMmYa5AKyIuNGVUjXqphp3Y= X-Google-Smtp-Source: ANB0VdaK5RSCY98Ul/0h++Bu4xvljfgDVR9o2I1u2jS/4+CSa3wu5R4eAl/ogHZabOdn8qdRlFeiKQ== X-Received: by 2002:a2e:971a:: with SMTP id r26-v6mr3969421lji.30.1537434347808; Thu, 20 Sep 2018 02:05:47 -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 g16-v6sm4338106lje.1.2018.09.20.02.05.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 20 Sep 2018 02:05:47 -0700 (PDT) From: Andrzej Ostruszka To: dev@dpdk.org Cc: mw@semihalf.com, zr@semihalf.com, tdu@semihalf.com, nadavh@marvell.com Date: Thu, 20 Sep 2018 11:05:36 +0200 Message-Id: <1537434339-22570-6-git-send-email-amo@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537434339-22570-1-git-send-email-amo@semihalf.com> References: <1537369294-17099-1-git-send-email-amo@semihalf.com> <1537434339-22570-1-git-send-email-amo@semihalf.com> Subject: [dpdk-dev] [PATCH v5 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: Thu, 20 Sep 2018 09:05:48 -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 e9cbff7..04881d5 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