From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from netronome.com (host-79-78-33-110.static.as9105.net [79.78.33.110]) by dpdk.org (Postfix) with ESMTP id 990461BB56 for ; Fri, 13 Apr 2018 13:01:18 +0200 (CEST) Received: from netronome.com (localhost [127.0.0.1]) by netronome.com (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id w3DB0Xd6012267 for ; Fri, 13 Apr 2018 12:00:33 +0100 Received: (from alucero@localhost) by netronome.com (8.14.4/8.14.4/Submit) id w3DB0X1r012266 for dev@dpdk.org; Fri, 13 Apr 2018 12:00:33 +0100 From: Alejandro Lucero To: dev@dpdk.org Date: Fri, 13 Apr 2018 12:00:33 +0100 Message-Id: <1523617233-12228-1-git-send-email-alejandro.lucero@netronome.com> X-Mailer: git-send-email 1.9.1 Subject: [dpdk-dev] [PATCH] net/nfp: add support for chaning MAC address 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, 13 Apr 2018 11:01:18 -0000 This patch allows to use another MAC address than the one coming with the NIC by default. Signed-off-by: Alejandro Lucero --- drivers/net/nfp/nfp_net.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index bedd4b6..7db438c 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -109,6 +109,8 @@ static int nfp_net_rss_reta_write(struct rte_eth_dev *dev, uint16_t reta_size); static int nfp_net_rss_hash_write(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); +static void nfp_set_mac_addr(struct rte_eth_dev *dev, + struct ether_addr *mac_addr); /* The offset of the queue controller queues in the PCIe Target */ #define NFP_PCIE_QUEUE(_q) (0x80000 + (NFP_QCP_QUEUE_ADDR_SZ * ((_q) & 0xff))) @@ -684,6 +686,15 @@ enum nfp_qcp_ptr { hw->ctrl_bar + NFP_NET_CFG_MACADDR + 6); } +void +nfp_set_mac_addr(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +{ + struct nfp_net_hw *hw; + + hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + nfp_net_write_mac(hw, (uint8_t *)mac_addr); +} + static int nfp_configure_rx_interrupt(struct rte_eth_dev *dev, struct rte_intr_handle *intr_handle) @@ -2750,6 +2761,7 @@ uint32_t nfp_net_txq_full(struct nfp_net_txq *txq) .dev_infos_get = nfp_net_infos_get, .dev_supported_ptypes_get = nfp_net_supported_ptypes_get, .mtu_set = nfp_net_dev_mtu_set, + .mac_addr_set = nfp_set_mac_addr, .vlan_offload_set = nfp_net_vlan_offload_set, .reta_update = nfp_net_reta_update, .reta_query = nfp_net_reta_query, -- 1.9.1