From patchwork Fri Jul 21 23:46:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Stringer X-Patchwork-Id: 792418 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xDnZz2SDsz9s7m for ; Sat, 22 Jul 2017 09:50:51 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 9FF71C01; Fri, 21 Jul 2017 23:46:39 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 9D83E900 for ; Fri, 21 Jul 2017 23:46:35 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id D25BF17E for ; Fri, 21 Jul 2017 23:46:34 +0000 (UTC) Received: from mfilter14-d.gandi.net (mfilter14-d.gandi.net [217.70.178.142]) by relay4-d.mail.gandi.net (Postfix) with ESMTP id B351B172095; Sat, 22 Jul 2017 01:46:33 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter14-d.gandi.net Received: from relay4-d.mail.gandi.net ([IPv6:::ffff:217.70.183.196]) by mfilter14-d.gandi.net (mfilter14-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id RYRDIJSVxxgJ; Sat, 22 Jul 2017 01:46:32 +0200 (CEST) X-Originating-IP: 208.91.1.34 Received: from carno.eng.vmware.com (unknown [208.91.1.34]) (Authenticated sender: joe@ovn.org) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 066BC17209C; Sat, 22 Jul 2017 01:46:30 +0200 (CEST) From: Joe Stringer To: dev@openvswitch.org Date: Fri, 21 Jul 2017 16:46:10 -0700 Message-Id: <20170721234614.2800-8-joe@ovn.org> X-Mailer: git-send-email 2.11.1 In-Reply-To: <20170721234614.2800-1-joe@ovn.org> References: <20170721234614.2800-1-joe@ovn.org> X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 07/11] compat: net: store port/representator id in metadata_dst. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Upstream commit: commit 3fcece12bc1b6dcdf0986f2cd9e8f63b1f9b6aa0 Author: Jakub Kicinski 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 Signed-off-by: Sridhar Samudrala Signed-off-by: Simon Horman Signed-off-by: David S. Miller Upstream: 3fcece12bc1b ("net: store port/representator id in metadata_dst") Signed-off-by: Joe Stringer --- acinclude.m4 | 3 +++ datapath/flow_netlink.c | 4 +++- datapath/linux/compat/include/net/dst_metadata.h | 15 +++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/acinclude.m4 b/acinclude.m4 index d72e13cd6c73..fce052477001 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -719,6 +719,9 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ OVS_GREP_IFELSE([$KSRC/include/linux/if_vlan.h], [skb_vlan_tagged]) OVS_GREP_IFELSE([$KSRC/include/linux/if_vlan.h], [eth_type_vlan]) + OVS_FIND_PARAM_IFELSE([$KSRC/include/net/dst_metadata.h], + [metadata_dst_alloc], [metadata_type]) + OVS_GREP_IFELSE([$KSRC/include/linux/u64_stats_sync.h], [u64_stats_fetch_begin_irq]) OVS_GREP_IFELSE([$KSRC/include/net/vxlan.h], [struct vxlan_metadata], diff --git a/datapath/flow_netlink.c b/datapath/flow_netlink.c index 07ab8e9a40b6..9b4861250b5a 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 279b7144bd17..e401eb400925 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 */