openflow: Move ReceivePortMod() to fix (erroneous) Doxygen warning

This commit is contained in:
Eduardo Almeida
2023-07-14 14:17:47 +00:00
parent 10e0166b43
commit 941536313a
2 changed files with 44 additions and 44 deletions

View File

@@ -1165,6 +1165,49 @@ OpenFlowSwitchNetDevice::RunThroughVPortTable(uint32_t packet_uid, int port, uin
return 0;
}
int
OpenFlowSwitchNetDevice::ReceivePortMod(const void* msg)
{
ofp_port_mod* opm = (ofp_port_mod*)msg;
int port = opm->port_no; // ntohs(opm->port_no);
if (port < DP_MAX_PORTS)
{
ofi::Port& p = m_ports[port];
// Make sure the port id hasn't changed since this was sent
Mac48Address hw_addr = Mac48Address();
hw_addr.CopyFrom(opm->hw_addr);
if (p.netdev->GetAddress() != hw_addr)
{
return 0;
}
if (opm->mask)
{
uint32_t config_mask = ntohl(opm->mask);
p.config &= ~config_mask;
p.config |= ntohl(opm->config) & config_mask;
}
if (opm->mask & htonl(OFPPC_PORT_DOWN))
{
if ((opm->config & htonl(OFPPC_PORT_DOWN)) && (p.config & OFPPC_PORT_DOWN) == 0)
{
p.config |= OFPPC_PORT_DOWN;
/// \todo Possibly disable the Port's Net Device via the appropriate interface.
}
else if ((opm->config & htonl(OFPPC_PORT_DOWN)) == 0 && (p.config & OFPPC_PORT_DOWN))
{
p.config &= ~OFPPC_PORT_DOWN;
/// \todo Possibly enable the Port's Net Device via the appropriate interface.
}
}
}
return 0;
}
int
OpenFlowSwitchNetDevice::ReceiveFeaturesRequest(const void* msg)
{
@@ -1252,49 +1295,6 @@ OpenFlowSwitchNetDevice::ReceivePacketOut(const void* msg)
return 0;
}
int
OpenFlowSwitchNetDevice::ReceivePortMod(const void* msg)
{
ofp_port_mod* opm = (ofp_port_mod*)msg;
int port = opm->port_no; // ntohs(opm->port_no);
if (port < DP_MAX_PORTS)
{
ofi::Port& p = m_ports[port];
// Make sure the port id hasn't changed since this was sent
Mac48Address hw_addr = Mac48Address();
hw_addr.CopyFrom(opm->hw_addr);
if (p.netdev->GetAddress() != hw_addr)
{
return 0;
}
if (opm->mask)
{
uint32_t config_mask = ntohl(opm->mask);
p.config &= ~config_mask;
p.config |= ntohl(opm->config) & config_mask;
}
if (opm->mask & htonl(OFPPC_PORT_DOWN))
{
if ((opm->config & htonl(OFPPC_PORT_DOWN)) && (p.config & OFPPC_PORT_DOWN) == 0)
{
p.config |= OFPPC_PORT_DOWN;
/// \todo Possibly disable the Port's Net Device via the appropriate interface.
}
else if ((opm->config & htonl(OFPPC_PORT_DOWN)) == 0 && (p.config & OFPPC_PORT_DOWN))
{
p.config &= ~OFPPC_PORT_DOWN;
/// \todo Possibly enable the Port's Net Device via the appropriate interface.
}
}
}
return 0;
}
// add or remove a virtual port table entry
int
OpenFlowSwitchNetDevice::ReceiveVPortMod(const void* msg)

View File

@@ -503,12 +503,12 @@ class OpenFlowSwitchNetDevice : public NetDevice
* \param msg The OpenFlow message received.
* \return 0 if everything's ok, otherwise an error number.
*/
int ReceivePortMod(const void* msg);
int ReceiveFeaturesRequest(const void* msg);
int ReceiveGetConfigRequest(const void* msg);
int ReceiveSetConfig(const void* msg);
int ReceivePacketOut(const void* msg);
int ReceiveFlow(const void* msg);
int ReceivePortMod(const void* msg);
int ReceiveStatsRequest(const void* msg);
int ReceiveEchoRequest(const void* msg);
int ReceiveEchoReply(const void* msg);