Skip to contentSkip to conversation

config: remove explicit undef of unset values

PATCH In review Bruce Richardson 4 participants 9 messages Dec 16, 2021 – Jun 15, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 config: remove explicit undef of unset values

Rather than explicitly clearing any setting of undefined values in our rte_config.h file, it's better to instead just add a comment that the value is not set. Using a comment allows the user to set the value using CFLAGS or similar mechanism without the config file clearing the value again.

The text used "<VALUE> is not set" is modelled after the kernel approach of doing the same thing.

---

Although DPDK coding convention forbids use of "//" for comments, using regular C comment style makes the config settings less clear, as they can be confused with regular comments in the file. Using "//" makes them stand out better, so I prefer it. However, if others feel strongly, they can be changed to standard.

Note: this is a resubmission of patch [1] which was part of a rejected series. However, the reasons for rejection - values in config being out of sync with those used for building apps - are less relevant for many, if not all, of these setting, so I believe the benefits for testing outweigh the potential downsides. If any setting is likely problematic, I can keep the explicit undef for that case in a new patch version.

[1] http://patches.dpdk.org/project/dpdk/patch/[email protected]/

---
 config/rte_config.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
config/rte_config.h +7 -7
index cab4390a97..953216babd 100644
@@ -83,17 +83,17 @@
 
 /* ip_fragmentation defines */
 #define RTE_LIBRTE_IP_FRAG_MAX_FRAG 8
-#undef RTE_LIBRTE_IP_FRAG_TBL_STAT
+// RTE_LIBRTE_IP_FRAG_TBL_STAT is not set
 
 /* rte_power defines */
 #define RTE_MAX_LCORE_FREQS 64
 
 /* rte_sched defines */
-#undef RTE_SCHED_CMAN
-#undef RTE_SCHED_COLLECT_STATS
-#undef RTE_SCHED_SUBPORT_TC_OV
+// RTE_SCHED_CMAN is not set
+// RTE_SCHED_COLLECT_STATS is not set
+// RTE_SCHED_SUBPORT_TC_OV is not set
 #define RTE_SCHED_PORT_N_GRINDERS 8
-#undef RTE_SCHED_VECTOR
+// RTE_SCHED_VECTOR is not set
 
 /* KNI defines */
 #define RTE_KNI_PREEMPT_DEFAULT 1
@@ -127,7 +127,7 @@
 
 /* i40e defines */
 #define RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC 1
-#undef RTE_LIBRTE_I40E_16BYTE_RX_DESC
+// RTE_LIBRTE_I40E_16BYTE_RX_DESC is not set
 #define RTE_LIBRTE_I40E_QUEUE_NUM_PER_PF 64
 #define RTE_LIBRTE_I40E_QUEUE_NUM_PER_VF 4
 #define RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM 4
@@ -140,6 +140,6 @@
 #define RTE_LIBRTE_QEDE_FW ""
 
 /* DLB2 defines */
-#undef RTE_LIBRTE_PMD_DLB2_QUELL_STATS
+// RTE_LIBRTE_PMD_DLB2_QUELL_STATS is not set
 
 #endif /* _RTE_CONFIG_H_ */
Signature · 1 line
2.32.0
#1 lore raw
Quoted 26 lines · Bruce Richardson

Rather than explicitly clearing any setting of undefined values in our rte_config.h file, it's better to instead just add a comment that the value is not set. Using a comment allows the user to set the value using CFLAGS or similar mechanism without the config file clearing the value again.

The text used "<VALUE> is not set" is modelled after the kernel approach of doing the same thing.

---

Although DPDK coding convention forbids use of "//" for comments, using regular C comment style makes the config settings less clear, as they can be confused with regular comments in the file. Using "//" makes them stand out better, so I prefer it. However, if others feel strongly, they can be changed to standard.

Note: this is a resubmission of patch [1] which was part of a rejected series. However, the reasons for rejection - values in config being out of sync with those used for building apps - are less relevant for many, if not all, of these setting, so I believe the benefits for testing outweigh the potential downsides. If any setting is likely problematic, I can keep the explicit undef for that case in a new patch version.

Quoted 2 lines

