From: Ciara Loftus <ciara.loftus@intel.com>
To: dev@dpdk.org
Cc: Ciara Loftus <ciara.loftus@intel.com>
Subject: [PATCH] net/ice: make link state configurable on device stop
Date: Thu, 28 Aug 2025 10:23:05 +0000 [thread overview]
Message-ID: <20250828102305.1522036-1-ciara.loftus@intel.com> (raw)
Introduce the boolean restore_link_state devarg for the ice driver. When
set, when the ice port is stopped, the physical link will be restored to
the state it was in when the device was started.
Prior to this patch the default behaviour was to always restore the link
to its original state. The new default behaiour is to always bring the
link down, which is in keeping with most other drivers.
Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
---
doc/guides/nics/ice.rst | 12 ++++++++++++
drivers/net/intel/ice/ice_ethdev.c | 10 ++++++++--
drivers/net/intel/ice/ice_ethdev.h | 1 +
3 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst
index 2c0f41c56c..9007b79471 100644
--- a/doc/guides/nics/ice.rst
+++ b/doc/guides/nics/ice.rst
@@ -322,6 +322,18 @@ Runtime Configuration
-a af:00.0,pps_out='[pin:0]'
+- ``Restore initial link state`` (default ``0``)
+
+ The user can request that the link be restored to its original state when
+ the device is stopped.
+
+ -a af:00.0,restore_link_state=1
+
+ The default behaviour is to bring the link down when the device is stopped,
+ however if restore_link_state is set and if the link state was up when the
+ device was started, then it will be restored to the up state when the
+ device is stopped.
+
- ``Low Rx latency`` (default ``0``)
vRAN workloads require low latency DPDK interface for the front haul
diff --git a/drivers/net/intel/ice/ice_ethdev.c b/drivers/net/intel/ice/ice_ethdev.c
index 513777e372..0c1dc9db1a 100644
--- a/drivers/net/intel/ice/ice_ethdev.c
+++ b/drivers/net/intel/ice/ice_ethdev.c
@@ -41,6 +41,7 @@
#define ICE_DDP_FILENAME_ARG "ddp_pkg_file"
#define ICE_DDP_LOAD_SCHED_ARG "ddp_load_sched_topo"
#define ICE_TM_LEVELS_ARG "tm_sched_levels"
+#define ICE_RESTORE_LINK_STATE "restore_link_state"
#define ICE_CYCLECOUNTER_MASK 0xffffffffffffffffULL
@@ -57,6 +58,7 @@ static const char * const ice_valid_args[] = {
ICE_DDP_FILENAME_ARG,
ICE_DDP_LOAD_SCHED_ARG,
ICE_TM_LEVELS_ARG,
+ ICE_RESTORE_LINK_STATE,
NULL
};
@@ -2368,6 +2370,9 @@ static int ice_parse_devargs(struct rte_eth_dev *dev)
if (ret)
goto bail;
+ ret = rte_kvargs_process(kvlist, ICE_RESTORE_LINK_STATE,
+ &parse_bool, &ad->devargs.restore_link_state);
+
bail:
rte_kvargs_free(kvlist);
return ret;
@@ -2811,7 +2816,7 @@ ice_dev_stop(struct rte_eth_dev *dev)
/* disable all queue interrupts */
ice_vsi_disable_queues_intr(main_vsi);
- if (pf->init_link_up)
+ if (pf->adapter->devargs.restore_link_state && pf->init_link_up)
ice_dev_set_link_up(dev);
else
ice_dev_set_link_down(dev);
@@ -7320,7 +7325,8 @@ RTE_PMD_REGISTER_PARAM_STRING(net_ice,
ICE_DDP_FILENAME_ARG "=</path/to/file>"
ICE_DDP_LOAD_SCHED_ARG "=<0|1>"
ICE_TM_LEVELS_ARG "=<N>"
- ICE_RX_LOW_LATENCY_ARG "=<0|1>");
+ ICE_RX_LOW_LATENCY_ARG "=<0|1>"
+ ICE_RESTORE_LINK_STATE "=<0|1>");
RTE_LOG_REGISTER_SUFFIX(ice_logtype_init, init, NOTICE);
RTE_LOG_REGISTER_SUFFIX(ice_logtype_driver, driver, NOTICE);
diff --git a/drivers/net/intel/ice/ice_ethdev.h b/drivers/net/intel/ice/ice_ethdev.h
index 8e5799f8b4..4605fee6c5 100644
--- a/drivers/net/intel/ice/ice_ethdev.h
+++ b/drivers/net/intel/ice/ice_ethdev.h
@@ -597,6 +597,7 @@ struct ice_devargs {
uint8_t pps_out_ena;
uint8_t ddp_load_sched;
uint8_t tm_exposed_levels;
+ uint8_t restore_link_state;
int xtr_field_offs;
uint8_t xtr_flag_offs[PROTO_XTR_MAX];
/* Name of the field. */
--
2.34.1
next reply other threads:[~2025-08-28 10:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-28 10:23 Ciara Loftus [this message]
2025-08-28 10:35 ` Bruce Richardson
2025-08-28 14:55 ` Stephen Hemminger
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=20250828102305.1522036-1-ciara.loftus@intel.com \
--to=ciara.loftus@intel.com \
--cc=dev@dpdk.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;
as well as URLs for NNTP newsgroup(s).