From patchwork Tue May 2 13:06:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil Kovvuri X-Patchwork-Id: 9707995 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 AF90E60245 for ; Tue, 2 May 2017 13:10:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9EAA328448 for ; Tue, 2 May 2017 13:10:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 91CE82844B; Tue, 2 May 2017 13:10:45 +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=unavailable 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 1FAFC28448 for ; Tue, 2 May 2017 13:10:45 +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=iTtmCEdRjdsDObE0i9m3SjylpHbAWQOYZWUmnxgZbnQ=; b=ScY3871ctR0r+9PoRtAw1YC42b AkfHvAUO8OkhELmVlZTgTsyabMBac76jJ2b6CLOFUp/qrbd4sQ2gCNm6oc4y7GHXAHJoZBg8aNnu2 KCTstNFgkgSzviQW0hUBH2Xy2dsTd3TqPLnyoVzdzhRjIw9a4SqujhLffDOiEcSo58MDCBC+AiRzE 2hhMXSx5D/kPzw7l8ZWjG18UHfFsfTaiEQvy9du8mlv0Vqqg1Ug0oiFkLpeZuN5I1vkzfApgvWJD+ PKIuzRY1I+BRlLBvIQHDpxSyseHlCrOn7/wzwhxc0QgCGEYAP+gIn5uSqadAANkwQpCa90iQKBEJD PqxnPTug==; 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 1d5XZi-00008R-4u; Tue, 02 May 2017 13:10:42 +0000 Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d5XX3-0005DD-F9 for linux-arm-kernel@lists.infradead.org; Tue, 02 May 2017 13:08:00 +0000 Received: by mail-pf0-x242.google.com with SMTP id v14so33043570pfd.3 for ; Tue, 02 May 2017 06:07:40 -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=LaFn5VOZBQUAzE9Fzon43cla162QElfLo43Z3d3n7+8=; b=umLveGHI8O4EqKvvPEwfP3BlKI6+GYduTb20sBkniepzQbvYVUgDLDLu5BKcjCT/5p yYT0gJ0fuRs/reEGvtX7DiJJWGzCEMz95QU6nYiHmghRQ8FysZdRJjpmevQ9pJ16z32N nOdBlRJD1P4PJNYop1rtUl0ygoB8KzHav+CJTE4enE4xEA5knaMvkY7JYcBETyAwUgXH PO17y9QVcsg0WHTVpNPk+wfyJeYXpkacLgCUIOkPevkE7Pg0tJVPG8nLcglXVMP+erSC InTYFCcCaWpBuxaLpL11+rGOdsf5DstqoOvDDOzoYIFu06acWE55g/Xp33bmlQtNrn/E vRHg== 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=LaFn5VOZBQUAzE9Fzon43cla162QElfLo43Z3d3n7+8=; b=CvLoEvDn6ItVQBo8K1pHvhbnSQvR1BEqjqDIx9uvaZGfpLZ7YRldrsugMUo+i4WNGP 8pNOCkOkmmPCM49alDWRWfQFbilKBTjDtAhIfG3i3RG5cMbj97viD4yAonl2VJDJhc5y xNECLAWjXD5Z3lW5bRm4aabXYOfxEbk6CjsjyOkIBJtUcPtkXf/7NAWdlMvZEdQ6TnMl x/5fNzORW5qWKnNZRbDyufXSq84o8n7bpuiPrUAEKjoSsBo+3GYJlKzjOk5kpqc619Re /xADdSgwjez1cFSon7aklqnhdJj5AtsdOYLKXpIN2UHq16CCpncR9Y41xBlRGgfemJgV 8gcA== X-Gm-Message-State: AN3rC/60DGmoxtERpGSS0gZmH40x+ac4LHwBLyLmgVeCDgobdCbLXUC5 fm9xVo9x0pbLIQ== X-Received: by 10.99.6.17 with SMTP id 17mr28850739pgg.201.1493730460224; Tue, 02 May 2017 06:07:40 -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.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 May 2017 06:07:39 -0700 (PDT) From: sunil.kovvuri@gmail.com To: netdev@vger.kernel.org Subject: [PATCH 4/9] net: thunderx: Cleanup receive buffer allocation Date: Tue, 2 May 2017 18:36:53 +0530 Message-Id: <1493730418-24606-5-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_060758_214172_E59291CC X-CRM114-Status: GOOD ( 12.20 ) 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 Get rid of unnecessary double pointer references and type casting in receive buffer allocation code. Signed-off-by: Sunil Goutham --- drivers/net/ethernet/cavium/thunder/nicvf_queues.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c index 90c5bc7d..e4a02a9 100644 --- a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c +++ b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c @@ -145,7 +145,7 @@ static struct pgcache *nicvf_alloc_page(struct nicvf *nic, /* Allocate buffer for packet reception */ static inline int nicvf_alloc_rcv_buffer(struct nicvf *nic, struct rbdr *rbdr, - gfp_t gfp, u32 buf_len, u64 **rbuf) + gfp_t gfp, u32 buf_len, u64 *rbuf) { struct pgcache *pgcache = NULL; @@ -172,10 +172,10 @@ static inline int nicvf_alloc_rcv_buffer(struct nicvf *nic, struct rbdr *rbdr, nic->rb_page = pgcache->page; ret: /* HW will ensure data coherency, CPU sync not required */ - *rbuf = (u64 *)((u64)dma_map_page_attrs(&nic->pdev->dev, nic->rb_page, - nic->rb_page_offset, buf_len, - DMA_FROM_DEVICE, - DMA_ATTR_SKIP_CPU_SYNC)); + *rbuf = (u64)dma_map_page_attrs(&nic->pdev->dev, nic->rb_page, + nic->rb_page_offset, buf_len, + DMA_FROM_DEVICE, + DMA_ATTR_SKIP_CPU_SYNC); if (dma_mapping_error(&nic->pdev->dev, (dma_addr_t)*rbuf)) { if (!nic->rb_page_offset) __free_pages(nic->rb_page, 0); @@ -212,7 +212,7 @@ static int nicvf_init_rbdr(struct nicvf *nic, struct rbdr *rbdr, int ring_len, int buf_size) { int idx; - u64 *rbuf; + u64 rbuf; struct rbdr_entry_t *desc; int err; @@ -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_BYTES - 1); + desc->buf_addr = rbuf & ~(NICVF_RCV_BUF_ALIGN_BYTES - 1); } nicvf_get_page(nic); @@ -330,7 +330,7 @@ static void nicvf_refill_rbdr(struct nicvf *nic, gfp_t gfp) int refill_rb_cnt; struct rbdr *rbdr; struct rbdr_entry_t *desc; - u64 *rbuf; + u64 rbuf; int new_rb = 0; refill: @@ -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_BYTES - 1); + desc->buf_addr = rbuf & ~(NICVF_RCV_BUF_ALIGN_BYTES - 1); refill_rb_cnt--; new_rb++; }