@@ -262,3 +262,9 @@ PMDs in the case where no value is specified. By default "scalar" is used.
\fIstudy_cnt\fR defaults to 128 and indicates the number of packets that the
"study" miniflow implementation must parse before choosing an optimal
implementation.
+.
+.IP "\fBdpif-netdev/offload-show\fR [\fIdp\fR] [\fInetdev\fR]"
+Prints the hardware offloading features enabled in netdev \fInetdev\fR
+attached to datapath \fIdp\fR. The datapath \fIdp\fR parameter can be
+omitted if there is only one. All netdev ports are printed if the
+parameter \fInetdev\fR is omitted.
@@ -1753,11 +1753,6 @@ netdev_dpdk_get_config(const struct netdev *netdev, struct smap *args)
} else {
smap_add(args, "rx_csum_offload", "false");
}
- if (dev->hw_ol_features & NETDEV_TX_TSO_OFFLOAD) {
- smap_add(args, "tx_tso_offload", "true");
- } else {
- smap_add(args, "tx_tso_offload", "false");
- }
smap_add(args, "lsc_interrupt_mode",
dev->lsc_interrupt_mode ? "true" : "false");
@@ -37,6 +37,7 @@ extern "C" {
struct netdev_tnl_build_header_params;
#define NETDEV_NUMA_UNSPEC OVS_NUMA_UNSPEC
+/* Keep this enum updated with translation to string below. */
enum netdev_ol_flags {
NETDEV_TX_OFFLOAD_IPV4_CKSUM = 1 << 0,
NETDEV_TX_OFFLOAD_TCP_CKSUM = 1 << 1,
@@ -43,6 +43,7 @@
#include "netdev-provider.h"
#include "netdev-vport.h"
#include "odp-netlink.h"
+#include "openvswitch/json.h"
#include "openflow/openflow.h"
#include "packets.h"
#include "openvswitch/ofp-print.h"
@@ -1373,9 +1374,31 @@ netdev_get_next_hop(const struct netdev *netdev,
int
netdev_get_status(const struct netdev *netdev, struct smap *smap)
{
- return (netdev->netdev_class->get_status
- ? netdev->netdev_class->get_status(netdev, smap)
- : EOPNOTSUPP);
+ int err = EOPNOTSUPP;
+
+ /* Set offload status only if relevant. */
+ if (netdev_get_dpif_type(netdev) &&
+ strcmp(netdev_get_dpif_type(netdev), "system")) {
+
+#define OL_ADD_STAT(name, bit) \
+ smap_add(smap, name "_csum_offload", \
+ netdev->ol_flags & bit ? "true" : "false");
+
+ OL_ADD_STAT("ip", NETDEV_TX_OFFLOAD_IPV4_CKSUM);
+ OL_ADD_STAT("tcp", NETDEV_TX_OFFLOAD_TCP_CKSUM);
+ OL_ADD_STAT("udp", NETDEV_TX_OFFLOAD_UDP_CKSUM);
+ OL_ADD_STAT("sctp", NETDEV_TX_OFFLOAD_SCTP_CKSUM);
+ OL_ADD_STAT("tso", NETDEV_TX_OFFLOAD_TCP_TSO);
+#undef OL_ADD_STAT
+
+ err = 0;
+ }
+
+ if (!netdev->netdev_class->get_status) {
+ return err;
+ }
+
+ return netdev->netdev_class->get_status(netdev, smap);
}
/* Returns all assigned IP address to 'netdev' and returns 0.
@@ -650,6 +650,24 @@ AT_CHECK([ovs-appctl revalidator/resume])
OVS_VSWITCHD_STOP
AT_CLEANUP
+AT_SETUP([dpif-netdev - check dpif-netdev/offload-show])
+OVS_VSWITCHD_START(
+ [add-port br0 p1 \
+ -- set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p0.sock \
+ -- set bridge br0 datapath-type=dummy \
+ other-config:datapath-id=1234 fail-mode=secure])
+
+AT_CHECK([ovs-vsctl list interface p1 | sed -n 's/^status.*{\(.*\).*}$/\1/p'], [0], [dnl
+ip_csum_offload="false", sctp_csum_offload="false", tcp_csum_offload="false", tso_csum_offload="false", udp_csum_offload="false"
+], [])
+
+AT_CHECK([ovs-vsctl list interface br0 | sed -n 's/^status.*{\(.*\).*}$/\1/p'], [0], [dnl
+ip_csum_offload="false", sctp_csum_offload="false", tcp_csum_offload="false", tso_csum_offload="false", udp_csum_offload="false"
+], [])
+
+OVS_VSWITCHD_STOP
+AT_CLEANUP
+
# SEND_UDP_PKTS([p_name], [p_ofport])
#
# Sends 128 packets to port 'p_name' with different UDP destination ports.