Skip to content
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

Get some RAM savings by re-ordering some structure members based on pahole feedback #32106

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/credentials/FabricTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,15 @@ class DLL_EXPORT FabricInfo
private:
struct InitParams
{
NodeId nodeId = kUndefinedNodeId;
FabricId fabricId = kUndefinedFabricId;
FabricIndex fabricIndex = kUndefinedFabricIndex;
CompressedFabricId compressedFabricId = kUndefinedCompressedFabricId;
Crypto::P256PublicKey rootPublicKey;
VendorId vendorId = VendorId::NotSpecified; /**< Vendor ID for commissioner of fabric */
CompressedFabricId compressedFabricId = kUndefinedCompressedFabricId;
NodeId nodeId = kUndefinedNodeId;
FabricIndex fabricIndex = kUndefinedFabricIndex;
Crypto::P256Keypair * operationalKeypair = nullptr;
bool hasExternallyOwnedKeypair = false;
bool advertiseIdentity = false;
FabricId fabricId = kUndefinedFabricId;
Crypto::P256PublicKey rootPublicKey;
VendorId vendorId = VendorId::NotSpecified; /**< Vendor ID for commissioner of fabric */
bool hasExternallyOwnedKeypair = false;
bool advertiseIdentity = false;

CHIP_ERROR AreValid() const
{
Expand Down
34 changes: 17 additions & 17 deletions src/lib/dnssd/TxtFields.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,28 +79,28 @@ enum class TxtFieldKey : uint8_t
namespace Internal {
struct TxtFieldInfo
{
TxtFieldKey key;
size_t valMaxSize;
char keyStr[4];
TxtFieldKey key;
TxtKeyUse use;
char keyStr[4];
};

constexpr const TxtFieldInfo txtFieldInfo[static_cast<size_t>(TxtFieldKey::kCount)] = {
{ TxtFieldKey::kUnknown, 0, "", TxtKeyUse::kNone },
{ TxtFieldKey::kLongDiscriminator, kKeyLongDiscriminatorMaxLength, "D", TxtKeyUse::kCommission },
{ TxtFieldKey::kVendorProduct, kKeyVendorProductMaxLength, "VP", TxtKeyUse::kCommission },
{ TxtFieldKey::kCommissioningMode, kKeyCommissioningModeMaxLength, "CM", TxtKeyUse::kCommission },
{ TxtFieldKey::kDeviceType, kKeyDeviceTypeMaxLength, "DT", TxtKeyUse::kCommission },
{ TxtFieldKey::kDeviceName, kKeyDeviceNameMaxLength, "DN", TxtKeyUse::kCommission },
{ TxtFieldKey::kRotatingDeviceId, kKeyRotatingDeviceIdMaxLength, "RI", TxtKeyUse::kCommission },
{ TxtFieldKey::kPairingInstruction, kKeyPairingInstructionMaxLength, "PI", TxtKeyUse::kCommission },
{ TxtFieldKey::kPairingHint, kKeyPairingHintMaxLength, "PH", TxtKeyUse::kCommission },
{ TxtFieldKey::kCommissionerPasscode, kKeyCommissionerPasscodeMaxLength, "CP", TxtKeyUse::kCommission },
{ TxtFieldKey::kSessionIdleInterval, kKeySessionIdleIntervalMaxLength, "SII", TxtKeyUse::kCommon },
{ TxtFieldKey::kSessionActiveInterval, kKeySessionActiveIntervalMaxLength, "SAI", TxtKeyUse::kCommon },
{ TxtFieldKey::kSessionActiveThreshold, kKeySessionActiveThresholdMaxLength, "SAT", TxtKeyUse::kCommon },
{ TxtFieldKey::kTcpSupported, kKeyTcpSupportedMaxLength, "T", TxtKeyUse::kCommon },
{ TxtFieldKey::kLongIdleTimeICD, kKeyLongIdleTimeICDMaxLength, "ICD", TxtKeyUse::kCommon },
{ 0, TxtFieldKey::kUnknown, TxtKeyUse::kNone, "" },
{ kKeyLongDiscriminatorMaxLength, TxtFieldKey::kLongDiscriminator, TxtKeyUse::kCommission, "D" },
{ kKeyVendorProductMaxLength, TxtFieldKey::kVendorProduct, TxtKeyUse::kCommission, "VP" },
{ kKeyCommissioningModeMaxLength, TxtFieldKey::kCommissioningMode, TxtKeyUse::kCommission, "CM" },
{ kKeyDeviceTypeMaxLength, TxtFieldKey::kDeviceType, TxtKeyUse::kCommission, "DT" },
{ kKeyDeviceNameMaxLength, TxtFieldKey::kDeviceName, TxtKeyUse::kCommission, "DN" },
{ kKeyRotatingDeviceIdMaxLength, TxtFieldKey::kRotatingDeviceId, TxtKeyUse::kCommission, "RI" },
{ kKeyPairingInstructionMaxLength, TxtFieldKey::kPairingInstruction, TxtKeyUse::kCommission, "PI" },
{ kKeyPairingHintMaxLength, TxtFieldKey::kPairingHint, TxtKeyUse::kCommission, "PH" },
{ kKeyCommissionerPasscodeMaxLength, TxtFieldKey::kCommissionerPasscode, TxtKeyUse::kCommission, "CP" },
{ kKeySessionIdleIntervalMaxLength, TxtFieldKey::kSessionIdleInterval, TxtKeyUse::kCommon, "SII" },
{ kKeySessionActiveIntervalMaxLength, TxtFieldKey::kSessionActiveInterval, TxtKeyUse::kCommon, "SAI" },
{ kKeySessionActiveThresholdMaxLength, TxtFieldKey::kSessionActiveThreshold, TxtKeyUse::kCommon, "SAT" },
{ kKeyTcpSupportedMaxLength, TxtFieldKey::kTcpSupported, TxtKeyUse::kCommon, "T" },
{ kKeyLongIdleTimeICDMaxLength, TxtFieldKey::kLongIdleTimeICD, TxtKeyUse::kCommon, "ICD" },
};
#ifdef CHIP_CONFIG_TEST

Expand Down
12 changes: 6 additions & 6 deletions src/lib/dnssd/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,18 +207,18 @@ inline constexpr size_t kMaxPairingInstructionLen = 128;
/// Data that is specific to commisionable/commissioning node discovery
struct CommissionNodeData
{
char instanceName[Commission::kInstanceNameMaxLength + 1] = {};
size_t rotatingIdLen = 0;
uint32_t deviceType = 0;
uint16_t longDiscriminator = 0;
uint16_t vendorId = 0;
uint16_t productId = 0;
uint16_t pairingHint = 0;
uint8_t commissioningMode = 0;
uint32_t deviceType = 0;
char deviceName[kMaxDeviceNameLen + 1] = {};
uint8_t commissionerPasscode = 0;
uint8_t rotatingId[kMaxRotatingIdLen] = {};
size_t rotatingIdLen = 0;
uint16_t pairingHint = 0;
char instanceName[Commission::kInstanceNameMaxLength + 1] = {};
char deviceName[kMaxDeviceNameLen + 1] = {};
char pairingInstruction[kMaxPairingInstructionLen + 1] = {};
uint8_t commissionerPasscode = 0;

CommissionNodeData() {}

Expand Down
Loading