diff options
author | Sugesh Chandran <sugesh.chandran@intel.com> | 2017-01-02 14:27:48 -0800 |
---|---|---|
committer | Pravin B Shelar <pravin.ovn@gmail.com> | 2017-01-04 01:10:35 -0800 |
commit | 1a2bb11817a40d1d532deededf59588f4b883395 (patch) | |
tree | b0274952b9631519fb56de4c963e502c60c16b6e /lib/netdev-native-tnl.c | |
parent | 9e0fdb8cdf95f412f4333e9120ed91c388b394d5 (diff) | |
download | openvswitch-1a2bb11817a40d1d532deededf59588f4b883395.tar.gz |
netdev-dpdk: Enable Rx checksum offloading feature on DPDK physical ports.
Add Rx checksum offloading feature support on DPDK physical ports. By default,
the Rx checksum offloading is enabled if NIC supports. However,
the checksum offloading can be turned OFF either while adding a new DPDK
physical port to OVS or at runtime.
The rx checksum offloading can be turned off by setting the parameter to
'false'. For eg: To disable the rx checksum offloading when adding a port,
'ovs-vsctl add-port br0 dpdk0 -- \
set Interface dpdk0 type=dpdk options:rx-checksum-offload=false'
OR (to disable at run time after port is being added to OVS)
'ovs-vsctl set Interface dpdk0 options:rx-checksum-offload=false'
Similarly to turn ON rx checksum offloading at run time,
'ovs-vsctl set Interface dpdk0 options:rx-checksum-offload=true'
The Tx checksum offloading support is not implemented due to the following
reasons.
1) Checksum offloading and vectorization are mutually exclusive in DPDK poll
mode driver. Vector packet processing is turned OFF when checksum offloading
is enabled which causes significant performance drop at Tx side.
2) Normally, OVS generates checksum for tunnel packets in software at the
'tunnel push' operation, where the tunnel headers are created. However
enabling Tx checksum offloading involves,
*) Mark every packets for tx checksum offloading at 'tunnel_push' and
recirculate.
*) At the time of xmit, validate the same flag and instruct the NIC to do the
checksum calculation. In case NIC doesnt support Tx checksum offloading,
the checksum calculation has to be done in software before sending out the
packets.
No significant performance improvement noticed with Tx checksum offloading
due to the e overhead of additional validations + non vector packet processing.
In some test scenarios, it introduces performance drop too.
Rx checksum offloading still offers 8-9% of improvement on VxLAN tunneling
decapsulation even though the SSE vector Rx function is disabled in DPDK poll
mode driver.
Signed-off-by: Sugesh Chandran <sugesh.chandran@intel.com>
Acked-by: Jesse Gross <jesse@kernel.org>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Diffstat (limited to 'lib/netdev-native-tnl.c')
-rw-r--r-- | lib/netdev-native-tnl.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/lib/netdev-native-tnl.c b/lib/netdev-native-tnl.c index ce2582f13..c730e7234 100644 --- a/lib/netdev-native-tnl.c +++ b/lib/netdev-native-tnl.c @@ -85,9 +85,11 @@ netdev_tnl_ip_extract_tnl_md(struct dp_packet *packet, struct flow_tnl *tnl, ovs_be32 ip_src, ip_dst; - if (csum(ip, IP_IHL(ip->ip_ihl_ver) * 4)) { - VLOG_WARN_RL(&err_rl, "ip packet has invalid checksum"); - return NULL; + if (OVS_UNLIKELY(!dp_packet_ip_checksum_valid(packet))) { + if (csum(ip, IP_IHL(ip->ip_ihl_ver) * 4)) { + VLOG_WARN_RL(&err_rl, "ip packet has invalid checksum"); + return NULL; + } } if (ntohs(ip->ip_tot_len) > l3_size) { @@ -179,18 +181,21 @@ udp_extract_tnl_md(struct dp_packet *packet, struct flow_tnl *tnl, } if (udp->udp_csum) { - uint32_t csum; - if (netdev_tnl_is_header_ipv6(dp_packet_data(packet))) { - csum = packet_csum_pseudoheader6(dp_packet_l3(packet)); - } else { - csum = packet_csum_pseudoheader(dp_packet_l3(packet)); - } - - csum = csum_continue(csum, udp, dp_packet_size(packet) - - ((const unsigned char *)udp - - (const unsigned char *)dp_packet_l2(packet))); - if (csum_finish(csum)) { - return NULL; + if (OVS_UNLIKELY(!dp_packet_l4_checksum_valid(packet))) { + uint32_t csum; + if (netdev_tnl_is_header_ipv6(dp_packet_data(packet))) { + csum = packet_csum_pseudoheader6(dp_packet_l3(packet)); + } else { + csum = packet_csum_pseudoheader(dp_packet_l3(packet)); + } + + csum = csum_continue(csum, udp, dp_packet_size(packet) - + ((const unsigned char *)udp - + (const unsigned char *)dp_packet_l2(packet) + )); + if (csum_finish(csum)) { + return NULL; + } } tnl->flags |= FLOW_TNL_F_CSUM; } |