aboutsummaryrefslogtreecommitdiffstats
path: root/net/openvswitch/flow_netlink.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/openvswitch/flow_netlink.c')
-rw-r--r--net/openvswitch/flow_netlink.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c
index 1b29ea706912..1050b2882b9e 100644
--- a/net/openvswitch/flow_netlink.c
+++ b/net/openvswitch/flow_netlink.c
@@ -252,6 +252,38 @@ static bool match_validate(const struct sw_flow_match *match,
252 return true; 252 return true;
253} 253}
254 254
255size_t ovs_key_attr_size(void)
256{
257 /* Whenever adding new OVS_KEY_ FIELDS, we should consider
258 * updating this function.
259 */
260 BUILD_BUG_ON(OVS_KEY_ATTR_TUNNEL_INFO != 22);
261
262 return nla_total_size(4) /* OVS_KEY_ATTR_PRIORITY */
263 + nla_total_size(0) /* OVS_KEY_ATTR_TUNNEL */
264 + nla_total_size(8) /* OVS_TUNNEL_KEY_ATTR_ID */
265 + nla_total_size(4) /* OVS_TUNNEL_KEY_ATTR_IPV4_SRC */
266 + nla_total_size(4) /* OVS_TUNNEL_KEY_ATTR_IPV4_DST */
267 + nla_total_size(1) /* OVS_TUNNEL_KEY_ATTR_TOS */
268 + nla_total_size(1) /* OVS_TUNNEL_KEY_ATTR_TTL */
269 + nla_total_size(0) /* OVS_TUNNEL_KEY_ATTR_DONT_FRAGMENT */
270 + nla_total_size(0) /* OVS_TUNNEL_KEY_ATTR_CSUM */
271 + nla_total_size(0) /* OVS_TUNNEL_KEY_ATTR_OAM */
272 + nla_total_size(256) /* OVS_TUNNEL_KEY_ATTR_GENEVE_OPTS */
273 + nla_total_size(4) /* OVS_KEY_ATTR_IN_PORT */
274 + nla_total_size(4) /* OVS_KEY_ATTR_SKB_MARK */
275 + nla_total_size(4) /* OVS_KEY_ATTR_DP_HASH */
276 + nla_total_size(4) /* OVS_KEY_ATTR_RECIRC_ID */
277 + nla_total_size(12) /* OVS_KEY_ATTR_ETHERNET */
278 + nla_total_size(2) /* OVS_KEY_ATTR_ETHERTYPE */
279 + nla_total_size(4) /* OVS_KEY_ATTR_VLAN */
280 + nla_total_size(0) /* OVS_KEY_ATTR_ENCAP */
281 + nla_total_size(2) /* OVS_KEY_ATTR_ETHERTYPE */
282 + nla_total_size(40) /* OVS_KEY_ATTR_IPV6 */
283 + nla_total_size(2) /* OVS_KEY_ATTR_ICMPV6 */
284 + nla_total_size(28); /* OVS_KEY_ATTR_ND */
285}
286
255/* The size of the argument for each %OVS_KEY_ATTR_* Netlink attribute. */ 287/* The size of the argument for each %OVS_KEY_ATTR_* Netlink attribute. */
256static const int ovs_key_lens[OVS_KEY_ATTR_MAX + 1] = { 288static const int ovs_key_lens[OVS_KEY_ATTR_MAX + 1] = {
257 [OVS_KEY_ATTR_ENCAP] = -1, 289 [OVS_KEY_ATTR_ENCAP] = -1,