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 BE60C2952 for ; Mon, 1 Oct 2018 11:26:18 +0200 (CEST) Received: by mail-lj1-f193.google.com with SMTP id o14-v6so4169885ljj.2 for ; Mon, 01 Oct 2018 02:26:18 -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=JH4A8kaHy76iU/+cjnz6lCcaHpjzekxFxL2MIcSRNYM=; b=qfioXDqhkKDj6SDFss6zpYB6zBs4HjZ659iE/xGo56GF5355Lxj/hbhemyW79kYrc2 2RZUlE2f3mm+KR7p32BkQw7E3cHQOi635DtN8iBWvElyLZPW6bj76UzqVEFqNhNHDL45 2yZXZOHDiZ+4kdZmhL/CV8i9SUizbiYP6In2i9JNzINg3Zj0XwINlugAvoETngRPHx9c kqJZnlu97LmY6r9AGOS5Qh0OwJDc8twJ8bGrwlkFyOiShJT4YRRvgeG8qzB86UB2SgX5 aAPKdrtebcPnSOlAGs0c7GErLBjQrV2GUNk4EGlJ1oMztV63TG/6CJ0JG5X2IMUUuR92 E/oA== 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=JH4A8kaHy76iU/+cjnz6lCcaHpjzekxFxL2MIcSRNYM=; b=j+LusZKWXXiVc8G83SYrCuxrmA332xzzvuG+hUGBQVhY9umJHA3Yw7mmmBUGgnrnmP YQliPUbhJSCBYgNr/YigqL0JtTXwSgzhk4sih5A4EAKGqv0Uh2p3UseU8pVC1jmsZnoV gyBecSK2GlFVLrGbx12ylvPuNpdJQmhA6l7ST+OqFMLmfIV5QfqfsRFhDXmh3/2c4Rhe HbA5c3SXFbU4b5nuuX+mQGkD0Wy0KIaaqs0rJjn7Dw5G7jVC5RU8neTfbY32DB6CN0eS LD24qsCJaiWmF5uXc2ngJqAyDbUl7JrWJhDHDFi3L+ye6u2mX22I4Ht07fDGM7rIriLK DvMQ== X-Gm-Message-State: ABuFfojBwypbyWvHKb/L48EyqEobTK0m1sJIhcF6S63AqylXAaIboJKi 4joXf/01u4PcRRn/F/hV2oSVJvrP6uvO5w== X-Google-Smtp-Source: ACcGV62kTwPZLJgVAtKo5Kc6BfFC0KpiNlY/9QCrDoZXRE4QxGxH85gTH5UFqWWIBlKOg1AHrT1d7g== X-Received: by 2002:a2e:8545:: with SMTP id u5-v6mr5738830ljj.164.1538385978176; Mon, 01 Oct 2018 02:26:18 -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 s11-v6sm2666955ljj.93.2018.10.01.02.26.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 01 Oct 2018 02:26:17 -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: Mon, 1 Oct 2018 11:26:07 +0200 Message-Id: <1538385970-21260-6-git-send-email-andrzej.ostruszka@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1538385970-21260-1-git-send-email-andrzej.ostruszka@gmail.com> References: <1537434339-22570-1-git-send-email-amo@semihalf.com> <1538385970-21260-1-git-send-email-andrzej.ostruszka@gmail.com> Subject: [dpdk-dev] [PATCH v6 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: Mon, 01 Oct 2018 09:26:19 -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 290bb1a..dc93164 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 3c450d2..d3b8885 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