-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[Silabs] Fixing the ipv4 build for the wifi devices #38830
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
Open
chirag-silabs
wants to merge
8
commits into
project-chip:master
Choose a base branch
from
chirag-silabs:bugfix/ipv4_fix
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5986ca1
Fixing the ipv4 build for the wifi devices
chirag-silabs ae8e819
removing the unused file
chirag-silabs 717579b
Merge branch 'master' into bugfix/ipv4_fix
chirag-silabs 93eb861
Merge branch 'master' into bugfix/ipv4_fix
chirag-silabs d87ac6f
removing the unused code
chirag-silabs 3b9e3c9
addressing review comments
chirag-silabs b9dbf10
addressing the review comment
chirag-silabs d67de46
Merge branch 'master' into bugfix/ipv4_fix
chirag-silabs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ | |
#include <lib/support/CHIPMemString.h> | ||
#include <lib/support/CodeUtils.h> | ||
#include <lib/support/logging/CHIPLogging.h> | ||
#include <platform/silabs/wifi/WifiInterface.h> | ||
#include <platform/silabs/wifi/lwip-support/dhcp_client.h> | ||
#include <platform/silabs/wifi/lwip-support/ethernetif.h> | ||
#include <platform/silabs/wifi/lwip-support/lwip_netif.h> | ||
|
@@ -299,22 +300,6 @@ inline int16_t ConvertRcpiToRssi(uint32_t rcpi) | |
VerifyOrReturnValue(rssi >= std::numeric_limits<int16_t>::min(), std::numeric_limits<int16_t>::min()); | ||
return rssi; | ||
} | ||
|
||
#if CHIP_DEVICE_CONFIG_ENABLE_IPV4 | ||
/** | ||
* @brief Updates the IPv4 address in the Wi-Fi interface and notifies the application layer about the new IP address. | ||
* | ||
* @param[in] ip New IPv4 address | ||
*/ | ||
void GotIPv4Address(uint32_t ip) | ||
{ | ||
ChipLogDetail(DeviceLayer, "DHCP IP=%d.%d.%d.%d", (ip & 0xFF), (ip >> 8 & 0xFF), (ip >> 16 & 0xFF), (ip >> 24 & 0xFF)); | ||
sta_ip = ip; | ||
|
||
NotifyIPv4Change(true); | ||
} | ||
#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */ | ||
|
||
} // namespace | ||
|
||
/**************************************************************************** | ||
|
@@ -603,6 +588,16 @@ CHIP_ERROR WifiInterfaceImpl::InitWiFiStack() | |
return CHIP_NO_ERROR; | ||
} | ||
|
||
#if CHIP_DEVICE_CONFIG_ENABLE_IPV4 | ||
void WifiInterface::GotIPv4Address(uint32_t ip) | ||
{ | ||
ChipLogDetail(DeviceLayer, "DHCP IP=%ld.%ld.%ld.%ld", (ip & 0xFF), (ip >> 8 & 0xFF), (ip >> 16 & 0xFF), (ip >> 24 & 0xFF)); | ||
sta_ip = ip; | ||
|
||
NotifyIPv4Change(true); | ||
} | ||
#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */ | ||
|
||
CHIP_ERROR WifiInterfaceImpl::GetMacAddress(sl_wfx_interface_t interface, MutableByteSpan & address) | ||
{ | ||
VerifyOrReturnError(address.size() >= kWifiMacAddressLength, CHIP_ERROR_BUFFER_TOO_SMALL); | ||
|
@@ -959,9 +954,11 @@ void WifiInterfaceImpl::ProcessEvents(void * arg) | |
#if (CHIP_DEVICE_CONFIG_ENABLE_IPV4) | ||
uint8_t dhcp_state = dhcpclient_poll(sta_netif); | ||
|
||
if ((dhcp_state == DHCP_ADDRESS_ASSIGNED) && !WifiInterfaceImpl::GetIstance().HasNotifiedIPv4()) | ||
if ((dhcp_state == DHCP_ADDRESS_ASSIGNED) && !WifiInterfaceImpl::GetInstance().HasNotifiedIPv4()) | ||
{ | ||
WifiInterface::GetInstance().GotIPv4Address((uint32_t) sta_netif->ip_addr.u_addr.ip4.addr); | ||
WifiInterfaceImpl::GetInstance().NotifyIPv4Change(false); | ||
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. Why do we notify that we lost the IPv4 address before notifying that have one? |
||
|
||
WifiInterfaceImpl::GetInstance().GotIPv4Address((uint32_t) sta_netif->ip_addr.u_addr.ip4.addr); | ||
if (!hasNotifiedWifiConnectivity) | ||
{ | ||
ChipLogProgress(DeviceLayer, "will notify WiFi connectivity"); | ||
|
@@ -971,7 +968,7 @@ void WifiInterfaceImpl::ProcessEvents(void * arg) | |
} | ||
else if (dhcp_state == DHCP_OFF) | ||
{ | ||
NotifyIPv4Change(false); | ||
WifiInterfaceImpl::GetInstance().NotifyIPv4Change(false); | ||
} | ||
#endif // CHIP_DEVICE_CONFIG_ENABLE_IPV4 | ||
if ((ip6_addr_ispreferred(netif_ip6_addr_state(sta_netif, 0))) && | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This inlcude should not have any impact since it is available through the WifiInterfaceImpl header.