Following commit (''netlink: Do not enforce alignment of last Netlink attribute''), signal the ability to receive unaligned Netlink messages to the datapath to enable utilization of zerocopy optimizations.
Signed-off-by: Thomas Graf <tg...@redhat.com> --- include/linux/openvswitch.h | 4 ++++ lib/dpif-linux.c | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/include/linux/openvswitch.h b/include/linux/openvswitch.h index b429201..8b5726a 100644 --- a/include/linux/openvswitch.h +++ b/include/linux/openvswitch.h @@ -95,6 +95,7 @@ enum ovs_datapath_attr { OVS_DP_ATTR_UPCALL_PID, /* Netlink PID to receive upcalls */ OVS_DP_ATTR_STATS, /* struct ovs_dp_stats */ OVS_DP_ATTR_MEGAFLOW_STATS, /* struct ovs_dp_megaflow_stats */ + OVS_DP_ATTR_USER_FEATURES, /* OVS_DP_F_* */ __OVS_DP_ATTR_MAX }; @@ -126,6 +127,9 @@ struct ovs_vport_stats { __u64 tx_dropped; /* no space available in linux */ }; +/* Allow last Netlink attribute to be unaligned */ +#define OVS_DP_F_UNALIGNED (1 << 0) + /* Fixed logical ports. */ #define OVSP_LOCAL ((__u32)0) diff --git a/lib/dpif-linux.c b/lib/dpif-linux.c index 42958d3..bc1395c 100644 --- a/lib/dpif-linux.c +++ b/lib/dpif-linux.c @@ -73,6 +73,7 @@ struct dpif_linux_dp { /* Attributes. */ const char *name; /* OVS_DP_ATTR_NAME. */ const uint32_t *upcall_pid; /* OVS_DP_UPCALL_PID. */ + uint32_t user_features; /* OVS_DP_ATTR_USER_FEATURES */ struct ovs_dp_stats stats; /* OVS_DP_ATTR_STATS. */ struct ovs_dp_megaflow_stats megaflow_stats; /* OVS_DP_ATTR_MEGAFLOW_STATS.*/ @@ -227,6 +228,7 @@ dpif_linux_open(const struct dpif_class *class OVS_UNUSED, const char *name, if (create) { dp_request.cmd = OVS_DP_CMD_NEW; upcall_pid = 0; + dp_request.user_features |= OVS_DP_F_UNALIGNED; dp_request.upcall_pid = &upcall_pid; } else { dp_request.cmd = OVS_DP_CMD_GET; @@ -1839,6 +1841,10 @@ dpif_linux_dp_to_ofpbuf(const struct dpif_linux_dp *dp, struct ofpbuf *buf) nl_msg_put_u32(buf, OVS_DP_ATTR_UPCALL_PID, *dp->upcall_pid); } + if (dp->user_features) { + nl_msg_put_u32(buf, OVS_DP_ATTR_USER_FEATURES, dp->user_features); + } + /* Skip OVS_DP_ATTR_STATS since we never have a reason to serialize it. */ } -- 1.8.3.1 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev