From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id AF9482BE0 for ; Fri, 4 Mar 2016 16:25:30 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP; 04 Mar 2016 07:25:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,536,1449561600"; d="scan'208";a="758138823" Received: from rpkelly-mobl2.ger.corp.intel.com (HELO VM.ger.corp.intel.com) ([10.252.0.14]) by orsmga003.jf.intel.com with ESMTP; 04 Mar 2016 07:25:28 -0800 From: Remy Horton To: dev@dpdk.org, Yong Wang Date: Fri, 4 Mar 2016 15:25:24 +0000 Message-Id: <1457105124-23650-3-git-send-email-remy.horton@intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1457105124-23650-1-git-send-email-remy.horton@intel.com> References: <1457105124-23650-1-git-send-email-remy.horton@intel.com> Subject: [dpdk-dev] [PATCH v2 2/2] drivers/net/vmxnet3: add ethdev functions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Mar 2016 15:25:31 -0000 Implements driver support for setting of MAC address. Signed-off-by: Remy Horton --- doc/guides/rel_notes/release_16_04.rst | 4 ++++ drivers/net/vmxnet3/vmxnet3_ethdev.c | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst index 4e0112e..39db674 100644 --- a/doc/guides/rel_notes/release_16_04.rst +++ b/doc/guides/rel_notes/release_16_04.rst @@ -62,6 +62,10 @@ This section should contain new features added in this release. Sample format: Implemented driver functions for Register dumping, EEPROM dumping, and setting of MAC address. +* **vmxnet3: Added ethdev support functions.** + + Implemented driver functionality for setting MAC address. + Resolved Issues --------------- diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index c363bf6..bc83524 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -91,6 +91,8 @@ static int vmxnet3_dev_vlan_filter_set(struct rte_eth_dev *dev, static void vmxnet3_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask); static void vmxnet3_dev_vlan_offload_set_clear(struct rte_eth_dev *dev, int mask, int clear); +static void vmxnet3_mac_addr_set(struct rte_eth_dev *dev, + struct ether_addr *mac_addr); #if PROCESS_SYS_EVENTS == 1 static void vmxnet3_process_events(struct vmxnet3_hw *); @@ -124,6 +126,7 @@ static const struct eth_dev_ops vmxnet3_eth_dev_ops = { .rx_queue_release = vmxnet3_dev_rx_queue_release, .tx_queue_setup = vmxnet3_dev_tx_queue_setup, .tx_queue_release = vmxnet3_dev_tx_queue_release, + .mac_addr_set = vmxnet3_mac_addr_set, }; static const struct rte_memzone * @@ -922,6 +925,22 @@ vmxnet3_process_events(struct vmxnet3_hw *hw) } #endif +static void vmxnet3_mac_addr_set(struct rte_eth_dev *dev, + struct ether_addr *mac_addr) +{ + struct vmxnet3_hw *hw = dev->data->dev_private; + uint32_t mac_hi, mac_lo; + + if (!is_valid_assigned_ether_addr(mac_addr)) { + PMD_DRV_LOG(ERR, "Tried to set invalid MAC address."); + return; + } + memcpy(&mac_lo, mac_addr, 4); + memcpy(&mac_hi, mac_addr + 4, 2); + VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_MACL, mac_lo); + VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_MACH, mac_hi); +} + static struct rte_driver rte_vmxnet3_driver = { .type = PMD_PDEV, .init = rte_vmxnet3_pmd_init, -- 2.5.0