diff options
author | Joe Stringer <joe@ovn.org> | 2017-07-21 16:46:10 -0700 |
---|---|---|
committer | Joe Stringer <joe@ovn.org> | 2017-07-24 11:25:34 -0700 |
commit | aadd6ae9e85d30a9a52ed4490501691a44c00a8e (patch) | |
tree | 21b5fe8ddb8183c882954c09ae76e0d690766487 /datapath | |
parent | 143656435c4a97cb4ef5fca9f086e64b11142a97 (diff) | |
download | openvswitch-aadd6ae9e85d30a9a52ed4490501691a44c00a8e.tar.gz |
compat: net: store port/representator id in metadata_dst.
Upstream commit:
commit 3fcece12bc1b6dcdf0986f2cd9e8f63b1f9b6aa0
Author: Jakub Kicinski <jakub.kicinski@netronome.com>
Date: Fri Jun 23 22:11:58 2017 +0200
net: store port/representator id in metadata_dst
Switches and modern SR-IOV enabled NICs may multiplex traffic from Port
representators and control messages over single set of hardware queues.
Control messages and muxed traffic may need ordered delivery.
Those requirements make it hard to comfortably use TC infrastructure today
unless we have a way of attaching metadata to skbs at the upper device.
Because single set of queues is used for many netdevs stopping TC/sched
queues of all of them reliably is impossible and lower device has to
retreat to returning NETDEV_TX_BUSY and usually has to take extra locks on
the fastpath.
This patch attempts to enable port/representative devs to attach metadata
to skbs which carry port id. This way representatives can be queueless and
all queuing can be performed at the lower netdev in the usual way.
Traffic arriving on the port/representative interfaces will be have
metadata attached and will subsequently be queued to the lower device for
transmission. The lower device should recognize the metadata and translate
it to HW specific format which is most likely either a special header
inserted before the network headers or descriptor/metadata fields.
Metadata is associated with the lower device by storing the netdev pointer
along with port id so that if TC decides to redirect or mirror the new
netdev will not try to interpret it.
This is mostly for SR-IOV devices since switches don't have lower netdevs
today.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Sridhar Samudrala <sridhar.samudrala@intel.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Upstream: 3fcece12bc1b ("net: store port/representator id in metadata_dst")
Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Greg Rose <gvrose8192@gmail.com>
Diffstat (limited to 'datapath')
-rw-r--r-- | datapath/flow_netlink.c | 4 | ||||
-rw-r--r-- | datapath/linux/compat/include/net/dst_metadata.h | 15 |
2 files changed, 18 insertions, 1 deletions
diff --git a/datapath/flow_netlink.c b/datapath/flow_netlink.c index 07ab8e9a4..9b4861250 100644 --- a/datapath/flow_netlink.c +++ b/datapath/flow_netlink.c @@ -2203,7 +2203,9 @@ static int validate_and_copy_set_tun(const struct nlattr *attr, if (start < 0) return start; - tun_dst = metadata_dst_alloc(key.tun_opts_len, GFP_KERNEL); + tun_dst = metadata_dst_alloc(key.tun_opts_len, METADATA_IP_TUNNEL, + GFP_KERNEL); + if (!tun_dst) return -ENOMEM; diff --git a/datapath/linux/compat/include/net/dst_metadata.h b/datapath/linux/compat/include/net/dst_metadata.h index 279b7144b..e401eb400 100644 --- a/datapath/linux/compat/include/net/dst_metadata.h +++ b/datapath/linux/compat/include/net/dst_metadata.h @@ -103,4 +103,19 @@ static inline void ovs_ipv6_tun_rx_dst(struct metadata_dst *md_dst, void ovs_ip_tunnel_rcv(struct net_device *dev, struct sk_buff *skb, struct metadata_dst *tun_dst); + +#ifndef HAVE_METADATA_DST_ALLOC_WITH_METADATA_TYPE +enum metadata_type { + METADATA_IP_TUNNEL, + METADATA_HW_PORT_MUX, +}; + +static inline struct metadata_dst * +rpl_metadata_dst_alloc(u8 optslen, enum metadata_type type, gfp_t flags) +{ + return metadata_dst_alloc(optslen, flags); +} +#define metadata_dst_alloc rpl_metadata_dst_alloc +#endif + #endif /* __NET_DST_METADATA_WRAPPER_H */ |