summaryrefslogtreecommitdiff
path: root/datapath/vport-internal_dev.c
Commit message (Collapse)AuthorAgeFilesLines
* datapath: Drop support for kernel older than 3.10Pravin B Shelar2016-03-141-63/+44
| | | | | | | | | | | | | | | | Currently OVS out of tree datapath supports a large number of kernel versions. From 2.6.32 to 4.3 and various distribution-specific kernels. But at this point major features are only available on more recent kernels. For example, stateful services are only available starting in kernel 3.10 and STT is available on starting with 3.5. Since these features are becoming essential to many OVS deployments, and the effort of maintaining the backports is high. We have decided to drop support for older kernel. Following patch drops supports for kernel older than 3.10. Signed-off-by: Pravin B Shelar <pshelar@ovn.org> Acked-by: Jesse Gross <jesse@kernel.org>
* datapath: Add support for lwtunnelPravin B Shelar2015-12-031-77/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | Following patch adds support for lwtunnel to OVS datapath. With this change OVS datapath detect lwtunnel support and make use of new APIs if available. On older kernel where the support is not there the backported tunnel modules are used. These backported tunnel devices acts as lwtunnel devices. I tried to keep backported module same as upstream for easier bug-fix backport. Since STT and LISP are not upstream OVS always needs to use respective modules from tunnel compat layer. To make it work on kernel 4.3 I have converted STT and LISP modules to lwtunnel API model. lwtunnel make use of skb-dst to pass tunnel information to the tunnel module. On older kernel this is not possible. So the in case of old kernel metadata ref is stored in OVS_CB and direct call to tunnel transmit function is made by respective tunnel vport modules. Similarly on receive side tunnel recv directly call netdev-vport-receive to pass the skb to OVS. Major backported components include: Geneve, GRE, VXLAN, ip_tunnel, udp-tunnels GRO. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Joe Stringer <joe@ovn.org> Acked-by: Jesse Gross <jesse@kernel.org>
* datapath: Turn vports with dependencies into separate modulesThomas Graf2015-04-041-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Upstream commit: The internal and netdev vport remain part of openvswitch.ko. Encap vports including vxlan, gre, and geneve can be built as separate modules and are loaded on demand. Modules can be unloaded after use. Datapath ports keep a reference to the vport module during their lifetime. Allows to remove the error prone maintenance of the global list vport_ops_list. Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net> Also folds in the follow-up commits 9ba559d9ca3 to turned the non-GPL symbol exports to GPL exports, and fa2d8ff4e35 which fixes a module reference release bug. Exports various backwards compat functions linked into the main openvswitch module as GPL symbols to ensure vport modules can use them. Some fiddling with the Makefile was needed to work around the fact that Makefile variables can't contain '-' characters needed to define 'vport-xxx' module sources. Also, Kbuild complains heavily if a $(module)-y = $(module).o is defined which is actually backed with a .c file of the same name. Therefore, a new $(build_multi_modules) variable is defined which lists all module which consist of more than one source file. Upstream: 62b9c8d0372 ("ovs: Turn vports with dependencies into separate modules") Upstream: 9ba559d9ca3 ("openvswitch: Export symbols as GPL symbols.") Upstream: fa2d8ff4e35 ("openvswitch: Return vport module ref before destruction") Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: Account for "rename vlan_tx_* helpers since "tx" is misleading there"Thomas Graf2015-02-031-2/+2
| | | | | | | | | | | | | | Upstream commit: net: rename vlan_tx_* helpers since "tx" is misleading there The same macros are used for rx as well. So rename it. Signed-off-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: David S. Miller <davem@davemloft.net> Upstream: df8a39d ("net: rename vlan_tx_* helpers since "tx" is misleading there") Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: introduce rtnl ops stubThomas Graf2015-01-071-0/+15
| | | | | | | | | This stub now allows userspace to see IFLA_INFO_KIND for ovs master and IFLA_INFO_SLAVE_KIND for slave. Upstream: 5b9e7e16 ("openvswitch: introduce rtnl ops stub") Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: Account for rename to vlan_insert_tag_set_proto()Thomas Graf2015-01-071-3/+3
| | | | | | | | | __vlan_put_tag() was renamed to vlan_insert_tag_set_proto() with the argument list kept intact. Upstream: 62749e ("vlan: rename __vlan_put_tag to vlan_insert_tag_set_proto") Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: Fix comment style.Pravin B Shelar2014-10-231-1/+2
| | | | | | | Use netdev comment style. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Andy Zhou <azhou@nicira.com>
* datapath: Provide compatibility for kernels up to 3.17Thomas Graf2014-09-201-2/+2
| | | | | | | | | | | Port datapath to work with kernrels up to 3.17 and use 3.16.2 as the new kernel for CI testing. Tested with 3.14, 3.16.2, and net-next (3.17). Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Co-authored-by: Madhu Challa <challa@noironetworks.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: Drop packets when interdev is not upChunhe Li2014-07-301-0/+5
| | | | | | | | | | If the internal device is not up, it should drop received packets. Sometimes it receive the broadcast or multicast packets, and the ip protocol stack will casue more cpu usage wasted. Signed-off-by: Chunhe Li <lichunhe@huawei.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: Enable tunnel GSO features.Pravin B Shelar2014-07-111-1/+7
| | | | | | | | | Following patch enables all available tunnel GSO features for OVS bridge device so that ovs can use hardware offloads available to underling device. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Andy Zhou <azhou@nicira.com>
* datapath: Enable all GSO features on internal port.Pravin B Shelar2013-10-231-1/+1
| | | | | | | | | | OVS already can handle all types of segmentation offloads that are supported by the kernel. Following patch specifically enables UDP and IPV6 segmentation offloads. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
* datapath: Remove net_device_ops compatibility code.Jesse Gross2013-09-171-19/+0
| | | | | | | | | | The symbol HAVE_NET_DEVICE_OPS was changed in 3.1 but code the that it was protecting dates back to before 2.6.32. Therefore, we can just assume that net_device_ops exists in all cases and drop the compat code. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: Remove vlan compat supportPravin B Shelar2013-09-061-4/+13
| | | | | Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
* datapath: Remove checksum compat supportPravin B Shelar2013-09-061-7/+0
| | | | | Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
* datapath: vport: Remove compat supportPravin B Shelar2013-09-061-13/+0
| | | | | Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
* datapath: Support for Linux kernel 3.10Pravin B Shelar2013-08-101-1/+2
| | | | | | | | | Changes are mostly related API changes in vlan, GRE restructuring. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Kyle Mestery <kmestery@cisco.com> Acked-by: Jesse Gross <jesse@nicira.com>
* datapath: Use kernel eth_mac_addr() on old kernels.Jesse Gross2013-07-121-1/+1
| | | | | | | | | | The OVS MAC address set function was removed in favor of the version in the kernel but the function pointer for older kernels was not updated. Reported-by: Cali Ente <calientepermanente@gmail.com> Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: make skb->csum consistent with rest of networking stack.Pravin B Shelar2013-06-121-0/+1
| | | | | | | | As suggested by Jesse in the comment for patch "gre: Restructure tunneling", following patch keeps skb->csum correct across ovs. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
* datapath: Kill VPORT_F_TUN_ID vport flag.Pravin B Shelar2013-05-061-1/+1
| | | | | | | | | VPORT_F_TUN_ID is last remaining flag, once we remove it, flags field from vport-ops can be removed. Since it does not complicate much code, we decided to remove this flag. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
* datapath: Move vport init to first port create.Pravin B Shelar2013-05-061-1/+0
| | | | | | | | | | | vport->init and exit() functions are defined by gre and netdev vport only and both can be moved to first port create. Following patch does same, it moves vport init to respective vport create and gets rid of vport->init() and vport->exit() functions. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
* datapath: Remove unneeded ovs_netdev_get_ifindex()Thomas Graf2013-04-301-1/+0
| | | | | | | | The only user is get_dpifindex(), no need to redirect via the port operations. Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Jesse Gross <jesse@nicira.com>
* datapath: Simplify datapath locking.Pravin B Shelar2013-04-121-0/+6
| | | | | | | | | | | | Currently OVS uses combination of genl and rtnl lock to protect datapath state. This was done due to networking stack locking. But this has complicated locking and there are few lock ordering issues with new tunneling protocols. Following patch simplifies locking by introducing new ovs mutex and now this lock is used to protect entire ovs state. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
* datapath: Remove checks for preinitialized flow.Jesse Gross2013-03-181-2/+1
| | | | | | | | | | Header caching used to store a precomputed flow along with the skb but no longer exists. There were a few remaining checks for those flows, which this removes. It simplifies the code slightly and brings us closer to upstream. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: fix drvinfo strings set in driversJiri Pirko2013-03-141-1/+1
| | | | | | | | | | | | | Use strlcpy where possible to ensure the string is \0 terminated. Use always sizeof(string) instead of 32, ETHTOOL_BUSINFO_LEN and custom defines. Use snprintf instead of sprint. Remove unnecessary inits of ->fw_version Remove unnecessary inits of drvinfo struct. Signed-off-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Jesse Gross <jesse@nicira.com>
* datapath: Remove vport MAC address configuration.Jesse Gross2013-01-281-2/+0
| | | | | | | | | | | | | The ability to retrieve and set MAC addresses on vports is only necessary for tunnel ports (the addresses for actual devices can be retrieved through direct Linux mechanisms). Tunnel ports only used the information for the purpose of generating path MTU discovery packets, which has now been removed. Current userspace code already reflects these changes, so this drops the functionality from the kernel. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Kyle Mestery <kmestery@cisco.com>
* openvswitch: Remove Linux bridge compatibility.Pravin B Shelar2012-12-271-17/+0
| | | | | | | | | Currently brcompat does not work on master due to recent datapath changes. We have decided to remove it as it is not used very widely. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
* datapath: Use eth_mac_addr() instead of duplicating itThomas Graf2012-12-041-14/+2
| | | | | | | | | bonus: if we ever are to use IFF_LIVE_ADDR_CHANGE for anything further than to check availability in eth_mac_addr(), Open vSwitch will be ready for that. Signed-off-by: Thomas Graf <tgraf@redhat.com> Signed-off-by: Jesse Gross <jesse@nicira.com>
* datapath: Reset upper layer protocol info on internal devices.Jesse Gross2012-05-171-0/+8
| | | | | | | | | | | | | | | | | It's possible that packets that are sent on internal devices (from the OVS perspective) have already traversed the local IP stack. After they go through the internal device, they will again travel through the IP stack which may get confused by the presence of existing information in the skb. The problem can be observed when switching between namespaces. This clears out that information to avoid problems but deliberately leaves other metadata alone. This is to provide maximum flexibility in chaining together OVS and other Linux components. Bug #10995 Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@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>
* datapath: use eth_hw_addr_random() and reset addr_assign_typeDanny Kukawka2012-02-151-1/+4
| | | | | | | | | | | | Use eth_hw_addr_random() instead of calling random_ether_addr() to set addr_assign_type correctly to NET_ADDR_RANDOM. Reset the state to NET_ADDR_PERM as soon as the MAC get changed via .ndo_set_mac_address. Signed-off-by: Danny Kukawka <danny.kukawka@bisect.de> [jesse: add backporting to older kernels] Signed-off-by: Jesse Gross <jesse@nicira.com>
* datapath: Add support for namespace.Pravin B Shelar2012-01-301-2/+7
| | | | | | | | | | | | Following patch adds support for Linux net-namespace. Now we can have independent OVS instance in each net-ns. Namespace support requires 2.6.32 or newer kernel as per-net-ns genl-sock is not available in earlier kernel. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com> Bug #7821
* datapath: Scope global symbols with ovs_ prefix.Jesse Gross2011-11-221-23/+23
| | | | | | | | | OVS has quite a few global symbols that should be scoped with a prefix to prevent collisions with other modules in the kernel. Suggested-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* datapath: Reformat copyright messages.Jesse Gross2011-11-161-4/+14
| | | | | | | | | | | Many of our kernel copyright messages make reference to code being copied from the Linux kernel, which is a bit odd for code in the kernel. This changes them to use the standard GNU GPL boilerplate instead. It does not change the actual license, which continues to be GPLv2. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* datapath: Don't use Nicira's OUI for generating mac-address.Pravin B Shelar2011-11-101-1/+1
| | | | | Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
* datapath: Remove unnecessary definition of is_internal_vport()Pravin B Shelar2011-11-101-5/+0
| | | | | Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
* datapath: Fix coding style issues.Pravin B Shelar2011-11-071-4/+7
| | | | | | | | | Most of issues are reported by checkpatch.pl Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com> Bug #7771
* datapath: Define net_device_ops->ndo_get_stats64() for internal_dev.Pravin B Shelar2011-11-041-17/+30
| | | | | | | Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com> Bug #7772
* datapath: Convert internal_dev to ndo_fix_features.Pravin B Shelar2011-11-041-0/+5
| | | | | | | | | | | | | | | | From 2.6.39 kernel netdev features are set using set_features and fix_features APIs. Since internal-dev does not need any special checks on setting feature, there is no need to define set_features or fix_features. Only hw_features needs to be set to features that are supported by internal-dev. Following patch does same and drops discrete offload setting ops for newer kernel. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com> Bug #7772
* datapath: Don't set flags on internal vports.Jesse Gross2011-11-041-1/+0
| | | | | | | | We currently set netdev->flags to IFF_BROADCAST | IFF_MULTICAST but this is unnecessary because it's already done by ether_setup(). Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* datapath: Assert IFF_TX_SKB_SHARING on internal devices.Jesse Gross2011-10-181-0/+1
| | | | | | | | | | Linux 3.1 adds a flag to check whether it's OK for shared skbs to be transmitted on devices. This generally isn't a problem for hardware devices but software devices such as OVS that hold state in the skb need to clear the flag, which is enabled by default. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* datapath: Add version check for struct netdev_ops.Jesse Gross2011-10-181-0/+4
| | | | | | | | | Linux 3.1 drops the symbol HAVE_NET_DEVICE_OPS that lets us know whether struct netdev_ops is present. As a result, we need to replace it with an explicit version check. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* datapath: Remove RT kernel support.Pravin B Shelar2011-10-061-4/+1
| | | | | | | | | | | | | Following patch removes RT kernel support. This allows us to cleanup the loop detection. Along with this BH is now disabled while running execute_actions() for packet from user-space. As a result we can simplify the stats code as entire send and receive path runs in BH context on all supported platforms. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com> Bug #7621
* datapath: Fix recv path for CONFIG_PREEMPT_RCU.Pravin B Shelar2011-10-061-1/+3
| | | | | | | | | | | In case CONFIG_PREEMPT_RCU, rcu grace period waits only for RCU read-side critical sections that are delimited by rcu_read_lock() and rcu_read_unlock(). internal_dev_xmit() is called in rcu_read_lock_bh context. Therefore we need to explicitly take rcu lock to prevent race with call_rcu() in PREEMPT_RCU case. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
* datapath: Always use generic stats for devices (vports)Pravin Shelar2011-09-151-6/+3
| | | | | | | | | | | | | | | Currently ovs is using device stats for Linux devices and count them itself in other situations. This leads to overlap with hardware stats, inconsistencies, etc. It's much better to just always count the packets flowing through the switch and let userspace do any merging that it wants. Following patch removes vport->get_stats() interface. vport-stat is changed to use new `struct ovs_vport_stat` rather than rtnl_link_stats64. Definitions of rtnl_link_stats64 is removed from OVS. dipf_port->stat is also removed as aggregate stats are only available at netdev layer. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
* Set MTU in userspace rather than kernel.Justin Pettit2011-09-151-6/+0
| | | | | | | | | | | | Currently the kernel automatically sets the MTU of any internal interfaces to the minimum of all attached interfaces because the Linux bridge does this. Userspace can do this with more knowledge and flexibility. Feature #7323 Signed-off-by: Justin Pettit <jpettit@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
* datapath: Improve kernel hash tablePravin Shelar2011-09-091-3/+1
| | | | | | | | | | | | Currently OVS uses its own hashing implmentation for hash tables which has some problems, e.g. error case on deletion code. Following patch replaces that with hlist based hash table which is consistent with other kernel hash tables. As Jesse suggested, flex-array is used for allocating hash buckets, So that we can have large hash-table without large contiguous kernel memory. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
* Strip down vport interface : iflinkPravin Shelar2011-09-081-1/+0
| | | | | | | | Remove iflink from vport interface. iflink is not used anywhere in OVS. So there is not need to have iflink as vport attribute. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
* datapath: Use "OVS_*" as opposed to "ODP_*" for user<->kernel interactions.Justin Pettit2011-08-191-1/+1
| | | | | | | | | | | | | The prefix "ODP_*" is not overly descriptive in the context of the larger Linux tree. This commit changes the prefix to "OVS_*" for the userpace to kernel interactions. The userspace libraries still use "ODP_" in many of their interfaces since it is more descriptive in the OVS oeuvre. Feature #6904 Signed-off-by: Justin Pettit <jpettit@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
* datapath: Add missing header.Jesse Gross2011-06-231-0/+1
| | | | | | | | | The internal dev vport really needs hardirq.h but doesn't depend directly on it and has relied on it being included from other sources. Recent kernels broke this, so explicitly add the header. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* datapath: Further mirror checksum offloading state on old kernels.Jesse Gross2011-06-161-1/+6
| | | | | | | | | | | | | | | | | | Older kernels (those before 2.6.22) rely on implicit assumptions to determine checksum offloading status. These assumptions tend to break down when doing switching because it sits in the middle of the transmit and receive path. Newer kernels deal with this problem by adding more explicit information about how to checksum. This replicates that behavior by mirroring the state from newer kernels in private OVS storage on the kernels that lack it. On ingress and egress we then map that state onto the appropriate location for the given kernel and can consistently manipulate it within OVS. Some of this was already done for the checksum type but this makes it more robust and expands it to the checksum start and offset as well. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>