Skip to contentSkip to conversation

i40e: Do not call devlink_port_type_clear()

PATCH In review Ivan Vecera 3 participants 6 messages Oct 24, 2023 – Nov 2, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 i40e: Do not call devlink_port_type_clear()

Do not call devlink_port_type_clear() prior devlink port unregister and let devlink core to take care about it.

Reproducer:
[root@host ~]# rmmod i40e

[ 4539.964699] i40e 0000:02:00.0: devlink port type for port 0 cleared without a software interface reference, device type not supported by the kernel?
[ 4540.319811] i40e 0000:02:00.1: devlink port type for port 1 cleared without a software interface reference, device type not supported by the kernel?
Fixes 9e479d64dc58 ("i40e: Add initial devlink support")
---
 drivers/net/ethernet/intel/i40e/i40e_devlink.c | 1 -
 1 file changed, 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_devlink.c +0 -1
index 74bc111b4849..cc4e9e2addb7 100644
@@ -231,6 +231,5 @@ int i40e_devlink_create_port(struct i40e_pf *pf)
  **/
 void i40e_devlink_destroy_port(struct i40e_pf *pf)
 {
-	devlink_port_type_clear(&pf->devlink_port);
 	devlink_port_unregister(&pf->devlink_port);
 }
Signature · 1 line
2.41.0
#1 lore raw

PATCH 2/2 i40e: Fix devlink port unregistering

Ensure that devlink port is unregistered after unregistering of net device.

Reproducer:
[root@host ~]# rmmod i40e

[ 4742.939386] i40e 0000:02:00.1: i40e_ptp_stop: removed PHC on enp2s0f1np1
[ 4743.059269] ------------[ cut here ]------------
[ 4743.063900] WARNING: CPU: 21 PID: 10766 at net/devlink/port.c:1078 devl_port_unregister+0x69/0x80

...

Fixes 9e479d64dc58 ("i40e: Add initial devlink support")
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +6 -4
index df058540d277..3f396c100835 100644
@@ -14181,8 +14181,7 @@ int i40e_vsi_release(struct i40e_vsi *vsi)
 	}
 	set_bit(__I40E_VSI_RELEASING, vsi->state);
 	uplink_seid = vsi->uplink_seid;
-	if (vsi->type == I40E_VSI_MAIN)
-		i40e_devlink_destroy_port(pf);
+
 	if (vsi->type != I40E_VSI_SRIOV) {
 		if (vsi->netdev_registered) {
 			vsi->netdev_registered = false;
@@ -14196,6 +14195,9 @@ int i40e_vsi_release(struct i40e_vsi *vsi)
 		i40e_vsi_disable_irq(vsi);
 	}
 
+	if (vsi->type == I40E_VSI_MAIN)
+		i40e_devlink_destroy_port(pf);
+
 	spin_lock_bh(&vsi->mac_filter_hash_lock);
 
 	/* clear the sync flag on all filters */
@@ -14370,14 +14372,14 @@ static struct i40e_vsi *i40e_vsi_reinit_setup(struct i40e_vsi *vsi)
 
 err_rings:
 	i40e_vsi_free_q_vectors(vsi);
-	if (vsi->type == I40E_VSI_MAIN)
-		i40e_devlink_destroy_port(pf);
 	if (vsi->netdev_registered) {
 		vsi->netdev_registered = false;
 		unregister_netdev(vsi->netdev);
 		free_netdev(vsi->netdev);
 		vsi->netdev = NULL;
 	}
+	if (vsi->type == I40E_VSI_MAIN)
+		i40e_devlink_destroy_port(pf);
 	i40e_aq_delete_element(&pf->hw, vsi->seid, NULL);
 err_vsi:
 	i40e_vsi_clear(vsi);
Signature · 6 lines
2.41.0

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH net-next 2/2] i40e: Fix devlink port unregistering

Quoted 5 lines · Tue, Oct 24, 2023 at 02:51:09PM CEST, [email protected] wrote:

