From: Ciara Loftus <ciara.loftus@intel.com>
To: dev@dpdk.org
Cc: Ciara Loftus <ciara.loftus@intel.com>
Subject: [RFC PATCH 2/3] net/ice: implement the link state on close device op
Date: Fri, 29 Aug 2025 14:02:23 +0000 [thread overview]
Message-ID: <20250829140224.1748255-3-ciara.loftus@intel.com> (raw)
In-Reply-To: <20250829140224.1748255-1-ciara.loftus@intel.com>
Implement the callback that allows for configuration of the link state
when the device is closed or stopped. The default behaviour remains the
same, that being that the link is restored to its original state on
device closure.
Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
---
drivers/net/intel/ice/ice_ethdev.c | 20 +++++++++++++++++++-
drivers/net/intel/ice/ice_ethdev.h | 1 +
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/drivers/net/intel/ice/ice_ethdev.c b/drivers/net/intel/ice/ice_ethdev.c
index 513777e372..37aee45abc 100644
--- a/drivers/net/intel/ice/ice_ethdev.c
+++ b/drivers/net/intel/ice/ice_ethdev.c
@@ -194,6 +194,8 @@ static int ice_fec_get(struct rte_eth_dev *dev, uint32_t *fec_capa);
static int ice_fec_set(struct rte_eth_dev *dev, uint32_t fec_capa);
static const uint32_t *ice_buffer_split_supported_hdr_ptypes_get(struct rte_eth_dev *dev,
size_t *no_of_elements);
+static int ice_link_state_on_close_set(struct rte_eth_dev *dev,
+ enum rte_eth_link_state_on_close state);
static const struct rte_pci_id pci_id_ice_map[] = {
{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E823L_BACKPLANE) },
@@ -324,6 +326,7 @@ static const struct eth_dev_ops ice_eth_dev_ops = {
.fec_get = ice_fec_get,
.fec_set = ice_fec_set,
.buffer_split_supported_hdr_ptypes_get = ice_buffer_split_supported_hdr_ptypes_get,
+ .link_state_on_close_set = ice_link_state_on_close_set,
};
/* store statistics names and its offset in stats structure */
@@ -2811,7 +2814,9 @@ 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->link_state_on_close == RTE_ETH_LINK_STATE_ON_CLOSE_UP ||
+ (pf->adapter->link_state_on_close == RTE_ETH_LINK_STATE_ON_CLOSE_INITIAL &&
+ pf->init_link_up))
ice_dev_set_link_up(dev);
else
ice_dev_set_link_down(dev);
@@ -3695,6 +3700,8 @@ ice_dev_configure(struct rte_eth_dev *dev)
}
}
+ ad->link_state_on_close = RTE_ETH_LINK_STATE_ON_CLOSE_INITIAL;
+
return 0;
}
@@ -7000,6 +7007,17 @@ ice_buffer_split_supported_hdr_ptypes_get(struct rte_eth_dev *dev __rte_unused,
return ptypes;
}
+static int
+ice_link_state_on_close_set(struct rte_eth_dev *dev, enum rte_eth_link_state_on_close state)
+{
+ struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct ice_adapter *ad = (struct ice_adapter *)hw->back;
+
+ ad->link_state_on_close = state;
+
+ return 0;
+}
+
static unsigned int
ice_fec_get_capa_num(struct ice_aqc_get_phy_caps_data *pcaps,
struct rte_eth_fec_capa *speed_fec_capa)
diff --git a/drivers/net/intel/ice/ice_ethdev.h b/drivers/net/intel/ice/ice_ethdev.h
index 8e5799f8b4..408684631f 100644
--- a/drivers/net/intel/ice/ice_ethdev.h
+++ b/drivers/net/intel/ice/ice_ethdev.h
@@ -663,6 +663,7 @@ struct ice_adapter {
bool tx_use_avx2;
bool tx_use_avx512;
bool rx_vec_offload_support;
+ enum rte_eth_link_state_on_close link_state_on_close; /* link state on device closure. */
};
struct ice_vsi_vlan_pvid_info {
--
2.34.1
next prev parent reply other threads:[~2025-08-29 14:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-29 14:02 [RFC PATCH 0/3] Make Link Status on Close Configurable Ciara Loftus
2025-08-29 14:02 ` [RFC PATCH 1/3] ethdev: add set link state on close API Ciara Loftus
2025-08-29 15:19 ` Ivan Malov
2025-08-29 14:02 ` Ciara Loftus [this message]
2025-08-29 14:02 ` [RFC PATCH 3/3] app/testpmd: support link state on close ethdev API Ciara Loftus
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=20250829140224.1748255-3-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).