diff mbox series

[BlueZ,1/2] mesh: Get rid of "unreliable opcodes" in config server

Message ID 20200707164439.24146-1-inga.stotland@intel.com (mailing list archive)
State Accepted
Headers show
Series [BlueZ,1/2] mesh: Get rid of "unreliable opcodes" in config server | expand

Commit Message

Stotland, Inga July 7, 2020, 4:44 p.m. UTC
This removes an old notion of unreliable opcodes in config server
model , i.e., a correctly formatted acknowledged message always
gets a response.
---
 mesh/cfgmod-server.c | 31 +++++++++++--------------------
 mesh/model.h         |  2 --
 2 files changed, 11 insertions(+), 22 deletions(-)

Comments

Brian Gix July 8, 2020, 5:56 p.m. UTC | #1
Patchset Applied

On Tue, 2020-07-07 at 09:44 -0700, Inga Stotland wrote:
> This removes an old notion of unreliable opcodes in config server
> model , i.e., a correctly formatted acknowledged message always
> gets a response.
> ---
>  mesh/cfgmod-server.c | 31 +++++++++++--------------------
>  mesh/model.h         |  2 --
>  2 files changed, 11 insertions(+), 22 deletions(-)
> 
> diff --git a/mesh/cfgmod-server.c b/mesh/cfgmod-server.c
> index c525d9d24..8ba9bc6ec 100644
> --- a/mesh/cfgmod-server.c
> +++ b/mesh/cfgmod-server.c
> @@ -98,9 +98,8 @@ static void config_pub_get(struct mesh_node *node, uint16_t net_idx,
>  }
>  
>  static void config_pub_set(struct mesh_node *node, uint16_t net_idx,
> -					uint16_t src, uint16_t dst,
> -					const uint8_t *pkt, bool virt,
> -					bool vendor, bool unreliable)
> +				uint16_t src, uint16_t dst,
> +				const uint8_t *pkt, bool virt, bool vendor)
>  {
>  	uint32_t mod_id;
>  	uint16_t ele_addr, idx, ota = UNASSIGNED_ADDRESS;
> @@ -143,9 +142,8 @@ static void config_pub_set(struct mesh_node *node, uint16_t net_idx,
>  					status, ele_addr, ota, mod_id, idx);
>  
>  	if (status != MESH_STATUS_SUCCESS) {
> -		if (!unreliable)
> -			send_pub_status(node, net_idx, src, dst, status,
> -					ele_addr, mod_id, 0, 0, 0, 0, 0, 0);
> +		send_pub_status(node, net_idx, src, dst, status, ele_addr,
> +						mod_id, 0, 0, 0, 0, 0, 0);
>  
>  		return;
>  	}
> @@ -180,10 +178,8 @@ static void config_pub_set(struct mesh_node *node, uint16_t net_idx,
>  			status = MESH_STATUS_STORAGE_FAIL;
>  	}
>  
> -	if (!unreliable)
> -		send_pub_status(node, net_idx, src, dst, status, ele_addr,
> -					mod_id, ota, idx, cred_flag, ttl,
> -					period, retransmit);
> +	send_pub_status(node, net_idx, src, dst, status, ele_addr, mod_id, ota,
> +				idx, cred_flag, ttl, period, retransmit);
>  }
>  
>  static void send_sub_status(struct mesh_node *node, uint16_t net_idx,
> @@ -311,7 +307,6 @@ static void config_sub_set(struct mesh_node *node, uint16_t net_idx,
>  					bool virt, uint32_t opcode)
>  {
>  	uint16_t grp, ele_addr;
> -	bool unreliable = !!(opcode & OP_UNRELIABLE);
>  	uint32_t mod_id;
>  	const uint8_t *addr = NULL;
>  	int status = MESH_STATUS_SUCCESS;
> @@ -369,7 +364,7 @@ static void config_sub_set(struct mesh_node *node, uint16_t net_idx,
>  	} else
>  		grp = UNASSIGNED_ADDRESS;
>  
> -	switch (opcode & ~OP_UNRELIABLE) {
> +	switch (opcode) {
>  	default:
>  		l_debug("Bad opcode: %x", opcode);
>  		return;
> @@ -411,8 +406,8 @@ static void config_sub_set(struct mesh_node *node, uint16_t net_idx,
>  		grp = UNASSIGNED_ADDRESS;
>  		/* Fall Through */
>  	case OP_CONFIG_MODEL_SUB_DELETE:
> -		status = mesh_model_sub_del(node, ele_addr, mod_id,
> -							addr, virt, &grp);
> +		status = mesh_model_sub_del(node, ele_addr, mod_id, addr, virt,
> +									&grp);
>  
>  		if (status == MESH_STATUS_SUCCESS)
>  			save_config_sub(node, ele_addr, mod_id, vendor, addr,
> @@ -421,10 +416,7 @@ static void config_sub_set(struct mesh_node *node, uint16_t net_idx,
>  		break;
>  	}
>  
> -	if (!unreliable)
> -		send_sub_status(node, net_idx, src, dst, status, ele_addr,
> -								grp, mod_id);
> -
> +	send_sub_status(node, net_idx, src, dst, status, ele_addr, grp, mod_id);
>  }
>  
>  static void send_model_app_status(struct mesh_node *node, uint16_t net_idx,
> @@ -786,8 +778,7 @@ static bool cfg_srv_pkt(uint16_t src, uint16_t dst, uint16_t app_idx,
>  			return true;
>  
>  		config_pub_set(node, net_idx, src, dst, pkt, virt,
> -						size == 13 || size == 27,
> -						!!(opcode & OP_UNRELIABLE));
> +						size == 13 || size == 27);
>  		break;
>  
>  	case OP_CONFIG_MODEL_PUB_GET:
> diff --git a/mesh/model.h b/mesh/model.h
> index f717fb00c..0377d3fdd 100644
> --- a/mesh/model.h
> +++ b/mesh/model.h
> @@ -19,8 +19,6 @@
>  
>  struct mesh_model;
>  
> -#define OP_UNRELIABLE			0x0100
> -
>  #define MAX_BINDINGS	10
>  #define MAX_GRP_PER_MOD	10
>
diff mbox series

Patch

diff --git a/mesh/cfgmod-server.c b/mesh/cfgmod-server.c
index c525d9d24..8ba9bc6ec 100644
--- a/mesh/cfgmod-server.c
+++ b/mesh/cfgmod-server.c
@@ -98,9 +98,8 @@  static void config_pub_get(struct mesh_node *node, uint16_t net_idx,
 }
 
 static void config_pub_set(struct mesh_node *node, uint16_t net_idx,
-					uint16_t src, uint16_t dst,
-					const uint8_t *pkt, bool virt,
-					bool vendor, bool unreliable)
+				uint16_t src, uint16_t dst,
+				const uint8_t *pkt, bool virt, bool vendor)
 {
 	uint32_t mod_id;
 	uint16_t ele_addr, idx, ota = UNASSIGNED_ADDRESS;
@@ -143,9 +142,8 @@  static void config_pub_set(struct mesh_node *node, uint16_t net_idx,
 					status, ele_addr, ota, mod_id, idx);
 
 	if (status != MESH_STATUS_SUCCESS) {
-		if (!unreliable)
-			send_pub_status(node, net_idx, src, dst, status,
-					ele_addr, mod_id, 0, 0, 0, 0, 0, 0);
+		send_pub_status(node, net_idx, src, dst, status, ele_addr,
+						mod_id, 0, 0, 0, 0, 0, 0);
 
 		return;
 	}
@@ -180,10 +178,8 @@  static void config_pub_set(struct mesh_node *node, uint16_t net_idx,
 			status = MESH_STATUS_STORAGE_FAIL;
 	}
 
-	if (!unreliable)
-		send_pub_status(node, net_idx, src, dst, status, ele_addr,
-					mod_id, ota, idx, cred_flag, ttl,
-					period, retransmit);
+	send_pub_status(node, net_idx, src, dst, status, ele_addr, mod_id, ota,
+				idx, cred_flag, ttl, period, retransmit);
 }
 
 static void send_sub_status(struct mesh_node *node, uint16_t net_idx,
@@ -311,7 +307,6 @@  static void config_sub_set(struct mesh_node *node, uint16_t net_idx,
 					bool virt, uint32_t opcode)
 {
 	uint16_t grp, ele_addr;
-	bool unreliable = !!(opcode & OP_UNRELIABLE);
 	uint32_t mod_id;
 	const uint8_t *addr = NULL;
 	int status = MESH_STATUS_SUCCESS;
@@ -369,7 +364,7 @@  static void config_sub_set(struct mesh_node *node, uint16_t net_idx,
 	} else
 		grp = UNASSIGNED_ADDRESS;
 
-	switch (opcode & ~OP_UNRELIABLE) {
+	switch (opcode) {
 	default:
 		l_debug("Bad opcode: %x", opcode);
 		return;
@@ -411,8 +406,8 @@  static void config_sub_set(struct mesh_node *node, uint16_t net_idx,
 		grp = UNASSIGNED_ADDRESS;
 		/* Fall Through */
 	case OP_CONFIG_MODEL_SUB_DELETE:
-		status = mesh_model_sub_del(node, ele_addr, mod_id,
-							addr, virt, &grp);
+		status = mesh_model_sub_del(node, ele_addr, mod_id, addr, virt,
+									&grp);
 
 		if (status == MESH_STATUS_SUCCESS)
 			save_config_sub(node, ele_addr, mod_id, vendor, addr,
@@ -421,10 +416,7 @@  static void config_sub_set(struct mesh_node *node, uint16_t net_idx,
 		break;
 	}
 
-	if (!unreliable)
-		send_sub_status(node, net_idx, src, dst, status, ele_addr,
-								grp, mod_id);
-
+	send_sub_status(node, net_idx, src, dst, status, ele_addr, grp, mod_id);
 }
 
 static void send_model_app_status(struct mesh_node *node, uint16_t net_idx,
@@ -786,8 +778,7 @@  static bool cfg_srv_pkt(uint16_t src, uint16_t dst, uint16_t app_idx,
 			return true;
 
 		config_pub_set(node, net_idx, src, dst, pkt, virt,
-						size == 13 || size == 27,
-						!!(opcode & OP_UNRELIABLE));
+						size == 13 || size == 27);
 		break;
 
 	case OP_CONFIG_MODEL_PUB_GET:
diff --git a/mesh/model.h b/mesh/model.h
index f717fb00c..0377d3fdd 100644
--- a/mesh/model.h
+++ b/mesh/model.h
@@ -19,8 +19,6 @@ 
 
 struct mesh_model;
 
-#define OP_UNRELIABLE			0x0100
-
 #define MAX_BINDINGS	10
 #define MAX_GRP_PER_MOD	10