mesh: Remove debug-only related callback for packet send
authorInga Stotland <inga.stotland@intel.com>
Sun, 31 May 2020 04:41:26 +0000 (21:41 -0700)
committerAbhay Agarwal <ay.agarwal@samsung.com>
Fri, 18 Dec 2020 05:40:30 +0000 (11:10 +0530)
This removes callback for sending every single access layer packet
since the callback does nothing but print debug satement. This
functionality is mature enough not to require such heavy debugging.

Change-Id: I033c970953b21a1f10701d919bc4b2f8789bf86d
Signed-off-by: anuj.bhumiya <anuj.bhumiya@samsung.com>
mesh/model.c
mesh/net.c
mesh/net.h

index 8355a08..ec79a69 100644 (file)
@@ -508,29 +508,6 @@ static int virt_packet_decrypt(struct mesh_net *net, const uint8_t *data,
        return -1;
 }
 
-static void cmplt(uint16_t remote, uint8_t status,
-                                       void *data, uint16_t size,
-                                       void *user_data)
-{
-       struct timeval tx_end;
-
-       gettimeofday(&tx_end, NULL);
-
-       if (tx_end.tv_sec == tx_start.tv_sec) {
-               l_debug("Duration 0.%6.6lu seconds",
-                               tx_end.tv_usec - tx_start.tv_usec);
-       } else {
-               if (tx_start.tv_usec > tx_end.tv_usec)
-                       l_debug("Duration %lu.%6.6lu seconds",
-                               tx_end.tv_sec - tx_start.tv_sec - 1,
-                               tx_end.tv_usec + 1000000 - tx_start.tv_usec);
-               else
-                       l_debug("Duration %lu.%6.6lu seconds",
-                                       tx_end.tv_sec - tx_start.tv_sec,
-                                       tx_end.tv_usec - tx_start.tv_usec);
-       }
-}
-
 static bool msg_send(struct mesh_node *node, bool credential, uint16_t src,
                uint32_t dst, uint16_t app_idx, uint16_t net_idx,
                uint8_t *label, uint8_t ttl, bool segmented,
@@ -585,9 +562,9 @@ static bool msg_send(struct mesh_node *node, bool credential, uint16_t src,
                goto done;
        }
 
-       ret = mesh_net_app_send(net, credential, src, dst, key_aid, net_idx,
+       ret =  mesh_net_app_send(net, credential, src, dst, key_aid, net_idx,
                                        ttl, seq_num, iv_index, segmented,
-                                       szmic, out, out_len, cmplt, NULL);
+                                       szmic, out, out_len);
 done:
        l_free(out);
        return ret;
index 1e49df9..c57beed 100644 (file)
@@ -169,8 +169,6 @@ struct mesh_sar {
        unsigned int id;
        struct l_timeout *seg_timeout;
        struct l_timeout *msg_timeout;
-       mesh_net_status_func_t status_func;
-       void *user_data;
        uint32_t flags;
        uint32_t last_nak;
        uint32_t iv_index;
@@ -1655,12 +1653,6 @@ static void outmsg_to(struct l_timeout *msg_timeout, void *user_data)
                return;
 
        sar->msg_timeout = NULL;
-
-       if (sar->status_func)
-               sar->status_func(sar->remote, 1,
-                               sar->buf, sar->len - 4,
-                               sar->user_data);
-
        mesh_sar_free(sar);
 }
 
@@ -1710,10 +1702,6 @@ static void ack_received(struct mesh_net *net, bool timeout,
                l_debug("ob_sar_removal (%x)", outgoing->flags);
 
                /* Note: ack_flags == 0x00000000 is a remote Cancel request */
-               if (outgoing->status_func)
-                       outgoing->status_func(src, ack_flag ? 0 : 1,
-                                       outgoing->buf,
-                                       outgoing->len - 4, outgoing->user_data);
 
                l_queue_remove(net->sar_out, outgoing);
                send_queued_sar(net, outgoing->remote);
@@ -3152,9 +3140,7 @@ bool mesh_net_app_send(struct mesh_net *net, bool frnd_cred, uint16_t src,
                                uint16_t dst, uint8_t key_aid, uint16_t net_idx,
                                uint8_t ttl, uint32_t seq, uint32_t iv_index,
                                bool segmented, bool szmic,
-                               const void *msg, uint16_t msg_len,
-                               mesh_net_status_func_t status_func,
-                               void *user_data)
+                               const void *msg, uint16_t msg_len)
 {
        struct mesh_sar *payload = NULL;
        uint8_t seg, seg_max;
@@ -3212,8 +3198,6 @@ bool mesh_net_app_send(struct mesh_net *net, bool frnd_cred, uint16_t src,
        if (segmented) {
                payload->flags = 0xffffffff >> (31 - seg_max);
                payload->seqZero = seq & SEQ_ZERO_MASK;
-               payload->status_func = status_func;
-               payload->user_data = user_data;
                payload->id = ++net->sar_id_next;
 
                /* Single thread SAR messages to same Unicast DST */
@@ -3249,8 +3233,6 @@ bool mesh_net_app_send(struct mesh_net *net, bool frnd_cred, uint16_t src,
                        l_timeout_create(SEG_TO, outseg_to, net, NULL);
                payload->msg_timeout =
                        l_timeout_create(MSG_TO, outmsg_to, net, NULL);
-               payload->status_func = status_func;
-               payload->user_data = user_data;
                payload->id = ++net->sar_id_next;
        } else
                mesh_sar_free(payload);
index 8646d5a..12808ce 100644 (file)
@@ -260,9 +260,6 @@ struct mesh_friend_msg {
 };
 
 typedef void (*mesh_status_func_t)(void *user_data, bool result);
-typedef void (*mesh_net_status_func_t)(uint16_t remote, uint8_t status,
-                                       void *data, uint16_t size,
-                                       void *user_data);
 
 struct mesh_net *mesh_net_new(struct mesh_node *node);
 void mesh_net_free(void *net);
@@ -313,10 +310,8 @@ void mesh_net_transport_send(struct mesh_net *net, uint32_t key_id,
 bool mesh_net_app_send(struct mesh_net *net, bool frnd_cred, uint16_t src,
                                uint16_t dst, uint8_t key_id, uint16_t net_idx,
                                uint8_t ttl, uint32_t seq, uint32_t iv_index,
-                               bool segmented, bool szmic,
-                               const void *msg, uint16_t msg_len,
-                               mesh_net_status_func_t status_func,
-                               void *user_data);
+                               bool segmented, bool szmic, const void *msg,
+                               uint16_t msg_len);
 void mesh_net_ack_send(struct mesh_net *net, uint32_t key_id,
                                uint32_t iv_index, uint8_t ttl, uint32_t seq,
                                uint16_t src, uint16_t dst, bool rly,