From 64ad89a59b4dac1c13aa2590e462a898a1886ccc Mon Sep 17 00:00:00 2001 From: x60052002 Date: Tue, 19 Nov 2024 21:40:31 +0800 Subject: [PATCH] lnn_lane optimize Signed-off-by: x60052002 --- .../wifi/common/softbus_wifi_api_adapter.c | 3 +-- .../lane_hub/lane_manager/src/lnn_lane_link.c | 27 +------------------ .../lane_manager/src/lnn_select_rule.c | 14 +++------- .../common/src/trans_lane_pending_ctl.c | 1 - 4 files changed, 5 insertions(+), 40 deletions(-) diff --git a/adapter/common/net/wifi/common/softbus_wifi_api_adapter.c b/adapter/common/net/wifi/common/softbus_wifi_api_adapter.c index 4d4376396..9c1f48df8 100644 --- a/adapter/common/net/wifi/common/softbus_wifi_api_adapter.c +++ b/adapter/common/net/wifi/common/softbus_wifi_api_adapter.c @@ -343,7 +343,6 @@ int32_t SoftBusGetChannelListFor5G(int32_t *channelList, int32_t num) SoftBusBand SoftBusGetLinkBand(void) { WifiLinkedInfo result; - GetLinkedInfo(&result); if (GetLinkedInfo(&result) != WIFI_SUCCESS) { LNN_LOGE(LNN_STATE, "get SoftBusGetLinkBand failed"); return BAND_UNKNOWN; @@ -467,4 +466,4 @@ bool SoftBusIsWifiP2pEnabled(void) LNN_LOGI(LNN_STATE, "P2pState=%{public}d", state); return state == P2P_STATE_STARTED; -} \ No newline at end of file +} diff --git a/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_lane_link.c b/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_lane_link.c index b18a62dfb..a098d4be9 100644 --- a/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_lane_link.c +++ b/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_lane_link.c @@ -1334,22 +1334,6 @@ static int32_t LaneLinkOfP2pReuse(uint32_t reqId, const LinkRequest *reqInfo, co return SOFTBUS_OK; } -static int32_t GetWlanLinkedAttribute(int32_t *channel, bool *is5GBand, bool *isConnected) -{ - LnnWlanLinkedInfo info; - int32_t ret = LnnGetWlanLinkedInfo(&info); - if (ret != SOFTBUS_OK) { - LNN_LOGE(LNN_LANE, "LnnGetWlanLinkedInfo fail, ret=%{public}d", ret); - return ret; - } - *isConnected = info.isConnected; - *is5GBand = (info.band != 1); - - *channel = SoftBusFrequencyToChannel(info.frequency); - LNN_LOGI(LNN_LANE, "wlan current channel=%{public}d", *channel); - return SOFTBUS_OK; -} - struct SelectProtocolReq { LnnNetIfType localIfType; ProtocolType selectedProtocol; @@ -1429,18 +1413,9 @@ static int32_t FillWlanLinkInfo(ProtocolType protocol, const LinkRequest *reqInf if (ret != SOFTBUS_OK) { return ret; } - int32_t channel = -1; - bool is5GBand = false; - bool isConnected = false; - if (GetWlanLinkedAttribute(&channel, &is5GBand, &isConnected) != SOFTBUS_OK) { - LNN_LOGE(LNN_LANE, "get wlan attr info fail"); - } - if (!isConnected) { - LNN_LOGE(LNN_LANE, "wlan is disconnected"); - } linkInfo->type = reqInfo->linkType; WlanLinkInfo *wlan = &(linkInfo->linkInfo.wlan); - wlan->channel = channel; + wlan->channel = -1; wlan->bw = LANE_BW_RANDOM; wlan->connInfo.protocol = protocol; wlan->connInfo.port = port; diff --git a/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_select_rule.c b/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_select_rule.c index b5541a904..586c1bbf3 100644 --- a/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_select_rule.c +++ b/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_select_rule.c @@ -359,15 +359,7 @@ static int32_t GetHmlScore(const char *networkId, uint32_t expectedBw) static int32_t GetLinkedChannelScore(void) { - int32_t frequency = GetWlanLinkedFrequency(); - if (frequency <= 0) { - return LNN_LINK_DEFAULT_SCORE; - } - int32_t channel = SoftBusFrequencyToChannel(frequency); - if (channel < 0) { - LNN_LOGE(LNN_LANE, "get curr channel fail"); - return LNN_LINK_DEFAULT_SCORE; - } + int32_t channel = 0; int32_t score = LnnGetCurrChannelScore(channel); LNN_LOGI(LNN_LANE, "current channel=%{public}d, score=%{public}d", channel, score); if (score <= 0) { @@ -529,8 +521,8 @@ static void DecideRetryLinks(const char *networkId, const LaneSelectParam *reque if (g_retryLaneList[bandWidthType][i] == LANE_LINK_TYPE_BUTT) { break; } - if ((CheckLaneValid(networkId, g_retryLaneList[bandWidthType][i], request->transType) == SOFTBUS_OK) && - !IsLaneExist(linkList, g_retryLaneList[bandWidthType][i])) { + if (!IsLaneExist(linkList, g_retryLaneList[bandWidthType][i]) && + (CheckLaneValid(networkId, g_retryLaneList[bandWidthType][i], request->transType) == SOFTBUS_OK)) { linkList[(*linksNum)++] = g_retryLaneList[bandWidthType][i]; LNN_LOGI(LNN_LANE, "decide retry linkType=%{public}d", g_retryLaneList[bandWidthType][i]); } diff --git a/core/transmission/trans_channel/common/src/trans_lane_pending_ctl.c b/core/transmission/trans_channel/common/src/trans_lane_pending_ctl.c index 567e4679e..e72401221 100644 --- a/core/transmission/trans_channel/common/src/trans_lane_pending_ctl.c +++ b/core/transmission/trans_channel/common/src/trans_lane_pending_ctl.c @@ -550,7 +550,6 @@ static void TransAsyncOpenChannelProc(uint32_t laneHandle, SessionParam *param, extra->osType = (appInfo->osType < 0) ? UNKNOW_OS_TYPE : appInfo->osType; appInfo->connectType = connOpt.type; extra->linkType = connOpt.type; - extra->deviceState = TransGetDeviceState(param->peerDeviceId); FillAppInfo(appInfo, param, &transInfo, connInnerInfo); TransOpenChannelSetModule(transInfo.channelType, &connOpt); TRANS_LOGI(TRANS_SVC, "laneHandle=%{public}u, channelType=%{public}u", laneHandle, transInfo.channelType);