diff mbox series

[net-next,v5,10/10] net: ngbe: add devlink and devlink port created

Message ID C6023F033917F553+20240804124841.71177-11-mengyuanlou@net-swift.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [net-next,v5,01/10] net: libwx: Add malibox api for wangxun pf drivers | expand

Checks

Context Check Description
netdev/series_format warning Series does not have a cover letter
netdev/tree_selection success Clearly marked for net-next, async
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 29 this patch: 29
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 5 maintainers not CCed: linux@armlinux.org.uk edumazet@google.com kuba@kernel.org pabeni@redhat.com jiawenwu@trustnetic.com
netdev/build_clang success Errors and warnings before: 29 this patch: 29
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 29 this patch: 29
netdev/checkpatch warning WARNING: Missing commit description - Add an appropriate one
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 8 this patch: 8
netdev/source_inline success Was 0 now: 0
netdev/contest fail net-next-2024-08-04--21-00 (tests: 701)

Commit Message

Mengyuan Lou Aug. 4, 2024, 12:48 p.m. UTC
Signed-off-by: Mengyuan Lou <mengyuanlou@net-swift.com>
---
 drivers/net/ethernet/wangxun/ngbe/ngbe_main.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Jiri Pirko Aug. 6, 2024, 11:43 a.m. UTC | #1
Sun, Aug 04, 2024 at 02:48:41PM CEST, mengyuanlou@net-swift.com wrote:
>Signed-off-by: Mengyuan Lou <mengyuanlou@net-swift.com>
>---
> drivers/net/ethernet/wangxun/ngbe/ngbe_main.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
>diff --git a/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c b/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
>index a03a4b5f2766..784819f8fcd5 100644
>--- a/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
>+++ b/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
>@@ -16,6 +16,7 @@
> #include "../libwx/wx_lib.h"
> #include "../libwx/wx_mbx.h"
> #include "../libwx/wx_sriov.h"
>+#include "../libwx/wx_devlink.h"
> #include "ngbe_type.h"
> #include "ngbe_mdio.h"
> #include "ngbe_hw.h"
>@@ -616,6 +617,13 @@ static int ngbe_probe(struct pci_dev *pdev,
> 	wx = netdev_priv(netdev);

WX should not be netdev priv anymore. It should be devlink priv. Please
split.


> 	wx->netdev = netdev;
> 	wx->pdev = pdev;
>+
>+	wx->dl_priv = wx_create_devlink(&pdev->dev);
>+	if (!wx->dl_priv) {
>+		err = -ENOMEM;
>+		goto err_pci_release_regions;
>+	}
>+	wx->dl_priv->priv_wx = wx;
> 	wx->msg_enable = BIT(3) - 1;
> 
> 	wx->hw_addr = devm_ioremap(&pdev->dev,
>@@ -735,6 +743,10 @@ static int ngbe_probe(struct pci_dev *pdev,
> 	if (err)
> 		goto err_clear_interrupt_scheme;
> 
>+	err = wx_devlink_create_pf_port(wx);
>+	if (err)
>+		goto err_devlink_create_pf_port;
>+
> 	err = register_netdev(netdev);
> 	if (err)
> 		goto err_register;
>@@ -744,6 +756,8 @@ static int ngbe_probe(struct pci_dev *pdev,
> 	return 0;
> 
> err_register:
>+	devl_port_unregister(&wx->devlink_port);
>+err_devlink_create_pf_port:
> 	phylink_destroy(wx->phylink);
> 	wx_control_hw(wx, false);
> err_clear_interrupt_scheme:
>@@ -775,6 +789,7 @@ static void ngbe_remove(struct pci_dev *pdev)
> 	netdev = wx->netdev;
> 	wx_disable_sriov(wx);
> 	unregister_netdev(netdev);
>+	devl_port_unregister(&wx->devlink_port);
> 	phylink_destroy(wx->phylink);
> 	pci_release_selected_regions(pdev,
> 				     pci_select_bars(pdev, IORESOURCE_MEM));
>-- 
>2.45.2
>
>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c b/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
index a03a4b5f2766..784819f8fcd5 100644
--- a/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
+++ b/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
@@ -16,6 +16,7 @@ 
 #include "../libwx/wx_lib.h"
 #include "../libwx/wx_mbx.h"
 #include "../libwx/wx_sriov.h"
+#include "../libwx/wx_devlink.h"
 #include "ngbe_type.h"
 #include "ngbe_mdio.h"
 #include "ngbe_hw.h"
@@ -616,6 +617,13 @@  static int ngbe_probe(struct pci_dev *pdev,
 	wx = netdev_priv(netdev);
 	wx->netdev = netdev;
 	wx->pdev = pdev;
+
+	wx->dl_priv = wx_create_devlink(&pdev->dev);
+	if (!wx->dl_priv) {
+		err = -ENOMEM;
+		goto err_pci_release_regions;
+	}
+	wx->dl_priv->priv_wx = wx;
 	wx->msg_enable = BIT(3) - 1;
 
 	wx->hw_addr = devm_ioremap(&pdev->dev,
@@ -735,6 +743,10 @@  static int ngbe_probe(struct pci_dev *pdev,
 	if (err)
 		goto err_clear_interrupt_scheme;
 
+	err = wx_devlink_create_pf_port(wx);
+	if (err)
+		goto err_devlink_create_pf_port;
+
 	err = register_netdev(netdev);
 	if (err)
 		goto err_register;
@@ -744,6 +756,8 @@  static int ngbe_probe(struct pci_dev *pdev,
 	return 0;
 
 err_register:
+	devl_port_unregister(&wx->devlink_port);
+err_devlink_create_pf_port:
 	phylink_destroy(wx->phylink);
 	wx_control_hw(wx, false);
 err_clear_interrupt_scheme:
@@ -775,6 +789,7 @@  static void ngbe_remove(struct pci_dev *pdev)
 	netdev = wx->netdev;
 	wx_disable_sriov(wx);
 	unregister_netdev(netdev);
+	devl_port_unregister(&wx->devlink_port);
 	phylink_destroy(wx->phylink);
 	pci_release_selected_regions(pdev,
 				     pci_select_bars(pdev, IORESOURCE_MEM));