summaryrefslogtreecommitdiff
path: root/datapath/vport-netdev.c
Commit message (Collapse)AuthorAgeFilesLines
* datapath: Fix netdev_master_upper_dev_link for 4.14Greg Rose2018-02-121-1/+2
| | | | | | | | | An extended netlink ack has been added for 4.14 - add compat layer changes so that it compiles for all kernels up to and including 4.14. Signed-off-by: Greg Rose <gvrose8192@gmail.com> Acked-by: Pravin B Shelar <pshelar@ovn.org>
* datapath: allow L3 netdev portsYang, Yi Y2017-03-021-3/+6
| | | | | | | | | | | | | | | | | | | | | | Upstream commit: commit 217ac77a3c2524d999730b2a80b61fcc2d0f734a Author: Jiri Benc <jbenc@redhat.com> Date: Thu Nov 10 16:28:24 2016 +0100 openvswitch: allow L3 netdev ports Allow ARPHRD_NONE interfaces to be added to ovs bridge. Based on previous versions by Lorand Jakab and Simon Horman. Signed-off-by: Lorand Jakab <lojakab@cisco.com> Signed-off-by: Simon Horman <simon.horman@netronome.com> Signed-off-by: Jiri Benc <jbenc@redhat.com> Acked-by: Pravin B Shelar <pshelar@ovn.org> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Yi Yang <yi.y.yang@intel.com> Signed-off-by: Joe Stringer <joe@ovn.org>
* datapath: remove unnecessary EXPORT_SYMBOLsJiri Benc2017-03-021-1/+0
| | | | | | | | | | | | | | | | | | | | | Upstream commit: commit 76e4cc7731a1e0c07e202999b9834f9d9be66de4 Author: Jiri Benc <jbenc@redhat.com> Date: Wed Oct 19 11:26:37 2016 +0200 openvswitch: remove unnecessary EXPORT_SYMBOLs Some symbols exported to other modules are really used only by openvswitch.ko. Remove the exports. Tested by loading all 4 openvswitch modules, nothing breaks. Signed-off-by: Jiri Benc <jbenc@redhat.com> Acked-by: Pravin B Shelar <pshelar@ovn.org> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Signed-off-by: Joe Stringer <joe@ovn.org>
* datapath: Add support for kernel 4.5Pravin B Shelar2016-07-191-1/+1
| | | | | Signed-off-by: Pravin B Shelar <pshelar@ovn.org> Acked-by: Jesse Gross <jesse@kernel.org>
* datapath: Use skb_postpush_rcsum()Pravin B Shelar2016-07-171-1/+1
| | | | | | | Use kernel function to update checksum. Signed-off-by: Pravin B Shelar <pshelar@ovn.org> Acked-by: Jesse Gross <jesse@kernel.org>
* datapath: compat: rename HAVE_METADATA_DST to USE_UPSTREAM_TUNNELPravin B Shelar2016-07-081-1/+1
| | | | | | | To better represent the meaning of symbol. Signed-off-by: Pravin B Shelar <pshelar@ovn.org> Acked-by: Jesse Gross <jesse@kernel.org>
* datapath: Drop support for kernel older than 3.10Pravin B Shelar2016-03-141-75/+8
| | | | | | | | | | | | | | | | 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: Backport: openvswitch: fix hangup on vxlan/gre/geneve device deletionPravin B Shelar2015-12-081-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | Upstream commit: Each openvswitch tunnel vport (vxlan,gre,geneve) holds a reference to the underlying tunnel device, but never released it when such device is deleted. Deleting the underlying device via the ip tool cause the kernel to hangup in the netdev_wait_allrefs() loop. This commit ensure that on device unregistration dp_detach_port_notify() is called for all vports that hold the device reference, properly releasing it. Fixes: 614732eaa12d ("openvswitch: Use regular VXLAN net_device device") Fixes: b2acd1dc3949 ("openvswitch: Use regular GRE net_device instead of vport") Fixes: 6b001e682e90 ("openvswitch: Use Geneve device.") Signed-off-by: Paolo Abeni <pabeni@redhat.com> Acked-by: Flavio Leitner <fbl@sysclose.org> Acked-by: Pravin B Shelar <pshelar@nicira.com> Signed-off-by: David S. Miller <davem@davemloft.net> Upstream: 131753030("openvswitch: fix hangup on vxlan/gre/geneve device deletion"). Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@kernel.org>
* datapath: Add support for lwtunnelPravin B Shelar2015-12-031-124/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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: check for rx handler registerFlavio Leitner2015-08-311-3/+8
| | | | | | | | | | | | | Red Hat Enterprise Linux 6 has backported the netdev RX handler facility so use the netdev_rx_handler_register as an indicator. The handler prototype changed between 2.6.36 and 2.6.39 since there could be backports in any stage, don't look at the kernel version, but at the prototype. Signed-off-by: Flavio Leitner <fbl@redhat.com> Signed-off-by: Jesse Gross <jesse@nicira.com>
* datapath: disable LROJiri Benc2015-08-171-0/+1
| | | | | | | | | | | | | | | | | Currently, openvswitch tries to disable LRO from the user space. This does not work correctly when the device added is a vlan interface, though. Instead of dealing with possibly complex stacked cross name space relations in the user space, do the same as bridging does and call dev_disable_lro in the kernel. Signed-off-by: Jiri Benc <jbenc@redhat.com> Acked-by: Flavio Leitner <fbl@redhat.com> Acked-by: Pravin B Shelar <pshelar@nicira.com> Signed-off-by: David S. Miller <davem@davemloft.net> Upstream: 640b2b107c ("openvswitch: disable LRO"). Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: Turn vports with dependencies into separate modulesThomas Graf2015-04-041-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: 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: Constify various function argumentsThomas Graf2014-09-231-1/+1
| | | | | | | Help produce better optimized code. Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: Provide compatibility for kernels up to 3.17Thomas Graf2014-09-201-1/+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: Simplify vport-netdev-hook compatibility code.Pravin B Shelar2013-10-271-33/+0
| | | | | | | | Move compat code to netdev_rx_handler_register() definition. It also adds type safety for netdev-hook. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
* datapath: fix vport-netdev unregisterAlexei Starovoitov2013-10-161-4/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The combination of two commits: commit 8e4e1713e4 ("openvswitch: Simplify datapath locking.") commit 2537b4dd0a ("openvswitch:: link upper device for port devices") introduced a bug where upper_dev wasn't unlinked upon netdev_unregister notification The following steps: modprobe openvswitch ovs-dpctl add-dp test ip tuntap add dev tap1 mode tap ovs-dpctl add-if test tap1 ip tuntap del dev tap1 mode tap are causing multiple warnings: [ 62.747557] gre: GRE over IPv4 demultiplexor driver [ 62.749579] openvswitch: Open vSwitch switching datapath [ 62.755087] device test entered promiscuous mode [ 62.765911] device tap1 entered promiscuous mode [ 62.766033] IPv6: ADDRCONF(NETDEV_UP): tap1: link is not ready [ 62.769017] ------------[ cut here ]------------ [ 62.769022] WARNING: CPU: 1 PID: 3267 at net/core/dev.c:5501 rollback_registered_many+0x20f/0x240() [ 62.769023] Modules linked in: openvswitch gre vxlan ip_tunnel libcrc32c ip6table_filter ip6_tables ebtable_nat ebtables nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack xt_CHECKSUM iptable_mangle ipt_REJECT xt_tcpudp iptable_filter ip_tables x_tables bridge stp llc vhost_net macvtap macvlan vhost kvm_intel kvm dm_crypt iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi hid_generic mxm_wmi eeepc_wmi asus_wmi sparse_keymap dm_multipath psmouse serio_raw usbhid hid parport_pc ppdev firewire_ohci lpc_ich firewire_core e1000e crc_itu_t binfmt_misc igb dca ptp pps_core mac_hid wmi lp parport i2o_config i2o_block video [ 62.769051] CPU: 1 PID: 3267 Comm: ip Not tainted 3.12.0-rc3+ #60 [ 62.769052] Hardware name: System manufacturer System Product Name/P8Z77 WS, BIOS 3007 07/26/2012 [ 62.769053] 0000000000000009 ffff8807f25cbd28 ffffffff8175e575 0000000000000006 [ 62.769055] 0000000000000000 ffff8807f25cbd68 ffffffff8105314c ffff8807f25cbd58 [ 62.769057] ffff8807f2634000 ffff8807f25cbdc8 ffff8807f25cbd88 ffff8807f25cbdc8 [ 62.769059] Call Trace: [ 62.769062] [<ffffffff8175e575>] dump_stack+0x55/0x76 [ 62.769065] [<ffffffff8105314c>] warn_slowpath_common+0x8c/0xc0 [ 62.769067] [<ffffffff8105319a>] warn_slowpath_null+0x1a/0x20 [ 62.769069] [<ffffffff8162a04f>] rollback_registered_many+0x20f/0x240 [ 62.769071] [<ffffffff8162a101>] rollback_registered+0x31/0x40 [ 62.769073] [<ffffffff8162a488>] unregister_netdevice_queue+0x58/0x90 [ 62.769075] [<ffffffff8154f900>] __tun_detach+0x140/0x340 [ 62.769077] [<ffffffff8154fb36>] tun_chr_close+0x36/0x60 [ 62.769080] [<ffffffff811bddaf>] __fput+0xff/0x260 [ 62.769082] [<ffffffff811bdf5e>] ____fput+0xe/0x10 [ 62.769084] [<ffffffff8107b515>] task_work_run+0xb5/0xe0 [ 62.769087] [<ffffffff810029b9>] do_notify_resume+0x59/0x80 [ 62.769089] [<ffffffff813a41fe>] ? trace_hardirqs_on_thunk+0x3a/0x3f [ 62.769091] [<ffffffff81770f5a>] int_signal+0x12/0x17 [ 62.769093] ---[ end trace 838756c62e156ffb ]--- [ 62.769481] ------------[ cut here ]------------ [ 62.769485] WARNING: CPU: 1 PID: 92 at fs/sysfs/inode.c:325 sysfs_hash_and_remove+0xa9/0xb0() [ 62.769486] sysfs: can not remove 'master', no directory [ 62.769486] Modules linked in: openvswitch gre vxlan ip_tunnel libcrc32c ip6table_filter ip6_tables ebtable_nat ebtables nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack xt_CHECKSUM iptable_mangle ipt_REJECT xt_tcpudp iptable_filter ip_tables x_tables bridge stp llc vhost_net macvtap macvlan vhost kvm_intel kvm dm_crypt iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi hid_generic mxm_wmi eeepc_wmi asus_wmi sparse_keymap dm_multipath psmouse serio_raw usbhid hid parport_pc ppdev firewire_ohci lpc_ich firewire_core e1000e crc_itu_t binfmt_misc igb dca ptp pps_core mac_hid wmi lp parport i2o_config i2o_block video [ 62.769514] CPU: 1 PID: 92 Comm: kworker/1:2 Tainted: G W 3.12.0-rc3+ #60 [ 62.769515] Hardware name: System manufacturer System Product Name/P8Z77 WS, BIOS 3007 07/26/2012 [ 62.769518] Workqueue: events ovs_dp_notify_wq [openvswitch] [ 62.769519] 0000000000000009 ffff880807ad3ac8 ffffffff8175e575 0000000000000006 [ 62.769521] ffff880807ad3b18 ffff880807ad3b08 ffffffff8105314c ffff880807ad3b28 [ 62.769523] 0000000000000000 ffffffff81a87a1f ffff8807f2634000 ffff880037038500 [ 62.769525] Call Trace: [ 62.769528] [<ffffffff8175e575>] dump_stack+0x55/0x76 [ 62.769529] [<ffffffff8105314c>] warn_slowpath_common+0x8c/0xc0 [ 62.769531] [<ffffffff81053236>] warn_slowpath_fmt+0x46/0x50 [ 62.769533] [<ffffffff8123e7e9>] sysfs_hash_and_remove+0xa9/0xb0 [ 62.769535] [<ffffffff81240e96>] sysfs_remove_link+0x26/0x30 [ 62.769538] [<ffffffff81631ef7>] __netdev_adjacent_dev_remove+0xf7/0x150 [ 62.769540] [<ffffffff81632037>] __netdev_adjacent_dev_unlink_lists+0x27/0x50 [ 62.769542] [<ffffffff8163213a>] __netdev_adjacent_dev_unlink_neighbour+0x3a/0x50 [ 62.769544] [<ffffffff8163218d>] netdev_upper_dev_unlink+0x3d/0x140 [ 62.769548] [<ffffffffa033c2db>] netdev_destroy+0x4b/0x80 [openvswitch] [ 62.769550] [<ffffffffa033b696>] ovs_vport_del+0x46/0x60 [openvswitch] [ 62.769552] [<ffffffffa0335314>] ovs_dp_detach_port+0x44/0x60 [openvswitch] [ 62.769555] [<ffffffffa0336574>] ovs_dp_notify_wq+0xb4/0x150 [openvswitch] [ 62.769557] [<ffffffff81075c28>] process_one_work+0x1d8/0x6a0 [ 62.769559] [<ffffffff81075bc8>] ? process_one_work+0x178/0x6a0 [ 62.769562] [<ffffffff8107659b>] worker_thread+0x11b/0x370 [ 62.769564] [<ffffffff81076480>] ? rescuer_thread+0x350/0x350 [ 62.769566] [<ffffffff8107f44a>] kthread+0xea/0xf0 [ 62.769568] [<ffffffff8107f360>] ? flush_kthread_worker+0x150/0x150 [ 62.769570] [<ffffffff81770bac>] ret_from_fork+0x7c/0xb0 [ 62.769572] [<ffffffff8107f360>] ? flush_kthread_worker+0x150/0x150 [ 62.769573] ---[ end trace 838756c62e156ffc ]--- [ 62.769574] ------------[ cut here ]------------ [ 62.769576] WARNING: CPU: 1 PID: 92 at fs/sysfs/inode.c:325 sysfs_hash_and_remove+0xa9/0xb0() [ 62.769577] sysfs: can not remove 'upper_test', no directory [ 62.769577] Modules linked in: openvswitch gre vxlan ip_tunnel libcrc32c ip6table_filter ip6_tables ebtable_nat ebtables nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack xt_CHECKSUM iptable_mangle ipt_REJECT xt_tcpudp iptable_filter ip_tables x_tables bridge stp llc vhost_net macvtap macvlan vhost kvm_intel kvm dm_crypt iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi hid_generic mxm_wmi eeepc_wmi asus_wmi sparse_keymap dm_multipath psmouse serio_raw usbhid hid parport_pc ppdev firewire_ohci lpc_ich firewire_core e1000e crc_itu_t binfmt_misc igb dca ptp pps_core mac_hid wmi lp parport i2o_config i2o_block video [ 62.769603] CPU: 1 PID: 92 Comm: kworker/1:2 Tainted: G W 3.12.0-rc3+ #60 [ 62.769604] Hardware name: System manufacturer System Product Name/P8Z77 WS, BIOS 3007 07/26/2012 [ 62.769606] Workqueue: events ovs_dp_notify_wq [openvswitch] [ 62.769607] 0000000000000009 ffff880807ad3ac8 ffffffff8175e575 0000000000000006 [ 62.769609] ffff880807ad3b18 ffff880807ad3b08 ffffffff8105314c ffff880807ad3b58 [ 62.769611] 0000000000000000 ffff880807ad3bd9 ffff8807f2634000 ffff880037038500 [ 62.769613] Call Trace: [ 62.769615] [<ffffffff8175e575>] dump_stack+0x55/0x76 [ 62.769617] [<ffffffff8105314c>] warn_slowpath_common+0x8c/0xc0 [ 62.769619] [<ffffffff81053236>] warn_slowpath_fmt+0x46/0x50 [ 62.769621] [<ffffffff8123e7e9>] sysfs_hash_and_remove+0xa9/0xb0 [ 62.769622] [<ffffffff81240e96>] sysfs_remove_link+0x26/0x30 [ 62.769624] [<ffffffff81631f22>] __netdev_adjacent_dev_remove+0x122/0x150 [ 62.769627] [<ffffffff81632037>] __netdev_adjacent_dev_unlink_lists+0x27/0x50 [ 62.769629] [<ffffffff8163213a>] __netdev_adjacent_dev_unlink_neighbour+0x3a/0x50 [ 62.769631] [<ffffffff8163218d>] netdev_upper_dev_unlink+0x3d/0x140 [ 62.769633] [<ffffffffa033c2db>] netdev_destroy+0x4b/0x80 [openvswitch] [ 62.769636] [<ffffffffa033b696>] ovs_vport_del+0x46/0x60 [openvswitch] [ 62.769638] [<ffffffffa0335314>] ovs_dp_detach_port+0x44/0x60 [openvswitch] [ 62.769640] [<ffffffffa0336574>] ovs_dp_notify_wq+0xb4/0x150 [openvswitch] [ 62.769642] [<ffffffff81075c28>] process_one_work+0x1d8/0x6a0 [ 62.769644] [<ffffffff81075bc8>] ? process_one_work+0x178/0x6a0 [ 62.769646] [<ffffffff8107659b>] worker_thread+0x11b/0x370 [ 62.769648] [<ffffffff81076480>] ? rescuer_thread+0x350/0x350 [ 62.769650] [<ffffffff8107f44a>] kthread+0xea/0xf0 [ 62.769652] [<ffffffff8107f360>] ? flush_kthread_worker+0x150/0x150 [ 62.769654] [<ffffffff81770bac>] ret_from_fork+0x7c/0xb0 [ 62.769656] [<ffffffff8107f360>] ? flush_kthread_worker+0x150/0x150 [ 62.769657] ---[ end trace 838756c62e156ffd ]--- [ 62.769724] device tap1 left promiscuous mode This patch also affects moving devices between net namespaces. OVS used to ignore netns move notifications which caused problems. Like: ovs-dpctl add-if test tap1 ip link set tap1 netns 3512 and then removing tap1 inside the namespace will cause hang on missing dev_put. With this patch OVS will detach dev upon receiving netns move event. Signed-off-by: Alexei Starovoitov <ast@plumgrid.com> Signed-off-by: Jesse Gross <jesse@nicira.com>
* datapath: Move segmentation compatibility code into a compatibility functionSimon Horman2013-09-251-71/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move segmentation compatibility code out of netdev_send and into rpl_dev_queue_xmit(), a compatibility function used in place of dev_queue_xmit() as necessary. As suggested by Jesse Gross. Some minor though verbose implementation notes: * This rpl_dev_queue_xmit() endeavours to return a valid error code or zero on success as per dev_queue_xmit(). The exception is that when dev_queue_xmit() is called in a loop only the status of the last call is taken into account, thus ignoring any errors returned by previous calls. This is derived from the previous calls to dev_queue_xmit() in a loop where netdev_send() ignores the return value of dev_queue_xmit() entirely. * netdev_send() continues to ignore the value of dev_queue_xmit(). So the discussion of the return value of rpl_dev_queue_xmit() above is has no bearing on run-time behaviour. * The return value of netdev_send() may differ from the previous implementation in the case where segmentation is performed before calling the real dev_queue_xmit(). This is because previously in this case netdev_send() would return the combined length of the skbs resulting from segmentation. Whereas the current code always returns the length of the original skb. Signed-off-by: Simon Horman <horms@verge.net.au> [jesse: adjust error path in netdev_send() to match upstream] Signed-off-by: Jesse Gross <jesse@nicira.com>
* datapath: simplify VLAN segmentationSimon Horman2013-09-251-15/+9
| | | | | | | | Push vlan tag onto packet before segmentation to simplify the code. As suggested by Pravin Shelar and Jesse Gross. Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Jesse Gross <jesse@nicira.com>
* datapath: Remove vlan compat supportPravin B Shelar2013-09-061-2/+0
| | | | | 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-5/+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-15/+1
| | | | | 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-2/+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: link upper device for port devicesJiri Pirko2013-07-301-1/+19
| | | | | | | | Link upper device properly. That will make IFLA_MASTER filled up. Set the master to port 0 of the datapath under which the port belongs. Signed-off-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: Jesse Gross <jesse@nicira.com>
* datapath: rhel: Move RHEL OVS hook registration to ↵Thomas Graf2013-07-091-20/+0
| | | | | | | | | | | | | | | | netdev_rx_handler_register() backport Moves the registration of the RHEL specific OVS hook to the compat backport of netdev_rx_handler_register(). This moves the hook unregistration from the RCU callback to the netdev_destroy() callback directly. This is purely cosmetic though, the RHEL hook is only used if the IFF_OVS_DATAPATH flag is present which was removed under RTNL protection before the RCU callback. Signed-off-by: Thomas Graf <tgraf@redhat.com> Signed-off-by: Jesse Gross <jesse@nicira.com>
* datapath: make skb->csum consistent with rest of networking stack.Pravin B Shelar2013-06-121-2/+3
| | | | | | | | 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-5/+14
| | | | | | | | | | | 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: Unify vport error stats handling.Pravin B Shelar2013-05-061-11/+6
| | | | | | | | Following patch changes vport->send return type so that vport layer can do error accounting. 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-7/+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: Use openvswitch_handle_frame hook in >=RHEL6.4 to live side by ↵Thomas Graf2013-04-251-4/+32
| | | | | | | | | | | | | | | | | | | side with bridging Due to the missing register rx_handler API in the kernel RHEL6 is based on, the datapath currently falls back to using the bridging hook with the consequence that bridging and OVS cannot be used in parallel on any RHEL6 release. For this purpose, >=RHEL6.4 releases provide a special rx frame hook to be used by OVS. It captures frames at the same location in the stack as the rx_handler would do in more recent kernel releases. In order to store the vport pointer, the net_device's ax25_ptr field is utilized under the assumption that an AX25 device will never be attached to an OVS bridge. Signed-off-by: Thomas Graf <tgraf@redhat.com> Signed-off-by: Jesse Gross <jesse@nicira.com>
* datapath: Simplify datapath locking.Pravin B Shelar2013-04-121-1/+7
| | | | | | | | | | | | 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 vport MAC address configuration.Jesse Gross2013-01-281-19/+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>
* datapath: Move LRO check from transmit to receive.Jesse Gross2013-01-211-11/+12
| | | | | | | | | | | | | | | | | | | Commit 24b019f808211a95078efd916064af0975ca5733 (datapath: Disable LRO from userspace instead of the kernel.) accidentally moved the check for LRO packets from the receive path to transmit. Since this check is supposed to protect OVS (and other parts of the system) from packets that it cannot handle it is obviously not useful on egress. Therefore, this commit moves it back to the receive side. The primary problem that this caused is upcalls to userspace tried to segment the packet even though no segmentation information is available. This would later cause NULL pointer dereferences when skb_gso_segment() did nothing. Bug #14772 Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* openvswitch: Remove Linux bridge compatibility.Pravin B Shelar2012-12-271-40/+14
| | | | | | | | | 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 RCU callback when detaching netdevices.Jesse Gross2012-11-281-4/+10
| | | | | | | | | | | Currently, each time a device is detached from an OVS datapath we call synchronize RCU before freeing associated data structures. However, if a bridge is deleted (which detaches all ports) when many devices are connected then there can be a long delay. This switches to use call_rcu() to group the cost together. Reported-by: Justin Pettit <jpettit@nicira.com> Signed-off-by: Jesse Gross <jesse@nicira.com>
* datapath: Print device when warning about over MTU packets.Jesse Gross2012-10-041-1/+1
| | | | | | | | | If an attempt is made to transmit a packet that is over the device's MTU then we log it using the datapath's name. However, it is much more helpful to use the device name instead. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Kyle Mestery <kmestery@cisco.com>
* datapath: Convert net_ratelimit uses to net_<level>_ratelimitedJoe Perches2012-05-251-3/+3
| | | | | | | | | | | Standardize the net core ratelimited logging functions. Coalesce formats, align arguments. Change a printk then vprintk sequence to use printf extension %pV. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Jesse Gross <jesse@nicira.com>
* datapath: cleanup unsigned to unsigned intEric Dumazet2012-05-251-2/+2
| | | | | | | | Use of "unsigned int" is preferred to bare "unsigned" in net tree. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Jesse Gross <jesse@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: omit _mod from module namesChris Wright2012-03-091-1/+1
| | | | | | | | | | | | | | | This renames the datapath modules: openvswitch_mod -> openvswitch brcompat_mod -> brcompat The first makes the module name consistent with upstream, and the latter is just for internal consistency. This makes tools, and documentation refer to a common module name regardless if it's coming from upstream linux or built from datapath/ as part of a local build. Signed-off-by: Chris Wright <chrisw@sous-sol.org> Signed-off-by: Jesse Gross <jesse@nicira.com>
* datapath: Add support for namespace.Pravin B Shelar2012-01-301-1/+1
| | | | | | | | | | | | 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: Enforce mutual exclusion between bridge and brcompat_mod.Ben Pfaff2012-01-171-15/+6
| | | | | | | | | | | | | | In kernels 2.6.36, Open vSwitch can (and does) safely coexist with the Linux bridge module, but it does not make sense to load both bridge and brcompat_mod at the same time. Until now, nothing has prevented both from loading; when they both load, confusion (at best) results. This fixes the problem by enforcing mutual exclusion. Bug #9226. Launchpad bug #917309. Reported-by: Rogério Vinhal Nunes Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
* datapath: IFF_OVS_DATAPATH is backported by RHEL 6.2.Jesse Gross2012-01-121-1/+1
| | | | | | | | | | | | | On kernels 2.6.37 and above IFF_OVS_DATAPATH has a unique value upstream, on 2.6.36 we define it to be IFF_BRIDGE_PORT and below to 0. There isn't really a good reason to use IFF_BRIDGE_PORT on 2.6.36 (and it's perhaps bad because it's checked in a few places and we don't want those checks to trigger on just this kernel) and it makes it difficult to know what value we should use in the face of backporting. Therefore, this just uses 0 on the places where we don't have a real value. Reported-by: Benoit ML <ben42ml@gmail.com> Signed-off-by: Jesse Gross <jesse@nicira.com>
* datapath: Fix build after global symbol rename.Jesse Gross2011-11-221-1/+1
| | | | | | | ovs_netdev_get_vport() did not get renamed in one of the blocks for older kernels. Signed-off-by: Jesse Gross <jesse@nicira.com>
* datapath: Scope global symbols with ovs_ prefix.Jesse Gross2011-11-221-29/+29
| | | | | | | | | 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: Fix coding style issues.Pravin B Shelar2011-11-071-5/+6
| | | | | | | | | 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: IFF_BRIDGE_PORT is backported by Centos 5.6.Jesse Gross2011-09-211-1/+1
| | | | | | | | | | Some versions of Centos 5.6 backport the flag IFF_BRIDGE_PORT without the associated rx_handler changes, so this changes to use a version check since we really don't care about the actual symbol. Reported-by: Srinivasan Ramasubramanian <vrsrini@gmail.com> Signed-off-by: Jesse Gross <jesse@nicira.com>
* datapath: Always use generic stats for devices (vports)Pravin Shelar2011-09-151-23/+1
| | | | | | | | | | | | | | | 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>