[1] http://patches.dpdk.org/project/dpdk/patch/[email protected]/
---

Ping for review or feedback for this patch. I'd like to see it move forward into a DPDK release if possible.

/Bruce

Quoted 50 lines
 config/rte_config.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
config/rte_config.h +7 -7
index cab4390a97..953216babd 100644
@@ -83,17 +83,17 @@
 
 /* ip_fragmentation defines */
 #define RTE_LIBRTE_IP_FRAG_MAX_FRAG 8
-#undef RTE_LIBRTE_IP_FRAG_TBL_STAT
+// RTE_LIBRTE_IP_FRAG_TBL_STAT is not set
 
 /* rte_power defines */
 #define RTE_MAX_LCORE_FREQS 64
 
 /* rte_sched defines */
-#undef RTE_SCHED_CMAN
-#undef RTE_SCHED_COLLECT_STATS
-#undef RTE_SCHED_SUBPORT_TC_OV
+// RTE_SCHED_CMAN is not set
+// RTE_SCHED_COLLECT_STATS is not set
+// RTE_SCHED_SUBPORT_TC_OV is not set
 #define RTE_SCHED_PORT_N_GRINDERS 8
-#undef RTE_SCHED_VECTOR
+// RTE_SCHED_VECTOR is not set
 
 /* KNI defines */
 #define RTE_KNI_PREEMPT_DEFAULT 1
@@ -127,7 +127,7 @@
 
 /* i40e defines */
 #define RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC 1
-#undef RTE_LIBRTE_I40E_16BYTE_RX_DESC
+// RTE_LIBRTE_I40E_16BYTE_RX_DESC is not set
 #define RTE_LIBRTE_I40E_QUEUE_NUM_PER_PF 64
 #define RTE_LIBRTE_I40E_QUEUE_NUM_PER_VF 4
 #define RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM 4
@@ -140,6 +140,6 @@
 #define RTE_LIBRTE_QEDE_FW ""
 
 /* DLB2 defines */
-#undef RTE_LIBRTE_PMD_DLB2_QUELL_STATS
+// RTE_LIBRTE_PMD_DLB2_QUELL_STATS is not set
 
 #endif /* _RTE_CONFIG_H_ */
Signature · 1 line
2.32.0
#2 lore raw
Quoted 63 lines

From: Bruce Richardson [mailto:[email protected]]
Sent: Monday, 13 June 2022 11.55
To: [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH] config: remove explicit undef of unset values

Quoted 1 line · Bruce Richardson

Rather than explicitly clearing any setting of undefined values in

our

Quoted 2 lines

rte_config.h file, it's better to instead just add a comment that the value is not set. Using a comment allows the user to set the value

using

Quoted 1 line

CFLAGS or similar mechanism without the config file clearing the

value

Quoted 3 lines

again.

The text used "<VALUE> is not set" is modelled after the kernel

approach

Quoted 6 lines

of doing the same thing.

---

Although DPDK coding convention forbids use of "//" for comments,

using

Quoted 1 line

regular C comment style makes the config settings less clear, as they

can

Quoted 1 line

be confused with regular comments in the file. Using "//" makes them

stand

Quoted 1 line

out better, so I prefer it. However, if others feel strongly, they

can be

Quoted 3 lines

changed to standard.

Note: this is a resubmission of patch [1] which was part of a

rejected

Quoted 1 line

series. However, the reasons for rejection - values in config being

out

Quoted 4 lines

of sync with those used for building apps - are less relevant for many, if not all, of these setting, so I believe the benefits for testing outweigh the potential downsides. If any setting is likely problematic, I can keep the explicit undef for that case in a new

patch

Quoted 3 lines

version.

[1] http://patches.dpdk.org/project/dpdk/patch/20200903144942.671870-

[email protected]/

Quoted 1 line

---

Ping for review or feedback for this patch. I'd like to see it move forward
into a DPDK release if possible.

/Bruce

Quoted 9 lines
 config/rte_config.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
config/rte_config.h +0 -0
index cab4390a97..953216babd 100644
@@ -83,17 +83,17 @@
 
Quoted 5 lines

