Skip to contentSkip to conversation

mesh: Implement lower transport layer for segmentation and reassembly

PATCH In review Junho Lee 2 participants 3 messages Oct 14, 2024 – Nov 11, 2024 Bluetooth drivers

lore
Share & tools
lore

Junho Lee

author
#0 lore raw

PATCH v3 1/4 mesh: Implement lower transport layer for segmentation and reassembly

These is implementations of segmentation and reassembly, except for the friend feature for LPN nodes, implemented according to Mesh Protocol 1.1 section 3.5.3.
Sections 4.2.48 and 4.2.49 of Mesh Protocol 1.1 define the transmission interval, number of retransmissions, retransmission interval, ack transmission, number of ack retransmissions, ack retransmission interval, ack retransmission interval, and discard time for SAR, which is a mutable state, and required a SAR implementation that conforms to the specification. The existing segmentation and reassembly were implemented before the specification was officially released, so they were fixed.

- In the previous implementation, the segments of the SAR were sent to the network layer immediately for every segO. This has been changed so that they are sent one after the other when the timer expires for each segment interval state.
- In the previous implementation, the SAR retransmission feature for multicast sent all segments to the network layer a fixed four times. This has been changed to send as many SAR retransmissions for multicast as the number of states.
- In the original implementation, the SAR retransmission feaure for unicast was persistent as long as the receiver was receiving additional segments. This has been changed to send as many SAR retransmissions for unicast as the number of states.
- In the previous implementation, the SAR transfer feature for the same destination worked as a single thread, so if SAR transfers were duplicated, queuing was used to delay the transfer, but if the upper transport layer required successive SAR transfers, the queue would stack up infinitely. This was solved by discarding existing SAR transmissions when SAR transmissions for the same destination are required.
- In the previous implementation, an ack was sent each time a segment was received for a SAR that had already been successfully received. This has been changed to sending an ACK only once within a certain period.

---
 mesh/mesh.c |  45 ++++
 mesh/mesh.h |   2 +
 mesh/net.c  | 672 +++++++++++++++++++++++++++++++++++-----------------
 3 files changed, 498 insertions(+), 221 deletions(-)
mesh/mesh.c +45 -0
index 91cf25175..f89230b6c 100644
@@ -95,6 +95,41 @@ static struct l_queue *pending_queue;
 
 static const char *storage_dir;
 
+struct mesh_sar_transmitter {
+	uint8_t	seg_int_step;
+	uint8_t	unicast_rtx_cnt;
+	uint8_t	unicast_rtx_without_prog_cnt;
+	uint8_t	unicast_rtx_int_step;
+	uint8_t	unicast_rtx_int_inc;
+	uint8_t	multicast_rtx_cnt;
+	uint8_t	multicast_rtx_int_step;
+};
+
+struct mesh_sar_receiver {
+	uint8_t	seg_threshold;
+	uint8_t	ack_delay_inc;
+	uint8_t	ack_rtx_cnt;
+	uint8_t	discard_timeout;
+	uint8_t	receiver_seg_int_step;
+};
+
+static struct mesh_sar_transmitter mesh_sar_txr = {
+	.seg_int_step = 5,
+	.unicast_rtx_cnt = 2,
+	.unicast_rtx_without_prog_cnt = 2,
+	.unicast_rtx_int_step = 7,
+	.unicast_rtx_int_inc = 1,
+	.multicast_rtx_cnt = 2,
+	.multicast_rtx_int_step = 8
+};
+static struct mesh_sar_receiver mesh_sar_rxr = {
+	.seg_threshold = 3,
+	.ack_delay_inc = 1,
+	.ack_rtx_cnt = 0,
+	.discard_timeout = 1,
+	.receiver_seg_int_step = 5
+};
+
 /* Forward static decalrations */
 static void def_attach(struct l_timeout *timeout, void *user_data);
 static void def_leave(struct l_timeout *timeout, void *user_data);
