Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1503986ybg; Thu, 11 Jun 2020 11:31:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDGGXd85DThXEI9xasA8+vRhhmZTYyTik+5kxmOiKQGg9AkuNOhdtY4k51q/F++G9dQrp5 X-Received: by 2002:a50:d7d1:: with SMTP id m17mr8467025edj.126.1591900298001; Thu, 11 Jun 2020 11:31:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591900297; cv=none; d=google.com; s=arc-20160816; b=VgiWOcRpF42z681SDspYWQXOOpeTh8VcE6ePMrnFnVLZdePElAr9BgcKUjPJWrKtm6 QrDURRBM6lbgow/DLDbuJ4wALMNvU1BHTBrijhjiKgC/uotrbX5VLnO6nlIQwP0LVUZd IFgqFLBCmGUM9FUMk3CLGm7JtlpX2ZuGZ9tNTzPgWV4Gqm1UxptmykNpcOAzj0l082ym U6ndV0BlHVk+A8ZzlbmW9QPpuv2KSTPHGZT5M/g8ML/qAEyq5tpS6x6NWVB2fZREcxx4 liqMD68f1NOipK+Th2ImFZFEgbqmF7YboVyxh4yW+jLDkZJz/pw92xPrO+T1I5ZzQ8IW 6vrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=3EmfURGOL+4efe6U4bxBYJZzgIfxw3avItKbuFEzzLI=; b=x2ANz9HlLJ3DeRYR9PgvuCq7g/KroB+DJsi//hNDQZ8V2yTpqo57W9i9g9FZcW3Ubp m1LHWLWpJHxx+lA0V7SSZC5z6RrCl0Fw0JDimHZ0uBShOpI/DWrPzrRfJCtcyl8ybQ9E BYRx2DBeRmrNOfHYO1lePBKU06DAG4abJI468xY+ZBtqce3tervvIP758zRIf3/vd8lw L4A6tyX2eKaBakNbs73AblE8lUmRtzvhPh8B52u31awsUmtjxEH+LCB1lQBraishphrl 8aO7TB1tgLv2PJrBexwMxVZjATS2rShfw3Xg5nVkAUltPtYfPj5b4TUkHHwiiWEv+jib k61g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g10si2054217edr.463.2020.06.11.11.30.57; Thu, 11 Jun 2020 11:31:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727845AbgFKSan (ORCPT + 99 others); Thu, 11 Jun 2020 14:30:43 -0400 Received: from mga04.intel.com ([192.55.52.120]:1954 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726386AbgFKSam (ORCPT ); Thu, 11 Jun 2020 14:30:42 -0400 IronPort-SDR: XCHvACZ3r6HaVKFywsxayJNt5POGzcaSfHK/R9zO7y4W3oGWOIKnI9QhAkK8xqrhRBq5Z86wI6 uMhNbAwlPEzA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2020 11:30:42 -0700 IronPort-SDR: QWlnxVJ9TMroK0SBHTNOdILRJPhD7jhsxeqltp6B9fsZ2C3vmOdZZopOeuOJZsh2A/6G4bEiSQ pjnnFHXrf2Rw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,500,1583222400"; d="scan'208";a="419194694" Received: from ewillia2-mobl1.amr.corp.intel.com (HELO ingas-nuc1.sea.intel.com) ([10.255.231.189]) by orsmga004.jf.intel.com with ESMTP; 11 Jun 2020 11:30:41 -0700 From: Inga Stotland To: linux-bluetooth@vger.kernel.org Cc: brian.gix@intel.com, Inga Stotland Subject: [PATCH BlueZ] mesh: Delete unused structures/functions Date: Thu, 11 Jun 2020 11:30:38 -0700 Message-Id: <20200611183038.96969-1-inga.stotland@intel.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This deletes unused functions and structures in net.c & net.h. Plus, some style cleanup. --- mesh/net.c | 64 +++++++++++++----------------------------------------- mesh/net.h | 2 -- 2 files changed, 15 insertions(+), 51 deletions(-) diff --git a/mesh/net.c b/mesh/net.c index 7dbe45f7d..3ab948be5 100644 --- a/mesh/net.c +++ b/mesh/net.c @@ -59,6 +59,8 @@ #define SAR_KEY(src, seq0) ((((uint32_t)(seq0)) << 16) | (src)) +#define FAST_CACHE_SIZE 8 + enum _relay_advice { RELAY_NONE, /* Relay not enabled in node */ RELAY_ALLOWED, /* Relay enabled, msg not to node's unicast */ @@ -179,30 +181,6 @@ struct mesh_destination { uint16_t ref_cnt; }; -struct msg_rx { - const uint8_t *data; - uint32_t iv_index; - uint32_t seq; - uint16_t src; - uint16_t dst; - uint16_t size; - uint8_t tc; - bool done; - bool szmic; - union { - struct { - uint16_t app_idx; - uint8_t key_aid; - } m; - struct { - uint16_t seq0; - } a; - struct { - uint8_t opcode; - } c; - } u; -}; - struct net_decode { struct mesh_net *net; struct mesh_friend *frnd; @@ -241,7 +219,6 @@ struct net_beacon_data { bool processed; }; -#define FAST_CACHE_SIZE 8 static struct l_queue *fast_cache; static struct l_queue *nets; @@ -289,6 +266,7 @@ static void trigger_heartbeat(struct mesh_net *net, uint16_t feature, struct mesh_net_heartbeat *hb = &net->heartbeat; l_debug("%s: %4.4x --> %d", __func__, feature, in_use); + if (in_use) { if (net->heartbeat.features & feature) return; /* no change */ @@ -402,17 +380,15 @@ struct mesh_friend *mesh_friend_new(struct mesh_net *net, uint16_t dst, subnet = get_primary_subnet(net); /* TODO: the primary key must be present, do we need to add check?. */ - frnd->net_key_cur = net_key_frnd_add(subnet->net_key_cur, - dst, net->src_addr, - lp_cnt, fn_cnt); + frnd->net_key_cur = net_key_frnd_add(subnet->net_key_cur, dst, + net->src_addr, lp_cnt, fn_cnt); if (!subnet->net_key_upd) return frnd; frnd->net_idx = subnet->idx; - frnd->net_key_upd = net_key_frnd_add(subnet->net_key_upd, - dst, net->src_addr, - lp_cnt, fn_cnt); + frnd->net_key_upd = net_key_frnd_add(subnet->net_key_upd, dst, + net->src_addr, lp_cnt, fn_cnt); return frnd; } @@ -436,8 +412,7 @@ bool mesh_friend_clear(struct mesh_net *net, struct mesh_friend *frnd) } void mesh_friend_sub_add(struct mesh_net *net, uint16_t lpn, uint8_t ele_cnt, - uint8_t grp_cnt, - const uint8_t *list) + uint8_t grp_cnt, const uint8_t *list) { uint16_t *new_list; uint16_t *grp_list; @@ -463,15 +438,13 @@ void mesh_friend_sub_add(struct mesh_net *net, uint16_t lpn, uint8_t ele_cnt, frnd->u.active.grp_cnt += grp_cnt; } -void mesh_friend_sub_del(struct mesh_net *net, uint16_t lpn, - uint8_t cnt, - const uint8_t *del_list) +void mesh_friend_sub_del(struct mesh_net *net, uint16_t lpn, uint8_t cnt, + const uint8_t *del_list) { uint16_t *grp_list; int16_t i, grp_cnt; size_t cnt16 = cnt * sizeof(uint16_t); - struct mesh_friend *frnd = l_queue_find(net->friends, - match_by_friend, + struct mesh_friend *frnd = l_queue_find(net->friends, match_by_friend, L_UINT_TO_PTR(lpn)); if (!frnd) return; @@ -749,14 +722,6 @@ bool mesh_net_register_unicast(struct mesh_net *net, return true; } -uint8_t mesh_net_get_num_ele(struct mesh_net *net) -{ - if (!net) - return 0; - - return net->last_addr - net->src_addr + 1; -} - bool mesh_net_set_proxy_mode(struct mesh_net *net, bool enable) { if (!net) @@ -3315,8 +3280,10 @@ static uint16_t get_features(struct mesh_net *net) if (net->relay.enable) features |= FEATURE_RELAY; + if (net->proxy_enable) features |= FEATURE_PROXY; + if (net->friend_enable) features |= FEATURE_FRIEND; @@ -3553,10 +3520,9 @@ bool net_msg_check_replay_cache(struct mesh_net *net, uint16_t src, l_debug("Ignoring replayed packet"); return true; } - } + } else if (l_queue_length(net->replay_cache) >= crpl) { + /* SRC not in Replay Cache... see if there is space for it */ - /* SRC not in Replay Cache... see if there is space for it */ - else if (l_queue_length(net->replay_cache) >= crpl) { int ret = l_queue_foreach_remove(net->replay_cache, clean_old_iv_index, L_UINT_TO_PTR(iv_index)); diff --git a/mesh/net.h b/mesh/net.h index f7fe3f150..7117f1a47 100644 --- a/mesh/net.h +++ b/mesh/net.h @@ -270,7 +270,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); -uint8_t mesh_net_get_num_ele(struct mesh_net *net); void net_local_beacon(uint32_t key_id, uint8_t *beacon); bool mesh_net_set_beacon_mode(struct mesh_net *net, bool enable); bool mesh_net_set_proxy_mode(struct mesh_net *net, bool enable); @@ -310,7 +309,6 @@ void mesh_net_ack_send(struct mesh_net *net, uint32_t key_id, uint16_t seqZero, uint32_t ack_flags); int mesh_net_get_identity_mode(struct mesh_net *net, uint16_t idx, uint8_t *mode); -char *mesh_net_id_name(struct mesh_net *net); bool mesh_net_dst_reg(struct mesh_net *net, uint16_t dst); bool mesh_net_dst_unreg(struct mesh_net *net, uint16_t dst); struct mesh_friend *mesh_friend_new(struct mesh_net *net, uint16_t dst, -- 2.26.2