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 83FF269D4 for ; Thu, 20 Sep 2018 11:05:49 +0200 (CEST) Received: by mail-lf1-f67.google.com with SMTP id x20-v6so7655534lfg.2 for ; Thu, 20 Sep 2018 02:05:49 -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=ptDihvFRxJlIepzCyAHM9mlKiKrYkL6F79nlYEUBoW8=; b=xGx/MEbCq70FJJpVJW3B6mONoUVLVKvx1qAi7k2FF9+ZFQscRQn+ostTfMP3zcFb8d U0wS+fLhHznX0xf8b0rMt/2WGeZWdM1jnFLzkqZzEqFGeO8hGcA2DLr1mVeOLpdTt2Iq ShL5XL27nD07eKXuIKZuW4Ml2wTgKJXJvNYmAsNQCOlHoLhqqzL8kldiQEAEVYKTXxQz +j42I1rFx/oDd+0+D9+47SD2yaxUFAMdu2KbXs4BkrEK2b9CebkJIwJeH2mGjOTsf/wk bL/L5vnxfDQqcB98jPtaBSDCjggzdlP3iBeoIjKjDhb2M3cBC3ZYteM/xZwvsT5i4+fE qolA== 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=ptDihvFRxJlIepzCyAHM9mlKiKrYkL6F79nlYEUBoW8=; b=lzEjxtxPkd7iS/J89OANNKftrjST8mjkbPcCPpiQcZIYcyXr6FPHXepCl6IOmlSRF+ okAU8kY3aC1QcGSXgg709WWrAYCu25a7qcOyr5xH4Z6ykqa/h18zrfBxvCLLwOcduDQE zuFiE4wj7In0sEgu9q2QLEokneB9YyBT+DKlb3oqXCvohi2mxYegMTGh4PrWTqIT5GBj uyKjS73MsAy+Y/JVg+ILnvPtMwXl8XbJ6xWvXBKMbF0RqLsIsmx+OHGMWc/bHjbBgNRH CCd2ilDcm5JLltZ9KBgcW/jRAcUgg51k+BLDQ09ogzORbDnLachKnXMxZkI8DpbtWxZt 9bQw== X-Gm-Message-State: APzg51DUcnRT2wzzoJTAnke+cOprwJAyOv57Sj1//1y5K6niAoPoHab+ 206H0iy8enzmAXuWonVzdvJeEniaw8Q= X-Google-Smtp-Source: ANB0VdY1+/sLauk0Cni9M/Wme7uqFKa76FbOZRp1+PC0WNShQArRAre3EQSz4WX2Zn8wcSZpTU0szQ== X-Received: by 2002:a19:5a8f:: with SMTP id y15-v6mr9527959lfk.15.1537434348903; Thu, 20 Sep 2018 02:05:48 -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.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 20 Sep 2018 02:05:48 -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:37 +0200 Message-Id: <1537434339-22570-7-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 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: Thu, 20 Sep 2018 09:05:49 -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 1912c3e..b21581b 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 04881d5..09b98de 100644 --- a/drivers/net/mvneta/mvneta_ethdev.c +++ b/drivers/net/mvneta/mvneta_ethdev.c @@ -599,6 +599,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 @@ -634,6 +701,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