netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: ena: Use pci_dev_id() to simplify the code
@ 2023-08-15  2:42 Jialin Zhang
  2023-08-15  7:23 ` Leon Romanovsky
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Jialin Zhang @ 2023-08-15  2:42 UTC (permalink / raw)
  To: shayagr, akiyano, darinzon, ndagan, saeedb, davem, edumazet, kuba,
	pabeni, michal.kubiak, yuancan
  Cc: netdev, liwei391, wangxiongfeng2

PCI core API pci_dev_id() can be used to get the BDF number for a pci
device. We don't need to compose it mannually. Use pci_dev_id() to
simplify the code a little bit.

Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com>
---
 drivers/net/ethernet/amazon/ena/ena_netdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
index d19593fae226..ad32ca81f7ef 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
@@ -3267,7 +3267,7 @@ static void ena_config_host_info(struct ena_com_dev *ena_dev, struct pci_dev *pd
 
 	host_info = ena_dev->host_attr.host_info;
 
-	host_info->bdf = (pdev->bus->number << 8) | pdev->devfn;
+	host_info->bdf = pci_dev_id(pdev);
 	host_info->os_type = ENA_ADMIN_OS_LINUX;
 	host_info->kernel_ver = LINUX_VERSION_CODE;
 	strscpy(host_info->kernel_ver_str, utsname()->version,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: ena: Use pci_dev_id() to simplify the code
  2023-08-15  2:42 [PATCH] net: ena: Use pci_dev_id() to simplify the code Jialin Zhang
@ 2023-08-15  7:23 ` Leon Romanovsky
  2023-08-15  8:31 ` Shay Agroskin
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Leon Romanovsky @ 2023-08-15  7:23 UTC (permalink / raw)
  To: Jialin Zhang
  Cc: shayagr, akiyano, darinzon, ndagan, saeedb, davem, edumazet, kuba,
	pabeni, michal.kubiak, yuancan, netdev, liwei391, wangxiongfeng2

On Tue, Aug 15, 2023 at 10:42:48AM +0800, Jialin Zhang wrote:
> PCI core API pci_dev_id() can be used to get the BDF number for a pci
> device. We don't need to compose it mannually. Use pci_dev_id() to
> simplify the code a little bit.
> 
> Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com>
> ---
>  drivers/net/ethernet/amazon/ena/ena_netdev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Patch should include target: [PATCH net-next] ....

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: ena: Use pci_dev_id() to simplify the code
  2023-08-15  2:42 [PATCH] net: ena: Use pci_dev_id() to simplify the code Jialin Zhang
  2023-08-15  7:23 ` Leon Romanovsky
@ 2023-08-15  8:31 ` Shay Agroskin
  2023-08-15 16:04 ` Simon Horman
  2023-08-18  2:20 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Shay Agroskin @ 2023-08-15  8:31 UTC (permalink / raw)
  To: Jialin Zhang
  Cc: akiyano, darinzon, ndagan, saeedb, davem, edumazet, kuba, pabeni,
	michal.kubiak, yuancan, netdev, liwei391, wangxiongfeng2


Jialin Zhang <zhangjialin11@huawei.com> writes:

> PCI core API pci_dev_id() can be used to get the BDF number for 
> a pci
> device. We don't need to compose it mannually. Use pci_dev_id() 
> to
> simplify the code a little bit.
>
> Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com>
> ---
>  drivers/net/ethernet/amazon/ena/ena_netdev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c 
> b/drivers/net/ethernet/amazon/ena/ena_netdev.c
> index d19593fae226..ad32ca81f7ef 100644
> --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
> +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
> @@ -3267,7 +3267,7 @@ static void ena_config_host_info(struct 
> ena_com_dev *ena_dev, struct pci_dev *pd
>  
>  	host_info = ena_dev->host_attr.host_info;
>  
> -	host_info->bdf = (pdev->bus->number << 8) | pdev->devfn;
> +	host_info->bdf = pci_dev_id(pdev);
>  	host_info->os_type = ENA_ADMIN_OS_LINUX;
>  	host_info->kernel_ver = LINUX_VERSION_CODE;
>  	strscpy(host_info->kernel_ver_str, utsname()->version,

Same as Leon's response. Otherwise lgtm
Reviewed-by: Shay Agroskin <shayagr@amazon.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: ena: Use pci_dev_id() to simplify the code
  2023-08-15  2:42 [PATCH] net: ena: Use pci_dev_id() to simplify the code Jialin Zhang
  2023-08-15  7:23 ` Leon Romanovsky
  2023-08-15  8:31 ` Shay Agroskin
@ 2023-08-15 16:04 ` Simon Horman
  2023-08-18  2:20 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2023-08-15 16:04 UTC (permalink / raw)
  To: Jialin Zhang
  Cc: shayagr, akiyano, darinzon, ndagan, saeedb, davem, edumazet, kuba,
	pabeni, michal.kubiak, yuancan, netdev, liwei391, wangxiongfeng2

On Tue, Aug 15, 2023 at 10:42:48AM +0800, Jialin Zhang wrote:
> PCI core API pci_dev_id() can be used to get the BDF number for a pci
> device. We don't need to compose it mannually. Use pci_dev_id() to

nit: mannually -> manually

> simplify the code a little bit.
> 
> Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com>
> ---
>  drivers/net/ethernet/amazon/ena/ena_netdev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
> index d19593fae226..ad32ca81f7ef 100644
> --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
> +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
> @@ -3267,7 +3267,7 @@ static void ena_config_host_info(struct ena_com_dev *ena_dev, struct pci_dev *pd
>  
>  	host_info = ena_dev->host_attr.host_info;
>  
> -	host_info->bdf = (pdev->bus->number << 8) | pdev->devfn;
> +	host_info->bdf = pci_dev_id(pdev);
>  	host_info->os_type = ENA_ADMIN_OS_LINUX;
>  	host_info->kernel_ver = LINUX_VERSION_CODE;
>  	strscpy(host_info->kernel_ver_str, utsname()->version,
> -- 
> 2.25.1
> 
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: ena: Use pci_dev_id() to simplify the code
  2023-08-15  2:42 [PATCH] net: ena: Use pci_dev_id() to simplify the code Jialin Zhang
                   ` (2 preceding siblings ...)
  2023-08-15 16:04 ` Simon Horman
@ 2023-08-18  2:20 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-08-18  2:20 UTC (permalink / raw)
  To: Jialin Zhang
  Cc: shayagr, akiyano, darinzon, ndagan, saeedb, davem, edumazet, kuba,
	pabeni, michal.kubiak, yuancan, netdev, liwei391, wangxiongfeng2

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 15 Aug 2023 10:42:48 +0800 you wrote:
> PCI core API pci_dev_id() can be used to get the BDF number for a pci
> device. We don't need to compose it mannually. Use pci_dev_id() to
> simplify the code a little bit.
> 
> Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com>
> ---
>  drivers/net/ethernet/amazon/ena/ena_netdev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Here is the summary with links:
  - net: ena: Use pci_dev_id() to simplify the code
    https://git.kernel.org/netdev/net-next/c/a5e5b2cd47bc

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-08-18  2:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-15  2:42 [PATCH] net: ena: Use pci_dev_id() to simplify the code Jialin Zhang
2023-08-15  7:23 ` Leon Romanovsky
2023-08-15  8:31 ` Shay Agroskin
2023-08-15 16:04 ` Simon Horman
2023-08-18  2:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).