From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH v14 1/4] ethdev: add apis to support access device info Date: Tue, 14 Jul 2015 00:26:38 +0200 Message-ID: <27632259.laExyItStL@xps13> References: <1432946276-9424-1-git-send-email-liang-min.wang@intel.com> <1436736155-9748-1-git-send-email-liang-min.wang@intel.com> <1436736155-9748-2-git-send-email-liang-min.wang@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org To: Liang-Min Larry Wang Return-path: Received: from mail-wi0-f170.google.com (mail-wi0-f170.google.com [209.85.212.170]) by dpdk.org (Postfix) with ESMTP id 3201E2C7A for ; Tue, 14 Jul 2015 00:27:52 +0200 (CEST) Received: by wibud3 with SMTP id ud3so41306446wib.1 for ; Mon, 13 Jul 2015 15:27:52 -0700 (PDT) In-Reply-To: <1436736155-9748-2-git-send-email-liang-min.wang@intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 2015-07-12 17:22, Liang-Min Larry Wang: > --- a/lib/librte_ether/rte_ethdev.c > +++ b/lib/librte_ether/rte_ethdev.c > @@ -2542,6 +2542,30 @@ rte_eth_dev_mac_addr_remove(uint8_t port_id, struct ether_addr *addr) > } > > int > +rte_eth_dev_default_mac_addr_set(uint8_t port_id, struct ether_addr *addr) > +{ > + struct rte_eth_dev *dev; > + > + if (!rte_eth_dev_is_valid_port(port_id)) { > + PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > + return -ENODEV; > + } > + > + if (!is_valid_assigned_ether_addr(addr)) > + return -EINVAL; > + > + dev = &rte_eth_devices[port_id]; > + FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_set, -ENOTSUP); > + > + /* Update default address in NIC data structure */ > + ether_addr_copy(addr, &dev->data->mac_addrs[0]); > + > + (*dev->dev_ops->mac_addr_set)(dev, addr); > + > + return 0; > +} It would be cleaner/clearer in a separate patch. Why not using VALID_PORTID_OR_ERR_RET instead of rte_eth_dev_is_valid_port? > +int > +rte_eth_dev_reg_length(uint8_t port_id) [...] > + return (*dev->dev_ops->get_reg_length)(dev); > +} [...] > +int > +rte_eth_dev_reg_info(uint8_t port_id, struct rte_dev_reg_info *info) [...] > + return (*dev->dev_ops->get_reg)(dev, info); > +} [...] > +int > +rte_eth_dev_eeprom_length(uint8_t port_id) [...] > + return (*dev->dev_ops->get_eeprom_length)(dev); > +} These functions should have the "get" word in their names. > --- a/lib/librte_ether/rte_ether_version.map > +++ b/lib/librte_ether/rte_ether_version.map > @@ -102,6 +102,12 @@ DPDK_2.0 { > rte_eth_tx_queue_setup; > rte_eth_xstats_get; > rte_eth_xstats_reset; > + rte_eth_dev_default_mac_addr_set; > + rte_eth_dev_reg_length; > + rte_eth_dev_reg_info; > + rte_eth_dev_eeprom_length; > + rte_eth_dev_get_eeprom; > + rte_eth_dev_set_eeprom; The new symbols should be in a new node for DPDK 2.1.