aboutsummaryrefslogtreecommitdiff
path: root/lib/netdev-dummy.c
AgeCommit message (Collapse)Author
2013-10-16netdev-dummy: Count rx packets regardless of sourceSimon Horman
This alters the way rx packets are accounted for by counting them when they are processed by netdev_dummy_rx_recv(), which seems to be a common path used by all received packets. Previously accounting was done earlier, in netdev_dummy_receive(), however this does not appear to count packets that are received via a socket. This resolves packet counting errors reported by the following OFtest tests: port_stats.MultiFlowStats port_stats.SingleFlowStats pktact.WildcardPriorityWithDelete pktact.WildcardPriority Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-10-09netdev-dummy: Add pcap feature.Ben Pfaff
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-08-28netdev-dummy: Stop overriding patch vport type with dummy.YAMAMOTO Takashi
There's little point to override patch ports, which is implmeneted purely in our userland process these days, with a dummy implementation. This allows testing patch ports in "make sandbox" environment. Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp> Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-08-27netdev: Fix deadlock when netdev_dump_queues() callback calls into netdev.Ben Pfaff
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>
2013-08-20Use "error-checking" mutexes in place of other kinds wherever possible.Ben Pfaff
We've seen a number of deadlocks in the tree since thread safety was introduced. So far, all of these are self-deadlocks, that is, a single thread acquiring a lock and then attempting to re-acquire the same lock recursively. When this has happened, the process simply hung, and it was somewhat difficult to find the cause. POSIX "error-checking" mutexes check for this specific problem (and others). This commit switches from other types of mutexes to error-checking mutexes everywhere that we can, that is, everywhere that we're not using recursive mutexes. This ought to help find problems more quickly in the future. There might be performance advantages to other kinds of mutexes in some cases. However, the existing mutex type choices were just guesses, so I'd rather go for easy detection of errors until we know that other mutex types actually perform better in specific cases. Also, I did a quick microbenchmark of glibc mutex types on my host and found that the error checking mutexes weren't any slower than the other types, at least when the mutex is uncontended. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
2013-08-16netdev-dummy: Add Clang lock annotations.Ben Pfaff
This commit adds some superfluous locks and unlocks, but they should not hurt performance and do make Clang happy. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Andy Zhou <azhou@nicira.com>
2013-08-16netdev-dummy: Fix synchronization error in netdev_dummy_get_config().Ben Pfaff
Found by Clang. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Andy Zhou <azhou@nicira.com>
2013-08-12netdev-dummy: Include all dummy classes in iterations.Ben Pfaff
Commit 86f1d0326bd0 (netdev-dummy: Use netdev_get_devices() instead of a local shash.) caused netdev-dummy functions that iterate over all dummy devices to iterate only over the ones that have class 'dummy_class'. This seemed to obviously include all the ones that we want, but in fact when ovs-vswitch is invoked with --enable-dummy=override, there are more dummy classes than just dummy_class, which this new form of iteration skipped over, with various negative consequences that showed up in some testing. This commit switches netdev-dummy back to internally tracking its own dummy devices. It fixes the tests for me. Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-08-09netdev: Make netdev access thread-safe.Ben Pfaff
Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Andy Zhou <azhou@nicira.com>
2013-08-09netdev: Adopt four-step alloc/construct/destruct/dealloc lifecycle.Ben Pfaff
This is the same lifecycle used in the ofproto provider interface. Compared to the previous netdev provider interface, it has the advantage that the netdev top layer can control when any given netdev becomes visible to the outside world. Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-08-09netdev-dummy: Use netdev_get_devices() instead of a local shash.Ben Pfaff
When an upcoming commit introduces thread safety into the netdev API, this allows netdev-dummy to avoid adding more internal locking by taking advantage of netdev_get_devices() refcounting. Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-08-02netdev-dummy: Fix memory leak on error path in netdev_rx_dummy_recv().Ben Pfaff
This code failed to free the packet if it was too big for the caller. Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-07-30clang: Add annotations for thread safety check.Ethan Jackson
This commit adds annotations for thread safety check. And the check can be conducted by using -Wthread-safety flag in clang. Co-authored-by: Alex Wang <alexw@nicira.com> Signed-off-by: Alex Wang <alexw@nicira.com> Signed-off-by: Ethan Jackson <ethan@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-07-23netdev-dummy: Make counter thread-safe.Ben Pfaff
Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Andy Zhou <azhou@nicira.com>
2013-06-28Replace all uses of strerror() by ovs_strerror(), for thread safety.Ben Pfaff
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-06-20ovs-dpctl: Add mega flow supportAndy Zhou
Added support to allow mega flow specified and displayed. ovs-dpctl tool is mainly used as debugging tool. This patch also implements the low level user space routines to send and receive mega flow netlink messages. Those netlink suppor routines are required for forthcoming user space mega flow patches. Added a unit test to test parsing and display of mega flows. Ethan contributed the ovs-dpctl mega flow output function. Co-authored-by: Ethan Jackson <ethan@nicira.com> Signed-off-by: Ethan Jackson <ethan@nicira.com> Signed-off-by: Andy Zhou <azhou@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-05-28netdev-dummy: Add "pstream" option for connecting a dummy to a process.Ben Pfaff
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-05-28netdev-dummy: Drop "nobody listened" reply from netdev-dummy/receive.Ben Pfaff
Ethan pointed out that this wasn't very useful. Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-05-28netdev-dummy: Factor some netdev_dummy_receive() code out into new function.Ben Pfaff
An upcoming patch will add another user. Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-05-28netdev-dummy: Limit receive queue length to 100 packets.Ben Pfaff
It doesn't seem like a good idea to allow the queue length to grow without bound, even for a test-only device. Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-05-18netdev-dummy: Remove FreeBSD dependency.Ben Pfaff
There's no particular reason that netdev_dummy_register() has to care about the particular OS, except that the tests like to use the special Linux-only tunnel vport types. But that can be done better, I think, by just always registering them from netdev_dummy_register() and making that function idempotent, so that calling it twice under Linux has no additional effect. This commit implements that solution. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ed Maste <emaste@freebsd.org>
2013-05-10netdev: Get rid of netdev_dev.Ben Pfaff
The distinction between struct netdev_dev and struct netdev has always been confusing. Now that previous commits have eliminated all interesting state from struct netdev, this commit deletes it and renames struct netdev_dev to take its place. Now the situation makes much more sense and I won't have to continue making embarrassed explanations in the future. Good riddance. Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-05-10Rename superclass members to 'up'.Ben Pfaff
Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
2013-05-10netdev: Add new "struct netdev_rx" for capturing packets from a netdev.Ben Pfaff
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>
2013-05-10netdev: Factor restoring flags into new "struct netdev_saved_flags".Ben Pfaff
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>
2013-04-01tests: Add sFlow test.Neil Mckee
This patch adds an sFlow test to the test suite. I have only tested this on a Fedora 17 OS. Signed-off-by: Neil Mckee <neil.mckee@inmon.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-02-11netdev-dummy: Correctly maintain port statistics.Ben Pfaff
Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
2013-01-28netdev-vport: Build on all platforms.Ethan Jackson
This patch removes the final bit of linux specific code which prevents building netdev-vport everywhere. With this, other platforms automatically get access to patch ports, and (if their datapath supports it), flow based tunneling. Signed-off-by: Ethan Jackson <ethan@nicira.com>
2013-01-16Replace most uses of assert by ovs_assert.Ben Pfaff
This is a straight search-and-replace, except that I also removed #include <assert.h> from each file where there were no assert calls left. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
2013-01-15netdev: Parse and make available tunnel configuration.Ethan Jackson
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>
2013-01-03netdev: Rename get_drv_info() to get_status().Ethan Jackson
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>
2012-08-10netdev-dummy: New appctl command netdev-dummy/set-admin-state.Ethan Jackson
There's currently no way to set the admin state on dummy netdevs. This patch provides a mechanism to do so which will be used in future unit tests. Signed-off-by: Ethan Jackson <ethan@nicira.com>
2012-05-02Global replace of Nicira Networks.Raju Subramanian
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>
2012-03-22netdev: Rename netdev->get_status() to netdev->get_drv_info().Pravin B Shelar
get_status actually returns driver information, so get_drv_info() is better name. Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
2012-02-21unixctl: New JSON RPC back-end.Ethan Jackson
The unixctl library had used the vde2 management protocol since the early days of Open vSwitch. As Open vSwitch has matured, several Python daemons have been added to the code base which would benefit from a unixctl implementations. Instead of implementing the old unixctl protocol in Python, this patch changes unixctl to use JSON RPC for which we already have an implementation in both Python and C. Future patches will need to implement a unixctl library in Python on top of JSON RPC. Signed-off-by: Ethan Jackson <ethan@nicira.com>
2012-01-19dummy: Make --enable-dummy=override replace all dpifs, netdevs by dummies.Ben Pfaff
Plain "--enable-dummy" just creates new dummy dpif and netdev classes. This commit makes "--enable-dummy=override" go a step farther and actually delete and replace all the existing dpif and netdev classes by copies of the dummy class. This is useful for testing in an environment where changing the classes in Bridge or Interface records is challenging. Requested-by: Andrew Lambeth <wal@nicira.com> Tested-by: Andrew Lambeth <wal@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-01-13netdev-dummy: Fix use-after-free error.Ben Pfaff
Found by valgrind. Signed-off-by: Ben Pfaff <blp@nicira.com>
2011-12-19netdev-dummy: Allow injecting traffic.Ben Pfaff
This paves the way to allow unit tests to test the whole switch on an end-to-end basis. Signed-off-by: Ben Pfaff <blp@nicira.com>
2011-11-23netdev: Remove netdev_get_vlan_vid().Ben Pfaff
It has no remaining users.
2011-10-17vswitchd: New column "link_resets".Ethan Jackson
An interface's 'link_resets' column represents the number of times Open vSwitch has observed its link_state change.
2011-09-22Remove netdev_find_dev_by_in4Simon Horman
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).
2011-09-12datapath: Strip down vport interface : OVS_VPORT_ATTR_MTUPravin Shelar
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>
2011-08-08netdev: Decouple creating and configuring network devices.Ben Pfaff
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>
2011-08-08netdev: Clean up and refactor packet receive interface.Ben Pfaff
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.
2011-06-14netdev: Add methods to do netdev-specific argument comparisons.Justin Pettit
When doing a netdev_open(), a check is first done to make sure the arguments are equivalent for any open devices with the same name. In most cases, a simple shash comparison is sufficient. However, IPsec key configuration is handled by an external program, so it is not pushed down into the kernel module. Thus, when the "unparse_config" method is called on an existing IPsec-based vport, a simple comparison with the returned data will not match the original configuration. This commit adds code to allow netdev-specific argument comparisons and has "ipsec_gre" make use of them. Bug #5575
2011-05-31netdev: Remove monitors and notifiers.Ethan Jackson
Neither of these constructs are used anymore.
2011-05-31netdev: New Function netdev_change_seq().Ethan Jackson
This new function will provide a much simpler replacement for netdev_monitor in the future.
2011-01-27netdev: Make netdev arguments fetchable, and implement for netdev-vport.Ben Pfaff
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.
2011-01-12vswitchd: Add miimon support.Ethan Jackson
This commit allows users to check link status in bonded ports using MII instead of carrier.
2011-01-11bridge: Move tunnel_egress_iface to status column.Ethan Jackson
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.