diff mbox series

[iwl-net,v4] ice: Block PF reinit if attached to bond

Message ID 20231127060512.1283336-1-sachin.bahadur@intel.com (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series [iwl-net,v4] ice: Block PF reinit if attached to bond | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/codegen success Generated files up to date
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1115 this patch: 1115
netdev/cc_maintainers warning 5 maintainers not CCed: kuba@kernel.org pabeni@redhat.com edumazet@google.com jesse.brandeburg@intel.com anthony.l.nguyen@intel.com
netdev/build_clang success Errors and warnings before: 1142 this patch: 1142
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 fail Problems with Fixes tag: 1
netdev/build_allmodconfig_warn success Errors and warnings before: 1142 this patch: 1142
netdev/checkpatch warning WARNING: line length of 102 exceeds 80 columns
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Bahadur, Sachin Nov. 27, 2023, 6:05 a.m. UTC
PF interface part of Bond should not allow driver reinit via devlink. Bond
config will be lost due to PF reinit. PF needs to be re-added to Bond
after PF reinit. ice_devlink_reload_down is called before PF driver reinit.
If PF is attached to bond, ice_devlink_reload_down returns error.

Fixes: trailer
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Sachin Bahadur <sachin.bahadur@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_devlink.c | 4 ++++
 1 file changed, 4 insertions(+)

--
2.25.1

Comments

Jiri Pirko Nov. 27, 2023, 9:41 a.m. UTC | #1
Mon, Nov 27, 2023 at 07:05:12AM CET, sachin.bahadur@intel.com wrote:
>PF interface part of Bond should not allow driver reinit via devlink. Bond
>config will be lost due to PF reinit. PF needs to be re-added to Bond
>after PF reinit. ice_devlink_reload_down is called before PF driver reinit.
>If PF is attached to bond, ice_devlink_reload_down returns error.
>
>Fixes: trailer
>Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
>Signed-off-by: Sachin Bahadur <sachin.bahadur@intel.com>
>---
> drivers/net/ethernet/intel/ice/ice_devlink.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
>diff --git a/drivers/net/ethernet/intel/ice/ice_devlink.c b/drivers/net/ethernet/intel/ice/ice_devlink.c
>index f4e24d11ebd0..5fe88e949b09 100644
>--- a/drivers/net/ethernet/intel/ice/ice_devlink.c
>+++ b/drivers/net/ethernet/intel/ice/ice_devlink.c
>@@ -457,6 +457,10 @@ ice_devlink_reload_down(struct devlink *devlink, bool netns_change,
> 					   "Remove all VFs before doing reinit\n");
> 			return -EOPNOTSUPP;
> 		}
>+		if (pf->lag && pf->lag->bonded) {
>+			NL_SET_ERR_MSG_MOD(extack, "Remove all associated Bonds before doing reinit");

Nack. Remove the netdev during re-init, that would solve your issue.
Looks like some checks are needed to be added in devlink code to make
sure drivers behave properly. I'm on in.



>+			return -EBUSY;
>+		}
> 		ice_unload(pf);
> 		return 0;
> 	case DEVLINK_RELOAD_ACTION_FW_ACTIVATE:
>--
>2.25.1
>
>
Bahadur, Sachin Nov. 27, 2023, 4:23 p.m. UTC | #2
> Nack. Remove the netdev during re-init, that would solve your issue.
> Looks like some checks are needed to be added in devlink code to make sure
> drivers behave properly. I'm on in.

Sure. This fix should apply to all drivers. Adding it in devlink makes more
sense. I am not a devlink expert, so I hope you or someone else can
help with it.

> 
> 
> >+			return -EBUSY;
> >+		}
> > 		ice_unload(pf);
> > 		return 0;
> > 	case DEVLINK_RELOAD_ACTION_FW_ACTIVATE:
> >--
> >2.25.1
> >
> >
Jiri Pirko Nov. 28, 2023, 7:37 a.m. UTC | #3
Mon, Nov 27, 2023 at 05:23:55PM CET, sachin.bahadur@intel.com wrote:
> 
>> Nack. Remove the netdev during re-init, that would solve your issue.
>> Looks like some checks are needed to be added in devlink code to make sure
>> drivers behave properly. I'm on in.
>
>Sure. This fix should apply to all drivers. Adding it in devlink makes more
>sense. I am not a devlink expert, so I hope you or someone else can
>help with it.

No, you misunderstood. I'll just add a check-warn in devlink for case
when port exists during reload. You need to fix it in your driver.

>
>> 
>> 
>> >+			return -EBUSY;
>> >+		}
>> > 		ice_unload(pf);
>> > 		return 0;
>> > 	case DEVLINK_RELOAD_ACTION_FW_ACTIVATE:
>> >--
>> >2.25.1
>> >
>> >
Przemek Kitszel Nov. 28, 2023, 10:26 a.m. UTC | #4
On 11/28/23 08:37, Jiri Pirko wrote:
> Mon, Nov 27, 2023 at 05:23:55PM CET, sachin.bahadur@intel.com wrote:
>>
>>> Nack. Remove the netdev during re-init, that would solve your issue.
>>> Looks like some checks are needed to be added in devlink code to make sure
>>> drivers behave properly. I'm on in.
>>
>> Sure. This fix should apply to all drivers. Adding it in devlink makes more
>> sense. I am not a devlink expert, so I hope you or someone else can
>> help with it.
> 
> No, you misunderstood. I'll just add a check-warn in devlink for case
> when port exists during reload. You need to fix it in your driver.

