[ovs-git] [openvswitch/ovs] f6f505: netdev-dpdk: Fix requested MTU size validation.

GitHub noreply at github.com
Sat Jan 27 17:27:28 UTC 2018


  Branch: refs/heads/master
  Home:   https://github.com/openvswitch/ovs
  Commit: f6f50552a3f05a7b44f759c1888d1f33e36da8c6
      https://github.com/openvswitch/ovs/commit/f6f50552a3f05a7b44f759c1888d1f33e36da8c6
  Author: Ian Stokes <ian.stokes at intel.com>
  Date:   2018-01-26 (Fri, 26 Jan 2018)

  Changed paths:
    M Documentation/intro/install/dpdk.rst
    M lib/netdev-dpdk.c

  Log Message:
  -----------
  netdev-dpdk: Fix requested MTU size validation.

This commit replaces MTU_TO_FRAME_LEN(mtu) with MTU_TO_MAX_FRAME_LEN(mtu)
in netdev_dpdk_set_mtu(), in order to determine if the total length of
the L2 frame with an MTU of ’mtu’ exceeds NETDEV_DPDK_MAX_PKT_LEN.

When setting an MTU we first check if the requested total frame length
(which includes associated L2 overhead) will exceed the maximum
frame length supported in netdev_dpdk_set_mtu(). The frame length is
calculated by MTU_TO_FRAME_LEN  as MTU + ETHER_HEADER + ETHER_CRC. The MTU
for the device will be set at a later stage in dpdk_eth_dev_init() using
rte_eth_dev_set_mtu(mtu).

However when using rte_eth_dev_set_mtu(mtu) the calculation used to check
that the frame does not exceed the max frame length for that device varies
between DPDK device drivers. For example ixgbe driver calculates the
frame length for a given MTU as

mtu + ETHER_HDR_LEN + ETHER_CRC_LEN

i40e driver calculates it as

mtu + ETHER_HDR_LEN + ETHER_CRC_LEN + I40E_VLAN_TAG_SIZE * 2

em driver calculates it as

mtu + ETHER_HDR_LEN + ETHER_CRC_LEN + VLAN_TAG_SIZE

Currently it is possible to set an MTU for a netdev_dpdk device that exceeds
the upper limit MTU for that devices DPDK driver. This leads to a segfault.
This is because the frame length comparison as is, does not take into account
the addition of the vlan tag overhead expected in the drivers. The
netdev_dpdk_set_mtu() call will incorrectly succeed but the subsequent
dpdk_eth_dev_init() will fail before the queues have been created for the
DPDK device. This coupled with assumptions regarding reconfiguration
requirements for the netdev will lead to a segfault when the rxq is polled
for this device.

A simple way to avoid this is by using MTU_TO_MAX_FRAME_LEN(mtu) when
validating a requested MTU in netdev_dpdk_set_mtu().
MTU_TO_MAX_FRAME_LEN(mtu) is equivalent to the following:

mtu + ETHER_HDR_LEN + ETHER_CRC_LEN + (2 * VLAN_HEADER_LEN)

By using MTU_TO_MAX_FRAME_LEN at the netdev_dpdk_set_mtu() stage, OvS
now takes into account the maximum L2 overhead that a DPDK driver could
allow for in its frame size calculation. This allows OVS to flag an error
rather than the DPDK driver if the frame length exceeds the max DPDK frame
length. OVS can fail gracefully at this point and use the default MTU of
1500 to continue to configure the port.

Note: this fix is a work around, a better approach would be if DPDK devices
could report the maximum MTU value that can be requested on a per device
basis. This capability however is not currently available. A downside of
this patch is that the MTU upper limit will be reduced by 8 bytes for
DPDK devices that do not need to account for vlan tags in the frame length
driver calculations e.g. ixgbe devices upper MTU limit is reduced from
the OVS point of view from 9710 to 9702.

CC: Mark Kavanagh <mark.b.kavanagh at intel.com>
Fixes: 0072e931 ("netdev-dpdk: add support for jumbo frames")
Signed-off-by: Ian Stokes <ian.stokes at intel.com>
Co-authored-by: Mark Kavanagh <mark.b.kavanagh at intel.com>
Signed-off-by: Mark Kavanagh <mark.b.kavanagh at intel.com>
Acked-by: Flavio Leitner <fbl at sysclose.org>


  Commit: 5e758818683915fe8490ddfd0365daee3407ce6f
      https://github.com/openvswitch/ovs/commit/5e758818683915fe8490ddfd0365daee3407ce6f
  Author: Yuanhan Liu <yliu at fridaylinux.org>
  Date:   2018-01-26 (Fri, 26 Jan 2018)

  Changed paths:
    M Documentation/howto/dpdk.rst
    M lib/netdev-dpdk.c

  Log Message:
  -----------
  netdev-dpdk: fix port addition for ports sharing same PCI id

Some NICs have only one PCI address associated with multiple ports. This
patch extends the dpdk-devargs option's format to cater for such devices.

To achieve that, this patch uses a new syntax that will be adapted and
implemented in future DPDK release (likely, v18.05):
    http://dpdk.org/ml/archives/dev/2017-December/084234.html

