Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp3232788ybn; Fri, 27 Sep 2019 03:15:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqzGg6zYlzvI6UxYjDMRC3rivT7JMg+5qe0HksrQg4JZcxgk42SI7om5lBBDwfEmtUCOHI1T X-Received: by 2002:a17:906:4b15:: with SMTP id y21mr624789eju.112.1569579351089; Fri, 27 Sep 2019 03:15:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569579351; cv=none; d=google.com; s=arc-20160816; b=yJbj1xX4bQZI+SIFJebe7tn5hBLoyQkf7fbYVV7ANXgxg6izF/6MLKI7rUyH7g4cl0 LEMQXnbQuoqxHeioeaQPQAlN/sCQHYvAPIciIwrGb5GZ3QfaXB2sWLQXcd5U1urIGQab nYqgaNtN0QiIQbu3USHyfY5H2geuJpnWtrGeq5hxSphpjrXWBRGqcSLHtYsB0lh/p5/z zDS/eh7EXhNj0HUCyhO2aMuyrO2ZRrrKIn9FX2Lm2FJbdGCB4h4dI8i2EpoBbHm67kii OEgtg005oN0oZEXswuXP85vqPyNZRBzETJQPwMBeOUdTgSV0y69lF4z9Y8vl6+qyKIsL Rnng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=5PgOh3SpOfG/4yRarXgh/uQiivI80prOJIdBsV9dW6M=; b=WQlWsY6qjWMBhKkk10TiylpjvygiZPeNJ5n/JM83htirljm3/V+sqk/08TGn1dlxiD C8ryFA6S3w+cd945fGIGcUYdZjyQXCsu2HpYNDsU1pNpy2Rp1ztnm5QmvT2zTX8S0Doc 5/duC0WIl/Qrd6CqyhywwUBJ0h/4uByee7TtmCOWVtPDz01gKgvlMBESxBAIC9mBGHfS rTOG9953Jm0qpHo+jXyp+c/xOalWTA1I6IlMLDI6vj1QAVPxQXpTRh/qbgMZGRWikcbi O1HxM/zW2GhvM2GPC9aI25M7tOaQnHHceb1nIuJR+wLXHHtkWVCe/M4gvL03zHPl+xUJ f0qA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fx14si2459133ejb.268.2019.09.27.03.15.25; Fri, 27 Sep 2019 03:15:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727330AbfI0KPA (ORCPT + 99 others); Fri, 27 Sep 2019 06:15:00 -0400 Received: from mx2.suse.de ([195.135.220.15]:56974 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726080AbfI0KO7 (ORCPT ); Fri, 27 Sep 2019 06:14:59 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 1BDD8AF92; Fri, 27 Sep 2019 10:14:58 +0000 (UTC) From: Benjamin Poirier To: Greg Kroah-Hartman Cc: Manish Chopra , GR-Linux-NIC-Dev@marvell.com, netdev@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 03/17] staging: qlge: Remove page_chunk.last_flag Date: Fri, 27 Sep 2019 19:11:57 +0900 Message-Id: <20190927101210.23856-4-bpoirier@suse.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190927101210.23856-1-bpoirier@suse.com> References: <20190927101210.23856-1-bpoirier@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As already done in ql_get_curr_lchunk(), this member can be replaced by a simple test. Signed-off-by: Benjamin Poirier Acked-by: Manish Chopra --- drivers/staging/qlge/qlge.h | 1 - drivers/staging/qlge/qlge_main.c | 13 +++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/staging/qlge/qlge.h b/drivers/staging/qlge/qlge.h index 5d9a36deda08..0a156a95e981 100644 --- a/drivers/staging/qlge/qlge.h +++ b/drivers/staging/qlge/qlge.h @@ -1363,7 +1363,6 @@ struct page_chunk { char *va; /* virt addr for this chunk */ u64 map; /* mapping for master */ unsigned int offset; /* offset for this chunk */ - unsigned int last_flag; /* flag set for last chunk in page */ }; struct bq_desc { diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c index 7a8d6390d5de..a82920776e6b 100644 --- a/drivers/staging/qlge/qlge_main.c +++ b/drivers/staging/qlge/qlge_main.c @@ -1077,11 +1077,9 @@ static int ql_get_next_chunk(struct ql_adapter *qdev, struct rx_ring *rx_ring, rx_ring->pg_chunk.offset += rx_ring->lbq_buf_size; if (rx_ring->pg_chunk.offset == ql_lbq_block_size(qdev)) { rx_ring->pg_chunk.page = NULL; - lbq_desc->p.pg_chunk.last_flag = 1; } else { rx_ring->pg_chunk.va += rx_ring->lbq_buf_size; get_page(rx_ring->pg_chunk.page); - lbq_desc->p.pg_chunk.last_flag = 0; } return 0; } @@ -2778,6 +2776,8 @@ static int ql_alloc_tx_resources(struct ql_adapter *qdev, static void ql_free_lbq_buffers(struct ql_adapter *qdev, struct rx_ring *rx_ring) { + unsigned int last_offset = ql_lbq_block_size(qdev) - + rx_ring->lbq_buf_size; struct bq_desc *lbq_desc; uint32_t curr_idx, clean_idx; @@ -2787,13 +2787,10 @@ static void ql_free_lbq_buffers(struct ql_adapter *qdev, struct rx_ring *rx_ring while (curr_idx != clean_idx) { lbq_desc = &rx_ring->lbq[curr_idx]; - if (lbq_desc->p.pg_chunk.last_flag) { - pci_unmap_page(qdev->pdev, - lbq_desc->p.pg_chunk.map, - ql_lbq_block_size(qdev), + if (lbq_desc->p.pg_chunk.offset == last_offset) + pci_unmap_page(qdev->pdev, lbq_desc->p.pg_chunk.map, + ql_lbq_block_size(qdev), PCI_DMA_FROMDEVICE); - lbq_desc->p.pg_chunk.last_flag = 0; - } put_page(lbq_desc->p.pg_chunk.page); lbq_desc->p.pg_chunk.page = NULL; -- 2.23.0