Skip to content

Commit

Permalink
spell check fixes (opencomputeproject#1189)
Browse files Browse the repository at this point in the history
Signed-off-by: Liat Grozovik <[email protected]>
  • Loading branch information
liat-grozovik authored Feb 1, 2021
1 parent bf4271b commit a2b3344
Show file tree
Hide file tree
Showing 18 changed files with 46 additions and 46 deletions.
4 changes: 2 additions & 2 deletions flexsai/p4/backend/json_stage/analyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class CFG final : public IHasDbPrint {
bool checkSame(const EdgeSet& other) const;
/// Check if this destination appears in this edgeset.
/// Importantly, a TableNode is a destination if it points to
/// the same table as an existin destination (pointer equality
/// the same table as an existing destination (pointer equality
/// is not enough).
bool isDestination(const CFG::Node* destination) const;
};
Expand Down Expand Up @@ -178,7 +178,7 @@ class CFG final : public IHasDbPrint {
void computeSuccessors()
{ for (auto n : allNodes) n->computeSuccessors(); }
/// BMv2 is very restricted in the kinds of graphs it supports.
/// Thie method checks whether a CFG is implementable.
/// This method checks whether a CFG is implementable.
bool checkImplementable() const;
// Graphs that require cycles are not implementable on BMv2.
// These can arise if a table is invoked multiple times.
Expand Down
2 changes: 1 addition & 1 deletion flexsai/p4/backend/json_stage/expression.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class ExpressionConverter : public Inspector {
* @param doFixup Insert masking operations for operands to ensure that the result
* matches the specification. BMv2 does arithmetic using unbounded
* precision, but the spec requires fixed precision, specified by the types.
* @param wrap Wrap the result into an additiona JSON expression block.
* @param wrap Wrap the result into an additional JSON expression block.
* See the BMv2 JSON spec.
* @param convertBool Wrap the result into a cast from boolean to data (b2d JSON).
*/
Expand Down
2 changes: 1 addition & 1 deletion flexsai/p4/backend/json_stage/lower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ struct VariableWriters {
return result;
}
/**
This function returns a non-null value only if there is exaclty one writer statement.
This function returns a non-null value only if there is exactly one writer statement.
In that case it returns the RHS of the assignment
*/
const IR::Expression* substitution() const {
Expand Down
2 changes: 1 addition & 1 deletion flexsai/p4/backend/json_stage/lower.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class RemoveComplexExpressions : public Transform {
const IR::Node* preorder(IR::P4Control* control) override;
const IR::Node* postorder(IR::P4Control* control) override {
if (newDecls.size() != 0) {
// prepend declarations
// prepare declarations
newDecls.append(control->controlLocals);
control->controlLocals = newDecls;
}
Expand Down
2 changes: 1 addition & 1 deletion flexsai/p4/backend/json_stage/saiSwitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const char* Switch_Model::P4_PIPELINE_INGRESS_L2 = "ingressPort";
const char* Switch_Model::P4_PIPELINE_EGRESS_L2 = "egressPort";
const char* Switch_Model::P4_PIPELINE_INGRESS_L3 = "ingressRif";
const char* Switch_Model::P4_PIPELINE_EGRESS_L3 = "egressRif";
// These string constatns must match those in the python transpiler
// These string constants must match those in the python transpiler
const char* Switch_Model::JSON_PIPELINE_PARSER = "parse";
const char* Switch_Model::JSON_PIPELINE_DEPARSER = "deparse";
const char* Switch_Model::JSON_PIPELINE_INGRESS_L2 = "control_in_port";
Expand Down
6 changes: 3 additions & 3 deletions flexsai/p4/backend/output_stage/SAI_templates/sai_template.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ sai_status_t sai_ext_api_initialize();

/**
* @brief Retrieve a pointer to the C-style method table for desired SAI
* extenstions functionality as specified by the given sai_ext_api_id.
* extensions functionality as specified by the given sai_ext_api_id.
*
* @param[in] sai_ext_api_id SAI EXT API ID
* @param[out] api_method_table Caller allocated method table The table must
Expand All @@ -45,11 +45,11 @@ sai_status_t sai_ext_api_query(
_Out_ void** api_method_table);

/**
* @brief Uninitialize sai extenstions
* @brief Uninitialize sai extensions
* retrieved via sai_ext_api_query() cannot be used after this call.
*
* @return #SAI_STATUS_SUCCESS on success Failure status code on error
*/
sai_status_t sai_ext_api_uninitialize();

#endif /** __SAI_EXT_H_ */
#endif /** __SAI_EXT_H_ */
4 changes: 2 additions & 2 deletions meta/saimetadatautils.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const sai_attr_metadata_t* sai_metadata_get_attr_metadata(
const sai_attr_metadata_t* const* const md = sai_metadata_attr_by_object_type[objecttype];

/*
* Most obejct attributes are not flags, so we can use direct index to
* Most object attributes are not flags, so we can use direct index to
* find attribute metadata, this should speed up search.
*/

Expand Down Expand Up @@ -244,7 +244,7 @@ bool sai_metadata_is_condition_met(
const sai_attr_condition_t *condition = metadata->conditions[idx];

/*
* Conditons may only be on the same object type.
* Conditions may only be on the same object type.
*
* Default value may not exists if conditional object is marked as
* MANDATORY_ON_CREATE.
Expand Down
22 changes: 11 additions & 11 deletions meta/saisanitycheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ void check_attr_allowed_object_types(
ot == SAI_OBJECT_TYPE_FDB_FLUSH ||
ot == SAI_OBJECT_TYPE_HOSTIF_PACKET)
{
/* switch object type is ment to be used only in non object id struct types */
/* switch object type is meant to be used only in non object id struct types */

META_MD_ASSERT_FAIL(md, "switch object type can't be used as object type in any attribute");
}
Expand Down Expand Up @@ -2379,7 +2379,7 @@ void check_attr_existing_objects(

case SAI_ATTR_VALUE_TYPE_POINTER:
/*
* Allow poniter for switch register read and write API's.
* Allow pointer for switch register read and write API's.
*/
break;
default:
Expand Down Expand Up @@ -2463,7 +2463,7 @@ void check_attr_brief_description(
META_LOG_ENTER();

/*
* Purpose of this check is to see if brief description extracte from
* Purpose of this check is to see if brief description extract from
* header is present and not too long.
*/

Expand Down Expand Up @@ -2594,7 +2594,7 @@ void check_attr_condition_met(

/*
* If there are multiple conditions, we need to provide fake values for all
* others to force return false to test each one separetly.
* others to force return false to test each one separately.
*/

uint32_t count = (uint32_t)md->conditionslength;
Expand Down Expand Up @@ -2833,11 +2833,11 @@ void check_attr_extension_flag(

if (md->attrid >= oi->attridend && md->attrid < CUSTOM_ATTR_RANGE_START)
{
META_ASSERT_TRUE(md->isextensionattr, "atribute %s expected to be extension", md->attridname);
META_ASSERT_TRUE(md->isextensionattr, "attribute %s expected to be extension", md->attridname);
}
else
{
META_ASSERT_FALSE(md->isextensionattr, "atribute %s not expected to be extension", md->attridname);
META_ASSERT_FALSE(md->isextensionattr, "attribute %s not expected to be extension", md->attridname);
}
}

Expand Down Expand Up @@ -3003,7 +3003,7 @@ void check_object_infos()
{
/*
* Attribute ID is in custom range, so it will not be in
* regural start .. end range.
* regular start .. end range.
*/

continue;
Expand Down Expand Up @@ -4140,12 +4140,12 @@ void check_switch_attributes()
const sai_attr_metadata_t *md = meta[index];

/*
* Gerabox attributes can be marked as mandatory on create.
* Gearbox attributes can be marked as mandatory on create.
*/

if (md->isoidattribute && md->ismandatoryoncreate)
{
META_MD_ASSERT_FAIL(md, "Mandatroy on create can't be object id on SWITCH");
META_MD_ASSERT_FAIL(md, "Mandatory on create can't be object id on SWITCH");
}

if (md->isoidattribute && md->iscreateonly)
Expand Down Expand Up @@ -4232,7 +4232,7 @@ void check_enum_to_attr_map(

/*
* Check whether attribute enum declared has equal number of items as the
* number of declared attributes. Item siwth @ignore flag shluld be
* number of declared attributes. Item swith @ignore flag should be
* removed from enum and attribute should not be created.
*/

Expand Down Expand Up @@ -4287,7 +4287,7 @@ void check_object_ro_list(
/*
* We skip hostif table entry since there is no 1 object which can
* identify all table entries. We would need to add one attribute for
* each used obect type port, lag, vlan etc.
* each used object type port, lag, vlan etc.
*/

return;
Expand Down
18 changes: 9 additions & 9 deletions meta/saiserializetest.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,15 +556,15 @@ void test_deserialize_ip4()
sai_ip4_t ip;

res = sai_deserialize_ip4("10.0.0.21", &ip);
ASSERT_TRUE(res > 0 && strlen("10.0.0.21") == res, "expectes true, res: %d", res);
ASSERT_TRUE(ip == htonl(0x0a000015), "expectes true");
ASSERT_TRUE(res > 0 && strlen("10.0.0.21") == res, "expected true, res: %d", res);
ASSERT_TRUE(ip == htonl(0x0a000015), "expected true");
ASSERT_TRUE(memcmp(&ip, "\x0a\x00\x00\x15", 4) == 0, "expected true");

res = sai_deserialize_ip4("10.0.0.21\"", &ip);
ASSERT_TRUE(res > 0 && strlen("10.0.0.21") == res, "expectes true, res: %d", res);
ASSERT_TRUE(res > 0 && strlen("10.0.0.21") == res, "expected true, res: %d", res);

res = sai_deserialize_ip4("10.0.0.21/", &ip);
ASSERT_TRUE(res > 0 && strlen("10.0.0.21") == res, "expectes true, res: %d", res);
ASSERT_TRUE(res > 0 && strlen("10.0.0.21") == res, "expected true, res: %d", res);

res = sai_deserialize_ip4("1::ff", &ip);
ASSERT_TRUE(res < 0, "expected negative number");
Expand Down Expand Up @@ -729,19 +729,19 @@ void test_deserialize_ip_address()
sai_ip_address_t ip;

res = sai_deserialize_ip_address("10.0.0.21", &ip);
ASSERT_TRUE(res > 0 && strlen("10.0.0.21") == res, "expectes true, res: %d", res);
ASSERT_TRUE(ip.addr.ip4 == htonl(0x0a000015), "expectes true");
ASSERT_TRUE(res > 0 && strlen("10.0.0.21") == res, "expected true, res: %d", res);
ASSERT_TRUE(ip.addr.ip4 == htonl(0x0a000015), "expected true");
ASSERT_TRUE(memcmp(&ip.addr.ip4, "\x0a\x00\x00\x15", 4) == 0, "expected true");
ASSERT_TRUE(ip.addr_family == SAI_IP_ADDR_FAMILY_IPV4, "expected true");

res = sai_deserialize_ip_address("10.0.0.21\"", &ip);
ASSERT_TRUE(res > 0 && strlen("10.0.0.21") == res, "expectes true, res: %d", res);
ASSERT_TRUE(res > 0 && strlen("10.0.0.21") == res, "expected true, res: %d", res);

res = sai_deserialize_ip_address("10.0.0.21/", &ip);
ASSERT_TRUE(res > 0 && strlen("10.0.0.21") == res, "expectes true, res: %d", res);
ASSERT_TRUE(res > 0 && strlen("10.0.0.21") == res, "expected true, res: %d", res);

res = sai_deserialize_ip_address("255.255.255.255", &ip);
ASSERT_TRUE(res > 0 && strlen("255.255.255.255") == res, "expectes true, res: %d", res);
ASSERT_TRUE(res > 0 && strlen("255.255.255.255") == res, "expected true, res: %d", res);

res = sai_deserialize_ip_address("1.1.256.1", &ip);
ASSERT_TRUE(res < 0, "expected negative number");
Expand Down
6 changes: 3 additions & 3 deletions test/basic_router/basic_router.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ bool basic_router_setup()
return false;
}

LOGG(TEST_DEBUG, SETL3, "virtual rounter id 0x%lx\n", g_vr_id);
LOGG(TEST_DEBUG, SETL3, "virtual router id 0x%lx\n", g_vr_id);


LOGG(TEST_INFO, SETL3, "for each port, sai_port_api->set_port_attribute SAI_PORT_ATTR_ADMIN_STATE true\n");
Expand Down Expand Up @@ -531,7 +531,7 @@ bool basic_router_setup()
LOGG(TEST_DEBUG, SETL3, "hif_id 0x%lx \n", hif_id);
}

LOGG(TEST_DEBUG, SETL3, "--- end of loof of interface ---\n");
LOGG(TEST_DEBUG, SETL3, "--- end of loop of interface ---\n");

for (i = 0; i < g_testcount; i++)
{
Expand Down Expand Up @@ -751,7 +751,7 @@ static void neighbor_removing()
{

neighbor_mgr->Show();
LOGG(TEST_INFO, TESTCASE, "--- remving all neighbor entries ---\n");
LOGG(TEST_INFO, TESTCASE, "--- removing all neighbor entries ---\n");

IpAddress ipAddr;

Expand Down
4 changes: 2 additions & 2 deletions test/basic_router/ip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ IpAddress::IpAddress(const std::string &ipstr)
{
if (inet_pton(AF_INET, ipstr.c_str(), &m_addr) != 1)
{
std::string errmsg = "connot convert " + ipstr + " to ip address";
std::string errmsg = "cannot convert " + ipstr + " to ip address";
throw std::invalid_argument(errmsg);
}
}
Expand Down Expand Up @@ -118,7 +118,7 @@ IpPrefix::IpPrefix(

if (m_maskLen < 0 || m_maskLen > 32)
{
std::string errmsg = "connot convert " + ipStr + " to ip prefix";
std::string errmsg = "cannot convert " + ipStr + " to ip prefix";
throw std::invalid_argument(errmsg);
}

Expand Down
2 changes: 1 addition & 1 deletion test/basic_router/nexthopgrp_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ bool NextHopGrpMgr::Add(IpAddresses nextHops)

if (!nbEntry)
{
LOGG(TEST_ERR, NXTHG, "fail to find the NeiborEntry for nexthop %s\n", itnh->to_string().c_str());
LOGG(TEST_ERR, NXTHG, "fail to find the neighbor entry for nexthop %s\n", itnh->to_string().c_str());
continue;
}

Expand Down
8 changes: 4 additions & 4 deletions test/basic_router/route_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ bool RouteMgr::Add(IpPrefix prefix, IpAddresses nexthops)

if (!nbEntry)
{
LOGG(TEST_ERR, ROUTE, "fail to find the NeiborEntry for nexthop %s\n", itnh->to_string().c_str());
LOGG(TEST_ERR, ROUTE, "fail to find the neighbor entry for nexthop %s\n", itnh->to_string().c_str());
continue;
}

Expand All @@ -114,23 +114,23 @@ bool RouteMgr::Add(IpPrefix prefix, IpAddresses nexthops)

if (nhids.size() == 0)
{
LOGG(TEST_DEBUG, ROUTE, "cannot find the any of nexthops %s in the neighbor table\n", nexthops.to_string().c_str());
LOGG(TEST_DEBUG, ROUTE, "cannot find any of nexthops %s in the neighbor table\n", nexthops.to_string().c_str());
return false;
}

if (nhids.size() > 1)
{
if (!m_nhgMgr->Add(nexthops))
{
LOGG(TEST_ERR, ROUTE, "fail to add next hop group %s\n", nexthops.to_string().c_str());
LOGG(TEST_ERR, ROUTE, "fail to add nexthop group %s\n", nexthops.to_string().c_str());
return false;
}

const NextHopGrpEntry *nhgEntry = m_nhgMgr->GetNextHopGrpEntry(nexthops);

if (!nhgEntry)
{
LOGG(TEST_ERR, ROUTE, "fail to retrieve next hop group %s\n", nexthops.to_string().c_str());
LOGG(TEST_ERR, ROUTE, "fail to retrieve nexthop group %s\n", nexthops.to_string().c_str());
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion test/sai_ut/routing/sai_l3_neighbor_unit_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ TEST_F (saiL3NeighborTest, invalid_attr_id)
const char *p_ip_addr_str = "11.0.0.1";
const char *p_mac_str = "00:a1:a2:a3:a4:a5";

/* Pass invalid attribtue id in list */
/* Pass invalid attribute id in list */
status = sai_test_neighbor_create (port_rif_id, ip_af, p_ip_addr_str,
(default_neighbor_attr_count + 1),
SAI_NEIGHBOR_ATTR_DST_MAC_ADDRESS,
Expand Down
2 changes: 1 addition & 1 deletion test/sai_ut/routing/sai_l3_nexthop_unit_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ TEST_F (saiL3NextHopTest, invalid_attr_id)
const unsigned int invalid_attr_pos = 3;
const unsigned int invalid_attr_id = 0xffff;

/* Pass invalid attribtue id in list */
/* Pass invalid attribute id in list */
status = sai_test_nexthop_create (&nh_id,
(default_nh_attr_count + 1),
SAI_NEXT_HOP_ATTR_TYPE,
Expand Down
2 changes: 1 addition & 1 deletion test/sai_ut/routing/sai_l3_nexthopgroup_unit_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ TEST_F (saiL3NextHopGroupTest, invalid_attr_id)
const unsigned int invalid_attr_pos = 2;
const unsigned int invalid_attr_id = 0xffff;

/* Pass invalid attribtue id in list */
/* Pass invalid attribute id in list */
status = sai_test_nh_group_create (&group_id, p_nh_id_list,
(default_nh_group_attr_count + 1),
SAI_NEXT_HOP_GROUP_ATTR_TYPE,
Expand Down
2 changes: 1 addition & 1 deletion test/sai_ut/routing/sai_l3_rif_unit_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ TEST_F (saiL3RifTest, rif_create_with_mac_attr_on_vrf_with_mac_attr)
}

/*
* PORT RIF, VLAN RIF created without any optional paramters on VRF with
* PORT RIF, VLAN RIF created without any optional parameters on VRF with
* SRC MAC, V4 and V6 admin state set.
*
* SRC MAC, V4 and V6 admin state attributes inherited by these RIF's from VRF.
Expand Down
2 changes: 1 addition & 1 deletion test/saithrift/src/switch_sai_rpc_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ class switch_sai_rpcHandler : virtual public switch_sai_rpcIf {

sai_attrs = (sai_attribute_t *) calloc(thrift_attr_list.size(), sizeof(sai_attribute_t));
if (!sai_attrs) {
SAI_THRIFT_LOG_ERR("failed to allocate sai attibutes list");
SAI_THRIFT_LOG_ERR("failed to allocate sai attributes list");
return NULL;
}

Expand Down

0 comments on commit a2b3344

Please sign in to comment.