[ovs-dev] [PATCH 12/12] datapath: do not propagate headroom updates to internal port

Greg Rose gvrose8192 at gmail.com
Mon Dec 11 21:50:33 UTC 2017


From: Paolo Abeni <pabeni at redhat.com>

Upstream commit:
    commit 183dea5818315c0a172d21ecbcd2554894bf01e3
    Author: Paolo Abeni <pabeni at redhat.com>
    Date:   Thu Nov 30 15:35:33 2017 +0100

    openvswitch: do not propagate headroom updates to internal port

    After commit 3a927bc7cf9d ("ovs: propagate per dp max headroom to
    all vports") the need_headroom for the internal vport is updated
    accordingly to the max needed headroom in its datapath.

    That avoids the pskb_expand_head() costs when sending/forwarding
    packets towards tunnel devices, at least for some scenarios.

    We still require such copy when using the ovs-preferred configuration
    for vxlan tunnels:

        br_int
      /       \
    tap      vxlan
               (remote_ip:X)

    br_phy
         \
        NIC

    where the route towards the IP 'X' is via 'br_phy'.

    When forwarding traffic from the tap towards the vxlan device, we
    will call pskb_expand_head() in vxlan_build_skb() because
    br-phy->needed_headroom is equal to tun->needed_headroom.

    With this change we avoid updating the internal vport needed_headroom,
    so that in the above scenario no head copy is needed, giving 5%
    performance improvement in UDP throughput test.

    As a trade-off, packets sent from the internal port towards a tunnel
    device will now experience the head copy overhead. The rationale is
    that the latter use-case is less relevant performance-wise.

    Signed-off-by: Paolo Abeni <pabeni at redhat.com>
    Acked-by: Pravin B Shelar <pshelar at ovn.org>
    Signed-off-by: David S. Miller <davem at davemloft.net>

Also removed related compat layer changes.

Cc: Paolo Abeni <pabeni at redhat.com>
Signed-off-by: Greg Rose <gvrose8192 at gmail.com>
---
 acinclude.m4                                    |  1 -
 datapath/linux/compat/include/linux/netdevice.h | 19 -------------------
 datapath/vport-internal_dev.c                   | 19 +------------------
 3 files changed, 1 insertion(+), 38 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 30a2103..0cf41d3 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -553,7 +553,6 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
   OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [udp_offload.*uoff],
                   [OVS_DEFINE([HAVE_UDP_OFFLOAD_ARG_UOFF])])
   OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [gro_remcsum])
-  OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [IFF_PHONY_HEADROOM])
   OVS_FIND_FIELD_IFELSE([$KSRC/include/linux/netdevice.h], [net_device_ops],
                         [extended])
   OVS_FIND_PARAM_IFELSE([$KSRC/include/linux/netdevice.h],
diff --git a/datapath/linux/compat/include/linux/netdevice.h b/datapath/linux/compat/include/linux/netdevice.h
index 3c3cf42..87f8469 100644
--- a/datapath/linux/compat/include/linux/netdevice.h
+++ b/datapath/linux/compat/include/linux/netdevice.h
@@ -244,25 +244,6 @@ int ovs_dev_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb);
 #define NETDEV_OFFLOAD_PUSH_GENEVE      0x001D
 #endif
 
-#ifndef HAVE_IFF_PHONY_HEADROOM
-
-#define IFF_PHONY_HEADROOM 0
-static inline unsigned netdev_get_fwd_headroom(struct net_device *dev)
-{
-	return 0;
-}
-
-static inline void netdev_set_rx_headroom(struct net_device *dev, int new_hr)
-{
-}
-
-/* set the device rx headroom to the dev's default */
-static inline void netdev_reset_rx_headroom(struct net_device *dev)
-{
-}
-
-#endif
-
 #ifdef IFF_NO_QUEUE
 #define HAVE_IFF_NO_QUEUE
 #else
diff --git a/datapath/vport-internal_dev.c b/datapath/vport-internal_dev.c
index 0aa331a..9bb8751 100644
--- a/datapath/vport-internal_dev.c
+++ b/datapath/vport-internal_dev.c
@@ -149,13 +149,6 @@ internal_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats)
 	}
 }
 
-#ifdef HAVE_IFF_PHONY_HEADROOM
-static void internal_set_rx_headroom(struct net_device *dev, int new_hr)
-{
-	dev->needed_headroom = new_hr < 0 ? 0 : new_hr;
-}
-#endif
-
 static const struct net_device_ops internal_dev_netdev_ops = {
 	.ndo_open = internal_dev_open,
 	.ndo_stop = internal_dev_stop,
@@ -165,13 +158,6 @@ static const struct net_device_ops internal_dev_netdev_ops = {
 	.ndo_change_mtu = internal_dev_change_mtu,
 #endif
 	.ndo_get_stats64 = (void *)internal_get_stats,
-#ifdef HAVE_IFF_PHONY_HEADROOM
-#ifndef HAVE_NET_DEVICE_OPS_WITH_EXTENDED
-	.ndo_set_rx_headroom = internal_set_rx_headroom,
-#else
-	.extended.ndo_set_rx_headroom = internal_set_rx_headroom,
-#endif
-#endif
 };
 
 static struct rtnl_link_ops internal_dev_link_ops __read_mostly = {
@@ -189,7 +175,7 @@ static void do_setup(struct net_device *netdev)
 
 	netdev->priv_flags &= ~IFF_TX_SKB_SHARING;
 	netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_OPENVSWITCH |
-			      IFF_PHONY_HEADROOM | IFF_NO_QUEUE;
+			      IFF_NO_QUEUE;
 #ifndef HAVE_NEEDS_FREE_NETDEV
 	netdev->destructor = internal_dev_destructor;
 #else
@@ -239,9 +225,6 @@ static struct vport *internal_dev_create(const struct vport_parms *parms)
 		goto error_free_netdev;
 	}
 
-#ifdef HAVE_IFF_PHONY_HEADROOM
-	vport->dev->needed_headroom = vport->dp->max_headroom;
-#endif
 	dev_net_set(vport->dev, ovs_dp_get_net(vport->dp));
 	internal_dev = internal_dev_priv(vport->dev);
 	internal_dev->vport = vport;
-- 
1.8.3.1



More information about the dev mailing list