Skip to content

Commit

Permalink
[orchagent] Arm 32-bit arch compilation warning Fixes (sonic-net#1488)
Browse files Browse the repository at this point in the history
**What I did**
Replaced %l variants with PRI format specifier to fix compilation warnings for arm 32-bit arch

**How I verified it**
Compiled and verified for arm 32-bit arch (marvell-armhf)

* [orchagent] Arm 32-bit arch compilation warning Fixes
* [orchagent] removed explicit type cast
  • Loading branch information
Sabareesh-Kumar-Anandan authored Nov 10, 2020
1 parent b9084a7 commit bed7970
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion orchagent/mirrororch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ bool MirrorOrch::setUnsetPortMirror(Port port,
if (set)
{
port_attr.value.objlist.count = 1;
port_attr.value.objlist.list = (long unsigned int *)calloc(port_attr.value.objlist.count, sizeof(sai_object_id_t));
port_attr.value.objlist.list = reinterpret_cast<sai_object_id_t *>(calloc(port_attr.value.objlist.count, sizeof(sai_object_id_t)));
port_attr.value.objlist.list[0] = sessionId;
}
else
Expand Down
14 changes: 7 additions & 7 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4348,7 +4348,7 @@ bool PortsOrch::initGearboxPort(Port &port)
{
if (m_gearboxInterfaceMap.find(port.m_index) != m_gearboxInterfaceMap.end())
{
SWSS_LOG_NOTICE("BOX: port_id:0x%lx index:%d alias:%s", port.m_port_id, port.m_index, port.m_alias.c_str());
SWSS_LOG_NOTICE("BOX: port_id:0x%" PRIx64 " index:%d alias:%s", port.m_port_id, port.m_index, port.m_alias.c_str());

phy_id = m_gearboxInterfaceMap[port.m_index].phy_id;
phyOidStr = m_gearboxPhyMap[phy_id].phy_oid;
Expand Down Expand Up @@ -4405,11 +4405,11 @@ bool PortsOrch::initGearboxPort(Port &port)
status = sai_port_api->create_port(&systemPort, phyOid, static_cast<uint32_t>(attrs.size()), attrs.data());
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("BOX: Failed to create Gearbox system-side port for alias:%s port_id:0x%lx index:%d status:%d",
SWSS_LOG_ERROR("BOX: Failed to create Gearbox system-side port for alias:%s port_id:0x%" PRIx64 " index:%d status:%d",
port.m_alias.c_str(), port.m_port_id, port.m_index, status);
return false;
}
SWSS_LOG_NOTICE("BOX: Created Gearbox system-side port 0x%lx for alias:%s index:%d",
SWSS_LOG_NOTICE("BOX: Created Gearbox system-side port 0x%" PRIx64 " for alias:%s index:%d",
systemPort, port.m_alias.c_str(), port.m_index);

/* Create LINE-SIDE port */
Expand Down Expand Up @@ -4488,11 +4488,11 @@ bool PortsOrch::initGearboxPort(Port &port)
status = sai_port_api->create_port(&linePort, phyOid, static_cast<uint32_t>(attrs.size()), attrs.data());
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("BOX: Failed to create Gearbox line-side port for alias:%s port_id:0x%lx index:%d status:%d",
SWSS_LOG_ERROR("BOX: Failed to create Gearbox line-side port for alias:%s port_id:0x%" PRIx64 " index:%d status:%d",
port.m_alias.c_str(), port.m_port_id, port.m_index, status);
return false;
}
SWSS_LOG_NOTICE("BOX: Created Gearbox line-side port 0x%lx for alias:%s index:%d",
SWSS_LOG_NOTICE("BOX: Created Gearbox line-side port 0x%" PRIx64 " for alias:%s index:%d",
linePort, port.m_alias.c_str(), port.m_index);

/* Connect SYSTEM-SIDE to LINE-SIDE */
Expand All @@ -4508,11 +4508,11 @@ bool PortsOrch::initGearboxPort(Port &port)
status = sai_port_api->create_port_connector(&connector, phyOid, static_cast<uint32_t>(attrs.size()), attrs.data());
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("BOX: Failed to connect Gearbox system-side:0x%lx to line-side:0x%lx; status:%d", systemPort, linePort, status);
SWSS_LOG_ERROR("BOX: Failed to connect Gearbox system-side:0x%" PRIx64 " to line-side:0x%" PRIx64 "; status:%d", systemPort, linePort, status);
return false;
}

SWSS_LOG_NOTICE("BOX: Connected Gearbox ports; system-side:0x%lx to line-side:0x%lx", systemPort, linePort);
SWSS_LOG_NOTICE("BOX: Connected Gearbox ports; system-side:0x%" PRIx64 " to line-side:0x%" PRIx64, systemPort, linePort);
m_gearboxPortListLaneMap[port.m_port_id] = make_tuple(systemPort, linePort);
}
}
Expand Down
5 changes: 3 additions & 2 deletions orchagent/saihelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ extern "C" {
#include "saiextensions.h"
}

#include <inttypes.h>
#include <string.h>
#include <fstream>
#include <map>
Expand Down Expand Up @@ -256,7 +257,7 @@ void initSaiRedis(const string &record_location)

if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to notify syncd INIT_VIEW, rv:%d gSwitchId %lx", status, gSwitchId);
SWSS_LOG_ERROR("Failed to notify syncd INIT_VIEW, rv:%d gSwitchId %" PRIx64, status, gSwitchId);
exit(EXIT_FAILURE);
}
SWSS_LOG_NOTICE("Notify syncd INIT_VIEW");
Expand Down Expand Up @@ -320,7 +321,7 @@ sai_status_t initSaiPhyApi(swss::gearbox_phy_t *phy)
SWSS_LOG_ERROR("BOX: Failed to create PHY:%d rtn:%d", phy->phy_id, status);
return status;
}
SWSS_LOG_NOTICE("BOX: Created PHY:%d Oid:0x%lx", phy->phy_id, phyOid);
SWSS_LOG_NOTICE("BOX: Created PHY:%d Oid:0x%" PRIx64, phy->phy_id, phyOid);

phy->phy_oid = sai_serialize_object_id(phyOid);

Expand Down

0 comments on commit bed7970

Please sign in to comment.