From: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH net-next 2/3] ice: change mode only if eswitch is supported
Date: Wed, 22 Dec 2021 07:22:00 +0100 [thread overview]
Message-ID: <20211222062201.36302-3-michal.swiatkowski@linux.intel.com> (raw)
In-Reply-To: <20211222062201.36302-1-michal.swiatkowski@linux.intel.com>
Support for eswitch can be turned off when reservation for msix fails.
Cover this situation and return error in changing eswitch mode function.
Add new lines in each dev_info call.
Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
---
drivers/net/ethernet/intel/ice/ice_eswitch.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_eswitch.c b/drivers/net/ethernet/intel/ice/ice_eswitch.c
index fbe640d501c6..2b6c7d27ac96 100644
--- a/drivers/net/ethernet/intel/ice/ice_eswitch.c
+++ b/drivers/net/ethernet/intel/ice/ice_eswitch.c
@@ -518,25 +518,34 @@ ice_eswitch_mode_set(struct devlink *devlink, u16 mode,
struct netlink_ext_ack *extack)
{
struct ice_pf *pf = devlink_priv(devlink);
+ struct device *dev = ice_pf_to_dev(pf);
if (pf->eswitch_mode == mode)
return 0;
if (pf->num_alloc_vfs) {
- dev_info(ice_pf_to_dev(pf), "Changing eswitch mode is allowed only if there is no VFs created");
- NL_SET_ERR_MSG_MOD(extack, "Changing eswitch mode is allowed only if there is no VFs created");
+ dev_info(dev, "Changing eswitch mode is allowed only if there is no VFs created\n");
+ NL_SET_ERR_MSG_MOD(extack,
+ "Changing eswitch mode is allowed only if there is no VFs created");
+ return -EOPNOTSUPP;
+ }
+
+ if (!ice_is_eswitch_supported(pf)) {
+ dev_info(dev, "There is no eswitch support or eswitch resource allocation failed\n");
+ NL_SET_ERR_MSG_MOD(extack,
+ "There is no eswitch support or eswitch resource allocation failed");
return -EOPNOTSUPP;
}
switch (mode) {
case DEVLINK_ESWITCH_MODE_LEGACY:
- dev_info(ice_pf_to_dev(pf), "PF %d changed eswitch mode to legacy",
+ dev_info(ice_pf_to_dev(pf), "PF %d changed eswitch mode to legacy\n",
pf->hw.pf_id);
NL_SET_ERR_MSG_MOD(extack, "Changed eswitch mode to legacy");
break;
case DEVLINK_ESWITCH_MODE_SWITCHDEV:
{
- dev_info(ice_pf_to_dev(pf), "PF %d changed eswitch mode to switchdev",
+ dev_info(ice_pf_to_dev(pf), "PF %d changed eswitch mode to switchdev\n",
pf->hw.pf_id);
NL_SET_ERR_MSG_MOD(extack, "Changed eswitch mode to switchdev");
break;
--
2.31.1
next prev parent reply other threads:[~2021-12-22 6:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-22 6:21 [Intel-wired-lan] [PATCH net-next 0/3] refactor irq allocation in ice Michal Swiatkowski
2021-12-22 6:21 ` [Intel-wired-lan] [PATCH net-next 1/3] ice: add check for eswitch support Michal Swiatkowski
2021-12-22 6:22 ` Michal Swiatkowski [this message]
2021-12-22 6:22 ` [Intel-wired-lan] [PATCH net-next 3/3] ice: use new alloc irqs API Michal Swiatkowski
2021-12-22 16:33 ` [Intel-wired-lan] [PATCH net-next 0/3] refactor irq allocation in ice Jonathan Toppins
2022-04-27 0:24 ` Tony Nguyen
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=20211222062201.36302-3-michal.swiatkowski@linux.intel.com \
--to=michal.swiatkowski@linux.intel.com \
--cc=intel-wired-lan@osuosl.org \
/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