And since it's the DPDK duty to parse the (complete and full) syntax
and this patch is more likely to serve as an intermediate workaround,
here I take a simpler and shorter syntax from it (note it's allowed to
have only one category being provided):
    class=eth,mac=00:11:22:33:44:55:66

Also, old compatibility is kept. Users can still go on with using the
PCI id to add a port (if that's enough for them). Meaning, this patch
will not break anything.

This patch is basically based on the one from Ciara:
    https://mail.openvswitch.org/pipermail/ovs-dev/2017-October/339496.html

Cc: Loftus Ciara <ciara.loftus at intel.com>
Cc: Thomas Monjalon <thomas at monjalon.net>
Cc: Kevin Traynor <ktraynor at redhat.com>
Signed-off-by: Yuanhan Liu <yliu at fridaylinux.org>
Signed-off-by: Ian Stokes <ian.stokes at intel.com>


  Commit: 40c23a57b822b02cf89409fad833d9c58d0bf6f0
      https://github.com/openvswitch/ovs/commit/40c23a57b822b02cf89409fad833d9c58d0bf6f0
  Author: Matteo Croce <mcroce at redhat.com>
  Date:   2018-01-26 (Fri, 26 Jan 2018)

  Changed paths:
    M lib/dpdk-stub.c
    M lib/dpdk.c
    M lib/dpdk.h
    M utilities/ovs-ctl.in
    M vswitchd/ovs-vswitchd.c

  Log Message:
  -----------
  vswitchd: show DPDK version

Show DPDK version if Open vSwitch is compiled with DPDK support.
Version can be retrieved with `ovs-vswitchd --version` or from OVS logs.
Small change in ovs-ctl to avoid breakage on output change.

Signed-off-by: Matteo Croce <mcroce at redhat.com>
Acked-by: Kevin Traynor <ktraynor at redhat.com>
Signed-off-by: Ian Stokes <ian.stokes at intel.com>


  Commit: 526259f22cb733348991c031f08ba348a859bde2
      https://github.com/openvswitch/ovs/commit/526259f22cb733348991c031f08ba348a859bde2
  Author: Ilya Maximets <i.maximets at samsung.com>
  Date:   2018-01-26 (Fri, 26 Jan 2018)

  Changed paths:
    M lib/netdev-dpdk.c

  Log Message:
  -----------
  netdev-dpdk: Fix memory leak in netdev_dpdk_get_custom_stats().

CC: Michal Weglicki <michalx.weglicki at intel.com>
Fixes: 971f4b394c6e ("netdev: Custom statistics.")
Signed-off-by: Ilya Maximets <i.maximets at samsung.com>
Signed-off-by: Ian Stokes <ian.stokes at intel.com>


  Commit: 34eb0863429eef8aa5e79a6c87f324a7ed4c19e3
      https://github.com/openvswitch/ovs/commit/34eb0863429eef8aa5e79a6c87f324a7ed4c19e3
  Author: Ilya Maximets <i.maximets at samsung.com>
  Date:   2018-01-26 (Fri, 26 Jan 2018)

  Changed paths:
    M lib/netdev-dpdk.c

  Log Message:
  -----------
  netdev-dpdk: Fix memory leak in netdev_dpdk_configure_xstats().

CC: Michal Weglicki <michalx.weglicki at intel.com>
Fixes: 971f4b394c6e ("netdev: Custom statistics.")
Signed-off-by: Ilya Maximets <i.maximets at samsung.com>
Signed-off-by: Ian Stokes <ian.stokes at intel.com>


  Commit: ac1a9bb93fb1d2d60bae64aa7778a4c4c388c2dd
      https://github.com/openvswitch/ovs/commit/ac1a9bb93fb1d2d60bae64aa7778a4c4c388c2dd
  Author: Ilya Maximets <i.maximets at samsung.com>
  Date:   2018-01-26 (Fri, 26 Jan 2018)

  Changed paths:
    M lib/netdev-dpdk.c

  Log Message:
  -----------
  netdev-dpdk: Fix xstats leak on port destruction.

CC: Michal Weglicki <michalx.weglicki at intel.com>
Fixes: 971f4b394c6e ("netdev: Custom statistics.")
Signed-off-by: Ilya Maximets <i.maximets at samsung.com>
Signed-off-by: Ian Stokes <ian.stokes at intel.com>


  Commit: d67ee81a301eba853e35af0d01dd01f7d853909b
      https://github.com/openvswitch/ovs/commit/d67ee81a301eba853e35af0d01dd01f7d853909b
  Author: Ben Pfaff <blp at ovn.org>
  Date:   2018-01-27 (Sat, 27 Jan 2018)

  Changed paths:
    M Documentation/howto/dpdk.rst
    M Documentation/intro/install/dpdk.rst
    M lib/dpdk-stub.c
    M lib/dpdk.c
    M lib/dpdk.h
    M lib/netdev-dpdk.c
    M utilities/ovs-ctl.in
    M vswitchd/ovs-vswitchd.c

  Log Message:
  -----------
  Merge branch 'dpdk_merge' of https://github.com/istokes/ovs into HEAD


Compare: https://github.com/openvswitch/ovs/compare/31bd820c1d08...d67ee81a301e


More information about the git mailing list