From patchwork Sun Oct 1 07:57:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bodireddy, Bhanuprakash" X-Patchwork-Id: 820242 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 3y4dKD1Rnzz9t2M for ; Sun, 1 Oct 2017 19:10:56 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 2AAAF97A; Sun, 1 Oct 2017 08:08:21 +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 5EECB305 for ; Sun, 1 Oct 2017 08:08:18 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id C0FE5171 for ; Sun, 1 Oct 2017 08:08:16 +0000 (UTC) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP; 01 Oct 2017 01:08:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.42,463,1500966000"; d="scan'208"; a="1020308550" Received: from silpixa00393942.ir.intel.com (HELO silpixa00393942.ger.corp.intel.com) ([10.237.223.42]) by orsmga003.jf.intel.com with ESMTP; 01 Oct 2017 01:07:43 -0700 From: Bhanuprakash Bodireddy To: dev@openvswitch.org Date: Sun, 1 Oct 2017 08:57:37 +0100 Message-Id: <1506844660-4902-4-git-send-email-bhanuprakash.bodireddy@intel.com> X-Mailer: git-send-email 2.4.11 In-Reply-To: <1506844660-4902-1-git-send-email-bhanuprakash.bodireddy@intel.com> References: <1506844660-4902-1-git-send-email-bhanuprakash.bodireddy@intel.com> X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD autolearn=disabled version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 4/7] netdev-dpdk: Refactor netdev_dpdk structure. 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 This commit introduces below changes to netdev_dpdk structure. - Mark cachelines and reorder few member variables. - Maintain the grouping of related member variables. - Add comment on the information on pad bytes where ever appropriate, so new members can be introduced in the future to fill the gaps. Below is how this structure looks with this commit. Member size OVS_CACHE_LINE_MARKER cacheline0; dpdk_port_t port_id; 1 bool attached; 1 ... OVS_CACHE_LINE_MARKER cacheline1; struct ovs_mutex; 48 struct dpdk_mp *dpdk_mp; 8 ... Signed-off-by: Bhanuprakash Bodireddy --- lib/netdev-dpdk.c | 158 +++++++++++++++++++++++++++++------------------------- 1 file changed, 84 insertions(+), 74 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index c60f46f..d999807 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -350,80 +350,90 @@ enum dpdk_hw_ol_features { }; struct netdev_dpdk { - struct netdev up; - dpdk_port_t port_id; - int max_packet_len; - enum dpdk_dev_type type; - - struct dpdk_tx_queue *tx_q; - - struct ovs_mutex mutex OVS_ACQ_AFTER(dpdk_mutex); - - struct dpdk_mp *dpdk_mp; - int mtu; - int socket_id; - int buf_size; - struct netdev_stats stats; - /* Protects stats */ - rte_spinlock_t stats_lock; - - struct eth_addr hwaddr; - enum netdev_flags flags; - - struct rte_eth_link link; - int link_reset_cnt; - - /* virtio identifier for vhost devices */ - ovsrcu_index vid; - - /* True if vHost device is 'up' and has been reconfigured at least once */ - bool vhost_reconfigured; - - /* Identifier used to distinguish vhost devices from each other. */ - char vhost_id[PATH_MAX]; - - /* Device arguments for dpdk ports */ - char *devargs; - - /* If true, device was attached by rte_eth_dev_attach(). */ - bool attached; - - /* In dpdk_list. */ - struct ovs_list list_node OVS_GUARDED_BY(dpdk_mutex); - - /* QoS configuration and lock for the device */ - OVSRCU_TYPE(struct qos_conf *) qos_conf; - - /* The following properties cannot be changed when a device is running, - * so we remember the request and update them next time - * netdev_dpdk*_reconfigure() is called */ - int requested_mtu; - int requested_n_txq; - int requested_n_rxq; - int requested_rxq_size; - int requested_txq_size; - - /* Number of rx/tx descriptors for physical devices */ - int rxq_size; - int txq_size; - - /* Socket ID detected when vHost device is brought up */ - int requested_socket_id; - - /* Denotes whether vHost port is client/server mode */ - uint64_t vhost_driver_flags; - - /* Ingress Policer */ - OVSRCU_TYPE(struct ingress_policer *) ingress_policer; - uint32_t policer_rate; - uint32_t policer_burst; - - /* DPDK-ETH Flow control */ - struct rte_eth_fc_conf fc_conf; - - /* DPDK-ETH hardware offload features, - * from the enum set 'dpdk_hw_ol_features' */ - uint32_t hw_ol_features; + PADDED_MEMBERS_CACHELINE_MARKER(CACHE_LINE_SIZE, cacheline0, + dpdk_port_t port_id; + + /* If true, device was attached by rte_eth_dev_attach(). */ + bool attached; + struct eth_addr hwaddr; + int mtu; + int socket_id; + int buf_size; + int max_packet_len; + enum dpdk_dev_type type; + enum netdev_flags flags; + char *devargs; /* Device arguments for dpdk ports */ + struct dpdk_tx_queue *tx_q; + struct rte_eth_link link; + int link_reset_cnt; + /* 4 pad bytes here. */ + ); + + PADDED_MEMBERS_CACHELINE_MARKER(CACHE_LINE_SIZE, cacheline1, + struct ovs_mutex mutex OVS_ACQ_AFTER(dpdk_mutex); + struct dpdk_mp *dpdk_mp; + + /* virtio identifier for vhost devices */ + ovsrcu_index vid; + + /* True if vHost device is 'up' and has been reconfigured at least once */ + bool vhost_reconfigured; + /* 3 pad bytes here. */ + ); + + PADDED_MEMBERS(CACHE_LINE_SIZE, + /* Identifier used to distinguish vhost devices from each other. */ + char vhost_id[PATH_MAX]; + ); + + PADDED_MEMBERS(CACHE_LINE_SIZE, + struct netdev up; + /* In dpdk_list. */ + struct ovs_list list_node OVS_GUARDED_BY(dpdk_mutex); + + /* QoS configuration and lock for the device */ + OVSRCU_TYPE(struct qos_conf *) qos_conf; + + /* Ingress Policer */ + OVSRCU_TYPE(struct ingress_policer *) ingress_policer; + uint32_t policer_rate; + uint32_t policer_burst; + ); + + PADDED_MEMBERS(CACHE_LINE_SIZE, + struct netdev_stats stats; + /* Protects stats */ + rte_spinlock_t stats_lock; + /* 44 pad bytes here. */ + ); + + PADDED_MEMBERS(CACHE_LINE_SIZE, + /* The following properties cannot be changed when a device is running, + * so we remember the request and update them next time + * netdev_dpdk*_reconfigure() is called */ + int requested_mtu; + int requested_n_txq; + int requested_n_rxq; + int requested_rxq_size; + int requested_txq_size; + + /* Number of rx/tx descriptors for physical devices */ + int rxq_size; + int txq_size; + + /* Socket ID detected when vHost device is brought up */ + int requested_socket_id; + + /* Denotes whether vHost port is client/server mode */ + uint64_t vhost_driver_flags; + + /* DPDK-ETH Flow control */ + struct rte_eth_fc_conf fc_conf; + + /* DPDK-ETH hardware offload features, + * from the enum set 'dpdk_hw_ol_features' */ + uint32_t hw_ol_features; + ); }; struct netdev_rxq_dpdk {