From c1b3ecc9fa60e9182fb48166ea55986531e80df2 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Sun, 3 Apr 2022 20:07:52 +0800 Subject: [PATCH] kernel: backport qrtr changes for 4.9/4.14 Required by package libqrtr-glib. Signed-off-by: Tianling Shen --- ...t-qrtr-Move-constants-to-header-file.patch | 38 +++++++++ ...dd-control-packet-definition-to-uapi.patch | 79 +++++++++++++++++++ ...t-qrtr-Move-constants-to-header-file.patch | 38 +++++++++ ...dd-control-packet-definition-to-uapi.patch | 79 +++++++++++++++++++ 4 files changed, 234 insertions(+) create mode 100644 target/linux/generic/backport-4.14/610-v4.15-net-qrtr-Move-constants-to-header-file.patch create mode 100644 target/linux/generic/backport-4.14/611-v4.15-net-qrtr-Add-control-packet-definition-to-uapi.patch create mode 100644 target/linux/generic/backport-4.9/610-v4.15-net-qrtr-Move-constants-to-header-file.patch create mode 100644 target/linux/generic/backport-4.9/611-v4.15-net-qrtr-Add-control-packet-definition-to-uapi.patch diff --git a/target/linux/generic/backport-4.14/610-v4.15-net-qrtr-Move-constants-to-header-file.patch b/target/linux/generic/backport-4.14/610-v4.15-net-qrtr-Move-constants-to-header-file.patch new file mode 100644 index 0000000000..e684f8c4e4 --- /dev/null +++ b/target/linux/generic/backport-4.14/610-v4.15-net-qrtr-Move-constants-to-header-file.patch @@ -0,0 +1,38 @@ +From 28978713c51b0a70acf748f76f9d6d2d20dcf980 Mon Sep 17 00:00:00 2001 +From: Bjorn Andersson +Date: Tue, 10 Oct 2017 23:45:18 -0700 +Subject: [PATCH] net: qrtr: Move constants to header file + +The constants are used by both the name server and clients, so clarify +their value and move them to the uapi header. + +Signed-off-by: Bjorn Andersson +Signed-off-by: David S. Miller +--- + include/uapi/linux/qrtr.h | 3 +++ + net/qrtr/qrtr.c | 2 -- + 2 files changed, 3 insertions(+), 2 deletions(-) + +--- a/include/uapi/linux/qrtr.h ++++ b/include/uapi/linux/qrtr.h +@@ -5,6 +5,9 @@ + #include + #include + ++#define QRTR_NODE_BCAST 0xffffffffu ++#define QRTR_PORT_CTRL 0xfffffffeu ++ + struct sockaddr_qrtr { + __kernel_sa_family_t sq_family; + __u32 sq_node; +--- a/net/qrtr/qrtr.c ++++ b/net/qrtr/qrtr.c +@@ -61,8 +61,6 @@ struct qrtr_hdr { + } __packed; + + #define QRTR_HDR_SIZE sizeof(struct qrtr_hdr) +-#define QRTR_NODE_BCAST ((unsigned int)-1) +-#define QRTR_PORT_CTRL ((unsigned int)-2) + + struct qrtr_sock { + /* WARNING: sk must be the first member */ diff --git a/target/linux/generic/backport-4.14/611-v4.15-net-qrtr-Add-control-packet-definition-to-uapi.patch b/target/linux/generic/backport-4.14/611-v4.15-net-qrtr-Add-control-packet-definition-to-uapi.patch new file mode 100644 index 0000000000..8b2448a777 --- /dev/null +++ b/target/linux/generic/backport-4.14/611-v4.15-net-qrtr-Add-control-packet-definition-to-uapi.patch @@ -0,0 +1,79 @@ +From da7653f0faabbe45eb2d3fd6e4b400fe003e81ae Mon Sep 17 00:00:00 2001 +From: Bjorn Andersson +Date: Tue, 10 Oct 2017 23:45:19 -0700 +Subject: [PATCH] net: qrtr: Add control packet definition to uapi + +The QMUX protocol specification defines structure of the special control +packet messages being sent between handlers of the control port. + +Add these to the uapi header, as this structure and the associated types +are shared between the kernel and all userspace handlers of control +messages. + +Signed-off-by: Bjorn Andersson +Signed-off-by: David S. Miller +--- + include/uapi/linux/qrtr.h | 32 ++++++++++++++++++++++++++++++++ + net/qrtr/qrtr.c | 12 ------------ + 2 files changed, 32 insertions(+), 12 deletions(-) + +--- a/include/uapi/linux/qrtr.h ++++ b/include/uapi/linux/qrtr.h +@@ -14,4 +14,36 @@ struct sockaddr_qrtr { + __u32 sq_port; + }; + ++enum qrtr_pkt_type { ++ QRTR_TYPE_DATA = 1, ++ QRTR_TYPE_HELLO = 2, ++ QRTR_TYPE_BYE = 3, ++ QRTR_TYPE_NEW_SERVER = 4, ++ QRTR_TYPE_DEL_SERVER = 5, ++ QRTR_TYPE_DEL_CLIENT = 6, ++ QRTR_TYPE_RESUME_TX = 7, ++ QRTR_TYPE_EXIT = 8, ++ QRTR_TYPE_PING = 9, ++ QRTR_TYPE_NEW_LOOKUP = 10, ++ QRTR_TYPE_DEL_LOOKUP = 11, ++}; ++ ++struct qrtr_ctrl_pkt { ++ __le32 cmd; ++ ++ union { ++ struct { ++ __le32 service; ++ __le32 instance; ++ __le32 node; ++ __le32 port; ++ } server; ++ ++ struct { ++ __le32 node; ++ __le32 port; ++ } client; ++ }; ++} __packed; ++ + #endif /* _LINUX_QRTR_H */ +--- a/net/qrtr/qrtr.c ++++ b/net/qrtr/qrtr.c +@@ -26,18 +26,6 @@ + #define QRTR_MIN_EPH_SOCKET 0x4000 + #define QRTR_MAX_EPH_SOCKET 0x7fff + +-enum qrtr_pkt_type { +- QRTR_TYPE_DATA = 1, +- QRTR_TYPE_HELLO = 2, +- QRTR_TYPE_BYE = 3, +- QRTR_TYPE_NEW_SERVER = 4, +- QRTR_TYPE_DEL_SERVER = 5, +- QRTR_TYPE_DEL_CLIENT = 6, +- QRTR_TYPE_RESUME_TX = 7, +- QRTR_TYPE_EXIT = 8, +- QRTR_TYPE_PING = 9, +-}; +- + /** + * struct qrtr_hdr - (I|R)PCrouter packet header + * @version: protocol version diff --git a/target/linux/generic/backport-4.9/610-v4.15-net-qrtr-Move-constants-to-header-file.patch b/target/linux/generic/backport-4.9/610-v4.15-net-qrtr-Move-constants-to-header-file.patch new file mode 100644 index 0000000000..e684f8c4e4 --- /dev/null +++ b/target/linux/generic/backport-4.9/610-v4.15-net-qrtr-Move-constants-to-header-file.patch @@ -0,0 +1,38 @@ +From 28978713c51b0a70acf748f76f9d6d2d20dcf980 Mon Sep 17 00:00:00 2001 +From: Bjorn Andersson +Date: Tue, 10 Oct 2017 23:45:18 -0700 +Subject: [PATCH] net: qrtr: Move constants to header file + +The constants are used by both the name server and clients, so clarify +their value and move them to the uapi header. + +Signed-off-by: Bjorn Andersson +Signed-off-by: David S. Miller +--- + include/uapi/linux/qrtr.h | 3 +++ + net/qrtr/qrtr.c | 2 -- + 2 files changed, 3 insertions(+), 2 deletions(-) + +--- a/include/uapi/linux/qrtr.h ++++ b/include/uapi/linux/qrtr.h +@@ -5,6 +5,9 @@ + #include + #include + ++#define QRTR_NODE_BCAST 0xffffffffu ++#define QRTR_PORT_CTRL 0xfffffffeu ++ + struct sockaddr_qrtr { + __kernel_sa_family_t sq_family; + __u32 sq_node; +--- a/net/qrtr/qrtr.c ++++ b/net/qrtr/qrtr.c +@@ -61,8 +61,6 @@ struct qrtr_hdr { + } __packed; + + #define QRTR_HDR_SIZE sizeof(struct qrtr_hdr) +-#define QRTR_NODE_BCAST ((unsigned int)-1) +-#define QRTR_PORT_CTRL ((unsigned int)-2) + + struct qrtr_sock { + /* WARNING: sk must be the first member */ diff --git a/target/linux/generic/backport-4.9/611-v4.15-net-qrtr-Add-control-packet-definition-to-uapi.patch b/target/linux/generic/backport-4.9/611-v4.15-net-qrtr-Add-control-packet-definition-to-uapi.patch new file mode 100644 index 0000000000..8b2448a777 --- /dev/null +++ b/target/linux/generic/backport-4.9/611-v4.15-net-qrtr-Add-control-packet-definition-to-uapi.patch @@ -0,0 +1,79 @@ +From da7653f0faabbe45eb2d3fd6e4b400fe003e81ae Mon Sep 17 00:00:00 2001 +From: Bjorn Andersson +Date: Tue, 10 Oct 2017 23:45:19 -0700 +Subject: [PATCH] net: qrtr: Add control packet definition to uapi + +The QMUX protocol specification defines structure of the special control +packet messages being sent between handlers of the control port. + +Add these to the uapi header, as this structure and the associated types +are shared between the kernel and all userspace handlers of control +messages. + +Signed-off-by: Bjorn Andersson +Signed-off-by: David S. Miller +--- + include/uapi/linux/qrtr.h | 32 ++++++++++++++++++++++++++++++++ + net/qrtr/qrtr.c | 12 ------------ + 2 files changed, 32 insertions(+), 12 deletions(-) + +--- a/include/uapi/linux/qrtr.h ++++ b/include/uapi/linux/qrtr.h +@@ -14,4 +14,36 @@ struct sockaddr_qrtr { + __u32 sq_port; + }; + ++enum qrtr_pkt_type { ++ QRTR_TYPE_DATA = 1, ++ QRTR_TYPE_HELLO = 2, ++ QRTR_TYPE_BYE = 3, ++ QRTR_TYPE_NEW_SERVER = 4, ++ QRTR_TYPE_DEL_SERVER = 5, ++ QRTR_TYPE_DEL_CLIENT = 6, ++ QRTR_TYPE_RESUME_TX = 7, ++ QRTR_TYPE_EXIT = 8, ++ QRTR_TYPE_PING = 9, ++ QRTR_TYPE_NEW_LOOKUP = 10, ++ QRTR_TYPE_DEL_LOOKUP = 11, ++}; ++ ++struct qrtr_ctrl_pkt { ++ __le32 cmd; ++ ++ union { ++ struct { ++ __le32 service; ++ __le32 instance; ++ __le32 node; ++ __le32 port; ++ } server; ++ ++ struct { ++ __le32 node; ++ __le32 port; ++ } client; ++ }; ++} __packed; ++ + #endif /* _LINUX_QRTR_H */ +--- a/net/qrtr/qrtr.c ++++ b/net/qrtr/qrtr.c +@@ -26,18 +26,6 @@ + #define QRTR_MIN_EPH_SOCKET 0x4000 + #define QRTR_MAX_EPH_SOCKET 0x7fff + +-enum qrtr_pkt_type { +- QRTR_TYPE_DATA = 1, +- QRTR_TYPE_HELLO = 2, +- QRTR_TYPE_BYE = 3, +- QRTR_TYPE_NEW_SERVER = 4, +- QRTR_TYPE_DEL_SERVER = 5, +- QRTR_TYPE_DEL_CLIENT = 6, +- QRTR_TYPE_RESUME_TX = 7, +- QRTR_TYPE_EXIT = 8, +- QRTR_TYPE_PING = 9, +-}; +- + /** + * struct qrtr_hdr - (I|R)PCrouter packet header + * @version: protocol version