From patchwork Tue May 2 13:06:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil Kovvuri X-Patchwork-Id: 9707973 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 46FEA60245 for ; Tue, 2 May 2017 13:08:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 38D7628448 for ; Tue, 2 May 2017 13:08:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2DA6C2844B; Tue, 2 May 2017 13:08:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CE76728448 for ; Tue, 2 May 2017 13:08:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=paw2DIdVL60qrhXnD+4S2XLhIVsRav2FSiOK1lOimPU=; b=TLGjvuDWLOhGnyo1pnXsDnZKB7 /26hNxZ7FPI825+Wmy5WrzTWV/R3PEYBdmFWCII+CQx45uP6XuMpPMULLRctI7a4Iaky9GjAfweJc qefsUXWB39K6JEKrg4s3bGZZnrPcoDV5tg8WbkoebniXd1gG1yhFXXPZwWhUBR9OTqwZ+BJGZ0+Vu pSJ97j2SaHjgJ2/w/jnHoLwubQnQQ3xzlMwW7i0Ck+5sOF5RDuK39O/c+a2PhfpVLWPIF4oaN+KIp uWoIxNHGwfldG2pKh78Kw86K7RRzZcZ00K9LjffDq1rOXHZAB6B8O1fZVrh3iMMiZS6Y5v2UbcqCa aJdDX11g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1d5XXF-0005cs-6j; Tue, 02 May 2017 13:08:09 +0000 Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d5XWy-00059R-0y for linux-arm-kernel@lists.infradead.org; Tue, 02 May 2017 13:07:53 +0000 Received: by mail-pg0-x242.google.com with SMTP id i63so2688032pgd.2 for ; Tue, 02 May 2017 06:07:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PrtBppn1XfY25SO8d5rybrl8c307Nv0iplg8e7VHEVM=; b=DhTFkx/TeW8GL0tHVn6LwrwTLN4263n/vt5NonPVt7xoIR1xbKDsXQBkLgBOWk4yvj Z66m9OVxqYmBFad6inFiXXbn9HFPi45CvAVKZYAfHU0F7Hx4jHZF7PNIuYHOUORP/jUq Uts7FoRgRls2gamDlMJ36cyTFIEA/uiKdk8dQvxOWFR0g9SIKORHli8sYgoRS/thbRgg uT9WW4MxQaJQdv7teEfD7E5JCv2mNMSAhmBzEw9SPTw2yhEosPzDuinJa81fI5wMOJ9u BByWZsuLkfrPxCUGjFAVtLYxWfSbzc/L+IeHkX49NBbvIYBAutRVBBFIoPahIA25OvkB PjZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PrtBppn1XfY25SO8d5rybrl8c307Nv0iplg8e7VHEVM=; b=mOZ5VyHNUNBlDzxXzAQnQCSKji98Kfy25Sf0oHzl8qd50CLubBFJgASo2/muOaquT2 eQ7UmaeQ/rngl5Rd9XruFACHCOrqBQXcjGyKTeYJwBUk6cPRk6GgyvmWmhZRBUPt4EqG wOUSme35tPGx3qvr0hlNwzAUmSZH0SQ51mReJBZXwB6a5PqAN8sROVjPo8Y4qA7MkP8N CEL103IGCetsSLzrHHV+6lALaBI/ajXhAKsHOQilTHTYboOe6iurBigKDXvldPXp5Dog wE/WqdEDgEW1mvtvWq/6hAj4cDmDgfESedSE16VB+NZCkMhp0NHNhmmp4CECtEiyJKHE ns3g== X-Gm-Message-State: AN3rC/6n4IlWuqDmQqkwX+mWTxNK9lzSALygYwtRyFeVpvtDhJhu1+u9 SOpT2hwbO5hDAg== X-Received: by 10.98.99.135 with SMTP id x129mr23585955pfb.4.1493730451293; Tue, 02 May 2017 06:07:31 -0700 (PDT) Received: from machine421.in.caveonetworks.com ([14.140.2.178]) by smtp.googlemail.com with ESMTPSA id k198sm24610689pga.54.2017.05.02.06.07.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 May 2017 06:07:30 -0700 (PDT) From: sunil.kovvuri@gmail.com To: netdev@vger.kernel.org Subject: [PATCH 2/9] net: thunderx: Optimize RBDR descriptor handling Date: Tue, 2 May 2017 18:36:51 +0530 Message-Id: <1493730418-24606-3-git-send-email-sunil.kovvuri@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493730418-24606-1-git-send-email-sunil.kovvuri@gmail.com> References: <1493730418-24606-1-git-send-email-sunil.kovvuri@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170502_060752_147627_8A3BE2FD X-CRM114-Status: GOOD ( 11.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sunil Goutham , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sunil Goutham Receive buffer's physical address or iova will anyway not go beyond 49bits, since it is the max supported HW address. As per perf, updating bitfields i.e buf_addr:42 in RBDR descriptor entry consumes lots of cpu cycles, hence changed it to a 64bit field with alignment requirements taken care of. Signed-off-by: Sunil Goutham --- drivers/net/ethernet/cavium/thunder/nicvf_queues.c | 8 ++++---- drivers/net/ethernet/cavium/thunder/q_struct.h | 10 +--------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c index 12f9709..dfc85a1 100644 --- a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c +++ b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c @@ -257,7 +257,7 @@ static int nicvf_init_rbdr(struct nicvf *nic, struct rbdr *rbdr, } desc = GET_RBDR_DESC(rbdr, idx); - desc->buf_addr = (u64)rbuf >> NICVF_RCV_BUF_ALIGN; + desc->buf_addr = (u64)rbuf & ~(NICVF_RCV_BUF_ALIGN_BYTES - 1); } nicvf_get_page(nic); @@ -286,7 +286,7 @@ static void nicvf_free_rbdr(struct nicvf *nic, struct rbdr *rbdr) /* Release page references */ while (head != tail) { desc = GET_RBDR_DESC(rbdr, head); - buf_addr = ((u64)desc->buf_addr) << NICVF_RCV_BUF_ALIGN; + buf_addr = desc->buf_addr; phys_addr = nicvf_iova_to_phys(nic, buf_addr); dma_unmap_page_attrs(&nic->pdev->dev, buf_addr, RCV_FRAG_LEN, DMA_FROM_DEVICE, DMA_ATTR_SKIP_CPU_SYNC); @@ -297,7 +297,7 @@ static void nicvf_free_rbdr(struct nicvf *nic, struct rbdr *rbdr) } /* Release buffer of tail desc */ desc = GET_RBDR_DESC(rbdr, tail); - buf_addr = ((u64)desc->buf_addr) << NICVF_RCV_BUF_ALIGN; + buf_addr = desc->buf_addr; phys_addr = nicvf_iova_to_phys(nic, buf_addr); dma_unmap_page_attrs(&nic->pdev->dev, buf_addr, RCV_FRAG_LEN, DMA_FROM_DEVICE, DMA_ATTR_SKIP_CPU_SYNC); @@ -364,7 +364,7 @@ static void nicvf_refill_rbdr(struct nicvf *nic, gfp_t gfp) break; desc = GET_RBDR_DESC(rbdr, tail); - desc->buf_addr = (u64)rbuf >> NICVF_RCV_BUF_ALIGN; + desc->buf_addr = (u64)rbuf & ~(NICVF_RCV_BUF_ALIGN_BYTES - 1); refill_rb_cnt--; new_rb++; } diff --git a/drivers/net/ethernet/cavium/thunder/q_struct.h b/drivers/net/ethernet/cavium/thunder/q_struct.h index f363472..e47205a 100644 --- a/drivers/net/ethernet/cavium/thunder/q_struct.h +++ b/drivers/net/ethernet/cavium/thunder/q_struct.h @@ -359,15 +359,7 @@ union cq_desc_t { }; struct rbdr_entry_t { -#if defined(__BIG_ENDIAN_BITFIELD) - u64 rsvd0:15; - u64 buf_addr:42; - u64 cache_align:7; -#elif defined(__LITTLE_ENDIAN_BITFIELD) - u64 cache_align:7; - u64 buf_addr:42; - u64 rsvd0:15; -#endif + u64 buf_addr; }; /* TCP reassembly context */