lnn_lane optimize

Signed-off-by: x60052002 <xiaohang19@h-partners.com>
This commit is contained in:
x60052002 2024-11-19 21:40:31 +08:00
parent 56177da596
commit 64ad89a59b
4 changed files with 5 additions and 40 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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]);
}

View File

@ -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);