summaryrefslogtreecommitdiff
path: root/lib/netdev.h
Commit message (Collapse)AuthorAgeFilesLines
...
* netdev: Rename netdev_rx to netdev_rxqPravin2014-03-211-12/+12
| | | | | | | | Preparation for multi queue netdev IO. There are no functional changes in this patch. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Thomas Graf <tgraf@redhat.com>
* dpif-netdev: Add poll-mode-device thread.Pravin2014-03-211-1/+4
| | | | | | | | | | | | | | This patch adds PMD type netdev for netdevice with poll-mode drivers. Since there is no way to get signal on a packet recv from these devices we need to poll them in busy loop. So minimize system call overhead this patch uses dpif-thread exclusively for PMD devices and rest of devices which needs system calls to do IO are moved to dpif-netdev-run(). PMD device like DPDK work in userspace so there is no system call overhead for them. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Thomas Graf <tgraf@redhat.com>
* netdev: Send ofpbuf directly to netdev.Pravin2014-03-211-1/+1
| | | | | | | | DPDK netdev need to access ofpbuf while sending buffer. Following patch changes netdev_send accordingly. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Thomas Graf <tgraf@redhat.com>
* netdev: Extend rx_recv to pass multiple packets.Pravin2014-03-211-1/+3
| | | | | | | | | DPDK can receive multiple packets but current netdev API does not allow that. Following patch allows dpif-netdev receive batch of packet in a rx_recv() call for any netdev port. This will be used by dpdk-netdev. Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
* netdev: Globally track port status changesJoe Stringer2013-12-121-2/+0
| | | | | | | | | | | | | | | | | | | | Previously, we tracked status changes for ofports on a per-device basis. Each time in the main thread's loop, we would inspect every ofport to determine whether the status had changed for corresponding devices. This patch replaces the per-netdev change_seq with a global 'struct seq' which tracks status change for all ports. In the average case where ports are not constantly going up or down, this allows us to check the sequence once per main loop and not poll any ports. In the worst case, execution is expected to be similar to how it is currently. In a test environment of 5000 internal ports and 50 tunnel ports with bfd, this reduces average CPU usage of the main thread from about 40% to about 35%. Signed-off-by: Joe Stringer <joestringer@nicira.com> Signed-off-by: Ethan Jackson <ethan@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* netdev: Fix deadlock when netdev_dump_queues() callback calls into netdev.Ben Pfaff2013-08-271-5/+36
| | | | | | | | | | | | | | | | | | | | | | | | We have a call chain like this: iface_configure_qos() calls netdev_dump_queues(), which calls netdev_linux_dump_queues(), which calls back through 'cb' to qos_unixctl_show_cb(), which calls netdev_delete_queue(), which calls netdev_linux_delete_queue(). Both netdev_dump_queues() and netdev_linux_delete_queue() take the same mutex in the same netdev, which deadlocks. This commit fixes the problem by getting rid of the callback. netdev_linux_dump_queue_stats() would benefit from the same treatment but it's less urgent because I don't see any callbacks from that function that call back into a netdev function. Bug #19319. Reported-by: Scott Hendricks <shendricks@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* netdev: Make netdev access thread-safe.Ben Pfaff2013-08-091-1/+17
| | | | | Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Andy Zhou <azhou@nicira.com>
* Implement OpenFlow 1.3 queue stats duration feature.Ben Pfaff2013-07-261-0/+3
| | | | Signed-off-by: Ben Pfaff <blp@nicira.com>
* netdev: New function netdev_ref().Ben Pfaff2013-05-221-0/+1
| | | | | | | | | I suspect that this makes it easier to make sure that a netdev stays open as long as needed in some cases where a module needs access to a netdev opened by some higher-level module. CC: Ethan Jackson <ethan@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* netdev: Prevent using reserved namesAlex Wang2013-05-161-0/+1
| | | | | | | | | | This commit adds a function to lib/netdev.c to check that the interface name is not the same as any of the registered vport providers' dpif_port name (e.g. gre_system) or the datapath's internal port name (e.g. ovs-system). Bug #15077. Signed-off-by: Alex Wang <alexw@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* netdev: Add new "struct netdev_rx" for capturing packets from a netdev.Ben Pfaff2013-05-101-8/+13
| | | | | | | | | Separating packet capture from "struct netdev" means that there is no remaining per-"struct netdev" state, which will allow us to get rid of "struct netdev_dev" (by renaming it "struct netdev"). Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* netdev: Factor restoring flags into new "struct netdev_saved_flags".Ben Pfaff2013-05-101-10/+18
| | | | | | | | | | | | | This gets rid of the only per-instance data in "struct netdev", which will make it possible to merge "struct netdev_dev" into "struct netdev" in a later commit. Ed Maste wrote the netdev-bsd changes in this commit. Signed-off-by: Ben Pfaff <blp@nicira.com> Co-authored-by: Ed Maste <emaste@freebsd.org> Signed-off-by: Ed Maste <emaste@freebsd.org> Tested-by: Ed Maste <emaste@freebsd.org>
* OpenFlow-level flow-based tunneling support.Jarno Rajahalme2013-05-101-0/+2
| | | | | | | | | | | | | | | | | | | | | Adds tun_src and tun_dst match and set capabilities via new NXM fields NXM_NX_TUN_IPV4_SRC and NXM_NX_TUN_IPV4_DST. This allows management of large number of tunnels via the flow tables, without requiring the tunnels to be pre-configured. Flow-based tunnels can be configured with options remote_ip=flow and local_ip=flow. local_ip=flow requires remote_ip=flow. When set, the tunnel remote IP address and/or local IP address is set from the flow, instead of the tunnel configuration. Example: $ ovs-vsctl add-port br0 gre -- set Interface gre ofport_request=1 type=gre options:remote_ip=flow options:key=flow $ ovs-ofctl add-flow br0 "in_port=LOCAL actions=set_tunnel:1,set_field:192.168.0.1->tun_dst,output:1" $ ovs-ofctl add-flow br0 "in_port=1 tun_src=192.168.0.1 tun_id=1 actions=LOCAL" Signed-off-by: Jarno Rajahalme <jarno.rajahalme@nsn.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* netdev: Remove netdev_is_open(), which has no users.Ben Pfaff2013-04-011-2/+0
| | | | | Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* netdev: Remove netdev_exists(), which has no users.Ben Pfaff2013-04-011-1/+0
| | | | | Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* netdev: Update comment.Ben Pfaff2013-02-281-4/+5
| | | | | | The claim that there's only a single implementation was long obsolete. Signed-off-by: Ben Pfaff <blp@nicira.com>
* ofproto-dpif: Implement patch ports in userspace.Ethan Jackson2013-01-241-0/+1
| | | | | | | | | | | | | | | | | | | This commit moves responsibility for implementing patch ports from the datapath to ofproto-dpif. There are two main reasons to do this. The first is a matter of design: ofproto-dpif both has more information than the datapath, and is better suited to handle the complexity required to implement patch ports. The second is performance. My setup is a virtual machine with two basic learning bridges connected by patch ports. I used ovs-benchmark to ping the virtual router IP residing outside the VM. Over a 60 second run, "ovs-benchmark rate" improves from 14618.1 to 19311.9 transactions per second, or a 32% improvement. Similarly, "ovs-benchmark latency" improves from 6ms to 4ms. Signed-off-by: Ethan Jackson <ethan@nicira.com>
* netdev: Parse and make available tunnel configuration.Ethan Jackson2013-01-151-0/+28
| | | | | | | Future patches will need to know the details of a netdev's tunnel configuration from outside the netdev library. Signed-off-by: Ethan Jackson <ethan@nicira.com>
* netdev: Rename get_drv_info() to get_status().Ethan Jackson2013-01-031-2/+2
| | | | | | | get_status() is a much more intuitive name since "status" is what the database column is called. Signed-off-by: Ethan Jackson <ethan@nicira.com>
* ofproto: Report 0 Mbps when speed not available instead of 100 Mbps.Ben Pfaff2012-11-031-1/+2
| | | | | | | | | | | | When a link is down, or when a link has no speed because it is not a physical interface, Open vSwitch previously reported that its rate is 100 Mbps as a default. This is counterintuitive, however, so this commit changes Open vSwitch behavior to report 0 Mbps when a link is down or its speed is otherwise unavailable. Bug #13388. Reported-by: Hiroshi Tanaka <htanaka@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* lib: New data structure - smap.Ethan Jackson2012-06-141-9/+9
| | | | | | | | | A smap is a string to string hash map. It has a cleaner interface than shash's which were traditionally used for the same purpose. This patch implements the data structure, and changes netdev and its providers to use it. Signed-off-by: Ethan Jackson <ethan@nicira.com>
* Global replace of Nicira Networks.Raju Subramanian2012-05-021-1/+1
| | | | | | | | Replaced all instances of Nicira Networks(, Inc) to Nicira, Inc. Feature #10593 Signed-off-by: Raju Subramanian <rsubramanian@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* netdev: Rename netdev->get_status() to netdev->get_drv_info().Pravin B Shelar2012-03-221-1/+1
| | | | | | | get_status actually returns driver information, so get_drv_info() is better name. Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
* netdev: Abstract "features" interface away from OpenFlow 1.0.Ben Pfaff2012-03-071-6/+29
| | | | | | | | | | | netdev_get_features() and other functions have always used OpenFlow 1.0 "enum ofp_port_features" bits as part of their interface. This commit switches over to using an internally defined interface that is not tied directly to any OpenFlow version, making evolution of each side of the interface easier in the future. Reviewed-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
* ofproto-dpif-sflow: allow sFlow to infer the agent device.Luca Giraudo2011-12-061-0/+1
| | | | Bug #2407.
* netdev: Remove netdev_get_vlan_vid().Ben Pfaff2011-11-231-3/+0
| | | | It has no remaining users.
* vswitchd: New column "link_resets".Ethan Jackson2011-10-171-0/+1
| | | | | An interface's 'link_resets' column represents the number of times Open vSwitch has observed its link_state change.
* Remove netdev_find_dev_by_in4Simon Horman2011-09-221-2/+0
| | | | | | | | | | | netdev_find_dev_by_in4() appears to no longer be used and thus can be removed. This also allows netdev_enumerate(), the enumerate member of struct netdev_class and netdev_linux_enumerate() to be removed. I noticed this as netdev_linux_enumerate() makes use of if_nameindex() and if_freenameindex() which are not available when compiling using the Android NDK r6b (Android API level 13).
* test-openflowd: Allow specifying port type on --ports option.Ben Pfaff2011-09-131-0/+2
| | | | | | | | This allows a command like "test-openflowd --enable-dummy dummy@br0 --ports=dummy@eth0,dummy@eth1,dummy@eth2" to create a dummy datapath with a number of dummy ports. This is more useful for testing than a dummy datapath with just an internal port, since output to "flood" and "normal" has less pathological results.
* datapath: Strip down vport interface : OVS_VPORT_ATTR_MTUPravin Shelar2011-09-121-0/+1
| | | | | | | | | | | | | | There is no need to have vport attribute MTU (OVS_VPORT_ATTR_MTU) as linux net-dev-ioctl can be used to get/set MTU for linux device. Following patch removes OVS_VPORT_ATTR_MTU from datapath protocol. This patch also adds netdev_set_mtu interface. So that MTU adjustments can be done from OVS userspace. get_mtu() interface is also changed, now get_mtu() returns EOPNOTSUPP rather than returning 0 and setting *pmtu to INT_MAX in case there is no MTU attribute for given device. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
* netdev: Get rid of struct netdev_options and netdev_open_default().Ben Pfaff2011-08-081-7/+1
| | | | | Now that netdev_options only has two members, we might as well pass them directly as parameters.
* netdev: Decouple creating and configuring network devices.Ben Pfaff2011-08-081-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Until now, each call to netdev_open() for a particular network device had to either specify a set of network device arguments that was either empty or (for devices that already existed) equal to the existing device's configuration. Unfortunately, the definition of "equality" in the latter case was mostly done in terms of strict equality of string-to-string maps, which caused problems in cases where, for example, one set of arguments specified the default value of an optional argument explicitly and the other omitted it. The netdev interface does have provisions for defining equality other ways, but this had only been done in one case that was especially problematic in practice. One way to solve this particular problem would be to carefully define equality in all the problematic cases. This commit takes another approach based on the realization that there is really no need to do any comparisons. Instead, it removes configuration at netdev_open() time entirely, because almost all of netdev_open()'s callers are not interested in creating and configuring a netdev. Most of them just want to open a configured device and use it. Therefore, this commit stops providing any configuration arguments to netdev_open() and the provider functions that it calls. Instead, a caller that does want to configure a device does so after it opens it, by calling netdev_set_config(). This change allows us to simplify the netdev interface a bit. There is no longer any need to implement argument comparisons. As a result, there is also no need for "struct netdev_dev" to keep track of configuration at all. Instead, the network devices that have configuration keep track of it in their own internal form. This new interface does mean that it becomes possible to accidentally create and try to use an unconfigured netdev that requires configuration. Bug #6677. Reported-by: Paul Ingram <paul@nicira.com>
* netdev: Clean up and refactor packet receive interface.Ben Pfaff2011-08-081-7/+1
| | | | | | | | | | | | | | | | | | | | | The Open vSwitch tree only has one user of the ability for a netdev to receive packets from a network device. Thus, this commit simplifies the common-case use of the netdev interface by replacing the "ethertype" option from "struct netdev_options" by a new netdev_listen() call. The only user of netdev_listen() wants to receive all packets from a network device, so this commit also removes the ability to restrict the received packets to a particular protocol. (This ability was once used by the Open vSwitch integrated DHCP client, but that code has been removed.) This commit also simplifies and improves the implementation of the code in netdev-linux that started listening to a network device. Before, I had not figured out how to avoid receiving all packets on all devices before binding to a particular device, but I took a closer look at the kernel code and figured it out. I've tested that the userspace datapath (dpif-netdev), the only user of netdev_recv(), still works after this change.
* netdev: Remove monitors and notifiers.Ethan Jackson2011-05-311-9/+0
| | | | Neither of these constructs are used anymore.
* netdev: New Function netdev_change_seq().Ethan Jackson2011-05-311-0/+2
| | | | | This new function will provide a much simpler replacement for netdev_monitor in the future.
* netdev: Take responsibility for polling MII registers.Ethan Jackson2011-05-201-1/+1
| | | | | | | | This patch moves miimon logic from the bond module to netdev-linux. This greatly simplifies the bonding code while adding minimal complexity to netdev-linux. The bonding code is so high level, it really has no business worrying about how precisely slave status is determined.
* bond: Bonds never sleep if carrier changes.Ethan Jackson2011-05-171-0/+1
| | | | | | | The bonding code neglected to call netdev_monitor_poll() on its monitor during bond_run(). Thus carrier changes would be permanently queued in the monitor, preventing it from ever allowing poll_loop to sleep.
* Convert remaining network-byte-order "uint<N>_t"s into "ovs_be<N>"s.Ben Pfaff2011-05-161-1/+2
| | | | | | | | | I looked at almost every uint<N>_t in the tree to determine whether it was really in network byte order, and converted the ones that were. The only remaining ones, modulo my mistakes, are in openflow.h. I'm not sure whether we should convert those, because there might be some value in remaining close to upstream for this header.
* netdev: Use sset instead of svec in netdev interface.Ben Pfaff2011-03-311-5/+5
|
* netdev: Make netdev arguments fetchable, and implement for netdev-vport.Ben Pfaff2011-01-271-1/+4
| | | | | | | | | | | | This gives network device implementations the opportunity to fetch an existing device's configuration and store it as their arguments, so that netdev clients can find out how an existing device is configured. So far netdev-vport is the only implementation that needs to use this. The next commit will add use by clients. Reviewed by Justin Pettit.
* netdev: Make 'netdev' parameter of 'get_features()' const.Andrew Evans2011-01-171-1/+1
| | | | Implementations shouldn't need to modify it.
* vswitchd: Add miimon support.Ethan Jackson2011-01-121-0/+1
| | | | | This commit allows users to check link status in bonded ports using MII instead of carrier.
* bridge: Move tunnel_egress_iface to status column.Ethan Jackson2011-01-111-1/+1
| | | | | | This commit removes the tunnel_egress_iface column from the interface table and moves it's data to the status column. In the process it reverts the database to version 1.0.0.
* lib: Show tunnel egress interface in ovsdbEthan Jackson2011-01-041-0/+1
| | | | | | | | This commit parses rtnetlink address notifications from the kernel in order to display the egress interface of tunnels in the database. Bug #4103.
* netdev: Fix carrier status for down interfaces.Jesse Gross2010-10-281-1/+1
| | | | | | | | | | | Currently netdev_get_carrier() returns both a carrier status and an error code. However, usage of the error code was inconsistent: most callers either ignored it or didn't perform their task if an error occured, which prevented bond rebalancing. This makes the handling consistent by translating an error into a down status in the netdev library. Bug #3959
* netdev-vport: Merge in netdev-patch and netdev-tunnel.Ben Pfaff2010-10-111-2/+0
| | | | | | | The only real difference between netdev-patch and netdev-tunnel is in their parse_config() implementation. That's a lot of extra code to maintain, for questionable benefit. This commit merges them into the netdev-vport code, which was heretofore merely a collection of helper functions.
* Implement QoS framework.Ben Pfaff2010-06-171-2/+55
| | | | | | | | | | | ovs-vswitchd doesn't declare its QoS capabilities in the database yet, so the controller has to know what they are. We can add that later. The linux-htb QoS class has been tested to the extent that I can see that it sets up the queues I expect when I run "tc qdisc show" and "tc class show". I haven't tested that the effects on flows are what we expect them to be. I am sure that there will be problems in that area that we will have to fix.
* netdev: Remove may_create/may_open flags.Jesse Gross2010-06-011-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The most recent revision of the netdev library added may_create and may_open flags to explicitly state the intent of the caller as to whether the device should already be in use. This was simply a sanity check for users of the netdev library and the configuration. At this point the netdev library and its users are well behaved and should no longer need to be checked. Additional checks have also been added for incorrect configuration that mean the netdev library is no longer the primary line of defense. These flags themselves create problems because it is not always easy for a library to know what the state of devices should be. This is particularly a problem for ovs-openflowd, which expects ports to be added by ovs-dpctl. Fixing this either requires that the checks are so permissive to be useless or ugly hacks to get around them. Since they are no longer needed, just remove the checks. This commit restores the previous behavior of ovs-openflowd to not require that ports be specified on the command line or cleaned up after use. Bug #2652 CC: Natasha Gude <natasha@nicira.com> CC: Jean Tourrilhes <jt@hpl.hp.com> CC: 蒲彦 <yan.p.bjtu@gmail.com>
* Update fake bond devices' statistics with the sum of bond slaves' stats.Ben Pfaff2010-04-191-0/+1
| | | | | | | | Needed by XAPI to accurately report bond statistics. Ugh. Bug NIC-63.
* netdev: Add function netdev_is_open().Jesse Gross2010-04-191-0/+1
| | | | | | Add netdev_is_open(), which checks to see if a given netdev is currently open. It will be used to assist in cleaning up old ports that are no longer in use.