Having a message in log that reminds devs would be useful, thanks!

> 
>>
>>>
>>>
>>>> +			return -EBUSY;
>>>> +		}
>>>> 		ice_unload(pf);
>>>> 		return 0;
>>>> 	case DEVLINK_RELOAD_ACTION_FW_ACTIVATE:
>>>> --
>>>> 2.25.1
>>>>
>>>>
>
Bahadur, Sachin Nov. 28, 2023, 5:45 p.m. UTC | #5
> From: Jiri Pirko <jiri@resnulli.us>
> Sent: Monday, November 27, 2023 11:38 PM
> To: Bahadur, Sachin <sachin.bahadur@intel.com>
> Cc: intel-wired-lan@lists.osuosl.org; netdev@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Subject: Re: [PATCH iwl-net v4] ice: Block PF reinit if attached to bond
> 
> Mon, Nov 27, 2023 at 05:23:55PM CET, sachin.bahadur@intel.com wrote:
> >
> >> Nack. Remove the netdev during re-init, that would solve your issue.
> >> Looks like some checks are needed to be added in devlink code to make
> >> sure drivers behave properly. I'm on in.
> >
> >Sure. This fix should apply to all drivers. Adding it in devlink makes
> >more sense. I am not a devlink expert, so I hope you or someone else
> >can help with it.
> 
> No, you misunderstood. I'll just add a check-warn in devlink for case when port
> exists during reload. You need to fix it in your driver.


What should be fixed in my driver. Can you clarify ? 
And are suggesting I add the check-warn in devlink code ?


> >
> >>
> >>
> >> >+			return -EBUSY;
> >> >+		}
> >> > 		ice_unload(pf);
> >> > 		return 0;
> >> > 	case DEVLINK_RELOAD_ACTION_FW_ACTIVATE:
> >> >--
> >> >2.25.1
> >> >
> >> >
Jiri Pirko Nov. 29, 2023, 2:41 p.m. UTC | #6
Tue, Nov 28, 2023 at 06:45:47PM CET, sachin.bahadur@intel.com wrote:
>
>
>> From: Jiri Pirko <jiri@resnulli.us>
>> Sent: Monday, November 27, 2023 11:38 PM
>> To: Bahadur, Sachin <sachin.bahadur@intel.com>
>> Cc: intel-wired-lan@lists.osuosl.org; netdev@vger.kernel.org; linux-
>> kernel@vger.kernel.org
>> Subject: Re: [PATCH iwl-net v4] ice: Block PF reinit if attached to bond
>> 
>> Mon, Nov 27, 2023 at 05:23:55PM CET, sachin.bahadur@intel.com wrote:
>> >
>> >> Nack. Remove the netdev during re-init, that would solve your issue.
>> >> Looks like some checks are needed to be added in devlink code to make
>> >> sure drivers behave properly. I'm on in.
>> >
>> >Sure. This fix should apply to all drivers. Adding it in devlink makes
>> >more sense. I am not a devlink expert, so I hope you or someone else
>> >can help with it.
>> 
>> No, you misunderstood. I'll just add a check-warn in devlink for case when port
>> exists during reload. You need to fix it in your driver.
>
>
>What should be fixed in my driver. Can you clarify ? 
>And are suggesting I add the check-warn in devlink code ?

Remove the netdev during re-init.


>
>
>> >
>> >>
>> >>
>> >> >+			return -EBUSY;
>> >> >+		}
>> >> > 		ice_unload(pf);
>> >> > 		return 0;
>> >> > 	case DEVLINK_RELOAD_ACTION_FW_ACTIVATE:
>> >> >--
>> >> >2.25.1
>> >> >
>> >> >
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/ice/ice_devlink.c b/drivers/net/ethernet/intel/ice/ice_devlink.c
index f4e24d11ebd0..5fe88e949b09 100644
--- a/drivers/net/ethernet/intel/ice/ice_devlink.c
+++ b/drivers/net/ethernet/intel/ice/ice_devlink.c
@@ -457,6 +457,10 @@  ice_devlink_reload_down(struct devlink *devlink, bool netns_change,
 					   "Remove all VFs before doing reinit\n");
 			return -EOPNOTSUPP;
 		}
+		if (pf->lag && pf->lag->bonded) {
+			NL_SET_ERR_MSG_MOD(extack, "Remove all associated Bonds before doing reinit");
+			return -EBUSY;
+		}
 		ice_unload(pf);
 		return 0;
 	case DEVLINK_RELOAD_ACTION_FW_ACTIVATE: