Skip to content

Commit 7084452

Browse files
kghostpull[bot]
authored andcommitted
Isolate default MRP config from local MPR config (#19753)
1 parent d9516eb commit 7084452

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+237
-203
lines changed

examples/chef/efr32/include/CHIPProjectConfig.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE (512)
129129

130130
/**
131-
* @def CHIP_CONFIG_MRP_DEFAULT_ACTIVE_RETRY_INTERVAL
131+
* @def CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL
132132
*
133133
* @brief
134134
* Active retransmit interval, or time to wait before retransmission after
@@ -138,6 +138,6 @@
138138
* needs (e.g. sleeping period) using Service Discovery TXT record CRA key.
139139
*
140140
*/
141-
#define CHIP_CONFIG_MRP_DEFAULT_ACTIVE_RETRY_INTERVAL (2000_ms32)
141+
#define CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL (2000_ms32)
142142

143143
#define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1

examples/chip-tool/commands/discover/Commands.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@ class Resolve : public DiscoverCommand, public chip::AddressResolve::NodeListene
4848
result.address.ToString(addrBuffer);
4949

5050
ChipLogProgress(chipTool, "NodeId Resolution: %" PRIu64 " at %s", peerId.GetNodeId(), addrBuffer);
51-
ChipLogProgress(chipTool, " MRP retry interval (idle): %" PRIu32 "ms", result.mrpConfig.mIdleRetransTimeout.count());
52-
ChipLogProgress(chipTool, " MRP retry interval (active): %" PRIu32 "ms", result.mrpConfig.mActiveRetransTimeout.count());
51+
ChipLogProgress(chipTool, " MRP retry interval (idle): %" PRIu32 "ms",
52+
result.mrpRemoteConfig.mIdleRetransTimeout.count());
53+
ChipLogProgress(chipTool, " MRP retry interval (active): %" PRIu32 "ms",
54+
result.mrpRemoteConfig.mActiveRetransTimeout.count());
5355
ChipLogProgress(chipTool, " Supports TCP: %s", result.supportsTcp ? "yes" : "no");
5456
SetCommandExitStatus(CHIP_NO_ERROR);
5557
}

examples/light-switch-app/efr32/include/CHIPProjectConfig.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE (512)
129129

130130
/**
131-
* @def CHIP_CONFIG_MRP_DEFAULT_ACTIVE_RETRY_INTERVAL
131+
* @def CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL
132132
*
133133
* @brief
134134
* Active retransmit interval, or time to wait before retransmission after
@@ -138,6 +138,6 @@
138138
* needs (e.g. sleeping period) using Service Discovery TXT record CRA key.
139139
*
140140
*/
141-
#define CHIP_CONFIG_MRP_DEFAULT_ACTIVE_RETRY_INTERVAL (2000_ms32)
141+
#define CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL (2000_ms32)
142142

143143
#define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1

examples/lighting-app/efr32/include/CHIPProjectConfig.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE (512)
129129

130130
/**
131-
* @def CHIP_CONFIG_MRP_DEFAULT_ACTIVE_RETRY_INTERVAL
131+
* @def CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL
132132
*
133133
* @brief
134134
* Active retransmit interval, or time to wait before retransmission after
@@ -138,6 +138,6 @@
138138
* needs (e.g. sleeping period) using Service Discovery TXT record CRA key.
139139
*
140140
*/
141-
#define CHIP_CONFIG_MRP_DEFAULT_ACTIVE_RETRY_INTERVAL (2000_ms32)
141+
#define CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL (2000_ms32)
142142

143143
#define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1

examples/lock-app/efr32/include/CHIPProjectConfig.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE (512)
130130

131131
/**
132-
* @def CHIP_CONFIG_MRP_DEFAULT_ACTIVE_RETRY_INTERVAL
132+
* @def CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL
133133
*
134134
* @brief
135135
* Active retransmit interval, or time to wait before retransmission after
@@ -139,4 +139,4 @@
139139
* needs (e.g. sleeping period) using Service Discovery TXT record CRA key.
140140
*
141141
*/
142-
#define CHIP_CONFIG_MRP_DEFAULT_ACTIVE_RETRY_INTERVAL (2000_ms32)
142+
#define CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL (2000_ms32)

examples/window-app/efr32/include/CHIPProjectConfig.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@
165165
#define CHIP_DEVICE_CONFIG_BLE_ADVERTISING_TIMEOUT (15 * 60 * 1000)
166166

167167
/**
168-
* @def CHIP_CONFIG_MRP_DEFAULT_ACTIVE_RETRY_INTERVAL
168+
* @def CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL
169169
*
170170
* @brief
171171
* Active retransmit interval, or time to wait before retransmission after
@@ -175,6 +175,6 @@
175175
* needs (e.g. sleeping period) using Service Discovery TXT record CRA key.
176176
*
177177
*/
178-
#define CHIP_CONFIG_MRP_DEFAULT_ACTIVE_RETRY_INTERVAL (2000_ms32)
178+
#define CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL (2000_ms32)
179179

180180
#define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1

src/app/DeviceProxy.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class DLL_EXPORT DeviceProxy
7272
protected:
7373
virtual bool IsSecureConnected() const = 0;
7474

75-
ReliableMessageProtocolConfig mRemoteMRPConfig = GetLocalMRPConfig();
75+
ReliableMessageProtocolConfig mRemoteMRPConfig = GetDefaultMRPConfig();
7676
};
7777

7878
} // namespace chip

src/app/OperationalDeviceProxy.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ CHIP_ERROR OperationalDeviceProxy::LookupPeerAddress()
404404

405405
void OperationalDeviceProxy::OnNodeAddressResolved(const PeerId & peerId, const ResolveResult & result)
406406
{
407-
UpdateDeviceData(result.address, result.mrpConfig);
407+
UpdateDeviceData(result.address, result.mrpRemoteConfig);
408408
}
409409

410410
void OperationalDeviceProxy::OnNodeAddressResolutionFailed(const PeerId & peerId, CHIP_ERROR reason)

src/app/server/CommissioningWindowManager.cpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,8 @@ CHIP_ERROR CommissioningWindowManager::AdvertiseAndListenForPASE()
219219
if (mUseECM)
220220
{
221221
ReturnErrorOnFailure(SetTemporaryDiscriminator(mECMDiscriminator));
222-
ReturnErrorOnFailure(mPairingSession.WaitForPairing(
223-
mServer->GetSecureSessionManager(), mECMPASEVerifier, mECMIterations, ByteSpan(mECMSalt, mECMSaltLength),
224-
Optional<ReliableMessageProtocolConfig>::Value(GetLocalMRPConfig()), this));
222+
ReturnErrorOnFailure(mPairingSession.WaitForPairing(mServer->GetSecureSessionManager(), mECMPASEVerifier, mECMIterations,
223+
ByteSpan(mECMSalt, mECMSaltLength), GetLocalMRPConfig(), this));
225224
}
226225
else
227226
{
@@ -243,8 +242,7 @@ CHIP_ERROR CommissioningWindowManager::AdvertiseAndListenForPASE()
243242
ReturnErrorOnFailure(verifier.Deserialize(ByteSpan(serializedVerifier)));
244243

245244
ReturnErrorOnFailure(mPairingSession.WaitForPairing(mServer->GetSecureSessionManager(), verifier, iterationCount, saltSpan,
246-
Optional<ReliableMessageProtocolConfig>::Value(GetLocalMRPConfig()),
247-
this));
245+
GetLocalMRPConfig(), this));
248246
}
249247

250248
ReturnErrorOnFailure(StartAdvertisement());

src/app/server/Dnssd.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ CHIP_ERROR DnssdServer::AdvertiseOperational()
258258
.SetMac(mac)
259259
.SetPort(GetSecuredPort())
260260
.SetInterfaceId(GetInterfaceId())
261-
.SetMRPConfig(GetLocalMRPConfig())
261+
.SetLocalMRPConfig(GetLocalMRPConfig())
262262
.SetTcpSupported(Optional<bool>(INET_CONFIG_ENABLE_TCP_ENDPOINT))
263263
.EnableIpV4(true);
264264

@@ -351,7 +351,7 @@ CHIP_ERROR DnssdServer::Advertise(bool commissionableNode, chip::Dnssd::Commissi
351351
advertiseParameters.SetRotatingDeviceId(chip::Optional<const char *>::Value(rotatingDeviceIdHexBuffer));
352352
#endif
353353

354-
advertiseParameters.SetMRPConfig(GetLocalMRPConfig()).SetTcpSupported(Optional<bool>(INET_CONFIG_ENABLE_TCP_ENDPOINT));
354+
advertiseParameters.SetLocalMRPConfig(GetLocalMRPConfig()).SetTcpSupported(Optional<bool>(INET_CONFIG_ENABLE_TCP_ENDPOINT));
355355

356356
if (!HaveOperationalCredentials())
357357
{

src/app/server/Server.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ CHIP_ERROR Server::Init(const ServerInitParams & initParams)
270270
.fabricTable = &mFabrics,
271271
.clientPool = &mCASEClientPool,
272272
.groupDataProvider = mGroupsProvider,
273-
.mrpLocalConfig = Optional<ReliableMessageProtocolConfig>(GetLocalMRPConfig()),
273+
.mrpLocalConfig = GetLocalMRPConfig(),
274274
},
275275
.devicePool = &mDevicePool,
276276
};

src/controller/CHIPDeviceController.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -634,8 +634,7 @@ CHIP_ERROR DeviceCommissioner::EstablishPASEConnection(NodeId remoteDeviceId, Re
634634
exchangeCtxt = mSystemState->ExchangeMgr()->NewContext(session.Value(), &device->GetPairing());
635635
VerifyOrExit(exchangeCtxt != nullptr, err = CHIP_ERROR_INTERNAL);
636636

637-
err = device->GetPairing().Pair(*mSystemState->SessionMgr(), params.GetSetupPINCode(),
638-
Optional<ReliableMessageProtocolConfig>::Value(GetLocalMRPConfig()), exchangeCtxt, this);
637+
err = device->GetPairing().Pair(*mSystemState->SessionMgr(), params.GetSetupPINCode(), GetLocalMRPConfig(), exchangeCtxt, this);
639638
SuccessOrExit(err);
640639

641640
exit:

src/controller/CHIPDeviceControllerFactory.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ CHIP_ERROR DeviceControllerFactory::InitSystemState(FactoryInitParams params)
241241
.fabricTable = stateParams.fabricTable,
242242
.clientPool = stateParams.caseClientPool,
243243
.groupDataProvider = stateParams.groupDataProvider,
244-
.mrpLocalConfig = Optional<ReliableMessageProtocolConfig>::Value(GetLocalMRPConfig()),
244+
.mrpLocalConfig = GetLocalMRPConfig(),
245245
};
246246

247247
CASESessionManagerConfig sessionManagerConfig = {

src/lib/address_resolve/AddressResolve.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ namespace AddressResolve {
3232
struct ResolveResult
3333
{
3434
Transport::PeerAddress address;
35-
ReliableMessageProtocolConfig mrpConfig;
35+
ReliableMessageProtocolConfig mrpRemoteConfig;
3636
bool supportsTcp = false;
3737

38-
ResolveResult() : address(Transport::Type::kUdp), mrpConfig(GetLocalMRPConfig()) {}
38+
ResolveResult() : address(Transport::Type::kUdp), mrpRemoteConfig(GetDefaultMRPConfig()) {}
3939
};
4040

4141
/// Represents an object interested in callbacks for a resolve operation.

src/lib/address_resolve/AddressResolve_DefaultImpl.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,8 @@ void Resolver::OnOperationalNodeResolved(const Dnssd::ResolvedNodeData & nodeDat
259259

260260
result.address.SetPort(nodeData.resolutionData.port);
261261
result.address.SetInterface(nodeData.resolutionData.interfaceId);
262-
result.mrpConfig = nodeData.resolutionData.GetMRPConfig();
263-
result.supportsTcp = nodeData.resolutionData.supportsTcp;
262+
result.mrpRemoteConfig = nodeData.resolutionData.GetRemoteMRPConfig();
263+
result.supportsTcp = nodeData.resolutionData.supportsTcp;
264264

265265
for (size_t i = 0; i < nodeData.resolutionData.numIPs; i++)
266266
{

src/lib/address_resolve/tool.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ class PrintOutNodeListener : public chip::AddressResolve::NodeListener
5454

5555
ChipLogProgress(Discovery, "Resolve completed: %s", addr_string);
5656
ChipLogProgress(Discovery, " Supports TCP: %s", result.supportsTcp ? "YES" : "NO");
57-
ChipLogProgress(Discovery, " MRP IDLE retransmit timeout: %u ms", result.mrpConfig.mIdleRetransTimeout.count());
58-
ChipLogProgress(Discovery, " MRP ACTIVE retransmit timeout: %u ms", result.mrpConfig.mActiveRetransTimeout.count());
57+
ChipLogProgress(Discovery, " MRP IDLE retransmit timeout: %u ms", result.mrpRemoteConfig.mIdleRetransTimeout.count());
58+
ChipLogProgress(Discovery, " MRP ACTIVE retransmit timeout: %u ms", result.mrpRemoteConfig.mActiveRetransTimeout.count());
5959
NotifyDone();
6060
}
6161

src/lib/dnssd/Advertiser.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,12 @@ class BaseAdvertisingParams
8888
const chip::ByteSpan GetMac() const { return chip::ByteSpan(mMacStorage, mMacLength); }
8989

9090
// Common Flags
91-
Derived & SetMRPConfig(const ReliableMessageProtocolConfig & config)
91+
Derived & SetLocalMRPConfig(const Optional<ReliableMessageProtocolConfig> & config)
9292
{
93-
mMRPConfig.SetValue(config);
93+
mLocalMRPConfig = config;
9494
return *reinterpret_cast<Derived *>(this);
9595
}
96-
const Optional<ReliableMessageProtocolConfig> & GetMRPConfig() const { return mMRPConfig; }
96+
const Optional<ReliableMessageProtocolConfig> & GetLocalMRPConfig() const { return mLocalMRPConfig; }
9797
Derived & SetTcpSupported(Optional<bool> tcpSupported)
9898
{
9999
mTcpSupported = tcpSupported;
@@ -107,7 +107,7 @@ class BaseAdvertisingParams
107107
bool mEnableIPv4 = true;
108108
uint8_t mMacStorage[kMaxMacSize] = {};
109109
size_t mMacLength = 0;
110-
Optional<ReliableMessageProtocolConfig> mMRPConfig;
110+
Optional<ReliableMessageProtocolConfig> mLocalMRPConfig;
111111
Optional<bool> mTcpSupported;
112112
};
113113

src/lib/dnssd/Advertiser_ImplMinimalMdns.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ class AdvertiserMinMdns : public ServiceAdvertiser,
222222
CHIP_ERROR AddCommonTxtEntries(const BaseAdvertisingParams<Derived> & params, CommonTxtEntryStorage & storage,
223223
char ** txtFields, size_t & numTxtFields)
224224
{
225-
auto optionalMrp = params.GetMRPConfig();
225+
auto optionalMrp = params.GetLocalMRPConfig();
226226

227227
if (optionalMrp.HasValue())
228228
{

src/lib/dnssd/Discovery_ImplPlatform.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ CHIP_ERROR CopyTxtRecord(TxtFieldKey key, char * buffer, size_t bufferLen, const
277277
return CopyTextRecordValue(buffer, bufferLen, params.GetTcpSupported());
278278
case TxtFieldKey::kSleepyIdleInterval:
279279
case TxtFieldKey::kSleepyActiveInterval:
280-
return CopyTextRecordValue(buffer, bufferLen, params.GetMRPConfig(), key == TxtFieldKey::kSleepyIdleInterval);
280+
return CopyTextRecordValue(buffer, bufferLen, params.GetLocalMRPConfig(), key == TxtFieldKey::kSleepyIdleInterval);
281281
default:
282282
return CHIP_ERROR_INVALID_ARGUMENT;
283283
}

src/lib/dnssd/Resolver.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ struct CommonResolutionData
5656

5757
bool IsValid() const { return !IsHost("") && (numIPs > 0) && (ipAddress[0] != chip::Inet::IPAddress::Any); }
5858

59-
ReliableMessageProtocolConfig GetMRPConfig() const
59+
ReliableMessageProtocolConfig GetRemoteMRPConfig() const
6060
{
61-
const ReliableMessageProtocolConfig defaultConfig = GetLocalMRPConfig();
61+
const ReliableMessageProtocolConfig defaultConfig = GetDefaultMRPConfig();
6262
return ReliableMessageProtocolConfig(GetMrpRetryIntervalIdle().ValueOr(defaultConfig.mIdleRetransTimeout),
6363
GetMrpRetryIntervalActive().ValueOr(defaultConfig.mActiveRetransTimeout));
6464
}

src/lib/dnssd/minimal_mdns/tests/TestAdvertiser.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ OperationalAdvertisingParameters operationalParams1 =
7979
.SetPort(CHIP_PORT)
8080
.EnableIpV4(true)
8181
.SetTcpSupported(chip::Optional<bool>(false))
82-
.SetMRPConfig(ReliableMessageProtocolConfig(32_ms32, 30_ms32)); // Match SII, SAI below
82+
.SetLocalMRPConfig(Optional<ReliableMessageProtocolConfig>::Value(32_ms32, 30_ms32)); // Match SII, SAI below
8383
OperationalAdvertisingParameters operationalParams2 =
8484
OperationalAdvertisingParameters().SetPeerId(kPeerId2).SetMac(ByteSpan(kMac)).SetPort(CHIP_PORT).EnableIpV4(true);
8585
OperationalAdvertisingParameters operationalParams3 =
@@ -180,7 +180,7 @@ CommissionAdvertisingParameters commissionableNodeParamsLargeEnhanced =
180180
.SetRotatingDeviceId(chip::Optional<const char *>("id_that_spins"))
181181
.SetTcpSupported(chip::Optional<bool>(true))
182182
// 3600005 is more than the max so should be adjusted down
183-
.SetMRPConfig(ReliableMessageProtocolConfig(3600000_ms32, 3600005_ms32));
183+
.SetLocalMRPConfig(Optional<ReliableMessageProtocolConfig>::Value(3600000_ms32, 3600005_ms32));
184184
QNamePart txtCommissionableNodeParamsLargeEnhancedParts[] = { "D=22", "VP=555+897", "CM=2", "DT=70000",
185185
"DN=testy-test", "RI=id_that_spins", "PI=Pair me", "PH=3",
186186
"SAI=3600000", "SII=3600000", "T=1" };

src/lib/dnssd/platform/tests/TestPlatform.cpp

+9-8
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,14 @@ test::ExpectedCall operationalCall1 = test::ExpectedCall()
4646
.SetInstanceName("BEEFBEEFF00DF00D-1111222233334444")
4747
.SetHostName(host)
4848
.AddSubtype("_IBEEFBEEFF00DF00D");
49-
OperationalAdvertisingParameters operationalParams2 = OperationalAdvertisingParameters()
50-
.SetPeerId(kPeerId2)
51-
.SetMac(ByteSpan(kMac))
52-
.SetPort(CHIP_PORT)
53-
.EnableIpV4(true)
54-
.SetMRPConfig({ 32_ms32, 30_ms32 }) // SII and SAI to match below
55-
.SetTcpSupported(Optional<bool>(true));
49+
OperationalAdvertisingParameters operationalParams2 =
50+
OperationalAdvertisingParameters()
51+
.SetPeerId(kPeerId2)
52+
.SetMac(ByteSpan(kMac))
53+
.SetPort(CHIP_PORT)
54+
.EnableIpV4(true)
55+
.SetLocalMRPConfig(Optional<ReliableMessageProtocolConfig>::Value(32_ms32, 30_ms32)) // SII and SAI to match below
56+
.SetTcpSupported(Optional<bool>(true));
5657
test::ExpectedCall operationalCall2 = test::ExpectedCall()
5758
.SetProtocol(DnssdServiceProtocol::kDnssdProtocolTcp)
5859
.SetServiceName("_matter")
@@ -95,7 +96,7 @@ CommissionAdvertisingParameters commissionableNodeParamsLargeBasic =
9596
.SetRotatingDeviceId(chip::Optional<const char *>("id_that_spins"))
9697
.SetTcpSupported(chip::Optional<bool>(true))
9798
// 3600005 is over the max, so this should be adjusted by the platform
98-
.SetMRPConfig({ 3600000_ms32, 3600005_ms32 });
99+
.SetLocalMRPConfig(Optional<ReliableMessageProtocolConfig>::Value(3600000_ms32, 3600005_ms32));
99100

100101
test::ExpectedCall commissionableLargeBasic = test::ExpectedCall()
101102
.SetProtocol(DnssdServiceProtocol::kDnssdProtocolUdp)

0 commit comments

Comments
 (0)