mesh: Cleanup unused LPN code
authorBrian Gix <brian.gix@intel.com>
Fri, 13 Dec 2019 20:25:02 +0000 (12:25 -0800)
committerAnupam Roy <anupam.r@samsung.com>
Wed, 18 Dec 2019 11:49:13 +0000 (17:19 +0530)
The daemon does not support the LPN role, and this is unreferenced code.

Change-Id: I8e201453bec2800c27e57d856b1258c127a67388
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
mesh/net.c
mesh/net.h

index ea79ee9..ecdc7ee 100644 (file)
@@ -116,7 +116,6 @@ struct mesh_net {
        uint32_t seq_num;
        uint16_t src_addr;
        uint16_t last_addr;
-       uint16_t friend_addr;
        uint16_t tx_interval;
        uint16_t tx_cnt;
        uint8_t chan; /* Channel of recent Rx */
@@ -1548,10 +1547,6 @@ static void send_net_ack(struct mesh_net *net, struct mesh_sar *sar,
        if (src & 0x8000)
                return;
 
-       /* We don't ACK segments as a Low Power Node */
-       if (net->friend_addr)
-               return;
-
        hdr = NET_OP_SEG_ACKNOWLEDGE << OPCODE_HDR_SHIFT;
        hdr |= sar->seqZero << SEQ_ZERO_HDR_SHIFT;
 
@@ -1945,8 +1940,7 @@ static bool seg_rxed(struct mesh_net *net, bool frnd, uint32_t iv_index,
 
                if (sar_in->flags == expected) {
                        /* Re-Send ACK for full msg */
-                       if (!net->friend_addr)
-                               send_net_ack(net, sar_in, expected);
+                       send_net_ack(net, sar_in, expected);
                        return true;
                }
        } else {
@@ -1964,8 +1958,7 @@ static bool seg_rxed(struct mesh_net *net, bool frnd, uint32_t iv_index,
                sar_in->key_aid = key_aid;
                sar_in->len = len;
                sar_in->last_seg = 0xff;
-               if (!net->friend_addr)
-                       sar_in->msg_timeout = l_timeout_create(MSG_TO,
+               sar_in->msg_timeout = l_timeout_create(MSG_TO,
                                        inmsg_to, net, NULL);
 
                l_debug("First Seg %4.4x", sar_in->flags);
@@ -1992,8 +1985,7 @@ static bool seg_rxed(struct mesh_net *net, bool frnd, uint32_t iv_index,
 
        if (sar_in->flags == expected) {
                /* Got it all */
-               if (!net->friend_addr)
-                       send_net_ack(net, sar_in, expected);
+               send_net_ack(net, sar_in, expected);
 
                msg_rxed(net, frnd, iv_index, ttl, seq, net_idx,
                                sar_in->remote, dst,
@@ -2012,15 +2004,12 @@ static bool seg_rxed(struct mesh_net *net, bool frnd, uint32_t iv_index,
                l_timeout_remove(sar_in->seg_timeout);
 
                /* if this is the largest outstanding segment, send NAK now */
-               if (!net->friend_addr) {
-                       largest = (0xffffffff << segO) & expected;
-                       if ((largest & sar_in->flags) == largest)
-                               send_net_ack(net, sar_in, sar_in->flags);
+               largest = (0xffffffff << segO) & expected;
+               if ((largest & sar_in->flags) == largest)
+                       send_net_ack(net, sar_in, sar_in->flags);
 
-                       sar_in->seg_timeout = l_timeout_create(SEG_TO,
+               sar_in->seg_timeout = l_timeout_create(SEG_TO,
                                inseg_to, net, NULL);
-               } else
-                       largest = 0;
        } else
                largest = 0;
 
@@ -2750,7 +2739,7 @@ static void beacon_recv(void *user_data, struct mesh_io_recv_info *info,
 
 bool mesh_net_set_beacon_mode(struct mesh_net *net, bool enable)
 {
-       if (!net || !IS_UNASSIGNED(net->friend_addr))
+       if (!net)
                return false;
 
        if (net->beacon_enable == enable)
@@ -2922,33 +2911,6 @@ void mesh_net_sub_list_del(struct mesh_net *net, uint16_t addr)
                        0, 0, 0, msg, n);
 }
 
-/* TODO: change to use net index */
-bool mesh_net_set_friend(struct mesh_net *net, uint16_t friend_addr)
-{
-       if (!net)
-               return false;
-
-       net->bea_id = 0;
-
-       l_info("Set Frnd addr: %4.4x", friend_addr);
-       if (!friend_addr)
-               trigger_heartbeat(net, FEATURE_LPN, false);
-       else
-               trigger_heartbeat(net, FEATURE_LPN, true);
-
-       net->friend_addr = friend_addr;
-
-       return true;
-}
-
-uint16_t mesh_net_get_friend(struct mesh_net *net)
-{
-       if (!net)
-               return 0;
-
-       return net->friend_addr;
-}
-
 bool mesh_net_dst_reg(struct mesh_net *net, uint16_t dst)
 {
        struct mesh_destination *dest = l_queue_find(net->destinations,
@@ -3491,8 +3453,6 @@ uint16_t mesh_net_get_features(struct mesh_net *net)
                features |= FEATURE_PROXY;
        if (net->friend_enable)
                features |= FEATURE_FRIEND;
-       if (net->friend_addr != UNASSIGNED_ADDRESS)
-               features |= FEATURE_LPN;
 
        return features;
 }
index 90ca832..07b8783 100644 (file)
@@ -279,8 +279,6 @@ void mesh_net_set_frnd_seq(struct mesh_net *net, bool seq);
 uint16_t mesh_net_get_address(struct mesh_net *net);
 bool mesh_net_register_unicast(struct mesh_net *net,
                                        uint16_t unicast, uint8_t num_ele);
-bool mesh_net_set_friend(struct mesh_net *net, uint16_t friend_addr);
-uint16_t mesh_net_get_friend(struct mesh_net *net);
 uint8_t mesh_net_get_num_ele(struct mesh_net *net);
 bool mesh_net_set_beacon_mode(struct mesh_net *net, bool enable);
 bool mesh_net_set_proxy_mode(struct mesh_net *net, bool enable);