From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 3CE46C404 for ; Thu, 28 Jan 2016 09:48:47 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP; 28 Jan 2016 00:48:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,357,1449561600"; d="scan'208";a="890850797" Received: from rhorton-mobl.ger.corp.intel.com (HELO VM.ir.intel.com) ([163.33.228.69]) by fmsmga001.fm.intel.com with ESMTP; 28 Jan 2016 00:48:25 -0800 From: Remy Horton To: helin.zhang@intel.com, huawei.xie@intel.com, yongwang@vmware.com Date: Thu, 28 Jan 2016 08:48:15 +0000 Message-Id: <1453970895-2639-4-git-send-email-remy.horton@intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1453970895-2639-1-git-send-email-remy.horton@intel.com> References: <1453970895-2639-1-git-send-email-remy.horton@intel.com> Cc: dev@dpdk.org Subject: [dpdk-dev] [PATCH v1 3/3] 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: Thu, 28 Jan 2016 08:48:47 -0000 Implements driver support for fetching Tx and Rx queue information, and setting of MAC address. Signed-off-by: Remy Horton --- doc/guides/rel_notes/release_2_3.rst | 5 +++ drivers/net/vmxnet3/vmxnet3_ethdev.c | 60 ++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) diff --git a/doc/guides/rel_notes/release_2_3.rst b/doc/guides/rel_notes/release_2_3.rst index e6dab98..6a50e26 100644 --- a/doc/guides/rel_notes/release_2_3.rst +++ b/doc/guides/rel_notes/release_2_3.rst @@ -13,6 +13,11 @@ New Features Implemented Tx & Rx queue information fetching functions. +* **vmxnet3: Added ethdev support functions.** + + Implemented Tx & Rx queue information fetching and MAC address setting + functions. + Resolved Issues --------------- diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index c363bf6..f7000d6 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -91,6 +91,15 @@ 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); +static void vmxnet3_rxq_info_get(struct rte_eth_dev *dev, + uint16_t queue_id, + struct rte_eth_rxq_info *qinfo); +static void vmxnet3_txq_info_get(struct rte_eth_dev *dev, + uint16_t queue_id, + struct rte_eth_txq_info *qinfo); + #if PROCESS_SYS_EVENTS == 1 static void vmxnet3_process_events(struct vmxnet3_hw *); @@ -124,6 +133,9 @@ 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, + .rxq_info_get = vmxnet3_rxq_info_get, + .txq_info_get = vmxnet3_txq_info_get, }; static const struct rte_memzone * @@ -922,6 +934,54 @@ 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; + + 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); + + ether_addr_copy(mac_addr, &dev->data->mac_addrs[0]); +} + +static void vmxnet3_rxq_info_get(struct rte_eth_dev *dev, + uint16_t queue_id, + struct rte_eth_rxq_info *qinfo) +{ + struct vmxnet3_rx_queue *rxq; + + rxq = dev->data->rx_queues[queue_id]; + + qinfo->mp = rxq->mp; + qinfo->scattered_rx = dev->data->scattered_rx; + qinfo->nb_desc = dev->data->nb_rx_queues; + + /* Driver does not use these values */ + qinfo->conf.rx_free_thresh = 0; + qinfo->conf.rx_drop_en = 0; + qinfo->conf.rx_deferred_start = 0; +} + +static void vmxnet3_txq_info_get(struct rte_eth_dev *dev, + __rte_unused uint16_t queue_id, + struct rte_eth_txq_info *qinfo) +{ + qinfo->nb_desc = dev->data->nb_tx_queues; + + /* Driver does not use these values */ + qinfo->conf.tx_thresh.pthresh = 0; + qinfo->conf.tx_thresh.hthresh = 0; + qinfo->conf.tx_thresh.wthresh = 0; + qinfo->conf.tx_free_thresh = 0; + qinfo->conf.tx_rs_thresh = 0; + qinfo->conf.txq_flags = 0; + qinfo->conf.tx_deferred_start = 0; +} + static struct rte_driver rte_vmxnet3_driver = { .type = PMD_PDEV, .init = rte_vmxnet3_pmd_init, -- 2.5.0