From: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
To: intel-wired-lan@lists.osuosl.org
Cc: netdev@vger.kernel.org, piotr.raczynski@intel.com,
wojciech.drewek@intel.com, marcin.szycik@intel.com,
jacob.e.keller@intel.com, przemyslaw.kitszel@intel.com,
jesse.brandeburg@intel.com,
Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Subject: [PATCH iwl-next v1 09/15] ice: return pointer to representor
Date: Tue, 24 Oct 2023 13:09:23 +0200 [thread overview]
Message-ID: <20231024110929.19423-10-michal.swiatkowski@linux.intel.com> (raw)
In-Reply-To: <20231024110929.19423-1-michal.swiatkowski@linux.intel.com>
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>
---
drivers/net/ethernet/intel/ice/ice_repr.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_repr.c b/drivers/net/ethernet/intel/ice/ice_repr.c
index fce25472d053..b29a3d010780 100644
--- a/drivers/net/ethernet/intel/ice/ice_repr.c
+++ b/drivers/net/ethernet/intel/ice/ice_repr.c
@@ -382,7 +382,7 @@ ice_repr_add(struct ice_pf *pf, struct ice_vsi *src_vsi, const u8 *parent_mac)
return ERR_PTR(err);
}
-static int ice_repr_add_vf(struct ice_vf *vf)
+static struct ice_repr *ice_repr_add_vf(struct ice_vf *vf)
{
struct ice_repr *repr;
struct ice_vsi *vsi;
@@ -390,11 +390,11 @@ static int ice_repr_add_vf(struct ice_vf *vf)
vsi = ice_get_vf_vsi(vf);
if (!vsi)
- return -EINVAL;
+ return ERR_PTR(-ENOENT);
err = ice_devlink_create_vf_port(vf);
if (err)
- return err;
+ return ERR_PTR(err);
repr = ice_repr_add(vf->pf, vsi, vf->hw_lan_addr);
if (IS_ERR(repr)) {
@@ -416,13 +416,13 @@ static int ice_repr_add_vf(struct ice_vf *vf)
ice_virtchnl_set_repr_ops(vf);
- return 0;
+ return repr;
err_netdev:
ice_repr_rem(&vf->pf->eswitch.reprs, repr);
err_repr_add:
ice_devlink_destroy_vf_port(vf);
- return err;
+ return ERR_PTR(err);
}
/**
@@ -432,6 +432,7 @@ static int ice_repr_add_vf(struct ice_vf *vf)
int ice_repr_add_for_all_vfs(struct ice_pf *pf)
{
struct devlink *devlink;
+ struct ice_repr *repr;
struct ice_vf *vf;
unsigned int bkt;
int err;
@@ -439,9 +440,11 @@ int ice_repr_add_for_all_vfs(struct ice_pf *pf)
lockdep_assert_held(&pf->vfs.table_lock);
ice_for_each_vf(pf, bkt, vf) {
- err = ice_repr_add_vf(vf);
- if (err)
+ repr = ice_repr_add_vf(vf);
+ if (IS_ERR(repr)) {
+ err = PTR_ERR(repr);
goto err;
+ }
}
/* only export if ADQ and DCB disabled */
--
2.41.0
next prev parent reply other threads:[~2023-10-24 11:35 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-24 11:09 [PATCH iwl-next v1 00/15] one by one port representors creation Michal Swiatkowski
2023-10-24 11:09 ` [PATCH iwl-next v1 01/15] ice: rename switchdev to eswitch Michal Swiatkowski
2023-10-24 11:09 ` [PATCH iwl-next v1 02/15] ice: remove redundant max_vsi_num variable Michal Swiatkowski
2023-10-24 11:09 ` [PATCH iwl-next v1 03/15] ice: remove unused control VSI parameter Michal Swiatkowski
2023-10-24 11:09 ` [PATCH iwl-next v1 04/15] ice: track q_id in representor Michal Swiatkowski
2023-11-09 10:19 ` [Intel-wired-lan] " Buvaneswaran, Sujai
2023-10-24 11:09 ` [PATCH iwl-next v1 05/15] ice: use repr instead of vf->repr Michal Swiatkowski
2023-10-24 11:09 ` [PATCH iwl-next v1 06/15] ice: track port representors in xarray Michal Swiatkowski
2023-11-09 10:20 ` [Intel-wired-lan] " Buvaneswaran, Sujai
2023-10-24 11:09 ` [PATCH iwl-next v1 07/15] ice: remove VF pointer reference in eswitch code Michal Swiatkowski
2023-11-09 10:21 ` [Intel-wired-lan] " Buvaneswaran, Sujai
2023-10-24 11:09 ` [PATCH iwl-next v1 08/15] ice: make representor code generic Michal Swiatkowski
2023-11-09 10:22 ` [Intel-wired-lan] " Buvaneswaran, Sujai
2023-10-24 11:09 ` Michal Swiatkowski [this message]
2023-11-09 10:23 ` [Intel-wired-lan] [PATCH iwl-next v1 09/15] ice: return pointer to representor Buvaneswaran, Sujai
2023-11-09 10:25 ` Buvaneswaran, Sujai
2023-10-24 11:09 ` [PATCH iwl-next v1 10/15] ice: allow changing SWITCHDEV_CTRL VSI queues Michal Swiatkowski
2023-11-09 10:25 ` [Intel-wired-lan] " Buvaneswaran, Sujai
2023-10-24 11:09 ` [PATCH iwl-next v1 11/15] ice: set Tx topology every time new repr is added Michal Swiatkowski
2023-11-09 10:26 ` [Intel-wired-lan] " Buvaneswaran, Sujai
2023-10-24 11:09 ` [PATCH iwl-next v1 12/15] ice: realloc VSI stats arrays Michal Swiatkowski
2023-11-09 10:30 ` [Intel-wired-lan] " Buvaneswaran, Sujai
2023-10-24 11:09 ` [PATCH iwl-next v1 13/15] ice: add VF representors one by one Michal Swiatkowski
2023-11-09 10:31 ` [Intel-wired-lan] " Buvaneswaran, Sujai
2023-10-24 11:09 ` [PATCH iwl-next v1 14/15] ice: adjust switchdev rebuild path Michal Swiatkowski
2023-11-09 10:31 ` [Intel-wired-lan] " Buvaneswaran, Sujai
2023-10-24 11:09 ` [PATCH iwl-next v1 15/15] ice: reserve number of CP queues Michal Swiatkowski
2023-11-09 10:32 ` [Intel-wired-lan] " Buvaneswaran, Sujai
2023-10-24 11:50 ` [PATCH iwl-next v1 00/15] one by one port representors creation Jiri Pirko
2023-10-24 13:10 ` Michal Swiatkowski
2023-10-24 13:59 ` Jiri Pirko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231024110929.19423-10-michal.swiatkowski@linux.intel.com \
--to=michal.swiatkowski@linux.intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jacob.e.keller@intel.com \
--cc=jesse.brandeburg@intel.com \
--cc=marcin.szycik@intel.com \
--cc=netdev@vger.kernel.org \
--cc=piotr.raczynski@intel.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=wojciech.drewek@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).