Re: [RFC PATCH] pps: Increase PPS_MAX_SOURCES value.

From: Rodolfo Giometti
Date: Wed Jun 07 2023 - 03:36:16 EST


On 05/06/23 22:31, Charlie Johnston wrote:
For consistency with what ptp uses for minors, this
change sets PPS_MAX_SOURCES to MINORMASK + 1.

The PPS_MAX_SOURCES value is currently set to 16. In
some cases this was not sufficient for a system. For
example, a system with multiple (4+) PCIe cards each
with 4 PTP-capable ethernet interfaces could run out
of the available PPS major:minors if each interface
registers a PPS source.

Signed-off-by: Charlie Johnston <charlie.johnston@xxxxxx>
---
include/uapi/linux/pps.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/linux/pps.h b/include/uapi/linux/pps.h
index 009ebcd8ced5..85f472330da8 100644
--- a/include/uapi/linux/pps.h
+++ b/include/uapi/linux/pps.h
@@ -26,7 +26,7 @@
#include <linux/types.h>
#define PPS_VERSION "5.3.6"
-#define PPS_MAX_SOURCES 16 /* should be enough... */
+#define PPS_MAX_SOURCES (MINORMASK + 1)
/* Implementation note: the logical states ``assert'' and ``clear''
* are implemented in terms of the chip register, i.e. ``assert''

I have just one question: are you sure that it's safe to call idr_alloc(..., 0, (MINORMASK + 1), ...)?

Ciao,

Rodolfo

--
GNU/Linux Solutions e-mail: giometti@xxxxxxxxxxxx
Linux Device Driver giometti@xxxxxxxx
Embedded Systems phone: +39 349 2432127
UNIX programming skype: rodolfo.giometti