From patchwork Mon Mar 14 11:06:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil Kovvuri X-Patchwork-Id: 8578321 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0CD3D9F54C for ; Mon, 14 Mar 2016 11:05:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 208F92041D for ; Mon, 14 Mar 2016 11:05:17 +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 37BE520412 for ; Mon, 14 Mar 2016 11:05:16 +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 1afQHo-0004sY-Sp; Mon, 14 Mar 2016 11:03:44 +0000 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1afQHZ-0004k4-QX for linux-arm-kernel@lists.infradead.org; Mon, 14 Mar 2016 11:03:31 +0000 Received: by mail-pf0-x243.google.com with SMTP id u190so9528548pfb.2 for ; Mon, 14 Mar 2016 04:03:08 -0700 (PDT) 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=4wKJ3ue8hwtLc/GWcIdMMpZ1NeUNQHUufEecyPkls4o=; b=PfV2TTqdCKxuO0w+u8UdbSDNJW+xzuSz+OSWPC7BbT1vqqwBk7kQ+UwVU+odN7vxt/ /X0vQJcQmMWuSbr+Y0xzj+Y6v/6/Tl9S4/oc4F5iMPR24f/XibtKcr2dSiuM7vIqRvWf 9pcFtXaeQtXR3G99SYuJk1U7OFttNCO1uJieqoG4fYaI+Ma/z1nJc+VNy5GeqR0HDaXM lwKzGzZeoCAkX+Cp2vNv0YiVxkLURqb+pT9Ujp/6yT2WfadGiJ52x9/zogVgdb0+8aa8 +qqb2xeRAZdtrTRC7vq2qk0qI2TRACOOEU0K7nwZzgJn3qROLwum2DeaqlUHQek09YpH EOYA== 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=4wKJ3ue8hwtLc/GWcIdMMpZ1NeUNQHUufEecyPkls4o=; b=dc9UMUzjWrM6Z1sfOp+/pQboE82oQ9ZCWN4LBmT98xshInS+ZzsjAbMeJaiiJnK4Ir tjhfAuDtnEC9YR3XLWrib62ObnIaRYAaCgxoUQQm7zkJGmX5eMjAmzxhOk+1Eo7VBS4W xV1u8q3dhnyf/kky22EukJzenK4QM6F7ejnwQppHJEg5RlIFpAoITdmkrkd4A4ohT8rU 9+K8ro+i+CboBtrl7yLPKHisChTbgFklxY8UFny7bIxod+fce6U83PMqEdUtgtyglYnp oZxOFy3+kI+E3pwPGE2VyBo85/D5OR6NTEr2NqBa2XMI1QEC/+/hqIjUh97EhPU1Q9yD 9bDQ== X-Gm-Message-State: AD7BkJLZgBqXTZziUZY1AwilN2vGhKW9ccBrRT16upgQdPqD+SKrimZZSHF3htA1PzV6Kw== X-Received: by 10.98.87.23 with SMTP id l23mr29136236pfb.101.1457953388221; Mon, 14 Mar 2016 04:03:08 -0700 (PDT) Received: from localhost.localdomain ([14.140.2.178]) by smtp.googlemail.com with ESMTPSA id a22sm31388211pfj.2.2016.03.14.04.03.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Mar 2016 04:03:07 -0700 (PDT) From: sunil.kovvuri@gmail.com To: netdev@vger.kernel.org Subject: [PATCH v2 2/2] net: thunderx: Adjust nicvf structure to reduce cache misses Date: Mon, 14 Mar 2016 16:36:15 +0530 Message-Id: <1457953578-7054-3-git-send-email-sunil.kovvuri@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1457953578-7054-1-git-send-email-sunil.kovvuri@gmail.com> References: <1457953578-7054-1-git-send-email-sunil.kovvuri@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160314_040330_023419_4E1D2DF3 X-CRM114-Status: GOOD ( 12.05 ) 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: robert.richter@caviumnetworks.com, sgoutham@cavium.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, davem@davemloft.net 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 872b22d..83025bb 100644 --- a/drivers/net/ethernet/cavium/thunder/nic.h +++ b/drivers/net/ethernet/cavium/thunder/nic.h @@ -272,46 +272,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;