From patchwork Mon Mar 7 07:35:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil Kovvuri X-Patchwork-Id: 8515921 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3E0B9C0554 for ; Mon, 7 Mar 2016 07:34:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6DF6C20121 for ; Mon, 7 Mar 2016 07:34:46 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8311120142 for ; Mon, 7 Mar 2016 07:34:45 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1acpfL-0007ma-UY; Mon, 07 Mar 2016 07:33:19 +0000 Received: from mail-pf0-x244.google.com ([2607:f8b0:400e:c00::244]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1acpfA-0007Vs-Vs for linux-arm-kernel@lists.infradead.org; Mon, 07 Mar 2016 07:33:10 +0000 Received: by mail-pf0-x244.google.com with SMTP id 184so7598851pff.1 for ; Sun, 06 Mar 2016 23:32:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wEh5LRZk80Wy42PHpX7rRdl7Kq09CIZdnqyhlG7AwdA=; b=JBrciwN78IN562mMS3bqT6CTXdK6dvyJo4qaAAb/crZ7I/1mMIi/rauLe/7JK1ES8l jcPZdRIrhSAC1Q6tQCGTN7+xSziU4nFyxksaTo5efqN2ScT2YIgf3HmnQl4AMqvFZHL4 0LHjlQ8HdosJInlOQ3qYnSYseGAQuyMg9fkxEnP5UCWqaKZ/Wm+bZszt5FWU5w/mr82t 5hBtcYN6QW244HvB3+XikRWSJzDHhHcC/AzW/xi9wH/mQ7bS0KrdFGC0ThfWf+K1Wg0v 9FiG5LUaTClfqCryb1wEGBsW8pC+ZIa3QCGTBKtdq/I//GYoqGcJVGDcbVZ5+33vHXx5 BVHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wEh5LRZk80Wy42PHpX7rRdl7Kq09CIZdnqyhlG7AwdA=; b=UDv8kIj26/rkx5af4C9G15cef3hs1Rnu5QtRcy0+JPPrT3yzcdN8McYjGilb3Tmhop YPu9NPnBDUxWNrcsjl/u/c608KxPgUKVHSL9JUHD8g4ELojmnx+PCbkzaIyI5zy+aWBa 3NjGQ1qFSbqrRfHTpWeEO+NaSJM0nuTQsztdSP4mmfILyK1M9xcPLZymZHWA39hLzkz5 UVlsFjom78ThgLba8RQOAiL+T0kggG2Np+aSMXNekAQqMpbBGj4RAzZBZfDMB1srcoZG ShePo3aExrIHwebMopdrAqeMMOmwZOmNsm0GJYyREKVpC7+lhIy2IGUaVSL1YMNDApes zdHQ== X-Gm-Message-State: AD7BkJLlhij3ZGI0xu6p1K01G3YsERnvq8+0icZ6xvAJGQ01bgiZ/MLYf5qui1ep08D3Ww== X-Received: by 10.98.76.216 with SMTP id e85mr2147999pfj.121.1457335968256; Sun, 06 Mar 2016 23:32:48 -0800 (PST) Received: from localhost.localdomain ([14.140.2.178]) by smtp.googlemail.com with ESMTPSA id wq3sm1742292pac.44.2016.03.06.23.32.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 06 Mar 2016 23:32:47 -0800 (PST) From: sunil.kovvuri@gmail.com To: netdev@vger.kernel.org Subject: [PATCH 2/2] net: thunderx: Adjust nicvf structure to reduce cache misses Date: Mon, 7 Mar 2016 13:05:57 +0530 Message-Id: <1457336157-31508-3-git-send-email-sunil.kovvuri@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1457336157-31508-1-git-send-email-sunil.kovvuri@gmail.com> References: <1457336157-31508-1-git-send-email-sunil.kovvuri@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160306_233309_314831_9F52BB43 X-CRM114-Status: GOOD ( 11.55 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sgoutham@cavium.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, robert.richter@caviumnetworks.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sunil Goutham Adjusted nicvf structure such that all elements used in hot path like napi, xmit e.t.c fall into same cache line. This reduced no of cache misses and resulted in ~2% increase in no of packets handled on a core. Also modified elements with :1 notation to boolean, to be consistent with other element definitions. Signed-off-by: Sunil Goutham --- drivers/net/ethernet/cavium/thunder/nic.h | 52 ++++++++++++++++------------ 1 files changed, 30 insertions(+), 22 deletions(-) diff --git a/drivers/net/ethernet/cavium/thunder/nic.h b/drivers/net/ethernet/cavium/thunder/nic.h index 5628aea..c063d92 100644 --- a/drivers/net/ethernet/cavium/thunder/nic.h +++ b/drivers/net/ethernet/cavium/thunder/nic.h @@ -263,46 +263,54 @@ struct nicvf { struct nicvf *pnicvf; struct net_device *netdev; struct pci_dev *pdev; + void __iomem *reg_base; + struct queue_set *qs; + struct nicvf_cq_poll *napi[8]; u8 vf_id; - u8 node; - u8 tns_mode:1; - u8 sqs_mode:1; - u8 loopback_supported:1; + u8 sqs_id; + bool sqs_mode; bool hw_tso; - u16 mtu; - struct queue_set *qs; + + /* Receive buffer alloc */ + u32 rb_page_offset; + u16 rb_pageref; + bool rb_alloc_fail; + bool rb_work_scheduled; + struct page *rb_page; + struct delayed_work rbdr_work; + struct tasklet_struct rbdr_task; + + /* Secondary Qset */ + u8 sqs_count; #define MAX_SQS_PER_VF_SINGLE_NODE 5 #define MAX_SQS_PER_VF 11 - u8 sqs_id; - u8 sqs_count; /* Secondary Qset count */ struct nicvf *snicvf[MAX_SQS_PER_VF]; + + /* Queue count */ u8 rx_queues; u8 tx_queues; u8 max_queues; - void __iomem *reg_base; + + u8 node; + u8 cpi_alg; + u16 mtu; bool link_up; u8 duplex; u32 speed; - struct page *rb_page; - u32 rb_page_offset; - u16 rb_pageref; - bool rb_alloc_fail; - bool rb_work_scheduled; - struct delayed_work rbdr_work; - struct tasklet_struct rbdr_task; - struct tasklet_struct qs_err_task; - struct tasklet_struct cq_task; - struct nicvf_cq_poll *napi[8]; + bool tns_mode; + bool loopback_supported; struct nicvf_rss_info rss_info; - u8 cpi_alg; + struct tasklet_struct qs_err_task; + struct work_struct reset_task; + /* Interrupt coalescing settings */ u32 cq_coalesce_usecs; - u32 msg_enable; + + /* Stats */ struct nicvf_hw_stats hw_stats; struct nicvf_drv_stats drv_stats; struct bgx_stats bgx_stats; - struct work_struct reset_task; /* MSI-X */ bool msix_enabled;