Skip to contentSkip to conversation

net/ice: add devargs to control link update

RFC Superseded Mingjin Ye 3 participants 5 messages Oct 22, 2024 – Jul 23 Network drivers

lore
Share & tools
lore

Mingjin Ye

author
#0 lore raw

RFC 1/1 net/ice: add devargs to control link update

This patch adds the ‘link_period’ devargs to adjust the link update period (microseconds), when the value is less than or equal to 0 it will be disabled, by default it is not enabled.

---
 doc/guides/nics/ice.rst      |  7 ++++
 drivers/net/ice/ice_ethdev.c | 69 ++++++++++++++++++++++++++++++++++++
 drivers/net/ice/ice_ethdev.h |  1 +
 3 files changed, 77 insertions(+)
doc/guides/nics/ice.rst +7 -0
index 91b5a9b461..ccfff3f294 100644
@@ -303,6 +303,13 @@ Runtime Configuration
   * ``segment``: Check number of mbuf segments does not exceed HW limits.
   * ``offload``: Check for use of an unsupported offload flag.
 
+- ``Cycle link update`` (default ``not enabled``)
+
+  Cyclic link update is enabled when the PMD status changes to STARTED. Setting
+  the ``devargs`` parameter ``link_period`` adjusts the link update period in
+  microseconds, and is disabled when the value set is less than or equal to 0.
+  For example ``-a 81:00.0,link_period=5000`` or ``-a 81:00.0,link_period=0``.
+
 Driver compilation and testing
 ------------------------------
 
drivers/net/ice/ice_ethdev.c +69 -0

111 lines not on this page · raw message

drivers/net/ice/ice_ethdev.h +1 -0
index 57087c98ed..4cbe119ac4 100644
@@ -569,6 +569,7 @@ struct ice_devargs {
 	/* Name of the field. */
 	char xtr_field_name[RTE_MBUF_DYN_NAMESIZE];
 	uint64_t mbuf_check;
+	uint32_t link_update_period;
 };
 
 /**
Signature · 1 line
2.25.1
author
#1 lore raw

RFC v2 1/1 net/ice: add devargs to control link update

This patch adds the ‘link_period’ devargs to adjust the link update period (microseconds), when the value is less than or equal to 0 it will be disabled, by default it is not enabled.

---
v2: Fix using the wrong variable.

---
 doc/guides/nics/ice.rst      |  7 ++++
 drivers/net/ice/ice_ethdev.c | 69 ++++++++++++++++++++++++++++++++++++
 drivers/net/ice/ice_ethdev.h |  1 +
 3 files changed, 77 insertions(+)
doc/guides/nics/ice.rst +7 -0
index 91b5a9b461..ccfff3f294 100644
@@ -303,6 +303,13 @@ Runtime Configuration
   * ``segment``: Check number of mbuf segments does not exceed HW limits.
   * ``offload``: Check for use of an unsupported offload flag.
 
+- ``Cycle link update`` (default ``not enabled``)
+
+  Cyclic link update is enabled when the PMD status changes to STARTED. Setting
+  the ``devargs`` parameter ``link_period`` adjusts the link update period in
+  microseconds, and is disabled when the value set is less than or equal to 0.
+  For example ``-a 81:00.0,link_period=5000`` or ``-a 81:00.0,link_period=0``.
+
 Driver compilation and testing
 ------------------------------
 
drivers/net/ice/ice_ethdev.c +69 -0

111 lines not on this page · raw message

drivers/net/ice/ice_ethdev.h +1 -0
index 57087c98ed..4cbe119ac4 100644
@@ -569,6 +569,7 @@ struct ice_devargs {
 	/* Name of the field. */
 	char xtr_field_name[RTE_MBUF_DYN_NAMESIZE];
 	uint64_t mbuf_check;
+	uint32_t link_update_period;
 };
 
 /**
Signature · 1 line
2.25.1
#2 lore raw
Quoted 4 lines · Mingjin Ye

This patch adds the ‘link_period’ devargs to adjust the link update period (microseconds), when the value is less than or equal to 0 it will be disabled, by default it is not enabled.

Quoted 9 lines

---
v2: Fix using the wrong variable.

---
 doc/guides/nics/ice.rst      |  7 ++++
 drivers/net/ice/ice_ethdev.c | 69 ++++++++++++++++++++++++++++++++++++
 drivers/net/ice/ice_ethdev.h |  1 +
 3 files changed, 77 insertions(+)

This RFC is now quite old, so marking as "Not Applicable" in patchwork. I know we had some other rework around link status updates in our driver, so these changes may no longer be relevant. If they are, please submit a new patch version rebased on latest main.

Thanks,
/Bruce

#3 lore raw
In reply to Mingjin Ye

drivers/net/ice/ice_ethdev.c ice_parse_mbuf_check(__rte_unused const char *key, const char *value, void *args · line 2244

Quoted 5 lines · On Tue, 22 Oct 2024 06:20:43 +0000 Mingjin Ye <[email protected]> wrote:
drivers/net/ice/ice_ethdev.c +5 -0
+static int
+ice_parse_clean_subtask_period(__rte_unused const char *key,
+		const char *value, void *args)
+{
+	int *num = (int *)args;

Cast of void * unnecessary in C.
You probably want period to be unsigned not signed.

Quoted 4 lines
drivers/net/ice/ice_ethdev.c +4 -0
+	int tmp;
+
+	errno = 0;
+	tmp = atoi(value);

drivers/net/ice/ice_ethdev.c ice_parse_mbuf_check(__rte_unused const char *key, const char *value, void *args · line 2258

Quoted 10 lines
drivers/net/ice/ice_ethdev.c +10 -0
+	if (tmp < 0) {
+		PMD_DRV_LOG(WARNING, "%s: \"%s\" is not greater than or equal to zero",
+						key, value);
+		return -1;
+	}
+
+	*num = tmp;
+
+	return 0;
+}

Prefer strtoul() when parsing values, it allows for better error handling.

#4 lore raw
Quoted 27 lines

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Tuesday, October 22, 2024 11:23 PM
To: Ye, MingjinX <[email protected]>
Cc: [email protected]
Subject: Re: [RFC] net/ice: add devargs to control link update

drivers/net/ice/ice_ethdev.c ice_parse_mbuf_check(__rte_unused const char *key, const char *value, void *args · line 2244

Quoted 5 lines · On Tue, 22 Oct 2024 06:20:43 +0000 Mingjin Ye <[email protected]> wrote:
drivers/net/ice/ice_ethdev.c +5 -0
+static int
+ice_parse_clean_subtask_period(__rte_unused const char *key,
+		const char *value, void *args)
+{
+	int *num = (int *)args;

Cast of void * unnecessary in C.
You probably want period to be unsigned not signed.

drivers/net/ice/ice_ethdev.c ice_parse_mbuf_check(__rte_unused const char *key, const char *value, void *args

Quoted 6 lines
drivers/net/ice/ice_ethdev.c +6 -0
+	int tmp;
+
+	errno = 0;
+	tmp = atoi(value);
+	if (tmp < 0) {
+		PMD_DRV_LOG(WARNING, "%s: \"%s\" is not greater than

or equal to zero",

Quoted 10 lines

drivers/net/ice/ice_ethdev.c ice_parse_mbuf_check(__rte_unused const char *key, const char *value, void *args · line 2258

Quoted 8 lines
drivers/net/ice/ice_ethdev.c +8 -0
+						key, value);
+		return -1;
+	}
+
+	*num = tmp;
+
+	return 0;
+}

Prefer strtoul() when parsing values, it allows for better error handling.

Thank you. Good suggestion.