[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y2FW7Ba/krWc4nwP@nvidia.com>
Date: Tue, 1 Nov 2022 14:27:08 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: Long Li <longli@...rosoft.com>
Cc: KY Srinivasan <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Stephen Hemminger <sthemmin@...rosoft.com>,
Wei Liu <wei.liu@...nel.org>, Dexuan Cui <decui@...rosoft.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Leon Romanovsky <leon@...nel.org>,
"edumazet@...gle.com" <edumazet@...gle.com>,
"shiraz.saleem@...el.com" <shiraz.saleem@...el.com>,
Ajay Sharma <sharmaajay@...rosoft.com>,
"linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>
Subject: Re: [Patch v9 12/12] RDMA/mana_ib: Add a driver for Microsoft Azure
Network Adapter
On Mon, Oct 31, 2022 at 07:32:24PM +0000, Long Li wrote:
>
> page_addr_list = create_req->page_addr_list;
> rdma_umem_for_each_dma_block(umem, &biter, page_sz) {
> page_addr_list[tail++] = rdma_block_iter_dma_address(&biter);
> if (tail >= num_pages_to_handle) {
if (tail <= num_pages_to_handle)
continue
And remove a level of indentation
> u32 expected_s = 0;
>
> if (num_pages_processed &&
> num_pages_processed + num_pages_to_handle <
> num_pages_total) {
> /* Status indicating more pages are needed */
> expected_s = GDMA_STATUS_MORE_ENTRIES;
> }
>
> if (!num_pages_processed) {
> /* First message */
> err = mana_ib_gd_first_dma_region(dev, gc,
> create_req,
> tail,
> gdma_region);
> if (err)
> goto out;
>
> page_addr_list = add_req->page_addr_list;
> } else {
> err = mana_ib_gd_add_dma_region(dev, gc,
> add_req, tail,
> expected_s);
> if (err) {
> tail = 0;
> break;
> }
> }
>
> num_pages_processed += tail;
>
> /* Prepare to send ADD_PAGE requests */
> num_pages_to_handle =
> min_t(size_t,
> num_pages_total - num_pages_processed,
> max_pgs_add_cmd);
>
> tail = 0;
> }
> }
>
> if (tail) {
> if (!num_pages_processed) {
> err = mana_ib_gd_first_dma_region(dev, gc, create_req,
> tail, gdma_region);
> if (err)
> goto out;
> } else {
> err = mana_ib_gd_add_dma_region(dev, gc, add_req,
> tail, 0);
> }
> }
Usually this can be folded above by having the first if not continue
if the end of the list is reached.
Anyhow, this is much better
Thanks,
Jason
Powered by blists - more mailing lists