Skip to content

Commit deb53f2

Browse files
Michal Swiatkowskianguy11
authored andcommitted
ice: return pointer to representor
In follow up patches it will be easier to obtain created port representor pointer instead of the id. Without it the pattern from eswitch side will look like: - create PR - get PR based on the id Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com> Tested-by: Sujai Buvaneswaran <sujai.buvaneswaran@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
1 parent 604283e commit deb53f2

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

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

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -382,19 +382,19 @@ ice_repr_add(struct ice_pf *pf, struct ice_vsi *src_vsi, const u8 *parent_mac)
382382
return ERR_PTR(err);
383383
}
384384

385-
static int ice_repr_add_vf(struct ice_vf *vf)
385+
static struct ice_repr *ice_repr_add_vf(struct ice_vf *vf)
386386
{
387387
struct ice_repr *repr;
388388
struct ice_vsi *vsi;
389389
int err;
390390

391391
vsi = ice_get_vf_vsi(vf);
392392
if (!vsi)
393-
return -EINVAL;
393+
return ERR_PTR(-ENOENT);
394394

395395
err = ice_devlink_create_vf_port(vf);
396396
if (err)
397-
return err;
397+
return ERR_PTR(err);
398398

399399
repr = ice_repr_add(vf->pf, vsi, vf->hw_lan_addr);
400400
if (IS_ERR(repr)) {
@@ -416,13 +416,13 @@ static int ice_repr_add_vf(struct ice_vf *vf)
416416

417417
ice_virtchnl_set_repr_ops(vf);
418418

419-
return 0;
419+
return repr;
420420

421421
err_netdev:
422422
ice_repr_rem(&vf->pf->eswitch.reprs, repr);
423423
err_repr_add:
424424
ice_devlink_destroy_vf_port(vf);
425-
return err;
425+
return ERR_PTR(err);
426426
}
427427

428428
/**
@@ -432,16 +432,19 @@ static int ice_repr_add_vf(struct ice_vf *vf)
432432
int ice_repr_add_for_all_vfs(struct ice_pf *pf)
433433
{
434434
struct devlink *devlink;
435+
struct ice_repr *repr;
435436
struct ice_vf *vf;
436437
unsigned int bkt;
437438
int err;
438439

439440
lockdep_assert_held(&pf->vfs.table_lock);
440441

441442
ice_for_each_vf(pf, bkt, vf) {
442-
err = ice_repr_add_vf(vf);
443-
if (err)
443+
repr = ice_repr_add_vf(vf);
444+
if (IS_ERR(repr)) {
445+
err = PTR_ERR(repr);
444446
goto err;
447+
}
445448
}
446449

447450
/* only export if ADQ and DCB disabled */

0 commit comments

Comments
 (0)