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);