config/rte_config.h line 87

Quoted 5 lines
config/rte_config.h +1 -1
 /* ip_fragmentation defines */
 #define RTE_LIBRTE_IP_FRAG_MAX_FRAG 8
-#undef RTE_LIBRTE_IP_FRAG_TBL_STAT
+// RTE_LIBRTE_IP_FRAG_TBL_STAT is not set
 

Yes, this is the right way to do it.

#3 lore raw
In reply to Bruce Richardson
Quoted 27 lines · Bruce Richardson
Quoted 26 lines · Bruce Richardson

Rather than explicitly clearing any setting of undefined values in our rte_config.h file, it's better to instead just add a comment that the value is not set. Using a comment allows the user to set the value using CFLAGS or similar mechanism without the config file clearing the value again.

The text used "<VALUE> is not set" is modelled after the kernel approach of doing the same thing.

---

Although DPDK coding convention forbids use of "//" for comments, using regular C comment style makes the config settings less clear, as they can be confused with regular comments in the file. Using "//" makes them stand out better, so I prefer it. However, if others feel strongly, they can be changed to standard.

Note: this is a resubmission of patch [1] which was part of a rejected series. However, the reasons for rejection - values in config being out of sync with those used for building apps - are less relevant for many, if not all, of these setting, so I believe the benefits for testing outweigh the potential downsides. If any setting is likely problematic, I can keep the explicit undef for that case in a new patch version.

Quoted 5 lines
Quoted 2 lines

[1] http://patches.dpdk.org/project/dpdk/patch/[email protected]/
---

Ping for review or feedback for this patch. I'd like to see it move forward into a DPDK release if possible.

I'd like a check like (below), to avoid new additions:

devtools/checkpatches.sh +8 -0
index 34a2e43845..8dae47165e 100755
@@ -158,6 +158,14 @@ check_forbidden_additions() { # <patch>
                -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
                "$1" || res=1
 
+       # '// XXX is not set' must be preferred over '#undef XXX'
+       awk -v FOLDERS='config/rte_config.h' \
+               -v EXPRESSIONS='#undef' \
+               -v RET_ON_FAIL=1 \
+               -v MESSAGE='Using "#undef XXX", prefer "// XXX is not set"' \
+               -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+               "$1" || res=1
+
        return $res
 }
 

Otherwise, the change lgtm.

Signature · 1 line
David Marchand
#4 lore raw
Quoted 56 lines · David Marchand
Quoted 27 lines · Bruce Richardson
Quoted 26 lines · Bruce Richardson

Rather than explicitly clearing any setting of undefined values in our rte_config.h file, it's better to instead just add a comment that the value is not set. Using a comment allows the user to set the value using CFLAGS or similar mechanism without the config file clearing the value again.

The text used "<VALUE> is not set" is modelled after the kernel approach of doing the same thing.

---

Although DPDK coding convention forbids use of "//" for comments, using regular C comment style makes the config settings less clear, as they can be confused with regular comments in the file. Using "//" makes them stand out better, so I prefer it. However, if others feel strongly, they can be changed to standard.

Note: this is a resubmission of patch [1] which was part of a rejected series. However, the reasons for rejection - values in config being out of sync with those used for building apps - are less relevant for many, if not all, of these setting, so I believe the benefits for testing outweigh the potential downsides. If any setting is likely problematic, I can keep the explicit undef for that case in a new patch version.

Quoted 5 lines
Quoted 2 lines

[1] http://patches.dpdk.org/project/dpdk/patch/[email protected]/
---

Ping for review or feedback for this patch. I'd like to see it move forward into a DPDK release if possible.

I'd like a check like (below), to avoid new additions:

devtools/checkpatches.sh +8 -0
index 34a2e43845..8dae47165e 100755
@@ -158,6 +158,14 @@ check_forbidden_additions() { # <patch>
                -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
                "$1" || res=1
 
+       # '// XXX is not set' must be preferred over '#undef XXX'
+       awk -v FOLDERS='config/rte_config.h' \
+               -v EXPRESSIONS='#undef' \
+               -v RET_ON_FAIL=1 \
+               -v MESSAGE='Using "#undef XXX", prefer "// XXX is not set"' \
+               -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+               "$1" || res=1
+
        return $res
 }
 