Ensure that devlink port is unregistered after unregistering of net device.

Reproducer:
[root@host ~]# rmmod i40e

Quoted 7 lines
[ 4742.939386] i40e 0000:02:00.1: i40e_ptp_stop: removed PHC on enp2s0f1np1
[ 4743.059269] ------------[ cut here ]------------
[ 4743.063900] WARNING: CPU: 21 PID: 10766 at net/devlink/port.c:1078 devl_port_unregister+0x69/0x80

...

Fixes 9e479d64dc58 ("i40e: Add initial devlink support")
Tested-by on v1 2/2
#3 lore raw

RE: [Intel-wired-lan] [PATCH net-next 2/2] i40e: Fix devlink port unregistering

In reply to Ivan Vecera
Quoted 15 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Ivan Vecera
Sent: Tuesday, October 24, 2023 6:21 PM
To: [email protected]
Cc: [email protected]; Brandeburg, Jesse <[email protected]>; [email protected]; Eric Dumazet <[email protected]>; Nguyen, Anthony L <[email protected]>; Keller, Jacob E <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; David S. Miller <[email protected]>
Subject: [Intel-wired-lan] [PATCH net-next 2/2] i40e: Fix devlink port unregistering

Ensure that devlink port is unregistered after unregistering of net device.

Reproducer:
[root@host ~]# rmmod i40e

[ 4742.939386] i40e 0000:02:00.1: i40e_ptp_stop: removed PHC on enp2s0f1np1
[ 4743.059269] ------------[ cut here ]------------
[ 4743.063900] WARNING: CPU: 21 PID: 10766 at net/devlink/port.c:1078 devl_port_unregister+0x69/0x80
Quoted 8 lines

...

Fixes 9e479d64dc58 ("i40e: Add initial devlink support")
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
Reviewed-by on v1 1/2
#4 lore raw
In reply to Ivan Vecera
Quoted 10 lines · Tue, Oct 24, 2023 at 02:51:08PM CEST, [email protected] wrote:

Do not call devlink_port_type_clear() prior devlink port unregister and let devlink core to take care about it.

Reproducer:
[root@host ~]# rmmod i40e

[ 4539.964699] i40e 0000:02:00.0: devlink port type for port 0 cleared without a software interface reference, device type not supported by the kernel?
[ 4540.319811] i40e 0000:02:00.1: devlink port type for port 1 cleared without a software interface reference, device type not supported by the kernel?
Fixes 9e479d64dc58 ("i40e: Add initial devlink support")

Ivan, I see that even if we have checks and warnings, it is not enough :)

Btw, some (even brief) cover letter for patchset would be nice.

Tested-by on v1 1/2
#5 lore raw
In reply to Ivan Vecera
Quoted 12 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Ivan Vecera
Sent: Tuesday, October 24, 2023 6:21 PM
To: [email protected]
Cc: [email protected]; Brandeburg, Jesse <[email protected]>; [email protected]; Eric Dumazet <[email protected]>; Nguyen, Anthony L <[email protected]>; Keller, Jacob E <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; David S. Miller <[email protected]>
Subject: [Intel-wired-lan] [PATCH net-next 1/2] i40e: Do not call devlink_port_type_clear()

Do not call devlink_port_type_clear() prior devlink port unregister and let devlink core to take care about it.

Reproducer:
[root@host ~]# rmmod i40e

Quoted 9 lines
[ 4539.964699] i40e 0000:02:00.0: devlink port type for port 0 cleared without a software interface reference, device type not supported by the kernel?
[ 4540.319811] i40e 0000:02:00.1: devlink port type for port 1 cleared without a software interface reference, device type not supported by the kernel?
Fixes 9e479d64dc58 ("i40e: Add initial devlink support")
---
 drivers/net/ethernet/intel/i40e/i40e_devlink.c | 1 -
 1 file changed, 1 deletion(-)