In 64K pagesize system, DPDK will read the size NIC need in 
uio/uio1/maps/map1/size,  when the size small than pagesize(e.g.,82599 is 16K), 
dev->mem_resource[i].len will be 16K, but the mmap function applies for at 
least 1 page size, which is 64K. 
Then second NIC mmap, start address is first NIC address + 16K, which already 
used by first NIC.
So if change the size to first NIC address + 64K, problem solved.

-----邮件原件-----
发件人: David Marchand [mailto:[email protected]]
发送时间: 2019年11月5日 22:33
收件人: Wangyu (Turing Solution Development Dep) <[email protected]>
抄送: [email protected]; [email protected]; Linuxarm <[email protected]>; humin 
(Q) <[email protected]>; Liyuan (Larry) <[email protected]>; dengxiaofeng 
<[email protected]>
主题: Re: [dpdk-dev] [PATCH v2] bus/pci: resolve multiple NICs address conflicts

On Tue, Nov 5, 2019 at 8:27 AM Wangyu (Turing Solution Development
Dep) <[email protected]> wrote:
>
>
> NIC address conflicts on 64K pagesize when using multiple NICs, as 
> system will mmap 64K pagesize for NIC, but dev->mem_resource[i].len is 
> 16K.

Please, can you describe the problem you want to fix?
Is this a problem specific to a pci device you are using?

Thanks.

>
> Signed-off-by: Beard-627 <[email protected]>
> Signed-off-by: Eric wang <[email protected]>
> Acked-by: Wei Hu <[email protected]>
> Acked-by: Min Hu <[email protected]>
> ---
>  drivers/bus/pci/linux/pci.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c 
> index 43debaa..afaa68d 100644
> --- a/drivers/bus/pci/linux/pci.c
> +++ b/drivers/bus/pci/linux/pci.c
> @@ -201,6 +201,11 @@
>                 if (flags & IORESOURCE_MEM) {
>                         dev->mem_resource[i].phys_addr = phys_addr;
>                         dev->mem_resource[i].len = end_addr - 
> phys_addr + 1;
> +                       if (dev->mem_resource[i].len <
> +                               (unsigned int)getpagesize())
> +
> +                               dev->mem_resource[i].len =
> +                                       (unsigned int)getpagesize();
>                         /* not mapped for now */
>                         dev->mem_resource[i].addr = NULL;
>                 }
> --
> 1.8.3.1


--
David Marchand

Reply via email to