From patchwork Tue Apr 2 14:57:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eli Britstein X-Patchwork-Id: 1074543 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=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=mellanox.com 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 44YXQh29cHz9sTX for ; Wed, 3 Apr 2019 01:58:36 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 9165FDE0; Tue, 2 Apr 2019 14:57:35 +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 3A35CE2F for ; Tue, 2 Apr 2019 14:57:34 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by smtp1.linuxfoundation.org (Postfix) with ESMTP id 478986E0 for ; Tue, 2 Apr 2019 14:57:33 +0000 (UTC) Received: from Internal Mail-Server by MTLPINE1 (envelope-from elibr@mellanox.com) with ESMTPS (AES256-SHA encrypted); 2 Apr 2019 17:57:31 +0300 Received: from dev-r-vrt-214.mtr.labs.mlnx. (dev-r-vrt-214.mtr.labs.mlnx [10.212.214.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x32EvNDl025807; Tue, 2 Apr 2019 17:57:31 +0300 From: Eli Britstein To: dev@openvswitch.org Date: Tue, 2 Apr 2019 14:57:07 +0000 Message-Id: <20190402145712.7290-2-elibr@mellanox.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190402145712.7290-1-elibr@mellanox.com> References: <20190402145712.7290-1-elibr@mellanox.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Oz Shlomo , Simon Horman , Eli Britstein Subject: [ovs-dev] [PATCH 1/6] netdev: Introduce peer port name as a netdevice class property 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 Currently peer port is defined as a patch port property. However, peer ports can be used as generic netdevice property to accelerate peer ports forwarding. Introduce a generic method for retreiving peer port name. Signed-off-by: Eli Britstein Reviewed-by: Oz Shlomo --- lib/netdev-provider.h | 6 ++++++ lib/netdev.c | 13 +++++++++++++ lib/netdev.h | 1 + 3 files changed, 20 insertions(+) diff --git a/lib/netdev-provider.h b/lib/netdev-provider.h index fb0c27e6e..967760fb3 100644 --- a/lib/netdev-provider.h +++ b/lib/netdev-provider.h @@ -775,6 +775,12 @@ struct netdev_class { * used to send and receive packets until a successful configuration is * applied. */ int (*reconfigure)(struct netdev *netdev); + + /* If the netdev class of 'netdev' supports peer option, returns the name + * of its peer as a malloc()'d string that the caller must free. + * + * If peer is not supported, returns NULL. */ + char *(*get_peer_name)(const struct netdev *netdev); /* ## -------------------- ## */ /* ## netdev_rxq Functions ## */ /* ## -------------------- ## */ diff --git a/lib/netdev.c b/lib/netdev.c index 7d7ecf6f0..c6b9c7e96 100644 --- a/lib/netdev.c +++ b/lib/netdev.c @@ -913,6 +913,19 @@ netdev_get_name(const struct netdev *netdev) return netdev->name; } +char * +netdev_get_peer_name(const struct netdev *netdev) +{ + const struct netdev_class *class = netdev->netdev_class; + char *peer = NULL; + + if (class->get_peer_name) { + peer = class->get_peer_name(netdev); + } + + return peer; +} + /* Retrieves the MTU of 'netdev'. The MTU is the maximum size of transmitted * (and received) packets, in bytes, not including the hardware header; thus, * this is typically 1500 bytes for Ethernet devices. diff --git a/lib/netdev.h b/lib/netdev.h index d94817fb6..d65b1ffcf 100644 --- a/lib/netdev.h +++ b/lib/netdev.h @@ -170,6 +170,7 @@ int netdev_get_numa_id(const struct netdev *); /* Basic properties. */ const char *netdev_get_name(const struct netdev *); +char *netdev_get_peer_name(const struct netdev *); const char *netdev_get_type(const struct netdev *); const char *netdev_get_type_from_name(const char *); int netdev_get_mtu(const struct netdev *, int *mtup); From patchwork Tue Apr 2 14:57:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eli Britstein X-Patchwork-Id: 1074544 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=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=mellanox.com 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 44YXR806bmz9sTb for ; Wed, 3 Apr 2019 01:59:00 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 36106E39; Tue, 2 Apr 2019 14:57:41 +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 BB399E39 for ; Tue, 2 Apr 2019 14:57:39 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by smtp1.linuxfoundation.org (Postfix) with ESMTP id BCA63712 for ; Tue, 2 Apr 2019 14:57:38 +0000 (UTC) Received: from Internal Mail-Server by MTLPINE1 (envelope-from elibr@mellanox.com) with ESMTPS (AES256-SHA encrypted); 2 Apr 2019 17:57:33 +0300 Received: from dev-r-vrt-214.mtr.labs.mlnx. (dev-r-vrt-214.mtr.labs.mlnx [10.212.214.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x32EvNDm025807; Tue, 2 Apr 2019 17:57:33 +0300 From: Eli Britstein To: dev@openvswitch.org Date: Tue, 2 Apr 2019 14:57:08 +0000 Message-Id: <20190402145712.7290-3-elibr@mellanox.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190402145712.7290-1-elibr@mellanox.com> References: <20190402145712.7290-1-elibr@mellanox.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Oz Shlomo , Simon Horman , Eli Britstein Subject: [ovs-dev] [PATCH 2/6] netdev-vport: Use generic peer port name API for patch ports 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 Replace specific patch port API for retreiving peer port name with the generic netdev API. Signed-off-by: Eli Britstein Reviewed-by: Oz Shlomo --- lib/netdev-vport.c | 40 ++++++++++++++++------------------------ lib/netdev-vport.h | 2 -- ofproto/ofproto-dpif.c | 6 +++--- 3 files changed, 19 insertions(+), 29 deletions(-) diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c index 808a43f99..14b3e5c82 100644 --- a/lib/netdev-vport.c +++ b/lib/netdev-vport.c @@ -964,30 +964,6 @@ get_tunnel_config(const struct netdev *dev, struct smap *args) return 0; } - -/* Code specific to patch ports. */ - -/* If 'netdev' is a patch port, returns the name of its peer as a malloc()'d - * string that the caller must free. - * - * If 'netdev' is not a patch port, returns NULL. */ -char * -netdev_vport_patch_peer(const struct netdev *netdev_) -{ - char *peer = NULL; - - if (netdev_vport_is_patch(netdev_)) { - struct netdev_vport *netdev = netdev_vport_cast(netdev_); - - ovs_mutex_lock(&netdev->mutex); - if (netdev->peer) { - peer = xstrdup(netdev->peer); - } - ovs_mutex_unlock(&netdev->mutex); - } - - return peer; -} void netdev_vport_inc_rx(const struct netdev *netdev, @@ -1067,6 +1043,21 @@ set_patch_config(struct netdev *dev_, const struct smap *args, char **errp) return 0; } +static char * +get_patch_peer_name(const struct netdev *netdev_) +{ + struct netdev_vport *netdev = netdev_vport_cast(netdev_); + char *peer = NULL; + + ovs_mutex_lock(&netdev->mutex); + if (netdev->peer) { + peer = xstrdup(netdev->peer); + } + ovs_mutex_unlock(&netdev->mutex); + + return peer; +} + static int netdev_vport_get_stats(const struct netdev *netdev, struct netdev_stats *stats) { @@ -1241,6 +1232,7 @@ netdev_vport_patch_register(void) .type = "patch", .get_config = get_patch_config, .set_config = set_patch_config, + .get_peer_name = get_patch_peer_name, }, {{NULL, NULL, 0, 0}} }; diff --git a/lib/netdev-vport.h b/lib/netdev-vport.h index 9d756a265..c60569971 100644 --- a/lib/netdev-vport.h +++ b/lib/netdev-vport.h @@ -32,8 +32,6 @@ void netdev_vport_patch_register(void); bool netdev_vport_is_patch(const struct netdev *); -char *netdev_vport_patch_peer(const struct netdev *netdev); - void netdev_vport_inc_rx(const struct netdev *, const struct dpif_flow_stats *); void netdev_vport_inc_tx(const struct netdev *, diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index f0d387ccd..5eddc507c 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -3526,7 +3526,7 @@ ofport_update_peer(struct ofport_dpif *ofport) ofport->peer = NULL; } - peer_name = netdev_vport_patch_peer(ofport->up.netdev); + peer_name = netdev_get_peer_name(ofport->up.netdev); if (!peer_name) { return; } @@ -3547,7 +3547,7 @@ ofport_update_peer(struct ofport_dpif *ofport) } peer = ofport_dpif_cast(peer_ofport); - peer_peer = netdev_vport_patch_peer(peer->up.netdev); + peer_peer = netdev_get_peer_name(peer->up.netdev); if (peer_peer && !strcmp(netdev_get_name(ofport->up.netdev), peer_peer)) { ofport->peer = peer; @@ -3777,7 +3777,7 @@ vport_get_status(const struct ofport *ofport_, char **errp) return 0; } - peer_name = netdev_vport_patch_peer(ofport->up.netdev); + peer_name = netdev_get_peer_name(ofport->up.netdev); if (!peer_name) { return 0; } From patchwork Tue Apr 2 14:57:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eli Britstein X-Patchwork-Id: 1074545 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=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=mellanox.com 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 44YXRg3dRsz9sTX for ; Wed, 3 Apr 2019 01:59:26 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id D7295EA1; Tue, 2 Apr 2019 14:57:45 +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 A979CE67 for ; Tue, 2 Apr 2019 14:57:44 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by smtp1.linuxfoundation.org (Postfix) with ESMTP id B2AC3712 for ; Tue, 2 Apr 2019 14:57:43 +0000 (UTC) Received: from Internal Mail-Server by MTLPINE1 (envelope-from elibr@mellanox.com) with ESMTPS (AES256-SHA encrypted); 2 Apr 2019 17:57:34 +0300 Received: from dev-r-vrt-214.mtr.labs.mlnx. (dev-r-vrt-214.mtr.labs.mlnx [10.212.214.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x32EvNDn025807; Tue, 2 Apr 2019 17:57:34 +0300 From: Eli Britstein To: dev@openvswitch.org Date: Tue, 2 Apr 2019 14:57:09 +0000 Message-Id: <20190402145712.7290-4-elibr@mellanox.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190402145712.7290-1-elibr@mellanox.com> References: <20190402145712.7290-1-elibr@mellanox.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Oz Shlomo , Simon Horman , Eli Britstein Subject: [ovs-dev] [PATCH 3/6] ofproto-dpif: Use peer port as a generic netdev property 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 Use peer port as a generic netdev property instead of a specific patch-port property. Signed-off-by: Eli Britstein Reviewed-by: Oz Shlomo --- ofproto/ofproto-dpif.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 5eddc507c..cad7f6dda 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -1856,6 +1856,7 @@ port_construct(struct ofport *port_) port->qdscp = NULL; port->n_qdscp = 0; port->carrier_seq = netdev_get_carrier_resets(netdev); + ofport_update_peer(port); if (netdev_vport_is_patch(netdev)) { /* By bailing out here, we don't submit the port to the sFlow module @@ -1864,7 +1865,6 @@ port_construct(struct ofport *port_) * to be "internal" to the switch as a whole, and therefore not a * candidate for counter polling. */ port->odp_port = ODPP_NONE; - ofport_update_peer(port); return 0; } @@ -3514,10 +3514,6 @@ ofport_update_peer(struct ofport_dpif *ofport) struct dpif_backer *backer; char *peer_name; - if (!netdev_vport_is_patch(ofport->up.netdev)) { - return; - } - backer = ofproto_dpif_cast(ofport->up.ofproto)->backer; backer->need_revalidate = REV_RECONFIGURE; From patchwork Tue Apr 2 14:57:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eli Britstein X-Patchwork-Id: 1074547 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=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=mellanox.com 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 44YXSr5hJvz9sTX for ; Wed, 3 Apr 2019 02:00:28 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 58CA5EB9; Tue, 2 Apr 2019 14:57:47 +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 C7D16E9E for ; Tue, 2 Apr 2019 14:57:45 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by smtp1.linuxfoundation.org (Postfix) with ESMTP id CBA497A6 for ; Tue, 2 Apr 2019 14:57:43 +0000 (UTC) Received: from Internal Mail-Server by MTLPINE1 (envelope-from elibr@mellanox.com) with ESMTPS (AES256-SHA encrypted); 2 Apr 2019 17:57:35 +0300 Received: from dev-r-vrt-214.mtr.labs.mlnx. (dev-r-vrt-214.mtr.labs.mlnx [10.212.214.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x32EvNDo025807; Tue, 2 Apr 2019 17:57:35 +0300 From: Eli Britstein To: dev@openvswitch.org Date: Tue, 2 Apr 2019 14:57:10 +0000 Message-Id: <20190402145712.7290-5-elibr@mellanox.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190402145712.7290-1-elibr@mellanox.com> References: <20190402145712.7290-1-elibr@mellanox.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Oz Shlomo , Simon Horman , Eli Britstein Subject: [ovs-dev] [PATCH 4/6] netdev-dpdk: Introduce peer name property for dpdk ports 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 Introduce peer name property for dpdk ports, as a pre-step towards accelarating peer port forwarding. Signed-off-by: Eli Britstein Reviewed-by: Oz Shlomo --- lib/netdev-dpdk.c | 55 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 3 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 67df3fc1a..8e02c37e4 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -430,7 +430,9 @@ struct netdev_dpdk { struct netdev_stats stats; /* Protects stats */ rte_spinlock_t stats_lock; - /* 44 pad bytes here. */ + /* 4 pad bytes here. */ + char *peer; + /* 32 pad bytes here. */ ); PADDED_MEMBERS(CACHE_LINE_SIZE, @@ -1622,6 +1624,9 @@ netdev_dpdk_get_config(const struct netdev *netdev, struct smap *args) smap_add(args, "lsc_interrupt_mode", dev->lsc_interrupt_mode ? "true" : "false"); } + if (dev->peer) { + smap_add(args, "peer", dev->peer); + } ovs_mutex_unlock(&dev->mutex); return 0; @@ -1759,6 +1764,27 @@ dpdk_process_queue_size(struct netdev *netdev, const struct smap *args, } } +static int +netdev_dpdk_set_peer_config(struct netdev *netdev, const struct smap *args) +{ + struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); + const char *name = netdev_get_name(netdev); + const char *peer; + int err = 0; + + peer = smap_get(args, "peer"); + if (!strcmp(name, peer)) { + VLOG_ERR("%s: dpdk peer must not be self", name); + err = EINVAL; + } + if (!dev->peer || strcmp(dev->peer, peer)) { + free(dev->peer); + dev->peer = xstrdup(peer); + } + + return err; +} + static int netdev_dpdk_set_config(struct netdev *netdev, const struct smap *args, char **errp) @@ -1841,6 +1867,11 @@ netdev_dpdk_set_config(struct netdev *netdev, const struct smap *args, goto out; } + err = netdev_dpdk_set_peer_config(netdev, args); + if (err) { + goto out; + } + lsc_interrupt_mode = smap_get_bool(args, "dpdk-lsc-interrupt", false); if (dev->requested_lsc_interrupt_mode != lsc_interrupt_mode) { dev->requested_lsc_interrupt_mode = lsc_interrupt_mode; @@ -1891,6 +1922,7 @@ netdev_dpdk_vhost_client_set_config(struct netdev *netdev, { struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); const char *path; + int err; ovs_mutex_lock(&dev->mutex); if (!(dev->vhost_driver_flags & RTE_VHOST_USER_CLIENT)) { @@ -1906,9 +1938,10 @@ netdev_dpdk_vhost_client_set_config(struct netdev *netdev, netdev_request_reconfigure(netdev); } } + err = netdev_dpdk_set_peer_config(netdev, args); ovs_mutex_unlock(&dev->mutex); - return 0; + return err; } static int @@ -4229,6 +4262,21 @@ netdev_dpdk_rte_flow_create(struct netdev *netdev, return flow; } +static char * +get_dpdk_peer_name(const struct netdev *netdev) +{ + struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); + char *peer = NULL; + + ovs_mutex_lock(&dev->mutex); + if (dev->peer) { + peer = xstrdup(dev->peer); + } + ovs_mutex_unlock(&dev->mutex); + + return peer; +} + #define NETDEV_DPDK_CLASS_COMMON \ .is_pmd = true, \ .alloc = netdev_dpdk_alloc, \ @@ -4250,7 +4298,8 @@ netdev_dpdk_rte_flow_create(struct netdev *netdev, .rxq_alloc = netdev_dpdk_rxq_alloc, \ .rxq_construct = netdev_dpdk_rxq_construct, \ .rxq_destruct = netdev_dpdk_rxq_destruct, \ - .rxq_dealloc = netdev_dpdk_rxq_dealloc + .rxq_dealloc = netdev_dpdk_rxq_dealloc, \ + .get_peer_name = get_dpdk_peer_name #define NETDEV_DPDK_CLASS_BASE \ NETDEV_DPDK_CLASS_COMMON, \ From patchwork Tue Apr 2 14:57:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eli Britstein X-Patchwork-Id: 1074546 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=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=mellanox.com 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 44YXS96sD9z9sTX for ; Wed, 3 Apr 2019 01:59:53 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 7C55DEB8; Tue, 2 Apr 2019 14:57:46 +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 CB99DE67 for ; Tue, 2 Apr 2019 14:57:44 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by smtp1.linuxfoundation.org (Postfix) with ESMTP id CCFC17C3 for ; Tue, 2 Apr 2019 14:57:43 +0000 (UTC) Received: from Internal Mail-Server by MTLPINE1 (envelope-from elibr@mellanox.com) with ESMTPS (AES256-SHA encrypted); 2 Apr 2019 17:57:36 +0300 Received: from dev-r-vrt-214.mtr.labs.mlnx. (dev-r-vrt-214.mtr.labs.mlnx [10.212.214.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x32EvNDp025807; Tue, 2 Apr 2019 17:57:36 +0300 From: Eli Britstein To: dev@openvswitch.org Date: Tue, 2 Apr 2019 14:57:11 +0000 Message-Id: <20190402145712.7290-6-elibr@mellanox.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190402145712.7290-1-elibr@mellanox.com> References: <20190402145712.7290-1-elibr@mellanox.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Oz Shlomo , Simon Horman , Eli Britstein Subject: [ovs-dev] [PATCH 5/6] ofproto-dpif: Introduce peer port netdev as a netdev property 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 If a netdev has a peer port configured, keep the peer netdev handler in the configured netdev, as a pre-step towards accelerating peer ports forwarding. Signed-off-by: Eli Britstein Reviewed-by: Oz Shlomo --- lib/netdev-provider.h | 1 + lib/netdev.c | 5 +++++ lib/netdev.h | 1 + ofproto/ofproto-dpif.c | 2 ++ 4 files changed, 9 insertions(+) diff --git a/lib/netdev-provider.h b/lib/netdev-provider.h index 967760fb3..18a1f2183 100644 --- a/lib/netdev-provider.h +++ b/lib/netdev-provider.h @@ -94,6 +94,7 @@ struct netdev { struct shash_node *node; /* Pointer to element in global map. */ struct ovs_list saved_flags_list; /* Contains "struct netdev_saved_flags". */ struct netdev_hw_info hw_info; /* offload-capable netdev info */ + struct netdev *peer; /* peer netdev if exists */ }; static inline void diff --git a/lib/netdev.c b/lib/netdev.c index c6b9c7e96..577c87d55 100644 --- a/lib/netdev.c +++ b/lib/netdev.c @@ -926,6 +926,11 @@ netdev_get_peer_name(const struct netdev *netdev) return peer; } +void netdev_set_peer_netdev(struct netdev *netdev, struct netdev *peer_netdev) +{ + netdev->peer = peer_netdev; +} + /* Retrieves the MTU of 'netdev'. The MTU is the maximum size of transmitted * (and received) packets, in bytes, not including the hardware header; thus, * this is typically 1500 bytes for Ethernet devices. diff --git a/lib/netdev.h b/lib/netdev.h index d65b1ffcf..05e36c304 100644 --- a/lib/netdev.h +++ b/lib/netdev.h @@ -171,6 +171,7 @@ int netdev_get_numa_id(const struct netdev *); /* Basic properties. */ const char *netdev_get_name(const struct netdev *); char *netdev_get_peer_name(const struct netdev *); +void netdev_set_peer_netdev(struct netdev *, struct netdev *); const char *netdev_get_type(const struct netdev *); const char *netdev_get_type_from_name(const char *); int netdev_get_mtu(const struct netdev *, int *mtup); diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index cad7f6dda..4ffb25b42 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -3548,6 +3548,8 @@ ofport_update_peer(struct ofport_dpif *ofport) peer_peer)) { ofport->peer = peer; ofport->peer->peer = ofport; + netdev_set_peer_netdev(ofport->up.netdev, peer->up.netdev); + netdev_set_peer_netdev(peer->up.netdev, ofport->up.netdev); } free(peer_peer); From patchwork Tue Apr 2 14:57:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eli Britstein X-Patchwork-Id: 1074548 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=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=mellanox.com 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 44YXTN3DS8z9sTX for ; Wed, 3 Apr 2019 02:00:56 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 01AEEECC; Tue, 2 Apr 2019 14:57:48 +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 197FCE97 for ; Tue, 2 Apr 2019 14:57:46 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by smtp1.linuxfoundation.org (Postfix) with ESMTP id E46897F8 for ; Tue, 2 Apr 2019 14:57:43 +0000 (UTC) Received: from Internal Mail-Server by MTLPINE1 (envelope-from elibr@mellanox.com) with ESMTPS (AES256-SHA encrypted); 2 Apr 2019 17:57:38 +0300 Received: from dev-r-vrt-214.mtr.labs.mlnx. (dev-r-vrt-214.mtr.labs.mlnx [10.212.214.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x32EvNDq025807; Tue, 2 Apr 2019 17:57:38 +0300 From: Eli Britstein To: dev@openvswitch.org Date: Tue, 2 Apr 2019 14:57:12 +0000 Message-Id: <20190402145712.7290-7-elibr@mellanox.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190402145712.7290-1-elibr@mellanox.com> References: <20190402145712.7290-1-elibr@mellanox.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Oz Shlomo , Simon Horman , Eli Britstein Subject: [ovs-dev] [PATCH 6/6] dpif-netdev: Accelerate peer port forwarding by bypassing DP processing 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 Packet parsing and rule matching introduce a large processing overhead for simple port-to-port forwarding scenarios. Accelerate port-to-port forwarding by bypassing the datapath packet processing if a peer-port property is defined. Signed-off-by: Eli Britstein Reviewed-by: Oz Shlomo --- lib/dpif-netdev.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 4d6d0c372..7751805ef 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -759,7 +759,8 @@ static void dp_netdev_execute_actions(struct dp_netdev_pmd_thread *pmd, const struct nlattr *actions, size_t actions_len); static void dp_netdev_input(struct dp_netdev_pmd_thread *, - struct dp_packet_batch *, odp_port_t port_no); + struct dp_packet_batch *, odp_port_t port_no, + struct netdev_rxq *); static void dp_netdev_recirculate(struct dp_netdev_pmd_thread *, struct dp_packet_batch *); @@ -4271,7 +4272,7 @@ dp_netdev_process_rxq_port(struct dp_netdev_pmd_thread *pmd, } } /* Process packet batch. */ - dp_netdev_input(pmd, &batch, port_no); + dp_netdev_input(pmd, &batch, port_no, rxq->rx); /* Assign processing cycles to rx queue. */ cycles = cycle_timer_stop(&pmd->perf_stats, &timer); @@ -6766,9 +6767,17 @@ dp_netdev_input__(struct dp_netdev_pmd_thread *pmd, static void dp_netdev_input(struct dp_netdev_pmd_thread *pmd, struct dp_packet_batch *packets, - odp_port_t port_no) + odp_port_t port_no, + struct netdev_rxq *rxq) { - dp_netdev_input__(pmd, packets, false, port_no); + if (!rxq->netdev->peer) { + dp_netdev_input__(pmd, packets, false, port_no); + } else { + /* Bypassing standard DP processing and forward the packets directly + * to its peer port */ + netdev_send(rxq->netdev->peer, rxq->queue_id, packets, true); + packets->count = 0; + } } static void