From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-f67.google.com (mail-lf1-f67.google.com [209.85.167.67]) by dpdk.org (Postfix) with ESMTP id 7D8364CBD for ; Tue, 28 Aug 2018 17:10:39 +0200 (CEST) Received: by mail-lf1-f67.google.com with SMTP id q13-v6so1689103lfc.2 for ; Tue, 28 Aug 2018 08:10:39 -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=5T2cMfcr55UqbuXqDCzTH9gMsS7Hcu3FEFX6Eas8x2k=; b=HIJVyX1sYugoo/wE8PY2+5wvPExBhNYjCf6ZOhQgDd3YKHT0pQ+o3ent/5Rl6eyYOw SmcNDPAePyz4pYEyzgoaW0a1BKmh/k64BF1Hzi3uIrNkAo74J16MmFsSsqxS0pQZJvV7 xpv7Rk7Ayv7eo88ywhWmlG+NBfPylS2SpM9iMtkCAvE163GN6XALrqXhFS4/5R/4n+mw dg2sGs9+UgoAwdSjpDwPpSssrgdK5zwkdl/BbpxS2YA0i5uLzwE7SPIeMgidu5CrBGCW cjGkoYkkEQm+6ZtL+GvCFcYbWVQJX5ZYp/1+JtVfyHzELJp6/ECr9QDWBomzWIiCEdDn w5SA== 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=5T2cMfcr55UqbuXqDCzTH9gMsS7Hcu3FEFX6Eas8x2k=; b=q8z8kB61BeMb3ZUtIiVe1r1KvGxw/40pvuGRUHv4SXy7diwqog6cS/YbRxoScKKbgt RrPqGPvjCcokOlxEzG6qeO3+Z9zMUovkJlV6XOFRALxXNAy2/Imm2p1+OAMoEfbxnhlN xP4lVauysOuuTwg4JA/9pU796iWP1RBavZKpzFK94ORUR+KqY2AOlMeHXYAkltoTg1Iv Amr+M/dCEPr/qlbZiECJLzKCttQyRhLa1sEaG6ZCmMrUwkNUHpevav4wPI5Q01TfXAG+ ygckc50llZITP3QLgIbxtnGRaWDup0YT8TvL1MtYpayuygEAsKBGI8Jw7262YJvTH7Dn yUVg== X-Gm-Message-State: APzg51DjDnCBEnsgohZLiT6qffuMx9BpEOT9Yi4jmPDutKMkeMYd1z76 0ME6GcomkCRt4/Vc4CKvPTDhRscf/H0= X-Google-Smtp-Source: ANB0Vdb4ZzF5z8zycM4tDvMsRqNcVkDbVaCQ4FIZzdmy5+Qb+uXZLvDzBdo8+JjmEc33lEV2ja9Kfg== X-Received: by 2002:a19:5353:: with SMTP id h80-v6mr1642678lfb.9.1535469038957; Tue, 28 Aug 2018 08:10:38 -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 p28-v6sm260685ljp.90.2018.08.28.08.10.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 28 Aug 2018 08:10:38 -0700 (PDT) From: Andrzej Ostruszka To: dev@dpdk.org Cc: nsamsono@marvell.com Date: Tue, 28 Aug 2018 17:10:28 +0200 Message-Id: <1535469030-18647-7-git-send-email-amo@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535469030-18647-1-git-send-email-amo@semihalf.com> References: <1535469030-18647-1-git-send-email-amo@semihalf.com> Subject: [dpdk-dev] [PATCH 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: Tue, 28 Aug 2018 15:10:39 -0000 From: Yelena Krivosheev Add callbacks for adding/removing MAC addresses. Signed-off-by: Yelena Krivosheev Signed-off-by: Natalie Samsonov --- drivers/net/mvneta/mvneta_ethdev.c | 69 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c index 3236e93..f19d2ea 100644 --- a/drivers/net/mvneta/mvneta_ethdev.c +++ b/drivers/net/mvneta/mvneta_ethdev.c @@ -1586,6 +1586,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\n", 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\n", buf); + return -1; + } + + return 0; +} + +/** * DPDK callback to set the primary MAC address. * * @param dev @@ -1621,6 +1688,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