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 C237B5B16 for ; Fri, 31 Aug 2018 14:26:22 +0200 (CEST) Received: by mail-lj1-f193.google.com with SMTP id y17-v6so9933121ljy.8 for ; Fri, 31 Aug 2018 05:26:22 -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=zZUKuII3gZUqtcGWFIEmON5fwHH422k8MKD8drfQHNE=; b=wLB/fM6w5jYLWnfJYlsIJaKzPwDyf7lEK4WfiW67qrslDZjjjjBAIWeEDfjnx0KNyQ GBPL4aQ0vQh6KO5A+kNj/aCa3/tQdsyf75iTDXPSNvVA6dgr3GtwoErWvGvXHzcPYNVr UejaiYsGP+rhc3q/b2SfSnoDP6RbNVpTT8eKmYFIZrmwQx1/K6ud/j4WPqYM6Uoh07QO Cdsp5hK8i1DlNAVIYkUoVQs0tj2d9LE5lFvNxyIX/0orYdGgaRRRQhcauXAOBNBsoGH8 IK1e/NU6cmqNq90RzrgzBxd2oRKTtGCQfiiYKz7yD7UYsA5L943F6w6c5G/b7DvsVaLB C8rA== 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=zZUKuII3gZUqtcGWFIEmON5fwHH422k8MKD8drfQHNE=; b=B2hhdV/kEEYfJ9iwY9FiS3P4tEPkvS7dhlCVJNaW0kVRY8j0WxRT6UxQKAMbZ5CmvW 6WCKIqz0KQnfbHpQeyz5xctEeEqrknwQmYtjlB2IQKJJDBOsfUcixQb3KTFY5Ewh0lDO u9x9aOsyxehJ2SFX7ac0AmgZW8hEl9ip560PZ7QX2zvoJjKxzLEtcPxoS+/a2TLgXLB8 Q8fAv5dKOw0vTzvHMksJ5fJnWPuupz7nObpNwok3agMNOkwbDDSGCgmEyu5MRV1Bsfj3 ma8hZKnr48ctMHYU4A9lRnyhwu1asKcLAWHs2/kSkHvBN8hXtkSIl7/SqWkmsiKfR3jd UhJw== X-Gm-Message-State: APzg51Cd7AMMNcIodvwxOCkXTzu1RUxKY8NISfAA3d3607Q9eRfZZPJe se1RBCAleR/StkxemvYMg9ZCkv2b2XI= X-Google-Smtp-Source: ANB0VdYVE3kh46cH4+6Nnv8EpafQfgHrpOnvdnsCWbdBavprbpLdRy2BBSTv2v+GogUUOU35NKZwuQ== X-Received: by 2002:a2e:2282:: with SMTP id i124-v6mr10772930lji.11.1535718382290; Fri, 31 Aug 2018 05:26:22 -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 t4-v6sm1825422lfd.13.2018.08.31.05.26.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 31 Aug 2018 05:26:21 -0700 (PDT) From: Andrzej Ostruszka To: dev@dpdk.org Cc: mw@semihalf.com, zr@semihalf.com, tdu@semihalf.com, nsamsono@marvell.com Date: Fri, 31 Aug 2018 14:26:06 +0200 Message-Id: <1535718368-15803-11-git-send-email-amo@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535718368-15803-1-git-send-email-amo@semihalf.com> References: <1535469030-18647-1-git-send-email-amo@semihalf.com> <1535718368-15803-1-git-send-email-amo@semihalf.com> Subject: [dpdk-dev] [PATCH v2 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: Fri, 31 Aug 2018 12:26:23 -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 --- 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 68d363e..975375e 100644 --- a/drivers/net/mvneta/mvneta_ethdev.c +++ b/drivers/net/mvneta/mvneta_ethdev.c @@ -1579,6 +1579,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 @@ -1614,6 +1681,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