diff options
author | Paolo Abeni <pabeni@redhat.com> | 2017-11-30 09:35:33 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-12-02 21:14:59 -0500 |
commit | 183dea5818315c0a172d21ecbcd2554894bf01e3 (patch) | |
tree | ef7a0a843aea2434716659d40fb141630022baf4 | |
parent | c5f66a85899705835f61d687a38f62d5a1ec4eb9 (diff) |
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@redhat.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/openvswitch/vport-internal_dev.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/net/openvswitch/vport-internal_dev.c b/net/openvswitch/vport-internal_dev.c index 04a3128adcf0..3e7747549f90 100644 --- a/net/openvswitch/vport-internal_dev.c +++ b/net/openvswitch/vport-internal_dev.c | |||
@@ -126,18 +126,12 @@ internal_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats) | |||
126 | } | 126 | } |
127 | } | 127 | } |
128 | 128 | ||
129 | static void internal_set_rx_headroom(struct net_device *dev, int new_hr) | ||
130 | { | ||
131 | dev->needed_headroom = new_hr < 0 ? 0 : new_hr; | ||
132 | } | ||
133 | |||
134 | static const struct net_device_ops internal_dev_netdev_ops = { | 129 | static const struct net_device_ops internal_dev_netdev_ops = { |
135 | .ndo_open = internal_dev_open, | 130 | .ndo_open = internal_dev_open, |
136 | .ndo_stop = internal_dev_stop, | 131 | .ndo_stop = internal_dev_stop, |
137 | .ndo_start_xmit = internal_dev_xmit, | 132 | .ndo_start_xmit = internal_dev_xmit, |
138 | .ndo_set_mac_address = eth_mac_addr, | 133 | .ndo_set_mac_address = eth_mac_addr, |
139 | .ndo_get_stats64 = internal_get_stats, | 134 | .ndo_get_stats64 = internal_get_stats, |
140 | .ndo_set_rx_headroom = internal_set_rx_headroom, | ||
141 | }; | 135 | }; |
142 | 136 | ||
143 | static struct rtnl_link_ops internal_dev_link_ops __read_mostly = { | 137 | static struct rtnl_link_ops internal_dev_link_ops __read_mostly = { |
@@ -154,7 +148,7 @@ static void do_setup(struct net_device *netdev) | |||
154 | 148 | ||
155 | netdev->priv_flags &= ~IFF_TX_SKB_SHARING; | 149 | netdev->priv_flags &= ~IFF_TX_SKB_SHARING; |
156 | netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_OPENVSWITCH | | 150 | netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_OPENVSWITCH | |
157 | IFF_PHONY_HEADROOM | IFF_NO_QUEUE; | 151 | IFF_NO_QUEUE; |
158 | netdev->needs_free_netdev = true; | 152 | netdev->needs_free_netdev = true; |
159 | netdev->priv_destructor = internal_dev_destructor; | 153 | netdev->priv_destructor = internal_dev_destructor; |
160 | netdev->ethtool_ops = &internal_dev_ethtool_ops; | 154 | netdev->ethtool_ops = &internal_dev_ethtool_ops; |
@@ -195,7 +189,6 @@ static struct vport *internal_dev_create(const struct vport_parms *parms) | |||
195 | err = -ENOMEM; | 189 | err = -ENOMEM; |
196 | goto error_free_netdev; | 190 | goto error_free_netdev; |
197 | } | 191 | } |
198 | vport->dev->needed_headroom = vport->dp->max_headroom; | ||
199 | 192 | ||
200 | dev_net_set(vport->dev, ovs_dp_get_net(vport->dp)); | 193 | dev_net_set(vport->dev, ovs_dp_get_net(vport->dp)); |
201 | internal_dev = internal_dev_priv(vport->dev); | 194 | internal_dev = internal_dev_priv(vport->dev); |