[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DM6PR18MB2697AB743E5965B602229348ABE20@DM6PR18MB2697.namprd18.prod.outlook.com>
Date: Wed, 26 Jun 2019 09:12:04 +0000
From: Manish Chopra <manishc@...vell.com>
To: Benjamin Poirier <bpoirier@...e.com>,
GR-Linux-NIC-Dev <GR-Linux-NIC-Dev@...vell.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: RE: [PATCH net-next 02/16] qlge: Remove page_chunk.last_flag
> -----Original Message-----
> From: Benjamin Poirier <bpoirier@...e.com>
> Sent: Monday, June 17, 2019 1:19 PM
> To: Manish Chopra <manishc@...vell.com>; GR-Linux-NIC-Dev <GR-Linux-
> NIC-Dev@...vell.com>; netdev@...r.kernel.org
> Subject: [PATCH net-next 02/16] qlge: Remove page_chunk.last_flag
>
> As already done in ql_get_curr_lchunk(), this member can be replaced by a
> simple test.
>
> Signed-off-by: Benjamin Poirier <bpoirier@...e.com>
> ---
> drivers/net/ethernet/qlogic/qlge/qlge.h | 1 -
> drivers/net/ethernet/qlogic/qlge/qlge_main.c | 13 +++++--------
> 2 files changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/net/ethernet/qlogic/qlge/qlge.h
> b/drivers/net/ethernet/qlogic/qlge/qlge.h
> index 5d9a36deda08..0a156a95e981 100644
> --- a/drivers/net/ethernet/qlogic/qlge/qlge.h
> +++ b/drivers/net/ethernet/qlogic/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/net/ethernet/qlogic/qlge/qlge_main.c
> b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
> index 0bfbe11db795..038a6bfc79c7 100644
> --- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c
> +++ b/drivers/net/ethernet/qlogic/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.21.0
Acked-by: Manish Chopra <manishc@...vell.com>
Powered by blists - more mailing lists