Skip to content

Commit 398d24a

Browse files
authored
Add comments aspell check (sonic-net#382)
* Add cold discovered oids * Add cold discovered oids * Add buffer pool logic and unittests * Add comments aspell check * Bring back logging
1 parent 08fccb0 commit 398d24a

Some content is hidden

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

41 files changed

+643
-243
lines changed

lib/inc/sairedis.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ typedef enum _sai_redis_switch_attr_t
9595
* to ".n" suffix, and when we reopen file, we will actually create new
9696
* one.
9797
*
98-
* This attribute is only setting variable in memroy, it's safe to call
98+
* This attribute is only setting variable in memory, it's safe to call
9999
* this from signal handler.
100100
*
101101
* @type bool

lib/src/sai_redis_generic_create.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ sai_object_type_t sai_object_type_query(
9393
SWSS_LOG_ERROR("invalid object id 0x%lx", object_id);
9494

9595
/*
96-
* We can't throw here, since it would give no meaningfull message.
96+
* We can't throw here, since it would give no meaningful message.
9797
* Throwing at one level up is better.
9898
*/
9999

@@ -356,7 +356,7 @@ sai_status_t internal_redis_bulk_generic_create(
356356
}
357357

358358
/*
359-
* We are adding number of entries to actualy add ':' to be compatible
359+
* We are adding number of entries to actually add ':' to be compatible
360360
* with previous
361361
*/
362362

@@ -372,7 +372,7 @@ sai_status_t internal_redis_bulk_generic_create(
372372
}
373373

374374
/*
375-
* Capital 'C' stads for bulk CREATE operation.
375+
* Capital 'C' stands for bulk CREATE operation.
376376
*/
377377

378378
recordLine("C|" + str_object_type + joined);

lib/src/sai_redis_generic_get.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ sai_status_t internal_redis_get_process(
2323

2424
sai_deserialize_status(str_sai_status, status);
2525

26-
// we could deserialize directly to user data, but list is alocated by deserializer
26+
// we could deserialize directly to user data, but list is allocated by deserializer
2727
if (status == SAI_STATUS_SUCCESS)
2828
{
2929
SaiAttributeList list(object_type, values, false);
@@ -117,7 +117,7 @@ void clear_oid_values(
117117
default:
118118

119119
/*
120-
* If in futre new attribute with object id will be added this
120+
* If in future new attribute with object id will be added this
121121
* will make sure that we will need to add handler here.
122122
*/
123123

@@ -155,7 +155,7 @@ sai_status_t internal_redis_generic_get(
155155

156156
/*
157157
* Since user may reuse buffers, then oid list buffers maybe not cleared
158-
* and contain som garbage, let's clean them so we send all oids as null to
158+
* and contain some garbage, let's clean them so we send all oids as null to
159159
* syncd.
160160
*/
161161

lib/src/sai_redis_generic_remove.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ sai_status_t internal_redis_bulk_generic_remove(
102102
}
103103

104104
/*
105-
* We are adding number of entries to actualy add ':' to be compatible
105+
* We are adding number of entries to actually add ':' to be compatible
106106
* with previous
107107
*/
108108

@@ -118,7 +118,7 @@ sai_status_t internal_redis_bulk_generic_remove(
118118
}
119119

120120
/*
121-
* Capital 'C' stads for bulk CREATE operation.
121+
* Capital 'C' stands for bulk CREATE operation.
122122
*/
123123

124124
recordLine("C|" + str_object_type + joined);

lib/src/sai_redis_generic_set.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ sai_status_t internal_redis_bulk_generic_set(
8181
}
8282

8383
/*
84-
* We are adding number of entries to actualy add ':' to be compatible
84+
* We are adding number of entries to actually add ':' to be compatible
8585
* with previous
8686
*/
8787

@@ -97,7 +97,7 @@ sai_status_t internal_redis_bulk_generic_set(
9797
}
9898

9999
/*
100-
* Capital 'S' stads for bulk SET operation.
100+
* Capital 'S' stands for bulk SET operation.
101101
*/
102102

103103
recordLine("S|" + str_object_type + joined);

lib/src/sai_redis_interfacequery.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ void clear_local_state()
4242
clear_notifications();
4343

4444
/*
45-
* Initialize metatada database.
45+
* Initialize metadata database.
4646
*/
4747

4848
meta_init_db();

lib/src/sai_redis_record.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void logfileReopen()
3737

3838
/*
3939
* On log rotate we will use the same file name, we are assuming that
40-
* logrotate deamon move filename to filename.1 and we will create new
40+
* logrotate daemon move filename to filename.1 and we will create new
4141
* empty file here.
4242
*/
4343

meta/sai_extra_acl.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ sai_status_t meta_pre_get_acl_entry_attribute(
162162
{
163163
SWSS_LOG_ENTER();
164164

165-
// TODO for get we need to check if attrib was set previously ?
165+
// TODO for get we need to check if attribute was set previously ?
166166
// like field or action, or can we get action that was not set?
167167

168168
return SAI_STATUS_SUCCESS;

meta/sai_extra_buffer.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ sai_status_t meta_pre_create_buffer_profile(
4444
SWSS_LOG_ENTER();
4545

4646
// TODO extra logic on checking profile buffer size may be needed
47-
// TODO we need to query other attribute pool id assigned and check wheter mode is dynamic/static
47+
// TODO we need to query other attribute pool id assigned and check whether mode is dynamic/static
4848

4949
const sai_attribute_t* attr_shared_dynamic_th = get_attribute_by_id(SAI_BUFFER_PROFILE_ATTR_SHARED_DYNAMIC_TH, attr_count, attr_list);
5050

@@ -80,7 +80,7 @@ sai_status_t meta_pre_set_buffer_profile_attr(
8080
{
8181
SWSS_LOG_ENTER();
8282

83-
// TODO on set, changing buffer pool on profiles should noe be possible
83+
// TODO on set, changing buffer pool on profiles should not be possible
8484
// to change dynamic to static on the fly
8585
// pool_id on profile should be create_only ?
8686

meta/sai_extra_mirror.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ sai_status_t meta_pre_set_mirror_session_attribute(
5757
// TODO we need to type to decide which parameters are safe to set
5858
// SAI_MIRROR_SESSION_ATTR_MONITOR_PORT:
5959
// TODO should changing port during mirror session should be possible ?
60-
// what if new port is somehow incompattible with current session?
60+
// what if new port is somehow incompatible with current session?
6161

6262
// SAI_MIRROR_SESSION_ATTR_GRE_PROTOCOL_TYPE: // TODO validate GRE protocol
6363
return is_header_version_ok(1, attr);

meta/sai_extra_schedulergroup.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ sai_status_t meta_pre_create_scheduler_group(
1919
return SAI_STATUS_INVALID_PARAMETER;
2020
}
2121

22-
// TODO level will require some additional validation to not crete loops
22+
// TODO level will require some additional validation to not create loops
2323

2424
uint8_t max_childs = attr_max_childs->value.u8;
2525

meta/sai_extra_tunnel.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ sai_status_t meta_pre_create_tunnel(
7777
// TODO for GRE/VXLAN it may be different type (router interface, overlay/underlay
7878
//
7979
// TODO validate object on that list! if they exist
80-
// shoud this list contain at least 1 element ? or can it be empty?
80+
// should this list contain at least 1 element ? or can it be empty?
8181
// check for duplicates on list ? - ecn mappers
8282

83-
// TODO sai spec is inconsisten here, if this is mandatory attribute on some condition,
83+
// TODO sai spec is inconsistent here, if this is mandatory attribute on some condition,
8484
// then it cannot have default value, dscp mode and ttl mode
8585

8686
return SAI_STATUS_SUCCESS;
@@ -145,7 +145,7 @@ sai_status_t meta_pre_create_tunnel_term_table_entry (
145145
// TODO check is this conditional attribute, maybe this action is only
146146
// required for ip in ip tunnel types
147147

148-
// TODO additional checks may be required sinec this action tunnel id is used for
148+
// TODO additional checks may be required since this action tunnel id is used for
149149
// decap so maybe this tunnel must have special attributes on creation set
150150

151151
return SAI_STATUS_SUCCESS;

meta/sai_extra_udf.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ sai_status_t meta_pre_create_udf(
99
SWSS_LOG_ENTER();
1010

1111
// TODO validate offset value range
12-
// TODO length must be quual to group attr length ?
12+
// TODO length must be equal to group attr length ?
1313
// TODO extra validation may be required here on mask
1414

1515
return SAI_STATUS_SUCCESS;

meta/sai_extra_wred.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ sai_status_t meta_pre_create_wred_profile(
4040
// green_min < green_max < yellow_min < yellow_max < red_min < red_max
4141
// This logic will be required also inside SET, so
4242

43-
// TODO need to be obrained from switch, also will be required during set
43+
// TODO need to be obtained from switch, also will be required during set
4444
uint32_t max_buffer_size = 0x10000; // is this SAI_SWITCH_ATTR_TOTAL_BUFFER_SIZE ?
4545

4646
// TODO change numbers to defines

meta/sai_meta.cpp

+17-17
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ static bool meta_unittests_get_and_erase_set_readonly_flag(
8383

8484
if (!unittests_enabled)
8585
{
86-
// explicityly to not produce false alarms
86+
// explicitly to not produce false alarms
8787
SWSS_LOG_NOTICE("unittests are not enabled");
8888
return false;
8989
}
@@ -192,8 +192,8 @@ class SaiAttrWrapper
192192
SWSS_LOG_ENTER();
193193

194194
/*
195-
* On destructor we need to call free to dealocate possible
196-
* alocated list on constructor.
195+
* On destructor we need to call free to deallocate possible
196+
* allocated list on constructor.
197197
*/
198198

199199
sai_deserialize_free_attribute_value(m_meta->attrvaluetype, m_attr);
@@ -220,7 +220,7 @@ std::string get_attr_info(const sai_attr_metadata_t& md)
220220

221221
/*
222222
* Attribute name will contain object type as well so we don't need to
223-
* serialize object type separatly.
223+
* serialize object type separately.
224224
*/
225225

226226
return std::string(md.attridname) + ":" + sai_serialize_attr_value_type(md.attrvaluetype);
@@ -596,7 +596,7 @@ sai_status_t meta_generic_validation_objlist(
596596
}
597597

598598
/*
599-
* We need oids set and object type to check whehter oids are not repeated
599+
* We need oids set and object type to check whether oids are not repeated
600600
* on list and whether all oids are same object type.
601601
*/
602602

@@ -741,7 +741,7 @@ std::string construct_key(
741741
SWSS_LOG_ENTER();
742742

743743
/*
744-
* Use map to make sure that keys will be always sorded by id.
744+
* Use map to make sure that keys will be always sorted by id.
745745
*/
746746

747747
std::map<int32_t, std::string> keys;
@@ -878,9 +878,9 @@ sai_status_t meta_generic_validate_non_object_on_create(
878878

879879
/*
880880
* Since non object id objects can contain several object id's inside
881-
* object id strucutre, we need to check whether they all belong to the
881+
* object id structure, we need to check whether they all belong to the
882882
* same switch (sine multiple switches can be present and whether all those
883-
* objects are allowd respectivly on their members.
883+
* objects are allowed respectively on their members.
884884
*
885885
* This check is required only on creation, since on set/get/remove we
886886
* check in object hash whether this object exists.
@@ -894,7 +894,7 @@ sai_status_t meta_generic_validate_non_object_on_create(
894894
}
895895

896896
/*
897-
* This will be most utilzed for createing route entries.
897+
* This will be most utilized for creating route entries.
898898
*/
899899

900900
for (size_t j = 0; j < info->structmemberscount; ++j)
@@ -1075,7 +1075,7 @@ sai_status_t meta_generic_validation_create(
10751075

10761076
bool haskeys = false;
10771077

1078-
// check each attribute separetly
1078+
// check each attribute separately
10791079
for (uint32_t idx = 0; idx < attr_count; ++idx)
10801080
{
10811081
const sai_attribute_t* attr = &attr_list[idx];
@@ -1468,7 +1468,7 @@ sai_status_t meta_generic_validation_create(
14681468
return SAI_STATUS_FAILURE;
14691469
}
14701470

1471-
// check if all mandatory attrributes were passed
1471+
// check if all mandatory attributes were passed
14721472

14731473
for (auto mdp: metadata)
14741474
{
@@ -1588,7 +1588,7 @@ sai_status_t meta_generic_validation_create(
15881588
{
15891589
const auto& c = *md.conditions[index];
15901590

1591-
// condtions may only be on the same object type
1591+
// conditions may only be on the same object type
15921592
const auto& cmd = *sai_metadata_get_attr_metadata(meta_key.objecttype, c.attrid);
15931593

15941594
const sai_attribute_value_t* cvalue = cmd.defaultvalue;
@@ -1749,7 +1749,7 @@ sai_status_t meta_generic_validation_remove(
17491749
{
17501750
/*
17511751
* We allow to remove switch object even if there are ROUTE_ENTRY
1752-
* created and refrencing this switch, since remove could be used
1752+
* created and referencing this switch, since remove could be used
17531753
* in WARM boot scenario.
17541754
*/
17551755

@@ -2255,7 +2255,7 @@ sai_status_t meta_generic_validation_get(
22552255
* attribute also oid, and then did a "set" on that value, and now
22562256
* reference is not decreased since previous oid was not snooped.
22572257
*
2258-
* TODO This concearn all attributes not only conditionals
2258+
* TODO This concern all attributes not only conditionals
22592259
*
22602260
* If attribute is conditional, we need to check if condition is
22612261
* met, if not then this attribute is not mandatory so we can
@@ -3180,7 +3180,7 @@ void meta_generic_validation_post_get_objlist(
31803180
* when we doing get on acl field/action. But none of those are created
31813181
* internally by switch.
31823182
*
3183-
* TODO Similar stuff is with SET, when we will set oid obejct on existing
3183+
* TODO Similar stuff is with SET, when we will set oid object on existing
31843184
* switch object, but we will not have it's previous value. We can check
31853185
* whether default value is present and it's const NULL.
31863186
*/
@@ -3249,7 +3249,7 @@ void meta_generic_validation_post_get_objlist(
32493249
if (!object_reference_exists(oid))
32503250
{
32513251
// NOTE: there may happen that user will request multiple object lists
3252-
// and first list was retrived ok, but second failed with overflow
3252+
// and first list was retrieved ok, but second failed with overflow
32533253
// then we may forget to snoop
32543254

32553255
META_LOG_INFO(md, "returned get object on list [%u] oid 0x%lx object type %d does not exists in local DB (snoop)", i, oid, ot);
@@ -3297,7 +3297,7 @@ void meta_generic_validation_post_get(
32973297
switch_id = meta_extract_switch_id(meta_key, switch_id);
32983298

32993299
/*
3300-
* TODO We should snoop attributes retrived from switch and put them to
3300+
* TODO We should snoop attributes retrieved from switch and put them to
33013301
* local db if they don't exist since if attr is oid it may lead to
33023302
* inconsistency when counting reference
33033303
*/

meta/sai_meta.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -152,19 +152,19 @@ void meta_unittests_enable(
152152
_In_ bool enable);
153153

154154
/**
155-
* @brief Indicates whethre unittests are enabled;
155+
* @brief Indicates whether unittests are enabled;
156156
*/
157157
bool meta_unittests_enabled();
158158

159159
/**
160-
* @bried Allow to perform SET operation on READ_ONLY attribue only once.
160+
* @brief Allow to perform SET operation on READ_ONLY attribute only once.
161161
*
162162
* This function relaxes metadata checking on SET operation, it allows to
163163
* perform SET api on READ_ONLY attribute only once on specific object type and
164-
* specific attribue.
164+
* specific attribute.
165165
*
166166
* Once means that SET operation is only relaxed for the very next SET call on
167-
* that specific object type and attrirbute id.
167+
* that specific object type and attribute id.
168168
*
169169
* Function is explicitly named ONCE, since it will force test developer to not
170170
* forget that SET check is relaxed, and not forget for future unittests.
@@ -186,7 +186,7 @@ bool meta_unittests_enabled();
186186
* It can be dangerous to set any readonly attribute to different values since
187187
* internal metadata logic maybe using that value and in some cases metadata
188188
* database may get out of sync and cause unexpected results in api calls up to
189-
* application carash.
189+
* application crash.
190190
*
191191
* This function is not thread safe.
192192
*

0 commit comments

Comments
 (0)