[dpdk-dev] Diff for persistent KNI interfaces
I guess theres not much interest from others for this support in general, but putting it out here in case anyone wants to take a look. If anyone finds any major issues with the diffset, please do let me know, that will be of great help. I have tested this on my machine. Rgds, Gopa. -- next part -- commit 58968f690056d5afa7517e724bc91f6436639d10 Author: Gopakumar C E Date: Sun Jul 12 11:18:33 2015 -0700 KNI persistent interfaces diff --git a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h index 1e55c2d..369ab85 100644 --- a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h +++ b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h @@ -160,6 +160,7 @@ struct rte_kni_device_info { uint32_t core_id; /**< core ID to bind for kernel thread */ uint8_t force_bind : 1; /**< Flag for kernel thread binding */ + uint8_t persist_on_close : 1; /**< Dont delete interface on dev/kni close */ /* mbuf size */ unsigned mbuf_size; diff --git a/lib/librte_eal/linuxapp/kni/kni_dev.h b/lib/librte_eal/linuxapp/kni/kni_dev.h index e79e472..e50aad7 100644 --- a/lib/librte_eal/linuxapp/kni/kni_dev.h +++ b/lib/librte_eal/linuxapp/kni/kni_dev.h @@ -96,6 +96,12 @@ struct kni_dev { /* synchro for request processing */ unsigned long synchro; + /* Persist netdev on /dev/kni close */ + uint8_t netdev_persist : 1; + + /* /dev/kni is closed or not */ + uint8_t kni_released : 1; + #ifdef RTE_KNI_VHOST struct kni_vhost_queue* vhost_queue; volatile enum { diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c b/lib/librte_eal/linuxapp/kni/kni_misc.c index 1935d32..f386a31 100644 --- a/lib/librte_eal/linuxapp/kni/kni_misc.c +++ b/lib/librte_eal/linuxapp/kni/kni_misc.c @@ -58,7 +58,7 @@ static int kni_ioctl(struct inode *inode, unsigned int ioctl_num, unsigned long ioctl_param); static int kni_compat_ioctl(struct inode *inode, unsigned int ioctl_num, unsigned long ioctl_param); -static int kni_dev_remove(struct kni_dev *dev); +static int kni_dev_remove(struct kni_dev *dev, int netdev_remove); static int __init kni_parse_kthread_mode(void); @@ -128,6 +128,21 @@ kni_init(void) static void __exit kni_exit(void) { +struct kni_dev *dev, *n; + + /* +* Remove all the persistent KNI interfaces. +*/ +down_write(&kni_list_lock); +list_for_each_entry_safe(dev, n, &kni_list_head, list) { + if (dev->net_dev) { + unregister_netdev(dev->net_dev); + free_netdev(dev->net_dev); + } +list_del(&dev->list); + } +up_write(&kni_list_lock); + misc_deregister(&kni_misc); KNI_PRINT("### DPDK kni module unloaded ###\n"); } @@ -196,8 +211,12 @@ kni_release(struct inode *inode, struct file *file) #ifdef RTE_KNI_VHOST kni_vhost_backend_release(dev); #endif - kni_dev_remove(dev); - list_del(&dev->list); + kni_dev_remove(dev, !dev->netdev_persist); + if (!dev->netdev_persist) { + list_del(&dev->list); + } else { + dev->kni_released = 1; + } } up_write(&kni_list_lock); @@ -264,7 +283,7 @@ kni_thread_multiple(void *param) } static int -kni_dev_remove(struct kni_dev *dev) +kni_dev_remove(struct kni_dev *dev, int netdev_remove) { if (!dev) return -ENODEV; @@ -282,7 +301,7 @@ kni_dev_remove(struct kni_dev *dev) break; } - if (dev->net_dev) { + if (dev->net_dev && netdev_remove) { unregister_netdev(dev->net_dev); free_netdev(dev->net_dev); } @@ -314,8 +333,9 @@ kni_ioctl_create(unsigned int ioctl_num, unsigned long ioctl_param) struct pci_dev *found_pci = NULL; struct net_device *net_dev = NULL; struct net_device *lad_dev = NULL; - struct kni_dev *kni, *dev, *n; + struct kni_dev *kni = NULL, *dev, *n; struct net *net; + int kni_exists = 0; printk(KERN_INFO "KNI: Creating kni...\n"); /* Check the buffer size, to avoid warning */ @@ -343,32 +363,52 @@ kni_ioctl_create(unsigned int ioctl_num, unsigned long ioctl_param) down_read(&kni_list_lock); list_for_each_entry_safe(dev, n, &kni_list_head, list) { if (kni_check_param(dev, &dev_info) < 0) { - up_read(&kni_list_lock); - return -EINVAL; + kni = dev; + kni_exists = 1; + break; } }
[dpdk-dev] [PATCH v14 0/4] User-space Ethtool
This implementation is designed to provide a familar interface for applications that rely on kernel-space driver to support ethtool_op and net_device_op for device management. The initial implementation focuses on ops that can be implemented through existing netdev APIs. More ops will be supported in latter release. v14 changes: - Add library path to fix top-level, $RTE_TARGET, example/l2fwd-ethtool build v13 changes: - Rebase beause patch 1588 v12 changes: - Update coding style to match latest change over rte_ethdev.c (by shemming at brocade.com) v11 changes: - Fixed a typo and clean coding style. v10 changes: - Merged const fix back to igb/ixgbe. v9 changes: - Fixed checkpatch errors. v8 changes: - Changed register tables to const. v7 change: - Remove rte_eth_dev_get_ringparam implementation v6 change: - Rebase to match new changes over librte_ether v5 change: - Change API name from 'leng' to 'length' - Remove unused data structure rte_dev_vf_info - Remove placeholder API rte_eth_dev_set_ringparam - Clean up set_mac_addr implementation v4 change: - Add rte_eth_xxx apis and respective ops over igb and ixgbe to support ethtool and net device alike ops - Add an example to demonstrate the use of ethtool library v3 change: - Fix a build issue v2 change: - Implement rte_eth_dev_default_mac_addr_set through dev_ops::mac_addr_set so it would support NIC devices other than ixgbe and igb Liang-Min Larry Wang (4): ethdev: add apis to support access device info ixgbe: add ops to support ethtool ops igb: add ops to support ethtool ops examples: new example: l2fwd-ethtool drivers/net/e1000/igb_ethdev.c | 175 drivers/net/e1000/igb_regs.h | 223 + drivers/net/ixgbe/ixgbe_ethdev.c | 178 +++- drivers/net/ixgbe/ixgbe_regs.h | 376 examples/Makefile|3 + examples/l2fwd-ethtool/Makefile | 55 ++ examples/l2fwd-ethtool/l2fwd-app/Makefile| 60 ++ examples/l2fwd-ethtool/l2fwd-app/main.c | 1066 ++ examples/l2fwd-ethtool/l2fwd-app/netdev_api.h| 769 examples/l2fwd-ethtool/l2fwd-app/shared_fifo.h | 158 examples/l2fwd-ethtool/lib/Makefile | 55 ++ examples/l2fwd-ethtool/lib/rte_ethtool.c | 308 +++ examples/l2fwd-ethtool/lib/rte_ethtool.h | 384 examples/l2fwd-ethtool/nic-control/Makefile | 55 ++ examples/l2fwd-ethtool/nic-control/nic_control.c | 471 ++ lib/librte_ether/Makefile|1 + lib/librte_ether/rte_eth_dev_info.h | 57 ++ lib/librte_ether/rte_ethdev.c| 84 ++ lib/librte_ether/rte_ethdev.h| 118 +++ lib/librte_ether/rte_ether_version.map |6 + 20 files changed, 4600 insertions(+), 2 deletions(-) create mode 100644 drivers/net/e1000/igb_regs.h create mode 100644 drivers/net/ixgbe/ixgbe_regs.h create mode 100644 examples/l2fwd-ethtool/Makefile create mode 100644 examples/l2fwd-ethtool/l2fwd-app/Makefile create mode 100644 examples/l2fwd-ethtool/l2fwd-app/main.c create mode 100644 examples/l2fwd-ethtool/l2fwd-app/netdev_api.h create mode 100644 examples/l2fwd-ethtool/l2fwd-app/shared_fifo.h create mode 100644 examples/l2fwd-ethtool/lib/Makefile create mode 100644 examples/l2fwd-ethtool/lib/rte_ethtool.c create mode 100644 examples/l2fwd-ethtool/lib/rte_ethtool.h create mode 100644 examples/l2fwd-ethtool/nic-control/Makefile create mode 100644 examples/l2fwd-ethtool/nic-control/nic_control.c create mode 100644 lib/librte_ether/rte_eth_dev_info.h -- 2.1.4
[dpdk-dev] [PATCH v14 1/4] ethdev: add apis to support access device info
add two new apis: rte_eth_dev_default_mac_addr_set and rte_eth_ethtool_dev_info to enable reading device parameters (mac, register, eeprom, pause, ring) based upon ethtool alike data parameter sepcification. Signed-off-by: Liang-Min Larry Wang --- lib/librte_ether/Makefile | 1 + lib/librte_ether/rte_eth_dev_info.h| 57 lib/librte_ether/rte_ethdev.c | 84 +++ lib/librte_ether/rte_ethdev.h | 118 + lib/librte_ether/rte_ether_version.map | 6 ++ 5 files changed, 266 insertions(+) create mode 100644 lib/librte_ether/rte_eth_dev_info.h diff --git a/lib/librte_ether/Makefile b/lib/librte_ether/Makefile index c0e5768..05209e9 100644 --- a/lib/librte_ether/Makefile +++ b/lib/librte_ether/Makefile @@ -51,6 +51,7 @@ SRCS-y += rte_ethdev.c SYMLINK-y-include += rte_ether.h SYMLINK-y-include += rte_ethdev.h SYMLINK-y-include += rte_eth_ctrl.h +SYMLINK-y-include += rte_eth_dev_info.h # this lib depends upon: DEPDIRS-y += lib/librte_eal lib/librte_mempool lib/librte_ring lib/librte_mbuf diff --git a/lib/librte_ether/rte_eth_dev_info.h b/lib/librte_ether/rte_eth_dev_info.h new file mode 100644 index 000..6848051 --- /dev/null +++ b/lib/librte_ether/rte_eth_dev_info.h @@ -0,0 +1,57 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2015 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _RTE_ETH_DEV_INFO_H_ +#define _RTE_ETH_DEV_INFO_H_ + +/* + * Placeholder for accessing device registers + */ +struct rte_dev_reg_info { + void *buf; /**< Buffer for register */ + uint32_t offset; /**< Offset for 1st register to fetch */ + uint32_t leng; /**< Number of registers to fetch */ + uint32_t version; /**< Device version */ +}; + +/* + * Placeholder for accessing device eeprom + */ +struct rte_dev_eeprom_info { + void *buf; /**< Buffer for eeprom */ + uint32_t offset; /**< Offset for 1st eeprom location to access */ + uint32_t leng; /**< Length of eeprom region to access */ + uint32_t magic; /**< Device ID */ +}; + +#endif /* _RTE_ETH_DEV_INFO_H_ */ diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index b79e5f7..6c1da9e 100644 --- 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; +} + +int rte_eth_dev_set_vf_rxmode(uint8_t port_id, uint16_t vf, uint16_t rx_mode, uint8_t on) { @@ -3353,3 +3377,63 @@ rte_eth_timesync_read_tx_timestamp(uint8_t port_id, struct timespec *timestamp) FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_tx_timest
[dpdk-dev] [PATCH v14 2/4] ixgbe: add ops to support ethtool ops
add function to support ethtool ops: - set_mac_addr - get_reg_length - get_regs - get_eeprom_length - get_eeprom - set_eeprom Signed-off-by: Liang-Min Larry Wang --- drivers/net/ixgbe/ixgbe_ethdev.c | 178 +- drivers/net/ixgbe/ixgbe_regs.h | 376 +++ 2 files changed, 552 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ixgbe/ixgbe_regs.h diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 4015feb..6676e71 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -68,6 +68,9 @@ #include "ixgbe_ethdev.h" #include "ixgbe_bypass.h" #include "ixgbe_rxtx.h" +#include "base/ixgbe_type.h" +#include "base/ixgbe_phy.h" +#include "ixgbe_regs.h" /* * High threshold controlling when to start sending XOFF frames. Must be at @@ -91,6 +94,7 @@ #define IXGBE_MMW_SIZE_DEFAULT0x4 #define IXGBE_MMW_SIZE_JUMBO_FRAME0x14 +#define IXGBE_MAX_RING_DESC 4096 /* replicate define from rxtx */ /* * Default values for RX/TX configuration @@ -187,6 +191,8 @@ static void ixgbe_dev_interrupt_delayed_handler(void *param); static void ixgbe_add_rar(struct rte_eth_dev *dev, struct ether_addr *mac_addr, uint32_t index, uint32_t pool); static void ixgbe_remove_rar(struct rte_eth_dev *dev, uint32_t index); +static void ixgbe_set_default_mac_addr(struct rte_eth_dev *dev, + struct ether_addr *mac_addr); static void ixgbe_dcb_init(struct ixgbe_hw *hw,struct ixgbe_dcb_config *dcb_config); /* For Virtual Function support */ @@ -231,6 +237,8 @@ static void ixgbevf_add_mac_addr(struct rte_eth_dev *dev, struct ether_addr *mac_addr, uint32_t index, uint32_t pool); static void ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index); +static void ixgbevf_set_default_mac_addr(struct rte_eth_dev *dev, +struct ether_addr *mac_addr); static int ixgbe_syn_filter_set(struct rte_eth_dev *dev, struct rte_eth_syn_filter *filter, bool add); @@ -268,6 +276,19 @@ static int ixgbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu); static int ixgbe_dev_set_mc_addr_list(struct rte_eth_dev *dev, struct ether_addr *mc_addr_set, uint32_t nb_mc_addr); +/* Ethtool op support */ +static int ixgbe_get_reg_length(struct rte_eth_dev *dev); +static int ixgbe_get_regs(struct rte_eth_dev *dev, + struct rte_dev_reg_info *regs); +static int ixgbe_get_eeprom_length(struct rte_eth_dev *dev); +static int ixgbe_get_eeprom(struct rte_eth_dev *dev, + struct rte_dev_eeprom_info *eeprom); +static int ixgbe_set_eeprom(struct rte_eth_dev *dev, + struct rte_dev_eeprom_info *eeprom); + +static int ixgbevf_get_reg_length(struct rte_eth_dev *dev); +static int ixgbevf_get_regs(struct rte_eth_dev *dev, + struct rte_dev_reg_info *regs); static int ixgbe_timesync_enable(struct rte_eth_dev *dev); static int ixgbe_timesync_disable(struct rte_eth_dev *dev); @@ -375,6 +396,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .priority_flow_ctrl_set = ixgbe_priority_flow_ctrl_set, .mac_addr_add = ixgbe_add_rar, .mac_addr_remove = ixgbe_remove_rar, + .mac_addr_set = ixgbe_set_default_mac_addr, .uc_hash_table_set= ixgbe_uc_hash_table_set, .uc_all_hash_table_set = ixgbe_uc_all_hash_table_set, .mirror_rule_set = ixgbe_mirror_rule_set, @@ -406,6 +428,11 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .timesync_disable = ixgbe_timesync_disable, .timesync_read_rx_timestamp = ixgbe_timesync_read_rx_timestamp, .timesync_read_tx_timestamp = ixgbe_timesync_read_tx_timestamp, + .get_reg_length = ixgbe_get_reg_length, + .get_reg = ixgbe_get_regs, + .get_eeprom_length= ixgbe_get_eeprom_length, + .get_eeprom = ixgbe_get_eeprom, + .set_eeprom = ixgbe_set_eeprom, }; /* @@ -432,6 +459,9 @@ static const struct eth_dev_ops ixgbevf_eth_dev_ops = { .mac_addr_add = ixgbevf_add_mac_addr, .mac_addr_remove = ixgbevf_remove_mac_addr, .set_mc_addr_list = ixgbe_dev_set_mc_addr_list, + .mac_addr_set = ixgbevf_set_default_mac_addr, + .get_reg_length = ixgbevf_get_reg_length, + .get_reg = ixgbevf_get_regs, }; /** @@ -2923,6 +2953,14 @@ ixgbe_remove_rar(struct rte_eth_dev *dev, uint32_t index) ixgbe_clear_rar(hw, index); } +static void +ixgbe_set_default_mac_addr(struct rte_eth_dev *dev, struct ether_addr *addr) +{ + ixgbe_remove_rar(dev, 0)
[dpdk-dev] [PATCH v14 3/4] igb: add ops to support ethtool ops
add function to support ethtool ops: - set_mac_addr - get_reg_length - get_regs - get_eeprom_length - get_eeprom - set_eeprom Signed-off-by: Liang-Min Larry Wang --- drivers/net/e1000/igb_ethdev.c | 175 drivers/net/e1000/igb_regs.h | 223 + 2 files changed, 398 insertions(+) create mode 100644 drivers/net/e1000/igb_regs.h diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index eb97218..c6d057f 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -55,6 +55,7 @@ #include "e1000_logs.h" #include "base/e1000_api.h" #include "e1000_ethdev.h" +#include "igb_regs.h" /* * Default values for port configuration @@ -137,6 +138,8 @@ static void eth_igb_rar_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr, uint32_t index, uint32_t pool); static void eth_igb_rar_clear(struct rte_eth_dev *dev, uint32_t index); +static void eth_igb_default_mac_addr_set(struct rte_eth_dev *dev, + struct ether_addr *addr); static void igbvf_intr_disable(struct e1000_hw *hw); static int igbvf_dev_configure(struct rte_eth_dev *dev); @@ -150,6 +153,12 @@ static int igbvf_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on); static int igbvf_set_vfta(struct e1000_hw *hw, uint16_t vid, bool on); static void igbvf_set_vfta_all(struct rte_eth_dev *dev, bool on); +static void igbvf_default_mac_addr_set(struct rte_eth_dev *dev, + struct ether_addr *addr); +static int igbvf_get_reg_length(struct rte_eth_dev *dev); +static int igbvf_get_regs(struct rte_eth_dev *dev, + struct rte_dev_reg_info *regs); + static int eth_igb_rss_reta_update(struct rte_eth_dev *dev, struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size); @@ -201,6 +210,14 @@ static int eth_igb_filter_ctrl(struct rte_eth_dev *dev, enum rte_filter_type filter_type, enum rte_filter_op filter_op, void *arg); +static int eth_igb_get_reg_length(struct rte_eth_dev *dev); +static int eth_igb_get_regs(struct rte_eth_dev *dev, + struct rte_dev_reg_info *regs); +static int eth_igb_get_eeprom_length(struct rte_eth_dev *dev); +static int eth_igb_get_eeprom(struct rte_eth_dev *dev, + struct rte_dev_eeprom_info *eeprom); +static int eth_igb_set_eeprom(struct rte_eth_dev *dev, + struct rte_dev_eeprom_info *eeprom); static int eth_igb_set_mc_addr_list(struct rte_eth_dev *dev, struct ether_addr *mc_addr_set, @@ -283,6 +300,7 @@ static const struct eth_dev_ops eth_igb_ops = { .flow_ctrl_set= eth_igb_flow_ctrl_set, .mac_addr_add = eth_igb_rar_set, .mac_addr_remove = eth_igb_rar_clear, + .mac_addr_set = eth_igb_default_mac_addr_set, .reta_update = eth_igb_rss_reta_update, .reta_query = eth_igb_rss_reta_query, .rss_hash_update = eth_igb_rss_hash_update, @@ -293,6 +311,11 @@ static const struct eth_dev_ops eth_igb_ops = { .timesync_disable = igb_timesync_disable, .timesync_read_rx_timestamp = igb_timesync_read_rx_timestamp, .timesync_read_tx_timestamp = igb_timesync_read_tx_timestamp, + .get_reg_length = eth_igb_get_reg_length, + .get_reg = eth_igb_get_regs, + .get_eeprom_length= eth_igb_get_eeprom_length, + .get_eeprom = eth_igb_get_eeprom, + .set_eeprom = eth_igb_set_eeprom, }; /* @@ -314,6 +337,9 @@ static const struct eth_dev_ops igbvf_eth_dev_ops = { .tx_queue_setup = eth_igb_tx_queue_setup, .tx_queue_release = eth_igb_tx_queue_release, .set_mc_addr_list = eth_igb_set_mc_addr_list, + .mac_addr_set = igbvf_default_mac_addr_set, + .get_reg_length = igbvf_get_reg_length, + .get_reg = igbvf_get_regs, }; /** @@ -2133,6 +2159,14 @@ eth_igb_rar_clear(struct rte_eth_dev *dev, uint32_t index) e1000_rar_set(hw, addr, index); } +static void +eth_igb_default_mac_addr_set(struct rte_eth_dev *dev, + struct ether_addr *addr) +{ + eth_igb_rar_clear(dev, 0); + + eth_igb_rar_set(dev, (void *)addr, 0, 0); +} /* * Virtual Function operations */ @@ -2367,6 +2401,17 @@ igbvf_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) return 0; } +static void +igbvf_default_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *addr) +{ + struct e1000_hw *hw = + E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + /* index is not used by rar_set() */ + hw->mac.ops.rar_set(hw, (void *)addr, 0); +} + + static int eth_igb_rss_reta_update(struct rte_eth_de
[dpdk-dev] [PATCH v14 4/4] examples: new example: l2fwd-ethtool
The example includes an ethtool library and two applications: one application is a non- DPDK process (nic-control) and the other is a DPDK l2fwd applicaiton (l2fwd-app). The nic-control process sends ethtool alike device management requests to l2fwd-app through a named pipe IPC. This example is designed to show how to build a ethtool shim library and how to use ethtool apis to manage device parameters. Signed-off-by: Liang-Min Larry Wang --- examples/Makefile|3 + examples/l2fwd-ethtool/Makefile | 55 ++ examples/l2fwd-ethtool/l2fwd-app/Makefile| 60 ++ examples/l2fwd-ethtool/l2fwd-app/main.c | 1066 ++ examples/l2fwd-ethtool/l2fwd-app/netdev_api.h| 769 examples/l2fwd-ethtool/l2fwd-app/shared_fifo.h | 158 examples/l2fwd-ethtool/lib/Makefile | 55 ++ examples/l2fwd-ethtool/lib/rte_ethtool.c | 308 +++ examples/l2fwd-ethtool/lib/rte_ethtool.h | 384 examples/l2fwd-ethtool/nic-control/Makefile | 55 ++ examples/l2fwd-ethtool/nic-control/nic_control.c | 471 ++ 11 files changed, 3384 insertions(+) create mode 100644 examples/l2fwd-ethtool/Makefile create mode 100644 examples/l2fwd-ethtool/l2fwd-app/Makefile create mode 100644 examples/l2fwd-ethtool/l2fwd-app/main.c create mode 100644 examples/l2fwd-ethtool/l2fwd-app/netdev_api.h create mode 100644 examples/l2fwd-ethtool/l2fwd-app/shared_fifo.h create mode 100644 examples/l2fwd-ethtool/lib/Makefile create mode 100644 examples/l2fwd-ethtool/lib/rte_ethtool.c create mode 100644 examples/l2fwd-ethtool/lib/rte_ethtool.h create mode 100644 examples/l2fwd-ethtool/nic-control/Makefile create mode 100644 examples/l2fwd-ethtool/nic-control/nic_control.c diff --git a/examples/Makefile b/examples/Makefile index b4eddbd..cd1c4b0 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -50,6 +50,9 @@ DIRS-y += ip_reassembly DIRS-$(CONFIG_RTE_IP_FRAG) += ip_fragmentation DIRS-y += ipv4_multicast DIRS-$(CONFIG_RTE_LIBRTE_KNI) += kni +DIRS-y += l2fwd-ethtool/lib +DIRS-y += l2fwd-ethtool/nic-control +DIRS-y += l2fwd-ethtool/l2fwd-app DIRS-y += l2fwd DIRS-$(CONFIG_RTE_LIBRTE_IVSHMEM) += l2fwd-ivshmem DIRS-$(CONFIG_RTE_LIBRTE_JOBSTATS) += l2fwd-jobstats diff --git a/examples/l2fwd-ethtool/Makefile b/examples/l2fwd-ethtool/Makefile new file mode 100644 index 000..80d257e --- /dev/null +++ b/examples/l2fwd-ethtool/Makefile @@ -0,0 +1,55 @@ +# BSD LICENSE +# +# Copyright(c) 2015 Intel Corporation. All rights reserved. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +ifeq ($(RTE_SDK),) +$(error "Please define RTE_SDK environment variable") +endif + +# Default target, can be overwritten by command line or environment +RTE_TARGET ?= x86_64-native-linuxapp-gcc + +include $(RTE_SDK)/mk/rte.vars.mk +unexport RTE_SRCDIR RTE_OUTPUT RTE_EXTMK + +ifneq ($(CONFIG_RTE_EXEC_ENV),"linuxapp") +$(error This application can only operate in a linuxapp environment, \ +please change the definition of the RTE_TARGET environment variable) +endif + +DIRS-y += lib nic-control l2fwd-app + +.PHONY: all clean $(DIRS-y) + +all: $(DIRS-y) +clean: $(DIRS-y) + +$(DIRS-y): + $(MAKE) -C $@ $(MAKECMDGOALS) O=$(RTE_OUTPUT) diff --git a/examples/l2fwd-ethtool/l2fwd-app/Makefile b/examples/l2fwd-ethtool/l2fwd-app/Makefile new file mode 100644 index 000..fd0b9a7 --- /dev/null
[dpdk-dev] [PATCH] ethdev: call rxtx callbacks in the order they were added
> Change the order that user supplied RX and TX callbacks are called > to the order that they were added (fifo). > > The previous calling order was the reverse of this (lifo) and was > counter intuitive for users. > > Signed-off-by: John McNamara Applied, thanks