Skip to content

Commit 360c465

Browse files
Michal Swiatkowskianguy11
authored andcommitted
ice: check for PF number outside the fwlog code
Fwlog can be supported only on PF 0. Check this before calling init/deinit functions. Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com> Tested-by: Rinitha S <sx.rinitha@intel.com> (A Contingent worker at Intel) Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
1 parent dc898f7 commit 360c465

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

drivers/net/ethernet/intel/ice/ice_common.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,6 +1002,10 @@ static int __fwlog_init(struct ice_hw *hw)
10021002
};
10031003
int err;
10041004

1005+
/* only support fw log commands on PF 0 */
1006+
if (hw->bus.func)
1007+
return -EINVAL;
1008+
10051009
err = ice_debugfs_pf_init(pf);
10061010
if (err)
10071011
return err;
@@ -1186,6 +1190,10 @@ int ice_init_hw(struct ice_hw *hw)
11861190

11871191
static void __fwlog_deinit(struct ice_hw *hw)
11881192
{
1193+
/* only support fw log commands on PF 0 */
1194+
if (hw->bus.func)
1195+
return;
1196+
11891197
ice_debugfs_pf_deinit(hw->back);
11901198
ice_fwlog_deinit(hw, &hw->fwlog);
11911199
}

drivers/net/ethernet/intel/ice/ice_debugfs.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -588,10 +588,6 @@ void ice_debugfs_fwlog_init(struct ice_pf *pf)
588588
struct dentry **fw_modules;
589589
int i;
590590

591-
/* only support fw log commands on PF 0 */
592-
if (pf->hw.bus.func)
593-
return;
594-
595591
/* allocate space for this first because if it fails then we don't
596592
* need to unwind
597593
*/

drivers/net/ethernet/intel/ice/ice_fwlog.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,6 @@ static void ice_fwlog_set_supported(struct ice_fwlog *fwlog)
242242
int ice_fwlog_init(struct ice_hw *hw, struct ice_fwlog *fwlog,
243243
struct ice_fwlog_api *api)
244244
{
245-
/* only support fw log commands on PF 0 */
246-
if (hw->bus.func)
247-
return -EINVAL;
248-
249245
fwlog->api = *api;
250246
ice_fwlog_set_supported(fwlog);
251247

@@ -296,10 +292,6 @@ void ice_fwlog_deinit(struct ice_hw *hw, struct ice_fwlog *fwlog)
296292
struct ice_pf *pf = hw->back;
297293
int status;
298294

299-
/* only support fw log commands on PF 0 */
300-
if (hw->bus.func)
301-
return;
302-
303295
/* make sure FW logging is disabled to not put the FW in a weird state
304296
* for the next driver load
305297
*/

0 commit comments

Comments
 (0)