-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BL602] Fix sve2 problems #22582
[BL602] Fix sve2 problems #22582
Changes from all commits
30ed488
c3a8a02
d94fea0
ae6af70
41d39d5
a103829
3365a66
2209915
832ed41
405576c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -163,11 +163,29 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetBootReason(BootReasonType & bootReason | |
return CHIP_NO_ERROR; | ||
} | ||
|
||
static int bl_netif_get_all_ip6(struct netif * netif, ip6_addr_t if_ip6[]) | ||
{ | ||
if (netif == NULL || if_ip6 == NULL) | ||
{ | ||
return 0; | ||
} | ||
|
||
int addr_count = 0; | ||
for (int i = 0; (i < LWIP_IPV6_NUM_ADDRESSES) && (i < kMaxIPv6AddrCount); i++) | ||
{ | ||
if (!ip_addr_cmp(&netif->ip6_addr[i], IP6_ADDR_ANY)) | ||
{ | ||
memcpy(&if_ip6[addr_count++], &netif->ip6_addr[i], sizeof(ip6_addr_t)); | ||
} | ||
} | ||
|
||
return addr_count; | ||
} | ||
|
||
CHIP_ERROR DiagnosticDataProviderImpl::GetNetworkInterfaces(NetworkInterface ** netifpp) | ||
{ | ||
NetworkInterface * ifp = new NetworkInterface(); | ||
struct netif * netif; | ||
uint8_t mac_addr[6]; | ||
|
||
netif = wifi_mgmr_sta_netif_get(); | ||
if (netif) | ||
|
@@ -179,10 +197,28 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetNetworkInterfaces(NetworkInterface ** | |
ifp->type = EMBER_ZCL_INTERFACE_TYPE_WI_FI; | ||
ifp->offPremiseServicesReachableIPv4.SetNull(); | ||
ifp->offPremiseServicesReachableIPv6.SetNull(); | ||
bl_efuse_read_mac(mac_addr); | ||
memcpy(ifp->MacAddress, mac_addr, sizeof(mac_addr)); | ||
bl_efuse_read_mac(ifp->MacAddress); | ||
ifp->hardwareAddress = ByteSpan(ifp->MacAddress, 6); | ||
|
||
uint32_t ip, gw, mask; | ||
wifi_mgmr_sta_ip_get(&ip, &gw, &mask); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do these methods never fail? Like is there always an ip/gw/mask? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What was the resolution here? This was marked resolved yet I see no comment of "this never fails" nor do I see code changes that would check for a return value from the |
||
memcpy(ifp->Ipv4AddressesBuffer[0], &ip, kMaxIPv4AddrSize); | ||
ifp->Ipv4AddressSpans[0] = ByteSpan(ifp->Ipv4AddressesBuffer[0], kMaxIPv4AddrSize); | ||
ifp->IPv4Addresses = chip::app::DataModel::List<chip::ByteSpan>(ifp->Ipv4AddressSpans, 1); | ||
|
||
uint8_t ipv6_addr_count = 0; | ||
ip6_addr_t ip6_addr[kMaxIPv6AddrCount]; | ||
ipv6_addr_count = bl_netif_get_all_ip6(netif, ip6_addr); | ||
for (uint8_t idx = 0; idx < ipv6_addr_count; ++idx) | ||
{ | ||
memcpy(ifp->Ipv6AddressesBuffer[idx], ip6_addr[idx].addr, kMaxIPv6AddrSize); | ||
ifp->Ipv6AddressSpans[idx] = ByteSpan(ifp->Ipv6AddressesBuffer[idx], kMaxIPv6AddrSize); | ||
} | ||
ifp->IPv6Addresses = chip::app::DataModel::List<chip::ByteSpan>(ifp->Ipv6AddressSpans, ipv6_addr_count); | ||
} | ||
|
||
*netifpp = ifp; | ||
|
||
return CHIP_NO_ERROR; | ||
} | ||
|
||
|
@@ -256,8 +292,7 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiBeaconLostCount(uint32_t & beaconL | |
|
||
CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiCurrentMaxRate(uint64_t & currentMaxRate) | ||
{ | ||
currentMaxRate = 0; | ||
return CHIP_NO_ERROR; | ||
return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; | ||
} | ||
|
||
CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiPacketMulticastRxCount(uint32_t & packetMulticastRxCount) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,8 @@ | |
#include <string> | ||
#include <utils_log.h> | ||
|
||
#define WIFI_STA_DISCONNECT_DELAY (pdMS_TO_TICKS(200)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in C++ use |
||
|
||
using namespace ::chip; | ||
//#if CHIP_DEVICE_CONFIG_ENABLE_WIFI | ||
namespace chip { | ||
|
@@ -121,6 +123,9 @@ bool BLWiFiDriver::NetworkMatch(const WiFiNetwork & network, ByteSpan networkId) | |
Status BLWiFiDriver::AddOrUpdateNetwork(ByteSpan ssid, ByteSpan credentials, MutableCharSpan & outDebugText, | ||
uint8_t & outNetworkIndex) | ||
{ | ||
outDebugText.reduce_size(0); | ||
outNetworkIndex = 0; | ||
|
||
VerifyOrReturnError(mStagingNetwork.ssidLen == 0 || NetworkMatch(mStagingNetwork, ssid), Status::kBoundsExceeded); | ||
VerifyOrReturnError(credentials.size() <= sizeof(mStagingNetwork.credentials), Status::kOutOfRange); | ||
VerifyOrReturnError(ssid.size() <= sizeof(mStagingNetwork.ssid), Status::kOutOfRange); | ||
|
@@ -136,6 +141,9 @@ Status BLWiFiDriver::AddOrUpdateNetwork(ByteSpan ssid, ByteSpan credentials, Mut | |
|
||
Status BLWiFiDriver::RemoveNetwork(ByteSpan networkId, MutableCharSpan & outDebugText, uint8_t & outNetworkIndex) | ||
{ | ||
outDebugText.reduce_size(0); | ||
outNetworkIndex = 0; | ||
|
||
VerifyOrReturnError(NetworkMatch(mStagingNetwork, networkId), Status::kNetworkIDNotFound); | ||
|
||
// Use empty ssid for representing invalid network | ||
|
@@ -145,6 +153,8 @@ Status BLWiFiDriver::RemoveNetwork(ByteSpan networkId, MutableCharSpan & outDebu | |
|
||
Status BLWiFiDriver::ReorderNetwork(ByteSpan networkId, uint8_t index, MutableCharSpan & outDebugText) | ||
{ | ||
outDebugText.reduce_size(0); | ||
|
||
// Only one network is supported now | ||
VerifyOrReturnError(index == 0, Status::kOutOfRange); | ||
VerifyOrReturnError(NetworkMatch(mStagingNetwork, networkId), Status::kNetworkIDNotFound); | ||
|
@@ -157,12 +167,24 @@ CHIP_ERROR BLWiFiDriver::ConnectWiFiNetwork(const char * ssid, uint8_t ssidLen, | |
|
||
char wifi_ssid[64] = { 0 }; | ||
char passwd[64] = { 0 }; | ||
// Set the wifi configuration | ||
int state = 0; | ||
|
||
wifi_mgmr_sta_disconnect(); | ||
vTaskDelay(WIFI_STA_DISCONNECT_DELAY); | ||
|
||
wifi_mgmr_sta_disable(NULL); | ||
wifi_mgmr_state_get(&state); | ||
while (state != WIFI_STATE_IDLE) | ||
{ | ||
wifi_mgmr_state_get(&state); | ||
vTaskDelay(100); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is the 100 here? why is it ok to use ticks which depend on tick rate instead of computing a standard time. At least a comment of why we do not care is appropriate. |
||
} | ||
|
||
memcpy(wifi_ssid, ssid, ssidLen); | ||
memcpy(passwd, key, keyLen); | ||
wifi_interface_t wifi_interface; | ||
wifi_interface = wifi_mgmr_sta_enable(); | ||
wifi_mgmr_sta_connect(wifi_interface, ssid, passwd, NULL, NULL, 0, 0); | ||
wifi_mgmr_sta_connect(wifi_interface, wifi_ssid, passwd, NULL, NULL, 0, 0); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do these methods return an error code we could check and log on failures? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These were marked resolved ... what was the resolution? I see no deltas. An answer like "this never fails" or implementation change would make sense. |
||
|
||
ReturnErrorOnFailure(ConnectivityMgr().SetWiFiStationMode(ConnectivityManager::kWiFiStationMode_Disabled)); | ||
|
||
|
@@ -280,6 +302,7 @@ void BLWiFiDriver::OnScanWiFiNetworkDone() | |
} | ||
})) | ||
{ | ||
vPortFree(ScanResult); | ||
ChipLogProgress(DeviceLayer, "ScheduleLambda OK"); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how do you ensure that if_ip6 has sufficient space for addr_count ?
I think the size of input arrays should be passed in to methods. Currently nothing seems to guarantee that kMaxIPv6AddrCount >= LWIP_IPV6_NUM_ADDRESSES
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what guarantees that
if_ip6
has at least min(kMaxIPv6AddrCount, LWIP_IPV6_NUM_ADDRESSES) elements?The size of if_ip6 should be passed in to this method as an argument, not assumed.