Re: [Patch v9 12/12] RDMA/mana_ib: Add a driver for Microsoft Azure Network Adapter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux