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 6F71F374E for ; Wed, 3 Oct 2018 09:22:26 +0200 (CEST) Received: by mail-lj1-f195.google.com with SMTP id 203-v6so4080487ljj.13 for ; Wed, 03 Oct 2018 00:22:26 -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=IKqg9fN3qIo7OaW1j2WuzNbJDtQxNRuLJwvqVxvE7TU=; b=T8QI4MvslQCaGKIV490NnOY/JvIVBbg2azn12lrgUtv2HF1XOmIFLjby+Nc6TpslVb gV58KiB/eYTaSTzH3bjgJL1+6HTg+5ylwk8PkKa0yMbOpsjmhkH1H1R/a7wqrDAJ71Q5 Gh846W2vFiF/RnJ2mL9WZFH65XEF26bfBsl+XUaIAN0Rs6HojgMoZnMnmS1/vn6nwinl foEwJ3aBFxQnchV5jPMz/E6LyXdw+MUVK8fep40+8Tr5Oqgf4b/Qabhjn74ti78dudOm BSYs9wLP9WgSqmBjbpuozHNgWwN26SOuBPiM6Rv1vmEkI9Eq58zVCXPx8SXwIMoR52T/ 3HNg== 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=IKqg9fN3qIo7OaW1j2WuzNbJDtQxNRuLJwvqVxvE7TU=; b=an3nILFfAPpHeT/ppwz8pakLOno1cx5jUreqLtGfw+tSI0qxI0i2HrSnWU2GIovJJL MHQIEpFU9y7jre+Kw9JBKeV4rNeOkuovHJ/nIDNw0MkAf8ymWYN0vF+6oXc5Y3r7CHJ3 mqnrfzURoW7p8lZyFyCzp29o8uuZH173MP+zocpmoHwM4sYRlEPPipZmXJHcIZsmY0dD tolJ4nVWA4jnr5amf+ENDWelYKn8iCTaGt0sXU9XAiJq8YWnkJFd6fQ7/iAqqQuYlblG diwF0YrFudxXyvh62VbR532JsHwLQcn5IocXbRYtzMz5knynwQp+k3Y9xsjBNiWhBJBL o6jA== X-Gm-Message-State: ABuFfohbBE93eVplwcWn0MlOqvQ3mzCebDTBy66chpoOgJ3Wdwyikylv 02AtmkUQbQYvtnSmM8TKRwtLzzV6mWE+HA== X-Google-Smtp-Source: ACcGV63tEwpzqmPD1FLfaFV007PiTmsNtXJTuVa2VYnkeW6geMORJWWY+B1ukpaBTo5xQdw+/fVsiA== X-Received: by 2002:a2e:9851:: with SMTP id e17-v6mr120474ljj.143.1538551345856; Wed, 03 Oct 2018 00:22:25 -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.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 03 Oct 2018 00:22:25 -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:14 +0200 Message-Id: <1538551336-19259-7-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 6/8] net/mvneta: add MAC filtering 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:26 -0000 From: Zyta Szpak Add callbacks for adding/removing MAC addresses. Signed-off-by: Yelena Krivosheev Signed-off-by: Natalie Samsonov Signed-off-by: Zyta Szpak --- doc/guides/nics/features/mvneta.ini | 1 + doc/guides/nics/mvneta.rst | 1 + drivers/net/mvneta/mvneta_ethdev.c | 69 +++++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+) diff --git a/doc/guides/nics/features/mvneta.ini b/doc/guides/nics/features/mvneta.ini index 6a140a3..59c9c36 100644 --- a/doc/guides/nics/features/mvneta.ini +++ b/doc/guides/nics/features/mvneta.ini @@ -9,6 +9,7 @@ Link status = Y MTU update = Y Jumbo frame = Y Promiscuous mode = Y +Unicast MAC filter = 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 ccd19f2..068b3a7 100644 --- a/doc/guides/nics/mvneta.rst +++ b/doc/guides/nics/mvneta.rst @@ -32,6 +32,7 @@ Features of the MVNETA PMD are: - Jumbo frame - MTU update - Promiscuous mode +- Unicast MAC filter - Link status - CRC offload - L3 checksum offload diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c index a3dbe56..7a64e5a 100644 --- a/drivers/net/mvneta/mvneta_ethdev.c +++ b/drivers/net/mvneta/mvneta_ethdev.c @@ -574,6 +574,73 @@ mvneta_promiscuous_disable(struct rte_eth_dev *dev) } /** + * DPDK callback to remove a MAC address. + * + * @param dev + * Pointer to Ethernet device structure. + * @param index + * MAC address index. + */ +static void +mvneta_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) +{ + struct mvneta_priv *priv = dev->data->dev_private; + char buf[ETHER_ADDR_FMT_SIZE]; + int ret; + + if (!priv->ppio) + return; + + ret = neta_ppio_remove_mac_addr(priv->ppio, + dev->data->mac_addrs[index].addr_bytes); + if (ret) { + ether_format_addr(buf, sizeof(buf), + &dev->data->mac_addrs[index]); + MVNETA_LOG(ERR, "Failed to remove mac %s", buf); + } +} + +/** + * DPDK callback to add a MAC address. + * + * @param dev + * Pointer to Ethernet device structure. + * @param mac_addr + * MAC address to register. + * @param index + * MAC address index. + * @param vmdq + * VMDq pool index to associate address with (unused). + * + * @return + * 0 on success, negative error value otherwise. + */ +static int +mvneta_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, + uint32_t index, uint32_t vmdq __rte_unused) +{ + struct mvneta_priv *priv = dev->data->dev_private; + char buf[ETHER_ADDR_FMT_SIZE]; + int ret; + + if (index == 0) + /* For setting index 0, mrvl_mac_addr_set() should be used.*/ + return -1; + + if (!priv->ppio) + return 0; + + ret = neta_ppio_add_mac_addr(priv->ppio, mac_addr->addr_bytes); + if (ret) { + ether_format_addr(buf, sizeof(buf), mac_addr); + MVNETA_LOG(ERR, "Failed to add mac %s", buf); + return -1; + } + + return 0; +} + +/** * DPDK callback to set the primary MAC address. * * @param dev @@ -609,6 +676,8 @@ static const struct eth_dev_ops mvneta_ops = { .link_update = mvneta_link_update, .promiscuous_enable = mvneta_promiscuous_enable, .promiscuous_disable = mvneta_promiscuous_disable, + .mac_addr_remove = mvneta_mac_addr_remove, + .mac_addr_add = mvneta_mac_addr_add, .mac_addr_set = mvneta_mac_addr_set, .mtu_set = mvneta_mtu_set, .dev_infos_get = mvneta_dev_infos_get, -- 2.7.4