Quoted 2 lines

Otherwise, the change lgtm.

Good idea. Do you want me to add your check above as a patch to this to make a two-patch set for v2?

/Bruce

#5 lore raw
Quoted 21 lines · Bruce Richardson
Quoted 21 lines

I'd like a check like (below), to avoid new additions:

devtools/checkpatches.sh +8 -0
index 34a2e43845..8dae47165e 100755
@@ -158,6 +158,14 @@ check_forbidden_additions() { # <patch>
                -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
                "$1" || res=1
 
+       # '// XXX is not set' must be preferred over '#undef XXX'
+       awk -v FOLDERS='config/rte_config.h' \
+               -v EXPRESSIONS='#undef' \
+               -v RET_ON_FAIL=1 \
+               -v MESSAGE='Using "#undef XXX", prefer "// XXX is not set"' \
+               -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+               "$1" || res=1
+
        return $res
 }
 
Quoted 4 lines
Quoted 2 lines

Otherwise, the change lgtm.

Good idea. Do you want me to add your check above as a patch to this to make a two-patch set for v2?

If you are fine with the check, I don't mind it is part of this simple patch. I can do it when applying if you are okay with it.

Signature · 1 line
David Marchand
#6 lore raw
Quoted 23 lines · David Marchand
Quoted 21 lines · Bruce Richardson
Quoted 21 lines

I'd like a check like (below), to avoid new additions:

devtools/checkpatches.sh +8 -0
index 34a2e43845..8dae47165e 100755
@@ -158,6 +158,14 @@ check_forbidden_additions() { # <patch>
                -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
                "$1" || res=1
 
+       # '// XXX is not set' must be preferred over '#undef XXX'
+       awk -v FOLDERS='config/rte_config.h' \
+               -v EXPRESSIONS='#undef' \
+               -v RET_ON_FAIL=1 \
+               -v MESSAGE='Using "#undef XXX", prefer "// XXX is not set"' \
+               -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+               "$1" || res=1
+
        return $res
 }
 
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Otherwise, the change lgtm.

Good idea. Do you want me to add your check above as a patch to this to make a two-patch set for v2?

If you are fine with the check, I don't mind it is part of this simple patch. I can do it when applying if you are okay with it.

Yes, I'm fine with it, thanks.

#7 lore raw
In reply to Bruce Richardson
Quoted 27 lines · Bruce Richardson
Quoted 26 lines · Bruce Richardson

Rather than explicitly clearing any setting of undefined values in our rte_config.h file, it's better to instead just add a comment that the value is not set. Using a comment allows the user to set the value using CFLAGS or similar mechanism without the config file clearing the value again.

The text used "<VALUE> is not set" is modelled after the kernel approach of doing the same thing.

---

Although DPDK coding convention forbids use of "//" for comments, using regular C comment style makes the config settings less clear, as they can be confused with regular comments in the file. Using "//" makes them stand out better, so I prefer it. However, if others feel strongly, they can be changed to standard.

Note: this is a resubmission of patch [1] which was part of a rejected series. However, the reasons for rejection - values in config being out of sync with those used for building apps - are less relevant for many, if not all, of these setting, so I believe the benefits for testing outweigh the potential downsides. If any setting is likely problematic, I can keep the explicit undef for that case in a new patch version.

Quoted 1 line
Quoted 1 line

[1] http://patches.dpdk.org/project/dpdk/patch/[email protected]/

Acked-by Morten Brørup Acked-by Tyler Retzlaff on v1 1/1
#8 lore raw
In reply to Bruce Richardson
Quoted 11 lines · Bruce Richardson

Rather than explicitly clearing any setting of undefined values in our rte_config.h file, it's better to instead just add a comment that the value is not set. Using a comment allows the user to set the value using CFLAGS or similar mechanism without the config file clearing the value again.

The text used "<VALUE> is not set" is modelled after the kernel approach of doing the same thing.

Rebased, added check as agreed, and applied.
Thanks Bruce.

Signature · 1 line
David Marchand