@@ -203,6 +238,16 @@ uint8_t mesh_get_friend_queue_size(void)
 	return mesh.friend_queue_sz;
 }
 
+void mesh_get_sar_transmitter(void *sar_txr)
+{
+	memcpy(sar_txr, &mesh_sar_txr, sizeof(struct mesh_sar_transmitter));
+}
+
+void mesh_get_sar_receiver(void *sar_rxr)
+{
+	memcpy(sar_rxr, &mesh_sar_rxr, sizeof(struct mesh_sar_receiver));
+}
+
 static void parse_settings(const char *mesh_conf_fname)
 {
 	struct l_settings *settings;
mesh/mesh.h +2 -0
index c30a8d1f0..5d62f35c8 100644
@@ -43,3 +43,5 @@ bool mesh_relay_supported(void);
 bool mesh_friendship_supported(void);
 uint16_t mesh_get_crpl(void);
 uint8_t mesh_get_friend_queue_size(void);
+void mesh_get_sar_transmitter(void *sar_txr);
+void mesh_get_sar_receiver(void *sar_rxr);
mesh/net.c +451 -221

959 lines not on this page · raw message

Signature · 1 line
2.34.1
#1 lore raw

RE: mesh: Fix segmentation behavior of Lower transport layer

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=898733

---Test result---

Test Summary:

CheckPatch                    PASS      2.12 seconds
GitLint                       FAIL      1.27 seconds
BuildEll                      PASS      24.90 seconds
BluezMake                     PASS      1680.91 seconds
MakeCheck                     PASS      13.10 seconds
MakeDistcheck                 PASS      182.16 seconds
CheckValgrind                 PASS      256.27 seconds
CheckSmatch                   PASS      361.24 seconds
bluezmakeextell               PASS      122.15 seconds
IncrementalBuild              PASS      6303.61 seconds
ScanBuild                     PASS      1060.98 seconds

Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[BlueZ,v3,1/4] mesh: Implement lower transport layer for segmentation and reassembly

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
1: T1 Title exceeds max length (84>80): "[BlueZ,v3,1/4] mesh: Implement lower transport layer for segmentation and reassembly"

---
Regards,
Linux Bluetooth

author
#2 lore raw

Re: mesh: Fix segmentation behavior of Lower transport layer

Hello Brian,

Thank you for taking the time to review the patch despite your busy schedule.

The patch I sent over relates to the Segmentation section within BlueZ. Since it’s been nearly a month without a response, I wanted to follow up as a reminder. If you encounter any issues during the review or see any areas that need improvement, please feel free to reach out.

As I mentioned in my previous email, I aimed to keep any refactoring or optimization changes to a minimum, focusing primarily on the modified logic itself to ease the review process. However, if additional optimization or refactoring is required, I’m happy to provide further patches as needed.

Best regards,
Junho Lee

Quoted 38 lines · On Mon, Oct 14, 2024 at 04:09:03AM -0700, [email protected] wrote:

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=898733

---Test result---

Test Summary:

CheckPatch                    PASS      2.12 seconds
GitLint                       FAIL      1.27 seconds
BuildEll                      PASS      24.90 seconds
BluezMake                     PASS      1680.91 seconds
MakeCheck                     PASS      13.10 seconds
MakeDistcheck                 PASS      182.16 seconds
CheckValgrind                 PASS      256.27 seconds
CheckSmatch                   PASS      361.24 seconds
bluezmakeextell               PASS      122.15 seconds
IncrementalBuild              PASS      6303.61 seconds
ScanBuild                     PASS      1060.98 seconds

Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[BlueZ,v3,1/4] mesh: Implement lower transport layer for segmentation and reassembly

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
1: T1 Title exceeds max length (84>80): "[BlueZ,v3,1/4] mesh: Implement lower transport layer for segmentation and reassembly"

---
Regards,
Linux Bluetooth